Initial boiler plate project

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

52
node_modules/next/dist/esm/lib/batcher.js generated vendored Normal file
View File

@ -0,0 +1,52 @@
import { DetachedPromise } from "./detached-promise";
/**
* A wrapper for a function that will only allow one call to the function to
* execute at a time.
*/ export 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(cacheKey, Promise.resolve);
}
const pending = this.pending.get(cacheKey);
if (pending) return pending;
const { promise, resolve, reject } = new DetachedPromise();
this.pending.set(cacheKey, promise);
this.schedulerFn(async ()=>{
try {
const result = await fn(cacheKey, resolve);
// 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

1
node_modules/next/dist/esm/lib/batcher.js.map generated vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"sources":["../../src/lib/batcher.ts"],"names":["DetachedPromise","Batcher","cacheKeyFn","schedulerFn","fn","pending","Map","create","options","batch","key","cacheKey","Promise","resolve","get","promise","reject","set","result","err","delete"],"mappings":"AAEA,SAASA,eAAe,QAAQ,qBAAoB;AAgBpD;;;CAGC,GACD,OAAO,MAAMC;IAGX,YACE,AAAiBC,UAA6B,EAC9C;;;;KAIC,GACD,AAAiBC,cAAiC,CAACC,KAAOA,IAAI,CAC9D;aAPiBF,aAAAA;aAMAC,cAAAA;aATFE,UAAU,IAAIC;IAU5B;IAcH,OAAcC,OACZC,OAA8B,EACZ;QAClB,OAAO,IAAIP,QAAiBO,2BAAAA,QAASN,UAAU,EAAEM,2BAAAA,QAASL,WAAW;IACvE;IAEA;;;;;;;;;GASC,GACD,MAAaM,MAAMC,GAAM,EAAEN,EAAgB,EAAc;QACvD,MAAMO,WAAY,IAAI,CAACT,UAAU,GAAG,MAAM,IAAI,CAACA,UAAU,CAACQ,OAAOA;QACjE,IAAIC,aAAa,MAAM;YACrB,OAAOP,GAAGO,UAAUC,QAAQC,OAAO;QACrC;QAEA,MAAMR,UAAU,IAAI,CAACA,OAAO,CAACS,GAAG,CAACH;QACjC,IAAIN,SAAS,OAAOA;QAEpB,MAAM,EAAEU,OAAO,EAAEF,OAAO,EAAEG,MAAM,EAAE,GAAG,IAAIhB;QACzC,IAAI,CAACK,OAAO,CAACY,GAAG,CAACN,UAAUI;QAE3B,IAAI,CAACZ,WAAW,CAAC;YACf,IAAI;gBACF,MAAMe,SAAS,MAAMd,GAAGO,UAAUE;gBAElC,kEAAkE;gBAClE,qDAAqD;gBACrDA,QAAQK;YACV,EAAE,OAAOC,KAAK;gBACZH,OAAOG;YACT,SAAU;gBACR,IAAI,CAACd,OAAO,CAACe,MAAM,CAACT;YACtB;QACF;QAEA,OAAOI;IACT;AACF"}

29
node_modules/next/dist/esm/lib/build-custom-route.js generated vendored Normal file
View File

@ -0,0 +1,29 @@
import { pathToRegexp } from "next/dist/compiled/path-to-regexp";
import { normalizeRouteRegex } from "./load-custom-routes";
import { getRedirectStatus, modifyRouteRegex } from "./redirect-status";
export function buildCustomRoute(type, route, restrictedRedirectPaths) {
const compiled = pathToRegexp(route.source, [], {
strict: true,
sensitive: false,
delimiter: "/"
});
let source = compiled.source;
if (!route.internal) {
source = modifyRouteRegex(source, type === "redirect" ? restrictedRedirectPaths : undefined);
}
const regex = normalizeRouteRegex(source);
if (type !== "redirect") {
return {
...route,
regex
};
}
return {
...route,
statusCode: getRedirectStatus(route),
permanent: undefined,
regex
};
}
//# sourceMappingURL=build-custom-route.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../src/lib/build-custom-route.ts"],"names":["pathToRegexp","normalizeRouteRegex","getRedirectStatus","modifyRouteRegex","buildCustomRoute","type","route","restrictedRedirectPaths","compiled","source","strict","sensitive","delimiter","internal","undefined","regex","statusCode","permanent"],"mappings":"AAAA,SAASA,YAAY,QAAQ,oCAAmC;AAMhE,SACEC,mBAAmB,QAKd,uBAAsB;AAC7B,SAASC,iBAAiB,EAAEC,gBAAgB,QAAQ,oBAAmB;AAevE,OAAO,SAASC,iBACdC,IAAe,EACfC,KAAkC,EAClCC,uBAAkC;IAElC,MAAMC,WAAWR,aAAaM,MAAMG,MAAM,EAAE,EAAE,EAAE;QAC9CC,QAAQ;QACRC,WAAW;QACXC,WAAW;IACb;IAEA,IAAIH,SAASD,SAASC,MAAM;IAC5B,IAAI,CAACH,MAAMO,QAAQ,EAAE;QACnBJ,SAASN,iBACPM,QACAJ,SAAS,aAAaE,0BAA0BO;IAEpD;IAEA,MAAMC,QAAQd,oBAAoBQ;IAElC,IAAIJ,SAAS,YAAY;QACvB,OAAO;YAAE,GAAGC,KAAK;YAAES;QAAM;IAC3B;IAEA,OAAO;QACL,GAAGT,KAAK;QACRU,YAAYd,kBAAkBI;QAC9BW,WAAWH;QACXC;IACF;AACF"}

6
node_modules/next/dist/esm/lib/client-reference.js generated vendored Normal file
View File

@ -0,0 +1,6 @@
export 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-reference.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../src/lib/client-reference.ts"],"names":["isClientReference","mod","defaultExport","default","$$typeof","Symbol","for"],"mappings":"AAAA,OAAO,SAASA,kBAAkBC,GAAQ;IACxC,MAAMC,gBAAgBD,CAAAA,uBAAAA,IAAKE,OAAO,KAAIF;IACtC,OAAOC,CAAAA,iCAAAA,cAAeE,QAAQ,MAAKC,OAAOC,GAAG,CAAC;AAChD"}

29
node_modules/next/dist/esm/lib/coalesced-function.js generated vendored Normal file
View File

@ -0,0 +1,29 @@
const globalInvokeCache = new Map();
export 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

@ -0,0 +1 @@
{"version":3,"sources":["../../src/lib/coalesced-function.ts"],"names":["globalInvokeCache","Map","withCoalescedInvoke","func","key","args","entry","get","then","res","isOrigin","value","__wrapper","apply","undefined","future","delete","catch","err","Promise","reject","set"],"mappings":"AAOA,MAAMA,oBAAoB,IAAIC;AAE9B,OAAO,SAASC,oBACdC,IAAO;IAKP,OAAO,eAAgBC,GAAW,EAAEC,IAAmB;QACrD,MAAMC,QAAQN,kBAAkBO,GAAG,CAACH;QACpC,IAAIE,OAAO;YACT,OAAOA,MAAME,IAAI,CAAC,CAACC,MAAS,CAAA;oBAC1BC,UAAU;oBACVC,OAAOF,IAAIE,KAAK;gBAClB,CAAA;QACF;QAEA,eAAeC;YACb,OAAO,MAAMT,KAAKU,KAAK,CAACC,WAAWT;QACrC;QAEA,MAAMU,SAASH,YACZJ,IAAI,CAAC,CAACC;YACLT,kBAAkBgB,MAAM,CAACZ;YACzB,OAAO;gBAAEM,UAAU;gBAAMC,OAAOF;YAAoC;QACtE,GACCQ,KAAK,CAAC,CAACC;YACNlB,kBAAkBgB,MAAM,CAACZ;YACzB,OAAOe,QAAQC,MAAM,CAACF;QACxB;QACFlB,kBAAkBqB,GAAG,CAACjB,KAAKW;QAC3B,OAAOA;IACT;AACF"}

4
node_modules/next/dist/esm/lib/compile-error.js generated vendored Normal file
View File

@ -0,0 +1,4 @@
export class CompileError extends Error {
}
//# sourceMappingURL=compile-error.js.map

1
node_modules/next/dist/esm/lib/compile-error.js.map generated vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"sources":["../../src/lib/compile-error.ts"],"names":["CompileError","Error"],"mappings":"AAAA,OAAO,MAAMA,qBAAqBC;AAAO"}

139
node_modules/next/dist/esm/lib/constants.js generated vendored Normal file
View File

@ -0,0 +1,139 @@
export const NEXT_QUERY_PARAM_PREFIX = "nxtP";
export const PRERENDER_REVALIDATE_HEADER = "x-prerender-revalidate";
export const PRERENDER_REVALIDATE_ONLY_GENERATED_HEADER = "x-prerender-revalidate-if-generated";
export const RSC_PREFETCH_SUFFIX = ".prefetch.rsc";
export const RSC_SUFFIX = ".rsc";
export const ACTION_SUFFIX = ".action";
export const NEXT_DATA_SUFFIX = ".json";
export const NEXT_META_SUFFIX = ".meta";
export const NEXT_BODY_SUFFIX = ".body";
export const NEXT_CACHE_TAGS_HEADER = "x-next-cache-tags";
export const NEXT_CACHE_SOFT_TAGS_HEADER = "x-next-cache-soft-tags";
export const NEXT_CACHE_REVALIDATED_TAGS_HEADER = "x-next-revalidated-tags";
export const NEXT_CACHE_REVALIDATE_TAG_TOKEN_HEADER = "x-next-revalidate-tag-token";
// if these change make sure we update the related
// documentation as well
export const NEXT_CACHE_TAG_MAX_ITEMS = 64;
export const NEXT_CACHE_TAG_MAX_LENGTH = 256;
export const NEXT_CACHE_SOFT_TAG_MAX_LENGTH = 1024;
export const NEXT_CACHE_IMPLICIT_TAG_ID = "_N_T_";
// in seconds
export const CACHE_ONE_YEAR = 31536000;
// Patterns to detect middleware files
export const MIDDLEWARE_FILENAME = "middleware";
export const MIDDLEWARE_LOCATION_REGEXP = `(?:src/)?${MIDDLEWARE_FILENAME}`;
// Pattern to detect instrumentation hooks file
export const INSTRUMENTATION_HOOK_FILENAME = "instrumentation";
// Because on Windows absolute paths in the generated code can break because of numbers, eg 1 in the path,
// we have to use a private alias
export const PAGES_DIR_ALIAS = "private-next-pages";
export const DOT_NEXT_ALIAS = "private-dot-next";
export const ROOT_DIR_ALIAS = "private-next-root-dir";
export const APP_DIR_ALIAS = "private-next-app-dir";
export const RSC_MOD_REF_PROXY_ALIAS = "private-next-rsc-mod-ref-proxy";
export const RSC_ACTION_VALIDATE_ALIAS = "private-next-rsc-action-validate";
export const RSC_ACTION_PROXY_ALIAS = "private-next-rsc-server-reference";
export const RSC_ACTION_ENCRYPTION_ALIAS = "private-next-rsc-action-encryption";
export const RSC_ACTION_CLIENT_WRAPPER_ALIAS = "private-next-rsc-action-client-wrapper";
export 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`;
export const SSG_GET_INITIAL_PROPS_CONFLICT = `You can not use getInitialProps with getStaticProps. To use SSG, please remove your getInitialProps`;
export const SERVER_PROPS_GET_INIT_PROPS_CONFLICT = `You can not use getInitialProps with getServerSideProps. Please remove getInitialProps.`;
export const SERVER_PROPS_SSG_CONFLICT = `You can not use getStaticProps or getStaticPaths with getServerSideProps. To use SSG, please remove getServerSideProps`;
export const STATIC_STATUS_PAGE_GET_INITIAL_PROPS_ERROR = `can not have getInitialProps/getServerSideProps, https://nextjs.org/docs/messages/404-get-initial-props`;
export const SERVER_PROPS_EXPORT_ERROR = `pages with \`getServerSideProps\` can not be exported. See more info here: https://nextjs.org/docs/messages/gssp-export`;
export const GSP_NO_RETURNED_VALUE = "Your `getStaticProps` function did not return an object. Did you forget to add a `return`?";
export const GSSP_NO_RETURNED_VALUE = "Your `getServerSideProps` function did not return an object. Did you forget to add a `return`?";
export const UNSTABLE_REVALIDATE_RENAME_ERROR = "The `unstable_revalidate` property is available for general use.\n" + "Please use `revalidate` instead.";
export 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`;
export 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`;
export 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`;
export const ESLINT_DEFAULT_DIRS = [
"app",
"pages",
"components",
"lib",
"src"
];
export const SERVER_RUNTIME = {
edge: "edge",
experimentalEdge: "experimental-edge",
nodejs: "nodejs"
};
/**
* 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",
/**
* React Server Components layer (rsc).
*/ reactServerComponents: "rsc",
/**
* Server Side Rendering layer for app (ssr).
*/ serverSideRendering: "ssr",
/**
* The browser client bundle layer for actions.
*/ actionBrowser: "action-browser",
/**
* The layer for the API routes.
*/ api: "api",
/**
* 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 server bundle layer for metadata routes.
*/ appMetadataRoute: "app-metadata-route",
/**
* The layer for the server bundle for App Route handlers.
*/ appRouteHandler: "app-route-handler"
};
const WEBPACK_LAYERS = {
...WEBPACK_LAYERS_NAMES,
GROUP: {
serverOnly: [
WEBPACK_LAYERS_NAMES.reactServerComponents,
WEBPACK_LAYERS_NAMES.actionBrowser,
WEBPACK_LAYERS_NAMES.appMetadataRoute,
WEBPACK_LAYERS_NAMES.appRouteHandler,
WEBPACK_LAYERS_NAMES.instrument
],
clientOnly: [
WEBPACK_LAYERS_NAMES.serverSideRendering,
WEBPACK_LAYERS_NAMES.appPagesBrowser
],
nonClientServerTarget: [
// middleware and pages api
WEBPACK_LAYERS_NAMES.middleware,
WEBPACK_LAYERS_NAMES.api
],
app: [
WEBPACK_LAYERS_NAMES.reactServerComponents,
WEBPACK_LAYERS_NAMES.actionBrowser,
WEBPACK_LAYERS_NAMES.appMetadataRoute,
WEBPACK_LAYERS_NAMES.appRouteHandler,
WEBPACK_LAYERS_NAMES.serverSideRendering,
WEBPACK_LAYERS_NAMES.appPagesBrowser,
WEBPACK_LAYERS_NAMES.shared,
WEBPACK_LAYERS_NAMES.instrument
]
}
};
const WEBPACK_RESOURCE_QUERIES = {
edgeSSREntry: "__next_edge_ssr_entry__",
metadata: "__next_metadata__",
metadataRoute: "__next_metadata_route__",
metadataImageMeta: "__next_metadata_image_meta__"
};
export { WEBPACK_LAYERS, WEBPACK_RESOURCE_QUERIES };
//# sourceMappingURL=constants.js.map

1
node_modules/next/dist/esm/lib/constants.js.map generated vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"sources":["../../src/lib/constants.ts"],"names":["NEXT_QUERY_PARAM_PREFIX","PRERENDER_REVALIDATE_HEADER","PRERENDER_REVALIDATE_ONLY_GENERATED_HEADER","RSC_PREFETCH_SUFFIX","RSC_SUFFIX","ACTION_SUFFIX","NEXT_DATA_SUFFIX","NEXT_META_SUFFIX","NEXT_BODY_SUFFIX","NEXT_CACHE_TAGS_HEADER","NEXT_CACHE_SOFT_TAGS_HEADER","NEXT_CACHE_REVALIDATED_TAGS_HEADER","NEXT_CACHE_REVALIDATE_TAG_TOKEN_HEADER","NEXT_CACHE_TAG_MAX_ITEMS","NEXT_CACHE_TAG_MAX_LENGTH","NEXT_CACHE_SOFT_TAG_MAX_LENGTH","NEXT_CACHE_IMPLICIT_TAG_ID","CACHE_ONE_YEAR","MIDDLEWARE_FILENAME","MIDDLEWARE_LOCATION_REGEXP","INSTRUMENTATION_HOOK_FILENAME","PAGES_DIR_ALIAS","DOT_NEXT_ALIAS","ROOT_DIR_ALIAS","APP_DIR_ALIAS","RSC_MOD_REF_PROXY_ALIAS","RSC_ACTION_VALIDATE_ALIAS","RSC_ACTION_PROXY_ALIAS","RSC_ACTION_ENCRYPTION_ALIAS","RSC_ACTION_CLIENT_WRAPPER_ALIAS","PUBLIC_DIR_MIDDLEWARE_CONFLICT","SSG_GET_INITIAL_PROPS_CONFLICT","SERVER_PROPS_GET_INIT_PROPS_CONFLICT","SERVER_PROPS_SSG_CONFLICT","STATIC_STATUS_PAGE_GET_INITIAL_PROPS_ERROR","SERVER_PROPS_EXPORT_ERROR","GSP_NO_RETURNED_VALUE","GSSP_NO_RETURNED_VALUE","UNSTABLE_REVALIDATE_RENAME_ERROR","GSSP_COMPONENT_MEMBER_ERROR","NON_STANDARD_NODE_ENV","SSG_FALLBACK_EXPORT_ERROR","ESLINT_DEFAULT_DIRS","SERVER_RUNTIME","edge","experimentalEdge","nodejs","WEBPACK_LAYERS_NAMES","shared","reactServerComponents","serverSideRendering","actionBrowser","api","middleware","instrument","edgeAsset","appPagesBrowser","appMetadataRoute","appRouteHandler","WEBPACK_LAYERS","GROUP","serverOnly","clientOnly","nonClientServerTarget","app","WEBPACK_RESOURCE_QUERIES","edgeSSREntry","metadata","metadataRoute","metadataImageMeta"],"mappings":"AAEA,OAAO,MAAMA,0BAA0B,OAAM;AAE7C,OAAO,MAAMC,8BAA8B,yBAAwB;AACnE,OAAO,MAAMC,6CACX,sCAAqC;AAEvC,OAAO,MAAMC,sBAAsB,gBAAe;AAClD,OAAO,MAAMC,aAAa,OAAM;AAChC,OAAO,MAAMC,gBAAgB,UAAS;AACtC,OAAO,MAAMC,mBAAmB,QAAO;AACvC,OAAO,MAAMC,mBAAmB,QAAO;AACvC,OAAO,MAAMC,mBAAmB,QAAO;AAEvC,OAAO,MAAMC,yBAAyB,oBAAmB;AACzD,OAAO,MAAMC,8BA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SAChC;IACH;AACF;AAEA,MAAMW,2BAA2B;IAC/BC,cAAc;IACdC,UAAU;IACVC,eAAe;IACfC,mBAAmB;AACrB;AAEA,SAASV,cAAc,EAAEM,wBAAwB,GAAE"}

View File

@ -0,0 +1,57 @@
import { BloomFilter } from "../shared/lib/bloom-filter";
import { isDynamicRoute } from "../shared/lib/router/utils";
import { removeTrailingSlash } from "../shared/lib/router/utils/remove-trailing-slash";
import { tryToParsePath } from "./try-to-parse-path";
import { extractInterceptionRouteInformation, isInterceptionRouteAppPath } from "../server/future/helpers/interception-routes";
export function createClientRouterFilter(paths, redirects, allowedErrorRate) {
const staticPaths = new Set();
const dynamicPaths = new Set();
for (let path of paths){
if (isDynamicRoute(path)) {
if (isInterceptionRouteAppPath(path)) {
path = 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 + 1; 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 = removeTrailingSlash(source);
let tokens = [];
try {
tokens = tryToParsePath(source).tokens || [];
} catch {}
if (tokens.every((token)=>typeof token === "string")) {
// only include static redirects initially
staticPaths.add(path);
}
}
const staticFilter = BloomFilter.from([
...staticPaths
], allowedErrorRate);
const dynamicFilter = BloomFilter.from([
...dynamicPaths
], allowedErrorRate);
const data = {
staticFilter: staticFilter.export(),
dynamicFilter: dynamicFilter.export()
};
return data;
}
//# sourceMappingURL=create-client-router-filter.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../src/lib/create-client-router-filter.ts"],"names":["BloomFilter","isDynamicRoute","removeTrailingSlash","tryToParsePath","extractInterceptionRouteInformation","isInterceptionRouteAppPath","createClientRouterFilter","paths","redirects","allowedErrorRate","staticPaths","Set","dynamicPaths","path","interceptedRoute","subPath","pathParts","split","i","length","curPart","startsWith","add","redirect","source","tokens","every","token","staticFilter","from","dynamicFilter","data","export"],"mappings":"AACA,SAASA,WAAW,QAAQ,6BAA4B;AACxD,SAASC,cAAc,QAAQ,6BAA4B;AAC3D,SAASC,mBAAmB,QAAQ,mDAAkD;AAEtF,SAASC,cAAc,QAAQ,sBAAqB;AACpD,SACEC,mCAAmC,EACnCC,0BAA0B,QACrB,+CAA8C;AAErD,OAAO,SAASC,yBACdC,KAAe,EACfC,SAAqB,EACrBC,gBAAyB;IAKzB,MAAMC,cAAc,IAAIC;IACxB,MAAMC,eAAe,IAAID;IAEzB,KAAK,IAAIE,QAAQN,MAAO;QACtB,IAAIN,eAAeY,OAAO;YACxB,IAAIR,2BAA2BQ,OAAO;gBACpCA,OAAOT,oCAAoCS,MAAMC,gBAAgB;YACnE;YAEA,IAAIC,UAAU;YACd,MAAMC,YAAYH,KAAKI,KAAK,CAAC;YAE7B,uDAAuD;YACvD,kDAAkD;YAClD,IAAK,IAAIC,IAAI,GAAGA,IAAIF,UAAUG,MAAM,GAAG,GAAGD,IAAK;gBAC7C,MAAME,UAAUJ,SAAS,CAACE,EAAE;gBAE5B,IAAIE,QAAQC,UAAU,CAAC,MAAM;oBAC3B;gBACF;gBACAN,UAAU,CAAC,EAAEA,QAAQ,CAAC,EAAEK,QAAQ,CAAC;YACnC;YAEA,IAAIL,SAAS;gBACXH,aAAaU,GAAG,CAACP;YACnB;QACF,OAAO;YACLL,YAAYY,GAAG,CAACT;QAClB;IACF;IAEA,KAAK,MAAMU,YAAYf,UAAW;QAChC,MAAM,EAAEgB,MAAM,EAAE,GAAGD;QACnB,MAAMV,OAAOX,oBAAoBsB;QACjC,IAAIC,SAAkB,EAAE;QAExB,IAAI;YACFA,SAAStB,eAAeqB,QAAQC,MAAM,IAAI,EAAE;QAC9C,EAAE,OAAM,CAAC;QAET,IAAIA,OAAOC,KAAK,CAAC,CAACC,QAAU,OAAOA,UAAU,WAAW;YACtD,0CAA0C;YAC1CjB,YAAYY,GAAG,CAACT;QAClB;IACF;IAEA,MAAMe,eAAe5B,YAAY6B,IAAI,CAAC;WAAInB;KAAY,EAAED;IAExD,MAAMqB,gBAAgB9B,YAAY6B,IAAI,CAAC;WAAIjB;KAAa,EAAEH;IAC1D,MAAMsB,OAAO;QACXH,cAAcA,aAAaI,MAAM;QACjCF,eAAeA,cAAcE,MAAM;IACrC;IACA,OAAOD;AACT"}

22
node_modules/next/dist/esm/lib/detached-promise.js generated vendored Normal file
View File

@ -0,0 +1,22 @@
/**
* A `Promise.withResolvers` implementation that exposes the `resolve` and
* `reject` functions on a `Promise`.
*
* @see https://tc39.es/proposal-promise-with-resolvers/
*/ export 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

@ -0,0 +1 @@
{"version":3,"sources":["../../src/lib/detached-promise.ts"],"names":["DetachedPromise","constructor","resolve","reject","promise","Promise","res","rej"],"mappings":"AAAA;;;;;CAKC,GACD,OAAO,MAAMA;IAKXC,aAAc;QACZ,IAAIC;QACJ,IAAIC;QAEJ,6DAA6D;QAC7D,IAAI,CAACC,OAAO,GAAG,IAAIC,QAAW,CAACC,KAAKC;YAClCL,UAAUI;YACVH,SAASI;QACX;QAEA,yEAAyE;QACzE,iBAAiB;QACjB,IAAI,CAACL,OAAO,GAAGA;QACf,IAAI,CAACC,MAAM,GAAGA;IAChB;AACF"}

41
node_modules/next/dist/esm/lib/detect-typo.js generated vendored Normal file
View File

@ -0,0 +1,41 @@
// the minimum number of operations required to convert string a to string b.
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];
}
export 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

1
node_modules/next/dist/esm/lib/detect-typo.js.map generated vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"sources":["../../src/lib/detect-typo.ts"],"names":["minDistance","a","b","threshold","m","length","n","previousRow","Array","from","_","i","s1","currentRow","j","s2","insertions","deletions","substitutions","Number","push","Math","min","detectTypo","input","options","potentialTypos","map","o","option","distance","filter","sort"],"mappings":"AAAA,6EAA6E;AAC7E,SAASA,YAAYC,CAAS,EAAEC,CAAS,EAAEC,SAAiB;IAC1D,MAAMC,IAAIH,EAAEI,MAAM;IAClB,MAAMC,IAAIJ,EAAEG,MAAM;IAElB,IAAID,IAAIE,GAAG;QACT,OAAON,YAAYE,GAAGD,GAAGE;IAC3B;IAEA,IAAIG,MAAM,GAAG;QACX,OAAOF;IACT;IAEA,IAAIG,cAAcC,MAAMC,IAAI,CAAC;QAAEJ,QAAQC,IAAI;IAAE,GAAG,CAACI,GAAGC,IAAMA;IAE1D,IAAK,IAAIA,IAAI,GAAGA,IAAIP,GAAGO,IAAK;QAC1B,MAAMC,KAAKX,CAAC,CAACU,EAAE;QACf,IAAIE,aAAa;YAACF,IAAI;SAAE;QACxB,IAAK,IAAIG,IAAI,GAAGA,IAAIR,GAAGQ,IAAK;YAC1B,MAAMC,KAAKb,CAAC,CAACY,EAAE;YACf,MAAME,aAAaT,WAAW,CAACO,IAAI,EAAE,GAAG;YACxC,MAAMG,YAAYJ,UAAU,CAACC,EAAE,GAAG;YAClC,MAAMI,gBAAgBX,WAAW,CAACO,EAAE,GAAGK,OAAOP,OAAOG;YACrDF,WAAWO,IAAI,CAACC,KAAKC,GAAG,CAACN,YAAYC,WAAWC;QAClD;QACAX,cAAcM;IAChB;IACA,OAAON,WAAW,CAACA,YAAYF,MAAM,GAAG,EAAE;AAC5C;AAEA,OAAO,SAASkB,WAAWC,KAAa,EAAEC,OAAiB,EAAEtB,YAAY,CAAC;IACxE,MAAMuB,iBAAiBD,QACpBE,GAAG,CAAC,CAACC,IAAO,CAAA;YACXC,QAAQD;YACRE,UAAU9B,YAAY4B,GAAGJ,OAAOrB;QAClC,CAAA,GACC4B,MAAM,CAAC,CAAC,EAAED,QAAQ,EAAE,GAAKA,YAAY3B,aAAa2B,WAAW,GAC7DE,IAAI,CAAC,CAAC/B,GAAGC,IAAMD,EAAE6B,QAAQ,GAAG5B,EAAE4B,QAAQ;IAEzC,IAAIJ,eAAerB,MAAM,EAAE;QACzB,OAAOqB,cAAc,CAAC,EAAE,CAACG,MAAM;IACjC;IACA,OAAO;AACT"}

103
node_modules/next/dist/esm/lib/download-swc.js generated vendored Normal file
View File

@ -0,0 +1,103 @@
import fs from "fs";
import path from "path";
import * as Log from "../build/output/log";
import tar from "next/dist/compiled/tar";
const { WritableStream } = require("node:stream/web");
import { getRegistry } from "./helpers/get-registry";
import { getCacheDirectory } from "./helpers/get-cache-directory";
const MAX_VERSIONS_TO_CACHE = 8;
async function extractBinary(outputDirectory, pkgName, tarFileName) {
const cacheDirectory = getCacheDirectory("next-swc", process.env["NEXT_SWC_PATH"]);
const extractFromTar = ()=>tar.x({
file: path.join(cacheDirectory, tarFileName),
cwd: outputDirectory,
strip: 1
});
if (!fs.existsSync(path.join(cacheDirectory, tarFileName))) {
Log.info(`Downloading swc package ${pkgName}...`);
await fs.promises.mkdir(cacheDirectory, {
recursive: true
});
const tempFile = path.join(cacheDirectory, `${tarFileName}.temp-${Date.now()}`);
const registry = 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 new Error(`request failed with status ${res.status}`);
}
if (!body) {
throw new Error("request failed with empty body");
}
const cacheWriteStream = fs.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.promises.rename(tempFile, path.join(cacheDirectory, tarFileName));
}
await extractFromTar();
const cacheFiles = await fs.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.promises.unlink(path.join(cacheDirectory, cacheFiles[i])).catch(()=>{});
}
}
}
export 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.join(bindingsDirectory, pkgName);
if (fs.existsSync(outputDirectory)) {
// if the package is already downloaded a different
// failure occurred than not being present
return;
}
await fs.promises.mkdir(outputDirectory, {
recursive: true
});
await extractBinary(outputDirectory, pkgName, tarFileName);
}
}
export async function downloadWasmSwc(version, wasmDirectory, variant = "nodejs") {
const pkgName = `@next/swc-wasm-${variant}`;
const tarFileName = `${pkgName.substring(6)}-${version}.tgz`;
const outputDirectory = path.join(wasmDirectory, pkgName);
if (fs.existsSync(outputDirectory)) {
// if the package is already downloaded a different
// failure occurred than not being present
return;
}
await fs.promises.mkdir(outputDirectory, {
recursive: true
});
await extractBinary(outputDirectory, pkgName, tarFileName);
}
//# sourceMappingURL=download-swc.js.map

1
node_modules/next/dist/esm/lib/download-swc.js.map generated vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"sources":["../../src/lib/download-swc.ts"],"names":["fs","path","Log","tar","WritableStream","require","getRegistry","getCacheDirectory","MAX_VERSIONS_TO_CACHE","extractBinary","outputDirectory","pkgName","tarFileName","cacheDirectory","process","env","extractFromTar","x","file","join","cwd","strip","existsSync","info","promises","mkdir","recursive","tempFile","Date","now","registry","downloadUrl","fetch","then","res","ok","body","error","Error","status","cacheWriteStream","createWriteStream","pipeTo","write","chunk","Promise","resolve","reject","close","rename","cacheFiles","readdir","length","sort","a","b","localeCompare","i","unlink","catch","downloadNativeNextSwc","version","bindingsDirectory","triplesABI","triple","substring","downloadWasmSwc","wasmDirectory","variant"],"mappings":"AAAA,OAAOA,QAAQ,KAAI;AACnB,OAAOC,UAAU,OAAM;AACvB,YAAYC,SAAS,sBAAqB;AAC1C,OAAOC,SAAS,yBAAwB;AACxC,MAAM,EAAEC,cAAc,EAAE,GAAGC,QAAQ;AAGnC,SAASC,WAAW,QAAQ,yBAAwB;AACpD,SAASC,iBAAiB,QAAQ,gCAA+B;AAEjE,MAAMC,wBAAwB;AAE9B,eAAeC,cACbC,eAAuB,EACvBC,OAAe,EACfC,WAAmB;IAEnB,MAAMC,iBAAiBN,kBACrB,YACAO,QAAQC,GAAG,CAAC,gBAAgB;IAG9B,MAAMC,iBAAiB,IACrBb,IAAIc,CAAC,CAAC;YACJC,MAAMjB,KAAKkB,IAAI,CAACN,gBAAgBD;YAChCQ,KAAKV;YACLW,OAAO;QACT;IAEF,IAAI,CAACrB,GAAGsB,UAAU,CAACrB,KAAKkB,IAAI,CAACN,gBAAgBD,eAAe;QAC1DV,IAAIqB,IAAI,CAAC,CAAC,wBAAwB,EAAEZ,QAAQ,GAAG,CAAC;QAChD,MA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AAGsB,UAAU,CAACZ,kBAAkB;QAClC,mDAAmD;QACnD,0CAA0C;QAC1C;IACF;IAEA,MAAMV,GAAGwB,QAAQ,CAACC,KAAK,CAACf,iBAAiB;QAAEgB,WAAW;IAAK;IAC3D,MAAMjB,cAAcC,iBAAiBC,SAASC;AAChD"}

View File

@ -0,0 +1,70 @@
import { bold, cyan, gray, red, yellow } from "../picocolors";
import path from "path";
export var MessageSeverity;
(function(MessageSeverity) {
MessageSeverity[MessageSeverity["Warning"] = 1] = "Warning";
MessageSeverity[MessageSeverity["Error"] = 2] = "Error";
})(MessageSeverity || (MessageSeverity = {}));
function pluginCount(messages) {
let nextPluginWarningCount = 0;
let nextPluginErrorCount = 0;
for(let i = 0; i < messages.length; i++){
const { severity, ruleId } = messages[i];
if (ruleId == null ? void 0 : ruleId.includes("@next/next")) {
if (severity === 1) {
nextPluginWarningCount += 1;
} else {
nextPluginErrorCount += 1;
}
}
}
return {
nextPluginErrorCount,
nextPluginWarningCount
};
}
function formatMessage(dir, messages, filePath) {
let fileName = path.posix.normalize(path.relative(dir, filePath).replace(/\\/g, "/"));
if (!fileName.startsWith(".")) {
fileName = "./" + fileName;
}
let output = "\n" + cyan(fileName);
for(let i = 0; i < messages.length; i++){
const { message, severity, line, column, ruleId } = messages[i];
output = output + "\n";
if (line && column) {
output = output + yellow(line.toString()) + ":" + yellow(column.toString()) + " ";
}
if (severity === 1) {
output += yellow(bold("Warning")) + ": ";
} else {
output += red(bold("Error")) + ": ";
}
output += message;
if (ruleId) {
output += " " + gray(bold(ruleId));
}
}
return output;
}
export function formatResults(baseDir, results, format) {
let totalNextPluginErrorCount = 0;
let totalNextPluginWarningCount = 0;
let resultsWithMessages = results.filter(({ messages })=>messages == null ? void 0 : messages.length);
// Track number of Next.js plugin errors and warnings
resultsWithMessages.forEach(({ messages })=>{
const res = pluginCount(messages);
totalNextPluginErrorCount += res.nextPluginErrorCount;
totalNextPluginWarningCount += res.nextPluginWarningCount;
});
// Use user defined formatter or Next.js's built-in custom formatter
const output = format ? format(resultsWithMessages) : resultsWithMessages.map(({ messages, filePath })=>formatMessage(baseDir, messages, filePath)).join("\n");
return {
output: output,
outputWithMessages: resultsWithMessages.length > 0 ? output + `\n\n${cyan("info")} - Need to disable some ESLint rules? Learn more here: https://nextjs.org/docs/basic-features/eslint#disabling-rules` : "",
totalNextPluginErrorCount,
totalNextPluginWarningCount
};
}
//# sourceMappingURL=customFormatter.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/lib/eslint/customFormatter.ts"],"names":["bold","cyan","gray","red","yellow","path","MessageSeverity","pluginCount","messages","nextPluginWarningCount","nextPluginErrorCount","i","length","severity","ruleId","includes","formatMessage","dir","filePath","fileName","posix","normalize","relative","replace","startsWith","output","message","line","column","toString","formatResults","baseDir","results","format","totalNextPluginErrorCount","totalNextPluginWarningCount","resultsWithMessages","filter","forEach","res","map","join","outputWithMessages"],"mappings":"AAAA,SAASA,IAAI,EAAEC,IAAI,EAAEC,IAAI,EAAEC,GAAG,EAAEC,MAAM,QAAQ,gBAAe;AAC7D,OAAOC,UAAU,OAAM;;UAGXC;;;GAAAA,oBAAAA;AAsBZ,SAASC,YAAYC,QAAuB;IAI1C,IAAIC,yBAAyB;IAC7B,IAAIC,uBAAuB;IAE3B,IAAK,IAAIC,IAAI,GAAGA,IAAIH,SAASI,MAAM,EAAED,IAAK;QACxC,MAAM,EAAEE,QAAQ,EAAEC,MAAM,EAAE,GAAGN,QAAQ,CAACG,EAAE;QAExC,IAAIG,0BAAAA,OAAQC,QAAQ,CAAC,eAAe;YAClC,IAAIF,gBAAsC;gBACxCJ,0BAA0B;YAC5B,OAAO;gBACLC,wBAAwB;YAC1B;QACF;IACF;IAEA,OAAO;QACLA;QACAD;IACF;AACF;AAEA,SAASO,cACPC,GAAW,EACXT,QAAuB,EACvBU,QAAgB;IAEhB,IAAIC,WAAWd,KAAKe,KAAK,CAACC,SAAS,CACjChB,KAAKiB,QAAQ,CAACL,KAAKC,UAAUK,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A;QACRiB,oBACEN,oBAAoBxB,MAAM,GAAG,IACzBa,SACA,CAAC,IAAI,EAAExB,KACL,QACA,qHAAqH,CAAC,GACxH;QACNiC;QACAC;IACF;AACF"}

