vinext 0.1.0 → 0.1.2
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 +2 -5
- package/dist/build/assets-ignore.d.ts +32 -0
- package/dist/build/assets-ignore.js +48 -0
- package/dist/build/client-build-config.d.ts +33 -1
- package/dist/build/client-build-config.js +66 -1
- package/dist/check.js +4 -3
- package/dist/cli.js +2 -0
- package/dist/client/navigation-runtime.d.ts +11 -2
- package/dist/client/navigation-runtime.js +1 -1
- package/dist/client/vinext-next-data.d.ts +2 -1
- package/dist/client/window-next.d.ts +6 -4
- package/dist/config/config-matchers.d.ts +31 -5
- package/dist/config/config-matchers.js +50 -3
- package/dist/config/next-config.d.ts +29 -3
- package/dist/config/next-config.js +32 -2
- package/dist/deploy.js +47 -304
- package/dist/entries/app-rsc-entry.d.ts +8 -2
- package/dist/entries/app-rsc-entry.js +61 -5
- package/dist/entries/app-rsc-manifest.js +20 -2
- package/dist/entries/pages-client-entry.js +1 -1
- package/dist/entries/pages-server-entry.js +16 -7
- package/dist/index.d.ts +0 -2
- package/dist/index.js +233 -280
- package/dist/plugins/dynamic-preload-metadata.d.ts +13 -0
- package/dist/plugins/dynamic-preload-metadata.js +415 -0
- package/dist/plugins/og-assets.js +2 -2
- package/dist/plugins/optimize-imports.d.ts +8 -4
- package/dist/plugins/optimize-imports.js +16 -12
- package/dist/plugins/postcss.js +18 -14
- package/dist/plugins/require-context.d.ts +6 -0
- package/dist/plugins/require-context.js +184 -0
- package/dist/plugins/sass.d.ts +53 -24
- package/dist/plugins/sass.js +249 -1
- package/dist/plugins/wasm-module-import.d.ts +15 -0
- package/dist/plugins/wasm-module-import.js +50 -0
- package/dist/routing/app-route-graph.d.ts +35 -2
- package/dist/routing/app-route-graph.js +179 -8
- package/dist/routing/file-matcher.js +1 -1
- package/dist/routing/route-pattern.d.ts +2 -1
- package/dist/routing/route-pattern.js +16 -1
- package/dist/server/api-handler.js +4 -0
- package/dist/server/app-browser-entry.js +155 -215
- package/dist/server/app-browser-error.d.ts +4 -1
- package/dist/server/app-browser-error.js +7 -1
- package/dist/server/app-browser-history-controller.d.ts +104 -0
- package/dist/server/app-browser-history-controller.js +210 -0
- package/dist/server/app-browser-interception-context.d.ts +2 -1
- package/dist/server/app-browser-interception-context.js +15 -2
- package/dist/server/app-browser-navigation-controller.d.ts +13 -2
- package/dist/server/app-browser-navigation-controller.js +83 -4
- package/dist/server/app-browser-popstate.d.ts +12 -3
- package/dist/server/app-browser-popstate.js +19 -4
- package/dist/server/app-browser-rsc-redirect.d.ts +11 -2
- package/dist/server/app-browser-rsc-redirect.js +30 -8
- package/dist/server/app-browser-state.d.ts +3 -0
- package/dist/server/app-browser-state.js +10 -10
- package/dist/server/app-browser-visible-commit.js +10 -8
- package/dist/server/app-fallback-renderer.d.ts +2 -1
- package/dist/server/app-fallback-renderer.js +3 -1
- package/dist/server/app-history-state.d.ts +45 -1
- package/dist/server/app-history-state.js +109 -1
- package/dist/server/app-middleware.js +1 -0
- package/dist/server/app-optimistic-routing.js +22 -1
- package/dist/server/app-page-boundary-render.d.ts +2 -1
- package/dist/server/app-page-boundary-render.js +45 -21
- package/dist/server/app-page-cache.js +9 -7
- package/dist/server/app-page-dispatch.d.ts +14 -0
- package/dist/server/app-page-dispatch.js +21 -6
- package/dist/server/app-page-element-builder.d.ts +23 -2
- package/dist/server/app-page-element-builder.js +58 -17
- package/dist/server/app-page-execution.d.ts +1 -1
- package/dist/server/app-page-execution.js +32 -17
- package/dist/server/app-page-render.d.ts +7 -1
- package/dist/server/app-page-render.js +11 -16
- package/dist/server/app-page-request.d.ts +9 -6
- package/dist/server/app-page-request.js +14 -10
- package/dist/server/app-page-response.d.ts +2 -2
- package/dist/server/app-page-response.js +2 -2
- package/dist/server/app-page-route-wiring.d.ts +3 -1
- package/dist/server/app-page-route-wiring.js +10 -8
- package/dist/server/app-page-stream.d.ts +37 -7
- package/dist/server/app-page-stream.js +36 -6
- package/dist/server/app-pages-bridge.d.ts +16 -0
- package/dist/server/app-pages-bridge.js +23 -3
- package/dist/server/app-route-handler-cache.d.ts +1 -0
- package/dist/server/app-route-handler-cache.js +1 -0
- package/dist/server/app-route-handler-dispatch.d.ts +1 -0
- package/dist/server/app-route-handler-dispatch.js +2 -0
- package/dist/server/app-route-handler-execution.d.ts +1 -0
- package/dist/server/app-route-handler-execution.js +1 -0
- package/dist/server/app-route-handler-response.js +11 -10
- package/dist/server/app-route-handler-runtime.d.ts +1 -0
- package/dist/server/app-route-handler-runtime.js +15 -3
- package/dist/server/app-rsc-handler.d.ts +1 -0
- package/dist/server/app-rsc-handler.js +5 -4
- package/dist/server/app-rsc-response-finalizer.js +1 -1
- package/dist/server/app-rsc-route-matching.d.ts +20 -1
- package/dist/server/app-rsc-route-matching.js +29 -4
- package/dist/server/app-server-action-execution.d.ts +22 -1
- package/dist/server/app-server-action-execution.js +73 -12
- package/dist/server/app-ssr-entry.d.ts +6 -0
- package/dist/server/app-ssr-entry.js +19 -3
- package/dist/server/app-ssr-stream.js +9 -1
- package/dist/server/dev-lockfile.js +2 -1
- package/dist/server/dev-server.d.ts +1 -1
- package/dist/server/dev-server.js +97 -43
- package/dist/server/headers.d.ts +8 -1
- package/dist/server/headers.js +8 -1
- package/dist/server/instrumentation-runtime.d.ts +6 -0
- package/dist/server/instrumentation-runtime.js +8 -0
- package/dist/server/isr-cache.d.ts +37 -1
- package/dist/server/isr-cache.js +85 -1
- package/dist/server/isr-decision.d.ts +79 -0
- package/dist/server/isr-decision.js +70 -0
- package/dist/server/metadata-route-response.js +5 -3
- package/dist/server/middleware-runtime.d.ts +13 -0
- package/dist/server/middleware-runtime.js +11 -7
- package/dist/server/middleware.js +1 -0
- package/dist/server/navigation-planner.d.ts +62 -1
- package/dist/server/navigation-planner.js +193 -3
- package/dist/server/navigation-trace.d.ts +12 -2
- package/dist/server/navigation-trace.js +11 -1
- package/dist/server/normalize-path.d.ts +0 -8
- package/dist/server/normalize-path.js +3 -1
- package/dist/server/otel-tracer-extension.d.ts +45 -0
- package/dist/server/otel-tracer-extension.js +89 -0
- package/dist/server/pages-api-route.d.ts +14 -3
- package/dist/server/pages-api-route.js +6 -1
- package/dist/server/pages-asset-tags.d.ts +15 -4
- package/dist/server/pages-asset-tags.js +18 -12
- package/dist/server/pages-data-route.js +5 -1
- package/dist/server/pages-node-compat.d.ts +5 -11
- package/dist/server/pages-node-compat.js +175 -118
- package/dist/server/pages-page-data.d.ts +38 -7
- package/dist/server/pages-page-data.js +64 -18
- package/dist/server/pages-page-handler.d.ts +10 -2
- package/dist/server/pages-page-handler.js +49 -20
- package/dist/server/pages-page-response.d.ts +55 -2
- package/dist/server/pages-page-response.js +74 -6
- package/dist/server/pages-readiness.d.ts +36 -0
- package/dist/server/pages-readiness.js +21 -0
- package/dist/server/pages-request-pipeline.d.ts +113 -0
- package/dist/server/pages-request-pipeline.js +230 -0
- package/dist/server/pages-revalidate.d.ts +15 -0
- package/dist/server/pages-revalidate.js +19 -0
- package/dist/server/prod-server.d.ts +45 -3
- package/dist/server/prod-server.js +182 -234
- package/dist/server/socket-error-backstop.d.ts +19 -1
- package/dist/server/socket-error-backstop.js +77 -4
- package/dist/shims/app-router-scroll.js +22 -4
- package/dist/shims/cache-runtime.js +39 -2
- package/dist/shims/dynamic-preload-chunks.d.ts +8 -0
- package/dist/shims/dynamic-preload-chunks.js +77 -0
- package/dist/shims/dynamic.d.ts +4 -0
- package/dist/shims/dynamic.js +4 -2
- package/dist/shims/error-boundary.d.ts +17 -7
- package/dist/shims/error-boundary.js +8 -1
- package/dist/shims/error.js +37 -11
- package/dist/shims/fetch-cache.d.ts +22 -1
- package/dist/shims/fetch-cache.js +28 -1
- package/dist/shims/hash-scroll.d.ts +1 -0
- package/dist/shims/hash-scroll.js +3 -1
- package/dist/shims/head.js +6 -1
- package/dist/shims/headers.d.ts +16 -2
- package/dist/shims/headers.js +37 -1
- package/dist/shims/image-config.js +7 -1
- package/dist/shims/internal/app-route-detection.d.ts +6 -3
- package/dist/shims/internal/app-route-detection.js +10 -6
- package/dist/shims/internal/app-router-context.d.ts +5 -0
- package/dist/shims/internal/link-status-registry.d.ts +43 -0
- package/dist/shims/internal/link-status-registry.js +42 -0
- package/dist/shims/internal/route-pattern-for-warning.d.ts +27 -0
- package/dist/shims/internal/route-pattern-for-warning.js +40 -0
- package/dist/shims/internal/utils.d.ts +1 -0
- package/dist/shims/link.js +20 -6
- package/dist/shims/metadata.d.ts +6 -2
- package/dist/shims/metadata.js +32 -14
- package/dist/shims/navigation.d.ts +9 -18
- package/dist/shims/navigation.js +96 -23
- package/dist/shims/router-state.d.ts +1 -0
- package/dist/shims/router-state.js +2 -0
- package/dist/shims/router.d.ts +6 -3
- package/dist/shims/router.js +156 -22
- package/dist/shims/script-nonce-context.d.ts +1 -1
- package/dist/shims/script-nonce-context.js +11 -3
- package/dist/shims/server.d.ts +17 -1
- package/dist/shims/server.js +31 -6
- package/dist/shims/slot.js +1 -1
- package/dist/shims/unified-request-context.js +1 -0
- package/dist/typegen.js +1 -0
- package/dist/utils/client-build-manifest.d.ts +8 -1
- package/dist/utils/client-build-manifest.js +41 -6
- package/dist/utils/client-entry-manifest.d.ts +11 -0
- package/dist/utils/client-entry-manifest.js +29 -0
- package/dist/utils/client-runtime-metadata.d.ts +45 -0
- package/dist/utils/client-runtime-metadata.js +63 -0
- package/dist/utils/hash.d.ts +17 -1
- package/dist/utils/hash.js +36 -1
- package/dist/utils/lazy-chunks.d.ts +27 -1
- package/dist/utils/lazy-chunks.js +65 -1
- package/dist/utils/manifest-paths.d.ts +20 -2
- package/dist/utils/manifest-paths.js +38 -3
- package/dist/utils/path.d.ts +2 -1
- package/dist/utils/path.js +5 -1
- package/package.json +6 -2
|
@@ -15,6 +15,7 @@ import { randomUUID } from "node:crypto";
|
|
|
15
15
|
* Previously housed in server/app-dev-server.ts.
|
|
16
16
|
*/
|
|
17
17
|
const DEFAULT_EXPIRE_TIME = 31536e3;
|
|
18
|
+
const DEFAULT_REACT_MAX_HEADERS_LENGTH = 6e3;
|
|
18
19
|
const middlewareRequestHeadersPath = resolveEntryPath("../server/middleware-request-headers.js", import.meta.url);
|
|
19
20
|
const normalizePathModulePath = resolveEntryPath("../server/normalize-path.js", import.meta.url);
|
|
20
21
|
const appRscHandlerPath = resolveEntryPath("../server/app-rsc-handler.js", import.meta.url);
|
|
@@ -63,10 +64,12 @@ function generateRscEntry(appDir, routes, middlewarePath, metadataRoutes, global
|
|
|
63
64
|
const headers = config?.headers ?? [];
|
|
64
65
|
const allowedOrigins = config?.allowedOrigins ?? [];
|
|
65
66
|
const bodySizeLimit = config?.bodySizeLimit ?? 1 * 1024 * 1024;
|
|
67
|
+
const bodySizeLimitLabel = config?.bodySizeLimitLabel ?? "1 MB";
|
|
66
68
|
const htmlLimitedBots = config?.htmlLimitedBots;
|
|
67
69
|
const clientTraceMetadata = config?.clientTraceMetadata;
|
|
68
70
|
const assetPrefix = config?.assetPrefix ?? "";
|
|
69
71
|
const expireTime = config?.expireTime ?? DEFAULT_EXPIRE_TIME;
|
|
72
|
+
const reactMaxHeadersLength = config?.reactMaxHeadersLength ?? DEFAULT_REACT_MAX_HEADERS_LENGTH;
|
|
70
73
|
const cacheMaxMemorySize = config?.cacheMaxMemorySize;
|
|
71
74
|
const inlineCss = config?.inlineCss === true;
|
|
72
75
|
const i18nConfig = config?.i18n ?? null;
|
|
@@ -119,6 +122,7 @@ import {
|
|
|
119
122
|
import {
|
|
120
123
|
handleProgressiveServerActionRequest as __handleProgressiveServerActionRequest,
|
|
121
124
|
handleServerActionRscRequest as __handleServerActionRscRequest,
|
|
125
|
+
isProgressiveServerActionRequest as __isProgressiveServerActionRequest,
|
|
122
126
|
readActionBodyWithLimit as __readBodyWithLimit,
|
|
123
127
|
readActionFormDataWithLimit as __readFormDataWithLimit,
|
|
124
128
|
} from ${JSON.stringify(appServerActionExecutionPath)};
|
|
@@ -271,6 +275,10 @@ ${metaRouteEntries.join(",\n")}
|
|
|
271
275
|
// recognising /_next/static/* paths (parity with __assetPrefix below).
|
|
272
276
|
export const __basePath = ${JSON.stringify(bp)};
|
|
273
277
|
|
|
278
|
+
// Hoisted alongside __basePath so __fallbackRenderer / buildPageElements can
|
|
279
|
+
// thread the configured trailingSlash flag through canonical URL rendering.
|
|
280
|
+
const __trailingSlash = ${JSON.stringify(ts)};
|
|
281
|
+
|
|
274
282
|
const rootNotFoundModule = ${rootNotFoundVar ? rootNotFoundVar : "null"};
|
|
275
283
|
const rootForbiddenModule = ${rootForbiddenVar ? rootForbiddenVar : "null"};
|
|
276
284
|
const rootUnauthorizedModule = ${rootUnauthorizedVar ? rootUnauthorizedVar : "null"};
|
|
@@ -294,6 +302,7 @@ const createRscOnErrorHandler = (request, pathname, routePath) =>
|
|
|
294
302
|
|
|
295
303
|
const __fallbackRenderer = __createAppFallbackRenderer({
|
|
296
304
|
basePath: __basePath,
|
|
305
|
+
trailingSlash: __trailingSlash,
|
|
297
306
|
rootBoundaries: {
|
|
298
307
|
rootForbiddenModule,
|
|
299
308
|
rootLayouts,
|
|
@@ -337,13 +346,14 @@ function findIntercept(pathname, sourcePathname = null) {
|
|
|
337
346
|
return __routeMatcher.findIntercept(pathname, sourcePathname);
|
|
338
347
|
}
|
|
339
348
|
|
|
340
|
-
async function buildPageElements(route, params, routePath, pageRequest, layoutParamAccess) {
|
|
349
|
+
async function buildPageElements(route, params, routePath, pageRequest, layoutParamAccess, displayPathname = routePath) {
|
|
341
350
|
// Hydrate lazy page/route-handler modules before any synchronous read.
|
|
342
351
|
await __ensureRouteLoaded(route);
|
|
343
352
|
return __buildPageElements({
|
|
344
353
|
route,
|
|
345
354
|
params,
|
|
346
355
|
routePath,
|
|
356
|
+
displayPathname,
|
|
347
357
|
pageRequest,
|
|
348
358
|
globalErrorModule: ${globalErrorVar ? globalErrorVar : "null"},
|
|
349
359
|
rootNotFoundModule: ${rootNotFoundVar ? rootNotFoundVar : "null"},
|
|
@@ -352,11 +362,11 @@ async function buildPageElements(route, params, routePath, pageRequest, layoutPa
|
|
|
352
362
|
metadataRoutes,
|
|
353
363
|
layoutParamAccess,
|
|
354
364
|
basePath: __basePath,
|
|
365
|
+
trailingSlash: __trailingSlash,
|
|
355
366
|
htmlLimitedBots: __htmlLimitedBots,
|
|
356
367
|
});
|
|
357
368
|
}
|
|
358
369
|
|
|
359
|
-
const __trailingSlash = ${JSON.stringify(ts)};
|
|
360
370
|
const __i18nConfig = ${JSON.stringify(i18nConfig)};
|
|
361
371
|
const __configRedirects = ${JSON.stringify(redirects)};
|
|
362
372
|
const __configRewrites = ${JSON.stringify(rewrites)};
|
|
@@ -366,11 +376,13 @@ const __allowedOrigins = ${JSON.stringify(allowedOrigins)};
|
|
|
366
376
|
const __expireTime = ${JSON.stringify(expireTime)};
|
|
367
377
|
const __htmlLimitedBots = ${JSON.stringify(htmlLimitedBots)};
|
|
368
378
|
const __clientTraceMetadata = ${JSON.stringify(clientTraceMetadata)};
|
|
379
|
+
const __reactMaxHeadersLength = ${JSON.stringify(reactMaxHeadersLength)};
|
|
369
380
|
// Re-exported for the App Router prod-server to consume at startup —
|
|
370
381
|
// mirrors the embedded \`__basePath\` pattern (and Pages Router's
|
|
371
382
|
// \`vinextConfig\` export). Empty string when unset.
|
|
372
383
|
export const __assetPrefix = ${JSON.stringify(assetPrefix)};
|
|
373
384
|
export const __inlineCss = ${JSON.stringify(inlineCss)};
|
|
385
|
+
export const __hasPagesDir = ${JSON.stringify(hasPagesDir)};
|
|
374
386
|
|
|
375
387
|
export function seedMemoryCacheFromPrerender(serverDir) {
|
|
376
388
|
return __seedMemoryCacheFromPrerender(serverDir, {
|
|
@@ -397,6 +409,13 @@ ${generateDevOriginCheckCode(config?.allowedDevOrigins)}
|
|
|
397
409
|
*/
|
|
398
410
|
var __MAX_ACTION_BODY_SIZE = ${JSON.stringify(bodySizeLimit)};
|
|
399
411
|
|
|
412
|
+
/**
|
|
413
|
+
* Verbatim serverActions.bodySizeLimit config value (e.g. "2mb"), used in the
|
|
414
|
+
* "Body exceeded {limit} limit" error so the message matches Next.js byte-for-byte.
|
|
415
|
+
* Defaults to "1 MB" (Next.js' defaultBodySizeLimit literal).
|
|
416
|
+
*/
|
|
417
|
+
var __MAX_ACTION_BODY_SIZE_LABEL = ${JSON.stringify(bodySizeLimitLabel)};
|
|
418
|
+
|
|
400
419
|
// Map from route pattern to generateStaticParams function.
|
|
401
420
|
// Used by the prerender phase to enumerate dynamic route URLs without
|
|
402
421
|
// loading route modules via the dev server.
|
|
@@ -421,6 +440,7 @@ export default __createAppRscHandler({
|
|
|
421
440
|
dispatchMatchedPage({
|
|
422
441
|
clientReuseManifest,
|
|
423
442
|
cleanPathname,
|
|
443
|
+
displayPathname,
|
|
424
444
|
formState,
|
|
425
445
|
actionError,
|
|
426
446
|
actionFailed,
|
|
@@ -456,6 +476,7 @@ export default __createAppRscHandler({
|
|
|
456
476
|
basePath: __basePath,
|
|
457
477
|
ensureRouteLoaded: __ensureRouteLoaded,
|
|
458
478
|
clientTraceMetadata: __clientTraceMetadata,
|
|
479
|
+
reactMaxHeadersLength: __reactMaxHeadersLength,
|
|
459
480
|
buildPageElement(targetRoute, targetParams, targetOpts, targetSearchParams, layoutParamAccess) {
|
|
460
481
|
return buildPageElements(targetRoute, targetParams, cleanPathname, {
|
|
461
482
|
opts: targetOpts,
|
|
@@ -464,10 +485,11 @@ export default __createAppRscHandler({
|
|
|
464
485
|
request,
|
|
465
486
|
mountedSlotsHeader,
|
|
466
487
|
renderMode,
|
|
467
|
-
}, layoutParamAccess);
|
|
488
|
+
}, layoutParamAccess, displayPathname);
|
|
468
489
|
},
|
|
469
490
|
clientReuseManifest,
|
|
470
491
|
cleanPathname,
|
|
492
|
+
displayPathname,
|
|
471
493
|
clearRequestContext() {
|
|
472
494
|
__clearRequestContext();
|
|
473
495
|
},
|
|
@@ -527,13 +549,23 @@ export default __createAppRscHandler({
|
|
|
527
549
|
route,
|
|
528
550
|
});
|
|
529
551
|
},
|
|
530
|
-
probePage() {
|
|
552
|
+
async probePage() {
|
|
553
|
+
const __probeIntercept = findIntercept(cleanPathname, interceptionContext);
|
|
554
|
+
// The intercepting-route page module is lazy (page: null + __pageLoader).
|
|
555
|
+
// Resolve it before probing so buildAppPageProbes inspects the real page
|
|
556
|
+
// component for dynamic bailout — matching the render path, which also
|
|
557
|
+
// awaits __pageLoader (resolveAppPageInterceptState). Without this the
|
|
558
|
+
// intercept probe branch silently inspects an undefined component and
|
|
559
|
+
// never observes the page's searchParams/headers access.
|
|
560
|
+
if (__probeIntercept && __probeIntercept.__pageLoader && __probeIntercept.page == null) {
|
|
561
|
+
__probeIntercept.page = await __probeIntercept.__pageLoader();
|
|
562
|
+
}
|
|
531
563
|
return Promise.all(__buildAppPageProbes({
|
|
532
564
|
route,
|
|
533
565
|
pageComponent: PageComponent,
|
|
534
566
|
asyncRouteParams: _asyncRouteParams,
|
|
535
567
|
searchParams,
|
|
536
|
-
intercept:
|
|
568
|
+
intercept: __probeIntercept,
|
|
537
569
|
isRscRequest,
|
|
538
570
|
matchedParams: params,
|
|
539
571
|
makeThenableParams,
|
|
@@ -583,6 +615,7 @@ export default __createAppRscHandler({
|
|
|
583
615
|
},
|
|
584
616
|
draftModeSecret: __draftModeSecret,
|
|
585
617
|
i18n: __i18nConfig,
|
|
618
|
+
trailingSlash: __trailingSlash,
|
|
586
619
|
isrDebug: __isrDebug,
|
|
587
620
|
isrGet: __isrGet,
|
|
588
621
|
isrRouteKey: __isrRouteKey,
|
|
@@ -610,6 +643,26 @@ export default __createAppRscHandler({
|
|
|
610
643
|
middlewareContext,
|
|
611
644
|
request,
|
|
612
645
|
}) {
|
|
646
|
+
// A multipart form POST to a page is always a server-action attempt, so a
|
|
647
|
+
// body that decodes to no action must surface as 404 action-not-found
|
|
648
|
+
// (#1340). Route handlers run after this dispatch and accept raw multipart
|
|
649
|
+
// POSTs, so only flag actual page routes. The __loadPage / __loadRouteHandler
|
|
650
|
+
// markers are static and available before lazy module hydration.
|
|
651
|
+
//
|
|
652
|
+
// Only the progressive (multipart, no actionId) POST path consults
|
|
653
|
+
// hasPageRoute, so skip the route match entirely for every other request
|
|
654
|
+
// rather than re-matching on each App Router request.
|
|
655
|
+
const __isProgressiveAction = __isProgressiveServerActionRequest(
|
|
656
|
+
request,
|
|
657
|
+
contentType,
|
|
658
|
+
actionId,
|
|
659
|
+
);
|
|
660
|
+
const __progressiveActionMatch = __isProgressiveAction ? matchRoute(cleanPathname) : null;
|
|
661
|
+
const __hasPageRoute = Boolean(
|
|
662
|
+
__progressiveActionMatch &&
|
|
663
|
+
__progressiveActionMatch.route.__loadPage &&
|
|
664
|
+
!__progressiveActionMatch.route.__loadRouteHandler,
|
|
665
|
+
);
|
|
613
666
|
return __handleProgressiveServerActionRequest({
|
|
614
667
|
actionId,
|
|
615
668
|
allowedOrigins: __allowedOrigins,
|
|
@@ -623,6 +676,7 @@ export default __createAppRscHandler({
|
|
|
623
676
|
decodeFormState,
|
|
624
677
|
getAndClearPendingCookies,
|
|
625
678
|
getDraftModeCookieHeader,
|
|
679
|
+
hasPageRoute: __hasPageRoute,
|
|
626
680
|
maxActionBodySize: __MAX_ACTION_BODY_SIZE,
|
|
627
681
|
middlewareHeaders: middlewareContext.headers,
|
|
628
682
|
readFormDataWithLimit: __readFormDataWithLimit,
|
|
@@ -713,6 +767,7 @@ export default __createAppRscHandler({
|
|
|
713
767
|
return matchRoute(pathnameToMatch);
|
|
714
768
|
},
|
|
715
769
|
maxActionBodySize: __MAX_ACTION_BODY_SIZE,
|
|
770
|
+
maxActionBodySizeLabel: __MAX_ACTION_BODY_SIZE_LABEL,
|
|
716
771
|
middlewareHeaders: middlewareContext.headers,
|
|
717
772
|
middlewareStatus: middlewareContext.status,
|
|
718
773
|
mountedSlotsHeader,
|
|
@@ -763,6 +818,7 @@ export default __createAppRscHandler({
|
|
|
763
818
|
buildRequestHeaders: __buildRequestHeadersFromMiddlewareResponse,
|
|
764
819
|
decodePathParams: __decodePathParams,
|
|
765
820
|
applyRouteHandlerMiddlewareContext: __applyRouteHandlerMiddlewareContext,
|
|
821
|
+
getDraftModeCookieHeader,
|
|
766
822
|
}
|
|
767
823
|
);
|
|
768
824
|
},` : ""}
|
|
@@ -77,10 +77,14 @@ function registerRouteModules(routes, imports) {
|
|
|
77
77
|
if (slot.loadingPath) imports.getImportVar(slot.loadingPath);
|
|
78
78
|
if (slot.errorPath) imports.getImportVar(slot.errorPath);
|
|
79
79
|
for (const ir of slot.interceptingRoutes) {
|
|
80
|
-
imports.
|
|
80
|
+
imports.getLazyLoaderVar(ir.pagePath);
|
|
81
81
|
for (const layoutPath of ir.layoutPaths) imports.getImportVar(layoutPath);
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
+
for (const ir of route.siblingIntercepts ?? []) {
|
|
85
|
+
imports.getLazyLoaderVar(ir.pagePath);
|
|
86
|
+
for (const layoutPath of ir.layoutPaths) imports.getImportVar(layoutPath);
|
|
87
|
+
}
|
|
84
88
|
}
|
|
85
89
|
}
|
|
86
90
|
function buildRouteEntries(routes, imports) {
|
|
@@ -91,13 +95,24 @@ function buildRouteEntries(routes, imports) {
|
|
|
91
95
|
const notFoundVars = (route.notFoundPaths ?? []).map((nf) => nf ? imports.getImportVar(nf) : "null");
|
|
92
96
|
const forbiddenVars = (route.forbiddenPaths ?? []).map((fp) => fp ? imports.getImportVar(fp) : "null");
|
|
93
97
|
const unauthorizedVars = (route.unauthorizedPaths ?? []).map((up) => up ? imports.getImportVar(up) : "null");
|
|
98
|
+
const siblingInterceptEntries = (route.siblingIntercepts ?? []).map((ir) => ` {
|
|
99
|
+
convention: ${JSON.stringify(ir.convention)},
|
|
100
|
+
targetPattern: ${JSON.stringify(ir.targetPattern)},
|
|
101
|
+
sourceMatchPattern: ${JSON.stringify(ir.sourceMatchPattern)},
|
|
102
|
+
slotId: ${JSON.stringify(ir.slotId ?? null)},
|
|
103
|
+
interceptLayouts: [${ir.layoutPaths.map((l) => imports.getImportVar(l)).join(", ")}],
|
|
104
|
+
page: null,
|
|
105
|
+
__pageLoader: ${imports.getLazyLoaderVar(ir.pagePath)},
|
|
106
|
+
params: ${JSON.stringify(ir.params)},
|
|
107
|
+
}`);
|
|
94
108
|
const slotEntries = route.parallelSlots.map((slot) => {
|
|
95
109
|
const interceptEntries = slot.interceptingRoutes.map((ir) => ` {
|
|
96
110
|
convention: ${JSON.stringify(ir.convention)},
|
|
97
111
|
targetPattern: ${JSON.stringify(ir.targetPattern)},
|
|
98
112
|
sourceMatchPattern: ${JSON.stringify(ir.sourceMatchPattern)},
|
|
99
113
|
interceptLayouts: [${ir.layoutPaths.map((layoutPath) => imports.getImportVar(layoutPath)).join(", ")}],
|
|
100
|
-
page:
|
|
114
|
+
page: null,
|
|
115
|
+
__pageLoader: ${imports.getLazyLoaderVar(ir.pagePath)},
|
|
101
116
|
params: ${JSON.stringify(ir.params)},
|
|
102
117
|
}`);
|
|
103
118
|
return ` ${JSON.stringify(slot.key)}: {
|
|
@@ -146,6 +161,9 @@ ${interceptEntries.join(",\n")}
|
|
|
146
161
|
slots: {
|
|
147
162
|
${slotEntries.join(",\n")}
|
|
148
163
|
},
|
|
164
|
+
siblingIntercepts: [
|
|
165
|
+
${siblingInterceptEntries.join(",\n")}
|
|
166
|
+
],
|
|
149
167
|
loading: ${route.loadingPath ? imports.getImportVar(route.loadingPath) : "null"},
|
|
150
168
|
error: ${route.errorPath ? imports.getImportVar(route.errorPath) : "null"},
|
|
151
169
|
notFound: ${route.notFoundPath ? imports.getImportVar(route.notFoundPath) : "null"},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { normalizePathSeparators } from "../utils/path.js";
|
|
1
2
|
import { findFileWithExts } from "../routing/file-matcher.js";
|
|
2
3
|
import { patternToNextFormat } from "../routing/route-validation.js";
|
|
3
4
|
import { pagesRouter } from "../routing/pages-router.js";
|
|
4
|
-
import { normalizePathSeparators } from "../utils/path.js";
|
|
5
5
|
//#region src/entries/pages-client-entry.ts
|
|
6
6
|
/**
|
|
7
7
|
* Pages Router client hydration entry generator.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { normalizePathSeparators } from "../utils/path.js";
|
|
1
2
|
import { findFileWithExts } from "../routing/file-matcher.js";
|
|
2
3
|
import { apiRouter, pagesRouter } from "../routing/pages-router.js";
|
|
3
|
-
import { normalizePathSeparators } from "../utils/path.js";
|
|
4
4
|
import { resolveEntryPath } from "./runtime-entry-module.js";
|
|
5
5
|
import { isProxyFile } from "../server/middleware.js";
|
|
6
6
|
//#region src/entries/pages-server-entry.ts
|
|
@@ -46,11 +46,11 @@ async function generateServerEntry(pagesDir, nextConfig, fileMatcher, middleware
|
|
|
46
46
|
const appFilePath = findFileWithExts(pagesDir, "_app", fileMatcher);
|
|
47
47
|
const docFilePath = findFileWithExts(pagesDir, "_document", fileMatcher);
|
|
48
48
|
const errorFilePath = findFileWithExts(pagesDir, "_error", fileMatcher);
|
|
49
|
-
const appAssetPathJson = appFilePath !== null ? JSON.stringify(
|
|
50
|
-
const appImportCode = appFilePath !== null ? `import { default as AppComponent } from ${JSON.stringify(
|
|
51
|
-
const docImportCode = docFilePath !== null ? `import { default as DocumentComponent } from ${JSON.stringify(
|
|
52
|
-
const errorAssetPathJson = errorFilePath !== null ? JSON.stringify(
|
|
53
|
-
const errorImportCode = errorFilePath !== null ? `import * as ErrorPageModule from ${JSON.stringify(
|
|
49
|
+
const appAssetPathJson = appFilePath !== null ? JSON.stringify(appFilePath) : "null";
|
|
50
|
+
const appImportCode = appFilePath !== null ? `import { default as AppComponent } from ${JSON.stringify(appFilePath)};` : `const AppComponent = null;`;
|
|
51
|
+
const docImportCode = docFilePath !== null ? `import { default as DocumentComponent } from ${JSON.stringify(docFilePath)};` : `const DocumentComponent = null;`;
|
|
52
|
+
const errorAssetPathJson = errorFilePath !== null ? JSON.stringify(errorFilePath) : "null";
|
|
53
|
+
const errorImportCode = errorFilePath !== null ? `import * as ErrorPageModule from ${JSON.stringify(errorFilePath)};` : `const ErrorPageModule = null;`;
|
|
54
54
|
const i18nConfigJson = nextConfig?.i18n ? JSON.stringify({
|
|
55
55
|
locales: nextConfig.i18n.locales,
|
|
56
56
|
defaultLocale: nextConfig.i18n.defaultLocale,
|
|
@@ -143,7 +143,7 @@ import React from "react";
|
|
|
143
143
|
import { renderToReadableStream } from "react-dom/server.edge";
|
|
144
144
|
import { resetSSRHead, getSSRHeadHTML, setDocumentInitialHead } from "next/head";
|
|
145
145
|
import { flushPreloads } from "next/dynamic";
|
|
146
|
-
import { setSSRContext, wrapWithRouterContext } from "next/router";
|
|
146
|
+
import { setSSRContext, wrapWithRouterContext, getPagesNavigationIsReadyFromSerializedState } from "next/router";
|
|
147
147
|
import { _runWithCacheState, configureMemoryCacheHandler as __configureMemoryCacheHandler } from "next/cache";
|
|
148
148
|
import { registerConfiguredCacheAdapters as __registerConfiguredCacheAdapters } from "virtual:vinext-cache-adapters";
|
|
149
149
|
import { runWithPrivateCache } from "vinext/cache-runtime";
|
|
@@ -279,6 +279,7 @@ const _renderPage = __createPagesPageHandler({
|
|
|
279
279
|
i18nConfig,
|
|
280
280
|
vinextConfig: {
|
|
281
281
|
basePath: vinextConfig.basePath,
|
|
282
|
+
assetPrefix: vinextConfig.assetPrefix,
|
|
282
283
|
trailingSlash: vinextConfig.trailingSlash,
|
|
283
284
|
expireTime: vinextConfig.expireTime,
|
|
284
285
|
clientTraceMetadata: vinextConfig.clientTraceMetadata,
|
|
@@ -287,9 +288,17 @@ const _renderPage = __createPagesPageHandler({
|
|
|
287
288
|
buildId,
|
|
288
289
|
hasMiddleware: __hasMiddleware,
|
|
289
290
|
appAssetPath: _appAssetPath,
|
|
291
|
+
hasRewrites:
|
|
292
|
+
vinextConfig.rewrites.beforeFiles.length > 0 ||
|
|
293
|
+
vinextConfig.rewrites.afterFiles.length > 0 ||
|
|
294
|
+
vinextConfig.rewrites.fallback.length > 0,
|
|
290
295
|
|
|
291
296
|
// next/*-derived closures
|
|
292
297
|
setSSRContext: typeof setSSRContext === "function" ? setSSRContext : null,
|
|
298
|
+
getPagesNavigationIsReadyFromSerializedState:
|
|
299
|
+
typeof getPagesNavigationIsReadyFromSerializedState === "function"
|
|
300
|
+
? getPagesNavigationIsReadyFromSerializedState
|
|
301
|
+
: null,
|
|
293
302
|
setI18nContext: typeof setI18nContext === "function" ? setI18nContext : null,
|
|
294
303
|
wrapWithRouterContext: typeof wrapWithRouterContext === "function" ? wrapWithRouterContext : null,
|
|
295
304
|
resetSSRHead: typeof resetSSRHead === "function" ? resetSSRHead : undefined,
|
package/dist/index.d.ts
CHANGED
|
@@ -88,12 +88,10 @@ type VinextOptions = {
|
|
|
88
88
|
* need a binding — e.g. a KV namespace — can read it.
|
|
89
89
|
*
|
|
90
90
|
* @example
|
|
91
|
-
* import { cdnAdapter } from "@vinext/cloudflare/cache/cdn-adapter";
|
|
92
91
|
* import { kvDataAdapter } from "@vinext/cloudflare/cache/kv-data-adapter";
|
|
93
92
|
*
|
|
94
93
|
* vinext({
|
|
95
94
|
* cache: {
|
|
96
|
-
* cdn: cdnAdapter(),
|
|
97
95
|
* data: kvDataAdapter({ binding: "MY_KV" }),
|
|
98
96
|
* },
|
|
99
97
|
* })
|