@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/browser.ts
CHANGED
|
@@ -186,6 +186,10 @@ const __asyncSignalModule = (() => {
|
|
|
186
186
|
};
|
|
187
187
|
},
|
|
188
188
|
|
|
189
|
+
_cloneSignalDeclaration() {
|
|
190
|
+
return asyncSignal(id, fn);
|
|
191
|
+
},
|
|
192
|
+
|
|
189
193
|
_restore(snapshot = {}) {
|
|
190
194
|
if (!isAsyncSignalSnapshot(snapshot)) {
|
|
191
195
|
return state.set(snapshot);
|
|
@@ -957,7 +961,12 @@ const __cacheModule = (() => {
|
|
|
957
961
|
return registryStore.entries(`${type}.entries`);
|
|
958
962
|
},
|
|
959
963
|
|
|
960
|
-
_adoptMany() {
|
|
964
|
+
_adoptMany(map = {}) {
|
|
965
|
+
for (const [id, definition] of Object.entries(map ?? {})) {
|
|
966
|
+
if (!definitions.has(id)) {
|
|
967
|
+
registryApi.register(id, definition);
|
|
968
|
+
}
|
|
969
|
+
}
|
|
961
970
|
return registryApi;
|
|
962
971
|
}
|
|
963
972
|
}, registryStore, type);
|
|
@@ -1115,6 +1124,10 @@ const __signalsModule = (() => {
|
|
|
1115
1124
|
|
|
1116
1125
|
snapshot() {
|
|
1117
1126
|
return value;
|
|
1127
|
+
},
|
|
1128
|
+
|
|
1129
|
+
_cloneSignalDeclaration() {
|
|
1130
|
+
return createSignal(value);
|
|
1118
1131
|
}
|
|
1119
1132
|
};
|
|
1120
1133
|
|
|
@@ -1157,6 +1170,10 @@ const __signalsModule = (() => {
|
|
|
1157
1170
|
return backing.snapshot();
|
|
1158
1171
|
},
|
|
1159
1172
|
|
|
1173
|
+
_cloneSignalDeclaration() {
|
|
1174
|
+
return computed(fn);
|
|
1175
|
+
},
|
|
1176
|
+
|
|
1160
1177
|
_bindRegistry(registry, id) {
|
|
1161
1178
|
return registry.effect(() => {
|
|
1162
1179
|
backing.set(fn.call({
|
|
@@ -1181,6 +1198,9 @@ const __signalsModule = (() => {
|
|
|
1181
1198
|
[effectKind]: true,
|
|
1182
1199
|
kind: "effect",
|
|
1183
1200
|
fn,
|
|
1201
|
+
_cloneSignalDeclaration() {
|
|
1202
|
+
return effect(fn);
|
|
1203
|
+
},
|
|
1184
1204
|
_bindRegistry(registry) {
|
|
1185
1205
|
return registry.effect(fn);
|
|
1186
1206
|
}
|
|
@@ -1399,10 +1419,14 @@ const __signalsModule = (() => {
|
|
|
1399
1419
|
},
|
|
1400
1420
|
|
|
1401
1421
|
_adoptMany(map = {}) {
|
|
1402
|
-
for (const id of Object.
|
|
1403
|
-
if (entries.has(id)) {
|
|
1404
|
-
|
|
1422
|
+
for (const [id, signalLike] of Object.entries(map ?? {})) {
|
|
1423
|
+
if (!entries.has(id)) {
|
|
1424
|
+
const entry = cloneSignalDeclaration(signalLike);
|
|
1425
|
+
entries.set(id, entry);
|
|
1426
|
+
bindEntry(id, entry);
|
|
1427
|
+
continue;
|
|
1405
1428
|
}
|
|
1429
|
+
bindEntry(id, entries.get(id));
|
|
1406
1430
|
}
|
|
1407
1431
|
return registry;
|
|
1408
1432
|
}
|
|
@@ -1480,6 +1504,16 @@ const __signalsModule = (() => {
|
|
|
1480
1504
|
return createSignal(signalLike);
|
|
1481
1505
|
}
|
|
1482
1506
|
|
|
1507
|
+
function cloneSignalDeclaration(signalLike) {
|
|
1508
|
+
if (typeof signalLike?._cloneSignalDeclaration === "function") {
|
|
1509
|
+
return signalLike._cloneSignalDeclaration();
|
|
1510
|
+
}
|
|
1511
|
+
if (isSignalLike(signalLike)) {
|
|
1512
|
+
return createSignal(typeof signalLike.snapshot === "function" ? signalLike.snapshot() : signalLike.value);
|
|
1513
|
+
}
|
|
1514
|
+
return createSignal(signalLike);
|
|
1515
|
+
}
|
|
1516
|
+
|
|
1483
1517
|
function isSignalLike(value) {
|
|
1484
1518
|
return Boolean(value && typeof value === "object" && typeof value.subscribe === "function");
|
|
1485
1519
|
}
|
|
@@ -1658,7 +1692,7 @@ const __signalsModule = (() => {
|
|
|
1658
1692
|
frame.add(path);
|
|
1659
1693
|
}
|
|
1660
1694
|
}
|
|
1661
|
-
return { createSignal, computed, effect, createSignalRegistry, isSignalRef, signal };
|
|
1695
|
+
return { createSignal, computed, effect, createSignalRegistry, cloneSignalDeclaration, isSignalRef, signal };
|
|
1662
1696
|
})();
|
|
1663
1697
|
|
|
1664
1698
|
const __htmlModule = (() => {
|
|
@@ -1900,7 +1934,12 @@ const __componentModule = (() => {
|
|
|
1900
1934
|
return lazyComponents.get(id);
|
|
1901
1935
|
},
|
|
1902
1936
|
|
|
1903
|
-
_adoptMany() {
|
|
1937
|
+
_adoptMany(map = {}) {
|
|
1938
|
+
for (const [id, Component] of Object.entries(map ?? {})) {
|
|
1939
|
+
if (!entries.has(id)) {
|
|
1940
|
+
registry.register(id, Component);
|
|
1941
|
+
}
|
|
1942
|
+
}
|
|
1904
1943
|
return registry;
|
|
1905
1944
|
}
|
|
1906
1945
|
}, registryStore, type);
|
|
@@ -2740,7 +2779,12 @@ const __handlersModule = (() => {
|
|
|
2740
2779
|
return results;
|
|
2741
2780
|
},
|
|
2742
2781
|
|
|
2743
|
-
_adoptMany() {
|
|
2782
|
+
_adoptMany(map = {}) {
|
|
2783
|
+
for (const [id, fn] of Object.entries(map ?? {})) {
|
|
2784
|
+
if (!handlers.has(id)) {
|
|
2785
|
+
registry.register(id, fn);
|
|
2786
|
+
}
|
|
2787
|
+
}
|
|
2744
2788
|
return registry;
|
|
2745
2789
|
}
|
|
2746
2790
|
}, registryStore, type);
|
|
@@ -4029,7 +4073,12 @@ const __partialsModule = (() => {
|
|
|
4029
4073
|
return normalizePartialResult(result, partialContext);
|
|
4030
4074
|
},
|
|
4031
4075
|
|
|
4032
|
-
_adoptMany() {
|
|
4076
|
+
_adoptMany(map = {}) {
|
|
4077
|
+
for (const [id, fn] of Object.entries(map ?? {})) {
|
|
4078
|
+
if (!entries.has(id)) {
|
|
4079
|
+
registry.register(id, fn);
|
|
4080
|
+
}
|
|
4081
|
+
}
|
|
4033
4082
|
return registry;
|
|
4034
4083
|
}
|
|
4035
4084
|
}, registryStore, type);
|
|
@@ -4181,7 +4230,11 @@ const __routerModule = (() => {
|
|
|
4181
4230
|
},
|
|
4182
4231
|
|
|
4183
4232
|
_adoptMany(map = {}) {
|
|
4184
|
-
for (const pattern of Object.
|
|
4233
|
+
for (const [pattern, definition] of Object.entries(map ?? {})) {
|
|
4234
|
+
if (!entries.has(pattern)) {
|
|
4235
|
+
registry.register(pattern, definition);
|
|
4236
|
+
continue;
|
|
4237
|
+
}
|
|
4185
4238
|
adoptRoute(pattern, entries.get(pattern));
|
|
4186
4239
|
}
|
|
4187
4240
|
return registry;
|
|
@@ -4677,7 +4730,7 @@ const __appModule = (() => {
|
|
|
4677
4730
|
const { createRouteRegistry, createRouter } = __routerModule;
|
|
4678
4731
|
const { createScheduler } = __schedulerModule;
|
|
4679
4732
|
const { createServerNamespace } = __serverModule;
|
|
4680
|
-
const { createSignal, createSignalRegistry } = __signalsModule;
|
|
4733
|
+
const { cloneSignalDeclaration, createSignal, createSignalRegistry } = __signalsModule;
|
|
4681
4734
|
const { createRegistryStore } = __registryStoreModule;
|
|
4682
4735
|
const { attributeName, normalizeAttributeConfig } = __attributesModule;
|
|
4683
4736
|
const { createLazyRegistry, defineRegistrySnapshot, sameRegistryValue } = __lazyRegistryModule;
|
|
@@ -4760,7 +4813,7 @@ const __appModule = (() => {
|
|
|
4760
4813
|
registryAssets: options.registryAssets,
|
|
4761
4814
|
importModule: options.importModule
|
|
4762
4815
|
});
|
|
4763
|
-
const registry = options.registry ?? app.registry
|
|
4816
|
+
const registry = options.registry ?? createRuntimeRegistry(app.registry, { target });
|
|
4764
4817
|
const signals = options.signals ?? createSignalRegistry(undefined, { registry, type: "signal", lazyRegistry });
|
|
4765
4818
|
const handlers = options.handlers ?? createHandlerRegistry(undefined, { registry, type: "handler", lazyRegistry });
|
|
4766
4819
|
const serverCache = createCacheRegistry(undefined, { registry, type: "cache.server" });
|
|
@@ -5141,6 +5194,22 @@ const __appModule = (() => {
|
|
|
5141
5194
|
registry?.registerMany?.(entries);
|
|
5142
5195
|
}
|
|
5143
5196
|
|
|
5197
|
+
function createRuntimeRegistry(appRegistry, { target } = {}) {
|
|
5198
|
+
const declarations = appRegistry.rawSnapshot();
|
|
5199
|
+
return createRegistryStore({
|
|
5200
|
+
...declarations,
|
|
5201
|
+
signal: cloneSignalDeclarations(declarations.signal)
|
|
5202
|
+
}, { target });
|
|
5203
|
+
}
|
|
5204
|
+
|
|
5205
|
+
function cloneSignalDeclarations(signals = {}) {
|
|
5206
|
+
const cloned = {};
|
|
5207
|
+
for (const [id, signalLike] of Object.entries(signals ?? {})) {
|
|
5208
|
+
cloned[id] = cloneSignalDeclaration(signalLike);
|
|
5209
|
+
}
|
|
5210
|
+
return cloned;
|
|
5211
|
+
}
|
|
5212
|
+
|
|
5144
5213
|
function emptyDeclarations() {
|
|
5145
5214
|
return {
|
|
5146
5215
|
signal: {},
|
package/browser.umd.js
CHANGED
|
@@ -196,6 +196,10 @@
|
|
|
196
196
|
};
|
|
197
197
|
},
|
|
198
198
|
|
|
199
|
+
_cloneSignalDeclaration() {
|
|
200
|
+
return asyncSignal(id, fn);
|
|
201
|
+
},
|
|
202
|
+
|
|
199
203
|
_restore(snapshot = {}) {
|
|
200
204
|
if (!isAsyncSignalSnapshot(snapshot)) {
|
|
201
205
|
return state.set(snapshot);
|
|
@@ -967,7 +971,12 @@
|
|
|
967
971
|
return registryStore.entries(`${type}.entries`);
|
|
968
972
|
},
|
|
969
973
|
|
|
970
|
-
_adoptMany() {
|
|
974
|
+
_adoptMany(map = {}) {
|
|
975
|
+
for (const [id, definition] of Object.entries(map ?? {})) {
|
|
976
|
+
if (!definitions.has(id)) {
|
|
977
|
+
registryApi.register(id, definition);
|
|
978
|
+
}
|
|
979
|
+
}
|
|
971
980
|
return registryApi;
|
|
972
981
|
}
|
|
973
982
|
}, registryStore, type);
|
|
@@ -1125,6 +1134,10 @@
|
|
|
1125
1134
|
|
|
1126
1135
|
snapshot() {
|
|
1127
1136
|
return value;
|
|
1137
|
+
},
|
|
1138
|
+
|
|
1139
|
+
_cloneSignalDeclaration() {
|
|
1140
|
+
return createSignal(value);
|
|
1128
1141
|
}
|
|
1129
1142
|
};
|
|
1130
1143
|
|
|
@@ -1167,6 +1180,10 @@
|
|
|
1167
1180
|
return backing.snapshot();
|
|
1168
1181
|
},
|
|
1169
1182
|
|
|
1183
|
+
_cloneSignalDeclaration() {
|
|
1184
|
+
return computed(fn);
|
|
1185
|
+
},
|
|
1186
|
+
|
|
1170
1187
|
_bindRegistry(registry, id) {
|
|
1171
1188
|
return registry.effect(() => {
|
|
1172
1189
|
backing.set(fn.call({
|
|
@@ -1191,6 +1208,9 @@
|
|
|
1191
1208
|
[effectKind]: true,
|
|
1192
1209
|
kind: "effect",
|
|
1193
1210
|
fn,
|
|
1211
|
+
_cloneSignalDeclaration() {
|
|
1212
|
+
return effect(fn);
|
|
1213
|
+
},
|
|
1194
1214
|
_bindRegistry(registry) {
|
|
1195
1215
|
return registry.effect(fn);
|
|
1196
1216
|
}
|
|
@@ -1409,10 +1429,14 @@
|
|
|
1409
1429
|
},
|
|
1410
1430
|
|
|
1411
1431
|
_adoptMany(map = {}) {
|
|
1412
|
-
for (const id of Object.
|
|
1413
|
-
if (entries.has(id)) {
|
|
1414
|
-
|
|
1432
|
+
for (const [id, signalLike] of Object.entries(map ?? {})) {
|
|
1433
|
+
if (!entries.has(id)) {
|
|
1434
|
+
const entry = cloneSignalDeclaration(signalLike);
|
|
1435
|
+
entries.set(id, entry);
|
|
1436
|
+
bindEntry(id, entry);
|
|
1437
|
+
continue;
|
|
1415
1438
|
}
|
|
1439
|
+
bindEntry(id, entries.get(id));
|
|
1416
1440
|
}
|
|
1417
1441
|
return registry;
|
|
1418
1442
|
}
|
|
@@ -1490,6 +1514,16 @@
|
|
|
1490
1514
|
return createSignal(signalLike);
|
|
1491
1515
|
}
|
|
1492
1516
|
|
|
1517
|
+
function cloneSignalDeclaration(signalLike) {
|
|
1518
|
+
if (typeof signalLike?._cloneSignalDeclaration === "function") {
|
|
1519
|
+
return signalLike._cloneSignalDeclaration();
|
|
1520
|
+
}
|
|
1521
|
+
if (isSignalLike(signalLike)) {
|
|
1522
|
+
return createSignal(typeof signalLike.snapshot === "function" ? signalLike.snapshot() : signalLike.value);
|
|
1523
|
+
}
|
|
1524
|
+
return createSignal(signalLike);
|
|
1525
|
+
}
|
|
1526
|
+
|
|
1493
1527
|
function isSignalLike(value) {
|
|
1494
1528
|
return Boolean(value && typeof value === "object" && typeof value.subscribe === "function");
|
|
1495
1529
|
}
|
|
@@ -1668,7 +1702,7 @@
|
|
|
1668
1702
|
frame.add(path);
|
|
1669
1703
|
}
|
|
1670
1704
|
}
|
|
1671
|
-
return { createSignal, computed, effect, createSignalRegistry, isSignalRef, signal };
|
|
1705
|
+
return { createSignal, computed, effect, createSignalRegistry, cloneSignalDeclaration, isSignalRef, signal };
|
|
1672
1706
|
})();
|
|
1673
1707
|
|
|
1674
1708
|
const __htmlModule = (() => {
|
|
@@ -1910,7 +1944,12 @@
|
|
|
1910
1944
|
return lazyComponents.get(id);
|
|
1911
1945
|
},
|
|
1912
1946
|
|
|
1913
|
-
_adoptMany() {
|
|
1947
|
+
_adoptMany(map = {}) {
|
|
1948
|
+
for (const [id, Component] of Object.entries(map ?? {})) {
|
|
1949
|
+
if (!entries.has(id)) {
|
|
1950
|
+
registry.register(id, Component);
|
|
1951
|
+
}
|
|
1952
|
+
}
|
|
1914
1953
|
return registry;
|
|
1915
1954
|
}
|
|
1916
1955
|
}, registryStore, type);
|
|
@@ -2750,7 +2789,12 @@
|
|
|
2750
2789
|
return results;
|
|
2751
2790
|
},
|
|
2752
2791
|
|
|
2753
|
-
_adoptMany() {
|
|
2792
|
+
_adoptMany(map = {}) {
|
|
2793
|
+
for (const [id, fn] of Object.entries(map ?? {})) {
|
|
2794
|
+
if (!handlers.has(id)) {
|
|
2795
|
+
registry.register(id, fn);
|
|
2796
|
+
}
|
|
2797
|
+
}
|
|
2754
2798
|
return registry;
|
|
2755
2799
|
}
|
|
2756
2800
|
}, registryStore, type);
|
|
@@ -4039,7 +4083,12 @@
|
|
|
4039
4083
|
return normalizePartialResult(result, partialContext);
|
|
4040
4084
|
},
|
|
4041
4085
|
|
|
4042
|
-
_adoptMany() {
|
|
4086
|
+
_adoptMany(map = {}) {
|
|
4087
|
+
for (const [id, fn] of Object.entries(map ?? {})) {
|
|
4088
|
+
if (!entries.has(id)) {
|
|
4089
|
+
registry.register(id, fn);
|
|
4090
|
+
}
|
|
4091
|
+
}
|
|
4043
4092
|
return registry;
|
|
4044
4093
|
}
|
|
4045
4094
|
}, registryStore, type);
|
|
@@ -4191,7 +4240,11 @@
|
|
|
4191
4240
|
},
|
|
4192
4241
|
|
|
4193
4242
|
_adoptMany(map = {}) {
|
|
4194
|
-
for (const pattern of Object.
|
|
4243
|
+
for (const [pattern, definition] of Object.entries(map ?? {})) {
|
|
4244
|
+
if (!entries.has(pattern)) {
|
|
4245
|
+
registry.register(pattern, definition);
|
|
4246
|
+
continue;
|
|
4247
|
+
}
|
|
4195
4248
|
adoptRoute(pattern, entries.get(pattern));
|
|
4196
4249
|
}
|
|
4197
4250
|
return registry;
|
|
@@ -4687,7 +4740,7 @@
|
|
|
4687
4740
|
const { createRouteRegistry, createRouter } = __routerModule;
|
|
4688
4741
|
const { createScheduler } = __schedulerModule;
|
|
4689
4742
|
const { createServerNamespace } = __serverModule;
|
|
4690
|
-
const { createSignal, createSignalRegistry } = __signalsModule;
|
|
4743
|
+
const { cloneSignalDeclaration, createSignal, createSignalRegistry } = __signalsModule;
|
|
4691
4744
|
const { createRegistryStore } = __registryStoreModule;
|
|
4692
4745
|
const { attributeName, normalizeAttributeConfig } = __attributesModule;
|
|
4693
4746
|
const { createLazyRegistry, defineRegistrySnapshot, sameRegistryValue } = __lazyRegistryModule;
|
|
@@ -4770,7 +4823,7 @@
|
|
|
4770
4823
|
registryAssets: options.registryAssets,
|
|
4771
4824
|
importModule: options.importModule
|
|
4772
4825
|
});
|
|
4773
|
-
const registry = options.registry ?? app.registry
|
|
4826
|
+
const registry = options.registry ?? createRuntimeRegistry(app.registry, { target });
|
|
4774
4827
|
const signals = options.signals ?? createSignalRegistry(undefined, { registry, type: "signal", lazyRegistry });
|
|
4775
4828
|
const handlers = options.handlers ?? createHandlerRegistry(undefined, { registry, type: "handler", lazyRegistry });
|
|
4776
4829
|
const serverCache = createCacheRegistry(undefined, { registry, type: "cache.server" });
|
|
@@ -5151,6 +5204,22 @@
|
|
|
5151
5204
|
registry?.registerMany?.(entries);
|
|
5152
5205
|
}
|
|
5153
5206
|
|
|
5207
|
+
function createRuntimeRegistry(appRegistry, { target } = {}) {
|
|
5208
|
+
const declarations = appRegistry.rawSnapshot();
|
|
5209
|
+
return createRegistryStore({
|
|
5210
|
+
...declarations,
|
|
5211
|
+
signal: cloneSignalDeclarations(declarations.signal)
|
|
5212
|
+
}, { target });
|
|
5213
|
+
}
|
|
5214
|
+
|
|
5215
|
+
function cloneSignalDeclarations(signals = {}) {
|
|
5216
|
+
const cloned = {};
|
|
5217
|
+
for (const [id, signalLike] of Object.entries(signals ?? {})) {
|
|
5218
|
+
cloned[id] = cloneSignalDeclaration(signalLike);
|
|
5219
|
+
}
|
|
5220
|
+
return cloned;
|
|
5221
|
+
}
|
|
5222
|
+
|
|
5154
5223
|
function emptyDeclarations() {
|
|
5155
5224
|
return {
|
|
5156
5225
|
signal: {},
|