@askrjs/askr 0.0.56 → 0.0.58
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/dist/benchmark.js +4 -4
- package/dist/boot/index.js +1 -1
- package/dist/{boot-ylKadz_Y.js → boot-tQCKG8nx.js} +10 -17
- package/dist/{deferred-C-mkQ9J1.js → deferred-CSFYIBJL.js} +69 -2
- package/dist/index.js +1 -1
- package/dist/{navigate-Nh4ibPyt.js → navigate-mkLGM5ec.js} +6 -58
- package/dist/{renderer-CJFgcaun.js → renderer-CCvnNMna.js} +4 -2
- package/dist/router/index.d.ts +5 -2
- package/dist/router/index.js +2 -2
- package/dist/ssg/index.js +2 -2
- package/dist/ssr/index.js +1 -1
- package/dist/{ssr-rvWGTg-y.js → ssr-DVFKktPX.js} +2 -1
- package/dist/{verify-hydration-BfINbTwe.js → verify-hydration-C41fY5Z2.js} +1 -1
- package/package.json +1 -1
package/dist/benchmark.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { r as flushRuntimeScheduler } from "./access-Bg4RJNC8.js";
|
|
2
|
-
import { t as installRendererBridge } from "./renderer-
|
|
2
|
+
import { t as installRendererBridge } from "./renderer-CCvnNMna.js";
|
|
3
3
|
import { t as state } from "./state-DPl8lffD.js";
|
|
4
4
|
import { t as selector } from "./selector-DafVYzV4.js";
|
|
5
5
|
import { jsx, jsxs } from "./jsx-runtime.js";
|
|
6
6
|
import { i as For } from "./control-BJmonrpE.js";
|
|
7
|
-
import { t as createIsland } from "./boot-
|
|
7
|
+
import { t as createIsland } from "./boot-tQCKG8nx.js";
|
|
8
8
|
//#region src/bench/components/benchmark-row.tsx
|
|
9
9
|
function BenchmarkRow({ item, isSelected, onSelect, onRemove }) {
|
|
10
10
|
return /* @__PURE__ */ jsxs("tr", {
|
|
@@ -63,8 +63,8 @@ function BenchmarkTable({ rows, isSelected, onSelect, onRemove }) {
|
|
|
63
63
|
installRendererBridge();
|
|
64
64
|
const benchmarkMetadata = {
|
|
65
65
|
packageName: "@askrjs/askr",
|
|
66
|
-
packageVersion: "0.0.
|
|
67
|
-
buildLabel: "0.0.
|
|
66
|
+
packageVersion: "0.0.58",
|
|
67
|
+
buildLabel: "0.0.58-local"
|
|
68
68
|
};
|
|
69
69
|
function getBenchmarkMetadata() {
|
|
70
70
|
return { ...benchmarkMetadata };
|
package/dist/boot/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as cleanupApp, i as hydrateSPA, n as createIslands, o as hasApp, r as createSPA, t as createIsland } from "../boot-
|
|
1
|
+
import { a as cleanupApp, i as hydrateSPA, n as createIslands, o as hasApp, r as createSPA, t as createIsland } from "../boot-tQCKG8nx.js";
|
|
2
2
|
export { cleanupApp, createIsland, createIslands, createSPA, hasApp, hydrateSPA };
|
|
@@ -2,15 +2,15 @@ import { b as isDevelopmentEnvironment, r as flushRuntimeScheduler, v as logger,
|
|
|
2
2
|
import { n as Fragment, t as ELEMENT_TYPE } from "./jsx-CUpRxrLH.js";
|
|
3
3
|
import { n as createComponentInstance, r as executeComponent } from "./component-internal-NdN_bJ2-.js";
|
|
4
4
|
import { h as cleanupComponent, m as isPromiseLike } from "./component-lifecycle-C7lnU9Bt.js";
|
|
5
|
-
import { a as withIntrinsicHydrationAdoption, i as registerDeferredHydrationBoundary, n as activateHydrationBoundary$1, o as setStaticChildSlotsCacheEnabled, r as clearDeferredHydrationBoundaries, t as installRendererBridge } from "./renderer-
|
|
5
|
+
import { a as withIntrinsicHydrationAdoption, i as registerDeferredHydrationBoundary, n as activateHydrationBoundary$1, o as setStaticChildSlotsCacheEnabled, r as clearDeferredHydrationBoundaries, t as installRendererBridge } from "./renderer-CCvnNMna.js";
|
|
6
6
|
import { _ as teardownNodeSubtree, d as removeAllListeners } from "./cleanup-DScKZG2i.js";
|
|
7
|
-
import {
|
|
7
|
+
import { C as assertExecutionModel, S as route, a as resolveRouteMeta, c as registerAppInstance, d as clearRoutes, g as createAppRenderRuntime, h as setServerLocation, i as reconcileRouteMeta, l as unregisterAppInstance, s as configureScrollRestoration, t as initializeNavigation, u as _applyManifest } from "./navigate-mkLGM5ec.js";
|
|
8
8
|
import { a as startHydrationRenderPhase, s as stopHydrationRenderPhase } from "./render-context-Clw3rFiO.js";
|
|
9
9
|
import { a as disposeDefaultPortalScope, t as DefaultPortal } from "./portal-C47xkwXj.js";
|
|
10
10
|
import { i as getDefaultDataRuntime } from "./data-runtime-SJ1BSUvk.js";
|
|
11
11
|
import { a as hydrateDataRuntime } from "./query-registry-CQIT4mXr.js";
|
|
12
12
|
import { a as resolveRouteFromRoutes, d as _setActiveRouteAuthOptions, j as lockRouteRegistration, k as hasRegisteredRoutes } from "./route-matching-vJpvLVbX.js";
|
|
13
|
-
import { _ as pageRenderEnvelope, d as hasRouteRenderData, f as resolveRouteRequest, l as getRouteRenderContext, o as reviveDeferredValue, u as getRouteRenderData } from "./deferred-
|
|
13
|
+
import { _ as pageRenderEnvelope, d as hasRouteRenderData, f as resolveRouteRequest, l as getRouteRenderContext, o as reviveDeferredValue, u as getRouteRenderData, x as _preloadRouteHandler } from "./deferred-CSFYIBJL.js";
|
|
14
14
|
import "./ssr-CbQO5xd3.js";
|
|
15
15
|
//#region src/boot/hydration.ts
|
|
16
16
|
const DEFERRED_PAYLOAD = "__askr_deferred__";
|
|
@@ -404,13 +404,16 @@ async function resolveInitialRoute(auth, source) {
|
|
|
404
404
|
manifest: source.manifest,
|
|
405
405
|
auth,
|
|
406
406
|
load: source.load
|
|
407
|
-
}) : source?.routes ? (() => {
|
|
407
|
+
}) : source?.routes ? await (() => {
|
|
408
408
|
const match = resolveRouteFromRoutes(path, source.routes);
|
|
409
|
-
|
|
409
|
+
if (!match) return null;
|
|
410
|
+
const lazyImport = _preloadRouteHandler(match.handler);
|
|
411
|
+
const result = {
|
|
410
412
|
kind: "render",
|
|
411
413
|
handler: match.handler,
|
|
412
414
|
params: match.params
|
|
413
|
-
}
|
|
415
|
+
};
|
|
416
|
+
return lazyImport ? lazyImport.then(() => result) : result;
|
|
414
417
|
})() : await resolveRouteRequest(href, { auth });
|
|
415
418
|
if (typeof window === "undefined" || !resolved || resolved.kind !== "redirect") return {
|
|
416
419
|
path,
|
|
@@ -477,10 +480,6 @@ async function createSPA(config) {
|
|
|
477
480
|
if (!hasManifest && !hasRoutes) throw new Error("createSPA requires a route manifest or route table. Pass `manifest: getManifest()` or `routes: getRoutes()`. If you are enhancing existing HTML, use createIsland instead.");
|
|
478
481
|
const rootElement = resolveRootElement(config.root);
|
|
479
482
|
if (!rootElement) throw new Error(`Root element not found: ${config.root}`);
|
|
480
|
-
const pendingLazyAtBoot = [..._snapshotLazy(), ..._snapshotRouteSourceLazy({
|
|
481
|
-
registry: config.registry,
|
|
482
|
-
manifest
|
|
483
|
-
})];
|
|
484
483
|
configureScrollRestoration(config.scrollRestoration);
|
|
485
484
|
clearRoutes();
|
|
486
485
|
if (hasManifest) _applyManifest(manifest);
|
|
@@ -493,7 +492,6 @@ async function createSPA(config) {
|
|
|
493
492
|
auth: routeAuth
|
|
494
493
|
};
|
|
495
494
|
_setActiveRouteAuthOptions(routeAuth);
|
|
496
|
-
await _drainLazy(pendingLazyAtBoot);
|
|
497
495
|
if (isProductionEnvironment()) lockRouteRegistration();
|
|
498
496
|
const { path, resolved } = await resolveInitialRoute(routeAuth, {
|
|
499
497
|
manifest: activeManifest,
|
|
@@ -554,10 +552,6 @@ async function hydrateSPA(config) {
|
|
|
554
552
|
const hydrationQueryCache = hydrationRenderData?.resources;
|
|
555
553
|
if (hydrationQueryCache) hydrateDataRuntime(config.dataRuntime ?? getDefaultDataRuntime(), hydrationQueryCache);
|
|
556
554
|
const hydrationRenderDataForApp = hydrationRenderData;
|
|
557
|
-
const pendingLazyAtHydrationBoot = [..._snapshotLazy(), ..._snapshotRouteSourceLazy({
|
|
558
|
-
registry: config.registry,
|
|
559
|
-
manifest
|
|
560
|
-
})];
|
|
561
555
|
configureScrollRestoration(config.scrollRestoration);
|
|
562
556
|
clearRoutes();
|
|
563
557
|
if (hasManifest) _applyManifest(manifest);
|
|
@@ -575,7 +569,6 @@ async function hydrateSPA(config) {
|
|
|
575
569
|
})
|
|
576
570
|
};
|
|
577
571
|
_setActiveRouteAuthOptions(routeAuth);
|
|
578
|
-
await _drainLazy(pendingLazyAtHydrationBoot);
|
|
579
572
|
const { path, href: currentUrl, resolved } = await resolveInitialRoute(routeAuth, {
|
|
580
573
|
manifest: activeManifest,
|
|
581
574
|
routes: hasManifest ? void 0 : routeTable,
|
|
@@ -601,7 +594,7 @@ async function hydrateSPA(config) {
|
|
|
601
594
|
handler: r.handler,
|
|
602
595
|
namespace: r.options.namespace
|
|
603
596
|
})) : routeTable;
|
|
604
|
-
const { verifyHydrationSyncForUrl } = await import("./verify-hydration-
|
|
597
|
+
const { verifyHydrationSyncForUrl } = await import("./verify-hydration-C41fY5Z2.js");
|
|
605
598
|
if (!verifyHydrationSyncForUrl({
|
|
606
599
|
root: rootElement,
|
|
607
600
|
url: currentUrl,
|
|
@@ -7,6 +7,62 @@ import { t as resource } from "./resource-operation-CUAUBhUB.js";
|
|
|
7
7
|
import { t as ROUTE_ROOT_COMPONENT } from "./router-internal-BC0w1_xk.js";
|
|
8
8
|
import { c as withTelemetry, t as createQueryPrefetchContext } from "./query-registry-CQIT4mXr.js";
|
|
9
9
|
import { E as getRouteRecords, h as getActiveRouteAuthOptions, i as getMatchingRouteRecord, o as buildRouteContext, s as buildRouteContextBase } from "./route-matching-vJpvLVbX.js";
|
|
10
|
+
//#region src/router/lazy.ts
|
|
11
|
+
const pendingLazy = /* @__PURE__ */ new Set();
|
|
12
|
+
const lazyStates = /* @__PURE__ */ new WeakMap();
|
|
13
|
+
const handlerLazyComponents = /* @__PURE__ */ new WeakMap();
|
|
14
|
+
function startLazyLoad(state) {
|
|
15
|
+
if (state.promise) return state.promise;
|
|
16
|
+
let promise;
|
|
17
|
+
promise = Promise.resolve().then(state.factory).then((mod) => {
|
|
18
|
+
state.resolved = typeof mod === "function" ? mod : mod.default;
|
|
19
|
+
}, (err) => {
|
|
20
|
+
state.loadError = err;
|
|
21
|
+
}).finally(() => {
|
|
22
|
+
pendingLazy.delete(promise);
|
|
23
|
+
});
|
|
24
|
+
state.promise = promise;
|
|
25
|
+
pendingLazy.add(promise);
|
|
26
|
+
return promise;
|
|
27
|
+
}
|
|
28
|
+
function lazy(factory) {
|
|
29
|
+
const state = {
|
|
30
|
+
factory,
|
|
31
|
+
promise: null,
|
|
32
|
+
resolved: null,
|
|
33
|
+
loadError: null
|
|
34
|
+
};
|
|
35
|
+
const component = ((params) => {
|
|
36
|
+
if (state.loadError) throw state.loadError;
|
|
37
|
+
if (!state.resolved) throw new Error("lazy() component used before it was resolved. Matched routes load automatically; call component.preload() for explicit preloading.");
|
|
38
|
+
return state.resolved(params);
|
|
39
|
+
});
|
|
40
|
+
Object.defineProperty(component, "preload", { value: () => startLazyLoad(state) });
|
|
41
|
+
lazyStates.set(component, state);
|
|
42
|
+
return component;
|
|
43
|
+
}
|
|
44
|
+
function _preloadRouteRecord(record) {
|
|
45
|
+
const imports = [
|
|
46
|
+
record.component,
|
|
47
|
+
...record.pageChain.map((scope) => scope.component),
|
|
48
|
+
...record.layoutChain.map((scope) => scope.component)
|
|
49
|
+
].flatMap((component) => {
|
|
50
|
+
const state = lazyStates.get(component);
|
|
51
|
+
return state ? [startLazyLoad(state)] : [];
|
|
52
|
+
});
|
|
53
|
+
return imports.length > 0 ? Promise.all(imports).then(() => void 0) : null;
|
|
54
|
+
}
|
|
55
|
+
function _associateLazyHandler(handler, components) {
|
|
56
|
+
handlerLazyComponents.set(handler, components);
|
|
57
|
+
}
|
|
58
|
+
function _preloadRouteHandler(handler) {
|
|
59
|
+
const imports = (handlerLazyComponents.get(handler) ?? []).flatMap((component) => {
|
|
60
|
+
const state = lazyStates.get(component);
|
|
61
|
+
return state ? [startLazyLoad(state)] : [];
|
|
62
|
+
});
|
|
63
|
+
return imports.length > 0 ? Promise.all(imports).then(() => void 0) : null;
|
|
64
|
+
}
|
|
65
|
+
//#endregion
|
|
10
66
|
//#region src/router/rendering.ts
|
|
11
67
|
const outletScope = defineScope(null);
|
|
12
68
|
function Outlet() {
|
|
@@ -35,7 +91,7 @@ function createRouteComponentVNode(component, params, routeRoot = false) {
|
|
|
35
91
|
};
|
|
36
92
|
}
|
|
37
93
|
function createRouteHandler(component, pageChain, layoutChain, deferComponents = false) {
|
|
38
|
-
|
|
94
|
+
const handler = (params) => {
|
|
39
95
|
let content = deferComponents ? createRouteComponentVNode(component, params, true) : component(params);
|
|
40
96
|
content = applyPageChain(pageChain, params, content, deferComponents);
|
|
41
97
|
for (let i = layoutChain.length - 1; i >= 0; i--) {
|
|
@@ -44,6 +100,12 @@ function createRouteHandler(component, pageChain, layoutChain, deferComponents =
|
|
|
44
100
|
}
|
|
45
101
|
return content;
|
|
46
102
|
};
|
|
103
|
+
_associateLazyHandler(handler, [
|
|
104
|
+
component,
|
|
105
|
+
...pageChain.map((scope) => scope.component),
|
|
106
|
+
...layoutChain.map((scope) => scope.component)
|
|
107
|
+
]);
|
|
108
|
+
return handler;
|
|
47
109
|
}
|
|
48
110
|
function getRenderHandler(record) {
|
|
49
111
|
return record.renderHandler ?? createRouteHandler(record.component, record.pageChain, record.layoutChain, true);
|
|
@@ -151,6 +213,11 @@ function hasRouteRenderData(result) {
|
|
|
151
213
|
return routeRenderData.has(result);
|
|
152
214
|
}
|
|
153
215
|
function buildRenderResult(record, params, context, request, telemetry, load) {
|
|
216
|
+
const lazyImport = _preloadRouteRecord(record);
|
|
217
|
+
if (lazyImport) return lazyImport.then(() => buildLoadedRenderResult(record, params, context, request, telemetry, load));
|
|
218
|
+
return buildLoadedRenderResult(record, params, context, request, telemetry, load);
|
|
219
|
+
}
|
|
220
|
+
function buildLoadedRenderResult(record, params, context, request, telemetry, load) {
|
|
154
221
|
const renderHandler = getRenderHandler(record);
|
|
155
222
|
const loader = context.mode !== "ssg" && load ? record.options?.loader : void 0;
|
|
156
223
|
const preload = record.options?.preload;
|
|
@@ -383,4 +450,4 @@ function Resolve(props) {
|
|
|
383
450
|
return props.children(result.value);
|
|
384
451
|
}
|
|
385
452
|
//#endregion
|
|
386
|
-
export { pageRenderEnvelope as _, resolveDeferredValues as a, getRenderHandler as b, bindResolvedRouteData as c, hasRouteRenderData as d, resolveRouteRequest as f, isPageRenderEnvelope as g, isEmptyPageRenderEnvelope as h, isDeferred as i, getRouteRenderContext as l, createPageRenderEnvelope as m, Resolve as n, reviveDeferredValue as o, currentAuth as p, defer as r, routeData as s, DEFERRED_BOUNDARY as t, getRouteRenderData as u, Outlet as v, createRouteHandler as y };
|
|
453
|
+
export { lazy as S, pageRenderEnvelope as _, resolveDeferredValues as a, getRenderHandler as b, bindResolvedRouteData as c, hasRouteRenderData as d, resolveRouteRequest as f, isPageRenderEnvelope as g, isEmptyPageRenderEnvelope as h, isDeferred as i, getRouteRenderContext as l, createPageRenderEnvelope as m, Resolve as n, reviveDeferredValue as o, currentAuth as p, defer as r, routeData as s, DEFERRED_BOUNDARY as t, getRouteRenderData as u, Outlet as v, _preloadRouteHandler as x, createRouteHandler as y };
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { n as Fragment } from "./jsx-CUpRxrLH.js";
|
|
|
4
4
|
import { h as readScope, u as defineScope } from "./component-internal-NdN_bJ2-.js";
|
|
5
5
|
import { g as getSignal, i as claimHookIndex, p as getCurrentInstance } from "./component-scope-CC3cojX9.js";
|
|
6
6
|
import { n as isSnapshotSource } from "./snapshot-source-BB42xgwb.js";
|
|
7
|
-
import { t as installRendererBridge } from "./renderer-
|
|
7
|
+
import { t as installRendererBridge } from "./renderer-CCvnNMna.js";
|
|
8
8
|
import { t as state } from "./state-DPl8lffD.js";
|
|
9
9
|
import { t as selector } from "./selector-DafVYzV4.js";
|
|
10
10
|
import { jsx, jsxs } from "./jsx-runtime.js";
|
|
@@ -9,7 +9,7 @@ import { n as getActiveRenderContext } from "./render-context-Clw3rFiO.js";
|
|
|
9
9
|
import { n as syncRouteActivitySnapshot } from "./route-activity-CNJfpwx-.js";
|
|
10
10
|
import { r as clearDefaultPortalForInstance, t as DefaultPortal } from "./portal-C47xkwXj.js";
|
|
11
11
|
import { A as insertRecordSorted, C as getCurrentPathPrefix, D as getRoutes, E as getRouteRecords, F as snapshotRouteState, I as computeRank, L as normalizeRouteSegmentName, M as pushRegistrationScope, N as restoreRouteState, O as hasActivePageScope, P as setDefaultRouteAuthOptions, R as parseSegments, S as getCurrentPageScope, T as getDefaultRouteAuthOptions, _ as getCurrentInheritedAuthRequirements, a as resolveRouteFromRoutes, b as getCurrentLayoutChain, c as deepFreeze, f as addRouteToStores, g as getActiveRoutes, j as lockRouteRegistration, l as makeQuery, m as clearRouteState, n as computeMatchesFromRoutes, p as assertRouteRegistrationUnlocked, r as computeRouteActivityMatches, u as parseLocation, v as getCurrentInheritedMeta, w as getCurrentScopeKind, x as getCurrentPageChain, y as getCurrentInheritedPolicies } from "./route-matching-vJpvLVbX.js";
|
|
12
|
-
import { d as hasRouteRenderData, f as resolveRouteRequest, l as getRouteRenderContext, u as getRouteRenderData, y as createRouteHandler } from "./deferred-
|
|
12
|
+
import { d as hasRouteRenderData, f as resolveRouteRequest, l as getRouteRenderContext, u as getRouteRenderData, x as _preloadRouteHandler, y as createRouteHandler } from "./deferred-CSFYIBJL.js";
|
|
13
13
|
import { allOf } from "@askrjs/auth";
|
|
14
14
|
//#region src/runtime/execution-model.ts
|
|
15
15
|
const EXECUTION_MODEL_KEY = Symbol.for("__ASKR_EXECUTION_MODEL__");
|
|
@@ -316,55 +316,6 @@ function syncCurrentRouteSnapshot(pathname, search, hash, activityMatches) {
|
|
|
316
316
|
setCurrentRouteSnapshot(pathname, search, hash, activityMatches);
|
|
317
317
|
}
|
|
318
318
|
//#endregion
|
|
319
|
-
//#region src/router/lazy.ts
|
|
320
|
-
const pendingLazy = /* @__PURE__ */ new Set();
|
|
321
|
-
const registryLazyImports = /* @__PURE__ */ new WeakMap();
|
|
322
|
-
const manifestLazyImports = /* @__PURE__ */ new WeakMap();
|
|
323
|
-
function lazy(factory) {
|
|
324
|
-
let resolved = null;
|
|
325
|
-
let loadError = null;
|
|
326
|
-
const promise = factory().then((mod) => {
|
|
327
|
-
resolved = typeof mod === "function" ? mod : mod.default;
|
|
328
|
-
pendingLazy.delete(promise);
|
|
329
|
-
}, (err) => {
|
|
330
|
-
loadError = err;
|
|
331
|
-
pendingLazy.delete(promise);
|
|
332
|
-
});
|
|
333
|
-
pendingLazy.add(promise);
|
|
334
|
-
return ((params) => {
|
|
335
|
-
if (loadError) throw loadError;
|
|
336
|
-
if (!resolved) throw new Error("lazy() component used before it was resolved. Await createSPA() / hydrateSPA() to ensure all chunks load first.");
|
|
337
|
-
return resolved(params);
|
|
338
|
-
});
|
|
339
|
-
}
|
|
340
|
-
function _snapshotLazy() {
|
|
341
|
-
return [...pendingLazy];
|
|
342
|
-
}
|
|
343
|
-
function _snapshotRouteSourceLazy(source) {
|
|
344
|
-
const imports = /* @__PURE__ */ new Set();
|
|
345
|
-
if (source.registry) for (const lazyImport of registryLazyImports.get(source.registry) ?? []) imports.add(lazyImport);
|
|
346
|
-
const manifest = source.manifest ?? source.registry?.manifest;
|
|
347
|
-
if (manifest) for (const lazyImport of manifestLazyImports.get(manifest) ?? []) imports.add(lazyImport);
|
|
348
|
-
return [...imports];
|
|
349
|
-
}
|
|
350
|
-
function _drainLazy(additionalPending = []) {
|
|
351
|
-
const combined = /* @__PURE__ */ new Set([...additionalPending, ...pendingLazy]);
|
|
352
|
-
if (combined.size === 0) return Promise.resolve();
|
|
353
|
-
return Promise.allSettled(combined).then(() => void 0);
|
|
354
|
-
}
|
|
355
|
-
function associateRouteSourceLazy(registry, manifest, lazyImports) {
|
|
356
|
-
if (lazyImports.length === 0) return;
|
|
357
|
-
registryLazyImports.set(registry, lazyImports);
|
|
358
|
-
manifestLazyImports.set(manifest, lazyImports);
|
|
359
|
-
}
|
|
360
|
-
function clearPendingLazy() {
|
|
361
|
-
pendingLazy.clear();
|
|
362
|
-
}
|
|
363
|
-
function restorePendingLazy(lazyImports) {
|
|
364
|
-
pendingLazy.clear();
|
|
365
|
-
for (const lazyImport of lazyImports) pendingLazy.add(lazyImport);
|
|
366
|
-
}
|
|
367
|
-
//#endregion
|
|
368
319
|
//#region src/router/manifest.ts
|
|
369
320
|
function getManifest() {
|
|
370
321
|
const auth = getDefaultRouteAuthOptions();
|
|
@@ -387,24 +338,19 @@ function _applyManifest(manifest) {
|
|
|
387
338
|
}
|
|
388
339
|
function clearRoutes() {
|
|
389
340
|
clearRouteState();
|
|
390
|
-
clearPendingLazy();
|
|
391
341
|
}
|
|
392
342
|
function createRouteRegistry(definition, options = {}) {
|
|
393
343
|
const previous = snapshotRouteState();
|
|
394
|
-
const previousLazy = _snapshotLazy();
|
|
395
344
|
clearRoutes();
|
|
396
345
|
try {
|
|
397
346
|
registerRoutes(definition, options);
|
|
398
347
|
const manifest = getManifest();
|
|
399
|
-
|
|
348
|
+
return Object.freeze({
|
|
400
349
|
manifest,
|
|
401
350
|
routes: getRoutes()
|
|
402
351
|
});
|
|
403
|
-
associateRouteSourceLazy(registry, manifest, _snapshotLazy());
|
|
404
|
-
return registry;
|
|
405
352
|
} finally {
|
|
406
353
|
restoreRouteState(previous);
|
|
407
|
-
restorePendingLazy(previousLazy);
|
|
408
354
|
}
|
|
409
355
|
}
|
|
410
356
|
//#endregion
|
|
@@ -1051,11 +997,13 @@ function resolveAppRouteRequest(app, pathname, href, signal) {
|
|
|
1051
997
|
if (app.routes) {
|
|
1052
998
|
const resolved = resolveRouteFromRoutes(pathname, app.routes);
|
|
1053
999
|
if (!resolved) return null;
|
|
1054
|
-
|
|
1000
|
+
const result = {
|
|
1055
1001
|
kind: "render",
|
|
1056
1002
|
handler: resolved.handler,
|
|
1057
1003
|
params: resolved.params
|
|
1058
1004
|
};
|
|
1005
|
+
const lazyImport = _preloadRouteHandler(resolved.handler);
|
|
1006
|
+
return lazyImport ? lazyImport.then(() => result) : result;
|
|
1059
1007
|
}
|
|
1060
1008
|
return resolveRouteRequest(href, {
|
|
1061
1009
|
auth: app.auth,
|
|
@@ -1446,4 +1394,4 @@ function initializeNavigation() {
|
|
|
1446
1394
|
window.addEventListener("popstate", handlePopState);
|
|
1447
1395
|
}
|
|
1448
1396
|
//#endregion
|
|
1449
|
-
export {
|
|
1397
|
+
export { assertExecutionModel as C, route as S, fallback as _, resolveRouteMeta as a, page as b, registerAppInstance as c, clearRoutes as d, createRouteRegistry as f, createAppRenderRuntime as g, setServerLocation as h, reconcileRouteMeta as i, unregisterAppInstance as l, currentRoute as m, navigate as n, serializeRouteMeta as o, getManifest as p, updateRouteQuery as r, configureScrollRestoration as s, initializeNavigation as t, _applyManifest as u, group as v, registerRoutes as x, index as y };
|
|
@@ -2596,7 +2596,9 @@ function updateMixedControlChildren(parent, children, forceUpdate) {
|
|
|
2596
2596
|
const controlState = getControlBoundaryState(child);
|
|
2597
2597
|
if (!controlState) throw new Error("[updateElementChildren] Control boundary missing internal state");
|
|
2598
2598
|
registerControlBoundaryCommitOwner(parent, controlState);
|
|
2599
|
-
const
|
|
2599
|
+
const childVNodes = evaluateControlBoundaryState(controlState);
|
|
2600
|
+
const cursorAfterBoundary = cursor ? isRangeStart(cursor) ? findRangeEnd(cursor)?.nextSibling ?? cursor.nextSibling : cursor.nextSibling : null;
|
|
2601
|
+
const ranges = syncControlBoundaryInMixedParent(parent, controlState, childVNodes, cursor);
|
|
2600
2602
|
for (const range of ranges) if (range.start.parentNode !== parent) moveRange(parent, range, cursor?.parentNode === parent ? cursor : null);
|
|
2601
2603
|
else if (cursor?.parentNode === parent) moveRange(parent, range, cursor);
|
|
2602
2604
|
const last = ranges[ranges.length - 1];
|
|
@@ -2606,7 +2608,7 @@ function updateMixedControlChildren(parent, children, forceUpdate) {
|
|
|
2606
2608
|
else if (cursorWasReplaced && isRangeStart(cursor)) cursor = findRangeEnd(cursor)?.nextSibling ?? last.end.nextSibling;
|
|
2607
2609
|
else if (isRangeStart(cursor)) cursor = findRangeEnd(cursor)?.nextSibling ?? last.end.nextSibling;
|
|
2608
2610
|
else cursor = last.end.nextSibling;
|
|
2609
|
-
}
|
|
2611
|
+
} else if (cursor?.parentNode !== parent) cursor = cursorAfterBoundary?.parentNode === parent ? cursorAfterBoundary : null;
|
|
2610
2612
|
continue;
|
|
2611
2613
|
}
|
|
2612
2614
|
if (cursor) cursor = removeRangeAtCursor(parent, cursor);
|
package/dist/router/index.d.ts
CHANGED
|
@@ -44,9 +44,12 @@ declare function createRouteRegistry(definition: RouteDefinition, options?: Regi
|
|
|
44
44
|
declare function getRoutes(): Route[];
|
|
45
45
|
//#endregion
|
|
46
46
|
//#region src/router/lazy.d.ts
|
|
47
|
+
type LazyRouteComponent<TComponent extends AnyRouteComponent> = TComponent & {
|
|
48
|
+
preload(): Promise<void>;
|
|
49
|
+
};
|
|
47
50
|
declare function lazy<TComponent extends AnyRouteComponent>(factory: () => Promise<{
|
|
48
51
|
default: TComponent;
|
|
49
|
-
} | TComponent>): TComponent
|
|
52
|
+
} | TComponent>): LazyRouteComponent<TComponent>;
|
|
50
53
|
//#endregion
|
|
51
54
|
//#region src/router/rendering.d.ts
|
|
52
55
|
declare function Outlet(): JSXElement;
|
|
@@ -163,4 +166,4 @@ declare function Link({
|
|
|
163
166
|
...rest
|
|
164
167
|
}: LinkProps): JSXElement;
|
|
165
168
|
//#endregion
|
|
166
|
-
export { type AccessDecision, type AccessDenyDecision, type AccessRedirectDecision, type AuthContext, type AuthRequirement, type Deferred, type DeferredState, type GroupHelperOptions, type HistoryScrollBehavior, type LayoutScopeRecord, Link, type LinkProps, type NavigateOptions, type NavigationScrollBehavior, Outlet, type PageHelperOptions, type PageScopeRecord, type ParsedSegment, type RegisterRoutesOptions, Resolve, type ResolveProps, type Route, type RouteAuthOptions, type RouteAuthResolver, type RouteComponent, type RouteContext, type RouteDefinition, type RouteDestination, type RouteHandler, type RouteManifest, type RouteMatch, type RouteMeta, type RouteMetaSource, type RouteMode, type RouteOptions, type RouteParams, type RoutePathParams, type RoutePolicy, type RouteQuery, type RouteQueryParamInput, type RouteQueryParamValue, type RouteQueryUpdater, type RouteQueryUpdates, type RouteRecord, type RouteRef, type RouteRegistry, type RouteRenderResult, type RouteRequestOptions, type RouteRequestResult, type RouteSearch, type RouteSearchValue, type RouteSnapshot, type ScrollRestorationOptions, type UpdateRouteQueryOptions, allow, clearRoutes, createRouteRegistry, currentAuth, currentRoute, defer, deny, fallback, forbidden, getManifest, getRoutes, group, index, isDeferred, lazy, navigate, notFound, page, reconcileRouteMeta, redirect, registerRoutes, resolveDeferredValues, resolveRouteMeta, resolveRouteRequest, route, routeData, serializeRouteMeta, to$1 as to, unauthorized, updateRouteQuery };
|
|
169
|
+
export { type AccessDecision, type AccessDenyDecision, type AccessRedirectDecision, type AuthContext, type AuthRequirement, type Deferred, type DeferredState, type GroupHelperOptions, type HistoryScrollBehavior, type LayoutScopeRecord, type LazyRouteComponent, Link, type LinkProps, type NavigateOptions, type NavigationScrollBehavior, Outlet, type PageHelperOptions, type PageScopeRecord, type ParsedSegment, type RegisterRoutesOptions, Resolve, type ResolveProps, type Route, type RouteAuthOptions, type RouteAuthResolver, type RouteComponent, type RouteContext, type RouteDefinition, type RouteDestination, type RouteHandler, type RouteManifest, type RouteMatch, type RouteMeta, type RouteMetaSource, type RouteMode, type RouteOptions, type RouteParams, type RoutePathParams, type RoutePolicy, type RouteQuery, type RouteQueryParamInput, type RouteQueryParamValue, type RouteQueryUpdater, type RouteQueryUpdates, type RouteRecord, type RouteRef, type RouteRegistry, type RouteRenderResult, type RouteRequestOptions, type RouteRequestResult, type RouteSearch, type RouteSearchValue, type RouteSnapshot, type ScrollRestorationOptions, type UpdateRouteQueryOptions, allow, clearRoutes, createRouteRegistry, currentAuth, currentRoute, defer, deny, fallback, forbidden, getManifest, getRoutes, group, index, isDeferred, lazy, navigate, notFound, page, reconcileRouteMeta, redirect, registerRoutes, resolveDeferredValues, resolveRouteMeta, resolveRouteRequest, route, routeData, serializeRouteMeta, to$1 as to, unauthorized, updateRouteQuery };
|
package/dist/router/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { S as route, _ as fallback, a as resolveRouteMeta, b as page, d as clearRoutes, f as createRouteRegistry, i as reconcileRouteMeta, m as currentRoute, n as navigate, o as serializeRouteMeta, p as getManifest, r as updateRouteQuery, v as group, x as registerRoutes, y as index } from "../navigate-mkLGM5ec.js";
|
|
2
2
|
import { jsx } from "../jsx-runtime.js";
|
|
3
3
|
import { D as getRoutes } from "../route-matching-vJpvLVbX.js";
|
|
4
|
-
import { a as resolveDeferredValues, f as resolveRouteRequest, i as isDeferred, n as Resolve, p as currentAuth, r as defer, s as routeData, v as Outlet } from "../deferred-
|
|
4
|
+
import { S as lazy, a as resolveDeferredValues, f as resolveRouteRequest, i as isDeferred, n as Resolve, p as currentAuth, r as defer, s as routeData, v as Outlet } from "../deferred-CSFYIBJL.js";
|
|
5
5
|
import { o as mergeProps } from "../compose-ref-Cc_YkUpM.js";
|
|
6
6
|
import { t as applyInteractionPolicy } from "../interactions-w7gQN4ha.js";
|
|
7
7
|
//#region src/router/policy.ts
|
package/dist/ssg/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "../access-Bg4RJNC8.js";
|
|
2
|
-
import { a as resolveDeferredValues, b as getRenderHandler, c as bindResolvedRouteData } from "../deferred-
|
|
2
|
+
import { a as resolveDeferredValues, b as getRenderHandler, c as bindResolvedRouteData } from "../deferred-CSFYIBJL.js";
|
|
3
3
|
import { n as renderDocument } from "../ssr-CbQO5xd3.js";
|
|
4
|
-
import { n as renderToString } from "../ssr-
|
|
4
|
+
import { n as renderToString } from "../ssr-DVFKktPX.js";
|
|
5
5
|
import * as fs from "node:fs/promises";
|
|
6
6
|
import * as pathModule from "node:path";
|
|
7
7
|
import * as os from "node:os";
|
package/dist/ssr/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { u as SSRDataMissingError } from "../render-context-Clw3rFiO.js";
|
|
2
|
-
import { a as renderResolvedToStringSync, c as createRenderContext, d as withRenderContextAsync, i as renderRouteRequestToString, l as getRenderContext, n as renderToString, o as renderToStringSync, r as renderRouteRequest, s as resolveRequest, t as renderToStream, u as withRenderContext } from "../ssr-
|
|
2
|
+
import { a as renderResolvedToStringSync, c as createRenderContext, d as withRenderContextAsync, i as renderRouteRequestToString, l as getRenderContext, n as renderToString, o as renderToStringSync, r as renderRouteRequest, s as resolveRequest, t as renderToStream, u as withRenderContext } from "../ssr-DVFKktPX.js";
|
|
3
3
|
export { SSRDataMissingError, createRenderContext, getRenderContext, renderResolvedToStringSync, renderRouteRequest, renderRouteRequestToString, renderToStream, renderToString, renderToStringSync, resolveRequest, withRenderContext, withRenderContextAsync };
|
|
@@ -12,7 +12,7 @@ import { t as getPublicAttributeName } from "./attr-names-CjhzmHOn.js";
|
|
|
12
12
|
import { t as createDataRuntime } from "./data-runtime-SJ1BSUvk.js";
|
|
13
13
|
import { c as withTelemetry, i as dehydrateDataRuntime, t as createQueryPrefetchContext } from "./query-registry-CQIT4mXr.js";
|
|
14
14
|
import { a as resolveRouteFromRoutes, t as _resolveRouteMatchFromRoutes } from "./route-matching-vJpvLVbX.js";
|
|
15
|
-
import { f as resolveRouteRequest, g as isPageRenderEnvelope, h as isEmptyPageRenderEnvelope, i as isDeferred, m as createPageRenderEnvelope, t as DEFERRED_BOUNDARY } from "./deferred-
|
|
15
|
+
import { f as resolveRouteRequest, g as isPageRenderEnvelope, h as isEmptyPageRenderEnvelope, i as isDeferred, m as createPageRenderEnvelope, t as DEFERRED_BOUNDARY, x as _preloadRouteHandler } from "./deferred-CSFYIBJL.js";
|
|
16
16
|
import { n as renderDocument, t as SSR_RENDER_DATA_ATTR } from "./ssr-CbQO5xd3.js";
|
|
17
17
|
//#region src/ssr/escape.ts
|
|
18
18
|
/**
|
|
@@ -501,6 +501,7 @@ async function resolveRequest(opts) {
|
|
|
501
501
|
if (!routes) throw new Error("resolveRequest requires a route manifest or route table.");
|
|
502
502
|
const resolved = resolveRouteFromRoutes(new URL(url, "http://localhost").pathname, routes);
|
|
503
503
|
if (!resolved) return null;
|
|
504
|
+
await _preloadRouteHandler(resolved.handler);
|
|
504
505
|
return {
|
|
505
506
|
kind: "render",
|
|
506
507
|
handler: resolved.handler,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as SSR_RENDER_DATA_ATTR } from "./ssr-CbQO5xd3.js";
|
|
2
|
-
import { a as renderResolvedToStringSync } from "./ssr-
|
|
2
|
+
import { a as renderResolvedToStringSync } from "./ssr-DVFKktPX.js";
|
|
3
3
|
//#region src/ssr/verify-hydration.ts
|
|
4
4
|
function normalizeHydrationHtml(html) {
|
|
5
5
|
const template = document.createElement("template");
|