@async/framework 0.11.2 → 0.11.4
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 +28 -0
- package/README.md +3 -1
- package/browser.js +128 -23
- package/browser.min.js +1 -1
- package/browser.ts +128 -23
- package/browser.umd.js +128 -23
- package/browser.umd.min.js +1 -1
- package/framework.ts +134 -24
- package/package.json +1 -1
- package/server.js +134 -24
package/framework.ts
CHANGED
|
@@ -188,6 +188,10 @@ const __asyncSignalModule = (() => {
|
|
|
188
188
|
};
|
|
189
189
|
},
|
|
190
190
|
|
|
191
|
+
_cloneSignalDeclaration() {
|
|
192
|
+
return asyncSignal(id, fn);
|
|
193
|
+
},
|
|
194
|
+
|
|
191
195
|
_restore(snapshot = {}) {
|
|
192
196
|
if (!isAsyncSignalSnapshot(snapshot)) {
|
|
193
197
|
return state.set(snapshot);
|
|
@@ -959,7 +963,12 @@ const __cacheModule = (() => {
|
|
|
959
963
|
return registryStore.entries(`${type}.entries`);
|
|
960
964
|
},
|
|
961
965
|
|
|
962
|
-
_adoptMany() {
|
|
966
|
+
_adoptMany(map = {}) {
|
|
967
|
+
for (const [id, definition] of Object.entries(map ?? {})) {
|
|
968
|
+
if (!definitions.has(id)) {
|
|
969
|
+
registryApi.register(id, definition);
|
|
970
|
+
}
|
|
971
|
+
}
|
|
963
972
|
return registryApi;
|
|
964
973
|
}
|
|
965
974
|
}, registryStore, type);
|
|
@@ -1117,6 +1126,10 @@ const __signalsModule = (() => {
|
|
|
1117
1126
|
|
|
1118
1127
|
snapshot() {
|
|
1119
1128
|
return value;
|
|
1129
|
+
},
|
|
1130
|
+
|
|
1131
|
+
_cloneSignalDeclaration() {
|
|
1132
|
+
return createSignal(value);
|
|
1120
1133
|
}
|
|
1121
1134
|
};
|
|
1122
1135
|
|
|
@@ -1159,6 +1172,10 @@ const __signalsModule = (() => {
|
|
|
1159
1172
|
return backing.snapshot();
|
|
1160
1173
|
},
|
|
1161
1174
|
|
|
1175
|
+
_cloneSignalDeclaration() {
|
|
1176
|
+
return computed(fn);
|
|
1177
|
+
},
|
|
1178
|
+
|
|
1162
1179
|
_bindRegistry(registry, id) {
|
|
1163
1180
|
return registry.effect(() => {
|
|
1164
1181
|
backing.set(fn.call({
|
|
@@ -1183,6 +1200,9 @@ const __signalsModule = (() => {
|
|
|
1183
1200
|
[effectKind]: true,
|
|
1184
1201
|
kind: "effect",
|
|
1185
1202
|
fn,
|
|
1203
|
+
_cloneSignalDeclaration() {
|
|
1204
|
+
return effect(fn);
|
|
1205
|
+
},
|
|
1186
1206
|
_bindRegistry(registry) {
|
|
1187
1207
|
return registry.effect(fn);
|
|
1188
1208
|
}
|
|
@@ -1391,6 +1411,24 @@ const __signalsModule = (() => {
|
|
|
1391
1411
|
return requireEntry(entries, id);
|
|
1392
1412
|
},
|
|
1393
1413
|
|
|
1414
|
+
_setPath(path, value) {
|
|
1415
|
+
const parsed = parseRootPath(path);
|
|
1416
|
+
if (!entries.has(parsed.id)) {
|
|
1417
|
+
if (asyncDescriptors.has(parsed.id)) {
|
|
1418
|
+
materializeAsyncSignal(parsed.id);
|
|
1419
|
+
} else {
|
|
1420
|
+
registry.register(parsed.id, createSignal(parsed.parts.length === 0 ? value : {}));
|
|
1421
|
+
}
|
|
1422
|
+
}
|
|
1423
|
+
const entry = requireEntry(entries, parsed.id);
|
|
1424
|
+
if (parsed.parts.length === 0) {
|
|
1425
|
+
return entry.set(value);
|
|
1426
|
+
}
|
|
1427
|
+
const nextValue = setPath(entry.value, parsed.parts, value);
|
|
1428
|
+
entry.set(nextValue);
|
|
1429
|
+
return value;
|
|
1430
|
+
},
|
|
1431
|
+
|
|
1394
1432
|
_setContext(context = {}) {
|
|
1395
1433
|
Object.assign(runtimeContext, context);
|
|
1396
1434
|
return registry;
|
|
@@ -1401,10 +1439,14 @@ const __signalsModule = (() => {
|
|
|
1401
1439
|
},
|
|
1402
1440
|
|
|
1403
1441
|
_adoptMany(map = {}) {
|
|
1404
|
-
for (const id of Object.
|
|
1405
|
-
if (entries.has(id)) {
|
|
1406
|
-
|
|
1442
|
+
for (const [id, signalLike] of Object.entries(map ?? {})) {
|
|
1443
|
+
if (!entries.has(id)) {
|
|
1444
|
+
const entry = cloneSignalDeclaration(signalLike);
|
|
1445
|
+
entries.set(id, entry);
|
|
1446
|
+
bindEntry(id, entry);
|
|
1447
|
+
continue;
|
|
1407
1448
|
}
|
|
1449
|
+
bindEntry(id, entries.get(id));
|
|
1408
1450
|
}
|
|
1409
1451
|
return registry;
|
|
1410
1452
|
}
|
|
@@ -1443,6 +1485,14 @@ const __signalsModule = (() => {
|
|
|
1443
1485
|
return { id, parts, path };
|
|
1444
1486
|
}
|
|
1445
1487
|
|
|
1488
|
+
function parseRootPath(path) {
|
|
1489
|
+
if (typeof path !== "string" || path.length === 0) {
|
|
1490
|
+
throw new TypeError("Signal path must be a non-empty string.");
|
|
1491
|
+
}
|
|
1492
|
+
const [id, ...parts] = path.split(".");
|
|
1493
|
+
return { id, parts, path };
|
|
1494
|
+
}
|
|
1495
|
+
|
|
1446
1496
|
function materializeAsyncSignal(id) {
|
|
1447
1497
|
if (entries.has(id) || !asyncDescriptors.has(id)) {
|
|
1448
1498
|
return;
|
|
@@ -1482,6 +1532,16 @@ const __signalsModule = (() => {
|
|
|
1482
1532
|
return createSignal(signalLike);
|
|
1483
1533
|
}
|
|
1484
1534
|
|
|
1535
|
+
function cloneSignalDeclaration(signalLike) {
|
|
1536
|
+
if (typeof signalLike?._cloneSignalDeclaration === "function") {
|
|
1537
|
+
return signalLike._cloneSignalDeclaration();
|
|
1538
|
+
}
|
|
1539
|
+
if (isSignalLike(signalLike)) {
|
|
1540
|
+
return createSignal(typeof signalLike.snapshot === "function" ? signalLike.snapshot() : signalLike.value);
|
|
1541
|
+
}
|
|
1542
|
+
return createSignal(signalLike);
|
|
1543
|
+
}
|
|
1544
|
+
|
|
1485
1545
|
function isSignalLike(value) {
|
|
1486
1546
|
return Boolean(value && typeof value === "object" && typeof value.subscribe === "function");
|
|
1487
1547
|
}
|
|
@@ -1660,7 +1720,7 @@ const __signalsModule = (() => {
|
|
|
1660
1720
|
frame.add(path);
|
|
1661
1721
|
}
|
|
1662
1722
|
}
|
|
1663
|
-
return { createSignal, computed, effect, createSignalRegistry, isSignalRef, signal };
|
|
1723
|
+
return { createSignal, computed, effect, createSignalRegistry, cloneSignalDeclaration, isSignalRef, signal };
|
|
1664
1724
|
})();
|
|
1665
1725
|
|
|
1666
1726
|
const __htmlModule = (() => {
|
|
@@ -1902,7 +1962,12 @@ const __componentModule = (() => {
|
|
|
1902
1962
|
return lazyComponents.get(id);
|
|
1903
1963
|
},
|
|
1904
1964
|
|
|
1905
|
-
_adoptMany() {
|
|
1965
|
+
_adoptMany(map = {}) {
|
|
1966
|
+
for (const [id, Component] of Object.entries(map ?? {})) {
|
|
1967
|
+
if (!entries.has(id)) {
|
|
1968
|
+
registry.register(id, Component);
|
|
1969
|
+
}
|
|
1970
|
+
}
|
|
1906
1971
|
return registry;
|
|
1907
1972
|
}
|
|
1908
1973
|
}, registryStore, type);
|
|
@@ -2742,7 +2807,12 @@ const __handlersModule = (() => {
|
|
|
2742
2807
|
return results;
|
|
2743
2808
|
},
|
|
2744
2809
|
|
|
2745
|
-
_adoptMany() {
|
|
2810
|
+
_adoptMany(map = {}) {
|
|
2811
|
+
for (const [id, fn] of Object.entries(map ?? {})) {
|
|
2812
|
+
if (!handlers.has(id)) {
|
|
2813
|
+
registry.register(id, fn);
|
|
2814
|
+
}
|
|
2815
|
+
}
|
|
2746
2816
|
return registry;
|
|
2747
2817
|
}
|
|
2748
2818
|
}, registryStore, type);
|
|
@@ -4031,7 +4101,12 @@ const __partialsModule = (() => {
|
|
|
4031
4101
|
return normalizePartialResult(result, partialContext);
|
|
4032
4102
|
},
|
|
4033
4103
|
|
|
4034
|
-
_adoptMany() {
|
|
4104
|
+
_adoptMany(map = {}) {
|
|
4105
|
+
for (const [id, fn] of Object.entries(map ?? {})) {
|
|
4106
|
+
if (!entries.has(id)) {
|
|
4107
|
+
registry.register(id, fn);
|
|
4108
|
+
}
|
|
4109
|
+
}
|
|
4035
4110
|
return registry;
|
|
4036
4111
|
}
|
|
4037
4112
|
}, registryStore, type);
|
|
@@ -4183,7 +4258,11 @@ const __routerModule = (() => {
|
|
|
4183
4258
|
},
|
|
4184
4259
|
|
|
4185
4260
|
_adoptMany(map = {}) {
|
|
4186
|
-
for (const pattern of Object.
|
|
4261
|
+
for (const [pattern, definition] of Object.entries(map ?? {})) {
|
|
4262
|
+
if (!entries.has(pattern)) {
|
|
4263
|
+
registry.register(pattern, definition);
|
|
4264
|
+
continue;
|
|
4265
|
+
}
|
|
4187
4266
|
adoptRoute(pattern, entries.get(pattern));
|
|
4188
4267
|
}
|
|
4189
4268
|
return registry;
|
|
@@ -4679,7 +4758,7 @@ const __appModule = (() => {
|
|
|
4679
4758
|
const { createRouteRegistry, createRouter } = __routerModule;
|
|
4680
4759
|
const { createScheduler } = __schedulerModule;
|
|
4681
4760
|
const { createServerNamespace } = __serverModule;
|
|
4682
|
-
const { createSignal, createSignalRegistry } = __signalsModule;
|
|
4761
|
+
const { cloneSignalDeclaration, createSignal, createSignalRegistry } = __signalsModule;
|
|
4683
4762
|
const { createRegistryStore } = __registryStoreModule;
|
|
4684
4763
|
const { attributeName, normalizeAttributeConfig } = __attributesModule;
|
|
4685
4764
|
const { createLazyRegistry, defineRegistrySnapshot, sameRegistryValue } = __lazyRegistryModule;
|
|
@@ -4762,7 +4841,7 @@ const __appModule = (() => {
|
|
|
4762
4841
|
registryAssets: options.registryAssets,
|
|
4763
4842
|
importModule: options.importModule
|
|
4764
4843
|
});
|
|
4765
|
-
const registry = options.registry ?? app.registry
|
|
4844
|
+
const registry = options.registry ?? createRuntimeRegistry(app.registry, { target });
|
|
4766
4845
|
const signals = options.signals ?? createSignalRegistry(undefined, { registry, type: "signal", lazyRegistry });
|
|
4767
4846
|
const handlers = options.handlers ?? createHandlerRegistry(undefined, { registry, type: "handler", lazyRegistry });
|
|
4768
4847
|
const serverCache = createCacheRegistry(undefined, { registry, type: "cache.server" });
|
|
@@ -4954,7 +5033,7 @@ const __appModule = (() => {
|
|
|
4954
5033
|
|
|
4955
5034
|
if (result.signals) {
|
|
4956
5035
|
for (const [path, value] of Object.entries(result.signals)) {
|
|
4957
|
-
|
|
5036
|
+
applySignalPatch(signals, path, value);
|
|
4958
5037
|
}
|
|
4959
5038
|
}
|
|
4960
5039
|
if (result.cache?.browser) {
|
|
@@ -5143,6 +5222,22 @@ const __appModule = (() => {
|
|
|
5143
5222
|
registry?.registerMany?.(entries);
|
|
5144
5223
|
}
|
|
5145
5224
|
|
|
5225
|
+
function createRuntimeRegistry(appRegistry, { target } = {}) {
|
|
5226
|
+
const declarations = appRegistry.rawSnapshot();
|
|
5227
|
+
return createRegistryStore({
|
|
5228
|
+
...declarations,
|
|
5229
|
+
signal: cloneSignalDeclarations(declarations.signal)
|
|
5230
|
+
}, { target });
|
|
5231
|
+
}
|
|
5232
|
+
|
|
5233
|
+
function cloneSignalDeclarations(signals = {}) {
|
|
5234
|
+
const cloned = {};
|
|
5235
|
+
for (const [id, signalLike] of Object.entries(signals ?? {})) {
|
|
5236
|
+
cloned[id] = cloneSignalDeclaration(signalLike);
|
|
5237
|
+
}
|
|
5238
|
+
return cloned;
|
|
5239
|
+
}
|
|
5240
|
+
|
|
5146
5241
|
function emptyDeclarations() {
|
|
5147
5242
|
return {
|
|
5148
5243
|
signal: {},
|
|
@@ -5216,8 +5311,9 @@ const __appModule = (() => {
|
|
|
5216
5311
|
|
|
5217
5312
|
function applySnapshotToRuntime(runtime, snapshot = {}, options = {}) {
|
|
5218
5313
|
const normalized = normalizeSnapshot(snapshot);
|
|
5219
|
-
|
|
5220
|
-
|
|
5314
|
+
mergeRegistryEntries(runtime, "asyncSignal", normalized.asyncSignal, null, options);
|
|
5315
|
+
for (const [id, value] of Object.entries(normalized.signal)) {
|
|
5316
|
+
restoreSignalEntry(runtime.signals, id, value);
|
|
5221
5317
|
}
|
|
5222
5318
|
runtime.browser.cache.restore(normalized.cache.browser);
|
|
5223
5319
|
mergeRegistryEntries(runtime, "handler", normalized.handler, runtime.handlers, options);
|
|
@@ -5225,7 +5321,6 @@ const __appModule = (() => {
|
|
|
5225
5321
|
mergeRegistryEntries(runtime, "partial", normalized.partial, runtime.partials, options);
|
|
5226
5322
|
mergeRegistryEntries(runtime, "route", normalized.route, runtime.routes, options);
|
|
5227
5323
|
mergeRegistryEntries(runtime, "component", normalized.component, runtime.components, options);
|
|
5228
|
-
mergeRegistryEntries(runtime, "asyncSignal", normalized.asyncSignal, null, options);
|
|
5229
5324
|
return runtime;
|
|
5230
5325
|
}
|
|
5231
5326
|
|
|
@@ -5331,16 +5426,26 @@ const __appModule = (() => {
|
|
|
5331
5426
|
}
|
|
5332
5427
|
}
|
|
5333
5428
|
|
|
5334
|
-
function
|
|
5335
|
-
const id = String(path).split(".")[0];
|
|
5429
|
+
function restoreSignalEntry(signals, id, value) {
|
|
5336
5430
|
if (signals.has?.(id)) {
|
|
5337
|
-
|
|
5338
|
-
|
|
5339
|
-
|
|
5340
|
-
|
|
5341
|
-
return;
|
|
5342
|
-
}
|
|
5431
|
+
const entry = signals._entry?.(id);
|
|
5432
|
+
if (typeof entry?._restore === "function" && isAsyncSignalSnapshot(value)) {
|
|
5433
|
+
entry._restore(value);
|
|
5434
|
+
return;
|
|
5343
5435
|
}
|
|
5436
|
+
signals.set(id, value);
|
|
5437
|
+
return;
|
|
5438
|
+
}
|
|
5439
|
+
signals.register(id, createSignal(value));
|
|
5440
|
+
}
|
|
5441
|
+
|
|
5442
|
+
function applySignalPatch(signals, path, value) {
|
|
5443
|
+
if (typeof signals._setPath === "function") {
|
|
5444
|
+
signals._setPath(path, value);
|
|
5445
|
+
return;
|
|
5446
|
+
}
|
|
5447
|
+
const id = String(path).split(".")[0];
|
|
5448
|
+
if (signals.has?.(id)) {
|
|
5344
5449
|
signals.set(path, value);
|
|
5345
5450
|
return;
|
|
5346
5451
|
}
|
|
@@ -5611,7 +5716,12 @@ const __serverRegistryModule = (() => {
|
|
|
5611
5716
|
return registry;
|
|
5612
5717
|
},
|
|
5613
5718
|
|
|
5614
|
-
_adoptMany() {
|
|
5719
|
+
_adoptMany(map = {}) {
|
|
5720
|
+
for (const [id, fn] of Object.entries(map ?? {})) {
|
|
5721
|
+
if (!entries.has(id)) {
|
|
5722
|
+
registry.register(id, fn);
|
|
5723
|
+
}
|
|
5724
|
+
}
|
|
5615
5725
|
return registry;
|
|
5616
5726
|
}
|
|
5617
5727
|
}, registryStore, type);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@async/framework",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.4",
|
|
4
4
|
"description": "No-build Loader app runtime with browser and server entrypoints, signals, command events, route partials, cache split, SSR activation, and streaming boundaries.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./server.js",
|
package/server.js
CHANGED
|
@@ -187,6 +187,10 @@ const __asyncSignalModule = (() => {
|
|
|
187
187
|
};
|
|
188
188
|
},
|
|
189
189
|
|
|
190
|
+
_cloneSignalDeclaration() {
|
|
191
|
+
return asyncSignal(id, fn);
|
|
192
|
+
},
|
|
193
|
+
|
|
190
194
|
_restore(snapshot = {}) {
|
|
191
195
|
if (!isAsyncSignalSnapshot(snapshot)) {
|
|
192
196
|
return state.set(snapshot);
|
|
@@ -958,7 +962,12 @@ const __cacheModule = (() => {
|
|
|
958
962
|
return registryStore.entries(`${type}.entries`);
|
|
959
963
|
},
|
|
960
964
|
|
|
961
|
-
_adoptMany() {
|
|
965
|
+
_adoptMany(map = {}) {
|
|
966
|
+
for (const [id, definition] of Object.entries(map ?? {})) {
|
|
967
|
+
if (!definitions.has(id)) {
|
|
968
|
+
registryApi.register(id, definition);
|
|
969
|
+
}
|
|
970
|
+
}
|
|
962
971
|
return registryApi;
|
|
963
972
|
}
|
|
964
973
|
}, registryStore, type);
|
|
@@ -1116,6 +1125,10 @@ const __signalsModule = (() => {
|
|
|
1116
1125
|
|
|
1117
1126
|
snapshot() {
|
|
1118
1127
|
return value;
|
|
1128
|
+
},
|
|
1129
|
+
|
|
1130
|
+
_cloneSignalDeclaration() {
|
|
1131
|
+
return createSignal(value);
|
|
1119
1132
|
}
|
|
1120
1133
|
};
|
|
1121
1134
|
|
|
@@ -1158,6 +1171,10 @@ const __signalsModule = (() => {
|
|
|
1158
1171
|
return backing.snapshot();
|
|
1159
1172
|
},
|
|
1160
1173
|
|
|
1174
|
+
_cloneSignalDeclaration() {
|
|
1175
|
+
return computed(fn);
|
|
1176
|
+
},
|
|
1177
|
+
|
|
1161
1178
|
_bindRegistry(registry, id) {
|
|
1162
1179
|
return registry.effect(() => {
|
|
1163
1180
|
backing.set(fn.call({
|
|
@@ -1182,6 +1199,9 @@ const __signalsModule = (() => {
|
|
|
1182
1199
|
[effectKind]: true,
|
|
1183
1200
|
kind: "effect",
|
|
1184
1201
|
fn,
|
|
1202
|
+
_cloneSignalDeclaration() {
|
|
1203
|
+
return effect(fn);
|
|
1204
|
+
},
|
|
1185
1205
|
_bindRegistry(registry) {
|
|
1186
1206
|
return registry.effect(fn);
|
|
1187
1207
|
}
|
|
@@ -1390,6 +1410,24 @@ const __signalsModule = (() => {
|
|
|
1390
1410
|
return requireEntry(entries, id);
|
|
1391
1411
|
},
|
|
1392
1412
|
|
|
1413
|
+
_setPath(path, value) {
|
|
1414
|
+
const parsed = parseRootPath(path);
|
|
1415
|
+
if (!entries.has(parsed.id)) {
|
|
1416
|
+
if (asyncDescriptors.has(parsed.id)) {
|
|
1417
|
+
materializeAsyncSignal(parsed.id);
|
|
1418
|
+
} else {
|
|
1419
|
+
registry.register(parsed.id, createSignal(parsed.parts.length === 0 ? value : {}));
|
|
1420
|
+
}
|
|
1421
|
+
}
|
|
1422
|
+
const entry = requireEntry(entries, parsed.id);
|
|
1423
|
+
if (parsed.parts.length === 0) {
|
|
1424
|
+
return entry.set(value);
|
|
1425
|
+
}
|
|
1426
|
+
const nextValue = setPath(entry.value, parsed.parts, value);
|
|
1427
|
+
entry.set(nextValue);
|
|
1428
|
+
return value;
|
|
1429
|
+
},
|
|
1430
|
+
|
|
1393
1431
|
_setContext(context = {}) {
|
|
1394
1432
|
Object.assign(runtimeContext, context);
|
|
1395
1433
|
return registry;
|
|
@@ -1400,10 +1438,14 @@ const __signalsModule = (() => {
|
|
|
1400
1438
|
},
|
|
1401
1439
|
|
|
1402
1440
|
_adoptMany(map = {}) {
|
|
1403
|
-
for (const id of Object.
|
|
1404
|
-
if (entries.has(id)) {
|
|
1405
|
-
|
|
1441
|
+
for (const [id, signalLike] of Object.entries(map ?? {})) {
|
|
1442
|
+
if (!entries.has(id)) {
|
|
1443
|
+
const entry = cloneSignalDeclaration(signalLike);
|
|
1444
|
+
entries.set(id, entry);
|
|
1445
|
+
bindEntry(id, entry);
|
|
1446
|
+
continue;
|
|
1406
1447
|
}
|
|
1448
|
+
bindEntry(id, entries.get(id));
|
|
1407
1449
|
}
|
|
1408
1450
|
return registry;
|
|
1409
1451
|
}
|
|
@@ -1442,6 +1484,14 @@ const __signalsModule = (() => {
|
|
|
1442
1484
|
return { id, parts, path };
|
|
1443
1485
|
}
|
|
1444
1486
|
|
|
1487
|
+
function parseRootPath(path) {
|
|
1488
|
+
if (typeof path !== "string" || path.length === 0) {
|
|
1489
|
+
throw new TypeError("Signal path must be a non-empty string.");
|
|
1490
|
+
}
|
|
1491
|
+
const [id, ...parts] = path.split(".");
|
|
1492
|
+
return { id, parts, path };
|
|
1493
|
+
}
|
|
1494
|
+
|
|
1445
1495
|
function materializeAsyncSignal(id) {
|
|
1446
1496
|
if (entries.has(id) || !asyncDescriptors.has(id)) {
|
|
1447
1497
|
return;
|
|
@@ -1481,6 +1531,16 @@ const __signalsModule = (() => {
|
|
|
1481
1531
|
return createSignal(signalLike);
|
|
1482
1532
|
}
|
|
1483
1533
|
|
|
1534
|
+
function cloneSignalDeclaration(signalLike) {
|
|
1535
|
+
if (typeof signalLike?._cloneSignalDeclaration === "function") {
|
|
1536
|
+
return signalLike._cloneSignalDeclaration();
|
|
1537
|
+
}
|
|
1538
|
+
if (isSignalLike(signalLike)) {
|
|
1539
|
+
return createSignal(typeof signalLike.snapshot === "function" ? signalLike.snapshot() : signalLike.value);
|
|
1540
|
+
}
|
|
1541
|
+
return createSignal(signalLike);
|
|
1542
|
+
}
|
|
1543
|
+
|
|
1484
1544
|
function isSignalLike(value) {
|
|
1485
1545
|
return Boolean(value && typeof value === "object" && typeof value.subscribe === "function");
|
|
1486
1546
|
}
|
|
@@ -1659,7 +1719,7 @@ const __signalsModule = (() => {
|
|
|
1659
1719
|
frame.add(path);
|
|
1660
1720
|
}
|
|
1661
1721
|
}
|
|
1662
|
-
return { createSignal, computed, effect, createSignalRegistry, isSignalRef, signal };
|
|
1722
|
+
return { createSignal, computed, effect, createSignalRegistry, cloneSignalDeclaration, isSignalRef, signal };
|
|
1663
1723
|
})();
|
|
1664
1724
|
|
|
1665
1725
|
const __htmlModule = (() => {
|
|
@@ -1901,7 +1961,12 @@ const __componentModule = (() => {
|
|
|
1901
1961
|
return lazyComponents.get(id);
|
|
1902
1962
|
},
|
|
1903
1963
|
|
|
1904
|
-
_adoptMany() {
|
|
1964
|
+
_adoptMany(map = {}) {
|
|
1965
|
+
for (const [id, Component] of Object.entries(map ?? {})) {
|
|
1966
|
+
if (!entries.has(id)) {
|
|
1967
|
+
registry.register(id, Component);
|
|
1968
|
+
}
|
|
1969
|
+
}
|
|
1905
1970
|
return registry;
|
|
1906
1971
|
}
|
|
1907
1972
|
}, registryStore, type);
|
|
@@ -2741,7 +2806,12 @@ const __handlersModule = (() => {
|
|
|
2741
2806
|
return results;
|
|
2742
2807
|
},
|
|
2743
2808
|
|
|
2744
|
-
_adoptMany() {
|
|
2809
|
+
_adoptMany(map = {}) {
|
|
2810
|
+
for (const [id, fn] of Object.entries(map ?? {})) {
|
|
2811
|
+
if (!handlers.has(id)) {
|
|
2812
|
+
registry.register(id, fn);
|
|
2813
|
+
}
|
|
2814
|
+
}
|
|
2745
2815
|
return registry;
|
|
2746
2816
|
}
|
|
2747
2817
|
}, registryStore, type);
|
|
@@ -4030,7 +4100,12 @@ const __partialsModule = (() => {
|
|
|
4030
4100
|
return normalizePartialResult(result, partialContext);
|
|
4031
4101
|
},
|
|
4032
4102
|
|
|
4033
|
-
_adoptMany() {
|
|
4103
|
+
_adoptMany(map = {}) {
|
|
4104
|
+
for (const [id, fn] of Object.entries(map ?? {})) {
|
|
4105
|
+
if (!entries.has(id)) {
|
|
4106
|
+
registry.register(id, fn);
|
|
4107
|
+
}
|
|
4108
|
+
}
|
|
4034
4109
|
return registry;
|
|
4035
4110
|
}
|
|
4036
4111
|
}, registryStore, type);
|
|
@@ -4182,7 +4257,11 @@ const __routerModule = (() => {
|
|
|
4182
4257
|
},
|
|
4183
4258
|
|
|
4184
4259
|
_adoptMany(map = {}) {
|
|
4185
|
-
for (const pattern of Object.
|
|
4260
|
+
for (const [pattern, definition] of Object.entries(map ?? {})) {
|
|
4261
|
+
if (!entries.has(pattern)) {
|
|
4262
|
+
registry.register(pattern, definition);
|
|
4263
|
+
continue;
|
|
4264
|
+
}
|
|
4186
4265
|
adoptRoute(pattern, entries.get(pattern));
|
|
4187
4266
|
}
|
|
4188
4267
|
return registry;
|
|
@@ -4678,7 +4757,7 @@ const __appModule = (() => {
|
|
|
4678
4757
|
const { createRouteRegistry, createRouter } = __routerModule;
|
|
4679
4758
|
const { createScheduler } = __schedulerModule;
|
|
4680
4759
|
const { createServerNamespace } = __serverModule;
|
|
4681
|
-
const { createSignal, createSignalRegistry } = __signalsModule;
|
|
4760
|
+
const { cloneSignalDeclaration, createSignal, createSignalRegistry } = __signalsModule;
|
|
4682
4761
|
const { createRegistryStore } = __registryStoreModule;
|
|
4683
4762
|
const { attributeName, normalizeAttributeConfig } = __attributesModule;
|
|
4684
4763
|
const { createLazyRegistry, defineRegistrySnapshot, sameRegistryValue } = __lazyRegistryModule;
|
|
@@ -4761,7 +4840,7 @@ const __appModule = (() => {
|
|
|
4761
4840
|
registryAssets: options.registryAssets,
|
|
4762
4841
|
importModule: options.importModule
|
|
4763
4842
|
});
|
|
4764
|
-
const registry = options.registry ?? app.registry
|
|
4843
|
+
const registry = options.registry ?? createRuntimeRegistry(app.registry, { target });
|
|
4765
4844
|
const signals = options.signals ?? createSignalRegistry(undefined, { registry, type: "signal", lazyRegistry });
|
|
4766
4845
|
const handlers = options.handlers ?? createHandlerRegistry(undefined, { registry, type: "handler", lazyRegistry });
|
|
4767
4846
|
const serverCache = createCacheRegistry(undefined, { registry, type: "cache.server" });
|
|
@@ -4953,7 +5032,7 @@ const __appModule = (() => {
|
|
|
4953
5032
|
|
|
4954
5033
|
if (result.signals) {
|
|
4955
5034
|
for (const [path, value] of Object.entries(result.signals)) {
|
|
4956
|
-
|
|
5035
|
+
applySignalPatch(signals, path, value);
|
|
4957
5036
|
}
|
|
4958
5037
|
}
|
|
4959
5038
|
if (result.cache?.browser) {
|
|
@@ -5142,6 +5221,22 @@ const __appModule = (() => {
|
|
|
5142
5221
|
registry?.registerMany?.(entries);
|
|
5143
5222
|
}
|
|
5144
5223
|
|
|
5224
|
+
function createRuntimeRegistry(appRegistry, { target } = {}) {
|
|
5225
|
+
const declarations = appRegistry.rawSnapshot();
|
|
5226
|
+
return createRegistryStore({
|
|
5227
|
+
...declarations,
|
|
5228
|
+
signal: cloneSignalDeclarations(declarations.signal)
|
|
5229
|
+
}, { target });
|
|
5230
|
+
}
|
|
5231
|
+
|
|
5232
|
+
function cloneSignalDeclarations(signals = {}) {
|
|
5233
|
+
const cloned = {};
|
|
5234
|
+
for (const [id, signalLike] of Object.entries(signals ?? {})) {
|
|
5235
|
+
cloned[id] = cloneSignalDeclaration(signalLike);
|
|
5236
|
+
}
|
|
5237
|
+
return cloned;
|
|
5238
|
+
}
|
|
5239
|
+
|
|
5145
5240
|
function emptyDeclarations() {
|
|
5146
5241
|
return {
|
|
5147
5242
|
signal: {},
|
|
@@ -5215,8 +5310,9 @@ const __appModule = (() => {
|
|
|
5215
5310
|
|
|
5216
5311
|
function applySnapshotToRuntime(runtime, snapshot = {}, options = {}) {
|
|
5217
5312
|
const normalized = normalizeSnapshot(snapshot);
|
|
5218
|
-
|
|
5219
|
-
|
|
5313
|
+
mergeRegistryEntries(runtime, "asyncSignal", normalized.asyncSignal, null, options);
|
|
5314
|
+
for (const [id, value] of Object.entries(normalized.signal)) {
|
|
5315
|
+
restoreSignalEntry(runtime.signals, id, value);
|
|
5220
5316
|
}
|
|
5221
5317
|
runtime.browser.cache.restore(normalized.cache.browser);
|
|
5222
5318
|
mergeRegistryEntries(runtime, "handler", normalized.handler, runtime.handlers, options);
|
|
@@ -5224,7 +5320,6 @@ const __appModule = (() => {
|
|
|
5224
5320
|
mergeRegistryEntries(runtime, "partial", normalized.partial, runtime.partials, options);
|
|
5225
5321
|
mergeRegistryEntries(runtime, "route", normalized.route, runtime.routes, options);
|
|
5226
5322
|
mergeRegistryEntries(runtime, "component", normalized.component, runtime.components, options);
|
|
5227
|
-
mergeRegistryEntries(runtime, "asyncSignal", normalized.asyncSignal, null, options);
|
|
5228
5323
|
return runtime;
|
|
5229
5324
|
}
|
|
5230
5325
|
|
|
@@ -5330,16 +5425,26 @@ const __appModule = (() => {
|
|
|
5330
5425
|
}
|
|
5331
5426
|
}
|
|
5332
5427
|
|
|
5333
|
-
function
|
|
5334
|
-
const id = String(path).split(".")[0];
|
|
5428
|
+
function restoreSignalEntry(signals, id, value) {
|
|
5335
5429
|
if (signals.has?.(id)) {
|
|
5336
|
-
|
|
5337
|
-
|
|
5338
|
-
|
|
5339
|
-
|
|
5340
|
-
return;
|
|
5341
|
-
}
|
|
5430
|
+
const entry = signals._entry?.(id);
|
|
5431
|
+
if (typeof entry?._restore === "function" && isAsyncSignalSnapshot(value)) {
|
|
5432
|
+
entry._restore(value);
|
|
5433
|
+
return;
|
|
5342
5434
|
}
|
|
5435
|
+
signals.set(id, value);
|
|
5436
|
+
return;
|
|
5437
|
+
}
|
|
5438
|
+
signals.register(id, createSignal(value));
|
|
5439
|
+
}
|
|
5440
|
+
|
|
5441
|
+
function applySignalPatch(signals, path, value) {
|
|
5442
|
+
if (typeof signals._setPath === "function") {
|
|
5443
|
+
signals._setPath(path, value);
|
|
5444
|
+
return;
|
|
5445
|
+
}
|
|
5446
|
+
const id = String(path).split(".")[0];
|
|
5447
|
+
if (signals.has?.(id)) {
|
|
5343
5448
|
signals.set(path, value);
|
|
5344
5449
|
return;
|
|
5345
5450
|
}
|
|
@@ -5610,7 +5715,12 @@ const __serverRegistryModule = (() => {
|
|
|
5610
5715
|
return registry;
|
|
5611
5716
|
},
|
|
5612
5717
|
|
|
5613
|
-
_adoptMany() {
|
|
5718
|
+
_adoptMany(map = {}) {
|
|
5719
|
+
for (const [id, fn] of Object.entries(map ?? {})) {
|
|
5720
|
+
if (!entries.has(id)) {
|
|
5721
|
+
registry.register(id, fn);
|
|
5722
|
+
}
|
|
5723
|
+
}
|
|
5614
5724
|
return registry;
|
|
5615
5725
|
}
|
|
5616
5726
|
}, registryStore, type);
|