feat(blog): add file-based blog with dynamic slugs, MDX content and layout shell

- Introduced blog routing using Next.js App Router
- Implemented dynamic [slug] pages for blog posts
- Added MDX-based content loading via lib/posts
- Integrated shared TopBar layout with navigation
- Established clear content, lib and component separation
This commit is contained in:
PascalSchattenburg
2026-01-22 14:14:15 +01:00
parent b717952234
commit d147843c76
10412 changed files with 2475583 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
import type { SchedulerFn } from './scheduler';
type CacheKeyFn<K, C extends string | number | null> = (key: K) => PromiseLike<C> | C;
type BatcherOptions<K, C extends string | number | null> = {
cacheKeyFn?: CacheKeyFn<K, C>;
schedulerFn?: SchedulerFn<void>;
};
type WorkFnContext<V, K> = {
resolve: (value: V | PromiseLike<V>) => void;
key: K;
};
type WorkFn<V, K> = (context: WorkFnContext<V, K>) => Promise<V>;
/**
* A wrapper for a function that will only allow one call to the function to
* execute at a time.
*/
export declare class Batcher<K, V, C extends string | number | null> {
private readonly 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.
*/
private readonly schedulerFn;
private readonly pending;
protected constructor(cacheKeyFn?: CacheKeyFn<K, C> | undefined,
/**
* 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?: SchedulerFn<void>);
/**
* Creates a new instance of PendingWrapper. If the key extends a string or
* number, the key will be used as the cache key. If the key is an object, a
* cache key function must be provided.
*/
static create<K extends string | number | null, V>(options?: BatcherOptions<K, K>): Batcher<K, V, K>;
static create<K, V, C extends string | number | null>(options: BatcherOptions<K, C> & Required<Pick<BatcherOptions<K, C>, 'cacheKeyFn'>>): Batcher<K, V, C>;
/**
* 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
*/
batch(key: K, fn: WorkFn<V, K>): Promise<V>;
}
export {};

65
apps/public-web/node_modules/next/dist/lib/batcher.js generated vendored Normal file
View File

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

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../src/lib/batcher.ts"],"sourcesContent":["import type { SchedulerFn } from './scheduler'\n\nimport { DetachedPromise } from './detached-promise'\n\ntype CacheKeyFn<K, C extends string | number | null> = (\n key: K\n) => PromiseLike<C> | C\n\ntype BatcherOptions<K, C extends string | number | null> = {\n cacheKeyFn?: CacheKeyFn<K, C>\n schedulerFn?: SchedulerFn<void>\n}\n\ntype WorkFnContext<V, K> = {\n resolve: (value: V | PromiseLike<V>) => void\n key: K\n}\n\ntype WorkFn<V, K> = (context: WorkFnContext<V, K>) => Promise<V>\n\n/**\n * A wrapper for a function that will only allow one call to the function to\n * execute at a time.\n */\nexport class Batcher<K, V, C extends string | number | null> {\n private readonly pending = new Map<C, Promise<V>>()\n\n protected constructor(\n private readonly cacheKeyFn?: CacheKeyFn<K, C>,\n /**\n * A function that will be called to schedule the wrapped function to be\n * executed. This defaults to a function that will execute the function\n * immediately.\n */\n private readonly schedulerFn: SchedulerFn<void> = (fn) => fn()\n ) {}\n\n /**\n * Creates a new instance of PendingWrapper. If the key extends a string or\n * number, the key will be used as the cache key. If the key is an object, a\n * cache key function must be provided.\n */\n public static create<K extends string | number | null, V>(\n options?: BatcherOptions<K, K>\n ): Batcher<K, V, K>\n public static create<K, V, C extends string | number | null>(\n options: BatcherOptions<K, C> &\n Required<Pick<BatcherOptions<K, C>, 'cacheKeyFn'>>\n ): Batcher<K, V, C>\n public static create<K, V, C extends string | number | null>(\n options?: BatcherOptions<K, C>\n ): Batcher<K, V, C> {\n return new Batcher<K, V, C>(options?.cacheKeyFn, options?.schedulerFn)\n }\n\n /**\n * Wraps a function in a promise that will be resolved or rejected only once\n * for a given key. This will allow multiple calls to the function to be\n * made, but only one will be executed at a time. The result of the first\n * call will be returned to all callers.\n *\n * @param key the key to use for the cache\n * @param fn the function to wrap\n * @returns a promise that resolves to the result of the function\n */\n public async batch(key: K, fn: WorkFn<V, K>): Promise<V> {\n const cacheKey = (this.cacheKeyFn ? await this.cacheKeyFn(key) : key) as C\n if (cacheKey === null) {\n return fn({ resolve: (value) => Promise.resolve(value), key })\n }\n\n const pending = this.pending.get(cacheKey)\n if (pending) return pending\n\n const { promise, resolve, reject } = new DetachedPromise<V>()\n this.pending.set(cacheKey, promise)\n\n this.schedulerFn(async () => {\n try {\n const result = await fn({ resolve, key })\n\n // Resolving a promise multiple times is a no-op, so we can safely\n // resolve all pending promises with the same result.\n resolve(result)\n } catch (err) {\n reject(err)\n } finally {\n this.pending.delete(cacheKey)\n }\n })\n\n return promise\n }\n}\n"],"names":["Batcher","cacheKeyFn","schedulerFn","fn","pending","Map","create","options","batch","key","cacheKey","resolve","value","Promise","get","promise","reject","DetachedPromise","set","result","err","delete"],"mappings":";;;;+BAwBaA;;;eAAAA;;;iCAtBmB;AAsBzB,MAAMA;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,GAAG;gBAAEQ,SAAS,CAACC,QAAUC,QAAQF,OAAO,CAACC;gBAAQH;YAAI;QAC9D;QAEA,MAAML,UAAU,IAAI,CAACA,OAAO,CAACU,GAAG,CAACJ;QACjC,IAAIN,SAAS,OAAOA;QAEpB,MAAM,EAAEW,OAAO,EAAEJ,OAAO,EAAEK,MAAM,EAAE,GAAG,IAAIC,gCAAe;QACxD,IAAI,CAACb,OAAO,CAACc,GAAG,CAACR,UAAUK;QAE3B,IAAI,CAACb,WAAW,CAAC;YACf,IAAI;gBACF,MAAMiB,SAAS,MAAMhB,GAAG;oBAAEQ;oBAASF;gBAAI;gBAEvC,kEAAkE;gBAClE,qDAAqD;gBACrDE,QAAQQ;YACV,EAAE,OAAOC,KAAK;gBACZJ,OAAOI;YACT,SAAU;gBACR,IAAI,CAAChB,OAAO,CAACiB,MAAM,CAACX;YACtB;QACF;QAEA,OAAOK;IACT;AACF","ignoreList":[0]}

View File

@@ -0,0 +1,5 @@
import type { ManifestHeaderRoute, ManifestRedirectRoute, ManifestRewriteRoute } from '../build';
import { type Header, type Redirect, type Rewrite } from './load-custom-routes';
export declare function buildCustomRoute(type: 'header', route: Header): ManifestHeaderRoute;
export declare function buildCustomRoute(type: 'rewrite', route: Rewrite): ManifestRewriteRoute;
export declare function buildCustomRoute(type: 'redirect', route: Redirect, restrictedRedirectPaths: string[]): ManifestRedirectRoute;

View File

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

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../src/lib/build-custom-route.ts"],"sourcesContent":["import { pathToRegexp } from 'next/dist/compiled/path-to-regexp'\nimport type {\n ManifestHeaderRoute,\n ManifestRedirectRoute,\n ManifestRewriteRoute,\n} from '../build'\nimport {\n normalizeRouteRegex,\n type Header,\n type Redirect,\n type Rewrite,\n type RouteType,\n} from './load-custom-routes'\nimport { getRedirectStatus, modifyRouteRegex } from './redirect-status'\n\nexport function buildCustomRoute(\n type: 'header',\n route: Header\n): ManifestHeaderRoute\nexport function buildCustomRoute(\n type: 'rewrite',\n route: Rewrite\n): ManifestRewriteRoute\nexport function buildCustomRoute(\n type: 'redirect',\n route: Redirect,\n restrictedRedirectPaths: string[]\n): ManifestRedirectRoute\nexport function buildCustomRoute(\n type: RouteType,\n route: Redirect | Rewrite | Header,\n restrictedRedirectPaths?: string[]\n): ManifestHeaderRoute | ManifestRewriteRoute | ManifestRedirectRoute {\n const compiled = pathToRegexp(route.source, [], {\n strict: true,\n sensitive: false,\n delimiter: '/', // default is `/#?`, but Next does not pass query info\n })\n\n // If this is an internal rewrite and it already provides a regex, use it\n // otherwise, normalize the source to a regex.\n let regex: string\n if (\n !route.internal ||\n type !== 'rewrite' ||\n !('regex' in route) ||\n typeof route.regex !== 'string'\n ) {\n let source = compiled.source\n if (!route.internal) {\n source = modifyRouteRegex(\n source,\n type === 'redirect' ? restrictedRedirectPaths : undefined\n )\n }\n\n regex = normalizeRouteRegex(source)\n } else {\n regex = route.regex\n }\n\n if (type !== 'redirect') {\n return { ...route, regex }\n }\n\n return {\n ...route,\n statusCode: getRedirectStatus(route as Redirect),\n permanent: undefined,\n regex,\n }\n}\n"],"names":["buildCustomRoute","type","route","restrictedRedirectPaths","compiled","pathToRegexp","source","strict","sensitive","delimiter","regex","internal","modifyRouteRegex","undefined","normalizeRouteRegex","statusCode","getRedirectStatus","permanent"],"mappings":";;;;+BA4BgBA;;;eAAAA;;;8BA5Ba;kCAYtB;gCAC6C;AAe7C,SAASA,iBACdC,IAAe,EACfC,KAAkC,EAClCC,uBAAkC;IAElC,MAAMC,WAAWC,IAAAA,0BAAY,EAACH,MAAMI,MAAM,EAAE,EAAE,EAAE;QAC9CC,QAAQ;QACRC,WAAW;QACXC,WAAW;IACb;IAEA,yEAAyE;IACzE,8CAA8C;IAC9C,IAAIC;IACJ,IACE,CAACR,MAAMS,QAAQ,IACfV,SAAS,aACT,CAAE,CAAA,WAAWC,KAAI,KACjB,OAAOA,MAAMQ,KAAK,KAAK,UACvB;QACA,IAAIJ,SAASF,SAASE,MAAM;QAC5B,IAAI,CAACJ,MAAMS,QAAQ,EAAE;YACnBL,SAASM,IAAAA,gCAAgB,EACvBN,QACAL,SAAS,aAAaE,0BAA0BU;QAEpD;QAEAH,QAAQI,IAAAA,qCAAmB,EAACR;IAC9B,OAAO;QACLI,QAAQR,MAAMQ,KAAK;IACrB;IAEA,IAAIT,SAAS,YAAY;QACvB,OAAO;YAAE,GAAGC,KAAK;YAAEQ;QAAM;IAC3B;IAEA,OAAO;QACL,GAAGR,KAAK;QACRa,YAAYC,IAAAA,iCAAiB,EAACd;QAC9Be,WAAWJ;QACXH;IACF;AACF","ignoreList":[0]}

View File

@@ -0,0 +1,25 @@
export declare enum Bundler {
Turbopack = 0,
Webpack = 1,
Rspack = 2
}
/**
* Parse the bundler arguments and potentially sets the `TURBOPACK` environment variable.
*
* NOTE: rspack is configured via next config which is chaotic so it is possible for this to be overridden later.
*
* @param options The options to parse.
* @returns The bundler that was configured
*/
export declare function parseBundlerArgs(options: {
turbo?: boolean;
turbopack?: boolean;
webpack?: boolean;
}): Bundler;
/**
* Finalize the bundler based on the config.
*
* Rspack is configured via next config by setting an environment variable (yay, side effects)
* so this should only be called after parsing the config.
*/
export declare function finalizeBundlerFromConfig(fromOptions: Bundler): Bundler;

97
apps/public-web/node_modules/next/dist/lib/bundler.js generated vendored Normal file
View File

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

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,10 @@
import { type ServerReferenceInfo } from '../shared/lib/server-reference-info';
export interface ServerReference {
$$typeof: Symbol;
$$id: string;
}
export type ServerFunction = ServerReference & ((...args: unknown[]) => Promise<unknown>);
export declare function isServerReference<T>(value: T & Partial<ServerReference>): value is T & ServerFunction;
export declare function isUseCacheFunction<T>(value: T & Partial<ServerReference>): value is T & ServerFunction;
export declare function getUseCacheFunctionInfo<T>(value: T & Partial<ServerReference>): ServerReferenceInfo | null;
export declare function isClientReference(mod: any): boolean;

View File

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

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../src/lib/client-and-server-references.ts"],"sourcesContent":["import {\n extractInfoFromServerReferenceId,\n type ServerReferenceInfo,\n} from '../shared/lib/server-reference-info'\n\n// Only contains the properties we're interested in.\nexport interface ServerReference {\n $$typeof: Symbol\n $$id: string\n}\n\nexport type ServerFunction = ServerReference &\n ((...args: unknown[]) => Promise<unknown>)\n\nexport function isServerReference<T>(\n value: T & Partial<ServerReference>\n): value is T & ServerFunction {\n return value.$$typeof === Symbol.for('react.server.reference')\n}\n\nexport function isUseCacheFunction<T>(\n value: T & Partial<ServerReference>\n): value is T & ServerFunction {\n if (!isServerReference(value)) {\n return false\n }\n\n const { type } = extractInfoFromServerReferenceId(value.$$id)\n\n return type === 'use-cache'\n}\n\nexport function getUseCacheFunctionInfo<T>(\n value: T & Partial<ServerReference>\n): ServerReferenceInfo | null {\n if (!isServerReference(value)) {\n return null\n }\n\n const info = extractInfoFromServerReferenceId(value.$$id)\n\n return info.type === 'use-cache' ? info : null\n}\n\nexport function isClientReference(mod: any): boolean {\n const defaultExport = mod?.default || mod\n return defaultExport?.$$typeof === Symbol.for('react.client.reference')\n}\n"],"names":["getUseCacheFunctionInfo","isClientReference","isServerReference","isUseCacheFunction","value","$$typeof","Symbol","for","type","extractInfoFromServerReferenceId","$$id","info","mod","defaultExport","default"],"mappings":";;;;;;;;;;;;;;;;;IAgCgBA,uBAAuB;eAAvBA;;IAYAC,iBAAiB;eAAjBA;;IA9BAC,iBAAiB;eAAjBA;;IAMAC,kBAAkB;eAAlBA;;;qCAjBT;AAWA,SAASD,kBACdE,KAAmC;IAEnC,OAAOA,MAAMC,QAAQ,KAAKC,OAAOC,GAAG,CAAC;AACvC;AAEO,SAASJ,mBACdC,KAAmC;IAEnC,IAAI,CAACF,kBAAkBE,QAAQ;QAC7B,OAAO;IACT;IAEA,MAAM,EAAEI,IAAI,EAAE,GAAGC,IAAAA,qDAAgC,EAACL,MAAMM,IAAI;IAE5D,OAAOF,SAAS;AAClB;AAEO,SAASR,wBACdI,KAAmC;IAEnC,IAAI,CAACF,kBAAkBE,QAAQ;QAC7B,OAAO;IACT;IAEA,MAAMO,OAAOF,IAAAA,qDAAgC,EAACL,MAAMM,IAAI;IAExD,OAAOC,KAAKH,IAAI,KAAK,cAAcG,OAAO;AAC5C;AAEO,SAASV,kBAAkBW,GAAQ;IACxC,MAAMC,gBAAgBD,CAAAA,uBAAAA,IAAKE,OAAO,KAAIF;IACtC,OAAOC,CAAAA,iCAAAA,cAAeR,QAAQ,MAAKC,OAAOC,GAAG,CAAC;AAChD","ignoreList":[0]}

View File

@@ -0,0 +1,7 @@
type CoalescedInvoke<T> = {
isOrigin: boolean;
value: T;
};
export type UnwrapPromise<T> = T extends Promise<infer U> ? U : T;
export declare function withCoalescedInvoke<F extends (...args: any) => any>(func: F): (key: string, args: Parameters<F>) => Promise<CoalescedInvoke<UnwrapPromise<ReturnType<F>>>>;
export {};

View File

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

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../src/lib/coalesced-function.ts"],"sourcesContent":["type CoalescedInvoke<T> = {\n isOrigin: boolean\n value: T\n}\n\nexport type UnwrapPromise<T> = T extends Promise<infer U> ? U : T\n\nconst globalInvokeCache = new Map<string, Promise<CoalescedInvoke<unknown>>>()\n\nexport function withCoalescedInvoke<F extends (...args: any) => any>(\n func: F\n): (\n key: string,\n args: Parameters<F>\n) => Promise<CoalescedInvoke<UnwrapPromise<ReturnType<F>>>> {\n return async function (key: string, args: Parameters<F>) {\n const entry = globalInvokeCache.get(key)\n if (entry) {\n return entry.then((res) => ({\n isOrigin: false,\n value: res.value as UnwrapPromise<ReturnType<F>>,\n }))\n }\n\n async function __wrapper() {\n return await func.apply(undefined, args)\n }\n\n const future = __wrapper()\n .then((res) => {\n globalInvokeCache.delete(key)\n return { isOrigin: true, value: res as UnwrapPromise<ReturnType<F>> }\n })\n .catch((err) => {\n globalInvokeCache.delete(key)\n return Promise.reject(err)\n })\n globalInvokeCache.set(key, future)\n return future\n }\n}\n"],"names":["withCoalescedInvoke","globalInvokeCache","Map","func","key","args","entry","get","then","res","isOrigin","value","__wrapper","apply","undefined","future","delete","catch","err","Promise","reject","set"],"mappings":";;;;+BASgBA;;;eAAAA;;;AAFhB,MAAMC,oBAAoB,IAAIC;AAEvB,SAASF,oBACdG,IAAO;IAKP,OAAO,eAAgBC,GAAW,EAAEC,IAAmB;QACrD,MAAMC,QAAQL,kBAAkBM,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;YACLR,kBAAkBe,MAAM,CAACZ;YACzB,OAAO;gBAAEM,UAAU;gBAAMC,OAAOF;YAAoC;QACtE,GACCQ,KAAK,CAAC,CAACC;YACNjB,kBAAkBe,MAAM,CAACZ;YACzB,OAAOe,QAAQC,MAAM,CAACF;QACxB;QACFjB,kBAAkBoB,GAAG,CAACjB,KAAKW;QAC3B,OAAOA;IACT;AACF","ignoreList":[0]}

View File

@@ -0,0 +1,2 @@
export declare class CompileError extends Error {
}

View File

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

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../src/lib/compile-error.ts"],"sourcesContent":["export class CompileError extends Error {}\n"],"names":["CompileError","Error"],"mappings":";;;;+BAAaA;;;eAAAA;;;AAAN,MAAMA,qBAAqBC;AAAO","ignoreList":[0]}

View File

@@ -0,0 +1,147 @@
import type { ServerRuntime } from '../types';
export declare const TEXT_PLAIN_CONTENT_TYPE_HEADER = "text/plain";
export declare const HTML_CONTENT_TYPE_HEADER = "text/html; charset=utf-8";
export declare const JSON_CONTENT_TYPE_HEADER = "application/json; charset=utf-8";
export declare const NEXT_QUERY_PARAM_PREFIX = "nxtP";
export declare const NEXT_INTERCEPTION_MARKER_PREFIX = "nxtI";
export declare const MATCHED_PATH_HEADER = "x-matched-path";
export declare const PRERENDER_REVALIDATE_HEADER = "x-prerender-revalidate";
export declare const PRERENDER_REVALIDATE_ONLY_GENERATED_HEADER = "x-prerender-revalidate-if-generated";
export declare const RSC_SEGMENTS_DIR_SUFFIX = ".segments";
export declare const RSC_SEGMENT_SUFFIX = ".segment.rsc";
export declare const RSC_SUFFIX = ".rsc";
export declare const ACTION_SUFFIX = ".action";
export declare const NEXT_DATA_SUFFIX = ".json";
export declare const NEXT_META_SUFFIX = ".meta";
export declare const NEXT_BODY_SUFFIX = ".body";
export declare const NEXT_CACHE_TAGS_HEADER = "x-next-cache-tags";
export declare const NEXT_CACHE_REVALIDATED_TAGS_HEADER = "x-next-revalidated-tags";
export declare const NEXT_CACHE_REVALIDATE_TAG_TOKEN_HEADER = "x-next-revalidate-tag-token";
export declare const NEXT_RESUME_HEADER = "next-resume";
export declare const NEXT_CACHE_TAG_MAX_ITEMS = 128;
export declare const NEXT_CACHE_TAG_MAX_LENGTH = 256;
export declare const NEXT_CACHE_SOFT_TAG_MAX_LENGTH = 1024;
export declare const NEXT_CACHE_IMPLICIT_TAG_ID = "_N_T_";
export declare const CACHE_ONE_YEAR = 31536000;
export declare const INFINITE_CACHE = 4294967294;
export declare const MIDDLEWARE_FILENAME = "middleware";
export declare const MIDDLEWARE_LOCATION_REGEXP = "(?:src/)?middleware";
export declare const PROXY_FILENAME = "proxy";
export declare const PROXY_LOCATION_REGEXP = "(?:src/)?proxy";
export declare const INSTRUMENTATION_HOOK_FILENAME = "instrumentation";
export declare const PAGES_DIR_ALIAS = "private-next-pages";
export declare const DOT_NEXT_ALIAS = "private-dot-next";
export declare const ROOT_DIR_ALIAS = "private-next-root-dir";
export declare const APP_DIR_ALIAS = "private-next-app-dir";
export declare const RSC_MOD_REF_PROXY_ALIAS = "private-next-rsc-mod-ref-proxy";
export declare const RSC_ACTION_VALIDATE_ALIAS = "private-next-rsc-action-validate";
export declare const RSC_ACTION_PROXY_ALIAS = "private-next-rsc-server-reference";
export declare const RSC_CACHE_WRAPPER_ALIAS = "private-next-rsc-cache-wrapper";
export declare const RSC_DYNAMIC_IMPORT_WRAPPER_ALIAS = "private-next-rsc-track-dynamic-import";
export declare const RSC_ACTION_ENCRYPTION_ALIAS = "private-next-rsc-action-encryption";
export declare const RSC_ACTION_CLIENT_WRAPPER_ALIAS = "private-next-rsc-action-client-wrapper";
export declare 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 declare const SSG_GET_INITIAL_PROPS_CONFLICT = "You can not use getInitialProps with getStaticProps. To use SSG, please remove your getInitialProps";
export declare const SERVER_PROPS_GET_INIT_PROPS_CONFLICT = "You can not use getInitialProps with getServerSideProps. Please remove getInitialProps.";
export declare const SERVER_PROPS_SSG_CONFLICT = "You can not use getStaticProps or getStaticPaths with getServerSideProps. To use SSG, please remove getServerSideProps";
export declare const STATIC_STATUS_PAGE_GET_INITIAL_PROPS_ERROR = "can not have getInitialProps/getServerSideProps, https://nextjs.org/docs/messages/404-get-initial-props";
export declare const SERVER_PROPS_EXPORT_ERROR = "pages with `getServerSideProps` can not be exported. See more info here: https://nextjs.org/docs/messages/gssp-export";
export declare const GSP_NO_RETURNED_VALUE = "Your `getStaticProps` function did not return an object. Did you forget to add a `return`?";
export declare const GSSP_NO_RETURNED_VALUE = "Your `getServerSideProps` function did not return an object. Did you forget to add a `return`?";
export declare const UNSTABLE_REVALIDATE_RENAME_ERROR: string;
export declare 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 declare 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 declare 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 declare const ESLINT_DEFAULT_DIRS: string[];
export declare const SERVER_RUNTIME: Record<string, ServerRuntime>;
export declare const WEB_SOCKET_MAX_RECONNECTIONS = 12;
/**
* The names of the webpack layers. These layers are the primitives for the
* webpack chunks.
*/
declare const WEBPACK_LAYERS_NAMES: {
/**
* The layer for the shared code between the client and server bundles.
*/
readonly shared: "shared";
/**
* The layer for server-only runtime and picking up `react-server` export conditions.
* Including app router RSC pages and app router custom routes and metadata routes.
*/
readonly reactServerComponents: "rsc";
/**
* Server Side Rendering layer for app (ssr).
*/
readonly serverSideRendering: "ssr";
/**
* The browser client bundle layer for actions.
*/
readonly actionBrowser: "action-browser";
/**
* The Node.js bundle layer for the API routes.
*/
readonly apiNode: "api-node";
/**
* The Edge Lite bundle layer for the API routes.
*/
readonly apiEdge: "api-edge";
/**
* The layer for the middleware code.
*/
readonly middleware: "middleware";
/**
* The layer for the instrumentation hooks.
*/
readonly instrument: "instrument";
/**
* The layer for assets on the edge.
*/
readonly edgeAsset: "edge-asset";
/**
* The browser client bundle layer for App directory.
*/
readonly appPagesBrowser: "app-pages-browser";
/**
* The browser client bundle layer for Pages directory.
*/
readonly pagesDirBrowser: "pages-dir-browser";
/**
* The Edge Lite bundle layer for Pages directory.
*/
readonly pagesDirEdge: "pages-dir-edge";
/**
* The Node.js bundle layer for Pages directory.
*/
readonly pagesDirNode: "pages-dir-node";
};
export type WebpackLayerName = (typeof WEBPACK_LAYERS_NAMES)[keyof typeof WEBPACK_LAYERS_NAMES];
declare const WEBPACK_LAYERS: {
GROUP: {
builtinReact: ("rsc" | "action-browser")[];
serverOnly: ("middleware" | "rsc" | "action-browser" | "instrument")[];
neutralTarget: ("api-node" | "api-edge")[];
clientOnly: ("ssr" | "app-pages-browser")[];
bundled: ("shared" | "middleware" | "rsc" | "ssr" | "action-browser" | "instrument" | "app-pages-browser")[];
appPages: ("rsc" | "ssr" | "action-browser" | "app-pages-browser")[];
};
shared: "shared";
reactServerComponents: "rsc";
serverSideRendering: "ssr";
actionBrowser: "action-browser";
apiNode: "api-node";
apiEdge: "api-edge";
middleware: "middleware";
instrument: "instrument";
edgeAsset: "edge-asset";
appPagesBrowser: "app-pages-browser";
pagesDirBrowser: "pages-dir-browser";
pagesDirEdge: "pages-dir-edge";
pagesDirNode: "pages-dir-node";
};
declare const WEBPACK_RESOURCE_QUERIES: {
edgeSSREntry: string;
metadata: string;
metadataRoute: string;
metadataImageMeta: string;
};
export { WEBPACK_LAYERS, WEBPACK_RESOURCE_QUERIES };

405
apps/public-web/node_modules/next/dist/lib/constants.js generated vendored Normal file
View File

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

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,6 @@
import { BloomFilter } from '../shared/lib/bloom-filter';
import type { Redirect } from './load-custom-routes';
export declare function createClientRouterFilter(paths: string[], redirects: Redirect[], allowedErrorRate?: number): {
staticFilter: ReturnType<BloomFilter['export']>;
dynamicFilter: ReturnType<BloomFilter['export']>;
};

View File

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

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../src/lib/create-client-router-filter.ts"],"sourcesContent":["import type { Token } from 'next/dist/compiled/path-to-regexp'\nimport { BloomFilter } from '../shared/lib/bloom-filter'\nimport { isDynamicRoute } from '../shared/lib/router/utils'\nimport { removeTrailingSlash } from '../shared/lib/router/utils/remove-trailing-slash'\nimport type { Redirect } from './load-custom-routes'\nimport { tryToParsePath } from './try-to-parse-path'\nimport {\n extractInterceptionRouteInformation,\n isInterceptionRouteAppPath,\n} from '../shared/lib/router/utils/interception-routes'\n\nexport function createClientRouterFilter(\n paths: string[],\n redirects: Redirect[],\n allowedErrorRate?: number\n): {\n staticFilter: ReturnType<BloomFilter['export']>\n dynamicFilter: ReturnType<BloomFilter['export']>\n} {\n const staticPaths = new Set<string>()\n const dynamicPaths = new Set<string>()\n\n for (let path of paths) {\n if (isDynamicRoute(path)) {\n if (isInterceptionRouteAppPath(path)) {\n path = extractInterceptionRouteInformation(path).interceptedRoute\n }\n\n let subPath = ''\n const pathParts = path.split('/')\n\n // start at 1 since we split on '/' and the path starts\n // with this so the first entry is an empty string\n for (let i = 1; i < pathParts.length; i++) {\n const curPart = pathParts[i]\n\n if (curPart.startsWith('[')) {\n break\n }\n subPath = `${subPath}/${curPart}`\n }\n\n if (subPath) {\n dynamicPaths.add(subPath)\n }\n } else {\n staticPaths.add(path)\n }\n }\n\n for (const redirect of redirects) {\n const { source } = redirect\n const path = removeTrailingSlash(source)\n let tokens: Token[] = []\n\n try {\n tokens = tryToParsePath(source).tokens || []\n } catch {}\n\n if (tokens.every((token) => typeof token === 'string')) {\n // only include static redirects initially\n staticPaths.add(path)\n }\n }\n\n const staticFilter = BloomFilter.from([...staticPaths], allowedErrorRate)\n\n const dynamicFilter = BloomFilter.from([...dynamicPaths], allowedErrorRate)\n const data = {\n staticFilter: staticFilter.export(),\n dynamicFilter: dynamicFilter.export(),\n }\n return data\n}\n"],"names":["createClientRouterFilter","paths","redirects","allowedErrorRate","staticPaths","Set","dynamicPaths","path","isDynamicRoute","isInterceptionRouteAppPath","extractInterceptionRouteInformation","interceptedRoute","subPath","pathParts","split","i","length","curPart","startsWith","add","redirect","source","removeTrailingSlash","tokens","tryToParsePath","every","token","staticFilter","BloomFilter","from","dynamicFilter","data","export"],"mappings":";;;;+BAWgBA;;;eAAAA;;;6BAVY;uBACG;qCACK;gCAEL;oCAIxB;AAEA,SAASA,yBACdC,KAAe,EACfC,SAAqB,EACrBC,gBAAyB;IAKzB,MAAMC,cAAc,IAAIC;IACxB,MAAMC,eAAe,IAAID;IAEzB,KAAK,IAAIE,QAAQN,MAAO;QACtB,IAAIO,IAAAA,qBAAc,EAACD,OAAO;YACxB,IAAIE,IAAAA,8CAA0B,EAACF,OAAO;gBACpCA,OAAOG,IAAAA,uDAAmC,EAACH,MAAMI,gBAAgB;YACnE;YAEA,IAAIC,UAAU;YACd,MAAMC,YAAYN,KAAKO,KAAK,CAAC;YAE7B,uDAAuD;YACvD,kDAAkD;YAClD,IAAK,IAAIC,IAAI,GAAGA,IAAIF,UAAUG,MAAM,EAAED,IAAK;gBACzC,MAAME,UAAUJ,SAAS,CAACE,EAAE;gBAE5B,IAAIE,QAAQC,UAAU,CAAC,MAAM;oBAC3B;gBACF;gBACAN,UAAU,GAAGA,QAAQ,CAAC,EAAEK,SAAS;YACnC;YAEA,IAAIL,SAAS;gBACXN,aAAaa,GAAG,CAACP;YACnB;QACF,OAAO;YACLR,YAAYe,GAAG,CAACZ;QAClB;IACF;IAEA,KAAK,MAAMa,YAAYlB,UAAW;QAChC,MAAM,EAAEmB,MAAM,EAAE,GAAGD;QACnB,MAAMb,OAAOe,IAAAA,wCAAmB,EAACD;QACjC,IAAIE,SAAkB,EAAE;QAExB,IAAI;YACFA,SAASC,IAAAA,8BAAc,EAACH,QAAQE,MAAM,IAAI,EAAE;QAC9C,EAAE,OAAM,CAAC;QAET,IAAIA,OAAOE,KAAK,CAAC,CAACC,QAAU,OAAOA,UAAU,WAAW;YACtD,0CAA0C;YAC1CtB,YAAYe,GAAG,CAACZ;QAClB;IACF;IAEA,MAAMoB,eAAeC,wBAAW,CAACC,IAAI,CAAC;WAAIzB;KAAY,EAAED;IAExD,MAAM2B,gBAAgBF,wBAAW,CAACC,IAAI,CAAC;WAAIvB;KAAa,EAAEH;IAC1D,MAAM4B,OAAO;QACXJ,cAAcA,aAAaK,MAAM;QACjCF,eAAeA,cAAcE,MAAM;IACrC;IACA,OAAOD;AACT","ignoreList":[0]}

View File

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

View File

@@ -0,0 +1,12 @@
/**
* A `Promise.withResolvers` implementation that exposes the `resolve` and
* `reject` functions on a `Promise`.
*
* @see https://tc39.es/proposal-promise-with-resolvers/
*/
export declare class DetachedPromise<T = any> {
readonly resolve: (value: T | PromiseLike<T>) => void;
readonly reject: (reason: any) => void;
readonly promise: Promise<T>;
constructor();
}

View File

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

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../src/lib/detached-promise.ts"],"sourcesContent":["/**\n * A `Promise.withResolvers` implementation that exposes the `resolve` and\n * `reject` functions on a `Promise`.\n *\n * @see https://tc39.es/proposal-promise-with-resolvers/\n */\nexport class DetachedPromise<T = any> {\n public readonly resolve: (value: T | PromiseLike<T>) => void\n public readonly reject: (reason: any) => void\n public readonly promise: Promise<T>\n\n constructor() {\n let resolve: (value: T | PromiseLike<T>) => void\n let reject: (reason: any) => void\n\n // Create the promise and assign the resolvers to the object.\n this.promise = new Promise<T>((res, rej) => {\n resolve = res\n reject = rej\n })\n\n // We know that resolvers is defined because the Promise constructor runs\n // synchronously.\n this.resolve = resolve!\n this.reject = reject!\n }\n}\n"],"names":["DetachedPromise","constructor","resolve","reject","promise","Promise","res","rej"],"mappings":"AAAA;;;;;CAKC;;;;+BACYA;;;eAAAA;;;AAAN,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","ignoreList":[0]}

View File

@@ -0,0 +1 @@
export declare function detectTypo(input: string, options: string[], threshold?: number): string | null;

View File

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

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../src/lib/detect-typo.ts"],"sourcesContent":["// the minimum number of operations required to convert string a to string b.\nfunction minDistance(a: string, b: string, threshold: number): number {\n const m = a.length\n const n = b.length\n\n if (m < n) {\n return minDistance(b, a, threshold)\n }\n\n if (n === 0) {\n return m\n }\n\n let previousRow = Array.from({ length: n + 1 }, (_, i) => i)\n\n for (let i = 0; i < m; i++) {\n const s1 = a[i]\n let currentRow = [i + 1]\n for (let j = 0; j < n; j++) {\n const s2 = b[j]\n const insertions = previousRow[j + 1] + 1\n const deletions = currentRow[j] + 1\n const substitutions = previousRow[j] + Number(s1 !== s2)\n currentRow.push(Math.min(insertions, deletions, substitutions))\n }\n previousRow = currentRow\n }\n return previousRow[previousRow.length - 1]\n}\n\nexport function detectTypo(input: string, options: string[], threshold = 2) {\n const potentialTypos = options\n .map((o) => ({\n option: o,\n distance: minDistance(o, input, threshold),\n }))\n .filter(({ distance }) => distance <= threshold && distance > 0)\n .sort((a, b) => a.distance - b.distance)\n\n if (potentialTypos.length) {\n return potentialTypos[0].option\n }\n return null\n}\n"],"names":["detectTypo","minDistance","a","b","threshold","m","length","n","previousRow","Array","from","_","i","s1","currentRow","j","s2","insertions","deletions","substitutions","Number","push","Math","min","input","options","potentialTypos","map","o","option","distance","filter","sort"],"mappings":"AAAA,6EAA6E;;;;;+BA8B7DA;;;eAAAA;;;AA7BhB,SAASC,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;AAEO,SAASN,WAAWwB,KAAa,EAAEC,OAAiB,EAAErB,YAAY,CAAC;IACxE,MAAMsB,iBAAiBD,QACpBE,GAAG,CAAC,CAACC,IAAO,CAAA;YACXC,QAAQD;YACRE,UAAU7B,YAAY2B,GAAGJ,OAAOpB;QAClC,CAAA,GACC2B,MAAM,CAAC,CAAC,EAAED,QAAQ,EAAE,GAAKA,YAAY1B,aAAa0B,WAAW,GAC7DE,IAAI,CAAC,CAAC9B,GAAGC,IAAMD,EAAE4B,QAAQ,GAAG3B,EAAE2B,QAAQ;IAEzC,IAAIJ,eAAepB,MAAM,EAAE;QACzB,OAAOoB,cAAc,CAAC,EAAE,CAACG,MAAM;IACjC;IACA,OAAO;AACT","ignoreList":[0]}

View File

@@ -0,0 +1,2 @@
export declare function downloadNativeNextSwc(version: string, bindingsDirectory: string, triplesABI: Array<string>): Promise<void>;
export declare function downloadWasmSwc(version: string, wasmDirectory: string, variant?: 'nodejs' | 'web'): Promise<void>;

View File

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

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,10 @@
/**
* Augments the digest field of errors thrown in React Server Components (RSC) with an error code.
* Since RSC errors can only be serialized through the digest field, this provides a way to include
* an additional error code that can be extracted client-side via `extractNextErrorCode`.
*
* The error code is appended to the digest string with a semicolon separator, allowing it to be
* parsed out later while preserving the original digest value.
*/
export declare const createDigestWithErrorCode: (thrownValue: unknown, originalDigest: string) => string;
export declare const extractNextErrorCode: (error: unknown) => string | undefined;

View File

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

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../src/lib/error-telemetry-utils.ts"],"sourcesContent":["const ERROR_CODE_DELIMITER = '@'\n\n/**\n * Augments the digest field of errors thrown in React Server Components (RSC) with an error code.\n * Since RSC errors can only be serialized through the digest field, this provides a way to include\n * an additional error code that can be extracted client-side via `extractNextErrorCode`.\n *\n * The error code is appended to the digest string with a semicolon separator, allowing it to be\n * parsed out later while preserving the original digest value.\n */\nexport const createDigestWithErrorCode = (\n thrownValue: unknown,\n originalDigest: string\n): string => {\n if (\n typeof thrownValue === 'object' &&\n thrownValue !== null &&\n '__NEXT_ERROR_CODE' in thrownValue\n ) {\n return `${originalDigest}${ERROR_CODE_DELIMITER}${thrownValue.__NEXT_ERROR_CODE}`\n }\n return originalDigest\n}\n\nexport const extractNextErrorCode = (error: unknown): string | undefined => {\n if (\n typeof error === 'object' &&\n error !== null &&\n '__NEXT_ERROR_CODE' in error &&\n typeof error.__NEXT_ERROR_CODE === 'string'\n ) {\n return error.__NEXT_ERROR_CODE\n }\n\n if (\n typeof error === 'object' &&\n error !== null &&\n 'digest' in error &&\n typeof error.digest === 'string'\n ) {\n const segments = error.digest.split(ERROR_CODE_DELIMITER)\n const errorCode = segments.find((segment) => segment.startsWith('E'))\n return errorCode\n }\n\n return undefined\n}\n"],"names":["createDigestWithErrorCode","extractNextErrorCode","ERROR_CODE_DELIMITER","thrownValue","originalDigest","__NEXT_ERROR_CODE","error","digest","segments","split","errorCode","find","segment","startsWith","undefined"],"mappings":";;;;;;;;;;;;;;;IAUaA,yBAAyB;eAAzBA;;IAcAC,oBAAoB;eAApBA;;;AAxBb,MAAMC,uBAAuB;AAUtB,MAAMF,4BAA4B,CACvCG,aACAC;IAEA,IACE,OAAOD,gBAAgB,YACvBA,gBAAgB,QAChB,uBAAuBA,aACvB;QACA,OAAO,GAAGC,iBAAiBF,uBAAuBC,YAAYE,iBAAiB,EAAE;IACnF;IACA,OAAOD;AACT;AAEO,MAAMH,uBAAuB,CAACK;IACnC,IACE,OAAOA,UAAU,YACjBA,UAAU,QACV,uBAAuBA,SACvB,OAAOA,MAAMD,iBAAiB,KAAK,UACnC;QACA,OAAOC,MAAMD,iBAAiB;IAChC;IAEA,IACE,OAAOC,UAAU,YACjBA,UAAU,QACV,YAAYA,SACZ,OAAOA,MAAMC,MAAM,KAAK,UACxB;QACA,MAAMC,WAAWF,MAAMC,MAAM,CAACE,KAAK,CAACP;QACpC,MAAMQ,YAAYF,SAASG,IAAI,CAAC,CAACC,UAAYA,QAAQC,UAAU,CAAC;QAChE,OAAOH;IACT;IAEA,OAAOI;AACT","ignoreList":[0]}

View File

@@ -0,0 +1,41 @@
/**
* Describes the different fallback modes that a given page can have.
*/
export declare const enum FallbackMode {
/**
* A BLOCKING_STATIC_RENDER fallback will block the request until the page is
* generated. No fallback page will be rendered, and users will have to wait
* to render the page.
*/
BLOCKING_STATIC_RENDER = "BLOCKING_STATIC_RENDER",
/**
* When set to PRERENDER, a fallback page will be sent to users in place of
* forcing them to wait for the page to be generated. This allows the user to
* see a rendered page earlier.
*/
PRERENDER = "PRERENDER",
/**
* When set to NOT_FOUND, pages that are not already prerendered will result
* in a not found response.
*/
NOT_FOUND = "NOT_FOUND"
}
/**
* The fallback value returned from the `getStaticPaths` function.
*/
export type GetStaticPathsFallback = boolean | 'blocking';
/**
* Parses the fallback field from the prerender manifest.
*
* @param fallbackField The fallback field from the prerender manifest.
* @returns The fallback mode.
*/
export declare function parseFallbackField(fallbackField: string | boolean | null | undefined): FallbackMode | undefined;
export declare function fallbackModeToFallbackField(fallback: FallbackMode, page: string | undefined): string | false | null;
/**
* Parses the fallback from the static paths result.
*
* @param result The result from the static paths function.
* @returns The fallback mode.
*/
export declare function parseStaticPathsResult(result: GetStaticPathsFallback): FallbackMode;

100
apps/public-web/node_modules/next/dist/lib/fallback.js generated vendored Normal file
View File

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

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../src/lib/fallback.ts"],"sourcesContent":["/**\n * Describes the different fallback modes that a given page can have.\n */\nexport const enum FallbackMode {\n /**\n * A BLOCKING_STATIC_RENDER fallback will block the request until the page is\n * generated. No fallback page will be rendered, and users will have to wait\n * to render the page.\n */\n BLOCKING_STATIC_RENDER = 'BLOCKING_STATIC_RENDER',\n\n /**\n * When set to PRERENDER, a fallback page will be sent to users in place of\n * forcing them to wait for the page to be generated. This allows the user to\n * see a rendered page earlier.\n */\n PRERENDER = 'PRERENDER',\n\n /**\n * When set to NOT_FOUND, pages that are not already prerendered will result\n * in a not found response.\n */\n NOT_FOUND = 'NOT_FOUND',\n}\n\n/**\n * The fallback value returned from the `getStaticPaths` function.\n */\nexport type GetStaticPathsFallback = boolean | 'blocking'\n\n/**\n * Parses the fallback field from the prerender manifest.\n *\n * @param fallbackField The fallback field from the prerender manifest.\n * @returns The fallback mode.\n */\nexport function parseFallbackField(\n fallbackField: string | boolean | null | undefined\n): FallbackMode | undefined {\n if (typeof fallbackField === 'string') {\n return FallbackMode.PRERENDER\n } else if (fallbackField === null) {\n return FallbackMode.BLOCKING_STATIC_RENDER\n } else if (fallbackField === false) {\n return FallbackMode.NOT_FOUND\n } else if (fallbackField === undefined) {\n return undefined\n } else {\n throw new Error(\n `Invalid fallback option: ${fallbackField}. Fallback option must be a string, null, undefined, or false.`\n )\n }\n}\n\nexport function fallbackModeToFallbackField(\n fallback: FallbackMode,\n page: string | undefined\n): string | false | null {\n switch (fallback) {\n case FallbackMode.BLOCKING_STATIC_RENDER:\n return null\n case FallbackMode.NOT_FOUND:\n return false\n case FallbackMode.PRERENDER:\n if (!page) {\n throw new Error(\n `Invariant: expected a page to be provided when fallback mode is \"${fallback}\"`\n )\n }\n\n return page\n default:\n throw new Error(`Invalid fallback mode: ${fallback}`)\n }\n}\n\n/**\n * Parses the fallback from the static paths result.\n *\n * @param result The result from the static paths function.\n * @returns The fallback mode.\n */\nexport function parseStaticPathsResult(\n result: GetStaticPathsFallback\n): FallbackMode {\n if (result === true) {\n return FallbackMode.PRERENDER\n } else if (result === 'blocking') {\n return FallbackMode.BLOCKING_STATIC_RENDER\n } else {\n return FallbackMode.NOT_FOUND\n }\n}\n"],"names":["FallbackMode","fallbackModeToFallbackField","parseFallbackField","parseStaticPathsResult","fallbackField","undefined","Error","fallback","page","result"],"mappings":"AAAA;;CAEC;;;;;;;;;;;;;;;;;IACiBA,YAAY;eAAZA;;IAmDFC,2BAA2B;eAA3BA;;IAlBAC,kBAAkB;eAAlBA;;IA8CAC,sBAAsB;eAAtBA;;;AA/ET,IAAA,AAAWH,sCAAAA;IAChB;;;;GAIC;IAGD;;;;GAIC;IAGD;;;GAGC;WAlBeA;;AAiCX,SAASE,mBACdE,aAAkD;IAElD,IAAI,OAAOA,kBAAkB,UAAU;QACrC;IACF,OAAO,IAAIA,kBAAkB,MAAM;QACjC;IACF,OAAO,IAAIA,kBAAkB,OAAO;QAClC;IACF,OAAO,IAAIA,kBAAkBC,WAAW;QACtC,OAAOA;IACT,OAAO;QACL,MAAM,qBAEL,CAFK,IAAIC,MACR,CAAC,yBAAyB,EAAEF,cAAc,8DAA8D,CAAC,GADrG,qBAAA;mBAAA;wBAAA;0BAAA;QAEN;IACF;AACF;AAEO,SAASH,4BACdM,QAAsB,EACtBC,IAAwB;IAExB,OAAQD;QACN;YACE,OAAO;QACT;YACE,OAAO;QACT;YACE,IAAI,CAACC,MAAM;gBACT,MAAM,qBAEL,CAFK,IAAIF,MACR,CAAC,iEAAiE,EAAEC,SAAS,CAAC,CAAC,GAD3E,qBAAA;2BAAA;gCAAA;kCAAA;gBAEN;YACF;YAEA,OAAOC;QACT;YACE,MAAM,qBAA+C,CAA/C,IAAIF,MAAM,CAAC,uBAAuB,EAAEC,UAAU,GAA9C,qBAAA;uBAAA;4BAAA;8BAAA;YAA8C;IACxD;AACF;AAQO,SAASJ,uBACdM,MAA8B;IAE9B,IAAIA,WAAW,MAAM;QACnB;IACF,OAAO,IAAIA,WAAW,YAAY;QAChC;IACF,OAAO;QACL;IACF;AACF","ignoreList":[0]}

View File

@@ -0,0 +1,2 @@
export declare class FatalError extends Error {
}

View File

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

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../src/lib/fatal-error.ts"],"sourcesContent":["export class FatalError extends Error {}\n"],"names":["FatalError","Error"],"mappings":";;;;+BAAaA;;;eAAAA;;;AAAN,MAAMA,mBAAmBC;AAAO","ignoreList":[0]}

View File

@@ -0,0 +1,5 @@
export declare enum FileType {
File = "file",
Directory = "directory"
}
export declare function fileExists(fileName: string, type?: FileType): Promise<boolean>;

View File

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

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../src/lib/file-exists.ts"],"sourcesContent":["import { existsSync, promises } from 'fs'\nimport isError from './is-error'\n\nexport enum FileType {\n File = 'file',\n Directory = 'directory',\n}\n\nexport async function fileExists(\n fileName: string,\n type?: FileType\n): Promise<boolean> {\n try {\n if (type === FileType.File) {\n const stats = await promises.stat(fileName)\n return stats.isFile()\n } else if (type === FileType.Directory) {\n const stats = await promises.stat(fileName)\n return stats.isDirectory()\n }\n\n return existsSync(fileName)\n } catch (err) {\n if (\n isError(err) &&\n (err.code === 'ENOENT' || err.code === 'ENAMETOOLONG')\n ) {\n return false\n }\n throw err\n }\n}\n"],"names":["FileType","fileExists","fileName","type","stats","promises","stat","isFile","isDirectory","existsSync","err","isError","code"],"mappings":";;;;;;;;;;;;;;;IAGYA,QAAQ;eAARA;;IAKUC,UAAU;eAAVA;;;oBARe;gEACjB;;;;;;AAEb,IAAA,AAAKD,kCAAAA;;;WAAAA;;AAKL,eAAeC,WACpBC,QAAgB,EAChBC,IAAe;IAEf,IAAI;QACF,IAAIA,iBAAwB;YAC1B,MAAMC,QAAQ,MAAMC,YAAQ,CAACC,IAAI,CAACJ;YAClC,OAAOE,MAAMG,MAAM;QACrB,OAAO,IAAIJ,sBAA6B;YACtC,MAAMC,QAAQ,MAAMC,YAAQ,CAACC,IAAI,CAACJ;YAClC,OAAOE,MAAMI,WAAW;QAC1B;QAEA,OAAOC,IAAAA,cAAU,EAACP;IACpB,EAAE,OAAOQ,KAAK;QACZ,IACEC,IAAAA,gBAAO,EAACD,QACPA,CAAAA,IAAIE,IAAI,KAAK,YAAYF,IAAIE,IAAI,KAAK,cAAa,GACpD;YACA,OAAO;QACT;QACA,MAAMF;IACR;AACF","ignoreList":[0]}

View File

@@ -0,0 +1,6 @@
type RecursivePartial<T> = {
[P in keyof T]?: RecursivePartial<T[P]>;
};
export declare function findConfigPath(dir: string, key: string): Promise<string | undefined>;
export declare function findConfig<T>(directory: string, key: string, _returnFile?: boolean): Promise<RecursivePartial<T> | null>;
export {};

View File

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

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,5 @@
export declare function findDir(dir: string, name: 'pages' | 'app'): string | null;
export declare function findPagesDir(dir: string): {
pagesDir: string | undefined;
appDir: string | undefined;
};

View File

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

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../src/lib/find-pages-dir.ts"],"sourcesContent":["import fs from 'fs'\nimport path from 'path'\n\nexport function findDir(dir: string, name: 'pages' | 'app'): string | null {\n // prioritize ./${name} over ./src/${name}\n let curDir = path.join(dir, name)\n if (fs.existsSync(curDir)) return curDir\n\n curDir = path.join(dir, 'src', name)\n if (fs.existsSync(curDir)) return curDir\n\n return null\n}\n\nexport function findPagesDir(dir: string): {\n pagesDir: string | undefined\n appDir: string | undefined\n} {\n const pagesDir = findDir(dir, 'pages') || undefined\n const appDir = findDir(dir, 'app') || undefined\n\n if (appDir == null && pagesDir == null) {\n throw new Error(\n \"> Couldn't find any `pages` or `app` directory. Please create one under the project root\"\n )\n }\n\n if (pagesDir && appDir) {\n const pagesParent = path.dirname(pagesDir)\n const appParent = path.dirname(appDir)\n if (pagesParent !== appParent) {\n throw new Error(\n '> `pages` and `app` directories should be under the same folder'\n )\n }\n }\n\n return {\n pagesDir,\n appDir,\n }\n}\n"],"names":["findDir","findPagesDir","dir","name","curDir","path","join","fs","existsSync","pagesDir","undefined","appDir","Error","pagesParent","dirname","appParent"],"mappings":";;;;;;;;;;;;;;;IAGgBA,OAAO;eAAPA;;IAWAC,YAAY;eAAZA;;;2DAdD;6DACE;;;;;;AAEV,SAASD,QAAQE,GAAW,EAAEC,IAAqB;IACxD,0CAA0C;IAC1C,IAAIC,SAASC,aAAI,CAACC,IAAI,CAACJ,KAAKC;IAC5B,IAAII,WAAE,CAACC,UAAU,CAACJ,SAAS,OAAOA;IAElCA,SAASC,aAAI,CAACC,IAAI,CAACJ,KAAK,OAAOC;IAC/B,IAAII,WAAE,CAACC,UAAU,CAACJ,SAAS,OAAOA;IAElC,OAAO;AACT;AAEO,SAASH,aAAaC,GAAW;IAItC,MAAMO,WAAWT,QAAQE,KAAK,YAAYQ;IAC1C,MAAMC,SAASX,QAAQE,KAAK,UAAUQ;IAEtC,IAAIC,UAAU,QAAQF,YAAY,MAAM;QACtC,MAAM,qBAEL,CAFK,IAAIG,MACR,6FADI,qBAAA;mBAAA;wBAAA;0BAAA;QAEN;IACF;IAEA,IAAIH,YAAYE,QAAQ;QACtB,MAAME,cAAcR,aAAI,CAACS,OAAO,CAACL;QACjC,MAAMM,YAAYV,aAAI,CAACS,OAAO,CAACH;QAC/B,IAAIE,gBAAgBE,WAAW;YAC7B,MAAM,qBAEL,CAFK,IAAIH,MACR,oEADI,qBAAA;uBAAA;4BAAA;8BAAA;YAEN;QACF;IACF;IAEA,OAAO;QACLH;QACAE;IACF;AACF","ignoreList":[0]}

View File

@@ -0,0 +1,6 @@
export declare function findRootLockFile(cwd: string): string | undefined;
export declare function findRootDirAndLockFiles(cwd: string): {
lockFiles: string[];
rootDir: string;
};
export declare function warnDuplicatedLockFiles(lockFiles: string[]): void;

122
apps/public-web/node_modules/next/dist/lib/find-root.js generated vendored Normal file
View File

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

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../src/lib/find-root.ts"],"sourcesContent":["import { dirname } from 'path'\nimport findUp from 'next/dist/compiled/find-up'\nimport * as Log from '../build/output/log'\n\nexport function findRootLockFile(cwd: string) {\n return findUp.sync(\n [\n 'pnpm-lock.yaml',\n 'package-lock.json',\n 'yarn.lock',\n 'bun.lock',\n 'bun.lockb',\n ],\n {\n cwd,\n }\n )\n}\n\nexport function findRootDirAndLockFiles(cwd: string): {\n lockFiles: string[]\n rootDir: string\n} {\n const lockFile = findRootLockFile(cwd)\n if (!lockFile)\n return {\n lockFiles: [],\n rootDir: cwd,\n }\n\n const lockFiles = [lockFile]\n while (true) {\n const lastLockFile = lockFiles[lockFiles.length - 1]\n const currentDir = dirname(lastLockFile)\n const parentDir = dirname(currentDir)\n\n // dirname('/')==='/' so if we happen to reach the FS root (as might happen in a container we need to quit to avoid looping forever\n if (parentDir === currentDir) break\n\n const newLockFile = findRootLockFile(parentDir)\n\n if (!newLockFile) break\n\n lockFiles.push(newLockFile)\n }\n\n return {\n lockFiles,\n rootDir: dirname(lockFiles[lockFiles.length - 1]),\n }\n}\n\nexport function warnDuplicatedLockFiles(lockFiles: string[]) {\n if (lockFiles.length > 1) {\n const additionalLockFiles = lockFiles\n .slice(0, -1)\n .map((str) => `\\n * ${str}`)\n .join('')\n\n if (process.env.TURBOPACK) {\n Log.warnOnce(\n `Warning: Next.js inferred your workspace root, but it may not be correct.\\n` +\n ` We detected multiple lockfiles and selected the directory of ${lockFiles[lockFiles.length - 1]} as the root directory.\\n` +\n ` To silence this warning, set \\`turbopack.root\\` in your Next.js config, or consider ` +\n `removing one of the lockfiles if it's not needed.\\n` +\n ` See https://nextjs.org/docs/app/api-reference/config/next-config-js/turbopack#root-directory for more information.\\n` +\n ` Detected additional lockfiles: ${additionalLockFiles}\\n`\n )\n } else {\n Log.warnOnce(\n `Warning: Next.js inferred your workspace root, but it may not be correct.\\n` +\n ` We detected multiple lockfiles and selected the directory of ${lockFiles[lockFiles.length - 1]} as the root directory.\\n` +\n ` To silence this warning, set \\`outputFileTracingRoot\\` in your Next.js config, or consider ` +\n `removing one of the lockfiles if it's not needed.\\n` +\n ` See https://nextjs.org/docs/app/api-reference/config/next-config-js/output#caveats for more information.\\n` +\n ` Detected additional lockfiles: ${additionalLockFiles}\\n`\n )\n }\n }\n}\n"],"names":["findRootDirAndLockFiles","findRootLockFile","warnDuplicatedLockFiles","cwd","findUp","sync","lockFile","lockFiles","rootDir","lastLockFile","length","currentDir","dirname","parentDir","newLockFile","push","additionalLockFiles","slice","map","str","join","process","env","TURBOPACK","Log","warnOnce"],"mappings":";;;;;;;;;;;;;;;;IAmBgBA,uBAAuB;eAAvBA;;IAfAC,gBAAgB;eAAhBA;;IAgDAC,uBAAuB;eAAvBA;;;sBApDQ;+DACL;6DACE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEd,SAASD,iBAAiBE,GAAW;IAC1C,OAAOC,eAAM,CAACC,IAAI,CAChB;QACE;QACA;QACA;QACA;QACA;KACD,EACD;QACEF;IACF;AAEJ;AAEO,SAASH,wBAAwBG,GAAW;IAIjD,MAAMG,WAAWL,iBAAiBE;IAClC,IAAI,CAACG,UACH,OAAO;QACLC,WAAW,EAAE;QACbC,SAASL;IACX;IAEF,MAAMI,YAAY;QAACD;KAAS;IAC5B,MAAO,KAAM;QACX,MAAMG,eAAeF,SAAS,CAACA,UAAUG,MAAM,GAAG,EAAE;QACpD,MAAMC,aAAaC,IAAAA,aAAO,EAACH;QAC3B,MAAMI,YAAYD,IAAAA,aAAO,EAACD;QAE1B,mIAAmI;QACnI,IAAIE,cAAcF,YAAY;QAE9B,MAAMG,cAAcb,iBAAiBY;QAErC,IAAI,CAACC,aAAa;QAElBP,UAAUQ,IAAI,CAACD;IACjB;IAEA,OAAO;QACLP;QACAC,SAASI,IAAAA,aAAO,EAACL,SAAS,CAACA,UAAUG,MAAM,GAAG,EAAE;IAClD;AACF;AAEO,SAASR,wBAAwBK,SAAmB;IACzD,IAAIA,UAAUG,MAAM,GAAG,GAAG;QACxB,MAAMM,sBAAsBT,UACzBU,KAAK,CAAC,GAAG,CAAC,GACVC,GAAG,CAAC,CAACC,MAAQ,CAAC,OAAO,EAAEA,KAAK,EAC5BC,IAAI,CAAC;QAER,IAAIC,QAAQC,GAAG,CAACC,SAAS,EAAE;YACzBC,KAAIC,QAAQ,CACV,CAAC,2EAA2E,CAAC,GAC3E,CAAC,8DAA8D,EAAElB,SAAS,CAACA,UAAUG,MAAM,GAAG,EAAE,CAAC,yBAAyB,CAAC,GAC3H,CAAC,qFAAqF,CAAC,GACvF,CAAC,mDAAmD,CAAC,GACrD,CAAC,uHAAuH,CAAC,GACzH,CAAC,gCAAgC,EAAEM,oBAAoB,EAAE,CAAC;QAEhE,OAAO;YACLQ,KAAIC,QAAQ,CACV,CAAC,2EAA2E,CAAC,GAC3E,CAAC,8DAA8D,EAAElB,SAAS,CAACA,UAAUG,MAAM,GAAG,EAAE,CAAC,yBAAyB,CAAC,GAC3H,CAAC,4FAA4F,CAAC,GAC9F,CAAC,mDAAmD,CAAC,GACrD,CAAC,6GAA6G,CAAC,GAC/G,CAAC,gCAAgC,EAAEM,oBAAoB,EAAE,CAAC;QAEhE;IACF;AACF","ignoreList":[0]}

View File

@@ -0,0 +1,3 @@
import type { Command, Help } from 'next/dist/compiled/commander';
declare const formatCliHelpOutput: (cmd: Command, helper: Help) => string;
export { formatCliHelpOutput };

View File

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

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../src/lib/format-cli-help-output.ts"],"sourcesContent":["import type { Command, Help } from 'next/dist/compiled/commander'\nimport { bold } from '../lib/picocolors'\n\n// Copy-pasted from Commander's Help class -> formatHelp().\n// TL;DR, we're overriding the built-in help to add a few niceties.\n// Link: https://github.com/tj/commander.js/blob/master/lib/help.js\nconst formatCliHelpOutput = (cmd: Command, helper: Help) => {\n const termWidth = helper.padWidth(cmd, helper)\n const helpWidth = helper.helpWidth || 80\n const itemIndentWidth = 2\n const itemSeparatorWidth = 2 // between term and description\n\n function formatItem(term: string, description: string) {\n let value = term\n\n if (description) {\n if (term === 'directory') {\n value = `[${term}]`\n }\n\n const fullText = `${value.padEnd(\n termWidth + itemSeparatorWidth\n )}${description}`\n\n return helper.wrap(\n fullText,\n helpWidth - itemIndentWidth,\n termWidth + itemSeparatorWidth\n )\n }\n\n return term\n }\n\n function formatList(textArray: string[]) {\n return textArray.join('\\n').replace(/^/gm, ' '.repeat(itemIndentWidth))\n }\n\n // Usage\n let output = [`${bold('Usage:')} ${helper.commandUsage(cmd)}`, '']\n\n // Description\n const commandDescription = helper.commandDescription(cmd)\n\n if (commandDescription.length > 0) {\n output = output.concat([helper.wrap(commandDescription, helpWidth, 0), ''])\n }\n\n // Arguments\n const argumentList = helper.visibleArguments(cmd).map((argument) => {\n return formatItem(\n helper.argumentTerm(argument),\n helper.argumentDescription(argument)\n )\n })\n\n if (argumentList.length > 0) {\n output = output.concat([\n `${bold('Arguments:')}`,\n formatList(argumentList),\n '',\n ])\n }\n\n // Options\n const optionList = helper.visibleOptions(cmd).map((option) => {\n return formatItem(\n helper.optionTerm(option),\n helper.optionDescription(option)\n )\n })\n\n if (optionList.length > 0) {\n output = output.concat([`${bold('Options:')}`, formatList(optionList), ''])\n }\n\n // Commands\n const commandList = helper.visibleCommands(cmd).map((subCmd) => {\n return formatItem(\n helper.subcommandTerm(subCmd),\n helper.subcommandDescription(subCmd)\n )\n })\n\n if (commandList.length > 0) {\n output = output.concat([\n `${bold('Commands:')}`,\n formatList(commandList),\n '',\n ])\n }\n\n return output.join('\\n')\n}\n\nexport { formatCliHelpOutput }\n"],"names":["formatCliHelpOutput","cmd","helper","termWidth","padWidth","helpWidth","itemIndentWidth","itemSeparatorWidth","formatItem","term","description","value","fullText","padEnd","wrap","formatList","textArray","join","replace","repeat","output","bold","commandUsage","commandDescription","length","concat","argumentList","visibleArguments","map","argument","argumentTerm","argumentDescription","optionList","visibleOptions","option","optionTerm","optionDescription","commandList","visibleCommands","subCmd","subcommandTerm","subcommandDescription"],"mappings":";;;;+BA+FSA;;;eAAAA;;;4BA9FY;AAErB,2DAA2D;AAC3D,mEAAmE;AACnE,mEAAmE;AACnE,MAAMA,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,GAAGD,MAAME,MAAM,CAC9BV,YAAYI,sBACVG,aAAa;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,GAAGC,IAAAA,gBAAI,EAAC,UAAU,CAAC,EAAEnB,OAAOoB,YAAY,CAACrB,MAAM;QAAE;KAAG;IAElE,cAAc;IACd,MAAMsB,qBAAqBrB,OAAOqB,kBAAkB,CAACtB;IAErD,IAAIsB,mBAAmBC,MAAM,GAAG,GAAG;QACjCJ,SAASA,OAAOK,MAAM,CAAC;YAACvB,OAAOY,IAAI,CAACS,oBAAoBlB,WAAW;YAAI;SAAG;IAC5E;IAEA,YAAY;IACZ,MAAMqB,eAAexB,OAAOyB,gBAAgB,CAAC1B,KAAK2B,GAAG,CAAC,CAACC;QACrD,OAAOrB,WACLN,OAAO4B,YAAY,CAACD,WACpB3B,OAAO6B,mBAAmB,CAACF;IAE/B;IAEA,IAAIH,aAAaF,MAAM,GAAG,GAAG;QAC3BJ,SAASA,OAAOK,MAAM,CAAC;YACrB,GAAGJ,IAAAA,gBAAI,EAAC,eAAe;YACvBN,WAAWW;YACX;SACD;IACH;IAEA,UAAU;IACV,MAAMM,aAAa9B,OAAO+B,cAAc,CAAChC,KAAK2B,GAAG,CAAC,CAACM;QACjD,OAAO1B,WACLN,OAAOiC,UAAU,CAACD,SAClBhC,OAAOkC,iBAAiB,CAACF;IAE7B;IAEA,IAAIF,WAAWR,MAAM,GAAG,GAAG;QACzBJ,SAASA,OAAOK,MAAM,CAAC;YAAC,GAAGJ,IAAAA,gBAAI,EAAC,aAAa;YAAEN,WAAWiB;YAAa;SAAG;IAC5E;IAEA,WAAW;IACX,MAAMK,cAAcnC,OAAOoC,eAAe,CAACrC,KAAK2B,GAAG,CAAC,CAACW;QACnD,OAAO/B,WACLN,OAAOsC,cAAc,CAACD,SACtBrC,OAAOuC,qBAAqB,CAACF;IAEjC;IAEA,IAAIF,YAAYb,MAAM,GAAG,GAAG;QAC1BJ,SAASA,OAAOK,MAAM,CAAC;YACrB,GAAGJ,IAAAA,gBAAI,EAAC,cAAc;YACtBN,WAAWsB;YACX;SACD;IACH;IAEA,OAAOjB,OAAOH,IAAI,CAAC;AACrB","ignoreList":[0]}

View File

@@ -0,0 +1,9 @@
/**
* 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 declare const formatDynamicImportPath: (dir: string, filePath: string) => string;

View File

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

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../src/lib/format-dynamic-import-path.ts"],"sourcesContent":["import path from 'path'\nimport { pathToFileURL } from 'url'\n\n/**\n * The path for a dynamic route must be URLs with a valid scheme.\n *\n * When an absolute Windows path is passed to it, it interprets the beginning of the path as a protocol (`C:`).\n * Therefore, it is important to always construct a complete path.\n * @param dir File directory\n * @param filePath Absolute or relative path\n */\nexport const formatDynamicImportPath = (dir: string, filePath: string) => {\n const absoluteFilePath = path.isAbsolute(filePath)\n ? filePath\n : path.join(dir, filePath)\n const formattedFilePath = pathToFileURL(absoluteFilePath).toString()\n\n return formattedFilePath\n}\n"],"names":["formatDynamicImportPath","dir","filePath","absoluteFilePath","path","isAbsolute","join","formattedFilePath","pathToFileURL","toString"],"mappings":";;;;+BAWaA;;;eAAAA;;;6DAXI;qBACa;;;;;;AAUvB,MAAMA,0BAA0B,CAACC,KAAaC;IACnD,MAAMC,mBAAmBC,aAAI,CAACC,UAAU,CAACH,YACrCA,WACAE,aAAI,CAACE,IAAI,CAACL,KAAKC;IACnB,MAAMK,oBAAoBC,IAAAA,kBAAa,EAACL,kBAAkBM,QAAQ;IAElE,OAAOF;AACT","ignoreList":[0]}

View File

@@ -0,0 +1,12 @@
/**
* 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 declare function getStackWithoutErrorMessage(error: Error): string;
export declare function formatServerError(error: Error): void;

View File

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

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../src/lib/format-server-error.ts"],"sourcesContent":["const invalidServerComponentReactHooks = [\n 'useDeferredValue',\n 'useEffect',\n 'useImperativeHandle',\n 'useInsertionEffect',\n 'useLayoutEffect',\n 'useReducer',\n 'useRef',\n 'useState',\n 'useSyncExternalStore',\n 'useTransition',\n 'experimental_useOptimistic',\n 'useOptimistic',\n]\n\nfunction setMessage(error: Error, message: string): void {\n error.message = message\n if (error.stack) {\n const lines = error.stack.split('\\n')\n lines[0] = message\n error.stack = lines.join('\\n')\n }\n}\n\n/**\n * Input:\n * Error: Something went wrong\n at funcName (/path/to/file.js:10:5)\n at anotherFunc (/path/to/file.js:15:10)\n \n * Output:\n at funcName (/path/to/file.js:10:5)\n at anotherFunc (/path/to/file.js:15:10) \n */\nexport function getStackWithoutErrorMessage(error: Error): string {\n const stack = error.stack\n if (!stack) return ''\n return stack.replace(/^[^\\n]*\\n/, '')\n}\n\nexport function formatServerError(error: Error): void {\n if (typeof error?.message !== 'string') return\n\n if (\n error.message.includes(\n 'Class extends value undefined is not a constructor or null'\n )\n ) {\n const addedMessage =\n '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'\n\n // If this error instance already has the message, don't add it again\n if (error.message.includes(addedMessage)) return\n\n setMessage(\n error,\n `${error.message}\n\n${addedMessage}`\n )\n return\n }\n\n if (error.message.includes('createContext is not a function')) {\n setMessage(\n error,\n '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'\n )\n return\n }\n\n for (const clientHook of invalidServerComponentReactHooks) {\n const regex = new RegExp(`\\\\b${clientHook}\\\\b.*is not a function`)\n if (regex.test(error.message)) {\n setMessage(\n error,\n `${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`\n )\n return\n }\n }\n}\n"],"names":["formatServerError","getStackWithoutErrorMessage","invalidServerComponentReactHooks","setMessage","error","message","stack","lines","split","join","replace","includes","addedMessage","clientHook","regex","RegExp","test"],"mappings":";;;;;;;;;;;;;;;IAwCgBA,iBAAiB;eAAjBA;;IANAC,2BAA2B;eAA3BA;;;AAlChB,MAAMC,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;AAYO,SAASR,4BAA4BG,KAAY;IACtD,MAAME,QAAQF,MAAME,KAAK;IACzB,IAAI,CAACA,OAAO,OAAO;IACnB,OAAOA,MAAMI,OAAO,CAAC,aAAa;AACpC;AAEO,SAASV,kBAAkBI,KAAY;IAC5C,IAAI,QAAOA,yBAAAA,MAAOC,OAAO,MAAK,UAAU;IAExC,IACED,MAAMC,OAAO,CAACM,QAAQ,CACpB,+DAEF;QACA,MAAMC,eACJ;QAEF,qEAAqE;QACrE,IAAIR,MAAMC,OAAO,CAACM,QAAQ,CAACC,eAAe;QAE1CT,WACEC,OACA,GAAGA,MAAMC,OAAO,CAAC;;AAEvB,EAAEO,cAAc;QAEZ;IACF;IAEA,IAAIR,MAAMC,OAAO,CAACM,QAAQ,CAAC,oCAAoC;QAC7DR,WACEC,OACA;QAEF;IACF;IAEA,KAAK,MAAMS,cAAcX,iCAAkC;QACzD,MAAMY,QAAQ,IAAIC,OAAO,CAAC,GAAG,EAAEF,WAAW,sBAAsB,CAAC;QACjE,IAAIC,MAAME,IAAI,CAACZ,MAAMC,OAAO,GAAG;YAC7BF,WACEC,OACA,GAAGS,WAAW,oLAAoL,CAAC;YAErM;QACF;IACF;AACF","ignoreList":[0]}

View File

@@ -0,0 +1,13 @@
import type { ReactNode } from 'react';
export declare const MetadataBoundary: ({ children }: {
children: ReactNode;
}) => ReactNode;
export declare const ViewportBoundary: ({ children }: {
children: ReactNode;
}) => ReactNode;
export declare const OutletBoundary: ({ children }: {
children: ReactNode;
}) => ReactNode;
export declare const RootLayoutBoundary: ({ children, }: {
children: ReactNode;
}) => ReactNode;

View File

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

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/lib/framework/boundary-components.tsx"],"sourcesContent":["'use client'\n\nimport type { ReactNode } from 'react'\nimport {\n METADATA_BOUNDARY_NAME,\n VIEWPORT_BOUNDARY_NAME,\n OUTLET_BOUNDARY_NAME,\n ROOT_LAYOUT_BOUNDARY_NAME,\n} from './boundary-constants'\n\n// We use a namespace object to allow us to recover the name of the function\n// at runtime even when production bundling/minification is used.\nconst NameSpace = {\n [METADATA_BOUNDARY_NAME]: function ({ children }: { children: ReactNode }) {\n return children\n },\n [VIEWPORT_BOUNDARY_NAME]: function ({ children }: { children: ReactNode }) {\n return children\n },\n [OUTLET_BOUNDARY_NAME]: function ({ children }: { children: ReactNode }) {\n return children\n },\n [ROOT_LAYOUT_BOUNDARY_NAME]: function ({\n children,\n }: {\n children: ReactNode\n }) {\n return children\n },\n}\n\nexport const MetadataBoundary =\n // We use slice(0) to trick the bundler into not inlining/minifying the function\n // so it retains the name inferred from the namespace object\n NameSpace[METADATA_BOUNDARY_NAME.slice(0) as typeof METADATA_BOUNDARY_NAME]\n\nexport const ViewportBoundary =\n // We use slice(0) to trick the bundler into not inlining/minifying the function\n // so it retains the name inferred from the namespace object\n NameSpace[VIEWPORT_BOUNDARY_NAME.slice(0) as typeof VIEWPORT_BOUNDARY_NAME]\n\nexport const OutletBoundary =\n // We use slice(0) to trick the bundler into not inlining/minifying the function\n // so it retains the name inferred from the namespace object\n NameSpace[OUTLET_BOUNDARY_NAME.slice(0) as typeof OUTLET_BOUNDARY_NAME]\n\nexport const RootLayoutBoundary =\n // We use slice(0) to trick the bundler into not inlining/minifying the function\n // so it retains the name inferred from the namespace object\n NameSpace[\n ROOT_LAYOUT_BOUNDARY_NAME.slice(0) as typeof ROOT_LAYOUT_BOUNDARY_NAME\n ]\n"],"names":["MetadataBoundary","OutletBoundary","RootLayoutBoundary","ViewportBoundary","NameSpace","METADATA_BOUNDARY_NAME","children","VIEWPORT_BOUNDARY_NAME","OUTLET_BOUNDARY_NAME","ROOT_LAYOUT_BOUNDARY_NAME","slice"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;IA+BaA,gBAAgB;eAAhBA;;IAUAC,cAAc;eAAdA;;IAKAC,kBAAkB;eAAlBA;;IAVAC,gBAAgB;eAAhBA;;;mCA5BN;AAEP,4EAA4E;AAC5E,iEAAiE;AACjE,MAAMC,YAAY;IAChB,CAACC,yCAAsB,CAAC,EAAE,SAAU,EAAEC,QAAQ,EAA2B;QACvE,OAAOA;IACT;IACA,CAACC,yCAAsB,CAAC,EAAE,SAAU,EAAED,QAAQ,EAA2B;QACvE,OAAOA;IACT;IACA,CAACE,uCAAoB,CAAC,EAAE,SAAU,EAAEF,QAAQ,EAA2B;QACrE,OAAOA;IACT;IACA,CAACG,4CAAyB,CAAC,EAAE,SAAU,EACrCH,QAAQ,EAGT;QACC,OAAOA;IACT;AACF;AAEO,MAAMN,mBACX,gFAAgF;AAChF,4DAA4D;AAC5DI,SAAS,CAACC,yCAAsB,CAACK,KAAK,CAAC,GAAoC;AAEtE,MAAMP,mBACX,gFAAgF;AAChF,4DAA4D;AAC5DC,SAAS,CAACG,yCAAsB,CAACG,KAAK,CAAC,GAAoC;AAEtE,MAAMT,iBACX,gFAAgF;AAChF,4DAA4D;AAC5DG,SAAS,CAACI,uCAAoB,CAACE,KAAK,CAAC,GAAkC;AAElE,MAAMR,qBACX,gFAAgF;AAChF,4DAA4D;AAC5DE,SAAS,CACPK,4CAAyB,CAACC,KAAK,CAAC,GACjC","ignoreList":[0]}

View File

@@ -0,0 +1,4 @@
export declare const METADATA_BOUNDARY_NAME = "__next_metadata_boundary__";
export declare const VIEWPORT_BOUNDARY_NAME = "__next_viewport_boundary__";
export declare const OUTLET_BOUNDARY_NAME = "__next_outlet_boundary__";
export declare const ROOT_LAYOUT_BOUNDARY_NAME = "__next_root_layout_boundary__";

View File

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

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/lib/framework/boundary-constants.tsx"],"sourcesContent":["export const METADATA_BOUNDARY_NAME = '__next_metadata_boundary__'\nexport const VIEWPORT_BOUNDARY_NAME = '__next_viewport_boundary__'\nexport const OUTLET_BOUNDARY_NAME = '__next_outlet_boundary__'\nexport const ROOT_LAYOUT_BOUNDARY_NAME = '__next_root_layout_boundary__'\n"],"names":["METADATA_BOUNDARY_NAME","OUTLET_BOUNDARY_NAME","ROOT_LAYOUT_BOUNDARY_NAME","VIEWPORT_BOUNDARY_NAME"],"mappings":";;;;;;;;;;;;;;;;;IAAaA,sBAAsB;eAAtBA;;IAEAC,oBAAoB;eAApBA;;IACAC,yBAAyB;eAAzBA;;IAFAC,sBAAsB;eAAtBA;;;AADN,MAAMH,yBAAyB;AAC/B,MAAMG,yBAAyB;AAC/B,MAAMF,uBAAuB;AAC7B,MAAMC,4BAA4B","ignoreList":[0]}

View File

@@ -0,0 +1,6 @@
/**
* 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 declare function renameSync(source: string, target: string, windowsRetryTimeout?: number | false): void;

View File

@@ -0,0 +1,87 @@
/*
MIT License
Copyright (c) 2015 - present Microsoft Corporation
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/ // This file is based on https://github.com/microsoft/vscode/blob/f860fcf11022f10a992440fd54c6e45674e39617/src/vs/base/node/pfs.ts
// See the LICENSE at the top of the file
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "renameSync", {
enumerable: true,
get: function() {
return renameSync;
}
});
const _nodefs = require("node:fs");
function renameSync(source, target, windowsRetryTimeout = 60000 /* matches graceful-fs */ ) {
if (source === target) {
return; // simulate node.js behaviour here and do a no-op if paths match
}
if (process.platform === 'win32' && typeof windowsRetryTimeout === 'number') {
// On Windows, a rename can fail when either source or target
// is locked by AV software. We do leverage graceful-fs to iron
// out these issues, however in case the target file exists,
// graceful-fs will immediately return without retry for fs.rename().
renameSyncWithRetry(source, target, Date.now(), windowsRetryTimeout);
} else {
(0, _nodefs.renameSync)(source, target);
}
}
function renameSyncWithRetry(source, target, startTime, retryTimeout, attempt = 0) {
try {
return (0, _nodefs.renameSync)(source, target);
} catch (error) {
if (error.code !== 'EACCES' && error.code !== 'EPERM' && error.code !== 'EBUSY') {
throw error // only for errors we think are temporary
;
}
if (Date.now() - startTime >= retryTimeout) {
console.error(`Node.js fs rename failed after ${attempt} retries with error: ${error}`);
throw error // give up after configurable timeout
;
}
if (attempt > 100) {
console.error(`Node.js fs rename failed after ${attempt} retries with error ${error}`);
throw error;
}
if (attempt === 0) {
let abortRetry = false;
try {
const statTarget = (0, _nodefs.statSync)(target);
if (!statTarget.isFile()) {
abortRetry = true // if target is not a file, EPERM error may be raised and we should not attempt to retry
;
}
} catch (e) {
// Ignore
}
if (abortRetry) {
throw error;
}
}
// Attempt again
return renameSyncWithRetry(source, target, startTime, retryTimeout, attempt + 1);
}
}
//# sourceMappingURL=rename.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
export declare function writeFileAtomic(filePath: string, content: string): void;

View File

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

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/lib/fs/write-atomic.ts"],"sourcesContent":["import { unlinkSync, writeFileSync } from 'fs'\nimport { renameSync } from './rename'\n\nexport function writeFileAtomic(filePath: string, content: string): void {\n const tempPath = filePath + '.tmp.' + Math.random().toString(36).slice(2)\n try {\n writeFileSync(tempPath, content, 'utf-8')\n renameSync(tempPath, filePath)\n } catch (e) {\n try {\n unlinkSync(tempPath)\n } catch {\n // ignore\n }\n throw e\n }\n}\n"],"names":["writeFileAtomic","filePath","content","tempPath","Math","random","toString","slice","writeFileSync","renameSync","e","unlinkSync"],"mappings":";;;;+BAGgBA;;;eAAAA;;;oBAH0B;wBACf;AAEpB,SAASA,gBAAgBC,QAAgB,EAAEC,OAAe;IAC/D,MAAMC,WAAWF,WAAW,UAAUG,KAAKC,MAAM,GAAGC,QAAQ,CAAC,IAAIC,KAAK,CAAC;IACvE,IAAI;QACFC,IAAAA,iBAAa,EAACL,UAAUD,SAAS;QACjCO,IAAAA,kBAAU,EAACN,UAAUF;IACvB,EAAE,OAAOS,GAAG;QACV,IAAI;YACFC,IAAAA,cAAU,EAACR;QACb,EAAE,OAAM;QACN,SAAS;QACX;QACA,MAAMO;IACR;AACF","ignoreList":[0]}

View File

@@ -0,0 +1,4 @@
import type { Rewrite } from './load-custom-routes';
import type { DeepReadonly } from '../shared/lib/deep-readonly';
export declare function generateInterceptionRoutesRewrites(appPaths: string[], basePath?: string): Rewrite[];
export declare function isInterceptionRouteRewrite(route: DeepReadonly<Rewrite>): boolean;

View File

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

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../src/lib/generate-interception-routes-rewrites.ts"],"sourcesContent":["import { NEXT_URL } from '../client/components/app-router-headers'\nimport {\n extractInterceptionRouteInformation,\n isInterceptionRouteAppPath,\n} from '../shared/lib/router/utils/interception-routes'\nimport type { Rewrite } from './load-custom-routes'\nimport type { DeepReadonly } from '../shared/lib/deep-readonly'\nimport { getNamedRouteRegex } from '../shared/lib/router/utils/route-regex'\n\nexport function generateInterceptionRoutesRewrites(\n appPaths: string[],\n basePath = ''\n): Rewrite[] {\n const rewrites: Rewrite[] = []\n\n for (const appPath of appPaths) {\n if (isInterceptionRouteAppPath(appPath)) {\n const { interceptingRoute, interceptedRoute } =\n extractInterceptionRouteInformation(appPath)\n\n const destination = getNamedRouteRegex(basePath + appPath, {\n prefixRouteKeys: true,\n })\n\n const header = getNamedRouteRegex(interceptingRoute, {\n prefixRouteKeys: true,\n reference: destination.reference,\n })\n\n const source = getNamedRouteRegex(basePath + interceptedRoute, {\n prefixRouteKeys: true,\n reference: header.reference,\n })\n\n const headerRegex = header.namedRegex\n // Strip ^ and $ anchors since matchHas() will add them automatically\n .replace(/^\\^/, '')\n .replace(/\\$$/, '')\n // Replace matching the `/` with matching any route segment.\n .replace(/^\\/\\(\\?:\\/\\)\\?$/, '/.*')\n // Replace the optional trailing with slash capture group with one that\n // will match any descendants.\n .replace(/\\(\\?:\\/\\)\\?$/, '(?:/.*)?')\n\n rewrites.push({\n source: source.pathToRegexpPattern,\n destination: destination.pathToRegexpPattern,\n has: [\n {\n type: 'header',\n key: NEXT_URL,\n value: headerRegex,\n },\n ],\n regex: source.namedRegex,\n })\n }\n }\n\n return rewrites\n}\n\nexport function isInterceptionRouteRewrite(route: DeepReadonly<Rewrite>) {\n // When we generate interception rewrites in the above implementation, we always do so with only a single `has` condition.\n return route.has?.[0]?.key === NEXT_URL\n}\n"],"names":["generateInterceptionRoutesRewrites","isInterceptionRouteRewrite","appPaths","basePath","rewrites","appPath","isInterceptionRouteAppPath","interceptingRoute","interceptedRoute","extractInterceptionRouteInformation","destination","getNamedRouteRegex","prefixRouteKeys","header","reference","source","headerRegex","namedRegex","replace","push","pathToRegexpPattern","has","type","key","NEXT_URL","value","regex","route"],"mappings":";;;;;;;;;;;;;;;IASgBA,kCAAkC;eAAlCA;;IAqDAC,0BAA0B;eAA1BA;;;kCA9DS;oCAIlB;4BAG4B;AAE5B,SAASD,mCACdE,QAAkB,EAClBC,WAAW,EAAE;IAEb,MAAMC,WAAsB,EAAE;IAE9B,KAAK,MAAMC,WAAWH,SAAU;QAC9B,IAAII,IAAAA,8CAA0B,EAACD,UAAU;YACvC,MAAM,EAAEE,iBAAiB,EAAEC,gBAAgB,EAAE,GAC3CC,IAAAA,uDAAmC,EAACJ;YAEtC,MAAMK,cAAcC,IAAAA,8BAAkB,EAACR,WAAWE,SAAS;gBACzDO,iBAAiB;YACnB;YAEA,MAAMC,SAASF,IAAAA,8BAAkB,EAACJ,mBAAmB;gBACnDK,iBAAiB;gBACjBE,WAAWJ,YAAYI,SAAS;YAClC;YAEA,MAAMC,SAASJ,IAAAA,8BAAkB,EAACR,WAAWK,kBAAkB;gBAC7DI,iBAAiB;gBACjBE,WAAWD,OAAOC,SAAS;YAC7B;YAEA,MAAME,cAAcH,OAAOI,UAAU,AACnC,qEAAqE;aACpEC,OAAO,CAAC,OAAO,IACfA,OAAO,CAAC,OAAO,GAChB,4DAA4D;aAC3DA,OAAO,CAAC,mBAAmB,MAC5B,uEAAuE;YACvE,8BAA8B;aAC7BA,OAAO,CAAC,gBAAgB;YAE3Bd,SAASe,IAAI,CAAC;gBACZJ,QAAQA,OAAOK,mBAAmB;gBAClCV,aAAaA,YAAYU,mBAAmB;gBAC5CC,KAAK;oBACH;wBACEC,MAAM;wBACNC,KAAKC,0BAAQ;wBACbC,OAAOT;oBACT;iBACD;gBACDU,OAAOX,OAAOE,UAAU;YAC1B;QACF;IACF;IAEA,OAAOb;AACT;AAEO,SAASH,2BAA2B0B,KAA4B;QAE9DA,aAAAA;IADP,0HAA0H;IAC1H,OAAOA,EAAAA,aAAAA,MAAMN,GAAG,sBAATM,cAAAA,UAAW,CAAC,EAAE,qBAAdA,YAAgBJ,GAAG,MAAKC,0BAAQ;AACzC","ignoreList":[0]}

View File

@@ -0,0 +1 @@
export declare function getFilesInDir(path: string): Promise<Set<string>>;

View File

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

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../src/lib/get-files-in-dir.ts"],"sourcesContent":["import { join } from 'path'\nimport fs from 'fs/promises'\nimport type { Dirent, StatsBase } from 'fs'\n\nexport async function getFilesInDir(path: string): Promise<Set<string>> {\n const dir = await fs.opendir(path)\n const results = new Set<string>()\n\n for await (const file of dir) {\n let resolvedFile: Dirent | StatsBase<number> = file\n\n if (file.isSymbolicLink()) {\n resolvedFile = await fs.stat(join(path, file.name))\n }\n\n if (resolvedFile.isFile()) {\n results.add(file.name)\n }\n }\n\n return results\n}\n"],"names":["getFilesInDir","path","dir","fs","opendir","results","Set","file","resolvedFile","isSymbolicLink","stat","join","name","isFile","add"],"mappings":";;;;+BAIsBA;;;eAAAA;;;sBAJD;iEACN;;;;;;AAGR,eAAeA,cAAcC,IAAY;IAC9C,MAAMC,MAAM,MAAMC,iBAAE,CAACC,OAAO,CAACH;IAC7B,MAAMI,UAAU,IAAIC;IAEpB,WAAW,MAAMC,QAAQL,IAAK;QAC5B,IAAIM,eAA2CD;QAE/C,IAAIA,KAAKE,cAAc,IAAI;YACzBD,eAAe,MAAML,iBAAE,CAACO,IAAI,CAACC,IAAAA,UAAI,EAACV,MAAMM,KAAKK,IAAI;QACnD;QAEA,IAAIJ,aAAaK,MAAM,IAAI;YACzBR,QAAQS,GAAG,CAACP,KAAKK,IAAI;QACvB;IACF;IAEA,OAAOP;AACT","ignoreList":[0]}

View File

@@ -0,0 +1 @@
export declare function getNetworkHost(family: 'IPv4' | 'IPv6'): string | null;

View File

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

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../src/lib/get-network-host.ts"],"sourcesContent":["import os from 'os'\n\nfunction getNetworkHosts(family: 'IPv4' | 'IPv6'): string[] {\n const interfaces = os.networkInterfaces()\n const hosts: string[] = []\n\n Object.keys(interfaces).forEach((key) => {\n interfaces[key]\n ?.filter((networkInterface) => {\n switch (networkInterface.family) {\n case 'IPv6':\n return (\n family === 'IPv6' &&\n networkInterface.scopeid === 0 &&\n networkInterface.address !== '::1'\n )\n case 'IPv4':\n return family === 'IPv4' && networkInterface.address !== '127.0.0.1'\n default:\n return false\n }\n })\n .forEach((networkInterface) => {\n if (networkInterface.address) {\n hosts.push(networkInterface.address)\n }\n })\n })\n\n return hosts\n}\n\nexport function getNetworkHost(family: 'IPv4' | 'IPv6'): string | null {\n const hosts = getNetworkHosts(family)\n return hosts[0] ?? null\n}\n"],"names":["getNetworkHost","getNetworkHosts","family","interfaces","os","networkInterfaces","hosts","Object","keys","forEach","key","filter","networkInterface","scopeid","address","push"],"mappings":";;;;+BAgCgBA;;;eAAAA;;;2DAhCD;;;;;;AAEf,SAASC,gBAAgBC,MAAuB;IAC9C,MAAMC,aAAaC,WAAE,CAACC,iBAAiB;IACvC,MAAMC,QAAkB,EAAE;IAE1BC,OAAOC,IAAI,CAACL,YAAYM,OAAO,CAAC,CAACC;YAC/BP;SAAAA,kBAAAA,UAAU,CAACO,IAAI,qBAAfP,gBACIQ,MAAM,CAAC,CAACC;YACR,OAAQA,iBAAiBV,MAAM;gBAC7B,KAAK;oBACH,OACEA,WAAW,UACXU,iBAAiBC,OAAO,KAAK,KAC7BD,iBAAiBE,OAAO,KAAK;gBAEjC,KAAK;oBACH,OAAOZ,WAAW,UAAUU,iBAAiBE,OAAO,KAAK;gBAC3D;oBACE,OAAO;YACX;QACF,GACCL,OAAO,CAAC,CAACG;YACR,IAAIA,iBAAiBE,OAAO,EAAE;gBAC5BR,MAAMS,IAAI,CAACH,iBAAiBE,OAAO;YACrC;QACF;IACJ;IAEA,OAAOR;AACT;AAEO,SAASN,eAAeE,MAAuB;IACpD,MAAMI,QAAQL,gBAAgBC;IAC9B,OAAOI,KAAK,CAAC,EAAE,IAAI;AACrB","ignoreList":[0]}

View File

@@ -0,0 +1,12 @@
type PackageJsonDependencies = {
dependencies: Record<string, string>;
devDependencies: Record<string, string>;
};
export declare function getDependencies({ cwd, }: {
cwd: string;
}): Promise<PackageJsonDependencies>;
export declare function getPackageVersion({ cwd, name, }: {
cwd: string;
name: string;
}): Promise<string | null>;
export {};

View File

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

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../src/lib/get-package-version.ts"],"sourcesContent":["import { promises as fs } from 'fs'\nimport findUp from 'next/dist/compiled/find-up'\nimport JSON5 from 'next/dist/compiled/json5'\nimport * as path from 'path'\n\ntype PackageJsonDependencies = {\n dependencies: Record<string, string>\n devDependencies: Record<string, string>\n}\n\nlet cachedDeps: Promise<PackageJsonDependencies>\n\nexport function getDependencies({\n cwd,\n}: {\n cwd: string\n}): Promise<PackageJsonDependencies> {\n if (cachedDeps) {\n return cachedDeps\n }\n\n return (cachedDeps = (async () => {\n const configurationPath: string | undefined = await findUp('package.json', {\n cwd,\n })\n if (!configurationPath) {\n return { dependencies: {}, devDependencies: {} }\n }\n\n const content = await fs.readFile(configurationPath, 'utf-8')\n const packageJson: any = JSON5.parse(content)\n\n const { dependencies = {}, devDependencies = {} } = packageJson || {}\n return { dependencies, devDependencies }\n })())\n}\n\nexport async function getPackageVersion({\n cwd,\n name,\n}: {\n cwd: string\n name: string\n}): Promise<string | null> {\n const { dependencies, devDependencies } = await getDependencies({ cwd })\n if (!(dependencies[name] || devDependencies[name])) {\n return null\n }\n\n const cwd2 =\n cwd.endsWith(path.posix.sep) || cwd.endsWith(path.win32.sep)\n ? cwd\n : `${cwd}/`\n\n try {\n const targetPath = require.resolve(`${name}/package.json`, {\n paths: [cwd2],\n })\n const targetContent = await fs.readFile(targetPath, 'utf-8')\n return JSON5.parse(targetContent).version ?? null\n } catch {\n return null\n }\n}\n"],"names":["getDependencies","getPackageVersion","cachedDeps","cwd","configurationPath","findUp","dependencies","devDependencies","content","fs","readFile","packageJson","JSON5","parse","name","cwd2","endsWith","path","posix","sep","win32","targetPath","require","resolve","paths","targetContent","version"],"mappings":";;;;;;;;;;;;;;;IAYgBA,eAAe;eAAfA;;IAyBMC,iBAAiB;eAAjBA;;;oBArCS;+DACZ;8DACD;8DACI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOtB,IAAIC;AAEG,SAASF,gBAAgB,EAC9BG,GAAG,EAGJ;IACC,IAAID,YAAY;QACd,OAAOA;IACT;IAEA,OAAQA,aAAa,AAAC,CAAA;QACpB,MAAME,oBAAwC,MAAMC,IAAAA,eAAM,EAAC,gBAAgB;YACzEF;QACF;QACA,IAAI,CAACC,mBAAmB;YACtB,OAAO;gBAAEE,cAAc,CAAC;gBAAGC,iBAAiB,CAAC;YAAE;QACjD;QAEA,MAAMC,UAAU,MAAMC,YAAE,CAACC,QAAQ,CAACN,mBAAmB;QACrD,MAAMO,cAAmBC,cAAK,CAACC,KAAK,CAACL;QAErC,MAAM,EAAEF,eAAe,CAAC,CAAC,EAAEC,kBAAkB,CAAC,CAAC,EAAE,GAAGI,eAAe,CAAC;QACpE,OAAO;YAAEL;YAAcC;QAAgB;IACzC,CAAA;AACF;AAEO,eAAeN,kBAAkB,EACtCE,GAAG,EACHW,IAAI,EAIL;IACC,MAAM,EAAER,YAAY,EAAEC,eAAe,EAAE,GAAG,MAAMP,gBAAgB;QAAEG;IAAI;IACtE,IAAI,CAAEG,CAAAA,YAAY,CAACQ,KAAK,IAAIP,eAAe,CAACO,KAAK,AAAD,GAAI;QAClD,OAAO;IACT;IAEA,MAAMC,OACJZ,IAAIa,QAAQ,CAACC,MAAKC,KAAK,CAACC,GAAG,KAAKhB,IAAIa,QAAQ,CAACC,MAAKG,KAAK,CAACD,GAAG,IACvDhB,MACA,GAAGA,IAAI,CAAC,CAAC;IAEf,IAAI;QACF,MAAMkB,aAAaC,QAAQC,OAAO,CAAC,GAAGT,KAAK,aAAa,CAAC,EAAE;YACzDU,OAAO;gBAACT;aAAK;QACf;QACA,MAAMU,gBAAgB,MAAMhB,YAAE,CAACC,QAAQ,CAACW,YAAY;QACpD,OAAOT,cAAK,CAACC,KAAK,CAACY,eAAeC,OAAO,IAAI;IAC/C,EAAE,OAAM;QACN,OAAO;IACT;AACF","ignoreList":[0]}

View File

@@ -0,0 +1 @@
export declare function getProjectDir(dir?: string, exitOnEnoent?: boolean): string;

View File

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

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../src/lib/get-project-dir.ts"],"sourcesContent":["import path from 'path'\nimport { warn } from '../build/output/log'\nimport { detectTypo } from './detect-typo'\nimport { realpathSync } from './realpath'\nimport { printAndExit } from '../server/lib/utils'\n\nexport function getProjectDir(dir?: string, exitOnEnoent = true) {\n const resolvedDir = path.resolve(dir || '.')\n try {\n const realDir = realpathSync(resolvedDir)\n\n if (\n resolvedDir !== realDir &&\n resolvedDir.toLowerCase() === realDir.toLowerCase()\n ) {\n warn(\n `Invalid casing detected for project dir, received ${resolvedDir} actual path ${realDir}, see more info here https://nextjs.org/docs/messages/invalid-project-dir-casing`\n )\n }\n\n return realDir\n } catch (err: any) {\n if (err.code === 'ENOENT' && exitOnEnoent) {\n if (typeof dir === 'string') {\n const detectedTypo = detectTypo(dir, [\n 'build',\n 'dev',\n 'info',\n 'lint',\n 'start',\n 'telemetry',\n 'experimental-test',\n ])\n\n if (detectedTypo) {\n return printAndExit(\n `\"next ${dir}\" does not exist. Did you mean \"next ${detectedTypo}\"?`\n )\n }\n }\n\n return printAndExit(\n `Invalid project directory provided, no such directory: ${resolvedDir}`\n )\n }\n throw err\n }\n}\n"],"names":["getProjectDir","dir","exitOnEnoent","resolvedDir","path","resolve","realDir","realpathSync","toLowerCase","warn","err","code","detectedTypo","detectTypo","printAndExit"],"mappings":";;;;+BAMgBA;;;eAAAA;;;6DANC;qBACI;4BACM;0BACE;uBACA;;;;;;AAEtB,SAASA,cAAcC,GAAY,EAAEC,eAAe,IAAI;IAC7D,MAAMC,cAAcC,aAAI,CAACC,OAAO,CAACJ,OAAO;IACxC,IAAI;QACF,MAAMK,UAAUC,IAAAA,sBAAY,EAACJ;QAE7B,IACEA,gBAAgBG,WAChBH,YAAYK,WAAW,OAAOF,QAAQE,WAAW,IACjD;YACAC,IAAAA,SAAI,EACF,CAAC,kDAAkD,EAAEN,YAAY,aAAa,EAAEG,QAAQ,gFAAgF,CAAC;QAE7K;QAEA,OAAOA;IACT,EAAE,OAAOI,KAAU;QACjB,IAAIA,IAAIC,IAAI,KAAK,YAAYT,cAAc;YACzC,IAAI,OAAOD,QAAQ,UAAU;gBAC3B,MAAMW,eAAeC,IAAAA,sBAAU,EAACZ,KAAK;oBACnC;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;iBACD;gBAED,IAAIW,cAAc;oBAChB,OAAOE,IAAAA,mBAAY,EACjB,CAAC,MAAM,EAAEb,IAAI,qCAAqC,EAAEW,aAAa,EAAE,CAAC;gBAExE;YACF;YAEA,OAAOE,IAAAA,mBAAY,EACjB,CAAC,uDAAuD,EAAEX,aAAa;QAE3E;QACA,MAAMO;IACR;AACF","ignoreList":[0]}

View File

@@ -0,0 +1,26 @@
export interface MissingDependency {
file: string;
/**
* The package's package.json (e.g. require(`${pkg}/package.json`)) MUST resolve.
* If `exportsRestrict` is false, `${file}` MUST also resolve.
*/
pkg: string;
/**
* If true, the pkg's package.json needs to be resolvable.
* If true, will resolve `file` relative to the real path of the package.json.
*
* For example, `{ file: '@types/react/index.d.ts', pkg: '@types/react', exportsRestrict: true }`
* will try to resolve '@types/react/package.json' first and then assume `@types/react/index.d.ts`
* resolves to `path.join(dirname(resolvedPackageJsonPath), 'index.d.ts')`.
*
* If false, will resolve `file` relative to the baseDir.
* ForFor example, `{ file: '@types/react/index.d.ts', pkg: '@types/react', exportsRestrict: true }`
* will try to resolve `@types/react/index.d.ts` directly.
*/
exportsRestrict: boolean;
}
export type NecessaryDependencies = {
resolved: Map<string, string>;
missing: MissingDependency[];
};
export declare function hasNecessaryDependencies(baseDir: string, requiredPackages: MissingDependency[]): NecessaryDependencies;

View File

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

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../src/lib/has-necessary-dependencies.ts"],"sourcesContent":["import { existsSync, realpathSync } from 'fs'\nimport { resolveFrom } from './resolve-from'\nimport { dirname, join, relative } from 'path'\n\nexport interface MissingDependency {\n file: string\n /**\n * The package's package.json (e.g. require(`${pkg}/package.json`)) MUST resolve.\n * If `exportsRestrict` is false, `${file}` MUST also resolve.\n */\n pkg: string\n /**\n * If true, the pkg's package.json needs to be resolvable.\n * If true, will resolve `file` relative to the real path of the package.json.\n *\n * For example, `{ file: '@types/react/index.d.ts', pkg: '@types/react', exportsRestrict: true }`\n * will try to resolve '@types/react/package.json' first and then assume `@types/react/index.d.ts`\n * resolves to `path.join(dirname(resolvedPackageJsonPath), 'index.d.ts')`.\n *\n * If false, will resolve `file` relative to the baseDir.\n * ForFor example, `{ file: '@types/react/index.d.ts', pkg: '@types/react', exportsRestrict: true }`\n * will try to resolve `@types/react/index.d.ts` directly.\n */\n exportsRestrict: boolean\n}\n\nexport type NecessaryDependencies = {\n resolved: Map<string, string>\n missing: MissingDependency[]\n}\n\nexport function hasNecessaryDependencies(\n baseDir: string,\n requiredPackages: MissingDependency[]\n): NecessaryDependencies {\n let resolutions = new Map<string, string>()\n const missingPackages: MissingDependency[] = []\n\n for (const p of requiredPackages) {\n try {\n const pkgPath = realpathSync(\n resolveFrom(baseDir, `${p.pkg}/package.json`)\n )\n const pkgDir = dirname(pkgPath)\n\n resolutions.set(join(p.pkg, 'package.json'), pkgPath)\n\n if (p.exportsRestrict) {\n const fileNameToVerify = relative(p.pkg, p.file)\n if (fileNameToVerify) {\n const fileToVerify = join(pkgDir, fileNameToVerify)\n if (existsSync(fileToVerify)) {\n resolutions.set(p.pkg, fileToVerify)\n } else {\n missingPackages.push(p)\n continue\n }\n } else {\n resolutions.set(p.pkg, pkgPath)\n }\n } else {\n resolutions.set(p.pkg, resolveFrom(baseDir, p.file))\n }\n } catch (_) {\n missingPackages.push(p)\n continue\n }\n }\n\n return {\n resolved: resolutions,\n missing: missingPackages,\n }\n}\n"],"names":["hasNecessaryDependencies","baseDir","requiredPackages","resolutions","Map","missingPackages","p","pkgPath","realpathSync","resolveFrom","pkg","pkgDir","dirname","set","join","exportsRestrict","fileNameToVerify","relative","file","fileToVerify","existsSync","push","_","resolved","missing"],"mappings":";;;;+BA+BgBA;;;eAAAA;;;oBA/ByB;6BACb;sBACY;AA6BjC,SAASA,yBACdC,OAAe,EACfC,gBAAqC;IAErC,IAAIC,cAAc,IAAIC;IACtB,MAAMC,kBAAuC,EAAE;IAE/C,KAAK,MAAMC,KAAKJ,iBAAkB;QAChC,IAAI;YACF,MAAMK,UAAUC,IAAAA,gBAAY,EAC1BC,IAAAA,wBAAW,EAACR,SAAS,GAAGK,EAAEI,GAAG,CAAC,aAAa,CAAC;YAE9C,MAAMC,SAASC,IAAAA,aAAO,EAACL;YAEvBJ,YAAYU,GAAG,CAACC,IAAAA,UAAI,EAACR,EAAEI,GAAG,EAAE,iBAAiBH;YAE7C,IAAID,EAAES,eAAe,EAAE;gBACrB,MAAMC,mBAAmBC,IAAAA,cAAQ,EAACX,EAAEI,GAAG,EAAEJ,EAAEY,IAAI;gBAC/C,IAAIF,kBAAkB;oBACpB,MAAMG,eAAeL,IAAAA,UAAI,EAACH,QAAQK;oBAClC,IAAII,IAAAA,cAAU,EAACD,eAAe;wBAC5BhB,YAAYU,GAAG,CAACP,EAAEI,GAAG,EAAES;oBACzB,OAAO;wBACLd,gBAAgBgB,IAAI,CAACf;wBACrB;oBACF;gBACF,OAAO;oBACLH,YAAYU,GAAG,CAACP,EAAEI,GAAG,EAAEH;gBACzB;YACF,OAAO;gBACLJ,YAAYU,GAAG,CAACP,EAAEI,GAAG,EAAED,IAAAA,wBAAW,EAACR,SAASK,EAAEY,IAAI;YACpD;QACF,EAAE,OAAOI,GAAG;YACVjB,gBAAgBgB,IAAI,CAACf;YACrB;QACF;IACF;IAEA,OAAO;QACLiB,UAAUpB;QACVqB,SAASnB;IACX;AACF","ignoreList":[0]}

View File

@@ -0,0 +1 @@
export declare function getCacheDirectory(fileDirectory: string, envPath?: string): string;

View File

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

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/lib/helpers/get-cache-directory.ts"],"sourcesContent":["import os from 'os'\nimport path from 'path'\nimport fs from 'fs'\n\n// get platform specific cache directory adapted from playwright's handling\n// https://github.com/microsoft/playwright/blob/7d924470d397975a74a19184c136b3573a974e13/packages/playwright-core/src/utils/registry.ts#L141\nexport function getCacheDirectory(fileDirectory: string, envPath?: string) {\n let result\n\n if (envPath) {\n result = envPath\n } else {\n let systemCacheDirectory\n if (process.platform === 'linux') {\n systemCacheDirectory =\n process.env.XDG_CACHE_HOME || path.join(os.homedir(), '.cache')\n } else if (process.platform === 'darwin') {\n systemCacheDirectory = path.join(os.homedir(), 'Library', 'Caches')\n } else if (process.platform === 'win32') {\n systemCacheDirectory =\n process.env.LOCALAPPDATA || path.join(os.homedir(), 'AppData', 'Local')\n } else {\n /// Attempt to use generic tmp location for un-handled platform\n if (!systemCacheDirectory) {\n for (const dir of [\n path.join(os.homedir(), '.cache'),\n path.join(os.tmpdir()),\n ]) {\n if (fs.existsSync(dir)) {\n systemCacheDirectory = dir\n break\n }\n }\n }\n\n if (!systemCacheDirectory) {\n console.error(new Error('Unsupported platform: ' + process.platform))\n process.exit(0)\n }\n }\n result = path.join(systemCacheDirectory, fileDirectory)\n }\n\n if (!path.isAbsolute(result)) {\n // It is important to resolve to the absolute path:\n // - for unzipping to work correctly;\n // - so that registry directory matches between installation and execution.\n // INIT_CWD points to the root of `npm/yarn install` and is probably what\n // the user meant when typing the relative path.\n result = path.resolve(process.env['INIT_CWD'] || process.cwd(), result)\n }\n return result\n}\n"],"names":["getCacheDirectory","fileDirectory","envPath","result","systemCacheDirectory","process","platform","env","XDG_CACHE_HOME","path","join","os","homedir","LOCALAPPDATA","dir","tmpdir","fs","existsSync","console","error","Error","exit","isAbsolute","resolve","cwd"],"mappings":";;;;+BAMgBA;;;eAAAA;;;2DAND;6DACE;2DACF;;;;;;AAIR,SAASA,kBAAkBC,aAAqB,EAAEC,OAAgB;IACvE,IAAIC;IAEJ,IAAID,SAAS;QACXC,SAASD;IACX,OAAO;QACL,IAAIE;QACJ,IAAIC,QAAQC,QAAQ,KAAK,SAAS;YAChCF,uBACEC,QAAQE,GAAG,CAACC,cAAc,IAAIC,aAAI,CAACC,IAAI,CAACC,WAAE,CAACC,OAAO,IAAI;QAC1D,OAAO,IAAIP,QAAQC,QAAQ,KAAK,UAAU;YACxCF,uBAAuBK,aAAI,CAACC,IAAI,CAACC,WAAE,CAACC,OAAO,IAAI,WAAW;QAC5D,OAAO,IAAIP,QAAQC,QAAQ,KAAK,SAAS;YACvCF,uBACEC,QAAQE,GAAG,CAACM,YAAY,IAAIJ,aAAI,CAACC,IAAI,CAACC,WAAE,CAACC,OAAO,IAAI,WAAW;QACnE,OAAO;YACL,+DAA+D;YAC/D,IAAI,CAACR,sBAAsB;gBACzB,KAAK,MAAMU,OAAO;oBAChBL,aAAI,CAACC,IAAI,CAACC,WAAE,CAACC,OAAO,IAAI;oBACxBH,aAAI,CAACC,IAAI,CAACC,WAAE,CAACI,MAAM;iBACpB,CAAE;oBACD,IAAIC,WAAE,CAACC,UAAU,CAACH,MAAM;wBACtBV,uBAAuBU;wBACvB;oBACF;gBACF;YACF;YAEA,IAAI,CAACV,sBAAsB;gBACzBc,QAAQC,KAAK,CAAC,qBAAsD,CAAtD,IAAIC,MAAM,2BAA2Bf,QAAQC,QAAQ,GAArD,qBAAA;2BAAA;gCAAA;kCAAA;gBAAqD;gBACnED,QAAQgB,IAAI,CAAC;YACf;QACF;QACAlB,SAASM,aAAI,CAACC,IAAI,CAACN,sBAAsBH;IAC3C;IAEA,IAAI,CAACQ,aAAI,CAACa,UAAU,CAACnB,SAAS;QAC5B,mDAAmD;QACnD,uCAAuC;QACvC,6EAA6E;QAC7E,yEAAyE;QACzE,gDAAgD;QAChDA,SAASM,aAAI,CAACc,OAAO,CAAClB,QAAQE,GAAG,CAAC,WAAW,IAAIF,QAAQmB,GAAG,IAAIrB;IAClE;IACA,OAAOA;AACT","ignoreList":[0]}

View File

@@ -0,0 +1 @@
export declare function getNpxCommand(baseDir: string): string;

View File

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

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/lib/helpers/get-npx-command.ts"],"sourcesContent":["import { execSync } from 'child_process'\nimport { getPkgManager } from './get-pkg-manager'\n\nexport function getNpxCommand(baseDir: string) {\n const pkgManager = getPkgManager(baseDir)\n let command = 'npx --yes'\n if (pkgManager === 'pnpm') {\n command = 'pnpm --silent dlx'\n } else if (pkgManager === 'yarn') {\n try {\n execSync('yarn dlx --help', { stdio: 'ignore' })\n command = 'yarn --quiet dlx'\n } catch {}\n }\n\n return command\n}\n"],"names":["getNpxCommand","baseDir","pkgManager","getPkgManager","command","execSync","stdio"],"mappings":";;;;+BAGgBA;;;eAAAA;;;+BAHS;+BACK;AAEvB,SAASA,cAAcC,OAAe;IAC3C,MAAMC,aAAaC,IAAAA,4BAAa,EAACF;IACjC,IAAIG,UAAU;IACd,IAAIF,eAAe,QAAQ;QACzBE,UAAU;IACZ,OAAO,IAAIF,eAAe,QAAQ;QAChC,IAAI;YACFG,IAAAA,uBAAQ,EAAC,mBAAmB;gBAAEC,OAAO;YAAS;YAC9CF,UAAU;QACZ,EAAE,OAAM,CAAC;IACX;IAEA,OAAOA;AACT","ignoreList":[0]}

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