@componentor/fs 3.0.19 → 3.0.20
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 +1 -1
- package/dist/index.d.mts +5 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -602,7 +602,7 @@ Make sure `opfsSync` is enabled (it's `true` by default). Files are mirrored to
|
|
|
602
602
|
|
|
603
603
|
## Changelog
|
|
604
604
|
|
|
605
|
-
### v3.0.19 (2026)
|
|
605
|
+
### v3.0.19-v3.0.20 (2026)
|
|
606
606
|
|
|
607
607
|
**Features:**
|
|
608
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
|
package/dist/index.d.mts
CHANGED
|
@@ -167,8 +167,12 @@ interface VFSConfig {
|
|
|
167
167
|
strictPermissions?: boolean;
|
|
168
168
|
sabSize?: number;
|
|
169
169
|
debug?: boolean;
|
|
170
|
+
/** URL of the service worker script. Defaults to `'./workers/service.worker.js'`
|
|
171
|
+
* relative to `import.meta.url`. Override when the library is bundled and the
|
|
172
|
+
* default relative URL no longer resolves to the correct location. */
|
|
173
|
+
swUrl?: string;
|
|
170
174
|
/** Scope for the internal service worker registration. Defaults to
|
|
171
|
-
* `'
|
|
175
|
+
* `'./${ns}/'` (relative to the SW script URL) so it won't collide
|
|
172
176
|
* with the host application's service worker. */
|
|
173
177
|
swScope?: string;
|
|
174
178
|
/** Upper bounds for VFS validation (prevents corrupt data from causing OOM/hangs). */
|
package/dist/index.js
CHANGED
|
@@ -1351,6 +1351,7 @@ var VFSFileSystem = class {
|
|
|
1351
1351
|
strictPermissions: config.strictPermissions ?? false,
|
|
1352
1352
|
sabSize: config.sabSize ?? DEFAULT_SAB_SIZE,
|
|
1353
1353
|
debug: config.debug ?? false,
|
|
1354
|
+
swUrl: config.swUrl,
|
|
1354
1355
|
swScope: config.swScope,
|
|
1355
1356
|
limits: config.limits
|
|
1356
1357
|
};
|
|
@@ -1560,9 +1561,9 @@ var VFSFileSystem = class {
|
|
|
1560
1561
|
/** Register the VFS service worker and return the active SW */
|
|
1561
1562
|
async getServiceWorker() {
|
|
1562
1563
|
if (!this.swReg) {
|
|
1563
|
-
const swUrl = new URL("./workers/service.worker.js", import.meta.url);
|
|
1564
|
+
const swUrl = this.config.swUrl ? new URL(this.config.swUrl, location.origin) : new URL("./workers/service.worker.js", import.meta.url);
|
|
1564
1565
|
const scope = this.config.swScope ?? new URL(`./${this.ns}/`, swUrl).href;
|
|
1565
|
-
this.swReg = await navigator.serviceWorker.register(swUrl.href, {
|
|
1566
|
+
this.swReg = await navigator.serviceWorker.register(swUrl.href, { scope });
|
|
1566
1567
|
}
|
|
1567
1568
|
const reg = this.swReg;
|
|
1568
1569
|
if (reg.active) return reg.active;
|