added fonts
This commit is contained in:
1 parent
4134e3a234
commit
142d2986b6
9079 files changed
+1498421
-2
No files matched your search
+46
@@ -0,0 +1,46 @@
|
||||
/**
|
||||
* Parse the app segment config.
|
||||
* @param data - The data to parse.
|
||||
* @param route - The route of the app.
|
||||
* @returns The parsed app segment config.
|
||||
*/
|
||||
export declare function parseAppSegmentConfig(data: unknown, route: string): AppSegmentConfig;
|
||||
/**
|
||||
* The configuration for a page.
|
||||
*/
|
||||
export type AppSegmentConfig = {
|
||||
/**
|
||||
* The revalidation period for the page in seconds, or false to disable ISR.
|
||||
*/
|
||||
revalidate?: number | false;
|
||||
/**
|
||||
* Whether the page supports dynamic parameters.
|
||||
*/
|
||||
dynamicParams?: boolean;
|
||||
/**
|
||||
* The dynamic behavior of the page.
|
||||
*/
|
||||
dynamic?: 'auto' | 'error' | 'force-static' | 'force-dynamic';
|
||||
/**
|
||||
* The caching behavior of the page.
|
||||
*/
|
||||
fetchCache?: 'auto' | 'default-cache' | 'default-no-store' | 'force-cache' | 'force-no-store' | 'only-cache' | 'only-no-store';
|
||||
/**
|
||||
* The preferred region for the page.
|
||||
*/
|
||||
preferredRegion?: string | string[];
|
||||
/**
|
||||
* Whether the page supports partial prerendering. When true, the page will be
|
||||
* served using partial prerendering. This setting will only take affect if
|
||||
* it's enabled via the `experimental.ppr = "incremental"` option.
|
||||
*/
|
||||
experimental_ppr?: boolean;
|
||||
/**
|
||||
* The runtime to use for the page.
|
||||
*/
|
||||
runtime?: 'edge' | 'nodejs';
|
||||
/**
|
||||
* The maximum duration for the page in seconds.
|
||||
*/
|
||||
maxDuration?: number;
|
||||
};
|
||||
+97
@@ -0,0 +1,97 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
AppSegmentConfigSchemaKeys: null,
|
||||
parseAppSegmentConfig: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
AppSegmentConfigSchemaKeys: function() {
|
||||
return AppSegmentConfigSchemaKeys;
|
||||
},
|
||||
parseAppSegmentConfig: function() {
|
||||
return parseAppSegmentConfig;
|
||||
}
|
||||
});
|
||||
const _zod = require("next/dist/compiled/zod");
|
||||
const _zod1 = require("../../../shared/lib/zod");
|
||||
/**
|
||||
* The schema for configuration for a page.
|
||||
*/ const AppSegmentConfigSchema = _zod.z.object({
|
||||
/**
|
||||
* The number of seconds to revalidate the page or false to disable revalidation.
|
||||
*/ revalidate: _zod.z.union([
|
||||
_zod.z.number().int().nonnegative(),
|
||||
_zod.z.literal(false)
|
||||
]).optional(),
|
||||
/**
|
||||
* Whether the page supports dynamic parameters.
|
||||
*/ dynamicParams: _zod.z.boolean().optional(),
|
||||
/**
|
||||
* The dynamic behavior of the page.
|
||||
*/ dynamic: _zod.z.enum([
|
||||
'auto',
|
||||
'error',
|
||||
'force-static',
|
||||
'force-dynamic'
|
||||
]).optional(),
|
||||
/**
|
||||
* The caching behavior of the page.
|
||||
*/ fetchCache: _zod.z.enum([
|
||||
'auto',
|
||||
'default-cache',
|
||||
'only-cache',
|
||||
'force-cache',
|
||||
'force-no-store',
|
||||
'default-no-store',
|
||||
'only-no-store'
|
||||
]).optional(),
|
||||
/**
|
||||
* The preferred region for the page.
|
||||
*/ preferredRegion: _zod.z.union([
|
||||
_zod.z.string(),
|
||||
_zod.z.array(_zod.z.string())
|
||||
]).optional(),
|
||||
/**
|
||||
* Whether the page supports partial prerendering. When true, the page will be
|
||||
* served using partial prerendering. This setting will only take affect if
|
||||
* it's enabled via the `experimental.ppr = "incremental"` option.
|
||||
*/ experimental_ppr: _zod.z.boolean().optional(),
|
||||
/**
|
||||
* The runtime to use for the page.
|
||||
*/ runtime: _zod.z.enum([
|
||||
'edge',
|
||||
'nodejs'
|
||||
]).optional(),
|
||||
/**
|
||||
* The maximum duration for the page in seconds.
|
||||
*/ maxDuration: _zod.z.number().int().nonnegative().optional()
|
||||
});
|
||||
function parseAppSegmentConfig(data, route) {
|
||||
const parsed = AppSegmentConfigSchema.safeParse(data, {
|
||||
errorMap: (issue, ctx)=>{
|
||||
if (issue.path.length === 1 && issue.path[0] === 'revalidate') {
|
||||
return {
|
||||
message: `Invalid revalidate value ${JSON.stringify(ctx.data)} on "${route}", must be a non-negative number or false`
|
||||
};
|
||||
}
|
||||
return {
|
||||
message: ctx.defaultError
|
||||
};
|
||||
}
|
||||
});
|
||||
if (!parsed.success) {
|
||||
throw (0, _zod1.formatZodError)(`Invalid segment configuration options detected for "${route}". Read more at https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config`, parsed.error);
|
||||
}
|
||||
return parsed.data;
|
||||
}
|
||||
const AppSegmentConfigSchemaKeys = AppSegmentConfigSchema.keyof().options;
|
||||
|
||||
//# sourceMappingURL=app-segment-config.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/build/segment-config/app/app-segment-config.ts"],"sourcesContent":["import { z } from 'next/dist/compiled/zod'\nimport { formatZodError } from '../../../shared/lib/zod'\n\n/**\n * The schema for configuration for a page.\n */\nconst AppSegmentConfigSchema = z.object({\n /**\n * The number of seconds to revalidate the page or false to disable revalidation.\n */\n revalidate: z\n .union([z.number().int().nonnegative(), z.literal(false)])\n .optional(),\n\n /**\n * Whether the page supports dynamic parameters.\n */\n dynamicParams: z.boolean().optional(),\n\n /**\n * The dynamic behavior of the page.\n */\n dynamic: z\n .enum(['auto', 'error', 'force-static', 'force-dynamic'])\n .optional(),\n\n /**\n * The caching behavior of the page.\n */\n fetchCache: z\n .enum([\n 'auto',\n 'default-cache',\n 'only-cache',\n 'force-cache',\n 'force-no-store',\n 'default-no-store',\n 'only-no-store',\n ])\n .optional(),\n\n /**\n * The preferred region for the page.\n */\n preferredRegion: z.union([z.string(), z.array(z.string())]).optional(),\n\n /**\n * Whether the page supports partial prerendering. When true, the page will be\n * served using partial prerendering. This setting will only take affect if\n * it's enabled via the `experimental.ppr = \"incremental\"` option.\n */\n experimental_ppr: z.boolean().optional(),\n\n /**\n * The runtime to use for the page.\n */\n runtime: z.enum(['edge', 'nodejs']).optional(),\n\n /**\n * The maximum duration for the page in seconds.\n */\n maxDuration: z.number().int().nonnegative().optional(),\n})\n\n/**\n * Parse the app segment config.\n * @param data - The data to parse.\n * @param route - The route of the app.\n * @returns The parsed app segment config.\n */\nexport function parseAppSegmentConfig(\n data: unknown,\n route: string\n): AppSegmentConfig {\n const parsed = AppSegmentConfigSchema.safeParse(data, {\n errorMap: (issue, ctx) => {\n if (issue.path.length === 1 && issue.path[0] === 'revalidate') {\n return {\n message: `Invalid revalidate value ${JSON.stringify(\n ctx.data\n )} on \"${route}\", must be a non-negative number or false`,\n }\n }\n\n return { message: ctx.defaultError }\n },\n })\n\n if (!parsed.success) {\n throw formatZodError(\n `Invalid segment configuration options detected for \"${route}\". Read more at https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config`,\n parsed.error\n )\n }\n\n return parsed.data\n}\n\n/**\n * The configuration for a page.\n */\nexport type AppSegmentConfig = {\n /**\n * The revalidation period for the page in seconds, or false to disable ISR.\n */\n revalidate?: number | false\n\n /**\n * Whether the page supports dynamic parameters.\n */\n dynamicParams?: boolean\n\n /**\n * The dynamic behavior of the page.\n */\n dynamic?: 'auto' | 'error' | 'force-static' | 'force-dynamic'\n\n /**\n * The caching behavior of the page.\n */\n fetchCache?:\n | 'auto'\n | 'default-cache'\n | 'default-no-store'\n | 'force-cache'\n | 'force-no-store'\n | 'only-cache'\n | 'only-no-store'\n\n /**\n * The preferred region for the page.\n */\n preferredRegion?: string | string[]\n\n /**\n * Whether the page supports partial prerendering. When true, the page will be\n * served using partial prerendering. This setting will only take affect if\n * it's enabled via the `experimental.ppr = \"incremental\"` option.\n */\n experimental_ppr?: boolean\n\n /**\n * The runtime to use for the page.\n */\n runtime?: 'edge' | 'nodejs'\n\n /**\n * The maximum duration for the page in seconds.\n */\n maxDuration?: number\n}\n\n/**\n * The keys of the configuration for a page.\n *\n * @internal - required to exclude zod types from the build\n */\nexport const AppSegmentConfigSchemaKeys = AppSegmentConfigSchema.keyof().options\n"],"names":["AppSegmentConfigSchemaKeys","parseAppSegmentConfig","AppSegmentConfigSchema","z","object","revalidate","union","number","int","nonnegative","literal","optional","dynamicParams","boolean","dynamic","enum","fetchCache","preferredRegion","string","array","experimental_ppr","runtime","maxDuration","data","route","parsed","safeParse","errorMap","issue","ctx","path","length","message","JSON","stringify","defaultError","success","formatZodError","error","keyof","options"],"mappings":";;;;;;;;;;;;;;;IA6JaA,0BAA0B;eAA1BA;;IAvFGC,qBAAqB;eAArBA;;;qBAtEE;sBACa;AAE/B;;CAEC,GACD,MAAMC,yBAAyBC,MAAC,CAACC,MAAM,CAAC;IACtC;;GAEC,GACDC,YAAYF,MAAC,CACVG,KAAK,CAAC;QAACH,MAAC,CAACI,MAAM,GAAGC,GAAG,GAAGC,WAAW;QAAIN,MAAC,CAACO,OAAO,CAAC;KAAO,EACxDC,QAAQ;IAEX;;GAEC,GACDC,eAAeT,MAAC,CAACU,OAAO,GAAGF,QAAQ;IAEnC;;GAEC,GACDG,SAASX,MAAC,CACPY,IAAI,CAAC;QAAC;QAAQ;QAAS;QAAgB;KAAgB,EACvDJ,QAAQ;IAEX;;GAEC,GACDK,YAAYb,MAAC,CACVY,IALine truncated
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
import type { LoadComponentsReturnType } from '../../../server/load-components';
|
||||
import type { Params } from '../../../server/request/params';
|
||||
import type { AppPageModule } from '../../../server/route-modules/app-page/module.compiled';
|
||||
import type { AppRouteModule } from '../../../server/route-modules/app-route/module.compiled';
|
||||
import { type AppSegmentConfig } from './app-segment-config';
|
||||
type GenerateStaticParams = (options: {
|
||||
params?: Params;
|
||||
}) => Promise<Params[]>;
|
||||
export type AppSegment = {
|
||||
name: string;
|
||||
param: string | undefined;
|
||||
filePath: string | undefined;
|
||||
config: AppSegmentConfig | undefined;
|
||||
isDynamicSegment: boolean;
|
||||
generateStaticParams: GenerateStaticParams | undefined;
|
||||
};
|
||||
/**
|
||||
* Collects the segments for a given route module.
|
||||
*
|
||||
* @param components the loaded components
|
||||
* @returns the segments for the route module
|
||||
*/
|
||||
export declare function collectSegments({ routeModule, }: LoadComponentsReturnType<AppPageModule | AppRouteModule>): Promise<AppSegment[]> | AppSegment[];
|
||||
export {};
|
||||
+160
@@ -0,0 +1,160 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "collectSegments", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return collectSegments;
|
||||
}
|
||||
});
|
||||
const _appsegmentconfig = require("./app-segment-config");
|
||||
const _invarianterror = require("../../../shared/lib/invariant-error");
|
||||
const _checks = require("../../../server/route-modules/checks");
|
||||
const _clientandserverreferences = require("../../../lib/client-and-server-references");
|
||||
const _getsegmentparam = require("../../../server/app-render/get-segment-param");
|
||||
const _appdirmodule = require("../../../server/lib/app-dir-module");
|
||||
const _segment = require("../../../shared/lib/segment");
|
||||
/**
|
||||
* Parses the app config and attaches it to the segment.
|
||||
*/ function attach(segment, userland, route) {
|
||||
// If the userland is not an object, then we can't do anything with it.
|
||||
if (typeof userland !== 'object' || userland === null) {
|
||||
return;
|
||||
}
|
||||
// Try to parse the application configuration.
|
||||
const config = (0, _appsegmentconfig.parseAppSegmentConfig)(userland, route);
|
||||
// If there was any keys on the config, then attach it to the segment.
|
||||
if (Object.keys(config).length > 0) {
|
||||
segment.config = config;
|
||||
}
|
||||
if ('generateStaticParams' in userland && typeof userland.generateStaticParams === 'function') {
|
||||
var _segment_config;
|
||||
segment.generateStaticParams = userland.generateStaticParams;
|
||||
// Validate that `generateStaticParams` makes sense in this context.
|
||||
if (((_segment_config = segment.config) == null ? void 0 : _segment_config.runtime) === 'edge') {
|
||||
throw Object.defineProperty(new Error('Edge runtime is not supported with `generateStaticParams`.'), "__NEXT_ERROR_CODE", {
|
||||
value: "E502",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Walks the loader tree and collects the generate parameters for each segment.
|
||||
*
|
||||
* @param routeModule the app page route module
|
||||
* @returns the segments for the app page route module
|
||||
*/ async function collectAppPageSegments(routeModule) {
|
||||
// We keep track of unique segments, since with parallel routes, it's possible
|
||||
// to see the same segment multiple times.
|
||||
const uniqueSegments = new Map();
|
||||
const queue = [
|
||||
[
|
||||
routeModule.userland.loaderTree,
|
||||
[]
|
||||
]
|
||||
];
|
||||
while(queue.length > 0){
|
||||
var _getSegmentParam;
|
||||
const [loaderTree, currentSegments] = queue.shift();
|
||||
const [name, parallelRoutes] = loaderTree;
|
||||
// Process current node
|
||||
const { mod: userland, filePath } = await (0, _appdirmodule.getLayoutOrPageModule)(loaderTree);
|
||||
const isClientComponent = userland && (0, _clientandserverreferences.isClientReference)(userland);
|
||||
const param = (_getSegmentParam = (0, _getsegmentparam.getSegmentParam)(name)) == null ? void 0 : _getSegmentParam.param;
|
||||
const segment = {
|
||||
name,
|
||||
param,
|
||||
filePath,
|
||||
config: undefined,
|
||||
isDynamicSegment: !!param,
|
||||
generateStaticParams: undefined
|
||||
};
|
||||
// Only server components can have app segment configurations
|
||||
if (!isClientComponent) {
|
||||
attach(segment, userland, routeModule.definition.pathname);
|
||||
}
|
||||
// Create a unique key for the segment
|
||||
const segmentKey = getSegmentKey(segment);
|
||||
if (!uniqueSegments.has(segmentKey)) {
|
||||
uniqueSegments.set(segmentKey, segment);
|
||||
}
|
||||
const updatedSegments = [
|
||||
...currentSegments,
|
||||
segment
|
||||
];
|
||||
// If this is a page segment, we've reached a leaf node
|
||||
if (name === _segment.PAGE_SEGMENT_KEY) {
|
||||
// Add all segments in the current path
|
||||
updatedSegments.forEach((seg)=>{
|
||||
const key = getSegmentKey(seg);
|
||||
uniqueSegments.set(key, seg);
|
||||
});
|
||||
}
|
||||
// Add all parallel routes to the queue
|
||||
for(const parallelRouteKey in parallelRoutes){
|
||||
const parallelRoute = parallelRoutes[parallelRouteKey];
|
||||
queue.push([
|
||||
parallelRoute,
|
||||
updatedSegments
|
||||
]);
|
||||
}
|
||||
}
|
||||
return Array.from(uniqueSegments.values());
|
||||
}
|
||||
function getSegmentKey(segment) {
|
||||
return `${segment.name}-${segment.filePath ?? ''}-${segment.param ?? ''}`;
|
||||
}
|
||||
/**
|
||||
* Collects the segments for a given app route module.
|
||||
*
|
||||
* @param routeModule the app route module
|
||||
* @returns the segments for the app route module
|
||||
*/ function collectAppRouteSegments(routeModule) {
|
||||
// Get the pathname parts, slice off the first element (which is empty).
|
||||
const parts = routeModule.definition.pathname.split('/').slice(1);
|
||||
if (parts.length === 0) {
|
||||
throw Object.defineProperty(new _invarianterror.InvariantError('Expected at least one segment'), "__NEXT_ERROR_CODE", {
|
||||
value: "E580",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
// Generate all the segments.
|
||||
const segments = parts.map((name)=>{
|
||||
var _getSegmentParam;
|
||||
const param = (_getSegmentParam = (0, _getsegmentparam.getSegmentParam)(name)) == null ? void 0 : _getSegmentParam.param;
|
||||
return {
|
||||
name,
|
||||
param,
|
||||
filePath: undefined,
|
||||
isDynamicSegment: !!param,
|
||||
config: undefined,
|
||||
generateStaticParams: undefined
|
||||
};
|
||||
});
|
||||
// We know we have at least one, we verified this above. We should get the
|
||||
// last segment which represents the root route module.
|
||||
const segment = segments[segments.length - 1];
|
||||
segment.filePath = routeModule.definition.filename;
|
||||
// Extract the segment config from the userland module.
|
||||
attach(segment, routeModule.userland, routeModule.definition.pathname);
|
||||
return segments;
|
||||
}
|
||||
function collectSegments({ routeModule }) {
|
||||
if ((0, _checks.isAppRouteRouteModule)(routeModule)) {
|
||||
return collectAppRouteSegments(routeModule);
|
||||
}
|
||||
if ((0, _checks.isAppPageRouteModule)(routeModule)) {
|
||||
return collectAppPageSegments(routeModule);
|
||||
}
|
||||
throw Object.defineProperty(new _invarianterror.InvariantError('Expected a route module to be one of app route or page'), "__NEXT_ERROR_CODE", {
|
||||
value: "E568",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
|
||||
//# sourceMappingURL=app-segments.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/build/segment-config/app/app-segments.ts"],"sourcesContent":["import type { LoadComponentsReturnType } from '../../../server/load-components'\nimport type { Params } from '../../../server/request/params'\nimport type {\n AppPageRouteModule,\n AppPageModule,\n} from '../../../server/route-modules/app-page/module.compiled'\nimport type {\n AppRouteRouteModule,\n AppRouteModule,\n} from '../../../server/route-modules/app-route/module.compiled'\nimport {\n type AppSegmentConfig,\n parseAppSegmentConfig,\n} from './app-segment-config'\n\nimport { InvariantError } from '../../../shared/lib/invariant-error'\nimport {\n isAppRouteRouteModule,\n isAppPageRouteModule,\n} from '../../../server/route-modules/checks'\nimport { isClientReference } from '../../../lib/client-and-server-references'\nimport { getSegmentParam } from '../../../server/app-render/get-segment-param'\nimport {\n getLayoutOrPageModule,\n type LoaderTree,\n} from '../../../server/lib/app-dir-module'\nimport { PAGE_SEGMENT_KEY } from '../../../shared/lib/segment'\n\ntype GenerateStaticParams = (options: { params?: Params }) => Promise<Params[]>\n\n/**\n * Parses the app config and attaches it to the segment.\n */\nfunction attach(segment: AppSegment, userland: unknown, route: string) {\n // If the userland is not an object, then we can't do anything with it.\n if (typeof userland !== 'object' || userland === null) {\n return\n }\n\n // Try to parse the application configuration.\n const config = parseAppSegmentConfig(userland, route)\n\n // If there was any keys on the config, then attach it to the segment.\n if (Object.keys(config).length > 0) {\n segment.config = config\n }\n\n if (\n 'generateStaticParams' in userland &&\n typeof userland.generateStaticParams === 'function'\n ) {\n segment.generateStaticParams =\n userland.generateStaticParams as GenerateStaticParams\n\n // Validate that `generateStaticParams` makes sense in this context.\n if (segment.config?.runtime === 'edge') {\n throw new Error(\n 'Edge runtime is not supported with `generateStaticParams`.'\n )\n }\n }\n}\n\nexport type AppSegment = {\n name: string\n param: string | undefined\n filePath: string | undefined\n config: AppSegmentConfig | undefined\n isDynamicSegment: boolean\n generateStaticParams: GenerateStaticParams | undefined\n}\n\n/**\n * Walks the loader tree and collects the generate parameters for each segment.\n *\n * @param routeModule the app page route module\n * @returns the segments for the app page route module\n */\nasync function collectAppPageSegments(routeModule: AppPageRouteModule) {\n // We keep track of unique segments, since with parallel routes, it's possible\n // to see the same segment multiple times.\n const uniqueSegments = new Map<string, AppSegment>()\n\n // Queue will store tuples of [loaderTree, currentSegments]\n type QueueItem = [LoaderTree, AppSegment[]]\n const queue: QueueItem[] = [[routeModule.userland.loaderTree, []]]\n\n while (queue.length > 0) {\n const [loaderTree, currentSegments] = queue.shift()!\n const [name, parallelRoutes] = loaderTree\n\n // Process current node\n const { mod: userland, filePath } = await getLayoutOrPageModule(loaderTree)\n const isClientComponent = userland && isClientReference(userland)\n\n const param = getSegmentParam(name)?.param\n\n const segment: AppSegment = {\n name,\n param,\n filePath,\n config: undefined,\n isDynamicSegment: !!param,\n generateStaticParams: undefined,\n }\n\n // Only server components can have app segment configurations\n if (!isClientComponent) {\n attach(segment, userland, routeModule.definition.pathname)\n }\n\n // Create a unique key for the segment\n const segmentKey = getSegmentKey(segment)\n if (!uniqueSegments.has(segmentKey)) {\n uniqueSegments.set(segmentKey, segment)\n }\n\n const updatedSegments = [...currentSegments, segment]\n\n // If this is a page segment, we've reached a leaf node\n if (name === PAGE_SEGMENT_KEY) {\n // Add all segments in the current path\n updatedSegments.forEach((seg) => {\n const key = getSegmentKey(seg)\n uniqueSegments.set(key, seg)\n })\n }\n\n // Add all parallel routes to the queue\n for (const parallelRouteKey in parallelRoutes) {\n const parallelRoute = parallelRoutes[parallelRouteKey]\n queue.push([parallelRoute, updatedSegments])\n }\n }\n\n return Array.from(uniqueSegments.values())\n}\n\nfunction getSegmentKey(segment: AppSegment) {\n return `${segment.name}-${segment.filePath ?? ''}-${segment.param ?? ''}`\n}\n\n/**\n * Collects the segments for a given app route module.\n *\n * @param routeModule the app route module\n * @returns the segments for the app route module\n */\nfunction collectAppRouteSegments(\n routeModule: AppRouteRouteModule\n): AppSegment[] {\n // GLine truncated
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
import type { LoadComponentsReturnType } from '../../../server/load-components';
|
||||
import type { AppPageModule } from '../../../server/route-modules/app-page/module';
|
||||
import type { AppRouteModule } from '../../../server/route-modules/app-route/module';
|
||||
/**
|
||||
* Collects the segments for a given route module.
|
||||
*
|
||||
* @param components the loaded components
|
||||
* @returns the segments for the route module
|
||||
*/
|
||||
export declare function collectRootParamKeys({ routeModule, }: LoadComponentsReturnType<AppPageModule | AppRouteModule>): readonly string[];
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "collectRootParamKeys", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return collectRootParamKeys;
|
||||
}
|
||||
});
|
||||
const _getsegmentparam = require("../../../server/app-render/get-segment-param");
|
||||
const _checks = require("../../../server/route-modules/checks");
|
||||
const _invarianterror = require("../../../shared/lib/invariant-error");
|
||||
function collectAppPageRootParamKeys(routeModule) {
|
||||
let rootParams = [];
|
||||
let current = routeModule.userland.loaderTree;
|
||||
while(current){
|
||||
var _getSegmentParam;
|
||||
const [name, parallelRoutes, modules] = current;
|
||||
// If this is a dynamic segment, then we collect the param.
|
||||
const param = (_getSegmentParam = (0, _getsegmentparam.getSegmentParam)(name)) == null ? void 0 : _getSegmentParam.param;
|
||||
if (param) {
|
||||
rootParams.push(param);
|
||||
}
|
||||
// If this has a layout module, then we've found the root layout because
|
||||
// we return once we found the first layout.
|
||||
if (typeof modules.layout !== 'undefined') {
|
||||
return rootParams;
|
||||
}
|
||||
// This didn't include a root layout, so we need to continue. We don't need
|
||||
// to collect from other parallel routes because we can't have a parallel
|
||||
// route above a root layout.
|
||||
current = parallelRoutes.children;
|
||||
}
|
||||
// If we didn't find a root layout, then we don't have any params.
|
||||
return [];
|
||||
}
|
||||
function collectRootParamKeys({ routeModule }) {
|
||||
if ((0, _checks.isAppRouteRouteModule)(routeModule)) {
|
||||
return [];
|
||||
}
|
||||
if ((0, _checks.isAppPageRouteModule)(routeModule)) {
|
||||
return collectAppPageRootParamKeys(routeModule);
|
||||
}
|
||||
throw Object.defineProperty(new _invarianterror.InvariantError('Expected a route module to be one of app route or page'), "__NEXT_ERROR_CODE", {
|
||||
value: "E568",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
|
||||
//# sourceMappingURL=collect-root-param-keys.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/build/segment-config/app/collect-root-param-keys.ts"],"sourcesContent":["import { getSegmentParam } from '../../../server/app-render/get-segment-param'\nimport type { LoadComponentsReturnType } from '../../../server/load-components'\nimport type { AppPageModule } from '../../../server/route-modules/app-page/module'\nimport type AppPageRouteModule from '../../../server/route-modules/app-page/module'\nimport type { AppRouteModule } from '../../../server/route-modules/app-route/module'\nimport {\n isAppPageRouteModule,\n isAppRouteRouteModule,\n} from '../../../server/route-modules/checks'\nimport { InvariantError } from '../../../shared/lib/invariant-error'\n\nfunction collectAppPageRootParamKeys(\n routeModule: AppPageRouteModule\n): readonly string[] {\n let rootParams: string[] = []\n\n let current = routeModule.userland.loaderTree\n while (current) {\n const [name, parallelRoutes, modules] = current\n\n // If this is a dynamic segment, then we collect the param.\n const param = getSegmentParam(name)?.param\n if (param) {\n rootParams.push(param)\n }\n\n // If this has a layout module, then we've found the root layout because\n // we return once we found the first layout.\n if (typeof modules.layout !== 'undefined') {\n return rootParams\n }\n\n // This didn't include a root layout, so we need to continue. We don't need\n // to collect from other parallel routes because we can't have a parallel\n // route above a root layout.\n current = parallelRoutes.children\n }\n\n // If we didn't find a root layout, then we don't have any params.\n return []\n}\n\n/**\n * Collects the segments for a given route module.\n *\n * @param components the loaded components\n * @returns the segments for the route module\n */\nexport function collectRootParamKeys({\n routeModule,\n}: LoadComponentsReturnType<\n AppPageModule | AppRouteModule\n>): readonly string[] {\n if (isAppRouteRouteModule(routeModule)) {\n return []\n }\n\n if (isAppPageRouteModule(routeModule)) {\n return collectAppPageRootParamKeys(routeModule)\n }\n\n throw new InvariantError(\n 'Expected a route module to be one of app route or page'\n )\n}\n"],"names":["collectRootParamKeys","collectAppPageRootParamKeys","routeModule","rootParams","current","userland","loaderTree","getSegmentParam","name","parallelRoutes","modules","param","push","layout","children","isAppRouteRouteModule","isAppPageRouteModule","InvariantError"],"mappings":";;;;+BAgDgBA;;;eAAAA;;;iCAhDgB;wBAQzB;gCACwB;AAE/B,SAASC,4BACPC,WAA+B;IAE/B,IAAIC,aAAuB,EAAE;IAE7B,IAAIC,UAAUF,YAAYG,QAAQ,CAACC,UAAU;IAC7C,MAAOF,QAAS;YAIAG;QAHd,MAAM,CAACC,MAAMC,gBAAgBC,QAAQ,GAAGN;QAExC,2DAA2D;QAC3D,MAAMO,SAAQJ,mBAAAA,IAAAA,gCAAe,EAACC,0BAAhBD,iBAAuBI,KAAK;QAC1C,IAAIA,OAAO;YACTR,WAAWS,IAAI,CAACD;QAClB;QAEA,wEAAwE;QACxE,4CAA4C;QAC5C,IAAI,OAAOD,QAAQG,MAAM,KAAK,aAAa;YACzC,OAAOV;QACT;QAEA,2EAA2E;QAC3E,yEAAyE;QACzE,6BAA6B;QAC7BC,UAAUK,eAAeK,QAAQ;IACnC;IAEA,kEAAkE;IAClE,OAAO,EAAE;AACX;AAQO,SAASd,qBAAqB,EACnCE,WAAW,EAGZ;IACC,IAAIa,IAAAA,6BAAqB,EAACb,cAAc;QACtC,OAAO,EAAE;IACX;IAEA,IAAIc,IAAAA,4BAAoB,EAACd,cAAc;QACrC,OAAOD,4BAA4BC;IACrC;IAEA,MAAM,qBAEL,CAFK,IAAIe,8BAAc,CACtB,2DADI,qBAAA;eAAA;oBAAA;sBAAA;IAEN;AACF"}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
import type { RouteHas } from '../../../lib/load-custom-routes';
|
||||
export type MiddlewareConfigInput = {
|
||||
/**
|
||||
* The matcher for the middleware.
|
||||
*/
|
||||
matcher?: string | Array<{
|
||||
locale?: false;
|
||||
has?: RouteHas[];
|
||||
missing?: RouteHas[];
|
||||
source: string;
|
||||
} | string>;
|
||||
/**
|
||||
* The regions that the middleware should run in.
|
||||
*/
|
||||
regions?: string | string[];
|
||||
/**
|
||||
* A glob, or an array of globs, ignoring dynamic code evaluation for specific
|
||||
* files. The globs are relative to your application root folder.
|
||||
*/
|
||||
unstable_allowDynamic?: string | string[];
|
||||
};
|
||||
+121
@@ -0,0 +1,121 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
MiddlewareConfigInputSchema: null,
|
||||
MiddlewareConfigInputSchemaKeys: null,
|
||||
SourceSchema: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
MiddlewareConfigInputSchema: function() {
|
||||
return MiddlewareConfigInputSchema;
|
||||
},
|
||||
MiddlewareConfigInputSchemaKeys: function() {
|
||||
return MiddlewareConfigInputSchemaKeys;
|
||||
},
|
||||
SourceSchema: function() {
|
||||
return SourceSchema;
|
||||
}
|
||||
});
|
||||
const _picomatch = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/picomatch"));
|
||||
const _zod = require("next/dist/compiled/zod");
|
||||
const _trytoparsepath = require("../../../lib/try-to-parse-path");
|
||||
function _interop_require_default(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
const RouteHasSchema = _zod.z.discriminatedUnion('type', [
|
||||
_zod.z.object({
|
||||
type: _zod.z.enum([
|
||||
'header',
|
||||
'query',
|
||||
'cookie'
|
||||
]),
|
||||
key: _zod.z.string({
|
||||
required_error: 'key is required when type is header, query or cookie'
|
||||
}),
|
||||
value: _zod.z.string({
|
||||
invalid_type_error: 'value must be a string'
|
||||
}).optional()
|
||||
}).strict(),
|
||||
_zod.z.object({
|
||||
type: _zod.z.literal('host'),
|
||||
value: _zod.z.string({
|
||||
required_error: 'host must have a value'
|
||||
})
|
||||
}).strict()
|
||||
]);
|
||||
const SourceSchema = _zod.z.string({
|
||||
required_error: 'source is required'
|
||||
}).max(4096, 'exceeds max built length of 4096 for route').superRefine((val, ctx)=>{
|
||||
if (!val.startsWith('/')) {
|
||||
return ctx.addIssue({
|
||||
code: _zod.z.ZodIssueCode.custom,
|
||||
message: `source must start with /`
|
||||
});
|
||||
}
|
||||
const { error, regexStr } = (0, _trytoparsepath.tryToParsePath)(val);
|
||||
if (error || !regexStr) {
|
||||
ctx.addIssue({
|
||||
code: _zod.z.ZodIssueCode.custom,
|
||||
message: `Invalid source '${val}': ${error.message}`
|
||||
});
|
||||
}
|
||||
});
|
||||
const MiddlewareMatcherInputSchema = _zod.z.object({
|
||||
locale: _zod.z.union([
|
||||
_zod.z.literal(false),
|
||||
_zod.z.undefined()
|
||||
]).optional(),
|
||||
has: _zod.z.array(RouteHasSchema).optional(),
|
||||
missing: _zod.z.array(RouteHasSchema).optional(),
|
||||
source: SourceSchema
|
||||
}).strict();
|
||||
const MiddlewareConfigMatcherInputSchema = _zod.z.union([
|
||||
SourceSchema,
|
||||
_zod.z.array(_zod.z.union([
|
||||
SourceSchema,
|
||||
MiddlewareMatcherInputSchema
|
||||
], {
|
||||
invalid_type_error: 'must be an array of strings or middleware matchers'
|
||||
}))
|
||||
]);
|
||||
const GlobSchema = _zod.z.string().superRefine((val, ctx)=>{
|
||||
try {
|
||||
(0, _picomatch.default)(val);
|
||||
} catch (err) {
|
||||
ctx.addIssue({
|
||||
code: _zod.z.ZodIssueCode.custom,
|
||||
message: `Invalid glob pattern '${val}': ${err.message}`
|
||||
});
|
||||
}
|
||||
});
|
||||
const MiddlewareConfigInputSchema = _zod.z.object({
|
||||
/**
|
||||
* The matcher for the middleware.
|
||||
*/ matcher: MiddlewareConfigMatcherInputSchema.optional(),
|
||||
/**
|
||||
* The regions that the middleware should run in.
|
||||
*/ regions: _zod.z.union([
|
||||
_zod.z.string(),
|
||||
_zod.z.array(_zod.z.string())
|
||||
]).optional(),
|
||||
/**
|
||||
* A glob, or an array of globs, ignoring dynamic code evaluation for specific
|
||||
* files. The globs are relative to your application root folder.
|
||||
*/ unstable_allowDynamic: _zod.z.union([
|
||||
GlobSchema,
|
||||
_zod.z.array(GlobSchema)
|
||||
]).optional()
|
||||
});
|
||||
const MiddlewareConfigInputSchemaKeys = MiddlewareConfigInputSchema.keyof().options;
|
||||
|
||||
//# sourceMappingURL=middleware-config.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/build/segment-config/middleware/middleware-config.ts"],"sourcesContent":["import picomatch from 'next/dist/compiled/picomatch'\nimport { z } from 'next/dist/compiled/zod'\nimport { tryToParsePath } from '../../../lib/try-to-parse-path'\nimport type { RouteHas } from '../../../lib/load-custom-routes'\n\nconst RouteHasSchema = z.discriminatedUnion('type', [\n z\n .object({\n type: z.enum(['header', 'query', 'cookie']),\n key: z.string({\n required_error: 'key is required when type is header, query or cookie',\n }),\n value: z\n .string({\n invalid_type_error: 'value must be a string',\n })\n .optional(),\n })\n .strict(),\n z\n .object({\n type: z.literal('host'),\n value: z.string({\n required_error: 'host must have a value',\n }),\n })\n .strict(),\n])\n\n/**\n * @internal - required to exclude zod types from the build\n */\nexport const SourceSchema = z\n .string({\n required_error: 'source is required',\n })\n .max(4096, 'exceeds max built length of 4096 for route')\n .superRefine((val, ctx) => {\n if (!val.startsWith('/')) {\n return ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `source must start with /`,\n })\n }\n\n const { error, regexStr } = tryToParsePath(val)\n\n if (error || !regexStr) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `Invalid source '${val}': ${error.message}`,\n })\n }\n })\n\nconst MiddlewareMatcherInputSchema = z\n .object({\n locale: z.union([z.literal(false), z.undefined()]).optional(),\n has: z.array(RouteHasSchema).optional(),\n missing: z.array(RouteHasSchema).optional(),\n source: SourceSchema,\n })\n .strict()\n\nconst MiddlewareConfigMatcherInputSchema = z.union([\n SourceSchema,\n z.array(\n z.union([SourceSchema, MiddlewareMatcherInputSchema], {\n invalid_type_error: 'must be an array of strings or middleware matchers',\n })\n ),\n])\n\n/**\n * @internal - required to exclude zod types from the build\n */\nexport type MiddlewareConfigMatcherInput = z.infer<\n typeof MiddlewareConfigMatcherInputSchema\n>\n\nconst GlobSchema = z.string().superRefine((val, ctx) => {\n try {\n picomatch(val)\n } catch (err: any) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `Invalid glob pattern '${val}': ${err.message}`,\n })\n }\n})\n\n/**\n * @internal - required to exclude zod types from the build\n */\nexport const MiddlewareConfigInputSchema = z.object({\n /**\n * The matcher for the middleware.\n */\n matcher: MiddlewareConfigMatcherInputSchema.optional(),\n\n /**\n * The regions that the middleware should run in.\n */\n regions: z.union([z.string(), z.array(z.string())]).optional(),\n\n /**\n * A glob, or an array of globs, ignoring dynamic code evaluation for specific\n * files. The globs are relative to your application root folder.\n */\n unstable_allowDynamic: z.union([GlobSchema, z.array(GlobSchema)]).optional(),\n})\n\nexport type MiddlewareConfigInput = {\n /**\n * The matcher for the middleware.\n */\n matcher?:\n | string\n | Array<\n | {\n locale?: false\n has?: RouteHas[]\n missing?: RouteHas[]\n source: string\n }\n | string\n >\n\n /**\n * The regions that the middleware should run in.\n */\n regions?: string | string[]\n\n /**\n * A glob, or an array of globs, ignoring dynamic code evaluation for specific\n * files. The globs are relative to your application root folder.\n */\n unstable_allowDynamic?: string | string[]\n}\n\n/**\n * The keys of the configuration for a middleware.\n *\n * @internal - required to exclude zod types from the build\n */\nexport const MiddlewareConfigInputSchemaKeys =\n MiddlewareConfigInputSchema.keyof().options\n"],"names":["MiddlewareConfigInputSchema","MiddlewareConfigInputSchemaKeys","SourceSchema","RouteHasSchema","z","discriminatedUnion","object","type","enum","key","string","required_error","value","invalid_type_error","optional","strict","literal","max","superRefine","val","ctx","startsWith","addIssue","code","ZodIssueCode","custom","message","error","regexStr","tryToParsePath","MiddlewareMatcherInputSchema","locale","union","undefined","has","array","missing","source","MiddlewareConfigMatcherInputSchema","GlobSchema","picomatch","err","matcher","regions","unstable_allowDynamic","keyof","options"],"mappings":";;;;;;;;;;;;;;;;IA8FaA,2BAA2B;eAA3BA;;IAmDAC,+BAA+B;eAA/BA;;IAjHAC,YAAY;eAAZA;;;kEAhCS;qBACJ;gCACa;;;;;;AAG/B,MAAMC,iBAAiBC,MAAC,CAACC,kBAAkB,CAAC,QAAQ;IAClDD,MAAC,CACEE,MAAM,CAAC;QACNC,MAAMH,MAAC,CAACI,IAAI,CAAC;YAAC;YAAU;YAAS;SAAS;QAC1CC,KAAKL,MAAC,CAACM,MAAM,CAAC;YACZC,gBAAgB;QAClB;QACAC,OAAOR,MAAC,CACLM,MAAM,CAAC;YACNG,oBAAoB;QACtB,GACCC,QAAQ;IACb,GACCC,MAAM;IACTX,MAAC,CACEE,MAAM,CAAC;QACNC,MAAMH,MAAC,CAACY,Line truncated
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* Parse the page segment config.
|
||||
* @param data - The data to parse.
|
||||
* @param route - The route of the page.
|
||||
* @returns The parsed page segment config.
|
||||
*/
|
||||
export declare function parsePagesSegmentConfig(data: unknown, route: string): PagesSegmentConfig;
|
||||
export type PagesSegmentConfigConfig = {
|
||||
/**
|
||||
* Enables AMP for the page.
|
||||
*/
|
||||
amp?: boolean | 'hybrid';
|
||||
/**
|
||||
* The maximum duration for the page render.
|
||||
*/
|
||||
maxDuration?: number;
|
||||
/**
|
||||
* The runtime to use for the page.
|
||||
*/
|
||||
runtime?: 'edge' | 'experimental-edge' | 'nodejs';
|
||||
/**
|
||||
* The preferred region for the page.
|
||||
*/
|
||||
regions?: string[];
|
||||
};
|
||||
export type PagesSegmentConfig = {
|
||||
/**
|
||||
* The runtime to use for the page.
|
||||
*/
|
||||
runtime?: 'edge' | 'experimental-edge' | 'nodejs';
|
||||
/**
|
||||
* The maximum duration for the page render.
|
||||
*/
|
||||
maxDuration?: number;
|
||||
/**
|
||||
* The exported config object for the page.
|
||||
*/
|
||||
config?: PagesSegmentConfigConfig;
|
||||
};
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
PagesSegmentConfigSchemaKeys: null,
|
||||
parsePagesSegmentConfig: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
PagesSegmentConfigSchemaKeys: function() {
|
||||
return PagesSegmentConfigSchemaKeys;
|
||||
},
|
||||
parsePagesSegmentConfig: function() {
|
||||
return parsePagesSegmentConfig;
|
||||
}
|
||||
});
|
||||
const _zod = require("next/dist/compiled/zod");
|
||||
const _zod1 = require("../../../shared/lib/zod");
|
||||
/**
|
||||
* The schema for the page segment config.
|
||||
*/ const PagesSegmentConfigSchema = _zod.z.object({
|
||||
/**
|
||||
* The runtime to use for the page.
|
||||
*/ runtime: _zod.z.enum([
|
||||
'edge',
|
||||
'experimental-edge',
|
||||
'nodejs'
|
||||
]).optional(),
|
||||
/**
|
||||
* The maximum duration for the page render.
|
||||
*/ maxDuration: _zod.z.number().optional(),
|
||||
/**
|
||||
* The exported config object for the page.
|
||||
*/ config: _zod.z.object({
|
||||
/**
|
||||
* Enables AMP for the page.
|
||||
*/ amp: _zod.z.union([
|
||||
_zod.z.boolean(),
|
||||
_zod.z.literal('hybrid')
|
||||
]).optional(),
|
||||
/**
|
||||
* The runtime to use for the page.
|
||||
*/ runtime: _zod.z.enum([
|
||||
'edge',
|
||||
'experimental-edge',
|
||||
'nodejs'
|
||||
]).optional(),
|
||||
/**
|
||||
* The maximum duration for the page render.
|
||||
*/ maxDuration: _zod.z.number().optional()
|
||||
}).optional()
|
||||
});
|
||||
function parsePagesSegmentConfig(data, route) {
|
||||
const parsed = PagesSegmentConfigSchema.safeParse(data, {});
|
||||
if (!parsed.success) {
|
||||
throw (0, _zod1.formatZodError)(`Invalid segment configuration options detected for "${route}". Read more at https://nextjs.org/docs/messages/invalid-page-config`, parsed.error);
|
||||
}
|
||||
return parsed.data;
|
||||
}
|
||||
const PagesSegmentConfigSchemaKeys = PagesSegmentConfigSchema.keyof().options;
|
||||
|
||||
//# sourceMappingURL=pages-segment-config.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/build/segment-config/pages/pages-segment-config.ts"],"sourcesContent":["import { z } from 'next/dist/compiled/zod'\nimport { formatZodError } from '../../../shared/lib/zod'\n\n/**\n * The schema for the page segment config.\n */\nconst PagesSegmentConfigSchema = z.object({\n /**\n * The runtime to use for the page.\n */\n runtime: z.enum(['edge', 'experimental-edge', 'nodejs']).optional(),\n\n /**\n * The maximum duration for the page render.\n */\n maxDuration: z.number().optional(),\n\n /**\n * The exported config object for the page.\n */\n config: z\n .object({\n /**\n * Enables AMP for the page.\n */\n amp: z.union([z.boolean(), z.literal('hybrid')]).optional(),\n\n /**\n * The runtime to use for the page.\n */\n runtime: z.enum(['edge', 'experimental-edge', 'nodejs']).optional(),\n\n /**\n * The maximum duration for the page render.\n */\n maxDuration: z.number().optional(),\n })\n .optional(),\n})\n\n/**\n * Parse the page segment config.\n * @param data - The data to parse.\n * @param route - The route of the page.\n * @returns The parsed page segment config.\n */\nexport function parsePagesSegmentConfig(\n data: unknown,\n route: string\n): PagesSegmentConfig {\n const parsed = PagesSegmentConfigSchema.safeParse(data, {})\n if (!parsed.success) {\n throw formatZodError(\n `Invalid segment configuration options detected for \"${route}\". Read more at https://nextjs.org/docs/messages/invalid-page-config`,\n parsed.error\n )\n }\n\n return parsed.data\n}\n\n/**\n * The keys of the configuration for a page.\n *\n * @internal - required to exclude zod types from the build\n */\nexport const PagesSegmentConfigSchemaKeys =\n PagesSegmentConfigSchema.keyof().options\n\nexport type PagesSegmentConfigConfig = {\n /**\n * Enables AMP for the page.\n */\n amp?: boolean | 'hybrid'\n\n /**\n * The maximum duration for the page render.\n */\n maxDuration?: number\n\n /**\n * The runtime to use for the page.\n */\n runtime?: 'edge' | 'experimental-edge' | 'nodejs'\n\n /**\n * The preferred region for the page.\n */\n regions?: string[]\n}\n\nexport type PagesSegmentConfig = {\n /**\n * The runtime to use for the page.\n */\n runtime?: 'edge' | 'experimental-edge' | 'nodejs'\n\n /**\n * The maximum duration for the page render.\n */\n maxDuration?: number\n\n /**\n * The exported config object for the page.\n */\n config?: PagesSegmentConfigConfig\n}\n"],"names":["PagesSegmentConfigSchemaKeys","parsePagesSegmentConfig","PagesSegmentConfigSchema","z","object","runtime","enum","optional","maxDuration","number","config","amp","union","boolean","literal","data","route","parsed","safeParse","success","formatZodError","error","keyof","options"],"mappings":";;;;;;;;;;;;;;;IAkEaA,4BAA4B;eAA5BA;;IApBGC,uBAAuB;eAAvBA;;;qBA9CE;sBACa;AAE/B;;CAEC,GACD,MAAMC,2BAA2BC,MAAC,CAACC,MAAM,CAAC;IACxC;;GAEC,GACDC,SAASF,MAAC,CAACG,IAAI,CAAC;QAAC;QAAQ;QAAqB;KAAS,EAAEC,QAAQ;IAEjE;;GAEC,GACDC,aAAaL,MAAC,CAACM,MAAM,GAAGF,QAAQ;IAEhC;;GAEC,GACDG,QAAQP,MAAC,CACNC,MAAM,CAAC;QACN;;OAEC,GACDO,KAAKR,MAAC,CAACS,KAAK,CAAC;YAACT,MAAC,CAACU,OAAO;YAAIV,MAAC,CAACW,OAAO,CAAC;SAAU,EAAEP,QAAQ;QAEzD;;OAEC,GACDF,SAASF,MAAC,CAACG,IAAI,CAAC;YAAC;YAAQ;YAAqB;SAAS,EAAEC,QAAQ;QAEjE;;OAEC,GACDC,aAAaL,MAAC,CAACM,MAAM,GAAGF,QAAQ;IAClC,GACCA,QAAQ;AACb;AAQO,SAASN,wBACdc,IAAa,EACbC,KAAa;IAEb,MAAMC,SAASf,yBAAyBgB,SAAS,CAACH,MAAM,CAAC;IACzD,IAAI,CAACE,OAAOE,OAAO,EAAE;QACnB,MAAMC,IAAAA,oBAAc,EAClB,CAAC,oDAAoD,EAAEJ,MAAM,oEAAoE,CAAC,EAClIC,OAAOI,KAAK;IAEhB;IAEA,OAAOJ,OAAOF,IAAI;AACpB;AAOO,MAAMf,+BACXE,yBAAyBoB,KAAK,GAAGC,OAAO"}
|
||||
Reference in new issue
Block a user