fixed version control heatmap and activity

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

View File

@@ -0,0 +1,18 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "AmpStateContext", {
enumerable: true,
get: function() {
return AmpStateContext;
}
});
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
const _react = /*#__PURE__*/ _interop_require_default._(require("react"));
const AmpStateContext = _react.default.createContext({});
if (process.env.NODE_ENV !== "production") {
AmpStateContext.displayName = "AmpStateContext";
}
//# sourceMappingURL=amp-context.shared-runtime.js.map

View File

@@ -0,0 +1,16 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "isInAmpMode", {
enumerable: true,
get: function() {
return isInAmpMode;
}
});
function isInAmpMode(param) {
let { ampFirst = false, hybrid = false, hasQuery = false } = param === void 0 ? {} : param;
return ampFirst || hybrid && hasQuery;
}
//# sourceMappingURL=amp-mode.js.map

View File

@@ -0,0 +1,51 @@
"use client";
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
AppRouterContext: null,
GlobalLayoutRouterContext: null,
LayoutRouterContext: null,
MissingSlotContext: null,
TemplateContext: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
AppRouterContext: function() {
return AppRouterContext;
},
GlobalLayoutRouterContext: function() {
return GlobalLayoutRouterContext;
},
LayoutRouterContext: function() {
return LayoutRouterContext;
},
MissingSlotContext: function() {
return MissingSlotContext;
},
TemplateContext: function() {
return TemplateContext;
}
});
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
const _react = /*#__PURE__*/ _interop_require_default._(require("react"));
const AppRouterContext = _react.default.createContext(null);
const LayoutRouterContext = _react.default.createContext(null);
const GlobalLayoutRouterContext = _react.default.createContext(null);
const TemplateContext = _react.default.createContext(null);
if (process.env.NODE_ENV !== "production") {
AppRouterContext.displayName = "AppRouterContext";
LayoutRouterContext.displayName = "LayoutRouterContext";
GlobalLayoutRouterContext.displayName = "GlobalLayoutRouterContext";
TemplateContext.displayName = "TemplateContext";
}
const MissingSlotContext = _react.default.createContext(new Set());
//# sourceMappingURL=app-router-context.shared-runtime.js.map

View File

@@ -0,0 +1,86 @@
// minimal implementation MurmurHash2 hash function
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "BloomFilter", {
enumerable: true,
get: function() {
return BloomFilter;
}
});
function murmurhash2(str) {
let h = 0;
for(let i = 0; i < str.length; i++){
const c = str.charCodeAt(i);
h = Math.imul(h ^ c, 0x5bd1e995);
h ^= h >>> 13;
h = Math.imul(h, 0x5bd1e995);
}
return h >>> 0;
}
// default to 0.01% error rate as the filter compresses very well
const DEFAULT_ERROR_RATE = 0.0001;
class BloomFilter {
static from(items, errorRate) {
if (errorRate === void 0) errorRate = DEFAULT_ERROR_RATE;
const filter = new BloomFilter(items.length, errorRate);
for (const item of items){
filter.add(item);
}
return filter;
}
export() {
const data = {
numItems: this.numItems,
errorRate: this.errorRate,
numBits: this.numBits,
numHashes: this.numHashes,
bitArray: this.bitArray
};
if (process.env.NEXT_RUNTIME === "nodejs") {
if (this.errorRate < DEFAULT_ERROR_RATE) {
const filterData = JSON.stringify(data);
const gzipSize = require("next/dist/compiled/gzip-size").sync(filterData);
if (gzipSize > 1024) {
console.warn("Creating filter with error rate less than 0.1% (0.001) can increase the size dramatically proceed with caution. Received error rate " + this.errorRate + " resulted in size " + filterData.length + " bytes, " + gzipSize + " bytes (gzip)");
}
}
}
return data;
}
import(data) {
this.numItems = data.numItems;
this.errorRate = data.errorRate;
this.numBits = data.numBits;
this.numHashes = data.numHashes;
this.bitArray = data.bitArray;
}
add(item) {
const hashValues = this.getHashValues(item);
hashValues.forEach((hash)=>{
this.bitArray[hash] = 1;
});
}
contains(item) {
const hashValues = this.getHashValues(item);
return hashValues.every((hash)=>this.bitArray[hash]);
}
getHashValues(item) {
const hashValues = [];
for(let i = 1; i <= this.numHashes; i++){
const hash = murmurhash2("" + item + i) % this.numBits;
hashValues.push(hash);
}
return hashValues;
}
constructor(numItems, errorRate = DEFAULT_ERROR_RATE){
this.numItems = numItems;
this.errorRate = errorRate;
this.numBits = Math.ceil(-(numItems * Math.log(errorRate)) / (Math.log(2) * Math.log(2)));
this.numHashes = Math.ceil(this.numBits / numItems * Math.log(2));
this.bitArray = new Array(this.numBits).fill(0);
}
}
//# sourceMappingURL=bloom-filter.js.map

View File

