update wings

This commit is contained in:
2026-07-14 11:56:47 +05:30
parent 4b8277af70
commit 07e035dd62
1701 changed files with 0 additions and 461071 deletions

View File

@@ -1,65 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "Batcher", {
enumerable: true,
get: function() {
return Batcher;
}
});
const _detachedpromise = require("./detached-promise");
class Batcher {
constructor(cacheKeyFn, /**
* A function that will be called to schedule the wrapped function to be
* executed. This defaults to a function that will execute the function
* immediately.
*/ schedulerFn = (fn)=>fn()){
this.cacheKeyFn = cacheKeyFn;
this.schedulerFn = schedulerFn;
this.pending = new Map();
}
static create(options) {
return new Batcher(options == null ? void 0 : options.cacheKeyFn, options == null ? void 0 : options.schedulerFn);
}
/**
* Wraps a function in a promise that will be resolved or rejected only once
* for a given key. This will allow multiple calls to the function to be
* made, but only one will be executed at a time. The result of the first
* call will be returned to all callers.
*
* @param key the key to use for the cache
* @param fn the function to wrap
* @returns a promise that resolves to the result of the function
*/ async batch(key, fn) {
const cacheKey = this.cacheKeyFn ? await this.cacheKeyFn(key) : key;
if (cacheKey === null) {
return fn({
resolve: (value)=>Promise.resolve(value),
key
});
}
const pending = this.pending.get(cacheKey);
if (pending) return pending;
const { promise, resolve, reject } = new _detachedpromise.DetachedPromise();
this.pending.set(cacheKey, promise);
this.schedulerFn(async ()=>{
try {
const result = await fn({
resolve,
key
});
// Resolving a promise multiple times is a no-op, so we can safely
// resolve all pending promises with the same result.
resolve(result);
} catch (err) {
reject(err);
} finally{
this.pending.delete(cacheKey);
}
});
return promise;
}
}
//# sourceMappingURL=batcher.js.map

View File

@@ -1,46 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "buildCustomRoute", {
enumerable: true,
get: function() {
return buildCustomRoute;
}
});
const _pathtoregexp = require("next/dist/compiled/path-to-regexp");
const _loadcustomroutes = require("./load-custom-routes");
const _redirectstatus = require("./redirect-status");
function buildCustomRoute(type, route, restrictedRedirectPaths) {
const compiled = (0, _pathtoregexp.pathToRegexp)(route.source, [], {
strict: true,
sensitive: false,
delimiter: '/'
});
// If this is an internal rewrite and it already provides a regex, use it
// otherwise, normalize the source to a regex.
let regex;
if (!route.internal || type !== 'rewrite' || !('regex' in route) || typeof route.regex !== 'string') {
let source = compiled.source;
if (!route.internal) {
source = (0, _redirectstatus.modifyRouteRegex)(source, type === 'redirect' ? restrictedRedirectPaths : undefined);
}
regex = (0, _loadcustomroutes.normalizeRouteRegex)(source);
} else {
regex = route.regex;
}
if (type !== 'redirect') {
return {
...route,
regex
};
}
return {
...route,
statusCode: (0, _redirectstatus.getRedirectStatus)(route),
permanent: undefined,
regex
};
}
//# sourceMappingURL=build-custom-route.js.map

View File

@@ -1,97 +0,0 @@
/// Utilties for configuring the bundler to use.
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
Bundler: null,
finalizeBundlerFromConfig: null,
parseBundlerArgs: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
Bundler: function() {
return Bundler;
},
finalizeBundlerFromConfig: function() {
return finalizeBundlerFromConfig;
},
parseBundlerArgs: function() {
return parseBundlerArgs;
}
});
var Bundler = /*#__PURE__*/ function(Bundler) {
Bundler[Bundler["Turbopack"] = 0] = "Turbopack";
Bundler[Bundler["Webpack"] = 1] = "Webpack";
Bundler[Bundler["Rspack"] = 2] = "Rspack";
return Bundler;
}({});
function parseBundlerArgs(options) {
const bundlerFlags = new Map();
const setBundlerFlag = (bundler, flag)=>{
bundlerFlags.set(bundler, (bundlerFlags.get(bundler) ?? []).concat(flag));
};
// What turbo flag was set? We allow multiple to be set, which is silly but not ambiguous, just pick the most relevant one.
if (options.turbopack) {
setBundlerFlag(0, '--turbopack');
}
if (options.turbo) {
setBundlerFlag(0, '--turbo');
} else if (process.env.TURBOPACK) {
// We don't really want to support this but it is trivial and not really confusing.
// If we don't support it and someone sets it, we would have inconsistent behavior
// since some parts of next would read the return value of this function and other
// parts will read the env variable.
setBundlerFlag(0, `TURBOPACK=${process.env.TURBOPACK}`);
} else if (process.env.IS_TURBOPACK_TEST) {
setBundlerFlag(0, `IS_TURBOPACK_TEST=${process.env.IS_TURBOPACK_TEST}`);
}
if (options.webpack) {
setBundlerFlag(1, '--webpack');
}
if (process.env.IS_WEBPACK_TEST) {
setBundlerFlag(1, `IS_WEBPACK_TEST=${process.env.IS_WEBPACK_TEST}`);
}
// Mostly this is set via the NextConfig but it can also be set via the command line which is
// common for testing.
if (process.env.NEXT_RSPACK) {
setBundlerFlag(2, `NEXT_RSPACK=${process.env.NEXT_RSPACK}`);
}
if (process.env.NEXT_TEST_USE_RSPACK) {
setBundlerFlag(2, `NEXT_TEST_USE_RSPACK=${process.env.NEXT_TEST_USE_RSPACK}`);
}
if (bundlerFlags.size > 1) {
console.error(`Multiple bundler flags set: ${Array.from(bundlerFlags.values()).flat().join(', ')}.
Edit your command or your package.json script to configure only one bundler.`);
process.exit(1);
}
// The default is turbopack when nothing is configured.
if (bundlerFlags.size === 0) {
process.env.TURBOPACK = 'auto';
return 0;
}
if (bundlerFlags.has(0)) {
// Only conditionally assign to the environment variable, preserving already set values.
// If it was set to 'auto' because no flag was set and this function is called a second time we
// would upgrade to '1' but we don't really want that.
process.env.TURBOPACK ??= '1';
return 0;
}
// Otherwise it is one of rspack or webpack. At this point there must be exactly one key in the map.
return bundlerFlags.keys().next().value;
}
function finalizeBundlerFromConfig(fromOptions) {
// Reading the next config can set NEXT_RSPACK environment variables.
if (process.env.NEXT_RSPACK) {
return 2;
}
return fromOptions;
}
//# sourceMappingURL=bundler.js.map

View File

@@ -1,54 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
getUseCacheFunctionInfo: null,
isClientReference: null,
isServerReference: null,
isUseCacheFunction: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
getUseCacheFunctionInfo: function() {
return getUseCacheFunctionInfo;
},
isClientReference: function() {
return isClientReference;
},
isServerReference: function() {
return isServerReference;
},
isUseCacheFunction: function() {
return isUseCacheFunction;
}
});
const _serverreferenceinfo = require("../shared/lib/server-reference-info");
function isServerReference(value) {
return value.$$typeof === Symbol.for('react.server.reference');
}
function isUseCacheFunction(value) {
if (!isServerReference(value)) {
return false;
}
const { type } = (0, _serverreferenceinfo.extractInfoFromServerReferenceId)(value.$$id);
return type === 'use-cache';
}
function getUseCacheFunctionInfo(value) {
if (!isServerReference(value)) {
return null;
}
const info = (0, _serverreferenceinfo.extractInfoFromServerReferenceId)(value.$$id);
return info.type === 'use-cache' ? info : null;
}
function isClientReference(mod) {
const defaultExport = (mod == null ? void 0 : mod.default) || mod;
return (defaultExport == null ? void 0 : defaultExport.$$typeof) === Symbol.for('react.client.reference');
}
//# sourceMappingURL=client-and-server-references.js.map

View File

@@ -1,39 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "withCoalescedInvoke", {
enumerable: true,
get: function() {
return withCoalescedInvoke;
}
});
const globalInvokeCache = new Map();
function withCoalescedInvoke(func) {
return async function(key, args) {
const entry = globalInvokeCache.get(key);
if (entry) {
return entry.then((res)=>({
isOrigin: false,
value: res.value
}));
}
async function __wrapper() {
return await func.apply(undefined, args);
}
const future = __wrapper().then((res)=>{
globalInvokeCache.delete(key);
return {
isOrigin: true,
value: res
};
}).catch((err)=>{
globalInvokeCache.delete(key);
return Promise.reject(err);
});
globalInvokeCache.set(key, future);
return future;
};
}
//# sourceMappingURL=coalesced-function.js.map

View File

@@ -1,14 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "CompileError", {
enumerable: true,
get: function() {
return CompileError;
}
});
class CompileError extends Error {
}
//# sourceMappingURL=compile-error.js.map

View File

@@ -1,420 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
ACTION_SUFFIX: null,
APP_DIR_ALIAS: null,
CACHE_ONE_YEAR_SECONDS: null,
DOT_NEXT_ALIAS: null,
ESLINT_DEFAULT_DIRS: null,
GSP_NO_RETURNED_VALUE: null,
GSSP_COMPONENT_MEMBER_ERROR: null,
GSSP_NO_RETURNED_VALUE: null,
HTML_CONTENT_TYPE_HEADER: null,
INFINITE_CACHE: null,
INSTRUMENTATION_HOOK_FILENAME: null,
JSON_CONTENT_TYPE_HEADER: null,
MATCHED_PATH_HEADER: null,
MIDDLEWARE_FILENAME: null,
MIDDLEWARE_LOCATION_REGEXP: null,
NEXT_BODY_SUFFIX: null,
NEXT_CACHE_IMPLICIT_TAG_ID: null,
NEXT_CACHE_REVALIDATED_TAGS_HEADER: null,
NEXT_CACHE_REVALIDATE_TAG_TOKEN_HEADER: null,
NEXT_CACHE_ROOT_PARAM_TAG_ID: null,
NEXT_CACHE_SOFT_TAG_MAX_LENGTH: null,
NEXT_CACHE_TAGS_HEADER: null,
NEXT_CACHE_TAG_MAX_ITEMS: null,
NEXT_CACHE_TAG_MAX_LENGTH: null,
NEXT_DATA_SUFFIX: null,
NEXT_INTERCEPTION_MARKER_PREFIX: null,
NEXT_META_SUFFIX: null,
NEXT_NAV_DEPLOYMENT_ID_HEADER: null,
NEXT_QUERY_PARAM_PREFIX: null,
NEXT_RESUME_HEADER: null,
NEXT_RESUME_STATE_LENGTH_HEADER: null,
NON_STANDARD_NODE_ENV: null,
PAGES_DIR_ALIAS: null,
PRERENDER_REVALIDATE_HEADER: null,
PRERENDER_REVALIDATE_ONLY_GENERATED_HEADER: null,
PROXY_FILENAME: null,
PROXY_LOCATION_REGEXP: null,
PUBLIC_DIR_MIDDLEWARE_CONFLICT: null,
ROOT_DIR_ALIAS: null,
RSC_ACTION_CLIENT_WRAPPER_ALIAS: null,
RSC_ACTION_ENCRYPTION_ALIAS: null,
RSC_ACTION_PROXY_ALIAS: null,
RSC_ACTION_VALIDATE_ALIAS: null,
RSC_CACHE_WRAPPER_ALIAS: null,
RSC_DYNAMIC_IMPORT_WRAPPER_ALIAS: null,
RSC_MOD_REF_PROXY_ALIAS: null,
RSC_SEGMENTS_DIR_SUFFIX: null,
RSC_SEGMENT_SUFFIX: null,
RSC_SUFFIX: null,
SERVER_PROPS_EXPORT_ERROR: null,
SERVER_PROPS_GET_INIT_PROPS_CONFLICT: null,
SERVER_PROPS_SSG_CONFLICT: null,
SERVER_RUNTIME: null,
SSG_FALLBACK_EXPORT_ERROR: null,
SSG_GET_INITIAL_PROPS_CONFLICT: null,
STATIC_STATUS_PAGE_GET_INITIAL_PROPS_ERROR: null,
TEXT_PLAIN_CONTENT_TYPE_HEADER: null,
UNSTABLE_REVALIDATE_RENAME_ERROR: null,
WEBPACK_LAYERS: null,
WEBPACK_RESOURCE_QUERIES: null,
WEB_SOCKET_MAX_RECONNECTIONS: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
ACTION_SUFFIX: function() {
return ACTION_SUFFIX;
},
APP_DIR_ALIAS: function() {
return APP_DIR_ALIAS;
},
CACHE_ONE_YEAR_SECONDS: function() {
return CACHE_ONE_YEAR_SECONDS;
},
DOT_NEXT_ALIAS: function() {
return DOT_NEXT_ALIAS;
},
ESLINT_DEFAULT_DIRS: function() {
return ESLINT_DEFAULT_DIRS;
},
GSP_NO_RETURNED_VALUE: function() {
return GSP_NO_RETURNED_VALUE;
},
GSSP_COMPONENT_MEMBER_ERROR: function() {
return GSSP_COMPONENT_MEMBER_ERROR;
},
GSSP_NO_RETURNED_VALUE: function() {
return GSSP_NO_RETURNED_VALUE;
},
HTML_CONTENT_TYPE_HEADER: function() {
return HTML_CONTENT_TYPE_HEADER;
},
INFINITE_CACHE: function() {
return INFINITE_CACHE;
},
INSTRUMENTATION_HOOK_FILENAME: function() {
return INSTRUMENTATION_HOOK_FILENAME;
},
JSON_CONTENT_TYPE_HEADER: function() {
return JSON_CONTENT_TYPE_HEADER;
},
MATCHED_PATH_HEADER: function() {
return MATCHED_PATH_HEADER;
},
MIDDLEWARE_FILENAME: function() {
return MIDDLEWARE_FILENAME;
},
MIDDLEWARE_LOCATION_REGEXP: function() {
return MIDDLEWARE_LOCATION_REGEXP;
},
NEXT_BODY_SUFFIX: function() {
return NEXT_BODY_SUFFIX;
},
NEXT_CACHE_IMPLICIT_TAG_ID: function() {
return NEXT_CACHE_IMPLICIT_TAG_ID;
},
NEXT_CACHE_REVALIDATED_TAGS_HEADER: function() {
return NEXT_CACHE_REVALIDATED_TAGS_HEADER;
},
NEXT_CACHE_REVALIDATE_TAG_TOKEN_HEADER: function() {
return NEXT_CACHE_REVALIDATE_TAG_TOKEN_HEADER;
},
NEXT_CACHE_ROOT_PARAM_TAG_ID: function() {
return NEXT_CACHE_ROOT_PARAM_TAG_ID;
},
NEXT_CACHE_SOFT_TAG_MAX_LENGTH: function() {
return NEXT_CACHE_SOFT_TAG_MAX_LENGTH;
},
NEXT_CACHE_TAGS_HEADER: function() {
return NEXT_CACHE_TAGS_HEADER;
},
NEXT_CACHE_TAG_MAX_ITEMS: function() {
return NEXT_CACHE_TAG_MAX_ITEMS;
},
NEXT_CACHE_TAG_MAX_LENGTH: function() {
return NEXT_CACHE_TAG_MAX_LENGTH;
},
NEXT_DATA_SUFFIX: function() {
return NEXT_DATA_SUFFIX;
},
NEXT_INTERCEPTION_MARKER_PREFIX: function() {
return NEXT_INTERCEPTION_MARKER_PREFIX;
},
NEXT_META_SUFFIX: function() {
return NEXT_META_SUFFIX;
},
NEXT_NAV_DEPLOYMENT_ID_HEADER: function() {
return NEXT_NAV_DEPLOYMENT_ID_HEADER;
},
NEXT_QUERY_PARAM_PREFIX: function() {
return NEXT_QUERY_PARAM_PREFIX;
},
NEXT_RESUME_HEADER: function() {
return NEXT_RESUME_HEADER;
},
NEXT_RESUME_STATE_LENGTH_HEADER: function() {
return NEXT_RESUME_STATE_LENGTH_HEADER;
},
NON_STANDARD_NODE_ENV: function() {
return NON_STANDARD_NODE_ENV;
},
PAGES_DIR_ALIAS: function() {
return PAGES_DIR_ALIAS;
},
PRERENDER_REVALIDATE_HEADER: function() {
return PRERENDER_REVALIDATE_HEADER;
},
PRERENDER_REVALIDATE_ONLY_GENERATED_HEADER: function() {
return PRERENDER_REVALIDATE_ONLY_GENERATED_HEADER;
},
PROXY_FILENAME: function() {
return PROXY_FILENAME;
},
PROXY_LOCATION_REGEXP: function() {
return PROXY_LOCATION_REGEXP;
},
PUBLIC_DIR_MIDDLEWARE_CONFLICT: function() {
return PUBLIC_DIR_MIDDLEWARE_CONFLICT;
},
ROOT_DIR_ALIAS: function() {
return ROOT_DIR_ALIAS;
},
RSC_ACTION_CLIENT_WRAPPER_ALIAS: function() {
return RSC_ACTION_CLIENT_WRAPPER_ALIAS;
},
RSC_ACTION_ENCRYPTION_ALIAS: function() {
return RSC_ACTION_ENCRYPTION_ALIAS;
},
RSC_ACTION_PROXY_ALIAS: function() {
return RSC_ACTION_PROXY_ALIAS;
},
RSC_ACTION_VALIDATE_ALIAS: function() {
return RSC_ACTION_VALIDATE_ALIAS;
},
RSC_CACHE_WRAPPER_ALIAS: function() {
return RSC_CACHE_WRAPPER_ALIAS;
},
RSC_DYNAMIC_IMPORT_WRAPPER_ALIAS: function() {
return RSC_DYNAMIC_IMPORT_WRAPPER_ALIAS;
},
RSC_MOD_REF_PROXY_ALIAS: function() {
return RSC_MOD_REF_PROXY_ALIAS;
},
RSC_SEGMENTS_DIR_SUFFIX: function() {
return RSC_SEGMENTS_DIR_SUFFIX;
},
RSC_SEGMENT_SUFFIX: function() {
return RSC_SEGMENT_SUFFIX;
},
RSC_SUFFIX: function() {
return RSC_SUFFIX;
},
SERVER_PROPS_EXPORT_ERROR: function() {
return SERVER_PROPS_EXPORT_ERROR;
},
SERVER_PROPS_GET_INIT_PROPS_CONFLICT: function() {
return SERVER_PROPS_GET_INIT_PROPS_CONFLICT;
},
SERVER_PROPS_SSG_CONFLICT: function() {
return SERVER_PROPS_SSG_CONFLICT;
},
SERVER_RUNTIME: function() {
return SERVER_RUNTIME;
},
SSG_FALLBACK_EXPORT_ERROR: function() {
return SSG_FALLBACK_EXPORT_ERROR;
},
SSG_GET_INITIAL_PROPS_CONFLICT: function() {
return SSG_GET_INITIAL_PROPS_CONFLICT;
},
STATIC_STATUS_PAGE_GET_INITIAL_PROPS_ERROR: function() {
return STATIC_STATUS_PAGE_GET_INITIAL_PROPS_ERROR;
},
TEXT_PLAIN_CONTENT_TYPE_HEADER: function() {
return TEXT_PLAIN_CONTENT_TYPE_HEADER;
},
UNSTABLE_REVALIDATE_RENAME_ERROR: function() {
return UNSTABLE_REVALIDATE_RENAME_ERROR;
},
WEBPACK_LAYERS: function() {
return WEBPACK_LAYERS;
},
WEBPACK_RESOURCE_QUERIES: function() {
return WEBPACK_RESOURCE_QUERIES;
},
WEB_SOCKET_MAX_RECONNECTIONS: function() {
return WEB_SOCKET_MAX_RECONNECTIONS;
}
});
const TEXT_PLAIN_CONTENT_TYPE_HEADER = 'text/plain';
const HTML_CONTENT_TYPE_HEADER = 'text/html; charset=utf-8';
const JSON_CONTENT_TYPE_HEADER = 'application/json; charset=utf-8';
const NEXT_QUERY_PARAM_PREFIX = 'nxtP';
const NEXT_INTERCEPTION_MARKER_PREFIX = 'nxtI';
const MATCHED_PATH_HEADER = 'x-matched-path';
const PRERENDER_REVALIDATE_HEADER = 'x-prerender-revalidate';
const PRERENDER_REVALIDATE_ONLY_GENERATED_HEADER = 'x-prerender-revalidate-if-generated';
const RSC_SEGMENTS_DIR_SUFFIX = '.segments';
const RSC_SEGMENT_SUFFIX = '.segment.rsc';
const RSC_SUFFIX = '.rsc';
const ACTION_SUFFIX = '.action';
const NEXT_DATA_SUFFIX = '.json';
const NEXT_META_SUFFIX = '.meta';
const NEXT_BODY_SUFFIX = '.body';
const NEXT_NAV_DEPLOYMENT_ID_HEADER = 'x-nextjs-deployment-id';
const NEXT_CACHE_TAGS_HEADER = 'x-next-cache-tags';
const NEXT_CACHE_REVALIDATED_TAGS_HEADER = 'x-next-revalidated-tags';
const NEXT_CACHE_REVALIDATE_TAG_TOKEN_HEADER = 'x-next-revalidate-tag-token';
const NEXT_RESUME_HEADER = 'next-resume';
const NEXT_RESUME_STATE_LENGTH_HEADER = 'x-next-resume-state-length';
const NEXT_CACHE_TAG_MAX_ITEMS = 128;
const NEXT_CACHE_TAG_MAX_LENGTH = 256;
const NEXT_CACHE_SOFT_TAG_MAX_LENGTH = 1024;
const NEXT_CACHE_IMPLICIT_TAG_ID = '_N_T_';
const NEXT_CACHE_ROOT_PARAM_TAG_ID = '_N_RP_';
const CACHE_ONE_YEAR_SECONDS = 31536000;
const INFINITE_CACHE = 0xfffffffe;
const MIDDLEWARE_FILENAME = 'middleware';
const MIDDLEWARE_LOCATION_REGEXP = `(?:src/)?${MIDDLEWARE_FILENAME}`;
const PROXY_FILENAME = 'proxy';
const PROXY_LOCATION_REGEXP = `(?:src/)?${PROXY_FILENAME}`;
const INSTRUMENTATION_HOOK_FILENAME = 'instrumentation';
const PAGES_DIR_ALIAS = 'private-next-pages';
const DOT_NEXT_ALIAS = 'private-dot-next';
const ROOT_DIR_ALIAS = 'private-next-root-dir';
const APP_DIR_ALIAS = 'private-next-app-dir';
const RSC_MOD_REF_PROXY_ALIAS = 'private-next-rsc-mod-ref-proxy';
const RSC_ACTION_VALIDATE_ALIAS = 'private-next-rsc-action-validate';
const RSC_ACTION_PROXY_ALIAS = 'private-next-rsc-server-reference';
const RSC_CACHE_WRAPPER_ALIAS = 'private-next-rsc-cache-wrapper';
const RSC_DYNAMIC_IMPORT_WRAPPER_ALIAS = 'private-next-rsc-track-dynamic-import';
const RSC_ACTION_ENCRYPTION_ALIAS = 'private-next-rsc-action-encryption';
const RSC_ACTION_CLIENT_WRAPPER_ALIAS = 'private-next-rsc-action-client-wrapper';
const PUBLIC_DIR_MIDDLEWARE_CONFLICT = `You can not have a '_next' folder inside of your public folder. This conflicts with the internal '/_next' route. https://nextjs.org/docs/messages/public-next-folder-conflict`;
const SSG_GET_INITIAL_PROPS_CONFLICT = `You can not use getInitialProps with getStaticProps. To use SSG, please remove your getInitialProps`;
const SERVER_PROPS_GET_INIT_PROPS_CONFLICT = `You can not use getInitialProps with getServerSideProps. Please remove getInitialProps.`;
const SERVER_PROPS_SSG_CONFLICT = `You can not use getStaticProps or getStaticPaths with getServerSideProps. To use SSG, please remove getServerSideProps`;
const STATIC_STATUS_PAGE_GET_INITIAL_PROPS_ERROR = `can not have getInitialProps/getServerSideProps, https://nextjs.org/docs/messages/404-get-initial-props`;
const SERVER_PROPS_EXPORT_ERROR = `pages with \`getServerSideProps\` can not be exported. See more info here: https://nextjs.org/docs/messages/gssp-export`;
const GSP_NO_RETURNED_VALUE = 'Your `getStaticProps` function did not return an object. Did you forget to add a `return`?';
const GSSP_NO_RETURNED_VALUE = 'Your `getServerSideProps` function did not return an object. Did you forget to add a `return`?';
const UNSTABLE_REVALIDATE_RENAME_ERROR = 'The `unstable_revalidate` property is available for general use.\n' + 'Please use `revalidate` instead.';
const GSSP_COMPONENT_MEMBER_ERROR = `can not be attached to a page's component and must be exported from the page. See more info here: https://nextjs.org/docs/messages/gssp-component-member`;
const NON_STANDARD_NODE_ENV = `You are using a non-standard "NODE_ENV" value in your environment. This creates inconsistencies in the project and is strongly advised against. Read more: https://nextjs.org/docs/messages/non-standard-node-env`;
const SSG_FALLBACK_EXPORT_ERROR = `Pages with \`fallback\` enabled in \`getStaticPaths\` can not be exported. See more info here: https://nextjs.org/docs/messages/ssg-fallback-true-export`;
const ESLINT_DEFAULT_DIRS = [
'app',
'pages',
'components',
'lib',
'src'
];
const SERVER_RUNTIME = {
edge: 'edge',
experimentalEdge: 'experimental-edge',
nodejs: 'nodejs'
};
const WEB_SOCKET_MAX_RECONNECTIONS = 12;
/**
* The names of the webpack layers. These layers are the primitives for the
* webpack chunks.
*/ const WEBPACK_LAYERS_NAMES = {
/**
* The layer for the shared code between the client and server bundles.
*/ shared: 'shared',
/**
* The layer for server-only runtime and picking up `react-server` export conditions.
* Including app router RSC pages and app router custom routes and metadata routes.
*/ reactServerComponents: 'rsc',
/**
* Server Side Rendering layer for app (ssr).
*/ serverSideRendering: 'ssr',
/**
* The browser client bundle layer for actions.
*/ actionBrowser: 'action-browser',
/**
* The Node.js bundle layer for the API routes.
*/ apiNode: 'api-node',
/**
* The Edge Lite bundle layer for the API routes.
*/ apiEdge: 'api-edge',
/**
* The layer for the middleware code.
*/ middleware: 'middleware',
/**
* The layer for the instrumentation hooks.
*/ instrument: 'instrument',
/**
* The layer for assets on the edge.
*/ edgeAsset: 'edge-asset',
/**
* The browser client bundle layer for App directory.
*/ appPagesBrowser: 'app-pages-browser',
/**
* The browser client bundle layer for Pages directory.
*/ pagesDirBrowser: 'pages-dir-browser',
/**
* The Edge Lite bundle layer for Pages directory.
*/ pagesDirEdge: 'pages-dir-edge',
/**
* The Node.js bundle layer for Pages directory.
*/ pagesDirNode: 'pages-dir-node'
};
const WEBPACK_LAYERS = {
...WEBPACK_LAYERS_NAMES,
GROUP: {
builtinReact: [
WEBPACK_LAYERS_NAMES.reactServerComponents,
WEBPACK_LAYERS_NAMES.actionBrowser
],
serverOnly: [
WEBPACK_LAYERS_NAMES.reactServerComponents,
WEBPACK_LAYERS_NAMES.actionBrowser,
WEBPACK_LAYERS_NAMES.instrument,
WEBPACK_LAYERS_NAMES.middleware
],
neutralTarget: [
// pages api
WEBPACK_LAYERS_NAMES.apiNode,
WEBPACK_LAYERS_NAMES.apiEdge
],
clientOnly: [
WEBPACK_LAYERS_NAMES.serverSideRendering,
WEBPACK_LAYERS_NAMES.appPagesBrowser
],
bundled: [
WEBPACK_LAYERS_NAMES.reactServerComponents,
WEBPACK_LAYERS_NAMES.actionBrowser,
WEBPACK_LAYERS_NAMES.serverSideRendering,
WEBPACK_LAYERS_NAMES.appPagesBrowser,
WEBPACK_LAYERS_NAMES.shared,
WEBPACK_LAYERS_NAMES.instrument,
WEBPACK_LAYERS_NAMES.middleware
],
appPages: [
// app router pages and layouts
WEBPACK_LAYERS_NAMES.reactServerComponents,
WEBPACK_LAYERS_NAMES.serverSideRendering,
WEBPACK_LAYERS_NAMES.appPagesBrowser,
WEBPACK_LAYERS_NAMES.actionBrowser
]
}
};
const WEBPACK_RESOURCE_QUERIES = {
edgeSSREntry: '__next_edge_ssr_entry__',
metadata: '__next_metadata__',
metadataRoute: '__next_metadata_route__',
metadataImageMeta: '__next_metadata_image_meta__'
};
//# sourceMappingURL=constants.js.map

View File

