Initial boiler plate project
This commit is contained in:
6
node_modules/next/dist/shared/lib/router/utils/add-locale.d.ts
generated
vendored
Normal file
6
node_modules/next/dist/shared/lib/router/utils/add-locale.d.ts
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
/**
|
||||
* For a given path and a locale, if the locale is given, it will prefix the
|
||||
* locale. The path shouldn't be an API path. If a default locale is given the
|
||||
* prefix will be omitted if the locale is already the default locale.
|
||||
*/
|
||||
export declare function addLocale(path: string, locale?: string | false, defaultLocale?: string, ignorePrefix?: boolean): string;
|
||||
28
node_modules/next/dist/shared/lib/router/utils/add-locale.js
generated
vendored
Normal file
28
node_modules/next/dist/shared/lib/router/utils/add-locale.js
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "addLocale", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return addLocale;
|
||||
}
|
||||
});
|
||||
const _addpathprefix = require("./add-path-prefix");
|
||||
const _pathhasprefix = require("./path-has-prefix");
|
||||
function addLocale(path, locale, defaultLocale, ignorePrefix) {
|
||||
// If no locale was given or the locale is the default locale, we don't need
|
||||
// to prefix the path.
|
||||
if (!locale || locale === defaultLocale) return path;
|
||||
const lower = path.toLowerCase();
|
||||
// If the path is an API path or the path already has the locale prefix, we
|
||||
// don't need to prefix the path.
|
||||
if (!ignorePrefix) {
|
||||
if ((0, _pathhasprefix.pathHasPrefix)(lower, "/api")) return path;
|
||||
if ((0, _pathhasprefix.pathHasPrefix)(lower, "/" + locale.toLowerCase())) return path;
|
||||
}
|
||||
// Add the locale prefix to the path.
|
||||
return (0, _addpathprefix.addPathPrefix)(path, "/" + locale);
|
||||
}
|
||||
|
||||
//# sourceMappingURL=add-locale.js.map
|
||||
1
node_modules/next/dist/shared/lib/router/utils/add-locale.js.map
generated
vendored
Normal file
1
node_modules/next/dist/shared/lib/router/utils/add-locale.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../src/shared/lib/router/utils/add-locale.ts"],"names":["addLocale","path","locale","defaultLocale","ignorePrefix","lower","toLowerCase","pathHasPrefix","addPathPrefix"],"mappings":";;;;+BAQgBA;;;eAAAA;;;+BARc;+BACA;AAOvB,SAASA,UACdC,IAAY,EACZC,MAAuB,EACvBC,aAAsB,EACtBC,YAAsB;IAEtB,4EAA4E;IAC5E,sBAAsB;IACtB,IAAI,CAACF,UAAUA,WAAWC,eAAe,OAAOF;IAEhD,MAAMI,QAAQJ,KAAKK,WAAW;IAE9B,2EAA2E;IAC3E,iCAAiC;IACjC,IAAI,CAACF,cAAc;QACjB,IAAIG,IAAAA,4BAAa,EAACF,OAAO,SAAS,OAAOJ;QACzC,IAAIM,IAAAA,4BAAa,EAACF,OAAO,AAAC,MAAGH,OAAOI,WAAW,KAAO,OAAOL;IAC/D;IAEA,qCAAqC;IACrC,OAAOO,IAAAA,4BAAa,EAACP,MAAM,AAAC,MAAGC;AACjC"}
|
||||
5
node_modules/next/dist/shared/lib/router/utils/add-path-prefix.d.ts
generated
vendored
Normal file
5
node_modules/next/dist/shared/lib/router/utils/add-path-prefix.d.ts
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
/**
|
||||
* Adds the provided prefix to the given path. It first ensures that the path
|
||||
* is indeed starting with a slash.
|
||||
*/
|
||||
export declare function addPathPrefix(path: string, prefix?: string): string;
|
||||
20
node_modules/next/dist/shared/lib/router/utils/add-path-prefix.js
generated
vendored
Normal file
20
node_modules/next/dist/shared/lib/router/utils/add-path-prefix.js
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "addPathPrefix", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return addPathPrefix;
|
||||
}
|
||||
});
|
||||
const _parsepath = require("./parse-path");
|
||||
function addPathPrefix(path, prefix) {
|
||||
if (!path.startsWith("/") || !prefix) {
|
||||
return path;
|
||||
}
|
||||
const { pathname, query, hash } = (0, _parsepath.parsePath)(path);
|
||||
return "" + prefix + pathname + query + hash;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=add-path-prefix.js.map
|
||||
1
node_modules/next/dist/shared/lib/router/utils/add-path-prefix.js.map
generated
vendored
Normal file
1
node_modules/next/dist/shared/lib/router/utils/add-path-prefix.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../src/shared/lib/router/utils/add-path-prefix.ts"],"names":["addPathPrefix","path","prefix","startsWith","pathname","query","hash","parsePath"],"mappings":";;;;+BAMgBA;;;eAAAA;;;2BANU;AAMnB,SAASA,cAAcC,IAAY,EAAEC,MAAe;IACzD,IAAI,CAACD,KAAKE,UAAU,CAAC,QAAQ,CAACD,QAAQ;QACpC,OAAOD;IACT;IAEA,MAAM,EAAEG,QAAQ,EAAEC,KAAK,EAAEC,IAAI,EAAE,GAAGC,IAAAA,oBAAS,EAACN;IAC5C,OAAO,AAAC,KAAEC,SAASE,WAAWC,QAAQC;AACxC"}
|
||||
6
node_modules/next/dist/shared/lib/router/utils/add-path-suffix.d.ts
generated
vendored
Normal file
6
node_modules/next/dist/shared/lib/router/utils/add-path-suffix.d.ts
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Similarly to `addPathPrefix`, this function adds a suffix at the end on the
|
||||
* provided path. It also works only for paths ensuring the argument starts
|
||||
* with a slash.
|
||||
*/
|
||||
export declare function addPathSuffix(path: string, suffix?: string): string;
|
||||
20
node_modules/next/dist/shared/lib/router/utils/add-path-suffix.js
generated
vendored
Normal file
20
node_modules/next/dist/shared/lib/router/utils/add-path-suffix.js
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "addPathSuffix", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return addPathSuffix;
|
||||
}
|
||||
});
|
||||
const _parsepath = require("./parse-path");
|
||||
function addPathSuffix(path, suffix) {
|
||||
if (!path.startsWith("/") || !suffix) {
|
||||
return path;
|
||||
}
|
||||
const { pathname, query, hash } = (0, _parsepath.parsePath)(path);
|
||||
return "" + pathname + suffix + query + hash;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=add-path-suffix.js.map
|
||||
1
node_modules/next/dist/shared/lib/router/utils/add-path-suffix.js.map
generated
vendored
Normal file
1
node_modules/next/dist/shared/lib/router/utils/add-path-suffix.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../src/shared/lib/router/utils/add-path-suffix.ts"],"names":["addPathSuffix","path","suffix","startsWith","pathname","query","hash","parsePath"],"mappings":";;;;+BAOgBA;;;eAAAA;;;2BAPU;AAOnB,SAASA,cAAcC,IAAY,EAAEC,MAAe;IACzD,IAAI,CAACD,KAAKE,UAAU,CAAC,QAAQ,CAACD,QAAQ;QACpC,OAAOD;IACT;IAEA,MAAM,EAAEG,QAAQ,EAAEC,KAAK,EAAEC,IAAI,EAAE,GAAGC,IAAAA,oBAAS,EAACN;IAC5C,OAAO,AAAC,KAAEG,WAAWF,SAASG,QAAQC;AACxC"}
|
||||
25
node_modules/next/dist/shared/lib/router/utils/app-paths.d.ts
generated
vendored
Normal file
25
node_modules/next/dist/shared/lib/router/utils/app-paths.d.ts
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
/**
|
||||
* Normalizes an app route so it represents the actual request path. Essentially
|
||||
* performing the following transformations:
|
||||
*
|
||||
* - `/(dashboard)/user/[id]/page` to `/user/[id]`
|
||||
* - `/(dashboard)/account/page` to `/account`
|
||||
* - `/user/[id]/page` to `/user/[id]`
|
||||
* - `/account/page` to `/account`
|
||||
* - `/page` to `/`
|
||||
* - `/(dashboard)/user/[id]/route` to `/user/[id]`
|
||||
* - `/(dashboard)/account/route` to `/account`
|
||||
* - `/user/[id]/route` to `/user/[id]`
|
||||
* - `/account/route` to `/account`
|
||||
* - `/route` to `/`
|
||||
* - `/` to `/`
|
||||
*
|
||||
* @param route the app route to normalize
|
||||
* @returns the normalized pathname
|
||||
*/
|
||||
export declare function normalizeAppPath(route: string): string;
|
||||
/**
|
||||
* Strips the `.rsc` extension if it's in the pathname.
|
||||
* Since this function is used on full urls it checks `?` for searchParams handling.
|
||||
*/
|
||||
export declare function normalizeRscURL(url: string): string;
|
||||
51
node_modules/next/dist/shared/lib/router/utils/app-paths.js
generated
vendored
Normal file
51
node_modules/next/dist/shared/lib/router/utils/app-paths.js
generated
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
normalizeAppPath: null,
|
||||
normalizeRscURL: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
normalizeAppPath: function() {
|
||||
return normalizeAppPath;
|
||||
},
|
||||
normalizeRscURL: function() {
|
||||
return normalizeRscURL;
|
||||
}
|
||||
});
|
||||
const _ensureleadingslash = require("../../page-path/ensure-leading-slash");
|
||||
const _segment = require("../../segment");
|
||||
function normalizeAppPath(route) {
|
||||
return (0, _ensureleadingslash.ensureLeadingSlash)(route.split("/").reduce((pathname, segment, index, segments)=>{
|
||||
// Empty segments are ignored.
|
||||
if (!segment) {
|
||||
return pathname;
|
||||
}
|
||||
// Groups are ignored.
|
||||
if ((0, _segment.isGroupSegment)(segment)) {
|
||||
return pathname;
|
||||
}
|
||||
// Parallel segments are ignored.
|
||||
if (segment[0] === "@") {
|
||||
return pathname;
|
||||
}
|
||||
// The last segment (if it's a leaf) should be ignored.
|
||||
if ((segment === "page" || segment === "route") && index === segments.length - 1) {
|
||||
return pathname;
|
||||
}
|
||||
return pathname + "/" + segment;
|
||||
}, ""));
|
||||
}
|
||||
function normalizeRscURL(url) {
|
||||
return url.replace(/\.rsc($|\?)/, // $1 ensures `?` is preserved
|
||||
"$1");
|
||||
}
|
||||
|
||||
//# sourceMappingURL=app-paths.js.map
|
||||
1
node_modules/next/dist/shared/lib/router/utils/app-paths.js.map
generated
vendored
Normal file
1
node_modules/next/dist/shared/lib/router/utils/app-paths.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../src/shared/lib/router/utils/app-paths.ts"],"names":["normalizeAppPath","normalizeRscURL","route","ensureLeadingSlash","split","reduce","pathname","segment","index","segments","isGroupSegment","length","url","replace"],"mappings":";;;;;;;;;;;;;;;IAsBgBA,gBAAgB;eAAhBA;;IAmCAC,eAAe;eAAfA;;;oCAzDmB;yBACJ;AAqBxB,SAASD,iBAAiBE,KAAa;IAC5C,OAAOC,IAAAA,sCAAkB,EACvBD,MAAME,KAAK,CAAC,KAAKC,MAAM,CAAC,CAACC,UAAUC,SAASC,OAAOC;QACjD,8BAA8B;QAC9B,IAAI,CAACF,SAAS;YACZ,OAAOD;QACT;QAEA,sBAAsB;QACtB,IAAII,IAAAA,uBAAc,EAACH,UAAU;YAC3B,OAAOD;QACT;QAEA,iCAAiC;QACjC,IAAIC,OAAO,CAAC,EAAE,KAAK,KAAK;YACtB,OAAOD;QACT;QAEA,uDAAuD;QACvD,IACE,AAACC,CAAAA,YAAY,UAAUA,YAAY,OAAM,KACzCC,UAAUC,SAASE,MAAM,GAAG,GAC5B;YACA,OAAOL;QACT;QAEA,OAAO,AAAGA,WAAS,MAAGC;IACxB,GAAG;AAEP;AAMO,SAASN,gBAAgBW,GAAW;IACzC,OAAOA,IAAIC,OAAO,CAChB,eACA,8BAA8B;IAC9B;AAEJ"}
|
||||
1
node_modules/next/dist/shared/lib/router/utils/app-paths.test.d.ts
generated
vendored
Normal file
1
node_modules/next/dist/shared/lib/router/utils/app-paths.test.d.ts
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
export {};
|
||||
1
node_modules/next/dist/shared/lib/router/utils/as-path-to-search-params.d.ts
generated
vendored
Normal file
1
node_modules/next/dist/shared/lib/router/utils/as-path-to-search-params.d.ts
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
export declare function asPathToSearchParams(asPath: string): URLSearchParams;
|
||||
17
node_modules/next/dist/shared/lib/router/utils/as-path-to-search-params.js
generated
vendored
Normal file
17
node_modules/next/dist/shared/lib/router/utils/as-path-to-search-params.js
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
// Convert router.asPath to a URLSearchParams object
|
||||
// example: /dynamic/[slug]?foo=bar -> { foo: 'bar' }
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "asPathToSearchParams", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return asPathToSearchParams;
|
||||
}
|
||||
});
|
||||
function asPathToSearchParams(asPath) {
|
||||
return new URL(asPath, "http://n").searchParams;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=as-path-to-search-params.js.map
|
||||
1
node_modules/next/dist/shared/lib/router/utils/as-path-to-search-params.js.map
generated
vendored
Normal file
1
node_modules/next/dist/shared/lib/router/utils/as-path-to-search-params.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../src/shared/lib/router/utils/as-path-to-search-params.ts"],"names":["asPathToSearchParams","asPath","URL","searchParams"],"mappings":"AAAA,oDAAoD;AACpD,qDAAqD;;;;;+BACrCA;;;eAAAA;;;AAAT,SAASA,qBAAqBC,MAAc;IACjD,OAAO,IAAIC,IAAID,QAAQ,YAAYE,YAAY;AACjD"}
|
||||
2
node_modules/next/dist/shared/lib/router/utils/compare-states.d.ts
generated
vendored
Normal file
2
node_modules/next/dist/shared/lib/router/utils/compare-states.d.ts
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
import type { default as Router } from '../router';
|
||||
export declare function compareRouterStates(a: Router['state'], b: Router['state']): boolean;
|
||||
34
node_modules/next/dist/shared/lib/router/utils/compare-states.js
generated
vendored
Normal file
34
node_modules/next/dist/shared/lib/router/utils/compare-states.js
generated
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "compareRouterStates", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return compareRouterStates;
|
||||
}
|
||||
});
|
||||
function compareRouterStates(a, b) {
|
||||
const stateKeys = Object.keys(a);
|
||||
if (stateKeys.length !== Object.keys(b).length) return false;
|
||||
for(let i = stateKeys.length; i--;){
|
||||
const key = stateKeys[i];
|
||||
if (key === "query") {
|
||||
const queryKeys = Object.keys(a.query);
|
||||
if (queryKeys.length !== Object.keys(b.query).length) {
|
||||
return false;
|
||||
}
|
||||
for(let j = queryKeys.length; j--;){
|
||||
const queryKey = queryKeys[j];
|
||||
if (!b.query.hasOwnProperty(queryKey) || a.query[queryKey] !== b.query[queryKey]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else if (!b.hasOwnProperty(key) || a[key] !== b[key]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=compare-states.js.map
|
||||
1
node_modules/next/dist/shared/lib/router/utils/compare-states.js.map
generated
vendored
Normal file
1
node_modules/next/dist/shared/lib/router/utils/compare-states.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../src/shared/lib/router/utils/compare-states.ts"],"names":["compareRouterStates","a","b","stateKeys","Object","keys","length","i","key","queryKeys","query","j","queryKey","hasOwnProperty"],"mappings":";;;;+BAEgBA;;;eAAAA;;;AAAT,SAASA,oBAAoBC,CAAkB,EAAEC,CAAkB;IACxE,MAAMC,YAAYC,OAAOC,IAAI,CAACJ;IAC9B,IAAIE,UAAUG,MAAM,KAAKF,OAAOC,IAAI,CAACH,GAAGI,MAAM,EAAE,OAAO;IAEvD,IAAK,IAAIC,IAAIJ,UAAUG,MAAM,EAAEC,KAAO;QACpC,MAAMC,MAAML,SAAS,CAACI,EAAE;QACxB,IAAIC,QAAQ,SAAS;YACnB,MAAMC,YAAYL,OAAOC,IAAI,CAACJ,EAAES,KAAK;YACrC,IAAID,UAAUH,MAAM,KAAKF,OAAOC,IAAI,CAACH,EAAEQ,KAAK,EAAEJ,MAAM,EAAE;gBACpD,OAAO;YACT;YACA,IAAK,IAAIK,IAAIF,UAAUH,MAAM,EAAEK,KAAO;gBACpC,MAAMC,WAAWH,SAAS,CAACE,EAAE;gBAC7B,IACE,CAACT,EAAEQ,KAAK,CAACG,cAAc,CAACD,aACxBX,EAAES,KAAK,CAACE,SAAS,KAAKV,EAAEQ,KAAK,CAACE,SAAS,EACvC;oBACA,OAAO;gBACT;YACF;QACF,OAAO,IACL,CAACV,EAAEW,cAAc,CAACL,QAClBP,CAAC,CAACO,IAA6B,KAAKN,CAAC,CAACM,IAA6B,EACnE;YACA,OAAO;QACT;IACF;IAEA,OAAO;AACT"}
|
||||
1
node_modules/next/dist/shared/lib/router/utils/escape-path-delimiters.d.ts
generated
vendored
Normal file
1
node_modules/next/dist/shared/lib/router/utils/escape-path-delimiters.d.ts
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
export default function escapePathDelimiters(segment: string, escapeEncoded?: boolean): string;
|
||||
16
node_modules/next/dist/shared/lib/router/utils/escape-path-delimiters.js
generated
vendored
Normal file
16
node_modules/next/dist/shared/lib/router/utils/escape-path-delimiters.js
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
// escape delimiters used by path-to-regexp
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "default", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return escapePathDelimiters;
|
||||
}
|
||||
});
|
||||
function escapePathDelimiters(segment, escapeEncoded) {
|
||||
return segment.replace(new RegExp("([/#?]" + (escapeEncoded ? "|%(2f|23|3f)" : "") + ")", "gi"), (char)=>encodeURIComponent(char));
|
||||
}
|
||||
|
||||
//# sourceMappingURL=escape-path-delimiters.js.map
|
||||
1
node_modules/next/dist/shared/lib/router/utils/escape-path-delimiters.js.map
generated
vendored
Normal file
1
node_modules/next/dist/shared/lib/router/utils/escape-path-delimiters.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../src/shared/lib/router/utils/escape-path-delimiters.ts"],"names":["escapePathDelimiters","segment","escapeEncoded","replace","RegExp","char","encodeURIComponent"],"mappings":"AAAA,2CAA2C;;;;;+BAC3C;;;eAAwBA;;;AAAT,SAASA,qBACtBC,OAAe,EACfC,aAAuB;IAEvB,OAAOD,QAAQE,OAAO,CACpB,IAAIC,OAAO,AAAC,WAAQF,CAAAA,gBAAgB,iBAAiB,EAAC,IAAE,KAAI,OAC5D,CAACG,OAAiBC,mBAAmBD;AAEzC"}
|
||||
7
node_modules/next/dist/shared/lib/router/utils/format-next-pathname-info.d.ts
generated
vendored
Normal file
7
node_modules/next/dist/shared/lib/router/utils/format-next-pathname-info.d.ts
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
import type { NextPathnameInfo } from './get-next-pathname-info';
|
||||
interface ExtendedInfo extends NextPathnameInfo {
|
||||
defaultLocale?: string;
|
||||
ignorePrefix?: boolean;
|
||||
}
|
||||
export declare function formatNextPathnameInfo(info: ExtendedInfo): string;
|
||||
export {};
|
||||
27
node_modules/next/dist/shared/lib/router/utils/format-next-pathname-info.js
generated
vendored
Normal file
27
node_modules/next/dist/shared/lib/router/utils/format-next-pathname-info.js
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "formatNextPathnameInfo", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return formatNextPathnameInfo;
|
||||
}
|
||||
});
|
||||
const _removetrailingslash = require("./remove-trailing-slash");
|
||||
const _addpathprefix = require("./add-path-prefix");
|
||||
const _addpathsuffix = require("./add-path-suffix");
|
||||
const _addlocale = require("./add-locale");
|
||||
function formatNextPathnameInfo(info) {
|
||||
let pathname = (0, _addlocale.addLocale)(info.pathname, info.locale, info.buildId ? undefined : info.defaultLocale, info.ignorePrefix);
|
||||
if (info.buildId || !info.trailingSlash) {
|
||||
pathname = (0, _removetrailingslash.removeTrailingSlash)(pathname);
|
||||
}
|
||||
if (info.buildId) {
|
||||
pathname = (0, _addpathsuffix.addPathSuffix)((0, _addpathprefix.addPathPrefix)(pathname, "/_next/data/" + info.buildId), info.pathname === "/" ? "index.json" : ".json");
|
||||
}
|
||||
pathname = (0, _addpathprefix.addPathPrefix)(pathname, info.basePath);
|
||||
return !info.buildId && info.trailingSlash ? !pathname.endsWith("/") ? (0, _addpathsuffix.addPathSuffix)(pathname, "/") : pathname : (0, _removetrailingslash.removeTrailingSlash)(pathname);
|
||||
}
|
||||
|
||||
//# sourceMappingURL=format-next-pathname-info.js.map
|
||||
1
node_modules/next/dist/shared/lib/router/utils/format-next-pathname-info.js.map
generated
vendored
Normal file
1
node_modules/next/dist/shared/lib/router/utils/format-next-pathname-info.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../src/shared/lib/router/utils/format-next-pathname-info.ts"],"names":["formatNextPathnameInfo","info","pathname","addLocale","locale","buildId","undefined","defaultLocale","ignorePrefix","trailingSlash","removeTrailingSlash","addPathSuffix","addPathPrefix","basePath","endsWith"],"mappings":";;;;+BAWgBA;;;eAAAA;;;qCAVoB;+BACN;+BACA;2BACJ;AAOnB,SAASA,uBAAuBC,IAAkB;IACvD,IAAIC,WAAWC,IAAAA,oBAAS,EACtBF,KAAKC,QAAQ,EACbD,KAAKG,MAAM,EACXH,KAAKI,OAAO,GAAGC,YAAYL,KAAKM,aAAa,EAC7CN,KAAKO,YAAY;IAGnB,IAAIP,KAAKI,OAAO,IAAI,CAACJ,KAAKQ,aAAa,EAAE;QACvCP,WAAWQ,IAAAA,wCAAmB,EAACR;IACjC;IAEA,IAAID,KAAKI,OAAO,EAAE;QAChBH,WAAWS,IAAAA,4BAAa,EACtBC,IAAAA,4BAAa,EAACV,UAAU,AAAC,iBAAcD,KAAKI,OAAO,GACnDJ,KAAKC,QAAQ,KAAK,MAAM,eAAe;IAE3C;IAEAA,WAAWU,IAAAA,4BAAa,EAACV,UAAUD,KAAKY,QAAQ;IAChD,OAAO,CAACZ,KAAKI,OAAO,IAAIJ,KAAKQ,aAAa,GACtC,CAACP,SAASY,QAAQ,CAAC,OACjBH,IAAAA,4BAAa,EAACT,UAAU,OACxBA,WACFQ,IAAAA,wCAAmB,EAACR;AAC1B"}
|
||||
5
node_modules/next/dist/shared/lib/router/utils/format-url.d.ts
generated
vendored
Normal file
5
node_modules/next/dist/shared/lib/router/utils/format-url.d.ts
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
/// <reference types="node" />
|
||||
import type { UrlObject } from 'url';
|
||||
export declare function formatUrl(urlObj: UrlObject): string;
|
||||
export declare const urlObjectKeys: string[];
|
||||
export declare function formatWithValidation(url: UrlObject): string;
|
||||
111
node_modules/next/dist/shared/lib/router/utils/format-url.js
generated
vendored
Normal file
111
node_modules/next/dist/shared/lib/router/utils/format-url.js
generated
vendored
Normal file
@ -0,0 +1,111 @@
|
||||
// Format function modified from nodejs
|
||||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
// persons to whom the Software is furnished to do so, subject to the
|
||||
// following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
formatUrl: null,
|
||||
formatWithValidation: null,
|
||||
urlObjectKeys: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
formatUrl: function() {
|
||||
return formatUrl;
|
||||
},
|
||||
formatWithValidation: function() {
|
||||
return formatWithValidation;
|
||||
},
|
||||
urlObjectKeys: function() {
|
||||
return urlObjectKeys;
|
||||
}
|
||||
});
|
||||
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
||||
const _querystring = /*#__PURE__*/ _interop_require_wildcard._(require("./querystring"));
|
||||
const slashedProtocols = /https?|ftp|gopher|file/;
|
||||
function formatUrl(urlObj) {
|
||||
let { auth, hostname } = urlObj;
|
||||
let protocol = urlObj.protocol || "";
|
||||
let pathname = urlObj.pathname || "";
|
||||
let hash = urlObj.hash || "";
|
||||
let query = urlObj.query || "";
|
||||
let host = false;
|
||||
auth = auth ? encodeURIComponent(auth).replace(/%3A/i, ":") + "@" : "";
|
||||
if (urlObj.host) {
|
||||
host = auth + urlObj.host;
|
||||
} else if (hostname) {
|
||||
host = auth + (~hostname.indexOf(":") ? "[" + hostname + "]" : hostname);
|
||||
if (urlObj.port) {
|
||||
host += ":" + urlObj.port;
|
||||
}
|
||||
}
|
||||
if (query && typeof query === "object") {
|
||||
query = String(_querystring.urlQueryToSearchParams(query));
|
||||
}
|
||||
let search = urlObj.search || query && "?" + query || "";
|
||||
if (protocol && !protocol.endsWith(":")) protocol += ":";
|
||||
if (urlObj.slashes || (!protocol || slashedProtocols.test(protocol)) && host !== false) {
|
||||
host = "//" + (host || "");
|
||||
if (pathname && pathname[0] !== "/") pathname = "/" + pathname;
|
||||
} else if (!host) {
|
||||
host = "";
|
||||
}
|
||||
if (hash && hash[0] !== "#") hash = "#" + hash;
|
||||
if (search && search[0] !== "?") search = "?" + search;
|
||||
pathname = pathname.replace(/[?#]/g, encodeURIComponent);
|
||||
search = search.replace("#", "%23");
|
||||
return "" + protocol + host + pathname + search + hash;
|
||||
}
|
||||
const urlObjectKeys = [
|
||||
"auth",
|
||||
"hash",
|
||||
"host",
|
||||
"hostname",
|
||||
"href",
|
||||
"path",
|
||||
"pathname",
|
||||
"port",
|
||||
"protocol",
|
||||
"query",
|
||||
"search",
|
||||
"slashes"
|
||||
];
|
||||
function formatWithValidation(url) {
|
||||
if (process.env.NODE_ENV === "development") {
|
||||
if (url !== null && typeof url === "object") {
|
||||
Object.keys(url).forEach((key)=>{
|
||||
if (!urlObjectKeys.includes(key)) {
|
||||
console.warn("Unknown key passed via urlObject into url.format: " + key);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
return formatUrl(url);
|
||||
}
|
||||
|
||||
//# sourceMappingURL=format-url.js.map
|
||||
1
node_modules/next/dist/shared/lib/router/utils/format-url.js.map
generated
vendored
Normal file
1
node_modules/next/dist/shared/lib/router/utils/format-url.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../src/shared/lib/router/utils/format-url.ts"],"names":["formatUrl","formatWithValidation","urlObjectKeys","slashedProtocols","urlObj","auth","hostname","protocol","pathname","hash","query","host","encodeURIComponent","replace","indexOf","port","String","querystring","urlQueryToSearchParams","search","endsWith","slashes","test","url","process","env","NODE_ENV","Object","keys","forEach","key","includes","console","warn"],"mappings":"AAAA,uCAAuC;AACvC,sDAAsD;AACtD,EAAE;AACF,0EAA0E;AAC1E,gEAAgE;AAChE,sEAAsE;AACtE,sEAAsE;AACtE,4EAA4E;AAC5E,qEAAqE;AACrE,wBAAwB;AACxB,EAAE;AACF,0EAA0E;AAC1E,yDAAyD;AACzD,EAAE;AACF,0EAA0E;AAC1E,6DAA6D;AAC7D,4EAA4E;AAC5E,2EAA2E;AAC3E,wEAAwE;AACxE,4EAA4E;AAC5E,yCAAyC;;;;;;;;;;;;;;;;;IAQzBA,SAAS;eAATA;;IA6DAC,oBAAoB;eAApBA;;IAfHC,aAAa;eAAbA;;;;uEAlDgB;AAE7B,MAAMC,mBAAmB;AAElB,SAASH,UAAUI,MAAiB;IACzC,IAAI,EAAEC,IAAI,EAAEC,QAAQ,EAAE,GAAGF;IACzB,IAAIG,WAAWH,OAAOG,QAAQ,IAAI;IAClC,IAAIC,WAAWJ,OAAOI,QAAQ,IAAI;IAClC,IAAIC,OAAOL,OAAOK,IAAI,IAAI;IAC1B,IAAIC,QAAQN,OAAOM,KAAK,IAAI;IAC5B,IAAIC,OAAuB;IAE3BN,OAAOA,OAAOO,mBAAmBP,MAAMQ,OAAO,CAAC,QAAQ,OAAO,MAAM;IAEpE,IAAIT,OAAOO,IAAI,EAAE;QACfA,OAAON,OAAOD,OAAOO,IAAI;IAC3B,OAAO,IAAIL,UAAU;QACnBK,OAAON,OAAQ,CAAA,CAACC,SAASQ,OAAO,CAAC,OAAO,AAAC,MAAGR,WAAS,MAAKA,QAAO;QACjE,IAAIF,OAAOW,IAAI,EAAE;YACfJ,QAAQ,MAAMP,OAAOW,IAAI;QAC3B;IACF;IAEA,IAAIL,SAAS,OAAOA,UAAU,UAAU;QACtCA,QAAQM,OAAOC,aAAYC,sBAAsB,CAACR;IACpD;IAEA,IAAIS,SAASf,OAAOe,MAAM,IAAKT,SAAS,AAAC,MAAGA,SAAY;IAExD,IAAIH,YAAY,CAACA,SAASa,QAAQ,CAAC,MAAMb,YAAY;IAErD,IACEH,OAAOiB,OAAO,IACb,AAAC,CAAA,CAACd,YAAYJ,iBAAiBmB,IAAI,CAACf,SAAQ,KAAMI,SAAS,OAC5D;QACAA,OAAO,OAAQA,CAAAA,QAAQ,EAAC;QACxB,IAAIH,YAAYA,QAAQ,CAAC,EAAE,KAAK,KAAKA,WAAW,MAAMA;IACxD,OAAO,IAAI,CAACG,MAAM;QAChBA,OAAO;IACT;IAEA,IAAIF,QAAQA,IAAI,CAAC,EAAE,KAAK,KAAKA,OAAO,MAAMA;IAC1C,IAAIU,UAAUA,MAAM,CAAC,EAAE,KAAK,KAAKA,SAAS,MAAMA;IAEhDX,WAAWA,SAASK,OAAO,CAAC,SAASD;IACrCO,SAASA,OAAON,OAAO,CAAC,KAAK;IAE7B,OAAO,AAAC,KAAEN,WAAWI,OAAOH,WAAWW,SAASV;AAClD;AAEO,MAAMP,gBAAgB;IAC3B;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AAEM,SAASD,qBAAqBsB,GAAc;IACjD,IAAIC,QAAQC,GAAG,CAACC,QAAQ,KAAK,eAAe;QAC1C,IAAIH,QAAQ,QAAQ,OAAOA,QAAQ,UAAU;YAC3CI,OAAOC,IAAI,CAACL,KAAKM,OAAO,CAAC,CAACC;gBACxB,IAAI,CAAC5B,cAAc6B,QAAQ,CAACD,MAAM;oBAChCE,QAAQC,IAAI,CACV,AAAC,uDAAoDH;gBAEzD;YACF;QACF;IACF;IAEA,OAAO9B,UAAUuB;AACnB"}
|
||||
1
node_modules/next/dist/shared/lib/router/utils/get-asset-path-from-route.d.ts
generated
vendored
Normal file
1
node_modules/next/dist/shared/lib/router/utils/get-asset-path-from-route.d.ts
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
export default function getAssetPathFromRoute(route: string, ext?: string): string;
|
||||
19
node_modules/next/dist/shared/lib/router/utils/get-asset-path-from-route.js
generated
vendored
Normal file
19
node_modules/next/dist/shared/lib/router/utils/get-asset-path-from-route.js
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
// Translates a logical route into its pages asset path (relative from a common prefix)
|
||||
// "asset path" being its javascript file, data file, prerendered html,...
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "default", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return getAssetPathFromRoute;
|
||||
}
|
||||
});
|
||||
function getAssetPathFromRoute(route, ext) {
|
||||
if (ext === void 0) ext = "";
|
||||
const path = route === "/" ? "/index" : /^\/index(\/|$)/.test(route) ? "/index" + route : route;
|
||||
return path + ext;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=get-asset-path-from-route.js.map
|
||||
1
node_modules/next/dist/shared/lib/router/utils/get-asset-path-from-route.js.map
generated
vendored
Normal file
1
node_modules/next/dist/shared/lib/router/utils/get-asset-path-from-route.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../src/shared/lib/router/utils/get-asset-path-from-route.ts"],"names":["getAssetPathFromRoute","route","ext","path","test"],"mappings":"AAAA,uFAAuF;AACvF,0EAA0E;;;;;+BAC1E;;;eAAwBA;;;AAAT,SAASA,sBACtBC,KAAa,EACbC,GAAgB;IAAhBA,IAAAA,gBAAAA,MAAc;IAEd,MAAMC,OACJF,UAAU,MACN,WACA,iBAAiBG,IAAI,CAACH,SACtB,AAAC,WAAQA,QACTA;IACN,OAAOE,OAAOD;AAChB"}
|
||||
49
node_modules/next/dist/shared/lib/router/utils/get-next-pathname-info.d.ts
generated
vendored
Normal file
49
node_modules/next/dist/shared/lib/router/utils/get-next-pathname-info.d.ts
generated
vendored
Normal file
@ -0,0 +1,49 @@
|
||||
import type { I18NProvider } from '../../../../server/future/helpers/i18n-provider';
|
||||
export interface NextPathnameInfo {
|
||||
/**
|
||||
* The base path in case the pathname included it.
|
||||
*/
|
||||
basePath?: string;
|
||||
/**
|
||||
* The buildId for when the parsed URL is a data URL. Parsing it can be
|
||||
* disabled with the `parseData` option.
|
||||
*/
|
||||
buildId?: string;
|
||||
/**
|
||||
* If there was a locale in the pathname, this will hold its value.
|
||||
*/
|
||||
locale?: string;
|
||||
/**
|
||||
* The processed pathname without a base path, locale, or data URL elements
|
||||
* when parsing it is enabled.
|
||||
*/
|
||||
pathname: string;
|
||||
/**
|
||||
* A boolean telling if the pathname had a trailingSlash. This can be only
|
||||
* true if trailingSlash is enabled.
|
||||
*/
|
||||
trailingSlash?: boolean;
|
||||
}
|
||||
interface Options {
|
||||
/**
|
||||
* When passed to true, this function will also parse Nextjs data URLs.
|
||||
*/
|
||||
parseData?: boolean;
|
||||
/**
|
||||
* A partial of the Next.js configuration to parse the URL.
|
||||
*/
|
||||
nextConfig?: {
|
||||
basePath?: string;
|
||||
i18n?: {
|
||||
locales?: string[];
|
||||
} | null;
|
||||
trailingSlash?: boolean;
|
||||
};
|
||||
/**
|
||||
* If provided, this normalizer will be used to detect the locale instead of
|
||||
* the default locale detection.
|
||||
*/
|
||||
i18nProvider?: I18NProvider;
|
||||
}
|
||||
export declare function getNextPathnameInfo(pathname: string, options: Options): NextPathnameInfo;
|
||||
export {};
|
||||
54
node_modules/next/dist/shared/lib/router/utils/get-next-pathname-info.js
generated
vendored
Normal file
54
node_modules/next/dist/shared/lib/router/utils/get-next-pathname-info.js
generated
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "getNextPathnameInfo", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return getNextPathnameInfo;
|
||||
}
|
||||
});
|
||||
const _normalizelocalepath = require("../../i18n/normalize-locale-path");
|
||||
const _removepathprefix = require("./remove-path-prefix");
|
||||
const _pathhasprefix = require("./path-has-prefix");
|
||||
function getNextPathnameInfo(pathname, options) {
|
||||
var _options_nextConfig;
|
||||
const { basePath, i18n, trailingSlash } = (_options_nextConfig = options.nextConfig) != null ? _options_nextConfig : {};
|
||||
const info = {
|
||||
pathname,
|
||||
trailingSlash: pathname !== "/" ? pathname.endsWith("/") : trailingSlash
|
||||
};
|
||||
if (basePath && (0, _pathhasprefix.pathHasPrefix)(info.pathname, basePath)) {
|
||||
info.pathname = (0, _removepathprefix.removePathPrefix)(info.pathname, basePath);
|
||||
info.basePath = basePath;
|
||||
}
|
||||
let pathnameNoDataPrefix = info.pathname;
|
||||
if (info.pathname.startsWith("/_next/data/") && info.pathname.endsWith(".json")) {
|
||||
const paths = info.pathname.replace(/^\/_next\/data\//, "").replace(/\.json$/, "").split("/");
|
||||
const buildId = paths[0];
|
||||
info.buildId = buildId;
|
||||
pathnameNoDataPrefix = paths[1] !== "index" ? "/" + paths.slice(1).join("/") : "/";
|
||||
// update pathname with normalized if enabled although
|
||||
// we use normalized to populate locale info still
|
||||
if (options.parseData === true) {
|
||||
info.pathname = pathnameNoDataPrefix;
|
||||
}
|
||||
}
|
||||
// If provided, use the locale route normalizer to detect the locale instead
|
||||
// of the function below.
|
||||
if (i18n) {
|
||||
let result = options.i18nProvider ? options.i18nProvider.analyze(info.pathname) : (0, _normalizelocalepath.normalizeLocalePath)(info.pathname, i18n.locales);
|
||||
info.locale = result.detectedLocale;
|
||||
var _result_pathname;
|
||||
info.pathname = (_result_pathname = result.pathname) != null ? _result_pathname : info.pathname;
|
||||
if (!result.detectedLocale && info.buildId) {
|
||||
result = options.i18nProvider ? options.i18nProvider.analyze(pathnameNoDataPrefix) : (0, _normalizelocalepath.normalizeLocalePath)(pathnameNoDataPrefix, i18n.locales);
|
||||
if (result.detectedLocale) {
|
||||
info.locale = result.detectedLocale;
|
||||
}
|
||||
}
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=get-next-pathname-info.js.map
|
||||
1
node_modules/next/dist/shared/lib/router/utils/get-next-pathname-info.js.map
generated
vendored
Normal file
1
node_modules/next/dist/shared/lib/router/utils/get-next-pathname-info.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../src/shared/lib/router/utils/get-next-pathname-info.ts"],"names":["getNextPathnameInfo","pathname","options","basePath","i18n","trailingSlash","nextConfig","info","endsWith","pathHasPrefix","removePathPrefix","pathnameNoDataPrefix","startsWith","paths","replace","split","buildId","slice","join","parseData","result","i18nProvider","analyze","normalizeLocalePath","locales","locale","detectedLocale"],"mappings":";;;;+BAoDgBA;;;eAAAA;;;qCApDoB;kCACH;+BACH;AAkDvB,SAASA,oBACdC,QAAgB,EAChBC,OAAgB;QAE0BA;IAA1C,MAAM,EAAEC,QAAQ,EAAEC,IAAI,EAAEC,aAAa,EAAE,GAAGH,CAAAA,sBAAAA,QAAQI,UAAU,YAAlBJ,sBAAsB,CAAC;IACjE,MAAMK,OAAyB;QAC7BN;QACAI,eAAeJ,aAAa,MAAMA,SAASO,QAAQ,CAAC,OAAOH;IAC7D;IAEA,IAAIF,YAAYM,IAAAA,4BAAa,EAACF,KAAKN,QAAQ,EAAEE,WAAW;QACtDI,KAAKN,QAAQ,GAAGS,IAAAA,kCAAgB,EAACH,KAAKN,QAAQ,EAAEE;QAChDI,KAAKJ,QAAQ,GAAGA;IAClB;IACA,IAAIQ,uBAAuBJ,KAAKN,QAAQ;IAExC,IACEM,KAAKN,QAAQ,CAACW,UAAU,CAAC,mBACzBL,KAAKN,QAAQ,CAACO,QAAQ,CAAC,UACvB;QACA,MAAMK,QAAQN,KAAKN,QAAQ,CACxBa,OAAO,CAAC,oBAAoB,IAC5BA,OAAO,CAAC,WAAW,IACnBC,KAAK,CAAC;QAET,MAAMC,UAAUH,KAAK,CAAC,EAAE;QACxBN,KAAKS,OAAO,GAAGA;QACfL,uBACEE,KAAK,CAAC,EAAE,KAAK,UAAU,AAAC,MAAGA,MAAMI,KAAK,CAAC,GAAGC,IAAI,CAAC,OAAS;QAE1D,sDAAsD;QACtD,kDAAkD;QAClD,IAAIhB,QAAQiB,SAAS,KAAK,MAAM;YAC9BZ,KAAKN,QAAQ,GAAGU;QAClB;IACF;IAEA,4EAA4E;IAC5E,yBAAyB;IACzB,IAAIP,MAAM;QACR,IAAIgB,SAASlB,QAAQmB,YAAY,GAC7BnB,QAAQmB,YAAY,CAACC,OAAO,CAACf,KAAKN,QAAQ,IAC1CsB,IAAAA,wCAAmB,EAAChB,KAAKN,QAAQ,EAAEG,KAAKoB,OAAO;QAEnDjB,KAAKkB,MAAM,GAAGL,OAAOM,cAAc;YACnBN;QAAhBb,KAAKN,QAAQ,GAAGmB,CAAAA,mBAAAA,OAAOnB,QAAQ,YAAfmB,mBAAmBb,KAAKN,QAAQ;QAEhD,IAAI,CAACmB,OAAOM,cAAc,IAAInB,KAAKS,OAAO,EAAE;YAC1CI,SAASlB,QAAQmB,YAAY,GACzBnB,QAAQmB,YAAY,CAACC,OAAO,CAACX,wBAC7BY,IAAAA,wCAAmB,EAACZ,sBAAsBP,KAAKoB,OAAO;YAE1D,IAAIJ,OAAOM,cAAc,EAAE;gBACzBnB,KAAKkB,MAAM,GAAGL,OAAOM,cAAc;YACrC;QACF;IACF;IACA,OAAOnB;AACT"}
|
||||
1
node_modules/next/dist/shared/lib/router/utils/get-route-from-asset-path.d.ts
generated
vendored
Normal file
1
node_modules/next/dist/shared/lib/router/utils/get-route-from-asset-path.d.ts
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
export default function getRouteFromAssetPath(assetPath: string, ext?: string): string;
|
||||
26
node_modules/next/dist/shared/lib/router/utils/get-route-from-asset-path.js
generated
vendored
Normal file
26
node_modules/next/dist/shared/lib/router/utils/get-route-from-asset-path.js
generated
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
// Translate a pages asset path (relative from a common prefix) back into its logical route
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, // "asset path" being its javascript file, data file, prerendered html,...
|
||||
"default", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return getRouteFromAssetPath;
|
||||
}
|
||||
});
|
||||
const _isdynamic = require("./is-dynamic");
|
||||
function getRouteFromAssetPath(assetPath, ext) {
|
||||
if (ext === void 0) ext = "";
|
||||
assetPath = assetPath.replace(/\\/g, "/");
|
||||
assetPath = ext && assetPath.endsWith(ext) ? assetPath.slice(0, -ext.length) : assetPath;
|
||||
if (assetPath.startsWith("/index/") && !(0, _isdynamic.isDynamicRoute)(assetPath)) {
|
||||
assetPath = assetPath.slice(6);
|
||||
} else if (assetPath === "/index") {
|
||||
assetPath = "/";
|
||||
}
|
||||
return assetPath;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=get-route-from-asset-path.js.map
|
||||
1
node_modules/next/dist/shared/lib/router/utils/get-route-from-asset-path.js.map
generated
vendored
Normal file
1
node_modules/next/dist/shared/lib/router/utils/get-route-from-asset-path.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../src/shared/lib/router/utils/get-route-from-asset-path.ts"],"names":["getRouteFromAssetPath","assetPath","ext","replace","endsWith","slice","length","startsWith","isDynamicRoute"],"mappings":"AAAA,2FAA2F;;;;;+BAI3F,0EAA0E;AAC1E;;;eAAwBA;;;2BAHO;AAGhB,SAASA,sBACtBC,SAAiB,EACjBC,GAAgB;IAAhBA,IAAAA,gBAAAA,MAAc;IAEdD,YAAYA,UAAUE,OAAO,CAAC,OAAO;IACrCF,YACEC,OAAOD,UAAUG,QAAQ,CAACF,OAAOD,UAAUI,KAAK,CAAC,GAAG,CAACH,IAAII,MAAM,IAAIL;IACrE,IAAIA,UAAUM,UAAU,CAAC,cAAc,CAACC,IAAAA,yBAAc,EAACP,YAAY;QACjEA,YAAYA,UAAUI,KAAK,CAAC;IAC9B,OAAO,IAAIJ,cAAc,UAAU;QACjCA,YAAY;IACd;IACA,OAAOA;AACT"}
|
||||
8
node_modules/next/dist/shared/lib/router/utils/handle-smooth-scroll.d.ts
generated
vendored
Normal file
8
node_modules/next/dist/shared/lib/router/utils/handle-smooth-scroll.d.ts
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Run function with `scroll-behavior: auto` applied to `<html/>`.
|
||||
* This css change will be reverted after the function finishes.
|
||||
*/
|
||||
export declare function handleSmoothScroll(fn: () => void, options?: {
|
||||
dontForceLayout?: boolean;
|
||||
onlyHashChange?: boolean;
|
||||
}): void;
|
||||
35
node_modules/next/dist/shared/lib/router/utils/handle-smooth-scroll.js
generated
vendored
Normal file
35
node_modules/next/dist/shared/lib/router/utils/handle-smooth-scroll.js
generated
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
/**
|
||||
* Run function with `scroll-behavior: auto` applied to `<html/>`.
|
||||
* This css change will be reverted after the function finishes.
|
||||
*/ "use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "handleSmoothScroll", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return handleSmoothScroll;
|
||||
}
|
||||
});
|
||||
function handleSmoothScroll(fn, options) {
|
||||
if (options === void 0) options = {};
|
||||
// if only the hash is changed, we don't need to disable smooth scrolling
|
||||
// we only care to prevent smooth scrolling when navigating to a new page to avoid jarring UX
|
||||
if (options.onlyHashChange) {
|
||||
fn();
|
||||
return;
|
||||
}
|
||||
const htmlElement = document.documentElement;
|
||||
const existing = htmlElement.style.scrollBehavior;
|
||||
htmlElement.style.scrollBehavior = "auto";
|
||||
if (!options.dontForceLayout) {
|
||||
// In Chrome-based browsers we need to force reflow before calling `scrollTo`.
|
||||
// Otherwise it will not pickup the change in scrollBehavior
|
||||
// More info here: https://github.com/vercel/next.js/issues/40719#issuecomment-1336248042
|
||||
htmlElement.getClientRects();
|
||||
}
|
||||
fn();
|
||||
htmlElement.style.scrollBehavior = existing;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=handle-smooth-scroll.js.map
|
||||
1
node_modules/next/dist/shared/lib/router/utils/handle-smooth-scroll.js.map
generated
vendored
Normal file
1
node_modules/next/dist/shared/lib/router/utils/handle-smooth-scroll.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../src/shared/lib/router/utils/handle-smooth-scroll.ts"],"names":["handleSmoothScroll","fn","options","onlyHashChange","htmlElement","document","documentElement","existing","style","scrollBehavior","dontForceLayout","getClientRects"],"mappings":"AAAA;;;CAGC;;;;+BACeA;;;eAAAA;;;AAAT,SAASA,mBACdC,EAAc,EACdC,OAAqE;IAArEA,IAAAA,oBAAAA,UAAmE,CAAC;IAEpE,yEAAyE;IACzE,6FAA6F;IAC7F,IAAIA,QAAQC,cAAc,EAAE;QAC1BF;QACA;IACF;IACA,MAAMG,cAAcC,SAASC,eAAe;IAC5C,MAAMC,WAAWH,YAAYI,KAAK,CAACC,cAAc;IACjDL,YAAYI,KAAK,CAACC,cAAc,GAAG;IACnC,IAAI,CAACP,QAAQQ,eAAe,EAAE;QAC5B,8EAA8E;QAC9E,4DAA4D;QAC5D,yFAAyF;QACzFN,YAAYO,cAAc;IAC5B;IACAV;IACAG,YAAYI,KAAK,CAACC,cAAc,GAAGF;AACrC"}
|
||||
2
node_modules/next/dist/shared/lib/router/utils/index.d.ts
generated
vendored
Normal file
2
node_modules/next/dist/shared/lib/router/utils/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
export { getSortedRoutes } from './sorted-routes';
|
||||
export { isDynamicRoute } from './is-dynamic';
|
||||
26
node_modules/next/dist/shared/lib/router/utils/index.js
generated
vendored
Normal file
26
node_modules/next/dist/shared/lib/router/utils/index.js
generated
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
getSortedRoutes: null,
|
||||
isDynamicRoute: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
getSortedRoutes: function() {
|
||||
return _sortedroutes.getSortedRoutes;
|
||||
},
|
||||
isDynamicRoute: function() {
|
||||
return _isdynamic.isDynamicRoute;
|
||||
}
|
||||
});
|
||||
const _sortedroutes = require("./sorted-routes");
|
||||
const _isdynamic = require("./is-dynamic");
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/next/dist/shared/lib/router/utils/index.js.map
generated
vendored
Normal file
1
node_modules/next/dist/shared/lib/router/utils/index.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../src/shared/lib/router/utils/index.ts"],"names":["getSortedRoutes","isDynamicRoute"],"mappings":";;;;;;;;;;;;;;;IAASA,eAAe;eAAfA,6BAAe;;IACfC,cAAc;eAAdA,yBAAc;;;8BADS;2BACD"}
|
||||
6
node_modules/next/dist/shared/lib/router/utils/interpolate-as.d.ts
generated
vendored
Normal file
6
node_modules/next/dist/shared/lib/router/utils/interpolate-as.d.ts
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
/// <reference types="node" />
|
||||
import type { ParsedUrlQuery } from 'querystring';
|
||||
export declare function interpolateAs(route: string, asPathname: string, query: ParsedUrlQuery): {
|
||||
params: string[];
|
||||
result: string;
|
||||
};
|
||||
53
node_modules/next/dist/shared/lib/router/utils/interpolate-as.js
generated
vendored
Normal file
53
node_modules/next/dist/shared/lib/router/utils/interpolate-as.js
generated
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "interpolateAs", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return interpolateAs;
|
||||
}
|
||||
});
|
||||
const _routematcher = require("./route-matcher");
|
||||
const _routeregex = require("./route-regex");
|
||||
function interpolateAs(route, asPathname, query) {
|
||||
let interpolatedRoute = "";
|
||||
const dynamicRegex = (0, _routeregex.getRouteRegex)(route);
|
||||
const dynamicGroups = dynamicRegex.groups;
|
||||
const dynamicMatches = // Try to match the dynamic route against the asPath
|
||||
(asPathname !== route ? (0, _routematcher.getRouteMatcher)(dynamicRegex)(asPathname) : "") || // Fall back to reading the values from the href
|
||||
// TODO: should this take priority; also need to change in the router.
|
||||
query;
|
||||
interpolatedRoute = route;
|
||||
const params = Object.keys(dynamicGroups);
|
||||
if (!params.every((param)=>{
|
||||
let value = dynamicMatches[param] || "";
|
||||
const { repeat, optional } = dynamicGroups[param];
|
||||
// support single-level catch-all
|
||||
// TODO: more robust handling for user-error (passing `/`)
|
||||
let replaced = "[" + (repeat ? "..." : "") + param + "]";
|
||||
if (optional) {
|
||||
replaced = (!value ? "/" : "") + "[" + replaced + "]";
|
||||
}
|
||||
if (repeat && !Array.isArray(value)) value = [
|
||||
value
|
||||
];
|
||||
return (optional || param in dynamicMatches) && // Interpolate group into data URL if present
|
||||
(interpolatedRoute = interpolatedRoute.replace(replaced, repeat ? value.map(// these values should be fully encoded instead of just
|
||||
// path delimiter escaped since they are being inserted
|
||||
// into the URL and we expect URL encoded segments
|
||||
// when parsing dynamic route params
|
||||
(segment)=>encodeURIComponent(segment)).join("/") : encodeURIComponent(value)) || "/");
|
||||
})) {
|
||||
interpolatedRoute = "" // did not satisfy all requirements
|
||||
;
|
||||
// n.b. We ignore this error because we handle warning for this case in
|
||||
// development in the `<Link>` component directly.
|
||||
}
|
||||
return {
|
||||
params,
|
||||
result: interpolatedRoute
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=interpolate-as.js.map
|
||||
1
node_modules/next/dist/shared/lib/router/utils/interpolate-as.js.map
generated
vendored
Normal file
1
node_modules/next/dist/shared/lib/router/utils/interpolate-as.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../src/shared/lib/router/utils/interpolate-as.ts"],"names":["interpolateAs","route","asPathname","query","interpolatedRoute","dynamicRegex","getRouteRegex","dynamicGroups","groups","dynamicMatches","getRouteMatcher","params","Object","keys","every","param","value","repeat","optional","replaced","Array","isArray","replace","map","segment","encodeURIComponent","join","result"],"mappings":";;;;+BAKgBA;;;eAAAA;;;8BAHgB;4BACF;AAEvB,SAASA,cACdC,KAAa,EACbC,UAAkB,EAClBC,KAAqB;IAErB,IAAIC,oBAAoB;IAExB,MAAMC,eAAeC,IAAAA,yBAAa,EAACL;IACnC,MAAMM,gBAAgBF,aAAaG,MAAM;IACzC,MAAMC,iBAEJ,AADA,oDAAoD;IACnDP,CAAAA,eAAeD,QAAQS,IAAAA,6BAAe,EAACL,cAAcH,cAAc,EAAC,KACrE,gDAAgD;IAChD,sEAAsE;IACtEC;IAEFC,oBAAoBH;IACpB,MAAMU,SAASC,OAAOC,IAAI,CAACN;IAE3B,IACE,CAACI,OAAOG,KAAK,CAAC,CAACC;QACb,IAAIC,QAAQP,cAAc,CAACM,MAAM,IAAI;QACrC,MAAM,EAAEE,MAAM,EAAEC,QAAQ,EAAE,GAAGX,aAAa,CAACQ,MAAM;QAEjD,iCAAiC;QACjC,0DAA0D;QAC1D,IAAII,WAAW,AAAC,MAAGF,CAAAA,SAAS,QAAQ,EAAC,IAAIF,QAAM;QAC/C,IAAIG,UAAU;YACZC,WAAW,AAAG,CAAA,CAACH,QAAQ,MAAM,EAAC,IAAE,MAAGG,WAAS;QAC9C;QACA,IAAIF,UAAU,CAACG,MAAMC,OAAO,CAACL,QAAQA,QAAQ;YAACA;SAAM;QAEpD,OACE,AAACE,CAAAA,YAAYH,SAASN,cAAa,KACnC,6CAA6C;QAC5CL,CAAAA,oBACCA,kBAAmBkB,OAAO,CACxBH,UACAF,SACI,AAACD,MACEO,GAAG,CACF,uDAAuD;QACvD,uDAAuD;QACvD,kDAAkD;QAClD,oCAAoC;QACpC,CAACC,UAAYC,mBAAmBD,UAEjCE,IAAI,CAAC,OACRD,mBAAmBT,WACpB,GAAE;IAEb,IACA;QACAZ,oBAAoB,GAAG,mCAAmC;;IAE1D,uEAAuE;IACvE,kDAAkD;IACpD;IACA,OAAO;QACLO;QACAgB,QAAQvB;IACV;AACF"}
|
||||
1
node_modules/next/dist/shared/lib/router/utils/is-bot.d.ts
generated
vendored
Normal file
1
node_modules/next/dist/shared/lib/router/utils/is-bot.d.ts
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
export declare function isBot(userAgent: string): boolean;
|
||||
15
node_modules/next/dist/shared/lib/router/utils/is-bot.js
generated
vendored
Normal file
15
node_modules/next/dist/shared/lib/router/utils/is-bot.js
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "isBot", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return isBot;
|
||||
}
|
||||
});
|
||||
function isBot(userAgent) {
|
||||
return /Googlebot|Mediapartners-Google|AdsBot-Google|googleweblight|Storebot-Google|Google-PageRenderer|Bingbot|BingPreview|Slurp|DuckDuckBot|baiduspider|yandex|sogou|LinkedInBot|bitlybot|tumblr|vkShare|quora link preview|facebookexternalhit|facebookcatalog|Twitterbot|applebot|redditbot|Slackbot|Discordbot|WhatsApp|SkypeUriPreview|ia_archiver/i.test(userAgent);
|
||||
}
|
||||
|
||||
//# sourceMappingURL=is-bot.js.map
|
||||
1
node_modules/next/dist/shared/lib/router/utils/is-bot.js.map
generated
vendored
Normal file
1
node_modules/next/dist/shared/lib/router/utils/is-bot.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../src/shared/lib/router/utils/is-bot.ts"],"names":["isBot","userAgent","test"],"mappings":";;;;+BAAgBA;;;eAAAA;;;AAAT,SAASA,MAAMC,SAAiB;IACrC,OAAO,oVAAoVC,IAAI,CAC7VD;AAEJ"}
|
||||
1
node_modules/next/dist/shared/lib/router/utils/is-dynamic.d.ts
generated
vendored
Normal file
1
node_modules/next/dist/shared/lib/router/utils/is-dynamic.d.ts
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
export declare function isDynamicRoute(route: string): boolean;
|
||||
21
node_modules/next/dist/shared/lib/router/utils/is-dynamic.js
generated
vendored
Normal file
21
node_modules/next/dist/shared/lib/router/utils/is-dynamic.js
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "isDynamicRoute", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return isDynamicRoute;
|
||||
}
|
||||
});
|
||||
const _interceptionroutes = require("../../../../server/future/helpers/interception-routes");
|
||||
// Identify /[param]/ in route string
|
||||
const TEST_ROUTE = /\/\[[^/]+?\](?=\/|$)/;
|
||||
function isDynamicRoute(route) {
|
||||
if ((0, _interceptionroutes.isInterceptionRouteAppPath)(route)) {
|
||||
route = (0, _interceptionroutes.extractInterceptionRouteInformation)(route).interceptedRoute;
|
||||
}
|
||||
return TEST_ROUTE.test(route);
|
||||
}
|
||||
|
||||
//# sourceMappingURL=is-dynamic.js.map
|
||||
1
node_modules/next/dist/shared/lib/router/utils/is-dynamic.js.map
generated
vendored
Normal file
1
node_modules/next/dist/shared/lib/router/utils/is-dynamic.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../src/shared/lib/router/utils/is-dynamic.ts"],"names":["isDynamicRoute","TEST_ROUTE","route","isInterceptionRouteAppPath","extractInterceptionRouteInformation","interceptedRoute","test"],"mappings":";;;;+BAQgBA;;;eAAAA;;;oCALT;AAEP,qCAAqC;AACrC,MAAMC,aAAa;AAEZ,SAASD,eAAeE,KAAa;IAC1C,IAAIC,IAAAA,8CAA0B,EAACD,QAAQ;QACrCA,QAAQE,IAAAA,uDAAmC,EAACF,OAAOG,gBAAgB;IACrE;IAEA,OAAOJ,WAAWK,IAAI,CAACJ;AACzB"}
|
||||
4
node_modules/next/dist/shared/lib/router/utils/is-local-url.d.ts
generated
vendored
Normal file
4
node_modules/next/dist/shared/lib/router/utils/is-local-url.d.ts
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
/**
|
||||
* Detects whether a given url is routable by the Next.js router (browser only).
|
||||
*/
|
||||
export declare function isLocalURL(url: string): boolean;
|
||||
26
node_modules/next/dist/shared/lib/router/utils/is-local-url.js
generated
vendored
Normal file
26
node_modules/next/dist/shared/lib/router/utils/is-local-url.js
generated
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "isLocalURL", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return isLocalURL;
|
||||
}
|
||||
});
|
||||
const _utils = require("../../utils");
|
||||
const _hasbasepath = require("../../../../client/has-base-path");
|
||||
function isLocalURL(url) {
|
||||
// prevent a hydration mismatch on href for url with anchor refs
|
||||
if (!(0, _utils.isAbsoluteUrl)(url)) return true;
|
||||
try {
|
||||
// absolute urls can be local if they are on the same origin
|
||||
const locationOrigin = (0, _utils.getLocationOrigin)();
|
||||
const resolved = new URL(url, locationOrigin);
|
||||
return resolved.origin === locationOrigin && (0, _hasbasepath.hasBasePath)(resolved.pathname);
|
||||
} catch (_) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=is-local-url.js.map
|
||||
1
node_modules/next/dist/shared/lib/router/utils/is-local-url.js.map
generated
vendored
Normal file
1
node_modules/next/dist/shared/lib/router/utils/is-local-url.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../src/shared/lib/router/utils/is-local-url.ts"],"names":["isLocalURL","url","isAbsoluteUrl","locationOrigin","getLocationOrigin","resolved","URL","origin","hasBasePath","pathname","_"],"mappings":";;;;+BAMgBA;;;eAAAA;;;uBANiC;6BACrB;AAKrB,SAASA,WAAWC,GAAW;IACpC,gEAAgE;IAChE,IAAI,CAACC,IAAAA,oBAAa,EAACD,MAAM,OAAO;IAChC,IAAI;QACF,4DAA4D;QAC5D,MAAME,iBAAiBC,IAAAA,wBAAiB;QACxC,MAAMC,WAAW,IAAIC,IAAIL,KAAKE;QAC9B,OAAOE,SAASE,MAAM,KAAKJ,kBAAkBK,IAAAA,wBAAW,EAACH,SAASI,QAAQ;IAC5E,EAAE,OAAOC,GAAG;QACV,OAAO;IACT;AACF"}
|
||||
7
node_modules/next/dist/shared/lib/router/utils/middleware-route-matcher.d.ts
generated
vendored
Normal file
7
node_modules/next/dist/shared/lib/router/utils/middleware-route-matcher.d.ts
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
import type { BaseNextRequest } from '../../../../server/base-http';
|
||||
import type { MiddlewareMatcher } from '../../../../build/analysis/get-page-static-info';
|
||||
import type { Params } from './route-matcher';
|
||||
export interface MiddlewareRouteMatch {
|
||||
(pathname: string | null | undefined, request: BaseNextRequest, query: Params): boolean;
|
||||
}
|
||||
export declare function getMiddlewareRouteMatcher(matchers: MiddlewareMatcher[]): MiddlewareRouteMatch;
|
||||
31
node_modules/next/dist/shared/lib/router/utils/middleware-route-matcher.js
generated
vendored
Normal file
31
node_modules/next/dist/shared/lib/router/utils/middleware-route-matcher.js
generated
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "getMiddlewareRouteMatcher", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return getMiddlewareRouteMatcher;
|
||||
}
|
||||
});
|
||||
const _preparedestination = require("./prepare-destination");
|
||||
function getMiddlewareRouteMatcher(matchers) {
|
||||
return (pathname, req, query)=>{
|
||||
for (const matcher of matchers){
|
||||
const routeMatch = new RegExp(matcher.regexp).exec(pathname);
|
||||
if (!routeMatch) {
|
||||
continue;
|
||||
}
|
||||
if (matcher.has || matcher.missing) {
|
||||
const hasParams = (0, _preparedestination.matchHas)(req, query, matcher.has, matcher.missing);
|
||||
if (!hasParams) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=middleware-route-matcher.js.map
|
||||
1
node_modules/next/dist/shared/lib/router/utils/middleware-route-matcher.js.map
generated
vendored
Normal file
1
node_modules/next/dist/shared/lib/router/utils/middleware-route-matcher.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../src/shared/lib/router/utils/middleware-route-matcher.ts"],"names":["getMiddlewareRouteMatcher","matchers","pathname","req","query","matcher","routeMatch","RegExp","regexp","exec","has","missing","hasParams","matchHas"],"mappings":";;;;+BAagBA;;;eAAAA;;;oCAVS;AAUlB,SAASA,0BACdC,QAA6B;IAE7B,OAAO,CACLC,UACAC,KACAC;QAEA,KAAK,MAAMC,WAAWJ,SAAU;YAC9B,MAAMK,aAAa,IAAIC,OAAOF,QAAQG,MAAM,EAAEC,IAAI,CAACP;YACnD,IAAI,CAACI,YAAY;gBACf;YACF;YAEA,IAAID,QAAQK,GAAG,IAAIL,QAAQM,OAAO,EAAE;gBAClC,MAAMC,YAAYC,IAAAA,4BAAQ,EAACV,KAAKC,OAAOC,QAAQK,GAAG,EAAEL,QAAQM,OAAO;gBACnE,IAAI,CAACC,WAAW;oBACd;gBACF;YACF;YAEA,OAAO;QACT;QAEA,OAAO;IACT;AACF"}
|
||||
3
node_modules/next/dist/shared/lib/router/utils/omit.d.ts
generated
vendored
Normal file
3
node_modules/next/dist/shared/lib/router/utils/omit.d.ts
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
export declare function omit<T extends {
|
||||
[key: string]: unknown;
|
||||
}, K extends keyof T>(object: T, keys: K[]): Omit<T, K>;
|
||||
21
node_modules/next/dist/shared/lib/router/utils/omit.js
generated
vendored
Normal file
21
node_modules/next/dist/shared/lib/router/utils/omit.js
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "omit", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return omit;
|
||||
}
|
||||
});
|
||||
function omit(object, keys) {
|
||||
const omitted = {};
|
||||
Object.keys(object).forEach((key)=>{
|
||||
if (!keys.includes(key)) {
|
||||
omitted[key] = object[key];
|
||||
}
|
||||
});
|
||||
return omitted;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=omit.js.map
|
||||
1
node_modules/next/dist/shared/lib/router/utils/omit.js.map
generated
vendored
Normal file
1
node_modules/next/dist/shared/lib/router/utils/omit.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../src/shared/lib/router/utils/omit.ts"],"names":["omit","object","keys","omitted","Object","forEach","key","includes"],"mappings":";;;;+BAAgBA;;;eAAAA;;;AAAT,SAASA,KACdC,MAAS,EACTC,IAAS;IAET,MAAMC,UAAsC,CAAC;IAC7CC,OAAOF,IAAI,CAACD,QAAQI,OAAO,CAAC,CAACC;QAC3B,IAAI,CAACJ,KAAKK,QAAQ,CAACD,MAAW;YAC5BH,OAAO,CAACG,IAAI,GAAGL,MAAM,CAACK,IAAI;QAC5B;IACF;IACA,OAAOH;AACT"}
|
||||
10
node_modules/next/dist/shared/lib/router/utils/parse-path.d.ts
generated
vendored
Normal file
10
node_modules/next/dist/shared/lib/router/utils/parse-path.d.ts
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
/**
|
||||
* Given a path this function will find the pathname, query and hash and return
|
||||
* them. This is useful to parse full paths on the client side.
|
||||
* @param path A path to parse e.g. /foo/bar?id=1#hash
|
||||
*/
|
||||
export declare function parsePath(path: string): {
|
||||
pathname: string;
|
||||
query: string;
|
||||
hash: string;
|
||||
};
|
||||
33
node_modules/next/dist/shared/lib/router/utils/parse-path.js
generated
vendored
Normal file
33
node_modules/next/dist/shared/lib/router/utils/parse-path.js
generated
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
/**
|
||||
* Given a path this function will find the pathname, query and hash and return
|
||||
* them. This is useful to parse full paths on the client side.
|
||||
* @param path A path to parse e.g. /foo/bar?id=1#hash
|
||||
*/ "use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "parsePath", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return parsePath;
|
||||
}
|
||||
});
|
||||
function parsePath(path) {
|
||||
const hashIndex = path.indexOf("#");
|
||||
const queryIndex = path.indexOf("?");
|
||||
const hasQuery = queryIndex > -1 && (hashIndex < 0 || queryIndex < hashIndex);
|
||||
if (hasQuery || hashIndex > -1) {
|
||||
return {
|
||||
pathname: path.substring(0, hasQuery ? queryIndex : hashIndex),
|
||||
query: hasQuery ? path.substring(queryIndex, hashIndex > -1 ? hashIndex : undefined) : "",
|
||||
hash: hashIndex > -1 ? path.slice(hashIndex) : ""
|
||||
};
|
||||
}
|
||||
return {
|
||||
pathname: path,
|
||||
query: "",
|
||||
hash: ""
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=parse-path.js.map
|
||||
1
node_modules/next/dist/shared/lib/router/utils/parse-path.js.map
generated
vendored
Normal file
1
node_modules/next/dist/shared/lib/router/utils/parse-path.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../src/shared/lib/router/utils/parse-path.ts"],"names":["parsePath","path","hashIndex","indexOf","queryIndex","hasQuery","pathname","substring","query","undefined","hash","slice"],"mappings":"AAAA;;;;CAIC;;;;+BACeA;;;eAAAA;;;AAAT,SAASA,UAAUC,IAAY;IACpC,MAAMC,YAAYD,KAAKE,OAAO,CAAC;IAC/B,MAAMC,aAAaH,KAAKE,OAAO,CAAC;IAChC,MAAME,WAAWD,aAAa,CAAC,KAAMF,CAAAA,YAAY,KAAKE,aAAaF,SAAQ;IAE3E,IAAIG,YAAYH,YAAY,CAAC,GAAG;QAC9B,OAAO;YACLI,UAAUL,KAAKM,SAAS,CAAC,GAAGF,WAAWD,aAAaF;YACpDM,OAAOH,WACHJ,KAAKM,SAAS,CAACH,YAAYF,YAAY,CAAC,IAAIA,YAAYO,aACxD;YACJC,MAAMR,YAAY,CAAC,IAAID,KAAKU,KAAK,CAACT,aAAa;QACjD;IACF;IAEA,OAAO;QAAEI,UAAUL;QAAMO,OAAO;QAAIE,MAAM;IAAG;AAC/C"}
|
||||
16
node_modules/next/dist/shared/lib/router/utils/parse-relative-url.d.ts
generated
vendored
Normal file
16
node_modules/next/dist/shared/lib/router/utils/parse-relative-url.d.ts
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
/// <reference types="node" />
|
||||
import type { ParsedUrlQuery } from 'querystring';
|
||||
export interface ParsedRelativeUrl {
|
||||
hash: string;
|
||||
href: string;
|
||||
pathname: string;
|
||||
query: ParsedUrlQuery;
|
||||
search: string;
|
||||
}
|
||||
/**
|
||||
* Parses path-relative urls (e.g. `/hello/world?foo=bar`). If url isn't path-relative
|
||||
* (e.g. `./hello`) then at least base must be.
|
||||
* Absolute urls are rejected with one exception, in the browser, absolute urls that are on
|
||||
* the current origin will be parsed as relative
|
||||
*/
|
||||
export declare function parseRelativeUrl(url: string, base?: string): ParsedRelativeUrl;
|
||||
29
node_modules/next/dist/shared/lib/router/utils/parse-relative-url.js
generated
vendored
Normal file
29
node_modules/next/dist/shared/lib/router/utils/parse-relative-url.js
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "parseRelativeUrl", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return parseRelativeUrl;
|
||||
}
|
||||
});
|
||||
const _utils = require("../../utils");
|
||||
const _querystring = require("./querystring");
|
||||
function parseRelativeUrl(url, base) {
|
||||
const globalBase = new URL(typeof window === "undefined" ? "http://n" : (0, _utils.getLocationOrigin)());
|
||||
const resolvedBase = base ? new URL(base, globalBase) : url.startsWith(".") ? new URL(typeof window === "undefined" ? "http://n" : window.location.href) : globalBase;
|
||||
const { pathname, searchParams, search, hash, href, origin } = new URL(url, resolvedBase);
|
||||
if (origin !== globalBase.origin) {
|
||||
throw new Error("invariant: invalid relative URL, router received " + url);
|
||||
}
|
||||
return {
|
||||
pathname,
|
||||
query: (0, _querystring.searchParamsToUrlQuery)(searchParams),
|
||||
search,
|
||||
hash,
|
||||
href: href.slice(globalBase.origin.length)
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=parse-relative-url.js.map
|
||||
1
node_modules/next/dist/shared/lib/router/utils/parse-relative-url.js.map
generated
vendored
Normal file
1
node_modules/next/dist/shared/lib/router/utils/parse-relative-url.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../src/shared/lib/router/utils/parse-relative-url.ts"],"names":["parseRelativeUrl","url","base","globalBase","URL","window","getLocationOrigin","resolvedBase","startsWith","location","href","pathname","searchParams","search","hash","origin","Error","query","searchParamsToUrlQuery","slice","length"],"mappings":";;;;+BAkBgBA;;;eAAAA;;;uBAjBkB;6BACK;AAgBhC,SAASA,iBACdC,GAAW,EACXC,IAAa;IAEb,MAAMC,aAAa,IAAIC,IACrB,OAAOC,WAAW,cAAc,aAAaC,IAAAA,wBAAiB;IAGhE,MAAMC,eAAeL,OACjB,IAAIE,IAAIF,MAAMC,cACdF,IAAIO,UAAU,CAAC,OACf,IAAIJ,IAAI,OAAOC,WAAW,cAAc,aAAaA,OAAOI,QAAQ,CAACC,IAAI,IACzEP;IAEJ,MAAM,EAAEQ,QAAQ,EAAEC,YAAY,EAAEC,MAAM,EAAEC,IAAI,EAAEJ,IAAI,EAAEK,MAAM,EAAE,GAAG,IAAIX,IACjEH,KACAM;IAEF,IAAIQ,WAAWZ,WAAWY,MAAM,EAAE;QAChC,MAAM,IAAIC,MAAM,AAAC,sDAAmDf;IACtE;IACA,OAAO;QACLU;QACAM,OAAOC,IAAAA,mCAAsB,EAACN;QAC9BC;QACAC;QACAJ,MAAMA,KAAKS,KAAK,CAAChB,WAAWY,MAAM,CAACK,MAAM;IAC3C;AACF"}
|
||||
13
node_modules/next/dist/shared/lib/router/utils/parse-url.d.ts
generated
vendored
Normal file
13
node_modules/next/dist/shared/lib/router/utils/parse-url.d.ts
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
/// <reference types="node" />
|
||||
import type { ParsedUrlQuery } from 'querystring';
|
||||
export interface ParsedUrl {
|
||||
hash: string;
|
||||
hostname?: string | null;
|
||||
href: string;
|
||||
pathname: string;
|
||||
port?: string | null;
|
||||
protocol?: string | null;
|
||||
query: ParsedUrlQuery;
|
||||
search: string;
|
||||
}
|
||||
export declare function parseUrl(url: string): ParsedUrl;
|
||||
30
node_modules/next/dist/shared/lib/router/utils/parse-url.js
generated
vendored
Normal file
30
node_modules/next/dist/shared/lib/router/utils/parse-url.js
generated
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "parseUrl", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return parseUrl;
|
||||
}
|
||||
});
|
||||
const _querystring = require("./querystring");
|
||||
const _parserelativeurl = require("./parse-relative-url");
|
||||
function parseUrl(url) {
|
||||
if (url.startsWith("/")) {
|
||||
return (0, _parserelativeurl.parseRelativeUrl)(url);
|
||||
}
|
||||
const parsedURL = new URL(url);
|
||||
return {
|
||||
hash: parsedURL.hash,
|
||||
hostname: parsedURL.hostname,
|
||||
href: parsedURL.href,
|
||||
pathname: parsedURL.pathname,
|
||||
port: parsedURL.port,
|
||||
protocol: parsedURL.protocol,
|
||||
query: (0, _querystring.searchParamsToUrlQuery)(parsedURL.searchParams),
|
||||
search: parsedURL.search
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=parse-url.js.map
|
||||
1
node_modules/next/dist/shared/lib/router/utils/parse-url.js.map
generated
vendored
Normal file
1
node_modules/next/dist/shared/lib/router/utils/parse-url.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../src/shared/lib/router/utils/parse-url.ts"],"names":["parseUrl","url","startsWith","parseRelativeUrl","parsedURL","URL","hash","hostname","href","pathname","port","protocol","query","searchParamsToUrlQuery","searchParams","search"],"mappings":";;;;+BAgBgBA;;;eAAAA;;;6BAduB;kCACN;AAa1B,SAASA,SAASC,GAAW;IAClC,IAAIA,IAAIC,UAAU,CAAC,MAAM;QACvB,OAAOC,IAAAA,kCAAgB,EAACF;IAC1B;IAEA,MAAMG,YAAY,IAAIC,IAAIJ;IAC1B,OAAO;QACLK,MAAMF,UAAUE,IAAI;QACpBC,UAAUH,UAAUG,QAAQ;QAC5BC,MAAMJ,UAAUI,IAAI;QACpBC,UAAUL,UAAUK,QAAQ;QAC5BC,MAAMN,UAAUM,IAAI;QACpBC,UAAUP,UAAUO,QAAQ;QAC5BC,OAAOC,IAAAA,mCAAsB,EAACT,UAAUU,YAAY;QACpDC,QAAQX,UAAUW,MAAM;IAC1B;AACF"}
|
||||
8
node_modules/next/dist/shared/lib/router/utils/path-has-prefix.d.ts
generated
vendored
Normal file
8
node_modules/next/dist/shared/lib/router/utils/path-has-prefix.d.ts
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Checks if a given path starts with a given prefix. It ensures it matches
|
||||
* exactly without containing extra chars. e.g. prefix /docs should replace
|
||||
* for /docs, /docs/, /docs/a but not /docsss
|
||||
* @param path The path to check.
|
||||
* @param prefix The prefix to check against.
|
||||
*/
|
||||
export declare function pathHasPrefix(path: string, prefix: string): boolean;
|
||||
20
node_modules/next/dist/shared/lib/router/utils/path-has-prefix.js
generated
vendored
Normal file
20
node_modules/next/dist/shared/lib/router/utils/path-has-prefix.js
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "pathHasPrefix", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return pathHasPrefix;
|
||||
}
|
||||
});
|
||||
const _parsepath = require("./parse-path");
|
||||
function pathHasPrefix(path, prefix) {
|
||||
if (typeof path !== "string") {
|
||||
return false;
|
||||
}
|
||||
const { pathname } = (0, _parsepath.parsePath)(path);
|
||||
return pathname === prefix || pathname.startsWith(prefix + "/");
|
||||
}
|
||||
|
||||
//# sourceMappingURL=path-has-prefix.js.map
|
||||
1
node_modules/next/dist/shared/lib/router/utils/path-has-prefix.js.map
generated
vendored
Normal file
1
node_modules/next/dist/shared/lib/router/utils/path-has-prefix.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../src/shared/lib/router/utils/path-has-prefix.ts"],"names":["pathHasPrefix","path","prefix","pathname","parsePath","startsWith"],"mappings":";;;;+BASgBA;;;eAAAA;;;2BATU;AASnB,SAASA,cAAcC,IAAY,EAAEC,MAAc;IACxD,IAAI,OAAOD,SAAS,UAAU;QAC5B,OAAO;IACT;IAEA,MAAM,EAAEE,QAAQ,EAAE,GAAGC,IAAAA,oBAAS,EAACH;IAC/B,OAAOE,aAAaD,UAAUC,SAASE,UAAU,CAACH,SAAS;AAC7D"}
|
||||
29
node_modules/next/dist/shared/lib/router/utils/path-match.d.ts
generated
vendored
Normal file
29
node_modules/next/dist/shared/lib/router/utils/path-match.d.ts
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
interface Options {
|
||||
/**
|
||||
* A transformer function that will be applied to the regexp generated
|
||||
* from the provided path and path-to-regexp.
|
||||
*/
|
||||
regexModifier?: (regex: string) => string;
|
||||
/**
|
||||
* When true the function will remove all unnamed parameters
|
||||
* from the matched parameters.
|
||||
*/
|
||||
removeUnnamedParams?: boolean;
|
||||
/**
|
||||
* When true the regexp won't allow an optional trailing delimiter
|
||||
* to match.
|
||||
*/
|
||||
strict?: boolean;
|
||||
/**
|
||||
* When true the matcher will be case-sensitive, defaults to false
|
||||
*/
|
||||
sensitive?: boolean;
|
||||
}
|
||||
export type PatchMatcher = (pathname?: string | null, params?: Record<string, any>) => Record<string, any> | false;
|
||||
/**
|
||||
* Generates a path matcher function for a given path and options based on
|
||||
* path-to-regexp. By default the match will be case insensitive, non strict
|
||||
* and delimited by `/`.
|
||||
*/
|
||||
export declare function getPathMatch(path: string, options?: Options): PatchMatcher;
|
||||
export {};
|
||||
49
node_modules/next/dist/shared/lib/router/utils/path-match.js
generated
vendored
Normal file
49
node_modules/next/dist/shared/lib/router/utils/path-match.js
generated
vendored
Normal file
@ -0,0 +1,49 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "getPathMatch", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return getPathMatch;
|
||||
}
|
||||
});
|
||||
const _pathtoregexp = require("next/dist/compiled/path-to-regexp");
|
||||
function getPathMatch(path, options) {
|
||||
const keys = [];
|
||||
const regexp = (0, _pathtoregexp.pathToRegexp)(path, keys, {
|
||||
delimiter: "/",
|
||||
sensitive: typeof (options == null ? void 0 : options.sensitive) === "boolean" ? options.sensitive : false,
|
||||
strict: options == null ? void 0 : options.strict
|
||||
});
|
||||
const matcher = (0, _pathtoregexp.regexpToFunction)((options == null ? void 0 : options.regexModifier) ? new RegExp(options.regexModifier(regexp.source), regexp.flags) : regexp, keys);
|
||||
/**
|
||||
* A matcher function that will check if a given pathname matches the path
|
||||
* given in the builder function. When the path does not match it will return
|
||||
* `false` but if it does it will return an object with the matched params
|
||||
* merged with the params provided in the second argument.
|
||||
*/ return (pathname, params)=>{
|
||||
// If no pathname is provided it's not a match.
|
||||
if (typeof pathname !== "string") return false;
|
||||
const match = matcher(pathname);
|
||||
// If the path did not match `false` will be returned.
|
||||
if (!match) return false;
|
||||
/**
|
||||
* If unnamed params are not allowed they must be removed from
|
||||
* the matched parameters. path-to-regexp uses "string" for named and
|
||||
* "number" for unnamed parameters.
|
||||
*/ if (options == null ? void 0 : options.removeUnnamedParams) {
|
||||
for (const key of keys){
|
||||
if (typeof key.name === "number") {
|
||||
delete match.params[key.name];
|
||||
}
|
||||
}
|
||||
}
|
||||
return {
|
||||
...params,
|
||||
...match.params
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=path-match.js.map
|
||||
1
node_modules/next/dist/shared/lib/router/utils/path-match.js.map
generated
vendored
Normal file
1
node_modules/next/dist/shared/lib/router/utils/path-match.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../src/shared/lib/router/utils/path-match.ts"],"names":["getPathMatch","path","options","keys","regexp","pathToRegexp","delimiter","sensitive","strict","matcher","regexpToFunction","regexModifier","RegExp","source","flags","pathname","params","match","removeUnnamedParams","key","name"],"mappings":";;;;+BAqCgBA;;;eAAAA;;;8BApCa;AAoCtB,SAASA,aAAaC,IAAY,EAAEC,OAAiB;IAC1D,MAAMC,OAAc,EAAE;IACtB,MAAMC,SAASC,IAAAA,0BAAY,EAACJ,MAAME,MAAM;QACtCG,WAAW;QACXC,WACE,QAAOL,2BAAAA,QAASK,SAAS,MAAK,YAAYL,QAAQK,SAAS,GAAG;QAChEC,MAAM,EAAEN,2BAAAA,QAASM,MAAM;IACzB;IAEA,MAAMC,UAAUC,IAAAA,8BAAgB,EAC9BR,CAAAA,2BAAAA,QAASS,aAAa,IAClB,IAAIC,OAAOV,QAAQS,aAAa,CAACP,OAAOS,MAAM,GAAGT,OAAOU,KAAK,IAC7DV,QACJD;IAGF;;;;;GAKC,GACD,OAAO,CAACY,UAAUC;QAChB,+CAA+C;QAC/C,IAAI,OAAOD,aAAa,UAAU,OAAO;QAEzC,MAAME,QAAQR,QAAQM;QAEtB,sDAAsD;QACtD,IAAI,CAACE,OAAO,OAAO;QAEnB;;;;KAIC,GACD,IAAIf,2BAAAA,QAASgB,mBAAmB,EAAE;YAChC,KAAK,MAAMC,OAAOhB,KAAM;gBACtB,IAAI,OAAOgB,IAAIC,IAAI,KAAK,UAAU;oBAChC,OAAOH,MAAMD,MAAM,CAACG,IAAIC,IAAI,CAAC;gBAC/B;YACF;QACF;QAEA,OAAO;YAAE,GAAGJ,MAAM;YAAE,GAAGC,MAAMD,MAAM;QAAC;IACtC;AACF"}
|
||||
19
node_modules/next/dist/shared/lib/router/utils/prepare-destination.d.ts
generated
vendored
Normal file
19
node_modules/next/dist/shared/lib/router/utils/prepare-destination.d.ts
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
/// <reference types="node" />
|
||||
/// <reference types="node" />
|
||||
import type { IncomingMessage } from 'http';
|
||||
import type { NextParsedUrlQuery } from '../../../../server/request-meta';
|
||||
import type { Params } from './route-matcher';
|
||||
import type { RouteHas } from '../../../../lib/load-custom-routes';
|
||||
import type { BaseNextRequest } from '../../../../server/base-http';
|
||||
export declare function matchHas(req: BaseNextRequest | IncomingMessage, query: Params, has?: RouteHas[], missing?: RouteHas[]): false | Params;
|
||||
export declare function compileNonPath(value: string, params: Params): string;
|
||||
export declare function prepareDestination(args: {
|
||||
appendParamsToQuery: boolean;
|
||||
destination: string;
|
||||
params: Params;
|
||||
query: NextParsedUrlQuery;
|
||||
}): {
|
||||
newUrl: string;
|
||||
destQuery: import("querystring").ParsedUrlQuery;
|
||||
parsedDestination: import("./parse-url").ParsedUrl;
|
||||
};
|
||||
236
node_modules/next/dist/shared/lib/router/utils/prepare-destination.js
generated
vendored
Normal file
236
node_modules/next/dist/shared/lib/router/utils/prepare-destination.js
generated
vendored
Normal file
@ -0,0 +1,236 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
compileNonPath: null,
|
||||
matchHas: null,
|
||||
prepareDestination: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
compileNonPath: function() {
|
||||
return compileNonPath;
|
||||
},
|
||||
matchHas: function() {
|
||||
return matchHas;
|
||||
},
|
||||
prepareDestination: function() {
|
||||
return prepareDestination;
|
||||
}
|
||||
});
|
||||
const _pathtoregexp = require("next/dist/compiled/path-to-regexp");
|
||||
const _escaperegexp = require("../../escape-regexp");
|
||||
const _parseurl = require("./parse-url");
|
||||
const _interceptionroutes = require("../../../../server/future/helpers/interception-routes");
|
||||
const _approuterheaders = require("../../../../client/components/app-router-headers");
|
||||
const _getcookieparser = require("../../../../server/api-utils/get-cookie-parser");
|
||||
/**
|
||||
* Ensure only a-zA-Z are used for param names for proper interpolating
|
||||
* with path-to-regexp
|
||||
*/ function getSafeParamName(paramName) {
|
||||
let newParamName = "";
|
||||
for(let i = 0; i < paramName.length; i++){
|
||||
const charCode = paramName.charCodeAt(i);
|
||||
if (charCode > 64 && charCode < 91 || // A-Z
|
||||
charCode > 96 && charCode < 123 // a-z
|
||||
) {
|
||||
newParamName += paramName[i];
|
||||
}
|
||||
}
|
||||
return newParamName;
|
||||
}
|
||||
function escapeSegment(str, segmentName) {
|
||||
return str.replace(new RegExp(":" + (0, _escaperegexp.escapeStringRegexp)(segmentName), "g"), "__ESC_COLON_" + segmentName);
|
||||
}
|
||||
function unescapeSegments(str) {
|
||||
return str.replace(/__ESC_COLON_/gi, ":");
|
||||
}
|
||||
function matchHas(req, query, has, missing) {
|
||||
if (has === void 0) has = [];
|
||||
if (missing === void 0) missing = [];
|
||||
const params = {};
|
||||
const hasMatch = (hasItem)=>{
|
||||
let value;
|
||||
let key = hasItem.key;
|
||||
switch(hasItem.type){
|
||||
case "header":
|
||||
{
|
||||
key = key.toLowerCase();
|
||||
value = req.headers[key];
|
||||
break;
|
||||
}
|
||||
case "cookie":
|
||||
{
|
||||
if ("cookies" in req) {
|
||||
value = req.cookies[hasItem.key];
|
||||
} else {
|
||||
const cookies = (0, _getcookieparser.getCookieParser)(req.headers)();
|
||||
value = cookies[hasItem.key];
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "query":
|
||||
{
|
||||
value = query[key];
|
||||
break;
|
||||
}
|
||||
case "host":
|
||||
{
|
||||
const { host } = (req == null ? void 0 : req.headers) || {};
|
||||
// remove port from host if present
|
||||
const hostname = host == null ? void 0 : host.split(":", 1)[0].toLowerCase();
|
||||
value = hostname;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!hasItem.value && value) {
|
||||
params[getSafeParamName(key)] = value;
|
||||
return true;
|
||||
} else if (value) {
|
||||
const matcher = new RegExp("^" + hasItem.value + "$");
|
||||
const matches = Array.isArray(value) ? value.slice(-1)[0].match(matcher) : value.match(matcher);
|
||||
if (matches) {
|
||||
if (Array.isArray(matches)) {
|
||||
if (matches.groups) {
|
||||
Object.keys(matches.groups).forEach((groupKey)=>{
|
||||
params[groupKey] = matches.groups[groupKey];
|
||||
});
|
||||
} else if (hasItem.type === "host" && matches[0]) {
|
||||
params.host = matches[0];
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
const allMatch = has.every((item)=>hasMatch(item)) && !missing.some((item)=>hasMatch(item));
|
||||
if (allMatch) {
|
||||
return params;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function compileNonPath(value, params) {
|
||||
if (!value.includes(":")) {
|
||||
return value;
|
||||
}
|
||||
for (const key of Object.keys(params)){
|
||||
if (value.includes(":" + key)) {
|
||||
value = value.replace(new RegExp(":" + key + "\\*", "g"), ":" + key + "--ESCAPED_PARAM_ASTERISKS").replace(new RegExp(":" + key + "\\?", "g"), ":" + key + "--ESCAPED_PARAM_QUESTION").replace(new RegExp(":" + key + "\\+", "g"), ":" + key + "--ESCAPED_PARAM_PLUS").replace(new RegExp(":" + key + "(?!\\w)", "g"), "--ESCAPED_PARAM_COLON" + key);
|
||||
}
|
||||
}
|
||||
value = value.replace(/(:|\*|\?|\+|\(|\)|\{|\})/g, "\\$1").replace(/--ESCAPED_PARAM_PLUS/g, "+").replace(/--ESCAPED_PARAM_COLON/g, ":").replace(/--ESCAPED_PARAM_QUESTION/g, "?").replace(/--ESCAPED_PARAM_ASTERISKS/g, "*");
|
||||
// the value needs to start with a forward-slash to be compiled
|
||||
// correctly
|
||||
return (0, _pathtoregexp.compile)("/" + value, {
|
||||
validate: false
|
||||
})(params).slice(1);
|
||||
}
|
||||
function prepareDestination(args) {
|
||||
const query = Object.assign({}, args.query);
|
||||
delete query.__nextLocale;
|
||||
delete query.__nextDefaultLocale;
|
||||
delete query.__nextDataReq;
|
||||
delete query.__nextInferredLocaleFromDefault;
|
||||
delete query[_approuterheaders.NEXT_RSC_UNION_QUERY];
|
||||
let escapedDestination = args.destination;
|
||||
for (const param of Object.keys({
|
||||
...args.params,
|
||||
...query
|
||||
})){
|
||||
escapedDestination = escapeSegment(escapedDestination, param);
|
||||
}
|
||||
const parsedDestination = (0, _parseurl.parseUrl)(escapedDestination);
|
||||
const destQuery = parsedDestination.query;
|
||||
const destPath = unescapeSegments("" + parsedDestination.pathname + (parsedDestination.hash || ""));
|
||||
const destHostname = unescapeSegments(parsedDestination.hostname || "");
|
||||
const destPathParamKeys = [];
|
||||
const destHostnameParamKeys = [];
|
||||
(0, _pathtoregexp.pathToRegexp)(destPath, destPathParamKeys);
|
||||
(0, _pathtoregexp.pathToRegexp)(destHostname, destHostnameParamKeys);
|
||||
const destParams = [];
|
||||
destPathParamKeys.forEach((key)=>destParams.push(key.name));
|
||||
destHostnameParamKeys.forEach((key)=>destParams.push(key.name));
|
||||
const destPathCompiler = (0, _pathtoregexp.compile)(destPath, // we don't validate while compiling the destination since we should
|
||||
// have already validated before we got to this point and validating
|
||||
// breaks compiling destinations with named pattern params from the source
|
||||
// e.g. /something:hello(.*) -> /another/:hello is broken with validation
|
||||
// since compile validation is meant for reversing and not for inserting
|
||||
// params from a separate path-regex into another
|
||||
{
|
||||
validate: false
|
||||
});
|
||||
const destHostnameCompiler = (0, _pathtoregexp.compile)(destHostname, {
|
||||
validate: false
|
||||
});
|
||||
// update any params in query values
|
||||
for (const [key, strOrArray] of Object.entries(destQuery)){
|
||||
// the value needs to start with a forward-slash to be compiled
|
||||
// correctly
|
||||
if (Array.isArray(strOrArray)) {
|
||||
destQuery[key] = strOrArray.map((value)=>compileNonPath(unescapeSegments(value), args.params));
|
||||
} else if (typeof strOrArray === "string") {
|
||||
destQuery[key] = compileNonPath(unescapeSegments(strOrArray), args.params);
|
||||
}
|
||||
}
|
||||
// add path params to query if it's not a redirect and not
|
||||
// already defined in destination query or path
|
||||
let paramKeys = Object.keys(args.params).filter((name)=>name !== "nextInternalLocale");
|
||||
if (args.appendParamsToQuery && !paramKeys.some((key)=>destParams.includes(key))) {
|
||||
for (const key of paramKeys){
|
||||
if (!(key in destQuery)) {
|
||||
destQuery[key] = args.params[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
let newUrl;
|
||||
// The compiler also that the interception route marker is an unnamed param, hence '0',
|
||||
// so we need to add it to the params object.
|
||||
if ((0, _interceptionroutes.isInterceptionRouteAppPath)(destPath)) {
|
||||
for (const segment of destPath.split("/")){
|
||||
const marker = _interceptionroutes.INTERCEPTION_ROUTE_MARKERS.find((m)=>segment.startsWith(m));
|
||||
if (marker) {
|
||||
args.params["0"] = marker;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
try {
|
||||
newUrl = destPathCompiler(args.params);
|
||||
const [pathname, hash] = newUrl.split("#", 2);
|
||||
parsedDestination.hostname = destHostnameCompiler(args.params);
|
||||
parsedDestination.pathname = pathname;
|
||||
parsedDestination.hash = "" + (hash ? "#" : "") + (hash || "");
|
||||
delete parsedDestination.search;
|
||||
} catch (err) {
|
||||
if (err.message.match(/Expected .*? to not repeat, but got an array/)) {
|
||||
throw new Error("To use a multi-match in the destination you must add `*` at the end of the param name to signify it should repeat. https://nextjs.org/docs/messages/invalid-multi-match");
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
// Query merge order lowest priority to highest
|
||||
// 1. initial URL query values
|
||||
// 2. path segment values
|
||||
// 3. destination specified query values
|
||||
parsedDestination.query = {
|
||||
...query,
|
||||
...parsedDestination.query
|
||||
};
|
||||
return {
|
||||
newUrl,
|
||||
destQuery,
|
||||
parsedDestination
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=prepare-destination.js.map
|
||||
1
node_modules/next/dist/shared/lib/router/utils/prepare-destination.js.map
generated
vendored
Normal file
1
node_modules/next/dist/shared/lib/router/utils/prepare-destination.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
5
node_modules/next/dist/shared/lib/router/utils/querystring.d.ts
generated
vendored
Normal file
5
node_modules/next/dist/shared/lib/router/utils/querystring.d.ts
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
/// <reference types="node" />
|
||||
import type { ParsedUrlQuery } from 'querystring';
|
||||
export declare function searchParamsToUrlQuery(searchParams: URLSearchParams): ParsedUrlQuery;
|
||||
export declare function urlQueryToSearchParams(urlQuery: ParsedUrlQuery): URLSearchParams;
|
||||
export declare function assign(target: URLSearchParams, ...searchParamsList: URLSearchParams[]): URLSearchParams;
|
||||
73
node_modules/next/dist/shared/lib/router/utils/querystring.js
generated
vendored
Normal file
73
node_modules/next/dist/shared/lib/router/utils/querystring.js
generated
vendored
Normal file
@ -0,0 +1,73 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
assign: null,
|
||||
searchParamsToUrlQuery: null,
|
||||
urlQueryToSearchParams: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
assign: function() {
|
||||
return assign;
|
||||
},
|
||||
searchParamsToUrlQuery: function() {
|
||||
return searchParamsToUrlQuery;
|
||||
},
|
||||
urlQueryToSearchParams: function() {
|
||||
return urlQueryToSearchParams;
|
||||
}
|
||||
});
|
||||
function searchParamsToUrlQuery(searchParams) {
|
||||
const query = {};
|
||||
searchParams.forEach((value, key)=>{
|
||||
if (typeof query[key] === "undefined") {
|
||||
query[key] = value;
|
||||
} else if (Array.isArray(query[key])) {
|
||||
query[key].push(value);
|
||||
} else {
|
||||
query[key] = [
|
||||
query[key],
|
||||
value
|
||||
];
|
||||
}
|
||||
});
|
||||
return query;
|
||||
}
|
||||
function stringifyUrlQueryParam(param) {
|
||||
if (typeof param === "string" || typeof param === "number" && !isNaN(param) || typeof param === "boolean") {
|
||||
return String(param);
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
function urlQueryToSearchParams(urlQuery) {
|
||||
const result = new URLSearchParams();
|
||||
Object.entries(urlQuery).forEach((param)=>{
|
||||
let [key, value] = param;
|
||||
if (Array.isArray(value)) {
|
||||
value.forEach((item)=>result.append(key, stringifyUrlQueryParam(item)));
|
||||
} else {
|
||||
result.set(key, stringifyUrlQueryParam(value));
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
function assign(target) {
|
||||
for(var _len = arguments.length, searchParamsList = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
|
||||
searchParamsList[_key - 1] = arguments[_key];
|
||||
}
|
||||
searchParamsList.forEach((searchParams)=>{
|
||||
Array.from(searchParams.keys()).forEach((key)=>target.delete(key));
|
||||
searchParams.forEach((value, key)=>target.append(key, value));
|
||||
});
|
||||
return target;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=querystring.js.map
|
||||
1
node_modules/next/dist/shared/lib/router/utils/querystring.js.map
generated
vendored
Normal file
1
node_modules/next/dist/shared/lib/router/utils/querystring.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../src/shared/lib/router/utils/querystring.ts"],"names":["assign","searchParamsToUrlQuery","urlQueryToSearchParams","searchParams","query","forEach","value","key","Array","isArray","push","stringifyUrlQueryParam","param","isNaN","String","urlQuery","result","URLSearchParams","Object","entries","item","append","set","target","searchParamsList","from","keys","delete"],"mappings":";;;;;;;;;;;;;;;;IA4CgBA,MAAM;eAANA;;IA1CAC,sBAAsB;eAAtBA;;IA4BAC,sBAAsB;eAAtBA;;;AA5BT,SAASD,uBACdE,YAA6B;IAE7B,MAAMC,QAAwB,CAAC;IAC/BD,aAAaE,OAAO,CAAC,CAACC,OAAOC;QAC3B,IAAI,OAAOH,KAAK,CAACG,IAAI,KAAK,aAAa;YACrCH,KAAK,CAACG,IAAI,GAAGD;QACf,OAAO,IAAIE,MAAMC,OAAO,CAACL,KAAK,CAACG,IAAI,GAAG;YAClCH,KAAK,CAACG,IAAI,CAAcG,IAAI,CAACJ;QACjC,OAAO;YACLF,KAAK,CAACG,IAAI,GAAG;gBAACH,KAAK,CAACG,IAAI;gBAAYD;aAAM;QAC5C;IACF;IACA,OAAOF;AACT;AAEA,SAASO,uBAAuBC,KAAc;IAC5C,IACE,OAAOA,UAAU,YAChB,OAAOA,UAAU,YAAY,CAACC,MAAMD,UACrC,OAAOA,UAAU,WACjB;QACA,OAAOE,OAAOF;IAChB,OAAO;QACL,OAAO;IACT;AACF;AAEO,SAASV,uBACda,QAAwB;IAExB,MAAMC,SAAS,IAAIC;IACnBC,OAAOC,OAAO,CAACJ,UAAUV,OAAO,CAAC;YAAC,CAACE,KAAKD,MAAM;QAC5C,IAAIE,MAAMC,OAAO,CAACH,QAAQ;YACxBA,MAAMD,OAAO,CAAC,CAACe,OAASJ,OAAOK,MAAM,CAACd,KAAKI,uBAAuBS;QACpE,OAAO;YACLJ,OAAOM,GAAG,CAACf,KAAKI,uBAAuBL;QACzC;IACF;IACA,OAAOU;AACT;AAEO,SAAShB,OACduB,MAAuB;IACvB,IAAA,IAAA,OAAA,UAAA,QAAA,AAAGC,mBAAH,UAAA,OAAA,IAAA,OAAA,QAAA,OAAA,GAAA,OAAA,MAAA;QAAGA,iBAAH,OAAA,KAAA,SAAA,CAAA,KAAsC;;IAEtCA,iBAAiBnB,OAAO,CAAC,CAACF;QACxBK,MAAMiB,IAAI,CAACtB,aAAauB,IAAI,IAAIrB,OAAO,CAAC,CAACE,MAAQgB,OAAOI,MAAM,CAACpB;QAC/DJ,aAAaE,OAAO,CAAC,CAACC,OAAOC,MAAQgB,OAAOF,MAAM,CAACd,KAAKD;IAC1D;IACA,OAAOiB;AACT"}
|
||||
6
node_modules/next/dist/shared/lib/router/utils/relativize-url.d.ts
generated
vendored
Normal file
6
node_modules/next/dist/shared/lib/router/utils/relativize-url.d.ts
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Given a URL as a string and a base URL it will make the URL relative
|
||||
* if the parsed protocol and host is the same as the one in the base
|
||||
* URL. Otherwise it returns the same URL string.
|
||||
*/
|
||||
export declare function relativizeURL(url: string | string, base: string | URL): string;
|
||||
22
node_modules/next/dist/shared/lib/router/utils/relativize-url.js
generated
vendored
Normal file
22
node_modules/next/dist/shared/lib/router/utils/relativize-url.js
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
/**
|
||||
* Given a URL as a string and a base URL it will make the URL relative
|
||||
* if the parsed protocol and host is the same as the one in the base
|
||||
* URL. Otherwise it returns the same URL string.
|
||||
*/ "use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "relativizeURL", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return relativizeURL;
|
||||
}
|
||||
});
|
||||
function relativizeURL(url, base) {
|
||||
const baseURL = typeof base === "string" ? new URL(base) : base;
|
||||
const relative = new URL(url, base);
|
||||
const origin = baseURL.protocol + "//" + baseURL.host;
|
||||
return relative.protocol + "//" + relative.host === origin ? relative.toString().replace(origin, "") : relative.toString();
|
||||
}
|
||||
|
||||
//# sourceMappingURL=relativize-url.js.map
|
||||
1
node_modules/next/dist/shared/lib/router/utils/relativize-url.js.map
generated
vendored
Normal file
1
node_modules/next/dist/shared/lib/router/utils/relativize-url.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../src/shared/lib/router/utils/relativize-url.ts"],"names":["relativizeURL","url","base","baseURL","URL","relative","origin","protocol","host","toString","replace"],"mappings":"AAAA;;;;CAIC;;;;+BACeA;;;eAAAA;;;AAAT,SAASA,cAAcC,GAAoB,EAAEC,IAAkB;IACpE,MAAMC,UAAU,OAAOD,SAAS,WAAW,IAAIE,IAAIF,QAAQA;IAC3D,MAAMG,WAAW,IAAID,IAAIH,KAAKC;IAC9B,MAAMI,SAAS,AAAGH,QAAQI,QAAQ,GAAC,OAAIJ,QAAQK,IAAI;IACnD,OAAO,AAAGH,SAASE,QAAQ,GAAC,OAAIF,SAASG,IAAI,KAAOF,SAChDD,SAASI,QAAQ,GAAGC,OAAO,CAACJ,QAAQ,MACpCD,SAASI,QAAQ;AACvB"}
|
||||
9
node_modules/next/dist/shared/lib/router/utils/remove-path-prefix.d.ts
generated
vendored
Normal file
9
node_modules/next/dist/shared/lib/router/utils/remove-path-prefix.d.ts
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Given a path and a prefix it will remove the prefix when it exists in the
|
||||
* given path. It ensures it matches exactly without containing extra chars
|
||||
* and if the prefix is not there it will be noop.
|
||||
*
|
||||
* @param path The path to remove the prefix from.
|
||||
* @param prefix The prefix to be removed.
|
||||
*/
|
||||
export declare function removePathPrefix(path: string, prefix: string): string;
|
||||
39
node_modules/next/dist/shared/lib/router/utils/remove-path-prefix.js
generated
vendored
Normal file
39
node_modules/next/dist/shared/lib/router/utils/remove-path-prefix.js
generated
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "removePathPrefix", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return removePathPrefix;
|
||||
}
|
||||
});
|
||||
const _pathhasprefix = require("./path-has-prefix");
|
||||
function removePathPrefix(path, prefix) {
|
||||
// If the path doesn't start with the prefix we can return it as is. This
|
||||
// protects us from situations where the prefix is a substring of the path
|
||||
// prefix such as:
|
||||
//
|
||||
// For prefix: /blog
|
||||
//
|
||||
// /blog -> true
|
||||
// /blog/ -> true
|
||||
// /blog/1 -> true
|
||||
// /blogging -> false
|
||||
// /blogging/ -> false
|
||||
// /blogging/1 -> false
|
||||
if (!(0, _pathhasprefix.pathHasPrefix)(path, prefix)) {
|
||||
return path;
|
||||
}
|
||||
// Remove the prefix from the path via slicing.
|
||||
const withoutPrefix = path.slice(prefix.length);
|
||||
// If the path without the prefix starts with a `/` we can return it as is.
|
||||
if (withoutPrefix.startsWith("/")) {
|
||||
return withoutPrefix;
|
||||
}
|
||||
// If the path without the prefix doesn't start with a `/` we need to add it
|
||||
// back to the path to make sure it's a valid path.
|
||||
return "/" + withoutPrefix;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=remove-path-prefix.js.map
|
||||
1
node_modules/next/dist/shared/lib/router/utils/remove-path-prefix.js.map
generated
vendored
Normal file
1
node_modules/next/dist/shared/lib/router/utils/remove-path-prefix.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../src/shared/lib/router/utils/remove-path-prefix.ts"],"names":["removePathPrefix","path","prefix","pathHasPrefix","withoutPrefix","slice","length","startsWith"],"mappings":";;;;+BAUgBA;;;eAAAA;;;+BAVc;AAUvB,SAASA,iBAAiBC,IAAY,EAAEC,MAAc;IAC3D,yEAAyE;IACzE,0EAA0E;IAC1E,kBAAkB;IAClB,EAAE;IACF,oBAAoB;IACpB,EAAE;IACF,kBAAkB;IAClB,mBAAmB;IACnB,oBAAoB;IACpB,uBAAuB;IACvB,wBAAwB;IACxB,yBAAyB;IACzB,IAAI,CAACC,IAAAA,4BAAa,EAACF,MAAMC,SAAS;QAChC,OAAOD;IACT;IAEA,+CAA+C;IAC/C,MAAMG,gBAAgBH,KAAKI,KAAK,CAACH,OAAOI,MAAM;IAE9C,2EAA2E;IAC3E,IAAIF,cAAcG,UAAU,CAAC,MAAM;QACjC,OAAOH;IACT;IAEA,4EAA4E;IAC5E,mDAAmD;IACnD,OAAO,AAAC,MAAGA;AACb"}
|
||||
8
node_modules/next/dist/shared/lib/router/utils/remove-trailing-slash.d.ts
generated
vendored
Normal file
8
node_modules/next/dist/shared/lib/router/utils/remove-trailing-slash.d.ts
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Removes the trailing slash for a given route or page path. Preserves the
|
||||
* root page. Examples:
|
||||
* - `/foo/bar/` -> `/foo/bar`
|
||||
* - `/foo/bar` -> `/foo/bar`
|
||||
* - `/` -> `/`
|
||||
*/
|
||||
export declare function removeTrailingSlash(route: string): string;
|
||||
21
node_modules/next/dist/shared/lib/router/utils/remove-trailing-slash.js
generated
vendored
Normal file
21
node_modules/next/dist/shared/lib/router/utils/remove-trailing-slash.js
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
/**
|
||||
* Removes the trailing slash for a given route or page path. Preserves the
|
||||
* root page. Examples:
|
||||
* - `/foo/bar/` -> `/foo/bar`
|
||||
* - `/foo/bar` -> `/foo/bar`
|
||||
* - `/` -> `/`
|
||||
*/ "use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "removeTrailingSlash", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return removeTrailingSlash;
|
||||
}
|
||||
});
|
||||
function removeTrailingSlash(route) {
|
||||
return route.replace(/\/$/, "") || "/";
|
||||
}
|
||||
|
||||
//# sourceMappingURL=remove-trailing-slash.js.map
|
||||
1
node_modules/next/dist/shared/lib/router/utils/remove-trailing-slash.js.map
generated
vendored
Normal file
1
node_modules/next/dist/shared/lib/router/utils/remove-trailing-slash.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../src/shared/lib/router/utils/remove-trailing-slash.ts"],"names":["removeTrailingSlash","route","replace"],"mappings":"AAAA;;;;;;CAMC;;;;+BACeA;;;eAAAA;;;AAAT,SAASA,oBAAoBC,KAAa;IAC/C,OAAOA,MAAMC,OAAO,CAAC,OAAO,OAAO;AACrC"}
|
||||
15
node_modules/next/dist/shared/lib/router/utils/resolve-rewrites.d.ts
generated
vendored
Normal file
15
node_modules/next/dist/shared/lib/router/utils/resolve-rewrites.d.ts
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
/// <reference types="node" />
|
||||
import type { ParsedUrlQuery } from 'querystring';
|
||||
import type { Rewrite } from '../../../../lib/load-custom-routes';
|
||||
import { parseRelativeUrl } from './parse-relative-url';
|
||||
export default function resolveRewrites(asPath: string, pages: string[], rewrites: {
|
||||
beforeFiles: Rewrite[];
|
||||
afterFiles: Rewrite[];
|
||||
fallback: Rewrite[];
|
||||
}, query: ParsedUrlQuery, resolveHref: (path: string) => string, locales?: string[]): {
|
||||
matchedPage: boolean;
|
||||
parsedAs: ReturnType<typeof parseRelativeUrl>;
|
||||
asPath: string;
|
||||
resolvedHref?: string;
|
||||
externalDest?: boolean;
|
||||
};
|
||||
118
node_modules/next/dist/shared/lib/router/utils/resolve-rewrites.js
generated
vendored
Normal file
118
node_modules/next/dist/shared/lib/router/utils/resolve-rewrites.js
generated
vendored
Normal file
@ -0,0 +1,118 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "default", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return resolveRewrites;
|
||||
}
|
||||
});
|
||||
const _pathmatch = require("./path-match");
|
||||
const _preparedestination = require("./prepare-destination");
|
||||
const _removetrailingslash = require("./remove-trailing-slash");
|
||||
const _normalizelocalepath = require("../../i18n/normalize-locale-path");
|
||||
const _removebasepath = require("../../../../client/remove-base-path");
|
||||
const _parserelativeurl = require("./parse-relative-url");
|
||||
function resolveRewrites(asPath, pages, rewrites, query, resolveHref, locales) {
|
||||
let matchedPage = false;
|
||||
let externalDest = false;
|
||||
let parsedAs = (0, _parserelativeurl.parseRelativeUrl)(asPath);
|
||||
let fsPathname = (0, _removetrailingslash.removeTrailingSlash)((0, _normalizelocalepath.normalizeLocalePath)((0, _removebasepath.removeBasePath)(parsedAs.pathname), locales).pathname);
|
||||
let resolvedHref;
|
||||
const handleRewrite = (rewrite)=>{
|
||||
const matcher = (0, _pathmatch.getPathMatch)(rewrite.source + (process.env.__NEXT_TRAILING_SLASH ? "(/)?" : ""), {
|
||||
removeUnnamedParams: true,
|
||||
strict: true
|
||||
});
|
||||
let params = matcher(parsedAs.pathname);
|
||||
if ((rewrite.has || rewrite.missing) && params) {
|
||||
const hasParams = (0, _preparedestination.matchHas)({
|
||||
headers: {
|
||||
host: document.location.hostname,
|
||||
"user-agent": navigator.userAgent
|
||||
},
|
||||
cookies: document.cookie.split("; ").reduce((acc, item)=>{
|
||||
const [key, ...value] = item.split("=");
|
||||
acc[key] = value.join("=");
|
||||
return acc;
|
||||
}, {})
|
||||
}, parsedAs.query, rewrite.has, rewrite.missing);
|
||||
if (hasParams) {
|
||||
Object.assign(params, hasParams);
|
||||
} else {
|
||||
params = false;
|
||||
}
|
||||
}
|
||||
if (params) {
|
||||
if (!rewrite.destination) {
|
||||
// this is a proxied rewrite which isn't handled on the client
|
||||
externalDest = true;
|
||||
return true;
|
||||
}
|
||||
const destRes = (0, _preparedestination.prepareDestination)({
|
||||
appendParamsToQuery: true,
|
||||
destination: rewrite.destination,
|
||||
params: params,
|
||||
query: query
|
||||
});
|
||||
parsedAs = destRes.parsedDestination;
|
||||
asPath = destRes.newUrl;
|
||||
Object.assign(query, destRes.parsedDestination.query);
|
||||
fsPathname = (0, _removetrailingslash.removeTrailingSlash)((0, _normalizelocalepath.normalizeLocalePath)((0, _removebasepath.removeBasePath)(asPath), locales).pathname);
|
||||
if (pages.includes(fsPathname)) {
|
||||
// check if we now match a page as this means we are done
|
||||
// resolving the rewrites
|
||||
matchedPage = true;
|
||||
resolvedHref = fsPathname;
|
||||
return true;
|
||||
}
|
||||
// check if we match a dynamic-route, if so we break the rewrites chain
|
||||
resolvedHref = resolveHref(fsPathname);
|
||||
if (resolvedHref !== asPath && pages.includes(resolvedHref)) {
|
||||
matchedPage = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
};
|
||||
let finished = false;
|
||||
for(let i = 0; i < rewrites.beforeFiles.length; i++){
|
||||
// we don't end after match in beforeFiles to allow
|
||||
// continuing through all beforeFiles rewrites
|
||||
handleRewrite(rewrites.beforeFiles[i]);
|
||||
}
|
||||
matchedPage = pages.includes(fsPathname);
|
||||
if (!matchedPage) {
|
||||
if (!finished) {
|
||||
for(let i = 0; i < rewrites.afterFiles.length; i++){
|
||||
if (handleRewrite(rewrites.afterFiles[i])) {
|
||||
finished = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// check dynamic route before processing fallback rewrites
|
||||
if (!finished) {
|
||||
resolvedHref = resolveHref(fsPathname);
|
||||
matchedPage = pages.includes(resolvedHref);
|
||||
finished = matchedPage;
|
||||
}
|
||||
if (!finished) {
|
||||
for(let i = 0; i < rewrites.fallback.length; i++){
|
||||
if (handleRewrite(rewrites.fallback[i])) {
|
||||
finished = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return {
|
||||
asPath,
|
||||
parsedAs,
|
||||
matchedPage,
|
||||
resolvedHref,
|
||||
externalDest
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=resolve-rewrites.js.map
|
||||
1
node_modules/next/dist/shared/lib/router/utils/resolve-rewrites.js.map
generated
vendored
Normal file
1
node_modules/next/dist/shared/lib/router/utils/resolve-rewrites.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../src/shared/lib/router/utils/resolve-rewrites.ts"],"names":["resolveRewrites","asPath","pages","rewrites","query","resolveHref","locales","matchedPage","externalDest","parsedAs","parseRelativeUrl","fsPathname","removeTrailingSlash","normalizeLocalePath","removeBasePath","pathname","resolvedHref","handleRewrite","rewrite","matcher","getPathMatch","source","process","env","__NEXT_TRAILING_SLASH","removeUnnamedParams","strict","params","has","missing","hasParams","matchHas","headers","host","document","location","hostname","navigator","userAgent","cookies","cookie","split","reduce","acc","item","key","value","join","Object","assign","destination","destRes","prepareDestination","appendParamsToQuery","parsedDestination","newUrl","includes","finished","i","beforeFiles","length","afterFiles","fallback"],"mappings":";;;;+BASA;;;eAAwBA;;;2BAPK;oCACgB;qCACT;qCACA;gCACL;kCACE;AAElB,SAASA,gBACtBC,MAAc,EACdC,KAAe,EACfC,QAIC,EACDC,KAAqB,EACrBC,WAAqC,EACrCC,OAAkB;IAQlB,IAAIC,cAAc;IAClB,IAAIC,eAAe;IACnB,IAAIC,WAAWC,IAAAA,kCAAgB,EAACT;IAChC,IAAIU,aAAaC,IAAAA,wCAAmB,EAClCC,IAAAA,wCAAmB,EAACC,IAAAA,8BAAc,EAACL,SAASM,QAAQ,GAAGT,SAASS,QAAQ;IAE1E,IAAIC;IAEJ,MAAMC,gBAAgB,CAACC;QACrB,MAAMC,UAAUC,IAAAA,uBAAY,EAC1BF,QAAQG,MAAM,GAAIC,CAAAA,QAAQC,GAAG,CAACC,qBAAqB,GAAG,SAAS,EAAC,GAChE;YACEC,qBAAqB;YACrBC,QAAQ;QACV;QAGF,IAAIC,SAASR,QAAQV,SAASM,QAAQ;QAEtC,IAAI,AAACG,CAAAA,QAAQU,GAAG,IAAIV,QAAQW,OAAO,AAAD,KAAMF,QAAQ;YAC9C,MAAMG,YAAYC,IAAAA,4BAAQ,EACxB;gBACEC,SAAS;oBACPC,MAAMC,SAASC,QAAQ,CAACC,QAAQ;oBAChC,cAAcC,UAAUC,SAAS;gBACnC;gBACAC,SAASL,SAASM,MAAM,CACrBC,KAAK,CAAC,MACNC,MAAM,CAAyB,CAACC,KAAKC;oBACpC,MAAM,CAACC,KAAK,GAAGC,MAAM,GAAGF,KAAKH,KAAK,CAAC;oBACnCE,GAAG,CAACE,IAAI,GAAGC,MAAMC,IAAI,CAAC;oBACtB,OAAOJ;gBACT,GAAG,CAAC;YACR,GACAlC,SAASL,KAAK,EACdc,QAAQU,GAAG,EACXV,QAAQW,OAAO;YAGjB,IAAIC,WAAW;gBACbkB,OAAOC,MAAM,CAACtB,QAAQG;YACxB,OAAO;gBACLH,SAAS;YACX;QACF;QAEA,IAAIA,QAAQ;YACV,IAAI,CAACT,QAAQgC,WAAW,EAAE;gBACxB,8DAA8D;gBAC9D1C,eAAe;gBACf,OAAO;YACT;YACA,MAAM2C,UAAUC,IAAAA,sCAAkB,EAAC;gBACjCC,qBAAqB;gBACrBH,aAAahC,QAAQgC,WAAW;gBAChCvB,QAAQA;gBACRvB,OAAOA;YACT;YACAK,WAAW0C,QAAQG,iBAAiB;YACpCrD,SAASkD,QAAQI,MAAM;YACvBP,OAAOC,MAAM,CAAC7C,OAAO+C,QAAQG,iBAAiB,CAAClD,KAAK;YAEpDO,aAAaC,IAAAA,wCAAmB,EAC9BC,IAAAA,wCAAmB,EAACC,IAAAA,8BAAc,EAACb,SAASK,SAASS,QAAQ;YAG/D,IAAIb,MAAMsD,QAAQ,CAAC7C,aAAa;gBAC9B,yDAAyD;gBACzD,yBAAyB;gBACzBJ,cAAc;gBACdS,eAAeL;gBACf,OAAO;YACT;YAEA,uEAAuE;YACvEK,eAAeX,YAAYM;YAE3B,IAAIK,iBAAiBf,UAAUC,MAAMsD,QAAQ,CAACxC,eAAe;gBAC3DT,cAAc;gBACd,OAAO;YACT;QACF;IACF;IACA,IAAIkD,WAAW;IAEf,IAAK,IAAIC,IAAI,GAAGA,IAAIvD,SAASwD,WAAW,CAACC,MAAM,EAAEF,IAAK;QACpD,mDAAmD;QACnD,8CAA8C;QAC9CzC,cAAcd,SAASwD,WAAW,CAACD,EAAE;IACvC;IACAnD,cAAcL,MAAMsD,QAAQ,CAAC7C;IAE7B,IAAI,CAACJ,aAAa;QAChB,IAAI,CAACkD,UAAU;YACb,IAAK,IAAIC,IAAI,GAAGA,IAAIvD,SAAS0D,UAAU,CAACD,MAAM,EAAEF,IAAK;gBACnD,IAAIzC,cAAcd,SAAS0D,UAAU,CAACH,EAAE,GAAG;oBACzCD,WAAW;oBACX;gBACF;YACF;QACF;QAEA,0DAA0D;QAC1D,IAAI,CAACA,UAAU;YACbzC,eAAeX,YAAYM;YAC3BJ,cAAcL,MAAMsD,QAAQ,CAACxC;YAC7ByC,WAAWlD;QACb;QAEA,IAAI,CAACkD,UAAU;YACb,IAAK,IAAIC,IAAI,GAAGA,IAAIvD,SAAS2D,QAAQ,CAACF,MAAM,EAAEF,IAAK;gBACjD,IAAIzC,cAAcd,SAAS2D,QAAQ,CAACJ,EAAE,GAAG;oBACvCD,WAAW;oBACX;gBACF;YACF;QACF;IACF;IAEA,OAAO;QACLxD;QACAQ;QACAF;QACAS;QACAR;IACF;AACF"}
|
||||
8
node_modules/next/dist/shared/lib/router/utils/route-matcher.d.ts
generated
vendored
Normal file
8
node_modules/next/dist/shared/lib/router/utils/route-matcher.d.ts
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
import type { RouteRegex } from './route-regex';
|
||||
export interface RouteMatchFn {
|
||||
(pathname: string | null | undefined): false | Params;
|
||||
}
|
||||
export interface Params {
|
||||
[param: string]: any;
|
||||
}
|
||||
export declare function getRouteMatcher({ re, groups }: RouteRegex): RouteMatchFn;
|
||||
40
node_modules/next/dist/shared/lib/router/utils/route-matcher.js
generated
vendored
Normal file
40
node_modules/next/dist/shared/lib/router/utils/route-matcher.js
generated
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "getRouteMatcher", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return getRouteMatcher;
|
||||
}
|
||||
});
|
||||
const _utils = require("../../utils");
|
||||
function getRouteMatcher(param) {
|
||||
let { re, groups } = param;
|
||||
return (pathname)=>{
|
||||
const routeMatch = re.exec(pathname);
|
||||
if (!routeMatch) {
|
||||
return false;
|
||||
}
|
||||
const decode = (param)=>{
|
||||
try {
|
||||
return decodeURIComponent(param);
|
||||
} catch (_) {
|
||||
throw new _utils.DecodeError("failed to decode param");
|
||||
}
|
||||
};
|
||||
const params = {};
|
||||
Object.keys(groups).forEach((slugName)=>{
|
||||
const g = groups[slugName];
|
||||
const m = routeMatch[g.pos];
|
||||
if (m !== undefined) {
|
||||
params[slugName] = ~m.indexOf("/") ? m.split("/").map((entry)=>decode(entry)) : g.repeat ? [
|
||||
decode(m)
|
||||
] : decode(m);
|
||||
}
|
||||
});
|
||||
return params;
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=route-matcher.js.map
|
||||
1
node_modules/next/dist/shared/lib/router/utils/route-matcher.js.map
generated
vendored
Normal file
1
node_modules/next/dist/shared/lib/router/utils/route-matcher.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../src/shared/lib/router/utils/route-matcher.ts"],"names":["getRouteMatcher","re","groups","pathname","routeMatch","exec","decode","param","decodeURIComponent","_","DecodeError","params","Object","keys","forEach","slugName","g","m","pos","undefined","indexOf","split","map","entry","repeat"],"mappings":";;;;+BAWgBA;;;eAAAA;;;uBAVY;AAUrB,SAASA,gBAAgB,KAA0B;IAA1B,IAAA,EAAEC,EAAE,EAAEC,MAAM,EAAc,GAA1B;IAC9B,OAAO,CAACC;QACN,MAAMC,aAAaH,GAAGI,IAAI,CAACF;QAC3B,IAAI,CAACC,YAAY;YACf,OAAO;QACT;QAEA,MAAME,SAAS,CAACC;YACd,IAAI;gBACF,OAAOC,mBAAmBD;YAC5B,EAAE,OAAOE,GAAG;gBACV,MAAM,IAAIC,kBAAW,CAAC;YACxB;QACF;QACA,MAAMC,SAAqD,CAAC;QAE5DC,OAAOC,IAAI,CAACX,QAAQY,OAAO,CAAC,CAACC;YAC3B,MAAMC,IAAId,MAAM,CAACa,SAAS;YAC1B,MAAME,IAAIb,UAAU,CAACY,EAAEE,GAAG,CAAC;YAC3B,IAAID,MAAME,WAAW;gBACnBR,MAAM,CAACI,SAAS,GAAG,CAACE,EAAEG,OAAO,CAAC,OAC1BH,EAAEI,KAAK,CAAC,KAAKC,GAAG,CAAC,CAACC,QAAUjB,OAAOiB,UACnCP,EAAEQ,MAAM,GACR;oBAAClB,OAAOW;iBAAG,GACXX,OAAOW;YACb;QACF;QACA,OAAON;IACT;AACF"}
|
||||
44
node_modules/next/dist/shared/lib/router/utils/route-regex.d.ts
generated
vendored
Normal file
44
node_modules/next/dist/shared/lib/router/utils/route-regex.d.ts
generated
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
export interface Group {
|
||||
pos: number;
|
||||
repeat: boolean;
|
||||
optional: boolean;
|
||||
}
|
||||
export interface RouteRegex {
|
||||
groups: {
|
||||
[groupName: string]: Group;
|
||||
};
|
||||
re: RegExp;
|
||||
}
|
||||
/**
|
||||
* From a normalized route this function generates a regular expression and
|
||||
* a corresponding groups object intended to be used to store matching groups
|
||||
* from the regular expression.
|
||||
*/
|
||||
export declare function getRouteRegex(normalizedRoute: string): RouteRegex;
|
||||
/**
|
||||
* This function extends `getRouteRegex` generating also a named regexp where
|
||||
* each group is named along with a routeKeys object that indexes the assigned
|
||||
* named group with its corresponding key. When the routeKeys need to be
|
||||
* prefixed to uniquely identify internally the "prefixRouteKey" arg should
|
||||
* be "true" currently this is only the case when creating the routes-manifest
|
||||
* during the build
|
||||
*/
|
||||
export declare function getNamedRouteRegex(normalizedRoute: string, prefixRouteKey: boolean): {
|
||||
namedRegex: string;
|
||||
routeKeys: {
|
||||
[named: string]: string;
|
||||
};
|
||||
groups: {
|
||||
[groupName: string]: Group;
|
||||
};
|
||||
re: RegExp;
|
||||
};
|
||||
/**
|
||||
* Generates a named regexp.
|
||||
* This is intended to be using for build time only.
|
||||
*/
|
||||
export declare function getNamedMiddlewareRegex(normalizedRoute: string, options: {
|
||||
catchAll?: boolean;
|
||||
}): {
|
||||
namedRegex: string;
|
||||
};
|
||||
196
node_modules/next/dist/shared/lib/router/utils/route-regex.js
generated
vendored
Normal file
196
node_modules/next/dist/shared/lib/router/utils/route-regex.js
generated
vendored
Normal file
@ -0,0 +1,196 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
getNamedMiddlewareRegex: null,
|
||||
getNamedRouteRegex: null,
|
||||
getRouteRegex: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
getNamedMiddlewareRegex: function() {
|
||||
return getNamedMiddlewareRegex;
|
||||
},
|
||||
getNamedRouteRegex: function() {
|
||||
return getNamedRouteRegex;
|
||||
},
|
||||
getRouteRegex: function() {
|
||||
return getRouteRegex;
|
||||
}
|
||||
});
|
||||
const _interceptionroutes = require("../../../../server/future/helpers/interception-routes");
|
||||
const _escaperegexp = require("../../escape-regexp");
|
||||
const _removetrailingslash = require("./remove-trailing-slash");
|
||||
const NEXT_QUERY_PARAM_PREFIX = "nxtP";
|
||||
const NEXT_INTERCEPTION_MARKER_PREFIX = "nxtI";
|
||||
/**
|
||||
* Parses a given parameter from a route to a data structure that can be used
|
||||
* to generate the parametrized route. Examples:
|
||||
* - `[...slug]` -> `{ key: 'slug', repeat: true, optional: true }`
|
||||
* - `...slug` -> `{ key: 'slug', repeat: true, optional: false }`
|
||||
* - `[foo]` -> `{ key: 'foo', repeat: false, optional: true }`
|
||||
* - `bar` -> `{ key: 'bar', repeat: false, optional: false }`
|
||||
*/ function parseParameter(param) {
|
||||
const optional = param.startsWith("[") && param.endsWith("]");
|
||||
if (optional) {
|
||||
param = param.slice(1, -1);
|
||||
}
|
||||
const repeat = param.startsWith("...");
|
||||
if (repeat) {
|
||||
param = param.slice(3);
|
||||
}
|
||||
return {
|
||||
key: param,
|
||||
repeat,
|
||||
optional
|
||||
};
|
||||
}
|
||||
function getParametrizedRoute(route) {
|
||||
const segments = (0, _removetrailingslash.removeTrailingSlash)(route).slice(1).split("/");
|
||||
const groups = {};
|
||||
let groupIndex = 1;
|
||||
return {
|
||||
parameterizedRoute: segments.map((segment)=>{
|
||||
const markerMatch = _interceptionroutes.INTERCEPTION_ROUTE_MARKERS.find((m)=>segment.startsWith(m));
|
||||
const paramMatches = segment.match(/\[((?:\[.*\])|.+)\]/) // Check for parameters
|
||||
;
|
||||
if (markerMatch && paramMatches) {
|
||||
const { key, optional, repeat } = parseParameter(paramMatches[1]);
|
||||
groups[key] = {
|
||||
pos: groupIndex++,
|
||||
repeat,
|
||||
optional
|
||||
};
|
||||
return "/" + (0, _escaperegexp.escapeStringRegexp)(markerMatch) + "([^/]+?)";
|
||||
} else if (paramMatches) {
|
||||
const { key, repeat, optional } = parseParameter(paramMatches[1]);
|
||||
groups[key] = {
|
||||
pos: groupIndex++,
|
||||
repeat,
|
||||
optional
|
||||
};
|
||||
return repeat ? optional ? "(?:/(.+?))?" : "/(.+?)" : "/([^/]+?)";
|
||||
} else {
|
||||
return "/" + (0, _escaperegexp.escapeStringRegexp)(segment);
|
||||
}
|
||||
}).join(""),
|
||||
groups
|
||||
};
|
||||
}
|
||||
function getRouteRegex(normalizedRoute) {
|
||||
const { parameterizedRoute, groups } = getParametrizedRoute(normalizedRoute);
|
||||
return {
|
||||
re: new RegExp("^" + parameterizedRoute + "(?:/)?$"),
|
||||
groups: groups
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Builds a function to generate a minimal routeKey using only a-z and minimal
|
||||
* number of characters.
|
||||
*/ function buildGetSafeRouteKey() {
|
||||
let i = 0;
|
||||
return ()=>{
|
||||
let routeKey = "";
|
||||
let j = ++i;
|
||||
while(j > 0){
|
||||
routeKey += String.fromCharCode(97 + (j - 1) % 26);
|
||||
j = Math.floor((j - 1) / 26);
|
||||
}
|
||||
return routeKey;
|
||||
};
|
||||
}
|
||||
function getSafeKeyFromSegment(param) {
|
||||
let { interceptionMarker, getSafeRouteKey, segment, routeKeys, keyPrefix } = param;
|
||||
const { key, optional, repeat } = parseParameter(segment);
|
||||
// replace any non-word characters since they can break
|
||||
// the named regex
|
||||
let cleanedKey = key.replace(/\W/g, "");
|
||||
if (keyPrefix) {
|
||||
cleanedKey = "" + keyPrefix + cleanedKey;
|
||||
}
|
||||
let invalidKey = false;
|
||||
// check if the key is still invalid and fallback to using a known
|
||||
// safe key
|
||||
if (cleanedKey.length === 0 || cleanedKey.length > 30) {
|
||||
invalidKey = true;
|
||||
}
|
||||
if (!isNaN(parseInt(cleanedKey.slice(0, 1)))) {
|
||||
invalidKey = true;
|
||||
}
|
||||
if (invalidKey) {
|
||||
cleanedKey = getSafeRouteKey();
|
||||
}
|
||||
if (keyPrefix) {
|
||||
routeKeys[cleanedKey] = "" + keyPrefix + key;
|
||||
} else {
|
||||
routeKeys[cleanedKey] = key;
|
||||
}
|
||||
// if the segment has an interception marker, make sure that's part of the regex pattern
|
||||
// this is to ensure that the route with the interception marker doesn't incorrectly match
|
||||
// the non-intercepted route (ie /app/(.)[username] should not match /app/[username])
|
||||
const interceptionPrefix = interceptionMarker ? (0, _escaperegexp.escapeStringRegexp)(interceptionMarker) : "";
|
||||
return repeat ? optional ? "(?:/" + interceptionPrefix + "(?<" + cleanedKey + ">.+?))?" : "/" + interceptionPrefix + "(?<" + cleanedKey + ">.+?)" : "/" + interceptionPrefix + "(?<" + cleanedKey + ">[^/]+?)";
|
||||
}
|
||||
function getNamedParametrizedRoute(route, prefixRouteKeys) {
|
||||
const segments = (0, _removetrailingslash.removeTrailingSlash)(route).slice(1).split("/");
|
||||
const getSafeRouteKey = buildGetSafeRouteKey();
|
||||
const routeKeys = {};
|
||||
return {
|
||||
namedParameterizedRoute: segments.map((segment)=>{
|
||||
const hasInterceptionMarker = _interceptionroutes.INTERCEPTION_ROUTE_MARKERS.some((m)=>segment.startsWith(m));
|
||||
const paramMatches = segment.match(/\[((?:\[.*\])|.+)\]/) // Check for parameters
|
||||
;
|
||||
if (hasInterceptionMarker && paramMatches) {
|
||||
const [usedMarker] = segment.split(paramMatches[0]);
|
||||
return getSafeKeyFromSegment({
|
||||
getSafeRouteKey,
|
||||
interceptionMarker: usedMarker,
|
||||
segment: paramMatches[1],
|
||||
routeKeys,
|
||||
keyPrefix: prefixRouteKeys ? NEXT_INTERCEPTION_MARKER_PREFIX : undefined
|
||||
});
|
||||
} else if (paramMatches) {
|
||||
return getSafeKeyFromSegment({
|
||||
getSafeRouteKey,
|
||||
segment: paramMatches[1],
|
||||
routeKeys,
|
||||
keyPrefix: prefixRouteKeys ? NEXT_QUERY_PARAM_PREFIX : undefined
|
||||
});
|
||||
} else {
|
||||
return "/" + (0, _escaperegexp.escapeStringRegexp)(segment);
|
||||
}
|
||||
}).join(""),
|
||||
routeKeys
|
||||
};
|
||||
}
|
||||
function getNamedRouteRegex(normalizedRoute, prefixRouteKey) {
|
||||
const result = getNamedParametrizedRoute(normalizedRoute, prefixRouteKey);
|
||||
return {
|
||||
...getRouteRegex(normalizedRoute),
|
||||
namedRegex: "^" + result.namedParameterizedRoute + "(?:/)?$",
|
||||
routeKeys: result.routeKeys
|
||||
};
|
||||
}
|
||||
function getNamedMiddlewareRegex(normalizedRoute, options) {
|
||||
const { parameterizedRoute } = getParametrizedRoute(normalizedRoute);
|
||||
const { catchAll = true } = options;
|
||||
if (parameterizedRoute === "/") {
|
||||
let catchAllRegex = catchAll ? ".*" : "";
|
||||
return {
|
||||
namedRegex: "^/" + catchAllRegex + "$"
|
||||
};
|
||||
}
|
||||
const { namedParameterizedRoute } = getNamedParametrizedRoute(normalizedRoute, false);
|
||||
let catchAllGroupedRegex = catchAll ? "(?:(/.*)?)" : "";
|
||||
return {
|
||||
namedRegex: "^" + namedParameterizedRoute + catchAllGroupedRegex + "$"
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=route-regex.js.map
|
||||
1
node_modules/next/dist/shared/lib/router/utils/route-regex.js.map
generated
vendored
Normal file
1
node_modules/next/dist/shared/lib/router/utils/route-regex.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../src/shared/lib/router/utils/route-regex.ts"],"names":["getNamedMiddlewareRegex","getNamedRouteRegex","getRouteRegex","NEXT_QUERY_PARAM_PREFIX","NEXT_INTERCEPTION_MARKER_PREFIX","parseParameter","param","optional","startsWith","endsWith","slice","repeat","key","getParametrizedRoute","route","segments","removeTrailingSlash","split","groups","groupIndex","parameterizedRoute","map","segment","markerMatch","INTERCEPTION_ROUTE_MARKERS","find","m","paramMatches","match","pos","escapeStringRegexp","join","normalizedRoute","re","RegExp","buildGetSafeRouteKey","i","routeKey","j","String","fromCharCode","Math","floor","getSafeKeyFromSegment","interceptionMarker","getSafeRouteKey","routeKeys","keyPrefix","cleanedKey","replace","invalidKey","length","isNaN","parseInt","interceptionPrefix","getNamedParametrizedRoute","prefixRouteKeys","namedParameterizedRoute","hasInterceptionMarker","some","usedMarker","undefined","prefixRouteKey","result","namedRegex","options","catchAll","catchAllRegex","catchAllGroupedRegex"],"mappings":"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"}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user