@@ -0,0 +1,426 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
APP_BUILD_MANIFEST: null,
APP_CLIENT_INTERNALS: null,
APP_PATHS_MANIFEST: null,
APP_PATH_ROUTES_MANIFEST: null,
AUTOMATIC_FONT_OPTIMIZATION_MANIFEST: null,
BARREL_OPTIMIZATION_PREFIX: null,
BLOCKED_PAGES: null,
BUILD_ID_FILE: null,
BUILD_MANIFEST: null,
CLIENT_PUBLIC_FILES_PATH: null,
CLIENT_REFERENCE_MANIFEST: null,
CLIENT_STATIC_FILES_PATH: null,
CLIENT_STATIC_FILES_RUNTIME_AMP: null,
CLIENT_STATIC_FILES_RUNTIME_MAIN: null,
CLIENT_STATIC_FILES_RUNTIME_MAIN_APP: null,
CLIENT_STATIC_FILES_RUNTIME_POLYFILLS: null,
CLIENT_STATIC_FILES_RUNTIME_POLYFILLS_SYMBOL: null,
CLIENT_STATIC_FILES_RUNTIME_REACT_REFRESH: null,
CLIENT_STATIC_FILES_RUNTIME_WEBPACK: null,
COMPILER_INDEXES: null,
COMPILER_NAMES: null,
CONFIG_FILES: null,
DEFAULT_RUNTIME_WEBPACK: null,
DEFAULT_SANS_SERIF_FONT: null,
DEFAULT_SERIF_FONT: null,
DEV_CLIENT_PAGES_MANIFEST: null,
DEV_MIDDLEWARE_MANIFEST: null,
EDGE_RUNTIME_WEBPACK: null,
EDGE_UNSUPPORTED_NODE_APIS: null,
EXPORT_DETAIL: null,
EXPORT_MARKER: null,
FUNCTIONS_CONFIG_MANIFEST: null,
GOOGLE_FONT_PROVIDER: null,
IMAGES_MANIFEST: null,
INTERCEPTION_ROUTE_REWRITE_MANIFEST: null,
INTERNAL_HEADERS: null,
MIDDLEWARE_BUILD_MANIFEST: null,
MIDDLEWARE_MANIFEST: null,
MIDDLEWARE_REACT_LOADABLE_MANIFEST: null,
MODERN_BROWSERSLIST_TARGET: null,
NEXT_BUILTIN_DOCUMENT: null,
NEXT_FONT_MANIFEST: null,
OPTIMIZED_FONT_PROVIDERS: null,
PAGES_MANIFEST: null,
PHASE_DEVELOPMENT_SERVER: null,
PHASE_EXPORT: null,
PHASE_INFO: null,
PHASE_PRODUCTION_BUILD: null,
PHASE_PRODUCTION_SERVER: null,
PHASE_TEST: null,
PRERENDER_MANIFEST: null,
REACT_LOADABLE_MANIFEST: null,
ROUTES_MANIFEST: null,
RSC_MODULE_TYPES: null,
SERVER_DIRECTORY: null,
SERVER_FILES_MANIFEST: null,
SERVER_PROPS_ID: null,
SERVER_REFERENCE_MANIFEST: null,
STATIC_PROPS_ID: null,
STATIC_STATUS_PAGES: null,
STRING_LITERAL_DROP_BUNDLE: null,
SUBRESOURCE_INTEGRITY_MANIFEST: null,
SYSTEM_ENTRYPOINTS: null,
TRACE_OUTPUT_VERSION: null,
TURBO_TRACE_DEFAULT_MEMORY_LIMIT: null,
UNDERSCORE_NOT_FOUND_ROUTE: null,
UNDERSCORE_NOT_FOUND_ROUTE_ENTRY: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
APP_BUILD_MANIFEST: function() {
return APP_BUILD_MANIFEST;
},
APP_CLIENT_INTERNALS: function() {
return APP_CLIENT_INTERNALS;
},
APP_PATHS_MANIFEST: function() {
return APP_PATHS_MANIFEST;
},
APP_PATH_ROUTES_MANIFEST: function() {
return APP_PATH_ROUTES_MANIFEST;
},
AUTOMATIC_FONT_OPTIMIZATION_MANIFEST: function() {
return AUTOMATIC_FONT_OPTIMIZATION_MANIFEST;
},
BARREL_OPTIMIZATION_PREFIX: function() {
return BARREL_OPTIMIZATION_PREFIX;
},
BLOCKED_PAGES: function() {
return BLOCKED_PAGES;
},
BUILD_ID_FILE: function() {
return BUILD_ID_FILE;
},
BUILD_MANIFEST: function() {
return BUILD_MANIFEST;
},
CLIENT_PUBLIC_FILES_PATH: function() {
return CLIENT_PUBLIC_FILES_PATH;
},
CLIENT_REFERENCE_MANIFEST: function() {
return CLIENT_REFERENCE_MANIFEST;
},
CLIENT_STATIC_FILES_PATH: function() {
return CLIENT_STATIC_FILES_PATH;
},
CLIENT_STATIC_FILES_RUNTIME_AMP: function() {
return CLIENT_STATIC_FILES_RUNTIME_AMP;
},
CLIENT_STATIC_FILES_RUNTIME_MAIN: function() {
return CLIENT_STATIC_FILES_RUNTIME_MAIN;
},
CLIENT_STATIC_FILES_RUNTIME_MAIN_APP: function() {
return CLIENT_STATIC_FILES_RUNTIME_MAIN_APP;
},
CLIENT_STATIC_FILES_RUNTIME_POLYFILLS: function() {
return CLIENT_STATIC_FILES_RUNTIME_POLYFILLS;
},
CLIENT_STATIC_FILES_RUNTIME_POLYFILLS_SYMBOL: function() {
return CLIENT_STATIC_FILES_RUNTIME_POLYFILLS_SYMBOL;
},
CLIENT_STATIC_FILES_RUNTIME_REACT_REFRESH: function() {
return CLIENT_STATIC_FILES_RUNTIME_REACT_REFRESH;
},
CLIENT_STATIC_FILES_RUNTIME_WEBPACK: function() {
return CLIENT_STATIC_FILES_RUNTIME_WEBPACK;
},
COMPILER_INDEXES: function() {
return COMPILER_INDEXES;
},
COMPILER_NAMES: function() {
return COMPILER_NAMES;
},
CONFIG_FILES: function() {
return CONFIG_FILES;
},
DEFAULT_RUNTIME_WEBPACK: function() {
return DEFAULT_RUNTIME_WEBPACK;
},
DEFAULT_SANS_SERIF_FONT: function() {
return DEFAULT_SANS_SERIF_FONT;
},
DEFAULT_SERIF_FONT: function() {
return DEFAULT_SERIF_FONT;
},
DEV_CLIENT_PAGES_MANIFEST: function() {
return DEV_CLIENT_PAGES_MANIFEST;
},
DEV_MIDDLEWARE_MANIFEST: function() {
return DEV_MIDDLEWARE_MANIFEST;
},
EDGE_RUNTIME_WEBPACK: function() {
return EDGE_RUNTIME_WEBPACK;
},
EDGE_UNSUPPORTED_NODE_APIS: function() {
return EDGE_UNSUPPORTED_NODE_APIS;
},
EXPORT_DETAIL: function() {
return EXPORT_DETAIL;
},
EXPORT_MARKER: function() {
return EXPORT_MARKER;
},
FUNCTIONS_CONFIG_MANIFEST: function() {
return FUNCTIONS_CONFIG_MANIFEST;
},
GOOGLE_FONT_PROVIDER: function() {
return GOOGLE_FONT_PROVIDER;
},
IMAGES_MANIFEST: function() {
return IMAGES_MANIFEST;
},
INTERCEPTION_ROUTE_REWRITE_MANIFEST: function() {
return INTERCEPTION_ROUTE_REWRITE_MANIFEST;
},
INTERNAL_HEADERS: function() {
return INTERNAL_HEADERS;
},
MIDDLEWARE_BUILD_MANIFEST: function() {
return MIDDLEWARE_BUILD_MANIFEST;
},
MIDDLEWARE_MANIFEST: function() {
return MIDDLEWARE_MANIFEST;
},
MIDDLEWARE_REACT_LOADABLE_MANIFEST: function() {
return MIDDLEWARE_REACT_LOADABLE_MANIFEST;
},
MODERN_BROWSERSLIST_TARGET: function() {
return _modernbrowserslisttarget.default;
},
NEXT_BUILTIN_DOCUMENT: function() {
return NEXT_BUILTIN_DOCUMENT;
},
NEXT_FONT_MANIFEST: function() {
return NEXT_FONT_MANIFEST;
},
OPTIMIZED_FONT_PROVIDERS: function() {
return OPTIMIZED_FONT_PROVIDERS;
},
PAGES_MANIFEST: function() {
return PAGES_MANIFEST;
},
PHASE_DEVELOPMENT_SERVER: function() {
return PHASE_DEVELOPMENT_SERVER;
},
PHASE_EXPORT: function() {
return PHASE_EXPORT;
},
PHASE_INFO: function() {
return PHASE_INFO;
},
PHASE_PRODUCTION_BUILD: function() {
return PHASE_PRODUCTION_BUILD;
},
PHASE_PRODUCTION_SERVER: function() {
return PHASE_PRODUCTION_SERVER;
},
PHASE_TEST: function() {
return PHASE_TEST;
},
PRERENDER_MANIFEST: function() {
return PRERENDER_MANIFEST;
},
REACT_LOADABLE_MANIFEST: function() {
return REACT_LOADABLE_MANIFEST;
},
ROUTES_MANIFEST: function() {
return ROUTES_MANIFEST;
},
RSC_MODULE_TYPES: function() {
return RSC_MODULE_TYPES;
},
SERVER_DIRECTORY: function() {
return SERVER_DIRECTORY;
},
SERVER_FILES_MANIFEST: function() {
return SERVER_FILES_MANIFEST;
},
SERVER_PROPS_ID: function() {
return SERVER_PROPS_ID;
},
SERVER_REFERENCE_MANIFEST: function() {
return SERVER_REFERENCE_MANIFEST;
},
STATIC_PROPS_ID: function() {
return STATIC_PROPS_ID;
},
STATIC_STATUS_PAGES: function() {
return STATIC_STATUS_PAGES;
},
STRING_LITERAL_DROP_BUNDLE: function() {
return STRING_LITERAL_DROP_BUNDLE;
},
SUBRESOURCE_INTEGRITY_MANIFEST: function() {
return SUBRESOURCE_INTEGRITY_MANIFEST;
},
SYSTEM_ENTRYPOINTS: function() {
return SYSTEM_ENTRYPOINTS;
},
TRACE_OUTPUT_VERSION: function() {
return TRACE_OUTPUT_VERSION;
},
TURBO_TRACE_DEFAULT_MEMORY_LIMIT: function() {
return TURBO_TRACE_DEFAULT_MEMORY_LIMIT;
},
UNDERSCORE_NOT_FOUND_ROUTE: function() {
return UNDERSCORE_NOT_FOUND_ROUTE;
},
UNDERSCORE_NOT_FOUND_ROUTE_ENTRY: function() {
return UNDERSCORE_NOT_FOUND_ROUTE_ENTRY;
}
});
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
const _modernbrowserslisttarget = /*#__PURE__*/ _interop_require_default._(require("./modern-browserslist-target"));
const COMPILER_NAMES = {
client: "client",
server: "server",
edgeServer: "edge-server"
};
const INTERNAL_HEADERS = [
"x-invoke-error",
"x-invoke-output",
"x-invoke-path",
"x-invoke-query",
"x-invoke-status",
"x-middleware-invoke"
];
const COMPILER_INDEXES = {
[COMPILER_NAMES.client]: 0,
[COMPILER_NAMES.server]: 1,
[COMPILER_NAMES.edgeServer]: 2
};
const UNDERSCORE_NOT_FOUND_ROUTE = "/_not-found";
const UNDERSCORE_NOT_FOUND_ROUTE_ENTRY = "" + UNDERSCORE_NOT_FOUND_ROUTE + "/page";
const PHASE_EXPORT = "phase-export";
const PHASE_PRODUCTION_BUILD = "phase-production-build";
const PHASE_PRODUCTION_SERVER = "phase-production-server";
const PHASE_DEVELOPMENT_SERVER = "phase-development-server";
const PHASE_TEST = "phase-test";
const PHASE_INFO = "phase-info";
const PAGES_MANIFEST = "pages-manifest.json";
const APP_PATHS_MANIFEST = "app-paths-manifest.json";
const APP_PATH_ROUTES_MANIFEST = "app-path-routes-manifest.json";
const BUILD_MANIFEST = "build-manifest.json";
const APP_BUILD_MANIFEST = "app-build-manifest.json";
const FUNCTIONS_CONFIG_MANIFEST = "functions-config-manifest.json";
const SUBRESOURCE_INTEGRITY_MANIFEST = "subresource-integrity-manifest";
const NEXT_FONT_MANIFEST = "next-font-manifest";
const EXPORT_MARKER = "export-marker.json";
const EXPORT_DETAIL = "export-detail.json";
const PRERENDER_MANIFEST = "prerender-manifest.json";
const ROUTES_MANIFEST = "routes-manifest.json";
const IMAGES_MANIFEST = "images-manifest.json";
const SERVER_FILES_MANIFEST = "required-server-files.json";
const DEV_CLIENT_PAGES_MANIFEST = "_devPagesManifest.json";
const MIDDLEWARE_MANIFEST = "middleware-manifest.json";
const DEV_MIDDLEWARE_MANIFEST = "_devMiddlewareManifest.json";
const REACT_LOADABLE_MANIFEST = "react-loadable-manifest.json";
const AUTOMATIC_FONT_OPTIMIZATION_MANIFEST = "font-manifest.json";
const SERVER_DIRECTORY = "server";
const CONFIG_FILES = [
"next.config.js",
"next.config.mjs"
];
const BUILD_ID_FILE = "BUILD_ID";
const BLOCKED_PAGES = [
"/_document",
"/_app",
"/_error"
];
const CLIENT_PUBLIC_FILES_PATH = "public";
const CLIENT_STATIC_FILES_PATH = "static";
const STRING_LITERAL_DROP_BUNDLE = "__NEXT_DROP_CLIENT_FILE__";
const NEXT_BUILTIN_DOCUMENT = "__NEXT_BUILTIN_DOCUMENT__";
const BARREL_OPTIMIZATION_PREFIX = "__barrel_optimize__";
const CLIENT_REFERENCE_MANIFEST = "client-reference-manifest";
const SERVER_REFERENCE_MANIFEST = "server-reference-manifest";
const MIDDLEWARE_BUILD_MANIFEST = "middleware-build-manifest";
const MIDDLEWARE_REACT_LOADABLE_MANIFEST = "middleware-react-loadable-manifest";
const INTERCEPTION_ROUTE_REWRITE_MANIFEST = "interception-route-rewrite-manifest";
const CLIENT_STATIC_FILES_RUNTIME_MAIN = "main";
const CLIENT_STATIC_FILES_RUNTIME_MAIN_APP = "" + CLIENT_STATIC_FILES_RUNTIME_MAIN + "-app";
const APP_CLIENT_INTERNALS = "app-pages-internals";
const CLIENT_STATIC_FILES_RUNTIME_REACT_REFRESH = "react-refresh";
const CLIENT_STATIC_FILES_RUNTIME_AMP = "amp";
const CLIENT_STATIC_FILES_RUNTIME_WEBPACK = "webpack";
const CLIENT_STATIC_FILES_RUNTIME_POLYFILLS = "polyfills";
const CLIENT_STATIC_FILES_RUNTIME_POLYFILLS_SYMBOL = Symbol(CLIENT_STATIC_FILES_RUNTIME_POLYFILLS);
const DEFAULT_RUNTIME_WEBPACK = "webpack-runtime";
const EDGE_RUNTIME_WEBPACK = "edge-runtime-webpack";
const STATIC_PROPS_ID = "__N_SSG";
const SERVER_PROPS_ID = "__N_SSP";
const GOOGLE_FONT_PROVIDER = "https://fonts.googleapis.com/";
const OPTIMIZED_FONT_PROVIDERS = [
{
url: GOOGLE_FONT_PROVIDER,
preconnect: "https://fonts.gstatic.com"
},
{
url: "https://use.typekit.net",
preconnect: "https://use.typekit.net"
}
];
const DEFAULT_SERIF_FONT = {
name: "Times New Roman",
xAvgCharWidth: 821,
azAvgWidth: 854.3953488372093,
unitsPerEm: 2048
};
const DEFAULT_SANS_SERIF_FONT = {
name: "Arial",
xAvgCharWidth: 904,
azAvgWidth: 934.5116279069767,
unitsPerEm: 2048
};
const STATIC_STATUS_PAGES = [
"/500"
];
const TRACE_OUTPUT_VERSION = 1;
const TURBO_TRACE_DEFAULT_MEMORY_LIMIT = 6000;
const RSC_MODULE_TYPES = {
client: "client",
server: "server"
};
const EDGE_UNSUPPORTED_NODE_APIS = [
"clearImmediate",
"setImmediate",
"BroadcastChannel",
"ByteLengthQueuingStrategy",
"CompressionStream",
"CountQueuingStrategy",
"DecompressionStream",
"DomException",
"MessageChannel",
"MessageEvent",
"MessagePort",
"ReadableByteStreamController",
"ReadableStreamBYOBRequest",
"ReadableStreamDefaultController",
"TransformStreamDefaultController",
"WritableStreamDefaultController"
];
const SYSTEM_ENTRYPOINTS = new Set([
CLIENT_STATIC_FILES_RUNTIME_MAIN,
CLIENT_STATIC_FILES_RUNTIME_REACT_REFRESH,
CLIENT_STATIC_FILES_RUNTIME_AMP,
CLIENT_STATIC_FILES_RUNTIME_MAIN_APP
]);
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
Object.defineProperty(exports.default, '__esModule', { value: true });
Object.assign(exports.default, exports);
module.exports = exports.default;
}
//# sourceMappingURL=constants.js.map

