@askrjs/askr 0.0.95 → 0.0.97
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 +3 -3
- package/dist/boot/index.js +1 -1
- package/dist/{boot-C1wT3Vfs.js → boot-CZuC3Muv.js} +3 -3
- package/dist/{deferred-p8hyanxJ.js → deferred-DFyDy5e7.js} +1 -1
- package/dist/{navigate-DChM5m8m.js → navigate-CbsZobFg.js} +1 -1
- package/dist/{resolution-BQyo7qNn.js → resolution-C-ZE5swD.js} +16 -4
- package/dist/router/index.js +3 -3
- package/dist/ssg/index.js +163 -122
- package/dist/ssr/index.js +1 -1
- package/dist/{ssr-DYcK20IX.js → ssr-BhcP35fE.js} +1 -1
- package/dist/testing/index.js +1 -1
- package/dist/{verify-hydration-m-wVbYOD.js → verify-hydration-CUgKeP65.js} +1 -1
- package/package.json +1 -1
package/dist/benchmark.js
CHANGED
|
@@ -4,7 +4,7 @@ import { t as selector } from "./selector-CyK-sDwB.js";
|
|
|
4
4
|
import { t as installRendererBridge } from "./renderer-tXX_xj86.js";
|
|
5
5
|
import { i as For } from "./control-C0klPV7Q.js";
|
|
6
6
|
import { jsx, jsxs } from "./jsx-runtime.js";
|
|
7
|
-
import { t as createIsland } from "./boot-
|
|
7
|
+
import { t as createIsland } from "./boot-CZuC3Muv.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.97",
|
|
67
|
+
buildLabel: "0.0.97-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-CZuC3Muv.js";
|
|
2
2
|
export { cleanupApp, createIsland, createIslands, createSPA, hasApp, hydrateSPA };
|
|
@@ -11,9 +11,9 @@ import { r as validateCspNonce, t as CspNonceScope } from "./csp-nonce-BVybpV1v.
|
|
|
11
11
|
import { i as getDefaultDataRuntime } from "./data-runtime-JxoRgrrt.js";
|
|
12
12
|
import { a as hydrateDataRuntime } from "./query-registry-CimB1YeW.js";
|
|
13
13
|
import { I as lockRouteRegistration, P as hasRegisteredRoutes, _ as clearRouteState, m as _setActiveRouteAuthOptions } from "./route-matching-Bo6UqG-5.js";
|
|
14
|
-
import { a as resolveRouteRequest, i as hasRouteRenderData, m as reviveDeferredValue, n as getRouteRenderContext, r as getRouteRenderData } from "./resolution-
|
|
14
|
+
import { a as resolveRouteRequest, i as hasRouteRenderData, m as reviveDeferredValue, n as getRouteRenderContext, r as getRouteRenderData } from "./resolution-C-ZE5swD.js";
|
|
15
15
|
import { o as createAppRenderRuntime, r as setServerLocation } from "./activity-d4t3CdzK.js";
|
|
16
|
-
import { f as registerAppInstance, g as unregisterAppInstance, i as resolveRouteMeta, o as configureScrollRestoration, r as reconcileRouteMeta, t as initializeNavigation } from "./navigate-
|
|
16
|
+
import { f as registerAppInstance, g as unregisterAppInstance, i as resolveRouteMeta, o as configureScrollRestoration, r as reconcileRouteMeta, t as initializeNavigation } from "./navigate-CbsZobFg.js";
|
|
17
17
|
import { n as disposeRegisteredDefaultPortalScope, r as getDefaultPortalHost } from "./default-portal-runtime-DvMvWJVp.js";
|
|
18
18
|
import "./ssr-DSHd_Q9K.js";
|
|
19
19
|
//#region src/boot/hydration.ts
|
|
@@ -612,7 +612,7 @@ async function hydrateSPA(config) {
|
|
|
612
612
|
cspNonce: config.cspNonce
|
|
613
613
|
}));
|
|
614
614
|
if (shouldVerifyHydrationMarkup(config)) {
|
|
615
|
-
const { verifyHydrationSyncForUrl } = await import("./verify-hydration-
|
|
615
|
+
const { verifyHydrationSyncForUrl } = await import("./verify-hydration-CUgKeP65.js");
|
|
616
616
|
if (!verifyHydrationSyncForUrl({
|
|
617
617
|
root: rootElement,
|
|
618
618
|
url: currentUrl,
|
|
@@ -3,7 +3,7 @@ import { i as getExecutionModel } from "./manifest-D6rfj_jC.js";
|
|
|
3
3
|
import { n as getActiveRenderContext, r as getCurrentRenderData } from "./render-context-B7ohlh6t.js";
|
|
4
4
|
import { t as resource } from "./resource-operation-B62UQKHV.js";
|
|
5
5
|
import { A as getDefaultRouteBasePath, C as getCurrentInheritedPolicies, D as getCurrentPathPrefix, E as getCurrentPageScope, F as insertRecordSorted, H as computeRank, L as pushRegistrationScope, N as hasActivePageScope, O as getCurrentScopeKind, S as getCurrentInheritedMeta, T as getCurrentPageChain, U as normalizeRouteSegmentName, W as parseSegments, g as assertRouteRegistrationUnlocked, h as addRouteToStores, w as getCurrentLayoutChain, x as getCurrentInheritedAuthRequirements } from "./route-matching-Bo6UqG-5.js";
|
|
6
|
-
import { _ as createRouteHandler, d as DEFERRED_BOUNDARY, p as isDeferred, s as guardHydratedRouteData } from "./resolution-
|
|
6
|
+
import { _ as createRouteHandler, d as DEFERRED_BOUNDARY, p as isDeferred, s as guardHydratedRouteData } from "./resolution-C-ZE5swD.js";
|
|
7
7
|
import { allOf } from "@askrjs/auth";
|
|
8
8
|
//#region src/router/access.ts
|
|
9
9
|
function compileNodePolicies(node) {
|
|
@@ -7,7 +7,7 @@ import { i as drainLifecycleCommitErrors, p as isPromiseLike, r as discardLifecy
|
|
|
7
7
|
import { _ as teardownNodeSubtree } from "./cleanup-D7uN-Z1s.js";
|
|
8
8
|
import { t as CspNonceScope } from "./csp-nonce-BVybpV1v.js";
|
|
9
9
|
import { I as lockRouteRegistration, o as addRouteBasePath, r as computeRouteActivityMatches, y as getActiveRouteBasePath } from "./route-matching-Bo6UqG-5.js";
|
|
10
|
-
import { a as resolveRouteRequest, i as hasRouteRenderData, n as getRouteRenderContext, r as getRouteRenderData, u as withoutRouteHydrationMetadata } from "./resolution-
|
|
10
|
+
import { a as resolveRouteRequest, i as hasRouteRenderData, n as getRouteRenderContext, r as getRouteRenderData, u as withoutRouteHydrationMetadata } from "./resolution-C-ZE5swD.js";
|
|
11
11
|
import { a as clearStagedAppRenderRouteLocation, i as syncCurrentRouteSnapshot, o as createAppRenderRuntime, s as stageAppRenderRouteLocation } from "./activity-d4t3CdzK.js";
|
|
12
12
|
import { r as getDefaultPortalHost, t as clearRegisteredDefaultPortalForInstance } from "./default-portal-runtime-DvMvWJVp.js";
|
|
13
13
|
//#region src/router/navigation-registry.ts
|
|
@@ -40,9 +40,13 @@ function startLazyLoad(state) {
|
|
|
40
40
|
let promise;
|
|
41
41
|
promise = Promise.resolve().then(state.factory).then((mod) => {
|
|
42
42
|
state.resolved = typeof mod === "function" ? mod : mod.default;
|
|
43
|
+
state.loadError = null;
|
|
44
|
+
state.hasLoadError = false;
|
|
43
45
|
}, (err) => {
|
|
44
46
|
state.loadError = err;
|
|
47
|
+
state.hasLoadError = true;
|
|
45
48
|
}).finally(() => {
|
|
49
|
+
if (state.hasLoadError) state.promise = null;
|
|
46
50
|
pendingLazy.delete(promise);
|
|
47
51
|
});
|
|
48
52
|
state.promise = promise;
|
|
@@ -55,10 +59,11 @@ function lazy(factory) {
|
|
|
55
59
|
factory,
|
|
56
60
|
promise: null,
|
|
57
61
|
resolved: null,
|
|
58
|
-
loadError: null
|
|
62
|
+
loadError: null,
|
|
63
|
+
hasLoadError: false
|
|
59
64
|
};
|
|
60
65
|
const component = ((params) => {
|
|
61
|
-
if (state.
|
|
66
|
+
if (state.hasLoadError) throw state.loadError;
|
|
62
67
|
if (!state.resolved) throw new Error("lazy() component used before it was resolved. Matched routes load automatically; call component.preload() for explicit preloading.");
|
|
63
68
|
return state.resolved(params);
|
|
64
69
|
});
|
|
@@ -72,7 +77,14 @@ function lazy(factory) {
|
|
|
72
77
|
*/
|
|
73
78
|
function lazyRouteData(factory, select) {
|
|
74
79
|
let imported = null;
|
|
75
|
-
const load = () =>
|
|
80
|
+
const load = () => {
|
|
81
|
+
if (imported) return imported;
|
|
82
|
+
imported = Promise.resolve().then(factory).catch((error) => {
|
|
83
|
+
imported = null;
|
|
84
|
+
throw error;
|
|
85
|
+
});
|
|
86
|
+
return imported;
|
|
87
|
+
};
|
|
76
88
|
const loader = ((context) => load().then((module) => select ? select(module, context) : module).catch((error) => _wrapRouteDataLoadError(error, context)));
|
|
77
89
|
Object.defineProperty(loader, "preload", { value: () => load().then(() => void 0) });
|
|
78
90
|
return loader;
|
|
@@ -537,7 +549,7 @@ function resolveRouteRequest(target, options) {
|
|
|
537
549
|
to: addRouteBasePath(result.to, basePath)
|
|
538
550
|
} : result;
|
|
539
551
|
const finalize = (authContext) => {
|
|
540
|
-
setCurrentAuth(authContext);
|
|
552
|
+
if (!signal.aborted) setCurrentAuth(authContext);
|
|
541
553
|
const result = resolveMatchedRoute(match.record, match.params, buildRouteContext(logicalTarget, match.params, {
|
|
542
554
|
mode,
|
|
543
555
|
signal,
|
package/dist/router/index.js
CHANGED
|
@@ -2,10 +2,10 @@ import { n as createRouteRegistry } from "../manifest-D6rfj_jC.js";
|
|
|
2
2
|
import { a as isSafeHref } from "../csp-nonce-BVybpV1v.js";
|
|
3
3
|
import { jsx } from "../jsx-runtime.js";
|
|
4
4
|
import { o as addRouteBasePath, y as getActiveRouteBasePath } from "../route-matching-Bo6UqG-5.js";
|
|
5
|
-
import { a as group, c as route, i as fallback, n as resolveDeferredValues, o as index, r as routeData, s as page, t as Resolve } from "../deferred-
|
|
6
|
-
import { S as RouteDataLoadError, a as resolveRouteRequest, b as lazy, f as defer, g as Outlet, h as currentAuth, p as isDeferred, x as lazyRouteData } from "../resolution-
|
|
5
|
+
import { a as group, c as route, i as fallback, n as resolveDeferredValues, o as index, r as routeData, s as page, t as Resolve } from "../deferred-DFyDy5e7.js";
|
|
6
|
+
import { S as RouteDataLoadError, a as resolveRouteRequest, b as lazy, f as defer, g as Outlet, h as currentAuth, p as isDeferred, x as lazyRouteData } from "../resolution-C-ZE5swD.js";
|
|
7
7
|
import { n as onRouteChange, t as currentRoute } from "../activity-d4t3CdzK.js";
|
|
8
|
-
import { a as serializeRouteMeta, c as getCurrentHref, d as parseTargetUrl, h as syncRegisteredRouteSnapshot, i as resolveRouteMeta, l as getRegisteredAppsSnapshot, m as syncAppRegistrationLocation, n as navigate, p as setCurrentRouteLocation, r as reconcileRouteMeta, s as saveScrollPosition, u as getWindowHref } from "../navigate-
|
|
8
|
+
import { a as serializeRouteMeta, c as getCurrentHref, d as parseTargetUrl, h as syncRegisteredRouteSnapshot, i as resolveRouteMeta, l as getRegisteredAppsSnapshot, m as syncAppRegistrationLocation, n as navigate, p as setCurrentRouteLocation, r as reconcileRouteMeta, s as saveScrollPosition, u as getWindowHref } from "../navigate-CbsZobFg.js";
|
|
9
9
|
import { o as mergeProps } from "../compose-ref-1Fhs7mbF.js";
|
|
10
10
|
import { t as applyInteractionPolicy } from "../interactions-B4XaFxt1.js";
|
|
11
11
|
//#region src/router/route-query.ts
|
package/dist/ssg/index.js
CHANGED
|
@@ -1,15 +1,32 @@
|
|
|
1
1
|
import "../access-d_DCdwqn.js";
|
|
2
2
|
import { n as createRouteRegistry } from "../manifest-D6rfj_jC.js";
|
|
3
3
|
import { o as addRouteBasePath } from "../route-matching-Bo6UqG-5.js";
|
|
4
|
-
import { c as route, n as resolveDeferredValues } from "../deferred-
|
|
5
|
-
import { S as RouteDataLoadError, c as prepareRouteHydrationData, t as bindResolvedRouteData, v as getRenderHandler, y as _preloadRouteHandler } from "../resolution-
|
|
4
|
+
import { c as route, n as resolveDeferredValues } from "../deferred-DFyDy5e7.js";
|
|
5
|
+
import { S as RouteDataLoadError, c as prepareRouteHydrationData, t as bindResolvedRouteData, v as getRenderHandler, y as _preloadRouteHandler } from "../resolution-C-ZE5swD.js";
|
|
6
6
|
import { n as renderDocument } from "../ssr-DSHd_Q9K.js";
|
|
7
|
-
import { n as renderToString } from "../ssr-
|
|
7
|
+
import { n as renderToString } from "../ssr-BhcP35fE.js";
|
|
8
8
|
import * as fs from "node:fs/promises";
|
|
9
9
|
import * as pathModule from "node:path";
|
|
10
10
|
import * as os from "node:os";
|
|
11
11
|
import * as fsSync from "node:fs";
|
|
12
12
|
//#region src/ssg/route-utils.ts
|
|
13
|
+
function getPortableOutputPathKey(filePath) {
|
|
14
|
+
return filePath.normalize("NFC").replaceAll("\\", "/").toLowerCase();
|
|
15
|
+
}
|
|
16
|
+
function describeRoute(descriptor) {
|
|
17
|
+
if (descriptor.route.path === descriptor.path) return `"${descriptor.path}"`;
|
|
18
|
+
return `"${descriptor.route.path}" (resolved as "${descriptor.path}")`;
|
|
19
|
+
}
|
|
20
|
+
/** Reject routes that could overwrite one another on any supported filesystem. */
|
|
21
|
+
function validateOutputPathCollisions(descriptors) {
|
|
22
|
+
const seen = /* @__PURE__ */ new Map();
|
|
23
|
+
for (const descriptor of descriptors) {
|
|
24
|
+
const key = getPortableOutputPathKey(descriptor.filePath);
|
|
25
|
+
const existing = seen.get(key);
|
|
26
|
+
if (existing) throw new Error(`SSG output path collision: routes ${describeRoute(existing)} and ${describeRoute(descriptor)} both map to "${descriptor.filePath}" after case-insensitive normalization`);
|
|
27
|
+
seen.set(key, descriptor);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
13
30
|
function assertSafeRoutePath(pathStr) {
|
|
14
31
|
if (!pathStr.startsWith("/") || pathStr.startsWith("//") || pathStr.includes("\\") || pathStr.includes("\0") || pathStr.split("/").some((segment) => segment === "." || segment === "..")) throw new Error(`SSG route path must be an absolute URL path without dot segments or backslashes: ${pathStr}`);
|
|
15
32
|
}
|
|
@@ -663,6 +680,24 @@ function resolveParallelism(requested) {
|
|
|
663
680
|
const availableParallelism = os.availableParallelism;
|
|
664
681
|
return Math.max(1, availableParallelism?.() ?? os.cpus().length ?? 1);
|
|
665
682
|
}
|
|
683
|
+
const outputDirectoryQueues = /* @__PURE__ */ new Map();
|
|
684
|
+
async function withOutputDirectoryLock(outputDir, operation) {
|
|
685
|
+
const key = pathModule.resolve(outputDir).normalize("NFC").toLowerCase();
|
|
686
|
+
const previous = outputDirectoryQueues.get(key) ?? Promise.resolve();
|
|
687
|
+
let release;
|
|
688
|
+
const current = new Promise((resolve) => {
|
|
689
|
+
release = resolve;
|
|
690
|
+
});
|
|
691
|
+
const tail = previous.then(() => current, () => current);
|
|
692
|
+
outputDirectoryQueues.set(key, tail);
|
|
693
|
+
await previous.catch(() => void 0);
|
|
694
|
+
try {
|
|
695
|
+
return await operation();
|
|
696
|
+
} finally {
|
|
697
|
+
release();
|
|
698
|
+
if (outputDirectoryQueues.get(key) === tail) outputDirectoryQueues.delete(key);
|
|
699
|
+
}
|
|
700
|
+
}
|
|
666
701
|
async function createStagingDirectory(outputDir) {
|
|
667
702
|
const parent = pathModule.dirname(outputDir);
|
|
668
703
|
const base = pathModule.basename(outputDir);
|
|
@@ -753,136 +788,142 @@ function createStaticGen(options) {
|
|
|
753
788
|
* Returns detailed results
|
|
754
789
|
*/
|
|
755
790
|
async generate(generateOptions = {}) {
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
const
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
const
|
|
794
|
-
const
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
791
|
+
return withOutputDirectoryLock(options.outputDir, async () => {
|
|
792
|
+
const splitRoutes = await splitStaticRoutes(configuredRoutes);
|
|
793
|
+
const routes = splitRoutes.routes;
|
|
794
|
+
validateRoutes(routes);
|
|
795
|
+
const changedKeys = dedupeStrings(generateOptions.changedKeys);
|
|
796
|
+
const changedRoutes = dedupeStrings(generateOptions.changedRoutes);
|
|
797
|
+
const requestedMode = generateOptions.mode ?? "full";
|
|
798
|
+
const previousManifest = !generateOptions.forceFull && requestedMode === "incremental" ? readIncrementalManifest(options.outputDir, seed) : null;
|
|
799
|
+
const effectiveMode = generateOptions.forceFull || requestedMode !== "incremental" || previousManifest === null ? "full" : "incremental";
|
|
800
|
+
const dataMap = resolveSsgData(routes, { dataOverrides: options.dataOverrides });
|
|
801
|
+
const descriptors = routes.map(resolveRouteDescriptor);
|
|
802
|
+
validateOutputPathCollisions(descriptors);
|
|
803
|
+
const routeResultsById = /* @__PURE__ */ new Map();
|
|
804
|
+
for (const runtimeRoute of splitRoutes.runtimeOnly) routeResultsById.set(runtimeRoute.routeId, runtimeRoute.result);
|
|
805
|
+
const eligibleDescriptors = descriptors;
|
|
806
|
+
const previousEntries = new Map((previousManifest?.routes ?? []).map((entry) => [entry.routeId, entry]));
|
|
807
|
+
const currentRouteIds = new Set(eligibleDescriptors.map((descriptor) => descriptor.routeId));
|
|
808
|
+
const selected = [];
|
|
809
|
+
const routesToRender = [];
|
|
810
|
+
for (let index = 0; index < eligibleDescriptors.length; index += 1) {
|
|
811
|
+
const descriptor = eligibleDescriptors[index];
|
|
812
|
+
const entry = selectRouteForGeneration(descriptor, previousEntries.get(descriptor.routeId) ?? null, effectiveMode, changedKeys, changedRoutes);
|
|
813
|
+
selected.push(entry);
|
|
814
|
+
if (entry.reason !== "unchanged") routesToRender.push(entry);
|
|
815
|
+
}
|
|
816
|
+
const renderStartTime = performance.now();
|
|
817
|
+
const renderedResults = routesToRender.length > 0 ? await batchRenderRoutes(getRoutesToRender(routesToRender), {
|
|
818
|
+
seed,
|
|
819
|
+
dataMap,
|
|
820
|
+
concurrency: resolvedConcurrency,
|
|
821
|
+
document: options.document,
|
|
822
|
+
styleRegistrationValidation: options.styleRegistrationValidation
|
|
823
|
+
}) : [];
|
|
824
|
+
performance.now() - renderStartTime;
|
|
825
|
+
const renderedByRouteId = /* @__PURE__ */ new Map();
|
|
826
|
+
for (let index = 0; index < renderedResults.length; index += 1) renderedByRouteId.set(routesToRender[index].descriptor.routeId, renderedResults[index]);
|
|
827
|
+
let cacheHits = 0;
|
|
828
|
+
const nextManifestRoutes = [];
|
|
829
|
+
for (const entry of selected) {
|
|
830
|
+
const { descriptor, previous, reason } = entry;
|
|
831
|
+
const resolvedData = resolveSsgRouteData(dataMap, descriptor.route.path, descriptor.path);
|
|
832
|
+
const baseData = resolvedData.hasData ? resolvedData.data : void 0;
|
|
833
|
+
const resourceCount = resolvedData.hasData && baseData ? Object.keys(baseData).length : 0;
|
|
834
|
+
if (reason === "unchanged") {
|
|
835
|
+
routeResultsById.set(descriptor.routeId, {
|
|
836
|
+
path: descriptor.path,
|
|
837
|
+
filePath: descriptor.filePath,
|
|
838
|
+
html: "",
|
|
839
|
+
fileSize: previous?.htmlHash !== null && previous !== null ? getExistingOutputFileSize(options.outputDir, descriptor.filePath) : 0,
|
|
840
|
+
renderDuration: 0,
|
|
841
|
+
resourceCount,
|
|
842
|
+
status: "skipped",
|
|
843
|
+
reason: "unchanged",
|
|
844
|
+
written: false
|
|
845
|
+
});
|
|
846
|
+
if (previous) nextManifestRoutes.push({
|
|
847
|
+
...previous,
|
|
848
|
+
path: descriptor.path,
|
|
849
|
+
filePath: descriptor.filePath,
|
|
850
|
+
invalidationKeys: descriptor.invalidationKeys.slice()
|
|
851
|
+
});
|
|
852
|
+
continue;
|
|
853
|
+
}
|
|
854
|
+
const rendered = renderedByRouteId.get(descriptor.routeId);
|
|
855
|
+
if (!rendered) throw new Error(`Missing rendered result for route "${descriptor.path}"`);
|
|
856
|
+
const nextResult = {
|
|
857
|
+
...rendered,
|
|
799
858
|
path: descriptor.path,
|
|
800
859
|
filePath: descriptor.filePath,
|
|
801
|
-
html: "",
|
|
802
|
-
fileSize: previous?.htmlHash !== null && previous !== null ? getExistingOutputFileSize(options.outputDir, descriptor.filePath) : 0,
|
|
803
|
-
renderDuration: 0,
|
|
804
860
|
resourceCount,
|
|
805
|
-
|
|
806
|
-
reason: "unchanged",
|
|
861
|
+
reason,
|
|
807
862
|
written: false
|
|
808
|
-
}
|
|
809
|
-
if (
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
resourceCount,
|
|
824
|
-
reason,
|
|
825
|
-
written: false
|
|
826
|
-
};
|
|
827
|
-
if (nextResult.status === "success") {
|
|
828
|
-
const htmlDigest = hashHtml(nextResult.html);
|
|
829
|
-
const shouldWrite = effectiveMode === "full" || !previous || previous.htmlHash !== htmlDigest || !outputFileExists(options.outputDir, descriptor.filePath);
|
|
830
|
-
nextResult.written = shouldWrite;
|
|
831
|
-
if (!shouldWrite) cacheHits += 1;
|
|
832
|
-
nextManifestRoutes.push({
|
|
863
|
+
};
|
|
864
|
+
if (nextResult.status === "success") {
|
|
865
|
+
const htmlDigest = hashHtml(nextResult.html);
|
|
866
|
+
const shouldWrite = effectiveMode === "full" || !previous || previous.htmlHash !== htmlDigest || !outputFileExists(options.outputDir, descriptor.filePath);
|
|
867
|
+
nextResult.written = shouldWrite;
|
|
868
|
+
if (!shouldWrite) cacheHits += 1;
|
|
869
|
+
nextManifestRoutes.push({
|
|
870
|
+
routeId: descriptor.routeId,
|
|
871
|
+
path: descriptor.path,
|
|
872
|
+
filePath: descriptor.filePath,
|
|
873
|
+
invalidationKeys: descriptor.invalidationKeys.slice(),
|
|
874
|
+
htmlHash: htmlDigest,
|
|
875
|
+
lastStatus: "success"
|
|
876
|
+
});
|
|
877
|
+
} else nextManifestRoutes.push({
|
|
833
878
|
routeId: descriptor.routeId,
|
|
834
879
|
path: descriptor.path,
|
|
835
880
|
filePath: descriptor.filePath,
|
|
836
881
|
invalidationKeys: descriptor.invalidationKeys.slice(),
|
|
837
|
-
htmlHash:
|
|
838
|
-
lastStatus: "
|
|
882
|
+
htmlHash: previous?.htmlHash ?? null,
|
|
883
|
+
lastStatus: "error"
|
|
839
884
|
});
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
}
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
const removedResults = collectRemovedRouteResults(previousManifest, currentRouteIds);
|
|
851
|
-
const routeResults = [];
|
|
852
|
-
for (const routeId of splitRoutes.outputRouteIds) {
|
|
853
|
-
const routeResult = routeResultsById.get(routeId);
|
|
854
|
-
if (routeResult) routeResults.push(routeResult);
|
|
855
|
-
}
|
|
856
|
-
routeResults.push(...removedResults);
|
|
857
|
-
result = generateSSGResult(routeResults, {
|
|
858
|
-
mode: effectiveMode,
|
|
859
|
-
cacheHits,
|
|
860
|
-
invalidatedKeys: changedKeys,
|
|
861
|
-
invalidatedRoutes: changedRoutes
|
|
862
|
-
});
|
|
863
|
-
if (effectiveMode === "full" && result.failed > 0) return result;
|
|
864
|
-
const targetOutputDir = effectiveMode === "full" ? await createStagingDirectory(options.outputDir) : options.outputDir;
|
|
865
|
-
try {
|
|
866
|
-
const writeStartTime = performance.now();
|
|
867
|
-
await writeStaticFiles(routeResults, targetOutputDir, { concurrency: resolvedConcurrency });
|
|
868
|
-
performance.now() - writeStartTime;
|
|
869
|
-
await writeMetadata(resultToMetadata(result), targetOutputDir);
|
|
870
|
-
await writeIncrementalManifest({
|
|
871
|
-
schemaVersion: 1,
|
|
872
|
-
seed,
|
|
885
|
+
routeResultsById.set(descriptor.routeId, nextResult);
|
|
886
|
+
}
|
|
887
|
+
const removedResults = collectRemovedRouteResults(previousManifest, currentRouteIds);
|
|
888
|
+
const routeResults = [];
|
|
889
|
+
for (const routeId of splitRoutes.outputRouteIds) {
|
|
890
|
+
const routeResult = routeResultsById.get(routeId);
|
|
891
|
+
if (routeResult) routeResults.push(routeResult);
|
|
892
|
+
}
|
|
893
|
+
routeResults.push(...removedResults);
|
|
894
|
+
result = generateSSGResult(routeResults, {
|
|
873
895
|
mode: effectiveMode,
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
if (effectiveMode === "full") await replaceOutputDirectory(targetOutputDir, options.outputDir);
|
|
878
|
-
} catch (error) {
|
|
879
|
-
if (effectiveMode === "full") await fs.rm(targetOutputDir, {
|
|
880
|
-
recursive: true,
|
|
881
|
-
force: true
|
|
896
|
+
cacheHits,
|
|
897
|
+
invalidatedKeys: changedKeys,
|
|
898
|
+
invalidatedRoutes: changedRoutes
|
|
882
899
|
});
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
900
|
+
if (effectiveMode === "full" && result.failed > 0) {
|
|
901
|
+
for (const routeResult of result.routes) if (routeResult.status === "success") routeResult.written = false;
|
|
902
|
+
return result;
|
|
903
|
+
}
|
|
904
|
+
const targetOutputDir = effectiveMode === "full" ? await createStagingDirectory(options.outputDir) : options.outputDir;
|
|
905
|
+
try {
|
|
906
|
+
const writeStartTime = performance.now();
|
|
907
|
+
await writeStaticFiles(routeResults, targetOutputDir, { concurrency: resolvedConcurrency });
|
|
908
|
+
performance.now() - writeStartTime;
|
|
909
|
+
await writeMetadata(resultToMetadata(result), targetOutputDir);
|
|
910
|
+
await writeIncrementalManifest({
|
|
911
|
+
schemaVersion: 1,
|
|
912
|
+
seed,
|
|
913
|
+
mode: effectiveMode,
|
|
914
|
+
routes: nextManifestRoutes
|
|
915
|
+
}, targetOutputDir);
|
|
916
|
+
await copyStaticAssets(options.assets, targetOutputDir);
|
|
917
|
+
if (effectiveMode === "full") await replaceOutputDirectory(targetOutputDir, options.outputDir);
|
|
918
|
+
} catch (error) {
|
|
919
|
+
if (effectiveMode === "full") await fs.rm(targetOutputDir, {
|
|
920
|
+
recursive: true,
|
|
921
|
+
force: true
|
|
922
|
+
});
|
|
923
|
+
throw error;
|
|
924
|
+
}
|
|
925
|
+
return result;
|
|
926
|
+
});
|
|
886
927
|
},
|
|
887
928
|
/**
|
|
888
929
|
* Get effective config in a serializable form for diagnostics.
|
package/dist/ssr/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { C as SSRDataMissingError } from "../render-context-B7ohlh6t.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-BhcP35fE.js";
|
|
3
3
|
export { SSRDataMissingError, createRenderContext, getRenderContext, renderResolvedToStringSync, renderRouteRequest, renderRouteRequestToString, renderToStream, renderToString, renderToStringSync, resolveRequest, withRenderContext, withRenderContextAsync };
|
|
@@ -14,7 +14,7 @@ import { n as SSR_PORTAL_HOST, t as SSR_PORTAL_ANCHOR } from "./portal-w3oQ6oQU.
|
|
|
14
14
|
import { t as createDataRuntime } from "./data-runtime-JxoRgrrt.js";
|
|
15
15
|
import { c as withTelemetry, i as dehydrateDataRuntime, t as createQueryPrefetchContext } from "./query-registry-CimB1YeW.js";
|
|
16
16
|
import { a as resolveRouteFromRoutes, c as removeRouteBasePath, s as normalizeRouteBasePath, t as _resolveRouteMatchFromRoutes } from "./route-matching-Bo6UqG-5.js";
|
|
17
|
-
import { a as resolveRouteRequest, d as DEFERRED_BOUNDARY, l as validateRouteHydrationData, o as getRouteHydrationMetadata, p as isDeferred } from "./resolution-
|
|
17
|
+
import { a as resolveRouteRequest, d as DEFERRED_BOUNDARY, l as validateRouteHydrationData, o as getRouteHydrationMetadata, p as isDeferred } from "./resolution-C-ZE5swD.js";
|
|
18
18
|
import { n as disposeRegisteredDefaultPortalScope, r as getDefaultPortalHost } from "./default-portal-runtime-DvMvWJVp.js";
|
|
19
19
|
import { n as renderDocument, t as SSR_RENDER_DATA_ATTR } from "./ssr-DSHd_Q9K.js";
|
|
20
20
|
//#region src/ssr/escape.ts
|
package/dist/testing/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { u as recordReadableRead } from "../readable-BsdGWsDE.js";
|
|
|
3
3
|
import { l as addInvalidationListener, t as createDataRuntime } from "../data-runtime-JxoRgrrt.js";
|
|
4
4
|
import { a as notifySource, i as normalizeAsyncDataError, r as createReadableSource } from "../data-Bm8L6JOm.js";
|
|
5
5
|
import { r as computeRouteActivityMatches } from "../route-matching-Bo6UqG-5.js";
|
|
6
|
-
import { a as cleanupApp, r as createSPA, t as createIsland } from "../boot-
|
|
6
|
+
import { a as cleanupApp, r as createSPA, t as createIsland } from "../boot-CZuC3Muv.js";
|
|
7
7
|
//#region src/testing/render.ts
|
|
8
8
|
const renderStates = /* @__PURE__ */ new WeakMap();
|
|
9
9
|
const eventConstructorNames = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { g as getHydrationRenderUrl, m as withHydrationVerificationRender } from "./render-context-B7ohlh6t.js";
|
|
2
2
|
import { t as SSR_RENDER_DATA_ATTR } from "./ssr-DSHd_Q9K.js";
|
|
3
|
-
import { a as renderResolvedToStringSync } from "./ssr-
|
|
3
|
+
import { a as renderResolvedToStringSync } from "./ssr-BhcP35fE.js";
|
|
4
4
|
//#region src/ssr/verify-hydration.ts
|
|
5
5
|
function normalizeHydrationHtml(html) {
|
|
6
6
|
const template = document.createElement("template");
|