Initial commit

This commit is contained in:
bilulib
2025-04-13 00:18:57 +02:00
parent cff009bb7c
commit d894249e61
18301 changed files with 2905442 additions and 3845 deletions

View File

@@ -0,0 +1 @@
export * from './module'

View File

@@ -0,0 +1,35 @@
if (process.env.NEXT_RUNTIME === 'edge') {
module.exports = require('next/dist/server/route-modules/app-page/module.js');
} else {
if (process.env.__NEXT_EXPERIMENTAL_REACT) {
if (process.env.NODE_ENV === 'development') {
if (process.env.TURBOPACK) {
module.exports = require('next/dist/compiled/next-server/app-page-turbo-experimental.runtime.dev.js');
} else {
module.exports = require('next/dist/compiled/next-server/app-page-experimental.runtime.dev.js');
}
} else {
if (process.env.TURBOPACK) {
module.exports = require('next/dist/compiled/next-server/app-page-turbo-experimental.runtime.prod.js');
} else {
module.exports = require('next/dist/compiled/next-server/app-page-experimental.runtime.prod.js');
}
}
} else {
if (process.env.NODE_ENV === 'development') {
if (process.env.TURBOPACK) {
module.exports = require('next/dist/compiled/next-server/app-page-turbo.runtime.dev.js');
} else {
module.exports = require('next/dist/compiled/next-server/app-page.runtime.dev.js');
}
} else {
if (process.env.TURBOPACK) {
module.exports = require('next/dist/compiled/next-server/app-page-turbo.runtime.prod.js');
} else {
module.exports = require('next/dist/compiled/next-server/app-page.runtime.prod.js');
}
}
}
}
//# sourceMappingURL=module.compiled.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/server/route-modules/app-page/module.compiled.js"],"sourcesContent":["if (process.env.NEXT_RUNTIME === 'edge') {\n module.exports = require('next/dist/server/route-modules/app-page/module.js')\n} else {\n if (process.env.__NEXT_EXPERIMENTAL_REACT) {\n if (process.env.NODE_ENV === 'development') {\n if (process.env.TURBOPACK) {\n module.exports = require('next/dist/compiled/next-server/app-page-turbo-experimental.runtime.dev.js')\n } else {\n module.exports = require('next/dist/compiled/next-server/app-page-experimental.runtime.dev.js')\n }\n } else {\n if (process.env.TURBOPACK) {\n module.exports = require('next/dist/compiled/next-server/app-page-turbo-experimental.runtime.prod.js')\n } else {\n module.exports = require('next/dist/compiled/next-server/app-page-experimental.runtime.prod.js')\n }\n }\n } else {\n if (process.env.NODE_ENV === 'development') {\n if (process.env.TURBOPACK) {\n module.exports = require('next/dist/compiled/next-server/app-page-turbo.runtime.dev.js')\n } else {\n module.exports = require('next/dist/compiled/next-server/app-page.runtime.dev.js')\n }\n } else {\n if (process.env.TURBOPACK) {\n module.exports = require('next/dist/compiled/next-server/app-page-turbo.runtime.prod.js')\n } else {\n module.exports = require('next/dist/compiled/next-server/app-page.runtime.prod.js')\n }\n }\n }\n}\n"],"names":["process","env","NEXT_RUNTIME","module","exports","require","__NEXT_EXPERIMENTAL_REACT","NODE_ENV","TURBOPACK"],"mappings":"AAAA,IAAIA,QAAQC,GAAG,CAACC,YAAY,KAAK,QAAQ;IACvCC,OAAOC,OAAO,GAAGC,QAAQ;AAC3B,OAAO;IACL,IAAIL,QAAQC,GAAG,CAACK,yBAAyB,EAAE;QACzC,IAAIN,QAAQC,GAAG,CAACM,QAAQ,KAAK,eAAe;YAC1C,IAAIP,QAAQC,GAAG,CAACO,SAAS,EAAE;gBACzBL,OAAOC,OAAO,GAAGC,QAAQ;YAC3B,OAAO;gBACLF,OAAOC,OAAO,GAAGC,QAAQ;YAC3B;QACF,OAAO;YACL,IAAIL,QAAQC,GAAG,CAACO,SAAS,EAAE;gBACzBL,OAAOC,OAAO,GAAGC,QAAQ;YAC3B,OAAO;gBACLF,OAAOC,OAAO,GAAGC,QAAQ;YAC3B;QACF;IACF,OAAO;QACL,IAAIL,QAAQC,GAAG,CAACM,QAAQ,KAAK,eAAe;YAC1C,IAAIP,QAAQC,GAAG,CAACO,SAAS,EAAE;gBACzBL,OAAOC,OAAO,GAAGC,QAAQ;YAC3B,OAAO;gBACLF,OAAOC,OAAO,GAAGC,QAAQ;YAC3B;QACF,OAAO;YACL,IAAIL,QAAQC,GAAG,CAACO,SAAS,EAAE;gBACzBL,OAAOC,OAAO,GAAGC,QAAQ;YAC3B,OAAO;gBACLF,OAAOC,OAAO,GAAGC,QAAQ;YAC3B;QACF;IACF;AACF"}

View File

@@ -0,0 +1,27 @@
import { renderToHTMLOrFlight } from '../../app-render/app-render';
import { RouteModule } from '../route-module';
import * as vendoredContexts from './vendored/contexts/entrypoints';
let vendoredReactRSC;
let vendoredReactSSR;
// the vendored Reacts are loaded from their original source in the edge runtime
if (process.env.NEXT_RUNTIME !== 'edge') {
vendoredReactRSC = require('./vendored/rsc/entrypoints');
vendoredReactSSR = require('./vendored/ssr/entrypoints');
}
export class AppPageRouteModule extends RouteModule {
render(req, res, context) {
return renderToHTMLOrFlight(req, res, context.page, context.query, context.fallbackRouteParams, context.renderOpts, context.serverComponentsHmrCache, false, context.sharedContext);
}
warmup(req, res, context) {
return renderToHTMLOrFlight(req, res, context.page, context.query, context.fallbackRouteParams, context.renderOpts, context.serverComponentsHmrCache, true, context.sharedContext);
}
}
const vendored = {
'react-rsc': vendoredReactRSC,
'react-ssr': vendoredReactSSR,
contexts: vendoredContexts
};
export { renderToHTMLOrFlight, vendored };
export default AppPageRouteModule;
//# sourceMappingURL=module.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/server/route-modules/app-page/module.ts"],"sourcesContent":["import type { AppPageRouteDefinition } from '../../route-definitions/app-page-route-definition'\nimport type RenderResult from '../../render-result'\nimport type { RenderOpts } from '../../app-render/types'\nimport type { NextParsedUrlQuery } from '../../request-meta'\nimport type { LoaderTree } from '../../lib/app-dir-module'\n\nimport {\n renderToHTMLOrFlight,\n type AppSharedContext,\n} from '../../app-render/app-render'\nimport {\n RouteModule,\n type RouteModuleOptions,\n type RouteModuleHandleContext,\n} from '../route-module'\nimport * as vendoredContexts from './vendored/contexts/entrypoints'\nimport type { BaseNextRequest, BaseNextResponse } from '../../base-http'\nimport type { ServerComponentsHmrCache } from '../../response-cache'\nimport type { FallbackRouteParams } from '../../request/fallback-params'\n\nlet vendoredReactRSC\nlet vendoredReactSSR\n\n// the vendored Reacts are loaded from their original source in the edge runtime\nif (process.env.NEXT_RUNTIME !== 'edge') {\n vendoredReactRSC = require('./vendored/rsc/entrypoints')\n vendoredReactSSR = require('./vendored/ssr/entrypoints')\n}\n\n/**\n * The AppPageModule is the type of the module exported by the bundled app page\n * module.\n */\nexport type AppPageModule = typeof import('../../../build/templates/app-page')\n\ntype AppPageUserlandModule = {\n /**\n * The tree created in next-app-loader that holds component segments and modules\n */\n loaderTree: LoaderTree\n}\n\nexport interface AppPageRouteHandlerContext extends RouteModuleHandleContext {\n page: string\n query: NextParsedUrlQuery\n fallbackRouteParams: FallbackRouteParams | null\n renderOpts: RenderOpts\n serverComponentsHmrCache?: ServerComponentsHmrCache\n sharedContext: AppSharedContext\n}\n\nexport type AppPageRouteModuleOptions = RouteModuleOptions<\n AppPageRouteDefinition,\n AppPageUserlandModule\n>\n\nexport class AppPageRouteModule extends RouteModule<\n AppPageRouteDefinition,\n AppPageUserlandModule\n> {\n public render(\n req: BaseNextRequest,\n res: BaseNextResponse,\n context: AppPageRouteHandlerContext\n ): Promise<RenderResult> {\n return renderToHTMLOrFlight(\n req,\n res,\n context.page,\n context.query,\n context.fallbackRouteParams,\n context.renderOpts,\n context.serverComponentsHmrCache,\n false,\n context.sharedContext\n )\n }\n\n public warmup(\n req: BaseNextRequest,\n res: BaseNextResponse,\n context: AppPageRouteHandlerContext\n ): Promise<RenderResult> {\n return renderToHTMLOrFlight(\n req,\n res,\n context.page,\n context.query,\n context.fallbackRouteParams,\n context.renderOpts,\n context.serverComponentsHmrCache,\n true,\n context.sharedContext\n )\n }\n}\n\nconst vendored = {\n 'react-rsc': vendoredReactRSC,\n 'react-ssr': vendoredReactSSR,\n contexts: vendoredContexts,\n}\n\nexport { renderToHTMLOrFlight, vendored }\n\nexport default AppPageRouteModule\n"],"names":["renderToHTMLOrFlight","RouteModule","vendoredContexts","vendoredReactRSC","vendoredReactSSR","process","env","NEXT_RUNTIME","require","AppPageRouteModule","render","req","res","context","page","query","fallbackRouteParams","renderOpts","serverComponentsHmrCache","sharedContext","warmup","vendored","contexts"],"mappings":"AAMA,SACEA,oBAAoB,QAEf,8BAA6B;AACpC,SACEC,WAAW,QAGN,kBAAiB;AACxB,YAAYC,sBAAsB,kCAAiC;AAKnE,IAAIC;AACJ,IAAIC;AAEJ,gFAAgF;AAChF,IAAIC,QAAQC,GAAG,CAACC,YAAY,KAAK,QAAQ;IACvCJ,mBAAmBK,QAAQ;IAC3BJ,mBAAmBI,QAAQ;AAC7B;AA6BA,OAAO,MAAMC,2BAA2BR;IAI/BS,OACLC,GAAoB,EACpBC,GAAqB,EACrBC,OAAmC,EACZ;QACvB,OAAOb,qBACLW,KACAC,KACAC,QAAQC,IAAI,EACZD,QAAQE,KAAK,EACbF,QAAQG,mBAAmB,EAC3BH,QAAQI,UAAU,EAClBJ,QAAQK,wBAAwB,EAChC,OACAL,QAAQM,aAAa;IAEzB;IAEOC,OACLT,GAAoB,EACpBC,GAAqB,EACrBC,OAAmC,EACZ;QACvB,OAAOb,qBACLW,KACAC,KACAC,QAAQC,IAAI,EACZD,QAAQE,KAAK,EACbF,QAAQG,mBAAmB,EAC3BH,QAAQI,UAAU,EAClBJ,QAAQK,wBAAwB,EAChC,MACAL,QAAQM,aAAa;IAEzB;AACF;AAEA,MAAME,WAAW;IACf,aAAalB;IACb,aAAaC;IACbkB,UAAUpB;AACZ;AAEA,SAASF,oBAAoB,EAAEqB,QAAQ,GAAE;AAEzC,eAAeZ,mBAAkB"}

View File

@@ -0,0 +1,14 @@
export const lazyRenderAppPage = (...args)=>{
if (process.env.NEXT_MINIMAL) {
throw Object.defineProperty(new Error("Can't use lazyRenderAppPage in minimal mode"), "__NEXT_ERROR_CODE", {
value: "E256",
enumerable: false,
configurable: true
});
} else {
const render = require('./module.compiled').renderToHTMLOrFlight;
return render(...args);
}
};
//# sourceMappingURL=module.render.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/server/route-modules/app-page/module.render.ts"],"sourcesContent":["import type { AppPageRender } from '../../app-render/app-render'\n\nexport const lazyRenderAppPage: AppPageRender = (...args) => {\n if (process.env.NEXT_MINIMAL) {\n throw new Error(\"Can't use lazyRenderAppPage in minimal mode\")\n } else {\n const render: AppPageRender =\n require('./module.compiled').renderToHTMLOrFlight\n\n return render(...args)\n }\n}\n"],"names":["lazyRenderAppPage","args","process","env","NEXT_MINIMAL","Error","render","require","renderToHTMLOrFlight"],"mappings":"AAEA,OAAO,MAAMA,oBAAmC,CAAC,GAAGC;IAClD,IAAIC,QAAQC,GAAG,CAACC,YAAY,EAAE;QAC5B,MAAM,qBAAwD,CAAxD,IAAIC,MAAM,gDAAV,qBAAA;mBAAA;wBAAA;0BAAA;QAAuD;IAC/D,OAAO;QACL,MAAMC,SACJC,QAAQ,qBAAqBC,oBAAoB;QAEnD,OAAOF,UAAUL;IACnB;AACF,EAAC"}

View File

@@ -0,0 +1,3 @@
module.exports = require('../../module.compiled').vendored['contexts'].AmpContext;
//# sourceMappingURL=amp-context.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../src/server/route-modules/app-page/vendored/contexts/amp-context.ts"],"sourcesContent":["module.exports = require('../../module.compiled').vendored[\n 'contexts'\n].AmpContext\n"],"names":["module","exports","require","vendored","AmpContext"],"mappings":"AAAAA,OAAOC,OAAO,GAAGC,QAAQ,yBAAyBC,QAAQ,CACxD,WACD,CAACC,UAAU"}

View File