@@ -1,67 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "createClientRouterFilter", {
enumerable: true,
get: function() {
return createClientRouterFilter;
}
});
const _bloomfilter = require("../shared/lib/bloom-filter");
const _utils = require("../shared/lib/router/utils");
const _removetrailingslash = require("../shared/lib/router/utils/remove-trailing-slash");
const _trytoparsepath = require("./try-to-parse-path");
const _interceptionroutes = require("../shared/lib/router/utils/interception-routes");
function createClientRouterFilter(paths, redirects, allowedErrorRate) {
const staticPaths = new Set();
const dynamicPaths = new Set();
for (let path of paths){
if ((0, _utils.isDynamicRoute)(path)) {
if ((0, _interceptionroutes.isInterceptionRouteAppPath)(path)) {
path = (0, _interceptionroutes.extractInterceptionRouteInformation)(path).interceptedRoute;
}
let subPath = '';
const pathParts = path.split('/');
// start at 1 since we split on '/' and the path starts
// with this so the first entry is an empty string
for(let i = 1; i < pathParts.length; i++){
const curPart = pathParts[i];
if (curPart.startsWith('[')) {
break;
}
subPath = `${subPath}/${curPart}`;
}
if (subPath) {
dynamicPaths.add(subPath);
}
} else {
staticPaths.add(path);
}
}
for (const redirect of redirects){
const { source } = redirect;
const path = (0, _removetrailingslash.removeTrailingSlash)(source);
let tokens = [];
try {
tokens = (0, _trytoparsepath.tryToParsePath)(source).tokens || [];
} catch {}
if (tokens.every((token)=>typeof token === 'string')) {
// only include static redirects initially
staticPaths.add(path);
}
}
const staticFilter = _bloomfilter.BloomFilter.from([
...staticPaths
], allowedErrorRate);
const dynamicFilter = _bloomfilter.BloomFilter.from([
...dynamicPaths
], allowedErrorRate);
const data = {
staticFilter: staticFilter.export(),
dynamicFilter: dynamicFilter.export()
};
return data;
}
//# sourceMappingURL=create-client-router-filter.js.map

View File

@@ -1 +0,0 @@
["geist"]

View File

@@ -1,32 +0,0 @@
/**
* A `Promise.withResolvers` implementation that exposes the `resolve` and
* `reject` functions on a `Promise`.
*
* @see https://tc39.es/proposal-promise-with-resolvers/
*/ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "DetachedPromise", {
enumerable: true,
get: function() {
return DetachedPromise;
}
});
class DetachedPromise {
constructor(){
let resolve;
let reject;
// Create the promise and assign the resolvers to the object.
this.promise = new Promise((res, rej)=>{
resolve = res;
reject = rej;
});
// We know that resolvers is defined because the Promise constructor runs
// synchronously.
this.resolve = resolve;
this.reject = reject;
}
}
//# sourceMappingURL=detached-promise.js.map

View File

@@ -1,51 +0,0 @@
// the minimum number of operations required to convert string a to string b.
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "detectTypo", {
enumerable: true,
get: function() {
return detectTypo;
}
});
function minDistance(a, b, threshold) {
const m = a.length;
const n = b.length;
if (m < n) {
return minDistance(b, a, threshold);
}
if (n === 0) {
return m;
}
let previousRow = Array.from({
length: n + 1
}, (_, i)=>i);
for(let i = 0; i < m; i++){
const s1 = a[i];
let currentRow = [
i + 1
];
for(let j = 0; j < n; j++){
const s2 = b[j];
const insertions = previousRow[j + 1] + 1;
const deletions = currentRow[j] + 1;
const substitutions = previousRow[j] + Number(s1 !== s2);
currentRow.push(Math.min(insertions, deletions, substitutions));
}
previousRow = currentRow;
}
return previousRow[previousRow.length - 1];
}
function detectTypo(input, options, threshold = 2) {
const potentialTypos = options.map((o)=>({
option: o,
distance: minDistance(o, input, threshold)
})).filter(({ distance })=>distance <= threshold && distance > 0).sort((a, b)=>a.distance - b.distance);
if (potentialTypos.length) {
return potentialTypos[0].option;
}
return null;
}
//# sourceMappingURL=detect-typo.js.map

View File

@@ -1,183 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
downloadNativeNextSwc: null,
downloadWasmSwc: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
downloadNativeNextSwc: function() {
return downloadNativeNextSwc;
},
downloadWasmSwc: function() {
return downloadWasmSwc;
}
});
const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
const _log = /*#__PURE__*/ _interop_require_wildcard(require("../build/output/log"));
const _tar = require("next/dist/compiled/tar");
const _getregistry = require("./helpers/get-registry");
const _getcachedirectory = require("./helpers/get-cache-directory");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function _getRequireWildcardCache(nodeInterop) {
if (typeof WeakMap !== "function") return null;
var cacheBabelInterop = new WeakMap();
var cacheNodeInterop = new WeakMap();
return (_getRequireWildcardCache = function(nodeInterop) {
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
})(nodeInterop);
}
function _interop_require_wildcard(obj, nodeInterop) {
if (!nodeInterop && obj && obj.__esModule) {
return obj;
}
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
return {
default: obj
};
}
var cache = _getRequireWildcardCache(nodeInterop);
if (cache && cache.has(obj)) {
return cache.get(obj);
}
var newObj = {
__proto__: null
};
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
for(var key in obj){
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
if (desc && (desc.get || desc.set)) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
newObj.default = obj;
if (cache) {
cache.set(obj, newObj);
}
return newObj;
}
const { WritableStream } = require('node:stream/web');
const MAX_VERSIONS_TO_CACHE = 8;
async function extractBinary(outputDirectory, pkgName, tarFileName) {
const cacheDirectory = (0, _getcachedirectory.getCacheDirectory)('next-swc', process.env['NEXT_SWC_PATH']);
const extractFromTar = ()=>(0, _tar.x)({
file: _path.default.join(cacheDirectory, tarFileName),
cwd: outputDirectory,
strip: 1
});
if (!_fs.default.existsSync(_path.default.join(cacheDirectory, tarFileName))) {
_log.info(`Downloading swc package ${pkgName}... to ${cacheDirectory}`);
await _fs.default.promises.mkdir(cacheDirectory, {
recursive: true
});
const tempFile = _path.default.join(cacheDirectory, `${tarFileName}.temp-${Date.now()}`);
const registry = (0, _getregistry.getRegistry)();
const downloadUrl = `${registry}${pkgName}/-/${tarFileName}`;
await fetch(downloadUrl).then((res)=>{
const { ok, body } = res;
if (!ok || !body) {
_log.error(`Failed to download swc package from ${downloadUrl}`);
}
if (!ok) {
throw Object.defineProperty(new Error(`request failed with status ${res.status}`), "__NEXT_ERROR_CODE", {
value: "E109",
enumerable: false,
configurable: true
});
}
if (!body) {
throw Object.defineProperty(new Error('request failed with empty body'), "__NEXT_ERROR_CODE", {
value: "E143",
enumerable: false,
configurable: true
});
}
const cacheWriteStream = _fs.default.createWriteStream(tempFile);
return body.pipeTo(new WritableStream({
write (chunk) {
return new Promise((resolve, reject)=>cacheWriteStream.write(chunk, (error)=>{
if (error) {
reject(error);
return;
}
resolve();
}));
},
close () {
return new Promise((resolve, reject)=>cacheWriteStream.close((error)=>{
if (error) {
reject(error);
return;
}
resolve();
}));
}
}));
});
await _fs.default.promises.access(tempFile) // ensure the temp file existed
;
await _fs.default.promises.rename(tempFile, _path.default.join(cacheDirectory, tarFileName));
} else {
_log.info(`Using cached swc package ${pkgName}...`);
}
await extractFromTar();
const cacheFiles = await _fs.default.promises.readdir(cacheDirectory);
if (cacheFiles.length > MAX_VERSIONS_TO_CACHE) {
cacheFiles.sort((a, b)=>{
if (a.length < b.length) return -1;
return a.localeCompare(b);
});
// prune oldest versions in cache
for(let i = 0; i++; i < cacheFiles.length - MAX_VERSIONS_TO_CACHE){
await _fs.default.promises.unlink(_path.default.join(cacheDirectory, cacheFiles[i])).catch(()=>{});
}
}
}
async function downloadNativeNextSwc(version, bindingsDirectory, triplesABI) {
for (const triple of triplesABI){
const pkgName = `@next/swc-${triple}`;
const tarFileName = `${pkgName.substring(6)}-${version}.tgz`;
const outputDirectory = _path.default.join(bindingsDirectory, pkgName);
if (_fs.default.existsSync(outputDirectory)) {
// if the package is already downloaded a different
// failure occurred than not being present
return;
}
await _fs.default.promises.mkdir(outputDirectory, {
recursive: true
});
await extractBinary(outputDirectory, pkgName, tarFileName);
}
}
async function downloadWasmSwc(version, wasmDirectory, variant = 'nodejs') {
const pkgName = `@next/swc-wasm-${variant}`;
const tarFileName = `${pkgName.substring(6)}-${version}.tgz`;
const outputDirectory = _path.default.join(wasmDirectory, pkgName);
if (_fs.default.existsSync(outputDirectory)) {
// if the package is already downloaded a different
// failure occurred than not being present
return;
}
await _fs.default.promises.mkdir(outputDirectory, {
recursive: true
});
await extractBinary(outputDirectory, pkgName, tarFileName);
}
//# sourceMappingURL=download-swc.js.map

View File

@@ -1,42 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
createDigestWithErrorCode: null,
extractNextErrorCode: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
createDigestWithErrorCode: function() {
return createDigestWithErrorCode;
},
extractNextErrorCode: function() {
return extractNextErrorCode;
}
});
const ERROR_CODE_DELIMITER = '@';
const createDigestWithErrorCode = (thrownValue, originalDigest)=>{
if (typeof thrownValue === 'object' && thrownValue !== null && '__NEXT_ERROR_CODE' in thrownValue) {
return `${originalDigest}${ERROR_CODE_DELIMITER}${thrownValue.__NEXT_ERROR_CODE}`;
}
return originalDigest;
};
const extractNextErrorCode = (error)=>{
if (typeof error === 'object' && error !== null && '__NEXT_ERROR_CODE' in error && typeof error.__NEXT_ERROR_CODE === 'string') {
return error.__NEXT_ERROR_CODE;
}
if (typeof error === 'object' && error !== null && 'digest' in error && typeof error.digest === 'string') {
const segments = error.digest.split(ERROR_CODE_DELIMITER);
const errorCode = segments.find((segment)=>segment.startsWith('E'));
return errorCode;
}
return undefined;
};
//# sourceMappingURL=error-telemetry-utils.js.map

View File

@@ -1,100 +0,0 @@
/**
* Describes the different fallback modes that a given page can have.
*/ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
FallbackMode: null,
fallbackModeToFallbackField: null,
parseFallbackField: null,
parseStaticPathsResult: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
FallbackMode: function() {
return FallbackMode;
},
fallbackModeToFallbackField: function() {
return fallbackModeToFallbackField;
},
parseFallbackField: function() {
return parseFallbackField;
},
parseStaticPathsResult: function() {
return parseStaticPathsResult;
}
});
var FallbackMode = /*#__PURE__*/ function(FallbackMode) {
/**
* A BLOCKING_STATIC_RENDER fallback will block the request until the page is
* generated. No fallback page will be rendered, and users will have to wait
* to render the page.
*/ FallbackMode["BLOCKING_STATIC_RENDER"] = "BLOCKING_STATIC_RENDER";
/**
* When set to PRERENDER, a fallback page will be sent to users in place of
* forcing them to wait for the page to be generated. This allows the user to
* see a rendered page earlier.
*/ FallbackMode["PRERENDER"] = "PRERENDER";
/**
* When set to NOT_FOUND, pages that are not already prerendered will result
* in a not found response.
*/ FallbackMode["NOT_FOUND"] = "NOT_FOUND";
return FallbackMode;
}({});
function parseFallbackField(fallbackField) {
if (typeof fallbackField === 'string') {
return "PRERENDER";
} else if (fallbackField === null) {
return "BLOCKING_STATIC_RENDER";
} else if (fallbackField === false) {
return "NOT_FOUND";
} else if (fallbackField === undefined) {
return undefined;
} else {
throw Object.defineProperty(new Error(`Invalid fallback option: ${fallbackField}. Fallback option must be a string, null, undefined, or false.`), "__NEXT_ERROR_CODE", {
value: "E285",
enumerable: false,
configurable: true
});
}
}
function fallbackModeToFallbackField(fallback, page) {
switch(fallback){
case "BLOCKING_STATIC_RENDER":
return null;
case "NOT_FOUND":
return false;
case "PRERENDER":
if (!page) {
throw Object.defineProperty(new Error(`Invariant: expected a page to be provided when fallback mode is "${fallback}"`), "__NEXT_ERROR_CODE", {
value: "E422",
enumerable: false,
configurable: true
});
}
return page;
default:
throw Object.defineProperty(new Error(`Invalid fallback mode: ${fallback}`), "__NEXT_ERROR_CODE", {
value: "E254",
enumerable: false,
configurable: true
});
}
}
function parseStaticPathsResult(result) {
if (result === true) {
return "PRERENDER";
} else if (result === 'blocking') {
return "BLOCKING_STATIC_RENDER";
} else {
return "NOT_FOUND";
}
}
//# sourceMappingURL=fallback.js.map

View File

@@ -1,14 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "FatalError", {
enumerable: true,
get: function() {
return FatalError;
}
});
class FatalError extends Error {
}
//# sourceMappingURL=fatal-error.js.map

View File

@@ -1,53 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
FileType: null,
fileExists: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
FileType: function() {
return FileType;
},
fileExists: function() {
return fileExists;
}
});
const _fs = require("fs");
const _iserror = /*#__PURE__*/ _interop_require_default(require("./is-error"));
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
var FileType = /*#__PURE__*/ function(FileType) {
FileType["File"] = "file";
FileType["Directory"] = "directory";
return FileType;
}({});
async function fileExists(fileName, type) {
try {
if (type === "file") {
const stats = await _fs.promises.stat(fileName);
return stats.isFile();
} else if (type === "directory") {
const stats = await _fs.promises.stat(fileName);
return stats.isDirectory();
}
return (0, _fs.existsSync)(fileName);
} catch (err) {
if ((0, _iserror.default)(err) && (err.code === 'ENOENT' || err.code === 'ENAMETOOLONG')) {
return false;
}
throw err;
}
}
//# sourceMappingURL=file-exists.js.map

View File

@@ -1,102 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
findConfig: null,
findConfigPath: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
findConfig: function() {
return findConfig;
},
findConfigPath: function() {
return findConfigPath;
}
});
const _findup = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/find-up"));
const _promises = require("fs/promises");
const _json5 = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/json5"));
const _url = require("url");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function findConfigPath(dir, key) {
// If we didn't find the configuration in `package.json`, we should look for
// known filenames.
return (0, _findup.default)([
`.${key}rc.json`,
`${key}.config.json`,
`.${key}rc.js`,
`${key}.config.js`,
`${key}.config.mjs`,
`${key}.config.cjs`
], {
cwd: dir
});
}
async function findConfig(directory, key, _returnFile) {
// `package.json` configuration always wins. Let's check that first.
const packageJsonPath = await (0, _findup.default)('package.json', {
cwd: directory
});
let isESM = false;
if (packageJsonPath) {
try {
const packageJsonStr = await (0, _promises.readFile)(packageJsonPath, 'utf8');
const packageJson = JSON.parse(packageJsonStr);
if (typeof packageJson !== 'object') {
throw new Error() // Stop processing and continue
;
}
if (packageJson.type === 'module') {
isESM = true;
}
if (packageJson[key] != null && typeof packageJson[key] === 'object') {
return packageJson[key];
}
} catch {
// Ignore error and continue
}
}
const filePath = await findConfigPath(directory, key);
const esmImport = (path)=>{
// Skip mapping to absolute url with pathToFileURL on windows if it's jest
// https://github.com/nodejs/node/issues/31710#issuecomment-587345749
if (process.platform === 'win32' && !process.env.JEST_WORKER_ID) {
// on windows import("C:\\path\\to\\file") is not valid, so we need to
// use file:// URLs
return import((0, _url.pathToFileURL)(path).toString());
} else {
return import(path);
}
};
if (filePath) {
if (filePath.endsWith('.js')) {
if (isESM) {
return (await esmImport(filePath)).default;
} else {
return require(filePath);
}
} else if (filePath.endsWith('.mjs')) {
return (await esmImport(filePath)).default;
} else if (filePath.endsWith('.cjs')) {
return require(filePath);
}
// We load JSON contents with JSON5 to allow users to comment in their
// configuration file. This pattern was popularized by TypeScript.
const fileContents = await (0, _promises.readFile)(filePath, 'utf8');
return _json5.default.parse(fileContents);
}
return null;
}
//# sourceMappingURL=find-config.js.map

View File

@@ -1,65 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
findDir: null,
findPagesDir: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
findDir: function() {
return findDir;
},
findPagesDir: function() {
return findPagesDir;
}
});
const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function findDir(dir, name) {
// prioritize ./${name} over ./src/${name}
let curDir = _path.default.join(dir, name);
if (_fs.default.existsSync(curDir)) return curDir;
curDir = _path.default.join(dir, 'src', name);
if (_fs.default.existsSync(curDir)) return curDir;
return null;
}
function findPagesDir(dir) {
const pagesDir = findDir(dir, 'pages') || undefined;
const appDir = findDir(dir, 'app') || undefined;
if (appDir == null && pagesDir == null) {
throw Object.defineProperty(new Error("> Couldn't find any `pages` or `app` directory. Please create one under the project root"), "__NEXT_ERROR_CODE", {
value: "E144",
enumerable: false,
configurable: true
});
}
if (pagesDir && appDir) {
const pagesParent = _path.default.dirname(pagesDir);
const appParent = _path.default.dirname(appDir);
if (pagesParent !== appParent) {
throw Object.defineProperty(new Error('> `pages` and `app` directories should be under the same folder'), "__NEXT_ERROR_CODE", {
value: "E801",
enumerable: false,
configurable: true
});
}
}
return {
pagesDir,
appDir
};
}
//# sourceMappingURL=find-pages-dir.js.map

View File

@@ -1,126 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
findRootDirAndLockFiles: null,
warnDuplicatedLockFiles: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
findRootDirAndLockFiles: function() {
return findRootDirAndLockFiles;
},
warnDuplicatedLockFiles: function() {
return warnDuplicatedLockFiles;
}
});
const _path = require("path");
const _findup = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/find-up"));
const _log = /*#__PURE__*/ _interop_require_wildcard(require("../build/output/log"));
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function _getRequireWildcardCache(nodeInterop) {
if (typeof WeakMap !== "function") return null;
var cacheBabelInterop = new WeakMap();
var cacheNodeInterop = new WeakMap();
return (_getRequireWildcardCache = function(nodeInterop) {
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
})(nodeInterop);
}
function _interop_require_wildcard(obj, nodeInterop) {
if (!nodeInterop && obj && obj.__esModule) {
return obj;
}
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
return {
default: obj
};
}
var cache = _getRequireWildcardCache(nodeInterop);
if (cache && cache.has(obj)) {
return cache.get(obj);
}
var newObj = {
__proto__: null
};
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
for(var key in obj){
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
if (desc && (desc.get || desc.set)) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
newObj.default = obj;
if (cache) {
cache.set(obj, newObj);
}
return newObj;
}
function findWorkRoot(cwd) {
// Find-up evaluates the list of files at each level.
// For pnpm-workspace.yaml we first want to look up before searching for lockfiles as those can be included in the application directory by accident.
const pnpmWorkspaceFile = _findup.default.sync('pnpm-workspace.yaml', {
cwd
});
if (pnpmWorkspaceFile) {
return pnpmWorkspaceFile;
}
return _findup.default.sync([
'pnpm-lock.yaml',
'package-lock.json',
'yarn.lock',
'bun.lock',
'bun.lockb'
], {
cwd
});
}
function findRootDirAndLockFiles(cwd) {
const lockFile = findWorkRoot(cwd);
if (!lockFile) return {
lockFiles: [],
rootDir: cwd
};
const lockFiles = [
lockFile
];
while(true){
const lastLockFile = lockFiles[lockFiles.length - 1];
const currentDir = (0, _path.dirname)(lastLockFile);
const parentDir = (0, _path.dirname)(currentDir);
// dirname('/')==='/' so if we happen to reach the FS root (as might happen in a container we need to quit to avoid looping forever
if (parentDir === currentDir) break;
const newLockFile = findWorkRoot(parentDir);
if (!newLockFile) break;
lockFiles.push(newLockFile);
}
return {
lockFiles,
rootDir: (0, _path.dirname)(lockFiles[lockFiles.length - 1])
};
}
function warnDuplicatedLockFiles(lockFiles) {
if (lockFiles.length > 1) {
const additionalLockFiles = lockFiles.slice(0, -1).map((str)=>`\n * ${str}`).join('');
if (process.env.TURBOPACK) {
_log.warnOnce(`Warning: Next.js inferred your workspace root, but it may not be correct.\n` + ` We detected multiple lockfiles and selected the directory of ${lockFiles[lockFiles.length - 1]} as the root directory.\n` + ` To silence this warning, set \`turbopack.root\` in your Next.js config, or consider ` + `removing one of the lockfiles if it's not needed.\n` + ` See https://nextjs.org/docs/app/api-reference/config/next-config-js/turbopack#root-directory for more information.\n` + ` Detected additional lockfiles: ${additionalLockFiles}\n`);
} else {
_log.warnOnce(`Warning: Next.js inferred your workspace root, but it may not be correct.\n` + ` We detected multiple lockfiles and selected the directory of ${lockFiles[lockFiles.length - 1]} as the root directory.\n` + ` To silence this warning, set \`outputFileTracingRoot\` in your Next.js config, or consider ` + `removing one of the lockfiles if it's not needed.\n` + ` See https://nextjs.org/docs/app/api-reference/config/next-config-js/output#caveats for more information.\n` + ` Detected additional lockfiles: ${additionalLockFiles}\n`);
}
}
}
//# sourceMappingURL=find-root.js.map

View File

@@ -1,84 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "formatCliHelpOutput", {
enumerable: true,
get: function() {
return formatCliHelpOutput;
}
});
const _picocolors = require("../lib/picocolors");
// Copy-pasted from Commander's Help class -> formatHelp().
// TL;DR, we're overriding the built-in help to add a few niceties.
// Link: https://github.com/tj/commander.js/blob/master/lib/help.js
const formatCliHelpOutput = (cmd, helper)=>{
const termWidth = helper.padWidth(cmd, helper);
const helpWidth = helper.helpWidth || 80;
const itemIndentWidth = 2;
const itemSeparatorWidth = 2 // between term and description
;
function formatItem(term, description) {
let value = term;
if (description) {
if (term === 'directory') {
value = `[${term}]`;
}
const fullText = `${value.padEnd(termWidth + itemSeparatorWidth)}${description}`;
return helper.wrap(fullText, helpWidth - itemIndentWidth, termWidth + itemSeparatorWidth);
}
return term;
}
function formatList(textArray) {
return textArray.join('\n').replace(/^/gm, ' '.repeat(itemIndentWidth));
}
// Usage
let output = [
`${(0, _picocolors.bold)('Usage:')} ${helper.commandUsage(cmd)}`,
''
];
// Description
const commandDescription = helper.commandDescription(cmd);
if (commandDescription.length > 0) {
output = output.concat([
helper.wrap(commandDescription, helpWidth, 0),
''
]);
}
// Arguments
const argumentList = helper.visibleArguments(cmd).map((argument)=>{
return formatItem(helper.argumentTerm(argument), helper.argumentDescription(argument));
});
if (argumentList.length > 0) {
output = output.concat([
`${(0, _picocolors.bold)('Arguments:')}`,
formatList(argumentList),
''
]);
}
// Options
const optionList = helper.visibleOptions(cmd).map((option)=>{
return formatItem(helper.optionTerm(option), helper.optionDescription(option));
});
if (optionList.length > 0) {
output = output.concat([
`${(0, _picocolors.bold)('Options:')}`,
formatList(optionList),
''
]);
}
// Commands
const commandList = helper.visibleCommands(cmd).map((subCmd)=>{
return formatItem(helper.subcommandTerm(subCmd), helper.subcommandDescription(subCmd));
});
if (commandList.length > 0) {
output = output.concat([
`${(0, _picocolors.bold)('Commands:')}`,
formatList(commandList),
''
]);
}
return output.join('\n');
};
//# sourceMappingURL=format-cli-help-output.js.map

View File

@@ -1,24 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "formatDynamicImportPath", {
enumerable: true,
get: function() {
return formatDynamicImportPath;
}
});
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
const _url = require("url");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
const formatDynamicImportPath = (dir, filePath)=>{
const absoluteFilePath = _path.default.isAbsolute(filePath) ? filePath : _path.default.join(dir, filePath);
const formattedFilePath = (0, _url.pathToFileURL)(absoluteFilePath).toString();
return formattedFilePath;
};
//# sourceMappingURL=format-dynamic-import-path.js.map

View File

@@ -1,75 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
formatServerError: null,
getStackWithoutErrorMessage: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
formatServerError: function() {
return formatServerError;
},
getStackWithoutErrorMessage: function() {
return getStackWithoutErrorMessage;
}
});
const invalidServerComponentReactHooks = [
'useDeferredValue',
'useEffect',
'useEffectEvent',
'useImperativeHandle',
'useInsertionEffect',
'useLayoutEffect',
'useReducer',
'useRef',
'useState',
'useSyncExternalStore',
'useTransition',
'experimental_useOptimistic',
'useOptimistic'
];
function setMessage(error, message) {
error.message = message;
if (error.stack) {
const lines = error.stack.split('\n');
lines[0] = message;
error.stack = lines.join('\n');
}
}
function getStackWithoutErrorMessage(error) {
const stack = error.stack;
if (!stack) return '';
return stack.replace(/^[^\n]*\n/, '');
}
function formatServerError(error) {
if (typeof (error == null ? void 0 : error.message) !== 'string') return;
if (error.message.includes('Class extends value undefined is not a constructor or null')) {
const addedMessage = 'This might be caused by a React Class Component being rendered in a Server Component, React Class Components only works in Client Components. Read more: https://nextjs.org/docs/messages/class-component-in-server-component';
// If this error instance already has the message, don't add it again
if (error.message.includes(addedMessage)) return;
setMessage(error, `${error.message}
${addedMessage}`);
return;
}
if (error.message.includes('createContext is not a function')) {
setMessage(error, 'createContext only works in Client Components. Add the "use client" directive at the top of the file to use it. Read more: https://nextjs.org/docs/messages/context-in-server-component');
return;
}
for (const clientHook of invalidServerComponentReactHooks){
const regex = new RegExp(`\\b${clientHook}\\b.*is not a function`);
if (regex.test(error.message)) {
setMessage(error, `${clientHook} only works in Client Components. Add the "use client" directive at the top of the file to use it. Read more: https://nextjs.org/docs/messages/react-client-hook-in-server-component`);
return;
}
}
}
//# sourceMappingURL=format-server-error.js.map

View File

@@ -1,62 +0,0 @@
'use client';
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
MetadataBoundary: null,
OutletBoundary: null,
RootLayoutBoundary: null,
ViewportBoundary: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
MetadataBoundary: function() {
return MetadataBoundary;
},
OutletBoundary: function() {
return OutletBoundary;
},
RootLayoutBoundary: function() {
return RootLayoutBoundary;
},
ViewportBoundary: function() {
return ViewportBoundary;
}
});
const _boundaryconstants = require("./boundary-constants");
// We use a namespace object to allow us to recover the name of the function
// at runtime even when production bundling/minification is used.
const NameSpace = {
[_boundaryconstants.METADATA_BOUNDARY_NAME]: function({ children }) {
return children;
},
[_boundaryconstants.VIEWPORT_BOUNDARY_NAME]: function({ children }) {
return children;
},
[_boundaryconstants.OUTLET_BOUNDARY_NAME]: function({ children }) {
return children;
},
[_boundaryconstants.ROOT_LAYOUT_BOUNDARY_NAME]: function({ children }) {
return children;
}
};
const MetadataBoundary = // We use slice(0) to trick the bundler into not inlining/minifying the function
// so it retains the name inferred from the namespace object
NameSpace[_boundaryconstants.METADATA_BOUNDARY_NAME.slice(0)];
const ViewportBoundary = // We use slice(0) to trick the bundler into not inlining/minifying the function
// so it retains the name inferred from the namespace object
NameSpace[_boundaryconstants.VIEWPORT_BOUNDARY_NAME.slice(0)];
const OutletBoundary = // We use slice(0) to trick the bundler into not inlining/minifying the function
// so it retains the name inferred from the namespace object
NameSpace[_boundaryconstants.OUTLET_BOUNDARY_NAME.slice(0)];
const RootLayoutBoundary = // We use slice(0) to trick the bundler into not inlining/minifying the function
// so it retains the name inferred from the namespace object
NameSpace[_boundaryconstants.ROOT_LAYOUT_BOUNDARY_NAME.slice(0)];
//# sourceMappingURL=boundary-components.js.map

View File

@@ -1,36 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
METADATA_BOUNDARY_NAME: null,
OUTLET_BOUNDARY_NAME: null,
ROOT_LAYOUT_BOUNDARY_NAME: null,
VIEWPORT_BOUNDARY_NAME: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
METADATA_BOUNDARY_NAME: function() {
return METADATA_BOUNDARY_NAME;
},
OUTLET_BOUNDARY_NAME: function() {
return OUTLET_BOUNDARY_NAME;
},
ROOT_LAYOUT_BOUNDARY_NAME: function() {
return ROOT_LAYOUT_BOUNDARY_NAME;
},
VIEWPORT_BOUNDARY_NAME: function() {
return VIEWPORT_BOUNDARY_NAME;
}
});
const METADATA_BOUNDARY_NAME = '__next_metadata_boundary__';
const VIEWPORT_BOUNDARY_NAME = '__next_viewport_boundary__';
const OUTLET_BOUNDARY_NAME = '__next_outlet_boundary__';
const ROOT_LAYOUT_BOUNDARY_NAME = '__next_root_layout_boundary__';
//# sourceMappingURL=boundary-constants.js.map

