From a90ae283211f24fa417958f189e70b9d44e7392d Mon Sep 17 00:00:00 2001 From: Juergen Kunz Date: Fri, 6 Mar 2026 11:35:02 +0000 Subject: [PATCH] feat(rust-provider): add cross-runtime Rust provider tests and docs; simplify bridge event handling and bump tstest --- changelog.md | 8 ++++++ deno.lock | 19 ++++++------- package.json | 2 +- pnpm-lock.yaml | 24 +++++++++++------ readme.md | 27 +++++++++++++++---- ...ts => test.rust.provider.node+bun+deno.ts} | 1 + ts/00_commitinfo_data.ts | 2 +- ts/providers/smartfs.provider.rust.ts | 10 ++----- 8 files changed, 61 insertions(+), 32 deletions(-) rename test/{test.rust.provider.node+bun.ts => test.rust.provider.node+bun+deno.ts} (99%) diff --git a/changelog.md b/changelog.md index 7923255..d58df9d 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,13 @@ # Changelog +## 2026-03-06 - 1.5.0 - feat(rust-provider) +add cross-runtime Rust provider tests and docs; simplify bridge event handling and bump tstest + +- Added comprehensive Rust provider test file supporting Node, Bun and Deno (test/test.rust.provider.node+bun+deno.ts) and removed the older node+bun-only test +- Simplified Rust provider bridge startup by removing a custom .on() override and relying on the bridge's inherited EventEmitter behavior +- Updated readme with new features: Directory Copy & Move, Multi-Runtime support, and expanded exported type list in examples +- Bumped dev dependency @git.zone/tstest from ^3.2.0 to ^3.3.0 + ## 2026-03-05 - 1.4.0 - feat(rust-provider) Add Rust-backed provider with XFS-safe durability via IPC bridge, TypeScript provider, tests and docs diff --git a/deno.lock b/deno.lock index a19c558..079496e 100644 --- a/deno.lock +++ b/deno.lock @@ -5,7 +5,7 @@ "npm:@git.zone/tsbundle@^2.9.1": "2.9.1", "npm:@git.zone/tsrun@^2.0.1": "2.0.1", "npm:@git.zone/tsrust@^1.3.0": "1.3.0", - "npm:@git.zone/tstest@^3.2.0": "3.2.0", + "npm:@git.zone/tstest@^3.3.0": "3.3.0", "npm:@push.rocks/smartpath@6": "6.0.0", "npm:@push.rocks/smartrust@^1.3.1": "1.3.1", "npm:@push.rocks/tapbundle@^6.0.3": "6.0.3", @@ -1073,8 +1073,8 @@ "bin": true, "tarball": "https://verdaccio.lossless.digital/@git.zone/tsrust/-/tsrust-1.3.0.tgz" }, - "@git.zone/tstest@3.2.0": { - "integrity": "sha512-NXJkgfaBL1owmhC4rW+ikPWQWkXK4s1R0akbMdqZ8MiaW5+Gs1xYZ+iEPRzsGS0s0P+4VS7Y+hCnAjCL90AcIg==", + "@git.zone/tstest@3.3.0": { + "integrity": "sha512-+j/XW7/XM3JAhlJEvITrGWlfeq4WCq2aODxKupboPXFLJTikwv3lxojcr4T/6RJ3Y3GCWYxWfzcjjw6ELi5phg==", "dependencies": [ "@api.global/typedserver", "@git.zone/tsbundle", @@ -1104,7 +1104,7 @@ "ws@8.19.0" ], "bin": true, - "tarball": "https://verdaccio.lossless.digital/@git.zone/tstest/-/tstest-3.2.0.tgz" + "tarball": "https://verdaccio.lossless.digital/@git.zone/tstest/-/tstest-3.3.0.tgz" }, "@hapi/bourne@3.0.0": { "integrity": "sha512-Waj1cwPXJDucOib4a3bAISsKJVb15MKi9IvmTI/7ssVEm6sywXGjVJDhl6/umt1pK1ZS7PacXU3A1PmFKHEZ2w==", @@ -2020,12 +2020,13 @@ ], "tarball": "https://verdaccio.lossless.digital/@push.rocks/smartfile/-/smartfile-13.1.2.tgz" }, - "@push.rocks/smartfs@1.3.3": { - "integrity": "sha512-IF16dgeDFDv65j+lhyhqjhm6gFhBrWTrnayVOCwbBg4yJ/6tNpd7sL8YsvBJRBRCBWrMFBCSL7thG0Thvq0VZA==", + "@push.rocks/smartfs@1.4.0": { + "integrity": "sha512-4PgteGOyMBiUWKLfTXOjxrZz+sXPLnvcmHeAEHY2gwZJflfp5/YDVPhodctOydersXzkynO359dIGLSCyQnnAQ==", "dependencies": [ - "@push.rocks/smartpath@6.0.0" + "@push.rocks/smartpath@6.0.0", + "@push.rocks/smartrust" ], - "tarball": "https://verdaccio.lossless.digital/@push.rocks/smartfs/-/smartfs-1.3.3.tgz" + "tarball": "https://verdaccio.lossless.digital/@push.rocks/smartfs/-/smartfs-1.4.0.tgz" }, "@push.rocks/smartguard@3.1.0": { "integrity": "sha512-J23q84f1O+TwFGmd4lrO9XLHUh2DaLXo9PN/9VmTWYzTkQDv5JehmifXVI0esophXcCIfbdIu6hbt7/aHlDF4A==", @@ -8765,7 +8766,7 @@ "npm:@git.zone/tsbundle@^2.9.1", "npm:@git.zone/tsrun@^2.0.1", "npm:@git.zone/tsrust@^1.3.0", - "npm:@git.zone/tstest@^3.2.0", + "npm:@git.zone/tstest@^3.3.0", "npm:@push.rocks/smartpath@6", "npm:@push.rocks/smartrust@^1.3.1", "npm:@push.rocks/tapbundle@^6.0.3", diff --git a/package.json b/package.json index bea7fb1..335a0d0 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "@git.zone/tsbundle": "^2.9.1", "@git.zone/tsrun": "^2.0.1", "@git.zone/tsrust": "^1.3.0", - "@git.zone/tstest": "^3.2.0", + "@git.zone/tstest": "^3.3.0", "@push.rocks/tapbundle": "^6.0.3", "@types/node": "^25.3.3" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f3678a5..583027e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -28,8 +28,8 @@ importers: specifier: ^1.3.0 version: 1.3.0 '@git.zone/tstest': - specifier: ^3.2.0 - version: 3.2.0(@tiptap/pm@2.27.2)(socks@2.8.7)(typescript@5.9.3) + specifier: ^3.3.0 + version: 3.3.0(@tiptap/pm@2.27.2)(socks@2.8.7)(typescript@5.9.3) '@push.rocks/tapbundle': specifier: ^6.0.3 version: 6.0.3(socks@2.8.7) @@ -492,8 +492,8 @@ packages: resolution: {integrity: sha512-dvmTAiM04Pkd7J1Gail3fu7aasmILQhC5vKL71/g6HYhpvl16/c+Dj3We5G4HsFr0jvAr+Xu570ZGEuZrtRcCg==} hasBin: true - '@git.zone/tstest@3.2.0': - resolution: {integrity: sha512-NXJkgfaBL1owmhC4rW+ikPWQWkXK4s1R0akbMdqZ8MiaW5+Gs1xYZ+iEPRzsGS0s0P+4VS7Y+hCnAjCL90AcIg==} + '@git.zone/tstest@3.3.0': + resolution: {integrity: sha512-+j/XW7/XM3JAhlJEvITrGWlfeq4WCq2aODxKupboPXFLJTikwv3lxojcr4T/6RJ3Y3GCWYxWfzcjjw6ELi5phg==} hasBin: true '@hapi/bourne@3.0.0': @@ -888,6 +888,9 @@ packages: '@push.rocks/smartfs@1.3.3': resolution: {integrity: sha512-IF16dgeDFDv65j+lhyhqjhm6gFhBrWTrnayVOCwbBg4yJ/6tNpd7sL8YsvBJRBRCBWrMFBCSL7thG0Thvq0VZA==} + '@push.rocks/smartfs@1.4.0': + resolution: {integrity: sha512-4PgteGOyMBiUWKLfTXOjxrZz+sXPLnvcmHeAEHY2gwZJflfp5/YDVPhodctOydersXzkynO359dIGLSCyQnnAQ==} + '@push.rocks/smartguard@3.1.0': resolution: {integrity: sha512-J23q84f1O+TwFGmd4lrO9XLHUh2DaLXo9PN/9VmTWYzTkQDv5JehmifXVI0esophXcCIfbdIu6hbt7/aHlDF4A==} @@ -4680,7 +4683,7 @@ snapshots: '@push.rocks/smartenv': 6.0.0 '@push.rocks/smartfeed': 1.4.0 '@push.rocks/smartfile': 13.1.2 - '@push.rocks/smartfs': 1.3.3 + '@push.rocks/smartfs': 1.4.0 '@push.rocks/smartjson': 5.2.0 '@push.rocks/smartlog': 3.2.1 '@push.rocks/smartlog-destination-devtools': 1.0.12 @@ -5588,7 +5591,7 @@ snapshots: - supports-color - vue - '@git.zone/tstest@3.2.0(@tiptap/pm@2.27.2)(socks@2.8.7)(typescript@5.9.3)': + '@git.zone/tstest@3.3.0(@tiptap/pm@2.27.2)(socks@2.8.7)(typescript@5.9.3)': dependencies: '@api.global/typedserver': 8.4.2(@tiptap/pm@2.27.2) '@git.zone/tsbundle': 2.9.1 @@ -5601,7 +5604,7 @@ snapshots: '@push.rocks/smartenv': 6.0.0 '@push.rocks/smartexpect': 2.5.0 '@push.rocks/smartfile': 13.1.2 - '@push.rocks/smartfs': 1.3.3 + '@push.rocks/smartfs': 1.4.0 '@push.rocks/smartjson': 6.0.0 '@push.rocks/smartlog': 3.2.1 '@push.rocks/smartmongo': 5.1.0(socks@2.8.7) @@ -6387,6 +6390,11 @@ snapshots: dependencies: '@push.rocks/smartpath': 6.0.0 + '@push.rocks/smartfs@1.4.0': + dependencies: + '@push.rocks/smartpath': 6.0.0 + '@push.rocks/smartrust': 1.3.1 + '@push.rocks/smartguard@3.1.0': dependencies: '@push.rocks/smartpromise': 4.2.3 @@ -6517,7 +6525,7 @@ snapshots: dependencies: '@push.rocks/mongodump': 1.1.0(socks@2.8.7) '@push.rocks/smartdata': 5.16.7(socks@2.8.7) - '@push.rocks/smartfs': 1.3.3 + '@push.rocks/smartfs': 1.4.0 '@push.rocks/smartpath': 5.1.0 '@push.rocks/smartpromise': 4.2.3 '@push.rocks/smartrx': 3.0.10 diff --git a/readme.md b/readme.md index b1f4851..8b10ae4 100644 --- a/readme.md +++ b/readme.md @@ -15,8 +15,10 @@ For reporting bugs, issues, or security vulnerabilities, please visit [community - 💾 **Transactions** — Atomic multi-file operations with automatic rollback on failure - 👀 **File Watching** — Event-based filesystem monitoring with debounce, filters, and recursive watching - 🔐 **Tree Hashing** — Deterministic SHA-256 directory hashing for cache-busting and change detection +- 📁 **Directory Copy & Move** — Full directory tree operations with conflict handling, filtering, and timestamp preservation - ⚡ **Async-Only** — Modern `async`/`await` patterns throughout — no sync footguns - 🎨 **TypeScript-First** — Full type safety, IntelliSense, and exported interfaces +- 🌍 **Multi-Runtime** — Works on Node.js, Bun, and Deno ## Installation @@ -480,16 +482,31 @@ SmartFS is fully typed. All interfaces and types are exported: ```typescript import type { + // Provider interface ISmartFsProvider, IProviderCapabilities, - IFileStats, - IDirectoryEntry, - IWatchEvent, - ITransactionOperation, - ITreeHashOptions, + TWatchCallback, + IWatcherHandle, + + // Core types TEncoding, // 'utf8' | 'utf-8' | 'ascii' | 'base64' | 'hex' | 'binary' | 'buffer' TFileMode, // number + IFileStats, + IDirectoryEntry, + + // Watch types TWatchEventType, // 'add' | 'change' | 'delete' + IWatchEvent, + IWatchOptions, + + // Operation types + TTransactionOperationType, // 'write' | 'delete' | 'copy' | 'move' | 'append' + ITransactionOperation, + IReadOptions, + IWriteOptions, + IStreamOptions, + ICopyOptions, + IListOptions, } from '@push.rocks/smartfs'; ``` diff --git a/test/test.rust.provider.node+bun.ts b/test/test.rust.provider.node+bun+deno.ts similarity index 99% rename from test/test.rust.provider.node+bun.ts rename to test/test.rust.provider.node+bun+deno.ts index 2af1ef8..c3aad32 100644 --- a/test/test.rust.provider.node+bun.ts +++ b/test/test.rust.provider.node+bun+deno.ts @@ -1,3 +1,4 @@ +// tstest:deno:allowAll /** * Tests for Rust provider */ diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index 5a575b2..30e1563 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@push.rocks/smartfs', - version: '1.4.0', + version: '1.5.0', description: 'a cross platform extendable fs module' } diff --git a/ts/providers/smartfs.provider.rust.ts b/ts/providers/smartfs.provider.rust.ts index 316e963..0f3d979 100644 --- a/ts/providers/smartfs.provider.rust.ts +++ b/ts/providers/smartfs.provider.rust.ts @@ -168,14 +168,8 @@ export class SmartFsProviderRust implements ISmartFsProvider { } this.initialized = true; - // Set up watch event forwarding - // The bridge emits events as 'management:' - // Watch events come as 'management:watch:' - const originalEmit = this.bridge.emit.bind(this.bridge); - this.bridge.on = ((event: string, handler: (...args: any[]) => void) => { - // Intercept watch events - return (this.bridge as any).__proto__.on.call(this.bridge, event, handler); - }) as any; + // The bridge already inherits .on() from EventEmitter. + // Watch events from Rust arrive as 'management:watch:'. } }