fixed version control heatmap and activity

This commit is contained in:
will
2026-04-02 20:38:56 +01:00
parent 1da5da43e1
commit 250a7030bf
1777 changed files with 170575 additions and 83 deletions

View File

@@ -0,0 +1,124 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "I18NProvider", {
enumerable: true,
get: function() {
return I18NProvider;
}
});
class I18NProvider {
constructor(config){
var _config_domains;
this.config = config;
if (!config.locales.length) {
throw new Error("Invariant: No locales provided");
}
this.lowerCaseLocales = config.locales.map((locale)=>locale.toLowerCase());
this.lowerCaseDomains = (_config_domains = config.domains) == null ? void 0 : _config_domains.map((domainLocale)=>{
var _domainLocale_locales;
const domain = domainLocale.domain.toLowerCase();
return {
defaultLocale: domainLocale.defaultLocale.toLowerCase(),
hostname: domain.split(":", 1)[0],
domain,
locales: (_domainLocale_locales = domainLocale.locales) == null ? void 0 : _domainLocale_locales.map((locale)=>locale.toLowerCase()),
http: domainLocale.http
};
});
}
/**
* Detects the domain locale from the hostname and the detected locale if
* provided.
*
* @param hostname The hostname to detect the domain locale from, this must be lowercased.
* @param detectedLocale The detected locale to use if the hostname does not match.
* @returns The domain locale if found, `undefined` otherwise.
*/ detectDomainLocale(hostname, detectedLocale) {
if (!hostname || !this.lowerCaseDomains || !this.config.domains) return;
if (detectedLocale) detectedLocale = detectedLocale.toLowerCase();
for(let i = 0; i < this.lowerCaseDomains.length; i++){
var // Configuration validation ensures that the locale is not repeated in
// other domains locales.
_domainLocale_locales;
const domainLocale = this.lowerCaseDomains[i];
if (// We assume that the hostname is already lowercased.
domainLocale.hostname === hostname || ((_domainLocale_locales = domainLocale.locales) == null ? void 0 : _domainLocale_locales.some((locale)=>locale === detectedLocale))) {
return this.config.domains[i];
}
}
return;
}
/**
* Pulls the pre-computed locale and inference results from the query
* object.
*
* @param pathname the pathname that could contain a locale prefix
* @param query the query object
* @returns the locale analysis result
*/ fromQuery(pathname, query) {
const detectedLocale = query.__nextLocale;
// If a locale was detected on the query, analyze the pathname to ensure
// that the locale matches.
if (detectedLocale) {
const analysis = this.analyze(pathname);
// If the analysis contained a locale we should validate it against the
// query and strip it from the pathname.
if (analysis.detectedLocale) {
if (analysis.detectedLocale !== detectedLocale) {
throw new Error(`Invariant: The detected locale does not match the locale in the query. Expected to find '${detectedLocale}' in '${pathname}' but found '${analysis.detectedLocale}'}`);
}
pathname = analysis.pathname;
}
}
return {
pathname,
detectedLocale,
inferredFromDefault: query.__nextInferredLocaleFromDefault === "1"
};
}
/**
* Analyzes the pathname for a locale and returns the pathname without it.
*
* @param pathname The pathname that could contain a locale prefix.
* @param options The options to use when matching the locale.
* @returns The matched locale and the pathname without the locale prefix
* (if any).
*/ analyze(pathname, options = {}) {
let detectedLocale = options.defaultLocale;
// By default, we assume that the default locale was inferred if there was
// no detected locale.
let inferredFromDefault = typeof detectedLocale === "string";
// The first segment will be empty, because it has a leading `/`. If
// there is no further segment, there is no locale (or it's the default).
const segments = pathname.split("/", 2);
if (!segments[1]) return {
detectedLocale,
pathname,
inferredFromDefault
};
// The second segment will contain the locale part if any.
const segment = segments[1].toLowerCase();
// See if the segment matches one of the locales. If it doesn't, there is
// no locale (or it's the default).
const index = this.lowerCaseLocales.indexOf(segment);
if (index < 0) return {
detectedLocale,
pathname,
inferredFromDefault
};
// Return the case-sensitive locale.
detectedLocale = this.config.locales[index];
inferredFromDefault = false;
// Remove the `/${locale}` part of the pathname.
pathname = pathname.slice(detectedLocale.length + 1) || "/";
return {
detectedLocale,
pathname,
inferredFromDefault
};
}
}
//# sourceMappingURL=i18n-provider.js.map

View File

@@ -0,0 +1,89 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
INTERCEPTION_ROUTE_MARKERS: null,
extractInterceptionRouteInformation: null,
isInterceptionRouteAppPath: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
INTERCEPTION_ROUTE_MARKERS: function() {
return INTERCEPTION_ROUTE_MARKERS;
},
extractInterceptionRouteInformation: function() {
return extractInterceptionRouteInformation;
},
isInterceptionRouteAppPath: function() {
return isInterceptionRouteAppPath;
}
});
const _apppaths = require("../../../shared/lib/router/utils/app-paths");
const INTERCEPTION_ROUTE_MARKERS = [
"(..)(..)",
"(.)",
"(..)",
"(...)"
];
function isInterceptionRouteAppPath(path) {
// TODO-APP: add more serious validation
return path.split("/").find((segment)=>INTERCEPTION_ROUTE_MARKERS.find((m)=>segment.startsWith(m))) !== undefined;
}
function extractInterceptionRouteInformation(path) {
let interceptingRoute, marker, interceptedRoute;
for (const segment of path.split("/")){
marker = INTERCEPTION_ROUTE_MARKERS.find((m)=>segment.startsWith(m));
if (marker) {
[interceptingRoute, interceptedRoute] = path.split(marker, 2);
break;
}
}
if (!interceptingRoute || !marker || !interceptedRoute) {
throw new Error(`Invalid interception route: ${path}. Must be in the format /<intercepting route>/(..|...|..)(..)/<intercepted route>`);
}
interceptingRoute = (0, _apppaths.normalizeAppPath)(interceptingRoute) // normalize the path, e.g. /(blog)/feed -> /feed
;
switch(marker){
case "(.)":
// (.) indicates that we should match with sibling routes, so we just need to append the intercepted route to the intercepting route
if (interceptingRoute === "/") {
interceptedRoute = `/${interceptedRoute}`;
} else {
interceptedRoute = interceptingRoute + "/" + interceptedRoute;
}
break;
case "(..)":
// (..) indicates that we should match at one level up, so we need to remove the last segment of the intercepting route
if (interceptingRoute === "/") {
throw new Error(`Invalid interception route: ${path}. Cannot use (..) marker at the root level, use (.) instead.`);
}
interceptedRoute = interceptingRoute.split("/").slice(0, -1).concat(interceptedRoute).join("/");
break;
case "(...)":
// (...) will match the route segment in the root directory, so we need to use the root directory to prepend the intercepted route
interceptedRoute = "/" + interceptedRoute;
break;
case "(..)(..)":
// (..)(..) indicates that we should match at two levels up, so we need to remove the last two segments of the intercepting route
const splitInterceptingRoute = interceptingRoute.split("/");
if (splitInterceptingRoute.length <= 2) {
throw new Error(`Invalid interception route: ${path}. Cannot use (..)(..) marker at the root level or one level up.`);
}
interceptedRoute = splitInterceptingRoute.slice(0, -2).concat(interceptedRoute).join("/");
break;
default:
throw new Error("Invariant: unexpected marker");
}
return {
interceptingRoute,
interceptedRoute
};
}
//# sourceMappingURL=interception-routes.js.map

View File

@@ -0,0 +1,21 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "NodeModuleLoader", {
enumerable: true,
get: function() {
return NodeModuleLoader;
}
});
class NodeModuleLoader {
async load(id) {
if (process.env.NEXT_RUNTIME !== "edge") {
// Need to `await` to cover the case that route is marked ESM modules by ESM escalation.
return await (process.env.NEXT_MINIMAL ? __non_webpack_require__(id) : require(id));
}
throw new Error("NodeModuleLoader is not supported in edge runtime.");
}
}
//# sourceMappingURL=node-module-loader.js.map

View File

@@ -0,0 +1,22 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "RouteModuleLoader", {
enumerable: true,
get: function() {
return RouteModuleLoader;
}
});
const _nodemoduleloader = require("./node-module-loader");
class RouteModuleLoader {
static async load(id, loader = new _nodemoduleloader.NodeModuleLoader()) {
const module = await loader.load(id);
if ("routeModule" in module) {
return module.routeModule;
}
throw new Error(`Module "${id}" does not export a routeModule.`);
}
}
//# sourceMappingURL=route-module-loader.js.map

View File

@@ -0,0 +1,33 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "AbsoluteFilenameNormalizer", {
enumerable: true,
get: function() {
return AbsoluteFilenameNormalizer;
}
});
const _absolutepathtopage = require("../../../shared/lib/page-path/absolute-path-to-page");
class AbsoluteFilenameNormalizer {
/**
*
* @param dir the directory for which the files should be made relative to
* @param extensions the extensions the file could have
* @param keepIndex when `true` the trailing `/index` is _not_ removed
*/ constructor(dir, extensions, pagesType){
this.dir = dir;
this.extensions = extensions;
this.pagesType = pagesType;
}
normalize(filename) {
return (0, _absolutepathtopage.absolutePathToPage)(filename, {
extensions: this.extensions,
keepIndex: false,
dir: this.dir,
pagesType: this.pagesType
});
}
}
//# sourceMappingURL=absolute-filename-normalizer.js.map

View File

@@ -0,0 +1,48 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
AppBundlePathNormalizer: null,
DevAppBundlePathNormalizer: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
AppBundlePathNormalizer: function() {
return AppBundlePathNormalizer;
},
DevAppBundlePathNormalizer: function() {
return DevAppBundlePathNormalizer;
}
});
const _normalizers = require("../../normalizers");
const _prefixingnormalizer = require("../../prefixing-normalizer");
const _normalizepagepath = require("../../../../../shared/lib/page-path/normalize-page-path");
class AppBundlePathNormalizer extends _prefixingnormalizer.PrefixingNormalizer {
constructor(){
super("app");
}
normalize(page) {
return super.normalize((0, _normalizepagepath.normalizePagePath)(page));
}
}
class DevAppBundlePathNormalizer extends _normalizers.Normalizers {
constructor(pageNormalizer){
super([
// This should normalize the filename to a page.
pageNormalizer,
// Normalize the app page to a pathname.
new AppBundlePathNormalizer()
]);
}
normalize(filename) {
return super.normalize(filename);
}
}
//# sourceMappingURL=app-bundle-path-normalizer.js.map

View File

@@ -0,0 +1,22 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "AppFilenameNormalizer", {
enumerable: true,
get: function() {
return AppFilenameNormalizer;
}
});
const _constants = require("../../../../../shared/lib/constants");
const _prefixingnormalizer = require("../../prefixing-normalizer");
class AppFilenameNormalizer extends _prefixingnormalizer.PrefixingNormalizer {
constructor(distDir){
super(distDir, _constants.SERVER_DIRECTORY);
}
normalize(manifestFilename) {
return super.normalize(manifestFilename);
}
}
//# sourceMappingURL=app-filename-normalizer.js.map

View File

