vinext 0.1.6 → 0.1.8
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/build/client-build-config.d.ts +4 -6
- package/dist/build/client-build-config.js +27 -7
- package/dist/build/prerender.js +1 -2
- package/dist/check.d.ts +18 -0
- package/dist/check.js +37 -17
- package/dist/cli.js +2 -2
- package/dist/config/next-config.d.ts +2 -1
- package/dist/config/next-config.js +3 -0
- package/dist/config/server-external-packages.d.ts +4 -0
- package/dist/config/server-external-packages.js +91 -0
- package/dist/deploy.d.ts +7 -0
- package/dist/deploy.js +25 -18
- package/dist/entries/app-rsc-entry.d.ts +2 -1
- package/dist/entries/app-rsc-entry.js +89 -20
- package/dist/entries/app-rsc-manifest.js +8 -0
- package/dist/entries/pages-client-entry.js +1 -0
- package/dist/entries/pages-server-entry.js +1 -0
- package/dist/index.js +87 -34
- package/dist/init.js +2 -1
- package/dist/plugins/middleware-server-only.d.ts +8 -6
- package/dist/plugins/middleware-server-only.js +8 -7
- package/dist/plugins/og-assets.js +6 -6
- package/dist/plugins/optimize-imports.js +1 -1
- package/dist/plugins/remove-console.js +1 -1
- package/dist/plugins/strip-server-exports.js +2 -1
- package/dist/routing/app-route-graph.d.ts +6 -2
- package/dist/routing/app-route-graph.js +61 -13
- package/dist/routing/app-router.d.ts +5 -0
- package/dist/routing/app-router.js +5 -0
- package/dist/routing/file-matcher.d.ts +5 -0
- package/dist/routing/file-matcher.js +7 -1
- package/dist/server/app-action-request.d.ts +4 -0
- package/dist/server/app-action-request.js +9 -0
- package/dist/server/app-bfcache-identity.d.ts +12 -2
- package/dist/server/app-bfcache-identity.js +52 -23
- package/dist/server/app-browser-entry.js +42 -147
- package/dist/server/app-browser-history-controller.d.ts +2 -1
- package/dist/server/app-browser-history-controller.js +6 -2
- package/dist/server/app-browser-server-action-client.d.ts +32 -0
- package/dist/server/app-browser-server-action-client.js +128 -0
- package/dist/server/app-fallback-renderer.d.ts +3 -1
- package/dist/server/app-fallback-renderer.js +6 -2
- package/dist/server/app-history-state.d.ts +1 -2
- package/dist/server/app-history-state.js +1 -1
- package/dist/server/app-page-boundary-render.d.ts +3 -0
- package/dist/server/app-page-boundary-render.js +14 -3
- package/dist/server/app-page-cache-finalizer.d.ts +1 -0
- package/dist/server/app-page-cache-finalizer.js +8 -2
- package/dist/server/app-page-dispatch.d.ts +33 -4
- package/dist/server/app-page-dispatch.js +62 -90
- package/dist/server/app-page-element-builder.d.ts +7 -1
- package/dist/server/app-page-element-builder.js +56 -19
- package/dist/server/app-page-head.d.ts +16 -1
- package/dist/server/app-page-head.js +44 -22
- package/dist/server/app-page-method.js +1 -1
- package/dist/server/app-page-params.d.ts +2 -1
- package/dist/server/app-page-params.js +8 -1
- package/dist/server/app-page-ppr-runtime.d.ts +7 -0
- package/dist/server/app-page-ppr-runtime.js +70 -0
- package/dist/server/app-page-probe.d.ts +1 -0
- package/dist/server/app-page-probe.js +1 -1
- package/dist/server/app-page-render.d.ts +4 -1
- package/dist/server/app-page-render.js +8 -3
- package/dist/server/app-page-request.d.ts +8 -1
- package/dist/server/app-page-request.js +23 -11
- package/dist/server/app-page-route-wiring.d.ts +6 -1
- package/dist/server/app-page-route-wiring.js +30 -8
- package/dist/server/app-page-search-params-observation.d.ts +4 -2
- package/dist/server/app-page-search-params-observation.js +11 -7
- package/dist/server/app-page-stream.js +2 -1
- package/dist/server/app-ppr-fallback-shell-render.d.ts +4 -3
- package/dist/server/app-route-handler-cache.js +1 -1
- package/dist/server/app-route-handler-dispatch.js +3 -2
- package/dist/server/app-route-handler-execution.js +5 -3
- package/dist/server/app-route-handler-policy.d.ts +1 -1
- package/dist/server/app-route-handler-policy.js +1 -6
- package/dist/server/app-route-module-loader.d.ts +2 -0
- package/dist/server/app-route-module-loader.js +1 -0
- package/dist/server/app-router-entry.js +7 -6
- package/dist/server/app-rsc-errors.d.ts +12 -1
- package/dist/server/app-rsc-errors.js +29 -3
- package/dist/server/app-rsc-handler.d.ts +15 -13
- package/dist/server/app-rsc-handler.js +28 -33
- package/dist/server/app-rsc-response-finalizer.js +5 -1
- package/dist/server/app-rsc-route-matching.d.ts +7 -0
- package/dist/server/app-rsc-route-matching.js +36 -3
- package/dist/server/app-segment-config.d.ts +1 -0
- package/dist/server/app-segment-config.js +32 -2
- package/dist/server/app-server-action-execution.d.ts +4 -0
- package/dist/server/app-server-action-execution.js +42 -11
- package/dist/server/app-ssr-entry.js +11 -6
- package/dist/server/app-static-generation.d.ts +1 -0
- package/dist/server/app-static-generation.js +1 -0
- package/dist/server/headers.d.ts +3 -1
- package/dist/server/headers.js +3 -1
- package/dist/server/metadata-route-response.d.ts +1 -1
- package/dist/server/prod-server.js +15 -6
- package/dist/server/worker-utils.d.ts +2 -1
- package/dist/server/worker-utils.js +7 -1
- package/dist/shims/dynamic.js +1 -1
- package/dist/shims/error-boundary.d.ts +19 -1
- package/dist/shims/error-boundary.js +11 -1
- package/dist/shims/headers.d.ts +3 -1
- package/dist/shims/headers.js +16 -5
- package/dist/shims/link.js +16 -12
- package/dist/shims/metadata.d.ts +3 -2
- package/dist/shims/metadata.js +8 -4
- package/dist/shims/router.js +13 -2
- package/dist/typegen.js +6 -5
- package/dist/utils/path.d.ts +2 -1
- package/dist/utils/path.js +1 -1
- package/dist/utils/project.d.ts +4 -0
- package/dist/utils/project.js +5 -1
- package/package.json +7 -3
|
@@ -20,6 +20,8 @@ const middlewareRequestHeadersPath = resolveEntryPath("../server/middleware-requ
|
|
|
20
20
|
const normalizePathModulePath = resolveEntryPath("../server/normalize-path.js", import.meta.url);
|
|
21
21
|
const appRouteHandlerDispatchPath = resolveEntryPath("../server/app-route-handler-dispatch.js", import.meta.url);
|
|
22
22
|
const appRouteHandlerResponsePath = resolveEntryPath("../server/app-route-handler-response.js", import.meta.url);
|
|
23
|
+
const appMiddlewarePath = resolveEntryPath("../server/app-middleware.js", import.meta.url);
|
|
24
|
+
const metadataRouteResponsePath = resolveEntryPath("../server/metadata-route-response.js", import.meta.url);
|
|
23
25
|
const appServerActionExecutionPath = resolveEntryPath("../server/app-server-action-execution.js", import.meta.url);
|
|
24
26
|
const appRscErrorsPath = resolveEntryPath("../server/app-rsc-errors.js", import.meta.url);
|
|
25
27
|
const appPageExecutionPath = resolveEntryPath("../server/app-page-execution.js", import.meta.url);
|
|
@@ -28,6 +30,8 @@ const appElementsPath = resolveEntryPath("../server/app-elements.js", import.met
|
|
|
28
30
|
const appPageRouteWiringPath = resolveEntryPath("../server/app-page-route-wiring.js", import.meta.url);
|
|
29
31
|
const appPageProbePath = resolveEntryPath("../server/app-page-probe.js", import.meta.url);
|
|
30
32
|
const appPageDispatchPath = resolveEntryPath("../server/app-page-dispatch.js", import.meta.url);
|
|
33
|
+
const appPagePprRuntimePath = resolveEntryPath("../server/app-page-ppr-runtime.js", import.meta.url);
|
|
34
|
+
const fileBasedMetadataPath = resolveEntryPath("../server/file-based-metadata.js", import.meta.url);
|
|
31
35
|
const appPageRequestPath = resolveEntryPath("../server/app-page-request.js", import.meta.url);
|
|
32
36
|
const appSegmentConfigPath = resolveEntryPath("../server/app-segment-config.js", import.meta.url);
|
|
33
37
|
const appRscRouteMatchingPath = resolveEntryPath("../server/app-rsc-route-matching.js", import.meta.url);
|
|
@@ -73,6 +77,7 @@ function generateRscEntry(appDir, routes, middlewarePath, metadataRoutes, global
|
|
|
73
77
|
const cacheMaxMemorySize = config?.cacheMaxMemorySize;
|
|
74
78
|
const inlineCss = config?.inlineCss === true;
|
|
75
79
|
const cacheComponents = config?.cacheComponents === true;
|
|
80
|
+
const hasServerActions = config?.hasServerActions !== false;
|
|
76
81
|
const i18nConfig = config?.i18n ?? null;
|
|
77
82
|
const hasPagesDir = config?.hasPagesDir ?? false;
|
|
78
83
|
const publicFiles = config?.publicFiles ?? [];
|
|
@@ -93,12 +98,12 @@ async function __loadPrerenderPagesRoutes() {
|
|
|
93
98
|
import ${JSON.stringify(serverGlobalsPath)};
|
|
94
99
|
import {
|
|
95
100
|
renderToReadableStream as _renderToReadableStream,
|
|
96
|
-
decodeAction,
|
|
101
|
+
${hasServerActions ? `decodeAction,
|
|
97
102
|
decodeFormState,
|
|
98
103
|
decodeReply,
|
|
99
104
|
loadServerAction,
|
|
100
|
-
createTemporaryReferenceSet
|
|
101
|
-
} from "@vitejs/plugin-rsc/rsc";
|
|
105
|
+
createTemporaryReferenceSet,` : ""}
|
|
106
|
+
} from ${JSON.stringify(hasServerActions ? "@vitejs/plugin-rsc/rsc" : "@vitejs/plugin-rsc/react/rsc")};
|
|
102
107
|
import { createClientManifest as _createClientManifest } from "@vitejs/plugin-rsc/core/rsc";
|
|
103
108
|
import { prerender as _prerender } from "@vitejs/plugin-rsc/vendor/react-server-dom/static.edge";
|
|
104
109
|
import { createRscPrerenderer, createRscRenderer } from ${JSON.stringify(rscStreamHintsPath)};
|
|
@@ -112,7 +117,8 @@ import { getNavigationContext as _getNavigationContext } from "next/navigation";
|
|
|
112
117
|
import { configureMemoryCacheHandler as __configureMemoryCacheHandler } from "vinext/shims/cache-handler";
|
|
113
118
|
import { headersContextFromRequest, getDraftModeCookieHeader, getAndClearPendingCookies, consumeDynamicUsage, consumeInvalidDynamicUsageError, setHeadersAccessPhase } from "next/headers";
|
|
114
119
|
import { mergeMetadata, resolveModuleMetadata, mergeViewport, resolveModuleViewport } from "vinext/metadata";
|
|
115
|
-
${middlewarePath ? `import * as middlewareModule from ${JSON.stringify(normalizePathSeparators(middlewarePath))}
|
|
120
|
+
${middlewarePath ? `import * as middlewareModule from ${JSON.stringify(normalizePathSeparators(middlewarePath))};
|
|
121
|
+
import { applyAppMiddleware as __applyAppMiddleware } from ${JSON.stringify(appMiddlewarePath)};` : ""}
|
|
116
122
|
${instrumentationPath ? `import * as _instrumentation from ${JSON.stringify(normalizePathSeparators(instrumentationPath))};
|
|
117
123
|
import { ensureInstrumentationRegistered as __ensureInstrumentationRegistered } from ${JSON.stringify(instrumentationRuntimePath)};` : ""}
|
|
118
124
|
import { createAppRscHandler } from "vinext/server/app-rsc-handler";
|
|
@@ -123,7 +129,13 @@ ${hasPagesDir ? `import {
|
|
|
123
129
|
applyRouteHandlerMiddlewareContext as __applyRouteHandlerMiddlewareContext,
|
|
124
130
|
} from ${JSON.stringify(appRouteHandlerResponsePath)};` : ""}
|
|
125
131
|
const __loadAppRouteHandlerDispatch = () => import(${JSON.stringify(appRouteHandlerDispatchPath)});
|
|
126
|
-
const __loadAppServerActionExecution = () => import(${JSON.stringify(appServerActionExecutionPath)})
|
|
132
|
+
${hasServerActions ? `const __loadAppServerActionExecution = () => import(${JSON.stringify(appServerActionExecutionPath)});` : ""}
|
|
133
|
+
${(metadataRoutes?.length ?? 0) > 0 ? `const __loadMetadataRouteResponse = () => import(${JSON.stringify(metadataRouteResponsePath)});` : ""}
|
|
134
|
+
${(metadataRoutes?.length ?? 0) > 0 ? `const __loadFileBasedMetadata = () => import(${JSON.stringify(fileBasedMetadataPath)});
|
|
135
|
+
async function __applyFileBasedMetadata(...args) {
|
|
136
|
+
const { applyFileBasedMetadata } = await __loadFileBasedMetadata();
|
|
137
|
+
return applyFileBasedMetadata(...args);
|
|
138
|
+
}` : ""}
|
|
127
139
|
import {
|
|
128
140
|
sanitizeErrorForClient as __sanitizeErrorForClient,
|
|
129
141
|
} from ${JSON.stringify(appRscErrorsPath)};
|
|
@@ -147,6 +159,10 @@ import { buildAppPageProbes as __buildAppPageProbes } from ${JSON.stringify(appP
|
|
|
147
159
|
import {
|
|
148
160
|
dispatchAppPage as __dispatchAppPage,
|
|
149
161
|
} from ${JSON.stringify(appPageDispatchPath)};
|
|
162
|
+
${cacheComponents ? `import {
|
|
163
|
+
appPagePprRuntime as __appPagePprRuntime,
|
|
164
|
+
createAppPprFallbackShells as __createAppPprFallbackShells,
|
|
165
|
+
} from ${JSON.stringify(appPagePprRuntimePath)};` : ""}
|
|
150
166
|
import {
|
|
151
167
|
resolveAppPageGenerateStaticParamsSources as __resolveAppPageGenerateStaticParamsSources,
|
|
152
168
|
} from ${JSON.stringify(appPageRequestPath)};
|
|
@@ -229,6 +245,11 @@ function __resolveRouteFetchCacheMode(route) {
|
|
|
229
245
|
return __resolveAppPageFetchCacheMode({
|
|
230
246
|
layouts: route.layouts,
|
|
231
247
|
page: route.page,
|
|
248
|
+
parallelSegments: Object.values(route.slots ?? {}).flatMap((slot) => [
|
|
249
|
+
slot.layout,
|
|
250
|
+
...(slot.configLayouts ?? []),
|
|
251
|
+
slot.page ?? slot.default,
|
|
252
|
+
]),
|
|
232
253
|
});
|
|
233
254
|
}
|
|
234
255
|
|
|
@@ -236,6 +257,11 @@ function __resolveRouteDynamicConfig(route) {
|
|
|
236
257
|
return __resolveAppPageSegmentConfig({
|
|
237
258
|
layouts: route.layouts,
|
|
238
259
|
page: route.page,
|
|
260
|
+
parallelSegments: Object.values(route.slots ?? {}).flatMap((slot) => [
|
|
261
|
+
slot.layout,
|
|
262
|
+
...(slot.configLayouts ?? []),
|
|
263
|
+
slot.page ?? slot.default,
|
|
264
|
+
]),
|
|
239
265
|
}).dynamicConfig ?? null;
|
|
240
266
|
}
|
|
241
267
|
|
|
@@ -243,6 +269,11 @@ function __resolveRouteRuntime(route) {
|
|
|
243
269
|
return __resolveAppPageSegmentConfig({
|
|
244
270
|
layouts: route.layouts,
|
|
245
271
|
page: route.page,
|
|
272
|
+
parallelSegments: Object.values(route.slots ?? {}).flatMap((slot) => [
|
|
273
|
+
slot.layout,
|
|
274
|
+
...(slot.configLayouts ?? []),
|
|
275
|
+
slot.page ?? slot.default,
|
|
276
|
+
]),
|
|
246
277
|
}).runtime ?? null;
|
|
247
278
|
}
|
|
248
279
|
|
|
@@ -312,6 +343,7 @@ const createRscOnErrorHandler = (request, pathname, routePath) =>
|
|
|
312
343
|
createAppRscOnErrorHandler(_reportRequestError, request, pathname, routePath);
|
|
313
344
|
|
|
314
345
|
const __fallbackRenderer = __createAppFallbackRenderer({
|
|
346
|
+
${(metadataRoutes?.length ?? 0) > 0 ? "applyFileBasedMetadata: __applyFileBasedMetadata," : ""}
|
|
315
347
|
basePath: __basePath,
|
|
316
348
|
trailingSlash: __trailingSlash,
|
|
317
349
|
rootBoundaries: {
|
|
@@ -361,6 +393,7 @@ async function buildPageElements(route, params, routePath, pageRequest, layoutPa
|
|
|
361
393
|
// Hydrate lazy page/route-handler modules before any synchronous read.
|
|
362
394
|
await __ensureRouteLoaded(route);
|
|
363
395
|
return __buildPageElements({
|
|
396
|
+
${(metadataRoutes?.length ?? 0) > 0 ? "applyFileBasedMetadata: __applyFileBasedMetadata," : ""}
|
|
364
397
|
route,
|
|
365
398
|
params,
|
|
366
399
|
routePath,
|
|
@@ -396,7 +429,6 @@ export const __assetPrefix = ${JSON.stringify(assetPrefix)};
|
|
|
396
429
|
export const __inlineCss = ${JSON.stringify(inlineCss)};
|
|
397
430
|
export const __hasPagesDir = ${JSON.stringify(hasPagesDir)};
|
|
398
431
|
export const getRenderedConcreteUrlPathsForRoute = __getRenderedConcreteUrlPathsForRoute;
|
|
399
|
-
const __cacheComponents = ${JSON.stringify(cacheComponents)};
|
|
400
432
|
|
|
401
433
|
export async function seedMemoryCacheFromPrerender(serverDir) {
|
|
402
434
|
const { seedMemoryCacheFromPrerender: __seedMemoryCacheFromPrerender } =
|
|
@@ -451,7 +483,9 @@ export default createAppRscHandler({
|
|
|
451
483
|
},
|
|
452
484
|
registerCacheAdapters: __registerConfiguredCacheAdapters,
|
|
453
485
|
configHeaders: __configHeaders,
|
|
454
|
-
cacheComponents
|
|
486
|
+
${cacheComponents ? `createPprFallbackShells(route, params) {
|
|
487
|
+
return __createAppPprFallbackShells(route, params);
|
|
488
|
+
},` : ""}
|
|
455
489
|
configRedirects: __configRedirects,
|
|
456
490
|
configRewrites: __configRewrites,
|
|
457
491
|
imageConfig: __imageConfig,
|
|
@@ -487,7 +521,12 @@ export default createAppRscHandler({
|
|
|
487
521
|
const __segmentConfig = __resolveAppPageSegmentConfig({
|
|
488
522
|
layouts: route.layouts,
|
|
489
523
|
page: route.page,
|
|
490
|
-
parallelPages: Object.values(route.slots ?? {}).map((slot) => slot.page),
|
|
524
|
+
parallelPages: Object.values(route.slots ?? {}).map((slot) => slot.page ?? slot.default),
|
|
525
|
+
parallelSegments: Object.values(route.slots ?? {}).flatMap((slot) => [
|
|
526
|
+
slot.layout,
|
|
527
|
+
...(slot.configLayouts ?? []),
|
|
528
|
+
slot.page ?? slot.default,
|
|
529
|
+
]),
|
|
491
530
|
});
|
|
492
531
|
const __generateStaticParams = __resolveAppPageGenerateStaticParamsSources({
|
|
493
532
|
layouts: route.layouts,
|
|
@@ -501,7 +540,7 @@ export default createAppRscHandler({
|
|
|
501
540
|
ensureRouteLoaded: __ensureRouteLoaded,
|
|
502
541
|
clientTraceMetadata: __clientTraceMetadata,
|
|
503
542
|
reactMaxHeadersLength: __reactMaxHeadersLength,
|
|
504
|
-
buildPageElement(targetRoute, targetParams, targetOpts, targetSearchParams, layoutParamAccess) {
|
|
543
|
+
buildPageElement(targetRoute, targetParams, targetOpts, targetSearchParams, layoutParamAccess, buildOptions) {
|
|
505
544
|
return buildPageElements(targetRoute, targetParams, cleanPathname, {
|
|
506
545
|
opts: targetOpts,
|
|
507
546
|
searchParams: targetSearchParams,
|
|
@@ -509,6 +548,8 @@ export default createAppRscHandler({
|
|
|
509
548
|
request,
|
|
510
549
|
mountedSlotsHeader,
|
|
511
550
|
renderMode,
|
|
551
|
+
observeMetadataSearchParamsAccess: buildOptions?.observeMetadataSearchParamsAccess === true,
|
|
552
|
+
observePageSearchParamsAccess: buildOptions?.observePageSearchParamsAccess === true,
|
|
512
553
|
}, layoutParamAccess, displayPathname);
|
|
513
554
|
},
|
|
514
555
|
clientReuseManifest,
|
|
@@ -565,6 +606,7 @@ export default createAppRscHandler({
|
|
|
565
606
|
params,
|
|
566
607
|
pprFallbackCacheShells,
|
|
567
608
|
pprFallbackShell,
|
|
609
|
+
pprRuntime: ${cacheComponents ? "__appPagePprRuntime" : "undefined"},
|
|
568
610
|
renderedConcreteUrlPaths,
|
|
569
611
|
skipStaticParamsValidation,
|
|
570
612
|
staticParamsValidationParams,
|
|
@@ -578,7 +620,7 @@ export default createAppRscHandler({
|
|
|
578
620
|
route,
|
|
579
621
|
});
|
|
580
622
|
},
|
|
581
|
-
async probePage() {
|
|
623
|
+
async probePage(probeSearchParams = searchParams) {
|
|
582
624
|
const __probeIntercept = findIntercept(cleanPathname, interceptionContext);
|
|
583
625
|
// The intercepting-route page module is lazy (page: null + __pageLoader).
|
|
584
626
|
// Resolve it before probing so buildAppPageProbes inspects the real page
|
|
@@ -593,21 +635,21 @@ export default createAppRscHandler({
|
|
|
593
635
|
route,
|
|
594
636
|
pageComponent: PageComponent,
|
|
595
637
|
asyncRouteParams: _asyncRouteParams,
|
|
596
|
-
searchParams,
|
|
638
|
+
searchParams: probeSearchParams,
|
|
597
639
|
intercept: __probeIntercept,
|
|
598
640
|
isRscRequest,
|
|
599
641
|
matchedParams: params,
|
|
600
642
|
makeThenableParams,
|
|
601
643
|
}));
|
|
602
644
|
},
|
|
603
|
-
renderErrorBoundaryPage(renderErr) {
|
|
645
|
+
renderErrorBoundaryPage(renderErr, errorOrigin) {
|
|
604
646
|
const __activeIntercept = findIntercept(cleanPathname, interceptionContext);
|
|
605
647
|
return __fallbackRenderer.renderErrorBoundary(route, renderErr, isRscRequest, request, params, scriptNonce, middlewareContext, {
|
|
606
648
|
isEdgeRuntime: __isEdgeRuntime(__segmentConfig.runtime),
|
|
607
649
|
sourcePageSegments: __activeIntercept?.slotKey === __SIBLING_PAGE_INTERCEPT_SLOT_KEY
|
|
608
650
|
? __activeIntercept.sourcePageSegments
|
|
609
651
|
: null,
|
|
610
|
-
});
|
|
652
|
+
}, errorOrigin);
|
|
611
653
|
},
|
|
612
654
|
renderHttpAccessFallbackPage(statusCode, opts, currentMiddlewareContext) {
|
|
613
655
|
const __activeIntercept = findIntercept(cleanPathname, interceptionContext);
|
|
@@ -683,6 +725,7 @@ export default createAppRscHandler({
|
|
|
683
725
|
${instrumentationPath ? `ensureInstrumentation() {
|
|
684
726
|
return __ensureInstrumentationRegistered(_instrumentation);
|
|
685
727
|
},` : ""}
|
|
728
|
+
${hasServerActions ? `
|
|
686
729
|
async handleProgressiveActionRequest({
|
|
687
730
|
actionId,
|
|
688
731
|
cleanPathname,
|
|
@@ -756,7 +799,7 @@ export default createAppRscHandler({
|
|
|
756
799
|
const __actionMatch = matchRoute(cleanPathname);
|
|
757
800
|
if (__actionMatch) await __ensureRouteLoaded(__actionMatch.route);
|
|
758
801
|
const __actionIsEdgeRuntime = __actionMatch
|
|
759
|
-
? __isEdgeRuntime(
|
|
802
|
+
? __isEdgeRuntime(__resolveRouteRuntime(__actionMatch.route))
|
|
760
803
|
: false;
|
|
761
804
|
return __handleServerActionRscRequest({
|
|
762
805
|
actionId,
|
|
@@ -774,6 +817,8 @@ export default createAppRscHandler({
|
|
|
774
817
|
request: actionRequest,
|
|
775
818
|
mountedSlotsHeader: actionMountedSlotsHeader,
|
|
776
819
|
renderMode: actionRenderMode,
|
|
820
|
+
observeMetadataSearchParamsAccess,
|
|
821
|
+
observePageSearchParamsAccess,
|
|
777
822
|
}) {
|
|
778
823
|
return buildPageElements(actionRoute, actionParams, actionCleanPathname, {
|
|
779
824
|
opts: interceptOpts,
|
|
@@ -782,6 +827,8 @@ export default createAppRscHandler({
|
|
|
782
827
|
request: actionRequest,
|
|
783
828
|
mountedSlotsHeader: actionMountedSlotsHeader,
|
|
784
829
|
renderMode: actionRenderMode,
|
|
830
|
+
observeMetadataSearchParamsAccess: observeMetadataSearchParamsAccess === true,
|
|
831
|
+
observePageSearchParamsAccess: observePageSearchParamsAccess === true,
|
|
785
832
|
});
|
|
786
833
|
},
|
|
787
834
|
cleanPathname,
|
|
@@ -807,6 +854,7 @@ export default createAppRscHandler({
|
|
|
807
854
|
},
|
|
808
855
|
createTemporaryReferenceSet,
|
|
809
856
|
decodeReply,
|
|
857
|
+
draftModeSecret: __draftModeSecret,
|
|
810
858
|
findIntercept(pathnameToMatch) {
|
|
811
859
|
return findIntercept(pathnameToMatch, interceptionContext);
|
|
812
860
|
},
|
|
@@ -850,6 +898,8 @@ export default createAppRscHandler({
|
|
|
850
898
|
return {
|
|
851
899
|
interceptionContext,
|
|
852
900
|
interceptLayouts: intercept.interceptLayouts,
|
|
901
|
+
interceptLayoutSegments: intercept.interceptLayoutSegments,
|
|
902
|
+
interceptBranchSegments: intercept.interceptBranchSegments,
|
|
853
903
|
interceptSlotId: intercept.slotId,
|
|
854
904
|
interceptSlotKey: intercept.slotKey,
|
|
855
905
|
interceptSourceMatchedUrl: interceptionContext,
|
|
@@ -860,17 +910,36 @@ export default createAppRscHandler({
|
|
|
860
910
|
},
|
|
861
911
|
});
|
|
862
912
|
},
|
|
913
|
+
` : ""}
|
|
863
914
|
i18nConfig: __i18nConfig,
|
|
864
|
-
isMiddlewareProxy: ${JSON.stringify(middlewarePath ? isProxyFile(middlewarePath) : false)},
|
|
865
915
|
${hasPagesDir ? `loadPrerenderPagesRoutes: __loadPrerenderPagesRoutes,` : ""}
|
|
866
|
-
|
|
916
|
+
${(metadataRoutes?.length ?? 0) > 0 ? `async handleMetadataRouteRequest(cleanPathname) {
|
|
917
|
+
const { handleMetadataRouteRequest: __handleMetadataRouteRequest } =
|
|
918
|
+
await __loadMetadataRouteResponse();
|
|
919
|
+
return __handleMetadataRouteRequest({
|
|
920
|
+
metadataRoutes,
|
|
921
|
+
cleanPathname,
|
|
922
|
+
makeThenableParams,
|
|
923
|
+
});
|
|
924
|
+
},` : ""}
|
|
867
925
|
matchRoute,
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
926
|
+
${middlewarePath ? `runMiddleware({ cleanPathname, context, isDataRequest, request }) {
|
|
927
|
+
return __applyAppMiddleware({
|
|
928
|
+
basePath: __basePath,
|
|
929
|
+
cleanPathname,
|
|
930
|
+
context,
|
|
931
|
+
filePath: ${JSON.stringify(middlewarePath ? normalizePathSeparators(middlewarePath) : "")},
|
|
932
|
+
i18nConfig: __i18nConfig,
|
|
933
|
+
isDataRequest,
|
|
934
|
+
isProxy: ${JSON.stringify(isProxyFile(middlewarePath))},
|
|
935
|
+
module: middlewareModule,
|
|
936
|
+
request,
|
|
937
|
+
trailingSlash: __trailingSlash,
|
|
938
|
+
});
|
|
939
|
+
},` : ""}
|
|
871
940
|
publicFiles: __publicFiles,
|
|
872
941
|
renderNotFound({ isRscRequest, matchedParams, middlewareContext, request, route, scriptNonce }) {
|
|
873
|
-
const __isEdge = route ? __isEdgeRuntime(
|
|
942
|
+
const __isEdge = route ? __isEdgeRuntime(__resolveRouteRuntime(route)) : false;
|
|
874
943
|
return __fallbackRenderer.renderNotFound(route, isRscRequest, request, matchedParams, scriptNonce, middlewareContext, { isEdgeRuntime: __isEdge });
|
|
875
944
|
},
|
|
876
945
|
${hasPagesDir ? `async renderPagesFallback({ allowRscDocumentFallback, appRouteMatch, isDataRequest, isRscRequest, matchKind, middlewareContext, pathname, pagesDataRequest, request, url }) {
|
|
@@ -74,6 +74,7 @@ function registerRouteModules(routes, imports) {
|
|
|
74
74
|
if (slot.pagePath) imports.getLazyLoaderVar(slot.pagePath);
|
|
75
75
|
if (slot.defaultPath) imports.getLazyLoaderVar(slot.defaultPath);
|
|
76
76
|
if (slot.layoutPath) imports.getLazyLoaderVar(slot.layoutPath);
|
|
77
|
+
for (const layoutPath of slot.configLayoutPaths ?? []) imports.getLazyLoaderVar(layoutPath);
|
|
77
78
|
if (slot.loadingPath) imports.getLazyLoaderVar(slot.loadingPath);
|
|
78
79
|
if (slot.errorPath) imports.getLazyLoaderVar(slot.errorPath);
|
|
79
80
|
for (const ir of slot.interceptingRoutes) {
|
|
@@ -112,6 +113,8 @@ function buildRouteEntries(routes, imports) {
|
|
|
112
113
|
slotId: ${JSON.stringify(ir.slotId ?? null)},
|
|
113
114
|
interceptLayouts: ${moduleArray(ir.layoutPaths.length)},
|
|
114
115
|
__loadInterceptLayouts: ${lazyLoaderArray(ir.layoutPaths, imports)},
|
|
116
|
+
interceptLayoutSegments: ${JSON.stringify(ir.layoutSegments ?? [])},
|
|
117
|
+
interceptBranchSegments: ${JSON.stringify(ir.branchSegments ?? [])},
|
|
115
118
|
page: null,
|
|
116
119
|
__pageLoader: ${imports.getLazyLoaderVar(ir.pagePath)},
|
|
117
120
|
params: ${JSON.stringify(ir.params)},
|
|
@@ -124,6 +127,8 @@ function buildRouteEntries(routes, imports) {
|
|
|
124
127
|
sourcePageSegments: ${JSON.stringify(ir.sourcePageSegments)},
|
|
125
128
|
interceptLayouts: ${moduleArray(ir.layoutPaths.length)},
|
|
126
129
|
__loadInterceptLayouts: ${lazyLoaderArray(ir.layoutPaths, imports)},
|
|
130
|
+
interceptLayoutSegments: ${JSON.stringify(ir.layoutSegments ?? [])},
|
|
131
|
+
interceptBranchSegments: ${JSON.stringify(ir.branchSegments ?? [])},
|
|
127
132
|
page: null,
|
|
128
133
|
__pageLoader: ${imports.getLazyLoaderVar(ir.pagePath)},
|
|
129
134
|
params: ${JSON.stringify(ir.params)},
|
|
@@ -137,6 +142,9 @@ function buildRouteEntries(routes, imports) {
|
|
|
137
142
|
__loadDefault: ${slot.defaultPath ? imports.getLazyLoaderVar(slot.defaultPath) : "null"},
|
|
138
143
|
layout: null,
|
|
139
144
|
__loadLayout: ${slot.layoutPath ? imports.getLazyLoaderVar(slot.layoutPath) : "null"},
|
|
145
|
+
configLayouts: ${moduleArray(slot.configLayoutPaths?.length ?? 0)},
|
|
146
|
+
__loadConfigLayouts: ${lazyLoaderArray(slot.configLayoutPaths ?? [], imports)},
|
|
147
|
+
configLayoutTreePositions: ${JSON.stringify(slot.configLayoutTreePositions ?? [])},
|
|
140
148
|
loading: null,
|
|
141
149
|
__loadLoading: ${slot.loadingPath ? imports.getLazyLoaderVar(slot.loadingPath) : "null"},
|
|
142
150
|
error: null,
|
|
@@ -2,6 +2,7 @@ import { normalizePathSeparators } from "../utils/path.js";
|
|
|
2
2
|
import { findFileWithExts } from "../routing/file-matcher.js";
|
|
3
3
|
import { patternToNextFormat } from "../routing/route-validation.js";
|
|
4
4
|
import { apiRouter, pagesRouter } from "../routing/pages-router.js";
|
|
5
|
+
import "./pages-entry-helpers.js";
|
|
5
6
|
//#region src/entries/pages-client-entry.ts
|
|
6
7
|
/**
|
|
7
8
|
* Pages Router client hydration entry generator.
|
|
@@ -3,6 +3,7 @@ import { findFileWithExts } from "../routing/file-matcher.js";
|
|
|
3
3
|
import { apiRouter, pagesRouter } from "../routing/pages-router.js";
|
|
4
4
|
import { resolveEntryPath } from "./runtime-entry-module.js";
|
|
5
5
|
import { isProxyFile } from "../server/middleware.js";
|
|
6
|
+
import "./pages-entry-helpers.js";
|
|
6
7
|
//#region src/entries/pages-server-entry.ts
|
|
7
8
|
/**
|
|
8
9
|
* Pages Router server entry generator.
|