@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/loaders/cjs.cjs
CHANGED
|
@@ -29,10 +29,12 @@ module$1 = __toESM$1(module$1);
|
|
|
29
29
|
let path_to_regexp = require("path-to-regexp");
|
|
30
30
|
|
|
31
31
|
//#region src/util.ts
|
|
32
|
+
const BEGIN_INTROSPECTION_RESULT = "\n__VERCEL_INTROSPECTION_BEGIN__\n";
|
|
33
|
+
const END_INTROSPECTION_RESULT = "\n__VERCEL_INTROSPECTION_END__\n";
|
|
32
34
|
const setupCloseHandlers = (cb) => {
|
|
33
35
|
const callCallback = () => {
|
|
34
36
|
const result = cb();
|
|
35
|
-
if (result) console.log(JSON.stringify(result));
|
|
37
|
+
if (result) console.log(`${BEGIN_INTROSPECTION_RESULT}${JSON.stringify(result)}${END_INTROSPECTION_RESULT}`);
|
|
36
38
|
};
|
|
37
39
|
process.on("SIGINT", callCallback);
|
|
38
40
|
process.on("SIGTERM", callCallback);
|
|
@@ -287,7 +289,7 @@ var require_dist$1 = /* @__PURE__ */ __commonJS$1({ "../build-utils/dist/index.j
|
|
|
287
289
|
this.head = this.tail = null;
|
|
288
290
|
this.length = 0;
|
|
289
291
|
};
|
|
290
|
-
BufferList.prototype.join = function
|
|
292
|
+
BufferList.prototype.join = function join6(s) {
|
|
291
293
|
if (this.length === 0) return "";
|
|
292
294
|
var p = this.head;
|
|
293
295
|
var ret = "" + p.data;
|
|
@@ -54370,6 +54372,7 @@ ${error.message}`;
|
|
|
54370
54372
|
NodeVersion: () => NodeVersion,
|
|
54371
54373
|
NodejsLambda: () => NodejsLambda,
|
|
54372
54374
|
NowBuildError: () => NowBuildError,
|
|
54375
|
+
PYTHON_FRAMEWORKS: () => PYTHON_FRAMEWORKS,
|
|
54373
54376
|
Prerender: () => Prerender,
|
|
54374
54377
|
Span: () => Span,
|
|
54375
54378
|
Version: () => Version,
|
|
@@ -54382,6 +54385,7 @@ ${error.message}`;
|
|
|
54382
54385
|
download: () => download,
|
|
54383
54386
|
downloadFile: () => downloadFile,
|
|
54384
54387
|
execCommand: () => execCommand,
|
|
54388
|
+
findPackageJson: () => findPackageJson,
|
|
54385
54389
|
functionsSchema: () => functionsSchema,
|
|
54386
54390
|
generateNodeBuilderFunctions: () => generateNodeBuilderFunctions,
|
|
54387
54391
|
getDiscontinuedNodeVersions: () => getDiscontinuedNodeVersions,
|
|
@@ -54394,6 +54398,7 @@ ${error.message}`;
|
|
|
54394
54398
|
getNodeBinPaths: () => getNodeBinPaths,
|
|
54395
54399
|
getNodeVersion: () => getNodeVersion,
|
|
54396
54400
|
getOsRelease: () => getOsRelease,
|
|
54401
|
+
getPackageJson: () => getPackageJson,
|
|
54397
54402
|
getPathForPackageManager: () => getPathForPackageManager,
|
|
54398
54403
|
getPlatformEnv: () => getPlatformEnv,
|
|
54399
54404
|
getPrefixedEnvVars: () => getPrefixedEnvVars,
|
|
@@ -54414,10 +54419,12 @@ ${error.message}`;
|
|
|
54414
54419
|
isExperimentalBackendsEnabled: () => isExperimentalBackendsEnabled,
|
|
54415
54420
|
isExperimentalBackendsWithoutIntrospectionEnabled: () => isExperimentalBackendsWithoutIntrospectionEnabled,
|
|
54416
54421
|
isPythonEntrypoint: () => isPythonEntrypoint,
|
|
54422
|
+
isPythonFramework: () => isPythonFramework,
|
|
54417
54423
|
isSymbolicLink: () => isSymbolicLink,
|
|
54418
54424
|
normalizePath: () => normalizePath,
|
|
54419
54425
|
readConfigFile: () => readConfigFile,
|
|
54420
54426
|
rename: () => rename,
|
|
54427
|
+
resetCustomInstallCommandSet: () => resetCustomInstallCommandSet,
|
|
54421
54428
|
runBundleInstall: () => runBundleInstall,
|
|
54422
54429
|
runCustomInstallCommand: () => runCustomInstallCommand,
|
|
54423
54430
|
runNpmInstall: () => runNpmInstall,
|
|
@@ -54878,7 +54885,7 @@ ${error.message}`;
|
|
|
54878
54885
|
(0, import_assert4.default)(typeof runtime === "string", "\"runtime\" is not a string");
|
|
54879
54886
|
(0, import_assert4.default)(typeof environment === "object", "\"environment\" is not an object");
|
|
54880
54887
|
if (architecture !== void 0) (0, import_assert4.default)(architecture === "x86_64" || architecture === "arm64", "\"architecture\" must be either \"x86_64\" or \"arm64\"");
|
|
54881
|
-
if (runtimeLanguage !== void 0) (0, import_assert4.default)(runtimeLanguage === "rust", "\"runtimeLanguage\"
|
|
54888
|
+
if (runtimeLanguage !== void 0) (0, import_assert4.default)(runtimeLanguage === "rust" || runtimeLanguage === "go", "\"runtimeLanguage\" is invalid. Valid options: \"rust\", \"go\"");
|
|
54882
54889
|
if ("experimentalAllowBundling" in opts && opts.experimentalAllowBundling !== void 0) (0, import_assert4.default)(typeof opts.experimentalAllowBundling === "boolean", "\"experimentalAllowBundling\" is not a boolean");
|
|
54883
54890
|
if (memory !== void 0) (0, import_assert4.default)(typeof memory === "number", "\"memory\" is not a number");
|
|
54884
54891
|
if (maxDuration !== void 0) (0, import_assert4.default)(typeof maxDuration === "number", "\"maxDuration\" is not a number");
|
|
@@ -55163,7 +55170,7 @@ ${error.message}`;
|
|
|
55163
55170
|
}
|
|
55164
55171
|
var import_assert6 = __toESM(require("assert"));
|
|
55165
55172
|
var import_fs_extra7 = __toESM(require_lib());
|
|
55166
|
-
var
|
|
55173
|
+
var import_path6 = __toESM(require("path"));
|
|
55167
55174
|
var import_async_sema4 = __toESM(require_async_sema());
|
|
55168
55175
|
var import_cross_spawn = __toESM(require_cross_spawn());
|
|
55169
55176
|
var import_semver2 = __toESM(require_semver2());
|
|
@@ -55283,14 +55290,14 @@ ${error.message}`;
|
|
|
55283
55290
|
return (0, import_semver.intersects)(o.range, engineRange) && (availableVersions?.length ? availableVersions.includes(o.major) : true);
|
|
55284
55291
|
}))) throw new NowBuildError({
|
|
55285
55292
|
code: "BUILD_UTILS_NODE_VERSION_INVALID",
|
|
55286
|
-
link: "
|
|
55293
|
+
link: "https://vercel.link/node-version",
|
|
55287
55294
|
message: `Found invalid Node.js Version: "${engineRange}". ${getHint(isAuto, availableVersions)}`
|
|
55288
55295
|
});
|
|
55289
55296
|
}
|
|
55290
55297
|
if (!selection) selection = getLatestNodeVersion(availableVersions);
|
|
55291
55298
|
if (selection.state === "discontinued") throw new NowBuildError({
|
|
55292
55299
|
code: "BUILD_UTILS_NODE_VERSION_DISCONTINUED",
|
|
55293
|
-
link: "
|
|
55300
|
+
link: "https://vercel.link/node-version",
|
|
55294
55301
|
message: `${`Node.js Version "${selection.range}" is discontinued and must be upgraded.`} ${getHint(isAuto)}`
|
|
55295
55302
|
});
|
|
55296
55303
|
debug$2(`Selected Node.js ${selection.range}`);
|
|
@@ -55324,6 +55331,7 @@ ${error.message}`;
|
|
|
55324
55331
|
var import_toml = __toESM(require_toml());
|
|
55325
55332
|
var import_fs_extra6 = __toESM(require_lib());
|
|
55326
55333
|
var import_error_utils = __toESM(require_dist());
|
|
55334
|
+
var import_path5 = require("path");
|
|
55327
55335
|
async function readFileOrNull(file) {
|
|
55328
55336
|
try {
|
|
55329
55337
|
return await (0, import_fs_extra6.readFile)(file);
|
|
@@ -55350,6 +55358,14 @@ ${error.message}`;
|
|
|
55350
55358
|
}
|
|
55351
55359
|
return null;
|
|
55352
55360
|
}
|
|
55361
|
+
async function getPackageJson(dir) {
|
|
55362
|
+
const packagePath = (0, import_path5.join)(dir, "package.json");
|
|
55363
|
+
try {
|
|
55364
|
+
return JSON.parse(await (0, import_fs_extra6.readFile)(packagePath, "utf8"));
|
|
55365
|
+
} catch (err) {
|
|
55366
|
+
return {};
|
|
55367
|
+
}
|
|
55368
|
+
}
|
|
55353
55369
|
var { hasOwnProperty: hasOwnProperty2 } = Object.prototype;
|
|
55354
55370
|
function cloneEnv(...envs) {
|
|
55355
55371
|
return envs.reduce((obj, env) => {
|
|
@@ -55407,12 +55423,12 @@ ${error.message}`;
|
|
|
55407
55423
|
return true;
|
|
55408
55424
|
}
|
|
55409
55425
|
function* traverseUpDirectories({ start, base }) {
|
|
55410
|
-
let current =
|
|
55411
|
-
const normalizedRoot = base ?
|
|
55426
|
+
let current = import_path6.default.normalize(start);
|
|
55427
|
+
const normalizedRoot = base ? import_path6.default.normalize(base) : void 0;
|
|
55412
55428
|
while (current) {
|
|
55413
55429
|
yield current;
|
|
55414
55430
|
if (current === normalizedRoot) break;
|
|
55415
|
-
const next =
|
|
55431
|
+
const next = import_path6.default.join(current, "..");
|
|
55416
55432
|
current = next === current ? void 0 : next;
|
|
55417
55433
|
}
|
|
55418
55434
|
}
|
|
@@ -55422,24 +55438,24 @@ ${error.message}`;
|
|
|
55422
55438
|
start,
|
|
55423
55439
|
base
|
|
55424
55440
|
})) {
|
|
55425
|
-
const packageJsonPath =
|
|
55441
|
+
const packageJsonPath = import_path6.default.join(dir, "package.json");
|
|
55426
55442
|
if (await import_fs_extra7.default.pathExists(packageJsonPath)) curRootPackageJsonPath = packageJsonPath;
|
|
55427
55443
|
}
|
|
55428
55444
|
return curRootPackageJsonPath ? {
|
|
55429
55445
|
packageJson: await import_fs_extra7.default.readJson(curRootPackageJsonPath),
|
|
55430
|
-
rootDir:
|
|
55446
|
+
rootDir: import_path6.default.dirname(curRootPackageJsonPath)
|
|
55431
55447
|
} : void 0;
|
|
55432
55448
|
}
|
|
55433
55449
|
async function getNodeBinPath({ cwd }) {
|
|
55434
55450
|
const { lockfilePath } = await scanParentDirs(cwd);
|
|
55435
|
-
const dir =
|
|
55436
|
-
return
|
|
55451
|
+
const dir = import_path6.default.dirname(lockfilePath || cwd);
|
|
55452
|
+
return import_path6.default.join(dir, "node_modules", ".bin");
|
|
55437
55453
|
}
|
|
55438
55454
|
function getNodeBinPaths({ start, base }) {
|
|
55439
55455
|
return Array.from(traverseUpDirectories({
|
|
55440
55456
|
start,
|
|
55441
55457
|
base
|
|
55442
|
-
})).map((dir) =>
|
|
55458
|
+
})).map((dir) => import_path6.default.join(dir, "node_modules/.bin"));
|
|
55443
55459
|
}
|
|
55444
55460
|
async function chmodPlusX(fsPath) {
|
|
55445
55461
|
const s = await import_fs_extra7.default.stat(fsPath);
|
|
@@ -55449,10 +55465,10 @@ ${error.message}`;
|
|
|
55449
55465
|
await import_fs_extra7.default.chmod(fsPath, base8);
|
|
55450
55466
|
}
|
|
55451
55467
|
async function runShellScript(fsPath, args = [], spawnOpts) {
|
|
55452
|
-
(0, import_assert6.default)(
|
|
55453
|
-
const destPath =
|
|
55468
|
+
(0, import_assert6.default)(import_path6.default.isAbsolute(fsPath));
|
|
55469
|
+
const destPath = import_path6.default.dirname(fsPath);
|
|
55454
55470
|
await chmodPlusX(fsPath);
|
|
55455
|
-
const command = `./${
|
|
55471
|
+
const command = `./${import_path6.default.basename(fsPath)}`;
|
|
55456
55472
|
await spawnAsync(command, args, {
|
|
55457
55473
|
...spawnOpts,
|
|
55458
55474
|
cwd: destPath,
|
|
@@ -55465,7 +55481,7 @@ ${error.message}`;
|
|
|
55465
55481
|
if (isBunVersion(nodeVersion)) return opts;
|
|
55466
55482
|
if (!meta.isDev) {
|
|
55467
55483
|
let found = false;
|
|
55468
|
-
const pathSegments = (opts.env.PATH || process.env.PATH || "").split(
|
|
55484
|
+
const pathSegments = (opts.env.PATH || process.env.PATH || "").split(import_path6.default.delimiter).map((segment) => {
|
|
55469
55485
|
if (/^\/node[0-9]+\/bin/.test(segment)) {
|
|
55470
55486
|
found = true;
|
|
55471
55487
|
return `/node${nodeVersion.major}/bin`;
|
|
@@ -55473,7 +55489,7 @@ ${error.message}`;
|
|
|
55473
55489
|
return segment;
|
|
55474
55490
|
});
|
|
55475
55491
|
if (!found) pathSegments.unshift(`/node${nodeVersion.major}/bin`);
|
|
55476
|
-
opts.env.PATH = pathSegments.filter(Boolean).join(
|
|
55492
|
+
opts.env.PATH = pathSegments.filter(Boolean).join(import_path6.default.delimiter);
|
|
55477
55493
|
}
|
|
55478
55494
|
return opts;
|
|
55479
55495
|
}
|
|
@@ -55484,20 +55500,20 @@ ${error.message}`;
|
|
|
55484
55500
|
latestVersion.runtime = "nodejs";
|
|
55485
55501
|
return latestVersion;
|
|
55486
55502
|
}
|
|
55487
|
-
const { packageJson } = await
|
|
55503
|
+
const { packageJson } = await findPackageJson(destPath, true);
|
|
55488
55504
|
const configuredVersion = config.nodeVersion || fallbackVersion;
|
|
55489
55505
|
const packageJsonVersion = packageJson?.engines?.node;
|
|
55490
55506
|
const supportedNodeVersion = await getSupportedNodeVersion(packageJsonVersion || configuredVersion, !packageJsonVersion, availableVersions);
|
|
55491
55507
|
if (packageJson?.engines?.node) {
|
|
55492
55508
|
const { node } = packageJson.engines;
|
|
55493
|
-
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:
|
|
55494
|
-
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:
|
|
55495
|
-
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:
|
|
55509
|
+
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`);
|
|
55510
|
+
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`);
|
|
55511
|
+
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`);
|
|
55496
55512
|
}
|
|
55497
55513
|
return supportedNodeVersion;
|
|
55498
55514
|
}
|
|
55499
|
-
async function
|
|
55500
|
-
(0, import_assert6.default)(
|
|
55515
|
+
async function findPackageJson(destPath, readPackageJson = false, base = "/") {
|
|
55516
|
+
(0, import_assert6.default)(import_path6.default.isAbsolute(destPath));
|
|
55501
55517
|
const pkgJsonPath = await walkParentDirs({
|
|
55502
55518
|
base,
|
|
55503
55519
|
start: destPath,
|
|
@@ -55509,6 +55525,14 @@ ${error.message}`;
|
|
|
55509
55525
|
} catch (err) {
|
|
55510
55526
|
throw new Error(`Could not read ${pkgJsonPath}: ${err.message}.`);
|
|
55511
55527
|
}
|
|
55528
|
+
return {
|
|
55529
|
+
packageJsonPath: pkgJsonPath || void 0,
|
|
55530
|
+
packageJson
|
|
55531
|
+
};
|
|
55532
|
+
}
|
|
55533
|
+
async function scanParentDirs(destPath, readPackageJson = false, base = "/") {
|
|
55534
|
+
(0, import_assert6.default)(import_path6.default.isAbsolute(destPath));
|
|
55535
|
+
const { packageJsonPath: pkgJsonPath, packageJson } = await findPackageJson(destPath, readPackageJson, base);
|
|
55512
55536
|
const { paths: [yarnLockPath, npmLockPath, pnpmLockPath, bunLockTextPath, bunLockBinPath, vltLockPath], packageJsonPackageManager } = await walkParentDirsMulti({
|
|
55513
55537
|
base,
|
|
55514
55538
|
start: destPath,
|
|
@@ -55583,8 +55607,8 @@ ${error.message}`;
|
|
|
55583
55607
|
}
|
|
55584
55608
|
async function checkTurboSupportsCorepack(turboVersionRange, rootDir) {
|
|
55585
55609
|
if (turboVersionSpecifierSupportsCorepack(turboVersionRange)) return true;
|
|
55586
|
-
const turboJsonPath =
|
|
55587
|
-
const turboJsoncPath =
|
|
55610
|
+
const turboJsonPath = import_path6.default.join(rootDir, "turbo.json");
|
|
55611
|
+
const turboJsoncPath = import_path6.default.join(rootDir, "turbo.jsonc");
|
|
55588
55612
|
const [turboJsonExists, turboJsoncExists] = await Promise.all([import_fs_extra7.default.pathExists(turboJsonPath), import_fs_extra7.default.pathExists(turboJsoncPath)]);
|
|
55589
55613
|
let turboJson = null;
|
|
55590
55614
|
let turboConfigPath = null;
|
|
@@ -55593,7 +55617,7 @@ ${error.message}`;
|
|
|
55593
55617
|
if (turboConfigPath) try {
|
|
55594
55618
|
turboJson = import_json5.default.parse(await import_fs_extra7.default.readFile(turboConfigPath, "utf8"));
|
|
55595
55619
|
} catch (err) {
|
|
55596
|
-
console.warn(`WARNING: Failed to parse ${
|
|
55620
|
+
console.warn(`WARNING: Failed to parse ${import_path6.default.basename(turboConfigPath)}`);
|
|
55597
55621
|
}
|
|
55598
55622
|
return turboJson !== null && typeof turboJson === "object" && "globalPassThroughEnv" in turboJson && Array.isArray(turboJson.globalPassThroughEnv) && turboJson.globalPassThroughEnv.includes("COREPACK_HOME");
|
|
55599
55623
|
}
|
|
@@ -55627,13 +55651,13 @@ ${error.message}`;
|
|
|
55627
55651
|
return true;
|
|
55628
55652
|
}
|
|
55629
55653
|
async function walkParentDirs({ base, start, filename }) {
|
|
55630
|
-
(0, import_assert6.default)(
|
|
55631
|
-
(0, import_assert6.default)(
|
|
55654
|
+
(0, import_assert6.default)(import_path6.default.isAbsolute(base), "Expected \"base\" to be absolute path");
|
|
55655
|
+
(0, import_assert6.default)(import_path6.default.isAbsolute(start), "Expected \"start\" to be absolute path");
|
|
55632
55656
|
for (const dir of traverseUpDirectories({
|
|
55633
55657
|
start,
|
|
55634
55658
|
base
|
|
55635
55659
|
})) {
|
|
55636
|
-
const fullPath =
|
|
55660
|
+
const fullPath = import_path6.default.join(dir, filename);
|
|
55637
55661
|
if (await import_fs_extra7.default.pathExists(fullPath)) return fullPath;
|
|
55638
55662
|
}
|
|
55639
55663
|
return null;
|
|
@@ -55644,10 +55668,10 @@ ${error.message}`;
|
|
|
55644
55668
|
start,
|
|
55645
55669
|
base
|
|
55646
55670
|
})) {
|
|
55647
|
-
const fullPaths = filenames.map((f) =>
|
|
55671
|
+
const fullPaths = filenames.map((f) => import_path6.default.join(dir, f));
|
|
55648
55672
|
const existResults = await Promise.all(fullPaths.map((f) => import_fs_extra7.default.pathExists(f)));
|
|
55649
55673
|
const foundOneOrMore = existResults.some((b) => b);
|
|
55650
|
-
const packageJsonPath =
|
|
55674
|
+
const packageJsonPath = import_path6.default.join(dir, "package.json");
|
|
55651
55675
|
const packageJson = await import_fs_extra7.default.readJSON(packageJsonPath).catch(() => null);
|
|
55652
55676
|
if (packageJson?.packageManager) packageManager = packageJson.packageManager;
|
|
55653
55677
|
if (foundOneOrMore) return {
|
|
@@ -55707,12 +55731,16 @@ ${error.message}`;
|
|
|
55707
55731
|
};
|
|
55708
55732
|
}
|
|
55709
55733
|
var runNpmInstallSema = new import_async_sema4.default(1);
|
|
55734
|
+
var customInstallCommandSet;
|
|
55735
|
+
function resetCustomInstallCommandSet() {
|
|
55736
|
+
customInstallCommandSet = void 0;
|
|
55737
|
+
}
|
|
55710
55738
|
async function runNpmInstall(destPath, args = [], spawnOpts, meta, projectCreatedAt) {
|
|
55711
55739
|
if (meta?.isDev) {
|
|
55712
55740
|
debug$2("Skipping dependency installation because dev mode is enabled");
|
|
55713
55741
|
return false;
|
|
55714
55742
|
}
|
|
55715
|
-
(0, import_assert6.default)(
|
|
55743
|
+
(0, import_assert6.default)(import_path6.default.isAbsolute(destPath));
|
|
55716
55744
|
try {
|
|
55717
55745
|
await runNpmInstallSema.acquire();
|
|
55718
55746
|
const { cliType, packageJsonPath, packageJson, lockfileVersion, packageJsonPackageManager, turboSupportsCorepackHome } = await scanParentDirs(destPath, true);
|
|
@@ -55724,6 +55752,12 @@ ${error.message}`;
|
|
|
55724
55752
|
if (meta && packageJsonPath && defaultInstall) {
|
|
55725
55753
|
const { alreadyInstalled, runNpmInstallSet } = checkIfAlreadyInstalled(meta.runNpmInstallSet, packageJsonPath);
|
|
55726
55754
|
if (alreadyInstalled) return false;
|
|
55755
|
+
if (process.env.VERCEL_INSTALL_COMPLETED === "1") {
|
|
55756
|
+
debug$2(`Skipping dependency installation for ${packageJsonPath} because VERCEL_INSTALL_COMPLETED is set`);
|
|
55757
|
+
runNpmInstallSet.add(packageJsonPath);
|
|
55758
|
+
meta.runNpmInstallSet = runNpmInstallSet;
|
|
55759
|
+
return false;
|
|
55760
|
+
}
|
|
55727
55761
|
meta.runNpmInstallSet = runNpmInstallSet;
|
|
55728
55762
|
}
|
|
55729
55763
|
if (cliType === "yarn") {
|
|
@@ -55779,11 +55813,11 @@ ${error.message}`;
|
|
|
55779
55813
|
else debug$2(`Detected ${detectedPackageManager}. Added "${newPath}" to path. Based on assumed package manager "${cliType}", lockfile "${detectedLockfile}", and lockfileVersion "${lockfileVersion}"`);
|
|
55780
55814
|
const newEnv = { ...env };
|
|
55781
55815
|
const alreadyInPath = (newPath2) => {
|
|
55782
|
-
return (env.PATH ?? "").split(
|
|
55816
|
+
return (env.PATH ?? "").split(import_path6.default.delimiter).includes(newPath2);
|
|
55783
55817
|
};
|
|
55784
55818
|
if (newPath && !alreadyInPath(newPath)) {
|
|
55785
55819
|
const oldPath = env.PATH + "";
|
|
55786
|
-
newEnv.PATH = `${newPath}${
|
|
55820
|
+
newEnv.PATH = `${newPath}${import_path6.default.delimiter}${oldPath}`;
|
|
55787
55821
|
if (detectedLockfile && detectedPackageManager) {
|
|
55788
55822
|
const detectedV9PnpmLockfile = detectedLockfile === "pnpm-lock.yaml" && lockfileVersion === 9;
|
|
55789
55823
|
if (detectedPackageManager === "pnpm@10.x" && packageJsonPackageManager) {
|
|
@@ -55950,7 +55984,7 @@ To use ${otherVersion}, manually opt in using corepack (https://vercel.com/docs/
|
|
|
55950
55984
|
});
|
|
55951
55985
|
if (corepackEnabled) overrides = NO_OVERRIDE;
|
|
55952
55986
|
const alreadyInPath = (newPath) => {
|
|
55953
|
-
return (env.PATH ?? "").split(
|
|
55987
|
+
return (env.PATH ?? "").split(import_path6.default.delimiter).includes(newPath);
|
|
55954
55988
|
};
|
|
55955
55989
|
switch (true) {
|
|
55956
55990
|
case cliType === "yarn" && !env.YARN_NODE_LINKER: return {
|
|
@@ -55970,6 +56004,17 @@ To use ${otherVersion}, manually opt in using corepack (https://vercel.com/docs/
|
|
|
55970
56004
|
}
|
|
55971
56005
|
}
|
|
55972
56006
|
async function runCustomInstallCommand({ destPath, installCommand, spawnOpts, projectCreatedAt }) {
|
|
56007
|
+
const normalizedPath = import_path6.default.normalize(destPath);
|
|
56008
|
+
const { alreadyInstalled, runNpmInstallSet } = checkIfAlreadyInstalled(customInstallCommandSet, normalizedPath);
|
|
56009
|
+
customInstallCommandSet = runNpmInstallSet;
|
|
56010
|
+
if (alreadyInstalled) {
|
|
56011
|
+
debug$2(`Skipping custom install command for ${normalizedPath} because it was already run`);
|
|
56012
|
+
return false;
|
|
56013
|
+
}
|
|
56014
|
+
if (process.env.VERCEL_INSTALL_COMPLETED === "1") {
|
|
56015
|
+
debug$2(`Skipping custom install command for ${normalizedPath} because VERCEL_INSTALL_COMPLETED is set`);
|
|
56016
|
+
return false;
|
|
56017
|
+
}
|
|
55973
56018
|
console.log(`Running "install" command: \`${installCommand}\`...`);
|
|
55974
56019
|
const { cliType, lockfileVersion, packageJson, packageJsonPackageManager, turboSupportsCorepackHome } = await scanParentDirs(destPath, true);
|
|
55975
56020
|
const env = getEnvForPackageManager({
|
|
@@ -55987,9 +56032,10 @@ To use ${otherVersion}, manually opt in using corepack (https://vercel.com/docs/
|
|
|
55987
56032
|
env,
|
|
55988
56033
|
cwd: destPath
|
|
55989
56034
|
});
|
|
56035
|
+
return true;
|
|
55990
56036
|
}
|
|
55991
56037
|
async function runPackageJsonScript(destPath, scriptNames, spawnOpts, projectCreatedAt) {
|
|
55992
|
-
(0, import_assert6.default)(
|
|
56038
|
+
(0, import_assert6.default)(import_path6.default.isAbsolute(destPath));
|
|
55993
56039
|
const { packageJson, cliType, lockfileVersion, packageJsonPackageManager, turboSupportsCorepackHome } = await scanParentDirs(destPath, true);
|
|
55994
56040
|
const scriptName = getScriptName(packageJson, typeof scriptNames === "string" ? [scriptNames] : scriptNames);
|
|
55995
56041
|
if (!scriptName) return false;
|
|
@@ -56023,7 +56069,7 @@ To use ${otherVersion}, manually opt in using corepack (https://vercel.com/docs/
|
|
|
56023
56069
|
debug$2("Skipping dependency installation because dev mode is enabled");
|
|
56024
56070
|
return;
|
|
56025
56071
|
}
|
|
56026
|
-
(0, import_assert6.default)(
|
|
56072
|
+
(0, import_assert6.default)(import_path6.default.isAbsolute(destPath));
|
|
56027
56073
|
const opts = {
|
|
56028
56074
|
...spawnOpts,
|
|
56029
56075
|
cwd: destPath,
|
|
@@ -56034,19 +56080,26 @@ To use ${otherVersion}, manually opt in using corepack (https://vercel.com/docs/
|
|
|
56034
56080
|
async function runPipInstall(destPath, args = [], spawnOpts, meta) {
|
|
56035
56081
|
if (meta && meta.isDev) {
|
|
56036
56082
|
debug$2("Skipping dependency installation because dev mode is enabled");
|
|
56037
|
-
return;
|
|
56083
|
+
return { installed: false };
|
|
56038
56084
|
}
|
|
56039
|
-
(0, import_assert6.default)(
|
|
56085
|
+
(0, import_assert6.default)(import_path6.default.isAbsolute(destPath));
|
|
56086
|
+
const targetDir = import_path6.default.join(destPath, ".vercel_python_packages");
|
|
56040
56087
|
const opts = {
|
|
56041
56088
|
...spawnOpts,
|
|
56042
56089
|
cwd: destPath,
|
|
56043
|
-
prettyCommand: "
|
|
56090
|
+
prettyCommand: "uv pip install"
|
|
56044
56091
|
};
|
|
56045
|
-
await spawnAsync("
|
|
56092
|
+
await spawnAsync("uv", [
|
|
56093
|
+
"pip",
|
|
56046
56094
|
"install",
|
|
56047
|
-
"--
|
|
56095
|
+
"--target",
|
|
56096
|
+
targetDir,
|
|
56048
56097
|
...args
|
|
56049
56098
|
], opts);
|
|
56099
|
+
return {
|
|
56100
|
+
installed: true,
|
|
56101
|
+
targetDir
|
|
56102
|
+
};
|
|
56050
56103
|
}
|
|
56051
56104
|
function getScriptName(pkg, possibleNames) {
|
|
56052
56105
|
if (pkg?.scripts) {
|
|
@@ -56054,7 +56107,7 @@ To use ${otherVersion}, manually opt in using corepack (https://vercel.com/docs/
|
|
|
56054
56107
|
}
|
|
56055
56108
|
}
|
|
56056
56109
|
var installDependencies = (0, import_util2.deprecate)(runNpmInstall, "installDependencies() is deprecated. Please use runNpmInstall() instead.");
|
|
56057
|
-
var
|
|
56110
|
+
var import_path7 = __toESM(require("path"));
|
|
56058
56111
|
var import_fs_extra8 = __toESM(require_lib());
|
|
56059
56112
|
var import_ignore = __toESM(require_ignore());
|
|
56060
56113
|
function isCodedError(error) {
|
|
@@ -56072,8 +56125,8 @@ To use ${otherVersion}, manually opt in using corepack (https://vercel.com/docs/
|
|
|
56072
56125
|
throw error;
|
|
56073
56126
|
}
|
|
56074
56127
|
};
|
|
56075
|
-
const vercelIgnorePath =
|
|
56076
|
-
const nowIgnorePath =
|
|
56128
|
+
const vercelIgnorePath = import_path7.default.join(downloadPath, rootDirectory || "", ".vercelignore");
|
|
56129
|
+
const nowIgnorePath = import_path7.default.join(downloadPath, rootDirectory || "", ".nowignore");
|
|
56077
56130
|
const ignoreContents = [];
|
|
56078
56131
|
try {
|
|
56079
56132
|
ignoreContents.push(...(await Promise.all([readFile4(vercelIgnorePath), readFile4(nowIgnorePath)])).filter(Boolean));
|
|
@@ -56111,18 +56164,18 @@ To use ${otherVersion}, manually opt in using corepack (https://vercel.com/docs/
|
|
|
56111
56164
|
}
|
|
56112
56165
|
return newEnvs;
|
|
56113
56166
|
}
|
|
56114
|
-
var
|
|
56167
|
+
var import_path8 = __toESM(require("path"));
|
|
56115
56168
|
var import_fs2 = require("fs");
|
|
56116
56169
|
async function hardLinkDir(src, destDirs) {
|
|
56117
56170
|
if (destDirs.length === 0) return;
|
|
56118
|
-
destDirs = destDirs.filter((destDir) =>
|
|
56171
|
+
destDirs = destDirs.filter((destDir) => import_path8.default.relative(destDir, src) !== "");
|
|
56119
56172
|
const files = await import_fs2.promises.readdir(src);
|
|
56120
56173
|
await Promise.all(files.map(async (file) => {
|
|
56121
56174
|
if (file === "node_modules") return;
|
|
56122
|
-
const srcFile =
|
|
56175
|
+
const srcFile = import_path8.default.join(src, file);
|
|
56123
56176
|
if ((await import_fs2.promises.lstat(srcFile)).isDirectory()) {
|
|
56124
56177
|
await hardLinkDir(srcFile, await Promise.all(destDirs.map(async (destDir) => {
|
|
56125
|
-
const destSubdir =
|
|
56178
|
+
const destSubdir = import_path8.default.join(destDir, file);
|
|
56126
56179
|
try {
|
|
56127
56180
|
await import_fs2.promises.mkdir(destSubdir, { recursive: true });
|
|
56128
56181
|
} catch (err) {
|
|
@@ -56133,7 +56186,7 @@ To use ${otherVersion}, manually opt in using corepack (https://vercel.com/docs/
|
|
|
56133
56186
|
return;
|
|
56134
56187
|
}
|
|
56135
56188
|
await Promise.all(destDirs.map(async (destDir) => {
|
|
56136
|
-
const destFile =
|
|
56189
|
+
const destFile = import_path8.default.join(destDir, file);
|
|
56137
56190
|
try {
|
|
56138
56191
|
await linkOrCopyFile(srcFile, destFile);
|
|
56139
56192
|
} catch (err) {
|
|
@@ -56148,7 +56201,7 @@ To use ${otherVersion}, manually opt in using corepack (https://vercel.com/docs/
|
|
|
56148
56201
|
await linkOrCopy(srcFile, destFile);
|
|
56149
56202
|
} catch (err) {
|
|
56150
56203
|
if (err.code === "ENOENT") {
|
|
56151
|
-
await import_fs2.promises.mkdir(
|
|
56204
|
+
await import_fs2.promises.mkdir(import_path8.default.dirname(destFile), { recursive: true });
|
|
56152
56205
|
await linkOrCopy(srcFile, destFile);
|
|
56153
56206
|
return;
|
|
56154
56207
|
}
|
|
@@ -56163,10 +56216,10 @@ To use ${otherVersion}, manually opt in using corepack (https://vercel.com/docs/
|
|
|
56163
56216
|
await import_fs2.promises.copyFile(srcFile, destFile);
|
|
56164
56217
|
}
|
|
56165
56218
|
}
|
|
56166
|
-
var
|
|
56219
|
+
var import_path9 = require("path");
|
|
56167
56220
|
var import_promises = require("fs/promises");
|
|
56168
56221
|
async function validateNpmrc(cwd) {
|
|
56169
|
-
if ((await (0, import_promises.readFile)((0,
|
|
56222
|
+
if ((await (0, import_promises.readFile)((0, import_path9.join)(cwd, ".npmrc"), "utf-8").catch((err) => {
|
|
56170
56223
|
if (err.code !== "ENOENT") throw err;
|
|
56171
56224
|
}))?.match(/(?<!#.*)use-node-version/)) throw new Error("Detected unsupported \"use-node-version\" in your \".npmrc\". Please use \"engines\" in your \"package.json\" instead.");
|
|
56172
56225
|
}
|
|
@@ -56207,12 +56260,12 @@ To use ${otherVersion}, manually opt in using corepack (https://vercel.com/docs/
|
|
|
56207
56260
|
if (!os) return "provided.al2023";
|
|
56208
56261
|
return os.PRETTY_NAME === "Amazon Linux 2" ? "provided.al2" : "provided.al2023";
|
|
56209
56262
|
}
|
|
56210
|
-
var
|
|
56263
|
+
var import_path10 = require("path");
|
|
56211
56264
|
var shouldServe = ({ entrypoint, files, requestPath }) => {
|
|
56212
56265
|
requestPath = requestPath.replace(/\/$/, "");
|
|
56213
56266
|
entrypoint = entrypoint.replace(/\\/, "/");
|
|
56214
56267
|
if (entrypoint === requestPath && hasProp(files, entrypoint)) return true;
|
|
56215
|
-
const { dir, name } = (0,
|
|
56268
|
+
const { dir, name } = (0, import_path10.parse)(entrypoint);
|
|
56216
56269
|
if (name === "index" && dir === requestPath && hasProp(files, entrypoint)) return true;
|
|
56217
56270
|
return false;
|
|
56218
56271
|
};
|
|
@@ -56493,14 +56546,21 @@ ${entrypointsForMessage}`);
|
|
|
56493
56546
|
"express",
|
|
56494
56547
|
"hono",
|
|
56495
56548
|
"h3",
|
|
56549
|
+
"koa",
|
|
56496
56550
|
"nestjs",
|
|
56497
56551
|
"fastify",
|
|
56498
56552
|
"elysia"
|
|
56499
56553
|
];
|
|
56554
|
+
var PYTHON_FRAMEWORKS = [
|
|
56555
|
+
"fastapi",
|
|
56556
|
+
"flask",
|
|
56557
|
+
"python"
|
|
56558
|
+
];
|
|
56500
56559
|
var BACKEND_BUILDERS = [
|
|
56501
56560
|
"@vercel/express",
|
|
56502
56561
|
"@vercel/hono",
|
|
56503
56562
|
"@vercel/h3",
|
|
56563
|
+
"@vercel/koa",
|
|
56504
56564
|
"@vercel/nestjs",
|
|
56505
56565
|
"@vercel/fastify",
|
|
56506
56566
|
"@vercel/elysia"
|
|
@@ -56509,6 +56569,10 @@ ${entrypointsForMessage}`);
|
|
|
56509
56569
|
if (!framework) return false;
|
|
56510
56570
|
return BACKEND_FRAMEWORKS.includes(framework);
|
|
56511
56571
|
}
|
|
56572
|
+
function isPythonFramework(framework) {
|
|
56573
|
+
if (!framework) return false;
|
|
56574
|
+
return PYTHON_FRAMEWORKS.includes(framework);
|
|
56575
|
+
}
|
|
56512
56576
|
function isExperimentalBackendsWithoutIntrospectionEnabled() {
|
|
56513
56577
|
return process.env.VERCEL_BACKENDS_BUILDS === "1";
|
|
56514
56578
|
}
|
|
@@ -56524,12 +56588,12 @@ ${entrypointsForMessage}`);
|
|
|
56524
56588
|
return isExperimentalBackendsEnabled() && isBackendFramework(framework);
|
|
56525
56589
|
}
|
|
56526
56590
|
var import_fs3 = __toESM(require("fs"));
|
|
56527
|
-
var
|
|
56591
|
+
var import_path11 = require("path");
|
|
56528
56592
|
var import_execa = __toESM(require_execa());
|
|
56529
56593
|
var isWin2 = process.platform === "win32";
|
|
56530
56594
|
async function runStdlibPyScript(options) {
|
|
56531
56595
|
const { scriptName, pythonPath, args = [], cwd } = options;
|
|
56532
|
-
const scriptPath = (0,
|
|
56596
|
+
const scriptPath = (0, import_path11.join)(__dirname, "..", "lib", "python", `${scriptName}.py`);
|
|
56533
56597
|
if (!import_fs3.default.existsSync(scriptPath)) throw new Error(`Python script not found: ${scriptPath}`);
|
|
56534
56598
|
const pythonCmd = pythonPath ?? (isWin2 ? "python" : "python3");
|
|
56535
56599
|
debug$2(`Running stdlib Python script: ${pythonCmd} ${scriptPath} ${args.join(" ")}`);
|
|
@@ -56681,22 +56745,6 @@ const extractRoutes = () => {
|
|
|
56681
56745
|
};
|
|
56682
56746
|
};
|
|
56683
56747
|
|
|
56684
|
-
//#endregion
|
|
56685
|
-
//#region src/loaders/block-network.ts
|
|
56686
|
-
for (const mod of [
|
|
56687
|
-
"net",
|
|
56688
|
-
"dns",
|
|
56689
|
-
"http",
|
|
56690
|
-
"https",
|
|
56691
|
-
"tls",
|
|
56692
|
-
"dgram"
|
|
56693
|
-
]) try {
|
|
56694
|
-
const m = require(mod);
|
|
56695
|
-
for (const key of Object.keys(m)) m[key] = new Proxy(m[key], { apply() {
|
|
56696
|
-
throw new Error("Networking is disabled");
|
|
56697
|
-
} });
|
|
56698
|
-
} catch {}
|
|
56699
|
-
|
|
56700
56748
|
//#endregion
|
|
56701
56749
|
//#region src/loaders/cjs.ts
|
|
56702
56750
|
const originalRequire = module$1.default.prototype.require;
|
package/dist/loaders/esm.mjs
CHANGED
|
@@ -1,25 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { register } from "node:module";
|
|
2
2
|
|
|
3
|
-
//#region rolldown:runtime
|
|
4
|
-
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
5
|
-
|
|
6
|
-
//#endregion
|
|
7
|
-
//#region src/loaders/block-network.ts
|
|
8
|
-
for (const mod of [
|
|
9
|
-
"net",
|
|
10
|
-
"dns",
|
|
11
|
-
"http",
|
|
12
|
-
"https",
|
|
13
|
-
"tls",
|
|
14
|
-
"dgram"
|
|
15
|
-
]) try {
|
|
16
|
-
const m = __require(mod);
|
|
17
|
-
for (const key of Object.keys(m)) m[key] = new Proxy(m[key], { apply() {
|
|
18
|
-
throw new Error("Networking is disabled");
|
|
19
|
-
} });
|
|
20
|
-
} catch {}
|
|
21
|
-
|
|
22
|
-
//#endregion
|
|
23
3
|
//#region src/loaders/esm.ts
|
|
24
4
|
register(new URL("./hooks.mjs", import.meta.url), import.meta.url);
|
|
25
5
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/introspection",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"homepage": "https://vercel.com/docs",
|
|
6
6
|
"type": "module",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@types/fs-extra": "11",
|
|
34
34
|
"@types/jest": "27.5.1",
|
|
35
35
|
"@vercel/nft": "1.1.1",
|
|
36
|
-
"@types/node": "
|
|
36
|
+
"@types/node": "20.11.0",
|
|
37
37
|
"fs-extra": "11.1.0",
|
|
38
38
|
"execa": "3.2.0",
|
|
39
39
|
"hono": "4.10.1",
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
"tsdown": "0.16.3",
|
|
42
42
|
"vite": "^5.1.6",
|
|
43
43
|
"vitest": "^2.0.1",
|
|
44
|
-
"@vercel/
|
|
45
|
-
"@vercel/build-utils": "13.2.
|
|
46
|
-
"@vercel/
|
|
44
|
+
"@vercel/cervel": "0.0.10",
|
|
45
|
+
"@vercel/build-utils": "13.2.14",
|
|
46
|
+
"@vercel/static-config": "3.1.2"
|
|
47
47
|
},
|
|
48
48
|
"scripts": {
|
|
49
49
|
"build": "tsdown",
|