@@ -0,0 +1,19 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "DevAppPageNormalizer", {
enumerable: true,
get: function() {
return DevAppPageNormalizer;
}
});
const _pagetypes = require("../../../../../lib/page-types");
const _absolutefilenamenormalizer = require("../../absolute-filename-normalizer");
class DevAppPageNormalizer extends _absolutefilenamenormalizer.AbsoluteFilenameNormalizer {
constructor(appDir, extensions){
super(appDir, extensions, _pagetypes.PAGE_TYPES.APP);
}
}
//# sourceMappingURL=app-page-normalizer.js.map

View File

@@ -0,0 +1,55 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
AppPathnameNormalizer: null,
DevAppPathnameNormalizer: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
AppPathnameNormalizer: function() {
return AppPathnameNormalizer;
},
DevAppPathnameNormalizer: function() {
return DevAppPathnameNormalizer;
}
});
const _apppaths = require("../../../../../shared/lib/router/utils/app-paths");
const _normalizers = require("../../normalizers");
const _wrapnormalizerfn = require("../../wrap-normalizer-fn");
const _underscorenormalizer = require("../../underscore-normalizer");
class AppPathnameNormalizer extends _normalizers.Normalizers {
constructor(){
super([
// The pathname to match should have the trailing `/page` and other route
// group information stripped from it.
(0, _wrapnormalizerfn.wrapNormalizerFn)(_apppaths.normalizeAppPath),
// The page should have the `%5F` characters replaced with `_` characters.
new _underscorenormalizer.UnderscoreNormalizer()
]);
}
normalize(page) {
return super.normalize(page);
}
}
class DevAppPathnameNormalizer extends _normalizers.Normalizers {
constructor(pageNormalizer){
super([
// This should normalize the filename to a page.
pageNormalizer,
// Normalize the app page to a pathname.
new AppPathnameNormalizer()
]);
}
normalize(filename) {
return super.normalize(filename);
}
}
//# sourceMappingURL=app-pathname-normalizer.js.map

View File

@@ -0,0 +1,42 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
AppNormalizers: null,
DevAppNormalizers: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
AppNormalizers: function() {
return AppNormalizers;
},
DevAppNormalizers: function() {
return DevAppNormalizers;
}
});
const _appbundlepathnormalizer = require("./app-bundle-path-normalizer");
const _appfilenamenormalizer = require("./app-filename-normalizer");
const _apppagenormalizer = require("./app-page-normalizer");
const _apppathnamenormalizer = require("./app-pathname-normalizer");
class AppNormalizers {
constructor(distDir){
this.filename = new _appfilenamenormalizer.AppFilenameNormalizer(distDir);
this.pathname = new _apppathnamenormalizer.AppPathnameNormalizer();
this.bundlePath = new _appbundlepathnormalizer.AppBundlePathNormalizer();
}
}
class DevAppNormalizers {
constructor(appDir, extensions){
this.page = new _apppagenormalizer.DevAppPageNormalizer(appDir, extensions);
this.pathname = new _apppathnamenormalizer.DevAppPathnameNormalizer(this.page);
this.bundlePath = new _appbundlepathnormalizer.DevAppBundlePathNormalizer(this.page);
}
}
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1,44 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
DevPagesNormalizers: null,
PagesNormalizers: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
DevPagesNormalizers: function() {
return DevPagesNormalizers;
},
PagesNormalizers: function() {
return PagesNormalizers;
}
});
const _pagesbundlepathnormalizer = require("./pages-bundle-path-normalizer");
const _pagesfilenamenormalizer = require("./pages-filename-normalizer");
const _pagespagenormalizer = require("./pages-page-normalizer");
const _pagespathnamenormalizer = require("./pages-pathname-normalizer");
class PagesNormalizers {
constructor(distDir){
this.filename = new _pagesfilenamenormalizer.PagesFilenameNormalizer(distDir);
this.bundlePath = new _pagesbundlepathnormalizer.PagesBundlePathNormalizer();
// You'd think that we'd require a `pathname` normalizer here, but for
// `/pages` we have to handle i18n routes, which means that we need to
// analyze the page path to determine the locale prefix and it's locale.
}
}
class DevPagesNormalizers {
constructor(pagesDir, extensions){
this.page = new _pagespagenormalizer.DevPagesPageNormalizer(pagesDir, extensions);
this.pathname = new _pagespathnamenormalizer.DevPagesPathnameNormalizer(pagesDir, extensions);
this.bundlePath = new _pagesbundlepathnormalizer.DevPagesBundlePathNormalizer(this.page);
}
}
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1,55 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
DevPagesBundlePathNormalizer: null,
PagesBundlePathNormalizer: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
DevPagesBundlePathNormalizer: function() {
return DevPagesBundlePathNormalizer;
},
PagesBundlePathNormalizer: function() {
return PagesBundlePathNormalizer;
}
});
const _normalizepagepath = require("../../../../../shared/lib/page-path/normalize-page-path");
const _normalizers = require("../../normalizers");
const _prefixingnormalizer = require("../../prefixing-normalizer");
const _wrapnormalizerfn = require("../../wrap-normalizer-fn");
class PagesBundlePathNormalizer extends _normalizers.Normalizers {
constructor(){
super([
// The bundle path should have the trailing `/index` stripped from
// it.
(0, _wrapnormalizerfn.wrapNormalizerFn)(_normalizepagepath.normalizePagePath),
// The page should prefixed with `pages/`.
new _prefixingnormalizer.PrefixingNormalizer("pages")
]);
}
normalize(page) {
return super.normalize(page);
}
}
class DevPagesBundlePathNormalizer extends _normalizers.Normalizers {
constructor(pagesNormalizer){
super([
// This should normalize the filename to a page.
pagesNormalizer,
// Normalize the app page to a pathname.
new PagesBundlePathNormalizer()
]);
}
normalize(filename) {
return super.normalize(filename);
}
}
//# sourceMappingURL=pages-bundle-path-normalizer.js.map

View File

@@ -0,0 +1,22 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "PagesFilenameNormalizer", {
enumerable: true,
get: function() {
return PagesFilenameNormalizer;
}
});
const _constants = require("../../../../../shared/lib/constants");
const _prefixingnormalizer = require("../../prefixing-normalizer");
class PagesFilenameNormalizer extends _prefixingnormalizer.PrefixingNormalizer {
constructor(distDir){
super(distDir, _constants.SERVER_DIRECTORY);
}
normalize(manifestFilename) {
return super.normalize(manifestFilename);
}
}
//# sourceMappingURL=pages-filename-normalizer.js.map

View File

@@ -0,0 +1,19 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "DevPagesPageNormalizer", {
enumerable: true,
get: function() {
return DevPagesPageNormalizer;
}
});
const _pagetypes = require("../../../../../lib/page-types");
const _absolutefilenamenormalizer = require("../../absolute-filename-normalizer");
class DevPagesPageNormalizer extends _absolutefilenamenormalizer.AbsoluteFilenameNormalizer {
constructor(pagesDir, extensions){
super(pagesDir, extensions, _pagetypes.PAGE_TYPES.PAGES);
}
}
//# sourceMappingURL=pages-page-normalizer.js.map

View File

@@ -0,0 +1,19 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "DevPagesPathnameNormalizer", {
enumerable: true,
get: function() {
return DevPagesPathnameNormalizer;
}
});
const _pagetypes = require("../../../../../lib/page-types");
const _absolutefilenamenormalizer = require("../../absolute-filename-normalizer");
class DevPagesPathnameNormalizer extends _absolutefilenamenormalizer.AbsoluteFilenameNormalizer {
constructor(pagesDir, extensions){
super(pagesDir, extensions, _pagetypes.PAGE_TYPES.PAGES);
}
}
//# sourceMappingURL=pages-pathname-normalizer.js.map

View File

@@ -0,0 +1,26 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "LocaleRouteNormalizer", {
enumerable: true,
get: function() {
return LocaleRouteNormalizer;
}
});
class LocaleRouteNormalizer {
constructor(provider){
this.provider = provider;
}
/**
* Normalizes the pathname by removing the locale prefix if any.
*
* @param pathname The pathname to normalize.
* @returns The pathname without the locale prefix (if any).
*/ normalize(pathname) {
const match = this.provider.analyze(pathname);
return match.pathname;
}
}
//# sourceMappingURL=locale-route-normalizer.js.map

View File

@@ -0,0 +1,23 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "Normalizers", {
enumerable: true,
get: function() {
return Normalizers;
}
});
class Normalizers {
constructor(normalizers = []){
this.normalizers = normalizers;
}
push(normalizer) {
this.normalizers.push(normalizer);
}
normalize(pathname) {
return this.normalizers.reduce((normalized, normalizer)=>normalizer.normalize(normalized), pathname);
}
}
//# sourceMappingURL=normalizers.js.map

View File

@@ -0,0 +1,26 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "PrefixingNormalizer", {
enumerable: true,
get: function() {
return PrefixingNormalizer;
}
});
const _path = /*#__PURE__*/ _interop_require_default(require("../../../shared/lib/isomorphic/path"));
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
class PrefixingNormalizer {
constructor(...prefixes){
this.prefix = _path.default.posix.join(...prefixes);
}
normalize(pathname) {
return _path.default.posix.join(this.prefix, pathname);
}
}
//# sourceMappingURL=prefixing-normalizer.js.map

View File

@@ -0,0 +1,19 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "ActionPathnameNormalizer", {
enumerable: true,
get: function() {
return ActionPathnameNormalizer;
}
});
const _constants = require("../../../../lib/constants");
const _suffix = require("./suffix");
class ActionPathnameNormalizer extends _suffix.SuffixPathnameNormalizer {
constructor(){
super(_constants.ACTION_SUFFIX);
}
}
//# sourceMappingURL=action.js.map

View File

@@ -0,0 +1,21 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "BasePathPathnameNormalizer", {
enumerable: true,
get: function() {
return BasePathPathnameNormalizer;
}
});
const _prefix = require("./prefix");
class BasePathPathnameNormalizer extends _prefix.PrefixPathnameNormalizer {
constructor(basePath){
if (!basePath || basePath === "/") {
throw new Error('Invariant: basePath must be set and cannot be "/"');
}
super(basePath);
}
}
//# sourceMappingURL=base-path.js.map

View File

@@ -0,0 +1,34 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "NextDataPathnameNormalizer", {
enumerable: true,
get: function() {
return NextDataPathnameNormalizer;
}
});
const _denormalizepagepath = require("../../../../shared/lib/page-path/denormalize-page-path");
const _prefix = require("./prefix");
const _suffix = require("./suffix");
class NextDataPathnameNormalizer {
constructor(buildID){
this.suffix = new _suffix.SuffixPathnameNormalizer(".json");
if (!buildID) {
throw new Error("Invariant: buildID is required");
}
this.prefix = new _prefix.PrefixPathnameNormalizer(`/_next/data/${buildID}`);
}
match(pathname) {
return this.prefix.match(pathname) && this.suffix.match(pathname);
}
normalize(pathname, matched) {
// If we're not matched and we don't match, we don't need to normalize.
if (!matched && !this.match(pathname)) return pathname;
pathname = this.prefix.normalize(pathname, true);
pathname = this.suffix.normalize(pathname, true);
return (0, _denormalizepagepath.denormalizePagePath)(pathname);
}
}
//# sourceMappingURL=next-data.js.map

View File

