@async/framework 0.11.7 → 0.11.9
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 +27 -0
- package/browser.js +21 -15
- package/browser.min.js +1 -1
- package/browser.ts +21 -15
- package/browser.umd.js +21 -15
- package/browser.umd.min.js +1 -1
- package/framework.ts +24 -18
- package/package.json +1 -1
- package/server.js +24 -18
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@async/framework",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.9",
|
|
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
|
@@ -2383,7 +2383,7 @@ const __serverModule = (() => {
|
|
|
2383
2383
|
const serverEnvelopeKind = Symbol.for("@async/framework.serverResult");
|
|
2384
2384
|
const serverEnvelopeWireKey = "__async_server_result__";
|
|
2385
2385
|
const serverEnvelopeWireVersion = 1;
|
|
2386
|
-
const
|
|
2386
|
+
const serverResultInvocation = Symbol("@async/framework.serverResultInvocation");
|
|
2387
2387
|
|
|
2388
2388
|
function createServerProxy({
|
|
2389
2389
|
endpoint = "/__async/server",
|
|
@@ -2403,7 +2403,7 @@ const __serverModule = (() => {
|
|
|
2403
2403
|
|
|
2404
2404
|
async function run(id, args = [], context = {}) {
|
|
2405
2405
|
assertServerId(id);
|
|
2406
|
-
const runContext = { ...defaults, ...context };
|
|
2406
|
+
const runContext = createServerResultContext({ ...defaults, ...context });
|
|
2407
2407
|
const body = {
|
|
2408
2408
|
args,
|
|
2409
2409
|
input: context.input ?? defaultInput(runContext),
|
|
@@ -2461,12 +2461,13 @@ const __serverModule = (() => {
|
|
|
2461
2461
|
if (!isServerEnvelope(result)) {
|
|
2462
2462
|
return result;
|
|
2463
2463
|
}
|
|
2464
|
-
|
|
2464
|
+
const invocation = getServerResultInvocation(context);
|
|
2465
|
+
if (invocation.applied.has(result)) {
|
|
2465
2466
|
return result;
|
|
2466
2467
|
}
|
|
2468
|
+
invocation.applied.add(result);
|
|
2467
2469
|
|
|
2468
2470
|
if (result.error) {
|
|
2469
|
-
markAppliedServerResult(result);
|
|
2470
2471
|
throw toError(result.error);
|
|
2471
2472
|
}
|
|
2472
2473
|
|
|
@@ -2488,8 +2489,6 @@ const __serverModule = (() => {
|
|
|
2488
2489
|
await context.router?.navigate?.(result.redirect);
|
|
2489
2490
|
}
|
|
2490
2491
|
|
|
2491
|
-
markAppliedServerResult(result);
|
|
2492
|
-
|
|
2493
2492
|
return result;
|
|
2494
2493
|
}
|
|
2495
2494
|
|
|
@@ -2505,13 +2504,20 @@ const __serverModule = (() => {
|
|
|
2505
2504
|
return result;
|
|
2506
2505
|
}
|
|
2507
2506
|
|
|
2508
|
-
function
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2507
|
+
function createServerResultContext(context = {}) {
|
|
2508
|
+
const invocation = context[serverResultInvocation] ?? {
|
|
2509
|
+
applied: new WeakSet()
|
|
2510
|
+
};
|
|
2511
|
+
return {
|
|
2512
|
+
...context,
|
|
2513
|
+
[serverResultInvocation]: invocation
|
|
2514
|
+
};
|
|
2515
|
+
}
|
|
2516
|
+
|
|
2517
|
+
function getServerResultInvocation(context = {}) {
|
|
2518
|
+
return context[serverResultInvocation] ?? {
|
|
2519
|
+
applied: new WeakSet()
|
|
2520
|
+
};
|
|
2515
2521
|
}
|
|
2516
2522
|
|
|
2517
2523
|
function defaultInput(context = {}) {
|
|
@@ -2789,7 +2795,7 @@ const __serverModule = (() => {
|
|
|
2789
2795
|
throw new TypeError("Server function id must be a non-empty string.");
|
|
2790
2796
|
}
|
|
2791
2797
|
}
|
|
2792
|
-
return { createServerProxy, resolveServerCommandArguments, applyServerResult, consumeServerResult, unwrapServerResult, defaultInput, createServerNamespace, createSignalReader, assertServerId };
|
|
2798
|
+
return { createServerProxy, resolveServerCommandArguments, applyServerResult, consumeServerResult, unwrapServerResult, createServerResultContext, defaultInput, createServerNamespace, createSignalReader, assertServerId };
|
|
2793
2799
|
})();
|
|
2794
2800
|
|
|
2795
2801
|
const __handlersModule = (() => {
|
|
@@ -3048,7 +3054,7 @@ const __schedulerModule = (() => {
|
|
|
3048
3054
|
const value = fn();
|
|
3049
3055
|
if (value && typeof value.then === "function") {
|
|
3050
3056
|
asyncBatch = true;
|
|
3051
|
-
return value.finally(() => {
|
|
3057
|
+
return Promise.resolve(value).finally(() => {
|
|
3052
3058
|
batchDepth -= 1;
|
|
3053
3059
|
requestFlush();
|
|
3054
3060
|
});
|
|
@@ -5746,7 +5752,7 @@ const __requestContextModule = (() => {
|
|
|
5746
5752
|
const __serverRegistryModule = (() => {
|
|
5747
5753
|
const { readRequestContext } = __requestContextModule;
|
|
5748
5754
|
const { attachRegistryInspection, createRegistryStore } = __registryStoreModule;
|
|
5749
|
-
const { assertServerId, consumeServerResult, createServerNamespace, createSignalReader } = __serverModule;
|
|
5755
|
+
const { assertServerId, consumeServerResult, createServerNamespace, createServerResultContext, createSignalReader } = __serverModule;
|
|
5750
5756
|
function createServerRegistry(initialMap = {}, options = {}) {
|
|
5751
5757
|
const registryStore = options.registry ?? createRegistryStore();
|
|
5752
5758
|
const type = options.type ?? "server";
|
|
@@ -5801,7 +5807,7 @@ const __serverRegistryModule = (() => {
|
|
|
5801
5807
|
cache: defaults.cache ?? context.cache
|
|
5802
5808
|
});
|
|
5803
5809
|
|
|
5804
|
-
runContext = {
|
|
5810
|
+
runContext = createServerResultContext({
|
|
5805
5811
|
...mergedContext,
|
|
5806
5812
|
id,
|
|
5807
5813
|
args,
|
|
@@ -5810,7 +5816,7 @@ const __serverRegistryModule = (() => {
|
|
|
5810
5816
|
abort: mergedContext.abort,
|
|
5811
5817
|
cache: mergedContext.cache,
|
|
5812
5818
|
server
|
|
5813
|
-
};
|
|
5819
|
+
});
|
|
5814
5820
|
|
|
5815
5821
|
return consumeServerResult(await fn.call(runContext, ...args), runContext);
|
|
5816
5822
|
},
|