View File

@ -0,0 +1,34 @@
import findUp from "next/dist/compiled/find-up";
export const getESLintStrictValue = async (cwd)=>{
const tsConfigLocation = await findUp("tsconfig.json", {
cwd
});
const hasTSConfig = tsConfigLocation !== undefined;
return {
title: "Strict",
recommended: true,
config: {
extends: hasTSConfig ? [
"next/core-web-vitals",
"next/typescript"
] : "next/core-web-vitals"
}
};
};
export const getESLintPromptValues = async (cwd)=>{
return [
await getESLintStrictValue(cwd),
{
title: "Base",
config: {
extends: "next"
}
},
{
title: "Cancel",
config: null
}
];
};
//# sourceMappingURL=getESLintPromptValues.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/lib/eslint/getESLintPromptValues.ts"],"names":["findUp","getESLintStrictValue","cwd","tsConfigLocation","hasTSConfig","undefined","title","recommended","config","extends","getESLintPromptValues"],"mappings":"AAAA,OAAOA,YAAY,6BAA4B;AAE/C,OAAO,MAAMC,uBAAuB,OAAOC;IACzC,MAAMC,mBAAmB,MAAMH,OAAO,iBAAiB;QAAEE;IAAI;IAC7D,MAAME,cAAcD,qBAAqBE;IAEzC,OAAO;QACLC,OAAO;QACPC,aAAa;QACbC,QAAQ;YACNC,SAASL,cACL;gBAAC;gBAAwB;aAAkB,GAC3C;QACN;IACF;AACF,EAAC;AAED,OAAO,MAAMM,wBAAwB,OAAOR;IAC1C,OAAO;QACL,MAAMD,qBAAqBC;QAC3B;YACEI,OAAO;YACPE,QAAQ;gBACNC,SAAS;YACX;QACF;QACA;YACEH,OAAO;YACPE,QAAQ;QACV;KACD;AACH,EAAC"}

