@vercel/introspection 0.0.8 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/express.mjs +123 -59
- package/dist/hono.mjs +123 -59
- package/dist/index.mjs +189 -78
- package/dist/loaders/cjs.cjs +123 -75
- package/dist/loaders/esm.mjs +1 -21
- package/package.json +5 -5
package/dist/express.mjs
CHANGED
|
@@ -10,10 +10,12 @@ var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
|
10
10
|
|
|
11
11
|
//#endregion
|
|
12
12
|
//#region src/util.ts
|
|
13
|
+
const BEGIN_INTROSPECTION_RESULT = "\n__VERCEL_INTROSPECTION_BEGIN__\n";
|
|
14
|
+
const END_INTROSPECTION_RESULT = "\n__VERCEL_INTROSPECTION_END__\n";
|
|
13
15
|
const setupCloseHandlers = (cb) => {
|
|
14
16
|
const callCallback = () => {
|
|
15
17
|
const result = cb();
|
|
16
|
-
if (result) console.log(JSON.stringify(result));
|
|
18
|
+
if (result) console.log(`${BEGIN_INTROSPECTION_RESULT}${JSON.stringify(result)}${END_INTROSPECTION_RESULT}`);
|
|
17
19
|
};
|
|
18
20
|
process.on("SIGINT", callCallback);
|
|
19
21
|
process.on("SIGTERM", callCallback);
|
|
@@ -268,7 +270,7 @@ var require_dist$1 = /* @__PURE__ */ __commonJS$1({ "../build-utils/dist/index.j
|
|
|
268
270
|
this.head = this.tail = null;
|
|
269
271
|
this.length = 0;
|
|
270
272
|
};
|
|
271
|
-
BufferList.prototype.join = function
|
|
273
|
+
BufferList.prototype.join = function join6(s) {
|
|
272
274
|
if (this.length === 0) return "";
|
|
273
275
|
var p = this.head;
|
|
274
276
|
var ret = "" + p.data;
|
|
@@ -54351,6 +54353,7 @@ ${error.message}`;
|
|
|
54351
54353
|
NodeVersion: () => NodeVersion,
|
|
54352
54354
|
NodejsLambda: () => NodejsLambda,
|
|
54353
54355
|
NowBuildError: () => NowBuildError,
|
|
54356
|
+
PYTHON_FRAMEWORKS: () => PYTHON_FRAMEWORKS,
|
|
54354
54357
|
Prerender: () => Prerender,
|
|
54355
54358
|
Span: () => Span,
|
|
54356
54359
|
Version: () => Version,
|
|
@@ -54363,6 +54366,7 @@ ${error.message}`;
|
|
|
54363
54366
|
download: () => download,
|
|
54364
54367
|
downloadFile: () => downloadFile,
|
|
54365
54368
|
execCommand: () => execCommand,
|
|
54369
|
+
findPackageJson: () => findPackageJson,
|
|
54366
54370
|
functionsSchema: () => functionsSchema,
|
|
54367
54371
|
generateNodeBuilderFunctions: () => generateNodeBuilderFunctions,
|
|
54368
54372
|
getDiscontinuedNodeVersions: () => getDiscontinuedNodeVersions,
|
|
@@ -54375,6 +54379,7 @@ ${error.message}`;
|
|
|
54375
54379
|
getNodeBinPaths: () => getNodeBinPaths,
|
|
54376
54380
|
getNodeVersion: () => getNodeVersion,
|
|
54377
54381
|
getOsRelease: () => getOsRelease,
|
|
54382
|
+
getPackageJson: () => getPackageJson,
|
|
54378
54383
|
getPathForPackageManager: () => getPathForPackageManager,
|
|
54379
54384
|
getPlatformEnv: () => getPlatformEnv,
|
|
54380
54385
|
getPrefixedEnvVars: () => getPrefixedEnvVars,
|
|
@@ -54395,10 +54400,12 @@ ${error.message}`;
|
|
|
54395
54400
|
isExperimentalBackendsEnabled: () => isExperimentalBackendsEnabled,
|
|
54396
54401
|
isExperimentalBackendsWithoutIntrospectionEnabled: () => isExperimentalBackendsWithoutIntrospectionEnabled,
|
|
54397
54402
|
isPythonEntrypoint: () => isPythonEntrypoint,
|
|
54403
|
+
isPythonFramework: () => isPythonFramework,
|
|
54398
54404
|
isSymbolicLink: () => isSymbolicLink,
|
|
54399
54405
|
normalizePath: () => normalizePath,
|
|
54400
54406
|
readConfigFile: () => readConfigFile,
|
|
54401
54407
|
rename: () => rename,
|
|
54408
|
+
resetCustomInstallCommandSet: () => resetCustomInstallCommandSet,
|
|
54402
54409
|
runBundleInstall: () => runBundleInstall,
|
|
54403
54410
|
runCustomInstallCommand: () => runCustomInstallCommand,
|
|
54404
54411
|
runNpmInstall: () => runNpmInstall,
|
|
@@ -54859,7 +54866,7 @@ ${error.message}`;
|
|
|
54859
54866
|
(0, import_assert4.default)(typeof runtime === "string", "\"runtime\" is not a string");
|
|
54860
54867
|
(0, import_assert4.default)(typeof environment === "object", "\"environment\" is not an object");
|
|
54861
54868
|
if (architecture !== void 0) (0, import_assert4.default)(architecture === "x86_64" || architecture === "arm64", "\"architecture\" must be either \"x86_64\" or \"arm64\"");
|
|
54862
|
-
if (runtimeLanguage !== void 0) (0, import_assert4.default)(runtimeLanguage === "rust", "\"runtimeLanguage\"
|
|
54869
|
+
if (runtimeLanguage !== void 0) (0, import_assert4.default)(runtimeLanguage === "rust" || runtimeLanguage === "go", "\"runtimeLanguage\" is invalid. Valid options: \"rust\", \"go\"");
|
|
54863
54870
|
if ("experimentalAllowBundling" in opts && opts.experimentalAllowBundling !== void 0) (0, import_assert4.default)(typeof opts.experimentalAllowBundling === "boolean", "\"experimentalAllowBundling\" is not a boolean");
|
|
54864
54871
|
if (memory !== void 0) (0, import_assert4.default)(typeof memory === "number", "\"memory\" is not a number");
|
|
54865
54872
|
if (maxDuration !== void 0) (0, import_assert4.default)(typeof maxDuration === "number", "\"maxDuration\" is not a number");
|
|
@@ -55144,7 +55151,7 @@ ${error.message}`;
|
|
|
55144
55151
|
}
|
|
55145
55152
|
var import_assert6 = __toESM(__require("assert"));
|
|
55146
55153
|
var import_fs_extra7 = __toESM(require_lib());
|
|
55147
|
-
var
|
|
55154
|
+
var import_path6 = __toESM(__require("path"));
|
|
55148
55155
|
var import_async_sema4 = __toESM(require_async_sema());
|
|
55149
55156
|
var import_cross_spawn = __toESM(require_cross_spawn());
|
|
55150
55157
|
var import_semver2 = __toESM(require_semver2());
|
|
@@ -55264,14 +55271,14 @@ ${error.message}`;
|
|
|
55264
55271
|
return (0, import_semver.intersects)(o.range, engineRange) && (availableVersions?.length ? availableVersions.includes(o.major) : true);
|
|
55265
55272
|
}))) throw new NowBuildError({
|
|
55266
55273
|
code: "BUILD_UTILS_NODE_VERSION_INVALID",
|
|
55267
|
-
link: "
|
|
55274
|
+
link: "https://vercel.link/node-version",
|
|
55268
55275
|
message: `Found invalid Node.js Version: "${engineRange}". ${getHint(isAuto, availableVersions)}`
|
|
55269
55276
|
});
|
|
55270
55277
|
}
|
|
55271
55278
|
if (!selection) selection = getLatestNodeVersion(availableVersions);
|
|
55272
55279
|
if (selection.state === "discontinued") throw new NowBuildError({
|
|
55273
55280
|
code: "BUILD_UTILS_NODE_VERSION_DISCONTINUED",
|
|
55274
|
-
link: "
|
|
55281
|
+
link: "https://vercel.link/node-version",
|
|
55275
55282
|
message: `${`Node.js Version "${selection.range}" is discontinued and must be upgraded.`} ${getHint(isAuto)}`
|
|
55276
55283
|
});
|
|
55277
55284
|
debug$1(`Selected Node.js ${selection.range}`);
|
|
@@ -55305,6 +55312,7 @@ ${error.message}`;
|
|
|
55305
55312
|
var import_toml = __toESM(require_toml());
|
|
55306
55313
|
var import_fs_extra6 = __toESM(require_lib());
|
|
55307
55314
|
var import_error_utils = __toESM(require_dist());
|
|
55315
|
+
var import_path5 = __require("path");
|
|
55308
55316
|
async function readFileOrNull(file) {
|
|
55309
55317
|
try {
|
|
55310
55318
|
return await (0, import_fs_extra6.readFile)(file);
|
|
@@ -55331,6 +55339,14 @@ ${error.message}`;
|
|
|
55331
55339
|
}
|
|
55332
55340
|
return null;
|
|
55333
55341
|
}
|
|
55342
|
+
async function getPackageJson(dir) {
|
|
55343
|
+
const packagePath = (0, import_path5.join)(dir, "package.json");
|
|
55344
|
+
try {
|
|
55345
|
+
return JSON.parse(await (0, import_fs_extra6.readFile)(packagePath, "utf8"));
|
|
55346
|
+
} catch (err) {
|
|
55347
|
+
return {};
|
|
55348
|
+
}
|
|
55349
|
+
}
|
|
55334
55350
|
var { hasOwnProperty: hasOwnProperty2 } = Object.prototype;
|
|
55335
55351
|
function cloneEnv(...envs) {
|
|
55336
55352
|
return envs.reduce((obj, env) => {
|
|
@@ -55388,12 +55404,12 @@ ${error.message}`;
|
|
|
55388
55404
|
return true;
|
|
55389
55405
|
}
|
|
55390
55406
|
function* traverseUpDirectories({ start, base }) {
|
|
55391
|
-
let current =
|
|
55392
|
-
const normalizedRoot = base ?
|
|
55407
|
+
let current = import_path6.default.normalize(start);
|
|
55408
|
+
const normalizedRoot = base ? import_path6.default.normalize(base) : void 0;
|
|
55393
55409
|
while (current) {
|
|
55394
55410
|
yield current;
|
|
55395
55411
|
if (current === normalizedRoot) break;
|
|
55396
|
-
const next =
|
|
55412
|
+
const next = import_path6.default.join(current, "..");
|
|
55397
55413
|
current = next === current ? void 0 : next;
|
|
55398
55414
|
}
|
|
55399
55415
|
}
|
|
@@ -55403,24 +55419,24 @@ ${error.message}`;
|
|
|
55403
55419
|
start,
|
|
55404
55420
|
base
|
|
55405
55421
|
})) {
|
|
55406
|
-
const packageJsonPath =
|
|
55422
|
+
const packageJsonPath = import_path6.default.join(dir, "package.json");
|
|
55407
55423
|
if (await import_fs_extra7.default.pathExists(packageJsonPath)) curRootPackageJsonPath = packageJsonPath;
|
|
55408
55424
|
}
|
|
55409
55425
|
return curRootPackageJsonPath ? {
|
|
55410
55426
|
packageJson: await import_fs_extra7.default.readJson(curRootPackageJsonPath),
|
|
55411
|
-
rootDir:
|
|
55427
|
+
rootDir: import_path6.default.dirname(curRootPackageJsonPath)
|
|
55412
55428
|
} : void 0;
|
|
55413
55429
|
}
|
|
55414
55430
|
async function getNodeBinPath({ cwd }) {
|
|
55415
55431
|
const { lockfilePath } = await scanParentDirs(cwd);
|
|
55416
|
-
const dir =
|
|
55417
|
-
return
|
|
55432
|
+
const dir = import_path6.default.dirname(lockfilePath || cwd);
|
|
55433
|
+
return import_path6.default.join(dir, "node_modules", ".bin");
|
|
55418
55434
|
}
|
|
55419
55435
|
function getNodeBinPaths({ start, base }) {
|
|
55420
55436
|
return Array.from(traverseUpDirectories({
|
|
55421
55437
|
start,
|
|
55422
55438
|
base
|
|
55423
|
-
})).map((dir) =>
|
|
55439
|
+
})).map((dir) => import_path6.default.join(dir, "node_modules/.bin"));
|
|
55424
55440
|
}
|
|
55425
55441
|
async function chmodPlusX(fsPath) {
|
|
55426
55442
|
const s = await import_fs_extra7.default.stat(fsPath);
|
|
@@ -55430,10 +55446,10 @@ ${error.message}`;
|
|
|
55430
55446
|
await import_fs_extra7.default.chmod(fsPath, base8);
|
|
55431
55447
|
}
|
|
55432
55448
|
async function runShellScript(fsPath, args = [], spawnOpts) {
|
|
55433
|
-
(0, import_assert6.default)(
|
|
55434
|
-
const destPath =
|
|
55449
|
+
(0, import_assert6.default)(import_path6.default.isAbsolute(fsPath));
|
|
55450
|
+
const destPath = import_path6.default.dirname(fsPath);
|
|
55435
55451
|
await chmodPlusX(fsPath);
|
|
55436
|
-
const command = `./${
|
|
55452
|
+
const command = `./${import_path6.default.basename(fsPath)}`;
|
|
55437
55453
|
await spawnAsync(command, args, {
|
|
55438
55454
|
...spawnOpts,
|
|
55439
55455
|
cwd: destPath,
|
|
@@ -55446,7 +55462,7 @@ ${error.message}`;
|
|
|
55446
55462
|
if (isBunVersion(nodeVersion)) return opts;
|
|
55447
55463
|
if (!meta.isDev) {
|
|
55448
55464
|
let found = false;
|
|
55449
|
-
const pathSegments = (opts.env.PATH || process.env.PATH || "").split(
|
|
55465
|
+
const pathSegments = (opts.env.PATH || process.env.PATH || "").split(import_path6.default.delimiter).map((segment) => {
|
|
55450
55466
|
if (/^\/node[0-9]+\/bin/.test(segment)) {
|
|
55451
55467
|
found = true;
|
|
55452
55468
|
return `/node${nodeVersion.major}/bin`;
|
|
@@ -55454,7 +55470,7 @@ ${error.message}`;
|
|
|
55454
55470
|
return segment;
|
|
55455
55471
|
});
|
|
55456
55472
|
if (!found) pathSegments.unshift(`/node${nodeVersion.major}/bin`);
|
|
55457
|
-
opts.env.PATH = pathSegments.filter(Boolean).join(
|
|
55473
|
+
opts.env.PATH = pathSegments.filter(Boolean).join(import_path6.default.delimiter);
|
|
55458
55474
|
}
|
|
55459
55475
|
return opts;
|
|
55460
55476
|
}
|
|
@@ -55465,20 +55481,20 @@ ${error.message}`;
|
|
|
55465
55481
|
latestVersion.runtime = "nodejs";
|
|
55466
55482
|
return latestVersion;
|
|
55467
55483
|
}
|
|
55468
|
-
const { packageJson } = await
|
|
55484
|
+
const { packageJson } = await findPackageJson(destPath, true);
|
|
55469
55485
|
const configuredVersion = config.nodeVersion || fallbackVersion;
|
|
55470
55486
|
const packageJsonVersion = packageJson?.engines?.node;
|
|
55471
55487
|
const supportedNodeVersion = await getSupportedNodeVersion(packageJsonVersion || configuredVersion, !packageJsonVersion, availableVersions);
|
|
55472
55488
|
if (packageJson?.engines?.node) {
|
|
55473
55489
|
const { node } = packageJson.engines;
|
|
55474
|
-
if (configuredVersion && !(0, import_semver2.intersects)(configuredVersion, supportedNodeVersion.range)) console.warn(`Warning: Due to "engines": { "node": "${node}" } in your \`package.json\` file, the Node.js Version defined in your Project Settings ("${configuredVersion}") will not apply, Node.js Version "${supportedNodeVersion.range}" will be used instead. Learn More:
|
|
55475
|
-
if ((0, import_semver2.coerce)(node)?.raw === node) console.warn(`Warning: Detected "engines": { "node": "${node}" } in your \`package.json\` with major.minor.patch, but only major Node.js Version can be selected. Learn More:
|
|
55476
|
-
else if ((0, import_semver2.validRange)(node) && (0, import_semver2.intersects)(`${latestVersion.major + 1}.x`, node)) console.warn(`Warning: Detected "engines": { "node": "${node}" } in your \`package.json\` that will automatically upgrade when a new major Node.js Version is released. Learn More:
|
|
55490
|
+
if (configuredVersion && !(0, import_semver2.intersects)(configuredVersion, supportedNodeVersion.range)) console.warn(`Warning: Due to "engines": { "node": "${node}" } in your \`package.json\` file, the Node.js Version defined in your Project Settings ("${configuredVersion}") will not apply, Node.js Version "${supportedNodeVersion.range}" will be used instead. Learn More: https://vercel.link/node-version`);
|
|
55491
|
+
if ((0, import_semver2.coerce)(node)?.raw === node) console.warn(`Warning: Detected "engines": { "node": "${node}" } in your \`package.json\` with major.minor.patch, but only major Node.js Version can be selected. Learn More: https://vercel.link/node-version`);
|
|
55492
|
+
else if ((0, import_semver2.validRange)(node) && (0, import_semver2.intersects)(`${latestVersion.major + 1}.x`, node)) console.warn(`Warning: Detected "engines": { "node": "${node}" } in your \`package.json\` that will automatically upgrade when a new major Node.js Version is released. Learn More: https://vercel.link/node-version`);
|
|
55477
55493
|
}
|
|
55478
55494
|
return supportedNodeVersion;
|
|
55479
55495
|
}
|
|
55480
|
-
async function
|
|
55481
|
-
(0, import_assert6.default)(
|
|
55496
|
+
async function findPackageJson(destPath, readPackageJson = false, base = "/") {
|
|
55497
|
+
(0, import_assert6.default)(import_path6.default.isAbsolute(destPath));
|
|
55482
55498
|
const pkgJsonPath = await walkParentDirs({
|
|
55483
55499
|
base,
|
|
55484
55500
|
start: destPath,
|
|
@@ -55490,6 +55506,14 @@ ${error.message}`;
|
|
|
55490
55506
|
} catch (err) {
|
|
55491
55507
|
throw new Error(`Could not read ${pkgJsonPath}: ${err.message}.`);
|
|
55492
55508
|
}
|
|
55509
|
+
return {
|
|
55510
|
+
packageJsonPath: pkgJsonPath || void 0,
|
|
55511
|
+
packageJson
|
|
55512
|
+
};
|
|
55513
|
+
}
|
|
55514
|
+
async function scanParentDirs(destPath, readPackageJson = false, base = "/") {
|
|
55515
|
+
(0, import_assert6.default)(import_path6.default.isAbsolute(destPath));
|
|
55516
|
+
const { packageJsonPath: pkgJsonPath, packageJson } = await findPackageJson(destPath, readPackageJson, base);
|
|
55493
55517
|
const { paths: [yarnLockPath, npmLockPath, pnpmLockPath, bunLockTextPath, bunLockBinPath, vltLockPath], packageJsonPackageManager } = await walkParentDirsMulti({
|
|
55494
55518
|
base,
|
|
55495
55519
|
start: destPath,
|
|
@@ -55564,8 +55588,8 @@ ${error.message}`;
|
|
|
55564
55588
|
}
|
|
55565
55589
|
async function checkTurboSupportsCorepack(turboVersionRange, rootDir) {
|
|
55566
55590
|
if (turboVersionSpecifierSupportsCorepack(turboVersionRange)) return true;
|
|
55567
|
-
const turboJsonPath =
|
|
55568
|
-
const turboJsoncPath =
|
|
55591
|
+
const turboJsonPath = import_path6.default.join(rootDir, "turbo.json");
|
|
55592
|
+
const turboJsoncPath = import_path6.default.join(rootDir, "turbo.jsonc");
|
|
55569
55593
|
const [turboJsonExists, turboJsoncExists] = await Promise.all([import_fs_extra7.default.pathExists(turboJsonPath), import_fs_extra7.default.pathExists(turboJsoncPath)]);
|
|
55570
55594
|
let turboJson = null;
|
|
55571
55595
|
let turboConfigPath = null;
|
|
@@ -55574,7 +55598,7 @@ ${error.message}`;
|
|
|
55574
55598
|
if (turboConfigPath) try {
|
|
55575
55599
|
turboJson = import_json5.default.parse(await import_fs_extra7.default.readFile(turboConfigPath, "utf8"));
|
|
55576
55600
|
} catch (err) {
|
|
55577
|
-
console.warn(`WARNING: Failed to parse ${
|
|
55601
|
+
console.warn(`WARNING: Failed to parse ${import_path6.default.basename(turboConfigPath)}`);
|
|
55578
55602
|
}
|
|
55579
55603
|
return turboJson !== null && typeof turboJson === "object" && "globalPassThroughEnv" in turboJson && Array.isArray(turboJson.globalPassThroughEnv) && turboJson.globalPassThroughEnv.includes("COREPACK_HOME");
|
|
55580
55604
|
}
|
|
@@ -55608,13 +55632,13 @@ ${error.message}`;
|
|
|
55608
55632
|
return true;
|
|
55609
55633
|
}
|
|
55610
55634
|
async function walkParentDirs({ base, start, filename }) {
|
|
55611
|
-
(0, import_assert6.default)(
|
|
55612
|
-
(0, import_assert6.default)(
|
|
55635
|
+
(0, import_assert6.default)(import_path6.default.isAbsolute(base), "Expected \"base\" to be absolute path");
|
|
55636
|
+
(0, import_assert6.default)(import_path6.default.isAbsolute(start), "Expected \"start\" to be absolute path");
|
|
55613
55637
|
for (const dir of traverseUpDirectories({
|
|
55614
55638
|
start,
|
|
55615
55639
|
base
|
|
55616
55640
|
})) {
|
|
55617
|
-
const fullPath =
|
|
55641
|
+
const fullPath = import_path6.default.join(dir, filename);
|
|
55618
55642
|
if (await import_fs_extra7.default.pathExists(fullPath)) return fullPath;
|
|
55619
55643
|
}
|
|
55620
55644
|
return null;
|
|
@@ -55625,10 +55649,10 @@ ${error.message}`;
|
|
|
55625
55649
|
start,
|
|
55626
55650
|
base
|
|
55627
55651
|
})) {
|
|
55628
|
-
const fullPaths = filenames.map((f) =>
|
|
55652
|
+
const fullPaths = filenames.map((f) => import_path6.default.join(dir, f));
|
|
55629
55653
|
const existResults = await Promise.all(fullPaths.map((f) => import_fs_extra7.default.pathExists(f)));
|
|
55630
55654
|
const foundOneOrMore = existResults.some((b) => b);
|
|
55631
|
-
const packageJsonPath =
|
|
55655
|
+
const packageJsonPath = import_path6.default.join(dir, "package.json");
|
|
55632
55656
|
const packageJson = await import_fs_extra7.default.readJSON(packageJsonPath).catch(() => null);
|
|
55633
55657
|
if (packageJson?.packageManager) packageManager = packageJson.packageManager;
|
|
55634
55658
|
if (foundOneOrMore) return {
|
|
@@ -55688,12 +55712,16 @@ ${error.message}`;
|
|
|
55688
55712
|
};
|
|
55689
55713
|
}
|
|
55690
55714
|
var runNpmInstallSema = new import_async_sema4.default(1);
|
|
55715
|
+
var customInstallCommandSet;
|
|
55716
|
+
function resetCustomInstallCommandSet() {
|
|
55717
|
+
customInstallCommandSet = void 0;
|
|
55718
|
+
}
|
|
55691
55719
|
async function runNpmInstall(destPath, args = [], spawnOpts, meta, projectCreatedAt) {
|
|
55692
55720
|
if (meta?.isDev) {
|
|
55693
55721
|
debug$1("Skipping dependency installation because dev mode is enabled");
|
|
55694
55722
|
return false;
|
|
55695
55723
|
}
|
|
55696
|
-
(0, import_assert6.default)(
|
|
55724
|
+
(0, import_assert6.default)(import_path6.default.isAbsolute(destPath));
|
|
55697
55725
|
try {
|
|
55698
55726
|
await runNpmInstallSema.acquire();
|
|
55699
55727
|
const { cliType, packageJsonPath, packageJson, lockfileVersion, packageJsonPackageManager, turboSupportsCorepackHome } = await scanParentDirs(destPath, true);
|
|
@@ -55705,6 +55733,12 @@ ${error.message}`;
|
|
|
55705
55733
|
if (meta && packageJsonPath && defaultInstall) {
|
|
55706
55734
|
const { alreadyInstalled, runNpmInstallSet } = checkIfAlreadyInstalled(meta.runNpmInstallSet, packageJsonPath);
|
|
55707
55735
|
if (alreadyInstalled) return false;
|
|
55736
|
+
if (process.env.VERCEL_INSTALL_COMPLETED === "1") {
|
|
55737
|
+
debug$1(`Skipping dependency installation for ${packageJsonPath} because VERCEL_INSTALL_COMPLETED is set`);
|
|
55738
|
+
runNpmInstallSet.add(packageJsonPath);
|
|
55739
|
+
meta.runNpmInstallSet = runNpmInstallSet;
|
|
55740
|
+
return false;
|
|
55741
|
+
}
|
|
55708
55742
|
meta.runNpmInstallSet = runNpmInstallSet;
|
|
55709
55743
|
}
|
|
55710
55744
|
if (cliType === "yarn") {
|
|
@@ -55760,11 +55794,11 @@ ${error.message}`;
|
|
|
55760
55794
|
else debug$1(`Detected ${detectedPackageManager}. Added "${newPath}" to path. Based on assumed package manager "${cliType}", lockfile "${detectedLockfile}", and lockfileVersion "${lockfileVersion}"`);
|
|
55761
55795
|
const newEnv = { ...env };
|
|
55762
55796
|
const alreadyInPath = (newPath2) => {
|
|
55763
|
-
return (env.PATH ?? "").split(
|
|
55797
|
+
return (env.PATH ?? "").split(import_path6.default.delimiter).includes(newPath2);
|
|
55764
55798
|
};
|
|
55765
55799
|
if (newPath && !alreadyInPath(newPath)) {
|
|
55766
55800
|
const oldPath = env.PATH + "";
|
|
55767
|
-
newEnv.PATH = `${newPath}${
|
|
55801
|
+
newEnv.PATH = `${newPath}${import_path6.default.delimiter}${oldPath}`;
|
|
55768
55802
|
if (detectedLockfile && detectedPackageManager) {
|
|
55769
55803
|
const detectedV9PnpmLockfile = detectedLockfile === "pnpm-lock.yaml" && lockfileVersion === 9;
|
|
55770
55804
|
if (detectedPackageManager === "pnpm@10.x" && packageJsonPackageManager) {
|
|
@@ -55931,7 +55965,7 @@ To use ${otherVersion}, manually opt in using corepack (https://vercel.com/docs/
|
|
|
55931
55965
|
});
|
|
55932
55966
|
if (corepackEnabled) overrides = NO_OVERRIDE;
|
|
55933
55967
|
const alreadyInPath = (newPath) => {
|
|
55934
|
-
return (env.PATH ?? "").split(
|
|
55968
|
+
return (env.PATH ?? "").split(import_path6.default.delimiter).includes(newPath);
|
|
55935
55969
|
};
|
|
55936
55970
|
switch (true) {
|
|
55937
55971
|
case cliType === "yarn" && !env.YARN_NODE_LINKER: return {
|
|
@@ -55951,6 +55985,17 @@ To use ${otherVersion}, manually opt in using corepack (https://vercel.com/docs/
|
|
|
55951
55985
|
}
|
|
55952
55986
|
}
|
|
55953
55987
|
async function runCustomInstallCommand({ destPath, installCommand, spawnOpts, projectCreatedAt }) {
|
|
55988
|
+
const normalizedPath = import_path6.default.normalize(destPath);
|
|
55989
|
+
const { alreadyInstalled, runNpmInstallSet } = checkIfAlreadyInstalled(customInstallCommandSet, normalizedPath);
|
|
55990
|
+
customInstallCommandSet = runNpmInstallSet;
|
|
55991
|
+
if (alreadyInstalled) {
|
|
55992
|
+
debug$1(`Skipping custom install command for ${normalizedPath} because it was already run`);
|
|
55993
|
+
return false;
|
|
55994
|
+
}
|
|
55995
|
+
if (process.env.VERCEL_INSTALL_COMPLETED === "1") {
|
|
55996
|
+
debug$1(`Skipping custom install command for ${normalizedPath} because VERCEL_INSTALL_COMPLETED is set`);
|
|
55997
|
+
return false;
|
|
55998
|
+
}
|
|
55954
55999
|
console.log(`Running "install" command: \`${installCommand}\`...`);
|
|
55955
56000
|
const { cliType, lockfileVersion, packageJson, packageJsonPackageManager, turboSupportsCorepackHome } = await scanParentDirs(destPath, true);
|
|
55956
56001
|
const env = getEnvForPackageManager({
|
|
@@ -55968,9 +56013,10 @@ To use ${otherVersion}, manually opt in using corepack (https://vercel.com/docs/
|
|
|
55968
56013
|
env,
|
|
55969
56014
|
cwd: destPath
|
|
55970
56015
|
});
|
|
56016
|
+
return true;
|
|
55971
56017
|
}
|
|
55972
56018
|
async function runPackageJsonScript(destPath, scriptNames, spawnOpts, projectCreatedAt) {
|
|
55973
|
-
(0, import_assert6.default)(
|
|
56019
|
+
(0, import_assert6.default)(import_path6.default.isAbsolute(destPath));
|
|
55974
56020
|
const { packageJson, cliType, lockfileVersion, packageJsonPackageManager, turboSupportsCorepackHome } = await scanParentDirs(destPath, true);
|
|
55975
56021
|
const scriptName = getScriptName(packageJson, typeof scriptNames === "string" ? [scriptNames] : scriptNames);
|
|
55976
56022
|
if (!scriptName) return false;
|
|
@@ -56004,7 +56050,7 @@ To use ${otherVersion}, manually opt in using corepack (https://vercel.com/docs/
|
|
|
56004
56050
|
debug$1("Skipping dependency installation because dev mode is enabled");
|
|
56005
56051
|
return;
|
|
56006
56052
|
}
|
|
56007
|
-
(0, import_assert6.default)(
|
|
56053
|
+
(0, import_assert6.default)(import_path6.default.isAbsolute(destPath));
|
|
56008
56054
|
const opts = {
|
|
56009
56055
|
...spawnOpts,
|
|
56010
56056
|
cwd: destPath,
|
|
@@ -56015,19 +56061,26 @@ To use ${otherVersion}, manually opt in using corepack (https://vercel.com/docs/
|
|
|
56015
56061
|
async function runPipInstall(destPath, args = [], spawnOpts, meta) {
|
|
56016
56062
|
if (meta && meta.isDev) {
|
|
56017
56063
|
debug$1("Skipping dependency installation because dev mode is enabled");
|
|
56018
|
-
return;
|
|
56064
|
+
return { installed: false };
|
|
56019
56065
|
}
|
|
56020
|
-
(0, import_assert6.default)(
|
|
56066
|
+
(0, import_assert6.default)(import_path6.default.isAbsolute(destPath));
|
|
56067
|
+
const targetDir = import_path6.default.join(destPath, ".vercel_python_packages");
|
|
56021
56068
|
const opts = {
|
|
56022
56069
|
...spawnOpts,
|
|
56023
56070
|
cwd: destPath,
|
|
56024
|
-
prettyCommand: "
|
|
56071
|
+
prettyCommand: "uv pip install"
|
|
56025
56072
|
};
|
|
56026
|
-
await spawnAsync("
|
|
56073
|
+
await spawnAsync("uv", [
|
|
56074
|
+
"pip",
|
|
56027
56075
|
"install",
|
|
56028
|
-
"--
|
|
56076
|
+
"--target",
|
|
56077
|
+
targetDir,
|
|
56029
56078
|
...args
|
|
56030
56079
|
], opts);
|
|
56080
|
+
return {
|
|
56081
|
+
installed: true,
|
|
56082
|
+
targetDir
|
|
56083
|
+
};
|
|
56031
56084
|
}
|
|
56032
56085
|
function getScriptName(pkg, possibleNames) {
|
|
56033
56086
|
if (pkg?.scripts) {
|
|
@@ -56035,7 +56088,7 @@ To use ${otherVersion}, manually opt in using corepack (https://vercel.com/docs/
|
|
|
56035
56088
|
}
|
|
56036
56089
|
}
|
|
56037
56090
|
var installDependencies = (0, import_util2.deprecate)(runNpmInstall, "installDependencies() is deprecated. Please use runNpmInstall() instead.");
|
|
56038
|
-
var
|
|
56091
|
+
var import_path7 = __toESM(__require("path"));
|
|
56039
56092
|
var import_fs_extra8 = __toESM(require_lib());
|
|
56040
56093
|
var import_ignore = __toESM(require_ignore());
|
|
56041
56094
|
function isCodedError(error) {
|
|
@@ -56053,8 +56106,8 @@ To use ${otherVersion}, manually opt in using corepack (https://vercel.com/docs/
|
|
|
56053
56106
|
throw error;
|
|
56054
56107
|
}
|
|
56055
56108
|
};
|
|
56056
|
-
const vercelIgnorePath =
|
|
56057
|
-
const nowIgnorePath =
|
|
56109
|
+
const vercelIgnorePath = import_path7.default.join(downloadPath, rootDirectory || "", ".vercelignore");
|
|
56110
|
+
const nowIgnorePath = import_path7.default.join(downloadPath, rootDirectory || "", ".nowignore");
|
|
56058
56111
|
const ignoreContents = [];
|
|
56059
56112
|
try {
|
|
56060
56113
|
ignoreContents.push(...(await Promise.all([readFile4(vercelIgnorePath), readFile4(nowIgnorePath)])).filter(Boolean));
|
|
@@ -56092,18 +56145,18 @@ To use ${otherVersion}, manually opt in using corepack (https://vercel.com/docs/
|
|
|
56092
56145
|
}
|
|
56093
56146
|
return newEnvs;
|
|
56094
56147
|
}
|
|
56095
|
-
var
|
|
56148
|
+
var import_path8 = __toESM(__require("path"));
|
|
56096
56149
|
var import_fs2 = __require("fs");
|
|
56097
56150
|
async function hardLinkDir(src, destDirs) {
|
|
56098
56151
|
if (destDirs.length === 0) return;
|
|
56099
|
-
destDirs = destDirs.filter((destDir) =>
|
|
56152
|
+
destDirs = destDirs.filter((destDir) => import_path8.default.relative(destDir, src) !== "");
|
|
56100
56153
|
const files = await import_fs2.promises.readdir(src);
|
|
56101
56154
|
await Promise.all(files.map(async (file) => {
|
|
56102
56155
|
if (file === "node_modules") return;
|
|
56103
|
-
const srcFile =
|
|
56156
|
+
const srcFile = import_path8.default.join(src, file);
|
|
56104
56157
|
if ((await import_fs2.promises.lstat(srcFile)).isDirectory()) {
|
|
56105
56158
|
await hardLinkDir(srcFile, await Promise.all(destDirs.map(async (destDir) => {
|
|
56106
|
-
const destSubdir =
|
|
56159
|
+
const destSubdir = import_path8.default.join(destDir, file);
|
|
56107
56160
|
try {
|
|
56108
56161
|
await import_fs2.promises.mkdir(destSubdir, { recursive: true });
|
|
56109
56162
|
} catch (err) {
|
|
@@ -56114,7 +56167,7 @@ To use ${otherVersion}, manually opt in using corepack (https://vercel.com/docs/
|
|
|
56114
56167
|
return;
|
|
56115
56168
|
}
|
|
56116
56169
|
await Promise.all(destDirs.map(async (destDir) => {
|
|
56117
|
-
const destFile =
|
|
56170
|
+
const destFile = import_path8.default.join(destDir, file);
|
|
56118
56171
|
try {
|
|
56119
56172
|
await linkOrCopyFile(srcFile, destFile);
|
|
56120
56173
|
} catch (err) {
|
|
@@ -56129,7 +56182,7 @@ To use ${otherVersion}, manually opt in using corepack (https://vercel.com/docs/
|
|
|
56129
56182
|
await linkOrCopy(srcFile, destFile);
|
|
56130
56183
|
} catch (err) {
|
|
56131
56184
|
if (err.code === "ENOENT") {
|
|
56132
|
-
await import_fs2.promises.mkdir(
|
|
56185
|
+
await import_fs2.promises.mkdir(import_path8.default.dirname(destFile), { recursive: true });
|
|
56133
56186
|
await linkOrCopy(srcFile, destFile);
|
|
56134
56187
|
return;
|
|
56135
56188
|
}
|
|
@@ -56144,10 +56197,10 @@ To use ${otherVersion}, manually opt in using corepack (https://vercel.com/docs/
|
|
|
56144
56197
|
await import_fs2.promises.copyFile(srcFile, destFile);
|
|
56145
56198
|
}
|
|
56146
56199
|
}
|
|
56147
|
-
var
|
|
56200
|
+
var import_path9 = __require("path");
|
|
56148
56201
|
var import_promises = __require("fs/promises");
|
|
56149
56202
|
async function validateNpmrc(cwd) {
|
|
56150
|
-
if ((await (0, import_promises.readFile)((0,
|
|
56203
|
+
if ((await (0, import_promises.readFile)((0, import_path9.join)(cwd, ".npmrc"), "utf-8").catch((err) => {
|
|
56151
56204
|
if (err.code !== "ENOENT") throw err;
|
|
56152
56205
|
}))?.match(/(?<!#.*)use-node-version/)) throw new Error("Detected unsupported \"use-node-version\" in your \".npmrc\". Please use \"engines\" in your \"package.json\" instead.");
|
|
56153
56206
|
}
|
|
@@ -56188,12 +56241,12 @@ To use ${otherVersion}, manually opt in using corepack (https://vercel.com/docs/
|
|
|
56188
56241
|
if (!os) return "provided.al2023";
|
|
56189
56242
|
return os.PRETTY_NAME === "Amazon Linux 2" ? "provided.al2" : "provided.al2023";
|
|
56190
56243
|
}
|
|
56191
|
-
var
|
|
56244
|
+
var import_path10 = __require("path");
|
|
56192
56245
|
var shouldServe = ({ entrypoint, files, requestPath }) => {
|
|
56193
56246
|
requestPath = requestPath.replace(/\/$/, "");
|
|
56194
56247
|
entrypoint = entrypoint.replace(/\\/, "/");
|
|
56195
56248
|
if (entrypoint === requestPath && hasProp(files, entrypoint)) return true;
|
|
56196
|
-
const { dir, name } = (0,
|
|
56249
|
+
const { dir, name } = (0, import_path10.parse)(entrypoint);
|
|
56197
56250
|
if (name === "index" && dir === requestPath && hasProp(files, entrypoint)) return true;
|
|
56198
56251
|
return false;
|
|
56199
56252
|
};
|
|
@@ -56474,14 +56527,21 @@ ${entrypointsForMessage}`);
|
|
|
56474
56527
|
"express",
|
|
56475
56528
|
"hono",
|
|
56476
56529
|
"h3",
|
|
56530
|
+
"koa",
|
|
56477
56531
|
"nestjs",
|
|
56478
56532
|
"fastify",
|
|
56479
56533
|
"elysia"
|
|
56480
56534
|
];
|
|
56535
|
+
var PYTHON_FRAMEWORKS = [
|
|
56536
|
+
"fastapi",
|
|
56537
|
+
"flask",
|
|
56538
|
+
"python"
|
|
56539
|
+
];
|
|
56481
56540
|
var BACKEND_BUILDERS = [
|
|
56482
56541
|
"@vercel/express",
|
|
56483
56542
|
"@vercel/hono",
|
|
56484
56543
|
"@vercel/h3",
|
|
56544
|
+
"@vercel/koa",
|
|
56485
56545
|
"@vercel/nestjs",
|
|
56486
56546
|
"@vercel/fastify",
|
|
56487
56547
|
"@vercel/elysia"
|
|
@@ -56490,6 +56550,10 @@ ${entrypointsForMessage}`);
|
|
|
56490
56550
|
if (!framework) return false;
|
|
56491
56551
|
return BACKEND_FRAMEWORKS.includes(framework);
|
|
56492
56552
|
}
|
|
56553
|
+
function isPythonFramework(framework) {
|
|
56554
|
+
if (!framework) return false;
|
|
56555
|
+
return PYTHON_FRAMEWORKS.includes(framework);
|
|
56556
|
+
}
|
|
56493
56557
|
function isExperimentalBackendsWithoutIntrospectionEnabled() {
|
|
56494
56558
|
return process.env.VERCEL_BACKENDS_BUILDS === "1";
|
|
56495
56559
|
}
|
|
@@ -56505,12 +56569,12 @@ ${entrypointsForMessage}`);
|
|
|
56505
56569
|
return isExperimentalBackendsEnabled() && isBackendFramework(framework);
|
|
56506
56570
|
}
|
|
56507
56571
|
var import_fs3 = __toESM(__require("fs"));
|
|
56508
|
-
var
|
|
56572
|
+
var import_path11 = __require("path");
|
|
56509
56573
|
var import_execa = __toESM(require_execa());
|
|
56510
56574
|
var isWin2 = process.platform === "win32";
|
|
56511
56575
|
async function runStdlibPyScript(options) {
|
|
56512
56576
|
const { scriptName, pythonPath, args = [], cwd } = options;
|
|
56513
|
-
const scriptPath = (0,
|
|
56577
|
+
const scriptPath = (0, import_path11.join)(__dirname, "..", "lib", "python", `${scriptName}.py`);
|
|
56514
56578
|
if (!import_fs3.default.existsSync(scriptPath)) throw new Error(`Python script not found: ${scriptPath}`);
|
|
56515
56579
|
const pythonCmd = pythonPath ?? (isWin2 ? "python" : "python3");
|
|
56516
56580
|
debug$1(`Running stdlib Python script: ${pythonCmd} ${scriptPath} ${args.join(" ")}`);
|