@componentor/fs 3.0.18 → 3.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -82,6 +82,7 @@ const fs = new VFSFileSystem({
|
|
|
82
82
|
strictPermissions: false, // Enforce Unix permissions (default: false)
|
|
83
83
|
sabSize: 4194304, // SharedArrayBuffer size in bytes (default: 4MB)
|
|
84
84
|
debug: false, // Enable debug logging (default: false)
|
|
85
|
+
swUrl: undefined, // URL of the service worker script (default: auto-resolved)
|
|
85
86
|
swScope: undefined, // Custom service worker scope (default: auto-scoped per root)
|
|
86
87
|
limits: { // Upper bounds for VFS validation (prevents corrupt data from causing OOM)
|
|
87
88
|
maxInodes: 4_000_000, // Max inode count (default: 4M)
|
|
@@ -160,6 +161,30 @@ console.log(fs.mode); // 'hybrid'
|
|
|
160
161
|
|
|
161
162
|
`setMode()` terminates internal workers, allocates fresh shared memory, and reinitializes the filesystem in the requested mode.
|
|
162
163
|
|
|
164
|
+
### Service Worker Setup (Multi-Tab)
|
|
165
|
+
|
|
166
|
+
Multi-tab coordination requires a service worker that acts as a MessagePort broker between tabs. The built service worker is shipped at `dist/workers/service.worker.js`. Unlike regular workers (which are resolved by the bundler), **service workers must be served as a real file at a public URL**.
|
|
167
|
+
|
|
168
|
+
Most bundlers (Vite, webpack) handle `new URL('./workers/service.worker.js', import.meta.url)` automatically, but if the default resolution doesn't work in your setup, use the `swUrl` option:
|
|
169
|
+
|
|
170
|
+
```typescript
|
|
171
|
+
const fs = new VFSFileSystem({
|
|
172
|
+
swUrl: '/vfs-service-worker.js', // your public URL
|
|
173
|
+
});
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
**Vite example** — copy the file to `public/`:
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
cp node_modules/@componentor/fs/dist/workers/service.worker.js public/vfs-service-worker.js
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
```typescript
|
|
183
|
+
const fs = new VFSFileSystem({ swUrl: '/vfs-service-worker.js' });
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
If you only use a single tab, the service worker is not needed — the tab always runs as the leader.
|
|
187
|
+
|
|
163
188
|
## COOP/COEP Headers
|
|
164
189
|
|
|
165
190
|
To enable the sync API, your page must be `crossOriginIsolated`. Add these headers:
|
|
@@ -577,6 +602,12 @@ Make sure `opfsSync` is enabled (it's `true` by default). Files are mirrored to
|
|
|
577
602
|
|
|
578
603
|
## Changelog
|
|
579
604
|
|
|
605
|
+
### v3.0.19 (2026)
|
|
606
|
+
|
|
607
|
+
**Features:**
|
|
608
|
+
- Add `swUrl` config option to specify a custom service worker URL for multi-tab support in bundled environments where the default auto-resolved URL doesn't work
|
|
609
|
+
- Remove `type: 'module'` from service worker registration (built output is plain script, not ESM)
|
|
610
|
+
|
|
580
611
|
### v3.0.18 (2026)
|
|
581
612
|
|
|
582
613
|
**Features:**
|
package/package.json
CHANGED