View File

@@ -1,87 +0,0 @@
/*
MIT License
Copyright (c) 2015 - present Microsoft Corporation
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/microsoft/vscode/blob/f860fcf11022f10a992440fd54c6e45674e39617/src/vs/base/node/pfs.ts
// See the LICENSE at the top of the file
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "renameSync", {
enumerable: true,
get: function() {
return renameSync;
}
});
const _nodefs = require("node:fs");
function renameSync(source, target, windowsRetryTimeout = 60000 /* matches graceful-fs */ ) {
if (source === target) {
return; // simulate node.js behaviour here and do a no-op if paths match
}
if (process.platform === 'win32' && typeof windowsRetryTimeout === 'number') {
// On Windows, a rename can fail when either source or target
// is locked by AV software. We do leverage graceful-fs to iron
// out these issues, however in case the target file exists,
// graceful-fs will immediately return without retry for fs.rename().
renameSyncWithRetry(source, target, Date.now(), windowsRetryTimeout);
} else {
(0, _nodefs.renameSync)(source, target);
}
}
function renameSyncWithRetry(source, target, startTime, retryTimeout, attempt = 0) {
try {
return (0, _nodefs.renameSync)(source, target);
} catch (error) {
if (error.code !== 'EACCES' && error.code !== 'EPERM' && error.code !== 'EBUSY') {
throw error // only for errors we think are temporary
;
}
if (Date.now() - startTime >= retryTimeout) {
console.error(`Node.js fs rename failed after ${attempt} retries with error: ${error}`);
throw error // give up after configurable timeout
;
}
if (attempt > 100) {
console.error(`Node.js fs rename failed after ${attempt} retries with error ${error}`);
throw error;
}
if (attempt === 0) {
let abortRetry = false;
try {
const statTarget = (0, _nodefs.statSync)(target);
if (!statTarget.isFile()) {
abortRetry = true // if target is not a file, EPERM error may be raised and we should not attempt to retry
;
}
} catch (e) {
// Ignore
}
if (abortRetry) {
throw error;
}
}
// Attempt again
return renameSyncWithRetry(source, target, startTime, retryTimeout, attempt + 1);
}
}
//# sourceMappingURL=rename.js.map

View File

@@ -1,28 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "writeFileAtomic", {
enumerable: true,
get: function() {
return writeFileAtomic;
}
});
const _fs = require("fs");
const _rename = require("./rename");
function writeFileAtomic(filePath, content) {
const tempPath = filePath + '.tmp.' + Math.random().toString(36).slice(2);
try {
(0, _fs.writeFileSync)(tempPath, content, 'utf-8');
(0, _rename.renameSync)(tempPath, filePath);
} catch (e) {
try {
(0, _fs.unlinkSync)(tempPath);
} catch {
// ignore
}
throw e;
}
}
//# sourceMappingURL=write-atomic.js.map

View File

@@ -1,52 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "generateInterceptionRoutesRewrites", {
enumerable: true,
get: function() {
return generateInterceptionRoutesRewrites;
}
});
const _approuterheaders = require("../client/components/app-router-headers");
const _interceptionroutes = require("../shared/lib/router/utils/interception-routes");
const _routeregex = require("../shared/lib/router/utils/route-regex");
function generateInterceptionRoutesRewrites(appPaths, basePath = '') {
const rewrites = [];
for (const appPath of appPaths){
if ((0, _interceptionroutes.isInterceptionRouteAppPath)(appPath)) {
const { interceptingRoute, interceptedRoute } = (0, _interceptionroutes.extractInterceptionRouteInformation)(appPath);
const destination = (0, _routeregex.getNamedRouteRegex)(basePath + appPath, {
prefixRouteKeys: true
});
const header = (0, _routeregex.getNamedRouteRegex)(interceptingRoute, {
prefixRouteKeys: true,
reference: destination.reference
});
const source = (0, _routeregex.getNamedRouteRegex)(basePath + interceptedRoute, {
prefixRouteKeys: true,
reference: header.reference
});
const headerRegex = header.namedRegex// Strip ^ and $ anchors since matchHas() will add them automatically
.replace(/^\^/, '').replace(/\$$/, '')// Replace matching the `/` with matching any route segment.
.replace(/^\/\(\?:\/\)\?$/, '/.*')// Replace the optional trailing with slash capture group with one that
// will match any descendants.
.replace(/\(\?:\/\)\?$/, '(?:/.*)?');
rewrites.push({
source: source.pathToRegexpPattern,
destination: destination.pathToRegexpPattern,
has: [
{
type: 'header',
key: _approuterheaders.NEXT_URL,
value: headerRegex
}
],
regex: source.namedRegex
});
}
}
return rewrites;
}
//# sourceMappingURL=generate-interception-routes-rewrites.js.map

View File

@@ -1,33 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "getFilesInDir", {
enumerable: true,
get: function() {
return getFilesInDir;
}
});
const _path = require("path");
const _promises = /*#__PURE__*/ _interop_require_default(require("fs/promises"));
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
async function getFilesInDir(path) {
const dir = await _promises.default.opendir(path);
const results = new Set();
for await (const file of dir){
let resolvedFile = file;
if (file.isSymbolicLink()) {
resolvedFile = await _promises.default.stat((0, _path.join)(path, file.name));
}
if (resolvedFile.isFile()) {
results.add(file.name);
}
}
return results;
}
//# sourceMappingURL=get-files-in-dir.js.map

View File

@@ -1,44 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "getNetworkHost", {
enumerable: true,
get: function() {
return getNetworkHost;
}
});
const _os = /*#__PURE__*/ _interop_require_default(require("os"));
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function getNetworkHosts(family) {
const interfaces = _os.default.networkInterfaces();
const hosts = [];
Object.keys(interfaces).forEach((key)=>{
var _interfaces_key;
(_interfaces_key = interfaces[key]) == null ? void 0 : _interfaces_key.filter((networkInterface)=>{
switch(networkInterface.family){
case 'IPv6':
return family === 'IPv6' && networkInterface.scopeid === 0 && networkInterface.address !== '::1';
case 'IPv4':
return family === 'IPv4' && networkInterface.address !== '127.0.0.1';
default:
return false;
}
}).forEach((networkInterface)=>{
if (networkInterface.address) {
hosts.push(networkInterface.address);
}
});
});
return hosts;
}
function getNetworkHost(family) {
const hosts = getNetworkHosts(family);
return hosts[0] ?? null;
}
//# sourceMappingURL=get-network-host.js.map

View File

@@ -1,118 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
getDependencies: null,
getPackageVersion: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
getDependencies: function() {
return getDependencies;
},
getPackageVersion: function() {
return getPackageVersion;
}
});
const _fs = require("fs");
const _findup = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/find-up"));
const _json5 = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/json5"));
const _path = /*#__PURE__*/ _interop_require_wildcard(require("path"));
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function _getRequireWildcardCache(nodeInterop) {
if (typeof WeakMap !== "function") return null;
var cacheBabelInterop = new WeakMap();
var cacheNodeInterop = new WeakMap();
return (_getRequireWildcardCache = function(nodeInterop) {
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
})(nodeInterop);
}
function _interop_require_wildcard(obj, nodeInterop) {
if (!nodeInterop && obj && obj.__esModule) {
return obj;
}
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
return {
default: obj
};
}
var cache = _getRequireWildcardCache(nodeInterop);
if (cache && cache.has(obj)) {
return cache.get(obj);
}
var newObj = {
__proto__: null
};
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
for(var key in obj){
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
if (desc && (desc.get || desc.set)) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
newObj.default = obj;
if (cache) {
cache.set(obj, newObj);
}
return newObj;
}
let cachedDeps;
function getDependencies({ cwd }) {
if (cachedDeps) {
return cachedDeps;
}
return cachedDeps = (async ()=>{
const configurationPath = await (0, _findup.default)('package.json', {
cwd
});
if (!configurationPath) {
return {
dependencies: {},
devDependencies: {}
};
}
const content = await _fs.promises.readFile(configurationPath, 'utf-8');
const packageJson = _json5.default.parse(content);
const { dependencies = {}, devDependencies = {} } = packageJson || {};
return {
dependencies,
devDependencies
};
})();
}
async function getPackageVersion({ cwd, name }) {
const { dependencies, devDependencies } = await getDependencies({
cwd
});
if (!(dependencies[name] || devDependencies[name])) {
return null;
}
const cwd2 = cwd.endsWith(_path.posix.sep) || cwd.endsWith(_path.win32.sep) ? cwd : `${cwd}/`;
try {
const targetPath = require.resolve(`${name}/package.json`, {
paths: [
cwd2
]
});
const targetContent = await _fs.promises.readFile(targetPath, 'utf-8');
return _json5.default.parse(targetContent).version ?? null;
} catch {
return null;
}
}
//# sourceMappingURL=get-package-version.js.map

View File

@@ -1,51 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "getProjectDir", {
enumerable: true,
get: function() {
return getProjectDir;
}
});
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
const _log = require("../build/output/log");
const _detecttypo = require("./detect-typo");
const _realpath = require("./realpath");
const _utils = require("../server/lib/utils");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function getProjectDir(dir, exitOnEnoent = true) {
const resolvedDir = _path.default.resolve(dir || '.');
try {
const realDir = (0, _realpath.realpathSync)(resolvedDir);
if (resolvedDir !== realDir && resolvedDir.toLowerCase() === realDir.toLowerCase()) {
(0, _log.warn)(`Invalid casing detected for project dir, received ${resolvedDir} actual path ${realDir}, see more info here https://nextjs.org/docs/messages/invalid-project-dir-casing`);
}
return realDir;
} catch (err) {
if (err.code === 'ENOENT' && exitOnEnoent) {
if (typeof dir === 'string') {
const detectedTypo = (0, _detecttypo.detectTypo)(dir, [
'build',
'dev',
'info',
'lint',
'start',
'telemetry',
'experimental-test'
]);
if (detectedTypo) {
return (0, _utils.printAndExit)(`"next ${dir}" does not exist. Did you mean "next ${detectedTypo}"?`);
}
}
return (0, _utils.printAndExit)(`Invalid project directory provided, no such directory: ${resolvedDir}`);
}
throw err;
}
}
//# sourceMappingURL=get-project-dir.js.map

View File

@@ -1,49 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "hasNecessaryDependencies", {
enumerable: true,
get: function() {
return hasNecessaryDependencies;
}
});
const _fs = require("fs");
const _resolvefrom = require("./resolve-from");
const _path = require("path");
function hasNecessaryDependencies(baseDir, requiredPackages) {
let resolutions = new Map();
const missingPackages = [];
for (const p of requiredPackages){
try {
const pkgPath = (0, _fs.realpathSync)((0, _resolvefrom.resolveFrom)(baseDir, `${p.pkg}/package.json`));
const pkgDir = (0, _path.dirname)(pkgPath);
resolutions.set((0, _path.join)(p.pkg, 'package.json'), pkgPath);
if (p.exportsRestrict) {
const fileNameToVerify = (0, _path.relative)(p.pkg, p.file);
if (fileNameToVerify) {
const fileToVerify = (0, _path.join)(pkgDir, fileNameToVerify);
if ((0, _fs.existsSync)(fileToVerify)) {
resolutions.set(p.pkg, fileToVerify);
} else {
missingPackages.push(p);
continue;
}
} else {
resolutions.set(p.pkg, pkgPath);
}
} else {
resolutions.set(p.pkg, (0, _resolvefrom.resolveFrom)(baseDir, p.file));
}
} catch (_) {
missingPackages.push(p);
continue;
}
}
return {
resolved: resolutions,
missing: missingPackages
};
}
//# sourceMappingURL=has-necessary-dependencies.js.map

View File

@@ -1,66 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "getCacheDirectory", {
enumerable: true,
get: function() {
return getCacheDirectory;
}
});
const _os = /*#__PURE__*/ _interop_require_default(require("os"));
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function getCacheDirectory(fileDirectory, envPath) {
let result;
if (envPath) {
result = envPath;
} else {
let systemCacheDirectory;
if (process.platform === 'linux') {
systemCacheDirectory = process.env.XDG_CACHE_HOME || _path.default.join(_os.default.homedir(), '.cache');
} else if (process.platform === 'darwin') {
systemCacheDirectory = _path.default.join(_os.default.homedir(), 'Library', 'Caches');
} else if (process.platform === 'win32') {
systemCacheDirectory = process.env.LOCALAPPDATA || _path.default.join(_os.default.homedir(), 'AppData', 'Local');
} else {
/// Attempt to use generic tmp location for un-handled platform
if (!systemCacheDirectory) {
for (const dir of [
_path.default.join(_os.default.homedir(), '.cache'),
_path.default.join(_os.default.tmpdir())
]){
if (_fs.default.existsSync(dir)) {
systemCacheDirectory = dir;
break;
}
}
}
if (!systemCacheDirectory) {
console.error(Object.defineProperty(new Error('Unsupported platform: ' + process.platform), "__NEXT_ERROR_CODE", {
value: "E141",
enumerable: false,
configurable: true
}));
process.exit(0);
}
}
result = _path.default.join(systemCacheDirectory, fileDirectory);
}
if (!_path.default.isAbsolute(result)) {
// It is important to resolve to the absolute path:
// - for unzipping to work correctly;
// - so that registry directory matches between installation and execution.
// INIT_CWD points to the root of `npm/yarn install` and is probably what
// the user meant when typing the relative path.
result = _path.default.resolve(process.env['INIT_CWD'] || process.cwd(), result);
}
return result;
}
//# sourceMappingURL=get-cache-directory.js.map

View File

@@ -1,29 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "getNpxCommand", {
enumerable: true,
get: function() {
return getNpxCommand;
}
});
const _child_process = require("child_process");
const _getpkgmanager = require("./get-pkg-manager");
function getNpxCommand(baseDir) {
const pkgManager = (0, _getpkgmanager.getPkgManager)(baseDir);
let command = 'npx --yes';
if (pkgManager === 'pnpm') {
command = 'pnpm --silent dlx';
} else if (pkgManager === 'yarn') {
try {
(0, _child_process.execSync)('yarn dlx --help', {
stdio: 'ignore'
});
command = 'yarn --quiet dlx';
} catch {}
}
return command;
}
//# sourceMappingURL=get-npx-command.js.map

View File

@@ -1,50 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "getOnline", {
enumerable: true,
get: function() {
return getOnline;
}
});
const _child_process = require("child_process");
const _promises = /*#__PURE__*/ _interop_require_default(require("dns/promises"));
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function getProxy() {
if (process.env.https_proxy) {
return process.env.https_proxy;
}
try {
const httpsProxy = (0, _child_process.execSync)('npm config get https-proxy', {
encoding: 'utf8'
}).trim();
return httpsProxy !== 'null' ? httpsProxy : undefined;
} catch (e) {
return;
}
}
async function getOnline() {
try {
await _promises.default.lookup('registry.yarnpkg.com');
return true;
} catch {
const proxy = getProxy();
if (!proxy) {
return false;
}
try {
const { hostname } = new URL(proxy);
await _promises.default.lookup(hostname);
return true;
} catch {
return false;
}
}
}
//# sourceMappingURL=get-online.js.map

View File

@@ -1,63 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "getPkgManager", {
enumerable: true,
get: function() {
return getPkgManager;
}
});
const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
const _child_process = require("child_process");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function getPkgManager(baseDir) {
try {
for (const { lockFile, packageManager } of [
{
lockFile: 'yarn.lock',
packageManager: 'yarn'
},
{
lockFile: 'pnpm-lock.yaml',
packageManager: 'pnpm'
},
{
lockFile: 'package-lock.json',
packageManager: 'npm'
}
]){
if (_fs.default.existsSync(_path.default.join(baseDir, lockFile))) {
return packageManager;
}
}
const userAgent = process.env.npm_config_user_agent;
if (userAgent) {
if (userAgent.startsWith('yarn')) {
return 'yarn';
} else if (userAgent.startsWith('pnpm')) {
return 'pnpm';
}
}
try {
(0, _child_process.execSync)('yarn --version', {
stdio: 'ignore'
});
return 'yarn';
} catch {
(0, _child_process.execSync)('pnpm --version', {
stdio: 'ignore'
});
return 'pnpm';
}
} catch {
return 'npm';
}
}
//# sourceMappingURL=get-pkg-manager.js.map

View File

@@ -1,45 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "getRegistry", {
enumerable: true,
get: function() {
return getRegistry;
}
});
const _child_process = require("child_process");
const _getpkgmanager = require("./get-pkg-manager");
const _utils = require("../../server/lib/utils");
function getRegistry(baseDir = process.cwd()) {
const pkgManager = (0, _getpkgmanager.getPkgManager)(baseDir);
// Since `npm config` command fails in npm workspace to prevent workspace config conflicts,
// add `--no-workspaces` flag to run under the context of the root project only.
// Safe for non-workspace projects as it's equivalent to default `--workspaces=false`.
// x-ref: https://github.com/vercel/next.js/issues/47121#issuecomment-1499044345
// x-ref: https://github.com/npm/statusboard/issues/371#issue-920669998
const resolvedFlags = pkgManager === 'npm' ? '--no-workspaces' : '';
let registry = `https://registry.npmjs.org/`;
try {
const output = (0, _child_process.execSync)(`${pkgManager} config get registry ${resolvedFlags}`, {
env: {
...process.env,
NODE_OPTIONS: (0, _utils.getFormattedNodeOptionsWithoutInspect)()
}
}).toString().trim();
if (output.startsWith('http')) {
registry = output.endsWith('/') ? output : `${output}/`;
}
} catch (err) {
throw Object.defineProperty(new Error(`Failed to get registry from "${pkgManager}".`, {
cause: err
}), "__NEXT_ERROR_CODE", {
value: "E508",
enumerable: false,
configurable: true
});
}
return registry;
}
//# sourceMappingURL=get-registry.js.map

View File

@@ -1,116 +0,0 @@
/** https://fetch.spec.whatwg.org/#port-blocking */ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
KNOWN_RESERVED_PORTS: null,
getReservedPortExplanation: null,
isPortIsReserved: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
KNOWN_RESERVED_PORTS: function() {
return KNOWN_RESERVED_PORTS;
},
getReservedPortExplanation: function() {
return getReservedPortExplanation;
},
isPortIsReserved: function() {
return isPortIsReserved;
}
});
const KNOWN_RESERVED_PORTS = {
1: 'tcpmux',
7: 'echo',
9: 'discard',
11: 'systat',
13: 'daytime',
15: 'netstat',
17: 'qotd',
19: 'chargen',
20: 'ftp-data',
21: 'ftp',
22: 'ssh',
23: 'telnet',
25: 'smtp',
37: 'time',
42: 'name',
43: 'nicname',
53: 'domain',
69: 'tftp',
77: 'rje',
79: 'finger',
87: 'link',
95: 'supdup',
101: 'hostname',
102: 'iso-tsap',
103: 'gppitnp',
104: 'acr-nema',
109: 'pop2',
110: 'pop3',
111: 'sunrpc',
113: 'auth',
115: 'sftp',
117: 'uucp-path',
119: 'nntp',
123: 'ntp',
135: 'epmap',
137: 'netbios-ns',
139: 'netbios-ssn',
143: 'imap',
161: 'snmp',
179: 'bgp',
389: 'ldap',
427: 'svrloc',
465: 'submissions',
512: 'exec',
513: 'login',
514: 'shell',
515: 'printer',
526: 'tempo',
530: 'courier',
531: 'chat',
532: 'netnews',
540: 'uucp',
548: 'afp',
554: 'rtsp',
556: 'remotefs',
563: 'nntps',
587: 'submission',
601: 'syslog-conn',
636: 'ldaps',
989: 'ftps-data',
990: 'ftps',
993: 'imaps',
995: 'pop3s',
1719: 'h323gatestat',
1720: 'h323hostcall',
1723: 'pptp',
2049: 'nfs',
3659: 'apple-sasl',
4045: 'npp',
5060: 'sip',
5061: 'sips',
6000: 'x11',
6566: 'sane-port',
6665: 'ircu',
6666: 'ircu',
6667: 'ircu',
6668: 'ircu',
6669: 'ircu',
6697: 'ircs-u',
10080: 'amanda'
};
function isPortIsReserved(port) {
return port in KNOWN_RESERVED_PORTS;
}
function getReservedPortExplanation(port) {
return `Bad port: "${port}" is reserved for ${KNOWN_RESERVED_PORTS[port]}\n` + 'Read more: https://nextjs.org/docs/messages/reserved-port';
}
//# sourceMappingURL=get-reserved-port.js.map

View File

@@ -1,83 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "install", {
enumerable: true,
get: function() {
return install;
}
});
const _picocolors = require("../picocolors");
const _crossspawn = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/cross-spawn"));
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function install(root, dependencies, { packageManager, isOnline, devDependencies }) {
let args = [];
if (dependencies.length > 0) {
if (packageManager === 'yarn') {
args = [
'add',
'--exact'
];
if (devDependencies) args.push('--dev');
} else if (packageManager === 'pnpm') {
args = [
'add',
'--save-exact'
];
args.push(devDependencies ? '--save-dev' : '--save-prod');
} else {
// npm
args = [
'install',
'--save-exact'
];
args.push(devDependencies ? '--save-dev' : '--save');
}
args.push(...dependencies);
} else {
args = [
'install'
] // npm, pnpm, and yarn all support `install`
;
if (!isOnline) {
args.push('--offline');
console.log((0, _picocolors.yellow)('You appear to be offline.'));
if (packageManager !== 'npm') {
console.log((0, _picocolors.yellow)(`Falling back to the local ${packageManager} cache.`));
}
console.log();
}
}
return new Promise((resolve, reject)=>{
/**
* Spawn the installation process.
*/ const child = (0, _crossspawn.default)(packageManager, args, {
cwd: root,
stdio: 'inherit',
env: {
...process.env,
ADBLOCK: '1',
// we set NODE_ENV to development as pnpm skips dev
// dependencies when production
NODE_ENV: 'development',
DISABLE_OPENCOLLECTIVE: '1'
}
});
child.on('close', (code)=>{
if (code !== 0) {
reject({
command: `${packageManager} ${args.join(' ')}`
});
return;
}
resolve();
});
});
}
//# sourceMappingURL=install.js.map

View File

@@ -1,50 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
const _log = /*#__PURE__*/ _interop_require_wildcard(require("../build/output/log"));
function _getRequireWildcardCache(nodeInterop) {
if (typeof WeakMap !== "function") return null;
var cacheBabelInterop = new WeakMap();
var cacheNodeInterop = new WeakMap();
return (_getRequireWildcardCache = function(nodeInterop) {
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
})(nodeInterop);
}
function _interop_require_wildcard(obj, nodeInterop) {
if (!nodeInterop && obj && obj.__esModule) {
return obj;
}
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
return {
default: obj
};
}
var cache = _getRequireWildcardCache(nodeInterop);
if (cache && cache.has(obj)) {
return cache.get(obj);
}
var newObj = {
__proto__: null
};
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
for(var key in obj){
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
if (desc && (desc.get || desc.set)) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
newObj.default = obj;
if (cache) {
cache.set(obj, newObj);
}
return newObj;
}
var _module_parent;
_log.warn(`"next" should not be imported directly, imported in ${(_module_parent = module.parent) == null ? void 0 : _module_parent.filename}\nSee more info here: https://nextjs.org/docs/messages/import-next`);
//# sourceMappingURL=import-next-warning.js.map

View File

@@ -1,112 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "inlineStaticEnv", {
enumerable: true,
get: function() {
return inlineStaticEnv;
}
});
const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
const _crypto = /*#__PURE__*/ _interop_require_default(require("crypto"));
const _util = require("util");
const _glob = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/glob"));
const _asyncsema = require("next/dist/compiled/async-sema");
const _staticenv = require("./static-env");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
const glob = (0, _util.promisify)(_glob.default);
async function inlineStaticEnv({ distDir, config }) {
const nextConfigEnv = (0, _staticenv.getNextConfigEnv)(config);
const staticEnv = (0, _staticenv.getStaticEnv)(config, config.deploymentId);
const serverDir = _path.default.join(distDir, 'server');
const serverChunks = await glob('**/*.{js,json,js.map}', {
cwd: serverDir
});
const clientDir = _path.default.join(distDir, 'static');
const clientChunks = await glob('**/*.{js,json,js.map}', {
cwd: clientDir
});
const manifestChunks = await glob('*.{js,json,js.map}', {
cwd: distDir
});
const inlineSema = new _asyncsema.Sema(8);
const nextConfigEnvKeys = Object.keys(nextConfigEnv).map((item)=>item.split('process.env.').pop());
const builtRegEx = new RegExp(`[\\w]{1,}(\\.env)?\\.(?:NEXT_PUBLIC_[\\w]{1,}${nextConfigEnvKeys.length ? '|' + nextConfigEnvKeys.join('|') : ''})`, 'g');
const changedClientFiles = [];
const filesToCheck = new Set(manifestChunks.map((f)=>_path.default.join(distDir, f)));
for (const [parentDir, files] of [
[
serverDir,
serverChunks
],
[
clientDir,
clientChunks
]
]){
await Promise.all(files.map(async (file)=>{
await inlineSema.acquire();
const filepath = _path.default.join(parentDir, file);
const content = await _fs.default.promises.readFile(filepath, 'utf8');
const newContent = content.replace(builtRegEx, (match)=>{
let normalizedMatch = `process.env.${match.split('.').pop()}`;
if (staticEnv[normalizedMatch]) {
return JSON.stringify(staticEnv[normalizedMatch]);
}
return match;
});
await _fs.default.promises.writeFile(filepath, newContent);
if (content !== newContent && parentDir === clientDir) {
changedClientFiles.push({
file,
content: newContent
});
}
filesToCheck.add(filepath);
inlineSema.release();
}));
}
const hashChanges = [];
// hashes need updating for any changed client files
for (const { file, content } of changedClientFiles){
var _file_match;
// hash is 16 chars currently for all client chunks
const originalHash = ((_file_match = file.match(/([a-z0-9]{16})\./)) == null ? void 0 : _file_match[1]) || '';
if (!originalHash) {
throw Object.defineProperty(new Error(`Invariant: client chunk changed but failed to detect hash ${file}`), "__NEXT_ERROR_CODE", {
value: "E663",
enumerable: false,
configurable: true
});
}
const newHash = _crypto.default.createHash('sha256').update(content).digest('hex').substring(0, 16);
hashChanges.push({
originalHash,
newHash
});
const filepath = _path.default.join(clientDir, file);
const newFilepath = filepath.replace(originalHash, newHash);
filesToCheck.delete(filepath);
filesToCheck.add(newFilepath);
await _fs.default.promises.rename(filepath, newFilepath);
}
// update build-manifest and webpack-runtime with new hashes
for (let file of filesToCheck){
const content = await _fs.default.promises.readFile(file, 'utf-8');
let newContent = content;
for (const { originalHash, newHash } of hashChanges){
newContent = newContent.replaceAll(originalHash, newHash);
}
if (content !== newContent) {
await _fs.default.promises.writeFile(file, newContent);
}
}
}
//# sourceMappingURL=inline-static-env.js.map

View File

@@ -1,40 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "installDependencies", {
enumerable: true,
get: function() {
return installDependencies;
}
});
const _picocolors = require("./picocolors");
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
const _getpkgmanager = require("./helpers/get-pkg-manager");
const _install = require("./helpers/install");
const _getonline = require("./helpers/get-online");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
async function installDependencies(baseDir, deps, dev = false) {
const packageManager = (0, _getpkgmanager.getPkgManager)(baseDir);
const isOnline = await (0, _getonline.getOnline)();
if (deps.length) {
console.log();
console.log(`Installing ${dev ? 'devDependencies' : 'dependencies'} (${packageManager}):`);
for (const dep of deps){
console.log(`- ${(0, _picocolors.cyan)(dep.pkg)}`);
}
console.log();
await (0, _install.install)(_path.default.resolve(baseDir), deps.map((dep)=>dep.pkg), {
devDependencies: dev,
isOnline,
packageManager
});
console.log();
}
}
//# sourceMappingURL=install-dependencies.js.map

View File

@@ -1,16 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "interopDefault", {
enumerable: true,
get: function() {
return interopDefault;
}
});
function interopDefault(mod) {
// @ts-ignore
return mod.default || mod;
}
//# sourceMappingURL=interop-default.js.map

View File

@@ -1,15 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "isAPIRoute", {
enumerable: true,
get: function() {
return isAPIRoute;
}
});
function isAPIRoute(value) {
return value === '/api' || Boolean(value == null ? void 0 : value.startsWith('/api/'));
}
//# sourceMappingURL=is-api-route.js.map

View File

@@ -1,15 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "isAppPageRoute", {
enumerable: true,
get: function() {
return isAppPageRoute;
}
});
function isAppPageRoute(route) {
return route.endsWith('/page');
}
//# sourceMappingURL=is-app-page-route.js.map

View File