@@ -0,0 +1,27 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "PostponedPathnameNormalizer", {
enumerable: true,
get: function() {
return PostponedPathnameNormalizer;
}
});
const _denormalizepagepath = require("../../../../shared/lib/page-path/denormalize-page-path");
const _prefix = require("./prefix");
const prefix = "/_next/postponed/resume";
class PostponedPathnameNormalizer extends _prefix.PrefixPathnameNormalizer {
constructor(){
super(prefix);
}
normalize(pathname, matched) {
// If we're not matched and we don't match, we don't need to normalize.
if (!matched && !this.match(pathname)) return pathname;
// Remove the prefix.
pathname = super.normalize(pathname, true);
return (0, _denormalizepagepath.denormalizePagePath)(pathname);
}
}
//# sourceMappingURL=postponed.js.map

View File

@@ -0,0 +1,19 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "PrefetchRSCPathnameNormalizer", {
enumerable: true,
get: function() {
return PrefetchRSCPathnameNormalizer;
}
});
const _constants = require("../../../../lib/constants");
const _suffix = require("./suffix");
class PrefetchRSCPathnameNormalizer extends _suffix.SuffixPathnameNormalizer {
constructor(){
super(_constants.RSC_PREFETCH_SUFFIX);
}
}
//# sourceMappingURL=prefetch-rsc.js.map

View File

@@ -0,0 +1,35 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "PrefixPathnameNormalizer", {
enumerable: true,
get: function() {
return PrefixPathnameNormalizer;
}
});
class PrefixPathnameNormalizer {
constructor(prefix){
this.prefix = prefix;
if (prefix.endsWith("/")) {
throw new Error(`PrefixPathnameNormalizer: prefix "${prefix}" should not end with a slash`);
}
}
match(pathname) {
// If the pathname doesn't start with the prefix, we don't match.
if (pathname !== this.prefix && !pathname.startsWith(this.prefix + "/")) {
return false;
}
return true;
}
normalize(pathname, matched) {
// If we're not matched and we don't match, we don't need to normalize.
if (!matched && !this.match(pathname)) return pathname;
if (pathname.length === this.prefix.length) {
return "/";
}
return pathname.substring(this.prefix.length);
}
}
//# sourceMappingURL=prefix.js.map

View File

@@ -0,0 +1,19 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "RSCPathnameNormalizer", {
enumerable: true,
get: function() {
return RSCPathnameNormalizer;
}
});
const _constants = require("../../../../lib/constants");
const _suffix = require("./suffix");
class RSCPathnameNormalizer extends _suffix.SuffixPathnameNormalizer {
constructor(){
super(_constants.RSC_SUFFIX);
}
}
//# sourceMappingURL=rsc.js.map

View File

@@ -0,0 +1,27 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "SuffixPathnameNormalizer", {
enumerable: true,
get: function() {
return SuffixPathnameNormalizer;
}
});
class SuffixPathnameNormalizer {
constructor(suffix){
this.suffix = suffix;
}
match(pathname) {
// If the pathname doesn't end in the suffix, we don't match.
if (!pathname.endsWith(this.suffix)) return false;
return true;
}
normalize(pathname, matched) {
// If we're not matched and we don't match, we don't need to normalize.
if (!matched && !this.match(pathname)) return pathname;
return pathname.substring(0, pathname.length - this.suffix.length);
}
}
//# sourceMappingURL=suffix.js.map

View File

@@ -0,0 +1,17 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "UnderscoreNormalizer", {
enumerable: true,
get: function() {
return UnderscoreNormalizer;
}
});
class UnderscoreNormalizer {
normalize(pathname) {
return pathname.replace(/%5F/g, "_");
}
}
//# sourceMappingURL=underscore-normalizer.js.map

View File

@@ -0,0 +1,17 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "wrapNormalizerFn", {
enumerable: true,
get: function() {
return wrapNormalizerFn;
}
});
function wrapNormalizerFn(fn) {
return {
normalize: fn
};
}
//# sourceMappingURL=wrap-normalizer-fn.js.map

View File

@@ -0,0 +1,16 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "isAppPageRouteDefinition", {
enumerable: true,
get: function() {
return isAppPageRouteDefinition;
}
});
const _routekind = require("../route-kind");
function isAppPageRouteDefinition(definition) {
return definition.kind === _routekind.RouteKind.APP_PAGE;
}
//# sourceMappingURL=app-page-route-definition.js.map

View File

@@ -0,0 +1,29 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "RouteKind", {
enumerable: true,
get: function() {
return RouteKind;
}
});
var RouteKind;
(function(RouteKind) {
/**
* `PAGES` represents all the React pages that are under `pages/`.
*/ RouteKind["PAGES"] = "PAGES";
/**
* `PAGES_API` represents all the API routes under `pages/api/`.
*/ RouteKind["PAGES_API"] = "PAGES_API";
/**
* `APP_PAGE` represents all the React pages that are under `app/` with the
* filename of `page.{j,t}s{,x}`.
*/ RouteKind["APP_PAGE"] = "APP_PAGE";
/**
* `APP_ROUTE` represents all the API routes and metadata routes that are under `app/` with the
* filename of `route.{j,t}s{,x}`.
*/ RouteKind["APP_ROUTE"] = "APP_ROUTE";
})(RouteKind || (RouteKind = {}));
//# sourceMappingURL=route-kind.js.map

View File

@@ -0,0 +1,227 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "DefaultRouteMatcherManager", {
enumerable: true,
get: function() {
return DefaultRouteMatcherManager;
}
});
const _utils = require("../../../shared/lib/router/utils");
const _localeroutematcher = require("../route-matchers/locale-route-matcher");
const _ensureleadingslash = require("../../../shared/lib/page-path/ensure-leading-slash");
const _detachedpromise = require("../../../lib/detached-promise");
class DefaultRouteMatcherManager {
/**
* When this value changes, it indicates that a change has been introduced
* that requires recompilation.
*/ get compilationID() {
return this.providers.length;
}
async waitTillReady() {
if (this.waitTillReadyPromise) {
await this.waitTillReadyPromise;
delete this.waitTillReadyPromise;
}
}
async reload() {
const { promise, resolve, reject } = new _detachedpromise.DetachedPromise();
this.waitTillReadyPromise = promise;
// Grab the compilation ID for this run, we'll verify it at the end to
// ensure that if any routes were added before reloading is finished that
// we error out.
const compilationID = this.compilationID;
try {
// Collect all the matchers from each provider.
const matchers = [];
// Get all the providers matchers.
const providersMatchers = await Promise.all(this.providers.map((provider)=>provider.matchers()));
// Use this to detect duplicate pathnames.
const all = new Map();
const duplicates = {};
for (const providerMatchers of providersMatchers){
for (const matcher of providerMatchers){
// Reset duplicated matches when reloading from pages conflicting state.
if (matcher.duplicated) delete matcher.duplicated;
// Test to see if the matcher being added is a duplicate.
const duplicate = all.get(matcher.definition.pathname);
if (duplicate) {
// This looks a little weird, but essentially if the pathname
// already exists in the duplicates map, then we got that array
// reference. Otherwise, we create a new array with the original
// duplicate first. Then we push the new matcher into the duplicate
// array, and reset it to the duplicates object (which may be a
// no-op if the pathname already existed in the duplicates object).
// Then we set the array of duplicates on both the original
// duplicate object and the new one, so we can keep them in sync.
// If a new duplicate is found, and it matches an existing pathname,
// the retrieval of the `other` will actually return the array
// reference used by all other duplicates. This is why ReadonlyArray
// is so important! Array's are always references!
const others = duplicates[matcher.definition.pathname] ?? [
duplicate
];
others.push(matcher);
duplicates[matcher.definition.pathname] = others;
// Add duplicated details to each route.
duplicate.duplicated = others;
matcher.duplicated = others;
// TODO: see if we should error for duplicates in production?
}
matchers.push(matcher);
// Add the matcher's pathname to the set.
all.set(matcher.definition.pathname, matcher);
}
}
// Update the duplicate matchers. This is used in the development manager
// to warn about duplicates.
this.matchers.duplicates = duplicates;
// If the cache is the same as what we just parsed, we can exit now. We
// can tell by using the `===` which compares object identity, which for
// the manifest matchers, will return the same matcher each time.
if (this.previousMatchers.length === matchers.length && this.previousMatchers.every((cachedMatcher, index)=>cachedMatcher === matchers[index])) {
return;
}
this.previousMatchers = matchers;
// For matchers that are for static routes, filter them now.
this.matchers.static = matchers.filter((matcher)=>!matcher.isDynamic);
// For matchers that are for dynamic routes, filter them and sort them now.
const dynamic = matchers.filter((matcher)=>matcher.isDynamic);
// As `getSortedRoutes` only takes an array of strings, we need to create
// a map of the pathnames (used for sorting) and the matchers. When we
// have locales, there may be multiple matches for the same pathname. To
// handle this, we keep a map of all the indexes (in `reference`) and
// merge them in later.
const reference = new Map();
const pathnames = new Array();
for(let index = 0; index < dynamic.length; index++){
// Grab the pathname from the definition.
const pathname = dynamic[index].definition.pathname;
// Grab the index in the dynamic array, push it into the reference.
const indexes = reference.get(pathname) ?? [];
indexes.push(index);
// If this is the first one set it. If it isn't, we don't need to
// because pushing above on the array will mutate the array already
// stored there because array's are always a reference!
if (indexes.length === 1) reference.set(pathname, indexes);
else continue;
pathnames.push(pathname);
}
// Sort the array of pathnames.
const sorted = (0, _utils.getSortedRoutes)(pathnames);
// For each of the sorted pathnames, iterate over them, grabbing the list
// of indexes and merging them back into the new `sortedDynamicMatchers`
// array. The order of the same matching pathname doesn't matter because
// they will have other matching characteristics (like the locale) that
// is considered.
const sortedDynamicMatchers = [];
for (const pathname of sorted){
const indexes = reference.get(pathname);
if (!Array.isArray(indexes)) {
throw new Error("Invariant: expected to find identity in indexes map");
}
const dynamicMatches = indexes.map((index)=>dynamic[index]);
sortedDynamicMatchers.push(...dynamicMatches);
}
this.matchers.dynamic = sortedDynamicMatchers;
// This means that there was a new matcher pushed while we were waiting
if (this.compilationID !== compilationID) {
throw new Error("Invariant: expected compilation to finish before new matchers were added, possible missing await");
}
} catch (err) {
reject(err);
} finally{
// The compilation ID matched, so mark the complication as finished.
this.lastCompilationID = compilationID;
resolve();
}
}
push(provider) {
this.providers.push(provider);
}
async test(pathname, options) {
// See if there's a match for the pathname...
const match = await this.match(pathname, options);
// This default implementation only needs to check to see if there _was_ a
// match. The development matcher actually changes it's behavior by not
// recompiling the routes.
return match !== null;
}
async match(pathname, options) {
// "Iterate" over the match options. Once we found a single match, exit with
// it, otherwise return null below. If no match is found, the inner block
// won't be called.
for await (const match of this.matchAll(pathname, options)){
return match;
}
return null;
}
/**
* This is a point for other managers to override to inject other checking
* behavior like duplicate route checking on a per-request basis.
*
* @param pathname the pathname to validate against
* @param matcher the matcher to validate/test with
* @returns the match if found
*/ validate(pathname, matcher, options) {
var _options_i18n;
if (matcher instanceof _localeroutematcher.LocaleRouteMatcher) {
return matcher.match(pathname, options);
}
// If the locale was inferred from the default locale, then it will have
// already added a locale to the pathname. We need to remove it before
// matching because this matcher is not locale aware.
if ((_options_i18n = options.i18n) == null ? void 0 : _options_i18n.inferredFromDefault) {
return matcher.match(options.i18n.pathname);
}
return matcher.match(pathname);
}
async *matchAll(pathname, options) {
// Guard against the matcher manager from being run before it needs to be
// recompiled. This was preferred to re-running the compilation here because
// it should be re-ran only when it changes. If a match is attempted before
// this is done, it indicates that there is a case where a provider is added
// before it was recompiled (an error). We also don't want to affect request
// times.
if (this.lastCompilationID !== this.compilationID) {
throw new Error("Invariant: expected routes to have been loaded before match");
}
// Ensure that path matching is done with a leading slash.
pathname = (0, _ensureleadingslash.ensureLeadingSlash)(pathname);
// If this pathname doesn't look like a dynamic route, and this pathname is
// listed in the normalized list of routes, then return it. This ensures
// that when a route like `/user/[id]` is encountered, it doesn't just match
// with the list of normalized routes.
if (!(0, _utils.isDynamicRoute)(pathname)) {
for (const matcher of this.matchers.static){
const match = this.validate(pathname, matcher, options);
if (!match) continue;
yield match;
}
}
// If we should skip handling dynamic routes, exit now.
if (options == null ? void 0 : options.skipDynamic) return null;
// Loop over the dynamic matchers, yielding each match.
for (const matcher of this.matchers.dynamic){
const match = this.validate(pathname, matcher, options);
if (!match) continue;
yield match;
}
// We tried direct matching against the pathname and against all the dynamic
// paths, so there was no match.
return null;
}
constructor(){
this.providers = [];
this.matchers = {
static: [],
dynamic: [],
duplicates: {}
};
this.lastCompilationID = this.compilationID;
this.previousMatchers = [];
}
}
//# sourceMappingURL=default-route-matcher-manager.js.map