View File

@ -0,0 +1,27 @@
import { promises as fs } from "fs";
export async function hasEslintConfiguration(eslintrcFile, packageJsonConfig) {
const configObject = {
exists: false,
emptyEslintrc: false,
emptyPkgJsonConfig: false
};
if (eslintrcFile) {
const content = await fs.readFile(eslintrcFile, {
encoding: "utf8"
}).then((txt)=>txt.trim().replace(/\n/g, ""), ()=>null);
if (content === "" || content === "{}" || content === "---" || content === "module.exports = {}") {
configObject.emptyEslintrc = true;
} else {
configObject.exists = true;
}
} else if (packageJsonConfig == null ? void 0 : packageJsonConfig.eslintConfig) {
if (Object.keys(packageJsonConfig.eslintConfig).length) {
configObject.exists = true;
} else {
configObject.emptyPkgJsonConfig = true;
}
}
return configObject;
}
//# sourceMappingURL=hasEslintConfiguration.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/lib/eslint/hasEslintConfiguration.ts"],"names":["promises","fs","hasEslintConfiguration","eslintrcFile","packageJsonConfig","configObject","exists","emptyEslintrc","emptyPkgJsonConfig","content","readFile","encoding","then","txt","trim","replace","eslintConfig","Object","keys","length"],"mappings":"AAAA,SAASA,YAAYC,EAAE,QAAQ,KAAI;AASnC,OAAO,eAAeC,uBACpBC,YAA2B,EAC3BC,iBAA+C;IAE/C,MAAMC,eAAe;QACnBC,QAAQ;QACRC,eAAe;QACfC,oBAAoB;IACtB;IAEA,IAAIL,cAAc;QAChB,MAAMM,UAAU,MAAMR,GAAGS,QAAQ,CAACP,cAAc;YAAEQ,UAAU;QAAO,GAAGC,IAAI,CACxE,CAACC,MAAQA,IAAIC,IAAI,GAAGC,OAAO,CAAC,OAAO,KACnC,IAAM;QAGR,IACEN,YAAY,MACZA,YAAY,QACZA,YAAY,SACZA,YAAY,uBACZ;YACAJ,aAAaE,aAAa,GAAG;QAC/B,OAAO;YACLF,aAAaC,MAAM,GAAG;QACxB;IACF,OAAO,IAAIF,qCAAAA,kBAAmBY,YAAY,EAAE;QAC1C,IAAIC,OAAOC,IAAI,CAACd,kBAAkBY,YAAY,EAAEG,MAAM,EAAE;YACtDd,aAAaC,MAAM,GAAG;QACxB,OAAO;YACLD,aAAaG,kBAAkB,GAAG;QACpC;IACF;IACA,OAAOH;AACT"}

260
node_modules/next/dist/esm/lib/eslint/runLintCheck.js generated vendored Normal file
View File

