@vercel/introspection 0.0.9 → 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 +39 -10
- package/dist/hono.mjs +39 -10
- package/dist/index.mjs +97 -29
- package/dist/loaders/cjs.cjs +39 -26
- 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);
|
|
@@ -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,
|
|
@@ -54373,6 +54377,7 @@ ${error.message}`;
|
|
|
54373
54377
|
getLatestNodeVersion: () => getLatestNodeVersion,
|
|
54374
54378
|
getNodeBinPath: () => getNodeBinPath,
|
|
54375
54379
|
getNodeBinPaths: () => getNodeBinPaths,
|
|
54380
|
+
getNodeVersion: () => getNodeVersion,
|
|
54376
54381
|
getOsRelease: () => getOsRelease,
|
|
54377
54382
|
getPackageJson: () => getPackageJson,
|
|
54378
54383
|
getPathForPackageManager: () => getPathForPackageManager,
|
|
@@ -54380,7 +54385,6 @@ ${error.message}`;
|
|
|
54380
54385
|
getPrefixedEnvVars: () => getPrefixedEnvVars,
|
|
54381
54386
|
getPrettyError: () => getPrettyError,
|
|
54382
54387
|
getProvidedRuntime: () => getProvidedRuntime,
|
|
54383
|
-
getRuntimeNodeVersion: () => getRuntimeNodeVersion,
|
|
54384
54388
|
getScriptName: () => getScriptName,
|
|
54385
54389
|
getSpawnOptions: () => getSpawnOptions,
|
|
54386
54390
|
getSupportedBunVersion: () => getSupportedBunVersion,
|
|
@@ -54396,6 +54400,7 @@ ${error.message}`;
|
|
|
54396
54400
|
isExperimentalBackendsEnabled: () => isExperimentalBackendsEnabled,
|
|
54397
54401
|
isExperimentalBackendsWithoutIntrospectionEnabled: () => isExperimentalBackendsWithoutIntrospectionEnabled,
|
|
54398
54402
|
isPythonEntrypoint: () => isPythonEntrypoint,
|
|
54403
|
+
isPythonFramework: () => isPythonFramework,
|
|
54399
54404
|
isSymbolicLink: () => isSymbolicLink,
|
|
54400
54405
|
normalizePath: () => normalizePath,
|
|
54401
54406
|
readConfigFile: () => readConfigFile,
|
|
@@ -54861,7 +54866,7 @@ ${error.message}`;
|
|
|
54861
54866
|
(0, import_assert4.default)(typeof runtime === "string", "\"runtime\" is not a string");
|
|
54862
54867
|
(0, import_assert4.default)(typeof environment === "object", "\"environment\" is not an object");
|
|
54863
54868
|
if (architecture !== void 0) (0, import_assert4.default)(architecture === "x86_64" || architecture === "arm64", "\"architecture\" must be either \"x86_64\" or \"arm64\"");
|
|
54864
|
-
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\"");
|
|
54865
54870
|
if ("experimentalAllowBundling" in opts && opts.experimentalAllowBundling !== void 0) (0, import_assert4.default)(typeof opts.experimentalAllowBundling === "boolean", "\"experimentalAllowBundling\" is not a boolean");
|
|
54866
54871
|
if (memory !== void 0) (0, import_assert4.default)(typeof memory === "number", "\"memory\" is not a number");
|
|
54867
54872
|
if (maxDuration !== void 0) (0, import_assert4.default)(typeof maxDuration === "number", "\"maxDuration\" is not a number");
|
|
@@ -55469,14 +55474,14 @@ ${error.message}`;
|
|
|
55469
55474
|
}
|
|
55470
55475
|
return opts;
|
|
55471
55476
|
}
|
|
55472
|
-
async function
|
|
55477
|
+
async function getNodeVersion(destPath, fallbackVersion = process.env.VERCEL_PROJECT_SETTINGS_NODE_VERSION, config = {}, meta = {}, availableVersions = getAvailableNodeVersions()) {
|
|
55473
55478
|
if (config.bunVersion) return getSupportedBunVersion(config.bunVersion);
|
|
55474
55479
|
const latestVersion = getLatestNodeVersion(availableVersions);
|
|
55475
55480
|
if (meta.isDev) {
|
|
55476
55481
|
latestVersion.runtime = "nodejs";
|
|
55477
55482
|
return latestVersion;
|
|
55478
55483
|
}
|
|
55479
|
-
const { packageJson } = await
|
|
55484
|
+
const { packageJson } = await findPackageJson(destPath, true);
|
|
55480
55485
|
const configuredVersion = config.nodeVersion || fallbackVersion;
|
|
55481
55486
|
const packageJsonVersion = packageJson?.engines?.node;
|
|
55482
55487
|
const supportedNodeVersion = await getSupportedNodeVersion(packageJsonVersion || configuredVersion, !packageJsonVersion, availableVersions);
|
|
@@ -55488,7 +55493,7 @@ ${error.message}`;
|
|
|
55488
55493
|
}
|
|
55489
55494
|
return supportedNodeVersion;
|
|
55490
55495
|
}
|
|
55491
|
-
async function
|
|
55496
|
+
async function findPackageJson(destPath, readPackageJson = false, base = "/") {
|
|
55492
55497
|
(0, import_assert6.default)(import_path6.default.isAbsolute(destPath));
|
|
55493
55498
|
const pkgJsonPath = await walkParentDirs({
|
|
55494
55499
|
base,
|
|
@@ -55501,6 +55506,14 @@ ${error.message}`;
|
|
|
55501
55506
|
} catch (err) {
|
|
55502
55507
|
throw new Error(`Could not read ${pkgJsonPath}: ${err.message}.`);
|
|
55503
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);
|
|
55504
55517
|
const { paths: [yarnLockPath, npmLockPath, pnpmLockPath, bunLockTextPath, bunLockBinPath, vltLockPath], packageJsonPackageManager } = await walkParentDirsMulti({
|
|
55505
55518
|
base,
|
|
55506
55519
|
start: destPath,
|
|
@@ -56048,19 +56061,26 @@ To use ${otherVersion}, manually opt in using corepack (https://vercel.com/docs/
|
|
|
56048
56061
|
async function runPipInstall(destPath, args = [], spawnOpts, meta) {
|
|
56049
56062
|
if (meta && meta.isDev) {
|
|
56050
56063
|
debug$1("Skipping dependency installation because dev mode is enabled");
|
|
56051
|
-
return;
|
|
56064
|
+
return { installed: false };
|
|
56052
56065
|
}
|
|
56053
56066
|
(0, import_assert6.default)(import_path6.default.isAbsolute(destPath));
|
|
56067
|
+
const targetDir = import_path6.default.join(destPath, ".vercel_python_packages");
|
|
56054
56068
|
const opts = {
|
|
56055
56069
|
...spawnOpts,
|
|
56056
56070
|
cwd: destPath,
|
|
56057
|
-
prettyCommand: "
|
|
56071
|
+
prettyCommand: "uv pip install"
|
|
56058
56072
|
};
|
|
56059
|
-
await spawnAsync("
|
|
56073
|
+
await spawnAsync("uv", [
|
|
56074
|
+
"pip",
|
|
56060
56075
|
"install",
|
|
56061
|
-
"--
|
|
56076
|
+
"--target",
|
|
56077
|
+
targetDir,
|
|
56062
56078
|
...args
|
|
56063
56079
|
], opts);
|
|
56080
|
+
return {
|
|
56081
|
+
installed: true,
|
|
56082
|
+
targetDir
|
|
56083
|
+
};
|
|
56064
56084
|
}
|
|
56065
56085
|
function getScriptName(pkg, possibleNames) {
|
|
56066
56086
|
if (pkg?.scripts) {
|
|
@@ -56512,6 +56532,11 @@ ${entrypointsForMessage}`);
|
|
|
56512
56532
|
"fastify",
|
|
56513
56533
|
"elysia"
|
|
56514
56534
|
];
|
|
56535
|
+
var PYTHON_FRAMEWORKS = [
|
|
56536
|
+
"fastapi",
|
|
56537
|
+
"flask",
|
|
56538
|
+
"python"
|
|
56539
|
+
];
|
|
56515
56540
|
var BACKEND_BUILDERS = [
|
|
56516
56541
|
"@vercel/express",
|
|
56517
56542
|
"@vercel/hono",
|
|
@@ -56525,6 +56550,10 @@ ${entrypointsForMessage}`);
|
|
|
56525
56550
|
if (!framework) return false;
|
|
56526
56551
|
return BACKEND_FRAMEWORKS.includes(framework);
|
|
56527
56552
|
}
|
|
56553
|
+
function isPythonFramework(framework) {
|
|
56554
|
+
if (!framework) return false;
|
|
56555
|
+
return PYTHON_FRAMEWORKS.includes(framework);
|
|
56556
|
+
}
|
|
56528
56557
|
function isExperimentalBackendsWithoutIntrospectionEnabled() {
|
|
56529
56558
|
return process.env.VERCEL_BACKENDS_BUILDS === "1";
|
|
56530
56559
|
}
|
package/dist/hono.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);
|
|
@@ -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,
|
|
@@ -54373,6 +54377,7 @@ ${error.message}`;
|
|
|
54373
54377
|
getLatestNodeVersion: () => getLatestNodeVersion,
|
|
54374
54378
|
getNodeBinPath: () => getNodeBinPath,
|
|
54375
54379
|
getNodeBinPaths: () => getNodeBinPaths,
|
|
54380
|
+
getNodeVersion: () => getNodeVersion,
|
|
54376
54381
|
getOsRelease: () => getOsRelease,
|
|
54377
54382
|
getPackageJson: () => getPackageJson,
|
|
54378
54383
|
getPathForPackageManager: () => getPathForPackageManager,
|
|
@@ -54380,7 +54385,6 @@ ${error.message}`;
|
|
|
54380
54385
|
getPrefixedEnvVars: () => getPrefixedEnvVars,
|
|
54381
54386
|
getPrettyError: () => getPrettyError,
|
|
54382
54387
|
getProvidedRuntime: () => getProvidedRuntime,
|
|
54383
|
-
getRuntimeNodeVersion: () => getRuntimeNodeVersion,
|
|
54384
54388
|
getScriptName: () => getScriptName,
|
|
54385
54389
|
getSpawnOptions: () => getSpawnOptions,
|
|
54386
54390
|
getSupportedBunVersion: () => getSupportedBunVersion,
|
|
@@ -54396,6 +54400,7 @@ ${error.message}`;
|
|
|
54396
54400
|
isExperimentalBackendsEnabled: () => isExperimentalBackendsEnabled,
|
|
54397
54401
|
isExperimentalBackendsWithoutIntrospectionEnabled: () => isExperimentalBackendsWithoutIntrospectionEnabled,
|
|
54398
54402
|
isPythonEntrypoint: () => isPythonEntrypoint,
|
|
54403
|
+
isPythonFramework: () => isPythonFramework,
|
|
54399
54404
|
isSymbolicLink: () => isSymbolicLink,
|
|
54400
54405
|
normalizePath: () => normalizePath,
|
|
54401
54406
|
readConfigFile: () => readConfigFile,
|
|
@@ -54861,7 +54866,7 @@ ${error.message}`;
|
|
|
54861
54866
|
(0, import_assert4.default)(typeof runtime === "string", "\"runtime\" is not a string");
|
|
54862
54867
|
(0, import_assert4.default)(typeof environment === "object", "\"environment\" is not an object");
|
|
54863
54868
|
if (architecture !== void 0) (0, import_assert4.default)(architecture === "x86_64" || architecture === "arm64", "\"architecture\" must be either \"x86_64\" or \"arm64\"");
|
|
54864
|
-
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\"");
|
|
54865
54870
|
if ("experimentalAllowBundling" in opts && opts.experimentalAllowBundling !== void 0) (0, import_assert4.default)(typeof opts.experimentalAllowBundling === "boolean", "\"experimentalAllowBundling\" is not a boolean");
|
|
54866
54871
|
if (memory !== void 0) (0, import_assert4.default)(typeof memory === "number", "\"memory\" is not a number");
|
|
54867
54872
|
if (maxDuration !== void 0) (0, import_assert4.default)(typeof maxDuration === "number", "\"maxDuration\" is not a number");
|
|
@@ -55469,14 +55474,14 @@ ${error.message}`;
|
|
|
55469
55474
|
}
|
|
55470
55475
|
return opts;
|
|
55471
55476
|
}
|
|
55472
|
-
async function
|
|
55477
|
+
async function getNodeVersion(destPath, fallbackVersion = process.env.VERCEL_PROJECT_SETTINGS_NODE_VERSION, config = {}, meta = {}, availableVersions = getAvailableNodeVersions()) {
|
|
55473
55478
|
if (config.bunVersion) return getSupportedBunVersion(config.bunVersion);
|
|
55474
55479
|
const latestVersion = getLatestNodeVersion(availableVersions);
|
|
55475
55480
|
if (meta.isDev) {
|
|
55476
55481
|
latestVersion.runtime = "nodejs";
|
|
55477
55482
|
return latestVersion;
|
|
55478
55483
|
}
|
|
55479
|
-
const { packageJson } = await
|
|
55484
|
+
const { packageJson } = await findPackageJson(destPath, true);
|
|
55480
55485
|
const configuredVersion = config.nodeVersion || fallbackVersion;
|
|
55481
55486
|
const packageJsonVersion = packageJson?.engines?.node;
|
|
55482
55487
|
const supportedNodeVersion = await getSupportedNodeVersion(packageJsonVersion || configuredVersion, !packageJsonVersion, availableVersions);
|
|
@@ -55488,7 +55493,7 @@ ${error.message}`;
|
|
|
55488
55493
|
}
|
|
55489
55494
|
return supportedNodeVersion;
|
|
55490
55495
|
}
|
|
55491
|
-
async function
|
|
55496
|
+
async function findPackageJson(destPath, readPackageJson = false, base = "/") {
|
|
55492
55497
|
(0, import_assert6.default)(import_path6.default.isAbsolute(destPath));
|
|
55493
55498
|
const pkgJsonPath = await walkParentDirs({
|
|
55494
55499
|
base,
|
|
@@ -55501,6 +55506,14 @@ ${error.message}`;
|
|
|
55501
55506
|
} catch (err) {
|
|
55502
55507
|
throw new Error(`Could not read ${pkgJsonPath}: ${err.message}.`);
|
|
55503
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);
|
|
55504
55517
|
const { paths: [yarnLockPath, npmLockPath, pnpmLockPath, bunLockTextPath, bunLockBinPath, vltLockPath], packageJsonPackageManager } = await walkParentDirsMulti({
|
|
55505
55518
|
base,
|
|
55506
55519
|
start: destPath,
|
|
@@ -56048,19 +56061,26 @@ To use ${otherVersion}, manually opt in using corepack (https://vercel.com/docs/
|
|
|
56048
56061
|
async function runPipInstall(destPath, args = [], spawnOpts, meta) {
|
|
56049
56062
|
if (meta && meta.isDev) {
|
|
56050
56063
|
debug$1("Skipping dependency installation because dev mode is enabled");
|
|
56051
|
-
return;
|
|
56064
|
+
return { installed: false };
|
|
56052
56065
|
}
|
|
56053
56066
|
(0, import_assert6.default)(import_path6.default.isAbsolute(destPath));
|
|
56067
|
+
const targetDir = import_path6.default.join(destPath, ".vercel_python_packages");
|
|
56054
56068
|
const opts = {
|
|
56055
56069
|
...spawnOpts,
|
|
56056
56070
|
cwd: destPath,
|
|
56057
|
-
prettyCommand: "
|
|
56071
|
+
prettyCommand: "uv pip install"
|
|
56058
56072
|
};
|
|
56059
|
-
await spawnAsync("
|
|
56073
|
+
await spawnAsync("uv", [
|
|
56074
|
+
"pip",
|
|
56060
56075
|
"install",
|
|
56061
|
-
"--
|
|
56076
|
+
"--target",
|
|
56077
|
+
targetDir,
|
|
56062
56078
|
...args
|
|
56063
56079
|
], opts);
|
|
56080
|
+
return {
|
|
56081
|
+
installed: true,
|
|
56082
|
+
targetDir
|
|
56083
|
+
};
|
|
56064
56084
|
}
|
|
56065
56085
|
function getScriptName(pkg, possibleNames) {
|
|
56066
56086
|
if (pkg?.scripts) {
|
|
@@ -56512,6 +56532,11 @@ ${entrypointsForMessage}`);
|
|
|
56512
56532
|
"fastify",
|
|
56513
56533
|
"elysia"
|
|
56514
56534
|
];
|
|
56535
|
+
var PYTHON_FRAMEWORKS = [
|
|
56536
|
+
"fastapi",
|
|
56537
|
+
"flask",
|
|
56538
|
+
"python"
|
|
56539
|
+
];
|
|
56515
56540
|
var BACKEND_BUILDERS = [
|
|
56516
56541
|
"@vercel/express",
|
|
56517
56542
|
"@vercel/hono",
|
|
@@ -56525,6 +56550,10 @@ ${entrypointsForMessage}`);
|
|
|
56525
56550
|
if (!framework) return false;
|
|
56526
56551
|
return BACKEND_FRAMEWORKS.includes(framework);
|
|
56527
56552
|
}
|
|
56553
|
+
function isPythonFramework(framework) {
|
|
56554
|
+
if (!framework) return false;
|
|
56555
|
+
return PYTHON_FRAMEWORKS.includes(framework);
|
|
56556
|
+
}
|
|
56528
56557
|
function isExperimentalBackendsWithoutIntrospectionEnabled() {
|
|
56529
56558
|
return process.env.VERCEL_BACKENDS_BUILDS === "1";
|
|
56530
56559
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
|
-
import {
|
|
3
|
-
import { existsSync } from "fs";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
2
|
+
import { dirname, isAbsolute, join, relative } from "node:path";
|
|
3
|
+
import { createWriteStream, existsSync, mkdtempSync, readFileSync, rmSync, unlinkSync } from "node:fs";
|
|
4
|
+
import { spawn } from "node:child_process";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
import { tmpdir } from "node:os";
|
|
7
7
|
import { z } from "zod";
|
|
8
8
|
|
|
9
9
|
//#region rolldown:runtime
|
|
@@ -2379,7 +2379,7 @@ var require_dist$1 = /* @__PURE__ */ __commonJS$1({ "../build-utils/dist/index.j
|
|
|
2379
2379
|
polyfills(fs8);
|
|
2380
2380
|
fs8.gracefulify = patch;
|
|
2381
2381
|
fs8.createReadStream = createReadStream;
|
|
2382
|
-
fs8.createWriteStream = createWriteStream;
|
|
2382
|
+
fs8.createWriteStream = createWriteStream$1;
|
|
2383
2383
|
var fs$readFile = fs8.readFile;
|
|
2384
2384
|
fs8.readFile = readFile4;
|
|
2385
2385
|
function readFile4(path7, options, cb) {
|
|
@@ -2598,7 +2598,7 @@ var require_dist$1 = /* @__PURE__ */ __commonJS$1({ "../build-utils/dist/index.j
|
|
|
2598
2598
|
function createReadStream(path7, options) {
|
|
2599
2599
|
return new fs8.ReadStream(path7, options);
|
|
2600
2600
|
}
|
|
2601
|
-
function createWriteStream(path7, options) {
|
|
2601
|
+
function createWriteStream$1(path7, options) {
|
|
2602
2602
|
return new fs8.WriteStream(path7, options);
|
|
2603
2603
|
}
|
|
2604
2604
|
var fs$open = fs8.open;
|
|
@@ -3810,7 +3810,7 @@ var require_dist$1 = /* @__PURE__ */ __commonJS$1({ "../build-utils/dist/index.j
|
|
|
3810
3810
|
return obj;
|
|
3811
3811
|
}
|
|
3812
3812
|
var readFile4 = universalify.fromPromise(_readFile);
|
|
3813
|
-
function readFileSync(file, options = {}) {
|
|
3813
|
+
function readFileSync$1(file, options = {}) {
|
|
3814
3814
|
if (typeof options === "string") options = { encoding: options };
|
|
3815
3815
|
const fs7 = options.fs || _fs;
|
|
3816
3816
|
const shouldThrow = "throws" in options ? options.throws : true;
|
|
@@ -3838,7 +3838,7 @@ var require_dist$1 = /* @__PURE__ */ __commonJS$1({ "../build-utils/dist/index.j
|
|
|
3838
3838
|
}
|
|
3839
3839
|
module2.exports = {
|
|
3840
3840
|
readFile: readFile4,
|
|
3841
|
-
readFileSync,
|
|
3841
|
+
readFileSync: readFileSync$1,
|
|
3842
3842
|
writeFile,
|
|
3843
3843
|
writeFileSync
|
|
3844
3844
|
};
|
|
@@ -54344,6 +54344,7 @@ ${error.message}`;
|
|
|
54344
54344
|
NodeVersion: () => NodeVersion,
|
|
54345
54345
|
NodejsLambda: () => NodejsLambda,
|
|
54346
54346
|
NowBuildError: () => NowBuildError,
|
|
54347
|
+
PYTHON_FRAMEWORKS: () => PYTHON_FRAMEWORKS,
|
|
54347
54348
|
Prerender: () => Prerender,
|
|
54348
54349
|
Span: () => Span,
|
|
54349
54350
|
Version: () => Version,
|
|
@@ -54356,6 +54357,7 @@ ${error.message}`;
|
|
|
54356
54357
|
download: () => download,
|
|
54357
54358
|
downloadFile: () => downloadFile,
|
|
54358
54359
|
execCommand: () => execCommand,
|
|
54360
|
+
findPackageJson: () => findPackageJson,
|
|
54359
54361
|
functionsSchema: () => functionsSchema,
|
|
54360
54362
|
generateNodeBuilderFunctions: () => generateNodeBuilderFunctions,
|
|
54361
54363
|
getDiscontinuedNodeVersions: () => getDiscontinuedNodeVersions,
|
|
@@ -54366,6 +54368,7 @@ ${error.message}`;
|
|
|
54366
54368
|
getLatestNodeVersion: () => getLatestNodeVersion,
|
|
54367
54369
|
getNodeBinPath: () => getNodeBinPath,
|
|
54368
54370
|
getNodeBinPaths: () => getNodeBinPaths,
|
|
54371
|
+
getNodeVersion: () => getNodeVersion,
|
|
54369
54372
|
getOsRelease: () => getOsRelease,
|
|
54370
54373
|
getPackageJson: () => getPackageJson,
|
|
54371
54374
|
getPathForPackageManager: () => getPathForPackageManager,
|
|
@@ -54373,7 +54376,6 @@ ${error.message}`;
|
|
|
54373
54376
|
getPrefixedEnvVars: () => getPrefixedEnvVars,
|
|
54374
54377
|
getPrettyError: () => getPrettyError,
|
|
54375
54378
|
getProvidedRuntime: () => getProvidedRuntime,
|
|
54376
|
-
getRuntimeNodeVersion: () => getRuntimeNodeVersion,
|
|
54377
54379
|
getScriptName: () => getScriptName,
|
|
54378
54380
|
getSpawnOptions: () => getSpawnOptions,
|
|
54379
54381
|
getSupportedBunVersion: () => getSupportedBunVersion,
|
|
@@ -54389,6 +54391,7 @@ ${error.message}`;
|
|
|
54389
54391
|
isExperimentalBackendsEnabled: () => isExperimentalBackendsEnabled,
|
|
54390
54392
|
isExperimentalBackendsWithoutIntrospectionEnabled: () => isExperimentalBackendsWithoutIntrospectionEnabled$1,
|
|
54391
54393
|
isPythonEntrypoint: () => isPythonEntrypoint,
|
|
54394
|
+
isPythonFramework: () => isPythonFramework,
|
|
54392
54395
|
isSymbolicLink: () => isSymbolicLink,
|
|
54393
54396
|
normalizePath: () => normalizePath,
|
|
54394
54397
|
readConfigFile: () => readConfigFile,
|
|
@@ -54854,7 +54857,7 @@ ${error.message}`;
|
|
|
54854
54857
|
(0, import_assert4.default)(typeof runtime === "string", "\"runtime\" is not a string");
|
|
54855
54858
|
(0, import_assert4.default)(typeof environment === "object", "\"environment\" is not an object");
|
|
54856
54859
|
if (architecture !== void 0) (0, import_assert4.default)(architecture === "x86_64" || architecture === "arm64", "\"architecture\" must be either \"x86_64\" or \"arm64\"");
|
|
54857
|
-
if (runtimeLanguage !== void 0) (0, import_assert4.default)(runtimeLanguage === "rust", "\"runtimeLanguage\"
|
|
54860
|
+
if (runtimeLanguage !== void 0) (0, import_assert4.default)(runtimeLanguage === "rust" || runtimeLanguage === "go", "\"runtimeLanguage\" is invalid. Valid options: \"rust\", \"go\"");
|
|
54858
54861
|
if ("experimentalAllowBundling" in opts && opts.experimentalAllowBundling !== void 0) (0, import_assert4.default)(typeof opts.experimentalAllowBundling === "boolean", "\"experimentalAllowBundling\" is not a boolean");
|
|
54859
54862
|
if (memory !== void 0) (0, import_assert4.default)(typeof memory === "number", "\"memory\" is not a number");
|
|
54860
54863
|
if (maxDuration !== void 0) (0, import_assert4.default)(typeof maxDuration === "number", "\"maxDuration\" is not a number");
|
|
@@ -55462,14 +55465,14 @@ ${error.message}`;
|
|
|
55462
55465
|
}
|
|
55463
55466
|
return opts;
|
|
55464
55467
|
}
|
|
55465
|
-
async function
|
|
55468
|
+
async function getNodeVersion(destPath, fallbackVersion = process.env.VERCEL_PROJECT_SETTINGS_NODE_VERSION, config = {}, meta = {}, availableVersions = getAvailableNodeVersions()) {
|
|
55466
55469
|
if (config.bunVersion) return getSupportedBunVersion(config.bunVersion);
|
|
55467
55470
|
const latestVersion = getLatestNodeVersion(availableVersions);
|
|
55468
55471
|
if (meta.isDev) {
|
|
55469
55472
|
latestVersion.runtime = "nodejs";
|
|
55470
55473
|
return latestVersion;
|
|
55471
55474
|
}
|
|
55472
|
-
const { packageJson } = await
|
|
55475
|
+
const { packageJson } = await findPackageJson(destPath, true);
|
|
55473
55476
|
const configuredVersion = config.nodeVersion || fallbackVersion;
|
|
55474
55477
|
const packageJsonVersion = packageJson?.engines?.node;
|
|
55475
55478
|
const supportedNodeVersion = await getSupportedNodeVersion(packageJsonVersion || configuredVersion, !packageJsonVersion, availableVersions);
|
|
@@ -55481,7 +55484,7 @@ ${error.message}`;
|
|
|
55481
55484
|
}
|
|
55482
55485
|
return supportedNodeVersion;
|
|
55483
55486
|
}
|
|
55484
|
-
async function
|
|
55487
|
+
async function findPackageJson(destPath, readPackageJson = false, base = "/") {
|
|
55485
55488
|
(0, import_assert6.default)(import_path6.default.isAbsolute(destPath));
|
|
55486
55489
|
const pkgJsonPath = await walkParentDirs({
|
|
55487
55490
|
base,
|
|
@@ -55494,6 +55497,14 @@ ${error.message}`;
|
|
|
55494
55497
|
} catch (err) {
|
|
55495
55498
|
throw new Error(`Could not read ${pkgJsonPath}: ${err.message}.`);
|
|
55496
55499
|
}
|
|
55500
|
+
return {
|
|
55501
|
+
packageJsonPath: pkgJsonPath || void 0,
|
|
55502
|
+
packageJson
|
|
55503
|
+
};
|
|
55504
|
+
}
|
|
55505
|
+
async function scanParentDirs(destPath, readPackageJson = false, base = "/") {
|
|
55506
|
+
(0, import_assert6.default)(import_path6.default.isAbsolute(destPath));
|
|
55507
|
+
const { packageJsonPath: pkgJsonPath, packageJson } = await findPackageJson(destPath, readPackageJson, base);
|
|
55497
55508
|
const { paths: [yarnLockPath, npmLockPath, pnpmLockPath, bunLockTextPath, bunLockBinPath, vltLockPath], packageJsonPackageManager } = await walkParentDirsMulti({
|
|
55498
55509
|
base,
|
|
55499
55510
|
start: destPath,
|
|
@@ -56041,19 +56052,26 @@ To use ${otherVersion}, manually opt in using corepack (https://vercel.com/docs/
|
|
|
56041
56052
|
async function runPipInstall(destPath, args = [], spawnOpts, meta) {
|
|
56042
56053
|
if (meta && meta.isDev) {
|
|
56043
56054
|
debug$1("Skipping dependency installation because dev mode is enabled");
|
|
56044
|
-
return;
|
|
56055
|
+
return { installed: false };
|
|
56045
56056
|
}
|
|
56046
56057
|
(0, import_assert6.default)(import_path6.default.isAbsolute(destPath));
|
|
56058
|
+
const targetDir = import_path6.default.join(destPath, ".vercel_python_packages");
|
|
56047
56059
|
const opts = {
|
|
56048
56060
|
...spawnOpts,
|
|
56049
56061
|
cwd: destPath,
|
|
56050
|
-
prettyCommand: "
|
|
56062
|
+
prettyCommand: "uv pip install"
|
|
56051
56063
|
};
|
|
56052
|
-
await spawnAsync("
|
|
56064
|
+
await spawnAsync("uv", [
|
|
56065
|
+
"pip",
|
|
56053
56066
|
"install",
|
|
56054
|
-
"--
|
|
56067
|
+
"--target",
|
|
56068
|
+
targetDir,
|
|
56055
56069
|
...args
|
|
56056
56070
|
], opts);
|
|
56071
|
+
return {
|
|
56072
|
+
installed: true,
|
|
56073
|
+
targetDir
|
|
56074
|
+
};
|
|
56057
56075
|
}
|
|
56058
56076
|
function getScriptName(pkg, possibleNames) {
|
|
56059
56077
|
if (pkg?.scripts) {
|
|
@@ -56505,6 +56523,11 @@ ${entrypointsForMessage}`);
|
|
|
56505
56523
|
"fastify",
|
|
56506
56524
|
"elysia"
|
|
56507
56525
|
];
|
|
56526
|
+
var PYTHON_FRAMEWORKS = [
|
|
56527
|
+
"fastapi",
|
|
56528
|
+
"flask",
|
|
56529
|
+
"python"
|
|
56530
|
+
];
|
|
56508
56531
|
var BACKEND_BUILDERS = [
|
|
56509
56532
|
"@vercel/express",
|
|
56510
56533
|
"@vercel/hono",
|
|
@@ -56518,6 +56541,10 @@ ${entrypointsForMessage}`);
|
|
|
56518
56541
|
if (!framework) return false;
|
|
56519
56542
|
return BACKEND_FRAMEWORKS.includes(framework);
|
|
56520
56543
|
}
|
|
56544
|
+
function isPythonFramework(framework) {
|
|
56545
|
+
if (!framework) return false;
|
|
56546
|
+
return PYTHON_FRAMEWORKS.includes(framework);
|
|
56547
|
+
}
|
|
56521
56548
|
function isExperimentalBackendsWithoutIntrospectionEnabled$1() {
|
|
56522
56549
|
return process.env.VERCEL_BACKENDS_BUILDS === "1";
|
|
56523
56550
|
}
|
|
@@ -56576,9 +56603,14 @@ ${entrypointsForMessage}`);
|
|
|
56576
56603
|
}) });
|
|
56577
56604
|
|
|
56578
56605
|
//#endregion
|
|
56579
|
-
//#region src/
|
|
56606
|
+
//#region src/util.ts
|
|
56580
56607
|
var import_dist = require_dist$1();
|
|
56581
|
-
const
|
|
56608
|
+
const BEGIN_INTROSPECTION_RESULT = "\n__VERCEL_INTROSPECTION_BEGIN__\n";
|
|
56609
|
+
const END_INTROSPECTION_RESULT = "\n__VERCEL_INTROSPECTION_END__\n";
|
|
56610
|
+
|
|
56611
|
+
//#endregion
|
|
56612
|
+
//#region src/index.ts
|
|
56613
|
+
const require$1 = createRequire(import.meta.url);
|
|
56582
56614
|
const introspectApp = async (args) => {
|
|
56583
56615
|
if ((0, import_dist.isExperimentalBackendsWithoutIntrospectionEnabled)()) return defaultResult(args);
|
|
56584
56616
|
const cjsLoaderPath = fileURLToPath(new URL("loaders/cjs.cjs", import.meta.url));
|
|
@@ -56621,13 +56653,13 @@ const introspectApp = async (args) => {
|
|
|
56621
56653
|
...args.env
|
|
56622
56654
|
}
|
|
56623
56655
|
});
|
|
56624
|
-
|
|
56625
|
-
|
|
56626
|
-
|
|
56627
|
-
|
|
56628
|
-
|
|
56629
|
-
|
|
56630
|
-
}
|
|
56656
|
+
const tempDir = mkdtempSync(join(tmpdir(), "introspection-"));
|
|
56657
|
+
const tempFilePath = join(tempDir, "output.txt");
|
|
56658
|
+
const writeStream = createWriteStream(tempFilePath);
|
|
56659
|
+
let streamClosed = false;
|
|
56660
|
+
child.stdout?.pipe(writeStream);
|
|
56661
|
+
writeStream.on("error", (err) => {
|
|
56662
|
+
(0, import_dist.debug)(`Write stream error: ${err.message}`);
|
|
56631
56663
|
});
|
|
56632
56664
|
const timeout = setTimeout(() => {
|
|
56633
56665
|
(0, import_dist.debug)("Introspection timeout, killing process with SIGTERM");
|
|
@@ -56641,13 +56673,49 @@ const introspectApp = async (args) => {
|
|
|
56641
56673
|
clearTimeout(timeout);
|
|
56642
56674
|
clearTimeout(timeout2);
|
|
56643
56675
|
(0, import_dist.debug)(`Loader error: ${err.message}`);
|
|
56644
|
-
|
|
56676
|
+
if (!streamClosed) writeStream.end(() => {
|
|
56677
|
+
streamClosed = true;
|
|
56678
|
+
try {
|
|
56679
|
+
unlinkSync(tempFilePath);
|
|
56680
|
+
} catch (cleanupErr) {
|
|
56681
|
+
(0, import_dist.debug)(`Error deleting temp file on error: ${cleanupErr}`);
|
|
56682
|
+
}
|
|
56683
|
+
resolvePromise(void 0);
|
|
56684
|
+
});
|
|
56685
|
+
else resolvePromise(void 0);
|
|
56645
56686
|
});
|
|
56646
56687
|
child.on("close", () => {
|
|
56647
56688
|
clearTimeout(timeout);
|
|
56648
56689
|
clearTimeout(timeout2);
|
|
56649
56690
|
(0, import_dist.debug)("Introspection process closed");
|
|
56650
|
-
|
|
56691
|
+
if (!streamClosed) writeStream.end(() => {
|
|
56692
|
+
streamClosed = true;
|
|
56693
|
+
try {
|
|
56694
|
+
const stdoutBuffer = readFileSync(tempFilePath, "utf8");
|
|
56695
|
+
const beginIndex = stdoutBuffer.indexOf(BEGIN_INTROSPECTION_RESULT);
|
|
56696
|
+
const endIndex = stdoutBuffer.indexOf(END_INTROSPECTION_RESULT);
|
|
56697
|
+
if (beginIndex !== -1 && endIndex !== -1) {
|
|
56698
|
+
const introspectionString = stdoutBuffer.substring(beginIndex + BEGIN_INTROSPECTION_RESULT.length, endIndex);
|
|
56699
|
+
if (introspectionString) {
|
|
56700
|
+
introspectionData = introspectionSchema.parse(JSON.parse(introspectionString));
|
|
56701
|
+
(0, import_dist.debug)("Introspection data parsed successfully");
|
|
56702
|
+
}
|
|
56703
|
+
}
|
|
56704
|
+
} catch (error) {
|
|
56705
|
+
(0, import_dist.debug)(`Error parsing introspection data: ${error}`);
|
|
56706
|
+
} finally {
|
|
56707
|
+
try {
|
|
56708
|
+
rmSync(tempDir, {
|
|
56709
|
+
recursive: true,
|
|
56710
|
+
force: true
|
|
56711
|
+
});
|
|
56712
|
+
} catch (err) {
|
|
56713
|
+
(0, import_dist.debug)(`Error deleting temp directory: ${err}`);
|
|
56714
|
+
}
|
|
56715
|
+
resolvePromise(void 0);
|
|
56716
|
+
}
|
|
56717
|
+
});
|
|
56718
|
+
else resolvePromise(void 0);
|
|
56651
56719
|
});
|
|
56652
56720
|
} catch (error) {
|
|
56653
56721
|
(0, import_dist.debug)("Introspection error", error);
|
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);
|
|
@@ -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,
|
|
@@ -54392,6 +54396,7 @@ ${error.message}`;
|
|
|
54392
54396
|
getLatestNodeVersion: () => getLatestNodeVersion,
|
|
54393
54397
|
getNodeBinPath: () => getNodeBinPath,
|
|
54394
54398
|
getNodeBinPaths: () => getNodeBinPaths,
|
|
54399
|
+
getNodeVersion: () => getNodeVersion,
|
|
54395
54400
|
getOsRelease: () => getOsRelease,
|
|
54396
54401
|
getPackageJson: () => getPackageJson,
|
|
54397
54402
|
getPathForPackageManager: () => getPathForPackageManager,
|
|
@@ -54399,7 +54404,6 @@ ${error.message}`;
|
|
|
54399
54404
|
getPrefixedEnvVars: () => getPrefixedEnvVars,
|
|
54400
54405
|
getPrettyError: () => getPrettyError,
|
|
54401
54406
|
getProvidedRuntime: () => getProvidedRuntime,
|
|
54402
|
-
getRuntimeNodeVersion: () => getRuntimeNodeVersion,
|
|
54403
54407
|
getScriptName: () => getScriptName,
|
|
54404
54408
|
getSpawnOptions: () => getSpawnOptions,
|
|
54405
54409
|
getSupportedBunVersion: () => getSupportedBunVersion,
|
|
@@ -54415,6 +54419,7 @@ ${error.message}`;
|
|
|
54415
54419
|
isExperimentalBackendsEnabled: () => isExperimentalBackendsEnabled,
|
|
54416
54420
|
isExperimentalBackendsWithoutIntrospectionEnabled: () => isExperimentalBackendsWithoutIntrospectionEnabled,
|
|
54417
54421
|
isPythonEntrypoint: () => isPythonEntrypoint,
|
|
54422
|
+
isPythonFramework: () => isPythonFramework,
|
|
54418
54423
|
isSymbolicLink: () => isSymbolicLink,
|
|
54419
54424
|
normalizePath: () => normalizePath,
|
|
54420
54425
|
readConfigFile: () => readConfigFile,
|
|
@@ -54880,7 +54885,7 @@ ${error.message}`;
|
|
|
54880
54885
|
(0, import_assert4.default)(typeof runtime === "string", "\"runtime\" is not a string");
|
|
54881
54886
|
(0, import_assert4.default)(typeof environment === "object", "\"environment\" is not an object");
|
|
54882
54887
|
if (architecture !== void 0) (0, import_assert4.default)(architecture === "x86_64" || architecture === "arm64", "\"architecture\" must be either \"x86_64\" or \"arm64\"");
|
|
54883
|
-
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\"");
|
|
54884
54889
|
if ("experimentalAllowBundling" in opts && opts.experimentalAllowBundling !== void 0) (0, import_assert4.default)(typeof opts.experimentalAllowBundling === "boolean", "\"experimentalAllowBundling\" is not a boolean");
|
|
54885
54890
|
if (memory !== void 0) (0, import_assert4.default)(typeof memory === "number", "\"memory\" is not a number");
|
|
54886
54891
|
if (maxDuration !== void 0) (0, import_assert4.default)(typeof maxDuration === "number", "\"maxDuration\" is not a number");
|
|
@@ -55488,14 +55493,14 @@ ${error.message}`;
|
|
|
55488
55493
|
}
|
|
55489
55494
|
return opts;
|
|
55490
55495
|
}
|
|
55491
|
-
async function
|
|
55496
|
+
async function getNodeVersion(destPath, fallbackVersion = process.env.VERCEL_PROJECT_SETTINGS_NODE_VERSION, config = {}, meta = {}, availableVersions = getAvailableNodeVersions()) {
|
|
55492
55497
|
if (config.bunVersion) return getSupportedBunVersion(config.bunVersion);
|
|
55493
55498
|
const latestVersion = getLatestNodeVersion(availableVersions);
|
|
55494
55499
|
if (meta.isDev) {
|
|
55495
55500
|
latestVersion.runtime = "nodejs";
|
|
55496
55501
|
return latestVersion;
|
|
55497
55502
|
}
|
|
55498
|
-
const { packageJson } = await
|
|
55503
|
+
const { packageJson } = await findPackageJson(destPath, true);
|
|
55499
55504
|
const configuredVersion = config.nodeVersion || fallbackVersion;
|
|
55500
55505
|
const packageJsonVersion = packageJson?.engines?.node;
|
|
55501
55506
|
const supportedNodeVersion = await getSupportedNodeVersion(packageJsonVersion || configuredVersion, !packageJsonVersion, availableVersions);
|
|
@@ -55507,7 +55512,7 @@ ${error.message}`;
|
|
|
55507
55512
|
}
|
|
55508
55513
|
return supportedNodeVersion;
|
|
55509
55514
|
}
|
|
55510
|
-
async function
|
|
55515
|
+
async function findPackageJson(destPath, readPackageJson = false, base = "/") {
|
|
55511
55516
|
(0, import_assert6.default)(import_path6.default.isAbsolute(destPath));
|
|
55512
55517
|
const pkgJsonPath = await walkParentDirs({
|
|
55513
55518
|
base,
|
|
@@ -55520,6 +55525,14 @@ ${error.message}`;
|
|
|
55520
55525
|
} catch (err) {
|
|
55521
55526
|
throw new Error(`Could not read ${pkgJsonPath}: ${err.message}.`);
|
|
55522
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);
|
|
55523
55536
|
const { paths: [yarnLockPath, npmLockPath, pnpmLockPath, bunLockTextPath, bunLockBinPath, vltLockPath], packageJsonPackageManager } = await walkParentDirsMulti({
|
|
55524
55537
|
base,
|
|
55525
55538
|
start: destPath,
|
|
@@ -56067,19 +56080,26 @@ To use ${otherVersion}, manually opt in using corepack (https://vercel.com/docs/
|
|
|
56067
56080
|
async function runPipInstall(destPath, args = [], spawnOpts, meta) {
|
|
56068
56081
|
if (meta && meta.isDev) {
|
|
56069
56082
|
debug$2("Skipping dependency installation because dev mode is enabled");
|
|
56070
|
-
return;
|
|
56083
|
+
return { installed: false };
|
|
56071
56084
|
}
|
|
56072
56085
|
(0, import_assert6.default)(import_path6.default.isAbsolute(destPath));
|
|
56086
|
+
const targetDir = import_path6.default.join(destPath, ".vercel_python_packages");
|
|
56073
56087
|
const opts = {
|
|
56074
56088
|
...spawnOpts,
|
|
56075
56089
|
cwd: destPath,
|
|
56076
|
-
prettyCommand: "
|
|
56090
|
+
prettyCommand: "uv pip install"
|
|
56077
56091
|
};
|
|
56078
|
-
await spawnAsync("
|
|
56092
|
+
await spawnAsync("uv", [
|
|
56093
|
+
"pip",
|
|
56079
56094
|
"install",
|
|
56080
|
-
"--
|
|
56095
|
+
"--target",
|
|
56096
|
+
targetDir,
|
|
56081
56097
|
...args
|
|
56082
56098
|
], opts);
|
|
56099
|
+
return {
|
|
56100
|
+
installed: true,
|
|
56101
|
+
targetDir
|
|
56102
|
+
};
|
|
56083
56103
|
}
|
|
56084
56104
|
function getScriptName(pkg, possibleNames) {
|
|
56085
56105
|
if (pkg?.scripts) {
|
|
@@ -56531,6 +56551,11 @@ ${entrypointsForMessage}`);
|
|
|
56531
56551
|
"fastify",
|
|
56532
56552
|
"elysia"
|
|
56533
56553
|
];
|
|
56554
|
+
var PYTHON_FRAMEWORKS = [
|
|
56555
|
+
"fastapi",
|
|
56556
|
+
"flask",
|
|
56557
|
+
"python"
|
|
56558
|
+
];
|
|
56534
56559
|
var BACKEND_BUILDERS = [
|
|
56535
56560
|
"@vercel/express",
|
|
56536
56561
|
"@vercel/hono",
|
|
@@ -56544,6 +56569,10 @@ ${entrypointsForMessage}`);
|
|
|
56544
56569
|
if (!framework) return false;
|
|
56545
56570
|
return BACKEND_FRAMEWORKS.includes(framework);
|
|
56546
56571
|
}
|
|
56572
|
+
function isPythonFramework(framework) {
|
|
56573
|
+
if (!framework) return false;
|
|
56574
|
+
return PYTHON_FRAMEWORKS.includes(framework);
|
|
56575
|
+
}
|
|
56547
56576
|
function isExperimentalBackendsWithoutIntrospectionEnabled() {
|
|
56548
56577
|
return process.env.VERCEL_BACKENDS_BUILDS === "1";
|
|
56549
56578
|
}
|
|
@@ -56716,22 +56745,6 @@ const extractRoutes = () => {
|
|
|
56716
56745
|
};
|
|
56717
56746
|
};
|
|
56718
56747
|
|
|
56719
|
-
//#endregion
|
|
56720
|
-
//#region src/loaders/block-network.ts
|
|
56721
|
-
for (const mod of [
|
|
56722
|
-
"net",
|
|
56723
|
-
"dns",
|
|
56724
|
-
"http",
|
|
56725
|
-
"https",
|
|
56726
|
-
"tls",
|
|
56727
|
-
"dgram"
|
|
56728
|
-
]) try {
|
|
56729
|
-
const m = require(mod);
|
|
56730
|
-
for (const key of Object.keys(m)) m[key] = new Proxy(m[key], { apply() {
|
|
56731
|
-
throw new Error("Networking is disabled");
|
|
56732
|
-
} });
|
|
56733
|
-
} catch {}
|
|
56734
|
-
|
|
56735
56748
|
//#endregion
|
|
56736
56749
|
//#region src/loaders/cjs.ts
|
|
56737
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/
|
|
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",
|