Initial boiler plate project

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

View File

@ -0,0 +1,65 @@
import type { DomainLocale, I18NConfig } from '../../config-shared';
import type { NextParsedUrlQuery } from '../../request-meta';
/**
* The result of matching a locale aware route.
*/
export interface LocaleAnalysisResult {
/**
* The pathname without the locale prefix (if any).
*/
pathname: string;
/**
* The detected locale. If no locale was detected, this will be `undefined`.
*/
detectedLocale?: string;
/**
* True if the locale was inferred from the default locale.
*/
inferredFromDefault: boolean;
}
type LocaleAnalysisOptions = {
/**
* When provided, it will be used as the default locale if the locale
* cannot be inferred from the pathname.
*/
defaultLocale?: string;
};
/**
* The I18NProvider is used to match locale aware routes, detect the locale from
* the pathname and hostname and normalize the pathname by removing the locale
* prefix.
*/
export declare class I18NProvider {
readonly config: Readonly<I18NConfig>;
private readonly lowerCaseLocales;
private readonly lowerCaseDomains?;
constructor(config: Readonly<I18NConfig>);
/**
* 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?: string, detectedLocale?: string): DomainLocale | undefined;
/**
* 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: string, query: NextParsedUrlQuery): LocaleAnalysisResult;
/**
* 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: string, options?: LocaleAnalysisOptions): LocaleAnalysisResult;
}
export {};

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 @@
{"version":3,"sources":["../../../../src/server/future/helpers/i18n-provider.ts"],"names":["I18NProvider","constructor","config","locales","length","Error","lowerCaseLocales","map","locale","toLowerCase","lowerCaseDomains","domains","domainLocale","domain","defaultLocale","hostname","split","http","detectDomainLocale","detectedLocale","i","some","fromQuery","pathname","query","__nextLocale","analysis","analyze","inferredFromDefault","__nextInferredLocaleFromDefault","options","segments","segment","index","indexOf","slice"],"mappings":";;;;+BAoCaA;;;eAAAA;;;AAAN,MAAMA;IAWXC,YAAY,AAAgBC,MAA4B,CAAE;YAMhCA;aANEA,SAAAA;QAC1B,IAAI,CAACA,OAAOC,OAAO,CAACC,MAAM,EAAE;YAC1B,MAAM,IAAIC,MAAM;QAClB;QAEA,IAAI,CAACC,gBAAgB,GAAGJ,OAAOC,OAAO,CAACI,GAAG,CAAC,CAACC,SAAWA,OAAOC,WAAW;QACzE,IAAI,CAACC,gBAAgB,IAAGR,kBAAAA,OAAOS,OAAO,qBAAdT,gBAAgBK,GAAG,CAAC,CAACK;gBAMhCA;YALX,MAAMC,SAASD,aAAaC,MAAM,CAACJ,WAAW;YAC9C,OAAO;gBACLK,eAAeF,aAAaE,aAAa,CAACL,WAAW;gBACrDM,UAAUF,OAAOG,KAAK,CAAC,KAAK,EAAE,CAAC,EAAE;gBACjCH;gBACAV,OAAO,GAAES,wBAAAA,aAAaT,OAAO,qBAApBS,sBAAsBL,GAAG,CAAC,CAACC,SAAWA,OAAOC,WAAW;gBACjEQ,MAAML,aAAaK,IAAI;YACzB;QACF;IACF;IAEA;;;;;;;GAOC,GACD,AAAOC,mBACLH,QAAiB,EACjBI,cAAuB,EACG;QAC1B,IAAI,CAACJ,YAAY,CAAC,IAAI,CAACL,gBAAgB,IAAI,CAAC,IAAI,CAACR,MAAM,CAACS,OAAO,EAAE;QAEjE,IAAIQ,gBAAgBA,iBAAiBA,eAAeV,WAAW;QAE/D,IAAK,IAAIW,IAAI,GAAGA,IAAI,IAAI,CAACV,gBAAgB,CAACN,MAAM,EAAEgB,IAAK;gBAKnD,sEAAsE;YACtE,yBAAyB;YACzBR;YANF,MAAMA,eAAe,IAAI,CAACF,gBAAgB,CAACU,EAAE;YAC7C,IACE,qDAAqD;YACrDR,aAAaG,QAAQ,KAAKA,cAG1BH,wBAAAA,aAAaT,OAAO,qBAApBS,sBAAsBS,IAAI,CAAC,CAACb,SAAWA,WAAWW,kBAClD;gBACA,OAAO,IAAI,CAACjB,MAAM,CAACS,OAAO,CAACS,EAAE;YAC/B;QACF;QAEA;IACF;IAEA;;;;;;;GAOC,GACD,AAAOE,UACLC,QAAgB,EAChBC,KAAyB,EACH;QACtB,MAAML,iBAAiBK,MAAMC,YAAY;QAEzC,wEAAwE;QACxE,2BAA2B;QAC3B,IAAIN,gBAAgB;YAClB,MAAMO,WAAW,IAAI,CAACC,OAAO,CAACJ;YAE9B,uEAAuE;YACvE,wCAAwC;YACxC,IAAIG,SAASP,cAAc,EAAE;gBAC3B,IAAIO,SAASP,cAAc,KAAKA,gBAAgB;oBAC9C,MAAM,IAAId,MACR,CAAC,yFAAyF,EAAEc,eAAe,MAAM,EAAEI,SAAS,aAAa,EAAEG,SAASP,cAAc,CAAC,EAAE,CAAC;gBAE1K;gBAEAI,WAAWG,SAASH,QAAQ;YAC9B;QACF;QAEA,OAAO;YACLA;YACAJ;YACAS,qBAAqBJ,MAAMK,+BAA+B,KAAK;QACjE;IACF;IAEA;;;;;;;GAOC,GACD,AAAOF,QACLJ,QAAgB,EAChBO,UAAiC,CAAC,CAAC,EACb;QACtB,IAAIX,iBAAqCW,QAAQhB,aAAa;QAE9D,0EAA0E;QAC1E,sBAAsB;QACtB,IAAIc,sBAAsB,OAAOT,mBAAmB;QAEpD,oEAAoE;QACpE,yEAAyE;QACzE,MAAMY,WAAWR,SAASP,KAAK,CAAC,KAAK;QACrC,IAAI,CAACe,QAAQ,CAAC,EAAE,EACd,OAAO;YACLZ;YACAI;YACAK;QACF;QAEF,0DAA0D;QAC1D,MAAMI,UAAUD,QAAQ,CAAC,EAAE,CAACtB,WAAW;QAEvC,yEAAyE;QACzE,mCAAmC;QACnC,MAAMwB,QAAQ,IAAI,CAAC3B,gBAAgB,CAAC4B,OAAO,CAACF;QAC5C,IAAIC,QAAQ,GACV,OAAO;YACLd;YACAI;YACAK;QACF;QAEF,oCAAoC;QACpCT,iBAAiB,IAAI,CAACjB,MAAM,CAACC,OAAO,CAAC8B,MAAM;QAC3CL,sBAAsB;QAEtB,gDAAgD;QAChDL,WAAWA,SAASY,KAAK,CAAChB,eAAef,MAAM,GAAG,MAAM;QAExD,OAAO;YACLe;YACAI;YACAK;QACF;IACF;AACF"}

View File

@ -0,0 +1 @@
export {};

View File

@ -0,0 +1,6 @@
export declare const INTERCEPTION_ROUTE_MARKERS: readonly ["(..)(..)", "(.)", "(..)", "(...)"];
export declare function isInterceptionRouteAppPath(path: string): boolean;
export declare function extractInterceptionRouteInformation(path: string): {
interceptingRoute: string;
interceptedRoute: string;
};

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 @@
{"version":3,"sources":["../../../../src/server/future/helpers/interception-routes.ts"],"names":["INTERCEPTION_ROUTE_MARKERS","extractInterceptionRouteInformation","isInterceptionRouteAppPath","path","split","find","segment","m","startsWith","undefined","interceptingRoute","marker","interceptedRoute","Error","normalizeAppPath","slice","concat","join","splitInterceptingRoute","length"],"mappings":";;;;;;;;;;;;;;;;IAGaA,0BAA0B;eAA1BA;;IAkBGC,mCAAmC;eAAnCA;;IAXAC,0BAA0B;eAA1BA;;;0BAViB;AAG1B,MAAMF,6BAA6B;IACxC;IACA;IACA;IACA;CACD;AAEM,SAASE,2BAA2BC,IAAY;IACrD,wCAAwC;IACxC,OACEA,KACGC,KAAK,CAAC,KACNC,IAAI,CAAC,CAACC,UACLN,2BAA2BK,IAAI,CAAC,CAACE,IAAMD,QAAQE,UAAU,CAACD,SACtDE;AAEZ;AAEO,SAASR,oCAAoCE,IAAY;IAC9D,IAAIO,mBACFC,QACAC;IAEF,KAAK,MAAMN,WAAWH,KAAKC,KAAK,CAAC,KAAM;QACrCO,SAASX,2BAA2BK,IAAI,CAAC,CAACE,IAAMD,QAAQE,UAAU,CAACD;QACnE,IAAII,QAAQ;YACT,CAACD,mBAAmBE,iBAAiB,GAAGT,KAAKC,KAAK,CAACO,QAAQ;YAC5D;QACF;IACF;IAEA,IAAI,CAACD,qBAAqB,CAACC,UAAU,CAACC,kBAAkB;QACtD,MAAM,IAAIC,MACR,CAAC,4BAA4B,EAAEV,KAAK,iFAAiF,CAAC;IAE1H;IAEAO,oBAAoBI,IAAAA,0BAAgB,EAACJ,mBAAmB,iDAAiD;;IAEzG,OAAQC;QACN,KAAK;YACH,oIAAoI;YACpI,IAAID,sBAAsB,KAAK;gBAC7BE,mBAAmB,CAAC,CAAC,EAAEA,iBAAiB,CAAC;YAC3C,OAAO;gBACLA,mBAAmBF,oBAAoB,MAAME;YAC/C;YACA;QACF,KAAK;YACH,uHAAuH;YACvH,IAAIF,sBAAsB,KAAK;gBAC7B,MAAM,IAAIG,MACR,CAAC,4BAA4B,EAAEV,KAAK,4DAA4D,CAAC;YAErG;YACAS,mBAAmBF,kBAChBN,KAAK,CAAC,KACNW,KAAK,CAAC,GAAG,CAAC,GACVC,MAAM,CAACJ,kBACPK,IAAI,CAAC;YACR;QACF,KAAK;YACH,kIAAkI;YAClIL,mBAAmB,MAAMA;YACzB;QACF,KAAK;YACH,iIAAiI;YAEjI,MAAMM,yBAAyBR,kBAAkBN,KAAK,CAAC;YACvD,IAAIc,uBAAuBC,MAAM,IAAI,GAAG;gBACtC,MAAM,IAAIN,MACR,CAAC,4BAA4B,EAAEV,KAAK,+DAA+D,CAAC;YAExG;YAEAS,mBAAmBM,uBAChBH,KAAK,CAAC,GAAG,CAAC,GACVC,MAAM,CAACJ,kBACPK,IAAI,CAAC;YACR;QACF;YACE,MAAM,IAAIJ,MAAM;IACpB;IAEA,OAAO;QAAEH;QAAmBE;IAAiB;AAC/C"}

View File

@ -0,0 +1 @@
export {};

View File

@ -0,0 +1,6 @@
/**
* Loads a given module for a given ID.
*/
export interface ModuleLoader {
load<M = any>(id: string): Promise<M>;
}

View File

@ -0,0 +1,8 @@
/**
* Loads a given module for a given ID.
*/ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//# sourceMappingURL=module-loader.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../../../src/server/future/helpers/module-loader/module-loader.ts"],"names":[],"mappings":"AAAA;;CAEC"}

View File

@ -0,0 +1,7 @@
import type { ModuleLoader } from './module-loader';
/**
* Loads a module using `await require(id)`.
*/
export declare class NodeModuleLoader implements ModuleLoader {
load<M>(id: string): Promise<M>;
}

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 @@
{"version":3,"sources":["../../../../../src/server/future/helpers/module-loader/node-module-loader.ts"],"names":["NodeModuleLoader","load","id","process","env","NEXT_RUNTIME","NEXT_MINIMAL","__non_webpack_require__","require","Error"],"mappings":";;;;+BAKaA;;;eAAAA;;;AAAN,MAAMA;IACX,MAAaC,KAAQC,EAAU,EAAc;QAC3C,IAAIC,QAAQC,GAAG,CAACC,YAAY,KAAK,QAAQ;YACvC,wFAAwF;YACxF,OAAO,MAAOF,CAAAA,QAAQC,GAAG,CAACE,YAAY,GAElCC,wBAAwBL,MACxBM,QAAQN,GAAE;QAChB;QAEA,MAAM,IAAIO,MAAM;IAClB;AACF"}

View File

@ -0,0 +1,8 @@
import type { RouteModule } from '../../route-modules/route-module';
import type { ModuleLoader } from './module-loader';
export interface AppLoaderModule<M extends RouteModule = RouteModule> {
routeModule: M;
}
export declare class RouteModuleLoader {
static load<M extends RouteModule>(id: string, loader?: ModuleLoader): Promise<M>;
}

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 @@
{"version":3,"sources":["../../../../../src/server/future/helpers/module-loader/route-module-loader.ts"],"names":["RouteModuleLoader","load","id","loader","NodeModuleLoader","module","routeModule","Error"],"mappings":";;;;+BASaA;;;eAAAA;;;kCANoB;AAM1B,MAAMA;IACX,aAAaC,KACXC,EAAU,EACVC,SAAuB,IAAIC,kCAAgB,EAAE,EACjC;QACZ,MAAMC,SAA6B,MAAMF,OAAOF,IAAI,CAACC;QACrD,IAAI,iBAAiBG,QAAQ;YAC3B,OAAOA,OAAOC,WAAW;QAC3B;QAEA,MAAM,IAAIC,MAAM,CAAC,QAAQ,EAAEL,GAAG,gCAAgC,CAAC;IACjE;AACF"}

View File

@ -0,0 +1,19 @@
import type { PAGE_TYPES } from '../../../lib/page-types';
import type { Normalizer } from './normalizer';
/**
* Normalizes a given filename so that it's relative to the provided directory.
* It will also strip the extension (if provided) and the trailing `/index`.
*/
export declare class AbsoluteFilenameNormalizer implements Normalizer {
private readonly dir;
private readonly extensions;
private readonly pagesType;
/**
*
* @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: string, extensions: ReadonlyArray<string>, pagesType: PAGE_TYPES);
normalize(filename: string): string;
}

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 @@
{"version":3,"sources":["../../../../src/server/future/normalizers/absolute-filename-normalizer.ts"],"names":["AbsoluteFilenameNormalizer","constructor","dir","extensions","pagesType","normalize","filename","absolutePathToPage","keepIndex"],"mappings":";;;;+BAQaA;;;eAAAA;;;oCAPsB;AAO5B,MAAMA;IACX;;;;;GAKC,GACDC,YACE,AAAiBC,GAAW,EAC5B,AAAiBC,UAAiC,EAClD,AAAiBC,SAAqB,CACtC;aAHiBF,MAAAA;aACAC,aAAAA;aACAC,YAAAA;IAChB;IAEIC,UAAUC,QAAgB,EAAU;QACzC,OAAOC,IAAAA,sCAAkB,EAACD,UAAU;YAClCH,YAAY,IAAI,CAACA,UAAU;YAC3BK,WAAW;YACXN,KAAK,IAAI,CAACA,GAAG;YACbE,WAAW,IAAI,CAACA,SAAS;QAC3B;IACF;AACF"}

View File

@ -0,0 +1 @@
export {};

View File

@ -0,0 +1,11 @@
import { Normalizers } from '../../normalizers';
import type { Normalizer } from '../../normalizer';
import { PrefixingNormalizer } from '../../prefixing-normalizer';
export declare class AppBundlePathNormalizer extends PrefixingNormalizer {
constructor();
normalize(page: string): string;
}
export declare class DevAppBundlePathNormalizer extends Normalizers {
constructor(pageNormalizer: Normalizer);
normalize(filename: string): string;
}

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 @@
{"version":3,"sources":["../../../../../../src/server/future/normalizers/built/app/app-bundle-path-normalizer.ts"],"names":["AppBundlePathNormalizer","DevAppBundlePathNormalizer","PrefixingNormalizer","constructor","normalize","page","normalizePagePath","Normalizers","pageNormalizer","filename"],"mappings":";;;;;;;;;;;;;;;IAKaA,uBAAuB;eAAvBA;;IAUAC,0BAA0B;eAA1BA;;;6BAfe;qCAEQ;mCACF;AAE3B,MAAMD,gCAAgCE,wCAAmB;IAC9DC,aAAc;QACZ,KAAK,CAAC;IACR;IAEOC,UAAUC,IAAY,EAAU;QACrC,OAAO,KAAK,CAACD,UAAUE,IAAAA,oCAAiB,EAACD;IAC3C;AACF;AAEO,MAAMJ,mCAAmCM,wBAAW;IACzDJ,YAAYK,cAA0B,CAAE;QACtC,KAAK,CAAC;YACJ,gDAAgD;YAChDA;YACA,wCAAwC;YACxC,IAAIR;SACL;IACH;IAEOI,UAAUK,QAAgB,EAAU;QACzC,OAAO,KAAK,CAACL,UAAUK;IACzB;AACF"}

View File

@ -0,0 +1,5 @@
import { PrefixingNormalizer } from '../../prefixing-normalizer';
export declare class AppFilenameNormalizer extends PrefixingNormalizer {
constructor(distDir: string);
normalize(manifestFilename: string): string;
}

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 @@
{"version":3,"sources":["../../../../../../src/server/future/normalizers/built/app/app-filename-normalizer.ts"],"names":["AppFilenameNormalizer","PrefixingNormalizer","constructor","distDir","SERVER_DIRECTORY","normalize","manifestFilename"],"mappings":";;;;+BAGaA;;;eAAAA;;;2BAHoB;qCACG;AAE7B,MAAMA,8BAA8BC,wCAAmB;IAC5DC,YAAYC,OAAe,CAAE;QAC3B,KAAK,CAACA,SAASC,2BAAgB;IACjC;IAEOC,UAAUC,gBAAwB,EAAU;QACjD,OAAO,KAAK,CAACD,UAAUC;IACzB;AACF"}

View File

@ -0,0 +1,8 @@
import { AbsoluteFilenameNormalizer } from '../../absolute-filename-normalizer';
/**
* DevAppPageNormalizer is a normalizer that is used to normalize a pathname
* to a page in the `app` directory.
*/
export declare class DevAppPageNormalizer extends AbsoluteFilenameNormalizer {
constructor(appDir: string, extensions: ReadonlyArray<string>);
}

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 @@
{"version":3,"sources":["../../../../../../src/server/future/normalizers/built/app/app-page-normalizer.ts"],"names":["DevAppPageNormalizer","AbsoluteFilenameNormalizer","constructor","appDir","extensions","PAGE_TYPES","APP"],"mappings":";;;;+BAOaA;;;eAAAA;;;2BAPc;4CACgB;AAMpC,MAAMA,6BAA6BC,sDAA0B;IAClEC,YAAYC,MAAc,EAAEC,UAAiC,CAAE;QAC7D,KAAK,CAACD,QAAQC,YAAYC,qBAAU,CAACC,GAAG;IAC1C;AACF"}

View File

@ -0,0 +1,10 @@
import { Normalizers } from '../../normalizers';
import type { Normalizer } from '../../normalizer';
export declare class AppPathnameNormalizer extends Normalizers {
constructor();
normalize(page: string): string;
}
export declare class DevAppPathnameNormalizer extends Normalizers {
constructor(pageNormalizer: Normalizer);
normalize(filename: string): string;
}

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 @@
{"version":3,"sources":["../../../../../../src/server/future/normalizers/built/app/app-pathname-normalizer.ts"],"names":["AppPathnameNormalizer","DevAppPathnameNormalizer","Normalizers","constructor","wrapNormalizerFn","normalizeAppPath","UnderscoreNormalizer","normalize","page","pageNormalizer","filename"],"mappings":";;;;;;;;;;;;;;;IAMaA,qBAAqB;eAArBA;;IAgBAC,wBAAwB;eAAxBA;;;0BAtBoB;6BACL;kCACK;sCACI;AAG9B,MAAMD,8BAA8BE,wBAAW;IACpDC,aAAc;QACZ,KAAK,CAAC;YACJ,yEAAyE;YACzE,sCAAsC;YACtCC,IAAAA,kCAAgB,EAACC,0BAAgB;YACjC,0EAA0E;YAC1E,IAAIC,0CAAoB;SACzB;IACH;IAEOC,UAAUC,IAAY,EAAU;QACrC,OAAO,KAAK,CAACD,UAAUC;IACzB;AACF;AAEO,MAAMP,iCAAiCC,wBAAW;IACvDC,YAAYM,cAA0B,CAAE;QACtC,KAAK,CAAC;YACJ,gDAAgD;YAChDA;YACA,wCAAwC;YACxC,IAAIT;SACL;IACH;IAEOO,UAAUG,QAAgB,EAAU;QACzC,OAAO,KAAK,CAACH,UAAUG;IACzB;AACF"}

View File

@ -0,0 +1,16 @@
import { AppBundlePathNormalizer, DevAppBundlePathNormalizer } from './app-bundle-path-normalizer';
import { AppFilenameNormalizer } from './app-filename-normalizer';
import { DevAppPageNormalizer } from './app-page-normalizer';
import { AppPathnameNormalizer, DevAppPathnameNormalizer } from './app-pathname-normalizer';
export declare class AppNormalizers {
readonly filename: AppFilenameNormalizer;
readonly pathname: AppPathnameNormalizer;
readonly bundlePath: AppBundlePathNormalizer;
constructor(distDir: string);
}
export declare class DevAppNormalizers {
readonly page: DevAppPageNormalizer;
readonly pathname: DevAppPathnameNormalizer;
readonly bundlePath: DevAppBundlePathNormalizer;
constructor(appDir: string, extensions: ReadonlyArray<string>);
}

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 @@
{"version":3,"sources":["../../../../../../src/server/future/normalizers/built/app/index.ts"],"names":["AppNormalizers","DevAppNormalizers","constructor","distDir","filename","AppFilenameNormalizer","pathname","AppPathnameNormalizer","bundlePath","AppBundlePathNormalizer","appDir","extensions","page","DevAppPageNormalizer","DevAppPathnameNormalizer","DevAppBundlePathNormalizer"],"mappings":";;;;;;;;;;;;;;;IAWaA,cAAc;eAAdA;;IAYAC,iBAAiB;eAAjBA;;;yCApBN;uCAC+B;mCACD;uCAI9B;AAEA,MAAMD;IAKXE,YAAYC,OAAe,CAAE;QAC3B,IAAI,CAACC,QAAQ,GAAG,IAAIC,4CAAqB,CAACF;QAC1C,IAAI,CAACG,QAAQ,GAAG,IAAIC,4CAAqB;QACzC,IAAI,CAACC,UAAU,GAAG,IAAIC,gDAAuB;IAC/C;AACF;AAEO,MAAMR;IAKXC,YAAYQ,MAAc,EAAEC,UAAiC,CAAE;QAC7D,IAAI,CAACC,IAAI,GAAG,IAAIC,uCAAoB,CAACH,QAAQC;QAC7C,IAAI,CAACL,QAAQ,GAAG,IAAIQ,+CAAwB,CAAC,IAAI,CAACF,IAAI;QACtD,IAAI,CAACJ,UAAU,GAAG,IAAIO,mDAA0B,CAAC,IAAI,CAACH,IAAI;IAC5D;AACF"}

View File

@ -0,0 +1,15 @@
import { DevPagesBundlePathNormalizer, PagesBundlePathNormalizer } from './pages-bundle-path-normalizer';
import { PagesFilenameNormalizer } from './pages-filename-normalizer';
import { DevPagesPageNormalizer } from './pages-page-normalizer';
import { DevPagesPathnameNormalizer } from './pages-pathname-normalizer';
export declare class PagesNormalizers {
readonly filename: PagesFilenameNormalizer;
readonly bundlePath: PagesBundlePathNormalizer;
constructor(distDir: string);
}
export declare class DevPagesNormalizers {
readonly page: DevPagesPageNormalizer;
readonly pathname: DevPagesPathnameNormalizer;
readonly bundlePath: DevPagesBundlePathNormalizer;
constructor(pagesDir: string, extensions: ReadonlyArray<string>);
}

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 @@
{"version":3,"sources":["../../../../../../src/server/future/normalizers/built/pages/index.ts"],"names":["DevPagesNormalizers","PagesNormalizers","constructor","distDir","filename","PagesFilenameNormalizer","bundlePath","PagesBundlePathNormalizer","pagesDir","extensions","page","DevPagesPageNormalizer","pathname","DevPagesPathnameNormalizer","DevPagesBundlePathNormalizer"],"mappings":";;;;;;;;;;;;;;;IAsBaA,mBAAmB;eAAnBA;;IAdAC,gBAAgB;eAAhBA;;;2CALN;yCACiC;qCACD;yCACI;AAEpC,MAAMA;IAIXC,YAAYC,OAAe,CAAE;QAC3B,IAAI,CAACC,QAAQ,GAAG,IAAIC,gDAAuB,CAACF;QAC5C,IAAI,CAACG,UAAU,GAAG,IAAIC,oDAAyB;IAE/C,sEAAsE;IACtE,sEAAsE;IACtE,wEAAwE;IAC1E;AACF;AAEO,MAAMP;IAKXE,YAAYM,QAAgB,EAAEC,UAAiC,CAAE;QAC/D,IAAI,CAACC,IAAI,GAAG,IAAIC,2CAAsB,CAACH,UAAUC;QACjD,IAAI,CAACG,QAAQ,GAAG,IAAIC,mDAA0B,CAACL,UAAUC;QACzD,IAAI,CAACH,UAAU,GAAG,IAAIQ,uDAA4B,CAAC,IAAI,CAACJ,IAAI;IAC9D;AACF"}

View File

@ -0,0 +1,10 @@
import type { Normalizer } from '../../normalizer';
import { Normalizers } from '../../normalizers';
export declare class PagesBundlePathNormalizer extends Normalizers {
constructor();
normalize(page: string): string;
}
export declare class DevPagesBundlePathNormalizer extends Normalizers {
constructor(pagesNormalizer: Normalizer);
normalize(filename: string): string;
}

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 @@
{"version":3,"sources":["../../../../../../src/server/future/normalizers/built/pages/pages-bundle-path-normalizer.ts"],"names":["DevPagesBundlePathNormalizer","PagesBundlePathNormalizer","Normalizers","constructor","wrapNormalizerFn","normalizePagePath","PrefixingNormalizer","normalize","page","pagesNormalizer","filename"],"mappings":";;;;;;;;;;;;;;;IAsBaA,4BAA4B;eAA5BA;;IAhBAC,yBAAyB;eAAzBA;;;mCANqB;6BAEN;qCACQ;kCACH;AAE1B,MAAMA,kCAAkCC,wBAAW;IACxDC,aAAc;QACZ,KAAK,CAAC;YACJ,kEAAkE;YAClE,MAAM;YACNC,IAAAA,kCAAgB,EAACC,oCAAiB;YAClC,0CAA0C;YAC1C,IAAIC,wCAAmB,CAAC;SACzB;IACH;IAEOC,UAAUC,IAAY,EAAU;QACrC,OAAO,KAAK,CAACD,UAAUC;IACzB;AACF;AAEO,MAAMR,qCAAqCE,wBAAW;IAC3DC,YAAYM,eAA2B,CAAE;QACvC,KAAK,CAAC;YACJ,gDAAgD;YAChDA;YACA,wCAAwC;YACxC,IAAIR;SACL;IACH;IAEOM,UAAUG,QAAgB,EAAU;QACzC,OAAO,KAAK,CAACH,UAAUG;IACzB;AACF"}

View File

@ -0,0 +1,5 @@
import { PrefixingNormalizer } from '../../prefixing-normalizer';
export declare class PagesFilenameNormalizer extends PrefixingNormalizer {
constructor(distDir: string);
normalize(manifestFilename: string): string;
}

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 @@
{"version":3,"sources":["../../../../../../src/server/future/normalizers/built/pages/pages-filename-normalizer.ts"],"names":["PagesFilenameNormalizer","PrefixingNormalizer","constructor","distDir","SERVER_DIRECTORY","normalize","manifestFilename"],"mappings":";;;;+BAGaA;;;eAAAA;;;2BAHoB;qCACG;AAE7B,MAAMA,gCAAgCC,wCAAmB;IAC9DC,YAAYC,OAAe,CAAE;QAC3B,KAAK,CAACA,SAASC,2BAAgB;IACjC;IAEOC,UAAUC,gBAAwB,EAAU;QACjD,OAAO,KAAK,CAACD,UAAUC;IACzB;AACF"}

View File

@ -0,0 +1,4 @@
import { AbsoluteFilenameNormalizer } from '../../absolute-filename-normalizer';
export declare class DevPagesPageNormalizer extends AbsoluteFilenameNormalizer {
constructor(pagesDir: string, extensions: ReadonlyArray<string>);
}

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 @@
{"version":3,"sources":["../../../../../../src/server/future/normalizers/built/pages/pages-page-normalizer.ts"],"names":["DevPagesPageNormalizer","AbsoluteFilenameNormalizer","constructor","pagesDir","extensions","PAGE_TYPES","PAGES"],"mappings":";;;;+BAGaA;;;eAAAA;;;2BAHc;4CACgB;AAEpC,MAAMA,+BAA+BC,sDAA0B;IACpEC,YAAYC,QAAgB,EAAEC,UAAiC,CAAE;QAC/D,KAAK,CAACD,UAAUC,YAAYC,qBAAU,CAACC,KAAK;IAC9C;AACF"}

View File

@ -0,0 +1,4 @@
import { AbsoluteFilenameNormalizer } from '../../absolute-filename-normalizer';
export declare class DevPagesPathnameNormalizer extends AbsoluteFilenameNormalizer {
constructor(pagesDir: string, extensions: ReadonlyArray<string>);
}

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 @@
{"version":3,"sources":["../../../../../../src/server/future/normalizers/built/pages/pages-pathname-normalizer.ts"],"names":["DevPagesPathnameNormalizer","AbsoluteFilenameNormalizer","constructor","pagesDir","extensions","PAGE_TYPES","PAGES"],"mappings":";;;;+BAGaA;;;eAAAA;;;2BAHc;4CACgB;AAEpC,MAAMA,mCAAmCC,sDAA0B;IACxEC,YAAYC,QAAgB,EAAEC,UAAiC,CAAE;QAC/D,KAAK,CAACD,UAAUC,YAAYC,qBAAU,CAACC,KAAK;IAC9C;AACF"}

View File

@ -0,0 +1,16 @@
import type { I18NProvider } from '../helpers/i18n-provider';
import type { Normalizer } from './normalizer';
/**
* Normalizes the pathname by removing the locale prefix if any.
*/
export declare class LocaleRouteNormalizer implements Normalizer {
private readonly provider;
constructor(provider: I18NProvider);
/**
* 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: string): string;
}

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 @@
{"version":3,"sources":["../../../../src/server/future/normalizers/locale-route-normalizer.ts"],"names":["LocaleRouteNormalizer","constructor","provider","normalize","pathname","match","analyze"],"mappings":";;;;+BAMaA;;;eAAAA;;;AAAN,MAAMA;IACXC,YAAY,AAAiBC,QAAsB,CAAE;aAAxBA,WAAAA;IAAyB;IAEtD;;;;;GAKC,GACD,AAAOC,UAAUC,QAAgB,EAAU;QACzC,MAAMC,QAAQ,IAAI,CAACH,QAAQ,CAACI,OAAO,CAACF;QACpC,OAAOC,MAAMD,QAAQ;IACvB;AACF"}

View File

@ -0,0 +1,3 @@
export interface Normalizer {
normalize(pathname: string): string;
}

View File

@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//# sourceMappingURL=normalizer.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":[],"names":[],"mappings":""}

View File

@ -0,0 +1,11 @@
import type { Normalizer } from './normalizer';
/**
* Normalizers combines many normalizers into a single normalizer interface that
* will normalize the inputted pathname with each normalizer in order.
*/
export declare class Normalizers implements Normalizer {
private readonly normalizers;
constructor(normalizers?: Array<Normalizer>);
push(normalizer: Normalizer): void;
normalize(pathname: string): string;
}

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 @@
{"version":3,"sources":["../../../../src/server/future/normalizers/normalizers.ts"],"names":["Normalizers","constructor","normalizers","push","normalizer","normalize","pathname","reduce","normalized"],"mappings":";;;;+BAMaA;;;eAAAA;;;AAAN,MAAMA;IACXC,YAAY,AAAiBC,cAAiC,EAAE,CAAE;aAArCA,cAAAA;IAAsC;IAE5DC,KAAKC,UAAsB,EAAE;QAClC,IAAI,CAACF,WAAW,CAACC,IAAI,CAACC;IACxB;IAEOC,UAAUC,QAAgB,EAAU;QACzC,OAAO,IAAI,CAACJ,WAAW,CAACK,MAAM,CAC5B,CAACC,YAAYJ,aAAeA,WAAWC,SAAS,CAACG,aACjDF;IAEJ;AACF"}

View File

@ -0,0 +1,6 @@
import type { Normalizer } from './normalizer';
export declare class PrefixingNormalizer implements Normalizer {
private readonly prefix;
constructor(...prefixes: ReadonlyArray<string>);
normalize(pathname: string): string;
}

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 @@
{"version":3,"sources":["../../../../src/server/future/normalizers/prefixing-normalizer.ts"],"names":["PrefixingNormalizer","constructor","prefixes","prefix","path","posix","join","normalize","pathname"],"mappings":";;;;+BAGaA;;;eAAAA;;;6DAHI;;;;;;AAGV,MAAMA;IAGXC,YAAY,GAAGC,QAA+B,CAAE;QAC9C,IAAI,CAACC,MAAM,GAAGC,aAAI,CAACC,KAAK,CAACC,IAAI,IAAIJ;IACnC;IAEOK,UAAUC,QAAgB,EAAU;QACzC,OAAOJ,aAAI,CAACC,KAAK,CAACC,IAAI,CAAC,IAAI,CAACH,MAAM,EAAEK;IACtC;AACF"}

View File

@ -0,0 +1,5 @@
import type { PathnameNormalizer } from './pathname-normalizer';
import { SuffixPathnameNormalizer } from './suffix';
export declare class ActionPathnameNormalizer extends SuffixPathnameNormalizer implements PathnameNormalizer {
constructor();
}

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 @@
{"version":3,"sources":["../../../../../src/server/future/normalizers/request/action.ts"],"names":["ActionPathnameNormalizer","SuffixPathnameNormalizer","constructor","ACTION_SUFFIX"],"mappings":";;;;+BAKaA;;;eAAAA;;;2BAHiB;wBACW;AAElC,MAAMA,iCACHC,gCAAwB;IAGhCC,aAAc;QACZ,KAAK,CAACC,wBAAa;IACrB;AACF"}

View File

@ -0,0 +1,5 @@
import type { PathnameNormalizer } from './pathname-normalizer';
import { PrefixPathnameNormalizer } from './prefix';
export declare class BasePathPathnameNormalizer extends PrefixPathnameNormalizer implements PathnameNormalizer {
constructor(basePath: string);
}

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 @@
{"version":3,"sources":["../../../../../src/server/future/normalizers/request/base-path.ts"],"names":["BasePathPathnameNormalizer","PrefixPathnameNormalizer","constructor","basePath","Error"],"mappings":";;;;+BAIaA;;;eAAAA;;;wBAF4B;AAElC,MAAMA,mCACHC,gCAAwB;IAGhCC,YAAYC,QAAgB,CAAE;QAC5B,IAAI,CAACA,YAAYA,aAAa,KAAK;YACjC,MAAM,IAAIC,MAAM;QAClB;QAEA,KAAK,CAACD;IACR;AACF"}

View File

@ -0,0 +1 @@
export {};

View File

@ -0,0 +1,8 @@
import type { PathnameNormalizer } from './pathname-normalizer';
export declare class NextDataPathnameNormalizer implements PathnameNormalizer {
private readonly prefix;
private readonly suffix;
constructor(buildID: string);
match(pathname: string): boolean;
normalize(pathname: string, matched?: boolean): string;
}

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 @@
{"version":3,"sources":["../../../../../src/server/future/normalizers/request/next-data.ts"],"names":["NextDataPathnameNormalizer","constructor","buildID","suffix","SuffixPathnameNormalizer","Error","prefix","PrefixPathnameNormalizer","match","pathname","normalize","matched","denormalizePagePath"],"mappings":";;;;+BAMaA;;;eAAAA;;;qCAJuB;wBACK;wBACA;AAElC,MAAMA;IAGXC,YAAYC,OAAe,CAAE;aADZC,SAAS,IAAIC,gCAAwB,CAAC;QAErD,IAAI,CAACF,SAAS;YACZ,MAAM,IAAIG,MAAM;QAClB;QAEA,IAAI,CAACC,MAAM,GAAG,IAAIC,gCAAwB,CAAC,CAAC,YAAY,EAAEL,QAAQ,CAAC;IACrE;IAEOM,MAAMC,QAAgB,EAAE;QAC7B,OAAO,IAAI,CAACH,MAAM,CAACE,KAAK,CAACC,aAAa,IAAI,CAACN,MAAM,CAACK,KAAK,CAACC;IAC1D;IAEOC,UAAUD,QAAgB,EAAEE,OAAiB,EAAU;QAC5D,uEAAuE;QACvE,IAAI,CAACA,WAAW,CAAC,IAAI,CAACH,KAAK,CAACC,WAAW,OAAOA;QAE9CA,WAAW,IAAI,CAACH,MAAM,CAACI,SAAS,CAACD,UAAU;QAC3CA,WAAW,IAAI,CAACN,MAAM,CAACO,SAAS,CAACD,UAAU;QAE3C,OAAOG,IAAAA,wCAAmB,EAACH;IAC7B;AACF"}

View File

@ -0,0 +1 @@
export {};

View File

@ -0,0 +1,5 @@
import type { Normalizer } from '../normalizer';
export interface PathnameNormalizer extends Normalizer {
match(pathname: string): boolean;
normalize(pathname: string, matched?: boolean): string;
}

View File

@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//# sourceMappingURL=pathname-normalizer.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":[],"names":[],"mappings":""}

View File

@ -0,0 +1,6 @@
import type { PathnameNormalizer } from './pathname-normalizer';
import { PrefixPathnameNormalizer } from './prefix';
export declare class PostponedPathnameNormalizer extends PrefixPathnameNormalizer implements PathnameNormalizer {
constructor();
normalize(pathname: string, matched?: boolean): string;
}

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 @@
{"version":3,"sources":["../../../../../src/server/future/normalizers/request/postponed.ts"],"names":["PostponedPathnameNormalizer","prefix","PrefixPathnameNormalizer","constructor","normalize","pathname","matched","match","denormalizePagePath"],"mappings":";;;;+BAOaA;;;eAAAA;;;qCAPuB;wBAGK;AAEzC,MAAMC,SAAS;AAER,MAAMD,oCACHE,gCAAwB;IAGhCC,aAAc;QACZ,KAAK,CAACF;IACR;IAEOG,UAAUC,QAAgB,EAAEC,OAAiB,EAAU;QAC5D,uEAAuE;QACvE,IAAI,CAACA,WAAW,CAAC,IAAI,CAACC,KAAK,CAACF,WAAW,OAAOA;QAE9C,qBAAqB;QACrBA,WAAW,KAAK,CAACD,UAAUC,UAAU;QAErC,OAAOG,IAAAA,wCAAmB,EAACH;IAC7B;AACF"}

View File

@ -0,0 +1 @@
export {};

View File

@ -0,0 +1,5 @@
import type { PathnameNormalizer } from './pathname-normalizer';
import { SuffixPathnameNormalizer } from './suffix';
export declare class PrefetchRSCPathnameNormalizer extends SuffixPathnameNormalizer implements PathnameNormalizer {
constructor();
}

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 @@
{"version":3,"sources":["../../../../../src/server/future/normalizers/request/prefetch-rsc.ts"],"names":["PrefetchRSCPathnameNormalizer","SuffixPathnameNormalizer","constructor","RSC_PREFETCH_SUFFIX"],"mappings":";;;;+BAKaA;;;eAAAA;;;2BAHuB;wBACK;AAElC,MAAMA,sCACHC,gCAAwB;IAGhCC,aAAc;QACZ,KAAK,CAACC,8BAAmB;IAC3B;AACF"}

View File

@ -0,0 +1,7 @@
import type { Normalizer } from '../normalizer';
export declare class PrefixPathnameNormalizer implements Normalizer {
private readonly prefix;
constructor(prefix: string);
match(pathname: string): boolean;
normalize(pathname: string, matched?: boolean): string;
}

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 @@
{"version":3,"sources":["../../../../../src/server/future/normalizers/request/prefix.ts"],"names":["PrefixPathnameNormalizer","constructor","prefix","endsWith","Error","match","pathname","startsWith","normalize","matched","length","substring"],"mappings":";;;;+BAEaA;;;eAAAA;;;AAAN,MAAMA;IACXC,YAAY,AAAiBC,MAAc,CAAE;aAAhBA,SAAAA;QAC3B,IAAIA,OAAOC,QAAQ,CAAC,MAAM;YACxB,MAAM,IAAIC,MACR,CAAC,kCAAkC,EAAEF,OAAO,6BAA6B,CAAC;QAE9E;IACF;IAEOG,MAAMC,QAAgB,EAAE;QAC7B,iEAAiE;QACjE,IAAIA,aAAa,IAAI,CAACJ,MAAM,IAAI,CAACI,SAASC,UAAU,CAAC,IAAI,CAACL,MAAM,GAAG,MAAM;YACvE,OAAO;QACT;QAEA,OAAO;IACT;IAEOM,UAAUF,QAAgB,EAAEG,OAAiB,EAAU;QAC5D,uEAAuE;QACvE,IAAI,CAACA,WAAW,CAAC,IAAI,CAACJ,KAAK,CAACC,WAAW,OAAOA;QAE9C,IAAIA,SAASI,MAAM,KAAK,IAAI,CAACR,MAAM,CAACQ,MAAM,EAAE;YAC1C,OAAO;QACT;QAEA,OAAOJ,SAASK,SAAS,CAAC,IAAI,CAACT,MAAM,CAACQ,MAAM;IAC9C;AACF"}

View File

@ -0,0 +1 @@
export {};

View File

@ -0,0 +1,5 @@
import type { PathnameNormalizer } from './pathname-normalizer';
import { SuffixPathnameNormalizer } from './suffix';
export declare class RSCPathnameNormalizer extends SuffixPathnameNormalizer implements PathnameNormalizer {
constructor();
}

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 @@
{"version":3,"sources":["../../../../../src/server/future/normalizers/request/rsc.ts"],"names":["RSCPathnameNormalizer","SuffixPathnameNormalizer","constructor","RSC_SUFFIX"],"mappings":";;;;+BAKaA;;;eAAAA;;;2BAHc;wBACc;AAElC,MAAMA,8BACHC,gCAAwB;IAGhCC,aAAc;QACZ,KAAK,CAACC,qBAAU;IAClB;AACF"}

View File

@ -0,0 +1,7 @@
import type { Normalizer } from '../normalizer';
export declare class SuffixPathnameNormalizer implements Normalizer {
private readonly suffix;
constructor(suffix: string);
match(pathname: string): boolean;
normalize(pathname: string, matched?: boolean): string;
}

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 @@
{"version":3,"sources":["../../../../../src/server/future/normalizers/request/suffix.ts"],"names":["SuffixPathnameNormalizer","constructor","suffix","match","pathname","endsWith","normalize","matched","substring","length"],"mappings":";;;;+BAEaA;;;eAAAA;;;AAAN,MAAMA;IACXC,YAAY,AAAiBC,MAAc,CAAE;aAAhBA,SAAAA;IAAiB;IAEvCC,MAAMC,QAAgB,EAAE;QAC7B,6DAA6D;QAC7D,IAAI,CAACA,SAASC,QAAQ,CAAC,IAAI,CAACH,MAAM,GAAG,OAAO;QAE5C,OAAO;IACT;IAEOI,UAAUF,QAAgB,EAAEG,OAAiB,EAAU;QAC5D,uEAAuE;QACvE,IAAI,CAACA,WAAW,CAAC,IAAI,CAACJ,KAAK,CAACC,WAAW,OAAOA;QAE9C,OAAOA,SAASI,SAAS,CAAC,GAAGJ,SAASK,MAAM,GAAG,IAAI,CAACP,MAAM,CAACO,MAAM;IACnE;AACF"}

View File

@ -0,0 +1 @@
export {};

View File

@ -0,0 +1,7 @@
import type { Normalizer } from './normalizer';
/**
* UnderscoreNormalizer replaces all instances of %5F with _.
*/
export declare class UnderscoreNormalizer implements Normalizer {
normalize(pathname: string): string;
}

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 @@
{"version":3,"sources":["../../../../src/server/future/normalizers/underscore-normalizer.ts"],"names":["UnderscoreNormalizer","normalize","pathname","replace"],"mappings":";;;;+BAKaA;;;eAAAA;;;AAAN,MAAMA;IACJC,UAAUC,QAAgB,EAAU;QACzC,OAAOA,SAASC,OAAO,CAAC,QAAQ;IAClC;AACF"}

View File

@ -0,0 +1,2 @@
import type { Normalizer } from './normalizer';
export declare function wrapNormalizerFn(fn: (pathname: string) => string): Normalizer;

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

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