View File

@@ -0,0 +1,126 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "DevRouteMatcherManager", {
enumerable: true,
get: function() {
return DevRouteMatcherManager;
}
});
const _routekind = require("../route-kind");
const _defaultroutematchermanager = require("./default-route-matcher-manager");
const _path = /*#__PURE__*/ _interop_require_default(require("../../../shared/lib/isomorphic/path"));
const _log = /*#__PURE__*/ _interop_require_wildcard(require("../../../build/output/log"));
const _picocolors = require("../../../lib/picocolors");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function _getRequireWildcardCache(nodeInterop) {
if (typeof WeakMap !== "function") return null;
var cacheBabelInterop = new WeakMap();
var cacheNodeInterop = new WeakMap();
return (_getRequireWildcardCache = function(nodeInterop) {
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
})(nodeInterop);
}
function _interop_require_wildcard(obj, nodeInterop) {
if (!nodeInterop && obj && obj.__esModule) {
return obj;
}
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
return {
default: obj
};
}
var cache = _getRequireWildcardCache(nodeInterop);
if (cache && cache.has(obj)) {
return cache.get(obj);
}
var newObj = {
__proto__: null
};
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
for(var key in obj){
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
if (desc && (desc.get || desc.set)) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
newObj.default = obj;
if (cache) {
cache.set(obj, newObj);
}
return newObj;
}
class DevRouteMatcherManager extends _defaultroutematchermanager.DefaultRouteMatcherManager {
constructor(production, ensurer, dir){
super();
this.production = production;
this.ensurer = ensurer;
this.dir = dir;
}
async test(pathname, options) {
// Try to find a match within the developer routes.
const match = await super.match(pathname, options);
// Return if the match wasn't null. Unlike the implementation of `match`
// which uses `matchAll` here, this does not call `ensure` on the match
// found via the development matches.
return match !== null;
}
validate(pathname, matcher, options) {
const match = super.validate(pathname, matcher, options);
// If a match was found, check to see if there were any conflicting app or
// pages files.
// TODO: maybe expand this to _any_ duplicated routes instead?
if (match && matcher.duplicated && matcher.duplicated.some((duplicate)=>duplicate.definition.kind === _routekind.RouteKind.APP_PAGE || duplicate.definition.kind === _routekind.RouteKind.APP_ROUTE) && matcher.duplicated.some((duplicate)=>duplicate.definition.kind === _routekind.RouteKind.PAGES || duplicate.definition.kind === _routekind.RouteKind.PAGES_API)) {
return null;
}
return match;
}
async *matchAll(pathname, options) {
// Compile the development routes.
// TODO: we may want to only run this during testing, users won't be fast enough to require this many dir scans
await super.reload();
// Iterate over the development matches to see if one of them match the
// request path.
for await (const development of super.matchAll(pathname, options)){
// We're here, which means that we haven't seen this match yet, so we
// should try to ensure it and recompile the production matcher.
await this.ensurer.ensure(development, pathname);
await this.production.reload();
// Iterate over the production matches again, this time we should be able
// to match it against the production matcher unless there's an error.
for await (const production of this.production.matchAll(pathname, options)){
yield production;
}
}
// We tried direct matching against the pathname and against all the dynamic
// paths, so there was no match.
return null;
}
async reload() {
// Compile the production routes again.
await this.production.reload();
// Compile the development routes.
await super.reload();
// Check for and warn of any duplicates.
for (const [pathname, matchers] of Object.entries(this.matchers.duplicates)){
// We only want to warn about matchers resolving to the same path if their
// identities are different.
const identity = matchers[0].identity;
if (matchers.slice(1).some((matcher)=>matcher.identity !== identity)) {
continue;
}
_log.warn(`Duplicate page detected. ${matchers.map((matcher)=>(0, _picocolors.cyan)(_path.default.relative(this.dir, matcher.definition.filename))).join(" and ")} resolve to ${(0, _picocolors.cyan)(pathname)}`);
}
}
}
//# sourceMappingURL=dev-route-matcher-manager.js.map

View File

@@ -0,0 +1,55 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "AppPageRouteMatcherProvider", {
enumerable: true,
get: function() {
return AppPageRouteMatcherProvider;
}
});
const _isapppageroute = require("../../../lib/is-app-page-route");
const _constants = require("../../../shared/lib/constants");
const _app = require("../normalizers/built/app");
const _routekind = require("../route-kind");
const _apppageroutematcher = require("../route-matchers/app-page-route-matcher");
const _manifestroutematcherprovider = require("./manifest-route-matcher-provider");
class AppPageRouteMatcherProvider extends _manifestroutematcherprovider.ManifestRouteMatcherProvider {
constructor(distDir, manifestLoader){
super(_constants.APP_PATHS_MANIFEST, manifestLoader);
this.normalizers = new _app.AppNormalizers(distDir);
}
async transform(manifest) {
// This matcher only matches app pages.
const pages = Object.keys(manifest).filter((page)=>(0, _isapppageroute.isAppPageRoute)(page));
// Collect all the app paths for each page. This could include any parallel
// routes.
const allAppPaths = {};
for (const page of pages){
const pathname = this.normalizers.pathname.normalize(page);
if (pathname in allAppPaths) allAppPaths[pathname].push(page);
else allAppPaths[pathname] = [
page
];
}
// Format the routes.
const matchers = [];
for (const [pathname, appPaths] of Object.entries(allAppPaths)){
// TODO-APP: (wyattjoh) this is a hack right now, should be more deterministic
const page = appPaths[0];
const filename = this.normalizers.filename.normalize(manifest[page]);
const bundlePath = this.normalizers.bundlePath.normalize(page);
matchers.push(new _apppageroutematcher.AppPageRouteMatcher({
kind: _routekind.RouteKind.APP_PAGE,
pathname,
page,
bundlePath,
filename,
appPaths
}));
}
return matchers;
}
}
//# sourceMappingURL=app-page-route-matcher-provider.js.map

View File

@@ -0,0 +1,43 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "AppRouteRouteMatcherProvider", {
enumerable: true,
get: function() {
return AppRouteRouteMatcherProvider;
}
});
const _isapprouteroute = require("../../../lib/is-app-route-route");
const _constants = require("../../../shared/lib/constants");
const _routekind = require("../route-kind");
const _approuteroutematcher = require("../route-matchers/app-route-route-matcher");
const _manifestroutematcherprovider = require("./manifest-route-matcher-provider");
const _app = require("../normalizers/built/app");
class AppRouteRouteMatcherProvider extends _manifestroutematcherprovider.ManifestRouteMatcherProvider {
constructor(distDir, manifestLoader){
super(_constants.APP_PATHS_MANIFEST, manifestLoader);
this.normalizers = new _app.AppNormalizers(distDir);
}
async transform(manifest) {
// This matcher only matches app routes.
const pages = Object.keys(manifest).filter((page)=>(0, _isapprouteroute.isAppRouteRoute)(page));
// Format the routes.
const matchers = [];
for (const page of pages){
const filename = this.normalizers.filename.normalize(manifest[page]);
const pathname = this.normalizers.pathname.normalize(page);
const bundlePath = this.normalizers.bundlePath.normalize(page);
matchers.push(new _approuteroutematcher.AppRouteRouteMatcher({
kind: _routekind.RouteKind.APP_ROUTE,
pathname,
page,
bundlePath,
filename
}));
}
return matchers;
}
}
//# sourceMappingURL=app-route-route-matcher-provider.js.map

View File

@@ -0,0 +1,78 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "DevAppPageRouteMatcherProvider", {
enumerable: true,
get: function() {
return DevAppPageRouteMatcherProvider;
}
});
const _apppageroutematcher = require("../../route-matchers/app-page-route-matcher");
const _routekind = require("../../route-kind");
const _filecacheroutematcherprovider = require("./file-cache-route-matcher-provider");
const _app = require("../../normalizers/built/app");
const _normalizecatchallroutes = require("../../../../build/normalize-catchall-routes");
class DevAppPageRouteMatcherProvider extends _filecacheroutematcherprovider.FileCacheRouteMatcherProvider {
constructor(appDir, extensions, reader){
super(appDir, reader);
this.normalizers = new _app.DevAppNormalizers(appDir, extensions);
// Match any page file that ends with `/page.${extension}` or `/default.${extension}` under the app
// directory.
this.expression = new RegExp(`[/\\\\](page|default)\\.(?:${extensions.join("|")})$`);
}
async transform(files) {
// Collect all the app paths for each page. This could include any parallel
// routes.
const cache = new Map();
const routeFilenames = new Array();
let appPaths = {};
for (const filename of files){
// If the file isn't a match for this matcher, then skip it.
if (!this.expression.test(filename)) continue;
const page = this.normalizers.page.normalize(filename);
// Validate that this is not an ignored page.
if (page.includes("/_")) continue;
// This is a valid file that we want to create a matcher for.
routeFilenames.push(filename);
const pathname = this.normalizers.pathname.normalize(filename);
const bundlePath = this.normalizers.bundlePath.normalize(filename);
// Save the normalization results.
cache.set(filename, {
page,
pathname,
bundlePath
});
if (pathname in appPaths) appPaths[pathname].push(page);
else appPaths[pathname] = [
page
];
}
(0, _normalizecatchallroutes.normalizeCatchAllRoutes)(appPaths);
// Make sure to sort parallel routes to make the result deterministic.
appPaths = Object.fromEntries(Object.entries(appPaths).map(([k, v])=>[
k,
v.sort()
]));
const matchers = [];
for (const filename of routeFilenames){
// Grab the cached values (and the appPaths).
const cached = cache.get(filename);
if (!cached) {
throw new Error("Invariant: expected filename to exist in cache");
}
const { pathname, page, bundlePath } = cached;
matchers.push(new _apppageroutematcher.AppPageRouteMatcher({
kind: _routekind.RouteKind.APP_PAGE,
pathname,
page,
bundlePath,
filename,
appPaths: appPaths[pathname]
}));
}
return matchers;
}
}
//# sourceMappingURL=dev-app-page-route-matcher-provider.js.map

