vinext 1.0.0-beta.2 → 1.0.0-beta.4
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/README.md +6 -9
- package/dist/build/client-build-config.js +7 -1
- package/dist/build/precompress.js +1 -1
- package/dist/build/prerender.d.ts +2 -1
- package/dist/build/prerender.js +12 -2
- package/dist/check.js +4 -0
- package/dist/cli-args.d.ts +2 -1
- package/dist/cli-args.js +10 -0
- package/dist/cli.js +14 -8
- package/dist/client/navigation-runtime.d.ts +6 -0
- package/dist/client/navigation-runtime.js +1 -1
- package/dist/config/config-matchers.js +4 -1
- package/dist/config/dotenv.d.ts +3 -4
- package/dist/config/dotenv.js +30 -22
- package/dist/config/next-config.d.ts +16 -5
- package/dist/config/next-config.js +7 -0
- package/dist/entries/app-browser-entry.d.ts +4 -10
- package/dist/entries/app-browser-entry.js +20 -4
- package/dist/entries/app-rsc-entry.js +21 -3
- package/dist/entries/app-rsc-manifest.js +19 -0
- package/dist/entries/pages-client-entry.js +0 -1
- package/dist/entries/pages-server-entry.js +13 -3
- package/dist/index.js +122 -49
- package/dist/init-cloudflare.d.ts +3 -1
- package/dist/init-cloudflare.js +59 -5
- package/dist/plugins/client-reference-dedup.js +7 -5
- package/dist/plugins/extensionless-dynamic-import.js +23 -18
- package/dist/plugins/ignore-dynamic-requests.js +3 -1
- package/dist/plugins/import-meta-url.js +17 -6
- package/dist/plugins/require-context.js +20 -15
- package/dist/plugins/sass.js +3 -4
- package/dist/plugins/transform-cache.d.ts +19 -0
- package/dist/plugins/transform-cache.js +36 -0
- package/dist/routing/app-route-graph.d.ts +14 -6
- package/dist/routing/app-route-graph.js +106 -16
- package/dist/server/api-handler.d.ts +2 -0
- package/dist/server/api-handler.js +7 -6
- package/dist/server/app-bfcache-identity.js +28 -2
- package/dist/server/app-browser-entry.js +175 -75
- package/dist/server/app-browser-navigation-controller.d.ts +23 -21
- package/dist/server/app-browser-navigation-controller.js +30 -5
- package/dist/server/app-browser-prefetch-response.d.ts +9 -0
- package/dist/server/app-browser-prefetch-response.js +32 -0
- package/dist/server/app-browser-state.d.ts +8 -3
- package/dist/server/app-browser-state.js +9 -3
- package/dist/server/app-page-cache-finalizer.js +1 -1
- package/dist/server/app-page-cache.d.ts +1 -1
- package/dist/server/app-page-cache.js +16 -2
- package/dist/server/app-page-dispatch.d.ts +9 -1
- package/dist/server/app-page-dispatch.js +37 -8
- package/dist/server/app-page-element-builder.d.ts +4 -1
- package/dist/server/app-page-element-builder.js +34 -7
- package/dist/server/app-page-head.d.ts +3 -3
- package/dist/server/app-page-head.js +58 -13
- package/dist/server/app-page-http-access-fallback-metadata.d.ts +2 -2
- package/dist/server/app-page-http-access-fallback-metadata.js +9 -1
- package/dist/server/app-page-probe.d.ts +4 -0
- package/dist/server/app-page-probe.js +6 -2
- package/dist/server/app-page-render.d.ts +1 -1
- package/dist/server/app-page-render.js +13 -3
- package/dist/server/app-page-request.d.ts +3 -1
- package/dist/server/app-page-request.js +4 -13
- package/dist/server/app-page-response.d.ts +2 -0
- package/dist/server/app-page-response.js +7 -2
- package/dist/server/app-page-route-wiring.d.ts +10 -2
- package/dist/server/app-page-route-wiring.js +269 -59
- package/dist/server/app-pages-bridge.d.ts +2 -1
- package/dist/server/app-pages-bridge.js +3 -1
- package/dist/server/app-route-handler-cache.js +4 -0
- package/dist/server/app-route-handler-dispatch.js +9 -3
- package/dist/server/app-route-handler-response.js +1 -1
- package/dist/server/app-route-module-loader.d.ts +6 -0
- package/dist/server/app-route-module-loader.js +3 -0
- package/dist/server/app-router-entry.js +6 -3
- package/dist/server/app-rsc-cache-busting.d.ts +7 -0
- package/dist/server/app-rsc-cache-busting.js +6 -0
- package/dist/server/app-rsc-errors.js +10 -0
- package/dist/server/app-rsc-handler.d.ts +2 -0
- package/dist/server/app-rsc-handler.js +30 -13
- package/dist/server/app-rsc-render-mode.d.ts +3 -2
- package/dist/server/app-rsc-render-mode.js +4 -1
- package/dist/server/app-rsc-request-normalization.js +65 -4
- package/dist/server/app-rsc-route-matching.d.ts +9 -0
- package/dist/server/app-rsc-route-matching.js +6 -0
- package/dist/server/app-server-action-execution.d.ts +1 -1
- package/dist/server/app-ssr-entry.js +4 -4
- package/dist/server/app-visited-response-cache.d.ts +6 -1
- package/dist/server/app-visited-response-cache.js +49 -1
- package/dist/server/cache-control.d.ts +2 -2
- package/dist/server/cache-control.js +2 -1
- package/dist/server/dev-server.d.ts +3 -1
- package/dist/server/dev-server.js +204 -348
- package/dist/server/edge-api-runtime.d.ts +10 -1
- package/dist/server/edge-api-runtime.js +29 -1
- package/dist/server/headers.d.ts +4 -2
- package/dist/server/headers.js +6 -3
- package/dist/server/isr-cache.d.ts +10 -33
- package/dist/server/isr-cache.js +33 -43
- package/dist/server/isr-decision.d.ts +2 -2
- package/dist/server/pages-api-route.d.ts +4 -0
- package/dist/server/pages-api-route.js +6 -3
- package/dist/server/pages-asset-tags.d.ts +1 -0
- package/dist/server/pages-asset-tags.js +6 -4
- package/dist/server/pages-dev-hydration.js +0 -1
- package/dist/server/pages-document-asset-props.d.ts +26 -0
- package/dist/server/pages-document-asset-props.js +69 -0
- package/dist/server/pages-get-initial-props.d.ts +1 -1
- package/dist/server/pages-get-initial-props.js +1 -4
- package/dist/server/pages-i18n.js +64 -16
- package/dist/server/pages-node-compat.d.ts +2 -0
- package/dist/server/pages-node-compat.js +10 -6
- package/dist/server/pages-page-data.d.ts +61 -9
- package/dist/server/pages-page-data.js +334 -74
- package/dist/server/pages-page-handler.d.ts +6 -1
- package/dist/server/pages-page-handler.js +119 -20
- package/dist/server/pages-page-response.d.ts +7 -3
- package/dist/server/pages-page-response.js +41 -33
- package/dist/server/pages-request-pipeline.d.ts +7 -0
- package/dist/server/pages-request-pipeline.js +5 -1
- package/dist/server/pages-revalidate.d.ts +1 -1
- package/dist/server/pages-revalidate.js +54 -8
- package/dist/server/pages-router-entry.d.ts +1 -0
- package/dist/server/pages-router-entry.js +10 -4
- package/dist/server/prerender-manifest.d.ts +1 -0
- package/dist/server/prod-server.d.ts +2 -1
- package/dist/server/prod-server.js +38 -13
- package/dist/server/revalidation-host.d.ts +11 -0
- package/dist/server/revalidation-host.js +19 -0
- package/dist/server/seed-cache.js +1 -1
- package/dist/server/worker-revalidation-context.d.ts +13 -0
- package/dist/server/worker-revalidation-context.js +30 -0
- package/dist/shims/app-router-scroll-state.d.ts +2 -1
- package/dist/shims/app-router-scroll-state.js +7 -2
- package/dist/shims/cache-handler.d.ts +1 -1
- package/dist/shims/cache-handler.js +10 -7
- package/dist/shims/cache-runtime.d.ts +6 -0
- package/dist/shims/cache-runtime.js +4 -1
- package/dist/shims/cache.js +1 -1
- package/dist/shims/document.js +15 -2
- package/dist/shims/error.js +1 -1
- package/dist/shims/fetch-cache.js +1 -1
- package/dist/shims/font-google-base.js +17 -8
- package/dist/shims/font-local.js +41 -10
- package/dist/shims/hash-scroll.d.ts +1 -1
- package/dist/shims/hash-scroll.js +2 -1
- package/dist/shims/headers.d.ts +10 -13
- package/dist/shims/headers.js +85 -36
- package/dist/shims/internal/cookie-serialize.d.ts +10 -9
- package/dist/shims/internal/cookie-serialize.js +9 -8
- package/dist/shims/internal/interpolate-as.d.ts +15 -1
- package/dist/shims/internal/interpolate-as.js +27 -2
- package/dist/shims/link.d.ts +2 -0
- package/dist/shims/link.js +77 -24
- package/dist/shims/metadata.d.ts +18 -34
- package/dist/shims/metadata.js +98 -56
- package/dist/shims/navigation.d.ts +18 -2
- package/dist/shims/navigation.js +70 -21
- package/dist/shims/request-context.d.ts +6 -2
- package/dist/shims/router.js +18 -7
- package/dist/shims/script.js +1 -1
- package/dist/shims/server.d.ts +7 -6
- package/dist/shims/server.js +156 -57
- package/dist/shims/slot.d.ts +2 -1
- package/dist/shims/slot.js +6 -2
- package/dist/shims/streamed-icons.d.ts +9 -0
- package/dist/shims/streamed-icons.js +33 -0
- package/dist/shims/unified-request-context.d.ts +21 -2
- package/dist/shims/unified-request-context.js +82 -1
- package/dist/utils/cache-control-metadata.d.ts +2 -1
- package/dist/utils/cache-control-metadata.js +5 -1
- package/dist/utils/html-limited-bots.js +1 -1
- package/dist/utils/protocol-headers.d.ts +7 -1
- package/dist/utils/protocol-headers.js +7 -1
- package/package.json +1 -1
|
@@ -30,6 +30,10 @@ function readRequestCacheLifeForPrerender(options) {
|
|
|
30
30
|
if (options.isEdgeRuntime && options.revalidateSeconds === null) return (options.peekRequestCacheLife?.() ?? options.getRequestCacheLife())?.revalidate !== void 0 ? { revalidate: 0 } : null;
|
|
31
31
|
return options.peekRequestCacheLife?.() ?? options.getRequestCacheLife();
|
|
32
32
|
}
|
|
33
|
+
function resolveConfiguredDynamicStaleTimeSeconds() {
|
|
34
|
+
const seconds = Number(process.env.__NEXT_CLIENT_ROUTER_DYNAMIC_STALETIME);
|
|
35
|
+
return Number.isInteger(seconds) && seconds >= 0 ? seconds : 0;
|
|
36
|
+
}
|
|
33
37
|
function readRequestCacheLifeForCachePolicy(options) {
|
|
34
38
|
const requestCacheLife = options.getRequestCacheLife();
|
|
35
39
|
if (options.isEdgeRuntime && options.revalidateSeconds === null) return null;
|
|
@@ -322,10 +326,11 @@ async function renderAppPageLifecycle(options) {
|
|
|
322
326
|
layoutParamAccess: options.layoutParamAccess
|
|
323
327
|
});
|
|
324
328
|
const shouldBypassRscCacheForSkipTransport = options.isRscRequest && isSkipTransportEnabled(skipDisposition);
|
|
329
|
+
const dynamicStaleTimeSeconds = options.dynamicStaleTimeSeconds ?? (options.isForceDynamic ? resolveConfiguredDynamicStaleTimeSeconds() : void 0);
|
|
325
330
|
const outgoingElement = AppElementsWire.encodeOutgoingPayload({
|
|
326
331
|
element: options.element,
|
|
327
332
|
layoutFlags,
|
|
328
|
-
...
|
|
333
|
+
...dynamicStaleTimeSeconds !== void 0 && options.isPrerender !== true && !options.isForceStatic ? { dynamicStaleTimeSeconds } : {},
|
|
329
334
|
...artifactCompatibility ? { artifactCompatibility } : {},
|
|
330
335
|
renderObservation: payloadRenderObservation,
|
|
331
336
|
skipDisposition: options.isRscRequest ? skipDisposition : void 0
|
|
@@ -385,8 +390,10 @@ async function renderAppPageLifecycle(options) {
|
|
|
385
390
|
revalidateSeconds
|
|
386
391
|
});
|
|
387
392
|
if (shouldBypassRscCacheForSkipTransport) options.isrDebug?.("RSC cache write skipped (skip transport payload)", options.cleanPathname);
|
|
393
|
+
const shouldEmitDynamicStaleTime = dynamicStaleTimeSeconds !== void 0 && options.isPrerender !== true && !options.isForceStatic && (dynamicUsedDuringBuild || options.isForceDynamic || !shouldCaptureRscForCacheMetadata);
|
|
388
394
|
const rscResponse = buildAppPageRscResponse(rscForResponse, {
|
|
389
|
-
|
|
395
|
+
cacheTags: options.isPrerender === true ? options.getPageTags() : void 0,
|
|
396
|
+
dynamicStaleTimeSeconds: shouldEmitDynamicStaleTime ? dynamicStaleTimeSeconds : void 0,
|
|
390
397
|
isEdgeRuntime: options.isEdgeRuntime,
|
|
391
398
|
middlewareContext: options.middlewareContext,
|
|
392
399
|
mountedSlotsHeader: options.mountedSlotsHeader,
|
|
@@ -474,7 +481,7 @@ async function renderAppPageLifecycle(options) {
|
|
|
474
481
|
}
|
|
475
482
|
return {
|
|
476
483
|
kind,
|
|
477
|
-
...kind === "dynamic" &&
|
|
484
|
+
...kind === "dynamic" && dynamicStaleTimeSeconds !== void 0 && options.isPrerender !== true && !shouldCaptureRscForCacheMetadata ? { dynamicStaleTimeSeconds } : {}
|
|
478
485
|
};
|
|
479
486
|
},
|
|
480
487
|
fontData,
|
|
@@ -564,6 +571,7 @@ async function renderAppPageLifecycle(options) {
|
|
|
564
571
|
});
|
|
565
572
|
if (htmlRender.shellErrorRecovered) {
|
|
566
573
|
const response = buildAppPageHtmlResponse(safeHtmlStream, {
|
|
574
|
+
cacheTags: options.isPrerender === true ? options.getPageTags() : void 0,
|
|
567
575
|
draftCookie,
|
|
568
576
|
linkHeader,
|
|
569
577
|
isEdgeRuntime: options.isEdgeRuntime,
|
|
@@ -581,6 +589,7 @@ async function renderAppPageLifecycle(options) {
|
|
|
581
589
|
const shouldSpeculativelyWriteCache = options.isProduction && shouldCaptureRscForCacheMetadata && !options.isEdgeRuntime && revalidateSeconds === null && !options.isDynamicError && !options.isForceStatic && !options.scriptNonce && options.isProgressiveActionRender !== true && !dynamicUsedDuringRender;
|
|
582
590
|
if (htmlResponsePolicy.shouldWriteToCache || shouldSpeculativelyWriteCache) {
|
|
583
591
|
const isrResponse = buildAppPageHtmlResponse(safeHtmlStream, {
|
|
592
|
+
cacheTags: options.isPrerender === true ? options.getPageTags() : void 0,
|
|
584
593
|
draftCookie,
|
|
585
594
|
linkHeader,
|
|
586
595
|
isEdgeRuntime: options.isEdgeRuntime,
|
|
@@ -647,6 +656,7 @@ async function renderAppPageLifecycle(options) {
|
|
|
647
656
|
});
|
|
648
657
|
}
|
|
649
658
|
return buildAppPageHtmlResponse(safeHtmlStream, {
|
|
659
|
+
cacheTags: options.isPrerender === true ? options.getPageTags() : void 0,
|
|
650
660
|
draftCookie,
|
|
651
661
|
linkHeader,
|
|
652
662
|
isEdgeRuntime: options.isEdgeRuntime,
|
|
@@ -33,7 +33,6 @@ type ParallelGenerateStaticParamsBranch = {
|
|
|
33
33
|
routeSegments?: readonly string[] | null;
|
|
34
34
|
};
|
|
35
35
|
type ValidateAppPageDynamicParamsOptions = {
|
|
36
|
-
clearRequestContext: () => void;
|
|
37
36
|
enforceStaticParamsOnly: boolean;
|
|
38
37
|
generateStaticParams?: GenerateStaticParams | GenerateStaticParamsSource | readonly (GenerateStaticParams | GenerateStaticParamsSource | null | undefined)[] | null;
|
|
39
38
|
isDynamicRoute: boolean;
|
|
@@ -62,8 +61,11 @@ type AppPageInterceptMatch<TPage = unknown> = {
|
|
|
62
61
|
interceptLayouts?: readonly unknown[] | null;
|
|
63
62
|
interceptLayoutSegments?: readonly (readonly string[])[] | null;
|
|
64
63
|
interceptBranchSegments?: readonly string[] | null;
|
|
64
|
+
interceptLoadings?: readonly unknown[] | null;
|
|
65
|
+
interceptLoadingTreePositions?: readonly number[] | null;
|
|
65
66
|
interceptNotFoundBranchSegments?: readonly string[] | null;
|
|
66
67
|
__loadInterceptLayouts?: readonly (() => Promise<unknown>)[] | null;
|
|
68
|
+
__loadInterceptLoadings?: readonly (() => Promise<unknown>)[] | null;
|
|
67
69
|
matchedParams: AppPageParams;
|
|
68
70
|
sourceMatchedParams?: AppPageParams;
|
|
69
71
|
page: TPage;
|
|
@@ -212,10 +212,7 @@ function normalizeGenerateStaticParams(generateStaticParams) {
|
|
|
212
212
|
async function validateAppPageDynamicParams(options) {
|
|
213
213
|
if (!options.enforceStaticParamsOnly || !options.isDynamicRoute) return null;
|
|
214
214
|
const generateStaticParamsSources = normalizeGenerateStaticParams(options.generateStaticParams);
|
|
215
|
-
if (generateStaticParamsSources.length === 0)
|
|
216
|
-
options.clearRequestContext();
|
|
217
|
-
return notFoundResponse();
|
|
218
|
-
}
|
|
215
|
+
if (generateStaticParamsSources.length === 0) return notFoundResponse();
|
|
219
216
|
const chainedSources = generateStaticParamsSources.filter((source) => source.chained);
|
|
220
217
|
let chainedStaticParams = null;
|
|
221
218
|
if (chainedSources.length > 0) chainedStaticParams = await generateChainedStaticParams(chainedSources);
|
|
@@ -230,17 +227,11 @@ async function validateAppPageDynamicParams(options) {
|
|
|
230
227
|
const result = await generateIndependentStaticParams(sources, chainedStaticParams, options.params);
|
|
231
228
|
if (result.validated) {
|
|
232
229
|
validatedIndependentResults = true;
|
|
233
|
-
if (!areStaticParamsAllowed(options.params, result.staticParams, true))
|
|
234
|
-
options.clearRequestContext();
|
|
235
|
-
return notFoundResponse();
|
|
236
|
-
}
|
|
230
|
+
if (!areStaticParamsAllowed(options.params, result.staticParams, true)) return notFoundResponse();
|
|
237
231
|
}
|
|
238
232
|
}
|
|
239
233
|
if (chainedStaticParams && !validatedIndependentResults) {
|
|
240
|
-
if (!areStaticParamsAllowed(options.params, chainedStaticParams))
|
|
241
|
-
options.clearRequestContext();
|
|
242
|
-
return notFoundResponse();
|
|
243
|
-
}
|
|
234
|
+
if (!areStaticParamsAllowed(options.params, chainedStaticParams)) return notFoundResponse();
|
|
244
235
|
}
|
|
245
236
|
return null;
|
|
246
237
|
}
|
|
@@ -307,7 +298,7 @@ async function resolveAppPageInterceptState(options) {
|
|
|
307
298
|
if (loadState) loadState.notFoundLoading = loading;
|
|
308
299
|
await loading;
|
|
309
300
|
}
|
|
310
|
-
if (intercept.__loadInterceptLayouts) await loadAppInterceptLayouts(intercept);
|
|
301
|
+
if (intercept.__loadInterceptLayouts || intercept.__loadInterceptLoadings) await loadAppInterceptLayouts(intercept);
|
|
311
302
|
const sourceRoute = await options.getSourceRoute(intercept.sourceRouteIndex);
|
|
312
303
|
if (!sourceRoute) return { kind: "none" };
|
|
313
304
|
if (sourceRoute === options.currentRoute) return {
|
|
@@ -40,6 +40,7 @@ type AppPageHtmlResponsePolicy = {
|
|
|
40
40
|
shouldWriteToCache: boolean;
|
|
41
41
|
} & AppPageResponsePolicy;
|
|
42
42
|
type BuildAppPageRscResponseOptions = {
|
|
43
|
+
cacheTags?: readonly string[];
|
|
43
44
|
dynamicStaleTimeSeconds?: number;
|
|
44
45
|
isEdgeRuntime?: boolean;
|
|
45
46
|
middlewareContext: AppPageMiddlewareContext;
|
|
@@ -51,6 +52,7 @@ type BuildAppPageRscResponseOptions = {
|
|
|
51
52
|
timing?: AppPageResponseTiming;
|
|
52
53
|
};
|
|
53
54
|
type BuildAppPageHtmlResponseOptions = {
|
|
55
|
+
cacheTags?: readonly string[];
|
|
54
56
|
draftCookie?: string | null; /** Combined preload `Link` header value (React hints + font preloads), already capped. */
|
|
55
57
|
linkHeader?: string;
|
|
56
58
|
isEdgeRuntime?: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { VINEXT_DYNAMIC_STALE_TIME_HEADER, VINEXT_MOUNTED_SLOTS_HEADER, VINEXT_PARAMS_HEADER, VINEXT_PRERENDER_CACHE_LIFE_HEADER, VINEXT_RENDERED_PATH_AND_SEARCH_HEADER, VINEXT_TIMING_HEADER } from "./headers.js";
|
|
2
|
-
import { setCacheStateHeaders } from "./cache-headers.js";
|
|
1
|
+
import { NEXT_CACHE_TAGS_HEADER, VINEXT_DYNAMIC_STALE_TIME_HEADER, VINEXT_MOUNTED_SLOTS_HEADER, VINEXT_PARAMS_HEADER, VINEXT_PRERENDER_CACHE_LIFE_HEADER, VINEXT_RENDERED_PATH_AND_SEARCH_HEADER, VINEXT_TIMING_HEADER } from "./headers.js";
|
|
3
2
|
import { NO_STORE_CACHE_CONTROL, STATIC_CACHE_CONTROL, buildRevalidateCacheControl } from "./cache-control.js";
|
|
3
|
+
import { setCacheStateHeaders } from "./cache-headers.js";
|
|
4
4
|
import { VINEXT_RSC_CONTENT_TYPE, VINEXT_RSC_VARY_HEADER, applyRscCompatibilityIdHeader, applyRscDeploymentIdHeader } from "./app-rsc-cache-busting.js";
|
|
5
5
|
import { mergeMiddlewareResponseHeaders } from "./middleware-response-headers.js";
|
|
6
6
|
//#region src/server/app-page-response.ts
|
|
@@ -22,6 +22,9 @@ function applyPrerenderCacheLifeHeader(headers, requestCacheLife) {
|
|
|
22
22
|
if (payload.revalidate === void 0 && payload.expire === void 0) return;
|
|
23
23
|
headers.set(VINEXT_PRERENDER_CACHE_LIFE_HEADER, JSON.stringify(payload));
|
|
24
24
|
}
|
|
25
|
+
function applyPrerenderCacheTagsHeader(headers, cacheTags) {
|
|
26
|
+
if (cacheTags && cacheTags.length > 0) headers.set(NEXT_CACHE_TAGS_HEADER, cacheTags.join(","));
|
|
27
|
+
}
|
|
25
28
|
function resolveAppPageRscResponsePolicy(options) {
|
|
26
29
|
if (options.isDraftMode) return { cacheControl: NO_STORE_CACHE_CONTROL };
|
|
27
30
|
if (options.isForceDynamic || options.dynamicUsedDuringBuild) return { cacheControl: NO_STORE_CACHE_CONTROL };
|
|
@@ -104,6 +107,7 @@ function buildAppPageRscResponse(body, options) {
|
|
|
104
107
|
applyRscCompatibilityIdHeader(headers);
|
|
105
108
|
applyRscDeploymentIdHeader(headers);
|
|
106
109
|
applyPrerenderCacheLifeHeader(headers, options.requestCacheLife);
|
|
110
|
+
applyPrerenderCacheTagsHeader(headers, options.cacheTags);
|
|
107
111
|
applyTimingHeader(headers, options.timing);
|
|
108
112
|
return new Response(body, {
|
|
109
113
|
status: options.middlewareContext.status ?? 200,
|
|
@@ -122,6 +126,7 @@ function buildAppPageHtmlResponse(body, options) {
|
|
|
122
126
|
if (options.linkHeader) headers.set("Link", options.linkHeader);
|
|
123
127
|
mergeMiddlewareResponseHeaders(headers, options.middlewareContext.headers);
|
|
124
128
|
applyPrerenderCacheLifeHeader(headers, options.requestCacheLife);
|
|
129
|
+
applyPrerenderCacheTagsHeader(headers, options.cacheTags);
|
|
125
130
|
applyTimingHeader(headers, options.timing);
|
|
126
131
|
return new Response(body, {
|
|
127
132
|
status: options.middlewareContext.status ?? 200,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { AppRouteSemanticIds } from "../routing/app-route-graph.js";
|
|
2
2
|
import { AppElements, AppElementsInterception, AppElementsSlotBinding } from "./app-elements-wire.js";
|
|
3
|
+
import { AppRscRenderMode } from "./app-rsc-render-mode.js";
|
|
3
4
|
import { AppPageParams } from "./app-page-boundary.js";
|
|
4
5
|
import { ThenableParamsObserver } from "../shims/thenable-params.js";
|
|
5
6
|
import { Metadata, Viewport } from "../shims/metadata.js";
|
|
6
7
|
import { AppLayoutParamAccessTracker } from "./app-layout-param-observation.js";
|
|
7
|
-
import { AppRscRenderMode } from "./app-rsc-render-mode.js";
|
|
8
8
|
import { AppPageRenderIdentity } from "./app-page-render-identity.js";
|
|
9
9
|
import { resolveAppPageChildSegments } from "./app-page-segment-state.js";
|
|
10
10
|
import { ComponentType, ReactNode } from "react";
|
|
@@ -37,6 +37,9 @@ type AppPageRouteWiringSlot<TModule extends AppPageModule = AppPageModule, TErro
|
|
|
37
37
|
layout?: TModule | null;
|
|
38
38
|
layoutIndex: number;
|
|
39
39
|
loading?: TModule | null;
|
|
40
|
+
loadings?: readonly (TModule | null | undefined)[] | null;
|
|
41
|
+
loadingTreePositions?: readonly number[] | null;
|
|
42
|
+
ownerTreePosition?: number | null;
|
|
40
43
|
notFound?: TModule | null;
|
|
41
44
|
notFoundTreePosition?: number | null;
|
|
42
45
|
page?: TModule | null;
|
|
@@ -59,6 +62,8 @@ type AppPageRouteWiringRoute<TModule extends AppPageModule = AppPageModule, TErr
|
|
|
59
62
|
layoutTreePositions?: readonly number[] | null;
|
|
60
63
|
layouts: readonly (TModule | null | undefined)[];
|
|
61
64
|
loading?: TModule | null;
|
|
65
|
+
loadings?: readonly (TModule | null | undefined)[] | null;
|
|
66
|
+
loadingTreePositions?: readonly number[] | null;
|
|
62
67
|
notFound?: TModule | null;
|
|
63
68
|
notFounds?: readonly (TModule | null | undefined)[] | null;
|
|
64
69
|
notFoundTreePosition?: number | null;
|
|
@@ -99,6 +104,8 @@ type AppPageSlotOverride<TModule extends AppPageModule = AppPageModule> = {
|
|
|
99
104
|
branchSegments?: readonly string[] | null;
|
|
100
105
|
layoutSegments?: readonly (readonly string[])[] | null;
|
|
101
106
|
layoutModules?: readonly (TModule | null | undefined)[] | null;
|
|
107
|
+
loadingModules?: readonly (TModule | null | undefined)[] | null;
|
|
108
|
+
loadingTreePositions?: readonly number[] | null;
|
|
102
109
|
/**
|
|
103
110
|
* The page module to render for this slot. Optional — when omitted, the
|
|
104
111
|
* slot's existing `page` is used (e.g. when the override only changes the
|
|
@@ -129,6 +136,7 @@ type BuildAppPageRouteElementOptions<TModule extends AppPageModule = AppPageModu
|
|
|
129
136
|
resolvedMetadata: Metadata | null;
|
|
130
137
|
resolvedMetadataPathname?: string;
|
|
131
138
|
resolvedViewport: Viewport;
|
|
139
|
+
scriptNonce?: string;
|
|
132
140
|
streamingMetadata?: Promise<Metadata | null> | null;
|
|
133
141
|
streamingMetadataOutlet?: Promise<unknown> | null;
|
|
134
142
|
streamingMetadataOutletSuspended?: boolean;
|
|
@@ -166,7 +174,7 @@ declare function createAppPageLayoutEntries<TModule extends AppPageModule, TErro
|
|
|
166
174
|
unauthorizeds?: readonly (TModule | null | undefined)[] | null;
|
|
167
175
|
}): AppPageLayoutEntry<TModule, TErrorModule>[];
|
|
168
176
|
declare function createAppPageSourcePage(routeSegments: readonly string[] | null | undefined): string;
|
|
169
|
-
declare function createAppPageRouteBodyMetadata(metadata: Metadata | null, pathname: string, metadataPlacement: "body" | "head", trailingSlash?: boolean): ReactNode;
|
|
177
|
+
declare function createAppPageRouteBodyMetadata(metadata: Metadata | null, pathname: string, metadataPlacement: "body" | "head", trailingSlash?: boolean, scriptNonce?: string): ReactNode;
|
|
170
178
|
declare function buildAppPageElements<TModule extends AppPageModule, TErrorModule extends AppPageErrorModule>(options: BuildAppPageElementsOptions<TModule, TErrorModule>): AppElements;
|
|
171
179
|
//#endregion
|
|
172
180
|
export { AppPageErrorModule, AppPageModule, AppPageRouteWiringRoute, AppPageSlotOverride, buildAppPageElements, createAppPageLayoutEntries, createAppPageRouteBodyMetadata, createAppPageSourcePage, createAppPageTreePath, probeAppPageLayoutWithTracking, resolveAppPageChildSegments };
|