@@ -0,0 +1,3 @@
module.exports = require('../../module.compiled').vendored['contexts'].AppRouterContext;
//# sourceMappingURL=app-router-context.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../src/server/route-modules/app-page/vendored/contexts/app-router-context.ts"],"sourcesContent":["module.exports = require('../../module.compiled').vendored[\n 'contexts'\n].AppRouterContext\n"],"names":["module","exports","require","vendored","AppRouterContext"],"mappings":"AAAAA,OAAOC,OAAO,GAAGC,QAAQ,yBAAyBC,QAAQ,CACxD,WACD,CAACC,gBAAgB"}

View File

@@ -0,0 +1,10 @@
export * as HeadManagerContext from '../../../../../shared/lib/head-manager-context.shared-runtime';
export * as ServerInsertedHtml from '../../../../../shared/lib/server-inserted-html.shared-runtime';
export * as ServerInsertedMetadata from '../../../../../shared/lib/server-inserted-metadata.shared-runtime';
export * as AppRouterContext from '../../../../../shared/lib/app-router-context.shared-runtime';
export * as HooksClientContext from '../../../../../shared/lib/hooks-client-context.shared-runtime';
export * as RouterContext from '../../../../../shared/lib/router-context.shared-runtime';
export * as AmpContext from '../../../../../shared/lib/amp-context.shared-runtime';
export * as ImageConfigContext from '../../../../../shared/lib/image-config-context.shared-runtime';
//# sourceMappingURL=entrypoints.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../src/server/route-modules/app-page/vendored/contexts/entrypoints.ts"],"sourcesContent":["export * as HeadManagerContext from '../../../../../shared/lib/head-manager-context.shared-runtime'\nexport * as ServerInsertedHtml from '../../../../../shared/lib/server-inserted-html.shared-runtime'\nexport * as ServerInsertedMetadata from '../../../../../shared/lib/server-inserted-metadata.shared-runtime'\nexport * as AppRouterContext from '../../../../../shared/lib/app-router-context.shared-runtime'\nexport * as HooksClientContext from '../../../../../shared/lib/hooks-client-context.shared-runtime'\nexport * as RouterContext from '../../../../../shared/lib/router-context.shared-runtime'\nexport * as AmpContext from '../../../../../shared/lib/amp-context.shared-runtime'\nexport * as ImageConfigContext from '../../../../../shared/lib/image-config-context.shared-runtime'\n"],"names":["HeadManagerContext","ServerInsertedHtml","ServerInsertedMetadata","AppRouterContext","HooksClientContext","RouterContext","AmpContext","ImageConfigContext"],"mappings":"AAAA,OAAO,KAAKA,kBAAkB,MAAM,gEAA+D;AACnG,OAAO,KAAKC,kBAAkB,MAAM,gEAA+D;AACnG,OAAO,KAAKC,sBAAsB,MAAM,oEAAmE;AAC3G,OAAO,KAAKC,gBAAgB,MAAM,8DAA6D;AAC/F,OAAO,KAAKC,kBAAkB,MAAM,gEAA+D;AACnG,OAAO,KAAKC,aAAa,MAAM,0DAAyD;AACxF,OAAO,KAAKC,UAAU,MAAM,uDAAsD;AAClF,OAAO,KAAKC,kBAAkB,MAAM,gEAA+D"}

View File

@@ -0,0 +1,3 @@
module.exports = require('../../module.compiled').vendored['contexts'].HeadManagerContext;
//# sourceMappingURL=head-manager-context.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../src/server/route-modules/app-page/vendored/contexts/head-manager-context.ts"],"sourcesContent":["module.exports = require('../../module.compiled').vendored[\n 'contexts'\n].HeadManagerContext\n"],"names":["module","exports","require","vendored","HeadManagerContext"],"mappings":"AAAAA,OAAOC,OAAO,GAAGC,QAAQ,yBAAyBC,QAAQ,CACxD,WACD,CAACC,kBAAkB"}

View File

@@ -0,0 +1,3 @@
module.exports = require('../../module.compiled').vendored['contexts'].HooksClientContext;
//# sourceMappingURL=hooks-client-context.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../src/server/route-modules/app-page/vendored/contexts/hooks-client-context.ts"],"sourcesContent":["module.exports = require('../../module.compiled').vendored[\n 'contexts'\n].HooksClientContext\n"],"names":["module","exports","require","vendored","HooksClientContext"],"mappings":"AAAAA,OAAOC,OAAO,GAAGC,QAAQ,yBAAyBC,QAAQ,CACxD,WACD,CAACC,kBAAkB"}

View File

@@ -0,0 +1,3 @@
module.exports = require('../../module.compiled').vendored['contexts'].ImageConfigContext;
//# sourceMappingURL=image-config-context.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../src/server/route-modules/app-page/vendored/contexts/image-config-context.ts"],"sourcesContent":["module.exports = require('../../module.compiled').vendored[\n 'contexts'\n].ImageConfigContext\n"],"names":["module","exports","require","vendored","ImageConfigContext"],"mappings":"AAAAA,OAAOC,OAAO,GAAGC,QAAQ,yBAAyBC,QAAQ,CACxD,WACD,CAACC,kBAAkB"}

View File

@@ -0,0 +1,3 @@
module.exports = require('../../module.compiled').vendored['contexts'].RouterContext;
//# sourceMappingURL=router-context.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../src/server/route-modules/app-page/vendored/contexts/router-context.ts"],"sourcesContent":["module.exports = require('../../module.compiled').vendored[\n 'contexts'\n].RouterContext\n"],"names":["module","exports","require","vendored","RouterContext"],"mappings":"AAAAA,OAAOC,OAAO,GAAGC,QAAQ,yBAAyBC,QAAQ,CACxD,WACD,CAACC,aAAa"}

View File

@@ -0,0 +1,3 @@
module.exports = require('../../module.compiled').vendored['contexts'].ServerInsertedHtml;
//# sourceMappingURL=server-inserted-html.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../src/server/route-modules/app-page/vendored/contexts/server-inserted-html.ts"],"sourcesContent":["module.exports = require('../../module.compiled').vendored[\n 'contexts'\n].ServerInsertedHtml\n"],"names":["module","exports","require","vendored","ServerInsertedHtml"],"mappings":"AAAAA,OAAOC,OAAO,GAAGC,QAAQ,yBAAyBC,QAAQ,CACxD,WACD,CAACC,kBAAkB"}

View File

@@ -0,0 +1,3 @@
module.exports = require('../../module.compiled').vendored['contexts'].ServerInsertedMetadata;
//# sourceMappingURL=server-inserted-metadata.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../src/server/route-modules/app-page/vendored/contexts/server-inserted-metadata.ts"],"sourcesContent":["module.exports = require('../../module.compiled').vendored[\n 'contexts'\n].ServerInsertedMetadata\n"],"names":["module","exports","require","vendored","ServerInsertedMetadata"],"mappings":"AAAAA,OAAOC,OAAO,GAAGC,QAAQ,yBAAyBC,QAAQ,CACxD,WACD,CAACC,sBAAsB"}

View File

@@ -0,0 +1,59 @@
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import * as ReactJsxDevRuntime from 'react/jsx-dev-runtime';
import * as ReactJsxRuntime from 'react/jsx-runtime';
import * as ReactCompilerRuntime from 'react/compiler-runtime';
function getAltProxyForBindingsDEV(type, pkg) {
if (process.env.NODE_ENV === 'development') {
const altType = type === 'Turbopack' ? 'Webpack' : 'Turbopack';
const altPkg = pkg.replace(new RegExp(type, 'gi'), altType.toLowerCase());
return new Proxy({}, {
get (_, prop) {
throw Object.defineProperty(new Error(`Expected to use ${type} bindings (${pkg}) for React but the current process is referencing '${prop}' from the ${altType} bindings (${altPkg}). This is likely a bug in our integration of the Next.js server runtime.`), "__NEXT_ERROR_CODE", {
value: "E253",
enumerable: false,
configurable: true
});
}
});
}
}
let ReactServerDOMTurbopackServerEdge, ReactServerDOMWebpackServerEdge;
let ReactServerDOMTurbopackServerNode, ReactServerDOMWebpackServerNode;
let ReactServerDOMTurbopackStaticEdge, ReactServerDOMWebpackStaticEdge;
if (process.env.TURBOPACK) {
// eslint-disable-next-line import/no-extraneous-dependencies
ReactServerDOMTurbopackServerEdge = require('react-server-dom-turbopack/server.edge');
if (process.env.NODE_ENV === 'development') {
ReactServerDOMWebpackServerEdge = getAltProxyForBindingsDEV('Turbopack', 'react-server-dom-turbopack/server.edge');
}
// eslint-disable-next-line import/no-extraneous-dependencies
ReactServerDOMTurbopackServerNode = require('react-server-dom-turbopack/server.node');
if (process.env.NODE_ENV === 'development') {
ReactServerDOMWebpackServerNode = getAltProxyForBindingsDEV('Turbopack', 'react-server-dom-turbopack/server.node');
}
// eslint-disable-next-line import/no-extraneous-dependencies
ReactServerDOMTurbopackStaticEdge = require('react-server-dom-turbopack/static.edge');
if (process.env.NODE_ENV === 'development') {
ReactServerDOMWebpackStaticEdge = getAltProxyForBindingsDEV('Turbopack', 'react-server-dom-turbopack/static.edge');
}
} else {
// eslint-disable-next-line import/no-extraneous-dependencies
ReactServerDOMWebpackServerEdge = require('react-server-dom-webpack/server.edge');
if (process.env.NODE_ENV === 'development') {
ReactServerDOMTurbopackServerEdge = getAltProxyForBindingsDEV('Webpack', 'react-server-dom-webpack/server.edge');
}
// eslint-disable-next-line import/no-extraneous-dependencies
ReactServerDOMWebpackServerNode = require('react-server-dom-webpack/server.node');
if (process.env.NODE_ENV === 'development') {
ReactServerDOMTurbopackServerNode = getAltProxyForBindingsDEV('Webpack', 'react-server-dom-webpack/server.node');
}
// eslint-disable-next-line import/no-extraneous-dependencies
ReactServerDOMWebpackStaticEdge = require('react-server-dom-webpack/static.edge');
if (process.env.NODE_ENV === 'development') {
ReactServerDOMTurbopackStaticEdge = getAltProxyForBindingsDEV('Webpack', 'react-server-dom-webpack/static.edge');
}
}
export { React, ReactJsxDevRuntime, ReactJsxRuntime, ReactCompilerRuntime, ReactDOM, ReactServerDOMWebpackServerEdge, ReactServerDOMTurbopackServerEdge, ReactServerDOMWebpackServerNode, ReactServerDOMTurbopackServerNode, ReactServerDOMWebpackStaticEdge, ReactServerDOMTurbopackStaticEdge, };
//# sourceMappingURL=entrypoints.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,3 @@
module.exports = require('../../module.compiled').vendored['react-rsc'].ReactCompilerRuntime;
//# sourceMappingURL=react-compiler-runtime.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../src/server/route-modules/app-page/vendored/rsc/react-compiler-runtime.ts"],"sourcesContent":["module.exports = require('../../module.compiled').vendored[\n 'react-rsc'\n].ReactCompilerRuntime\n"],"names":["module","exports","require","vendored","ReactCompilerRuntime"],"mappings":"AAAAA,OAAOC,OAAO,GAAGC,QAAQ,yBAAyBC,QAAQ,CACxD,YACD,CAACC,oBAAoB"}

View File

@@ -0,0 +1,3 @@
module.exports = require('../../module.compiled').vendored['react-rsc'].ReactDOM;
//# sourceMappingURL=react-dom.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../src/server/route-modules/app-page/vendored/rsc/react-dom.ts"],"sourcesContent":["module.exports = require('../../module.compiled').vendored['react-rsc'].ReactDOM\n"],"names":["module","exports","require","vendored","ReactDOM"],"mappings":"AAAAA,OAAOC,OAAO,GAAGC,QAAQ,yBAAyBC,QAAQ,CAAC,YAAY,CAACC,QAAQ"}

View File

@@ -0,0 +1,3 @@
module.exports = require('../../module.compiled').vendored['react-rsc'].ReactJsxDevRuntime;
//# sourceMappingURL=react-jsx-dev-runtime.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../src/server/route-modules/app-page/vendored/rsc/react-jsx-dev-runtime.ts"],"sourcesContent":["module.exports = require('../../module.compiled').vendored[\n 'react-rsc'\n].ReactJsxDevRuntime\n"],"names":["module","exports","require","vendored","ReactJsxDevRuntime"],"mappings":"AAAAA,OAAOC,OAAO,GAAGC,QAAQ,yBAAyBC,QAAQ,CACxD,YACD,CAACC,kBAAkB"}

View File

@@ -0,0 +1,3 @@
module.exports = require('../../module.compiled').vendored['react-rsc'].ReactJsxRuntime;
//# sourceMappingURL=react-jsx-runtime.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../src/server/route-modules/app-page/vendored/rsc/react-jsx-runtime.ts"],"sourcesContent":["module.exports = require('../../module.compiled').vendored[\n 'react-rsc'\n].ReactJsxRuntime\n"],"names":["module","exports","require","vendored","ReactJsxRuntime"],"mappings":"AAAAA,OAAOC,OAAO,GAAGC,QAAQ,yBAAyBC,QAAQ,CACxD,YACD,CAACC,eAAe"}

View File

@@ -0,0 +1,3 @@
module.exports = require('../../module.compiled').vendored['react-rsc'].ReactServerDOMTurbopackServerEdge;
//# sourceMappingURL=react-server-dom-turbopack-server-edge.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../src/server/route-modules/app-page/vendored/rsc/react-server-dom-turbopack-server-edge.ts"],"sourcesContent":["module.exports = require('../../module.compiled').vendored[\n 'react-rsc'\n].ReactServerDOMTurbopackServerEdge\n"],"names":["module","exports","require","vendored","ReactServerDOMTurbopackServerEdge"],"mappings":"AAAAA,OAAOC,OAAO,GAAGC,QAAQ,yBAAyBC,QAAQ,CACxD,YACD,CAACC,iCAAiC"}

View File