View File

@@ -0,0 +1,43 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "DevAppRouteRouteMatcherProvider", {
enumerable: true,
get: function() {
return DevAppRouteRouteMatcherProvider;
}
});
const _approuteroutematcher = require("../../route-matchers/app-route-route-matcher");
const _routekind = require("../../route-kind");
const _filecacheroutematcherprovider = require("./file-cache-route-matcher-provider");
const _isapprouteroute = require("../../../../lib/is-app-route-route");
const _app = require("../../normalizers/built/app");
class DevAppRouteRouteMatcherProvider extends _filecacheroutematcherprovider.FileCacheRouteMatcherProvider {
constructor(appDir, extensions, reader){
super(appDir, reader);
this.normalizers = new _app.DevAppNormalizers(appDir, extensions);
}
async transform(files) {
const matchers = [];
for (const filename of files){
const page = this.normalizers.page.normalize(filename);
// If the file isn't a match for this matcher, then skip it.
if (!(0, _isapprouteroute.isAppRouteRoute)(page)) continue;
// Validate that this is not an ignored page.
if (page.includes("/_")) continue;
const pathname = this.normalizers.pathname.normalize(filename);
const bundlePath = this.normalizers.bundlePath.normalize(filename);
matchers.push(new _approuteroutematcher.AppRouteRouteMatcher({
kind: _routekind.RouteKind.APP_ROUTE,
pathname,
page,
bundlePath,
filename
}));
}
return matchers;
}
}
//# sourceMappingURL=dev-app-route-route-matcher-provider.js.map

View File

@@ -0,0 +1,80 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "DevPagesAPIRouteMatcherProvider", {
enumerable: true,
get: function() {
return DevPagesAPIRouteMatcherProvider;
}
});
const _pagesapiroutematcher = require("../../route-matchers/pages-api-route-matcher");
const _routekind = require("../../route-kind");
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
const _filecacheroutematcherprovider = require("./file-cache-route-matcher-provider");
const _pages = require("../../normalizers/built/pages");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
class DevPagesAPIRouteMatcherProvider extends _filecacheroutematcherprovider.FileCacheRouteMatcherProvider {
constructor(pagesDir, extensions, reader, localeNormalizer){
super(pagesDir, reader);
this.pagesDir = pagesDir;
this.extensions = extensions;
this.localeNormalizer = localeNormalizer;
// Match any route file that ends with `/${filename}.${extension}` under the
// pages directory.
this.expression = new RegExp(`\\.(?:${extensions.join("|")})$`);
this.normalizers = new _pages.DevPagesNormalizers(pagesDir, extensions);
}
test(filename) {
// If the file does not end in the correct extension it's not a match.
if (!this.expression.test(filename)) return false;
// Pages API routes must exist in the pages directory with the `/api/`
// prefix. The pathnames being tested here though are the full filenames,
// so we need to include the pages directory.
// TODO: could path separator normalization be needed here?
if (filename.startsWith(_path.default.join(this.pagesDir, "/api/"))) return true;
for (const extension of this.extensions){
// We can also match if we have `pages/api.${extension}`, so check to
// see if it's a match.
if (filename === _path.default.join(this.pagesDir, `api.${extension}`)) {
return true;
}
}
return false;
}
async transform(files) {
const matchers = [];
for (const filename of files){
// If the file isn't a match for this matcher, then skip it.
if (!this.test(filename)) continue;
const pathname = this.normalizers.pathname.normalize(filename);
const page = this.normalizers.page.normalize(filename);
const bundlePath = this.normalizers.bundlePath.normalize(filename);
if (this.localeNormalizer) {
matchers.push(new _pagesapiroutematcher.PagesAPILocaleRouteMatcher({
kind: _routekind.RouteKind.PAGES_API,
pathname,
page,
bundlePath,
filename,
i18n: {}
}));
} else {
matchers.push(new _pagesapiroutematcher.PagesAPIRouteMatcher({
kind: _routekind.RouteKind.PAGES_API,
pathname,
page,
bundlePath,
filename
}));
}
}
return matchers;
}
}
//# sourceMappingURL=dev-pages-api-route-matcher-provider.js.map

View File

@@ -0,0 +1,80 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "DevPagesRouteMatcherProvider", {
enumerable: true,
get: function() {
return DevPagesRouteMatcherProvider;
}
});
const _pagesroutematcher = require("../../route-matchers/pages-route-matcher");
const _routekind = require("../../route-kind");
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
const _filecacheroutematcherprovider = require("./file-cache-route-matcher-provider");
const _pages = require("../../normalizers/built/pages");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
class DevPagesRouteMatcherProvider extends _filecacheroutematcherprovider.FileCacheRouteMatcherProvider {
constructor(pagesDir, extensions, reader, localeNormalizer){
super(pagesDir, reader);
this.pagesDir = pagesDir;
this.extensions = extensions;
this.localeNormalizer = localeNormalizer;
// Match any route file that ends with `/${filename}.${extension}` under the
// pages directory.
this.expression = new RegExp(`\\.(?:${extensions.join("|")})$`);
this.normalizers = new _pages.DevPagesNormalizers(pagesDir, extensions);
}
test(filename) {
// If the file does not end in the correct extension it's not a match.
if (!this.expression.test(filename)) return false;
// Pages routes must exist in the pages directory without the `/api/`
// prefix. The pathnames being tested here though are the full filenames,
// so we need to include the pages directory.
// TODO: could path separator normalization be needed here?
if (filename.startsWith(_path.default.join(this.pagesDir, "/api/"))) return false;
for (const extension of this.extensions){
// We can also match if we have `pages/api.${extension}`, so check to
// see if it's a match.
if (filename === _path.default.join(this.pagesDir, `api.${extension}`)) {
return false;
}
}
return true;
}
async transform(files) {
const matchers = [];
for (const filename of files){
// If the file isn't a match for this matcher, then skip it.
if (!this.test(filename)) continue;
const pathname = this.normalizers.pathname.normalize(filename);
const page = this.normalizers.page.normalize(filename);
const bundlePath = this.normalizers.bundlePath.normalize(filename);
if (this.localeNormalizer) {
matchers.push(new _pagesroutematcher.PagesLocaleRouteMatcher({
kind: _routekind.RouteKind.PAGES,
pathname,
page,
bundlePath,
filename,
i18n: {}
}));
} else {
matchers.push(new _pagesroutematcher.PagesRouteMatcher({
kind: _routekind.RouteKind.PAGES,
pathname,
page,
bundlePath,
filename
}));
}
}
return matchers;
}
}
//# sourceMappingURL=dev-pages-route-matcher-provider.js.map

View File

@@ -0,0 +1,28 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "FileCacheRouteMatcherProvider", {
enumerable: true,
get: function() {
return FileCacheRouteMatcherProvider;
}
});
const _cachedroutematcherprovider = require("../helpers/cached-route-matcher-provider");
class FileCacheRouteMatcherProvider extends _cachedroutematcherprovider.CachedRouteMatcherProvider {
constructor(dir, reader){
super({
load: async ()=>reader.read(dir),
compare: (left, right)=>{
if (left.length !== right.length) return false;
// Assuming the file traversal order is deterministic...
for(let i = 0; i < left.length; i++){
if (left[i] !== right[i]) return false;
}
return true;
}
});
}
}
//# sourceMappingURL=file-cache-route-matcher-provider.js.map

View File

@@ -0,0 +1,106 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "BatchedFileReader", {
enumerable: true,
get: function() {
return BatchedFileReader;
}
});
class BatchedFileReader {
constructor(reader){
this.reader = reader;
}
schedule(callback) {
if (!this.schedulePromise) {
this.schedulePromise = Promise.resolve();
}
this.schedulePromise.then(()=>{
process.nextTick(callback);
});
}
getOrCreateBatch() {
// If there is an existing batch and it's not completed, then reuse it.
if (this.batch && !this.batch.completed) {
return this.batch;
}
const batch = {
completed: false,
directories: [],
callbacks: []
};
this.batch = batch;
this.schedule(async ()=>{
batch.completed = true;
if (batch.directories.length === 0) return;
// Collect all the results for each of the directories. If any error
// occurs, send the results back to the loaders.
let values;
try {
values = await this.load(batch.directories);
} catch (err) {
// Reject all the callbacks.
for (const { reject } of batch.callbacks){
reject(err);
}
return;
}
// Loop over all the callbacks and send them their results.
for(let i = 0; i < batch.callbacks.length; i++){
const value = values[i];
if (value instanceof Error) {
batch.callbacks[i].reject(value);
} else {
batch.callbacks[i].resolve(value);
}
}
});
return batch;
}
async load(directories) {
// Make a unique array of directories. This is what lets us de-duplicate
// loads for the same directory.
const unique = [
...new Set(directories)
];
const results = await Promise.all(unique.map(async (directory)=>{
let files;
let error;
try {
files = await this.reader.read(directory);
} catch (err) {
if (err instanceof Error) error = err;
}
return {
directory,
files,
error
};
}));
return directories.map((directory)=>{
const found = results.find((result)=>result.directory === directory);
if (!found) return [];
if (found.files) return found.files;
if (found.error) return found.error;
return [];
});
}
async read(dir) {
// Get or create a new file reading batch.
const batch = this.getOrCreateBatch();
// Push this directory into the batch to resolve.
batch.directories.push(dir);
// Push the promise handles into the batch (under the same index) so it can
// be resolved later when it's scheduled.
const promise = new Promise((resolve, reject)=>{
batch.callbacks.push({
resolve,
reject
});
});
return promise;
}
}
//# sourceMappingURL=batched-file-reader.js.map

View File

@@ -0,0 +1,43 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "DefaultFileReader", {
enumerable: true,
get: function() {
return DefaultFileReader;
}
});
const _recursivereaddir = require("../../../../../../lib/recursive-readdir");
class DefaultFileReader {
/**
* Creates a new file reader.
*
* @param pathnameFilter filter to ignore files with absolute pathnames, false to ignore
* @param ignoreFilter filter to ignore files and directories with absolute pathnames, false to ignore
* @param ignorePartFilter filter to ignore files and directories with the pathname part, false to ignore
*/ constructor(options){
this.options = options;
}
/**
* Reads all the files in the directory and its subdirectories following any
* symbolic links.
*
* @param dir the directory to read
* @returns a promise that resolves to the list of files
*/ async read(dir) {
return (0, _recursivereaddir.recursiveReadDir)(dir, {
pathnameFilter: this.options.pathnameFilter,
ignoreFilter: this.options.ignoreFilter,
ignorePartFilter: this.options.ignorePartFilter,
// We don't need to sort the results because we're not depending on the
// order of the results.
sortPathnames: false,
// We want absolute pathnames because we're going to be comparing them
// with other absolute pathnames.
relativePathnames: false
});
}
}
//# sourceMappingURL=default-file-reader.js.map

