@async/framework 0.11.2 → 0.11.3
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/README.md +3 -1
- package/browser.js +80 -11
- package/browser.min.js +1 -1
- package/browser.ts +80 -11
- package/browser.umd.js +80 -11
- package/browser.umd.min.js +1 -1
- package/framework.ts +86 -12
- package/package.json +1 -1
- package/server.js +86 -12
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
|
}
|
|
@@ -1400,10 +1420,14 @@ const __signalsModule = (() => {
|
|
|
1400
1420
|
},
|
|
1401
1421
|
|
|
1402
1422
|
_adoptMany(map = {}) {
|
|
1403
|
-
for (const id of Object.
|
|
1404
|
-
if (entries.has(id)) {
|
|
1405
|
-
|
|
1423
|
+
for (const [id, signalLike] of Object.entries(map ?? {})) {
|
|
1424
|
+
if (!entries.has(id)) {
|
|
1425
|
+
const entry = cloneSignalDeclaration(signalLike);
|
|
1426
|
+
entries.set(id, entry);
|
|
1427
|
+
bindEntry(id, entry);
|
|
1428
|
+
continue;
|
|
1406
1429
|
}
|
|
1430
|
+
bindEntry(id, entries.get(id));
|
|
1407
1431
|
}
|
|
1408
1432
|
return registry;
|
|
1409
1433
|
}
|
|
@@ -1481,6 +1505,16 @@ const __signalsModule = (() => {
|
|
|
1481
1505
|
return createSignal(signalLike);
|
|
1482
1506
|
}
|
|
1483
1507
|
|
|
1508
|
+
function cloneSignalDeclaration(signalLike) {
|
|
1509
|
+
if (typeof signalLike?._cloneSignalDeclaration === "function") {
|
|
1510
|
+
return signalLike._cloneSignalDeclaration();
|
|
1511
|
+
}
|
|
1512
|
+
if (isSignalLike(signalLike)) {
|
|
1513
|
+
return createSignal(typeof signalLike.snapshot === "function" ? signalLike.snapshot() : signalLike.value);
|
|
1514
|
+
}
|
|
1515
|
+
return createSignal(signalLike);
|
|
1516
|
+
}
|
|
1517
|
+
|
|
1484
1518
|
function isSignalLike(value) {
|
|
1485
1519
|
return Boolean(value && typeof value === "object" && typeof value.subscribe === "function");
|
|
1486
1520
|
}
|
|
@@ -1659,7 +1693,7 @@ const __signalsModule = (() => {
|
|
|
1659
1693
|
frame.add(path);
|
|
1660
1694
|
}
|
|
1661
1695
|
}
|
|
1662
|
-
return { createSignal, computed, effect, createSignalRegistry, isSignalRef, signal };
|
|
1696
|
+
return { createSignal, computed, effect, createSignalRegistry, cloneSignalDeclaration, isSignalRef, signal };
|
|
1663
1697
|
})();
|
|
1664
1698
|
|
|
1665
1699
|
const __htmlModule = (() => {
|
|
@@ -1901,7 +1935,12 @@ const __componentModule = (() => {
|
|
|
1901
1935
|
return lazyComponents.get(id);
|
|
1902
1936
|
},
|
|
1903
1937
|
|
|
1904
|
-
_adoptMany() {
|
|
1938
|
+
_adoptMany(map = {}) {
|
|
1939
|
+
for (const [id, Component] of Object.entries(map ?? {})) {
|
|
1940
|
+
if (!entries.has(id)) {
|
|
1941
|
+
registry.register(id, Component);
|
|
1942
|
+
}
|
|
1943
|
+
}
|
|
1905
1944
|
return registry;
|
|
1906
1945
|
}
|
|
1907
1946
|
}, registryStore, type);
|
|
@@ -2741,7 +2780,12 @@ const __handlersModule = (() => {
|
|
|
2741
2780
|
return results;
|
|
2742
2781
|
},
|
|
2743
2782
|
|
|
2744
|
-
_adoptMany() {
|
|
2783
|
+
_adoptMany(map = {}) {
|
|
2784
|
+
for (const [id, fn] of Object.entries(map ?? {})) {
|
|
2785
|
+
if (!handlers.has(id)) {
|
|
2786
|
+
registry.register(id, fn);
|
|
2787
|
+
}
|
|
2788
|
+
}
|
|
2745
2789
|
return registry;
|
|
2746
2790
|
}
|
|
2747
2791
|
}, registryStore, type);
|
|
@@ -4030,7 +4074,12 @@ const __partialsModule = (() => {
|
|
|
4030
4074
|
return normalizePartialResult(result, partialContext);
|
|
4031
4075
|
},
|
|
4032
4076
|
|
|
4033
|
-
_adoptMany() {
|
|
4077
|
+
_adoptMany(map = {}) {
|
|
4078
|
+
for (const [id, fn] of Object.entries(map ?? {})) {
|
|
4079
|
+
if (!entries.has(id)) {
|
|
4080
|
+
registry.register(id, fn);
|
|
4081
|
+
}
|
|
4082
|
+
}
|
|
4034
4083
|
return registry;
|
|
4035
4084
|
}
|
|
4036
4085
|
}, registryStore, type);
|
|
@@ -4182,7 +4231,11 @@ const __routerModule = (() => {
|
|
|
4182
4231
|
},
|
|
4183
4232
|
|
|
4184
4233
|
_adoptMany(map = {}) {
|
|
4185
|
-
for (const pattern of Object.
|
|
4234
|
+
for (const [pattern, definition] of Object.entries(map ?? {})) {
|
|
4235
|
+
if (!entries.has(pattern)) {
|
|
4236
|
+
registry.register(pattern, definition);
|
|
4237
|
+
continue;
|
|
4238
|
+
}
|
|
4186
4239
|
adoptRoute(pattern, entries.get(pattern));
|
|
4187
4240
|
}
|
|
4188
4241
|
return registry;
|
|
@@ -4678,7 +4731,7 @@ const __appModule = (() => {
|
|
|
4678
4731
|
const { createRouteRegistry, createRouter } = __routerModule;
|
|
4679
4732
|
const { createScheduler } = __schedulerModule;
|
|
4680
4733
|
const { createServerNamespace } = __serverModule;
|
|
4681
|
-
const { createSignal, createSignalRegistry } = __signalsModule;
|
|
4734
|
+
const { cloneSignalDeclaration, createSignal, createSignalRegistry } = __signalsModule;
|
|
4682
4735
|
const { createRegistryStore } = __registryStoreModule;
|
|
4683
4736
|
const { attributeName, normalizeAttributeConfig } = __attributesModule;
|
|
4684
4737
|
const { createLazyRegistry, defineRegistrySnapshot, sameRegistryValue } = __lazyRegistryModule;
|
|
@@ -4761,7 +4814,7 @@ const __appModule = (() => {
|
|
|
4761
4814
|
registryAssets: options.registryAssets,
|
|
4762
4815
|
importModule: options.importModule
|
|
4763
4816
|
});
|
|
4764
|
-
const registry = options.registry ?? app.registry
|
|
4817
|
+
const registry = options.registry ?? createRuntimeRegistry(app.registry, { target });
|
|
4765
4818
|
const signals = options.signals ?? createSignalRegistry(undefined, { registry, type: "signal", lazyRegistry });
|
|
4766
4819
|
const handlers = options.handlers ?? createHandlerRegistry(undefined, { registry, type: "handler", lazyRegistry });
|
|
4767
4820
|
const serverCache = createCacheRegistry(undefined, { registry, type: "cache.server" });
|
|
@@ -5142,6 +5195,22 @@ const __appModule = (() => {
|
|
|
5142
5195
|
registry?.registerMany?.(entries);
|
|
5143
5196
|
}
|
|
5144
5197
|
|
|
5198
|
+
function createRuntimeRegistry(appRegistry, { target } = {}) {
|
|
5199
|
+
const declarations = appRegistry.rawSnapshot();
|
|
5200
|
+
return createRegistryStore({
|
|
5201
|
+
...declarations,
|
|
5202
|
+
signal: cloneSignalDeclarations(declarations.signal)
|
|
5203
|
+
}, { target });
|
|
5204
|
+
}
|
|
5205
|
+
|
|
5206
|
+
function cloneSignalDeclarations(signals = {}) {
|
|
5207
|
+
const cloned = {};
|
|
5208
|
+
for (const [id, signalLike] of Object.entries(signals ?? {})) {
|
|
5209
|
+
cloned[id] = cloneSignalDeclaration(signalLike);
|
|
5210
|
+
}
|
|
5211
|
+
return cloned;
|
|
5212
|
+
}
|
|
5213
|
+
|
|
5145
5214
|
function emptyDeclarations() {
|
|
5146
5215
|
return {
|
|
5147
5216
|
signal: {},
|
|
@@ -5610,7 +5679,12 @@ const __serverRegistryModule = (() => {
|
|
|
5610
5679
|
return registry;
|
|
5611
5680
|
},
|
|
5612
5681
|
|
|
5613
|
-
_adoptMany() {
|
|
5682
|
+
_adoptMany(map = {}) {
|
|
5683
|
+
for (const [id, fn] of Object.entries(map ?? {})) {
|
|
5684
|
+
if (!entries.has(id)) {
|
|
5685
|
+
registry.register(id, fn);
|
|
5686
|
+
}
|
|
5687
|
+
}
|
|
5614
5688
|
return registry;
|
|
5615
5689
|
}
|
|
5616
5690
|
}, registryStore, type);
|