@@ -0,0 +1,3 @@
module.exports = require('../../module.compiled').vendored['react-rsc'].ReactServerDOMTurbopackServerNode;
//# sourceMappingURL=react-server-dom-turbopack-server-node.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../src/server/route-modules/app-page/vendored/rsc/react-server-dom-turbopack-server-node.ts"],"sourcesContent":["module.exports = require('../../module.compiled').vendored[\n 'react-rsc'\n].ReactServerDOMTurbopackServerNode\n"],"names":["module","exports","require","vendored","ReactServerDOMTurbopackServerNode"],"mappings":"AAAAA,OAAOC,OAAO,GAAGC,QAAQ,yBAAyBC,QAAQ,CACxD,YACD,CAACC,iCAAiC"}

View File

@@ -0,0 +1,3 @@
module.exports = require('../../module.compiled').vendored['react-rsc'].ReactServerDOMTurbopackStaticEdge;
//# sourceMappingURL=react-server-dom-turbopack-static-edge.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../src/server/route-modules/app-page/vendored/rsc/react-server-dom-turbopack-static-edge.ts"],"sourcesContent":["module.exports = require('../../module.compiled').vendored[\n 'react-rsc'\n].ReactServerDOMTurbopackStaticEdge\n"],"names":["module","exports","require","vendored","ReactServerDOMTurbopackStaticEdge"],"mappings":"AAAAA,OAAOC,OAAO,GAAGC,QAAQ,yBAAyBC,QAAQ,CACxD,YACD,CAACC,iCAAiC"}

View File

@@ -0,0 +1,3 @@
module.exports = require('../../module.compiled').vendored['react-rsc'].ReactServerDOMWebpackServerEdge;
//# sourceMappingURL=react-server-dom-webpack-server-edge.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../src/server/route-modules/app-page/vendored/rsc/react-server-dom-webpack-server-edge.ts"],"sourcesContent":["module.exports = require('../../module.compiled').vendored[\n 'react-rsc'\n].ReactServerDOMWebpackServerEdge\n"],"names":["module","exports","require","vendored","ReactServerDOMWebpackServerEdge"],"mappings":"AAAAA,OAAOC,OAAO,GAAGC,QAAQ,yBAAyBC,QAAQ,CACxD,YACD,CAACC,+BAA+B"}

View File

@@ -0,0 +1,3 @@
module.exports = require('../../module.compiled').vendored['react-rsc'].ReactServerDOMWebpackServerNode;
//# sourceMappingURL=react-server-dom-webpack-server-node.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../src/server/route-modules/app-page/vendored/rsc/react-server-dom-webpack-server-node.ts"],"sourcesContent":["module.exports = require('../../module.compiled').vendored[\n 'react-rsc'\n].ReactServerDOMWebpackServerNode\n"],"names":["module","exports","require","vendored","ReactServerDOMWebpackServerNode"],"mappings":"AAAAA,OAAOC,OAAO,GAAGC,QAAQ,yBAAyBC,QAAQ,CACxD,YACD,CAACC,+BAA+B"}

View File

@@ -0,0 +1,3 @@
module.exports = require('../../module.compiled').vendored['react-rsc'].ReactServerDOMWebpackStaticEdge;
//# sourceMappingURL=react-server-dom-webpack-static-edge.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../src/server/route-modules/app-page/vendored/rsc/react-server-dom-webpack-static-edge.ts"],"sourcesContent":["module.exports = require('../../module.compiled').vendored[\n 'react-rsc'\n].ReactServerDOMWebpackStaticEdge\n"],"names":["module","exports","require","vendored","ReactServerDOMWebpackStaticEdge"],"mappings":"AAAAA,OAAOC,OAAO,GAAGC,QAAQ,yBAAyBC,QAAQ,CACxD,YACD,CAACC,+BAA+B"}

View File

@@ -0,0 +1,3 @@
module.exports = require('../../module.compiled').vendored['react-rsc'].React;
//# sourceMappingURL=react.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../src/server/route-modules/app-page/vendored/rsc/react.ts"],"sourcesContent":["module.exports = require('../../module.compiled').vendored['react-rsc'].React\n"],"names":["module","exports","require","vendored","React"],"mappings":"AAAAA,OAAOC,OAAO,GAAGC,QAAQ,yBAAyBC,QAAQ,CAAC,YAAY,CAACC,KAAK"}

View File

@@ -0,0 +1,39 @@
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import * as ReactJsxDevRuntime from 'react/jsx-dev-runtime';
import * as ReactJsxRuntime from 'react/jsx-runtime';
import * as ReactCompilerRuntime from 'react/compiler-runtime';
// eslint-disable-next-line import/no-extraneous-dependencies
import * as ReactDOMServerEdge from 'react-dom/server.edge';
function getAltProxyForBindingsDEV(type, pkg) {
if (process.env.NODE_ENV === 'development') {
const altType = type === 'Turbopack' ? 'Webpack' : 'Turbopack';
const altPkg = pkg.replace(new RegExp(type, 'gi'), altType.toLowerCase());
return new Proxy({}, {
get (_, prop) {
throw Object.defineProperty(new Error(`Expected to use ${type} bindings (${pkg}) for React but the current process is referencing '${prop}' from the ${altType} bindings (${altPkg}). This is likely a bug in our integration of the Next.js server runtime.`), "__NEXT_ERROR_CODE", {
value: "E253",
enumerable: false,
configurable: true
});
}
});
}
}
let ReactServerDOMTurbopackClientEdge, ReactServerDOMWebpackClientEdge;
if (process.env.TURBOPACK) {
// eslint-disable-next-line import/no-extraneous-dependencies
ReactServerDOMTurbopackClientEdge = require('react-server-dom-turbopack/client.edge');
if (process.env.NODE_ENV === 'development') {
ReactServerDOMWebpackClientEdge = getAltProxyForBindingsDEV('Turbopack', 'react-server-dom-turbopack/client.edge');
}
} else {
// eslint-disable-next-line import/no-extraneous-dependencies
ReactServerDOMWebpackClientEdge = require('react-server-dom-webpack/client.edge');
if (process.env.NODE_ENV === 'development') {
ReactServerDOMTurbopackClientEdge = getAltProxyForBindingsDEV('Webpack', 'react-server-dom-webpack/client.edge');
}
}
export { React, ReactJsxDevRuntime, ReactJsxRuntime, ReactCompilerRuntime, ReactDOM, ReactDOMServerEdge, ReactServerDOMTurbopackClientEdge, ReactServerDOMWebpackClientEdge, };
//# sourceMappingURL=entrypoints.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../src/server/route-modules/app-page/vendored/ssr/entrypoints.ts"],"sourcesContent":["import * as React from 'react'\nimport * as ReactDOM from 'react-dom'\nimport * as ReactJsxDevRuntime from 'react/jsx-dev-runtime'\nimport * as ReactJsxRuntime from 'react/jsx-runtime'\nimport * as ReactCompilerRuntime from 'react/compiler-runtime'\n\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport * as ReactDOMServerEdge from 'react-dom/server.edge'\n\nfunction getAltProxyForBindingsDEV(\n type: 'Turbopack' | 'Webpack',\n pkg:\n | 'react-server-dom-turbopack/client.edge'\n | 'react-server-dom-webpack/client.edge'\n) {\n if (process.env.NODE_ENV === 'development') {\n const altType = type === 'Turbopack' ? 'Webpack' : 'Turbopack'\n const altPkg = pkg.replace(new RegExp(type, 'gi'), altType.toLowerCase())\n\n return new Proxy(\n {},\n {\n get(_, prop: string) {\n throw new Error(\n `Expected to use ${type} bindings (${pkg}) for React but the current process is referencing '${prop}' from the ${altType} bindings (${altPkg}). This is likely a bug in our integration of the Next.js server runtime.`\n )\n },\n }\n )\n }\n}\n\nlet ReactServerDOMTurbopackClientEdge, ReactServerDOMWebpackClientEdge\nif (process.env.TURBOPACK) {\n // eslint-disable-next-line import/no-extraneous-dependencies\n ReactServerDOMTurbopackClientEdge = require('react-server-dom-turbopack/client.edge')\n if (process.env.NODE_ENV === 'development') {\n ReactServerDOMWebpackClientEdge = getAltProxyForBindingsDEV(\n 'Turbopack',\n 'react-server-dom-turbopack/client.edge'\n )\n }\n} else {\n // eslint-disable-next-line import/no-extraneous-dependencies\n ReactServerDOMWebpackClientEdge = require('react-server-dom-webpack/client.edge')\n if (process.env.NODE_ENV === 'development') {\n ReactServerDOMTurbopackClientEdge = getAltProxyForBindingsDEV(\n 'Webpack',\n 'react-server-dom-webpack/client.edge'\n )\n }\n}\n\nexport {\n React,\n ReactJsxDevRuntime,\n ReactJsxRuntime,\n ReactCompilerRuntime,\n ReactDOM,\n ReactDOMServerEdge,\n ReactServerDOMTurbopackClientEdge,\n ReactServerDOMWebpackClientEdge,\n}\n"],"names":["React","ReactDOM","ReactJsxDevRuntime","ReactJsxRuntime","ReactCompilerRuntime","ReactDOMServerEdge","getAltProxyForBindingsDEV","type","pkg","process","env","NODE_ENV","altType","altPkg","replace","RegExp","toLowerCase","Proxy","get","_","prop","Error","ReactServerDOMTurbopackClientEdge","ReactServerDOMWebpackClientEdge","TURBOPACK","require"],"mappings":"AAAA,YAAYA,WAAW,QAAO;AAC9B,YAAYC,cAAc,YAAW;AACrC,YAAYC,wBAAwB,wBAAuB;AAC3D,YAAYC,qBAAqB,oBAAmB;AACpD,YAAYC,0BAA0B,yBAAwB;AAE9D,6DAA6D;AAC7D,YAAYC,wBAAwB,wBAAuB;AAE3D,SAASC,0BACPC,IAA6B,EAC7BC,GAE0C;IAE1C,IAAIC,QAAQC,GAAG,CAACC,QAAQ,KAAK,eAAe;QAC1C,MAAMC,UAAUL,SAAS,cAAc,YAAY;QACnD,MAAMM,SAASL,IAAIM,OAAO,CAAC,IAAIC,OAAOR,MAAM,OAAOK,QAAQI,WAAW;QAEtE,OAAO,IAAIC,MACT,CAAC,GACD;YACEC,KAAIC,CAAC,EAAEC,IAAY;gBACjB,MAAM,qBAEL,CAFK,IAAIC,MACR,CAAC,gBAAgB,EAAEd,KAAK,WAAW,EAAEC,IAAI,oDAAoD,EAAEY,KAAK,WAAW,EAAER,QAAQ,WAAW,EAAEC,OAAO,yEAAyE,CAAC,GADnN,qBAAA;2BAAA;gCAAA;kCAAA;gBAEN;YACF;QACF;IAEJ;AACF;AAEA,IAAIS,mCAAmCC;AACvC,IAAId,QAAQC,GAAG,CAACc,SAAS,EAAE;IACzB,6DAA6D;IAC7DF,oCAAoCG,QAAQ;IAC5C,IAAIhB,QAAQC,GAAG,CAACC,QAAQ,KAAK,eAAe;QAC1CY,kCAAkCjB,0BAChC,aACA;IAEJ;AACF,OAAO;IACL,6DAA6D;IAC7DiB,kCAAkCE,QAAQ;IAC1C,IAAIhB,QAAQC,GAAG,CAACC,QAAQ,KAAK,eAAe;QAC1CW,oCAAoChB,0BAClC,WACA;IAEJ;AACF;AAEA,SACEN,KAAK,EACLE,kBAAkB,EAClBC,eAAe,EACfC,oBAAoB,EACpBH,QAAQ,EACRI,kBAAkB,EAClBiB,iCAAiC,EACjCC,+BAA+B,KAChC"}

View File

@@ -0,0 +1,3 @@
module.exports = require('../../module.compiled').vendored['react-ssr'].ReactCompilerRuntime;
//# sourceMappingURL=react-compiler-runtime.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../src/server/route-modules/app-page/vendored/ssr/react-compiler-runtime.ts"],"sourcesContent":["module.exports = require('../../module.compiled').vendored[\n 'react-ssr'\n].ReactCompilerRuntime\n"],"names":["module","exports","require","vendored","ReactCompilerRuntime"],"mappings":"AAAAA,OAAOC,OAAO,GAAGC,QAAQ,yBAAyBC,QAAQ,CACxD,YACD,CAACC,oBAAoB"}

View File

@@ -0,0 +1,3 @@
module.exports = require('../../module.compiled').vendored['react-ssr'].ReactDOMServerEdge;
//# sourceMappingURL=react-dom-server-edge.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../src/server/route-modules/app-page/vendored/ssr/react-dom-server-edge.ts"],"sourcesContent":["module.exports = require('../../module.compiled').vendored[\n 'react-ssr'\n].ReactDOMServerEdge\n"],"names":["module","exports","require","vendored","ReactDOMServerEdge"],"mappings":"AAAAA,OAAOC,OAAO,GAAGC,QAAQ,yBAAyBC,QAAQ,CACxD,YACD,CAACC,kBAAkB"}

View File

@@ -0,0 +1,3 @@
module.exports = require('../../module.compiled').vendored['react-ssr'].ReactDOM;
//# sourceMappingURL=react-dom.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../src/server/route-modules/app-page/vendored/ssr/react-dom.ts"],"sourcesContent":["module.exports = require('../../module.compiled').vendored['react-ssr'].ReactDOM\n"],"names":["module","exports","require","vendored","ReactDOM"],"mappings":"AAAAA,OAAOC,OAAO,GAAGC,QAAQ,yBAAyBC,QAAQ,CAAC,YAAY,CAACC,QAAQ"}

View File

