main repo

This commit is contained in:
Basilosaurusrex
2025-11-24 18:09:40 +01:00
parent b636ee5e70
commit f027651f9b
34146 changed files with 4436636 additions and 0 deletions

View File

@@ -0,0 +1,49 @@
import os from "os";
import path from "path";
import { fileExists } from "../file-exists";
// get platform specific cache directory adapted from playwright's handling
// https://github.com/microsoft/playwright/blob/7d924470d397975a74a19184c136b3573a974e13/packages/playwright-core/src/utils/registry.ts#L141
export async function getCacheDirectory(fileDirectory, envPath) {
let result;
if (envPath) {
result = envPath;
} else {
let systemCacheDirectory;
if (process.platform === "linux") {
systemCacheDirectory = process.env.XDG_CACHE_HOME || path.join(os.homedir(), ".cache");
} else if (process.platform === "darwin") {
systemCacheDirectory = path.join(os.homedir(), "Library", "Caches");
} else if (process.platform === "win32") {
systemCacheDirectory = process.env.LOCALAPPDATA || path.join(os.homedir(), "AppData", "Local");
} else {
/// Attempt to use generic tmp location for un-handled platform
if (!systemCacheDirectory) {
for (const dir of [
path.join(os.homedir(), ".cache"),
path.join(os.tmpdir())
]){
if (await fileExists(dir)) {
systemCacheDirectory = dir;
break;
}
}
}
if (!systemCacheDirectory) {
console.error(new Error("Unsupported platform: " + process.platform));
process.exit(0);
}
}
result = path.join(systemCacheDirectory, fileDirectory);
}
if (!path.isAbsolute(result)) {
// It is important to resolve to the absolute path:
// - for unzipping to work correctly;
// - so that registry directory matches between installation and execution.
// INIT_CWD points to the root of `npm/yarn install` and is probably what
// the user meant when typing the relative path.
result = path.resolve(process.env["INIT_CWD"] || process.cwd(), result);
}
return result;
}
//# sourceMappingURL=get-cache-directory.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/lib/helpers/get-cache-directory.ts"],"names":["os","path","fileExists","getCacheDirectory","fileDirectory","envPath","result","systemCacheDirectory","process","platform","env","XDG_CACHE_HOME","join","homedir","LOCALAPPDATA","dir","tmpdir","console","error","Error","exit","isAbsolute","resolve","cwd"],"mappings":"AAAA,OAAOA,QAAQ,KAAI;AACnB,OAAOC,UAAU,OAA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View File

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

View File

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

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

@@ -0,0 +1,36 @@
import { execSync } from "child_process";
import dns from "dns";
import url from "url";
function getProxy() {
if (process.env.https_proxy) {
return process.env.https_proxy;
}
try {
const httpsProxy = execSync("npm config get https-proxy").toString().trim();
return httpsProxy !== "null" ? httpsProxy : undefined;
} catch (e) {
return;
}
}
export function getOnline() {
return new Promise((resolve)=>{
dns.lookup("registry.yarnpkg.com", (registryErr)=>{
if (!registryErr) {
return resolve(true);
}
const proxy = getProxy();
if (!proxy) {
return resolve(false);
}
const { hostname } = url.parse(proxy);
if (!hostname) {
return resolve(false);
}
dns.lookup(hostname, (proxyErr)=>{
resolve(proxyErr == null);
});
});
});
}
//# sourceMappingURL=get-online.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/lib/helpers/get-online.ts"],"names":["execSync","dns","url","getProxy","process","env","https_proxy","httpsProxy","toString","trim","undefined","e","getOnline","Promise","resolve","lookup","registryErr","proxy","hostname","parse","proxyErr"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,gBAAe;AACxC,OAAOC,SAAS,MAAK;AACrB,OAAOC,SAAS,MAAK;AAErB,SAASC;IACP,IAAIC,QAAQC,GAAG,CAACC,WAAW,EAAE;QAC3B,OAAOF,QAAQC,GAAG,CAACC,WAAW;IAChC;IAEA,IAAI;QACF,MAAMC,aAAaP,SAAS,8BAA8BQ,QAAQ,GAAGC,IAAI;QACzE,OAAOF,eAAe,SAASA,aAAaG;IAC9C,EAAE,OAAOC,GAAG;QACV;IACF;AACF;AAEA,OAAO,SAASC;IACd,OAAO,IAAIC,QAAQ,CAACC;QAClBb,IAAIc,MAAM,CAAC,wBAAwB,CAACC;YAClC,IAAI,CAACA,aAAa;gBAChB,OAAOF,QAAQ;YACjB;YAEA,MAAMG,QAAQd;YACd,IAAI,CAACc,OAAO;gBACV,OAAOH,QAAQ;YACjB;YAEA,MAAM,EAAEI,QAAQ,EAAE,GAAGhB,IAAIiB,KAAK,CAACF;YAC/B,IAAI,CAACC,UAAU;gBACb,OAAOJ,QAAQ;YACjB;YAEAb,IAAIc,MAAM,CAACG,UAAU,CAACE;gBACpBN,QAAQM,YAAY;YACtB;QACF;IACF;AACF"}

View File

@@ -0,0 +1,48 @@
import fs from "fs";
import path from "path";
import { execSync } from "child_process";
export function getPkgManager(baseDir) {
try {
for (const { lockFile, packageManager } of [
{
lockFile: "yarn.lock",
packageManager: "yarn"
},
{
lockFile: "pnpm-lock.yaml",
packageManager: "pnpm"
},
{
lockFile: "package-lock.json",
packageManager: "npm"
}
]){
if (fs.existsSync(path.join(baseDir, lockFile))) {
return packageManager;
}
}
const userAgent = process.env.npm_config_user_agent;
if (userAgent) {
if (userAgent.startsWith("yarn")) {
return "yarn";
} else if (userAgent.startsWith("pnpm")) {
return "pnpm";
}
}
try {
execSync("yarn --version", {
stdio: "ignore"
});
return "yarn";
} catch {
execSync("pnpm --version", {
stdio: "ignore"
});
return "pnpm";
}
} catch {
return "npm";
}
}
//# sourceMappingURL=get-pkg-manager.js.map

View File

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

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

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

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/lib/helpers/get-registry.ts"],"names":["execSync","getPkgManager","getRegistry","baseDir","process","cwd","registry","pkgManager","output","toString","trim","startsWith","endsWith"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,gBAAe;AACxC,SAASC,aAAa,QAAQ,oBAAmB;AAEjD;;;;CAIC,GACD,OAAO,SAASC,YAAYC,UAAkBC,QAAQC,GAAG,EAAE;IACzD,IAAIC,WAAW,CAAC,2BAA2B,CAAC;IAC5C,IAAI;QACF,MAAMC,aAAaN,cAAcE;QACjC,MAAMK,SAASR,SAAS,CAAC,EAAEO,WAAW,oBAAoB,CAAC,EACxDE,QAAQ,GACRC,IAAI;QAEP,IAAIF,OAAOG,UAAU,CAAC,SAAS;YAC7BL,WAAWE,OAAOI,QAAQ,CAAC,OAAOJ,SAAS,CAAC,EAAEA,OAAO,CAAC,CAAC;QACzD;IACF,SAAU;QACR,OAAOF;IACT;AACF"}

View File

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

View File

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

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

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

View File

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