@@ -1,15 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "isAppRouteRoute", {
enumerable: true,
get: function() {
return isAppRouteRoute;
}
});
function isAppRouteRoute(route) {
return route.endsWith('/route');
}
//# sourceMappingURL=is-app-route-route.js.map

View File

@@ -1,16 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "isEdgeRuntime", {
enumerable: true,
get: function() {
return isEdgeRuntime;
}
});
const _constants = require("./constants");
function isEdgeRuntime(value) {
return value === _constants.SERVER_RUNTIME.experimentalEdge || value === _constants.SERVER_RUNTIME.edge;
}
//# sourceMappingURL=is-edge-runtime.js.map

View File

@@ -1,78 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
default: null,
getProperError: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
/**
* Checks whether the given value is a NextError.
* This can be used to print a more detailed error message with properties like `code` & `digest`.
*/ default: function() {
return isError;
},
getProperError: function() {
return getProperError;
}
});
const _isplainobject = require("../shared/lib/is-plain-object");
/**
* This is a safe stringify function that handles circular references.
* We're using a simpler version here to avoid introducing
* the dependency `safe-stable-stringify` into production bundle.
*
* This helper is used both in development and production.
*/ function safeStringifyLite(obj) {
const seen = new WeakSet();
return JSON.stringify(obj, (_key, value)=>{
// If value is an object and already seen, replace with "[Circular]"
if (typeof value === 'object' && value !== null) {
if (seen.has(value)) {
return '[Circular]';
}
seen.add(value);
}
return value;
});
}
function isError(err) {
return typeof err === 'object' && err !== null && 'name' in err && 'message' in err;
}
function getProperError(err) {
if (isError(err)) {
return err;
}
if (process.env.NODE_ENV === 'development') {
// provide better error for case where `throw undefined`
// is called in development
if (typeof err === 'undefined') {
return Object.defineProperty(new Error('An undefined error was thrown, ' + 'see here for more info: https://nextjs.org/docs/messages/threw-undefined'), "__NEXT_ERROR_CODE", {
value: "E98",
enumerable: false,
configurable: true
});
}
if (err === null) {
return Object.defineProperty(new Error('A null error was thrown, ' + 'see here for more info: https://nextjs.org/docs/messages/threw-undefined'), "__NEXT_ERROR_CODE", {
value: "E336",
enumerable: false,
configurable: true
});
}
}
return Object.defineProperty(new Error((0, _isplainobject.isPlainObject)(err) ? safeStringifyLite(err) : err + ''), "__NEXT_ERROR_CODE", {
value: "E394",
enumerable: false,
configurable: true
});
}
//# sourceMappingURL=is-error.js.map

View File

@@ -1,18 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "isInterceptionRouteRewrite", {
enumerable: true,
get: function() {
return isInterceptionRouteRewrite;
}
});
const _approuterheaders = require("../client/components/app-router-headers");
function isInterceptionRouteRewrite(route) {
var _route_has_, _route_has;
// When we generate interception rewrites in the above implementation, we always do so with only a single `has` condition.
return ((_route_has = route.has) == null ? void 0 : (_route_has_ = _route_has[0]) == null ? void 0 : _route_has_.key) === _approuterheaders.NEXT_URL;
}
//# sourceMappingURL=is-interception-route-rewrite.js.map

View File

@@ -1,36 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
isInternalComponent: null,
isNonRoutePagesPage: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
isInternalComponent: function() {
return isInternalComponent;
},
isNonRoutePagesPage: function() {
return isNonRoutePagesPage;
}
});
function isInternalComponent(pathname) {
switch(pathname){
case 'next/dist/pages/_app':
case 'next/dist/pages/_document':
return true;
default:
return false;
}
}
function isNonRoutePagesPage(pathname) {
return pathname === '/_app' || pathname === '/_document';
}
//# sourceMappingURL=is-internal-component.js.map

View File

@@ -1,106 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
SerializableError: null,
isSerializableProps: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
SerializableError: function() {
return SerializableError;
},
isSerializableProps: function() {
return isSerializableProps;
}
});
const _isplainobject = require("../shared/lib/is-plain-object");
const regexpPlainIdentifier = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
class SerializableError extends Error {
constructor(page, method, path, message){
super(path ? `Error serializing \`${path}\` returned from \`${method}\` in "${page}".\nReason: ${message}` : `Error serializing props returned from \`${method}\` in "${page}".\nReason: ${message}`);
}
}
function isSerializableProps(page, method, input) {
if (!(0, _isplainobject.isPlainObject)(input)) {
throw Object.defineProperty(new SerializableError(page, method, '', `Props must be returned as a plain object from ${method}: \`{ props: { ... } }\` (received: \`${(0, _isplainobject.getObjectClassLabel)(input)}\`).`), "__NEXT_ERROR_CODE", {
value: "E394",
enumerable: false,
configurable: true
});
}
function visit(visited, value, path) {
if (visited.has(value)) {
throw Object.defineProperty(new SerializableError(page, method, path, `Circular references cannot be expressed in JSON (references: \`${visited.get(value) || '(self)'}\`).`), "__NEXT_ERROR_CODE", {
value: "E394",
enumerable: false,
configurable: true
});
}
visited.set(value, path);
}
function isSerializable(refs, value, path) {
const type = typeof value;
if (// `null` can be serialized, but not `undefined`.
value === null || // n.b. `bigint`, `function`, `symbol`, and `undefined` cannot be
// serialized.
//
// `object` is special-cased below, as it may represent `null`, an Array,
// a plain object, a class, et al.
type === 'boolean' || type === 'number' || type === 'string') {
return true;
}
if (type === 'undefined') {
throw Object.defineProperty(new SerializableError(page, method, path, '`undefined` cannot be serialized as JSON. Please use `null` or omit this value.'), "__NEXT_ERROR_CODE", {
value: "E394",
enumerable: false,
configurable: true
});
}
if ((0, _isplainobject.isPlainObject)(value)) {
visit(refs, value, path);
if (Object.entries(value).every(([key, nestedValue])=>{
const nextPath = regexpPlainIdentifier.test(key) ? `${path}.${key}` : `${path}[${JSON.stringify(key)}]`;
const newRefs = new Map(refs);
return isSerializable(newRefs, key, nextPath) && isSerializable(newRefs, nestedValue, nextPath);
})) {
return true;
}
throw Object.defineProperty(new SerializableError(page, method, path, `invariant: Unknown error encountered in Object.`), "__NEXT_ERROR_CODE", {
value: "E394",
enumerable: false,
configurable: true
});
}
if (Array.isArray(value)) {
visit(refs, value, path);
if (value.every((nestedValue, index)=>{
const newRefs = new Map(refs);
return isSerializable(newRefs, nestedValue, `${path}[${index}]`);
})) {
return true;
}
throw Object.defineProperty(new SerializableError(page, method, path, `invariant: Unknown error encountered in Array.`), "__NEXT_ERROR_CODE", {
value: "E394",
enumerable: false,
configurable: true
});
}
// None of these can be expressed as JSON:
// const type: "bigint" | "symbol" | "object" | "function"
throw Object.defineProperty(new SerializableError(page, method, path, '`' + type + '`' + (type === 'object' ? ` ("${Object.prototype.toString.call(value)}")` : '') + ' cannot be serialized as JSON. Please only return JSON serializable data types.'), "__NEXT_ERROR_CODE", {
value: "E394",
enumerable: false,
configurable: true
});
}
return isSerializable(new Map(), input, '');
}
//# sourceMappingURL=is-serializable-props.js.map

View File

@@ -1 +0,0 @@
["function-bind"]

View File

@@ -1,594 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
checkCustomRoutes: null,
default: null,
normalizeRouteRegex: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
checkCustomRoutes: function() {
return checkCustomRoutes;
},
default: function() {
return loadCustomRoutes;
},
normalizeRouteRegex: function() {
return normalizeRouteRegex;
}
});
const _picocolors = require("./picocolors");
const _escaperegexp = require("../shared/lib/escape-regexp");
const _trytoparsepath = require("./try-to-parse-path");
const _redirectstatus = require("./redirect-status");
const _url = require("./url");
const _constants = require("./constants");
const allowedHasTypes = new Set([
'header',
'cookie',
'query',
'host'
]);
const namedGroupsRegex = /\(\?<([a-zA-Z][a-zA-Z0-9]*)>/g;
function normalizeRouteRegex(regex) {
// clean up un-necessary escaping from regex.source which turns / into \\/
return regex.replace(/\\\//g, '/');
}
function checkRedirect(route) {
const invalidParts = [];
let hadInvalidStatus = false;
if (route.statusCode && !_redirectstatus.allowedStatusCodes.has(route['statusCode'])) {
hadInvalidStatus = true;
invalidParts.push(`\`statusCode\` is not undefined or valid statusCode`);
}
if (typeof route.permanent !== 'boolean' && !route['statusCode']) {
invalidParts.push(`\`permanent\` is not set to \`true\` or \`false\``);
}
return {
invalidParts,
hadInvalidStatus
};
}
function checkHeader(route) {
const invalidParts = [];
if (!Array.isArray(route.headers)) {
invalidParts.push('`headers` field must be an array');
} else if (route.headers.length === 0) {
invalidParts.push('`headers` field cannot be empty');
} else {
for (const header of route.headers){
if (!header || typeof header !== 'object') {
invalidParts.push("`headers` items must be object with { key: '', value: '' }");
break;
}
if (typeof header.key !== 'string') {
invalidParts.push('`key` in header item must be string');
break;
}
if (typeof header.value !== 'string') {
invalidParts.push('`value` in header item must be string');
break;
}
}
}
return invalidParts;
}
function checkCustomRoutes(routes, type) {
if (!Array.isArray(routes)) {
console.error(`Error: ${type}s must return an array, received ${typeof routes}.\n` + `See here for more info: https://nextjs.org/docs/messages/routes-must-be-array`);
process.exit(1);
}
let numInvalidRoutes = 0;
let hadInvalidStatus = false;
let hadInvalidHas = false;
let hadInvalidMissing = false;
const allowedKeys = new Set([
'source',
'locale',
'has',
'missing'
]);
if (type === 'rewrite') {
allowedKeys.add('basePath');
allowedKeys.add('destination');
}
if (type === 'redirect') {
allowedKeys.add('basePath');
allowedKeys.add('statusCode');
allowedKeys.add('permanent');
allowedKeys.add('destination');
}
if (type === 'header') {
allowedKeys.add('basePath');
allowedKeys.add('headers');
}
for (const route of routes){
if (!route || typeof route !== 'object') {
console.error(`The route ${JSON.stringify(route)} is not a valid object with \`source\`${type !== 'middleware' ? ` and \`${type === 'header' ? 'headers' : 'destination'}\`` : ''}`);
numInvalidRoutes++;
continue;
}
if (type === 'rewrite' && route.basePath === false && !(route.destination.startsWith('http://') || route.destination.startsWith('https://'))) {
console.error(`The route ${route.source} rewrites urls outside of the basePath. Please use a destination that starts with \`http://\` or \`https://\` https://nextjs.org/docs/messages/invalid-external-rewrite`);
numInvalidRoutes++;
continue;
}
const keys = Object.keys(route);
const invalidKeys = keys.filter((key)=>!allowedKeys.has(key));
const invalidParts = [];
if ('basePath' in route && typeof route.basePath !== 'undefined' && route.basePath !== false) {
invalidParts.push('`basePath` must be undefined or false');
}
if (typeof route.locale !== 'undefined' && route.locale !== false) {
invalidParts.push('`locale` must be undefined or false');
}
const checkInvalidHasMissing = (items, fieldName)=>{
let hadInvalidItem = false;
if (typeof items !== 'undefined' && !Array.isArray(items)) {
invalidParts.push(`\`${fieldName}\` must be undefined or valid has object`);
hadInvalidItem = true;
} else if (items) {
const invalidHasItems = [];
for (const hasItem of items){
let invalidHasParts = [];
if (!allowedHasTypes.has(hasItem.type)) {
invalidHasParts.push(`invalid type "${hasItem.type}"`);
}
if (typeof hasItem.key !== 'string' && hasItem.type !== 'host') {
invalidHasParts.push(`invalid key "${hasItem.key}"`);
}
if (typeof hasItem.value !== 'undefined' && typeof hasItem.value !== 'string') {
invalidHasParts.push(`invalid value "${hasItem.value}"`);
}
if (typeof hasItem.value === 'undefined' && hasItem.type === 'host') {
invalidHasParts.push(`value is required for "host" type`);
}
if (invalidHasParts.length > 0) {
invalidHasItems.push(`${invalidHasParts.join(', ')} for ${JSON.stringify(hasItem)}`);
}
}
if (invalidHasItems.length > 0) {
hadInvalidItem = true;
const itemStr = `item${invalidHasItems.length === 1 ? '' : 's'}`;
console.error(`Invalid \`${fieldName}\` ${itemStr}:\n` + invalidHasItems.join('\n'));
console.error();
invalidParts.push(`invalid \`${fieldName}\` ${itemStr} found`);
}
}
return hadInvalidItem;
};
if (checkInvalidHasMissing(route.has, 'has')) {
hadInvalidHas = true;
}
if (checkInvalidHasMissing(route.missing, 'missing')) {
hadInvalidMissing = true;
}
if (!route.source) {
invalidParts.push('`source` is missing');
} else if (typeof route.source !== 'string') {
invalidParts.push('`source` is not a string');
} else if (!route.source.startsWith('/')) {
invalidParts.push('`source` does not start with /');
}
if (type === 'header') {
invalidParts.push(...checkHeader(route));
} else if (type !== 'middleware') {
let _route = route;
if (!_route.destination) {
invalidParts.push('`destination` is missing');
} else if (typeof _route.destination !== 'string') {
invalidParts.push('`destination` is not a string');
} else if (type === 'rewrite' && !_route.destination.match(/^(\/|https:\/\/|http:\/\/)/)) {
invalidParts.push('`destination` does not start with `/`, `http://`, or `https://`');
}
}
if (type === 'redirect') {
const result = checkRedirect(route);
hadInvalidStatus = hadInvalidStatus || result.hadInvalidStatus;
invalidParts.push(...result.invalidParts);
}
let sourceTokens;
if (typeof route.source === 'string' && route.source.startsWith('/')) {
// only show parse error if we didn't already show error
// for not being a string
const { tokens, error, regexStr } = (0, _trytoparsepath.tryToParsePath)(route.source);
if (error) {
invalidParts.push('`source` parse failed');
}
if (regexStr && regexStr.length > 4096) {
invalidParts.push('`source` exceeds max built length of 4096');
}
sourceTokens = tokens;
}
const hasSegments = new Set();
if (route.has) {
for (const hasItem of route.has){
if (!hasItem.value && hasItem.key) {
hasSegments.add(hasItem.key);
}
if (hasItem.value) {
for (const match of hasItem.value.matchAll(namedGroupsRegex)){
if (match[1]) {
hasSegments.add(match[1]);
}
}
if (hasItem.type === 'host') {
hasSegments.add('host');
}
}
}
}
// make sure no unnamed patterns are attempted to be used in the
// destination as this can cause confusion and is not allowed
if (typeof route.destination === 'string') {
if (route.destination.startsWith('/') && Array.isArray(sourceTokens)) {
const unnamedInDest = new Set();
for (const token of sourceTokens){
if (typeof token === 'object' && typeof token.name === 'number') {
const unnamedIndex = new RegExp(`:${token.name}(?!\\d)`);
if (route.destination.match(unnamedIndex)) {
unnamedInDest.add(`:${token.name}`);
}
}
}
if (unnamedInDest.size > 0) {
invalidParts.push(`\`destination\` has unnamed params ${[
...unnamedInDest
].join(', ')}`);
} else {
const { tokens: destTokens, regexStr: destRegexStr, error: destinationParseFailed } = (0, _trytoparsepath.tryToParsePath)(route.destination, {
handleUrl: true
});
if (destRegexStr && destRegexStr.length > 4096) {
invalidParts.push('`destination` exceeds max built length of 4096');
}
if (destinationParseFailed) {
invalidParts.push('`destination` parse failed');
} else {
const sourceSegments = new Set(sourceTokens.map((item)=>typeof item === 'object' && item.name).filter(Boolean));
const invalidDestSegments = new Set();
for (const token of destTokens){
if (typeof token === 'object' && !sourceSegments.has(token.name) && !hasSegments.has(token.name)) {
invalidDestSegments.add(token.name);
}
}
if (invalidDestSegments.size) {
invalidParts.push(`\`destination\` has segments not in \`source\` or \`has\` (${[
...invalidDestSegments
].join(', ')})`);
}
}
}
}
}
const hasInvalidKeys = invalidKeys.length > 0;
const hasInvalidParts = invalidParts.length > 0;
if (hasInvalidKeys || hasInvalidParts) {
console.error(`${invalidParts.join(', ')}${invalidKeys.length ? (hasInvalidParts ? ',' : '') + ` invalid field${invalidKeys.length === 1 ? '' : 's'}: ` + invalidKeys.join(',') : ''} for route ${JSON.stringify(route)}`);
console.error();
numInvalidRoutes++;
}
}
if (numInvalidRoutes > 0) {
if (hadInvalidStatus) {
console.error(`\nValid redirect statusCode values are ${[
..._redirectstatus.allowedStatusCodes
].join(', ')}`);
}
if (hadInvalidHas) {
console.error(`\nValid \`has\` object shape is ${JSON.stringify({
type: [
...allowedHasTypes
].join(', '),
key: 'the key to check for',
value: 'undefined or a value string to match against'
}, null, 2)}`);
}
if (hadInvalidMissing) {
console.error(`\nValid \`missing\` object shape is ${JSON.stringify({
type: [
...allowedHasTypes
].join(', '),
key: 'the key to check for',
value: 'undefined or a value string to match against'
}, null, 2)}`);
}
console.error();
console.error(`Error: Invalid ${type}${numInvalidRoutes === 1 ? '' : 's'} found`);
process.exit(1);
}
}
function processRoutes(routes, config, type) {
const _routes = routes;
const newRoutes = [];
const defaultLocales = [];
if (config.i18n && type === 'redirect') {
var _config_i18n;
for (const item of ((_config_i18n = config.i18n) == null ? void 0 : _config_i18n.domains) || []){
defaultLocales.push({
locale: item.defaultLocale,
base: `http${item.http ? '' : 's'}://${item.domain}`
});
}
defaultLocales.push({
locale: config.i18n.defaultLocale,
base: ''
});
}
for (const r of _routes){
var _r_destination;
const srcBasePath = config.basePath && r.basePath !== false ? config.basePath : '';
const isExternal = !((_r_destination = r.destination) == null ? void 0 : _r_destination.startsWith('/'));
const destBasePath = srcBasePath && !isExternal ? srcBasePath : '';
if (config.i18n && r.locale !== false) {
var _r_destination1;
if (!isExternal) {
defaultLocales.forEach((item)=>{
let destination;
if (r.destination) {
destination = item.base ? `${item.base}${destBasePath}${r.destination}` : `${destBasePath}${r.destination}`;
}
newRoutes.push({
...r,
destination,
source: `${srcBasePath}/${item.locale}${r.source === '/' && !config.trailingSlash ? '' : r.source}`
});
});
}
r.source = `/:nextInternalLocale(${config.i18n.locales.map((locale)=>(0, _escaperegexp.escapeStringRegexp)(locale)).join('|')})${r.source === '/' && !config.trailingSlash ? '' : r.source}`;
if (r.destination && ((_r_destination1 = r.destination) == null ? void 0 : _r_destination1.startsWith('/'))) {
r.destination = `/:nextInternalLocale${r.destination === '/' && !config.trailingSlash ? '' : r.destination}`;
}
}
r.source = `${srcBasePath}${r.source === '/' && srcBasePath ? '' : r.source}`;
if (r.destination) {
r.destination = `${destBasePath}${r.destination === '/' && destBasePath ? '' : r.destination}`;
}
newRoutes.push(r);
}
return newRoutes;
}
async function loadRedirects(config) {
if (typeof config.redirects !== 'function') {
return [];
}
let redirects = await config.redirects();
// check before we process the routes and after to ensure
// they are still valid
checkCustomRoutes(redirects, 'redirect');
// save original redirects before transforms
if (Array.isArray(redirects)) {
config._originalRedirects = redirects.map((r)=>({
...r
}));
}
redirects = processRoutes(redirects, config, 'redirect');
checkCustomRoutes(redirects, 'redirect');
return redirects;
}
async function loadRewrites(config) {
// If assetPrefix is set, add a rewrite for `/${assetPrefix}/_next/*`
// requests so that they are handled in any of dev, start, or deploy
// automatically without the user having to configure this.
// If the assetPrefix is an absolute URL, we still consider the path for automatic rewrite.
// but hostname routing must be handled by the user
let maybeAssetPrefixRewrite = [];
if (config.assetPrefix) {
let prefix = config.assetPrefix;
if ((0, _url.isFullStringUrl)(config.assetPrefix) && URL.canParse(config.assetPrefix)) {
prefix = new URL(config.assetPrefix).pathname;
}
if (prefix && prefix !== '/') {
const assetPrefix = prefix.startsWith('/') ? prefix : `/${prefix}`;
const basePath = config.basePath || '';
// If these are the same, then this would result in an infinite rewrite.
if (assetPrefix !== basePath) {
maybeAssetPrefixRewrite.push({
source: `${assetPrefix}/_next/:path+`,
destination: `${basePath}/_next/:path+`
});
}
}
}
if (typeof config.rewrites !== 'function') {
return {
beforeFiles: [
...maybeAssetPrefixRewrite
],
afterFiles: [],
fallback: []
};
}
const _rewrites = await config.rewrites();
let beforeFiles = [];
let afterFiles = [];
let fallback = [];
if (!Array.isArray(_rewrites) && typeof _rewrites === 'object' && Object.keys(_rewrites).every((key)=>key === 'beforeFiles' || key === 'afterFiles' || key === 'fallback')) {
beforeFiles = _rewrites.beforeFiles || [];
afterFiles = _rewrites.afterFiles || [];
fallback = _rewrites.fallback || [];
} else {
afterFiles = _rewrites;
}
// check before we process the routes and after to ensure
// they are still valid
checkCustomRoutes(beforeFiles, 'rewrite');
checkCustomRoutes(afterFiles, 'rewrite');
checkCustomRoutes(fallback, 'rewrite');
// save original rewrites before transforms
config._originalRewrites = {
beforeFiles: beforeFiles.map((r)=>({
...r
})),
afterFiles: afterFiles.map((r)=>({
...r
})),
fallback: fallback.map((r)=>({
...r
}))
};
beforeFiles = [
...maybeAssetPrefixRewrite,
...processRoutes(beforeFiles, config, 'rewrite')
];
afterFiles = processRoutes(afterFiles, config, 'rewrite');
fallback = processRoutes(fallback, config, 'rewrite');
checkCustomRoutes(beforeFiles, 'rewrite');
checkCustomRoutes(afterFiles, 'rewrite');
checkCustomRoutes(fallback, 'rewrite');
return {
beforeFiles,
afterFiles,
fallback
};
}
async function loadHeaders(config) {
if (typeof config.headers !== 'function') {
return [];
}
let headers = await config.headers();
// check before we process the routes and after to ensure
// they are still valid
checkCustomRoutes(headers, 'header');
headers = processRoutes(headers, config, 'header');
checkCustomRoutes(headers, 'header');
return headers;
}
async function loadCustomRoutes(config) {
const [headers, rewrites, redirects] = await Promise.all([
loadHeaders(config),
loadRewrites(config),
loadRedirects(config)
]);
const onMatchHeaders = [];
const totalRewrites = rewrites.beforeFiles.length + rewrites.afterFiles.length + rewrites.fallback.length;
const totalRoutes = headers.length + redirects.length + totalRewrites;
if (totalRoutes > 1000) {
console.warn((0, _picocolors.bold)((0, _picocolors.yellow)(`Warning: `)) + `total number of custom routes exceeds 1000, this can reduce performance. Route counts:\n` + `headers: ${headers.length}\n` + `rewrites: ${totalRewrites}\n` + `redirects: ${redirects.length}\n` + `See more info: https://nextjs.org/docs/messages/max-custom-routes-reached`);
}
const cacheControlSources = [];
for (const headerRoute of headers){
if (!headerRoute.source.startsWith('/_next/')) {
continue;
}
for (const header of headerRoute.headers){
if (header.key.toLowerCase() === 'cache-control') {
cacheControlSources.push(headerRoute.source);
break;
}
}
}
if (cacheControlSources.length > 0) {
console.warn((0, _picocolors.bold)((0, _picocolors.yellow)(`Warning: `)) + `Custom Cache-Control headers detected for the following routes:\n` + cacheControlSources.map((source)=>` - ${source}`).join('\n') + `\n\nSetting a custom Cache-Control header can break Next.js development behavior.`);
}
if (config.deploymentId) {
var _config_experimental;
if ((_config_experimental = config.experimental) == null ? void 0 : _config_experimental.useSkewCookie) {
headers.unshift({
source: '/:path*',
headers: [
{
key: 'Set-Cookie',
value: `__vdpl=${config.deploymentId}; Path=/; HttpOnly`
}
]
});
}
onMatchHeaders.push({
source: '/:path*',
has: [
{
type: 'header',
key: 'rsc',
value: '1'
}
],
headers: [
{
key: _constants.NEXT_NAV_DEPLOYMENT_ID_HEADER,
value: config.deploymentId
}
]
}, {
source: '/_next/data/(.*)',
headers: [
{
key: _constants.NEXT_NAV_DEPLOYMENT_ID_HEADER,
value: config.deploymentId
}
]
});
}
if (!config.skipTrailingSlashRedirect) {
if (config.trailingSlash) {
redirects.unshift({
source: '/:file((?!\\.well-known(?:/.*)?)(?:[^/]+/)*[^/]+\\.\\w+)/',
destination: '/:file',
permanent: true,
locale: config.i18n ? false : undefined,
internal: true,
priority: true,
// don't run this redirect for _next/data requests
missing: [
{
type: 'header',
key: 'x-nextjs-data'
}
]
}, {
source: '/:notfile((?!\\.well-known(?:/.*)?)(?:[^/]+/)*[^/\\.]+)',
destination: '/:notfile/',
permanent: true,
locale: config.i18n ? false : undefined,
internal: true,
priority: true
});
if (config.basePath) {
redirects.unshift({
source: config.basePath,
destination: config.basePath + '/',
permanent: true,
basePath: false,
locale: config.i18n ? false : undefined,
internal: true,
priority: true
});
}
} else {
redirects.unshift({
source: '/:path+/',
destination: '/:path+',
permanent: true,
locale: config.i18n ? false : undefined,
internal: true,
priority: true
});
if (config.basePath) {
redirects.unshift({
source: config.basePath + '/',
destination: config.basePath,
permanent: true,
basePath: false,
locale: config.i18n ? false : undefined,
internal: true,
priority: true
});
}
}
}
return {
headers,
onMatchHeaders,
rewrites,
redirects
};
}
//# sourceMappingURL=load-custom-routes.js.map

View File

@@ -1,53 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
getGcEvents: null,
startObservingGc: null,
stopObservingGc: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
getGcEvents: function() {
return getGcEvents;
},
startObservingGc: function() {
return startObservingGc;
},
stopObservingGc: function() {
return stopObservingGc;
}
});
const _perf_hooks = require("perf_hooks");
const _log = require("../../build/output/log");
const _picocolors = require("../picocolors");
const LONG_RUNNING_GC_THRESHOLD_MS = 15;
const gcEvents = [];
const obs = new _perf_hooks.PerformanceObserver((list)=>{
const entry = list.getEntries()[0];
gcEvents.push(entry);
if (entry.duration > LONG_RUNNING_GC_THRESHOLD_MS) {
(0, _log.warn)((0, _picocolors.bold)(`Long running GC detected: ${entry.duration.toFixed(2)}ms`));
}
});
function startObservingGc() {
obs.observe({
entryTypes: [
'gc'
]
});
}
function stopObservingGc() {
obs.disconnect();
}
function getGcEvents() {
return gcEvents;
}
//# sourceMappingURL=gc-observer.js.map

View File

@@ -1,29 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "disableMemoryDebuggingMode", {
enumerable: true,
get: function() {
return disableMemoryDebuggingMode;
}
});
const _log = require("../../build/output/log");
const _picocolors = require("../picocolors");
const _gcobserver = require("./gc-observer");
const _trace = require("./trace");
function disableMemoryDebuggingMode() {
(0, _trace.stopPeriodicMemoryUsageTracing)();
(0, _gcobserver.stopObservingGc)();
(0, _log.info)((0, _picocolors.bold)('Memory usage report:'));
const gcEvents = (0, _gcobserver.getGcEvents)();
const totalTimeInGcMs = gcEvents.reduce((acc, event)=>acc + event.duration, 0);
(0, _log.info)(` - Total time spent in GC: ${totalTimeInGcMs.toFixed(2)}ms`);
const allMemoryUsage = (0, _trace.getAllMemoryUsageSpans)();
const peakHeapUsage = Math.max(...allMemoryUsage.map((usage)=>usage['memory.heapUsed']));
const peakRssUsage = Math.max(...allMemoryUsage.map((usage)=>usage['memory.rss']));
(0, _log.info)(` - Peak heap usage: ${(peakHeapUsage / 1024 / 1024).toFixed(2)} MB`);
(0, _log.info)(` - Peak RSS usage: ${(peakRssUsage / 1024 / 1024).toFixed(2)} MB`);
}
//# sourceMappingURL=shutdown.js.map

View File