@@ -0,0 +1,3 @@
module.exports = require('../../module.compiled').vendored['react-ssr'].ReactJsxDevRuntime;
//# sourceMappingURL=react-jsx-dev-runtime.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../src/server/route-modules/app-page/vendored/ssr/react-jsx-dev-runtime.ts"],"sourcesContent":["module.exports = require('../../module.compiled').vendored[\n 'react-ssr'\n].ReactJsxDevRuntime\n"],"names":["module","exports","require","vendored","ReactJsxDevRuntime"],"mappings":"AAAAA,OAAOC,OAAO,GAAGC,QAAQ,yBAAyBC,QAAQ,CACxD,YACD,CAACC,kBAAkB"}

View File

@@ -0,0 +1,3 @@
module.exports = require('../../module.compiled').vendored['react-ssr'].ReactJsxRuntime;
//# sourceMappingURL=react-jsx-runtime.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../src/server/route-modules/app-page/vendored/ssr/react-jsx-runtime.ts"],"sourcesContent":["module.exports = require('../../module.compiled').vendored[\n 'react-ssr'\n].ReactJsxRuntime\n"],"names":["module","exports","require","vendored","ReactJsxRuntime"],"mappings":"AAAAA,OAAOC,OAAO,GAAGC,QAAQ,yBAAyBC,QAAQ,CACxD,YACD,CAACC,eAAe"}

View File

@@ -0,0 +1,3 @@
module.exports = require('../../module.compiled').vendored['react-ssr'].ReactServerDOMTurbopackClientEdge;
//# sourceMappingURL=react-server-dom-turbopack-client-edge.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../src/server/route-modules/app-page/vendored/ssr/react-server-dom-turbopack-client-edge.ts"],"sourcesContent":["module.exports = require('../../module.compiled').vendored[\n 'react-ssr'\n].ReactServerDOMTurbopackClientEdge\n"],"names":["module","exports","require","vendored","ReactServerDOMTurbopackClientEdge"],"mappings":"AAAAA,OAAOC,OAAO,GAAGC,QAAQ,yBAAyBC,QAAQ,CACxD,YACD,CAACC,iCAAiC"}

View File

@@ -0,0 +1,3 @@
module.exports = require('../../module.compiled').vendored['react-ssr'].ReactServerDOMWebpackClientEdge;
//# sourceMappingURL=react-server-dom-webpack-client-edge.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../src/server/route-modules/app-page/vendored/ssr/react-server-dom-webpack-client-edge.ts"],"sourcesContent":["module.exports = require('../../module.compiled').vendored[\n 'react-ssr'\n].ReactServerDOMWebpackClientEdge\n"],"names":["module","exports","require","vendored","ReactServerDOMWebpackClientEdge"],"mappings":"AAAAA,OAAOC,OAAO,GAAGC,QAAQ,yBAAyBC,QAAQ,CACxD,YACD,CAACC,+BAA+B"}

View File

@@ -0,0 +1,3 @@
module.exports = require('../../module.compiled').vendored['react-ssr'].React;
//# sourceMappingURL=react.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../src/server/route-modules/app-page/vendored/ssr/react.ts"],"sourcesContent":["module.exports = require('../../module.compiled').vendored['react-ssr'].React\n"],"names":["module","exports","require","vendored","React"],"mappings":"AAAAA,OAAOC,OAAO,GAAGC,QAAQ,yBAAyBC,QAAQ,CAAC,YAAY,CAACC,KAAK"}

View File

@@ -0,0 +1,75 @@
import { HTTP_METHODS } from '../../../web/http';
const AUTOMATIC_ROUTE_METHODS = [
'HEAD',
'OPTIONS'
];
function handleMethodNotAllowedResponse() {
return new Response(null, {
status: 405
});
}
export function autoImplementMethods(handlers) {
// Loop through all the HTTP methods to create the initial methods object.
// Each of the methods will be set to the 405 response handler.
const methods = HTTP_METHODS.reduce((acc, method)=>({
...acc,
// If the userland module implements the method, then use it. Otherwise,
// use the 405 response handler.
[method]: handlers[method] ?? handleMethodNotAllowedResponse
}), {});
// Get all the methods that could be automatically implemented that were not
// implemented by the userland module.
const implemented = new Set(HTTP_METHODS.filter((method)=>handlers[method]));
const missing = AUTOMATIC_ROUTE_METHODS.filter((method)=>!implemented.has(method));
// Loop over the missing methods to automatically implement them if we can.
for (const method of missing){
// If the userland module doesn't implement the HEAD method, then
// we'll automatically implement it by calling the GET method (if it
// exists).
if (method === 'HEAD') {
if (handlers.GET) {
// Implement the HEAD method by calling the GET method.
methods.HEAD = handlers.GET;
// Mark it as implemented.
implemented.add('HEAD');
}
continue;
}
// If OPTIONS is not provided then implement it.
if (method === 'OPTIONS') {
// TODO: check if HEAD is implemented, if so, use it to add more headers
// Get all the methods that were implemented by the userland module.
const allow = [
'OPTIONS',
...implemented
];
// If the list of methods doesn't include HEAD, but it includes GET, then
// add HEAD as it's automatically implemented.
if (!implemented.has('HEAD') && implemented.has('GET')) {
allow.push('HEAD');
}
// Sort and join the list with commas to create the `Allow` header. See:
// https://httpwg.org/specs/rfc9110.html#field.allow
const headers = {
Allow: allow.sort().join(', ')
};
// Implement the OPTIONS method by returning a 204 response with the
// `Allow` header.
methods.OPTIONS = ()=>new Response(null, {
status: 204,
headers
});
// Mark this method as implemented.
implemented.add('OPTIONS');
continue;
}
throw Object.defineProperty(new Error(`Invariant: should handle all automatic implementable methods, got method: ${method}`), "__NEXT_ERROR_CODE", {
value: "E211",
enumerable: false,
configurable: true
});
}
return methods;
}
//# sourceMappingURL=auto-implement-methods.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../src/server/route-modules/app-route/helpers/auto-implement-methods.ts"],"sourcesContent":["import type { AppRouteHandlerFn, AppRouteHandlers } from '../module'\n\nimport { HTTP_METHODS, type HTTP_METHOD } from '../../../web/http'\n\nconst AUTOMATIC_ROUTE_METHODS = ['HEAD', 'OPTIONS'] as const\n\nfunction handleMethodNotAllowedResponse(): Response {\n return new Response(null, { status: 405 })\n}\n\nexport function autoImplementMethods(\n handlers: AppRouteHandlers\n): Record<HTTP_METHOD, AppRouteHandlerFn> {\n // Loop through all the HTTP methods to create the initial methods object.\n // Each of the methods will be set to the 405 response handler.\n const methods: Record<HTTP_METHOD, AppRouteHandlerFn> = HTTP_METHODS.reduce(\n (acc, method) => ({\n ...acc,\n // If the userland module implements the method, then use it. Otherwise,\n // use the 405 response handler.\n [method]: handlers[method] ?? handleMethodNotAllowedResponse,\n }),\n {} as Record<HTTP_METHOD, AppRouteHandlerFn>\n )\n\n // Get all the methods that could be automatically implemented that were not\n // implemented by the userland module.\n const implemented = new Set(HTTP_METHODS.filter((method) => handlers[method]))\n const missing = AUTOMATIC_ROUTE_METHODS.filter(\n (method) => !implemented.has(method)\n )\n\n // Loop over the missing methods to automatically implement them if we can.\n for (const method of missing) {\n // If the userland module doesn't implement the HEAD method, then\n // we'll automatically implement it by calling the GET method (if it\n // exists).\n if (method === 'HEAD') {\n if (handlers.GET) {\n // Implement the HEAD method by calling the GET method.\n methods.HEAD = handlers.GET\n\n // Mark it as implemented.\n implemented.add('HEAD')\n }\n continue\n }\n\n // If OPTIONS is not provided then implement it.\n if (method === 'OPTIONS') {\n // TODO: check if HEAD is implemented, if so, use it to add more headers\n\n // Get all the methods that were implemented by the userland module.\n const allow: HTTP_METHOD[] = ['OPTIONS', ...implemented]\n\n // If the list of methods doesn't include HEAD, but it includes GET, then\n // add HEAD as it's automatically implemented.\n if (!implemented.has('HEAD') && implemented.has('GET')) {\n allow.push('HEAD')\n }\n\n // Sort and join the list with commas to create the `Allow` header. See:\n // https://httpwg.org/specs/rfc9110.html#field.allow\n const headers = { Allow: allow.sort().join(', ') }\n\n // Implement the OPTIONS method by returning a 204 response with the\n // `Allow` header.\n methods.OPTIONS = () => new Response(null, { status: 204, headers })\n\n // Mark this method as implemented.\n implemented.add('OPTIONS')\n\n continue\n }\n\n throw new Error(\n `Invariant: should handle all automatic implementable methods, got method: ${method}`\n )\n }\n\n return methods\n}\n"],"names":["HTTP_METHODS","AUTOMATIC_ROUTE_METHODS","handleMethodNotAllowedResponse","Response","status","autoImplementMethods","handlers","methods","reduce","acc","method","implemented","Set","filter","missing","has","GET","HEAD","add","allow","push","headers","Allow","sort","join","OPTIONS","Error"],"mappings":"AAEA,SAASA,YAAY,QAA0B,oBAAmB;AAElE,MAAMC,0BAA0B;IAAC;IAAQ;CAAU;AAEnD,SAASC;IACP,OAAO,IAAIC,SAAS,MAAM;QAAEC,QAAQ;IAAI;AAC1C;AAEA,OAAO,SAASC,qBACdC,QAA0B;IAE1B,0EAA0E;IAC1E,+DAA+D;IAC/D,MAAMC,UAAkDP,aAAaQ,MAAM,CACzE,CAACC,KAAKC,SAAY,CAAA;YAChB,GAAGD,GAAG;YACN,wEAAwE;YACxE,gCAAgC;YAChC,CAACC,OAAO,EAAEJ,QAAQ,CAACI,OAAO,IAAIR;QAChC,CAAA,GACA,CAAC;IAGH,4EAA4E;IAC5E,sCAAsC;IACtC,MAAMS,cAAc,IAAIC,IAAIZ,aAAaa,MAAM,CAAC,CAACH,SAAWJ,QAAQ,CAACI,OAAO;IAC5E,MAAMI,UAAUb,wBAAwBY,MAAM,CAC5C,CAACH,SAAW,CAACC,YAAYI,GAAG,CAACL;IAG/B,2EAA2E;IAC3E,KAAK,MAAMA,UAAUI,QAAS;QAC5B,iEAAiE;QACjE,oEAAoE;QACpE,WAAW;QACX,IAAIJ,WAAW,QAAQ;YACrB,IAAIJ,SAASU,GAAG,EAAE;gBAChB,uDAAuD;gBACvDT,QAAQU,IAAI,GAAGX,SAASU,GAAG;gBAE3B,0BAA0B;gBAC1BL,YAAYO,GAAG,CAAC;YAClB;YACA;QACF;QAEA,gDAAgD;QAChD,IAAIR,WAAW,WAAW;YACxB,wEAAwE;YAExE,oEAAoE;YACpE,MAAMS,QAAuB;gBAAC;mBAAcR;aAAY;YAExD,yEAAyE;YACzE,8CAA8C;YAC9C,IAAI,CAACA,YAAYI,GAAG,CAAC,WAAWJ,YAAYI,GAAG,CAAC,QAAQ;gBACtDI,MAAMC,IAAI,CAAC;YACb;YAEA,wEAAwE;YACxE,oDAAoD;YACpD,MAAMC,UAAU;gBAAEC,OAAOH,MAAMI,IAAI,GAAGC,IAAI,CAAC;YAAM;YAEjD,oEAAoE;YACpE,kBAAkB;YAClBjB,QAAQkB,OAAO,GAAG,IAAM,IAAItB,SAAS,MAAM;oBAAEC,QAAQ;oBAAKiB;gBAAQ;YAElE,mCAAmC;YACnCV,YAAYO,GAAG,CAAC;YAEhB;QACF;QAEA,MAAM,qBAEL,CAFK,IAAIQ,MACR,CAAC,0EAA0E,EAAEhB,QAAQ,GADjF,qBAAA;mBAAA;wBAAA;0BAAA;QAEN;IACF;IAEA,OAAOH;AACT"}

View File

@@ -0,0 +1,14 @@
/**
* Cleans a URL by stripping the protocol, host, and search params.
*
* @param urlString the url to clean
* @returns the cleaned url
*/ export function cleanURL(url) {
const u = new URL(url);
u.host = 'localhost:3000';
u.search = '';
u.protocol = 'http';
return u;
}
//# sourceMappingURL=clean-url.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../src/server/route-modules/app-route/helpers/clean-url.ts"],"sourcesContent":["/**\n * Cleans a URL by stripping the protocol, host, and search params.\n *\n * @param urlString the url to clean\n * @returns the cleaned url\n */\n\nexport function cleanURL(url: string | URL): URL {\n const u = new URL(url)\n u.host = 'localhost:3000'\n u.search = ''\n u.protocol = 'http'\n return u\n}\n"],"names":["cleanURL","url","u","URL","host","search","protocol"],"mappings":"AAAA;;;;;CAKC,GAED,OAAO,SAASA,SAASC,GAAiB;IACxC,MAAMC,IAAI,IAAIC,IAAIF;IAClBC,EAAEE,IAAI,GAAG;IACTF,EAAEG,MAAM,GAAG;IACXH,EAAEI,QAAQ,GAAG;IACb,OAAOJ;AACT"}

View File