View File

@@ -0,0 +1,15 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "encodeURIPath", {
enumerable: true,
get: function() {
return encodeURIPath;
}
});
function encodeURIPath(file) {
return file.split("/").map((p)=>encodeURIComponent(p)).join("/");
}
//# sourceMappingURL=encode-uri-path.js.map

View File

@@ -0,0 +1,36 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
decorateServerError: null,
getErrorSource: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
decorateServerError: function() {
return decorateServerError;
},
getErrorSource: function() {
return getErrorSource;
}
});
const symbolError = Symbol.for("NextjsError");
function getErrorSource(error) {
return error[symbolError] || null;
}
function decorateServerError(error, type) {
Object.defineProperty(error, symbolError, {
writable: false,
enumerable: false,
configurable: false,
value: type
});
}
//# sourceMappingURL=error-source.js.map

View File

@@ -0,0 +1,22 @@
// regexp is based on https://github.com/sindresorhus/escape-string-regexp
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "escapeStringRegexp", {
enumerable: true,
get: function() {
return escapeStringRegexp;
}
});
const reHasRegExp = /[|\\{}()[\]^$+*?.-]/;
const reReplaceRegExp = /[|\\{}()[\]^$+*?.-]/g;
function escapeStringRegexp(str) {
// see also: https://github.com/lodash/lodash/blob/2da024c3b4f9947a48517639de7560457cd4ec6c/escapeRegExp.js#L23
if (reHasRegExp.test(str)) {
return str.replace(reReplaceRegExp, "\\$&");
}
return str;
}
//# sourceMappingURL=escape-regexp.js.map

View File

@@ -0,0 +1,23 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "getHostname", {
enumerable: true,
get: function() {
return getHostname;
}
});
function getHostname(parsed, headers) {
// Get the hostname from the headers if it exists, otherwise use the parsed
// hostname.
let hostname;
if ((headers == null ? void 0 : headers.host) && !Array.isArray(headers.host)) {
hostname = headers.host.toString().split(":", 1)[0];
} else if (parsed.hostname) {
hostname = parsed.hostname;
} else return;
return hostname.toLowerCase();
}
//# sourceMappingURL=get-hostname.js.map

View File

@@ -0,0 +1,42 @@
// http://www.cse.yorku.ca/~oz/hash.html
// More specifically, 32-bit hash via djbxor
// (ref: https://gist.github.com/eplawless/52813b1d8ad9af510d85?permalink_comment_id=3367765#gistcomment-3367765)
// This is due to number type differences between rust for turbopack to js number types,
// where rust does not have easy way to repreesnt js's 53-bit float number type for the matching
// overflow behavior. This is more `correct` in terms of having canonical hash across different runtime / implementation
// as can gaurantee determinstic output from 32bit hash.
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
djb2Hash: null,
hexHash: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
djb2Hash: function() {
return djb2Hash;
},
hexHash: function() {
return hexHash;
}
});
function djb2Hash(str) {
let hash = 5381;
for(let i = 0; i < str.length; i++){
const char = str.charCodeAt(i);
hash = (hash << 5) + hash + char & 0xffffffff;
}
return hash >>> 0;
}
function hexHash(str) {
return djb2Hash(str).toString(36).slice(0, 5);
}
//# sourceMappingURL=hash.js.map

View File

@@ -0,0 +1,18 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "HeadManagerContext", {
enumerable: true,
get: function() {
return HeadManagerContext;
}
});
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
const _react = /*#__PURE__*/ _interop_require_default._(require("react"));
const HeadManagerContext = _react.default.createContext({});
if (process.env.NODE_ENV !== "production") {
HeadManagerContext.displayName = "HeadManagerContext";
}
//# sourceMappingURL=head-manager-context.shared-runtime.js.map

View File

@@ -0,0 +1,189 @@
"use client";
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
default: null,
defaultHead: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
default: function() {
return _default;
},
defaultHead: function() {
return defaultHead;
}
});
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _jsxruntime = require("react/jsx-runtime");
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
const _sideeffect = /*#__PURE__*/ _interop_require_default._(require("./side-effect"));
const _ampcontextsharedruntime = require("./amp-context.shared-runtime");
const _headmanagercontextsharedruntime = require("./head-manager-context.shared-runtime");
const _ampmode = require("./amp-mode");
const _warnonce = require("./utils/warn-once");
function defaultHead(inAmpMode) {
if (inAmpMode === void 0) inAmpMode = false;
const head = [
/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", {
charSet: "utf-8"
})
];
if (!inAmpMode) {
head.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", {
name: "viewport",
content: "width=device-width"
}));
}
return head;
}
function onlyReactElement(list, child) {
// React children can be "string" or "number" in this case we ignore them for backwards compat
if (typeof child === "string" || typeof child === "number") {
return list;
}
// Adds support for React.Fragment
if (child.type === _react.default.Fragment) {
return list.concat(// @ts-expect-error @types/react does not remove fragments but this could also return ReactPortal[]
_react.default.Children.toArray(child.props.children).reduce(// @ts-expect-error @types/react does not remove fragments but this could also return ReactPortal[]
(fragmentList, fragmentChild)=>{
if (typeof fragmentChild === "string" || typeof fragmentChild === "number") {
return fragmentList;
}
return fragmentList.concat(fragmentChild);
}, []));
}
return list.concat(child);
}
const METATYPES = [
"name",
"httpEquiv",
"charSet",
"itemProp"
];
/*
returns a function for filtering head child elements
which shouldn't be duplicated, like <title/>
Also adds support for deduplicated `key` properties
*/ function unique() {
const keys = new Set();
const tags = new Set();
const metaTypes = new Set();
const metaCategories = {};
return (h)=>{
let isUnique = true;
let hasKey = false;
if (h.key && typeof h.key !== "number" && h.key.indexOf("$") > 0) {
hasKey = true;
const key = h.key.slice(h.key.indexOf("$") + 1);
if (keys.has(key)) {
isUnique = false;
} else {
keys.add(key);
}
}
// eslint-disable-next-line default-case
switch(h.type){
case "title":
case "base":
if (tags.has(h.type)) {
isUnique = false;
} else {
tags.add(h.type);
}
break;
case "meta":
for(let i = 0, len = METATYPES.length; i < len; i++){
const metatype = METATYPES[i];
if (!h.props.hasOwnProperty(metatype)) continue;
if (metatype === "charSet") {
if (metaTypes.has(metatype)) {
isUnique = false;
} else {
metaTypes.add(metatype);
}
} else {
const category = h.props[metatype];
const categories = metaCategories[metatype] || new Set();
if ((metatype !== "name" || !hasKey) && categories.has(category)) {
isUnique = false;
} else {
categories.add(category);
metaCategories[metatype] = categories;
}
}
}
break;
}
return isUnique;
};
}
/**
*
* @param headChildrenElements List of children of <Head>
*/ function reduceComponents(headChildrenElements, props) {
const { inAmpMode } = props;
return headChildrenElements.reduce(onlyReactElement, []).reverse().concat(defaultHead(inAmpMode).reverse()).filter(unique()).reverse().map((c, i)=>{
const key = c.key || i;
if (process.env.NODE_ENV !== "development" && process.env.__NEXT_OPTIMIZE_FONTS && !inAmpMode) {
if (c.type === "link" && c.props["href"] && // TODO(prateekbh@): Replace this with const from `constants` when the tree shaking works.
[
"https://fonts.googleapis.com/css",
"https://use.typekit.net/"
].some((url)=>c.props["href"].startsWith(url))) {
const newProps = {
...c.props || {}
};
newProps["data-href"] = newProps["href"];
newProps["href"] = undefined;
// Add this attribute to make it easy to identify optimized tags
newProps["data-optimized-fonts"] = true;
return /*#__PURE__*/ _react.default.cloneElement(c, newProps);
}
}
if (process.env.NODE_ENV === "development") {
// omit JSON-LD structured data snippets from the warning
if (c.type === "script" && c.props["type"] !== "application/ld+json") {
const srcMessage = c.props["src"] ? '<script> tag with src="' + c.props["src"] + '"' : "inline <script>";
(0, _warnonce.warnOnce)("Do not add <script> tags using next/head (see " + srcMessage + "). Use next/script instead. \nSee more info here: https://nextjs.org/docs/messages/no-script-tags-in-head-component");
} else if (c.type === "link" && c.props["rel"] === "stylesheet") {
(0, _warnonce.warnOnce)('Do not add stylesheets using next/head (see <link rel="stylesheet"> tag with href="' + c.props["href"] + '"). Use Document instead. \nSee more info here: https://nextjs.org/docs/messages/no-stylesheets-in-head-component');
}
}
return /*#__PURE__*/ _react.default.cloneElement(c, {
key
});
});
}
/**
* This component injects elements to `<head>` of your page.
* To avoid duplicated `tags` in `<head>` you can use the `key` property, which will make sure every tag is only rendered once.
*/ function Head(param) {
let { children } = param;
const ampState = (0, _react.useContext)(_ampcontextsharedruntime.AmpStateContext);
const headManager = (0, _react.useContext)(_headmanagercontextsharedruntime.HeadManagerContext);
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_sideeffect.default, {
reduceComponentsToState: reduceComponents,
headManager: headManager,
inAmpMode: (0, _ampmode.isInAmpMode)(ampState),
children: children
});
}
const _default = Head;
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
Object.defineProperty(exports.default, '__esModule', { value: true });
Object.assign(exports.default, exports);
module.exports = exports.default;
}
//# sourceMappingURL=head.js.map

