@inkandswitch/patchwork-bootloader 0.2.7 → 0.2.8
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 +12 -0
- package/dist/automerge-worker.js +1 -1
- package/dist/service-worker.js +1 -1
- package/dist/site.js +3 -1
- package/package.json +3 -3
- package/src/automerge-worker.ts +1 -1
- package/src/service-worker.ts +1 -1
- package/src/site.ts +11 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @inkandswitch/patchwork-bootloader
|
|
2
2
|
|
|
3
|
+
## 0.2.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 48e4391: Pass the realm-local `repo` to `<patchwork-view>` registration so booted views
|
|
8
|
+
resolve their document handles through it — via the per-view `OverlayRepo` and
|
|
9
|
+
the root `<repo-provider>` fallback for `repo:handle-descriptor`.
|
|
10
|
+
- Updated dependencies [48e4391]
|
|
11
|
+
- Updated dependencies [48e4391]
|
|
12
|
+
- @inkandswitch/patchwork-elements@2.0.0
|
|
13
|
+
- @inkandswitch/patchwork-providers@0.3.0
|
|
14
|
+
|
|
3
15
|
## 0.2.7
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/automerge-worker.js
CHANGED
|
@@ -79,7 +79,7 @@ async function connectClassicSyncNetwork(server) {
|
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
const siteName = typeof __SITE_NAME__ !== "undefined" ? __SITE_NAME__ : "tiny-patchwork";
|
|
82
|
-
const cacheableStatuses = [200, 203, 204
|
|
82
|
+
const cacheableStatuses = [200, 203, 204];
|
|
83
83
|
function log(...args) {
|
|
84
84
|
if (!debugging)
|
|
85
85
|
return;
|
package/dist/service-worker.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import { HANDOFF_CHANNEL, } from "./types.js";
|
|
9
9
|
let cachename = "default";
|
|
10
10
|
let debugging = false;
|
|
11
|
-
const cacheableStatuses = [200, 203, 204
|
|
11
|
+
const cacheableStatuses = [200, 203, 204];
|
|
12
12
|
// The automerge worker times its own resolution out after 30s and replies
|
|
13
13
|
// with an error, so this only fires when nobody is listening at all.
|
|
14
14
|
const HANDOFF_TIMEOUT_MS = 35_000;
|
package/dist/site.js
CHANGED
|
@@ -100,10 +100,12 @@ export async function bootPatchworkSite(config) {
|
|
|
100
100
|
if (!rootElement) {
|
|
101
101
|
throw new Error(`bootPatchworkSite: no element with id="${config.rootElementId ?? "root"}"`);
|
|
102
102
|
}
|
|
103
|
+
// `<repo-provider>` sits above the root and answers `repo:handle-descriptor`
|
|
104
|
+
// for any view outside a remapper (resolving to the requested url unchanged).
|
|
103
105
|
const repoProvider = document.createElement("repo-provider");
|
|
104
106
|
rootElement.parentElement.insertBefore(repoProvider, rootElement);
|
|
105
107
|
repoProvider.appendChild(rootElement);
|
|
106
|
-
registerPatchworkViewElement(
|
|
108
|
+
registerPatchworkViewElement({ hive, repo });
|
|
107
109
|
// The watcher is started with the site's default-tools bundle alone so that
|
|
108
110
|
// `resolveAccountHandle` below has something to await on (the `account`
|
|
109
111
|
// datatype lives in that bundle today). The user's own module-settings URL
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkandswitch/patchwork-bootloader",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.8",
|
|
4
4
|
"author": "chee",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -53,10 +53,10 @@
|
|
|
53
53
|
"resolve.exports": "^2.0.3",
|
|
54
54
|
"service-worker-types": "npm:@types/serviceworker@^0.0.153",
|
|
55
55
|
"tinyargs": "^0.1.4",
|
|
56
|
-
"@inkandswitch/patchwork-elements": "^1.0.0",
|
|
57
56
|
"@inkandswitch/patchwork-filesystem": "^0.0.8",
|
|
58
57
|
"@inkandswitch/patchwork-plugins": "^0.0.11",
|
|
59
|
-
"@inkandswitch/patchwork-providers": "^0.
|
|
58
|
+
"@inkandswitch/patchwork-providers": "^0.3.0",
|
|
59
|
+
"@inkandswitch/patchwork-elements": "^2.0.0"
|
|
60
60
|
},
|
|
61
61
|
"peerDependencies": {
|
|
62
62
|
"@automerge/automerge": "3.3.0-fragments.1",
|
package/src/automerge-worker.ts
CHANGED
|
@@ -121,7 +121,7 @@ async function connectClassicSyncNetwork(server: string): Promise<void> {
|
|
|
121
121
|
const siteName =
|
|
122
122
|
typeof __SITE_NAME__ !== "undefined" ? __SITE_NAME__ : "tiny-patchwork";
|
|
123
123
|
|
|
124
|
-
const cacheableStatuses = [200, 203, 204
|
|
124
|
+
const cacheableStatuses = [200, 203, 204];
|
|
125
125
|
|
|
126
126
|
function log(...args: any[]) {
|
|
127
127
|
if (!debugging) return;
|
package/src/service-worker.ts
CHANGED
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
let cachename = "default";
|
|
17
17
|
let debugging = false;
|
|
18
18
|
|
|
19
|
-
const cacheableStatuses = [200, 203, 204
|
|
19
|
+
const cacheableStatuses = [200, 203, 204];
|
|
20
20
|
|
|
21
21
|
// The automerge worker times its own resolution out after 30s and replies
|
|
22
22
|
// with an error, so this only fires when nobody is listening at all.
|
package/src/site.ts
CHANGED
|
@@ -173,14 +173,14 @@ export async function bootPatchworkSite(
|
|
|
173
173
|
if (!sw) throw new Error("Failed to set up service worker");
|
|
174
174
|
|
|
175
175
|
let hive: AutomergeRepoKeyhive | undefined;
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
176
|
+
// Get the initial automerge-worker port via subscribeToRepoChannel,
|
|
177
|
+
// then pass it to keyhive init which wraps it in its own network adapter.
|
|
178
|
+
let resolvePort!: (port: MessagePort) => void;
|
|
179
|
+
const portPromise = new Promise<MessagePort>((r) => {
|
|
180
|
+
resolvePort = r;
|
|
181
|
+
});
|
|
182
|
+
await sw.subscribeToRepoChannel(resolvePort);
|
|
183
|
+
const workerPort = await portPromise;
|
|
184
184
|
|
|
185
185
|
if (config.keyhive) {
|
|
186
186
|
initKeyhiveWasm();
|
|
@@ -219,7 +219,6 @@ export async function bootPatchworkSite(
|
|
|
219
219
|
|
|
220
220
|
await repo.networkSubsystem.whenReady();
|
|
221
221
|
if (hive) {
|
|
222
|
-
|
|
223
222
|
(hive.networkAdapter as any).syncKeyhive?.();
|
|
224
223
|
}
|
|
225
224
|
|
|
@@ -233,11 +232,13 @@ export async function bootPatchworkSite(
|
|
|
233
232
|
`bootPatchworkSite: no element with id="${config.rootElementId ?? "root"}"`
|
|
234
233
|
);
|
|
235
234
|
}
|
|
235
|
+
// `<repo-provider>` sits above the root and answers `repo:handle-descriptor`
|
|
236
|
+
// for any view outside a remapper (resolving to the requested url unchanged).
|
|
236
237
|
const repoProvider = document.createElement("repo-provider");
|
|
237
238
|
rootElement.parentElement!.insertBefore(repoProvider, rootElement);
|
|
238
239
|
repoProvider.appendChild(rootElement);
|
|
239
240
|
|
|
240
|
-
registerPatchworkViewElement(
|
|
241
|
+
registerPatchworkViewElement({ hive, repo });
|
|
241
242
|
|
|
242
243
|
// The watcher is started with the site's default-tools bundle alone so that
|
|
243
244
|
// `resolveAccountHandle` below has something to await on (the `account`
|