@@ -0,0 +1,19 @@
/**
* Get pathname from absolute path.
*
* @param absolutePath the absolute path
* @returns the pathname
*/ export function getPathnameFromAbsolutePath(absolutePath) {
// Remove prefix including app dir
let appDir = '/app/';
if (!absolutePath.includes(appDir)) {
appDir = '\\app\\';
}
const [, ...parts] = absolutePath.split(appDir);
const relativePath = appDir[0] + parts.join(appDir);
// remove extension
const pathname = relativePath.split('.').slice(0, -1).join('.');
return pathname;
}
//# sourceMappingURL=get-pathname-from-absolute-path.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../src/server/route-modules/app-route/helpers/get-pathname-from-absolute-path.ts"],"sourcesContent":["/**\n * Get pathname from absolute path.\n *\n * @param absolutePath the absolute path\n * @returns the pathname\n */\nexport function getPathnameFromAbsolutePath(absolutePath: string) {\n // Remove prefix including app dir\n let appDir = '/app/'\n if (!absolutePath.includes(appDir)) {\n appDir = '\\\\app\\\\'\n }\n const [, ...parts] = absolutePath.split(appDir)\n const relativePath = appDir[0] + parts.join(appDir)\n\n // remove extension\n const pathname = relativePath.split('.').slice(0, -1).join('.')\n return pathname\n}\n"],"names":["getPathnameFromAbsolutePath","absolutePath","appDir","includes","parts","split","relativePath","join","pathname","slice"],"mappings":"AAAA;;;;;CAKC,GACD,OAAO,SAASA,4BAA4BC,YAAoB;IAC9D,kCAAkC;IAClC,IAAIC,SAAS;IACb,IAAI,CAACD,aAAaE,QAAQ,CAACD,SAAS;QAClCA,SAAS;IACX;IACA,MAAM,GAAG,GAAGE,MAAM,GAAGH,aAAaI,KAAK,CAACH;IACxC,MAAMI,eAAeJ,MAAM,CAAC,EAAE,GAAGE,MAAMG,IAAI,CAACL;IAE5C,mBAAmB;IACnB,MAAMM,WAAWF,aAAaD,KAAK,CAAC,KAAKI,KAAK,CAAC,GAAG,CAAC,GAAGF,IAAI,CAAC;IAC3D,OAAOC;AACT"}

View File

@@ -0,0 +1,12 @@
// route handlers are only statically optimized if they define
// one of these top-level configs manually
// - dynamic = 'force-static'
// - dynamic = 'error'
// - revalidate > 0
// - revalidate = false
// - generateStaticParams
export function isStaticGenEnabled(mod) {
return mod.dynamic === 'force-static' || mod.dynamic === 'error' || mod.revalidate === false || mod.revalidate !== undefined && mod.revalidate > 0 || typeof mod.generateStaticParams == 'function';
}
//# sourceMappingURL=is-static-gen-enabled.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../src/server/route-modules/app-route/helpers/is-static-gen-enabled.ts"],"sourcesContent":["import type { AppRouteModule } from '../module.compiled'\n\n// route handlers are only statically optimized if they define\n// one of these top-level configs manually\n// - dynamic = 'force-static'\n// - dynamic = 'error'\n// - revalidate > 0\n// - revalidate = false\n// - generateStaticParams\nexport function isStaticGenEnabled(\n mod: AppRouteModule['routeModule']['userland']\n) {\n return (\n mod.dynamic === 'force-static' ||\n mod.dynamic === 'error' ||\n mod.revalidate === false ||\n (mod.revalidate !== undefined && mod.revalidate > 0) ||\n typeof mod.generateStaticParams == 'function'\n )\n}\n"],"names":["isStaticGenEnabled","mod","dynamic","revalidate","undefined","generateStaticParams"],"mappings":"AAEA,8DAA8D;AAC9D,0CAA0C;AAC1C,+BAA+B;AAC/B,wBAAwB;AACxB,qBAAqB;AACrB,yBAAyB;AACzB,2BAA2B;AAC3B,OAAO,SAASA,mBACdC,GAA8C;IAE9C,OACEA,IAAIC,OAAO,KAAK,kBAChBD,IAAIC,OAAO,KAAK,WAChBD,IAAIE,UAAU,KAAK,SAClBF,IAAIE,UAAU,KAAKC,aAAaH,IAAIE,UAAU,GAAG,KAClD,OAAOF,IAAII,oBAAoB,IAAI;AAEvC"}

View File

@@ -0,0 +1,15 @@
/**
* Converts the query into params.
*
* @param query the query to convert to params
* @returns the params
*/ export function parsedUrlQueryToParams(query) {
const params = {};
for (const [key, value] of Object.entries(query)){
if (typeof value === 'undefined') continue;
params[key] = value;
}
return params;
}
//# sourceMappingURL=parsed-url-query-to-params.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../src/server/route-modules/app-route/helpers/parsed-url-query-to-params.ts"],"sourcesContent":["import type { ParsedUrlQuery } from 'querystring'\n\n/**\n * Converts the query into params.\n *\n * @param query the query to convert to params\n * @returns the params\n */\nexport function parsedUrlQueryToParams(\n query: ParsedUrlQuery\n): Record<string, string | string[]> {\n const params: Record<string, string | string[]> = {}\n\n for (const [key, value] of Object.entries(query)) {\n if (typeof value === 'undefined') continue\n params[key] = value\n }\n\n return params\n}\n"],"names":["parsedUrlQueryToParams","query","params","key","value","Object","entries"],"mappings":"AAEA;;;;;CAKC,GACD,OAAO,SAASA,uBACdC,KAAqB;IAErB,MAAMC,SAA4C,CAAC;IAEnD,KAAK,MAAM,CAACC,KAAKC,MAAM,IAAIC,OAAOC,OAAO,CAACL,OAAQ;QAChD,IAAI,OAAOG,UAAU,aAAa;QAClCF,MAAM,CAACC,IAAI,GAAGC;IAChB;IAEA,OAAOF;AACT"}

View File

@@ -0,0 +1 @@
export * from './module'

View File

@@ -0,0 +1,35 @@
if (process.env.NEXT_RUNTIME === 'edge') {
module.exports = require('next/dist/server/route-modules/app-route/module.js');
} else {
if (process.env.__NEXT_EXPERIMENTAL_REACT) {
if (process.env.NODE_ENV === 'development') {
if (process.env.TURBOPACK) {
module.exports = require('next/dist/compiled/next-server/app-route-turbo-experimental.runtime.dev.js');
} else {
module.exports = require('next/dist/compiled/next-server/app-route-experimental.runtime.dev.js');
}
} else {
if (process.env.TURBOPACK) {
module.exports = require('next/dist/compiled/next-server/app-route-turbo-experimental.runtime.prod.js');
} else {
module.exports = require('next/dist/compiled/next-server/app-route-experimental.runtime.prod.js');
}
}
} else {
if (process.env.NODE_ENV === 'development') {
if (process.env.TURBOPACK) {
module.exports = require('next/dist/compiled/next-server/app-route-turbo.runtime.dev.js');
} else {
module.exports = require('next/dist/compiled/next-server/app-route.runtime.dev.js');
}
} else {
if (process.env.TURBOPACK) {
module.exports = require('next/dist/compiled/next-server/app-route-turbo.runtime.prod.js');
} else {
module.exports = require('next/dist/compiled/next-server/app-route.runtime.prod.js');
}
}
}
}
//# sourceMappingURL=module.compiled.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/server/route-modules/app-route/module.compiled.js"],"sourcesContent":["if (process.env.NEXT_RUNTIME === 'edge') {\n module.exports = require('next/dist/server/route-modules/app-route/module.js')\n} else {\n if (process.env.__NEXT_EXPERIMENTAL_REACT) {\n if (process.env.NODE_ENV === 'development') {\n if (process.env.TURBOPACK) {\n module.exports = require('next/dist/compiled/next-server/app-route-turbo-experimental.runtime.dev.js')\n } else {\n module.exports = require('next/dist/compiled/next-server/app-route-experimental.runtime.dev.js')\n }\n } else {\n if (process.env.TURBOPACK) {\n module.exports = require('next/dist/compiled/next-server/app-route-turbo-experimental.runtime.prod.js')\n } else {\n module.exports = require('next/dist/compiled/next-server/app-route-experimental.runtime.prod.js')\n }\n }\n } else {\n if (process.env.NODE_ENV === 'development') {\n if (process.env.TURBOPACK) {\n module.exports = require('next/dist/compiled/next-server/app-route-turbo.runtime.dev.js')\n } else {\n module.exports = require('next/dist/compiled/next-server/app-route.runtime.dev.js')\n }\n } else {\n if (process.env.TURBOPACK) {\n module.exports = require('next/dist/compiled/next-server/app-route-turbo.runtime.prod.js')\n } else {\n module.exports = require('next/dist/compiled/next-server/app-route.runtime.prod.js')\n }\n }\n }\n}\n"],"names":["process","env","NEXT_RUNTIME","module","exports","require","__NEXT_EXPERIMENTAL_REACT","NODE_ENV","TURBOPACK"],"mappings":"AAAA,IAAIA,QAAQC,GAAG,CAACC,YAAY,KAAK,QAAQ;IACvCC,OAAOC,OAAO,GAAGC,QAAQ;AAC3B,OAAO;IACL,IAAIL,QAAQC,GAAG,CAACK,yBAAyB,EAAE;QACzC,IAAIN,QAAQC,GAAG,CAACM,QAAQ,KAAK,eAAe;YAC1C,IAAIP,QAAQC,GAAG,CAACO,SAAS,EAAE;gBACzBL,OAAOC,OAAO,GAAGC,QAAQ;YAC3B,OAAO;gBACLF,OAAOC,OAAO,GAAGC,QAAQ;YAC3B;QACF,OAAO;YACL,IAAIL,QAAQC,GAAG,CAACO,SAAS,EAAE;gBACzBL,OAAOC,OAAO,GAAGC,QAAQ;YAC3B,OAAO;gBACLF,OAAOC,OAAO,GAAGC,QAAQ;YAC3B;QACF;IACF,OAAO;QACL,IAAIL,QAAQC,GAAG,CAACM,QAAQ,KAAK,eAAe;YAC1C,IAAIP,QAAQC,GAAG,CAACO,SAAS,EAAE;gBACzBL,OAAOC,OAAO,GAAGC,QAAQ;YAC3B,OAAO;gBACLF,OAAOC,OAAO,GAAGC,QAAQ;YAC3B;QACF,OAAO;YACL,IAAIL,QAAQC,GAAG,CAACO,SAAS,EAAE;gBACzBL,OAAOC,OAAO,GAAGC,QAAQ;YAC3B,OAAO;gBACLF,OAAOC,OAAO,GAAGC,QAAQ;YAC3B;QACF;IACF;AACF"}

View File

