@vercel/backends 0.0.21 → 0.0.23
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/index.mjs +98 -47
- package/package.json +6 -6
package/dist/index.mjs
CHANGED
|
@@ -54346,18 +54346,20 @@ ${error.message}`;
|
|
|
54346
54346
|
NodeVersion: () => NodeVersion,
|
|
54347
54347
|
NodejsLambda: () => NodejsLambda$1,
|
|
54348
54348
|
NowBuildError: () => NowBuildError,
|
|
54349
|
+
PYTHON_FRAMEWORKS: () => PYTHON_FRAMEWORKS,
|
|
54349
54350
|
Prerender: () => Prerender,
|
|
54350
|
-
Span: () => Span,
|
|
54351
|
+
Span: () => Span$1,
|
|
54351
54352
|
Version: () => Version,
|
|
54352
54353
|
buildsSchema: () => buildsSchema,
|
|
54353
54354
|
cloneEnv: () => cloneEnv,
|
|
54354
54355
|
createLambda: () => createLambda,
|
|
54355
|
-
debug: () => debug$
|
|
54356
|
+
debug: () => debug$2,
|
|
54356
54357
|
defaultCachePathGlob: () => defaultCachePathGlob$1,
|
|
54357
54358
|
detectPackageManager: () => detectPackageManager,
|
|
54358
54359
|
download: () => download$1,
|
|
54359
54360
|
downloadFile: () => downloadFile,
|
|
54360
54361
|
execCommand: () => execCommand$1,
|
|
54362
|
+
findPackageJson: () => findPackageJson,
|
|
54361
54363
|
functionsSchema: () => functionsSchema,
|
|
54362
54364
|
generateNodeBuilderFunctions: () => generateNodeBuilderFunctions,
|
|
54363
54365
|
getDiscontinuedNodeVersions: () => getDiscontinuedNodeVersions,
|
|
@@ -54368,6 +54370,7 @@ ${error.message}`;
|
|
|
54368
54370
|
getLatestNodeVersion: () => getLatestNodeVersion,
|
|
54369
54371
|
getNodeBinPath: () => getNodeBinPath,
|
|
54370
54372
|
getNodeBinPaths: () => getNodeBinPaths$1,
|
|
54373
|
+
getNodeVersion: () => getNodeVersion$1,
|
|
54371
54374
|
getOsRelease: () => getOsRelease,
|
|
54372
54375
|
getPackageJson: () => getPackageJson$1,
|
|
54373
54376
|
getPathForPackageManager: () => getPathForPackageManager,
|
|
@@ -54375,7 +54378,6 @@ ${error.message}`;
|
|
|
54375
54378
|
getPrefixedEnvVars: () => getPrefixedEnvVars,
|
|
54376
54379
|
getPrettyError: () => getPrettyError,
|
|
54377
54380
|
getProvidedRuntime: () => getProvidedRuntime,
|
|
54378
|
-
getRuntimeNodeVersion: () => getRuntimeNodeVersion$1,
|
|
54379
54381
|
getScriptName: () => getScriptName$1,
|
|
54380
54382
|
getSpawnOptions: () => getSpawnOptions,
|
|
54381
54383
|
getSupportedBunVersion: () => getSupportedBunVersion,
|
|
@@ -54391,6 +54393,7 @@ ${error.message}`;
|
|
|
54391
54393
|
isExperimentalBackendsEnabled: () => isExperimentalBackendsEnabled,
|
|
54392
54394
|
isExperimentalBackendsWithoutIntrospectionEnabled: () => isExperimentalBackendsWithoutIntrospectionEnabled,
|
|
54393
54395
|
isPythonEntrypoint: () => isPythonEntrypoint,
|
|
54396
|
+
isPythonFramework: () => isPythonFramework,
|
|
54394
54397
|
isSymbolicLink: () => isSymbolicLink,
|
|
54395
54398
|
normalizePath: () => normalizePath,
|
|
54396
54399
|
readConfigFile: () => readConfigFile,
|
|
@@ -54708,7 +54711,7 @@ ${error.message}`;
|
|
|
54708
54711
|
}
|
|
54709
54712
|
return n;
|
|
54710
54713
|
};
|
|
54711
|
-
function debug$
|
|
54714
|
+
function debug$2(message, ...additional) {
|
|
54712
54715
|
if (getPlatformEnv("BUILDER_DEBUG")) console.log(message, ...additional);
|
|
54713
54716
|
else if (process.env.VERCEL_DEBUG_PREFIX) console.log(`${process.env.VERCEL_DEBUG_PREFIX}${message}`, ...additional);
|
|
54714
54717
|
}
|
|
@@ -54813,7 +54816,7 @@ ${error.message}`;
|
|
|
54813
54816
|
async function download$1(files, basePath, meta) {
|
|
54814
54817
|
const { isDev = false, skipDownload = false, filesChanged = null, filesRemoved = null } = meta || {};
|
|
54815
54818
|
if (isDev || skipDownload) return files;
|
|
54816
|
-
debug$
|
|
54819
|
+
debug$2("Downloading deployment source files...");
|
|
54817
54820
|
const start = Date.now();
|
|
54818
54821
|
const files2 = {};
|
|
54819
54822
|
const filenames = Object.keys(files);
|
|
@@ -54836,7 +54839,7 @@ ${error.message}`;
|
|
|
54836
54839
|
files2[name] = await downloadFile(file, import_path2.default.join(basePath, name));
|
|
54837
54840
|
}));
|
|
54838
54841
|
const duration = Date.now() - start;
|
|
54839
|
-
debug$
|
|
54842
|
+
debug$2(`Downloaded ${filenames.length} source files: ${duration}ms`);
|
|
54840
54843
|
return files2;
|
|
54841
54844
|
}
|
|
54842
54845
|
function getDefaultLambdaArchitecture(architecture) {
|
|
@@ -54856,7 +54859,7 @@ ${error.message}`;
|
|
|
54856
54859
|
(0, import_assert4.default)(typeof runtime === "string", "\"runtime\" is not a string");
|
|
54857
54860
|
(0, import_assert4.default)(typeof environment === "object", "\"environment\" is not an object");
|
|
54858
54861
|
if (architecture !== void 0) (0, import_assert4.default)(architecture === "x86_64" || architecture === "arm64", "\"architecture\" must be either \"x86_64\" or \"arm64\"");
|
|
54859
|
-
if (runtimeLanguage !== void 0) (0, import_assert4.default)(runtimeLanguage === "rust", "\"runtimeLanguage\"
|
|
54862
|
+
if (runtimeLanguage !== void 0) (0, import_assert4.default)(runtimeLanguage === "rust" || runtimeLanguage === "go", "\"runtimeLanguage\" is invalid. Valid options: \"rust\", \"go\"");
|
|
54860
54863
|
if ("experimentalAllowBundling" in opts && opts.experimentalAllowBundling !== void 0) (0, import_assert4.default)(typeof opts.experimentalAllowBundling === "boolean", "\"experimentalAllowBundling\" is not a boolean");
|
|
54861
54864
|
if (memory !== void 0) (0, import_assert4.default)(typeof memory === "number", "\"memory\" is not a number");
|
|
54862
54865
|
if (maxDuration !== void 0) (0, import_assert4.default)(typeof maxDuration === "number", "\"maxDuration\" is not a number");
|
|
@@ -55271,7 +55274,7 @@ ${error.message}`;
|
|
|
55271
55274
|
link: "https://vercel.link/node-version",
|
|
55272
55275
|
message: `${`Node.js Version "${selection.range}" is discontinued and must be upgraded.`} ${getHint(isAuto)}`
|
|
55273
55276
|
});
|
|
55274
|
-
debug$
|
|
55277
|
+
debug$2(`Selected Node.js ${selection.range}`);
|
|
55275
55278
|
if (selection.state === "deprecated") {
|
|
55276
55279
|
const d = selection.formattedDate;
|
|
55277
55280
|
if (d) console.warn(`Error: Node.js version ${selection.range} is deprecated. Deployments created on or after ${d} will fail to build. ${getHint(isAuto)}`);
|
|
@@ -55464,14 +55467,14 @@ ${error.message}`;
|
|
|
55464
55467
|
}
|
|
55465
55468
|
return opts;
|
|
55466
55469
|
}
|
|
55467
|
-
async function
|
|
55470
|
+
async function getNodeVersion$1(destPath, fallbackVersion = process.env.VERCEL_PROJECT_SETTINGS_NODE_VERSION, config = {}, meta = {}, availableVersions = getAvailableNodeVersions()) {
|
|
55468
55471
|
if (config.bunVersion) return getSupportedBunVersion(config.bunVersion);
|
|
55469
55472
|
const latestVersion = getLatestNodeVersion(availableVersions);
|
|
55470
55473
|
if (meta.isDev) {
|
|
55471
55474
|
latestVersion.runtime = "nodejs";
|
|
55472
55475
|
return latestVersion;
|
|
55473
55476
|
}
|
|
55474
|
-
const { packageJson } = await
|
|
55477
|
+
const { packageJson } = await findPackageJson(destPath, true);
|
|
55475
55478
|
const configuredVersion = config.nodeVersion || fallbackVersion;
|
|
55476
55479
|
const packageJsonVersion = packageJson?.engines?.node;
|
|
55477
55480
|
const supportedNodeVersion = await getSupportedNodeVersion(packageJsonVersion || configuredVersion, !packageJsonVersion, availableVersions);
|
|
@@ -55483,7 +55486,7 @@ ${error.message}`;
|
|
|
55483
55486
|
}
|
|
55484
55487
|
return supportedNodeVersion;
|
|
55485
55488
|
}
|
|
55486
|
-
async function
|
|
55489
|
+
async function findPackageJson(destPath, readPackageJson = false, base = "/") {
|
|
55487
55490
|
(0, import_assert6.default)(import_path6.default.isAbsolute(destPath));
|
|
55488
55491
|
const pkgJsonPath = await walkParentDirs({
|
|
55489
55492
|
base,
|
|
@@ -55496,6 +55499,14 @@ ${error.message}`;
|
|
|
55496
55499
|
} catch (err) {
|
|
55497
55500
|
throw new Error(`Could not read ${pkgJsonPath}: ${err.message}.`);
|
|
55498
55501
|
}
|
|
55502
|
+
return {
|
|
55503
|
+
packageJsonPath: pkgJsonPath || void 0,
|
|
55504
|
+
packageJson
|
|
55505
|
+
};
|
|
55506
|
+
}
|
|
55507
|
+
async function scanParentDirs$1(destPath, readPackageJson = false, base = "/") {
|
|
55508
|
+
(0, import_assert6.default)(import_path6.default.isAbsolute(destPath));
|
|
55509
|
+
const { packageJsonPath: pkgJsonPath, packageJson } = await findPackageJson(destPath, readPackageJson, base);
|
|
55499
55510
|
const { paths: [yarnLockPath, npmLockPath, pnpmLockPath, bunLockTextPath, bunLockBinPath, vltLockPath], packageJsonPackageManager } = await walkParentDirsMulti({
|
|
55500
55511
|
base,
|
|
55501
55512
|
start: destPath,
|
|
@@ -55700,7 +55711,7 @@ ${error.message}`;
|
|
|
55700
55711
|
}
|
|
55701
55712
|
async function runNpmInstall$1(destPath, args = [], spawnOpts, meta, projectCreatedAt) {
|
|
55702
55713
|
if (meta?.isDev) {
|
|
55703
|
-
debug$
|
|
55714
|
+
debug$2("Skipping dependency installation because dev mode is enabled");
|
|
55704
55715
|
return false;
|
|
55705
55716
|
}
|
|
55706
55717
|
(0, import_assert6.default)(import_path6.default.isAbsolute(destPath));
|
|
@@ -55708,7 +55719,7 @@ ${error.message}`;
|
|
|
55708
55719
|
await runNpmInstallSema.acquire();
|
|
55709
55720
|
const { cliType, packageJsonPath, packageJson, lockfileVersion, packageJsonPackageManager, turboSupportsCorepackHome } = await scanParentDirs$1(destPath, true);
|
|
55710
55721
|
if (!packageJsonPath) {
|
|
55711
|
-
debug$
|
|
55722
|
+
debug$2(`Skipping dependency installation because no package.json was found for ${destPath}`);
|
|
55712
55723
|
return false;
|
|
55713
55724
|
}
|
|
55714
55725
|
const defaultInstall = args.length === 0;
|
|
@@ -55716,7 +55727,7 @@ ${error.message}`;
|
|
|
55716
55727
|
const { alreadyInstalled, runNpmInstallSet } = checkIfAlreadyInstalled(meta.runNpmInstallSet, packageJsonPath);
|
|
55717
55728
|
if (alreadyInstalled) return false;
|
|
55718
55729
|
if (process.env.VERCEL_INSTALL_COMPLETED === "1") {
|
|
55719
|
-
debug$
|
|
55730
|
+
debug$2(`Skipping dependency installation for ${packageJsonPath} because VERCEL_INSTALL_COMPLETED is set`);
|
|
55720
55731
|
runNpmInstallSet.add(packageJsonPath);
|
|
55721
55732
|
meta.runNpmInstallSet = runNpmInstallSet;
|
|
55722
55733
|
return false;
|
|
@@ -55734,7 +55745,7 @@ ${error.message}`;
|
|
|
55734
55745
|
}
|
|
55735
55746
|
const installTime = Date.now();
|
|
55736
55747
|
console.log("Installing dependencies...");
|
|
55737
|
-
debug$
|
|
55748
|
+
debug$2(`Installing to ${destPath}`);
|
|
55738
55749
|
const opts = {
|
|
55739
55750
|
cwd: destPath,
|
|
55740
55751
|
...spawnOpts
|
|
@@ -55756,7 +55767,7 @@ ${error.message}`;
|
|
|
55756
55767
|
args,
|
|
55757
55768
|
opts
|
|
55758
55769
|
});
|
|
55759
|
-
debug$
|
|
55770
|
+
debug$2(`Install complete [${Date.now() - installTime}ms]`);
|
|
55760
55771
|
return true;
|
|
55761
55772
|
} finally {
|
|
55762
55773
|
runNpmInstallSema.release();
|
|
@@ -55772,8 +55783,8 @@ ${error.message}`;
|
|
|
55772
55783
|
packageJsonEngines,
|
|
55773
55784
|
projectCreatedAt
|
|
55774
55785
|
});
|
|
55775
|
-
if (corepackEnabled) debug$
|
|
55776
|
-
else debug$
|
|
55786
|
+
if (corepackEnabled) debug$2(`Detected corepack use for "${packageJsonPackageManager}". Not overriding package manager version.`);
|
|
55787
|
+
else debug$2(`Detected ${detectedPackageManager}. Added "${newPath}" to path. Based on assumed package manager "${cliType}", lockfile "${detectedLockfile}", and lockfileVersion "${lockfileVersion}"`);
|
|
55777
55788
|
const newEnv = { ...env };
|
|
55778
55789
|
const alreadyInPath = (newPath2) => {
|
|
55779
55790
|
return (env.PATH ?? "").split(import_path6.default.delimiter).includes(newPath2);
|
|
@@ -55971,11 +55982,11 @@ To use ${otherVersion}, manually opt in using corepack (https://vercel.com/docs/
|
|
|
55971
55982
|
const { alreadyInstalled, runNpmInstallSet } = checkIfAlreadyInstalled(customInstallCommandSet, normalizedPath);
|
|
55972
55983
|
customInstallCommandSet = runNpmInstallSet;
|
|
55973
55984
|
if (alreadyInstalled) {
|
|
55974
|
-
debug$
|
|
55985
|
+
debug$2(`Skipping custom install command for ${normalizedPath} because it was already run`);
|
|
55975
55986
|
return false;
|
|
55976
55987
|
}
|
|
55977
55988
|
if (process.env.VERCEL_INSTALL_COMPLETED === "1") {
|
|
55978
|
-
debug$
|
|
55989
|
+
debug$2(`Skipping custom install command for ${normalizedPath} because VERCEL_INSTALL_COMPLETED is set`);
|
|
55979
55990
|
return false;
|
|
55980
55991
|
}
|
|
55981
55992
|
console.log(`Running "install" command: \`${installCommand}\`...`);
|
|
@@ -55989,7 +56000,7 @@ To use ${otherVersion}, manually opt in using corepack (https://vercel.com/docs/
|
|
|
55989
56000
|
turboSupportsCorepackHome,
|
|
55990
56001
|
projectCreatedAt
|
|
55991
56002
|
});
|
|
55992
|
-
debug$
|
|
56003
|
+
debug$2(`Running with $PATH:`, env?.PATH || "");
|
|
55993
56004
|
await execCommand$1(installCommand, {
|
|
55994
56005
|
...spawnOpts,
|
|
55995
56006
|
env,
|
|
@@ -56002,7 +56013,7 @@ To use ${otherVersion}, manually opt in using corepack (https://vercel.com/docs/
|
|
|
56002
56013
|
const { packageJson, cliType, lockfileVersion, packageJsonPackageManager, turboSupportsCorepackHome } = await scanParentDirs$1(destPath, true);
|
|
56003
56014
|
const scriptName = getScriptName$1(packageJson, typeof scriptNames === "string" ? [scriptNames] : scriptNames);
|
|
56004
56015
|
if (!scriptName) return false;
|
|
56005
|
-
debug$
|
|
56016
|
+
debug$2("Running user script...");
|
|
56006
56017
|
const runScriptTime = Date.now();
|
|
56007
56018
|
const opts = {
|
|
56008
56019
|
cwd: destPath,
|
|
@@ -56024,12 +56035,12 @@ To use ${otherVersion}, manually opt in using corepack (https://vercel.com/docs/
|
|
|
56024
56035
|
else opts.prettyCommand = `yarn run ${scriptName}`;
|
|
56025
56036
|
console.log(`Running "${opts.prettyCommand}"`);
|
|
56026
56037
|
await spawnAsync(cliType, ["run", scriptName], opts);
|
|
56027
|
-
debug$
|
|
56038
|
+
debug$2(`Script complete [${Date.now() - runScriptTime}ms]`);
|
|
56028
56039
|
return true;
|
|
56029
56040
|
}
|
|
56030
56041
|
async function runBundleInstall(destPath, args = [], spawnOpts, meta) {
|
|
56031
56042
|
if (meta && meta.isDev) {
|
|
56032
|
-
debug$
|
|
56043
|
+
debug$2("Skipping dependency installation because dev mode is enabled");
|
|
56033
56044
|
return;
|
|
56034
56045
|
}
|
|
56035
56046
|
(0, import_assert6.default)(import_path6.default.isAbsolute(destPath));
|
|
@@ -56042,20 +56053,27 @@ To use ${otherVersion}, manually opt in using corepack (https://vercel.com/docs/
|
|
|
56042
56053
|
}
|
|
56043
56054
|
async function runPipInstall(destPath, args = [], spawnOpts, meta) {
|
|
56044
56055
|
if (meta && meta.isDev) {
|
|
56045
|
-
debug$
|
|
56046
|
-
return;
|
|
56056
|
+
debug$2("Skipping dependency installation because dev mode is enabled");
|
|
56057
|
+
return { installed: false };
|
|
56047
56058
|
}
|
|
56048
56059
|
(0, import_assert6.default)(import_path6.default.isAbsolute(destPath));
|
|
56060
|
+
const targetDir = import_path6.default.join(destPath, ".vercel_python_packages");
|
|
56049
56061
|
const opts = {
|
|
56050
56062
|
...spawnOpts,
|
|
56051
56063
|
cwd: destPath,
|
|
56052
|
-
prettyCommand: "
|
|
56064
|
+
prettyCommand: "uv pip install"
|
|
56053
56065
|
};
|
|
56054
|
-
await spawnAsync("
|
|
56066
|
+
await spawnAsync("uv", [
|
|
56067
|
+
"pip",
|
|
56055
56068
|
"install",
|
|
56056
|
-
"--
|
|
56069
|
+
"--target",
|
|
56070
|
+
targetDir,
|
|
56057
56071
|
...args
|
|
56058
56072
|
], opts);
|
|
56073
|
+
return {
|
|
56074
|
+
installed: true,
|
|
56075
|
+
targetDir
|
|
56076
|
+
};
|
|
56059
56077
|
}
|
|
56060
56078
|
function getScriptName$1(pkg, possibleNames) {
|
|
56061
56079
|
if (pkg?.scripts) {
|
|
@@ -56333,7 +56351,7 @@ To use ${otherVersion}, manually opt in using corepack (https://vercel.com/docs/
|
|
|
56333
56351
|
function mapUndefinedAttributes(attrs) {
|
|
56334
56352
|
return Object.fromEntries(Object.entries(attrs ?? {}).filter((attr) => !!attr[1]));
|
|
56335
56353
|
}
|
|
56336
|
-
var Span = class _Span {
|
|
56354
|
+
var Span$1 = class _Span {
|
|
56337
56355
|
constructor({ name, parentId, attrs, reporter }) {
|
|
56338
56356
|
this.name = name;
|
|
56339
56357
|
this.parentId = parentId;
|
|
@@ -56387,7 +56405,7 @@ To use ${otherVersion}, manually opt in using corepack (https://vercel.com/docs/
|
|
|
56387
56405
|
const resolved = __require.resolve(`${packageName}/package.json`, { paths: path7 ? Array.isArray(path7) ? path7 : [path7] : [process.cwd()] });
|
|
56388
56406
|
return __require(resolved).version;
|
|
56389
56407
|
} catch (err) {
|
|
56390
|
-
debug$
|
|
56408
|
+
debug$2(`Could not resolve package "${packageName}". Package is not installed.`, err);
|
|
56391
56409
|
return;
|
|
56392
56410
|
}
|
|
56393
56411
|
}
|
|
@@ -56507,6 +56525,11 @@ ${entrypointsForMessage}`);
|
|
|
56507
56525
|
"fastify",
|
|
56508
56526
|
"elysia"
|
|
56509
56527
|
];
|
|
56528
|
+
var PYTHON_FRAMEWORKS = [
|
|
56529
|
+
"fastapi",
|
|
56530
|
+
"flask",
|
|
56531
|
+
"python"
|
|
56532
|
+
];
|
|
56510
56533
|
var BACKEND_BUILDERS = [
|
|
56511
56534
|
"@vercel/express",
|
|
56512
56535
|
"@vercel/hono",
|
|
@@ -56520,6 +56543,10 @@ ${entrypointsForMessage}`);
|
|
|
56520
56543
|
if (!framework) return false;
|
|
56521
56544
|
return BACKEND_FRAMEWORKS.includes(framework);
|
|
56522
56545
|
}
|
|
56546
|
+
function isPythonFramework(framework) {
|
|
56547
|
+
if (!framework) return false;
|
|
56548
|
+
return PYTHON_FRAMEWORKS.includes(framework);
|
|
56549
|
+
}
|
|
56523
56550
|
function isExperimentalBackendsWithoutIntrospectionEnabled() {
|
|
56524
56551
|
return process.env.VERCEL_BACKENDS_BUILDS === "1";
|
|
56525
56552
|
}
|
|
@@ -56543,7 +56570,7 @@ ${entrypointsForMessage}`);
|
|
|
56543
56570
|
const scriptPath = (0, import_path11.join)(__dirname, "..", "lib", "python", `${scriptName}.py`);
|
|
56544
56571
|
if (!import_fs3.default.existsSync(scriptPath)) throw new Error(`Python script not found: ${scriptPath}`);
|
|
56545
56572
|
const pythonCmd = pythonPath ?? (isWin2 ? "python" : "python3");
|
|
56546
|
-
debug$
|
|
56573
|
+
debug$2(`Running stdlib Python script: ${pythonCmd} ${scriptPath} ${args.join(" ")}`);
|
|
56547
56574
|
try {
|
|
56548
56575
|
const result = await (0, import_execa.default)(pythonCmd, [scriptPath, ...args], { cwd });
|
|
56549
56576
|
return {
|
|
@@ -56571,7 +56598,7 @@ ${entrypointsForMessage}`);
|
|
|
56571
56598
|
args: [fsPath]
|
|
56572
56599
|
})).exitCode === 0;
|
|
56573
56600
|
} catch (err) {
|
|
56574
|
-
debug$
|
|
56601
|
+
debug$2(`Failed to check Python entrypoint: ${err}`);
|
|
56575
56602
|
return false;
|
|
56576
56603
|
}
|
|
56577
56604
|
}
|
|
@@ -56670,9 +56697,12 @@ const doBuild = async (args, downloadResult) => {
|
|
|
56670
56697
|
let tsPromise;
|
|
56671
56698
|
const isCervelCommand = buildCommand?.trim().startsWith("cervel");
|
|
56672
56699
|
if (!outputSetting) {
|
|
56700
|
+
(0, import_dist$1.debug)("No output directory configured, using default output directory");
|
|
56673
56701
|
if (isCervelCommand) {
|
|
56702
|
+
(0, import_dist$1.debug)("Cervel command ran, using its default output location");
|
|
56674
56703
|
const cervelOutputDir = join$1(args.workPath, "dist");
|
|
56675
56704
|
if (existsSync$1(join$1(cervelOutputDir, ".cervel.json"))) {
|
|
56705
|
+
(0, import_dist$1.debug)("Cervel JSON file found, using its handler");
|
|
56676
56706
|
const { handler: handler$2 } = await getBuildSummary(cervelOutputDir);
|
|
56677
56707
|
return {
|
|
56678
56708
|
dir: cervelOutputDir,
|
|
@@ -56684,6 +56714,7 @@ const doBuild = async (args, downloadResult) => {
|
|
|
56684
56714
|
}
|
|
56685
56715
|
const distDir = join$1(args.workPath, "dist");
|
|
56686
56716
|
if (existsSync$1(distDir)) {
|
|
56717
|
+
(0, import_dist$1.debug)("Dist directory found, checking for .cervel.json");
|
|
56687
56718
|
const cervelJsonPath$1 = join$1(distDir, ".cervel.json");
|
|
56688
56719
|
if (existsSync$1(cervelJsonPath$1)) {
|
|
56689
56720
|
const { handler: handler$3 } = await getBuildSummary(distDir);
|
|
@@ -56695,8 +56726,10 @@ const doBuild = async (args, downloadResult) => {
|
|
|
56695
56726
|
}
|
|
56696
56727
|
let handler$2;
|
|
56697
56728
|
try {
|
|
56729
|
+
(0, import_dist$1.debug)("Finding entrypoint in dist directory");
|
|
56698
56730
|
handler$2 = await findEntrypoint(distDir);
|
|
56699
56731
|
} catch (error) {
|
|
56732
|
+
(0, import_dist$1.debug)("Finding entrypoint in dist directory with ignoreRegex");
|
|
56700
56733
|
handler$2 = await findEntrypoint(distDir, { ignoreRegex: true });
|
|
56701
56734
|
}
|
|
56702
56735
|
await writeFile(cervelJsonPath$1, JSON.stringify({ handler: handler$2 }, null, 2));
|
|
@@ -56706,6 +56739,7 @@ const doBuild = async (args, downloadResult) => {
|
|
|
56706
56739
|
tsPromise
|
|
56707
56740
|
};
|
|
56708
56741
|
}
|
|
56742
|
+
(0, import_dist$1.debug)("No dist directory found, building ourselves");
|
|
56709
56743
|
const buildResult = await build$1({
|
|
56710
56744
|
cwd: args.workPath,
|
|
56711
56745
|
out: defaultOutputDirectory
|
|
@@ -56763,21 +56797,38 @@ var import_dist = require_dist$1();
|
|
|
56763
56797
|
const version = 2;
|
|
56764
56798
|
const build = async (args) => {
|
|
56765
56799
|
const downloadResult = await downloadInstallAndBundle(args);
|
|
56766
|
-
const nodeVersion = await (0, import_dist.
|
|
56767
|
-
const
|
|
56768
|
-
const
|
|
56769
|
-
(
|
|
56770
|
-
const
|
|
56771
|
-
|
|
56772
|
-
|
|
56773
|
-
|
|
56774
|
-
|
|
56775
|
-
|
|
56776
|
-
|
|
56800
|
+
const nodeVersion = await (0, import_dist.getNodeVersion)(args.workPath);
|
|
56801
|
+
const builderName = "@vercel/backends";
|
|
56802
|
+
const span = args.span ?? new import_dist.Span({ name: builderName });
|
|
56803
|
+
span.setAttributes({ "builder.name": builderName });
|
|
56804
|
+
const outputConfig = await span.child("vc.builder.backends.doBuild").trace(async (span$1) => {
|
|
56805
|
+
const result = await doBuild(args, downloadResult);
|
|
56806
|
+
span$1.setAttributes({
|
|
56807
|
+
"outputConfig.dir": result.dir,
|
|
56808
|
+
"outputConfig.handler": result.handler
|
|
56809
|
+
});
|
|
56810
|
+
return result;
|
|
56811
|
+
});
|
|
56812
|
+
(0, import_dist.debug)("Node file trace starting..");
|
|
56813
|
+
const nftPromise = span.child("vc.builder.backends.nodeFileTrace").trace(() => nodeFileTrace$1(args, nodeVersion, outputConfig));
|
|
56814
|
+
(0, import_dist.debug)("Introspection starting..");
|
|
56815
|
+
const { routes, framework } = await span.child("vc.builder.backends.introspectApp").trace(async (span$1) => {
|
|
56816
|
+
const result = await introspectApp({
|
|
56817
|
+
...outputConfig,
|
|
56818
|
+
framework: args.config.framework,
|
|
56819
|
+
env: {
|
|
56820
|
+
...args.meta?.env ?? {},
|
|
56821
|
+
...args.meta?.buildEnv ?? {}
|
|
56822
|
+
}
|
|
56823
|
+
});
|
|
56824
|
+
span$1.setAttributes({ "introspectApp.routes": String(result.routes.length) });
|
|
56825
|
+
return result;
|
|
56777
56826
|
});
|
|
56778
|
-
if (routes.length > 2) (0, import_dist.debug)(`
|
|
56779
|
-
else (0, import_dist.debug)(`
|
|
56827
|
+
if (routes.length > 2) (0, import_dist.debug)(`Introspection completed successfully with ${routes.length} routes`);
|
|
56828
|
+
else (0, import_dist.debug)(`Introspection failed to detect routes`);
|
|
56780
56829
|
const handler = relative$1(args.repoRootPath, join$1(outputConfig.dir, outputConfig.handler));
|
|
56830
|
+
const { files } = await nftPromise;
|
|
56831
|
+
(0, import_dist.debug)("Node file trace complete");
|
|
56781
56832
|
const lambda = new import_dist.NodejsLambda({
|
|
56782
56833
|
runtime: nodeVersion.runtime,
|
|
56783
56834
|
handler,
|
|
@@ -56796,7 +56847,7 @@ const build = async (args) => {
|
|
|
56796
56847
|
if (route.dest === "/") continue;
|
|
56797
56848
|
output[route.dest] = lambda;
|
|
56798
56849
|
}
|
|
56799
|
-
if (outputConfig.tsPromise) await outputConfig.tsPromise;
|
|
56850
|
+
if (outputConfig.tsPromise) await span.child("vc.builder.backends.tsCompile").trace(() => outputConfig.tsPromise);
|
|
56800
56851
|
return {
|
|
56801
56852
|
routes,
|
|
56802
56853
|
output
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/backends",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.23",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "./dist/index.mjs",
|
|
6
6
|
"homepage": "https://vercel.com/docs",
|
|
@@ -23,22 +23,22 @@
|
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@vercel/nft": "1.1.1",
|
|
25
25
|
"fs-extra": "11.1.0",
|
|
26
|
-
"@vercel/
|
|
27
|
-
"@vercel/
|
|
28
|
-
"@vercel/
|
|
26
|
+
"@vercel/static-config": "3.1.2",
|
|
27
|
+
"@vercel/cervel": "0.0.10",
|
|
28
|
+
"@vercel/introspection": "0.0.10"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/express": "5.0.3",
|
|
32
32
|
"@types/fs-extra": "11",
|
|
33
33
|
"@types/jest": "27.5.1",
|
|
34
|
-
"@types/node": "
|
|
34
|
+
"@types/node": "20.11.0",
|
|
35
35
|
"execa": "3.2.0",
|
|
36
36
|
"hono": "4.10.1",
|
|
37
37
|
"jest-junit": "16.0.0",
|
|
38
38
|
"tsdown": "0.16.3",
|
|
39
39
|
"vite": "^5.1.6",
|
|
40
40
|
"vitest": "^2.0.1",
|
|
41
|
-
"@vercel/build-utils": "13.2.
|
|
41
|
+
"@vercel/build-utils": "13.2.14"
|
|
42
42
|
},
|
|
43
43
|
"module": "./dist/index.mjs",
|
|
44
44
|
"types": "./dist/index.d.mts",
|