View File

@@ -0,0 +1,39 @@
"use client";
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
PathParamsContext: null,
PathnameContext: null,
SearchParamsContext: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
PathParamsContext: function() {
return PathParamsContext;
},
PathnameContext: function() {
return PathnameContext;
},
SearchParamsContext: function() {
return SearchParamsContext;
}
});
const _react = require("react");
const SearchParamsContext = (0, _react.createContext)(null);
const PathnameContext = (0, _react.createContext)(null);
const PathParamsContext = (0, _react.createContext)(null);
if (process.env.NODE_ENV !== "production") {
SearchParamsContext.displayName = "SearchParamsContext";
PathnameContext.displayName = "PathnameContext";
PathParamsContext.displayName = "PathParamsContext";
}
//# sourceMappingURL=hooks-client-context.shared-runtime.js.map

View File

@@ -0,0 +1,36 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
HtmlContext: null,
useHtmlContext: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
HtmlContext: function() {
return HtmlContext;
},
useHtmlContext: function() {
return useHtmlContext;
}
});
const _react = require("react");
const HtmlContext = (0, _react.createContext)(undefined);
if (process.env.NODE_ENV !== "production") {
HtmlContext.displayName = "HtmlContext";
}
function useHtmlContext() {
const context = (0, _react.useContext)(HtmlContext);
if (!context) {
throw new Error("<Html> should not be imported outside of pages/_document.\n" + "Read more: https://nextjs.org/docs/messages/no-document-import-in-page");
}
return context;
}
//# sourceMappingURL=html-context.shared-runtime.js.map

View File

@@ -0,0 +1,26 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "detectDomainLocale", {
enumerable: true,
get: function() {
return detectDomainLocale;
}
});
function detectDomainLocale(domainItems, hostname, detectedLocale) {
if (!domainItems) return;
if (detectedLocale) {
detectedLocale = detectedLocale.toLowerCase();
}
for (const item of domainItems){
var _item_domain, _item_locales;
// remove port if present
const domainHostname = (_item_domain = item.domain) == null ? void 0 : _item_domain.split(":", 1)[0].toLowerCase();
if (hostname === domainHostname || detectedLocale === item.defaultLocale.toLowerCase() || ((_item_locales = item.locales) == null ? void 0 : _item_locales.some((locale)=>locale.toLowerCase() === detectedLocale))) {
return item;
}
}
}
//# sourceMappingURL=detect-domain-locale.js.map

View File

@@ -0,0 +1,63 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "getLocaleRedirect", {
enumerable: true,
get: function() {
return getLocaleRedirect;
}
});
const _acceptheader = require("../../../server/accept-header");
const _denormalizepagepath = require("../page-path/denormalize-page-path");
const _detectdomainlocale = require("./detect-domain-locale");
const _formaturl = require("../router/utils/format-url");
const _getcookieparser = require("../../../server/api-utils/get-cookie-parser");
function getLocaleFromCookie(i18n, headers) {
if (headers === void 0) headers = {};
var _getCookieParser_NEXT_LOCALE, _getCookieParser;
const nextLocale = (_getCookieParser = (0, _getcookieparser.getCookieParser)(headers || {})()) == null ? void 0 : (_getCookieParser_NEXT_LOCALE = _getCookieParser.NEXT_LOCALE) == null ? void 0 : _getCookieParser_NEXT_LOCALE.toLowerCase();
return nextLocale ? i18n.locales.find((locale)=>nextLocale === locale.toLowerCase()) : undefined;
}
function detectLocale(param) {
let { i18n, headers, domainLocale, preferredLocale, pathLocale } = param;
return pathLocale || (domainLocale == null ? void 0 : domainLocale.defaultLocale) || getLocaleFromCookie(i18n, headers) || preferredLocale || i18n.defaultLocale;
}
function getAcceptPreferredLocale(i18n, headers) {
if ((headers == null ? void 0 : headers["accept-language"]) && !Array.isArray(headers["accept-language"])) {
try {
return (0, _acceptheader.acceptLanguage)(headers["accept-language"], i18n.locales);
} catch (err) {}
}
}
function getLocaleRedirect(param) {
let { defaultLocale, domainLocale, pathLocale, headers, nextConfig, urlParsed } = param;
if (nextConfig.i18n && nextConfig.i18n.localeDetection !== false && (0, _denormalizepagepath.denormalizePagePath)(urlParsed.pathname) === "/") {
const preferredLocale = getAcceptPreferredLocale(nextConfig.i18n, headers);
const detectedLocale = detectLocale({
i18n: nextConfig.i18n,
preferredLocale,
headers,
pathLocale,
domainLocale
});
const preferredDomain = (0, _detectdomainlocale.detectDomainLocale)(nextConfig.i18n.domains, undefined, preferredLocale);
if (domainLocale && preferredDomain) {
const isPDomain = preferredDomain.domain === domainLocale.domain;
const isPLocale = preferredDomain.defaultLocale === preferredLocale;
if (!isPDomain || !isPLocale) {
const scheme = "http" + (preferredDomain.http ? "" : "s");
const rlocale = isPLocale ? "" : preferredLocale;
return scheme + "://" + preferredDomain.domain + "/" + rlocale;
}
}
if (detectedLocale.toLowerCase() !== defaultLocale.toLowerCase()) {
return (0, _formaturl.formatUrl)({
...urlParsed,
pathname: (nextConfig.basePath || "") + "/" + detectedLocale + (nextConfig.trailingSlash ? "/" : "")
});
}
}
}
//# sourceMappingURL=get-locale-redirect.js.map

View File

@@ -0,0 +1,30 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "normalizeLocalePath", {
enumerable: true,
get: function() {
return normalizeLocalePath;
}
});
function normalizeLocalePath(pathname, locales) {
let detectedLocale;
// first item will be empty string from splitting at first char
const pathnameParts = pathname.split("/");
(locales || []).some((locale)=>{
if (pathnameParts[1] && pathnameParts[1].toLowerCase() === locale.toLowerCase()) {
detectedLocale = locale;
pathnameParts.splice(1, 1);
pathname = pathnameParts.join("/") || "/";
return true;
}
return false;
});
return {
pathname,
detectedLocale
};
}
//# sourceMappingURL=normalize-locale-path.js.map

View File

@@ -0,0 +1,23 @@
/**
* A shared function, used on both client and server, to generate a SVG blur placeholder.
*/ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "getImageBlurSvg", {
enumerable: true,
get: function() {
return getImageBlurSvg;
}
});
function getImageBlurSvg(param) {
let { widthInt, heightInt, blurWidth, blurHeight, blurDataURL, objectFit } = param;
const std = 20;
const svgWidth = blurWidth ? blurWidth * 40 : widthInt;
const svgHeight = blurHeight ? blurHeight * 40 : heightInt;
const viewBox = svgWidth && svgHeight ? "viewBox='0 0 " + svgWidth + " " + svgHeight + "'" : "";
const preserveAspectRatio = viewBox ? "none" : objectFit === "contain" ? "xMidYMid" : objectFit === "cover" ? "xMidYMid slice" : "none";
return "%3Csvg xmlns='http://www.w3.org/2000/svg' " + viewBox + "%3E%3Cfilter id='b' color-interpolation-filters='sRGB'%3E%3CfeGaussianBlur stdDeviation='" + std + "'/%3E%3CfeColorMatrix values='1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 100 -1' result='s'/%3E%3CfeFlood x='0' y='0' width='100%25' height='100%25'/%3E%3CfeComposite operator='out' in='s'/%3E%3CfeComposite in2='SourceGraphic'/%3E%3CfeGaussianBlur stdDeviation='" + std + "'/%3E%3C/filter%3E%3Cimage width='100%25' height='100%25' x='0' y='0' preserveAspectRatio='" + preserveAspectRatio + "' style='filter: url(%23b);' href='" + blurDataURL + "'/%3E%3C/svg%3E";
}
//# sourceMappingURL=image-blur-svg.js.map

View File

@@ -0,0 +1,19 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "ImageConfigContext", {
enumerable: true,
get: function() {
return ImageConfigContext;
}
});
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
const _react = /*#__PURE__*/ _interop_require_default._(require("react"));
const _imageconfig = require("./image-config");
const ImageConfigContext = _react.default.createContext(_imageconfig.imageConfigDefault);
if (process.env.NODE_ENV !== "production") {
ImageConfigContext.displayName = "ImageConfigContext";
}
//# sourceMappingURL=image-config-context.shared-runtime.js.map