@@ -0,0 +1,780 @@
import { RouteModule } from '../route-module';
import { createRequestStoreForAPI } from '../../async-storage/request-store';
import { createWorkStore } from '../../async-storage/work-store';
import { HTTP_METHODS, isHTTPMethod } from '../../web/http';
import { getImplicitTags } from '../../lib/implicit-tags';
import { patchFetch } from '../../lib/patch-fetch';
import { getTracer } from '../../lib/trace/tracer';
import { AppRouteRouteHandlersSpan } from '../../lib/trace/constants';
import { getPathnameFromAbsolutePath } from './helpers/get-pathname-from-absolute-path';
import * as Log from '../../../build/output/log';
import { autoImplementMethods } from './helpers/auto-implement-methods';
import { appendMutableCookies } from '../../web/spec-extension/adapters/request-cookies';
import { HeadersAdapter } from '../../web/spec-extension/adapters/headers';
import { RequestCookiesAdapter } from '../../web/spec-extension/adapters/request-cookies';
import { parsedUrlQueryToParams } from './helpers/parsed-url-query-to-params';
import { printDebugThrownValueForProspectiveRender } from '../../app-render/prospective-render-utils';
import * as serverHooks from '../../../client/components/hooks-server-context';
import { DynamicServerError } from '../../../client/components/hooks-server-context';
import { workAsyncStorage } from '../../app-render/work-async-storage.external';
import { workUnitAsyncStorage } from '../../app-render/work-unit-async-storage.external';
import { actionAsyncStorage } from '../../app-render/action-async-storage.external';
import * as sharedModules from './shared-modules';
import { getIsPossibleServerAction } from '../../lib/server-action-request-meta';
import { RequestCookies } from 'next/dist/compiled/@edge-runtime/cookies';
import { cleanURL } from './helpers/clean-url';
import { StaticGenBailoutError } from '../../../client/components/static-generation-bailout';
import { isStaticGenEnabled } from './helpers/is-static-gen-enabled';
import { abortAndThrowOnSynchronousRequestDataAccess, postponeWithTracking, createDynamicTrackingState, getFirstDynamicReason } from '../../app-render/dynamic-rendering';
import { ReflectAdapter } from '../../web/spec-extension/adapters/reflect';
import { CacheSignal } from '../../app-render/cache-signal';
import { scheduleImmediate } from '../../../lib/scheduler';
import { createServerParamsForRoute } from '../../request/params';
import { getRedirectStatusCodeFromError, getURLFromRedirectError } from '../../../client/components/redirect';
import { isRedirectError } from '../../../client/components/redirect-error';
import { getAccessFallbackHTTPStatus, isHTTPAccessFallbackError } from '../../../client/components/http-access-fallback/http-access-fallback';
import { RedirectStatusCode } from '../../../client/components/redirect-status-code';
import { INFINITE_CACHE } from '../../../lib/constants';
import { executeRevalidates } from '../../revalidation-utils';
export class WrappedNextRouterError {
constructor(error, headers){
this.error = error;
this.headers = headers;
}
}
/**
* AppRouteRouteHandler is the handler for app routes.
*/ export class AppRouteRouteModule extends RouteModule {
static #_ = this.sharedModules = sharedModules;
constructor({ userland, definition, resolvedPagePath, nextConfigOutput }){
super({
userland,
definition
}), /**
* A reference to the request async storage.
*/ this.workUnitAsyncStorage = workUnitAsyncStorage, /**
* A reference to the static generation async storage.
*/ this.workAsyncStorage = workAsyncStorage, /**
* An interface to call server hooks which interact with the underlying
* storage.
*/ this.serverHooks = serverHooks, /**
* A reference to the mutation related async storage, such as mutations of
* cookies.
*/ this.actionAsyncStorage = actionAsyncStorage;
this.resolvedPagePath = resolvedPagePath;
this.nextConfigOutput = nextConfigOutput;
// Automatically implement some methods if they aren't implemented by the
// userland module.
this.methods = autoImplementMethods(userland);
// Get the non-static methods for this route.
this.hasNonStaticMethods = hasNonStaticMethods(userland);
// Get the dynamic property from the userland module.
this.dynamic = this.userland.dynamic;
if (this.nextConfigOutput === 'export') {
if (this.dynamic === 'force-dynamic') {
throw Object.defineProperty(new Error(`export const dynamic = "force-dynamic" on page "${definition.pathname}" cannot be used with "output: export". See more info here: https://nextjs.org/docs/advanced-features/static-html-export`), "__NEXT_ERROR_CODE", {
value: "E278",
enumerable: false,
configurable: true
});
} else if (!isStaticGenEnabled(this.userland) && this.userland['GET']) {
throw Object.defineProperty(new Error(`export const dynamic = "force-static"/export const revalidate not configured on route "${definition.pathname}" with "output: export". See more info here: https://nextjs.org/docs/advanced-features/static-html-export`), "__NEXT_ERROR_CODE", {
value: "E301",
enumerable: false,
configurable: true
});
} else {
this.dynamic = 'error';
}
}
// We only warn in development after here, so return if we're not in
// development.
if (process.env.NODE_ENV === 'development') {
// Print error in development if the exported handlers are in lowercase, only
// uppercase handlers are supported.
const lowercased = HTTP_METHODS.map((method)=>method.toLowerCase());
for (const method of lowercased){
if (method in this.userland) {
Log.error(`Detected lowercase method '${method}' in '${this.resolvedPagePath}'. Export the uppercase '${method.toUpperCase()}' method name to fix this error.`);
}
}
// Print error if the module exports a default handler, they must use named
// exports for each HTTP method.
if ('default' in this.userland) {
Log.error(`Detected default export in '${this.resolvedPagePath}'. Export a named export for each HTTP method instead.`);
}
// If there is no methods exported by this module, then return a not found
// response.
if (!HTTP_METHODS.some((method)=>method in this.userland)) {
Log.error(`No HTTP methods exported in '${this.resolvedPagePath}'. Export a named export for each HTTP method.`);
}
}
}
/**
* Resolves the handler function for the given method.
*
* @param method the requested method
* @returns the handler function for the given method
*/ resolve(method) {
// Ensure that the requested method is a valid method (to prevent RCE's).
if (!isHTTPMethod(method)) return ()=>new Response(null, {
status: 400
});
// Return the handler.
return this.methods[method];
}
async do(handler, actionStore, workStore, // @TODO refactor to not take this argument but instead construct the RequestStore
// inside this function. Right now we get passed a RequestStore even when
// we're going to do a prerender. We should probably just split do up into prexecute and execute
requestStore, implicitTags, request, context) {
var _context_renderOpts_experimental;
const isStaticGeneration = workStore.isStaticGeneration;
const dynamicIOEnabled = !!((_context_renderOpts_experimental = context.renderOpts.experimental) == null ? void 0 : _context_renderOpts_experimental.dynamicIO);
// Patch the global fetch.
patchFetch({
workAsyncStorage: this.workAsyncStorage,
workUnitAsyncStorage: this.workUnitAsyncStorage
});
const handlerContext = {
params: context.params ? createServerParamsForRoute(parsedUrlQueryToParams(context.params), workStore) : undefined
};
const resolvePendingRevalidations = ()=>{
context.renderOpts.pendingWaitUntil = executeRevalidates(workStore).finally(()=>{
if (process.env.NEXT_PRIVATE_DEBUG_CACHE) {
console.log('pending revalidates promise finished for:', requestStore.url);
}
});
};
let prerenderStore = null;
let res;
try {
if (isStaticGeneration) {
const userlandRevalidate = this.userland.revalidate;
const defaultRevalidate = // If the static generation store does not have a revalidate value
// set, then we should set it the revalidate value from the userland
// module or default to false.
userlandRevalidate === false || userlandRevalidate === undefined ? INFINITE_CACHE : userlandRevalidate;
if (dynamicIOEnabled) {
/**
* When we are attempting to statically prerender the GET handler of a route.ts module
* and dynamicIO is on we follow a similar pattern to rendering.
*
* We first run the handler letting caches fill. If something synchronously dynamic occurs
* during this prospective render then we can infer it will happen on every render and we
* just bail out of prerendering.
*
* Next we run the handler again and we check if we get a result back in a microtask.
* Next.js expects the return value to be a Response or a Thenable that resolves to a Response.
* Unfortunately Response's do not allow for accessing the response body synchronously or in
* a microtask so we need to allow one more task to unwrap the response body. This is a slightly
* different semantic than what we have when we render and it means that certain tasks can still
* execute before a prerender completes such as a carefully timed setImmediate.
*
* Functionally though IO should still take longer than the time it takes to unwrap the response body
* so our heuristic of excluding any IO should be preserved.
*/ const prospectiveController = new AbortController();
let prospectiveRenderIsDynamic = false;
const cacheSignal = new CacheSignal();
let dynamicTracking = createDynamicTrackingState(undefined);
const prospectiveRoutePrerenderStore = prerenderStore = {
type: 'prerender',
phase: 'action',
// This replicates prior behavior where rootParams is empty in routes
// TODO we need to make this have the proper rootParams for this route
rootParams: {},
implicitTags,
renderSignal: prospectiveController.signal,
controller: prospectiveController,
cacheSignal,
// During prospective render we don't use a controller
// because we need to let all caches fill.
dynamicTracking,
revalidate: defaultRevalidate,
expire: INFINITE_CACHE,
stale: INFINITE_CACHE,
tags: [
...implicitTags.tags
],
prerenderResumeDataCache: null,
hmrRefreshHash: undefined
};
let prospectiveResult;
try {
prospectiveResult = this.workUnitAsyncStorage.run(prospectiveRoutePrerenderStore, handler, request, handlerContext);
} catch (err) {
if (prospectiveController.signal.aborted) {
// the route handler called an API which is always dynamic
// there is no need to try again
prospectiveRenderIsDynamic = true;
} else if (process.env.NEXT_DEBUG_BUILD || process.env.__NEXT_VERBOSE_LOGGING) {
printDebugThrownValueForProspectiveRender(err, workStore.route);
}
}
if (typeof prospectiveResult === 'object' && prospectiveResult !== null && typeof prospectiveResult.then === 'function') {
// The handler returned a Thenable. We'll listen for rejections to determine
// if the route is erroring for dynamic reasons.
;
prospectiveResult.then(()=>{}, (err)=>{
if (prospectiveController.signal.aborted) {
// the route handler called an API which is always dynamic
// there is no need to try again
prospectiveRenderIsDynamic = true;
} else if (process.env.NEXT_DEBUG_BUILD) {
printDebugThrownValueForProspectiveRender(err, workStore.route);
}
});
}
await cacheSignal.cacheReady();
if (prospectiveRenderIsDynamic) {
// the route handler called an API which is always dynamic
// there is no need to try again
const dynamicReason = getFirstDynamicReason(dynamicTracking);
if (dynamicReason) {
throw Object.defineProperty(new DynamicServerError(`Route ${workStore.route} couldn't be rendered statically because it used \`${dynamicReason}\`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error`), "__NEXT_ERROR_CODE", {
value: "E558",
enumerable: false,
configurable: true
});
} else {
console.error('Expected Next.js to keep track of reason for opting out of static rendering but one was not found. This is a bug in Next.js');
throw Object.defineProperty(new DynamicServerError(`Route ${workStore.route} couldn't be rendered statically because it used a dynamic API. See more info here: https://nextjs.org/docs/messages/dynamic-server-error`), "__NEXT_ERROR_CODE", {
value: "E577",
enumerable: false,
configurable: true
});
}
}
// TODO start passing this controller to the route handler. We should expose
// it so the handler to abort inflight requests and other operations if we abort
// the prerender.
const finalController = new AbortController();
dynamicTracking = createDynamicTrackingState(undefined);
const finalRoutePrerenderStore = prerenderStore = {
type: 'prerender',
phase: 'action',
rootParams: {},
implicitTags,
renderSignal: finalController.signal,
controller: finalController,
cacheSignal: null,
dynamicTracking,
revalidate: defaultRevalidate,
expire: INFINITE_CACHE,
stale: INFINITE_CACHE,
tags: [
...implicitTags.tags
],
prerenderResumeDataCache: null,
hmrRefreshHash: undefined
};
let responseHandled = false;
res = await new Promise((resolve, reject)=>{
scheduleImmediate(async ()=>{
try {
const result = await this.workUnitAsyncStorage.run(finalRoutePrerenderStore, handler, request, handlerContext);
if (responseHandled) {
// we already rejected in the followup task
return;
} else if (!(result instanceof Response)) {
// This is going to error but we let that happen below
resolve(result);
return;
}
responseHandled = true;
let bodyHandled = false;
result.arrayBuffer().then((body)=>{
if (!bodyHandled) {
bodyHandled = true;
resolve(new Response(body, {
headers: result.headers,
status: result.status,
statusText: result.statusText
}));
}
}, reject);
scheduleImmediate(()=>{
if (!bodyHandled) {
bodyHandled = true;
finalController.abort();
reject(createDynamicIOError(workStore.route));
}
});
} catch (err) {
reject(err);
}
});
scheduleImmediate(()=>{
if (!responseHandled) {
responseHandled = true;
finalController.abort();
reject(createDynamicIOError(workStore.route));
}
});
});
if (finalController.signal.aborted) {
// We aborted from within the execution
throw createDynamicIOError(workStore.route);
} else {
// We didn't abort during the execution. We can abort now as a matter of semantics
// though at the moment nothing actually consumes this signal so it won't halt any
// inflight work.
finalController.abort();
}
} else {
prerenderStore = {
type: 'prerender-legacy',
phase: 'action',
rootParams: {},
implicitTags,
revalidate: defaultRevalidate,
expire: INFINITE_CACHE,
stale: INFINITE_CACHE,
tags: [
...implicitTags.tags
]
};
res = await workUnitAsyncStorage.run(prerenderStore, handler, request, handlerContext);
}
} else {
res = await workUnitAsyncStorage.run(requestStore, handler, request, handlerContext);
}
} catch (err) {
if (isRedirectError(err)) {
const url = getURLFromRedirectError(err);
if (!url) {
throw Object.defineProperty(new Error('Invariant: Unexpected redirect url format'), "__NEXT_ERROR_CODE", {
value: "E399",
enumerable: false,
configurable: true
});
}
// We need to capture any headers that should be sent on
// the response.
const headers = new Headers({
Location: url
});
// Let's append any cookies that were added by the
// cookie API.
// TODO leaving the gate here b/c it indicates that we might not actually want to do this
// on every `do` call. During prerender there should be no mutableCookies because
if (requestStore.type === 'request') {
appendMutableCookies(headers, requestStore.mutableCookies);
}
resolvePendingRevalidations();
// Return the redirect response.
return new Response(null, {
// If we're in an action, we want to use a 303 redirect as we don't
// want the POST request to follow the redirect, as it could result in
// erroneous re-submissions.
status: actionStore.isAction ? RedirectStatusCode.SeeOther : getRedirectStatusCodeFromError(err),
headers
});
} else if (isHTTPAccessFallbackError(err)) {
const httpStatus = getAccessFallbackHTTPStatus(err);
return new Response(null, {
status: httpStatus
});
}
throw err;
}
// Validate that the response is a valid response object.
if (!(res instanceof Response)) {
throw Object.defineProperty(new Error(`No response is returned from route handler '${this.resolvedPagePath}'. Ensure you return a \`Response\` or a \`NextResponse\` in all branches of your handler.`), "__NEXT_ERROR_CODE", {
value: "E325",
enumerable: false,
configurable: true
});
}
context.renderOpts.fetchMetrics = workStore.fetchMetrics;
resolvePendingRevalidations();
if (prerenderStore) {
var _prerenderStore_tags;
context.renderOpts.collectedTags = (_prerenderStore_tags = prerenderStore.tags) == null ? void 0 : _prerenderStore_tags.join(',');
context.renderOpts.collectedRevalidate = prerenderStore.revalidate;
context.renderOpts.collectedExpire = prerenderStore.expire;
context.renderOpts.collectedStale = prerenderStore.stale;
}
// It's possible cookies were set in the handler, so we need
// to merge the modified cookies and the returned response
// here.
const headers = new Headers(res.headers);
if (requestStore.type === 'request' && appendMutableCookies(headers, requestStore.mutableCookies)) {
return new Response(res.body, {
status: res.status,
statusText: res.statusText,
headers
});
}
return res;
}
async handle(req, context) {
// Get the handler function for the given method.
const handler = this.resolve(req.method);
// Get the context for the static generation.
const staticGenerationContext = {
// App Routes don't support unknown route params.
fallbackRouteParams: null,
page: this.definition.page,
renderOpts: context.renderOpts,
buildId: context.sharedContext.buildId,
previouslyRevalidatedTags: []
};
// Add the fetchCache option to the renderOpts.
staticGenerationContext.renderOpts.fetchCache = this.userland.fetchCache;
const actionStore = {
isAppRoute: true,
isAction: getIsPossibleServerAction(req)
};
const implicitTags = await getImplicitTags(this.definition.page, req.nextUrl, // App Routes don't support unknown route params.
null);
const requestStore = createRequestStoreForAPI(req, req.nextUrl, implicitTags, undefined, context.prerenderManifest.preview);
const workStore = createWorkStore(staticGenerationContext);
// Run the handler with the request AsyncLocalStorage to inject the helper
// support. We set this to `unknown` because the type is not known until
// runtime when we do a instanceof check below.
const response = await this.actionAsyncStorage.run(actionStore, ()=>this.workUnitAsyncStorage.run(requestStore, ()=>this.workAsyncStorage.run(workStore, async ()=>{
// Check to see if we should bail out of static generation based on
// having non-static methods.
if (this.hasNonStaticMethods) {
if (workStore.isStaticGeneration) {
const err = Object.defineProperty(new DynamicServerError('Route is configured with methods that cannot be statically generated.'), "__NEXT_ERROR_CODE", {
value: "E582",
enumerable: false,
configurable: true
});
workStore.dynamicUsageDescription = err.message;
workStore.dynamicUsageStack = err.stack;
throw err;
}
}
// We assume we can pass the original request through however we may end up
// proxying it in certain circumstances based on execution type and configuration
let request = req;
// Update the static generation store based on the dynamic property.
switch(this.dynamic){
case 'force-dynamic':
{
// Routes of generated paths should be dynamic
workStore.forceDynamic = true;
break;
}
case 'force-static':
// The dynamic property is set to force-static, so we should
// force the page to be static.
workStore.forceStatic = true;
// We also Proxy the request to replace dynamic data on the request
// with empty stubs to allow for safely executing as static
request = new Proxy(req, forceStaticRequestHandlers);
break;
case 'error':
// The dynamic property is set to error, so we should throw an
// error if the page is being statically generated.
workStore.dynamicShouldError = true;
if (workStore.isStaticGeneration) request = new Proxy(req, requireStaticRequestHandlers);
break;
default:
// We proxy `NextRequest` to track dynamic access, and potentially bail out of static generation
request = proxyNextRequest(req, workStore);
}
// TODO: propagate this pathname from route matcher
const route = getPathnameFromAbsolutePath(this.resolvedPagePath);
const tracer = getTracer();
// Update the root span attribute for the route.
tracer.setRootSpanAttribute('next.route', route);
return tracer.trace(AppRouteRouteHandlersSpan.runHandler, {
spanName: `executing api route (app) ${route}`,
attributes: {
'next.route': route
}
}, async ()=>this.do(handler, actionStore, workStore, requestStore, implicitTags, request, context));
})));
// If the handler did't return a valid response, then return the internal
// error response.
if (!(response instanceof Response)) {
// TODO: validate the correct handling behavior, maybe log something?
return new Response(null, {
status: 500
});
}
if (response.headers.has('x-middleware-rewrite')) {
throw Object.defineProperty(new Error('NextResponse.rewrite() was used in a app route handler, this is not currently supported. Please remove the invocation to continue.'), "__NEXT_ERROR_CODE", {
value: "E374",
enumerable: false,
configurable: true
});
}
if (response.headers.get('x-middleware-next') === '1') {
// TODO: move this error into the `NextResponse.next()` function.
throw Object.defineProperty(new Error('NextResponse.next() was used in a app route handler, this is not supported. See here for more info: https://nextjs.org/docs/messages/next-response-next-in-app-route-handler'), "__NEXT_ERROR_CODE", {
value: "E385",
enumerable: false,
configurable: true
});
}
return response;
}
}
export default AppRouteRouteModule;
/**
* Gets all the method names for handlers that are not considered static.
*
* @param handlers the handlers from the userland module
* @returns the method names that are not considered static or false if all
* methods are static
*/ export function hasNonStaticMethods(handlers) {
if (// Order these by how common they are to be used
handlers.POST || handlers.PUT || handlers.DELETE || handlers.PATCH || handlers.OPTIONS) {
return true;
}
return false;
}
// These symbols will be used to stash cached values on Proxied requests without requiring
// additional closures or storage such as WeakMaps.
const nextURLSymbol = Symbol('nextUrl');
const requestCloneSymbol = Symbol('clone');
const urlCloneSymbol = Symbol('clone');
const searchParamsSymbol = Symbol('searchParams');
const hrefSymbol = Symbol('href');
const toStringSymbol = Symbol('toString');
const headersSymbol = Symbol('headers');
const cookiesSymbol = Symbol('cookies');
/**
* The general technique with these proxy handlers is to prioritize keeping them static
* by stashing computed values on the Proxy itself. This is safe because the Proxy is
* inaccessible to the consumer since all operations are forwarded
*/ const forceStaticRequestHandlers = {
get (target, prop, receiver) {
switch(prop){
case 'headers':
return target[headersSymbol] || (target[headersSymbol] = HeadersAdapter.seal(new Headers({})));
case 'cookies':
return target[cookiesSymbol] || (target[cookiesSymbol] = RequestCookiesAdapter.seal(new RequestCookies(new Headers({}))));
case 'nextUrl':
return target[nextURLSymbol] || (target[nextURLSymbol] = new Proxy(target.nextUrl, forceStaticNextUrlHandlers));
case 'url':
// we don't need to separately cache this we can just read the nextUrl
// and return the href since we know it will have been stripped of any
// dynamic parts. We access via the receiver to trigger the get trap
return receiver.nextUrl.href;
case 'geo':
case 'ip':
return undefined;
case 'clone':
return target[requestCloneSymbol] || (target[requestCloneSymbol] = ()=>new Proxy(// This is vaguely unsafe but it's required since NextRequest does not implement
// clone. The reason we might expect this to work in this context is the Proxy will
// respond with static-amenable values anyway somewhat restoring the interface.
// @TODO we need to rethink NextRequest and NextURL because they are not sufficientlly
// sophisticated to adequately represent themselves in all contexts. A better approach is
// to probably embed the static generation logic into the class itself removing the need
// for any kind of proxying
target.clone(), forceStaticRequestHandlers));
default:
return ReflectAdapter.get(target, prop, receiver);
}
}
};
const forceStaticNextUrlHandlers = {
get (target, prop, receiver) {
switch(prop){
// URL properties
case 'search':
return '';
case 'searchParams':
return target[searchParamsSymbol] || (target[searchParamsSymbol] = new URLSearchParams());
case 'href':
return target[hrefSymbol] || (target[hrefSymbol] = cleanURL(target.href).href);
case 'toJSON':
case 'toString':
return target[toStringSymbol] || (target[toStringSymbol] = ()=>receiver.href);
// NextUrl properties
case 'url':
// Currently nextURL does not expose url but our Docs indicate that it is an available property
// I am forcing this to undefined here to avoid accidentally exposing a dynamic value later if
// the underlying nextURL ends up adding this property
return undefined;
case 'clone':
return target[urlCloneSymbol] || (target[urlCloneSymbol] = ()=>new Proxy(target.clone(), forceStaticNextUrlHandlers));
default:
return ReflectAdapter.get(target, prop, receiver);
}
}
};
function proxyNextRequest(request, workStore) {
const nextUrlHandlers = {
get (target, prop, receiver) {
switch(prop){
case 'search':
case 'searchParams':
case 'url':
case 'href':
case 'toJSON':
case 'toString':
case 'origin':
{
const workUnitStore = workUnitAsyncStorage.getStore();
trackDynamic(workStore, workUnitStore, `nextUrl.${prop}`);
return ReflectAdapter.get(target, prop, receiver);
}
case 'clone':
return target[urlCloneSymbol] || (target[urlCloneSymbol] = ()=>new Proxy(target.clone(), nextUrlHandlers));
default:
return ReflectAdapter.get(target, prop, receiver);
}
}
};
const nextRequestHandlers = {
get (target, prop) {
switch(prop){
case 'nextUrl':
return target[nextURLSymbol] || (target[nextURLSymbol] = new Proxy(target.nextUrl, nextUrlHandlers));
case 'headers':
case 'cookies':
case 'url':
case 'body':
case 'blob':
case 'json':
case 'text':
case 'arrayBuffer':
case 'formData':
{
const workUnitStore = workUnitAsyncStorage.getStore();
trackDynamic(workStore, workUnitStore, `request.${prop}`);
// The receiver arg is intentionally the same as the target to fix an issue with
// edge runtime, where attempting to access internal slots with the wrong `this` context
// results in an error.
return ReflectAdapter.get(target, prop, target);
}
case 'clone':
return target[requestCloneSymbol] || (target[requestCloneSymbol] = ()=>new Proxy(// This is vaguely unsafe but it's required since NextRequest does not implement
// clone. The reason we might expect this to work in this context is the Proxy will
// respond with static-amenable values anyway somewhat restoring the interface.
// @TODO we need to rethink NextRequest and NextURL because they are not sufficientlly
// sophisticated to adequately represent themselves in all contexts. A better approach is
// to probably embed the static generation logic into the class itself removing the need
// for any kind of proxying
target.clone(), nextRequestHandlers));
default:
// The receiver arg is intentionally the same as the target to fix an issue with
// edge runtime, where attempting to access internal slots with the wrong `this` context
// results in an error.
return ReflectAdapter.get(target, prop, target);
}
}
};
return new Proxy(request, nextRequestHandlers);
}
const requireStaticRequestHandlers = {
get (target, prop, receiver) {
switch(prop){
case 'nextUrl':
return target[nextURLSymbol] || (target[nextURLSymbol] = new Proxy(target.nextUrl, requireStaticNextUrlHandlers));
case 'headers':
case 'cookies':
case 'url':
case 'body':
case 'blob':
case 'json':
case 'text':
case 'arrayBuffer':
case 'formData':
throw Object.defineProperty(new StaticGenBailoutError(`Route ${target.nextUrl.pathname} with \`dynamic = "error"\` couldn't be rendered statically because it used \`request.${prop}\`.`), "__NEXT_ERROR_CODE", {
value: "E611",
enumerable: false,
configurable: true
});
case 'clone':
return target[requestCloneSymbol] || (target[requestCloneSymbol] = ()=>new Proxy(// This is vaguely unsafe but it's required since NextRequest does not implement
// clone. The reason we might expect this to work in this context is the Proxy will
// respond with static-amenable values anyway somewhat restoring the interface.
// @TODO we need to rethink NextRequest and NextURL because they are not sufficientlly
// sophisticated to adequately represent themselves in all contexts. A better approach is
// to probably embed the static generation logic into the class itself removing the need
// for any kind of proxying
target.clone(), requireStaticRequestHandlers));
default:
return ReflectAdapter.get(target, prop, receiver);
}
}
};
const requireStaticNextUrlHandlers = {
get (target, prop, receiver) {
switch(prop){
case 'search':
case 'searchParams':
case 'url':
case 'href':
case 'toJSON':
case 'toString':
case 'origin':
throw Object.defineProperty(new StaticGenBailoutError(`Route ${target.pathname} with \`dynamic = "error"\` couldn't be rendered statically because it used \`nextUrl.${prop}\`.`), "__NEXT_ERROR_CODE", {
value: "E575",
enumerable: false,
configurable: true
});
case 'clone':
return target[urlCloneSymbol] || (target[urlCloneSymbol] = ()=>new Proxy(target.clone(), requireStaticNextUrlHandlers));
default:
return ReflectAdapter.get(target, prop, receiver);
}
}
};
function createDynamicIOError(route) {
return Object.defineProperty(new DynamicServerError(`Route ${route} couldn't be rendered statically because it used IO that was not cached. See more info here: https://nextjs.org/docs/messages/dynamic-io`), "__NEXT_ERROR_CODE", {
value: "E609",
enumerable: false,
configurable: true
});
}
export function trackDynamic(store, workUnitStore, expression) {
if (workUnitStore) {
if (workUnitStore.type === 'cache') {
throw Object.defineProperty(new Error(`Route ${store.route} used "${expression}" inside "use cache". Accessing Dynamic data sources inside a cache scope is not supported. If you need this data inside a cached function use "${expression}" outside of the cached function and pass the required dynamic data in as an argument. See more info here: https://nextjs.org/docs/messages/next-request-in-use-cache`), "__NEXT_ERROR_CODE", {
value: "E178",
enumerable: false,
configurable: true
});
} else if (workUnitStore.type === 'unstable-cache') {
throw Object.defineProperty(new Error(`Route ${store.route} used "${expression}" inside a function cached with "unstable_cache(...)". Accessing Dynamic data sources inside a cache scope is not supported. If you need this data inside a cached function use "${expression}" outside of the cached function and pass the required dynamic data in as an argument. See more info here: https://nextjs.org/docs/app/api-reference/functions/unstable_cache`), "__NEXT_ERROR_CODE", {
value: "E133",
enumerable: false,
configurable: true
});
}
}
if (store.dynamicShouldError) {
throw Object.defineProperty(new StaticGenBailoutError(`Route ${store.route} with \`dynamic = "error"\` couldn't be rendered statically because it used \`${expression}\`. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering`), "__NEXT_ERROR_CODE", {
value: "E553",
enumerable: false,
configurable: true
});
}
if (workUnitStore) {
if (workUnitStore.type === 'prerender') {
// dynamicIO Prerender
const error = Object.defineProperty(new Error(`Route ${store.route} used ${expression} without first calling \`await connection()\`. See more info here: https://nextjs.org/docs/messages/next-prerender-sync-request`), "__NEXT_ERROR_CODE", {
value: "E261",
enumerable: false,
configurable: true
});
abortAndThrowOnSynchronousRequestDataAccess(store.route, expression, error, workUnitStore);
} else if (workUnitStore.type === 'prerender-ppr') {
// PPR Prerender
postponeWithTracking(store.route, expression, workUnitStore.dynamicTracking);
} else if (workUnitStore.type === 'prerender-legacy') {
// legacy Prerender
workUnitStore.revalidate = 0;
const err = Object.defineProperty(new DynamicServerError(`Route ${store.route} couldn't be rendered statically because it used \`${expression}\`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error`), "__NEXT_ERROR_CODE", {
value: "E558",
enumerable: false,
configurable: true
});
store.dynamicUsageDescription = expression;
store.dynamicUsageStack = err.stack;
throw err;
} else if (process.env.NODE_ENV === 'development' && workUnitStore && workUnitStore.type === 'request') {
workUnitStore.usedDynamic = true;
}
}
}
//# sourceMappingURL=module.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,5 @@
// the name of the export has to be the camelCase version of the file name (without the extension)
// TODO: remove this. We need it because using notFound from next/navigation imports this file :(
export * as appRouterContext from '../../../shared/lib/app-router-context.shared-runtime';
//# sourceMappingURL=shared-modules.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/server/route-modules/app-route/shared-modules.ts"],"sourcesContent":["// the name of the export has to be the camelCase version of the file name (without the extension)\n// TODO: remove this. We need it because using notFound from next/navigation imports this file :(\nexport * as appRouterContext from '../../../shared/lib/app-router-context.shared-runtime'\n"],"names":["appRouterContext"],"mappings":"AAAA,kGAAkG;AAClG,iGAAiG;AACjG,OAAO,KAAKA,gBAAgB,MAAM,wDAAuD"}

