@componentor/fs 3.0.4 → 3.0.5

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.
@@ -5,8 +5,7 @@ var pending = [];
5
5
  sw.addEventListener("install", () => {
6
6
  sw.skipWaiting();
7
7
  });
8
- sw.addEventListener("activate", (event) => {
9
- event.waitUntil(sw.clients.claim());
8
+ sw.addEventListener("activate", () => {
10
9
  });
11
10
  sw.addEventListener("message", (event) => {
12
11
  const msg = event.data;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/src/workers/service.worker.ts"],"sourcesContent":["/**\n * Service Worker — port transfer broker for multi-tab VFS.\n *\n * Transfers MessageChannel ports from follower tabs to the leader tab.\n * Uses MessagePorts for all communication (no clients.get() / scope dependency).\n *\n * Protocol:\n * Leader: { type: 'register-server' } + [controlPort]\n * Follower: { type: 'transfer-port', tabId } + [dataPort]\n * → Leader receives on controlPort: { type: 'client-port', tabId } + [dataPort]\n */\n\nexport {}; // Module boundary (avoids global scope conflicts)\n\nconst sw = self as unknown as ServiceWorkerGlobalScope;\n\n// Leader's control port — used to forward follower ports to the leader\nlet serverPort: MessagePort | null = null;\n\n// Ports received before the leader registered\nconst pending: Array<{ tabId: string; port: MessagePort }> = [];\n\nsw.addEventListener('install', () => {\n sw.skipWaiting();\n});\n\nsw.addEventListener('activate', (event: ExtendableEvent) => {\n event.waitUntil(sw.clients.claim());\n});\n\nsw.addEventListener('message', (event: ExtendableMessageEvent) => {\n const msg = event.data;\n\n if (msg.type === 'register-server') {\n // Leader sends a control port for receiving follower ports\n serverPort = event.ports[0];\n if (!serverPort) return;\n\n // Flush any ports that arrived before the leader registered\n while (pending.length > 0) {\n const entry = pending.shift()!;\n serverPort.postMessage(\n { type: 'client-port', tabId: entry.tabId },\n [entry.port as unknown as Transferable],\n );\n }\n return;\n }\n\n if (msg.type === 'transfer-port') {\n // Follower sends a port to be forwarded to the leader\n const port = event.ports[0];\n if (!port) return;\n\n if (serverPort) {\n serverPort.postMessage(\n { type: 'client-port', tabId: msg.tabId },\n [port as unknown as Transferable],\n );\n } else {\n // Leader not registered yet — queue for later\n pending.push({ tabId: msg.tabId, port });\n }\n return;\n }\n});\n"],"mappings":";AAcA,IAAM,KAAK;AAGX,IAAI,aAAiC;AAGrC,IAAM,UAAuD,CAAC;AAE9D,GAAG,iBAAiB,WAAW,MAAM;AACnC,KAAG,YAAY;AACjB,CAAC;AAED,GAAG,iBAAiB,YAAY,CAAC,UAA2B;AAC1D,QAAM,UAAU,GAAG,QAAQ,MAAM,CAAC;AACpC,CAAC;AAED,GAAG,iBAAiB,WAAW,CAAC,UAAkC;AAChE,QAAM,MAAM,MAAM;AAElB,MAAI,IAAI,SAAS,mBAAmB;AAElC,iBAAa,MAAM,MAAM,CAAC;AAC1B,QAAI,CAAC,WAAY;AAGjB,WAAO,QAAQ,SAAS,GAAG;AACzB,YAAM,QAAQ,QAAQ,MAAM;AAC5B,iBAAW;AAAA,QACT,EAAE,MAAM,eAAe,OAAO,MAAM,MAAM;AAAA,QAC1C,CAAC,MAAM,IAA+B;AAAA,MACxC;AAAA,IACF;AACA;AAAA,EACF;AAEA,MAAI,IAAI,SAAS,iBAAiB;AAEhC,UAAM,OAAO,MAAM,MAAM,CAAC;AAC1B,QAAI,CAAC,KAAM;AAEX,QAAI,YAAY;AACd,iBAAW;AAAA,QACT,EAAE,MAAM,eAAe,OAAO,IAAI,MAAM;AAAA,QACxC,CAAC,IAA+B;AAAA,MAClC;AAAA,IACF,OAAO;AAEL,cAAQ,KAAK,EAAE,OAAO,IAAI,OAAO,KAAK,CAAC;AAAA,IACzC;AACA;AAAA,EACF;AACF,CAAC;","names":[]}
1
+ {"version":3,"sources":["../../src/src/workers/service.worker.ts"],"sourcesContent":["/**\n * Service Worker — port transfer broker for multi-tab VFS.\n *\n * Transfers MessageChannel ports from follower tabs to the leader tab.\n * Uses MessagePorts for all communication (no clients.get() / scope dependency).\n *\n * Protocol:\n * Leader: { type: 'register-server' } + [controlPort]\n * Follower: { type: 'transfer-port', tabId } + [dataPort]\n * → Leader receives on controlPort: { type: 'client-port', tabId } + [dataPort]\n */\n\nexport {}; // Module boundary (avoids global scope conflicts)\n\nconst sw = self as unknown as ServiceWorkerGlobalScope;\n\n// Leader's control port — used to forward follower ports to the leader\nlet serverPort: MessagePort | null = null;\n\n// Ports received before the leader registered\nconst pending: Array<{ tabId: string; port: MessagePort }> = [];\n\nsw.addEventListener('install', () => {\n sw.skipWaiting();\n});\n\nsw.addEventListener('activate', () => {\n // No clients.claim() — this SW is a port broker only, it does not need to\n // control any pages. Claiming clients could interfere with the host app's\n // own service worker.\n});\n\nsw.addEventListener('message', (event: ExtendableMessageEvent) => {\n const msg = event.data;\n\n if (msg.type === 'register-server') {\n // Leader sends a control port for receiving follower ports\n serverPort = event.ports[0];\n if (!serverPort) return;\n\n // Flush any ports that arrived before the leader registered\n while (pending.length > 0) {\n const entry = pending.shift()!;\n serverPort.postMessage(\n { type: 'client-port', tabId: entry.tabId },\n [entry.port as unknown as Transferable],\n );\n }\n return;\n }\n\n if (msg.type === 'transfer-port') {\n // Follower sends a port to be forwarded to the leader\n const port = event.ports[0];\n if (!port) return;\n\n if (serverPort) {\n serverPort.postMessage(\n { type: 'client-port', tabId: msg.tabId },\n [port as unknown as Transferable],\n );\n } else {\n // Leader not registered yet — queue for later\n pending.push({ tabId: msg.tabId, port });\n }\n return;\n }\n});\n"],"mappings":";AAcA,IAAM,KAAK;AAGX,IAAI,aAAiC;AAGrC,IAAM,UAAuD,CAAC;AAE9D,GAAG,iBAAiB,WAAW,MAAM;AACnC,KAAG,YAAY;AACjB,CAAC;AAED,GAAG,iBAAiB,YAAY,MAAM;AAItC,CAAC;AAED,GAAG,iBAAiB,WAAW,CAAC,UAAkC;AAChE,QAAM,MAAM,MAAM;AAElB,MAAI,IAAI,SAAS,mBAAmB;AAElC,iBAAa,MAAM,MAAM,CAAC;AAC1B,QAAI,CAAC,WAAY;AAGjB,WAAO,QAAQ,SAAS,GAAG;AACzB,YAAM,QAAQ,QAAQ,MAAM;AAC5B,iBAAW;AAAA,QACT,EAAE,MAAM,eAAe,OAAO,MAAM,MAAM;AAAA,QAC1C,CAAC,MAAM,IAA+B;AAAA,MACxC;AAAA,IACF;AACA;AAAA,EACF;AAEA,MAAI,IAAI,SAAS,iBAAiB;AAEhC,UAAM,OAAO,MAAM,MAAM,CAAC;AAC1B,QAAI,CAAC,KAAM;AAEX,QAAI,YAAY;AACd,iBAAW;AAAA,QACT,EAAE,MAAM,eAAe,OAAO,IAAI,MAAM;AAAA,QACxC,CAAC,IAA+B;AAAA,MAClC;AAAA,IACF,OAAO;AAEL,cAAQ,KAAK,EAAE,OAAO,IAAI,OAAO,KAAK,CAAC;AAAA,IACzC;AACA;AAAA,EACF;AACF,CAAC;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@componentor/fs",
3
- "version": "3.0.4",
3
+ "version": "3.0.5",
4
4
  "description": "High-performance OPFS-based Node.js fs polyfill with true sync API, VFS binary format, and bidirectional OPFS mirroring",
5
5
  "license": "MIT",
6
6
  "author": "Componentor",