View File

@@ -0,0 +1,67 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
VALID_LOADERS: null,
imageConfigDefault: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
VALID_LOADERS: function() {
return VALID_LOADERS;
},
imageConfigDefault: function() {
return imageConfigDefault;
}
});
const VALID_LOADERS = [
"default",
"imgix",
"cloudinary",
"akamai",
"custom"
];
const imageConfigDefault = {
deviceSizes: [
640,
750,
828,
1080,
1200,
1920,
2048,
3840
],
imageSizes: [
16,
32,
48,
64,
96,
128,
256,
384
],
path: "/_next/image",
loader: "default",
loaderFile: "",
domains: [],
disableStaticImages: false,
minimumCacheTTL: 60,
formats: [
"image/webp"
],
dangerouslyAllowSVG: false,
contentSecurityPolicy: "script-src 'none'; frame-src 'none'; sandbox;",
contentDispositionType: "inline",
remotePatterns: [],
unoptimized: false
};
//# sourceMappingURL=image-config.js.map

View File

@@ -0,0 +1,42 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
getObjectClassLabel: null,
isPlainObject: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
getObjectClassLabel: function() {
return getObjectClassLabel;
},
isPlainObject: function() {
return isPlainObject;
}
});
function getObjectClassLabel(value) {
return Object.prototype.toString.call(value);
}
function isPlainObject(value) {
if (getObjectClassLabel(value) !== "[object Object]") {
return false;
}
const prototype = Object.getPrototypeOf(value);
/**
* this used to be previously:
*
* `return prototype === null || prototype === Object.prototype`
*
* but Edge Runtime expose Object from vm, being that kind of type-checking wrongly fail.
*
* It was changed to the current implementation since it's resilient to serialization.
*/ return prototype === null || prototype.hasOwnProperty("isPrototypeOf");
}
//# sourceMappingURL=is-plain-object.js.map

View File

@@ -0,0 +1,14 @@
/**
* This module is for next.js server internal usage of path module.
* It will use native path module for nodejs runtime.
* It will use path-browserify polyfill for edge runtime.
*/ "use strict";
let path;
if (process.env.NEXT_RUNTIME === "edge") {
path = require("next/dist/compiled/path-browserify");
} else {
path = require("path");
}
module.exports = path;
//# sourceMappingURL=path.js.map

View File

@@ -0,0 +1,39 @@
// This has to be a shared module which is shared between client component error boundary and dynamic component
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
BailoutToCSRError: null,
isBailoutToCSRError: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
BailoutToCSRError: function() {
return BailoutToCSRError;
},
isBailoutToCSRError: function() {
return isBailoutToCSRError;
}
});
const BAILOUT_TO_CSR = "BAILOUT_TO_CLIENT_SIDE_RENDERING";
class BailoutToCSRError extends Error {
constructor(reason){
super("Bail out to client-side rendering: " + reason);
this.reason = reason;
this.digest = BAILOUT_TO_CSR;
}
}
function isBailoutToCSRError(err) {
if (typeof err !== "object" || err === null || !("digest" in err)) {
return false;
}
return err.digest === BAILOUT_TO_CSR;
}
//# sourceMappingURL=bailout-to-csr.js.map

View File

@@ -0,0 +1,20 @@
"use client";
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "LoadableContext", {
enumerable: true,
get: function() {
return LoadableContext;
}
});
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
const _react = /*#__PURE__*/ _interop_require_default._(require("react"));
const LoadableContext = _react.default.createContext(null);
if (process.env.NODE_ENV !== "production") {
LoadableContext.displayName = "LoadableContext";
}
//# sourceMappingURL=loadable-context.shared-runtime.js.map

View File

@@ -0,0 +1,248 @@
// TODO: Remove use of `any` type.
/**
@copyright (c) 2017-present James Kyle <me@thejameskyle.com>
MIT License
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
*/ // https://github.com/jamiebuilds/react-loadable/blob/v5.5.0/src/index.js
// Modified to be compatible with webpack 4 / Next.js
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "default", {
enumerable: true,
get: function() {
return _default;
}
});
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
const _react = /*#__PURE__*/ _interop_require_default._(require("react"));
const _loadablecontextsharedruntime = require("./loadable-context.shared-runtime");
function resolve(obj) {
return obj && obj.default ? obj.default : obj;
}
const ALL_INITIALIZERS = [];
const READY_INITIALIZERS = [];
let initialized = false;
function load(loader) {
let promise = loader();
let state = {
loading: true,
loaded: null,
error: null
};
state.promise = promise.then((loaded)=>{
state.loading = false;
state.loaded = loaded;
return loaded;
}).catch((err)=>{
state.loading = false;
state.error = err;
throw err;
});
return state;
}
function createLoadableComponent(loadFn, options) {
let opts = Object.assign({
loader: null,
loading: null,
delay: 200,
timeout: null,
webpack: null,
modules: null
}, options);
/** @type LoadableSubscription */ let subscription = null;
function init() {
if (!subscription) {
// eslint-disable-next-line @typescript-eslint/no-use-before-define
const sub = new LoadableSubscription(loadFn, opts);
subscription = {
getCurrentValue: sub.getCurrentValue.bind(sub),
subscribe: sub.subscribe.bind(sub),
retry: sub.retry.bind(sub),
promise: sub.promise.bind(sub)
};
}
return subscription.promise();
}
// Server only
if (typeof window === "undefined") {
ALL_INITIALIZERS.push(init);
}
// Client only
if (!initialized && typeof window !== "undefined") {
// require.resolveWeak check is needed for environments that don't have it available like Jest
const moduleIds = opts.webpack && typeof require.resolveWeak === "function" ? opts.webpack() : opts.modules;
if (moduleIds) {
READY_INITIALIZERS.push((ids)=>{
for (const moduleId of moduleIds){
if (ids.includes(moduleId)) {
return init();
}
}
});
}
}
function useLoadableModule() {
init();
const context = _react.default.useContext(_loadablecontextsharedruntime.LoadableContext);
if (context && Array.isArray(opts.modules)) {
opts.modules.forEach((moduleName)=>{
context(moduleName);
});
}
}
function LoadableComponent(props, ref) {
useLoadableModule();
const state = _react.default.useSyncExternalStore(subscription.subscribe, subscription.getCurrentValue, subscription.getCurrentValue);
_react.default.useImperativeHandle(ref, ()=>({
retry: subscription.retry
}), []);
return _react.default.useMemo(()=>{
if (state.loading || state.error) {
return /*#__PURE__*/ _react.default.createElement(opts.loading, {
isLoading: state.loading,
pastDelay: state.pastDelay,
timedOut: state.timedOut,
error: state.error,
retry: subscription.retry
});
} else if (state.loaded) {
return /*#__PURE__*/ _react.default.createElement(resolve(state.loaded), props);
} else {
return null;
}
}, [
props,
state
]);
}
LoadableComponent.preload = ()=>init();
LoadableComponent.displayName = "LoadableComponent";
return /*#__PURE__*/ _react.default.forwardRef(LoadableComponent);
}
class LoadableSubscription {
promise() {
return this._res.promise;
}
retry() {
this._clearTimeouts();
this._res = this._loadFn(this._opts.loader);
this._state = {
pastDelay: false,
timedOut: false
};
const { _res: res, _opts: opts } = this;
if (res.loading) {
if (typeof opts.delay === "number") {
if (opts.delay === 0) {
this._state.pastDelay = true;
} else {
this._delay = setTimeout(()=>{
this._update({
pastDelay: true
});
}, opts.delay);
}
}
if (typeof opts.timeout === "number") {
this._timeout = setTimeout(()=>{
this._update({
timedOut: true
});
}, opts.timeout);
}
}
this._res.promise.then(()=>{
this._update({});
this._clearTimeouts();
}).catch((_err)=>{
this._update({});
this._clearTimeouts();
});
this._update({});
}
_update(partial) {
this._state = {
...this._state,
error: this._res.error,
loaded: this._res.loaded,
loading: this._res.loading,
...partial
};
this._callbacks.forEach((callback)=>callback());
}
_clearTimeouts() {
clearTimeout(this._delay);
clearTimeout(this._timeout);
}
getCurrentValue() {
return this._state;
}
subscribe(callback) {
this._callbacks.add(callback);
return ()=>{
this._callbacks.delete(callback);
};
}
constructor(loadFn, opts){
this._loadFn = loadFn;
this._opts = opts;
this._callbacks = new Set();
this._delay = null;
this._timeout = null;
this.retry();
}
}
function Loadable(opts) {
return createLoadableComponent(load, opts);
}
function flushInitializers(initializers, ids) {
let promises = [];
while(initializers.length){
let init = initializers.pop();
promises.push(init(ids));
}
return Promise.all(promises).then(()=>{
if (initializers.length) {
return flushInitializers(initializers, ids);
}
});
}
Loadable.preloadAll = ()=>{
return new Promise((resolveInitializers, reject)=>{
flushInitializers(ALL_INITIALIZERS).then(resolveInitializers, reject);
});
};
Loadable.preloadReady = (ids)=>{
if (ids === void 0) ids = [];
return new Promise((resolvePreload)=>{
const res = ()=>{
initialized = true;
return resolvePreload();
};
// We always will resolve, errors should be handled within loading UIs.
flushInitializers(READY_INITIALIZERS, ids).then(res, res);
});
};
if (typeof window !== "undefined") {
window.__NEXT_PRELOADREADY = Loadable.preloadReady;
}
const _default = Loadable;
//# sourceMappingURL=loadable.shared-runtime.js.map

View File