View File

@@ -0,0 +1,15 @@
import { RouteKind } from '../route-kind';
export function isAppRouteRouteModule(routeModule) {
return routeModule.definition.kind === RouteKind.APP_ROUTE;
}
export function isAppPageRouteModule(routeModule) {
return routeModule.definition.kind === RouteKind.APP_PAGE;
}
export function isPagesRouteModule(routeModule) {
return routeModule.definition.kind === RouteKind.PAGES;
}
export function isPagesAPIRouteModule(routeModule) {
return routeModule.definition.kind === RouteKind.PAGES_API;
}
//# sourceMappingURL=checks.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/server/route-modules/checks.ts"],"sourcesContent":["import type { AppRouteRouteModule } from './app-route/module'\nimport type { AppPageRouteModule } from './app-page/module'\nimport type { PagesRouteModule } from './pages/module'\nimport type { PagesAPIRouteModule } from './pages-api/module'\n\nimport type { RouteModule } from './route-module'\n\nimport { RouteKind } from '../route-kind'\n\nexport function isAppRouteRouteModule(\n routeModule: RouteModule\n): routeModule is AppRouteRouteModule {\n return routeModule.definition.kind === RouteKind.APP_ROUTE\n}\n\nexport function isAppPageRouteModule(\n routeModule: RouteModule\n): routeModule is AppPageRouteModule {\n return routeModule.definition.kind === RouteKind.APP_PAGE\n}\n\nexport function isPagesRouteModule(\n routeModule: RouteModule\n): routeModule is PagesRouteModule {\n return routeModule.definition.kind === RouteKind.PAGES\n}\n\nexport function isPagesAPIRouteModule(\n routeModule: RouteModule\n): routeModule is PagesAPIRouteModule {\n return routeModule.definition.kind === RouteKind.PAGES_API\n}\n"],"names":["RouteKind","isAppRouteRouteModule","routeModule","definition","kind","APP_ROUTE","isAppPageRouteModule","APP_PAGE","isPagesRouteModule","PAGES","isPagesAPIRouteModule","PAGES_API"],"mappings":"AAOA,SAASA,SAAS,QAAQ,gBAAe;AAEzC,OAAO,SAASC,sBACdC,WAAwB;IAExB,OAAOA,YAAYC,UAAU,CAACC,IAAI,KAAKJ,UAAUK,SAAS;AAC5D;AAEA,OAAO,SAASC,qBACdJ,WAAwB;IAExB,OAAOA,YAAYC,UAAU,CAACC,IAAI,KAAKJ,UAAUO,QAAQ;AAC3D;AAEA,OAAO,SAASC,mBACdN,WAAwB;IAExB,OAAOA,YAAYC,UAAU,CAACC,IAAI,KAAKJ,UAAUS,KAAK;AACxD;AAEA,OAAO,SAASC,sBACdR,WAAwB;IAExB,OAAOA,YAAYC,UAAU,CAACC,IAAI,KAAKJ,UAAUW,SAAS;AAC5D"}