@@ -1,47 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "enableMemoryDebuggingMode", {
enumerable: true,
get: function() {
return enableMemoryDebuggingMode;
}
});
const _v8 = /*#__PURE__*/ _interop_require_default(require("v8"));
const _log = require("../../build/output/log");
const _picocolors = require("../picocolors");
const _gcobserver = require("./gc-observer");
const _trace = require("./trace");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function enableMemoryDebuggingMode() {
// This will generate a heap snapshot when the program is close to the
// memory limit. It does not give any warning to the user though which
// can be jarring. If memory is large, this may take a long time.
if ('setHeapSnapshotNearHeapLimit' in _v8.default) {
_v8.default.setHeapSnapshotNearHeapLimit(1);
}
// This flag will kill the process when it starts to GC thrash when it's
// close to the memory limit rather than continuing to try to collect
// memory ineffectively.
_v8.default.setFlagsFromString('--detect-ineffective-gcs-near-heap-limit');
// This allows users to generate a heap snapshot on demand just by sending
// a signal to the process.
process.on('SIGUSR2', ()=>{
(0, _log.warn)(`Received SIGUSR2 signal. Generating heap snapshot. ${(0, _picocolors.italic)('Note: this will take some time.')}`);
_v8.default.writeHeapSnapshot();
});
(0, _gcobserver.startObservingGc)();
(0, _trace.startPeriodicMemoryUsageTracing)();
(0, _log.warn)(`Memory debugging mode is enabled. ${(0, _picocolors.italic)('Note: This will affect performance.')}`);
(0, _log.info)(' - Heap snapshots will be automatically generated when the process reaches more than 70% of the memory limit and again when the process is just about to run out of memory.');
(0, _log.info)(` - To manually generate a heap snapshot, send the process a SIGUSR2 signal: \`kill -SIGUSR2 ${process.pid}\``);
(0, _log.info)(' - Heap snapshots when there is high memory will take a very long time to complete and may be difficult to analyze in tools.');
(0, _log.info)(' - See https://nextjs.org/docs/app/building-your-application/optimizing/memory-usage for more information.');
}
//# sourceMappingURL=startup.js.map

View File

@@ -1,109 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
getAllMemoryUsageSpans: null,
startPeriodicMemoryUsageTracing: null,
stopPeriodicMemoryUsageTracing: null,
traceMemoryUsage: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
getAllMemoryUsageSpans: function() {
return getAllMemoryUsageSpans;
},
startPeriodicMemoryUsageTracing: function() {
return startPeriodicMemoryUsageTracing;
},
stopPeriodicMemoryUsageTracing: function() {
return stopPeriodicMemoryUsageTracing;
},
traceMemoryUsage: function() {
return traceMemoryUsage;
}
});
const _v8 = /*#__PURE__*/ _interop_require_default(require("v8"));
const _log = require("../../build/output/log");
const _trace = require("../../trace");
const _picocolors = require("../picocolors");
const _path = require("path");
const _shared = require("../../trace/shared");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
const HEAP_SNAPSHOT_THRESHOLD_PERCENT = 70;
let alreadyGeneratedHeapSnapshot = false;
const TRACE_MEMORY_USAGE_TIMER_MS = 20000;
let traceMemoryUsageTimer;
const allMemoryUsage = [];
function startPeriodicMemoryUsageTracing() {
traceMemoryUsageTimer = setTimeout(()=>{
traceMemoryUsage('periodic memory snapshot');
startPeriodicMemoryUsageTracing();
}, TRACE_MEMORY_USAGE_TIMER_MS);
}
function stopPeriodicMemoryUsageTracing() {
if (traceMemoryUsageTimer) {
clearTimeout(traceMemoryUsageTimer);
}
}
function getAllMemoryUsageSpans() {
return allMemoryUsage;
}
function traceMemoryUsage(description, parentSpan) {
const memoryUsage = process.memoryUsage();
const v8HeapStatistics = _v8.default.getHeapStatistics();
const heapUsed = v8HeapStatistics.used_heap_size;
const heapMax = v8HeapStatistics.heap_size_limit;
const tracedMemoryUsage = {
'memory.rss': memoryUsage.rss,
'memory.heapUsed': heapUsed,
'memory.heapTotal': memoryUsage.heapTotal,
'memory.heapMax': heapMax
};
allMemoryUsage.push(tracedMemoryUsage);
const tracedMemoryUsageAsStrings = Object.fromEntries(Object.entries(tracedMemoryUsage).map(([key, value])=>[
key,
String(value)
]));
if (parentSpan) {
parentSpan.traceChild('memory-usage', tracedMemoryUsageAsStrings);
} else {
(0, _trace.trace)('memory-usage', undefined, tracedMemoryUsageAsStrings);
}
if (process.env.EXPERIMENTAL_DEBUG_MEMORY_USAGE) {
const percentageHeapUsed = 100 * heapUsed / heapMax;
(0, _log.info)('');
(0, _log.info)('***************************************');
(0, _log.info)(`Memory usage report at "${description}":`);
(0, _log.info)(` - RSS: ${(memoryUsage.rss / 1024 / 1024).toFixed(2)} MB`);
(0, _log.info)(` - Heap Used: ${(heapUsed / 1024 / 1024).toFixed(2)} MB`);
(0, _log.info)(` - Heap Total Allocated: ${(memoryUsage.heapTotal / 1024 / 1024).toFixed(2)} MB`);
(0, _log.info)(` - Heap Max: ${(heapMax / 1024 / 1024).toFixed(2)} MB`);
(0, _log.info)(` - Percentage Heap Used: ${percentageHeapUsed.toFixed(2)}%`);
(0, _log.info)('***************************************');
(0, _log.info)('');
if (percentageHeapUsed > HEAP_SNAPSHOT_THRESHOLD_PERCENT) {
const distDir = _shared.traceGlobals.get('distDir');
const heapFilename = (0, _path.join)(distDir, `${description.replace(' ', '-')}.heapsnapshot`);
(0, _log.warn)((0, _picocolors.bold)(`Heap usage is close to the limit. ${percentageHeapUsed.toFixed(2)}% of heap has been used.`));
if (!alreadyGeneratedHeapSnapshot) {
(0, _log.warn)((0, _picocolors.bold)(`Saving heap snapshot to ${heapFilename}. ${(0, _picocolors.italic)('Note: this will take some time.')}`));
_v8.default.writeHeapSnapshot(heapFilename);
alreadyGeneratedHeapSnapshot = true;
} else {
(0, _log.warn)('Skipping heap snapshot generation since heap snapshot has already been generated.');
}
}
}
}
//# sourceMappingURL=trace.js.map

View File

@@ -1,40 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
IconKeys: null,
ViewportMetaKeys: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
IconKeys: function() {
return IconKeys;
},
ViewportMetaKeys: function() {
return ViewportMetaKeys;
}
});
const ViewportMetaKeys = {
width: 'width',
height: 'height',
initialScale: 'initial-scale',
minimumScale: 'minimum-scale',
maximumScale: 'maximum-scale',
viewportFit: 'viewport-fit',
userScalable: 'user-scalable',
interactiveWidget: 'interactive-widget'
};
const IconKeys = [
'icon',
'shortcut',
'apple',
'other'
];
//# sourceMappingURL=constants.js.map

View File

@@ -1,82 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
createDefaultMetadata: null,
createDefaultViewport: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
createDefaultMetadata: function() {
return createDefaultMetadata;
},
createDefaultViewport: function() {
return createDefaultViewport;
}
});
function createDefaultViewport() {
return {
// name=viewport
width: 'device-width',
initialScale: 1,
// visual metadata
themeColor: null,
colorScheme: null
};
}
function createDefaultMetadata() {
return {
// Deprecated ones
viewport: null,
themeColor: null,
colorScheme: null,
metadataBase: null,
// Other values are all null
title: null,
description: null,
applicationName: null,
authors: null,
generator: null,
keywords: null,
referrer: null,
creator: null,
publisher: null,
robots: null,
manifest: null,
alternates: {
canonical: null,
languages: null,
media: null,
types: null
},
icons: null,
openGraph: null,
twitter: null,
verification: {},
appleWebApp: null,
formatDetection: null,
itunes: null,
facebook: null,
pinterest: null,
abstract: null,
appLinks: null,
archives: null,
assets: null,
bookmarks: null,
category: null,
classification: null,
pagination: {
previous: null,
next: null
},
other: {}
};
}
//# sourceMappingURL=default-metadata.js.map

View File

@@ -1,22 +0,0 @@
'use client';
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "IconMark", {
enumerable: true,
get: function() {
return IconMark;
}
});
const _jsxruntime = require("react/jsx-runtime");
const IconMark = ()=>{
if (typeof window !== 'undefined') {
return null;
}
return /*#__PURE__*/ (0, _jsxruntime.jsx)("meta", {
name: "\xabnxt-icon\xbb"
});
};
//# sourceMappingURL=icon-mark.js.map

View File

@@ -1,52 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
getOrigin: null,
resolveArray: null,
resolveAsArrayOrUndefined: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
getOrigin: function() {
return getOrigin;
},
resolveArray: function() {
return resolveArray;
},
resolveAsArrayOrUndefined: function() {
return resolveAsArrayOrUndefined;
}
});
function resolveArray(value) {
if (Array.isArray(value)) {
return value;
}
return [
value
];
}
function resolveAsArrayOrUndefined(value) {
if (typeof value === 'undefined' || value === null) {
return undefined;
}
return resolveArray(value);
}
function getOrigin(url) {
let origin = undefined;
if (typeof url === 'string') {
try {
url = new URL(url);
origin = url.origin;
} catch {}
}
return origin;
}
//# sourceMappingURL=utils.js.map

View File

@@ -1,123 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
fillMetadataSegment: null,
normalizeMetadataPageToRoute: null,
normalizeMetadataRoute: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
fillMetadataSegment: function() {
return fillMetadataSegment;
},
normalizeMetadataPageToRoute: function() {
return normalizeMetadataPageToRoute;
},
normalizeMetadataRoute: function() {
return normalizeMetadataRoute;
}
});
const _ismetadataroute = require("./is-metadata-route");
const _path = /*#__PURE__*/ _interop_require_default(require("../../shared/lib/isomorphic/path"));
const _serverutils = require("../../server/server-utils");
const _routeregex = require("../../shared/lib/router/utils/route-regex");
const _hash = require("../../shared/lib/hash");
const _apppaths = require("../../shared/lib/router/utils/app-paths");
const _normalizepathsep = require("../../shared/lib/page-path/normalize-path-sep");
const _segment = require("../../shared/lib/segment");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
/*
* If there's special convention like (...) or @ in the page path,
* Give it a unique hash suffix to avoid conflicts
*
* e.g.
* /opengraph-image -> /opengraph-image
* /(post)/opengraph-image.tsx -> /opengraph-image-[0-9a-z]{6}
*
* Sitemap is an exception, it should not have a suffix.
* Each sitemap contains all the urls of sub routes, we don't have the case of duplicates `/(group)/sitemap.[ext]` and `/sitemap.[ext]` since they should be the same.
* Hence we always normalize the urls for sitemap and do not append hash suffix, and ensure user-land only contains one sitemap per pathname.
*
* /sitemap -> /sitemap
* /(post)/sitemap -> /sitemap
*/ function getMetadataRouteSuffix(page) {
// Remove the last segment and get the parent pathname
// e.g. /parent/a/b/c -> /parent/a/b
// e.g. /parent/opengraph-image -> /parent
const parentPathname = _path.default.dirname(page);
// Only apply suffix to metadata routes except for sitemaps
if (page.endsWith('/sitemap') || page.endsWith('/sitemap.xml')) {
return '';
}
// Calculate the hash suffix based on the parent path
let suffix = '';
// Check if there's any special characters in the parent pathname.
const segments = parentPathname.split('/');
if (segments.some((seg)=>(0, _segment.isGroupSegment)(seg) || (0, _segment.isParallelRouteSegment)(seg))) {
// Hash the parent path to get a unique suffix
suffix = (0, _hash.djb2Hash)(parentPathname).toString(36).slice(0, 6);
}
return suffix;
}
function fillMetadataSegment(segment, params, lastSegment, isStatic) {
const pathname = (0, _apppaths.normalizeAppPath)(segment);
const routeRegex = (0, _routeregex.getNamedRouteRegex)(pathname, {
prefixRouteKeys: false
});
// For static metadata files, fill all dynamic segments with "-" placeholder
const routeParams = isStatic ? Object.keys(routeRegex.groups).reduce((acc, key)=>{
const { repeat } = routeRegex.groups[key];
// Use array for catch-all segments, string for regular segments
acc[key] = repeat ? [
'-'
] : '-';
return acc;
}, {}) : params;
const route = (0, _serverutils.interpolateDynamicPath)(pathname, routeParams, routeRegex);
const { name, ext } = _path.default.parse(lastSegment);
const pagePath = _path.default.posix.join(segment, name);
const suffix = getMetadataRouteSuffix(pagePath);
const routeSuffix = suffix ? `-${suffix}` : '';
return (0, _normalizepathsep.normalizePathSep)(_path.default.join(route, `${name}${routeSuffix}${ext}`));
}
function normalizeMetadataRoute(page) {
if (!(0, _ismetadataroute.isMetadataPage)(page)) {
return page;
}
let route = page;
let suffix = '';
if (page === '/robots') {
route += '.txt';
} else if (page === '/manifest') {
route += '.webmanifest';
} else {
suffix = getMetadataRouteSuffix(page);
}
// Support both /<metadata-route.ext> and custom routes /<metadata-route>/route.ts.
// If it's a metadata file route, we need to append /[id]/route to the page.
if (!route.endsWith('/route')) {
const { dir, name: baseName, ext } = _path.default.parse(route);
route = _path.default.posix.join(dir, `${baseName}${suffix ? `-${suffix}` : ''}${ext}`, 'route');
}
return route;
}
function normalizeMetadataPageToRoute(page, isDynamic) {
const isRoute = page.endsWith('/route');
const routePagePath = isRoute ? page.slice(0, -'/route'.length) : page;
const metadataRouteExtension = routePagePath.endsWith('/sitemap') ? '.xml' : '';
const mapped = isDynamic ? `${routePagePath}/[__metadata_id__]` : `${routePagePath}${metadataRouteExtension}`;
return mapped + (isRoute ? '/route' : '');
}
//# sourceMappingURL=get-metadata-route.js.map

View File

@@ -1,221 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
DEFAULT_METADATA_ROUTE_EXTENSIONS: null,
STATIC_METADATA_IMAGES: null,
getExtensionRegexString: null,
isMetadataPage: null,
isMetadataRoute: null,
isMetadataRouteFile: null,
isStaticMetadataFile: null,
isStaticMetadataRoute: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
DEFAULT_METADATA_ROUTE_EXTENSIONS: function() {
return DEFAULT_METADATA_ROUTE_EXTENSIONS;
},
STATIC_METADATA_IMAGES: function() {
return STATIC_METADATA_IMAGES;
},
getExtensionRegexString: function() {
return getExtensionRegexString;
},
isMetadataPage: function() {
return isMetadataPage;
},
isMetadataRoute: function() {
return isMetadataRoute;
},
isMetadataRouteFile: function() {
return isMetadataRouteFile;
},
isStaticMetadataFile: function() {
return isStaticMetadataFile;
},
isStaticMetadataRoute: function() {
return isStaticMetadataRoute;
}
});
const _normalizepathsep = require("../../shared/lib/page-path/normalize-path-sep");
const _apppaths = require("../../shared/lib/router/utils/app-paths");
const _isapprouteroute = require("../is-app-route-route");
const STATIC_METADATA_IMAGES = {
icon: {
filename: 'icon',
extensions: [
'ico',
'jpg',
'jpeg',
'png',
'svg'
]
},
apple: {
filename: 'apple-icon',
extensions: [
'jpg',
'jpeg',
'png'
]
},
favicon: {
filename: 'favicon',
extensions: [
'ico'
]
},
openGraph: {
filename: 'opengraph-image',
extensions: [
'jpg',
'jpeg',
'png',
'gif'
]
},
twitter: {
filename: 'twitter-image',
extensions: [
'jpg',
'jpeg',
'png',
'gif'
]
}
};
const DEFAULT_METADATA_ROUTE_EXTENSIONS = [
'js',
'jsx',
'ts',
'tsx'
];
const getExtensionRegexString = (staticExtensions, dynamicExtensions)=>{
let result;
// If there's no possible multi dynamic routes, will not match any <name>[].<ext> files
if (!dynamicExtensions || dynamicExtensions.length === 0) {
result = `(\\.(?:${staticExtensions.join('|')}))`;
} else {
result = `(?:\\.(${staticExtensions.join('|')})|(\\.(${dynamicExtensions.join('|')})))`;
}
return result;
};
function isStaticMetadataFile(appDirRelativePath) {
return isMetadataRouteFile(appDirRelativePath, [], true);
}
// Pre-compiled static regexes for common cases
const FAVICON_REGEX = /^[\\/]favicon\.ico$/;
const ROBOTS_TXT_REGEX = /^[\\/]robots\.txt$/;
const MANIFEST_JSON_REGEX = /^[\\/]manifest\.json$/;
const MANIFEST_WEBMANIFEST_REGEX = /^[\\/]manifest\.webmanifest$/;
const SITEMAP_XML_REGEX = /[\\/]sitemap\.xml$/;
// Cache for compiled regex patterns based on parameters
const compiledRegexCache = new Map();
// Fast path checks for common metadata files
function fastPathCheck(normalizedPath) {
// Check favicon.ico first (most common)
if (FAVICON_REGEX.test(normalizedPath)) return true;
// Check other common static files
if (ROBOTS_TXT_REGEX.test(normalizedPath)) return true;
if (MANIFEST_JSON_REGEX.test(normalizedPath)) return true;
if (MANIFEST_WEBMANIFEST_REGEX.test(normalizedPath)) return true;
if (SITEMAP_XML_REGEX.test(normalizedPath)) return true;
// Quick negative check - if it doesn't contain any metadata keywords, skip
if (!normalizedPath.includes('robots') && !normalizedPath.includes('manifest') && !normalizedPath.includes('sitemap') && !normalizedPath.includes('icon') && !normalizedPath.includes('apple-icon') && !normalizedPath.includes('opengraph-image') && !normalizedPath.includes('twitter-image') && !normalizedPath.includes('favicon')) {
return false;
}
return null // Continue with full regex matching
;
}
function getCompiledRegexes(pageExtensions, strictlyMatchExtensions) {
// Create cache key
const cacheKey = `${pageExtensions.join(',')}|${strictlyMatchExtensions}`;
const cached = compiledRegexCache.get(cacheKey);
if (cached) {
return cached;
}
// Pre-compute common strings
const trailingMatcher = strictlyMatchExtensions ? '$' : '?$';
const variantsMatcher = '\\d?';
const groupSuffix = strictlyMatchExtensions ? '' : '(-\\w{6})?';
const suffixMatcher = variantsMatcher + groupSuffix;
// Pre-compute extension arrays to avoid repeated concatenation
const robotsExts = pageExtensions.length > 0 ? [
...pageExtensions,
'txt'
] : [
'txt'
];
const manifestExts = pageExtensions.length > 0 ? [
...pageExtensions,
'webmanifest',
'json'
] : [
'webmanifest',
'json'
];
const regexes = [
new RegExp(`^[\\\\/]robots${getExtensionRegexString(robotsExts, null)}${trailingMatcher}`),
new RegExp(`^[\\\\/]manifest${getExtensionRegexString(manifestExts, null)}${trailingMatcher}`),
// FAVICON_REGEX removed - already handled in fastPathCheck
new RegExp(`[\\\\/]sitemap${getExtensionRegexString([
'xml'
], pageExtensions)}${trailingMatcher}`),
new RegExp(`[\\\\/]icon${suffixMatcher}${getExtensionRegexString(STATIC_METADATA_IMAGES.icon.extensions, pageExtensions)}${trailingMatcher}`),
new RegExp(`[\\\\/]apple-icon${suffixMatcher}${getExtensionRegexString(STATIC_METADATA_IMAGES.apple.extensions, pageExtensions)}${trailingMatcher}`),
new RegExp(`[\\\\/]opengraph-image${suffixMatcher}${getExtensionRegexString(STATIC_METADATA_IMAGES.openGraph.extensions, pageExtensions)}${trailingMatcher}`),
new RegExp(`[\\\\/]twitter-image${suffixMatcher}${getExtensionRegexString(STATIC_METADATA_IMAGES.twitter.extensions, pageExtensions)}${trailingMatcher}`)
];
compiledRegexCache.set(cacheKey, regexes);
return regexes;
}
function isMetadataRouteFile(appDirRelativePath, pageExtensions, strictlyMatchExtensions) {
// Early exit for empty or obviously non-metadata paths
if (!appDirRelativePath || appDirRelativePath.length < 2) {
return false;
}
const normalizedPath = (0, _normalizepathsep.normalizePathSep)(appDirRelativePath);
// Fast path check for common cases
const fastResult = fastPathCheck(normalizedPath);
if (fastResult !== null) {
return fastResult;
}
// Get compiled regexes from cache
const regexes = getCompiledRegexes(pageExtensions, strictlyMatchExtensions);
// Use for loop instead of .some() for better performance
for(let i = 0; i < regexes.length; i++){
if (regexes[i].test(normalizedPath)) {
return true;
}
}
return false;
}
function isStaticMetadataRoute(route) {
// extract ext with regex
const pathname = route.replace(/\/route$/, '');
const matched = (0, _isapprouteroute.isAppRouteRoute)(route) && isMetadataRouteFile(pathname, [], true) && // These routes can either be built by static or dynamic entrypoints,
// so we assume they're dynamic
pathname !== '/robots.txt' && pathname !== '/manifest.webmanifest' && !pathname.endsWith('/sitemap.xml');
return matched;
}
function isMetadataPage(page) {
const matched = !(0, _isapprouteroute.isAppRouteRoute)(page) && isMetadataRouteFile(page, [], false);
return matched;
}
function isMetadataRoute(route) {
let page = (0, _apppaths.normalizeAppPath)(route).replace(/^\/?app\//, '')// Remove the dynamic route id
.replace('/[__metadata_id__]', '')// Remove the /route suffix
.replace(/\/route$/, '');
if (page[0] !== '/') page = '/' + page;
const matched = (0, _isapprouteroute.isAppRouteRoute)(route) && isMetadataRouteFile(page, [], false);
return matched;
}
//# sourceMappingURL=is-metadata-route.js.map

View File

@@ -1,18 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "createMetadataContext", {
enumerable: true,
get: function() {
return createMetadataContext;
}
});
function createMetadataContext(renderOpts) {
return {
trailingSlash: renderOpts.trailingSlash,
isStaticMetadataRouteFile: false
};
}
//# sourceMappingURL=metadata-context.js.map

File diff suppressed because it is too large Load Diff

View File