View File

@@ -0,0 +1,30 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "CachedRouteMatcherProvider", {
enumerable: true,
get: function() {
return CachedRouteMatcherProvider;
}
});
class CachedRouteMatcherProvider {
constructor(loader){
this.loader = loader;
this.cached = [];
}
async matchers() {
const data = await this.loader.load();
if (!data) return [];
// Return the cached matchers if the data has not changed.
if (this.data && this.loader.compare(this.data, data)) return this.cached;
this.data = data;
// Transform the manifest into matchers.
const matchers = await this.transform(data);
// Cache the matchers.
this.cached = matchers;
return matchers;
}
}
//# sourceMappingURL=cached-route-matcher-provider.js.map

View File

@@ -0,0 +1,34 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "NodeManifestLoader", {
enumerable: true,
get: function() {
return NodeManifestLoader;
}
});
const _constants = require("../../../../../shared/lib/constants");
const _path = /*#__PURE__*/ _interop_require_default(require("../../../../../shared/lib/isomorphic/path"));
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
class NodeManifestLoader {
constructor(distDir){
this.distDir = distDir;
}
static require(id) {
try {
return require(id);
} catch {
return null;
}
}
load(name) {
return NodeManifestLoader.require(_path.default.join(this.distDir, _constants.SERVER_DIRECTORY, name));
}
}
//# sourceMappingURL=node-manifest-loader.js.map

View File

@@ -0,0 +1,20 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "ServerManifestLoader", {
enumerable: true,
get: function() {
return ServerManifestLoader;
}
});
class ServerManifestLoader {
constructor(getter){
this.getter = getter;
}
load(name) {
return this.getter(name);
}
}
//# sourceMappingURL=server-manifest-loader.js.map

View File

@@ -0,0 +1,21 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "ManifestRouteMatcherProvider", {
enumerable: true,
get: function() {
return ManifestRouteMatcherProvider;
}
});
const _cachedroutematcherprovider = require("./helpers/cached-route-matcher-provider");
class ManifestRouteMatcherProvider extends _cachedroutematcherprovider.CachedRouteMatcherProvider {
constructor(manifestName, manifestLoader){
super({
load: async ()=>manifestLoader.load(manifestName),
compare: (left, right)=>left === right
});
}
}
//# sourceMappingURL=manifest-route-matcher-provider.js.map

View File

@@ -0,0 +1,56 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "PagesAPIRouteMatcherProvider", {
enumerable: true,
get: function() {
return PagesAPIRouteMatcherProvider;
}
});
const _isapiroute = require("../../../lib/is-api-route");
const _constants = require("../../../shared/lib/constants");
const _routekind = require("../route-kind");
const _pagesapiroutematcher = require("../route-matchers/pages-api-route-matcher");
const _manifestroutematcherprovider = require("./manifest-route-matcher-provider");
const _pages = require("../normalizers/built/pages");
class PagesAPIRouteMatcherProvider extends _manifestroutematcherprovider.ManifestRouteMatcherProvider {
constructor(distDir, manifestLoader, i18nProvider){
super(_constants.PAGES_MANIFEST, manifestLoader);
this.i18nProvider = i18nProvider;
this.normalizers = new _pages.PagesNormalizers(distDir);
}
async transform(manifest) {
// This matcher is only for Pages API routes.
const pathnames = Object.keys(manifest).filter((pathname)=>(0, _isapiroute.isAPIRoute)(pathname));
const matchers = [];
for (const page of pathnames){
if (this.i18nProvider) {
// Match the locale on the page name, or default to the default locale.
const { detectedLocale, pathname } = this.i18nProvider.analyze(page);
matchers.push(new _pagesapiroutematcher.PagesAPILocaleRouteMatcher({
kind: _routekind.RouteKind.PAGES_API,
pathname,
page,
bundlePath: this.normalizers.bundlePath.normalize(page),
filename: this.normalizers.filename.normalize(manifest[page]),
i18n: {
locale: detectedLocale
}
}));
} else {
matchers.push(new _pagesapiroutematcher.PagesAPIRouteMatcher({
kind: _routekind.RouteKind.PAGES_API,
// In `pages/`, the page is the same as the pathname.
pathname: page,
page,
bundlePath: this.normalizers.bundlePath.normalize(page),
filename: this.normalizers.filename.normalize(manifest[page])
}));
}
}
return matchers;
}
}
//# sourceMappingURL=pages-api-route-matcher-provider.js.map

View File

@@ -0,0 +1,65 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "PagesRouteMatcherProvider", {
enumerable: true,
get: function() {
return PagesRouteMatcherProvider;
}
});
const _isapiroute = require("../../../lib/is-api-route");
const _constants = require("../../../shared/lib/constants");
const _routekind = require("../route-kind");
const _pagesroutematcher = require("../route-matchers/pages-route-matcher");
const _manifestroutematcherprovider = require("./manifest-route-matcher-provider");
const _pages = require("../normalizers/built/pages");
class PagesRouteMatcherProvider extends _manifestroutematcherprovider.ManifestRouteMatcherProvider {
constructor(distDir, manifestLoader, i18nProvider){
super(_constants.PAGES_MANIFEST, manifestLoader);
this.i18nProvider = i18nProvider;
this.normalizers = new _pages.PagesNormalizers(distDir);
}
async transform(manifest) {
// This matcher is only for Pages routes, not Pages API routes which are
// included in this manifest.
const pathnames = Object.keys(manifest).filter((pathname)=>!(0, _isapiroute.isAPIRoute)(pathname))// Remove any blocked pages (page that can't be routed to, like error or
// internal pages).
.filter((pathname)=>{
var _this_i18nProvider;
const normalized = ((_this_i18nProvider = this.i18nProvider) == null ? void 0 : _this_i18nProvider.analyze(pathname).pathname) ?? pathname;
// Skip any blocked pages.
if (_constants.BLOCKED_PAGES.includes(normalized)) return false;
return true;
});
const matchers = [];
for (const page of pathnames){
if (this.i18nProvider) {
// Match the locale on the page name, or default to the default locale.
const { detectedLocale, pathname } = this.i18nProvider.analyze(page);
matchers.push(new _pagesroutematcher.PagesLocaleRouteMatcher({
kind: _routekind.RouteKind.PAGES,
pathname,
page,
bundlePath: this.normalizers.bundlePath.normalize(page),
filename: this.normalizers.filename.normalize(manifest[page]),
i18n: {
locale: detectedLocale
}
}));
} else {
matchers.push(new _pagesroutematcher.PagesRouteMatcher({
kind: _routekind.RouteKind.PAGES,
// In `pages/`, the page is the same as the pathname.
pathname: page,
page,
bundlePath: this.normalizers.bundlePath.normalize(page),
filename: this.normalizers.filename.normalize(manifest[page])
}));
}
}
return matchers;
}
}
//# sourceMappingURL=pages-route-matcher-provider.js.map

View File

@@ -0,0 +1,18 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "AppPageRouteMatcher", {
enumerable: true,
get: function() {
return AppPageRouteMatcher;
}
});
const _routematcher = require("./route-matcher");
class AppPageRouteMatcher extends _routematcher.RouteMatcher {
get identity() {
return `${this.definition.pathname}?__nextPage=${this.definition.page}`;
}
}
//# sourceMappingURL=app-page-route-matcher.js.map

View File

@@ -0,0 +1,15 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "AppRouteRouteMatcher", {
enumerable: true,
get: function() {
return AppRouteRouteMatcher;
}
});
const _routematcher = require("./route-matcher");
class AppRouteRouteMatcher extends _routematcher.RouteMatcher {
}
//# sourceMappingURL=app-route-route-matcher.js.map

View File

@@ -0,0 +1,68 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "LocaleRouteMatcher", {
enumerable: true,
get: function() {
return LocaleRouteMatcher;
}
});
const _routematcher = require("./route-matcher");
class LocaleRouteMatcher extends _routematcher.RouteMatcher {
/**
* Identity returns the identity part of the matcher. This is used to compare
* a unique matcher to another. This is also used when sorting dynamic routes,
* so it must contain the pathname part as well.
*/ get identity() {
var _this_definition_i18n;
return `${this.definition.pathname}?__nextLocale=${(_this_definition_i18n = this.definition.i18n) == null ? void 0 : _this_definition_i18n.locale}`;
}
/**
* Match will attempt to match the given pathname against this route while
* also taking into account the locale information.
*
* @param pathname The pathname to match against.
* @param options The options to use when matching.
* @returns The match result, or `null` if there was no match.
*/ match(pathname, options) {
var // If the options have a detected locale, then use that, otherwise use
// the route's locale.
_options_i18n, _this_definition_i18n;
// This is like the parent `match` method but instead this injects the
// additional `options` into the
const result = this.test(pathname, options);
if (!result) return null;
return {
definition: this.definition,
params: result.params,
detectedLocale: (options == null ? void 0 : (_options_i18n = options.i18n) == null ? void 0 : _options_i18n.detectedLocale) ?? ((_this_definition_i18n = this.definition.i18n) == null ? void 0 : _this_definition_i18n.locale)
};
}
/**
* Test will attempt to match the given pathname against this route while
* also taking into account the locale information.
*
* @param pathname The pathname to match against.
* @param options The options to use when matching.
* @returns The match result, or `null` if there was no match.
*/ test(pathname, options) {
// If this route has locale information and we have detected a locale, then
// we need to compare the detected locale to the route's locale.
if (this.definition.i18n && (options == null ? void 0 : options.i18n)) {
// If we have detected a locale and it does not match this route's locale,
// then this isn't a match!
if (this.definition.i18n.locale && options.i18n.detectedLocale && this.definition.i18n.locale !== options.i18n.detectedLocale) {
return null;
}
// Perform regular matching against the locale stripped pathname now, the
// locale information matches!
return super.test(options.i18n.pathname);
}
// If we don't have locale information, then we can just perform regular
// matching.
return super.test(pathname);
}
}
//# sourceMappingURL=locale-route-matcher.js.map

View File

@@ -0,0 +1,30 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
PagesAPILocaleRouteMatcher: null,
PagesAPIRouteMatcher: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
PagesAPILocaleRouteMatcher: function() {
return PagesAPILocaleRouteMatcher;
},
PagesAPIRouteMatcher: function() {
return PagesAPIRouteMatcher;
}
});
const _localeroutematcher = require("./locale-route-matcher");
const _routematcher = require("./route-matcher");
class PagesAPIRouteMatcher extends _routematcher.RouteMatcher {
}
class PagesAPILocaleRouteMatcher extends _localeroutematcher.LocaleRouteMatcher {
}
//# sourceMappingURL=pages-api-route-matcher.js.map

View File

@@ -0,0 +1,30 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
PagesLocaleRouteMatcher: null,
PagesRouteMatcher: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
PagesLocaleRouteMatcher: function() {
return PagesLocaleRouteMatcher;
},
PagesRouteMatcher: function() {
return PagesRouteMatcher;
}
});
const _localeroutematcher = require("./locale-route-matcher");
const _routematcher = require("./route-matcher");
class PagesRouteMatcher extends _routematcher.RouteMatcher {
}
class PagesLocaleRouteMatcher extends _localeroutematcher.LocaleRouteMatcher {
}
//# sourceMappingURL=pages-route-matcher.js.map

