Initial boiler plate project

This commit is contained in:
2024-09-24 03:52:46 +00:00
parent 6120b2d6c3
commit 154b93e267
10034 changed files with 2079352 additions and 2 deletions

View File

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

View File

@ -0,0 +1,23 @@
if (process.env.NEXT_RUNTIME === "edge") {
module.exports = require("next/dist/server/future/route-modules/app-page/module.js");
} else {
if (process.env.__NEXT_EXPERIMENTAL_REACT) {
if (process.env.NODE_ENV === "development") {
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") {
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/future/route-modules/app-page/module.compiled.js"],"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;YAC1CJ,OAAOC,OAAO,GAAGC,QAAQ;QAC3B,OAAO,IAAIL,QAAQC,GAAG,CAACO,SAAS,EAAE;YAChCL,OAAOC,OAAO,GAAGC,QAAQ;QAC3B,OAAO;YACLF,OAAOC,OAAO,GAAGC,QAAQ;QAC3B;IACF,OAAO;QACL,IAAIL,QAAQC,GAAG,CAACM,QAAQ,KAAK,eAAe;YAC1CJ,OAAOC,OAAO,GAAGC,QAAQ;QAC3B,OAAO,IAAIL,QAAQC,GAAG,CAACO,SAAS,EAAE;YAChCL,OAAOC,OAAO,GAAGC,QAAQ;QAC3B,OAAO;YACLF,OAAOC,OAAO,GAAGC,QAAQ;QAC3B;IACF;AACF"}

View File

@ -0,0 +1,24 @@
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.renderOpts);
}
}
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/future/route-modules/app-page/module.ts"],"names":["renderToHTMLOrFlight","RouteModule","vendoredContexts","vendoredReactRSC","vendoredReactSSR","process","env","NEXT_RUNTIME","require","AppPageRouteModule","render","req","res","context","page","query","renderOpts","vendored","contexts"],"mappings":"AAOA,SAASA,oBAAoB,QAAQ,iCAAgC;AACrE,SACEC,WAAW,QAGN,kBAAiB;AACxB,YAAYC,sBAAsB,kCAAiC;AAEnE,IAAIC;AACJ,IAAIC;AAEJ,gFAAgF;AAChF,IAAIC,QAAQC,GAAG,CAACC,YAAY,KAAK,QAAQ;IACvCJ,mBAAmBK,QAAQ;IAC3BJ,mBAAmBI,QAAQ;AAC7B;AA2BA,OAAO,MAAMC,2BAA2BR;IAI/BS,OACLC,GAAoB,EACpBC,GAAmB,EACnBC,OAAmC,EACZ;QACvB,OAAOb,qBACLW,KACAC,KACAC,QAAQC,IAAI,EACZD,QAAQE,KAAK,EACbF,QAAQG,UAAU;IAEtB;AACF;AAEA,MAAMC,WAAW;IACf,aAAad;IACb,aAAaC;IACbc,UAAUhB;AACZ;AAEA,SAASF,oBAAoB,EAAEiB,QAAQ,GAAE;AAEzC,eAAeR,mBAAkB"}

View File