@@ -1,884 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
accumulateMetadata: null,
accumulateViewport: null,
resolveMetadata: null,
resolveViewport: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
accumulateMetadata: function() {
return accumulateMetadata;
},
accumulateViewport: function() {
return accumulateViewport;
},
resolveMetadata: function() {
return resolveMetadata;
},
resolveViewport: function() {
return resolveViewport;
}
});
const _getsegmentparam = require("../../shared/lib/router/utils/get-segment-param");
const _workasyncstorageexternal = require("../../server/app-render/work-async-storage.external");
const _invarianterror = require("../../shared/lib/invariant-error");
require("server-only");
const _react = require("react");
const _defaultmetadata = require("./default-metadata");
const _resolveopengraph = require("./resolvers/resolve-opengraph");
const _resolvetitle = require("./resolvers/resolve-title");
const _utils = require("./generate/utils");
const _appdirmodule = require("../../server/lib/app-dir-module");
const _resolvebasics = require("./resolvers/resolve-basics");
const _resolveicons = require("./resolvers/resolve-icons");
const _tracer = require("../../server/lib/trace/tracer");
const _constants = require("../../server/lib/trace/constants");
const _segment = require("../../shared/lib/segment");
const _log = /*#__PURE__*/ _interop_require_wildcard(require("../../build/output/log"));
const _params = require("../../server/request/params");
const _clientandserverreferences = require("../client-and-server-references");
const _lazyresult = require("../../server/lib/lazy-result");
function _getRequireWildcardCache(nodeInterop) {
if (typeof WeakMap !== "function") return null;
var cacheBabelInterop = new WeakMap();
var cacheNodeInterop = new WeakMap();
return (_getRequireWildcardCache = function(nodeInterop) {
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
})(nodeInterop);
}
function _interop_require_wildcard(obj, nodeInterop) {
if (!nodeInterop && obj && obj.__esModule) {
return obj;
}
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
return {
default: obj
};
}
var cache = _getRequireWildcardCache(nodeInterop);
if (cache && cache.has(obj)) {
return cache.get(obj);
}
var newObj = {
__proto__: null
};
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
for(var key in obj){
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
if (desc && (desc.get || desc.set)) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
newObj.default = obj;
if (cache) {
cache.set(obj, newObj);
}
return newObj;
}
function isFavicon(icon) {
if (!icon) {
return false;
}
// turbopack appends a hash to all images
return (icon.url === '/favicon.ico' || icon.url.toString().startsWith('/favicon.ico?')) && icon.type === 'image/x-icon';
}
function convertUrlsToStrings(input) {
if (input instanceof URL) {
return input.toString();
} else if (Array.isArray(input)) {
return input.map((item)=>convertUrlsToStrings(item));
} else if (input && typeof input === 'object') {
const result = {};
for (const [key, value] of Object.entries(input)){
result[key] = convertUrlsToStrings(value);
}
return result;
}
return input;
}
function normalizeMetadataBase(metadataBase) {
if (typeof metadataBase === 'string') {
try {
metadataBase = new URL(metadataBase);
} catch {
throw Object.defineProperty(new Error(`metadataBase is not a valid URL: ${metadataBase}`), "__NEXT_ERROR_CODE", {
value: "E850",
enumerable: false,
configurable: true
});
}
}
return metadataBase;
}
async function mergeStaticMetadata(metadataBase, source, target, staticFilesMetadata, metadataContext, titleTemplates, leafSegmentStaticIcons, pathname) {
var _source_twitter, _source_openGraph;
if (!staticFilesMetadata) return target;
const { icon, apple, openGraph, twitter, manifest } = staticFilesMetadata;
// Keep updating the static icons in the most leaf node
if (icon) {
leafSegmentStaticIcons.icon = icon;
}
if (apple) {
leafSegmentStaticIcons.apple = apple;
}
// file based metadata is specified and current level metadata twitter.images is not specified
if (twitter && !(source == null ? void 0 : (_source_twitter = source.twitter) == null ? void 0 : _source_twitter.hasOwnProperty('images'))) {
const resolvedTwitter = (0, _resolveopengraph.resolveTwitter)({
...target.twitter,
images: twitter
}, metadataBase, {
...metadataContext,
isStaticMetadataRouteFile: true
}, titleTemplates.twitter);
target.twitter = convertUrlsToStrings(resolvedTwitter);
}
// file based metadata is specified and current level metadata openGraph.images is not specified
if (openGraph && !(source == null ? void 0 : (_source_openGraph = source.openGraph) == null ? void 0 : _source_openGraph.hasOwnProperty('images'))) {
const resolvedOpenGraph = await (0, _resolveopengraph.resolveOpenGraph)({
...target.openGraph,
images: openGraph
}, metadataBase, pathname, {
...metadataContext,
isStaticMetadataRouteFile: true
}, titleTemplates.openGraph);
target.openGraph = convertUrlsToStrings(resolvedOpenGraph);
}
if (manifest) {
target.manifest = manifest;
}
return target;
}
/**
* Merges the given metadata with the resolved metadata. Returns a new object.
*/ async function mergeMetadata(route, pathname, { metadata, resolvedMetadata, staticFilesMetadata, titleTemplates, metadataContext, buildState, leafSegmentStaticIcons }) {
const newResolvedMetadata = structuredClone(resolvedMetadata);
const metadataBase = normalizeMetadataBase((metadata == null ? void 0 : metadata.metadataBase) !== undefined ? metadata.metadataBase : resolvedMetadata.metadataBase);
for(const key_ in metadata){
const key = key_;
switch(key){
case 'title':
{
newResolvedMetadata.title = (0, _resolvetitle.resolveTitle)(metadata.title, titleTemplates.title);
break;
}
case 'alternates':
{
newResolvedMetadata.alternates = convertUrlsToStrings(await (0, _resolvebasics.resolveAlternates)(metadata.alternates, metadataBase, pathname, metadataContext));
break;
}
case 'openGraph':
{
newResolvedMetadata.openGraph = convertUrlsToStrings(await (0, _resolveopengraph.resolveOpenGraph)(metadata.openGraph, metadataBase, pathname, metadataContext, titleTemplates.openGraph));
break;
}
case 'twitter':
{
newResolvedMetadata.twitter = convertUrlsToStrings((0, _resolveopengraph.resolveTwitter)(metadata.twitter, metadataBase, metadataContext, titleTemplates.twitter));
break;
}
case 'facebook':
newResolvedMetadata.facebook = (0, _resolvebasics.resolveFacebook)(metadata.facebook);
break;
case 'verification':
newResolvedMetadata.verification = (0, _resolvebasics.resolveVerification)(metadata.verification);
break;
case 'icons':
{
newResolvedMetadata.icons = convertUrlsToStrings((0, _resolveicons.resolveIcons)(metadata.icons));
break;
}
case 'appleWebApp':
newResolvedMetadata.appleWebApp = (0, _resolvebasics.resolveAppleWebApp)(metadata.appleWebApp);
break;
case 'appLinks':
newResolvedMetadata.appLinks = convertUrlsToStrings((0, _resolvebasics.resolveAppLinks)(metadata.appLinks));
break;
case 'robots':
{
newResolvedMetadata.robots = (0, _resolvebasics.resolveRobots)(metadata.robots);
break;
}
case 'archives':
case 'assets':
case 'bookmarks':
case 'keywords':
{
newResolvedMetadata[key] = (0, _utils.resolveAsArrayOrUndefined)(metadata[key]);
break;
}
case 'authors':
{
newResolvedMetadata[key] = convertUrlsToStrings((0, _utils.resolveAsArrayOrUndefined)(metadata.authors));
break;
}
case 'itunes':
{
newResolvedMetadata[key] = await (0, _resolvebasics.resolveItunes)(metadata.itunes, metadataBase, pathname, metadataContext);
break;
}
case 'pagination':
{
newResolvedMetadata.pagination = await (0, _resolvebasics.resolvePagination)(metadata.pagination, metadataBase, pathname, metadataContext);
break;
}
// directly assign fields that fallback to null
case 'abstract':
newResolvedMetadata[key] = metadata[key] ?? null;
break;
case 'applicationName':
newResolvedMetadata[key] = metadata[key] ?? null;
break;
case 'description':
newResolvedMetadata[key] = metadata[key] ?? null;
break;
case 'generator':
newResolvedMetadata[key] = metadata[key] ?? null;
break;
case 'creator':
newResolvedMetadata[key] = metadata[key] ?? null;
break;
case 'publisher':
newResolvedMetadata[key] = metadata[key] ?? null;
break;
case 'category':
newResolvedMetadata[key] = metadata[key] ?? null;
break;
case 'classification':
newResolvedMetadata[key] = metadata[key] ?? null;
break;
case 'referrer':
newResolvedMetadata[key] = metadata[key] ?? null;
break;
case 'formatDetection':
newResolvedMetadata[key] = metadata[key] ?? null;
break;
case 'manifest':
newResolvedMetadata[key] = convertUrlsToStrings(metadata[key]) ?? null;
break;
case 'pinterest':
newResolvedMetadata[key] = convertUrlsToStrings(metadata[key]) ?? null;
break;
case 'other':
newResolvedMetadata.other = Object.assign({}, newResolvedMetadata.other, metadata.other);
if (metadata.other) {
if ('apple-touch-fullscreen' in metadata.other) {
buildState.warnings.add(`Use appleWebApp instead\nRead more: https://nextjs.org/docs/app/api-reference/functions/generate-metadata`);
}
if ('apple-touch-icon-precomposed' in metadata.other) {
buildState.warnings.add(`Use icons.apple instead\nRead more: https://nextjs.org/docs/app/api-reference/functions/generate-metadata`);
}
}
break;
case 'metadataBase':
newResolvedMetadata.metadataBase = metadataBase ? metadataBase.toString() : null;
break;
case 'apple-touch-fullscreen':
{
buildState.warnings.add(`Use appleWebApp instead\nRead more: https://nextjs.org/docs/app/api-reference/functions/generate-metadata`);
break;
}
case 'apple-touch-icon-precomposed':
{
buildState.warnings.add(`Use icons.apple instead\nRead more: https://nextjs.org/docs/app/api-reference/functions/generate-metadata`);
break;
}
case 'themeColor':
case 'colorScheme':
case 'viewport':
if (metadata[key] != null) {
buildState.warnings.add(`Unsupported metadata ${key} is configured in metadata export in ${route}. Please move it to viewport export instead.\nRead more: https://nextjs.org/docs/app/api-reference/functions/generate-viewport`);
}
break;
default:
{
key;
}
}
}
return mergeStaticMetadata(metadataBase, metadata, newResolvedMetadata, staticFilesMetadata, metadataContext, titleTemplates, leafSegmentStaticIcons, pathname);
}
/**
* Merges the given viewport with the resolved viewport. Returns a new object.
*/ function mergeViewport({ resolvedViewport, viewport }) {
const newResolvedViewport = structuredClone(resolvedViewport);
if (viewport) {
for(const key_ in viewport){
const key = key_;
switch(key){
case 'themeColor':
{
newResolvedViewport.themeColor = (0, _resolvebasics.resolveThemeColor)(viewport.themeColor);
break;
}
case 'colorScheme':
newResolvedViewport.colorScheme = viewport.colorScheme || null;
break;
case 'width':
case 'height':
case 'initialScale':
case 'minimumScale':
case 'maximumScale':
case 'userScalable':
case 'viewportFit':
case 'interactiveWidget':
// always override the target with the source
// @ts-ignore viewport properties
newResolvedViewport[key] = viewport[key];
break;
default:
key;
}
}
}
return newResolvedViewport;
}
function getDefinedViewport(mod, props, tracingProps) {
if (typeof mod.generateViewport === 'function') {
const { route } = tracingProps;
const segmentProps = createSegmentProps(mod.generateViewport, props);
return Object.assign((parent)=>(0, _tracer.getTracer)().trace(_constants.ResolveMetadataSpan.generateViewport, {
spanName: `generateViewport ${route}`,
attributes: {
'next.page': route
}
}, ()=>mod.generateViewport(segmentProps, parent)), {
$$original: mod.generateViewport
});
}
return mod.viewport || null;
}
function getDefinedMetadata(mod, props, tracingProps) {
if (typeof mod.generateMetadata === 'function') {
const { route } = tracingProps;
const segmentProps = createSegmentProps(mod.generateMetadata, props);
return Object.assign((parent)=>(0, _tracer.getTracer)().trace(_constants.ResolveMetadataSpan.generateMetadata, {
spanName: `generateMetadata ${route}`,
attributes: {
'next.page': route
}
}, ()=>mod.generateMetadata(segmentProps, parent)), {
$$original: mod.generateMetadata
});
}
return mod.metadata || null;
}
/**
* If `fn` is a `'use cache'` function, we add special markers to the props,
* that the cache wrapper reads and removes, before passing the props to the
* user function.
*/ function createSegmentProps(fn, props) {
return (0, _clientandserverreferences.isUseCacheFunction)(fn) ? 'searchParams' in props ? {
...props,
$$isPage: true
} : {
...props,
$$isLayout: true
} : props;
}
async function collectStaticImagesFiles(metadata, props, type) {
if (!(metadata == null ? void 0 : metadata[type])) return undefined;
const iconPromises = metadata[type].map(async (imageModule)=>await imageModule(props));
return (iconPromises == null ? void 0 : iconPromises.length) > 0 ? (await Promise.all(iconPromises)).flat() : undefined;
}
async function resolveStaticMetadata(modules, props) {
const { metadata } = modules;
if (!metadata) return null;
const [icon, apple, openGraph, twitter] = await Promise.all([
collectStaticImagesFiles(metadata, props, 'icon'),
collectStaticImagesFiles(metadata, props, 'apple'),
collectStaticImagesFiles(metadata, props, 'openGraph'),
collectStaticImagesFiles(metadata, props, 'twitter')
]);
const staticMetadata = {
icon,
apple,
openGraph,
twitter,
manifest: metadata.manifest
};
return staticMetadata;
}
// [layout.metadata, static files metadata] -> ... -> [page.metadata, static files metadata]
async function collectMetadata({ tree, metadataItems, errorMetadataItem, props, route, errorConvention }) {
let mod;
let modType;
const hasErrorConventionComponent = Boolean(errorConvention && tree[2][errorConvention]);
if (errorConvention) {
mod = await (0, _appdirmodule.getComponentTypeModule)(tree, 'layout');
modType = errorConvention;
} else {
const { mod: layoutOrPageMod, modType: layoutOrPageModType } = await (0, _appdirmodule.getLayoutOrPageModule)(tree);
mod = layoutOrPageMod;
modType = layoutOrPageModType;
}
if (modType) {
route += `/${modType}`;
}
const staticFilesMetadata = await resolveStaticMetadata(tree[2], props);
const metadataExport = mod ? getDefinedMetadata(mod, props, {
route
}) : null;
metadataItems.push([
metadataExport,
staticFilesMetadata
]);
if (hasErrorConventionComponent && errorConvention) {
const errorMod = await (0, _appdirmodule.getComponentTypeModule)(tree, errorConvention);
const errorMetadataExport = errorMod ? getDefinedMetadata(errorMod, props, {
route
}) : null;
errorMetadataItem[0] = errorMetadataExport;
errorMetadataItem[1] = staticFilesMetadata;
}
}
// [layout.metadata, static files metadata] -> ... -> [page.metadata, static files metadata]
async function collectViewport({ tree, viewportItems, errorViewportItemRef, props, route, errorConvention }) {
let mod;
let modType;
const hasErrorConventionComponent = Boolean(errorConvention && tree[2][errorConvention]);
if (errorConvention) {
mod = await (0, _appdirmodule.getComponentTypeModule)(tree, 'layout');
modType = errorConvention;
} else {
const { mod: layoutOrPageMod, modType: layoutOrPageModType } = await (0, _appdirmodule.getLayoutOrPageModule)(tree);
mod = layoutOrPageMod;
modType = layoutOrPageModType;
}
if (modType) {
route += `/${modType}`;
}
const viewportExport = mod ? getDefinedViewport(mod, props, {
route
}) : null;
viewportItems.push(viewportExport);
if (hasErrorConventionComponent && errorConvention) {
const errorMod = await (0, _appdirmodule.getComponentTypeModule)(tree, errorConvention);
const errorViewportExport = errorMod ? getDefinedViewport(errorMod, props, {
route
}) : null;
errorViewportItemRef.current = errorViewportExport;
}
}
const resolveMetadataItems = (0, _react.cache)(async function(tree, searchParams, errorConvention, interpolatedParams, isRuntimePrefetchable) {
const parentParams = {};
const metadataItems = [];
const errorMetadataItem = [
null,
null
];
const treePrefix = undefined;
return resolveMetadataItemsImpl(metadataItems, tree, treePrefix, parentParams, null, searchParams, errorConvention, errorMetadataItem, interpolatedParams, isRuntimePrefetchable);
});
async function resolveMetadataItemsImpl(metadataItems, tree, /** Provided tree can be nested subtree, this argument says what is the path of such subtree */ treePrefix, parentParams, parentOptionalCatchAllParamName, searchParams, errorConvention, errorMetadataItem, interpolatedParams, isRuntimePrefetchable) {
const [segment, parallelRoutes, { page }] = tree;
const currentTreePrefix = treePrefix && treePrefix.length ? [
...treePrefix,
segment
] : [
segment
];
const isPage = typeof page !== 'undefined';
// Handle dynamic segment params.
let currentParams = parentParams;
const segmentParam = (0, _getsegmentparam.getSegmentParam)(segment);
if (segmentParam) {
const value = interpolatedParams[segmentParam.paramName];
if (value !== null && value !== undefined) {
currentParams = {
...parentParams,
[segmentParam.paramName]: value
};
}
}
// Track optional catch-all params with no value (see comment in
// create-component-tree.tsx for full explanation).
const optionalCatchAllParamName = (segmentParam == null ? void 0 : segmentParam.paramType) === 'optional-catchall' && (interpolatedParams[segmentParam.paramName] === null || interpolatedParams[segmentParam.paramName] === undefined) ? segmentParam.paramName : parentOptionalCatchAllParamName;
const params = (0, _params.createServerParamsForMetadata)(currentParams, optionalCatchAllParamName, isRuntimePrefetchable);
const props = isPage ? {
params,
searchParams
} : {
params
};
await collectMetadata({
tree,
metadataItems,
errorMetadataItem,
errorConvention,
props,
route: currentTreePrefix// __PAGE__ shouldn't be shown in a route
.filter((s)=>s !== _segment.PAGE_SEGMENT_KEY).join('/')
});
for(const key in parallelRoutes){
const childTree = parallelRoutes[key];
await resolveMetadataItemsImpl(metadataItems, childTree, currentTreePrefix, currentParams, optionalCatchAllParamName, searchParams, errorConvention, errorMetadataItem, interpolatedParams, isRuntimePrefetchable);
}
if (Object.keys(parallelRoutes).length === 0 && errorConvention) {
// If there are no parallel routes, place error metadata as the last item.
// e.g. layout -> layout -> not-found
metadataItems.push(errorMetadataItem);
}
return metadataItems;
}
const resolveViewportItems = (0, _react.cache)(async function(tree, searchParams, errorConvention, interpolatedParams, isRuntimePrefetchable) {
const parentParams = {};
const viewportItems = [];
const errorViewportItemRef = {
current: null
};
const treePrefix = undefined;
return resolveViewportItemsImpl(viewportItems, tree, treePrefix, parentParams, null, searchParams, errorConvention, errorViewportItemRef, interpolatedParams, isRuntimePrefetchable);
});
async function resolveViewportItemsImpl(viewportItems, tree, /** Provided tree can be nested subtree, this argument says what is the path of such subtree */ treePrefix, parentParams, parentOptionalCatchAllParamName, searchParams, errorConvention, errorViewportItemRef, interpolatedParams, isRuntimePrefetchable) {
const [segment, parallelRoutes, { page }] = tree;
const currentTreePrefix = treePrefix && treePrefix.length ? [
...treePrefix,
segment
] : [
segment
];
const isPage = typeof page !== 'undefined';
// Handle dynamic segment params.
let currentParams = parentParams;
const segmentParam = (0, _getsegmentparam.getSegmentParam)(segment);
if (segmentParam) {
const value = interpolatedParams[segmentParam.paramName];
if (value !== null && value !== undefined) {
currentParams = {
...parentParams,
[segmentParam.paramName]: value
};
}
}
// Track optional catch-all params with no value (see comment in
// create-component-tree.tsx for full explanation).
const optionalCatchAllParamName = (segmentParam == null ? void 0 : segmentParam.paramType) === 'optional-catchall' && (interpolatedParams[segmentParam.paramName] === null || interpolatedParams[segmentParam.paramName] === undefined) ? segmentParam.paramName : parentOptionalCatchAllParamName;
const params = (0, _params.createServerParamsForMetadata)(currentParams, optionalCatchAllParamName, isRuntimePrefetchable);
let layerProps;
if (isPage) {
layerProps = {
params,
searchParams
};
} else {
layerProps = {
params
};
}
await collectViewport({
tree,
viewportItems,
errorViewportItemRef,
errorConvention,
props: layerProps,
route: currentTreePrefix// __PAGE__ shouldn't be shown in a route
.filter((s)=>s !== _segment.PAGE_SEGMENT_KEY).join('/')
});
for(const key in parallelRoutes){
const childTree = parallelRoutes[key];
await resolveViewportItemsImpl(viewportItems, childTree, currentTreePrefix, currentParams, optionalCatchAllParamName, searchParams, errorConvention, errorViewportItemRef, interpolatedParams, isRuntimePrefetchable);
}
if (Object.keys(parallelRoutes).length === 0 && errorConvention) {
// If there are no parallel routes, place error metadata as the last item.
// e.g. layout -> layout -> not-found
viewportItems.push(errorViewportItemRef.current);
}
return viewportItems;
}
const isTitleTruthy = (title)=>!!(title == null ? void 0 : title.absolute);
const hasTitle = (metadata)=>isTitleTruthy(metadata == null ? void 0 : metadata.title);
function inheritFromMetadata(target, metadata) {
if (target) {
if (!hasTitle(target) && hasTitle(metadata)) {
target.title = metadata.title;
}
if (!target.description && metadata.description) {
target.description = metadata.description;
}
}
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const commonOgKeys = [
'title',
'description',
'images'
];
function postProcessMetadata(metadata, favicon, titleTemplates, metadataContext) {
const { openGraph, twitter } = metadata;
if (openGraph) {
// If there's openGraph information but not configured in twitter,
// inherit them from openGraph metadata.
let autoFillProps = {};
const hasTwTitle = hasTitle(twitter);
const hasTwDescription = twitter == null ? void 0 : twitter.description;
const hasTwImages = Boolean((twitter == null ? void 0 : twitter.hasOwnProperty('images')) && twitter.images);
if (!hasTwTitle) {
if (isTitleTruthy(openGraph.title)) {
autoFillProps.title = openGraph.title;
} else if (metadata.title && isTitleTruthy(metadata.title)) {
autoFillProps.title = metadata.title;
}
}
if (!hasTwDescription) autoFillProps.description = openGraph.description || metadata.description || undefined;
if (!hasTwImages) autoFillProps.images = openGraph.images;
if (Object.keys(autoFillProps).length > 0) {
const partialTwitter = (0, _resolveopengraph.resolveTwitter)(autoFillProps, normalizeMetadataBase(metadata.metadataBase), metadataContext, titleTemplates.twitter);
if (metadata.twitter) {
metadata.twitter = Object.assign({}, metadata.twitter, {
...!hasTwTitle && {
title: partialTwitter == null ? void 0 : partialTwitter.title
},
...!hasTwDescription && {
description: partialTwitter == null ? void 0 : partialTwitter.description
},
...!hasTwImages && {
images: partialTwitter == null ? void 0 : partialTwitter.images
}
});
} else {
metadata.twitter = convertUrlsToStrings(partialTwitter);
}
}
}
// If there's no title and description configured in openGraph or twitter,
// use the title and description from metadata.
inheritFromMetadata(openGraph, metadata);
inheritFromMetadata(twitter, metadata);
if (favicon) {
if (!metadata.icons) {
metadata.icons = {
icon: [],
apple: []
};
}
metadata.icons.icon.unshift(favicon);
}
return metadata;
}
function prerenderMetadata(metadataItems) {
// If the index is a function then it is a resolver and the next slot
// is the corresponding result. If the index is not a function it is the result
// itself.
const resolversAndResults = [];
for(let i = 0; i < metadataItems.length; i++){
const metadataExport = metadataItems[i][0];
getResult(resolversAndResults, metadataExport);
}
return resolversAndResults;
}
function prerenderViewport(viewportItems) {
// If the index is a function then it is a resolver and the next slot
// is the corresponding result. If the index is not a function it is the result
// itself.
const resolversAndResults = [];
for(let i = 0; i < viewportItems.length; i++){
const viewportExport = viewportItems[i];
getResult(resolversAndResults, viewportExport);
}
return resolversAndResults;
}
const noop = ()=>{};
function getResult(resolversAndResults, exportForResult) {
if (typeof exportForResult === 'function') {
// If the function is a 'use cache' function that uses the parent data as
// the second argument, we don't want to eagerly execute it during
// metadata/viewport pre-rendering, as the parent data might also be
// computed from another 'use cache' function. To ensure that the hanging
// input abort signal handling works in this case (i.e. the depending
// function waits for the cached input to resolve while encoding its args),
// they must be called sequentially. This can be accomplished by wrapping
// the call in a lazy promise, so that the original function is only called
// when the result is actually awaited.
const useCacheFunctionInfo = (0, _clientandserverreferences.getUseCacheFunctionInfo)(exportForResult.$$original);
if (useCacheFunctionInfo && useCacheFunctionInfo.usedArgs[1]) {
const promise = new Promise((resolve)=>resolversAndResults.push(resolve));
resolversAndResults.push((0, _lazyresult.createLazyResult)(async ()=>exportForResult(promise)));
} else {
let result;
if (useCacheFunctionInfo) {
resolversAndResults.push(noop);
// @ts-expect-error We intentionally omit the parent argument, because
// we know from the check above that the 'use cache' function does not
// use it.
result = exportForResult();
} else {
result = exportForResult(new Promise((resolve)=>resolversAndResults.push(resolve)));
}
resolversAndResults.push(result);
if (result instanceof Promise) {
// since we eager execute generateMetadata and
// they can reject at anytime we need to ensure
// we attach the catch handler right away to
// prevent unhandled rejections crashing the process
result.catch((err)=>{
return {
__nextError: err
};
});
}
}
} else if (typeof exportForResult === 'object') {
resolversAndResults.push(exportForResult);
} else {
resolversAndResults.push(null);
}
}
function freezeInDev(obj) {
if (process.env.NODE_ENV === 'development') {
return require('../../shared/lib/deep-freeze').deepFreeze(obj);
}
return obj;
}
async function accumulateMetadata(route, metadataItems, pathname, metadataContext) {
let resolvedMetadata = (0, _defaultmetadata.createDefaultMetadata)();
let titleTemplates = {
title: null,
twitter: null,
openGraph: null
};
const buildState = {
warnings: new Set()
};
let favicon;
// Collect the static icons in the most leaf node,
// since we don't collect all the static metadata icons in the parent segments.
const leafSegmentStaticIcons = {
icon: [],
apple: []
};
const resolversAndResults = prerenderMetadata(metadataItems);
let resultIndex = 0;
for(let i = 0; i < metadataItems.length; i++){
var _staticFilesMetadata_icon;
const staticFilesMetadata = metadataItems[i][1];
// Treat favicon as special case, it should be the first icon in the list
// i <= 1 represents root layout, and if current page is also at root
if (i <= 1 && isFavicon(staticFilesMetadata == null ? void 0 : (_staticFilesMetadata_icon = staticFilesMetadata.icon) == null ? void 0 : _staticFilesMetadata_icon[0])) {
var _staticFilesMetadata_icon1;
const iconMod = staticFilesMetadata == null ? void 0 : (_staticFilesMetadata_icon1 = staticFilesMetadata.icon) == null ? void 0 : _staticFilesMetadata_icon1.shift();
if (i === 0) favicon = iconMod;
}
let pendingMetadata = resolversAndResults[resultIndex++];
if (typeof pendingMetadata === 'function') {
// This metadata item had a `generateMetadata` and
// we need to provide the currently resolved metadata
// to it before we continue;
const resolveParentMetadata = pendingMetadata;
// we know that the next item is a result if this item
// was a resolver
pendingMetadata = resolversAndResults[resultIndex++];
resolveParentMetadata(freezeInDev(resolvedMetadata));
}
// Otherwise the item was either null or a static export
let metadata;
if (isPromiseLike(pendingMetadata)) {
metadata = await pendingMetadata;
} else {
metadata = pendingMetadata;
}
resolvedMetadata = await mergeMetadata(route, pathname, {
resolvedMetadata,
metadata,
metadataContext,
staticFilesMetadata,
titleTemplates,
buildState,
leafSegmentStaticIcons
});
// If the layout is the same layer with page, skip the leaf layout and leaf page
// The leaf layout and page are the last two items
if (i < metadataItems.length - 2) {
var _resolvedMetadata_title, _resolvedMetadata_openGraph, _resolvedMetadata_twitter;
titleTemplates = {
title: ((_resolvedMetadata_title = resolvedMetadata.title) == null ? void 0 : _resolvedMetadata_title.template) || null,
openGraph: ((_resolvedMetadata_openGraph = resolvedMetadata.openGraph) == null ? void 0 : _resolvedMetadata_openGraph.title.template) || null,
twitter: ((_resolvedMetadata_twitter = resolvedMetadata.twitter) == null ? void 0 : _resolvedMetadata_twitter.title.template) || null
};
}
}
if (leafSegmentStaticIcons.icon.length > 0 || leafSegmentStaticIcons.apple.length > 0) {
if (!resolvedMetadata.icons) {
resolvedMetadata.icons = {
icon: [],
apple: []
};
if (leafSegmentStaticIcons.icon.length > 0) {
resolvedMetadata.icons.icon.unshift(...leafSegmentStaticIcons.icon);
}
if (leafSegmentStaticIcons.apple.length > 0) {
resolvedMetadata.icons.apple.unshift(...leafSegmentStaticIcons.apple);
}
}
}
// Only log warnings if there are any, and only once after the metadata resolving process is finished
if (buildState.warnings.size > 0) {
for (const warning of buildState.warnings){
_log.warn(warning);
}
}
return postProcessMetadata(resolvedMetadata, favicon, titleTemplates, metadataContext);
}
async function accumulateViewport(viewportItems) {
let resolvedViewport = (0, _defaultmetadata.createDefaultViewport)();
const resolversAndResults = prerenderViewport(viewportItems);
let i = 0;
while(i < resolversAndResults.length){
let pendingViewport = resolversAndResults[i++];
if (typeof pendingViewport === 'function') {
// this viewport item had a `generateViewport` and
// we need to provide the currently resolved viewport
// to it before we continue;
const resolveParentViewport = pendingViewport;
// we know that the next item is a result if this item
// was a resolver
pendingViewport = resolversAndResults[i++];
resolveParentViewport(freezeInDev(resolvedViewport));
}
// Otherwise the item was either null or a static export
let viewport;
if (isPromiseLike(pendingViewport)) {
viewport = await pendingViewport;
} else {
viewport = pendingViewport;
}
resolvedViewport = mergeViewport({
resolvedViewport,
viewport
});
}
return resolvedViewport;
}
async function resolveMetadata(tree, pathname, searchParams, errorConvention, interpolatedParams, metadataContext, isRuntimePrefetchable) {
const metadataItems = await resolveMetadataItems(tree, searchParams, errorConvention, interpolatedParams, isRuntimePrefetchable);
const workStore = _workasyncstorageexternal.workAsyncStorage.getStore();
if (!workStore) {
throw Object.defineProperty(new _invarianterror.InvariantError('Expected workStore to be initialized'), "__NEXT_ERROR_CODE", {
value: "E1068",
enumerable: false,
configurable: true
});
}
return accumulateMetadata(workStore.route, metadataItems, pathname, metadataContext);
}
async function resolveViewport(tree, searchParams, errorConvention, interpolatedParams, isRuntimePrefetchable) {
const viewportItems = await resolveViewportItems(tree, searchParams, errorConvention, interpolatedParams, isRuntimePrefetchable);
return accumulateViewport(viewportItems);
}
function isPromiseLike(value) {
return typeof value === 'object' && value !== null && typeof value.then === 'function';
}
//# sourceMappingURL=resolve-metadata.js.map

View File

@@ -1,232 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
resolveAlternates: null,
resolveAppLinks: null,
resolveAppleWebApp: null,
resolveFacebook: null,
resolveItunes: null,
resolvePagination: null,
resolveRobots: null,
resolveThemeColor: null,
resolveVerification: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
resolveAlternates: function() {
return resolveAlternates;
},
resolveAppLinks: function() {
return resolveAppLinks;
},
resolveAppleWebApp: function() {
return resolveAppleWebApp;
},
resolveFacebook: function() {
return resolveFacebook;
},
resolveItunes: function() {
return resolveItunes;
},
resolvePagination: function() {
return resolvePagination;
},
resolveRobots: function() {
return resolveRobots;
},
resolveThemeColor: function() {
return resolveThemeColor;
},
resolveVerification: function() {
return resolveVerification;
}
});
const _utils = require("../generate/utils");
const _resolveurl = require("./resolve-url");
function resolveAlternateUrl(url, metadataBase, pathname, metadataContext) {
// If alter native url is an URL instance,
// we treat it as a URL base and resolve with current pathname
if (url instanceof URL) {
const newUrl = new URL(pathname, url);
url.searchParams.forEach((value, key)=>newUrl.searchParams.set(key, value));
url = newUrl;
}
return (0, _resolveurl.resolveAbsoluteUrlWithPathname)(url, metadataBase, pathname, metadataContext);
}
const resolveThemeColor = (themeColor)=>{
var _resolveAsArrayOrUndefined;
if (!themeColor) return null;
const themeColorDescriptors = [];
(_resolveAsArrayOrUndefined = (0, _utils.resolveAsArrayOrUndefined)(themeColor)) == null ? void 0 : _resolveAsArrayOrUndefined.forEach((descriptor)=>{
if (typeof descriptor === 'string') themeColorDescriptors.push({
color: descriptor
});
else if (typeof descriptor === 'object') themeColorDescriptors.push({
color: descriptor.color,
media: descriptor.media
});
});
return themeColorDescriptors;
};
async function resolveUrlValuesOfObject(obj, metadataBase, pathname, metadataContext) {
if (!obj) return null;
const result = {};
for (const [key, value] of Object.entries(obj)){
if (typeof value === 'string' || value instanceof URL) {
const pathnameForUrl = await pathname;
result[key] = [
{
url: resolveAlternateUrl(value, metadataBase, pathnameForUrl, metadataContext)
}
];
} else if (value && value.length) {
result[key] = [];
const pathnameForUrl = await pathname;
value.forEach((item, index)=>{
const url = resolveAlternateUrl(item.url, metadataBase, pathnameForUrl, metadataContext);
result[key][index] = {
url,
title: item.title
};
});
}
}
return result;
}
async function resolveCanonicalUrl(urlOrDescriptor, metadataBase, pathname, metadataContext) {
if (!urlOrDescriptor) return null;
const url = typeof urlOrDescriptor === 'string' || urlOrDescriptor instanceof URL ? urlOrDescriptor : urlOrDescriptor.url;
const pathnameForUrl = await pathname;
// Return string url because structureClone can't handle URL instance
return {
url: resolveAlternateUrl(url, metadataBase, pathnameForUrl, metadataContext)
};
}
const resolveAlternates = async (alternates, metadataBase, pathname, context)=>{
if (!alternates) return null;
const canonical = await resolveCanonicalUrl(alternates.canonical, metadataBase, pathname, context);
const languages = await resolveUrlValuesOfObject(alternates.languages, metadataBase, pathname, context);
const media = await resolveUrlValuesOfObject(alternates.media, metadataBase, pathname, context);
const types = await resolveUrlValuesOfObject(alternates.types, metadataBase, pathname, context);
return {
canonical,
languages,
media,
types
};
};
const robotsKeys = [
'noarchive',
'nosnippet',
'noimageindex',
'nocache',
'notranslate',
'indexifembedded',
'nositelinkssearchbox',
'unavailable_after',
'max-video-preview',
'max-image-preview',
'max-snippet'
];
const resolveRobotsValue = (robots)=>{
if (!robots) return null;
if (typeof robots === 'string') return robots;
const values = [];
if (robots.index) values.push('index');
else if (typeof robots.index === 'boolean') values.push('noindex');
if (robots.follow) values.push('follow');
else if (typeof robots.follow === 'boolean') values.push('nofollow');
for (const key of robotsKeys){
const value = robots[key];
if (typeof value !== 'undefined' && value !== false) {
values.push(typeof value === 'boolean' ? key : `${key}:${value}`);
}
}
return values.join(', ');
};
const resolveRobots = (robots)=>{
if (!robots) return null;
return {
basic: resolveRobotsValue(robots),
googleBot: typeof robots !== 'string' ? resolveRobotsValue(robots.googleBot) : null
};
};
const VerificationKeys = [
'google',
'yahoo',
'yandex',
'me',
'other'
];
const resolveVerification = (verification)=>{
if (!verification) return null;
const res = {};
for (const key of VerificationKeys){
const value = verification[key];
if (value) {
if (key === 'other') {
res.other = {};
for(const otherKey in verification.other){
const otherValue = (0, _utils.resolveAsArrayOrUndefined)(verification.other[otherKey]);
if (otherValue) res.other[otherKey] = otherValue;
}
} else res[key] = (0, _utils.resolveAsArrayOrUndefined)(value);
}
}
return res;
};
const resolveAppleWebApp = (appWebApp)=>{
var _resolveAsArrayOrUndefined;
if (!appWebApp) return null;
if (appWebApp === true) {
return {
capable: true
};
}
const startupImages = appWebApp.startupImage ? (_resolveAsArrayOrUndefined = (0, _utils.resolveAsArrayOrUndefined)(appWebApp.startupImage)) == null ? void 0 : _resolveAsArrayOrUndefined.map((item)=>typeof item === 'string' ? {
url: item
} : item) : null;
return {
capable: 'capable' in appWebApp ? !!appWebApp.capable : true,
title: appWebApp.title || null,
startupImage: startupImages,
statusBarStyle: appWebApp.statusBarStyle || 'default'
};
};
const resolveAppLinks = (appLinks)=>{
if (!appLinks) return null;
for(const key in appLinks){
// @ts-ignore // TODO: type infer
appLinks[key] = (0, _utils.resolveAsArrayOrUndefined)(appLinks[key]);
}
return appLinks;
};
const resolveItunes = async (itunes, metadataBase, pathname, context)=>{
if (!itunes) return null;
return {
appId: itunes.appId,
appArgument: itunes.appArgument ? resolveAlternateUrl(itunes.appArgument, metadataBase, await pathname, context) : undefined
};
};
const resolveFacebook = (facebook)=>{
if (!facebook) return null;
return {
appId: facebook.appId,
admins: (0, _utils.resolveAsArrayOrUndefined)(facebook.admins)
};
};
const resolvePagination = async (pagination, metadataBase, pathname, context)=>{
return {
previous: (pagination == null ? void 0 : pagination.previous) ? resolveAlternateUrl(pagination.previous, metadataBase, await pathname, context) : null,
next: (pagination == null ? void 0 : pagination.next) ? resolveAlternateUrl(pagination.next, metadataBase, await pathname, context) : null
};
};
//# sourceMappingURL=resolve-basics.js.map