@ -0,0 +1,260 @@
import { promises as fs, existsSync } from "fs";
import { bold, cyan, red, underline, yellow } from "../picocolors";
import path from "path";
import findUp from "next/dist/compiled/find-up";
import semver from "next/dist/compiled/semver";
import * as CommentJson from "next/dist/compiled/comment-json";
import { formatResults } from "./customFormatter";
import { writeDefaultConfig } from "./writeDefaultConfig";
import { hasEslintConfiguration } from "./hasEslintConfiguration";
import { writeOutputFile } from "./writeOutputFile";
import { findPagesDir } from "../find-pages-dir";
import { installDependencies } from "../install-dependencies";
import { hasNecessaryDependencies } from "../has-necessary-dependencies";
import * as Log from "../../build/output/log";
import isError, { getProperError } from "../is-error";
import { getPkgManager } from "../helpers/get-pkg-manager";
import { getESLintStrictValue, getESLintPromptValues } from "./getESLintPromptValues";
// 0 is off, 1 is warn, 2 is error. See https://eslint.org/docs/user-guide/configuring/rules#configuring-rules
const VALID_SEVERITY = [
"off",
"warn",
"error"
];
function isValidSeverity(severity) {
return VALID_SEVERITY.includes(severity);
}
const requiredPackages = [
{
file: "eslint",
pkg: "eslint",
exportsRestrict: false
},
{
file: "eslint-config-next",
pkg: "eslint-config-next",
exportsRestrict: false
}
];
async function cliPrompt(cwd) {
console.log(bold(`${cyan("?")} How would you like to configure ESLint? https://nextjs.org/docs/basic-features/eslint`));
try {
const cliSelect = (await Promise.resolve(require("next/dist/compiled/cli-select"))).default;
const { value } = await cliSelect({
values: await getESLintPromptValues(cwd),
valueRenderer: ({ title, recommended }, selected)=>{
const name = selected ? bold(underline(cyan(title))) : title;
return name + (recommended ? bold(yellow(" (recommended)")) : "");
},
selected: cyan(" "),
unselected: " "
});
return {
config: (value == null ? void 0 : value.config) ?? null
};
} catch {
return {
config: null
};
}
}
async function lint(baseDir, lintDirs, eslintrcFile, pkgJsonPath, { lintDuringBuild = false, eslintOptions = null, reportErrorsOnly = false, maxWarnings = -1, formatter = null, outputFile = null }) {
try {
var _mod_CLIEngine, _ESLint_getErrorResults;
// Load ESLint after we're sure it exists:
const deps = await hasNecessaryDependencies(baseDir, requiredPackages);
const packageManager = getPkgManager(baseDir);
if (deps.missing.some((dep)=>dep.pkg === "eslint")) {
Log.error(`ESLint must be installed${lintDuringBuild ? " in order to run during builds:" : ":"} ${bold(cyan((packageManager === "yarn" ? "yarn add --dev" : packageManager === "pnpm" ? "pnpm install --save-dev" : "npm install --save-dev") + " eslint"))}`);
return null;
}
const mod = await Promise.resolve(require(deps.resolved.get("eslint")));
const { ESLint } = mod;
let eslintVersion = (ESLint == null ? void 0 : ESLint.version) ?? ((_mod_CLIEngine = mod.CLIEngine) == null ? void 0 : _mod_CLIEngine.version);
if (!eslintVersion || semver.lt(eslintVersion, "7.0.0")) {
return `${red("error")} - Your project has an older version of ESLint installed${eslintVersion ? " (" + eslintVersion + ")" : ""}. Please upgrade to ESLint version 7 or above`;
}
let options = {
useEslintrc: true,
baseConfig: {},
errorOnUnmatchedPattern: false,
extensions: [
".js",
".jsx",
".ts",
".tsx"
],
cache: true,
...eslintOptions
};
let eslint = new ESLint(options);
let nextEslintPluginIsEnabled = false;
const nextRulesEnabled = new Map();
for (const configFile of [
eslintrcFile,
pkgJsonPath
]){
var _completeConfig_plugins;
if (!configFile) continue;
const completeConfig = await eslint.calculateConfigForFile(configFile);
if ((_completeConfig_plugins = completeConfig.plugins) == null ? void 0 : _completeConfig_plugins.includes("@next/next")) {
nextEslintPluginIsEnabled = true;
for (const [name, [severity]] of Object.entries(completeConfig.rules)){
if (!name.startsWith("@next/next/")) {
continue;
}
if (typeof severity === "number" && severity >= 0 && severity < VALID_SEVERITY.length) {
nextRulesEnabled.set(name, VALID_SEVERITY[severity]);
} else if (typeof severity === "string" && isValidSeverity(severity)) {
nextRulesEnabled.set(name, severity);
}
}
break;
}
}
const pagesDir = findPagesDir(baseDir).pagesDir;
const pagesDirRules = pagesDir ? [
"@next/next/no-html-link-for-pages"
] : [];
if (nextEslintPluginIsEnabled) {
let updatedPagesDir = false;
for (const rule of pagesDirRules){
var _options_baseConfig_rules, _options_baseConfig_rules1;
if (!((_options_baseConfig_rules = options.baseConfig.rules) == null ? void 0 : _options_baseConfig_rules[rule]) && !((_options_baseConfig_rules1 = options.baseConfig.rules) == null ? void 0 : _options_baseConfig_rules1[rule.replace("@next/next", "@next/babel-plugin-next")])) {
if (!options.baseConfig.rules) {
options.baseConfig.rules = {};
}
options.baseConfig.rules[rule] = [
1,
pagesDir
];
updatedPagesDir = true;
}
}
if (updatedPagesDir) {
eslint = new ESLint(options);
}
} else {
Log.warn("");
Log.warn("The Next.js plugin was not detected in your ESLint configuration. See https://nextjs.org/docs/basic-features/eslint#migrating-existing-config");
}
const lintStart = process.hrtime();
let results = await eslint.lintFiles(lintDirs);
let selectedFormatter = null;
if (options.fix) await ESLint.outputFixes(results);
if (reportErrorsOnly) results = await ESLint.getErrorResults(results) // Only return errors if --quiet flag is used
;
if (formatter) selectedFormatter = await eslint.loadFormatter(formatter);
const formattedResult = formatResults(baseDir, results, selectedFormatter == null ? void 0 : selectedFormatter.format);
const lintEnd = process.hrtime(lintStart);
const totalWarnings = results.reduce((sum, file)=>sum + file.warningCount, 0);
if (outputFile) await writeOutputFile(outputFile, formattedResult.output);
return {
output: formattedResult.outputWithMessages,
isError: ((_ESLint_getErrorResults = ESLint.getErrorResults(results)) == null ? void 0 : _ESLint_getErrorResults.length) > 0 || maxWarnings >= 0 && totalWarnings > maxWarnings,
eventInfo: {
durationInSeconds: lintEnd[0],
eslintVersion: eslintVersion,
lintedFilesCount: results.length,
lintFix: !!options.fix,
nextEslintPluginVersion: nextEslintPluginIsEnabled && deps.resolved.has("eslint-config-next") ? require(path.join(path.dirname(deps.resolved.get("eslint-config-next")), "package.json")).version : null,
nextEslintPluginErrorsCount: formattedResult.totalNextPluginErrorCount,
nextEslintPluginWarningsCount: formattedResult.totalNextPluginWarningCount,
nextRulesEnabled: Object.fromEntries(nextRulesEnabled)
}
};
} catch (err) {
if (lintDuringBuild) {
Log.error(`ESLint: ${isError(err) && err.message ? err.message.replace(/\n/g, " ") : err}`);
return null;
} else {
throw getProperError(err);
}
}
}
export async function runLintCheck(baseDir, lintDirs, opts) {
const { lintDuringBuild = false, eslintOptions = null, reportErrorsOnly = false, maxWarnings = -1, formatter = null, outputFile = null, strict = false } = opts;
try {
// Find user's .eslintrc file
// See: https://eslint.org/docs/user-guide/configuring/configuration-files#configuration-file-formats
const eslintrcFile = await findUp([
".eslintrc.js",
".eslintrc.cjs",
".eslintrc.yaml",
".eslintrc.yml",
".eslintrc.json",
".eslintrc"
], {
cwd: baseDir
}) ?? null;
const pkgJsonPath = await findUp("package.json", {
cwd: baseDir
}) ?? null;
let packageJsonConfig = null;
if (pkgJsonPath) {
const pkgJsonContent = await fs.readFile(pkgJsonPath, {
encoding: "utf8"
});
packageJsonConfig = CommentJson.parse(pkgJsonContent);
}
const config = await hasEslintConfiguration(eslintrcFile, packageJsonConfig);
let deps;
if (config.exists) {
// Run if ESLint config exists
return await lint(baseDir, lintDirs, eslintrcFile, pkgJsonPath, {
lintDuringBuild,
eslintOptions,
reportErrorsOnly,
maxWarnings,
formatter,
outputFile
});
} else {
// Display warning if no ESLint configuration is present inside
// config file during "next build", no warning is shown when
// no eslintrc file is present
if (lintDuringBuild) {
if (config.emptyPkgJsonConfig || config.emptyEslintrc) {
Log.warn(`No ESLint configuration detected. Run ${bold(cyan("next lint"))} to begin setup`);
}
return null;
} else {
// Ask user what config they would like to start with for first time "next lint" setup
const { config: selectedConfig } = strict ? await getESLintStrictValue(baseDir) : await cliPrompt(baseDir);
if (selectedConfig == null) {
// Show a warning if no option is selected in prompt
Log.warn("If you set up ESLint yourself, we recommend adding the Next.js ESLint plugin. See https://nextjs.org/docs/basic-features/eslint#migrating-existing-config");
return null;
} else {
// Check if necessary deps installed, and install any that are missing
deps = await hasNecessaryDependencies(baseDir, requiredPackages);
if (deps.missing.length > 0) {
deps.missing.forEach((dep)=>{
if (dep.pkg === "eslint") {
// eslint v9 has breaking changes, so lock to 8 until dependency plugins fully support v9.
dep.pkg = "eslint@^8";
}
});
await installDependencies(baseDir, deps.missing, true);
}
// Write default ESLint config.
// Check for /pages and src/pages is to make sure this happens in Next.js folder
if ([
"app",
"src/app",
"pages",
"src/pages"
].some((dir)=>existsSync(path.join(baseDir, dir)))) {
await writeDefaultConfig(baseDir, config, selectedConfig, eslintrcFile, pkgJsonPath, packageJsonConfig);
}
}
Log.ready(`ESLint has successfully been configured. Run ${bold(cyan("next lint"))} again to view warnings and errors.`);
return null;
}
}
} catch (err) {
throw err;
}
}
//# sourceMappingURL=runLintCheck.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,31 @@
import { promises as fs } from "fs";
import { bold, green } from "../picocolors";
import os from "os";
import path from "path";
import * as CommentJson from "next/dist/compiled/comment-json";
import * as Log from "../../build/output/log";
export async function writeDefaultConfig(baseDir, { exists, emptyEslintrc, emptyPkgJsonConfig }, selectedConfig, eslintrcFile, pkgJsonPath, packageJsonConfig) {
if (!exists && emptyEslintrc && eslintrcFile) {
const ext = path.extname(eslintrcFile);
let newFileContent;
if (ext === ".yaml" || ext === ".yml") {
newFileContent = "extends: 'next'";
} else {
newFileContent = CommentJson.stringify(selectedConfig, null, 2);
if (ext === ".js") {
newFileContent = "module.exports = " + newFileContent;
}
}
await fs.writeFile(eslintrcFile, newFileContent + os.EOL);
Log.info(`We detected an empty ESLint configuration file (${bold(path.basename(eslintrcFile))}) and updated it for you!`);
} else if (!exists && emptyPkgJsonConfig && packageJsonConfig) {
packageJsonConfig.eslintConfig = selectedConfig;
if (pkgJsonPath) await fs.writeFile(pkgJsonPath, CommentJson.stringify(packageJsonConfig, null, 2) + os.EOL);
Log.info(`We detected an empty ${bold("eslintConfig")} field in package.json and updated it for you!`);
} else if (!exists) {
await fs.writeFile(path.join(baseDir, ".eslintrc.json"), CommentJson.stringify(selectedConfig, null, 2) + os.EOL);
console.log(green(`We created the ${bold(".eslintrc.json")} file for you and included your selected configuration.`));
}
}
//# sourceMappingURL=writeDefaultConfig.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/lib/eslint/writeDefaultConfig.ts"],"names":["promises","fs","bold","green","os","path","CommentJson","Log","writeDefaultConfig","baseDir","exists","emptyEslintrc","emptyPkgJsonConfig","selectedConfig","eslintrcFile","pkgJsonPath","packageJsonConfig","ext","extname","newFileContent","stringify","writeFile","EOL","info","basename","eslintConfig","join","console","log"],"mappings":"AAAA,SAASA,YAAYC,EAAE,QAAQ,KAAI;AACnC,SAASC,IAAI,EAAEC,KAAK,QAAQ,gBAAe;AAC3C,OAAOC,QAAQ,KAAI;AACnB,OAAOC,UAAU,OAAM;AACvB,YAAYC,iBAAiB,kCAAiC;AAG9D,YAAYC,SAAS,yBAAwB;AAE7C,OAAO,eAAeC,mBACpBC,OAAe,EACf,EAAEC,MAAM,EAAEC,aAAa,EAAEC,kBAAkB,EAAmB,EAC9DC,cAAmB,EACnBC,YAA2B,EAC3BC,WAA0B,EAC1BC,iBAA+C;IAE/C,IAAI,CAACN,UAAUC,iBAAiBG,cAAc;QAC5C,MAAMG,MAAMZ,KAAKa,OAAO,CAACJ;QAEzB,IAAIK;QACJ,IAAIF,QAAQ,WAAWA,QAAQ,QAAQ;YACrCE,iBAAiB;QACnB,OAAO;YACLA,iBAAiBb,YAAYc,SAAS,CAACP,gBAAgB,MAAM;YAE7D,IAAII,QAAQ,OAAO;gBACjBE,iBAAiB,sBAAsBA;YACzC;QACF;QAEA,MAAMlB,GAAGoB,SAAS,CAACP,cAAcK,iBAAiBf,GAAGkB,GAAG;QAExDf,IAAIgB,IAAI,CACN,CAAC,gDAAgD,EAAErB,KACjDG,KAAKmB,QAAQ,CAACV,eACd,yBAAyB,CAAC;IAEhC,OAAO,IAAI,CAACJ,UAAUE,sBAAsBI,mBAAmB;QAC7DA,kBAAkBS,YAAY,GAAGZ;QAEjC,IAAIE,aACF,MAAMd,GAAGoB,SAAS,CAChBN,aACAT,YAAYc,SAAS,CAACJ,mBAAmB,MAAM,KAAKZ,GAAGkB,GAAG;QAG9Df,IAAIgB,IAAI,CACN,CAAC,qBAAqB,EAAErB,KACtB,gBACA,8CAA8C,CAAC;IAErD,OAAO,IAAI,CAACQ,QAAQ;QAClB,MAAMT,GAAGoB,SAAS,CAChBhB,KAAKqB,IAAI,CAACjB,SAAS,mBACnBH,YAAYc,SAAS,CAACP,gBAAgB,MAAM,KAAKT,GAAGkB,GAAG;QAGzDK,QAAQC,GAAG,CACTzB,MACE,CAAC,eAAe,EAAED,KAChB,kBACA,uDAAuD,CAAC;IAGhE;AACF"}

View File

@ -0,0 +1,36 @@
import { promises as fs } from "fs";
import path from "path";
import * as Log from "../../build/output/log";
import isError from "../../lib/is-error";
/**
* Check if a given file path is a directory or not.
* Returns `true` if the path is a directory.
*/ function isDirectory(/** The path to a file to check. */ filePath) {
return fs.stat(filePath).then((stat)=>stat.isDirectory()).catch((error)=>{
if (isError(error) && (error.code === "ENOENT" || error.code === "ENOTDIR")) {
return false;
}
throw error;
});
}
/**
* Create a file with eslint output data
*/ export async function writeOutputFile(/** The name file that needs to be created */ outputFile, /** The data that needs to be inserted into the file */ outputData) {
const filePath = path.resolve(process.cwd(), outputFile);
if (await isDirectory(filePath)) {
Log.error(`Cannot write to output file path, it is a directory: ${filePath}`);
} else {
try {
await fs.mkdir(path.dirname(filePath), {
recursive: true
});
await fs.writeFile(filePath, outputData);
Log.info(`The output file has been created: ${filePath}`);
} catch (err) {
Log.error(`There was a problem writing the output file: ${filePath}`);
console.error(err);
}
}
}
//# sourceMappingURL=writeOutputFile.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/lib/eslint/writeOutputFile.ts"],"names":["promises","fs","path","Log","isError","isDirectory","filePath","stat","then","catch","error","code","writeOutputFile","outputFile","outputData","resolve","process","cwd","mkdir","dirname","recursive","writeFile","info","err","console"],"mappings":"AAAA,SAASA,YAAYC,EAAE,QAAQ,KAAI;AACnC,OAAOC,UAAU,OAAM;AACvB,YAAYC,SAAS,yBAAwB;AAC7C,OAAOC,aAAa,qBAAoB;AAExC;;;CAGC,GACD,SAASC,YACP,kCAAkC,GAClCC,QAAgB;IAEhB,OAAOL,GACJM,IAAI,CAACD,UACLE,IAAI,CAAC,CAACD,OAASA,KAAKF,WAAW,IAC/BI,KAAK,CAAC,CAACC;QACN,IACEN,QAAQM,UACPA,CAAAA,MAAMC,IAAI,KAAK,YAAYD,MAAMC,IAAI,KAAK,SAAQ,GACnD;YACA,OAAO;QACT;QACA,MAAMD;IACR;AACJ;AACA;;CAEC,GACD,OAAO,eAAeE,gBACpB,2CAA2C,GAC3CC,UAAkB,EAClB,qDAAqD,GACrDC,UAAkB;IAElB,MAAMR,WAAWJ,KAAKa,OAAO,CAACC,QAAQC,GAAG,IAAIJ;IAE7C,IAAI,MAAMR,YAAYC,WAAW;QAC/BH,IAAIO,KAAK,CACP,CAAC,qDAAqD,EAAEJ,SAAS,CAAC;IAEtE,OAAO;QACL,IAAI;YACF,MAAML,GAAGiB,KAAK,CAAChB,KAAKiB,OAAO,CAACb,WAAW;gBAAEc,WAAW;YAAK;YACzD,MAAMnB,GAAGoB,SAAS,CAACf,UAAUQ;YAC7BX,IAAImB,IAAI,CAAC,CAAC,kCAAkC,EAAEhB,SAAS,CAAC;QAC1D,EAAE,OAAOiB,KAAK;YACZpB,IAAIO,KAAK,CAAC,CAAC,6CAA6C,EAAEJ,SAAS,CAAC;YACpEkB,QAAQd,KAAK,CAACa;QAChB;IACF;AACF"}

4
node_modules/next/dist/esm/lib/fatal-error.js generated vendored Normal file
View File

@ -0,0 +1,4 @@
export class FatalError extends Error {
}
//# sourceMappingURL=fatal-error.js.map

1
node_modules/next/dist/esm/lib/fatal-error.js.map generated vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"sources":["../../src/lib/fatal-error.ts"],"names":["FatalError","Error"],"mappings":"AAAA,OAAO,MAAMA,mBAAmBC;AAAO"}

26
node_modules/next/dist/esm/lib/file-exists.js generated vendored Normal file
View File

@ -0,0 +1,26 @@
import { existsSync, promises } from "fs";
import isError from "./is-error";
export var FileType;
(function(FileType) {
FileType["File"] = "file";
FileType["Directory"] = "directory";
})(FileType || (FileType = {}));
export async function fileExists(fileName, type) {
try {
if (type === "file") {
const stats = await promises.stat(fileName);
return stats.isFile();
} else if (type === "directory") {
const stats = await promises.stat(fileName);
return stats.isDirectory();
}
return existsSync(fileName);
} catch (err) {
if (isError(err) && (err.code === "ENOENT" || err.code === "ENAMETOOLONG")) {
return false;
}
throw err;
}
}
//# sourceMappingURL=file-exists.js.map

1
node_modules/next/dist/esm/lib/file-exists.js.map generated vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"sources":["../../src/lib/file-exists.ts"],"names":["existsSync","promises","isError","FileType","fileExists","fileName","type","stats","stat","isFile","isDirectory","err","code"],"mappings":"AAAA,SAASA,UAAU,EAAEC,QAAQ,QAAQ,KAAI;AACzC,OAAOC,aAAa,aAAY;;UAEpBC;;;GAAAA,aAAAA;AAKZ,OAAO,eAAeC,WACpBC,QAAgB,EAChBC,IAAe;IAEf,IAAI;QACF,IAAIA,iBAAwB;YAC1B,MAAMC,QAAQ,MAAMN,SAASO,IAAI,CAACH;YAClC,OAAOE,MAAME,MAAM;QACrB,OAAO,IAAIH,sBAA6B;YACtC,MAAMC,QAAQ,MAAMN,SAASO,IAAI,CAACH;YAClC,OAAOE,MAAMG,WAAW;QAC1B;QAEA,OAAOV,WAAWK;IACpB,EAAE,OAAOM,KAAK;QACZ,IACET,QAAQS,QACPA,CAAAA,IAAIC,IAAI,KAAK,YAAYD,IAAIC,IAAI,KAAK,cAAa,GACpD;YACA,OAAO;QACT;QACA,MAAMD;IACR;AACF"}

78
node_modules/next/dist/esm/lib/find-config.js generated vendored Normal file
View File

@ -0,0 +1,78 @@
import findUp from "next/dist/compiled/find-up";
import { readFile } from "fs/promises";
import JSON5 from "next/dist/compiled/json5";
import { pathToFileURL } from "url";
export function findConfigPath(dir, key) {
// If we didn't find the configuration in `package.json`, we should look for
// known filenames.
return findUp([
`.${key}rc.json`,
`${key}.config.json`,
`.${key}rc.js`,
`${key}.config.js`,
`${key}.config.mjs`,
`${key}.config.cjs`
], {
cwd: dir
});
}
// We'll allow configuration to be typed, but we force everything provided to
// become optional. We do not perform any schema validation. We should maybe
// force all the types to be `unknown` as well.
export async function findConfig(directory, key, _returnFile) {
// `package.json` configuration always wins. Let's check that first.
const packageJsonPath = await findUp("package.json", {
cwd: directory
});
let isESM = false;
if (packageJsonPath) {
try {
const packageJsonStr = await 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(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 readFile(filePath, "utf8");
return JSON5.parse(fileContents);
}
return null;
}
//# sourceMappingURL=find-config.js.map

1
node_modules/next/dist/esm/lib/find-config.js.map generated vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"sources":["../../src/lib/find-config.ts"],"names":["findUp","readFile","JSON5","pathToFileURL","findConfigPath","dir","key","cwd","findConfig","directory","_returnFile","packageJsonPath","isESM","packageJsonStr","packageJson","JSON","parse","Error","type","filePath","esmImport","path","process","platform","env","JEST_WORKER_ID","toString","endsWith","default","require","fileContents"],"mapp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,KAAK,WAAW,CAACD,QAAQE,GAAG,CAACC,cAAc,EAAE;YAC/D,sEAAsE;YACtE,mBAAmB;YACnB,OAAO,MAAM,CAACtB,cAAckB,MAAMK,QAAQ;QAC5C,OAAO;YACL,OAAO,MAAM,CAACL;QAChB;IACF;IAEA,IAAIF,UAAU;QACZ,IAAIA,SAASQ,QAAQ,CAAC,QAAQ;YAC5B,IAAIf,OAAO;gBACT,OAAO,AAAC,CAAA,MAAMQ,UAAUD,SAAQ,EAAGS,OAAO;YAC5C,OAAO;gBACL,OAAOC,QAAQV;YACjB;QACF,OAAO,IAAIA,SAASQ,QAAQ,CAAC,SAAS;YACpC,OAAO,AAAC,CAAA,MAAMP,UAAUD,SAAQ,EAAGS,OAAO;QAC5C,OAAO,IAAIT,SAASQ,QAAQ,CAAC,SAAS;YACpC,OAAOE,QAAQV;QACjB;QAEA,sEAAsE;QACtE,kEAAkE;QAClE,MAAMW,eAAe,MAAM7B,SAASkB,UAAU;QAC9C,OAAOjB,MAAMc,KAAK,CAACc;IACrB;IAEA,OAAO;AACT"}

23
node_modules/next/dist/esm/lib/find-pages-dir.js generated vendored Normal file
View File

@ -0,0 +1,23 @@
import fs from "fs";
import path from "path";
export function findDir(dir, name) {
// prioritize ./${name} over ./src/${name}
let curDir = path.join(dir, name);
if (fs.existsSync(curDir)) return curDir;
curDir = path.join(dir, "src", name);
if (fs.existsSync(curDir)) return curDir;
return null;
}
export function findPagesDir(dir) {
const pagesDir = findDir(dir, "pages") || undefined;
const appDir = findDir(dir, "app") || undefined;
if (appDir == null && pagesDir == null) {
throw new Error("> Couldn't find any `pages` or `app` directory. Please create one under the project root");
}
return {
pagesDir,
appDir
};
}
//# sourceMappingURL=find-pages-dir.js.map

1
node_modules/next/dist/esm/lib/find-pages-dir.js.map generated vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"sources":["../../src/lib/find-pages-dir.ts"],"names":["fs","path","findDir","dir","name","curDir","join","existsSync","findPagesDir","pagesDir","undefined","appDir","Error"],"mappings":"AAAA,OAAOA,QAAQ,KAAI;AACnB,OAAOC,UAAU,OAAM;AAEvB,OAAO,SAASC,QAAQC,GAAW,EAAEC,IAAqB;IACxD,0CAA0C;IAC1C,IAAIC,SAASJ,KAAKK,IAAI,CAACH,KAAKC;IAC5B,IAAIJ,GAAGO,UAAU,CAACF,SAAS,OAAOA;IAElCA,SAASJ,KAAKK,IAAI,CAACH,KAAK,OAAOC;IAC/B,IAAIJ,GAAGO,UAAU,CAACF,SAAS,OAAOA;IAElC,OAAO;AACT;AAEA,OAAO,SAASG,aAAaL,GAAW;IAItC,MAAMM,WAAWP,QAAQC,KAAK,YAAYO;IAC1C,MAAMC,SAAST,QAAQC,KAAK,UAAUO;IAEtC,IAAIC,UAAU,QAAQF,YAAY,MAAM;QACtC,MAAM,IAAIG,MACR;IAEJ;IAEA,OAAO;QACLH;QACAE;IACF;AACF"}