@ -0,0 +1,10 @@
export const lazyRenderAppPage = (...args)=>{
if (process.env.NEXT_MINIMAL) {
throw new Error("Can't use lazyRenderAppPage in minimal mode");
} 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/future/route-modules/app-page/module.render.ts"],"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,IAAIC,MAAM;IAClB,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/future/route-modules/app-page/vendored/contexts/amp-context.ts"],"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/future/route-modules/app-page/vendored/contexts/app-router-context.ts"],"names":["module","exports","require","vendored","AppRouterContext"],"mappings":"AAAAA,OAAOC,OAAO,GAAGC,QAAQ,yBAAyBC,QAAQ,CACxD,WACD,CAACC,gBAAgB"}

View File

@ -0,0 +1,12 @@
export * as HeadManagerContext from "../../../../../../shared/lib/head-manager-context.shared-runtime";
export * as ServerInsertedHtml from "../../../../../../shared/lib/server-inserted-html.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 HtmlContext from "../../../../../../shared/lib/html-context.shared-runtime";
export * as AmpContext from "../../../../../../shared/lib/amp-context.shared-runtime";
export * as LoadableContext from "../../../../../../shared/lib/loadable-context.shared-runtime";
export * as ImageConfigContext from "../../../../../../shared/lib/image-config-context.shared-runtime";
export * as Loadable from "../../../../../../shared/lib/loadable.shared-runtime";
//# sourceMappingURL=entrypoints.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../../src/server/future/route-modules/app-page/vendored/contexts/entrypoints.ts"],"names":["HeadManagerContext","ServerInsertedHtml","AppRouterContext","HooksClientContext","RouterContext","HtmlContext","AmpContext","LoadableContext","ImageConfigContext","Loadable"],"mappings":"AAAA,OAAO,KAAKA,kBAAkB,MAAM,mEAAkE;AACtG,OAAO,KAAKC,kBAAkB,MAAM,mEAAkE;AACtG,OAAO,KAAKC,gBAAgB,MAAM,iEAAgE;AAClG,OAAO,KAAKC,kBAAkB,MAAM,mEAAkE;AACtG,OAAO,KAAKC,aAAa,MAAM,6DAA4D;AAC3F,OAAO,KAAKC,WAAW,MAAM,2DAA0D;AACvF,OAAO,KAAKC,UAAU,MAAM,0DAAyD;AACrF,OAAO,KAAKC,eAAe,MAAM,+DAA8D;AAC/F,OAAO,KAAKC,kBAAkB,MAAM,mEAAkE;AACtG,OAAO,KAAKC,QAAQ,MAAM,uDAAsD"}

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/future/route-modules/app-page/vendored/contexts/head-manager-context.ts"],"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/future/route-modules/app-page/vendored/contexts/hooks-client-context.ts"],"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"].HtmlContext;
//# sourceMappingURL=html-context.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../../src/server/future/route-modules/app-page/vendored/contexts/html-context.ts"],"names":["module","exports","require","vendored","HtmlContext"],"mappings":"AAAAA,OAAOC,OAAO,GAAGC,QAAQ,yBAAyBC,QAAQ,CACxD,WACD,CAACC,WAAW"}

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/future/route-modules/app-page/vendored/contexts/image-config-context.ts"],"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"].LoadableContext;
//# sourceMappingURL=loadable-context.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../../src/server/future/route-modules/app-page/vendored/contexts/loadable-context.ts"],"names":["module","exports","require","vendored","LoadableContext"],"mappings":"AAAAA,OAAOC,OAAO,GAAGC,QAAQ,yBAAyBC,QAAQ,CACxD,WACD,CAACC,eAAe"}

View File

@ -0,0 +1,3 @@
module.exports = require("../../module.compiled").vendored["contexts"].Loadable;
//# sourceMappingURL=loadable.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../../src/server/future/route-modules/app-page/vendored/contexts/loadable.ts"],"names":["module","exports","require","vendored","Loadable"],"mappings":"AAAAA,OAAOC,OAAO,GAAGC,QAAQ,yBAAyBC,QAAQ,CAAC,WAAW,CAACC,QAAQ"}

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/future/route-modules/app-page/vendored/contexts/router-context.ts"],"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/future/route-modules/app-page/vendored/contexts/server-inserted-html.ts"],"names":["module","exports","require","vendored","ServerInsertedHtml"],"mappings":"AAAAA,OAAOC,OAAO,GAAGC,QAAQ,yBAAyBC,QAAQ,CACxD,WACD,CAACC,kBAAkB"}

View File

@ -0,0 +1,50 @@
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";
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 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.`);
}
});
}
}
let ReactServerDOMTurbopackServerEdge, ReactServerDOMWebpackServerEdge;
let ReactServerDOMTurbopackServerNode, ReactServerDOMWebpackServerNode;
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");
}
} 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");
}
}
if (ReactDOM.version === undefined) {
// FIXME: ReactDOM's 'react-server' entrypoint is missing `.version`,
// which makes our tests fail when it's used, so this is an ugly workaround
// (but should be safe because these are always kept in sync anyway)
// @ts-expect-error
ReactDOM.version = React.version;
}
export { React, ReactJsxDevRuntime, ReactJsxRuntime, ReactDOM, ReactServerDOMWebpackServerEdge, ReactServerDOMTurbopackServerEdge, ReactServerDOMWebpackServerNode, ReactServerDOMTurbopackServerNode, };
//# sourceMappingURL=entrypoints.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../../src/server/future/route-modules/app-page/vendored/rsc/entrypoints.ts"],"names":["React","ReactDOM","ReactJsxDevRuntime","ReactJsxRuntime","getAltProxyForBindingsDEV","type","pkg","process","env","NODE_ENV","altType","altPkg","replace","RegExp","toLowerCase","Proxy","get","_","prop","Error","ReactServerDOMTurbopackServerEdge","ReactServerDOMWebpackServerEdge","ReactServerDOMTurbopackServerNode","ReactServerDOMWebpackServerNode","TURBOPACK","require","version","undefined"],"mappings":"AAAA,YAAYA,WAAW,QAAO;AAC9B,YAAYC,cAAc,YAAW;AACrC,YAAYC,wBAAwB,wBAAuB;AAC3D,YAAYC,qBAAqB,oBAAmB;AAEpD,SAASC,0BACPC,IAA6B,EAC7BC,GAI0C;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,IAAIC,MACR,CAAC,gBAAgB,EAAEd,KAAK,WAAW,EAAEC,IAAI,oDAAoD,EAAEY,KAAK,WAAW,EAAER,QAAQ,WAAW,EAAEC,OAAO,yEAAyE,CAAC;YAE3N;QACF;IAEJ;AACF;AAEA,IAAIS,mCAAmCC;AACvC,IAAIC,mCAAmCC;AAEvC,IAAIhB,QAAQC,GAAG,CAACgB,SAAS,EAAE;IACzB,6DAA6D;IAC7DJ,oCAAoCK,QAAQ;IAC5C,IAAIlB,QAAQC,GAAG,CAACC,QAAQ,KAAK,eAAe;QAC1CY,kCAAkCjB,0BAChC,aACA;IAEJ;IACA,6DAA6D;IAC7DkB,oCAAoCG,QAAQ;IAC5C,IAAIlB,QAAQC,GAAG,CAACC,QAAQ,KAAK,eAAe;QAC1Cc,kCAAkCnB,0BAChC,aACA;IAEJ;AACF,OAAO;IACL,6DAA6D;IAC7DiB,kCAAkCI,QAAQ;IAC1C,IAAIlB,QAAQC,GAAG,CAACC,QAAQ,KAAK,eAAe;QAC1CW,oCAAoChB,0BAClC,WACA;IAEJ;IACA,6DAA6D;IAC7DmB,kCAAkCE,QAAQ;IAC1C,IAAIlB,QAAQC,GAAG,CAACC,QAAQ,KAAK,eAAe;QAC1Ca,oCAAoClB,0BAClC,WACA;IAEJ;AACF;AAEA,IAAIH,SAASyB,OAAO,KAAKC,WAAW;IAClC,qEAAqE;IACrE,2EAA2E;IAC3E,oEAAoE;IACpE,mBAAmB;IACnB1B,SAASyB,OAAO,GAAG1B,MAAM0B,OAAO;AAClC;AAEA,SACE1B,KAAK,EACLE,kBAAkB,EAClBC,eAAe,EACfF,QAAQ,EACRoB,+BAA+B,EAC/BD,iCAAiC,EACjCG,+BAA+B,EAC/BD,iCAAiC,KAClC"}

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/future/route-modules/app-page/vendored/rsc/react-dom.ts"],"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/future/route-modules/app-page/vendored/rsc/react-jsx-dev-runtime.ts"],"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/future/route-modules/app-page/vendored/rsc/react-jsx-runtime.ts"],"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/future/route-modules/app-page/vendored/rsc/react-server-dom-turbopack-server-edge.ts"],"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/future/route-modules/app-page/vendored/rsc/react-server-dom-turbopack-server-node.ts"],"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"].ReactServerDOMWebpackServerEdge;
//# sourceMappingURL=react-server-dom-webpack-server-edge.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../../src/server/future/route-modules/app-page/vendored/rsc/react-server-dom-webpack-server-edge.ts"],"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/future/route-modules/app-page/vendored/rsc/react-server-dom-webpack-server-node.ts"],"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"].React;
//# sourceMappingURL=react.js.map

View File

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

View File

@ -0,0 +1,34 @@
import * as React from "react";
import * as ReactDOM from "react-dom/server-rendering-stub";
import * as ReactJsxDevRuntime from "react/jsx-dev-runtime";
import * as ReactJsxRuntime from "react/jsx-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 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.`);
}
});
}
}
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, ReactDOM, ReactDOMServerEdge, ReactServerDOMTurbopackClientEdge, ReactServerDOMWebpackClientEdge, };
//# sourceMappingURL=entrypoints.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../../src/server/future/route-modules/app-page/vendored/ssr/entrypoints.ts"],"names":["React","ReactDOM","ReactJsxDevRuntime","ReactJsxRuntime","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,kCAAiC;AAC3D,YAAYC,wBAAwB,wBAAuB;AAC3D,YAAYC,qBAAqB,oBAAmB;AAEpD,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,IAAIC,MACR,CAAC,gBAAgB,EAAEd,KAAK,WAAW,EAAEC,IAAI,oDAAoD,EAAEY,KAAK,WAAW,EAAER,QAAQ,WAAW,EAAEC,OAAO,yEAAyE,CAAC;YAE3N;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,SACEL,KAAK,EACLE,kBAAkB,EAClBC,eAAe,EACfF,QAAQ,EACRG,kBAAkB,EAClBiB,iCAAiC,EACjCC,+BAA+B,KAChC"}

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/future/route-modules/app-page/vendored/ssr/react-dom-server-edge.ts"],"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/future/route-modules/app-page/vendored/ssr/react-dom.ts"],"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/future/route-modules/app-page/vendored/ssr/react-jsx-dev-runtime.ts"],"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/future/route-modules/app-page/vendored/ssr/react-jsx-runtime.ts"],"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/future/route-modules/app-page/vendored/ssr/react-server-dom-turbopack-client-edge.ts"],"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/future/route-modules/app-page/vendored/ssr/react-server-dom-webpack-client-edge.ts"],"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/future/route-modules/app-page/vendored/ssr/react.ts"],"names":["module","exports","require","vendored","React"],"mappings":"AAAAA,OAAOC,OAAO,GAAGC,QAAQ,yBAAyBC,QAAQ,CAAC,YAAY,CAACC,KAAK"}