View File

@@ -1,56 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
resolveIcon: null,
resolveIcons: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
resolveIcon: function() {
return resolveIcon;
},
resolveIcons: function() {
return resolveIcons;
}
});
const _utils = require("../generate/utils");
const _resolveurl = require("./resolve-url");
const _constants = require("../constants");
function resolveIcon(icon) {
if ((0, _resolveurl.isStringOrURL)(icon)) return {
url: icon
};
else if (Array.isArray(icon)) return icon;
return icon;
}
const resolveIcons = (icons)=>{
if (!icons) {
return null;
}
const resolved = {
icon: [],
apple: []
};
if (Array.isArray(icons)) {
resolved.icon = icons.map(resolveIcon).filter(Boolean);
} else if ((0, _resolveurl.isStringOrURL)(icons)) {
resolved.icon = [
resolveIcon(icons)
];
} else {
for (const key of _constants.IconKeys){
const values = (0, _utils.resolveAsArrayOrUndefined)(icons[key]);
if (values) resolved[key] = values.map(resolveIcon);
}
}
return resolved;
};
//# sourceMappingURL=resolve-icons.js.map

View File

@@ -1,199 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
resolveImages: null,
resolveOpenGraph: null,
resolveTwitter: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
resolveImages: function() {
return resolveImages;
},
resolveOpenGraph: function() {
return resolveOpenGraph;
},
resolveTwitter: function() {
return resolveTwitter;
}
});
const _utils = require("../generate/utils");
const _resolveurl = require("./resolve-url");
const _resolvetitle = require("./resolve-title");
const _url = require("../../url");
const _log = require("../../../build/output/log");
const OgTypeFields = {
article: [
'authors',
'tags'
],
song: [
'albums',
'musicians'
],
playlist: [
'albums',
'musicians'
],
radio: [
'creators'
],
video: [
'actors',
'directors',
'writers',
'tags'
],
basic: [
'emails',
'phoneNumbers',
'faxNumbers',
'alternateLocale',
'audio',
'videos'
]
};
function resolveAndValidateImage(item, metadataBase, isStaticMetadataRouteFile) {
if (!item) return undefined;
const isItemUrl = (0, _resolveurl.isStringOrURL)(item);
const inputUrl = isItemUrl ? item : item.url;
if (!inputUrl) return undefined;
// process.env.VERCEL is set to "1" when System Environment Variables are
// exposed. When exposed, validation is not necessary since we are falling back to
// process.env.VERCEL_PROJECT_PRODUCTION_URL, process.env.VERCEL_BRANCH_URL, or
// process.env.VERCEL_URL for the `metadataBase`. process.env.VERCEL is undefined
// when System Environment Variables are not exposed. When not exposed, we cannot
// detect in the build environment if the deployment is a Vercel deployment or not.
//
// x-ref: https://vercel.com/docs/projects/environment-variables/system-environment-variables#system-environment-variables
const isUsingVercelSystemEnvironmentVariables = Boolean(process.env.VERCEL);
const isRelativeUrl = typeof inputUrl === 'string' && !(0, _url.isFullStringUrl)(inputUrl);
// When no explicit metadataBase is specified by the user, we'll override it with the fallback metadata
// under the following conditions:
// - The provided URL is relative (ie ./og-image).
// - The image is statically generated by Next.js (such as the special `opengraph-image` route)
// In both cases, we want to ensure that across all environments, the ogImage is a fully qualified URL.
// In the `opengraph-image` case, since the user isn't explicitly passing a relative path, this ensures
// the ogImage will be properly discovered across different environments without the user needing to
// have a bunch of `process.env` checks when defining their `metadataBase`.
if (isRelativeUrl && (!metadataBase || isStaticMetadataRouteFile)) {
const fallbackMetadataBase = (0, _resolveurl.getSocialImageMetadataBaseFallback)(metadataBase);
// When not using Vercel environment variables for URL injection, we aren't able to determine
// a fallback value for `metadataBase`. For self-hosted setups, we want to warn
// about this since the only fallback we'll be able to generate is `localhost`.
// In development, we'll only warn for relative metadata that isn't part of the static
// metadata conventions (eg `opengraph-image`), as otherwise it's currently very noisy
// for common cases. Eventually we should remove this warning all together in favor of
// devtools.
const shouldWarn = !isUsingVercelSystemEnvironmentVariables && !metadataBase && (process.env.NODE_ENV === 'production' || !isStaticMetadataRouteFile);
if (shouldWarn) {
(0, _log.warnOnce)(`metadataBase property in metadata export is not set for resolving social open graph or twitter images, using "${fallbackMetadataBase.origin}". See https://nextjs.org/docs/app/api-reference/functions/generate-metadata#metadatabase`);
}
metadataBase = fallbackMetadataBase;
}
return isItemUrl ? {
url: (0, _resolveurl.resolveUrl)(inputUrl, metadataBase)
} : {
...item,
// Update image descriptor url
url: (0, _resolveurl.resolveUrl)(inputUrl, metadataBase)
};
}
function resolveImages(images, metadataBase, isStaticMetadataRouteFile) {
const resolvedImages = (0, _utils.resolveAsArrayOrUndefined)(images);
if (!resolvedImages) return resolvedImages;
const nonNullableImages = [];
for (const item of resolvedImages){
const resolvedItem = resolveAndValidateImage(item, metadataBase, isStaticMetadataRouteFile);
if (!resolvedItem) continue;
nonNullableImages.push(resolvedItem);
}
return nonNullableImages;
}
const ogTypeToFields = {
article: OgTypeFields.article,
book: OgTypeFields.article,
'music.song': OgTypeFields.song,
'music.album': OgTypeFields.song,
'music.playlist': OgTypeFields.playlist,
'music.radio_station': OgTypeFields.radio,
'video.movie': OgTypeFields.video,
'video.episode': OgTypeFields.video
};
function getFieldsByOgType(ogType) {
if (!ogType || !(ogType in ogTypeToFields)) return OgTypeFields.basic;
return ogTypeToFields[ogType].concat(OgTypeFields.basic);
}
const resolveOpenGraph = async (openGraph, metadataBase, pathname, metadataContext, titleTemplate)=>{
if (!openGraph) return null;
function resolveProps(target, og) {
const ogType = og && 'type' in og ? og.type : undefined;
const keys = getFieldsByOgType(ogType);
for (const k of keys){
const key = k;
if (key in og && key !== 'url') {
const value = og[key];
target[key] = value ? (0, _utils.resolveArray)(value) : null;
}
}
target.images = resolveImages(og.images, metadataBase, metadataContext.isStaticMetadataRouteFile);
}
const resolved = {
...openGraph,
title: (0, _resolvetitle.resolveTitle)(openGraph.title, titleTemplate)
};
resolveProps(resolved, openGraph);
resolved.url = openGraph.url ? (0, _resolveurl.resolveAbsoluteUrlWithPathname)(openGraph.url, metadataBase, await pathname, metadataContext) : null;
return resolved;
};
const TwitterBasicInfoKeys = [
'site',
'siteId',
'creator',
'creatorId',
'description'
];
const resolveTwitter = (twitter, metadataBase, metadataContext, titleTemplate)=>{
var _resolved_images;
if (!twitter) return null;
let card = 'card' in twitter ? twitter.card : undefined;
const resolved = {
...twitter,
title: (0, _resolvetitle.resolveTitle)(twitter.title, titleTemplate)
};
for (const infoKey of TwitterBasicInfoKeys){
resolved[infoKey] = twitter[infoKey] || null;
}
resolved.images = resolveImages(twitter.images, metadataBase, metadataContext.isStaticMetadataRouteFile);
card = card || (((_resolved_images = resolved.images) == null ? void 0 : _resolved_images.length) ? 'summary_large_image' : 'summary');
resolved.card = card;
if ('card' in resolved) {
switch(resolved.card){
case 'player':
{
resolved.players = (0, _utils.resolveAsArrayOrUndefined)(resolved.players) || [];
break;
}
case 'app':
{
resolved.app = resolved.app || {};
break;
}
case 'summary':
case 'summary_large_image':
break;
default:
resolved;
}
}
return resolved;
};
//# sourceMappingURL=resolve-opengraph.js.map

View File

@@ -1,40 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "resolveTitle", {
enumerable: true,
get: function() {
return resolveTitle;
}
});
function resolveTitleTemplate(template, title) {
return template ? template.replace(/%s/g, title) : title;
}
function resolveTitle(title, stashedTemplate) {
let resolved;
const template = typeof title !== 'string' && title && 'template' in title ? title.template : null;
if (typeof title === 'string') {
resolved = resolveTitleTemplate(stashedTemplate, title);
} else if (title) {
if ('default' in title) {
resolved = resolveTitleTemplate(stashedTemplate, title.default);
}
if ('absolute' in title && title.absolute) {
resolved = title.absolute;
}
}
if (title && typeof title !== 'string') {
return {
template,
absolute: resolved || ''
};
} else {
return {
absolute: resolved || title || '',
template
};
}
}
//# sourceMappingURL=resolve-title.js.map

View File

@@ -1,135 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
getSocialImageMetadataBaseFallback: null,
isStringOrURL: null,
resolveAbsoluteUrlWithPathname: null,
resolveRelativeUrl: null,
resolveUrl: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
getSocialImageMetadataBaseFallback: function() {
return getSocialImageMetadataBaseFallback;
},
isStringOrURL: function() {
return isStringOrURL;
},
resolveAbsoluteUrlWithPathname: function() {
return resolveAbsoluteUrlWithPathname;
},
resolveRelativeUrl: function() {
return resolveRelativeUrl;
},
resolveUrl: function() {
return resolveUrl;
}
});
const _path = /*#__PURE__*/ _interop_require_default(require("../../../shared/lib/isomorphic/path"));
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function isStringOrURL(icon) {
return typeof icon === 'string' || icon instanceof URL;
}
function createLocalMetadataBase() {
// Check if experimental HTTPS is enabled
const isExperimentalHttps = Boolean(process.env.__NEXT_EXPERIMENTAL_HTTPS);
const protocol = isExperimentalHttps ? 'https' : 'http';
return new URL(`${protocol}://localhost:${process.env.PORT || 3000}`);
}
function getPreviewDeploymentUrl() {
const origin = process.env.VERCEL_BRANCH_URL || process.env.VERCEL_URL;
return origin ? new URL(`https://${origin}`) : undefined;
}
function getProductionDeploymentUrl() {
const origin = process.env.VERCEL_PROJECT_PRODUCTION_URL;
return origin ? new URL(`https://${origin}`) : undefined;
}
function getSocialImageMetadataBaseFallback(metadataBase) {
const defaultMetadataBase = createLocalMetadataBase();
const previewDeploymentUrl = getPreviewDeploymentUrl();
const productionDeploymentUrl = getProductionDeploymentUrl();
let fallbackMetadataBase;
if (process.env.NODE_ENV === 'development') {
fallbackMetadataBase = defaultMetadataBase;
} else {
fallbackMetadataBase = process.env.NODE_ENV === 'production' && previewDeploymentUrl && process.env.VERCEL_ENV === 'preview' ? previewDeploymentUrl : metadataBase || productionDeploymentUrl || defaultMetadataBase;
}
return fallbackMetadataBase;
}
function resolveUrl(url, metadataBase) {
if (url instanceof URL) return url;
if (!url) return null;
try {
// If we can construct a URL instance from url, ignore metadataBase
const parsedUrl = new URL(url);
return parsedUrl;
} catch {}
if (!metadataBase) {
metadataBase = createLocalMetadataBase();
}
// Handle relative or absolute paths
const pathname = metadataBase.pathname || '';
const joinedPath = _path.default.posix.join(pathname, url);
return new URL(joinedPath, metadataBase);
}
// Resolve with `pathname` if `url` is a relative path.
function resolveRelativeUrl(url, pathname) {
if (typeof url === 'string' && url.startsWith('./')) {
return _path.default.posix.resolve(pathname, url);
}
return url;
}
// The regex is matching logic from packages/next/src/lib/load-custom-routes.ts
const FILE_REGEX = /^(?:\/((?!\.well-known(?:\/.*)?)(?:[^/]+\/)*[^/]+\.\w+))(\/?|$)/i;
function isFilePattern(pathname) {
return FILE_REGEX.test(pathname);
}
// Resolve `pathname` if `url` is a relative path the compose with `metadataBase`.
function resolveAbsoluteUrlWithPathname(url, metadataBase, pathname, { trailingSlash }) {
// Resolve url with pathname that always starts with `/`
url = resolveRelativeUrl(url, pathname);
// Convert string url or URL instance to absolute url string,
// if there's case needs to be resolved with metadataBase
let resolvedUrl = '';
const result = metadataBase ? resolveUrl(url, metadataBase) : url;
if (typeof result === 'string') {
resolvedUrl = result;
} else {
resolvedUrl = result.pathname === '/' && result.searchParams.size === 0 ? result.origin : result.href;
}
// Add trailing slash if it's enabled for urls matches the condition
// - Not external, same origin with metadataBase
// - Doesn't have query
if (trailingSlash && !resolvedUrl.endsWith('/')) {
let isRelative = resolvedUrl.startsWith('/');
let hasQuery = resolvedUrl.includes('?');
let isExternal = false;
let isFileUrl = false;
if (!isRelative) {
try {
const parsedUrl = new URL(resolvedUrl);
isExternal = metadataBase != null && parsedUrl.origin !== metadataBase.origin;
isFileUrl = isFilePattern(parsedUrl.pathname);
} catch {
// If it's not a valid URL, treat it as external
isExternal = true;
}
if (// Do not apply trailing slash for file like urls, aligning with the behavior with `trailingSlash`
!isFileUrl && !isExternal && !hasQuery) return `${resolvedUrl}/`;
}
}
return resolvedUrl;
}
//# sourceMappingURL=resolve-url.js.map

View File

@@ -1,7 +0,0 @@
// Reference: https://hreflang.org/what-is-a-valid-hreflang
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//# sourceMappingURL=alternative-urls-types.js.map

View File

@@ -1,9 +0,0 @@
// When rendering applink meta tags add a namespace tag before each array instance
// if more than one member exists.
// ref: https://developers.facebook.com/docs/applinks/metadata-reference
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//# sourceMappingURL=extra-types.js.map

View File

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

View File

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

View File

@@ -1,18 +0,0 @@
/**
* Next.js Metadata API
*
* This file defines the types used by Next.js to configure metadata
* through static exports or dynamic `generateMetadata` functions in Server Components.
*
* @remarks
* - The static `metadata` object and `generateMetadata` function are only supported in Server Components.
* - Do not export both a `metadata` object and a `generateMetadata` function from the same route segment.
* - You can still render metadata in client components directly as part of the component's JSX.
*
* @see https://nextjs.org/docs/app/api-reference/metadata
*/ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//# sourceMappingURL=metadata-interface.js.map

View File

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

View File

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

View File

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

View File

@@ -1,7 +0,0 @@
// Reference: https://developer.twitter.com/en/docs/twitter-for-websites/cards/overview/markup
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//# sourceMappingURL=twitter-types.js.map

View File

@@ -1,20 +0,0 @@
/**
* Map of images extensions to MIME types
*/ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "imageExtMimeTypeMap", {
enumerable: true,
get: function() {
return imageExtMimeTypeMap;
}
});
const imageExtMimeTypeMap = {
jpeg: 'image/jpeg',
png: 'image/png',
ico: 'image/x-icon',
svg: 'image/svg+xml'
};
//# sourceMappingURL=mime-type.js.map

View File

@@ -1,204 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "createSelfSignedCertificate", {
enumerable: true,
get: function() {
return createSelfSignedCertificate;
}
});
const _nodefs = /*#__PURE__*/ _interop_require_default(require("node:fs"));
const _nodepath = /*#__PURE__*/ _interop_require_default(require("node:path"));
const _nodecrypto = require("node:crypto");
const _getcachedirectory = require("./helpers/get-cache-directory");
const _log = /*#__PURE__*/ _interop_require_wildcard(require("../build/output/log"));
const _nodechild_process = require("node:child_process");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function _getRequireWildcardCache(nodeInterop) {
if (typeof WeakMap !== "function") return null;
var cacheBabelInterop = new WeakMap();
var cacheNodeInterop = new WeakMap();
return (_getRequireWildcardCache = function(nodeInterop) {
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
})(nodeInterop);
}
function _interop_require_wildcard(obj, nodeInterop) {
if (!nodeInterop && obj && obj.__esModule) {
return obj;
}
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
return {
default: obj
};
}
var cache = _getRequireWildcardCache(nodeInterop);
if (cache && cache.has(obj)) {
return cache.get(obj);
}
var newObj = {
__proto__: null
};
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
for(var key in obj){
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
if (desc && (desc.get || desc.set)) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
newObj.default = obj;
if (cache) {
cache.set(obj, newObj);
}
return newObj;
}
const { WritableStream } = require('node:stream/web');
const MKCERT_VERSION = 'v1.4.4';
function getBinaryName() {
const platform = process.platform;
const arch = process.arch === 'x64' ? 'amd64' : process.arch;
if (platform === 'win32') {
return `mkcert-${MKCERT_VERSION}-windows-${arch}.exe`;
}
if (platform === 'darwin') {
return `mkcert-${MKCERT_VERSION}-darwin-${arch}`;
}
if (platform === 'linux') {
return `mkcert-${MKCERT_VERSION}-linux-${arch}`;
}
throw Object.defineProperty(new Error(`Unsupported platform: ${platform}`), "__NEXT_ERROR_CODE", {
value: "E141",
enumerable: false,
configurable: true
});
}
async function downloadBinary() {
try {
const binaryName = getBinaryName();
const cacheDirectory = (0, _getcachedirectory.getCacheDirectory)('mkcert');
const binaryPath = _nodepath.default.join(cacheDirectory, binaryName);
if (_nodefs.default.existsSync(binaryPath)) {
return binaryPath;
}
const downloadUrl = `https://github.com/FiloSottile/mkcert/releases/download/${MKCERT_VERSION}/${binaryName}`;
await _nodefs.default.promises.mkdir(cacheDirectory, {
recursive: true
});
_log.info(`Downloading mkcert package...`);
const response = await fetch(downloadUrl);
if (!response.ok || !response.body) {
throw Object.defineProperty(new Error(`request failed with status ${response.status}`), "__NEXT_ERROR_CODE", {
value: "E109",
enumerable: false,
configurable: true
});
}
_log.info(`Download response was successful, writing to disk`);
const binaryWriteStream = _nodefs.default.createWriteStream(binaryPath);
await response.body.pipeTo(new WritableStream({
write (chunk) {
return new Promise((resolve, reject)=>{
binaryWriteStream.write(chunk, (error)=>{
if (error) {
reject(error);
return;
}
resolve();
});
});
},
close () {
return new Promise((resolve, reject)=>{
binaryWriteStream.close((error)=>{
if (error) {
reject(error);
return;
}
resolve();
});
});
}
}));
await _nodefs.default.promises.chmod(binaryPath, 493);
return binaryPath;
} catch (err) {
_log.error('Error downloading mkcert:', err);
}
}
async function createSelfSignedCertificate(host, certDir = 'certificates') {
try {
const binaryPath = await downloadBinary();
if (!binaryPath) throw Object.defineProperty(new Error('missing mkcert binary'), "__NEXT_ERROR_CODE", {
value: "E198",
enumerable: false,
configurable: true
});
const resolvedCertDir = _nodepath.default.resolve(process.cwd(), `./${certDir}`);
await _nodefs.default.promises.mkdir(resolvedCertDir, {
recursive: true
});
const keyPath = _nodepath.default.resolve(resolvedCertDir, 'localhost-key.pem');
const certPath = _nodepath.default.resolve(resolvedCertDir, 'localhost.pem');
if (_nodefs.default.existsSync(keyPath) && _nodefs.default.existsSync(certPath)) {
const cert = new _nodecrypto.X509Certificate(_nodefs.default.readFileSync(certPath));
const key = _nodefs.default.readFileSync(keyPath);
if (cert.checkHost(host ?? 'localhost') && cert.checkPrivateKey((0, _nodecrypto.createPrivateKey)(key))) {
_log.info('Using already generated self signed certificate');
const caLocation = (0, _nodechild_process.execSync)(`"${binaryPath}" -CAROOT`).toString().trim();
return {
key: keyPath,
cert: certPath,
rootCA: `${caLocation}/rootCA.pem`
};
}
}
_log.info('Attempting to generate self signed certificate. This may prompt for your password');
const defaultHosts = [
'localhost',
'127.0.0.1',
'::1'
];
const hosts = host && !defaultHosts.includes(host) ? [
...defaultHosts,
host
] : defaultHosts;
(0, _nodechild_process.execSync)(`"${binaryPath}" -install -key-file "${keyPath}" -cert-file "${certPath}" ${hosts.join(' ')}`, {
stdio: 'ignore'
});
const caLocation = (0, _nodechild_process.execSync)(`"${binaryPath}" -CAROOT`).toString().trim();
if (!_nodefs.default.existsSync(keyPath) || !_nodefs.default.existsSync(certPath)) {
throw Object.defineProperty(new Error('Certificate files not found'), "__NEXT_ERROR_CODE", {
value: "E131",
enumerable: false,
configurable: true
});
}
_log.info(`CA Root certificate created in ${caLocation}`);
_log.info(`Certificates created in ${resolvedCertDir}`);
const gitignorePath = _nodepath.default.resolve(process.cwd(), './.gitignore');
if (_nodefs.default.existsSync(gitignorePath)) {
const gitignore = await _nodefs.default.promises.readFile(gitignorePath, 'utf8');
if (!gitignore.includes(certDir)) {
_log.info('Adding certificates to .gitignore');
await _nodefs.default.promises.appendFile(gitignorePath, `\n${certDir}`);
}
}
return {
key: keyPath,
cert: certPath,
rootCA: `${caLocation}/rootCA.pem`
};
} catch (err) {
_log.error('Failed to generate self-signed certificate. Falling back to http.', err);
}
}
//# sourceMappingURL=mkcert.js.map

View File

@@ -1,75 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "MultiFileWriter", {
enumerable: true,
get: function() {
return MultiFileWriter;
}
});
const _path = /*#__PURE__*/ _interop_require_default(require("../shared/lib/isomorphic/path"));
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
class MultiFileWriter {
constructor(/**
* The file system methods to use.
*/ fs){
this.fs = fs;
this.tasks = [];
}
/**
* Finds or creates a task for a directory.
*
* @param directory - The directory to find or create a task for.
* @returns The task for the directory.
*/ findOrCreateTask(directory) {
// See if this directory already has a task to create it.
for (const task of this.tasks){
if (task[0] === directory) {
return task;
}
}
const promise = this.fs.mkdir(directory);
// Attach a catch handler so that it doesn't throw an unhandled promise
// rejection warning.
promise.catch(()=>{});
// Otherwise, create a new task for this directory.
const task = [
directory,
promise,
[]
];
this.tasks.push(task);
return task;
}
/**
* Appends a file to the writer to be written after its containing directory
* is created. The file writer should be awaited after all the files have been
* appended. Any async operation that occurs between appending and awaiting
* may cause an unhandled promise rejection warning and potentially crash the
* process.
*
* @param filePath - The path to the file to write.
* @param data - The data to write to the file.
*/ append(filePath, data) {
// Find or create a task for the directory that contains the file.
const task = this.findOrCreateTask(_path.default.dirname(filePath));
const promise = task[1].then(()=>this.fs.writeFile(filePath, data));
// Attach a catch handler so that it doesn't throw an unhandled promise
// rejection warning.
promise.catch(()=>{});
// Add the file write to the task AFTER the directory promise has resolved.
task[2].push(promise);
}
/**
* Returns a promise that resolves when all the files have been written.
*/ wait() {
return Promise.all(this.tasks.flatMap((task)=>task[2]));
}
}
//# sourceMappingURL=multi-file-writer.js.map

View File

@@ -1,16 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "needsExperimentalReact", {
enumerable: true,
get: function() {
return needsExperimentalReact;
}
});
function needsExperimentalReact(config) {
const { taint, transitionIndicator, gestureTransition } = config.experimental || {};
return Boolean(taint || transitionIndicator || gestureTransition);
}
//# sourceMappingURL=needs-experimental-react.js.map

View File

@@ -1,15 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "nonNullable", {
enumerable: true,
get: function() {
return nonNullable;
}
});
function nonNullable(value) {
return value !== null && value !== undefined;
}
//# sourceMappingURL=non-nullable.js.map

View File

@@ -1,21 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "normalizePath", {
enumerable: true,
get: function() {
return normalizePath;
}
});
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function normalizePath(file) {
return _path.default.sep === '\\' ? file.replace(/\\/g, '/') : file;
}
//# sourceMappingURL=normalize-path.js.map

View File

@@ -1,15 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "getOxfordCommaList", {
enumerable: true,
get: function() {
return getOxfordCommaList;
}
});
function getOxfordCommaList(items) {
return items.map((v, index, { length })=>(index > 0 ? index === length - 1 ? length > 2 ? ', and ' : ' and ' : ', ' : '') + v).join('');
}
//# sourceMappingURL=oxford-comma-list.js.map

View File

@@ -1,18 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "PAGE_TYPES", {
enumerable: true,
get: function() {
return PAGE_TYPES;
}
});
var PAGE_TYPES = /*#__PURE__*/ function(PAGE_TYPES) {
PAGE_TYPES["PAGES"] = "pages";
PAGE_TYPES["ROOT"] = "root";
PAGE_TYPES["APP"] = "app";
return PAGE_TYPES;
}({});
//# sourceMappingURL=page-types.js.map

View File