18
node_modules/next/dist/esm/lib/find-root.js generated vendored Normal file
View File

@ -0,0 +1,18 @@
import { dirname } from "path";
import findUp from "next/dist/compiled/find-up";
export function findRootLockFile(cwd) {
return findUp.sync([
"pnpm-lock.yaml",
"package-lock.json",
"yarn.lock",
"bun.lockb"
], {
cwd
});
}
export function findRootDir(cwd) {
const lockFile = findRootLockFile(cwd);
return lockFile ? dirname(lockFile) : undefined;
}
//# sourceMappingURL=find-root.js.map

1
node_modules/next/dist/esm/lib/find-root.js.map generated vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"sources":["../../src/lib/find-root.ts"],"names":["dirname","findUp","findRootLockFile","cwd","sync","findRootDir","lockFile","undefined"],"mappings":"AAAA,SAASA,OAAO,QAAQ,OAAM;AAC9B,OAAOC,YAAY,6BAA4B;AAE/C,OAAO,SAASC,iBAAiBC,GAAW;IAC1C,OAAOF,OAAOG,IAAI,CAChB;QAAC;QAAkB;QAAqB;QAAa;KAAY,EACjE;QACED;IACF;AAEJ;AAEA,OAAO,SAASE,YAAYF,GAAW;IACrC,MAAMG,WAAWJ,iBAAiBC;IAClC,OAAOG,WAAWN,QAAQM,YAAYC;AACxC"}

View File