View File

@@ -0,0 +1,54 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "RouteMatcher", {
enumerable: true,
get: function() {
return RouteMatcher;
}
});
const _utils = require("../../../shared/lib/router/utils");
const _routematcher = require("../../../shared/lib/router/utils/route-matcher");
const _routeregex = require("../../../shared/lib/router/utils/route-regex");
class RouteMatcher {
constructor(definition){
this.definition = definition;
if ((0, _utils.isDynamicRoute)(definition.pathname)) {
this.dynamic = (0, _routematcher.getRouteMatcher)((0, _routeregex.getRouteRegex)(definition.pathname));
}
}
/**
* Identity returns the identity part of the matcher. This is used to compare
* a unique matcher to another. This is also used when sorting dynamic routes,
* so it must contain the pathname part.
*/ get identity() {
return this.definition.pathname;
}
get isDynamic() {
return this.dynamic !== undefined;
}
match(pathname) {
const result = this.test(pathname);
if (!result) return null;
return {
definition: this.definition,
params: result.params
};
}
test(pathname) {
if (this.dynamic) {
const params = this.dynamic(pathname);
if (!params) return null;
return {
params
};
}
if (pathname === this.definition.pathname) {
return {};
}
return null;
}
}
//# sourceMappingURL=route-matcher.js.map

View File

@@ -0,0 +1,16 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "isPagesAPIRouteMatch", {
enumerable: true,
get: function() {
return isPagesAPIRouteMatch;
}
});
const _routekind = require("../route-kind");
function isPagesAPIRouteMatch(match) {
return match.definition.kind === _routekind.RouteKind.PAGES_API;
}
//# sourceMappingURL=pages-api-route-match.js.map

View File

@@ -0,0 +1,24 @@
"use strict";
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,94 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
AppPageRouteModule: null,
default: null,
renderToHTMLOrFlight: null,
vendored: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
AppPageRouteModule: function() {
return AppPageRouteModule;
},
default: function() {
return _default;
},
renderToHTMLOrFlight: function() {
return _apprender.renderToHTMLOrFlight;
},
vendored: function() {
return vendored;
}
});
const _apprender = require("../../../app-render/app-render");
const _routemodule = require("../route-module");
const _entrypoints = /*#__PURE__*/ _interop_require_wildcard(require("./vendored/contexts/entrypoints"));
function _getRequireWildcardCache(nodeInterop) {
if (typeof WeakMap !== "function") return null;
var cacheBabelInterop = new WeakMap();
var cacheNodeInterop = new WeakMap();
return (_getRequireWildcardCache = function(nodeInterop) {
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
})(nodeInterop);
}
function _interop_require_wildcard(obj, nodeInterop) {
if (!nodeInterop && obj && obj.__esModule) {
return obj;
}
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
return {
default: obj
};
}
var cache = _getRequireWildcardCache(nodeInterop);
if (cache && cache.has(obj)) {
return cache.get(obj);
}
var newObj = {
__proto__: null
};
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
for(var key in obj){
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
if (desc && (desc.get || desc.set)) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
newObj.default = obj;
if (cache) {
cache.set(obj, newObj);
}
return newObj;
}
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");
}
class AppPageRouteModule extends _routemodule.RouteModule {
render(req, res, context) {
return (0, _apprender.renderToHTMLOrFlight)(req, res, context.page, context.query, context.renderOpts);
}
}
const vendored = {
"react-rsc": vendoredReactRSC,
"react-ssr": vendoredReactSSR,
contexts: _entrypoints
};
const _default = AppPageRouteModule;
//# sourceMappingURL=module.js.map

View File

@@ -0,0 +1,20 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "lazyRenderAppPage", {
enumerable: true,
get: function() {
return lazyRenderAppPage;
}
});
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,4 @@
"use strict";
module.exports = require("../../module.compiled").vendored["contexts"].AmpContext;
//# sourceMappingURL=amp-context.js.map

View File

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

View File

@@ -0,0 +1,107 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
AmpContext: null,
AppRouterContext: null,
HeadManagerContext: null,
HooksClientContext: null,
HtmlContext: null,
ImageConfigContext: null,
Loadable: null,
LoadableContext: null,
RouterContext: null,
ServerInsertedHtml: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
AmpContext: function() {
return _ampcontextsharedruntime;
},
AppRouterContext: function() {
return _approutercontextsharedruntime;
},
HeadManagerContext: function() {
return _headmanagercontextsharedruntime;
},
HooksClientContext: function() {
return _hooksclientcontextsharedruntime;
},
HtmlContext: function() {
return _htmlcontextsharedruntime;
},
ImageConfigContext: function() {
return _imageconfigcontextsharedruntime;
},
Loadable: function() {
return _loadablesharedruntime;
},
LoadableContext: function() {
return _loadablecontextsharedruntime;
},
RouterContext: function() {
return _routercontextsharedruntime;
},
ServerInsertedHtml: function() {
return _serverinsertedhtmlsharedruntime;
}
});
const _headmanagercontextsharedruntime = /*#__PURE__*/ _interop_require_wildcard(require("../../../../../../shared/lib/head-manager-context.shared-runtime"));
const _serverinsertedhtmlsharedruntime = /*#__PURE__*/ _interop_require_wildcard(require("../../../../../../shared/lib/server-inserted-html.shared-runtime"));
const _approutercontextsharedruntime = /*#__PURE__*/ _interop_require_wildcard(require("../../../../../../shared/lib/app-router-context.shared-runtime"));
const _hooksclientcontextsharedruntime = /*#__PURE__*/ _interop_require_wildcard(require("../../../../../../shared/lib/hooks-client-context.shared-runtime"));
const _routercontextsharedruntime = /*#__PURE__*/ _interop_require_wildcard(require("../../../../../../shared/lib/router-context.shared-runtime"));
const _htmlcontextsharedruntime = /*#__PURE__*/ _interop_require_wildcard(require("../../../../../../shared/lib/html-context.shared-runtime"));
const _ampcontextsharedruntime = /*#__PURE__*/ _interop_require_wildcard(require("../../../../../../shared/lib/amp-context.shared-runtime"));
const _loadablecontextsharedruntime = /*#__PURE__*/ _interop_require_wildcard(require("../../../../../../shared/lib/loadable-context.shared-runtime"));
const _imageconfigcontextsharedruntime = /*#__PURE__*/ _interop_require_wildcard(require("../../../../../../shared/lib/image-config-context.shared-runtime"));
const _loadablesharedruntime = /*#__PURE__*/ _interop_require_wildcard(require("../../../../../../shared/lib/loadable.shared-runtime"));
function _getRequireWildcardCache(nodeInterop) {
if (typeof WeakMap !== "function") return null;
var cacheBabelInterop = new WeakMap();
var cacheNodeInterop = new WeakMap();
return (_getRequireWildcardCache = function(nodeInterop) {
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
})(nodeInterop);
}
function _interop_require_wildcard(obj, nodeInterop) {
if (!nodeInterop && obj && obj.__esModule) {
return obj;
}
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
return {
default: obj
};
}
var cache = _getRequireWildcardCache(nodeInterop);
if (cache && cache.has(obj)) {
return cache.get(obj);
}
var newObj = {
__proto__: null
};
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
for(var key in obj){
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
if (desc && (desc.get || desc.set)) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
newObj.default = obj;
if (cache) {
cache.set(obj, newObj);
}
return newObj;
}
//# sourceMappingURL=entrypoints.js.map

View File

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

View File

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

View File

@@ -0,0 +1,4 @@
"use strict";
module.exports = require("../../module.compiled").vendored["contexts"].HtmlContext;
//# sourceMappingURL=html-context.js.map

View File

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

View File

@@ -0,0 +1,4 @@
"use strict";
module.exports = require("../../module.compiled").vendored["contexts"].LoadableContext;
//# sourceMappingURL=loadable-context.js.map

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,136 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
React: null,
ReactDOM: null,
ReactJsxDevRuntime: null,
ReactJsxRuntime: null,
ReactServerDOMTurbopackServerEdge: null,
ReactServerDOMTurbopackServerNode: null,
ReactServerDOMWebpackServerEdge: null,
ReactServerDOMWebpackServerNode: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
React: function() {
return _react;
},
ReactDOM: function() {
return _reactdom;
},
ReactJsxDevRuntime: function() {
return _jsxdevruntime;
},
ReactJsxRuntime: function() {
return _jsxruntime;
},
ReactServerDOMTurbopackServerEdge: function() {
return ReactServerDOMTurbopackServerEdge;
},
ReactServerDOMTurbopackServerNode: function() {
return ReactServerDOMTurbopackServerNode;
},
ReactServerDOMWebpackServerEdge: function() {
return ReactServerDOMWebpackServerEdge;
},
ReactServerDOMWebpackServerNode: function() {
return ReactServerDOMWebpackServerNode;
}
});
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
const _reactdom = /*#__PURE__*/ _interop_require_wildcard(require("react-dom"));
const _jsxdevruntime = /*#__PURE__*/ _interop_require_wildcard(require("react/jsx-dev-runtime"));
const _jsxruntime = /*#__PURE__*/ _interop_require_wildcard(require("react/jsx-runtime"));
function _getRequireWildcardCache(nodeInterop) {
if (typeof WeakMap !== "function") return null;
var cacheBabelInterop = new WeakMap();
var cacheNodeInterop = new WeakMap();
return (_getRequireWildcardCache = function(nodeInterop) {
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
})(nodeInterop);
}
function _interop_require_wildcard(obj, nodeInterop) {
if (!nodeInterop && obj && obj.__esModule) {
return obj;
}
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
return {
default: obj
};
}
var cache = _getRequireWildcardCache(nodeInterop);
if (cache && cache.has(obj)) {
return cache.get(obj);
}
var newObj = {
__proto__: null
};
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
for(var key in obj){
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
if (desc && (desc.get || desc.set)) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
newObj.default = obj;
if (cache) {
cache.set(obj, newObj);
}
return newObj;
}
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;
}
//# sourceMappingURL=entrypoints.js.map

View File

@@ -0,0 +1,115 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
React: null,
ReactDOM: null,
ReactDOMServerEdge: null,
ReactJsxDevRuntime: null,
ReactJsxRuntime: null,
ReactServerDOMTurbopackClientEdge: null,
ReactServerDOMWebpackClientEdge: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
React: function() {
return _react;
},
ReactDOM: function() {
return _serverrenderingstub;
},
ReactDOMServerEdge: function() {
return _serveredge;
},
ReactJsxDevRuntime: function() {
return _jsxdevruntime;
},
ReactJsxRuntime: function() {
return _jsxruntime;
},
ReactServerDOMTurbopackClientEdge: function() {
return ReactServerDOMTurbopackClientEdge;
},
ReactServerDOMWebpackClientEdge: function() {
return ReactServerDOMWebpackClientEdge;
}
});
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
const _serverrenderingstub = /*#__PURE__*/ _interop_require_wildcard(require("react-dom/server-rendering-stub"));
const _jsxdevruntime = /*#__PURE__*/ _interop_require_wildcard(require("react/jsx-dev-runtime"));
const _jsxruntime = /*#__PURE__*/ _interop_require_wildcard(require("react/jsx-runtime"));
const _serveredge = /*#__PURE__*/ _interop_require_wildcard(require("react-dom/server.edge"));
function _getRequireWildcardCache(nodeInterop) {
if (typeof WeakMap !== "function") return null;
var cacheBabelInterop = new WeakMap();
var cacheNodeInterop = new WeakMap();
return (_getRequireWildcardCache = function(nodeInterop) {
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
})(nodeInterop);
}
function _interop_require_wildcard(obj, nodeInterop) {
if (!nodeInterop && obj && obj.__esModule) {
return obj;
}
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
return {
default: obj
};
}
var cache = _getRequireWildcardCache(nodeInterop);
if (cache && cache.has(obj)) {
return cache.get(obj);
}
var newObj = {
__proto__: null
};
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
for(var key in obj){
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
if (desc && (desc.get || desc.set)) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
newObj.default = obj;
if (cache) {
cache.set(obj, newObj);
}
return newObj;
}
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");
}
}
//# sourceMappingURL=entrypoints.js.map