@@ -1,185 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "patchIncorrectLockfile", {
enumerable: true,
get: function() {
return patchIncorrectLockfile;
}
});
const _fs = require("fs");
const _log = /*#__PURE__*/ _interop_require_wildcard(require("../build/output/log"));
const _findup = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/find-up"));
const _packagejson = require("next/package.json");
const _ciinfo = require("../server/ci-info");
const _getregistry = require("./helpers/get-registry");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function _getRequireWildcardCache(nodeInterop) {
if (typeof WeakMap !== "function") return null;
var cacheBabelInterop = new WeakMap();
var cacheNodeInterop = new WeakMap();
return (_getRequireWildcardCache = function(nodeInterop) {
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
})(nodeInterop);
}
function _interop_require_wildcard(obj, nodeInterop) {
if (!nodeInterop && obj && obj.__esModule) {
return obj;
}
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
return {
default: obj
};
}
var cache = _getRequireWildcardCache(nodeInterop);
if (cache && cache.has(obj)) {
return cache.get(obj);
}
var newObj = {
__proto__: null
};
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
for(var key in obj){
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
if (desc && (desc.get || desc.set)) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
newObj.default = obj;
if (cache) {
cache.set(obj, newObj);
}
return newObj;
}
let registry;
async function fetchPkgInfo(pkg) {
if (!registry) registry = (0, _getregistry.getRegistry)();
const res = await fetch(`${registry}${pkg}`);
if (!res.ok) {
throw Object.defineProperty(new Error(`Failed to fetch registry info for ${pkg}, got status ${res.status}`), "__NEXT_ERROR_CODE", {
value: "E172",
enumerable: false,
configurable: true
});
}
const data = await res.json();
const versionData = data.versions["16.2.6"];
return {
os: versionData.os,
cpu: versionData.cpu,
engines: versionData.engines,
tarball: versionData.dist.tarball,
integrity: versionData.dist.integrity
};
}
async function patchIncorrectLockfile(dir) {
if (process.env.NEXT_IGNORE_INCORRECT_LOCKFILE) {
return;
}
const lockfilePath = await (0, _findup.default)('package-lock.json', {
cwd: dir
});
if (!lockfilePath) {
// if no lockfile present there is no action to take
return;
}
const content = await _fs.promises.readFile(lockfilePath, 'utf8');
// maintain current line ending
const endingNewline = content.endsWith('\r\n') ? '\r\n' : content.endsWith('\n') ? '\n' : '';
const lockfileParsed = JSON.parse(content);
const lockfileVersion = parseInt(lockfileParsed == null ? void 0 : lockfileParsed.lockfileVersion, 10);
const expectedSwcPkgs = Object.keys(_packagejson.optionalDependencies || {}).filter((pkg)=>pkg.startsWith('@next/swc-'));
const patchDependency = (pkg, pkgData)=>{
lockfileParsed.dependencies[pkg] = {
version: "16.2.6",
resolved: pkgData.tarball,
integrity: pkgData.integrity,
optional: true
};
};
const patchPackage = (pkg, pkgData)=>{
lockfileParsed.packages[pkg] = {
version: "16.2.6",
resolved: pkgData.tarball,
integrity: pkgData.integrity,
cpu: pkgData.cpu,
optional: true,
os: pkgData.os,
engines: pkgData.engines
};
};
try {
const supportedVersions = [
1,
2,
3
];
if (!supportedVersions.includes(lockfileVersion)) {
// bail on unsupported version
return;
}
// v1 only uses dependencies
// v2 uses dependencies and packages
// v3 only uses packages
const shouldPatchDependencies = lockfileVersion === 1 || lockfileVersion === 2;
const shouldPatchPackages = lockfileVersion === 2 || lockfileVersion === 3;
if (shouldPatchDependencies && !lockfileParsed.dependencies || shouldPatchPackages && !lockfileParsed.packages) {
// invalid lockfile so bail
return;
}
const missingSwcPkgs = [];
let pkgPrefix;
if (shouldPatchPackages) {
pkgPrefix = '';
for (const pkg of Object.keys(lockfileParsed.packages)){
if (pkg.endsWith('node_modules/next')) {
pkgPrefix = pkg.substring(0, pkg.length - 4);
}
}
if (!pkgPrefix) {
// unable to locate the next package so bail
return;
}
}
for (const pkg of expectedSwcPkgs){
if (shouldPatchDependencies && !lockfileParsed.dependencies[pkg] || shouldPatchPackages && !lockfileParsed.packages[`${pkgPrefix}${pkg}`]) {
missingSwcPkgs.push(pkg);
}
}
if (missingSwcPkgs.length === 0) {
return;
}
_log.warn(`Found lockfile missing swc dependencies,`, _ciinfo.isCI ? 'run next locally to automatically patch' : 'patching...');
if (_ciinfo.isCI) {
// no point in updating in CI as the user can't save the patch
return;
}
const pkgsData = await Promise.all(missingSwcPkgs.map((pkg)=>fetchPkgInfo(pkg)));
for(let i = 0; i < pkgsData.length; i++){
const pkg = missingSwcPkgs[i];
const pkgData = pkgsData[i];
if (shouldPatchDependencies) {
patchDependency(pkg, pkgData);
}
if (shouldPatchPackages) {
patchPackage(`${pkgPrefix}${pkg}`, pkgData);
}
}
await _fs.promises.writeFile(lockfilePath, JSON.stringify(lockfileParsed, null, 2) + endingNewline);
_log.warn('Lockfile was successfully patched, please run "npm install" to ensure @next/swc dependencies are downloaded');
} catch (err) {
_log.error(`Failed to patch lockfile, please try uninstalling and reinstalling next in this workspace`);
console.error(err);
}
}
//# sourceMappingURL=patch-incorrect-lockfile.js.map

View File

@@ -1,19 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "pick", {
enumerable: true,
get: function() {
return pick;
}
});
function pick(obj, keys) {
const newObj = {};
for (const key of keys){
newObj[key] = obj[key];
}
return newObj;
}
//# sourceMappingURL=pick.js.map

View File

@@ -1,177 +0,0 @@
// ISC License
// Copyright (c) 2021 Alexey Raspopov, Kostiantyn Denysov, Anton Verinov
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
//
// https://github.com/alexeyraspopov/picocolors/blob/b6261487e7b81aaab2440e397a356732cad9e342/picocolors.js#L1
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
bgBlack: null,
bgBlue: null,
bgCyan: null,
bgGreen: null,
bgMagenta: null,
bgRed: null,
bgWhite: null,
bgYellow: null,
black: null,
blue: null,
bold: null,
cyan: null,
dim: null,
gray: null,
green: null,
hidden: null,
inverse: null,
italic: null,
magenta: null,
purple: null,
red: null,
reset: null,
strikethrough: null,
underline: null,
white: null,
yellow: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
bgBlack: function() {
return bgBlack;
},
bgBlue: function() {
return bgBlue;
},
bgCyan: function() {
return bgCyan;
},
bgGreen: function() {
return bgGreen;
},
bgMagenta: function() {
return bgMagenta;
},
bgRed: function() {
return bgRed;
},
bgWhite: function() {
return bgWhite;
},
bgYellow: function() {
return bgYellow;
},
black: function() {
return black;
},
blue: function() {
return blue;
},
bold: function() {
return bold;
},
cyan: function() {
return cyan;
},
dim: function() {
return dim;
},
gray: function() {
return gray;
},
green: function() {
return green;
},
hidden: function() {
return hidden;
},
inverse: function() {
return inverse;
},
italic: function() {
return italic;
},
magenta: function() {
return magenta;
},
purple: function() {
return purple;
},
red: function() {
return red;
},
reset: function() {
return reset;
},
strikethrough: function() {
return strikethrough;
},
underline: function() {
return underline;
},
white: function() {
return white;
},
yellow: function() {
return yellow;
}
});
var _globalThis;
const { env, stdout } = ((_globalThis = globalThis) == null ? void 0 : _globalThis.process) ?? {};
const enabled = env && !env.NO_COLOR && (env.FORCE_COLOR || (stdout == null ? void 0 : stdout.isTTY) && !env.CI && env.TERM !== 'dumb');
const replaceClose = (str, close, replace, index)=>{
const start = str.substring(0, index) + replace;
const end = str.substring(index + close.length);
const nextIndex = end.indexOf(close);
return ~nextIndex ? start + replaceClose(end, close, replace, nextIndex) : start + end;
};
const formatter = (open, close, replace = open)=>{
if (!enabled) return String;
return (input)=>{
const string = '' + input;
const index = string.indexOf(close, open.length);
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
};
};
const reset = enabled ? (s)=>`\x1b[0m${s}\x1b[0m` : String;
const bold = formatter('\x1b[1m', '\x1b[22m', '\x1b[22m\x1b[1m');
const dim = formatter('\x1b[2m', '\x1b[22m', '\x1b[22m\x1b[2m');
const italic = formatter('\x1b[3m', '\x1b[23m');
const underline = formatter('\x1b[4m', '\x1b[24m');
const inverse = formatter('\x1b[7m', '\x1b[27m');
const hidden = formatter('\x1b[8m', '\x1b[28m');
const strikethrough = formatter('\x1b[9m', '\x1b[29m');
const black = formatter('\x1b[30m', '\x1b[39m');
const red = formatter('\x1b[31m', '\x1b[39m');
const green = formatter('\x1b[32m', '\x1b[39m');
const yellow = formatter('\x1b[33m', '\x1b[39m');
const blue = formatter('\x1b[34m', '\x1b[39m');
const magenta = formatter('\x1b[35m', '\x1b[39m');
const purple = formatter('\x1b[38;2;173;127;168m', '\x1b[39m');
const cyan = formatter('\x1b[36m', '\x1b[39m');
const white = formatter('\x1b[37m', '\x1b[39m');
const gray = formatter('\x1b[90m', '\x1b[39m');
const bgBlack = formatter('\x1b[40m', '\x1b[49m');
const bgRed = formatter('\x1b[41m', '\x1b[49m');
const bgGreen = formatter('\x1b[42m', '\x1b[49m');
const bgYellow = formatter('\x1b[43m', '\x1b[49m');
const bgBlue = formatter('\x1b[44m', '\x1b[49m');
const bgMagenta = formatter('\x1b[45m', '\x1b[49m');
const bgCyan = formatter('\x1b[46m', '\x1b[49m');
const bgWhite = formatter('\x1b[47m', '\x1b[49m');
//# sourceMappingURL=picocolors.js.map

View File

@@ -1,74 +0,0 @@
/*
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.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.
*/ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "default", {
enumerable: true,
get: function() {
return prettyBytes;
}
});
const UNITS = [
'B',
'kB',
'MB',
'GB',
'TB',
'PB',
'EB',
'ZB',
'YB'
];
/*
Formats the given number using `Number#toLocaleString`.
- If locale is a string, the value is expected to be a locale-key (for example: `de`).
- If locale is true, the system default locale is used for translation.
- If no value for locale is specified, the number is returned unmodified.
*/ const toLocaleString = (number, locale)=>{
let result = number;
if (typeof locale === 'string') {
result = number.toLocaleString(locale);
} else if (locale === true) {
result = number.toLocaleString();
}
return result;
};
function prettyBytes(number, options) {
if (!Number.isFinite(number)) {
throw Object.defineProperty(new TypeError(`Expected a finite number, got ${typeof number}: ${number}`), "__NEXT_ERROR_CODE", {
value: "E572",
enumerable: false,
configurable: true
});
}
options = Object.assign({}, options);
if (options.signed && number === 0) {
return ' 0 B';
}
const isNegative = number < 0;
const prefix = isNegative ? '-' : options.signed ? '+' : '';
if (isNegative) {
number = -number;
}
if (number < 1) {
const numberString = toLocaleString(number, options.locale);
return prefix + numberString + ' B';
}
const exponent = Math.min(Math.floor(Math.log10(number) / 3), UNITS.length - 1);
number = Number((number / Math.pow(1000, exponent)).toPrecision(3));
const numberString = toLocaleString(number, options.locale);
const unit = UNITS[exponent];
return prefix + numberString + ' ' + unit;
}
//# sourceMappingURL=pretty-bytes.js.map

View File

@@ -1,20 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "realpathSync", {
enumerable: true,
get: function() {
return realpathSync;
}
});
const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
const isWindows = process.platform === 'win32';
const realpathSync = isWindows ? _fs.default.realpathSync : _fs.default.realpathSync.native;
//# sourceMappingURL=realpath.js.map

View File

@@ -1,76 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "recursiveCopy", {
enumerable: true,
get: function() {
return recursiveCopy;
}
});
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
const _fs = require("fs");
const _asyncsema = require("next/dist/compiled/async-sema");
const _iserror = /*#__PURE__*/ _interop_require_default(require("./is-error"));
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
const COPYFILE_EXCL = _fs.constants.COPYFILE_EXCL;
async function recursiveCopy(source, dest, { concurrency = 32, overwrite = false, filter = ()=>true } = {}) {
const cwdPath = process.cwd();
const from = _path.default.resolve(cwdPath, source);
const to = _path.default.resolve(cwdPath, dest);
const sema = new _asyncsema.Sema(concurrency);
// deep copy the file/directory
async function _copy(item, lstats) {
const target = item.replace(from, to);
await sema.acquire();
if (!lstats) {
// after lock on first run
lstats = await _fs.promises.lstat(from);
}
// readdir & lstat do not follow symbolic links
// if part is a symbolic link, follow it with stat
let isFile = lstats.isFile();
let isDirectory = lstats.isDirectory();
if (lstats.isSymbolicLink()) {
const stats = await _fs.promises.stat(item);
isFile = stats.isFile();
isDirectory = stats.isDirectory();
}
if (isDirectory) {
try {
await _fs.promises.mkdir(target, {
recursive: true
});
} catch (err) {
// do not throw `folder already exists` errors
if ((0, _iserror.default)(err) && err.code !== 'EEXIST') {
throw err;
}
}
sema.release();
const files = await _fs.promises.readdir(item, {
withFileTypes: true
});
await Promise.all(files.map((file)=>_copy(_path.default.join(item, file.name), file)));
} else if (isFile && // before we send the path to filter
// we remove the base path (from) and replace \ by / (windows)
filter(item.replace(from, '').replace(/\\/g, '/'))) {
await _fs.promises.copyFile(item, target, overwrite ? undefined : COPYFILE_EXCL).catch((err)=>{
// if overwrite is false we shouldn't fail on EEXIST
if (err.code !== 'EEXIST') {
throw err;
}
});
sema.release();
} else {
sema.release();
}
}
await _copy(from);
}
//# sourceMappingURL=recursive-copy.js.map

View File

@@ -1,137 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
calcBackoffMs: null,
recursiveDeleteSyncWithAsyncRetries: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
calcBackoffMs: function() {
return calcBackoffMs;
},
recursiveDeleteSyncWithAsyncRetries: function() {
return recursiveDeleteSyncWithAsyncRetries;
}
});
const _nodefs = /*#__PURE__*/ _interop_require_wildcard(require("node:fs"));
const _nodepath = require("node:path");
const _iserror = /*#__PURE__*/ _interop_require_default(require("./is-error"));
const _wait = require("./wait");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function _getRequireWildcardCache(nodeInterop) {
if (typeof WeakMap !== "function") return null;
var cacheBabelInterop = new WeakMap();
var cacheNodeInterop = new WeakMap();
return (_getRequireWildcardCache = function(nodeInterop) {
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
})(nodeInterop);
}
function _interop_require_wildcard(obj, nodeInterop) {
if (!nodeInterop && obj && obj.__esModule) {
return obj;
}
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
return {
default: obj
};
}
var cache = _getRequireWildcardCache(nodeInterop);
if (cache && cache.has(obj)) {
return cache.get(obj);
}
var newObj = {
__proto__: null
};
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
for(var key in obj){
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
if (desc && (desc.get || desc.set)) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
newObj.default = obj;
if (cache) {
cache.set(obj, newObj);
}
return newObj;
}
// We use an exponential backoff. See the unit test for example values.
//
// - Node's `fs` module uses a linear backoff, starting with 100ms.
// - Rust tries 64 times with only a `thread::yield_now` in between.
//
// We want something more aggressive, as `recursiveDelete` is in the critical
// path of `next dev` and `next build` startup.
const INITIAL_RETRY_MS = 8;
const MAX_RETRY_MS = 64;
const MAX_RETRIES = 6;
function calcBackoffMs(attempt) {
return Math.min(INITIAL_RETRY_MS * Math.pow(2, attempt), MAX_RETRY_MS);
}
function unlinkPath(p, isDir = false, attempt = 0) {
try {
if (isDir) {
_nodefs.rmdirSync(p);
} else {
_nodefs.unlinkSync(p);
}
} catch (e) {
const code = (0, _iserror.default)(e) && e.code;
if ((code === 'EBUSY' || code === 'ENOTEMPTY' || code === 'EPERM' || code === 'EMFILE') && attempt < MAX_RETRIES) {
// retrying is unlikely to succeed on POSIX platforms, but Windows can
// fail due to temporarily-open files
return (async ()=>{
await (0, _wait.wait)(calcBackoffMs(attempt));
return unlinkPath(p, isDir, attempt + 1);
})();
}
if (code === 'ENOENT') {
return;
}
throw e;
}
}
async function recursiveDeleteSyncWithAsyncRetries(/** Directory to delete the contents of */ dir, /** Exclude based on relative file path */ exclude, /** Relative path to the directory being deleted, used for exclude */ previousPath = '') {
let result;
try {
result = _nodefs.readdirSync(dir, {
withFileTypes: true
});
} catch (e) {
if ((0, _iserror.default)(e) && e.code === 'ENOENT') {
return;
}
throw e;
}
await Promise.all(result.map(async (part)=>{
const absolutePath = (0, _nodepath.join)(dir, part.name);
const pp = (0, _nodepath.join)(previousPath, part.name);
const isNotExcluded = !exclude || !exclude.test(pp);
if (isNotExcluded) {
// Note: readdir does not follow symbolic links, that's good: we want to
// delete the links and not the destination.
let isDirectory = part.isDirectory();
if (isDirectory) {
await recursiveDeleteSyncWithAsyncRetries(absolutePath, exclude, pp);
}
return unlinkPath(absolutePath, isDirectory);
}
}));
}
//# sourceMappingURL=recursive-delete.js.map

View File

@@ -1,124 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "recursiveReadDir", {
enumerable: true,
get: function() {
return recursiveReadDir;
}
});
const _promises = /*#__PURE__*/ _interop_require_default(require("fs/promises"));
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
async function recursiveReadDir(rootDirectory, options = {}) {
// Grab our options.
const { pathnameFilter, ignoreFilter, ignorePartFilter, sortPathnames = true, relativePathnames = true } = options;
// The list of pathnames to return.
const pathnames = [];
/**
* Coerces the pathname to be relative if requested.
*/ const coerce = relativePathnames ? (pathname)=>pathname.replace(rootDirectory, '') : (pathname)=>pathname;
// The queue of directories to scan.
let directories = [
rootDirectory
];
while(directories.length > 0){
// Load all the files in each directory at the same time.
const results = await Promise.all(directories.map(async (directory)=>{
const result = {
directories: [],
pathnames: [],
links: []
};
try {
const dir = await _promises.default.readdir(directory, {
withFileTypes: true
});
for (const file of dir){
// If enabled, ignore the file if it matches the ignore filter.
if (ignorePartFilter && ignorePartFilter(file.name)) {
continue;
}
// Handle each file.
const absolutePathname = _path.default.join(directory, file.name);
// If enabled, ignore the file if it matches the ignore filter.
if (ignoreFilter && ignoreFilter(absolutePathname)) {
continue;
}
// If the file is a directory, then add it to the list of directories,
// they'll be scanned on a later pass.
if (file.isDirectory()) {
result.directories.push(absolutePathname);
} else if (file.isSymbolicLink()) {
result.links.push(absolutePathname);
} else if (!pathnameFilter || pathnameFilter(absolutePathname)) {
result.pathnames.push(coerce(absolutePathname));
}
}
} catch (err) {
// This can only happen when the underlying directory was removed. If
// anything other than this error occurs, re-throw it.
// if (err.code !== 'ENOENT') throw err
if (err.code !== 'ENOENT' || directory === rootDirectory) throw err;
// The error occurred, so abandon reading this directory.
return null;
}
return result;
}));
// Empty the directories, we'll fill it later if some of the files are
// directories.
directories = [];
// Keep track of any symbolic links we find, we'll resolve them later.
const links = [];
// For each result of directory scans...
for (const result of results){
// If the directory was removed, then skip it.
if (!result) continue;
// Add any directories to the list of directories to scan.
directories.push(...result.directories);
// Add any symbolic links to the list of symbolic links to resolve.
links.push(...result.links);
// Add any file pathnames to the list of pathnames.
pathnames.push(...result.pathnames);
}
// Resolve all the symbolic links we found if any.
if (links.length > 0) {
const resolved = await Promise.all(links.map(async (absolutePathname)=>{
try {
return await _promises.default.stat(absolutePathname);
} catch (err) {
// This can only happen when the underlying link was removed. If
// anything other than this error occurs, re-throw it.
if (err.code !== 'ENOENT') throw err;
// The error occurred, so abandon reading this directory.
return null;
}
}));
for(let i = 0; i < links.length; i++){
const stats = resolved[i];
// If the link was removed, then skip it.
if (!stats) continue;
// We would have already ignored the file if it matched the ignore
// filter, so we don't need to check it again.
const absolutePathname = links[i];
if (stats.isDirectory()) {
directories.push(absolutePathname);
} else if (!pathnameFilter || pathnameFilter(absolutePathname)) {
pathnames.push(coerce(absolutePathname));
}
}
}
}
// Sort the pathnames in place if requested.
if (sortPathnames) {
pathnames.sort();
}
return pathnames;
}
//# sourceMappingURL=recursive-readdir.js.map

View File

@@ -1,46 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
allowedStatusCodes: null,
getRedirectStatus: null,
modifyRouteRegex: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
allowedStatusCodes: function() {
return allowedStatusCodes;
},
getRedirectStatus: function() {
return getRedirectStatus;
},
modifyRouteRegex: function() {
return modifyRouteRegex;
}
});
const _redirectstatuscode = require("../client/components/redirect-status-code");
const allowedStatusCodes = new Set([
301,
302,
303,
307,
308
]);
function getRedirectStatus(route) {
return route.statusCode || (route.permanent ? _redirectstatuscode.RedirectStatusCode.PermanentRedirect : _redirectstatuscode.RedirectStatusCode.TemporaryRedirect);
}
function modifyRouteRegex(regex, restrictedPaths) {
if (restrictedPaths) {
regex = regex.replace(/\^/, `^(?!${restrictedPaths.map((path)=>path.replace(/\//g, '\\/')).join('|')})`);
}
regex = regex.replace(/\$$/, '(?:\\/)?$');
return regex;
}
//# sourceMappingURL=redirect-status.js.map

View File

@@ -1,26 +0,0 @@
/**
* This module imports the client instrumentation hook from the project root.
*
* The `private-next-instrumentation-client` module is automatically aliased to
* the `instrumentation-client.ts` file in the project root by webpack or turbopack.
*/ "use strict";
if (process.env.NODE_ENV === 'development') {
const measureName = 'Client Instrumentation Hook';
const startTime = performance.now();
// eslint-disable-next-line @next/internal/typechecked-require -- Not a module.
module.exports = require('private-next-instrumentation-client');
const endTime = performance.now();
const duration = endTime - startTime;
// Using 16ms threshold as it represents one frame (1000ms/60fps)
// This helps identify if the instrumentation hook initialization
// could potentially cause frame drops during development.
const THRESHOLD = 16;
if (duration > THRESHOLD) {
console.log(`[${measureName}] Slow execution detected: ${duration.toFixed(0)}ms (Note: Code download overhead is not included in this measurement)`);
}
} else {
// eslint-disable-next-line @next/internal/typechecked-require -- Not a module.
module.exports = require('private-next-instrumentation-client');
}
//# sourceMappingURL=require-instrumentation-client.js.map

View File

@@ -1,154 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
parseBuildPathsInput: null,
resolveBuildPaths: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
parseBuildPathsInput: function() {
return parseBuildPathsInput;
},
resolveBuildPaths: function() {
return resolveBuildPaths;
}
});
const _util = require("util");
const _glob = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/glob"));
const _log = /*#__PURE__*/ _interop_require_wildcard(require("../build/output/log"));
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
const _iserror = /*#__PURE__*/ _interop_require_default(require("./is-error"));
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function _getRequireWildcardCache(nodeInterop) {
if (typeof WeakMap !== "function") return null;
var cacheBabelInterop = new WeakMap();
var cacheNodeInterop = new WeakMap();
return (_getRequireWildcardCache = function(nodeInterop) {
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
})(nodeInterop);
}
function _interop_require_wildcard(obj, nodeInterop) {
if (!nodeInterop && obj && obj.__esModule) {
return obj;
}
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
return {
default: obj
};
}
var cache = _getRequireWildcardCache(nodeInterop);
if (cache && cache.has(obj)) {
return cache.get(obj);
}
var newObj = {
__proto__: null
};
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
for(var key in obj){
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
if (desc && (desc.get || desc.set)) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
newObj.default = obj;
if (cache) {
cache.set(obj, newObj);
}
return newObj;
}
const glob = (0, _util.promisify)(_glob.default);
/**
* Escapes Next.js dynamic route bracket expressions so glob treats them as
* literal directory names rather than character classes.
*
* e.g., "app/blog/[slug]/** /page.tsx" → "app/blog/\[slug\]/** /page.tsx"
*/ function escapeBrackets(pattern) {
// Match Next.js dynamic route patterns: [name], [...name], [[...name]]
return pattern.replace(/\[\[?\.\.\.[^\]]+\]?\]|\[[^\]]+\]/g, (match)=>match.replace(/\[/g, '\\[').replace(/\]/g, '\\]'));
}
async function resolveBuildPaths(patterns, projectDir) {
const appPaths = new Set();
const pagePaths = new Set();
const includePatterns = [];
const excludePatterns = [];
for (const pattern of patterns){
const trimmed = pattern.trim();
if (!trimmed) continue;
if (trimmed.startsWith('!')) {
excludePatterns.push(escapeBrackets(trimmed.slice(1)));
} else {
includePatterns.push(escapeBrackets(trimmed));
}
}
// Default to matching all files when only negation patterns are provided.
if (includePatterns.length === 0 && excludePatterns.length > 0) {
includePatterns.push('**');
}
// Combine patterns using brace expansion: {pattern1,pattern2}
const combinedPattern = includePatterns.length === 1 ? includePatterns[0] : `{${includePatterns.join(',')}}`;
try {
const matches = await glob(combinedPattern, {
cwd: projectDir,
ignore: excludePatterns
});
if (matches.length === 0) {
_log.warn(`Pattern "${patterns.join(',')}" did not match any files`);
}
for (const file of matches){
if (!_fs.default.statSync(_path.default.join(projectDir, file)).isDirectory()) {
categorizeAndAddPath(file, appPaths, pagePaths);
}
}
} catch (error) {
throw Object.defineProperty(new Error(`Failed to resolve pattern "${patterns.join(',')}": ${(0, _iserror.default)(error) ? error.message : String(error)}`), "__NEXT_ERROR_CODE", {
value: "E972",
enumerable: false,
configurable: true
});
}
return {
appPaths: Array.from(appPaths).sort(),
pagePaths: Array.from(pagePaths).sort()
};
}
/**
* Categorizes a file path to either app or pages router based on its prefix.
* For app router, only route-defining files (page.*, route.*) are included.
*
* Examples:
* - "app/page.tsx" → appPaths.add("/page.tsx")
* - "app/layout.tsx" → skipped (not a route file)
* - "pages/index.tsx" → pagePaths.add("/index.tsx")
*/ function categorizeAndAddPath(filePath, appPaths, pagePaths) {
const normalized = filePath.replace(/\\/g, '/');
if (normalized.startsWith('app/')) {
// Only include route-defining files (page.* or route.*)
if (/\/(page|route)\.[^/]+$/.test(normalized)) {
appPaths.add('/' + normalized.slice(4));
}
} else if (normalized.startsWith('pages/')) {
pagePaths.add('/' + normalized.slice(6));
}
}
function parseBuildPathsInput(input) {
// Comma-separated values
return input.split(',').map((p)=>p.trim()).filter((p)=>p.length > 0);
}
//# sourceMappingURL=resolve-build-paths.js.map

View File

@@ -1,65 +0,0 @@
// source: https://github.com/sindresorhus/resolve-from
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "resolveFrom", {
enumerable: true,
get: function() {
return resolveFrom;
}
});
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
const _iserror = /*#__PURE__*/ _interop_require_default(require("./is-error"));
const _realpath = require("./realpath");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
const Module = require('module');
const resolveFrom = (fromDirectory, moduleId, silent)=>{
if (typeof fromDirectory !== 'string') {
throw Object.defineProperty(new TypeError(`Expected \`fromDir\` to be of type \`string\`, got \`${typeof fromDirectory}\``), "__NEXT_ERROR_CODE", {
value: "E537",
enumerable: false,
configurable: true
});
}
if (typeof moduleId !== 'string') {
throw Object.defineProperty(new TypeError(`Expected \`moduleId\` to be of type \`string\`, got \`${typeof moduleId}\``), "__NEXT_ERROR_CODE", {
value: "E565",
enumerable: false,
configurable: true
});
}
try {
fromDirectory = (0, _realpath.realpathSync)(fromDirectory);
} catch (error) {
if ((0, _iserror.default)(error) && error.code === 'ENOENT') {
fromDirectory = _path.default.resolve(fromDirectory);
} else if (silent) {
return;
} else {
throw error;
}
}
const fromFile = _path.default.join(fromDirectory, 'noop.js');
const resolveFileName = ()=>// @ts-expect-error
Module._resolveFilename(moduleId, {
id: fromFile,
filename: fromFile,
paths: // @ts-expect-error
Module._nodeModulePaths(fromDirectory)
});
if (silent) {
try {
return resolveFileName();
} catch (error) {
return;
}
}
return resolveFileName();
};
//# sourceMappingURL=resolve-from.js.map

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