@inkandswitch/patchwork-bootloader 0.3.0 → 0.3.1
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/CHANGELOG.md +14 -0
- package/dist/automerge-worker.js +124 -8
- package/dist/externals.js +1 -2
- package/dist/module-loader-worker.d.ts +1 -0
- package/dist/module-loader-worker.js +55 -0
- package/dist/module-loader.d.ts +13 -0
- package/dist/module-loader.js +72 -0
- package/dist/service-worker.js +58 -6
- package/dist/setup.d.ts +2 -0
- package/dist/setup.js +134 -2
- package/dist/site.d.ts +1 -6
- package/dist/site.js +94 -42
- package/dist/types.d.ts +8 -0
- package/dist/types.js +6 -0
- package/dist/vite/service-worker-plugin.js +4 -0
- package/package.json +18 -14
- package/src/automerge-worker.ts +135 -9
- package/src/externals.ts +1 -2
- package/src/module-loader-worker.ts +68 -0
- package/src/module-loader.ts +85 -0
- package/src/service-worker.ts +78 -6
- package/src/setup.ts +141 -7
- package/src/site.ts +116 -62
- package/src/types.ts +9 -0
- package/src/vite/service-worker-plugin.ts +4 -0
package/src/types.ts
CHANGED
|
@@ -6,6 +6,13 @@
|
|
|
6
6
|
*/
|
|
7
7
|
export const HANDOFF_CHANNEL = "@patchwork/handoff";
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* BroadcastChannel on which the automerge shared worker announces remote
|
|
11
|
+
* heads it learns about from the sync server. Any tab can listen to stay
|
|
12
|
+
* informed of sync progress without repo-to-repo gossiping.
|
|
13
|
+
*/
|
|
14
|
+
export const SYNCSTATE_CHANNEL = "@patchwork/syncstate";
|
|
15
|
+
|
|
9
16
|
/**
|
|
10
17
|
* The special URL to resolve, plus enough of the {@link Request} the service
|
|
11
18
|
* worker is holding that the automerge worker can construct one that
|
|
@@ -105,6 +112,8 @@ export type ServiceWorkerRepoChannelListener = (
|
|
|
105
112
|
) => void | Promise<void>;
|
|
106
113
|
|
|
107
114
|
export type SetupServiceWorkerResult = {
|
|
115
|
+
shared?: SharedWorker;
|
|
116
|
+
kill?: () => void;
|
|
108
117
|
/** Open a classic Automerge sync WebSocket from the automerge worker. */
|
|
109
118
|
connectClassicSync: (server?: string) => Promise<void>;
|
|
110
119
|
subscribeToRepoChannel: (
|
|
@@ -14,6 +14,10 @@ const workers = [
|
|
|
14
14
|
specifier: "@inkandswitch/patchwork-bootloader/automerge-worker",
|
|
15
15
|
fileName: "automerge-worker.js",
|
|
16
16
|
},
|
|
17
|
+
{
|
|
18
|
+
specifier: "@inkandswitch/patchwork-bootloader/module-loader-worker",
|
|
19
|
+
fileName: "module-loader-worker.js",
|
|
20
|
+
},
|
|
17
21
|
];
|
|
18
22
|
|
|
19
23
|
export function serviceworker(): Plugin {
|