View File

@@ -0,0 +1,45 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
isAppPageRouteModule: null,
isAppRouteRouteModule: null,
isPagesAPIRouteModule: null,
isPagesRouteModule: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
isAppPageRouteModule: function() {
return isAppPageRouteModule;
},
isAppRouteRouteModule: function() {
return isAppRouteRouteModule;
},
isPagesAPIRouteModule: function() {
return isPagesAPIRouteModule;
},
isPagesRouteModule: function() {
return isPagesRouteModule;
}
});
const _routekind = require("../route-kind");
function isAppRouteRouteModule(routeModule) {
return routeModule.definition.kind === _routekind.RouteKind.APP_ROUTE;
}
function isAppPageRouteModule(routeModule) {
return routeModule.definition.kind === _routekind.RouteKind.APP_PAGE;
}
function isPagesRouteModule(routeModule) {
return routeModule.definition.kind === _routekind.RouteKind.PAGES;
}
function isPagesAPIRouteModule(routeModule) {
return routeModule.definition.kind === _routekind.RouteKind.PAGES_API;
}
//# sourceMappingURL=checks.js.map

View File

@@ -0,0 +1,67 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
handleBadRequestResponse: null,
handleInternalServerErrorResponse: null,
handleMethodNotAllowedResponse: null,
handleNotFoundResponse: null,
handleRedirectResponse: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
handleBadRequestResponse: function() {
return handleBadRequestResponse;
},
handleInternalServerErrorResponse: function() {
return handleInternalServerErrorResponse;
},
handleMethodNotAllowedResponse: function() {
return handleMethodNotAllowedResponse;
},
handleNotFoundResponse: function() {
return handleNotFoundResponse;
},
handleRedirectResponse: function() {
return handleRedirectResponse;
}
});
const _requestcookies = require("../../../web/spec-extension/adapters/request-cookies");
function handleRedirectResponse(url, mutableCookies, status) {
const headers = new Headers({
location: url
});
(0, _requestcookies.appendMutableCookies)(headers, mutableCookies);
return new Response(null, {
status,
headers
});
}
function handleBadRequestResponse() {
return new Response(null, {
status: 400
});
}
function handleNotFoundResponse() {
return new Response(null, {
status: 404
});
}
function handleMethodNotAllowedResponse() {
return new Response(null, {
status: 405
});
}
function handleInternalServerErrorResponse() {
return new Response(null, {
status: 500
});
}
//# sourceMappingURL=response-handlers.js.map

View File

@@ -0,0 +1,78 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "routeModule", {
enumerable: true,
get: function() {
return routeModule;
}
});
const _document = /*#__PURE__*/ _interop_require_default(require("../../../../../pages/_document"));
const _app = /*#__PURE__*/ _interop_require_default(require("../../../../../pages/_app"));
const _routekind = require("../../../route-kind");
const _error = /*#__PURE__*/ _interop_require_wildcard(require("../../../../../pages/_error"));
const _module = /*#__PURE__*/ _interop_require_default(require("../module"));
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function _getRequireWildcardCache(nodeInterop) {
if (typeof WeakMap !== "function") return null;
var cacheBabelInterop = new WeakMap();
var cacheNodeInterop = new WeakMap();
return (_getRequireWildcardCache = function(nodeInterop) {
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
})(nodeInterop);
}
function _interop_require_wildcard(obj, nodeInterop) {
if (!nodeInterop && obj && obj.__esModule) {
return obj;
}
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
return {
default: obj
};
}
var cache = _getRequireWildcardCache(nodeInterop);
if (cache && cache.has(obj)) {
return cache.get(obj);
}
var newObj = {
__proto__: null
};
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
for(var key in obj){
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
if (desc && (desc.get || desc.set)) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
newObj.default = obj;
if (cache) {
cache.set(obj, newObj);
}
return newObj;
}
const routeModule = new _module.default({
// TODO: add descriptor for internal error page
definition: {
kind: _routekind.RouteKind.PAGES,
page: "/_error",
pathname: "/_error",
filename: "",
bundlePath: ""
},
components: {
App: _app.default,
Document: _document.default
},
userland: _error
});
//# sourceMappingURL=_error.js.map

View File

@@ -0,0 +1,14 @@
"use strict";
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,92 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
PagesRouteModule: null,
default: null,
renderToHTML: null,
vendored: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
PagesRouteModule: function() {
return PagesRouteModule;
},
default: function() {
return _default;
},
renderToHTML: function() {
return _render.renderToHTML;
},
vendored: function() {
return vendored;
}
});
const _routemodule = require("../route-module");
const _render = require("../../../render");
const _entrypoints = /*#__PURE__*/ _interop_require_wildcard(require("./vendored/contexts/entrypoints"));
function _getRequireWildcardCache(nodeInterop) {
if (typeof WeakMap !== "function") return null;
var cacheBabelInterop = new WeakMap();
var cacheNodeInterop = new WeakMap();
return (_getRequireWildcardCache = function(nodeInterop) {
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
})(nodeInterop);
}
function _interop_require_wildcard(obj, nodeInterop) {
if (!nodeInterop && obj && obj.__esModule) {
return obj;
}
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
return {
default: obj
};
}
var cache = _getRequireWildcardCache(nodeInterop);
if (cache && cache.has(obj)) {
return cache.get(obj);
}
var newObj = {
__proto__: null
};
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
for(var key in obj){
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
if (desc && (desc.get || desc.set)) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
newObj.default = obj;
if (cache) {
cache.set(obj, newObj);
}
return newObj;
}
class PagesRouteModule extends _routemodule.RouteModule {
constructor(options){
super(options);
this.components = options.components;
}
render(req, res, context) {
return (0, _render.renderToHTMLImpl)(req, res, context.page, context.query, context.renderOpts, {
App: this.components.App,
Document: this.components.Document
});
}
}
const vendored = {
contexts: _entrypoints
};
const _default = PagesRouteModule;
//# sourceMappingURL=module.js.map

View File

@@ -0,0 +1,20 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "lazyRenderPagesPage", {
enumerable: true,
get: function() {
return lazyRenderPagesPage;
}
});
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,4 @@
"use strict";
module.exports = require("../../module.compiled").vendored["contexts"].AmpContext;
//# sourceMappingURL=amp-context.js.map

View File

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

View File

@@ -0,0 +1,107 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
AmpContext: null,
AppRouterContext: null,
HeadManagerContext: null,
HooksClientContext: null,
HtmlContext: null,
ImageConfigContext: null,
Loadable: null,
LoadableContext: null,
RouterContext: null,
ServerInsertedHtml: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
AmpContext: function() {
return _ampcontextsharedruntime;
},
AppRouterContext: function() {
return _approutercontextsharedruntime;
},
HeadManagerContext: function() {
return _headmanagercontextsharedruntime;
},
HooksClientContext: function() {
return _hooksclientcontextsharedruntime;
},
HtmlContext: function() {
return _htmlcontextsharedruntime;
},
ImageConfigContext: function() {
return _imageconfigcontextsharedruntime;
},
Loadable: function() {
return _loadablesharedruntime;
},
LoadableContext: function() {
return _loadablecontextsharedruntime;
},
RouterContext: function() {
return _routercontextsharedruntime;
},
ServerInsertedHtml: function() {
return _serverinsertedhtmlsharedruntime;
}
});
const _routercontextsharedruntime = /*#__PURE__*/ _interop_require_wildcard(require("../../../../../../shared/lib/router-context.shared-runtime"));
const _loadablecontextsharedruntime = /*#__PURE__*/ _interop_require_wildcard(require("../../../../../../shared/lib/loadable-context.shared-runtime"));
const _loadablesharedruntime = /*#__PURE__*/ _interop_require_wildcard(require("../../../../../../shared/lib/loadable.shared-runtime"));
const _imageconfigcontextsharedruntime = /*#__PURE__*/ _interop_require_wildcard(require("../../../../../../shared/lib/image-config-context.shared-runtime"));
const _htmlcontextsharedruntime = /*#__PURE__*/ _interop_require_wildcard(require("../../../../../../shared/lib/html-context.shared-runtime"));
const _hooksclientcontextsharedruntime = /*#__PURE__*/ _interop_require_wildcard(require("../../../../../../shared/lib/hooks-client-context.shared-runtime"));
const _headmanagercontextsharedruntime = /*#__PURE__*/ _interop_require_wildcard(require("../../../../../../shared/lib/head-manager-context.shared-runtime"));
const _approutercontextsharedruntime = /*#__PURE__*/ _interop_require_wildcard(require("../../../../../../shared/lib/app-router-context.shared-runtime"));
const _ampcontextsharedruntime = /*#__PURE__*/ _interop_require_wildcard(require("../../../../../../shared/lib/amp-context.shared-runtime"));
const _serverinsertedhtmlsharedruntime = /*#__PURE__*/ _interop_require_wildcard(require("../../../../../../shared/lib/server-inserted-html.shared-runtime"));
function _getRequireWildcardCache(nodeInterop) {
if (typeof WeakMap !== "function") return null;
var cacheBabelInterop = new WeakMap();
var cacheNodeInterop = new WeakMap();
return (_getRequireWildcardCache = function(nodeInterop) {
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
})(nodeInterop);
}
function _interop_require_wildcard(obj, nodeInterop) {
if (!nodeInterop && obj && obj.__esModule) {
return obj;
}
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
return {
default: obj
};
}
var cache = _getRequireWildcardCache(nodeInterop);
if (cache && cache.has(obj)) {
return cache.get(obj);
}
var newObj = {
__proto__: null
};
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
for(var key in obj){
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
if (desc && (desc.get || desc.set)) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
newObj.default = obj;
if (cache) {
cache.set(obj, newObj);
}
return newObj;
}
//# sourceMappingURL=entrypoints.js.map

View File

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

View File

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

View File

@@ -0,0 +1,4 @@
"use strict";
module.exports = require("../../module.compiled").vendored["contexts"].HtmlContext;
//# sourceMappingURL=html-context.js.map

View File

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

View File

@@ -0,0 +1,4 @@
"use strict";
module.exports = require("../../module.compiled").vendored["contexts"].LoadableContext;
//# sourceMappingURL=loadable-context.js.map

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,18 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "RouteModule", {
enumerable: true,
get: function() {
return RouteModule;
}
});
class RouteModule {
constructor({ userland, definition }){
this.userland = userland;
this.definition = definition;
}
}
//# sourceMappingURL=route-module.js.map