feat(rust-provider): add cross-runtime Rust provider tests and docs; simplify bridge event handling and bump tstest

This commit is contained in:
2026-03-06 11:35:02 +00:00
parent 647cb5e92f
commit a90ae28321
8 changed files with 61 additions and 32 deletions

View File

@@ -1,5 +1,13 @@
# Changelog # 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) ## 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 Add Rust-backed provider with XFS-safe durability via IPC bridge, TypeScript provider, tests and docs

19
deno.lock generated
View File

@@ -5,7 +5,7 @@
"npm:@git.zone/tsbundle@^2.9.1": "2.9.1", "npm:@git.zone/tsbundle@^2.9.1": "2.9.1",
"npm:@git.zone/tsrun@^2.0.1": "2.0.1", "npm:@git.zone/tsrun@^2.0.1": "2.0.1",
"npm:@git.zone/tsrust@^1.3.0": "1.3.0", "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/smartpath@6": "6.0.0",
"npm:@push.rocks/smartrust@^1.3.1": "1.3.1", "npm:@push.rocks/smartrust@^1.3.1": "1.3.1",
"npm:@push.rocks/tapbundle@^6.0.3": "6.0.3", "npm:@push.rocks/tapbundle@^6.0.3": "6.0.3",
@@ -1073,8 +1073,8 @@
"bin": true, "bin": true,
"tarball": "https://verdaccio.lossless.digital/@git.zone/tsrust/-/tsrust-1.3.0.tgz" "tarball": "https://verdaccio.lossless.digital/@git.zone/tsrust/-/tsrust-1.3.0.tgz"
}, },
"@git.zone/tstest@3.2.0": { "@git.zone/tstest@3.3.0": {
"integrity": "sha512-NXJkgfaBL1owmhC4rW+ikPWQWkXK4s1R0akbMdqZ8MiaW5+Gs1xYZ+iEPRzsGS0s0P+4VS7Y+hCnAjCL90AcIg==", "integrity": "sha512-+j/XW7/XM3JAhlJEvITrGWlfeq4WCq2aODxKupboPXFLJTikwv3lxojcr4T/6RJ3Y3GCWYxWfzcjjw6ELi5phg==",
"dependencies": [ "dependencies": [
"@api.global/typedserver", "@api.global/typedserver",
"@git.zone/tsbundle", "@git.zone/tsbundle",
@@ -1104,7 +1104,7 @@
"ws@8.19.0" "ws@8.19.0"
], ],
"bin": true, "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": { "@hapi/bourne@3.0.0": {
"integrity": "sha512-Waj1cwPXJDucOib4a3bAISsKJVb15MKi9IvmTI/7ssVEm6sywXGjVJDhl6/umt1pK1ZS7PacXU3A1PmFKHEZ2w==", "integrity": "sha512-Waj1cwPXJDucOib4a3bAISsKJVb15MKi9IvmTI/7ssVEm6sywXGjVJDhl6/umt1pK1ZS7PacXU3A1PmFKHEZ2w==",
@@ -2020,12 +2020,13 @@
], ],
"tarball": "https://verdaccio.lossless.digital/@push.rocks/smartfile/-/smartfile-13.1.2.tgz" "tarball": "https://verdaccio.lossless.digital/@push.rocks/smartfile/-/smartfile-13.1.2.tgz"
}, },
"@push.rocks/smartfs@1.3.3": { "@push.rocks/smartfs@1.4.0": {
"integrity": "sha512-IF16dgeDFDv65j+lhyhqjhm6gFhBrWTrnayVOCwbBg4yJ/6tNpd7sL8YsvBJRBRCBWrMFBCSL7thG0Thvq0VZA==", "integrity": "sha512-4PgteGOyMBiUWKLfTXOjxrZz+sXPLnvcmHeAEHY2gwZJflfp5/YDVPhodctOydersXzkynO359dIGLSCyQnnAQ==",
"dependencies": [ "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": { "@push.rocks/smartguard@3.1.0": {
"integrity": "sha512-J23q84f1O+TwFGmd4lrO9XLHUh2DaLXo9PN/9VmTWYzTkQDv5JehmifXVI0esophXcCIfbdIu6hbt7/aHlDF4A==", "integrity": "sha512-J23q84f1O+TwFGmd4lrO9XLHUh2DaLXo9PN/9VmTWYzTkQDv5JehmifXVI0esophXcCIfbdIu6hbt7/aHlDF4A==",
@@ -8765,7 +8766,7 @@
"npm:@git.zone/tsbundle@^2.9.1", "npm:@git.zone/tsbundle@^2.9.1",
"npm:@git.zone/tsrun@^2.0.1", "npm:@git.zone/tsrun@^2.0.1",
"npm:@git.zone/tsrust@^1.3.0", "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/smartpath@6",
"npm:@push.rocks/smartrust@^1.3.1", "npm:@push.rocks/smartrust@^1.3.1",
"npm:@push.rocks/tapbundle@^6.0.3", "npm:@push.rocks/tapbundle@^6.0.3",

View File

@@ -18,7 +18,7 @@
"@git.zone/tsbundle": "^2.9.1", "@git.zone/tsbundle": "^2.9.1",
"@git.zone/tsrun": "^2.0.1", "@git.zone/tsrun": "^2.0.1",
"@git.zone/tsrust": "^1.3.0", "@git.zone/tsrust": "^1.3.0",
"@git.zone/tstest": "^3.2.0", "@git.zone/tstest": "^3.3.0",
"@push.rocks/tapbundle": "^6.0.3", "@push.rocks/tapbundle": "^6.0.3",
"@types/node": "^25.3.3" "@types/node": "^25.3.3"
}, },

24
pnpm-lock.yaml generated
View File

@@ -28,8 +28,8 @@ importers:
specifier: ^1.3.0 specifier: ^1.3.0
version: 1.3.0 version: 1.3.0
'@git.zone/tstest': '@git.zone/tstest':
specifier: ^3.2.0 specifier: ^3.3.0
version: 3.2.0(@tiptap/pm@2.27.2)(socks@2.8.7)(typescript@5.9.3) version: 3.3.0(@tiptap/pm@2.27.2)(socks@2.8.7)(typescript@5.9.3)
'@push.rocks/tapbundle': '@push.rocks/tapbundle':
specifier: ^6.0.3 specifier: ^6.0.3
version: 6.0.3(socks@2.8.7) version: 6.0.3(socks@2.8.7)
@@ -492,8 +492,8 @@ packages:
resolution: {integrity: sha512-dvmTAiM04Pkd7J1Gail3fu7aasmILQhC5vKL71/g6HYhpvl16/c+Dj3We5G4HsFr0jvAr+Xu570ZGEuZrtRcCg==} resolution: {integrity: sha512-dvmTAiM04Pkd7J1Gail3fu7aasmILQhC5vKL71/g6HYhpvl16/c+Dj3We5G4HsFr0jvAr+Xu570ZGEuZrtRcCg==}
hasBin: true hasBin: true
'@git.zone/tstest@3.2.0': '@git.zone/tstest@3.3.0':
resolution: {integrity: sha512-NXJkgfaBL1owmhC4rW+ikPWQWkXK4s1R0akbMdqZ8MiaW5+Gs1xYZ+iEPRzsGS0s0P+4VS7Y+hCnAjCL90AcIg==} resolution: {integrity: sha512-+j/XW7/XM3JAhlJEvITrGWlfeq4WCq2aODxKupboPXFLJTikwv3lxojcr4T/6RJ3Y3GCWYxWfzcjjw6ELi5phg==}
hasBin: true hasBin: true
'@hapi/bourne@3.0.0': '@hapi/bourne@3.0.0':
@@ -888,6 +888,9 @@ packages:
'@push.rocks/smartfs@1.3.3': '@push.rocks/smartfs@1.3.3':
resolution: {integrity: sha512-IF16dgeDFDv65j+lhyhqjhm6gFhBrWTrnayVOCwbBg4yJ/6tNpd7sL8YsvBJRBRCBWrMFBCSL7thG0Thvq0VZA==} resolution: {integrity: sha512-IF16dgeDFDv65j+lhyhqjhm6gFhBrWTrnayVOCwbBg4yJ/6tNpd7sL8YsvBJRBRCBWrMFBCSL7thG0Thvq0VZA==}
'@push.rocks/smartfs@1.4.0':
resolution: {integrity: sha512-4PgteGOyMBiUWKLfTXOjxrZz+sXPLnvcmHeAEHY2gwZJflfp5/YDVPhodctOydersXzkynO359dIGLSCyQnnAQ==}
'@push.rocks/smartguard@3.1.0': '@push.rocks/smartguard@3.1.0':
resolution: {integrity: sha512-J23q84f1O+TwFGmd4lrO9XLHUh2DaLXo9PN/9VmTWYzTkQDv5JehmifXVI0esophXcCIfbdIu6hbt7/aHlDF4A==} resolution: {integrity: sha512-J23q84f1O+TwFGmd4lrO9XLHUh2DaLXo9PN/9VmTWYzTkQDv5JehmifXVI0esophXcCIfbdIu6hbt7/aHlDF4A==}
@@ -4680,7 +4683,7 @@ snapshots:
'@push.rocks/smartenv': 6.0.0 '@push.rocks/smartenv': 6.0.0
'@push.rocks/smartfeed': 1.4.0 '@push.rocks/smartfeed': 1.4.0
'@push.rocks/smartfile': 13.1.2 '@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/smartjson': 5.2.0
'@push.rocks/smartlog': 3.2.1 '@push.rocks/smartlog': 3.2.1
'@push.rocks/smartlog-destination-devtools': 1.0.12 '@push.rocks/smartlog-destination-devtools': 1.0.12
@@ -5588,7 +5591,7 @@ snapshots:
- supports-color - supports-color
- vue - 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: dependencies:
'@api.global/typedserver': 8.4.2(@tiptap/pm@2.27.2) '@api.global/typedserver': 8.4.2(@tiptap/pm@2.27.2)
'@git.zone/tsbundle': 2.9.1 '@git.zone/tsbundle': 2.9.1
@@ -5601,7 +5604,7 @@ snapshots:
'@push.rocks/smartenv': 6.0.0 '@push.rocks/smartenv': 6.0.0
'@push.rocks/smartexpect': 2.5.0 '@push.rocks/smartexpect': 2.5.0
'@push.rocks/smartfile': 13.1.2 '@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/smartjson': 6.0.0
'@push.rocks/smartlog': 3.2.1 '@push.rocks/smartlog': 3.2.1
'@push.rocks/smartmongo': 5.1.0(socks@2.8.7) '@push.rocks/smartmongo': 5.1.0(socks@2.8.7)
@@ -6387,6 +6390,11 @@ snapshots:
dependencies: dependencies:
'@push.rocks/smartpath': 6.0.0 '@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': '@push.rocks/smartguard@3.1.0':
dependencies: dependencies:
'@push.rocks/smartpromise': 4.2.3 '@push.rocks/smartpromise': 4.2.3
@@ -6517,7 +6525,7 @@ snapshots:
dependencies: dependencies:
'@push.rocks/mongodump': 1.1.0(socks@2.8.7) '@push.rocks/mongodump': 1.1.0(socks@2.8.7)
'@push.rocks/smartdata': 5.16.7(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/smartpath': 5.1.0
'@push.rocks/smartpromise': 4.2.3 '@push.rocks/smartpromise': 4.2.3
'@push.rocks/smartrx': 3.0.10 '@push.rocks/smartrx': 3.0.10

View File

@@ -15,8 +15,10 @@ For reporting bugs, issues, or security vulnerabilities, please visit [community
- 💾 **Transactions** — Atomic multi-file operations with automatic rollback on failure - 💾 **Transactions** — Atomic multi-file operations with automatic rollback on failure
- 👀 **File Watching** — Event-based filesystem monitoring with debounce, filters, and recursive watching - 👀 **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 - 🔐 **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 -**Async-Only** — Modern `async`/`await` patterns throughout — no sync footguns
- 🎨 **TypeScript-First** — Full type safety, IntelliSense, and exported interfaces - 🎨 **TypeScript-First** — Full type safety, IntelliSense, and exported interfaces
- 🌍 **Multi-Runtime** — Works on Node.js, Bun, and Deno
## Installation ## Installation
@@ -480,16 +482,31 @@ SmartFS is fully typed. All interfaces and types are exported:
```typescript ```typescript
import type { import type {
// Provider interface
ISmartFsProvider, ISmartFsProvider,
IProviderCapabilities, IProviderCapabilities,
IFileStats, TWatchCallback,
IDirectoryEntry, IWatcherHandle,
IWatchEvent,
ITransactionOperation, // Core types
ITreeHashOptions,
TEncoding, // 'utf8' | 'utf-8' | 'ascii' | 'base64' | 'hex' | 'binary' | 'buffer' TEncoding, // 'utf8' | 'utf-8' | 'ascii' | 'base64' | 'hex' | 'binary' | 'buffer'
TFileMode, // number TFileMode, // number
IFileStats,
IDirectoryEntry,
// Watch types
TWatchEventType, // 'add' | 'change' | 'delete' TWatchEventType, // 'add' | 'change' | 'delete'
IWatchEvent,
IWatchOptions,
// Operation types
TTransactionOperationType, // 'write' | 'delete' | 'copy' | 'move' | 'append'
ITransactionOperation,
IReadOptions,
IWriteOptions,
IStreamOptions,
ICopyOptions,
IListOptions,
} from '@push.rocks/smartfs'; } from '@push.rocks/smartfs';
``` ```

View File

@@ -1,3 +1,4 @@
// tstest:deno:allowAll
/** /**
* Tests for Rust provider * Tests for Rust provider
*/ */

View File

@@ -3,6 +3,6 @@
*/ */
export const commitinfo = { export const commitinfo = {
name: '@push.rocks/smartfs', name: '@push.rocks/smartfs',
version: '1.4.0', version: '1.5.0',
description: 'a cross platform extendable fs module' description: 'a cross platform extendable fs module'
} }

View File

@@ -168,14 +168,8 @@ export class SmartFsProviderRust implements ISmartFsProvider {
} }
this.initialized = true; this.initialized = true;
// Set up watch event forwarding // The bridge already inherits .on() from EventEmitter.
// The bridge emits events as 'management:<eventName>' // Watch events from Rust arrive as 'management:watch:<id>'.
// Watch events come as 'management:watch:<id>'
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;
} }
} }