@ -0,0 +1,75 @@
import { bold } from "../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 = [
`${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([
`${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([
`${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([
`${bold("Commands:")}`,
formatList(commandList),
""
]);
}
return output.join("\n");
};
export { formatCliHelpOutput };
//# sourceMappingURL=format-cli-help-output.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../src/lib/format-cli-help-output.ts"],"names":["bold","formatCliHelpOutput","cmd","helper","termWidth","padWidth","helpWidth","itemIndentWidth","itemSeparatorWidth","formatItem","term","description","value","fullText","padEnd","wrap","formatList","textArray","join","replace","repeat","output","commandUsage","commandDescription","length","concat","argumentList","visibleArguments","map","argument","argumentTerm","argumentDescription","optionList","visibleOptions","option","optionTerm","optionDescription","commandList","visibleCommands","subCmd","subcommandTerm","subcommandDescription"],"mappings":"AACA,SAASA,IAAI,QAAQ,oBAAmB;AAExC,2DAA2D;AAC3D,mEAAmE;AACnE,mEAAmE;AACnE,MAAMC,sBAAsB,CAACC,KAAcC;IACzC,MAAMC,YAAYD,OAAOE,QAAQ,CAACH,KAAKC;IACvC,MAAMG,YAAYH,OAAOG,SAAS,IAAI;IACtC,MAAMC,kBAAkB;IACxB,MAAMC,qBAAqB,EAAE,+BAA+B;;IAE5D,SAASC,WAAWC,IAAY,EAAEC,WAAmB;QACnD,IAAIC,QAAQF;QAEZ,IAAIC,aAAa;YACf,IAAID,SAAS,aAAa;gBACxBE,QAAQ,CAAC,CAAC,EAAEF,KAAK,CAAC,CAAC;YACrB;YAEA,MAAMG,WAAW,CAAC,EAAED,MAAME,MAAM,CAC9BV,YAAYI,oBACZ,EAAEG,YAAY,CAAC;YAEjB,OAAOR,OAAOY,IAAI,CAChBF,UACAP,YAAYC,iBACZH,YAAYI;QAEhB;QAEA,OAAOE;IACT;IAEA,SAASM,WAAWC,SAAmB;QACrC,OAAOA,UAAUC,IAAI,CAAC,MAAMC,OAAO,CAAC,OAAO,IAAIC,MAAM,CAACb;IACxD;IAEA,QAAQ;IACR,IAAIc,SAAS;QAAC,CAAC,EAAErB,KAAK,UAAU,CAAC,EAAEG,OAAOmB,YAAY,CAACpB,KAAK,CAAC;QAAE;KAAG;IAElE,cAAc;IACd,MAAMqB,qBAAqBpB,OAAOoB,kBAAkB,CAACrB;IAErD,IAAIqB,mBAAmBC,MAAM,GAAG,GAAG;QACjCH,SAASA,OAAOI,MAAM,CAAC;YAACtB,OAAOY,IAAI,CAACQ,oBAAoBjB,WAAW;YAAI;SAAG;IAC5E;IAEA,YAAY;IACZ,MAAMoB,eAAevB,OAAOwB,gBAAgB,CAACzB,KAAK0B,GAAG,CAAC,CAACC;QACrD,OAAOpB,WACLN,OAAO2B,YAAY,CAACD,WACpB1B,OAAO4B,mBAAmB,CAACF;IAE/B;IAEA,IAAIH,aAAaF,MAAM,GAAG,GAAG;QAC3BH,SAASA,OAAOI,MAAM,CAAC;YACrB,CAAC,EAAEzB,KAAK,cAAc,CAAC;YACvBgB,WAAWU;YACX;SACD;IACH;IAEA,UAAU;IACV,MAAMM,aAAa7B,OAAO8B,cAAc,CAAC/B,KAAK0B,GAAG,CAAC,CAACM;QACjD,OAAOzB,WACLN,OAAOgC,UAAU,CAACD,SAClB/B,OAAOiC,iBAAiB,CAACF;IAE7B;IAEA,IAAIF,WAAWR,MAAM,GAAG,GAAG;QACzBH,SAASA,OAAOI,MAAM,CAAC;YAAC,CAAC,EAAEzB,KAAK,YAAY,CAAC;YAAEgB,WAAWgB;YAAa;SAAG;IAC5E;IAEA,WAAW;IACX,MAAMK,cAAclC,OAAOmC,eAAe,CAACpC,KAAK0B,GAAG,CAAC,CAACW;QACnD,OAAO9B,WACLN,OAAOqC,cAAc,CAACD,SACtBpC,OAAOsC,qBAAqB,CAACF;IAEjC;IAEA,IAAIF,YAAYb,MAAM,GAAG,GAAG;QAC1BH,SAASA,OAAOI,MAAM,CAAC;YACrB,CAAC,EAAEzB,KAAK,aAAa,CAAC;YACtBgB,WAAWqB;YACX;SACD;IACH;IAEA,OAAOhB,OAAOH,IAAI,CAAC;AACrB;AAEA,SAASjB,mBAAmB,GAAE"}

View File

@ -0,0 +1,16 @@
import path from "path";
import { pathToFileURL } from "url";
/**
* The path for a dynamic route must be URLs with a valid scheme.
*
* When an absolute Windows path is passed to it, it interprets the beginning of the path as a protocol (`C:`).
* Therefore, it is important to always construct a complete path.
* @param dir File directory
* @param filePath Absolute or relative path
*/ export const formatDynamicImportPath = (dir, filePath)=>{
const absoluteFilePath = path.isAbsolute(filePath) ? filePath : path.join(dir, filePath);
const formattedFilePath = pathToFileURL(absoluteFilePath).toString();
return formattedFilePath;
};
//# sourceMappingURL=format-dynamic-import-path.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../src/lib/format-dynamic-import-path.ts"],"names":["path","pathToFileURL","formatDynamicImportPath","dir","filePath","absoluteFilePath","isAbsolute","join","formattedFilePath","toString"],"mappings":"AAAA,OAAOA,UAAU,OAAM;AACvB,SAASC,aAAa,QAAQ,MAAK;AAEnC;;;;;;;CAOC,GACD,OAAO,MAAMC,0BAA0B,CAACC,KAAaC;IACnD,MAAMC,mBAAmBL,KAAKM,UAAU,CAACF,YACrCA,WACAJ,KAAKO,IAAI,CAACJ,KAAKC;IACnB,MAAMI,oBAAoBP,cAAcI,kBAAkBI,QAAQ;IAElE,OAAOD;AACT,EAAC"}

61
node_modules/next/dist/esm/lib/format-server-error.js generated vendored Normal file
View File

@ -0,0 +1,61 @@
const invalidServerComponentReactHooks = [
"useDeferredValue",
"useEffect",
"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");
}
}
/**
* Input:
* Error: Something went wrong
at funcName (/path/to/file.js:10:5)
at anotherFunc (/path/to/file.js:15:10)
* Output:
at funcName (/path/to/file.js:10:5)
at anotherFunc (/path/to/file.js:15:10)
*/ export function getStackWithoutErrorMessage(error) {
const stack = error.stack;
if (!stack) return "";
return stack.replace(/^[^\n]*\n/, "");
}
export 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

@ -0,0 +1 @@
{"version":3,"sources":["../../src/lib/format-server-error.ts"],"names":["invalidServerComponentReactHooks","setMessage","error","message","stack","lines","split","join","getStackWithoutErrorMessage","replace","formatServerError","includes","addedMessage","clientHook","regex","RegExp","test"],"mappings":"AAAA,MAAMA,mCAAmC;IACvC;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AAED,SAASC,WAAWC,KAAY,EAAEC,OAAe;IAC/CD,MAAMC,OAAO,GAAGA;IAChB,IAAID,MAAME,KAAK,EAAE;QACf,MAAMC,QAAQH,MAAME,KAAK,CAACE,KAAK,CAAC;QAChCD,KAAK,CAAC,EAAE,GAAGF;QACXD,MAAME,KAAK,GAAGC,MAAME,IAAI,CAAC;IAC3B;AACF;AAEA;;;;;;;;;CASC,GACD,OAAO,SAASC,4BAA4BN,KAAY;IACtD,MAAME,QAAQF,MAAME,KAAK;IACzB,IAAI,CAACA,OAAO,OAAO;IACnB,OAAOA,MAAMK,OAAO,CAAC,aAAa;AACpC;AAEA,OAAO,SAASC,kBAAkBR,KAAY;IAC5C,IAAI,QAAOA,yBAAAA,MAAOC,OAAO,MAAK,UAAU;IAExC,IACED,MAAMC,OAAO,CAACQ,QAAQ,CACpB,+DAEF;QACA,MAAMC,eACJ;QAEF,qEAAqE;QACrE,IAAIV,MAAMC,OAAO,CAACQ,QAAQ,CAACC,eAAe;QAE1CX,WACEC,OACA,CAAC,EAAEA,MAAMC,OAAO,CAAC;;AAEvB,EAAES,aAAa,CAAC;QAEZ;IACF;IAEA,IAAIV,MAAMC,OAAO,CAACQ,QAAQ,CAAC,oCAAoC;QAC7DV,WACEC,OACA;QAEF;IACF;IAEA,KAAK,MAAMW,cAAcb,iCAAkC;QACzD,MAAMc,QAAQ,IAAIC,OAAO,CAAC,GAAG,EAAEF,WAAW,sBAAsB,CAAC;QACjE,IAAIC,MAAME,IAAI,CAACd,MAAMC,OAAO,GAAG;YAC7BF,WACEC,OACA,CAAC,EAAEW,WAAW,oLAAoL,CAAC;YAErM;QACF;IACF;AACF"}

81
node_modules/next/dist/esm/lib/fs/rename.js generated vendored Normal file
View File

@ -0,0 +1,81 @@
/*
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
import * as fs from "graceful-fs";
import { promisify } from "util";
/**
* A drop-in replacement for `fs.rename` that:
* - allows to move across multiple disks
* - attempts to retry the operation for certain error codes on Windows
*/ export async function rename(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().
await renameWithRetry(source, target, Date.now(), windowsRetryTimeout);
} else {
await promisify(fs.rename)(source, target);
}
}
async function renameWithRetry(source, target, startTime, retryTimeout, attempt = 0) {
try {
return await promisify(fs.rename)(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 === 0) {
let abortRetry = false;
try {
const stat = await promisify(fs.stat)(target);
if (!stat.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;
}
}
// Delay with incremental backoff up to 100ms
await timeout(Math.min(100, attempt * 10));
// Attempt again
return renameWithRetry(source, target, startTime, retryTimeout, attempt + 1);
}
}
const timeout = (millis)=>new Promise((resolve)=>setTimeout(resolve, millis));
//# sourceMappingURL=rename.js.map

1
node_modules/next/dist/esm/lib/fs/rename.js.map generated vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/lib/fs/rename.ts"],"names":["fs","promisify","rename","source","target","windowsRetryTimeout","process","platform","renameWithRetry","Date","now","startTime","retryTimeout","attempt","error","code","console","abortRetry","stat","isFile","e","timeout","Math","min","millis","Promise","resolve","setTimeout"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;CAsB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6CAA6C;QAC7C,MAAMO,QAAQC,KAAKC,GAAG,CAAC,KAAKV,UAAU;QAEtC,gBAAgB;QAChB,OAAOL,gBAAgBL,QAAQC,QAAQO,WAAWC,cAAcC,UAAU;IAC5E;AACF;AAEA,MAAMQ,UAAU,CAACG,SACf,IAAIC,QAAQ,CAACC,UAAYC,WAAWD,SAASF"}

18
node_modules/next/dist/esm/lib/fs/write-atomic.js generated vendored Normal file
View File

@ -0,0 +1,18 @@
import { unlink, writeFile } from "fs/promises";
import { rename } from "./rename";
export async function writeFileAtomic(filePath, content) {
const tempPath = filePath + ".tmp." + Math.random().toString(36).slice(2);
try {
await writeFile(tempPath, content, "utf-8");
await rename(tempPath, filePath);
} catch (e) {
try {
await unlink(tempPath);
} catch {
// ignore
}
throw e;
}
}
//# sourceMappingURL=write-atomic.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/lib/fs/write-atomic.ts"],"names":["unlink","writeFile","rename","writeFileAtomic","filePath","content","tempPath","Math","random","toString","slice","e"],"mappings":"AAAA,SAASA,MAAM,EAAEC,SAAS,QAAQ,cAAa;AAC/C,SAASC,MAAM,QAAQ,WAAU;AAEjC,OAAO,eAAeC,gBACpBC,QAAgB,EAChBC,OAAe;IAEf,MAAMC,WAAWF,WAAW,UAAUG,KAAKC,MAAM,GAAGC,QAAQ,CAAC,IAAIC,KAAK,CAAC;IACvE,IAAI;QACF,MAAMT,UAAUK,UAAUD,SAAS;QACnC,MAAMH,OAAOI,UAAUF;IACzB,EAAE,OAAOO,GAAG;QACV,IAAI;YACF,MAAMX,OAAOM;QACf,EAAE,OAAM;QACN,SAAS;QACX;QACA,MAAMK;IACR;AACF"}

View File

@ -0,0 +1,66 @@
import { pathToRegexp } from "next/dist/compiled/path-to-regexp";
import { NEXT_URL } from "../client/components/app-router-headers";
import { INTERCEPTION_ROUTE_MARKERS, extractInterceptionRouteInformation, isInterceptionRouteAppPath } from "../server/future/helpers/interception-routes";
// a function that converts normalised paths (e.g. /foo/[bar]/[baz]) to the format expected by pathToRegexp (e.g. /foo/:bar/:baz)
function toPathToRegexpPath(path) {
return path.replace(/\[\[?([^\]]+)\]\]?/g, (_, capture)=>{
// handle catch-all segments (e.g. /foo/bar/[...baz] or /foo/bar/[[...baz]])
if (capture.startsWith("...")) {
return `:${capture.slice(3)}*`;
}
return ":" + capture;
});
}
// for interception routes we don't have access to the dynamic segments from the
// referrer route so we mark them as noop for the app renderer so that it
// can retrieve them from the router state later on. This also allows us to
// compile the route properly with path-to-regexp, otherwise it will throw
function voidParamsBeforeInterceptionMarker(path) {
let newPath = [];
let foundInterceptionMarker = false;
for (const segment of path.split("/")){
if (INTERCEPTION_ROUTE_MARKERS.find((marker)=>segment.startsWith(marker))) {
foundInterceptionMarker = true;
}
if (segment.startsWith(":") && !foundInterceptionMarker) {
newPath.push("__NEXT_EMPTY_PARAM__");
} else {
newPath.push(segment);
}
}
return newPath.join("/");
}
export function generateInterceptionRoutesRewrites(appPaths, basePath = "") {
const rewrites = [];
for (const appPath of appPaths){
if (isInterceptionRouteAppPath(appPath)) {
const { interceptingRoute, interceptedRoute } = extractInterceptionRouteInformation(appPath);
const normalizedInterceptingRoute = `${interceptingRoute !== "/" ? toPathToRegexpPath(interceptingRoute) : ""}/(.*)?`;
const normalizedInterceptedRoute = toPathToRegexpPath(interceptedRoute);
const normalizedAppPath = voidParamsBeforeInterceptionMarker(toPathToRegexpPath(appPath));
// pathToRegexp returns a regex that matches the path, but we need to
// convert it to a string that can be used in a header value
// to the format that Next/the proxy expects
let interceptingRouteRegex = pathToRegexp(normalizedInterceptingRoute).toString().slice(2, -3);
rewrites.push({
source: `${basePath}${normalizedInterceptedRoute}`,
destination: `${basePath}${normalizedAppPath}`,
has: [
{
type: "header",
key: NEXT_URL,
value: interceptingRouteRegex
}
]
});
}
}
return rewrites;
}
export 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) === NEXT_URL;
}
//# sourceMappingURL=generate-interception-routes-rewrites.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../src/lib/generate-interception-routes-rewrites.ts"],"names":["pathToRegexp","NEXT_URL","INTERCEPTION_ROUTE_MARKERS","extractInterceptionRouteInformation","isInterceptionRouteAppPath","toPathToRegexpPath","path","replace","_","capture","startsWith","slice","voidParamsBeforeInterceptionMarker","newPath","foundInterceptionMarker","segment","split","find","marker","push","join","generateInterceptionRoutesRewrites","appPaths","basePath","rewrites","appPath","interceptingRoute","interceptedRoute","normalizedInterceptingRoute","normalizedInterceptedRoute","normalizedAppPath","interceptingRouteRegex","toString","source","destination","has","type","key","value","isInterceptionRouteRewrite","route"],"mappings":"AAAA,SAASA,YAAY,QAAQ,oCAAmC;AAChE,SAASC,QAAQ,QAAQ,0CAAyC;AAClE,SACEC,0BAA0B,EAC1BC,mCAAmC,EACnCC,0BAA0B,QACrB,+CAA8C;AAGrD,iIAAiI;AACjI,SAASC,mBAAmBC,IAAY;IACtC,OAAOA,KAAKC,OAAO,CAAC,uBAAuB,CAACC,GAAGC;QAC7C,4EAA4E;QAC5E,IAAIA,QAAQC,UAAU,CAAC,QAAQ;YAC7B,OAAO,CAAC,CAAC,EAAED,QAAQE,KAAK,CAAC,GAAG,CAAC,CAAC;QAChC;QACA,OAAO,MAAMF;IACf;AACF;AAEA,gFAAgF;AAChF,yEAAyE;AACzE,2EAA2E;AAC3E,0EAA0E;AAC1E,SAASG,mCAAmCN,IAAY;IACtD,IAAIO,UAAU,EAAE;IAEhB,IAAIC,0BAA0B;IAC9B,KAAK,MAAMC,WAAWT,KAAKU,KAAK,CAAC,KAAM;QACrC,IACEd,2BAA2Be,IAAI,CAAC,CAACC,SAAWH,QAAQL,UAAU,CAACQ,UAC/D;YACAJ,0BAA0B;QAC5B;QAEA,IAAIC,QAAQL,UAAU,CAAC,QAAQ,CAACI,yBAAyB;YACvDD,QAAQM,IAAI,CAAC;QACf,OAAO;YACLN,QAAQM,IAAI,CAACJ;QACf;IACF;IAEA,OAAOF,QAAQO,IAAI,CAAC;AACtB;AAEA,OAAO,SAASC,mCACdC,QAAkB,EAClBC,WAAW,EAAE;IAEb,MAAMC,WAAsB,EAAE;IAE9B,KAAK,MAAMC,WAAWH,SAAU;QAC9B,IAAIlB,2BAA2BqB,UAAU;YACvC,MAAM,EAAEC,iBAAiB,EAAEC,gBAAgB,EAAE,GAC3CxB,oCAAoCsB;YAEtC,MAAMG,8BAA8B,CAAC,EACnCF,sBAAsB,MAAMrB,mBAAmBqB,qBAAqB,GACrE,MAAM,CAAC;YAER,MAAMG,6BAA6BxB,mBAAmBsB;YACtD,MAAMG,oBAAoBlB,mCACxBP,mBAAmBoB;YAGrB,qEAAqE;YACrE,4DAA4D;YAC5D,4CAA4C;YAC5C,IAAIM,yBAAyB/B,aAAa4B,6BACvCI,QAAQ,GACRrB,KAAK,CAAC,GAAG,CAAC;YAEba,SAASL,IAAI,CAAC;gBACZc,QAAQ,CAAC,EAAEV,SAAS,EAAEM,2BAA2B,CAAC;gBAClDK,aAAa,CAAC,EAAEX,SAAS,EAAEO,kBAAkB,CAAC;gBAC9CK,KAAK;oBACH;wBACEC,MAAM;wBACNC,KAAKpC;wBACLqC,OAAOP;oBACT;iBACD;YACH;QACF;IACF;IAEA,OAAOP;AACT;AAEA,OAAO,SAASe,2BAA2BC,KAAc;QAEhDA,aAAAA;IADP,0HAA0H;IAC1H,OAAOA,EAAAA,aAAAA,MAAML,GAAG,sBAATK,cAAAA,UAAW,CAAC,EAAE,qBAAdA,YAAgBH,GAAG,MAAKpC;AACjC"}

18
node_modules/next/dist/esm/lib/get-files-in-dir.js generated vendored Normal file
View File

@ -0,0 +1,18 @@
import { join } from "path";
import fs from "fs/promises";
export async function getFilesInDir(path) {
const dir = await fs.opendir(path);
const results = [];
for await (const file of dir){
let resolvedFile = file;
if (file.isSymbolicLink()) {
resolvedFile = await fs.stat(join(path, file.name));
}
if (resolvedFile.isFile()) {
results.push(file.name);
}
}
return results;
}
//# sourceMappingURL=get-files-in-dir.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../src/lib/get-files-in-dir.ts"],"names":["join","fs","getFilesInDir","path","dir","opendir","results","file","resolvedFile","isSymbolicLink","stat","name","isFile","push"],"mappings":"AAAA,SAASA,IAAI,QAAQ,OAAM;AAC3B,OAAOC,QAAQ,cAAa;AAG5B,OAAO,eAAeC,cAAcC,IAAY;IAC9C,MAAMC,MAAM,MAAMH,GAAGI,OAAO,CAACF;IAC7B,MAAMG,UAAU,EAAE;IAElB,WAAW,MAAMC,QAAQH,IAAK;QAC5B,IAAII,eAA2CD;QAE/C,IAAIA,KAAKE,cAAc,IAAI;YACzBD,eAAe,MAAMP,GAAGS,IAAI,CAACV,KAAKG,MAAMI,KAAKI,IAAI;QACnD;QAEA,IAAIH,aAAaI,MAAM,IAAI;YACzBN,QAAQO,IAAI,CAACN,KAAKI,IAAI;QACxB;IACF;IAEA,OAAOL;AACT"}

50
node_modules/next/dist/esm/lib/get-package-version.js generated vendored Normal file
View File

@ -0,0 +1,50 @@
import { promises as fs } from "fs";
import findUp from "next/dist/compiled/find-up";
import JSON5 from "next/dist/compiled/json5";
import * as path from "path";
let cachedDeps;
export function getDependencies({ cwd }) {
if (cachedDeps) {
return cachedDeps;
}
return cachedDeps = (async ()=>{
const configurationPath = await findUp("package.json", {
cwd
});
if (!configurationPath) {
return {
dependencies: {},
devDependencies: {}
};
}
const content = await fs.readFile(configurationPath, "utf-8");
const packageJson = JSON5.parse(content);
const { dependencies = {}, devDependencies = {} } = packageJson || {};
return {
dependencies,
devDependencies
};
})();
}
export 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.readFile(targetPath, "utf-8");
return JSON5.parse(targetContent).version ?? null;
} catch {
return null;
}
}
//# sourceMappingURL=get-package-version.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../src/lib/get-package-version.ts"],"names":["promises","fs","findUp","JSON5","path","cachedDeps","getDependencies","cwd","configurationPath","dependencies","devDependencies","content","readFile","packageJson","parse","getPackageVersion","name","cwd2","endsWith","posix","sep","win32","targetPath","require","resolve","paths","targetContent","version"],"mappings":"AAAA,SAASA,YAAYC,EAAE,QAAQ,KAAI;AACnC,OAAOC,YAAY,6BAA4B;AAC/C,OAAOC,WAAW,2BAA0B;AAC5C,YAAYC,UAAU,OAAM;AAO5B,IAAIC;AAEJ,OAAO,SAASC,gBAAgB,EAC9BC,GAAG,EAGJ;IACC,IAAIF,YAAY;QACd,OAAOA;IACT;IAEA,OAAQA,aAAa,AAAC,CAAA;QACpB,MAAMG,oBAAwC,MAAMN,OAAO,gBAAgB;YACzEK;QACF;QACA,IAAI,CAACC,mBAAmB;YACtB,OAAO;gBAAEC,cAAc,CAAC;gBAAGC,iBAAiB,CAAC;YAAE;QACjD;QAEA,MAAMC,UAAU,MAAMV,GAAGW,QAAQ,CAACJ,mBAAmB;QACrD,MAAMK,cAAmBV,MAAMW,KAAK,CAACH;QAErC,MAAM,EAAEF,eAAe,CAAC,CAAC,EAAEC,kBAAkB,CAAC,CAAC,EAAE,GAAGG,eAAe,CAAC;QACpE,OAAO;YAAEJ;YAAcC;QAAgB;IACzC,CAAA;AACF;AAEA,OAAO,eAAeK,kBAAkB,EACtCR,GAAG,EACHS,IAAI,EAIL;IACC,MAAM,EAAEP,YAAY,EAAEC,eAAe,EAAE,GAAG,MAAMJ,gBAAgB;QAAEC;IAAI;IACtE,IAAI,CAAEE,CAAAA,YAAY,CAACO,KAAK,IAAIN,eAAe,CAACM,KAAK,AAAD,GAAI;QAClD,OAAO;IACT;IAEA,MAAMC,OACJV,IAAIW,QAAQ,CAACd,KAAKe,KAAK,CAACC,GAAG,KAAKb,IAAIW,QAAQ,CAACd,KAAKiB,KAAK,CAACD,GAAG,IACvDb,MACA,CAAC,EAAEA,IAAI,CAAC,CAAC;IAEf,IAAI;QACF,MAAMe,aAAaC,QAAQC,OAAO,CAAC,CAAC,EAAER,KAAK,aAAa,CAAC,EAAE;YACzDS,OAAO;gBAACR;aAAK;QACf;QACA,MAAMS,gBAAgB,MAAMzB,GAAGW,QAAQ,CAACU,YAAY;QACpD,OAAOnB,MAAMW,KAAK,CAACY,eAAeC,OAAO,IAAI;IAC/C,EAAE,OAAM;QACN,OAAO;IACT;AACF"}

36
node_modules/next/dist/esm/lib/get-project-dir.js generated vendored Normal file
View File

@ -0,0 +1,36 @@
import path from "path";
import { error, warn } from "../build/output/log";
import { detectTypo } from "./detect-typo";
import { realpathSync } from "./realpath";
export function getProjectDir(dir) {
try {
const resolvedDir = path.resolve(dir || ".");
const realDir = realpathSync(resolvedDir);
if (resolvedDir !== realDir && resolvedDir.toLowerCase() === realDir.toLowerCase()) {
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") {
if (typeof dir === "string") {
const detectedTypo = detectTypo(dir, [
"build",
"dev",
"info",
"lint",
"start",
"telemetry"
]);
if (detectedTypo) {
error(`"next ${dir}" does not exist. Did you mean "next ${detectedTypo}"?`);
process.exit(1);
}
}
error(`Invalid project directory provided, no such directory: ${path.resolve(dir || ".")}`);
process.exit(1);
}
throw err;
}
}
//# sourceMappingURL=get-project-dir.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../src/lib/get-project-dir.ts"],"names":["path","error","warn","detectTypo","realpathSync","getProjectDir","dir","resolvedDir","resolve","realDir","toLowerCase","err","code","detectedTypo","process","exit"],"mappings":"AAAA,OAAOA,UAAU,OAAM;AACvB,SAASC,KAAK,EAAEC,IAAI,QAAQ,sBAAqB;AACjD,SAASC,UAAU,QAAQ,gBAAe;AAC1C,SAASC,YAAY,QAAQ,aAAY;AAEzC,OAAO,SAASC,cAAcC,GAAY;IACxC,IAAI;QACF,MAAMC,cAAcP,KAAKQ,OAAO,CAACF,OAAO;QACxC,MAAMG,UAAUL,aAAaG;QAE7B,IACEA,gBAAgBE,WAChBF,YAAYG,WAAW,OAAOD,QAAQC,WAAW,IACjD;YACAR,KACE,CAAC,kDAAkD,EAAEK,YAAY,aAAa,EAAEE,QAAQ,gFAAgF,CAAC;QAE7K;QAEA,OAAOA;IACT,EAAE,OAAOE,KAAU;QACjB,IAAIA,IAAIC,IAAI,KAAK,UAAU;YACzB,IAAI,OAAON,QAAQ,UAAU;gBAC3B,MAAMO,eAAeV,WAAWG,KAAK;oBACnC;oBACA;oBACA;oBACA;oBACA;oBACA;iBACD;gBAED,IAAIO,cAAc;oBAChBZ,MACE,CAAC,MAAM,EAAEK,IAAI,qCAAqC,EAAEO,aAAa,EAAE,CAAC;oBAEtEC,QAAQC,IAAI,CAAC;gBACf;YACF;YAEAd,MACE,CAAC,uDAAuD,EAAED,KAAKQ,OAAO,CACpEF,OAAO,KACP,CAAC;YAELQ,QAAQC,IAAI,CAAC;QACf;QACA,MAAMJ;IACR;AACF"}

View File

@ -0,0 +1,36 @@
import { existsSync, promises as fs } from "fs";
import { resolveFrom } from "./resolve-from";
import { dirname, join, relative } from "path";
export async function hasNecessaryDependencies(baseDir, requiredPackages) {
let resolutions = new Map();
const missingPackages = [];
await Promise.all(requiredPackages.map(async (p)=>{
try {
const pkgPath = await fs.realpath(resolveFrom(baseDir, `${p.pkg}/package.json`));
const pkgDir = dirname(pkgPath);
if (p.exportsRestrict) {
const fileNameToVerify = relative(p.pkg, p.file);
if (fileNameToVerify) {
const fileToVerify = join(pkgDir, fileNameToVerify);
if (existsSync(fileToVerify)) {
resolutions.set(p.pkg, fileToVerify);
} else {
return missingPackages.push(p);
}
} else {
resolutions.set(p.pkg, pkgPath);
}
} else {
resolutions.set(p.pkg, resolveFrom(baseDir, p.file));
}
} catch (_) {
return missingPackages.push(p);
}
}));
return {
resolved: resolutions,
missing: missingPackages
};
}
//# sourceMappingURL=has-necessary-dependencies.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../src/lib/has-necessary-dependencies.ts"],"names":["existsSync","promises","fs","resolveFrom","dirname","join","relative","hasNecessaryDependencies","baseDir","requiredPackages","resolutions","Map","missingPackages","Promise","all","map","p","pkgPath","realpath","pkg","pkgDir","exportsRestrict","fileNameToVerify","file","fileToVerify","set","push","_","resolved","missing"],"mappings":"AAAA,SAASA,UAAU,EAAEC,YAAYC,EAAE,QAAQ,KAAI;AAC/C,SAASC,WAAW,QAAQ,iBAAgB;AAC5C,SAASC,OAAO,EAAEC,IAAI,EAAEC,QAAQ,QAAQ,OAAM;AAa9C,OAAO,eAAeC,yBACpBC,OAAe,EACfC,gBAAqC;IAErC,IAAIC,cAAc,IAAIC;IACtB,MAAMC,kBAAuC,EAAE;IAE/C,MAAMC,QAAQC,GAAG,CACfL,iBAAiBM,GAAG,CAAC,OAAOC;QAC1B,IAAI;YACF,MAAMC,UAAU,MAAMf,GAAGgB,QAAQ,CAC/Bf,YAAYK,SAAS,CAAC,EAAEQ,EAAEG,GAAG,CAAC,aAAa,CAAC;YAE9C,MAAMC,SAAShB,QAAQa;YAEvB,IAAID,EAAEK,eAAe,EAAE;gBACrB,MAAMC,mBAAmBhB,SAASU,EAAEG,GAAG,EAAEH,EAAEO,IAAI;gBAC/C,IAAID,kBAAkB;oBACpB,MAAME,eAAenB,KAAKe,QAAQE;oBAClC,IAAItB,WAAWwB,eAAe;wBAC5Bd,YAAYe,GAAG,CAACT,EAAEG,GAAG,EAAEK;oBACzB,OAAO;wBACL,OAAOZ,gBAAgBc,IAAI,CAACV;oBAC9B;gBACF,OAAO;oBACLN,YAAYe,GAAG,CAACT,EAAEG,GAAG,EAAEF;gBACzB;YACF,OAAO;gBACLP,YAAYe,GAAG,CAACT,EAAEG,GAAG,EAAEhB,YAAYK,SAASQ,EAAEO,IAAI;YACpD;QACF,EAAE,OAAOI,GAAG;YACV,OAAOf,gBAAgBc,IAAI,CAACV;QAC9B;IACF;IAGF,OAAO;QACLY,UAAUlB;QACVmB,SAASjB;IACX;AACF"}

View File

@ -0,0 +1,49 @@
import os from "os";
import path from "path";
import fs from "fs";
// get platform specific cache directory adapted from playwright's handling
// https://github.com/microsoft/playwright/blob/7d924470d397975a74a19184c136b3573a974e13/packages/playwright-core/src/utils/registry.ts#L141
export function getCacheDirectory(fileDirectory, envPath) {
let result;
if (envPath) {
result = envPath;
} else {
let systemCacheDirectory;
if (process.platform === "linux") {
systemCacheDirectory = process.env.XDG_CACHE_HOME || path.join(os.homedir(), ".cache");
} else if (process.platform === "darwin") {
systemCacheDirectory = path.join(os.homedir(), "Library", "Caches");
} else if (process.platform === "win32") {
systemCacheDirectory = process.env.LOCALAPPDATA || path.join(os.homedir(), "AppData", "Local");
} else {
/// Attempt to use generic tmp location for un-handled platform
if (!systemCacheDirectory) {
for (const dir of [
path.join(os.homedir(), ".cache"),
path.join(os.tmpdir())
]){
if (fs.existsSync(dir)) {
systemCacheDirectory = dir;
break;
}
}
}
if (!systemCacheDirectory) {
console.error(new Error("Unsupported platform: " + process.platform));
process.exit(0);
}
}
result = path.join(systemCacheDirectory, fileDirectory);
}
if (!path.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.resolve(process.env["INIT_CWD"] || process.cwd(), result);
}
return result;
}
//# sourceMappingURL=get-cache-directory.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/lib/helpers/get-cache-directory.ts"],"names":["os","path","fs","getCacheDirectory","fileDirectory","envPath","result","systemCacheDirectory","process","platform","env","XDG_CACHE_HOME","join","homedir","LOCALAPPDATA","dir","tmpdir","existsSync","console","error","Error","exit","isAbsolute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,CAAC,WAAW,IAAIF,QAAQgB,GAAG,IAAIlB;IAClE;IACA,OAAOA;AACT"}

View File

@ -0,0 +1,19 @@
import { execSync } from "child_process";
import { getPkgManager } from "./get-pkg-manager";
export function getNpxCommand(baseDir) {
const pkgManager = getPkgManager(baseDir);
let command = "npx";
if (pkgManager === "pnpm") {
command = "pnpm dlx";
} else if (pkgManager === "yarn") {
try {
execSync("yarn dlx --help", {
stdio: "ignore"
});
command = "yarn dlx";
} catch {}
}
return command;
}
//# sourceMappingURL=get-npx-command.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/lib/helpers/get-npx-command.ts"],"names":["execSync","getPkgManager","getNpxCommand","baseDir","pkgManager","command","stdio"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,gBAAe;AACxC,SAASC,aAAa,QAAQ,oBAAmB;AAEjD,OAAO,SAASC,cAAcC,OAAe;IAC3C,MAAMC,aAAaH,cAAcE;IACjC,IAAIE,UAAU;IACd,IAAID,eAAe,QAAQ;QACzBC,UAAU;IACZ,OAAO,IAAID,eAAe,QAAQ;QAChC,IAAI;YACFJ,SAAS,mBAAmB;gBAAEM,OAAO;YAAS;YAC9CD,UAAU;QACZ,EAAE,OAAM,CAAC;IACX;IAEA,OAAOA;AACT"}

35
node_modules/next/dist/esm/lib/helpers/get-online.js generated vendored Normal file
View File

@ -0,0 +1,35 @@
import { execSync } from "child_process";
import dns from "dns/promises";
function getProxy() {
if (process.env.https_proxy) {
return process.env.https_proxy;
}
try {
const httpsProxy = execSync("npm config get https-proxy", {
encoding: "utf8"
}).trim();
return httpsProxy !== "null" ? httpsProxy : undefined;
} catch (e) {
return;
}
}
export async function getOnline() {
try {
await dns.lookup("registry.yarnpkg.com");
return true;
} catch {
const proxy = getProxy();
if (!proxy) {
return false;
}
try {
const { hostname } = new URL(proxy);
await dns.lookup(hostname);
return true;
} catch {
return false;
}
}
}
//# sourceMappingURL=get-online.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/lib/helpers/get-online.ts"],"names":["execSync","dns","getProxy","process","env","https_proxy","httpsProxy","encoding","trim","undefined","e","getOnline","lookup","proxy","hostname","URL"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,gBAAe;AACxC,OAAOC,SAAS,eAAc;AAE9B,SAASC;IACP,IAAIC,QAAQC,GAAG,CAACC,WAAW,EAAE;QAC3B,OAAOF,QAAQC,GAAG,CAACC,WAAW;IAChC;IAEA,IAAI;QACF,MAAMC,aAAaN,SAAS,8BAA8B;YACxDO,UAAU;QACZ,GAAGC,IAAI;QACP,OAAOF,eAAe,SAASA,aAAaG;IAC9C,EAAE,OAAOC,GAAG;QACV;IACF;AACF;AAEA,OAAO,eAAeC;IACpB,IAAI;QACF,MAAMV,IAAIW,MAAM,CAAC;QACjB,OAAO;IACT,EAAE,OAAM;QACN,MAAMC,QAAQX;QACd,IAAI,CAACW,OAAO;YACV,OAAO;QACT;QAEA,IAAI;YACF,MAAM,EAAEC,QAAQ,EAAE,GAAG,IAAIC,IAAIF;YAC7B,MAAMZ,IAAIW,MAAM,CAACE;YACjB,OAAO;QACT,EAAE,OAAM;YACN,OAAO;QACT;IACF;AACF"}

View File

@ -0,0 +1,48 @@
import fs from "fs";
import path from "path";
import { execSync } from "child_process";
export 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.existsSync(path.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 {
execSync("yarn --version", {
stdio: "ignore"
});
return "yarn";
} catch {
execSync("pnpm --version", {
stdio: "ignore"
});
return "pnpm";
}
} catch {
return "npm";
}
}
//# sourceMappingURL=get-pkg-manager.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/lib/helpers/get-pkg-manager.ts"],"names":["fs","path","execSync","getPkgManager","baseDir","lockFile","packageManager","existsSync","join","userAgent","process","env","npm_config_user_agent","startsWith","stdio"],"mappings":"AAAA,OAAOA,QAAQ,KAAI;AACnB,OAAOC,UAAU,OAAM;AACvB,SAASC,QAAQ,QAAQ,gBAAe;AAIxC,OAAO,SAASC,cAAcC,OAAe;IAC3C,IAAI;QACF,KAAK,MAAM,EAAEC,QAAQ,EAAEC,cAAc,EAAE,IAAI;YACzC;gBAAED,UAAU;gBAAaC,gBAAgB;YAAO;YAChD;gBAAED,UAAU;gBAAkBC,gBAAgB;YAAO;YACrD;gBAAED,UAAU;gBAAqBC,gBAAgB;YAAM;SACxD,CAAE;YACD,IAAIN,GAAGO,UAAU,CAACN,KAAKO,IAAI,CAACJ,SAASC,YAAY;gBAC/C,OAAOC;YACT;QACF;QACA,MAAMG,YAAYC,QAAQC,GAAG,CAACC,qBAAqB;QACnD,IAAIH,WAAW;YACb,IAAIA,UAAUI,UAAU,CAAC,SAAS;gBAChC,OAAO;YACT,OAAO,IAAIJ,UAAUI,UAAU,CAAC,SAAS;gBACvC,OAAO;YACT;QACF;QACA,IAAI;YACFX,SAAS,kBAAkB;gBAAEY,OAAO;YAAS;YAC7C,OAAO;QACT,EAAE,OAAM;YACNZ,SAAS,kBAAkB;gBAAEY,OAAO;YAAS;YAC7C,OAAO;QACT;IACF,EAAE,OAAM;QACN,OAAO;IACT;AACF"}

26
node_modules/next/dist/esm/lib/helpers/get-registry.js generated vendored Normal file
View File

@ -0,0 +1,26 @@
import { execSync } from "child_process";
import { getPkgManager } from "./get-pkg-manager";
import { getNodeOptionsWithoutInspect } from "../../server/lib/utils";
/**
* Returns the package registry using the user's package manager.
* The URL will have a trailing slash.
* @default https://registry.npmjs.org/
*/ export function getRegistry(baseDir = process.cwd()) {
let registry = `https://registry.npmjs.org/`;
try {
const pkgManager = getPkgManager(baseDir);
const output = execSync(`${pkgManager} config get registry`, {
env: {
...process.env,
NODE_OPTIONS: getNodeOptionsWithoutInspect()
}
}).toString().trim();
if (output.startsWith("http")) {
registry = output.endsWith("/") ? output : `${output}/`;
}
} finally{
return registry;
}
}
//# sourceMappingURL=get-registry.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/lib/helpers/get-registry.ts"],"names":["execSync","getPkgManager","getNodeOptionsWithoutInspect","getRegistry","baseDir","process","cwd","registry","pkgManager","output","env","NODE_OPTIONS","toString","trim","startsWith","endsWith"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,gBAAe;AACxC,SAASC,aAAa,QAAQ,oBAAmB;AACjD,SAASC,4BAA4B,QAAQ,yBAAwB;AAErE;;;;CAIC,GACD,OAAO,SAASC,YAAYC,UAAkBC,QAAQC,GAAG,EAAE;IACzD,IAAIC,WAAW,CAAC,2BAA2B,CAAC;IAC5C,IAAI;QACF,MAAMC,aAAaP,cAAcG;QACjC,MAAMK,SAAST,SAAS,CAAC,EAAEQ,WAAW,oBAAoB,CAAC,EAAE;YAC3DE,KAAK;gBACH,GAAGL,QAAQK,GAAG;gBACdC,cAAcT;YAChB;QACF,GACGU,QAAQ,GACRC,IAAI;QAEP,IAAIJ,OAAOK,UAAU,CAAC,SAAS;YAC7BP,WAAWE,OAAOM,QAAQ,CAAC,OAAON,SAAS,CAAC,EAAEA,OAAO,CAAC,CAAC;QACzD;IACF,SAAU;QACR,OAAOF;IACT;AACF"}

View File

@ -0,0 +1,90 @@
/** https://fetch.spec.whatwg.org/#port-blocking */ export 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"
};
export function isPortIsReserved(port) {
return port in KNOWN_RESERVED_PORTS;
}
export 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

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/lib/helpers/get-reserved-port.ts"],"names":["KNOWN_RESERVED_PORTS","isPortIsReserved","port","getReservedPortExplanation"],"mappings":"AAAA,iDAAiD,GACjD,OAAO,MAAMA,uBAAuB;IAClC,GAAG;IACH,GAAG;IACH,GAAG;IACH,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,OAAO;AACT,EAAU;AAIV,OAAO,SAASC,iBAAiBC,IAAY;IAC3C,OAAOA,QAAQF;AACjB;AAEA,OAAO,SAASG,2BAA2BD,IAAkB;IAC3D,OACE,CAAC,WAAW,EAAEA,KAAK,kBAAkB,EAAEF,oBAAoB,CAACE,KAAK,CAAC,EAAE,CAAC,GACrE;AAEJ"}

94
node_modules/next/dist/esm/lib/helpers/install.js generated vendored Normal file
View File

@ -0,0 +1,94 @@
import { yellow } from "../picocolors";
import spawn from "next/dist/compiled/cross-spawn";
/**
* Spawn a package manager installation with either Yarn or NPM.
*
* @returns A Promise that resolves once the installation is finished.
*/ export function install(root, dependencies, { packageManager, isOnline, devDependencies }) {
/**
* (p)npm-specific command-line flags.
*/ const npmFlags = [];
/**
* Yarn-specific command-line flags.
*/ const yarnFlags = [];
/**
* Return a Promise that resolves once the installation is finished.
*/ return new Promise((resolve, reject)=>{
let args;
let command = packageManager;
const useYarn = packageManager === "yarn";
if (dependencies && dependencies.length) {
/**
* If there are dependencies, run a variation of `{packageManager} add`.
*/ if (useYarn) {
/**
* Call `yarn add --exact (--offline)? (-D)? ...`.
*/ args = [
"add",
"--exact"
];
if (!isOnline) args.push("--offline");
args.push("--cwd", root);
if (devDependencies) args.push("--dev");
args.push(...dependencies);
} else {
/**
* Call `(p)npm install [--save|--save-dev] ...`.
*/ args = [
"install",
"--save-exact"
];
args.push(devDependencies ? "--save-dev" : "--save");
args.push(...dependencies);
}
} else {
/**
* If there are no dependencies, run a variation of `{packageManager}
* install`.
*/ args = [
"install"
];
if (!isOnline) {
console.log(yellow("You appear to be offline."));
if (useYarn) {
console.log(yellow("Falling back to the local Yarn cache."));
console.log();
args.push("--offline");
} else {
console.log();
}
}
}
/**
* Add any package manager-specific flags.
*/ if (useYarn) {
args.push(...yarnFlags);
} else {
args.push(...npmFlags);
}
/**
* Spawn the installation process.
*/ const child = spawn(command, args, {
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: `${command} ${args.join(" ")}`
});
return;
}
resolve();
});
});
}
//# sourceMappingURL=install.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/lib/helpers/install.ts"],"names":["yellow","spawn","install","root","dependencies","packageManager","isOnline","devDependencies","npmFlags","yarnFlags","Promise","resolve","reject","args","command","useYarn","length","push","console","log","child","stdio","env","process","ADBLOCK","NODE_ENV","DISABLE_OPENCOLLECTIVE","on","code","join"],"mappings":"AAAA,SAASA,MAAM,QAAQ,gBAAe;AACtC,OAAOC,WAAW,iCAAgC;AAmBlD;;;;CAIC,GACD,OAAO,SAASC,QACdC,IAAY,EACZC,YAA6B,EAC7B,EAAEC,cAAc,EAAEC,QAAQ,EAAEC,eAAe,EAAe;IAE1D;;GAEC,GACD,MAAMC,WAAqB,EAAE;IAC7B;;GAEC,GACD,MAAMC,YAAsB,EAAE;IAC9B;;GAEC,GACD,OAAO,IAAIC,QAAQ,CAAC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