@@ -0,0 +1,99 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
MAGIC_IDENTIFIER_REGEX: null,
decodeMagicIdentifier: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
MAGIC_IDENTIFIER_REGEX: function() {
return MAGIC_IDENTIFIER_REGEX;
},
decodeMagicIdentifier: function() {
return decodeMagicIdentifier;
}
});
function decodeHex(hexStr) {
if (hexStr.trim() === "") {
throw new Error("can't decode empty hex");
}
const num = parseInt(hexStr, 16);
if (isNaN(num)) {
throw new Error("invalid hex: `" + hexStr + "`");
}
return String.fromCodePoint(num);
}
var Mode;
const DECODE_REGEX = /^__TURBOPACK__([a-zA-Z0-9_$]+)__$/;
function decodeMagicIdentifier(identifier) {
const matches = identifier.match(DECODE_REGEX);
if (!matches) {
return identifier;
}
const inner = matches[1];
let output = "";
let mode = 0;
let buffer = "";
for(let i = 0; i < inner.length; i++){
const char = inner[i];
if (mode === 0) {
if (char === "_") {
mode = 1;
} else if (char === "$") {
mode = 2;
} else {
output += char;
}
} else if (mode === 1) {
if (char === "_") {
output += " ";
mode = 0;
} else if (char === "$") {
output += "_";
mode = 2;
} else {
output += char;
mode = 0;
}
} else if (mode === 2) {
if (buffer.length === 2) {
output += decodeHex(buffer);
buffer = "";
}
if (char === "_") {
if (buffer !== "") {
throw new Error("invalid hex: `" + buffer + "`");
}
mode = 3;
} else if (char === "$") {
if (buffer !== "") {
throw new Error("invalid hex: `" + buffer + "`");
}
mode = 0;
} else {
buffer += char;
}
} else if (mode === 3) {
if (char === "_") {
throw new Error("invalid hex: `" + (buffer + char) + "`");
} else if (char === "$") {
output += decodeHex(buffer);
buffer = "";
mode = 0;
} else {
buffer += char;
}
}
}
return output;
}
const MAGIC_IDENTIFIER_REGEX = /__TURBOPACK__[a-zA-Z0-9_$]+__/g;
//# sourceMappingURL=magic-identifier.js.map

View File

@@ -0,0 +1,55 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
hasMatch: null,
matchRemotePattern: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
hasMatch: function() {
return hasMatch;
},
matchRemotePattern: function() {
return matchRemotePattern;
}
});
const _picomatch = require("next/dist/compiled/picomatch");
function matchRemotePattern(pattern, url) {
if (pattern.protocol !== undefined) {
const actualProto = url.protocol.slice(0, -1);
if (pattern.protocol !== actualProto) {
return false;
}
}
if (pattern.port !== undefined) {
if (pattern.port !== url.port) {
return false;
}
}
if (pattern.hostname === undefined) {
throw new Error("Pattern should define hostname but found\n" + JSON.stringify(pattern));
} else {
if (!(0, _picomatch.makeRe)(pattern.hostname).test(url.hostname)) {
return false;
}
}
var _pattern_pathname;
if (!(0, _picomatch.makeRe)((_pattern_pathname = pattern.pathname) != null ? _pattern_pathname : "**", {
dot: true
}).test(url.pathname)) {
return false;
}
return true;
}
function hasMatch(domains, remotePatterns, url) {
return domains.some((domain)=>url.hostname === domain) || remotePatterns.some((p)=>matchRemotePattern(p, url));
}
//# sourceMappingURL=match-remote-pattern.js.map

View File

@@ -0,0 +1,46 @@
/*
MIT License
Copyright (c) Jason Miller (https://jasonformat.com/)
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.
*/ // This file is based on https://github.com/developit/mitt/blob/v1.1.3/src/index.js
// It's been edited for the needs of this script
// See the LICENSE at the top of the file
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "default", {
enumerable: true,
get: function() {
return mitt;
}
});
function mitt() {
const all = Object.create(null);
return {
on (type, handler) {
(all[type] || (all[type] = [])).push(handler);
},
off (type, handler) {
if (all[type]) {
all[type].splice(all[type].indexOf(handler) >>> 0, 1);
}
},
emit (type) {
for(var _len = arguments.length, evts = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
evts[_key - 1] = arguments[_key];
}
(all[type] || []).slice().map((handler)=>{
handler(...evts);
});
}
};
}
//# sourceMappingURL=mitt.js.map

View File

@@ -0,0 +1,18 @@
// Note: This file is JS because it's used by the taskfile-swc.js file, which is JS.
// Keep file changes in sync with the corresponding `.d.ts` files.
/**
* These are the browser versions that support all of the following:
* static import: https://caniuse.com/es6-module
* dynamic import: https://caniuse.com/es6-module-dynamic-import
* import.meta: https://caniuse.com/mdn-javascript_operators_import_meta
*/ "use strict";
const MODERN_BROWSERSLIST_TARGET = [
"chrome 64",
"edge 79",
"firefox 67",
"opera 51",
"safari 12"
];
module.exports = MODERN_BROWSERSLIST_TARGET;
//# sourceMappingURL=modern-browserslist-target.js.map

View File

@@ -0,0 +1,26 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "absolutePathToPage", {
enumerable: true,
get: function() {
return absolutePathToPage;
}
});
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
const _ensureleadingslash = require("./ensure-leading-slash");
const _normalizepathsep = require("./normalize-path-sep");
const _path = /*#__PURE__*/ _interop_require_default._(require("../isomorphic/path"));
const _removepagepathtail = require("./remove-page-path-tail");
const _getmetadataroute = require("../../../lib/metadata/get-metadata-route");
function absolutePathToPage(pagePath, options) {
const isAppDir = options.pagesType === "app";
const page = (0, _removepagepathtail.removePagePathTail)((0, _normalizepathsep.normalizePathSep)((0, _ensureleadingslash.ensureLeadingSlash)(_path.default.relative(options.dir, pagePath))), {
extensions: options.extensions,
keepIndex: options.keepIndex
});
return isAppDir ? (0, _getmetadataroute.normalizeMetadataRoute)(page) : page;
}
//# sourceMappingURL=absolute-path-to-page.js.map

View File

@@ -0,0 +1,19 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "denormalizeAppPagePath", {
enumerable: true,
get: function() {
return denormalizeAppPagePath;
}
});
function denormalizeAppPagePath(page) {
// `/` is normalized to `/index`
if (page === "/index") {
return "/";
}
return page;
}
//# sourceMappingURL=denormalize-app-path.js.map

View File

@@ -0,0 +1,18 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "denormalizePagePath", {
enumerable: true,
get: function() {
return denormalizePagePath;
}
});
const _utils = require("../router/utils");
const _normalizepathsep = require("./normalize-path-sep");
function denormalizePagePath(page) {
let _page = (0, _normalizepathsep.normalizePathSep)(page);
return _page.startsWith("/index/") && !(0, _utils.isDynamicRoute)(_page) ? _page.slice(6) : _page !== "/index" ? _page : "/";
}
//# sourceMappingURL=denormalize-page-path.js.map

View File

@@ -0,0 +1,18 @@
/**
* For a given page path, this function ensures that there is a leading slash.
* If there is not a leading slash, one is added, otherwise it is noop.
*/ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "ensureLeadingSlash", {
enumerable: true,
get: function() {
return ensureLeadingSlash;
}
});
function ensureLeadingSlash(path) {
return path.startsWith("/") ? path : "/" + path;
}
//# sourceMappingURL=ensure-leading-slash.js.map

View File

@@ -0,0 +1,40 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "getPagePaths", {
enumerable: true,
get: function() {
return getPagePaths;
}
});
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
const _denormalizepagepath = require("./denormalize-page-path");
const _path = /*#__PURE__*/ _interop_require_default._(require("../isomorphic/path"));
function getPagePaths(normalizedPagePath, extensions, isAppDir) {
const page = (0, _denormalizepagepath.denormalizePagePath)(normalizedPagePath);
let prefixes;
if (isAppDir) {
prefixes = [
page
];
} else if (normalizedPagePath.endsWith("/index")) {
prefixes = [
_path.default.join(page, "index")
];
} else {
prefixes = [
page,
_path.default.join(page, "index")
];
}
const paths = [];
for (const extension of extensions){
for (const prefix of prefixes){
paths.push(prefix + "." + extension);
}
}
return paths;
}
//# sourceMappingURL=get-page-paths.js.map

View File

@@ -0,0 +1,26 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "normalizePagePath", {
enumerable: true,
get: function() {
return normalizePagePath;
}
});
const _ensureleadingslash = require("./ensure-leading-slash");
const _utils = require("../router/utils");
const _utils1 = require("../utils");
function normalizePagePath(page) {
const normalized = /^\/index(\/|$)/.test(page) && !(0, _utils.isDynamicRoute)(page) ? "/index" + page : page === "/" ? "/index" : (0, _ensureleadingslash.ensureLeadingSlash)(page);
if (process.env.NEXT_RUNTIME !== "edge") {
const { posix } = require("path");
const resolvedPage = posix.normalize(normalized);
if (resolvedPage !== normalized) {
throw new _utils1.NormalizeError("Requested and resolved page mismatch: " + normalized + " " + resolvedPage);
}
}
return normalized;
}
//# sourceMappingURL=normalize-page-path.js.map

View File

@@ -0,0 +1,19 @@
/**
* For a given page path, this function ensures that there is no backslash
* escaping slashes in the path. Example:
* - `foo\/bar\/baz` -> `foo/bar/baz`
*/ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "normalizePathSep", {
enumerable: true,
get: function() {
return normalizePathSep;
}
});
function normalizePathSep(path) {
return path.replace(/\\/g, "/");
}
//# sourceMappingURL=normalize-path-sep.js.map

View File

@@ -0,0 +1,20 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "removePagePathTail", {
enumerable: true,
get: function() {
return removePagePathTail;
}
});
const _normalizepathsep = require("./normalize-path-sep");
function removePagePathTail(pagePath, options) {
pagePath = (0, _normalizepathsep.normalizePathSep)(pagePath).replace(new RegExp("\\.+(?:" + options.extensions.join("|") + ")$"), "");
if (options.keepIndex !== true) {
pagePath = pagePath.replace(/\/index$/, "") || "/";
}
return pagePath;
}
//# sourceMappingURL=remove-page-path-tail.js.map

View File

@@ -0,0 +1,18 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "RouterContext", {
enumerable: true,
get: function() {
return RouterContext;
}
});
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
const _react = /*#__PURE__*/ _interop_require_default._(require("react"));
const RouterContext = _react.default.createContext(null);
if (process.env.NODE_ENV !== "production") {
RouterContext.displayName = "RouterContext";
}
//# sourceMappingURL=router-context.shared-runtime.js.map