View File

@@ -0,0 +1 @@
export * from './module'

View File

@@ -0,0 +1,19 @@
if (process.env.NEXT_RUNTIME === 'edge') {
module.exports = require('next/dist/server/route-modules/pages-api/module.js');
} else {
if (process.env.NODE_ENV === 'development') {
if (process.env.TURBOPACK) {
module.exports = require('next/dist/compiled/next-server/pages-api-turbo.runtime.dev.js');
} else {
module.exports = require('next/dist/compiled/next-server/pages-api.runtime.dev.js');
}
} else {
if (process.env.TURBOPACK) {
module.exports = require('next/dist/compiled/next-server/pages-api-turbo.runtime.prod.js');
} else {
module.exports = require('next/dist/compiled/next-server/pages-api.runtime.prod.js');
}
}
}
//# sourceMappingURL=module.compiled.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/server/route-modules/pages-api/module.compiled.js"],"sourcesContent":["if (process.env.NEXT_RUNTIME === 'edge') {\n module.exports = require('next/dist/server/route-modules/pages-api/module.js')\n} else {\n if (process.env.NODE_ENV === 'development') {\n if (process.env.TURBOPACK) {\n module.exports = require('next/dist/compiled/next-server/pages-api-turbo.runtime.dev.js')\n } else {\n module.exports = require('next/dist/compiled/next-server/pages-api.runtime.dev.js')\n }\n } else {\n if (process.env.TURBOPACK) {\n module.exports = require('next/dist/compiled/next-server/pages-api-turbo.runtime.prod.js')\n } else {\n module.exports = require('next/dist/compiled/next-server/pages-api.runtime.prod.js')\n }\n }\n}\n"],"names":["process","env","NEXT_RUNTIME","module","exports","require","NODE_ENV","TURBOPACK"],"mappings":"AAAA,IAAIA,QAAQC,GAAG,CAACC,YAAY,KAAK,QAAQ;IACvCC,OAAOC,OAAO,GAAGC,QAAQ;AAC3B,OAAO;IACL,IAAIL,QAAQC,GAAG,CAACK,QAAQ,KAAK,eAAe;QAC1C,IAAIN,QAAQC,GAAG,CAACM,SAAS,EAAE;YACzBJ,OAAOC,OAAO,GAAGC,QAAQ;QAC3B,OAAO;YACLF,OAAOC,OAAO,GAAGC,QAAQ;QAC3B;IACF,OAAO;QACL,IAAIL,QAAQC,GAAG,CAACM,SAAS,EAAE;YACzBJ,OAAOC,OAAO,GAAGC,QAAQ;QAC3B,OAAO;YACLF,OAAOC,OAAO,GAAGC,QAAQ;QAC3B;IACF;AACF"}

View File

@@ -0,0 +1,36 @@
import { wrapApiHandler } from '../../api-utils';
import { RouteModule } from '../route-module';
import { apiResolver } from '../../api-utils/node/api-resolver';
export class PagesAPIRouteModule extends RouteModule {
constructor(options){
super(options);
if (typeof options.userland.default !== 'function') {
throw Object.defineProperty(new Error(`Page ${options.definition.page} does not export a default function.`), "__NEXT_ERROR_CODE", {
value: "E379",
enumerable: false,
configurable: true
});
}
this.apiResolverWrapped = wrapApiHandler(options.definition.page, apiResolver);
}
/**
*
* @param req the incoming server request
* @param res the outgoing server response
* @param context the context for the render
*/ async render(req, res, context) {
const { apiResolverWrapped } = this;
await apiResolverWrapped(req, res, context.query, this.userland, {
...context.previewProps,
revalidate: context.revalidate,
trustHostHeader: context.trustHostHeader,
allowedRevalidateHeaderKeys: context.allowedRevalidateHeaderKeys,
hostname: context.hostname,
multiZoneDraftMode: context.multiZoneDraftMode,
dev: context.dev
}, context.minimalMode, context.dev, context.page, context.onError);
}
}
export default PagesAPIRouteModule;
//# sourceMappingURL=module.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,23 @@
import Document from '../../../../pages/_document';
import App from '../../../../pages/_app';
import { RouteKind } from '../../../route-kind';
import * as moduleError from '../../../../pages/_error';
import PagesRouteModule from '../module';
export const routeModule = new PagesRouteModule({
// TODO: add descriptor for internal error page
definition: {
kind: RouteKind.PAGES,
page: '/_error',
pathname: '/_error',
filename: '',
bundlePath: ''
},
components: {
App,
Document
},
// @ts-expect-error -- Types don't account for getInitialProps. `Error` requires to be instantiated with `statusCode` but the types currently don't guarantee that.
userland: moduleError
});
//# sourceMappingURL=_error.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../src/server/route-modules/pages/builtin/_error.tsx"],"sourcesContent":["import Document from '../../../../pages/_document'\nimport App from '../../../../pages/_app'\nimport { RouteKind } from '../../../route-kind'\n\nimport * as moduleError from '../../../../pages/_error'\n\nimport PagesRouteModule from '../module'\n\nexport const routeModule = new PagesRouteModule({\n // TODO: add descriptor for internal error page\n definition: {\n kind: RouteKind.PAGES,\n page: '/_error',\n pathname: '/_error',\n filename: '',\n bundlePath: '',\n },\n components: {\n App,\n Document,\n },\n // @ts-expect-error -- Types don't account for getInitialProps. `Error` requires to be instantiated with `statusCode` but the types currently don't guarantee that.\n userland: moduleError,\n})\n"],"names":["Document","App","RouteKind","moduleError","PagesRouteModule","routeModule","definition","kind","PAGES","page","pathname","filename","bundlePath","components","userland"],"mappings":"AAAA,OAAOA,cAAc,8BAA6B;AAClD,OAAOC,SAAS,yBAAwB;AACxC,SAASC,SAAS,QAAQ,sBAAqB;AAE/C,YAAYC,iBAAiB,2BAA0B;AAEvD,OAAOC,sBAAsB,YAAW;AAExC,OAAO,MAAMC,cAAc,IAAID,iBAAiB;IAC9C,+CAA+C;IAC/CE,YAAY;QACVC,MAAML,UAAUM,KAAK;QACrBC,MAAM;QACNC,UAAU;QACVC,UAAU;QACVC,YAAY;IACd;IACAC,YAAY;QACVZ;QACAD;IACF;IACA,mKAAmK;IACnKc,UAAUX;AACZ,GAAE"}

View File

@@ -0,0 +1 @@
export * from './module'

View File

@@ -0,0 +1,19 @@
if (process.env.NEXT_RUNTIME === 'edge') {
module.exports = require('next/dist/server/route-modules/pages/module.js');
} else {
if (process.env.NODE_ENV === 'development') {
if (process.env.TURBOPACK) {
module.exports = require('next/dist/compiled/next-server/pages-turbo.runtime.dev.js');
} else {
module.exports = require('next/dist/compiled/next-server/pages.runtime.dev.js');
}
} else {
if (process.env.TURBOPACK) {
module.exports = require('next/dist/compiled/next-server/pages-turbo.runtime.prod.js');
} else {
module.exports = require('next/dist/compiled/next-server/pages.runtime.prod.js');
}
}
}
//# sourceMappingURL=module.compiled.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/server/route-modules/pages/module.compiled.js"],"sourcesContent":["if (process.env.NEXT_RUNTIME === 'edge') {\n module.exports = require('next/dist/server/route-modules/pages/module.js')\n} else {\n if (process.env.NODE_ENV === 'development') {\n if (process.env.TURBOPACK) {\n module.exports = require('next/dist/compiled/next-server/pages-turbo.runtime.dev.js')\n } else {\n module.exports = require('next/dist/compiled/next-server/pages.runtime.dev.js')\n }\n } else {\n if (process.env.TURBOPACK) {\n module.exports = require('next/dist/compiled/next-server/pages-turbo.runtime.prod.js')\n } else {\n module.exports = require('next/dist/compiled/next-server/pages.runtime.prod.js')\n }\n }\n}\n"],"names":["process","env","NEXT_RUNTIME","module","exports","require","NODE_ENV","TURBOPACK"],"mappings":"AAAA,IAAIA,QAAQC,GAAG,CAACC,YAAY,KAAK,QAAQ;IACvCC,OAAOC,OAAO,GAAGC,QAAQ;AAC3B,OAAO;IACL,IAAIL,QAAQC,GAAG,CAACK,QAAQ,KAAK,eAAe;QAC1C,IAAIN,QAAQC,GAAG,CAACM,SAAS,EAAE;YACzBJ,OAAOC,OAAO,GAAGC,QAAQ;QAC3B,OAAO;YACLF,OAAOC,OAAO,GAAGC,QAAQ;QAC3B;IACF,OAAO;QACL,IAAIL,QAAQC,GAAG,CAACM,SAAS,EAAE;YACzBJ,OAAOC,OAAO,GAAGC,QAAQ;QAC3B,OAAO;YACLF,OAAOC,OAAO,GAAGC,QAAQ;QAC3B;IACF;AACF"}

View File

@@ -0,0 +1,23 @@
import { RouteModule } from '../route-module';
import { renderToHTMLImpl, renderToHTML } from '../../render';
import * as vendoredContexts from './vendored/contexts/entrypoints';
export class PagesRouteModule extends RouteModule {
constructor(options){
super(options);
this.components = options.components;
}
render(req, res, context) {
return renderToHTMLImpl(req, res, context.page, context.query, context.renderOpts, {
App: this.components.App,
Document: this.components.Document
}, context.sharedContext, context.renderContext);
}
}
const vendored = {
contexts: vendoredContexts
};
// needed for the static build
export { renderToHTML, vendored };
export default PagesRouteModule;
//# sourceMappingURL=module.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,14 @@
export const lazyRenderPagesPage = (...args)=>{
if (process.env.NEXT_MINIMAL) {
throw Object.defineProperty(new Error("Can't use lazyRenderPagesPage in minimal mode"), "__NEXT_ERROR_CODE", {
value: "E272",
enumerable: false,
configurable: true
});
} else {
const render = require('./module.compiled').renderToHTML;
return render(...args);
}
};
//# sourceMappingURL=module.render.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/server/route-modules/pages/module.render.ts"],"sourcesContent":["import type { PagesRender } from '../../render'\n\nexport const lazyRenderPagesPage: PagesRender = (...args) => {\n if (process.env.NEXT_MINIMAL) {\n throw new Error(\"Can't use lazyRenderPagesPage in minimal mode\")\n } else {\n const render: PagesRender = require('./module.compiled').renderToHTML\n\n return render(...args)\n }\n}\n"],"names":["lazyRenderPagesPage","args","process","env","NEXT_MINIMAL","Error","render","require","renderToHTML"],"mappings":"AAEA,OAAO,MAAMA,sBAAmC,CAAC,GAAGC;IAClD,IAAIC,QAAQC,GAAG,CAACC,YAAY,EAAE;QAC5B,MAAM,qBAA0D,CAA1D,IAAIC,MAAM,kDAAV,qBAAA;mBAAA;wBAAA;0BAAA;QAAyD;IACjE,OAAO;QACL,MAAMC,SAAsBC,QAAQ,qBAAqBC,YAAY;QAErE,OAAOF,UAAUL;IACnB;AACF,EAAC"}

Some files were not shown because too many files have changed in this diff Show More