@ -0,0 +1,5 @@
var _module_parent;
import * as Log from "../build/output/log";
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

@ -0,0 +1 @@
{"version":3,"sources":["../../src/lib/import-next-warning.ts"],"names":["module","Log","warn","parent","filename"],"mappings":"IAGyDA;AAHzD,YAAYC,SAAS,sBAAqB;AAE1CA,IAAIC,IAAI,CACN,CAAC,oDAAoD,GAAEF,iBAAAA,OAAOG,MAAM,qBAAbH,eAAeI,QAAQ,CAAC,kEAAkE,CAAC"}

25
node_modules/next/dist/esm/lib/install-dependencies.js generated vendored Normal file
View File

@ -0,0 +1,25 @@
import { cyan } from "./picocolors";
import path from "path";
import { getPkgManager } from "./helpers/get-pkg-manager";
import { install } from "./helpers/install";
import { getOnline } from "./helpers/get-online";
export async function installDependencies(baseDir, deps, dev = false) {
const packageManager = getPkgManager(baseDir);
const isOnline = await getOnline();
if (deps.length) {
console.log();
console.log(`Installing ${dev ? "devDependencies" : "dependencies"} (${packageManager}):`);
for (const dep of deps){
console.log(`- ${cyan(dep.pkg)}`);
}
console.log();
await install(path.resolve(baseDir), deps.map((dep)=>dep.pkg), {
devDependencies: dev,
isOnline,
packageManager
});
console.log();
}
}
//# sourceMappingURL=install-dependencies.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../src/lib/install-dependencies.ts"],"names":["cyan","path","getPkgManager","install","getOnline","installDependencies","baseDir","deps","dev","packageManager","isOnline","length","console","log","dep","pkg","resolve","map","devDependencies"],"mappings":"AAAA,SAASA,IAAI,QAAQ,eAAc;AACnC,OAAOC,UAAU,OAAM;AAGvB,SAASC,aAAa,QAAQ,4BAA2B;AACzD,SAASC,OAAO,QAAQ,oBAAmB;AAC3C,SAASC,SAAS,QAAQ,uBAAsB;AAMhD,OAAO,eAAeC,oBACpBC,OAAe,EACfC,IAAS,EACTC,MAAe,KAAK;IAEpB,MAAMC,iBAAiBP,cAAcI;IACrC,MAAMI,WAAW,MAAMN;IAEvB,IAAIG,KAAKI,MAAM,EAAE;QACfC,QAAQC,GAAG;QACXD,QAAQC,GAAG,CACT,CAAC,WAAW,EACVL,MAAM,oBAAoB,eAC3B,EAAE,EAAEC,eAAe,EAAE,CAAC;QAEzB,KAAK,MAAMK,OAAOP,KAAM;YACtBK,QAAQC,GAAG,CAAC,CAAC,EAAE,EAAEb,KAAKc,IAAIC,GAAG,EAAE,CAAC;QAClC;QACAH,QAAQC,GAAG;QAEX,MAAMV,QACJF,KAAKe,OAAO,CAACV,UACbC,KAAKU,GAAG,CAAC,CAACH,MAA2BA,IAAIC,GAAG,GAC5C;YAAEG,iBAAiBV;YAAKE;YAAUD;QAAe;QAEnDG,QAAQC,GAAG;IACb;AACF"}