View File

@@ -0,0 +1,139 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
PathnameContextProviderAdapter: null,
adaptForAppRouterInstance: null,
adaptForPathParams: null,
adaptForSearchParams: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
PathnameContextProviderAdapter: function() {
return PathnameContextProviderAdapter;
},
adaptForAppRouterInstance: function() {
return adaptForAppRouterInstance;
},
adaptForPathParams: function() {
return adaptForPathParams;
},
adaptForSearchParams: function() {
return adaptForSearchParams;
}
});
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _jsxruntime = require("react/jsx-runtime");
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
const _hooksclientcontextsharedruntime = require("../hooks-client-context.shared-runtime");
const _utils = require("./utils");
const _aspathtosearchparams = require("./utils/as-path-to-search-params");
const _routeregex = require("./utils/route-regex");
function adaptForAppRouterInstance(pagesRouter) {
return {
back () {
pagesRouter.back();
},
forward () {
pagesRouter.forward();
},
refresh () {
pagesRouter.reload();
},
fastRefresh () {},
push (href, param) {
let { scroll } = param === void 0 ? {} : param;
void pagesRouter.push(href, undefined, {
scroll
});
},
replace (href, param) {
let { scroll } = param === void 0 ? {} : param;
void pagesRouter.replace(href, undefined, {
scroll
});
},
prefetch (href) {
void pagesRouter.prefetch(href);
}
};
}
function adaptForSearchParams(router) {
if (!router.isReady || !router.query) {
return new URLSearchParams();
}
return (0, _aspathtosearchparams.asPathToSearchParams)(router.asPath);
}
function adaptForPathParams(router) {
if (!router.isReady || !router.query) {
return null;
}
const pathParams = {};
const routeRegex = (0, _routeregex.getRouteRegex)(router.pathname);
const keys = Object.keys(routeRegex.groups);
for (const key of keys){
pathParams[key] = router.query[key];
}
return pathParams;
}
function PathnameContextProviderAdapter(param) {
let { children, router, ...props } = param;
const ref = (0, _react.useRef)(props.isAutoExport);
const value = (0, _react.useMemo)(()=>{
// isAutoExport is only ever `true` on the first render from the server,
// so reset it to `false` after we read it for the first time as `true`. If
// we don't use the value, then we don't need it.
const isAutoExport = ref.current;
if (isAutoExport) {
ref.current = false;
}
// When the route is a dynamic route, we need to do more processing to
// determine if we need to stop showing the pathname.
if ((0, _utils.isDynamicRoute)(router.pathname)) {
// When the router is rendering the fallback page, it can't possibly know
// the path, so return `null` here. Read more about fallback pages over
// at:
// https://nextjs.org/docs/api-reference/data-fetching/get-static-paths#fallback-pages
if (router.isFallback) {
return null;
}
// When `isAutoExport` is true, meaning this is a page page has been
// automatically statically optimized, and the router is not ready, then
// we can't know the pathname yet. Read more about automatic static
// optimization at:
// https://nextjs.org/docs/advanced-features/automatic-static-optimization
if (isAutoExport && !router.isReady) {
return null;
}
}
// The `router.asPath` contains the pathname seen by the browser (including
// any query strings), so it should have that stripped. Read more about the
// `asPath` option over at:
// https://nextjs.org/docs/api-reference/next/router#router-object
let url;
try {
url = new URL(router.asPath, "http://f");
} catch (_) {
// fallback to / for invalid asPath values e.g. //
return "/";
}
return url.pathname;
}, [
router.asPath,
router.isFallback,
router.isReady,
router.pathname
]);
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_hooksclientcontextsharedruntime.PathnameContext.Provider, {
value: value,
children: children
});
}
//# sourceMappingURL=adapters.js.map

File diff suppressed because it is too large Load Diff

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View File

@@ -0,0 +1,170 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "getSortedRoutes", {
enumerable: true,
get: function() {
return getSortedRoutes;
}
});
class UrlNode {
insert(urlPath) {
this._insert(urlPath.split("/").filter(Boolean), [], false);
}
smoosh() {
return this._smoosh();
}
_smoosh(prefix) {
if (prefix === void 0) prefix = "/";
const childrenPaths = [
...this.children.keys()
].sort();
if (this.slugName !== null) {
childrenPaths.splice(childrenPaths.indexOf("[]"), 1);
}
if (this.restSlugName !== null) {
childrenPaths.splice(childrenPaths.indexOf("[...]"), 1);
}
if (this.optionalRestSlugName !== null) {
childrenPaths.splice(childrenPaths.indexOf("[[...]]"), 1);
}
const routes = childrenPaths.map((c)=>this.children.get(c)._smoosh("" + prefix + c + "/")).reduce((prev, curr)=>[
...prev,
...curr
], []);
if (this.slugName !== null) {
routes.push(...this.children.get("[]")._smoosh(prefix + "[" + this.slugName + "]/"));
}
if (!this.placeholder) {
const r = prefix === "/" ? "/" : prefix.slice(0, -1);
if (this.optionalRestSlugName != null) {
throw new Error('You cannot define a route with the same specificity as a optional catch-all route ("' + r + '" and "' + r + "[[..." + this.optionalRestSlugName + ']]").');
}
routes.unshift(r);
}
if (this.restSlugName !== null) {
routes.push(...this.children.get("[...]")._smoosh(prefix + "[..." + this.restSlugName + "]/"));
}
if (this.optionalRestSlugName !== null) {
routes.push(...this.children.get("[[...]]")._smoosh(prefix + "[[..." + this.optionalRestSlugName + "]]/"));
}
return routes;
}
_insert(urlPaths, slugNames, isCatchAll) {
if (urlPaths.length === 0) {
this.placeholder = false;
return;
}
if (isCatchAll) {
throw new Error("Catch-all must be the last part of the URL.");
}
// The next segment in the urlPaths list
let nextSegment = urlPaths[0];
// Check if the segment matches `[something]`
if (nextSegment.startsWith("[") && nextSegment.endsWith("]")) {
// Strip `[` and `]`, leaving only `something`
let segmentName = nextSegment.slice(1, -1);
let isOptional = false;
if (segmentName.startsWith("[") && segmentName.endsWith("]")) {
// Strip optional `[` and `]`, leaving only `something`
segmentName = segmentName.slice(1, -1);
isOptional = true;
}
if (segmentName.startsWith("...")) {
// Strip `...`, leaving only `something`
segmentName = segmentName.substring(3);
isCatchAll = true;
}
if (segmentName.startsWith("[") || segmentName.endsWith("]")) {
throw new Error("Segment names may not start or end with extra brackets ('" + segmentName + "').");
}
if (segmentName.startsWith(".")) {
throw new Error("Segment names may not start with erroneous periods ('" + segmentName + "').");
}
function handleSlug(previousSlug, nextSlug) {
if (previousSlug !== null) {
// If the specific segment already has a slug but the slug is not `something`
// This prevents collisions like:
// pages/[post]/index.js
// pages/[id]/index.js
// Because currently multiple dynamic params on the same segment level are not supported
if (previousSlug !== nextSlug) {
// TODO: This error seems to be confusing for users, needs an error link, the description can be based on above comment.
throw new Error("You cannot use different slug names for the same dynamic path ('" + previousSlug + "' !== '" + nextSlug + "').");
}
}
slugNames.forEach((slug)=>{
if (slug === nextSlug) {
throw new Error('You cannot have the same slug name "' + nextSlug + '" repeat within a single dynamic path');
}
if (slug.replace(/\W/g, "") === nextSegment.replace(/\W/g, "")) {
throw new Error('You cannot have the slug names "' + slug + '" and "' + nextSlug + '" differ only by non-word symbols within a single dynamic path');
}
});
slugNames.push(nextSlug);
}
if (isCatchAll) {
if (isOptional) {
if (this.restSlugName != null) {
throw new Error('You cannot use both an required and optional catch-all route at the same level ("[...' + this.restSlugName + ']" and "' + urlPaths[0] + '" ).');
}
handleSlug(this.optionalRestSlugName, segmentName);
// slugName is kept as it can only be one particular slugName
this.optionalRestSlugName = segmentName;
// nextSegment is overwritten to [[...]] so that it can later be sorted specifically
nextSegment = "[[...]]";
} else {
if (this.optionalRestSlugName != null) {
throw new Error('You cannot use both an optional and required catch-all route at the same level ("[[...' + this.optionalRestSlugName + ']]" and "' + urlPaths[0] + '").');
}
handleSlug(this.restSlugName, segmentName);
// slugName is kept as it can only be one particular slugName
this.restSlugName = segmentName;
// nextSegment is overwritten to [...] so that it can later be sorted specifically
nextSegment = "[...]";
}
} else {
if (isOptional) {
throw new Error('Optional route parameters are not yet supported ("' + urlPaths[0] + '").');
}
handleSlug(this.slugName, segmentName);
// slugName is kept as it can only be one particular slugName
this.slugName = segmentName;
// nextSegment is overwritten to [] so that it can later be sorted specifically
nextSegment = "[]";
}
}
// If this UrlNode doesn't have the nextSegment yet we create a new child UrlNode
if (!this.children.has(nextSegment)) {
this.children.set(nextSegment, new UrlNode());
}
this.children.get(nextSegment)._insert(urlPaths.slice(1), slugNames, isCatchAll);
}
constructor(){
this.placeholder = true;
this.children = new Map();
this.slugName = null;
this.restSlugName = null;
this.optionalRestSlugName = null;
}
}
function getSortedRoutes(normalizedPages) {
// First the UrlNode is created, and every UrlNode can have only 1 dynamic segment
// Eg you can't have pages/[post]/abc.js and pages/[hello]/something-else.js
// Only 1 dynamic segment per nesting level
// So in the case that is test/integration/dynamic-routing it'll be this:
// pages/[post]/comments.js
// pages/blog/[post]/comment/[id].js
// Both are fine because `pages/[post]` and `pages/blog` are on the same level
// So in this case `UrlNode` created here has `this.slugName === 'post'`
// And since your PR passed through `slugName` as an array basically it'd including it in too many possibilities
// Instead what has to be passed through is the upwards path's dynamic names
const root = new UrlNode();
// Here the `root` gets injected multiple paths, and insert will break them up into sublevels
normalizedPages.forEach((pagePath)=>root.insert(pagePath));
// Smoosh will then sort those sublevels up to the point where you get the correct route definition priority
return root.smoosh();
}
//# sourceMappingURL=sorted-routes.js.map