View File

@ -0,0 +1,67 @@
import { HTTP_METHODS } from "../../../../web/http";
import { handleMethodNotAllowedResponse } from "../../helpers/response-handlers";
const AUTOMATIC_ROUTE_METHODS = [
"HEAD",
"OPTIONS"
];
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 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 new Error(`Invariant: should handle all automatic implementable methods, got method: ${method}`);
}
return methods;
}
//# sourceMappingURL=auto-implement-methods.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../src/server/future/route-modules/app-route/helpers/auto-implement-methods.ts"],"names":["HTTP_METHODS","handleMethodNotAllowedResponse","AUTOMATIC_ROUTE_METHODS","autoImplementMethods","handlers","methods","reduce","acc","method","implemented","Set","filter","missing","has","GET","HEAD","add","allow","push","headers","Allow","sort","join","OPTIONS","Response","status","Error"],"mappings":"AAEA,SAASA,YAAY,QAA0B,uBAAsB;AACrE,SAASC,8BAA8B,QAAQ,kCAAiC;AAEhF,MAAMC,0BAA0B;IAAC;IAAQ;CAAU;AAEnD,OAAO,SAASC,qBACdC,QAA0B;IAE1B,0EAA0E;IAC1E,mEAAmE;IACnE,MAAMC,UAAkDL,aAAaM,MAAM,CACzE,CAACC,KAAKC,SAAY,CAAA;YAChB,GAAGD,GAAG;YACN,wEAAwE;YACxE,gCAAgC;YAChC,CAACC,OAAO,EAAEJ,QAAQ,CAACI,OAAO,IAAIP;QAChC,CAAA,GACA,CAAC;IAGH,4EAA4E;IAC5E,sCAAsC;IACtC,MAAMQ,cAAc,IAAIC,IAAIV,aAAaW,MAAM,CAAC,CAACH,SAAWJ,QAAQ,CAACI,OAAO;IAC5E,MAAMI,UAAUV,wBAAwBS,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,IAAIC,SAAS,MAAM;oBAAEC,QAAQ;oBAAKN;gBAAQ;YAElE,mCAAmC;YACnCV,YAAYO,GAAG,CAAC;YAEhB;QACF;QAEA,MAAM,IAAIU,MACR,CAAC,0EAA0E,EAAElB,OAAO,CAAC;IAEzF;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/future/route-modules/app-route/helpers/clean-url.ts"],"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/future/route-modules/app-route/helpers/get-pathname-from-absolute-path.ts"],"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,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/future/route-modules/app-route/helpers/parsed-url-query-to-params.ts"],"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,22 @@
import { isNotFoundError } from "../../../../../client/components/not-found";
import { getURLFromRedirectError, isRedirectError, getRedirectStatusCodeFromError } from "../../../../../client/components/redirect";
import { handleNotFoundResponse, handleRedirectResponse } from "../../helpers/response-handlers";
export function resolveHandlerError(err) {
if (isRedirectError(err)) {
const redirect = getURLFromRedirectError(err);
if (!redirect) {
throw new Error("Invariant: Unexpected redirect url format");
}
const status = getRedirectStatusCodeFromError(err);
// This is a redirect error! Send the redirect response.
return handleRedirectResponse(redirect, err.mutableCookies, status);
}
if (isNotFoundError(err)) {
// This is a not found error! Send the not found response.
return handleNotFoundResponse();
}
// Return false to indicate that this is not a handled error.
return false;
}
//# sourceMappingURL=resolve-handler-error.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../src/server/future/route-modules/app-route/helpers/resolve-handler-error.ts"],"names":["isNotFoundError","getURLFromRedirectError","isRedirectError","getRedirectStatusCodeFromError","handleNotFoundResponse","handleRedirectResponse","resolveHandlerError","err","redirect","Error","status","mutableCookies"],"mappings":"AAAA,SAASA,eAAe,QAAQ,6CAA4C;AAC5E,SACEC,uBAAuB,EACvBC,eAAe,EACfC,8BAA8B,QACzB,4CAA2C;AAClD,SACEC,sBAAsB,EACtBC,sBAAsB,QACjB,kCAAiC;AAExC,OAAO,SAASC,oBAAoBC,GAAQ;IAC1C,IAAIL,gBAAgBK,MAAM;QACxB,MAAMC,WAAWP,wBAAwBM;QACzC,IAAI,CAACC,UAAU;YACb,MAAM,IAAIC,MAAM;QAClB;QAEA,MAAMC,SAASP,+BAA+BI;QAE9C,wDAAwD;QACxD,OAAOF,uBAAuBG,UAAUD,IAAII,cAAc,EAAED;IAC9D;IAEA,IAAIV,gBAAgBO,MAAM;QACxB,0DAA0D;QAC1D,OAAOH;IACT;IAEA,6DAA6D;IAC7D,OAAO;AACT"}