5
node_modules/next/dist/esm/lib/interop-default.js generated vendored Normal file
View File

@ -0,0 +1,5 @@
export function interopDefault(mod) {
return mod.default || mod;
}
//# sourceMappingURL=interop-default.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../src/lib/interop-default.ts"],"names":["interopDefault","mod","default"],"mappings":"AAAA,OAAO,SAASA,eAAeC,GAAQ;IACrC,OAAOA,IAAIC,OAAO,IAAID;AACxB"}

5
node_modules/next/dist/esm/lib/is-api-route.js generated vendored Normal file
View File

@ -0,0 +1,5 @@
export function isAPIRoute(value) {
return value === "/api" || Boolean(value == null ? void 0 : value.startsWith("/api/"));
}
//# sourceMappingURL=is-api-route.js.map

1
node_modules/next/dist/esm/lib/is-api-route.js.map generated vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"sources":["../../src/lib/is-api-route.ts"],"names":["isAPIRoute","value","Boolean","startsWith"],"mappings":"AAAA,OAAO,SAASA,WAAWC,KAAc;IACvC,OAAOA,UAAU,UAAUC,QAAQD,yBAAAA,MAAOE,UAAU,CAAC;AACvD"}

5
node_modules/next/dist/esm/lib/is-app-page-route.js generated vendored Normal file
View File

@ -0,0 +1,5 @@
export function isAppPageRoute(route) {
return route.endsWith("/page");
}
//# sourceMappingURL=is-app-page-route.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../src/lib/is-app-page-route.ts"],"names":["isAppPageRoute","route","endsWith"],"mappings":"AAAA,OAAO,SAASA,eAAeC,KAAa;IAC1C,OAAOA,MAAMC,QAAQ,CAAC;AACxB"}

5
node_modules/next/dist/esm/lib/is-app-route-route.js generated vendored Normal file
View File

@ -0,0 +1,5 @@
export function isAppRouteRoute(route) {
return route.endsWith("/route");
}
//# sourceMappingURL=is-app-route-route.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../src/lib/is-app-route-route.ts"],"names":["isAppRouteRoute","route","endsWith"],"mappings":"AAAA,OAAO,SAASA,gBAAgBC,KAAa;IAC3C,OAAOA,MAAMC,QAAQ,CAAC;AACxB"}

6
node_modules/next/dist/esm/lib/is-edge-runtime.js generated vendored Normal file
View File

@ -0,0 +1,6 @@
import { SERVER_RUNTIME } from "./constants";
export function isEdgeRuntime(value) {
return value === SERVER_RUNTIME.experimentalEdge || value === SERVER_RUNTIME.edge;
}
//# sourceMappingURL=is-edge-runtime.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../src/lib/is-edge-runtime.ts"],"names":["SERVER_RUNTIME","isEdgeRuntime","value","experimentalEdge","edge"],"mappings":"AACA,SAASA,cAAc,QAAQ,cAAa;AAE5C,OAAO,SAASC,cAAcC,KAAc;IAC1C,OACEA,UAAUF,eAAeG,gBAAgB,IAAID,UAAUF,eAAeI,IAAI;AAE9E"}

22
node_modules/next/dist/esm/lib/is-error.js generated vendored Normal file
View File

@ -0,0 +1,22 @@
import { isPlainObject } from "../shared/lib/is-plain-object";
export default function isError(err) {
return typeof err === "object" && err !== null && "name" in err && "message" in err;
}
export 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 new Error("An undefined error was thrown, " + "see here for more info: https://nextjs.org/docs/messages/threw-undefined");
}
if (err === null) {
return new Error("A null error was thrown, " + "see here for more info: https://nextjs.org/docs/messages/threw-undefined");
}
}
return new Error(isPlainObject(err) ? JSON.stringify(err) : err + "");
}
//# sourceMappingURL=is-error.js.map

1
node_modules/next/dist/esm/lib/is-error.js.map generated vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"sources":["../../src/lib/is-error.ts"],"names":["isPlainObject","isError","err","getProperError","process","env","NODE_ENV","Error","JSON","stringify"],"mappings":"AAAA,SAASA,aAAa,QAAQ,gCAA+B;AAW7D,eAAe,SAASC,QAAQC,GAAY;IAC1C,OACE,OAAOA,QAAQ,YAAYA,QAAQ,QAAQ,UAAUA,OAAO,aAAaA;AAE7E;AAEA,OAAO,SAASC,eAAeD,GAAY;IACzC,IAAID,QAAQC,MAAM;QAChB,OAAOA;IACT;IAEA,IAAIE,QAAQC,GAAG,CAACC,QAAQ,KAAK,eAAe;QAC1C,wDAAwD;QACxD,2BAA2B;QAC3B,IAAI,OAAOJ,QAAQ,aAAa;YAC9B,OAAO,IAAIK,MACT,oCACE;QAEN;QAEA,IAAIL,QAAQ,MAAM;YAChB,OAAO,IAAIK,MACT,8BACE;QAEN;IACF;IAEA,OAAO,IAAIA,MAAMP,cAAcE,OAAOM,KAAKC,SAAS,CAACP,OAAOA,MAAM;AACpE"}

View File

@ -0,0 +1,14 @@
export function isInternalComponent(pathname) {
switch(pathname){
case "next/dist/pages/_app":
case "next/dist/pages/_document":
return true;
default:
return false;
}
}
export function isNonRoutePagesPage(pathname) {
return pathname === "/_app" || pathname === "/_document";
}
//# sourceMappingURL=is-internal-component.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../src/lib/is-internal-component.ts"],"names":["isInternalComponent","pathname","isNonRoutePagesPage"],"mappings":"AAAA,OAAO,SAASA,oBAAoBC,QAAgB;IAClD,OAAQA;QACN,KAAK;QACL,KAAK;YACH,OAAO;QACT;YACE,OAAO;IACX;AACF;AAEA,OAAO,SAASC,oBAAoBD,QAAgB;IAClD,OAAOA,aAAa,WAAWA,aAAa;AAC9C"}

View File

@ -0,0 +1,60 @@
import { isPlainObject, getObjectClassLabel } from "../shared/lib/is-plain-object";
const regexpPlainIdentifier = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
export 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}`);
}
}
export function isSerializableProps(page, method, input) {
if (!isPlainObject(input)) {
throw new SerializableError(page, method, "", `Props must be returned as a plain object from ${method}: \`{ props: { ... } }\` (received: \`${getObjectClassLabel(input)}\`).`);
}
function visit(visited, value, path) {
if (visited.has(value)) {
throw new SerializableError(page, method, path, `Circular references cannot be expressed in JSON (references: \`${visited.get(value) || "(self)"}\`).`);
}
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 new SerializableError(page, method, path, "`undefined` cannot be serialized as JSON. Please use `null` or omit this value.");
}
if (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 new SerializableError(page, method, path, `invariant: Unknown error encountered in Object.`);
}
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 new SerializableError(page, method, path, `invariant: Unknown error encountered in Array.`);
}
// None of these can be expressed as JSON:
// const type: "bigint" | "symbol" | "object" | "function"
throw 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.");
}
return isSerializable(new Map(), input, "");
}
//# sourceMappingURL=is-serializable-props.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../src/lib/is-serializable-props.ts"],"names":["isPlainObject","getObjectClassLabel","regexpPlainIdentifier","SerializableError","Error","constructor","page","method","path","message","isSerializableProps","input","visit","visited","value","has","get","set","isSerializable","refs","type","Object","entries","every","key","nestedValue","nextPath","test","JSON","stringify","newRefs","Map","Array","isArray","index","prototype","toString","call"],"mappings":"AAAA,SACEA,aAAa,EACbC,mBAAmB,QACd,gCAA+B;AAEtC,MAAMC,wBAAwB;AAE9B,OAAO,MAAMC,0BAA0BC;IACrCC,YAAYC,IAAY,EAAEC,MAAc,EAAEC,IAAY,EAAEC,OAAe,CAAE;QACvE,KAAK,CACHD,OACI,CAAC,oBAAoB,EAAEA,KAAK,mBAAmB,EAAED,OAAO,OAAO,EAAED,KAAK,YAAY,EAAEG,QAAQ,CAAC,GAC7F,CAAC,wCAAwC,EAAEF,OAAO,OAAO,EAAED,KAAK,YAAY,EAAEG,QAAQ,CAAC;IAE/F;AACF;AAEA,OAAO,SAASC,oBACdJ,IAAY,EACZC,MAAc,EACdI,KAAU;IAEV,IAAI,CAACX,cAAcW,QAAQ;QACzB,MAAM,IAAIR,kBACRG,MACAC,QACA,IACA,CAAC,8CAA8C,EAAEA,OAAO,sCAAsC,EAAEN,oBAC9FU,OACA,IAAI,CAAC;IAEX;IAEA,SAASC,MAAMC,OAAyB,EAAEC,KAAU,EAAEN,IAAY;QAChE,IAAIK,QAAQE,GAAG,CAACD,QAAQ;YACtB,MAAM,IAAIX,kBACRG,MACAC,QACAC,MACA,CAAC,+DAA+D,EAC9DK,QAAQG,GAAG,CAACF,UAAU,SACvB,IAAI,CAAC;QAEV;QAEA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IL,kBACRG,MACAC,QACAC,MACA,MACEY,OACA,MACCA,CAAAA,SAAS,WACN,CAAC,GAAG,EAAEC,OAAOc,SAAS,CAACC,QAAQ,CAACC,IAAI,CAACvB,OAAO,EAAE,CAAC,GAC/C,EAAC,IACL;IAEN;IAEA,OAAOI,eAAe,IAAIa,OAAOpB,OAAO;AAC1C"}

View File

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

478
node_modules/next/dist/esm/lib/load-custom-routes.js generated vendored Normal file
View File

@ -0,0 +1,478 @@
import { bold, yellow } from "./picocolors";
import { escapeStringRegexp } from "../shared/lib/escape-regexp";
import { tryToParsePath } from "./try-to-parse-path";
import { allowedStatusCodes } from "./redirect-status";
const allowedHasTypes = new Set([
"header",
"cookie",
"query",
"host"
]);
const namedGroupsRegex = /\(\?<([a-zA-Z][a-zA-Z0-9]*)>/g;
export 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 && !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;
}
export 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 } = 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 } = 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 ${[
...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)=>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 (typeof config.rewrites !== "function") {
return {
beforeFiles: [],
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 = 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;
}
export default async function loadCustomRoutes(config) {
const [headers, rewrites, redirects] = await Promise.all([
loadHeaders(config),
loadRewrites(config),
loadRedirects(config)
]);
const totalRewrites = rewrites.beforeFiles.length + rewrites.afterFiles.length + rewrites.fallback.length;
const totalRoutes = headers.length + redirects.length + totalRewrites;
if (totalRoutes > 1000) {
console.warn(bold(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`);
}
if (!config.skipTrailingSlashRedirect) {
if (config.trailingSlash) {
redirects.unshift({
source: "/:file((?!\\.well-known(?:/.*)?)(?:[^/]+/)*[^/]+\\.\\w+)/",
destination: "/:file",
permanent: true,
locale: config.i18n ? false : undefined,
internal: 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
});
if (config.basePath) {
redirects.unshift({
source: config.basePath,
destination: config.basePath + "/",
permanent: true,
basePath: false,
locale: config.i18n ? false : undefined,
internal: true
});
}
} else {
redirects.unshift({
source: "/:path+/",
destination: "/:path+",
permanent: true,
locale: config.i18n ? false : undefined,
internal: true
});
if (config.basePath) {
redirects.unshift({
source: config.basePath + "/",
destination: config.basePath,
permanent: true,
basePath: false,
locale: config.i18n ? false : undefined,
internal: true
});
}
}
}
return {
headers,
rewrites,
redirects
};
}
//# sourceMappingURL=load-custom-routes.js.map

File diff suppressed because one or more lines are too long

34
node_modules/next/dist/esm/lib/memory/gc-observer.js generated vendored Normal file
View File

@ -0,0 +1,34 @@
import { PerformanceObserver } from "perf_hooks";
import { warn } from "../../build/output/log";
import { bold } from "../picocolors";
const LONG_RUNNING_GC_THRESHOLD_MS = 15;
const gcEvents = [];
const obs = new PerformanceObserver((list)=>{
const entry = list.getEntries()[0];
gcEvents.push(entry);
if (entry.duration > LONG_RUNNING_GC_THRESHOLD_MS) {
warn(bold(`Long running GC detected: ${entry.duration.toFixed(2)}ms`));
}
});
/**
* Starts recording garbage collection events in the process and warn on long
* running GCs. To disable, call `stopObservingGc`.
*/ export function startObservingGc() {
obs.observe({
entryTypes: [
"gc"
]
});
}
export function stopObservingGc() {
obs.disconnect();
}
/**
* Returns all recorded garbage collection events. This function will only
* return information from when `startObservingGc` was enabled and before
* `stopObservingGc` was called.
*/ export function getGcEvents() {
return gcEvents;
}
//# sourceMappingURL=gc-observer.js.map

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