View File

@@ -0,0 +1,31 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
default: null,
setConfig: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
default: function() {
return _default;
},
setConfig: function() {
return setConfig;
}
});
let runtimeConfig;
const _default = ()=>{
return runtimeConfig;
};
function setConfig(configValue) {
runtimeConfig = configValue;
}
//# sourceMappingURL=runtime-config.external.js.map

View File

@@ -0,0 +1,34 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
DEFAULT_SEGMENT_KEY: null,
PAGE_SEGMENT_KEY: null,
isGroupSegment: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
DEFAULT_SEGMENT_KEY: function() {
return DEFAULT_SEGMENT_KEY;
},
PAGE_SEGMENT_KEY: function() {
return PAGE_SEGMENT_KEY;
},
isGroupSegment: function() {
return isGroupSegment;
}
});
function isGroupSegment(segment) {
// Use array[0] for performant purpose
return segment[0] === "(" && segment.endsWith(")");
}
const PAGE_SEGMENT_KEY = "__PAGE__";
const DEFAULT_SEGMENT_KEY = "__DEFAULT__";
//# sourceMappingURL=segment.js.map

View File

@@ -0,0 +1,36 @@
"use client";
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
ServerInsertedHTMLContext: null,
useServerInsertedHTML: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
ServerInsertedHTMLContext: function() {
return ServerInsertedHTMLContext;
},
useServerInsertedHTML: function() {
return useServerInsertedHTML;
}
});
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
const ServerInsertedHTMLContext = /*#__PURE__*/ _react.default.createContext(null);
function useServerInsertedHTML(callback) {
const addInsertedServerHTMLCallback = (0, _react.useContext)(ServerInsertedHTMLContext);
// Should have no effects on client where there's no flush effects provider
if (addInsertedServerHTMLCallback) {
addInsertedServerHTMLCallback(callback);
}
}
//# sourceMappingURL=server-inserted-html.shared-runtime.js.map

View File

@@ -0,0 +1,66 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "default", {
enumerable: true,
get: function() {
return SideEffect;
}
});
const _react = require("react");
const isServer = typeof window === "undefined";
const useClientOnlyLayoutEffect = isServer ? ()=>{} : _react.useLayoutEffect;
const useClientOnlyEffect = isServer ? ()=>{} : _react.useEffect;
function SideEffect(props) {
const { headManager, reduceComponentsToState } = props;
function emitChange() {
if (headManager && headManager.mountedInstances) {
const headElements = _react.Children.toArray(Array.from(headManager.mountedInstances).filter(Boolean));
headManager.updateHead(reduceComponentsToState(headElements, props));
}
}
if (isServer) {
var _headManager_mountedInstances;
headManager == null ? void 0 : (_headManager_mountedInstances = headManager.mountedInstances) == null ? void 0 : _headManager_mountedInstances.add(props.children);
emitChange();
}
useClientOnlyLayoutEffect(()=>{
var _headManager_mountedInstances;
headManager == null ? void 0 : (_headManager_mountedInstances = headManager.mountedInstances) == null ? void 0 : _headManager_mountedInstances.add(props.children);
return ()=>{
var _headManager_mountedInstances;
headManager == null ? void 0 : (_headManager_mountedInstances = headManager.mountedInstances) == null ? void 0 : _headManager_mountedInstances.delete(props.children);
};
});
// We need to call `updateHead` method whenever the `SideEffect` is trigger in all
// life-cycles: mount, update, unmount. However, if there are multiple `SideEffect`s
// being rendered, we only trigger the method from the last one.
// This is ensured by keeping the last unflushed `updateHead` in the `_pendingUpdate`
// singleton in the layout effect pass, and actually trigger it in the effect pass.
useClientOnlyLayoutEffect(()=>{
if (headManager) {
headManager._pendingUpdate = emitChange;
}
return ()=>{
if (headManager) {
headManager._pendingUpdate = emitChange;
}
};
});
useClientOnlyEffect(()=>{
if (headManager && headManager._pendingUpdate) {
headManager._pendingUpdate();
headManager._pendingUpdate = null;
}
return ()=>{
if (headManager && headManager._pendingUpdate) {
headManager._pendingUpdate();
headManager._pendingUpdate = null;
}
};
});
return null;
}
//# sourceMappingURL=side-effect.js.map

View File

@@ -0,0 +1,203 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
DecodeError: null,
MiddlewareNotFoundError: null,
MissingStaticPage: null,
NormalizeError: null,
PageNotFoundError: null,
SP: null,
ST: null,
WEB_VITALS: null,
execOnce: null,
getDisplayName: null,
getLocationOrigin: null,
getURL: null,
isAbsoluteUrl: null,
isResSent: null,
loadGetInitialProps: null,
normalizeRepeatedSlashes: null,
stringifyError: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
DecodeError: function() {
return DecodeError;
},
MiddlewareNotFoundError: function() {
return MiddlewareNotFoundError;
},
MissingStaticPage: function() {
return MissingStaticPage;
},
NormalizeError: function() {
return NormalizeError;
},
PageNotFoundError: function() {
return PageNotFoundError;
},
SP: function() {
return SP;
},
ST: function() {
return ST;
},
WEB_VITALS: function() {
return WEB_VITALS;
},
execOnce: function() {
return execOnce;
},
getDisplayName: function() {
return getDisplayName;
},
getLocationOrigin: function() {
return getLocationOrigin;
},
getURL: function() {
return getURL;
},
isAbsoluteUrl: function() {
return isAbsoluteUrl;
},
isResSent: function() {
return isResSent;
},
loadGetInitialProps: function() {
return loadGetInitialProps;
},
normalizeRepeatedSlashes: function() {
return normalizeRepeatedSlashes;
},
stringifyError: function() {
return stringifyError;
}
});
const WEB_VITALS = [
"CLS",
"FCP",
"FID",
"INP",
"LCP",
"TTFB"
];
function execOnce(fn) {
let used = false;
let result;
return function() {
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
args[_key] = arguments[_key];
}
if (!used) {
used = true;
result = fn(...args);
}
return result;
};
}
// Scheme: https://tools.ietf.org/html/rfc3986#section-3.1
// Absolute URL: https://tools.ietf.org/html/rfc3986#section-4.3
const ABSOLUTE_URL_REGEX = /^[a-zA-Z][a-zA-Z\d+\-.]*?:/;
const isAbsoluteUrl = (url)=>ABSOLUTE_URL_REGEX.test(url);
function getLocationOrigin() {
const { protocol, hostname, port } = window.location;
return protocol + "//" + hostname + (port ? ":" + port : "");
}
function getURL() {
const { href } = window.location;
const origin = getLocationOrigin();
return href.substring(origin.length);
}
function getDisplayName(Component) {
return typeof Component === "string" ? Component : Component.displayName || Component.name || "Unknown";
}
function isResSent(res) {
return res.finished || res.headersSent;
}
function normalizeRepeatedSlashes(url) {
const urlParts = url.split("?");
const urlNoQuery = urlParts[0];
return urlNoQuery// first we replace any non-encoded backslashes with forward
// then normalize repeated forward slashes
.replace(/\\/g, "/").replace(/\/\/+/g, "/") + (urlParts[1] ? "?" + urlParts.slice(1).join("?") : "");
}
async function loadGetInitialProps(App, ctx) {
if (process.env.NODE_ENV !== "production") {
var _App_prototype;
if ((_App_prototype = App.prototype) == null ? void 0 : _App_prototype.getInitialProps) {
const message = '"' + getDisplayName(App) + '.getInitialProps()" is defined as an instance method - visit https://nextjs.org/docs/messages/get-initial-props-as-an-instance-method for more information.';
throw new Error(message);
}
}
// when called from _app `ctx` is nested in `ctx`
const res = ctx.res || ctx.ctx && ctx.ctx.res;
if (!App.getInitialProps) {
if (ctx.ctx && ctx.Component) {
// @ts-ignore pageProps default
return {
pageProps: await loadGetInitialProps(ctx.Component, ctx.ctx)
};
}
return {};
}
const props = await App.getInitialProps(ctx);
if (res && isResSent(res)) {
return props;
}
if (!props) {
const message = '"' + getDisplayName(App) + '.getInitialProps()" should resolve to an object. But found "' + props + '" instead.';
throw new Error(message);
}
if (process.env.NODE_ENV !== "production") {
if (Object.keys(props).length === 0 && !ctx.ctx) {
console.warn("" + getDisplayName(App) + " returned an empty object from `getInitialProps`. This de-optimizes and prevents automatic static optimization. https://nextjs.org/docs/messages/empty-object-getInitialProps");
}
}
return props;
}
const SP = typeof performance !== "undefined";
const ST = SP && [
"mark",
"measure",
"getEntriesByName"
].every((method)=>typeof performance[method] === "function");
class DecodeError extends Error {
}
class NormalizeError extends Error {
}
class PageNotFoundError extends Error {
constructor(page){
super();
this.code = "ENOENT";
this.name = "PageNotFoundError";
this.message = "Cannot find module for page: " + page;
}
}
class MissingStaticPage extends Error {
constructor(page, message){
super();
this.message = "Failed to load static file for page: " + page + " " + message;
}
}
class MiddlewareNotFoundError extends Error {
constructor(){
super();
this.code = "ENOENT";
this.message = "Cannot find the middleware module";
}
}
function stringifyError(error) {
return JSON.stringify({
message: error.message,
stack: error.stack
});
}
//# sourceMappingURL=utils.js.map

View File

@@ -0,0 +1,22 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "warnOnce", {
enumerable: true,
get: function() {
return warnOnce;
}
});
let warnOnce = (_)=>{};
if (process.env.NODE_ENV !== "production") {
const warnings = new Set();
warnOnce = (msg)=>{
if (!warnings.has(msg)) {
console.warn(msg);
}
warnings.add(msg);
};
}
//# sourceMappingURL=warn-once.js.map