View File

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

View File

@ -0,0 +1,23 @@
if (process.env.NEXT_RUNTIME === "edge") {
module.exports = require("next/dist/server/future/route-modules/app-route/module.js");
} else {
if (process.env.__NEXT_EXPERIMENTAL_REACT) {
if (process.env.NODE_ENV === "development") {
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") {
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/future/route-modules/app-route/module.compiled.js"],"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;YAC1CJ,OAAOC,OAAO,GAAGC,QAAQ;QAC3B,OAAO,IAAIL,QAAQC,GAAG,CAACO,SAAS,EAAE;YAChCL,OAAOC,OAAO,GAAGC,QAAQ;QAC3B,OAAO;YACLF,OAAOC,OAAO,GAAGC,QAAQ;QAC3B;IACF,OAAO;QACL,IAAIL,QAAQC,GAAG,CAACM,QAAQ,KAAK,eAAe;YAC1CJ,OAAOC,OAAO,GAAGC,QAAQ;QAC3B,OAAO,IAAIL,QAAQC,GAAG,CAACO,SAAS,EAAE;YAChCL,OAAOC,OAAO,GAAGC,QAAQ;QAC3B,OAAO;YACLF,OAAOC,OAAO,GAAGC,QAAQ;QAC3B;IACF;AACF"}

View File

@ -0,0 +1,467 @@
import { RouteModule } from "../route-module";
import { RequestAsyncStorageWrapper } from "../../../async-storage/request-async-storage-wrapper";
import { StaticGenerationAsyncStorageWrapper } from "../../../async-storage/static-generation-async-storage-wrapper";
import { handleBadRequestResponse, handleInternalServerErrorResponse } from "../helpers/response-handlers";
import { HTTP_METHODS, isHTTPMethod } from "../../../web/http";
import { addImplicitTags, 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 { resolveHandlerError } from "./helpers/resolve-handler-error";
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 * as serverHooks from "../../../../client/components/hooks-server-context";
import { DynamicServerError } from "../../../../client/components/hooks-server-context";
import { requestAsyncStorage } from "../../../../client/components/request-async-storage.external";
import { staticGenerationAsyncStorage } from "../../../../client/components/static-generation-async-storage.external";
import { actionAsyncStorage } from "../../../../client/components/action-async-storage.external";
import * as sharedModules from "./shared-modules";
import { getIsServerAction } 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 { trackDynamicDataAccessed } from "../../../app-render/dynamic-rendering";
import { ReflectAdapter } from "../../../web/spec-extension/adapters/reflect";
/**
* 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.requestAsyncStorage = requestAsyncStorage;
/**
* A reference to the static generation async storage.
*/ this.staticGenerationAsyncStorage = staticGenerationAsyncStorage;
/**
* 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 || this.dynamic === "auto") {
this.dynamic = "error";
} else if (this.dynamic === "force-dynamic") {
throw 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`);
}
}
// 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 handleBadRequestResponse;
// Return the handler.
return this.methods[method];
}
/**
* Executes the route handler.
*/ async execute(rawRequest, context) {
// Get the handler function for the given method.
const handler = this.resolve(rawRequest.method);
// Get the context for the request.
const requestContext = {
req: rawRequest
};
requestContext.renderOpts = {
previewProps: context.prerenderManifest.preview
};
// Get the context for the static generation.
const staticGenerationContext = {
urlPathname: rawRequest.nextUrl.pathname,
renderOpts: context.renderOpts
};
// Add the fetchCache option to the renderOpts.
staticGenerationContext.renderOpts.fetchCache = this.userland.fetchCache;
// 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({
isAppRoute: true,
isAction: getIsServerAction(rawRequest)
}, ()=>RequestAsyncStorageWrapper.wrap(this.requestAsyncStorage, requestContext, ()=>StaticGenerationAsyncStorageWrapper.wrap(this.staticGenerationAsyncStorage, staticGenerationContext, (staticGenerationStore)=>{
var _getTracer_getRootSpanAttributes;
// Check to see if we should bail out of static generation based on
// having non-static methods.
const isStaticGeneration = staticGenerationStore.isStaticGeneration;
if (this.hasNonStaticMethods) {
if (isStaticGeneration) {
const err = new DynamicServerError("Route is configured with methods that cannot be statically generated.");
staticGenerationStore.dynamicUsageDescription = err.message;
staticGenerationStore.dynamicUsageStack = err.stack;
throw err;
} else {
// We aren't statically generating but since this route has non-static methods
// we still need to set the default caching to no cache by setting revalidate = 0
// @TODO this type of logic is too indirect. we need to refactor how we set fetch cache
// behavior. Prior to the most recent refactor this logic was buried deep in staticGenerationBailout
// so it is possible it was unintentional and then tests were written to assert the current behavior
staticGenerationStore.revalidate = 0;
}
}
// 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 = rawRequest;
// Update the static generation store based on the dynamic property.
switch(this.dynamic){
case "force-dynamic":
{
// Routes of generated paths should be dynamic
staticGenerationStore.forceDynamic = true;
break;
}
case "force-static":
// The dynamic property is set to force-static, so we should
// force the page to be static.
staticGenerationStore.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(rawRequest, forceStaticRequestHandlers);
break;
case "error":
// The dynamic property is set to error, so we should throw an
// error if the page is being statically generated.
staticGenerationStore.dynamicShouldError = true;
if (isStaticGeneration) request = new Proxy(rawRequest, requireStaticRequestHandlers);
break;
default:
// We proxy `NextRequest` to track dynamic access, and potentially bail out of static generation
request = proxyNextRequest(rawRequest, staticGenerationStore);
}
// 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.
staticGenerationStore.revalidate ??= this.userland.revalidate ?? false;
// TODO: propagate this pathname from route matcher
const route = getPathnameFromAbsolutePath(this.resolvedPagePath);
(_getTracer_getRootSpanAttributes = getTracer().getRootSpanAttributes()) == null ? void 0 : _getTracer_getRootSpanAttributes.set("next.route", route);
return getTracer().trace(AppRouteRouteHandlersSpan.runHandler, {
spanName: `executing api route (app) ${route}`,
attributes: {
"next.route": route
}
}, async ()=>{
var _staticGenerationStore_incrementalCache, _staticGenerationStore_tags;
// Patch the global fetch.
patchFetch({
serverHooks: this.serverHooks,
staticGenerationAsyncStorage: this.staticGenerationAsyncStorage
});
const res = await handler(request, {
params: context.params ? parsedUrlQueryToParams(context.params) : undefined
});
if (!(res instanceof Response)) {
throw 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.`);
}
context.renderOpts.fetchMetrics = staticGenerationStore.fetchMetrics;
context.renderOpts.waitUntil = Promise.all([
(_staticGenerationStore_incrementalCache = staticGenerationStore.incrementalCache) == null ? void 0 : _staticGenerationStore_incrementalCache.revalidateTag(staticGenerationStore.revalidatedTags || []),
...Object.values(staticGenerationStore.pendingRevalidates || {})
]);
addImplicitTags(staticGenerationStore);
context.renderOpts.fetchTags = (_staticGenerationStore_tags = staticGenerationStore.tags) == null ? void 0 : _staticGenerationStore_tags.join(",");
// It's possible cookies were set in the handler, so we need
// to merge the modified cookies and the returned response
// here.
const requestStore = this.requestAsyncStorage.getStore();
if (requestStore && requestStore.mutableCookies) {
const headers = new Headers(res.headers);
if (appendMutableCookies(headers, requestStore.mutableCookies)) {
return new Response(res.body, {
status: res.status,
statusText: res.statusText,
headers
});
}
}
return res;
});
})));
// 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 handleInternalServerErrorResponse();
}
if (response.headers.has("x-middleware-rewrite")) {
// TODO: move this error into the `NextResponse.rewrite()` function.
// TODO-APP: re-enable support below when we can proxy these type of requests
throw new Error("NextResponse.rewrite() was used in a app route handler, this is not currently supported. Please remove the invocation to continue.");
// // This is a rewrite created via `NextResponse.rewrite()`. We need to send
// // the response up so it can be handled by the backing server.
// // If the server is running in minimal mode, we just want to forward the
// // response (including the rewrite headers) upstream so it can perform the
// // redirect for us, otherwise return with the special condition so this
// // server can perform a rewrite.
// if (!minimalMode) {
// return { response, condition: 'rewrite' }
// }
// // Relativize the url so it's relative to the base url. This is so the
// // outgoing headers upstream can be relative.
// const rewritePath = response.headers.get('x-middleware-rewrite')!
// const initUrl = getRequestMeta(req, 'initURL')!
// const { pathname } = parseUrl(relativizeURL(rewritePath, initUrl))
// response.headers.set('x-middleware-rewrite', pathname)
}
if (response.headers.get("x-middleware-next") === "1") {
// TODO: move this error into the `NextResponse.next()` function.
throw 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");
}
return response;
}
async handle(request, context) {
try {
// Execute the route to get the response.
const response = await this.execute(request, context);
// The response was handled, return it.
return response;
} catch (err) {
// Try to resolve the error to a response, else throw it again.
const response = resolveHandlerError(err);
if (!response) throw err;
// The response was resolved, return it.
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.POST || 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, staticGenerationStore) {
const nextUrlHandlers = {
get (target, prop, receiver) {
switch(prop){
case "search":
case "searchParams":
case "url":
case "href":
case "toJSON":
case "toString":
case "origin":
{
trackDynamicDataAccessed(staticGenerationStore, `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":
{
trackDynamicDataAccessed(staticGenerationStore, `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 new StaticGenBailoutError(`Route ${target.nextUrl.pathname} with \`dynamic = "error"\` couldn't be rendered statically because it used \`request.${prop}\`.`);
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 new StaticGenBailoutError(`Route ${target.pathname} with \`dynamic = "error"\` couldn't be rendered statically because it used \`nextUrl.${prop}\`.`);
case "clone":
return target[urlCloneSymbol] || (target[urlCloneSymbol] = ()=>new Proxy(target.clone(), requireStaticNextUrlHandlers));
default:
return ReflectAdapter.get(target, prop, receiver);
}
}
};
//# 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/future/route-modules/app-route/shared-modules.ts"],"names":["appRouterContext"],"mappings":"AAAA,kGAAkG;AAClG,iGAAiG;AACjG,OAAO,KAAKA,gBAAgB,MAAM,2DAA0D"}

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/future/route-modules/checks.ts"],"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,33 @@
import { appendMutableCookies } from "../../../web/spec-extension/adapters/request-cookies";
export function handleRedirectResponse(url, mutableCookies, status) {
const headers = new Headers({
location: url
});
appendMutableCookies(headers, mutableCookies);
return new Response(null, {
status,
headers
});
}
export function handleBadRequestResponse() {
return new Response(null, {
status: 400
});
}
export function handleNotFoundResponse() {
return new Response(null, {
status: 404
});
}
export function handleMethodNotAllowedResponse() {
return new Response(null, {
status: 405
});
}
export function handleInternalServerErrorResponse() {
return new Response(null, {
status: 500
});
}
//# sourceMappingURL=response-handlers.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../../../src/server/future/route-modules/helpers/response-handlers.ts"],"names":["appendMutableCookies","handleRedirectResponse","url","mutableCookies","status","headers","Headers","location","Response","handleBadRequestResponse","handleNotFoundResponse","handleMethodNotAllowedResponse","handleInternalServerErrorResponse"],"mappings":"AAAA,SAASA,oBAAoB,QAAQ,uDAAsD;AAG3F,OAAO,SAASC,uBACdC,GAAW,EACXC,cAA+B,EAC/BC,MAAc;IAEd,MAAMC,UAAU,IAAIC,QAAQ;QAAEC,UAAUL;IAAI;IAE5CF,qBAAqBK,SAASF;IAE9B,OAAO,IAAIK,SAAS,MAAM;QAAEJ;QAAQC;IAAQ;AAC9C;AAEA,OAAO,SAASI;IACd,OAAO,IAAID,SAAS,MAAM;QAAEJ,QAAQ;IAAI;AAC1C;AAEA,OAAO,SAASM;IACd,OAAO,IAAIF,SAAS,MAAM;QAAEJ,QAAQ;IAAI;AAC1C;AAEA,OAAO,SAASO;IACd,OAAO,IAAIH,SAAS,MAAM;QAAEJ,QAAQ;IAAI;AAC1C;AAEA,OAAO,SAASQ;IACd,OAAO,IAAIJ,SAAS,MAAM;QAAEJ,QAAQ;IAAI;AAC1C"}

View File

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

View File

@ -0,0 +1,13 @@
if (process.env.NEXT_RUNTIME === "edge") {
module.exports = require("next/dist/server/future/route-modules/pages-api/module.js");
} else {
if (process.env.NODE_ENV === "development") {
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/future/route-modules/pages-api/module.compiled.js"],"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;QAC1CH,OAAOC,OAAO,GAAGC,QAAQ;IAC3B,OAAO,IAAIL,QAAQC,GAAG,CAACM,SAAS,EAAE;QAChCJ,OAAOC,OAAO,GAAGC,QAAQ;IAC3B,OAAO;QACLF,OAAOC,OAAO,GAAGC,QAAQ;IAC3B;AACF"}

View File

@ -0,0 +1,31 @@
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 new Error(`Page ${options.definition.page} does not export a default function.`);
}
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
}, context.minimalMode, context.dev, context.page);
}
}
export default PagesAPIRouteModule;
//# sourceMappingURL=module.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../../../src/server/future/route-modules/pages-api/module.ts"],"names":["wrapApiHandler","RouteModule","apiResolver","PagesAPIRouteModule","constructor","options","userland","default","Error","definition","page","apiResolverWrapped","render","req","res","context","query","previewProps","revalidate","trustHostHeader","allowedRevalidateHeaderKeys","hostname","multiZoneDraftMode","minimalMode","dev"],"mappings":"AAIA,SAASA,cAAc,QAAgC,qBAAoB;AAG3E,SAASC,WAAW,QAAuC,kBAAiB;AAC5E,SAASC,WAAW,QAAQ,uCAAsC;AAmGlE,OAAO,MAAMC,4BAA4BF;IAMvCG,YAAYC,OAAmC,CAAE;QAC/C,KAAK,CAACA;QAEN,IAAI,OAAOA,QAAQC,QAAQ,CAACC,OAAO,KAAK,YAAY;YAClD,MAAM,IAAIC,MACR,CAAC,KAAK,EAAEH,QAAQI,UAAU,CAACC,IAAI,CAAC,oCAAoC,CAAC;QAEzE;QAEA,IAAI,CAACC,kBAAkB,GAAGX,eACxBK,QAAQI,UAAU,CAACC,IAAI,EACvBR;IAEJ;IAEA;;;;;GAKC,GACD,MAAaU,OACXC,GAAoB,EACpBC,GAAmB,EACnBC,OAAoC,EACrB;QACf,MAAM,EAAEJ,kBAAkB,EAAE,GAAG,IAAI;QACnC,MAAMA,mBACJE,KACAC,KACAC,QAAQC,KAAK,EACb,IAAI,CAACV,QAAQ,EACb;YACE,GAAGS,QAAQE,YAAY;YACvBC,YAAYH,QAAQG,UAAU;YAC9BC,iBAAiBJ,QAAQI,eAAe;YACxCC,6BAA6BL,QAAQK,2BAA2B;YAChEC,UAAUN,QAAQM,QAAQ;YAC1BC,oBAAoBP,QAAQO,kBAAkB;QAChD,GACAP,QAAQQ,WAAW,EACnBR,QAAQS,GAAG,EACXT,QAAQL,IAAI;IAEhB;AACF;AAEA,eAAeP,oBAAmB"}

View File

@ -0,0 +1,22 @@
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
},
userland: moduleError
});
//# sourceMappingURL=_error.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../src/server/future/route-modules/pages/builtin/_error.tsx"],"names":["Document","App","RouteKind","moduleError","PagesRouteModule","routeModule","definition","kind","PAGES","page","pathname","filename","bundlePath","components","userland"],"mappings":"AAAA,OAAOA,cAAc,iCAAgC;AACrD,OAAOC,SAAS,4BAA2B;AAC3C,SAASC,SAAS,QAAQ,sBAAqB;AAE/C,YAAYC,iBAAiB,8BAA6B;AAE1D,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;IACAc,UAAUX;AACZ,GAAE"}

View File

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

View File

@ -0,0 +1,13 @@
if (process.env.NEXT_RUNTIME === "edge") {
module.exports = require("next/dist/server/future/route-modules/pages/module.js");
} else {
if (process.env.NODE_ENV === "development") {
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/future/route-modules/pages/module.compiled.js"],"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;QAC1CH,OAAOC,OAAO,GAAGC,QAAQ;IAC3B,OAAO,IAAIL,QAAQC,GAAG,CAACM,SAAS,EAAE;QAChCJ,OAAOC,OAAO,GAAGC,QAAQ;IAC3B,OAAO;QACLF,OAAOC,OAAO,GAAGC,QAAQ;IAC3B;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
});
}
}
const vendored = {
contexts: vendoredContexts
};
// needed for the static build
export { renderToHTML, vendored };
export default PagesRouteModule;
//# sourceMappingURL=module.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../../../src/server/future/route-modules/pages/module.ts"],"names":["RouteModule","renderToHTMLImpl","renderToHTML","vendoredContexts","PagesRouteModule","constructor","options","components","render","req","res","context","page","query","renderOpts","App","Document","vendored","contexts"],"mappings":"AAcA,SACEA,WAAW,QAGN,kBAAiB;AACxB,SAASC,gBAAgB,EAAEC,YAAY,QAAQ,kBAAiB;AAChE,YAAYC,sBAAsB,kCAAiC;AAuFnE,OAAO,MAAMC,yBAAyBJ;IAMpCK,YAAYC,OAAgC,CAAE;QAC5C,KAAK,CAACA;QAEN,IAAI,CAACC,UAAU,GAAGD,QAAQC,UAAU;IACtC;IAEOC,OACLC,GAAoB,EACpBC,GAAmB,EACnBC,OAAiC,EACV;QACvB,OAAOV,iBACLQ,KACAC,KACAC,QAAQC,IAAI,EACZD,QAAQE,KAAK,EACbF,QAAQG,UAAU,EAClB;YACEC,KAAK,IAAI,CAACR,UAAU,CAACQ,GAAG;YACxBC,UAAU,IAAI,CAACT,UAAU,CAACS,QAAQ;QACpC;IAEJ;AACF;AAEA,MAAMC,WAAW;IACfC,UAAUf;AACZ;AAEA,8BAA8B;AAC9B,SAASD,YAAY,EAAEe,QAAQ,GAAE;AAEjC,eAAeb,iBAAgB"}

View File

@ -0,0 +1,10 @@
export const lazyRenderPagesPage = (...args)=>{
if (process.env.NEXT_MINIMAL) {
throw new Error("Can't use lazyRenderPagesPage in minimal mode");
} 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/future/route-modules/pages/module.render.ts"],"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,IAAIC,MAAM;IAClB,OAAO;QACL,MAAMC,SAAsBC,QAAQ,qBAAqBC,YAAY;QAErE,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/future/route-modules/pages/vendored/contexts/amp-context.ts"],"names":["module","exports","require","vendored","AmpContext"],"mappings":"AAAAA,OAAOC,OAAO,GAAGC,QAAQ,yBAAyBC,QAAQ,CACxD,WACD,CAACC,UAAU"}

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