@vercel/backends 0.0.19 → 0.0.21

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.
Files changed (2) hide show
  1. package/dist/index.mjs +22 -24
  2. package/package.json +4 -4
package/dist/index.mjs CHANGED
@@ -54368,7 +54368,6 @@ ${error.message}`;
54368
54368
  getLatestNodeVersion: () => getLatestNodeVersion,
54369
54369
  getNodeBinPath: () => getNodeBinPath,
54370
54370
  getNodeBinPaths: () => getNodeBinPaths$1,
54371
- getNodeVersion: () => getNodeVersion$1,
54372
54371
  getOsRelease: () => getOsRelease,
54373
54372
  getPackageJson: () => getPackageJson$1,
54374
54373
  getPathForPackageManager: () => getPathForPackageManager,
@@ -54376,8 +54375,9 @@ ${error.message}`;
54376
54375
  getPrefixedEnvVars: () => getPrefixedEnvVars,
54377
54376
  getPrettyError: () => getPrettyError,
54378
54377
  getProvidedRuntime: () => getProvidedRuntime,
54378
+ getRuntimeNodeVersion: () => getRuntimeNodeVersion$1,
54379
54379
  getScriptName: () => getScriptName$1,
54380
- getSpawnOptions: () => getSpawnOptions$1,
54380
+ getSpawnOptions: () => getSpawnOptions,
54381
54381
  getSupportedBunVersion: () => getSupportedBunVersion,
54382
54382
  getSupportedNodeVersion: () => getSupportedNodeVersion,
54383
54383
  getWriteableDirectory: () => getWritableDirectory,
@@ -55447,7 +55447,7 @@ ${error.message}`;
55447
55447
  });
55448
55448
  return true;
55449
55449
  }
55450
- function getSpawnOptions$1(meta, nodeVersion) {
55450
+ function getSpawnOptions(meta, nodeVersion) {
55451
55451
  const opts = { env: cloneEnv(process.env) };
55452
55452
  if (isBunVersion$1(nodeVersion)) return opts;
55453
55453
  if (!meta.isDev) {
@@ -55464,7 +55464,7 @@ ${error.message}`;
55464
55464
  }
55465
55465
  return opts;
55466
55466
  }
55467
- async function getNodeVersion$1(destPath, fallbackVersion = process.env.VERCEL_PROJECT_SETTINGS_NODE_VERSION, config = {}, meta = {}, availableVersions = getAvailableNodeVersions()) {
55467
+ async function getRuntimeNodeVersion$1(destPath, fallbackVersion = process.env.VERCEL_PROJECT_SETTINGS_NODE_VERSION, config = {}, meta = {}, availableVersions = getAvailableNodeVersions()) {
55468
55468
  if (config.bunVersion) return getSupportedBunVersion(config.bunVersion);
55469
55469
  const latestVersion = getLatestNodeVersion(availableVersions);
55470
55470
  if (meta.isDev) {
@@ -56502,6 +56502,7 @@ ${entrypointsForMessage}`);
56502
56502
  "express",
56503
56503
  "hono",
56504
56504
  "h3",
56505
+ "koa",
56505
56506
  "nestjs",
56506
56507
  "fastify",
56507
56508
  "elysia"
@@ -56510,6 +56511,7 @@ ${entrypointsForMessage}`);
56510
56511
  "@vercel/express",
56511
56512
  "@vercel/hono",
56512
56513
  "@vercel/h3",
56514
+ "@vercel/koa",
56513
56515
  "@vercel/nestjs",
56514
56516
  "@vercel/fastify",
56515
56517
  "@vercel/elysia"
@@ -56582,14 +56584,12 @@ async function downloadInstallAndBundle(args) {
56582
56584
  const { entrypoint, files, workPath, meta, config, repoRootPath } = args;
56583
56585
  await (0, import_dist$3.download)(files, workPath, meta);
56584
56586
  const entrypointFsDirname = join(workPath, dirname(entrypoint));
56585
- const nodeVersion = await (0, import_dist$3.getNodeVersion)(entrypointFsDirname, void 0, config, meta);
56586
- const spawnOpts = (0, import_dist$3.getSpawnOptions)(meta || {}, nodeVersion);
56587
56587
  const { cliType, lockfileVersion, packageJsonPackageManager, turboSupportsCorepackHome } = await (0, import_dist$3.scanParentDirs)(entrypointFsDirname, true, repoRootPath);
56588
- spawnOpts.env = (0, import_dist$3.getEnvForPackageManager)({
56588
+ const spawnEnv = (0, import_dist$3.getEnvForPackageManager)({
56589
56589
  cliType,
56590
56590
  lockfileVersion,
56591
56591
  packageJsonPackageManager,
56592
- env: spawnOpts.env || {},
56592
+ env: process.env,
56593
56593
  turboSupportsCorepackHome,
56594
56594
  projectCreatedAt: config.projectSettings?.createdAt
56595
56595
  });
@@ -56597,45 +56597,42 @@ async function downloadInstallAndBundle(args) {
56597
56597
  if (typeof installCommand === "string") if (installCommand.trim()) {
56598
56598
  console.log(`Running "install" command: \`${installCommand}\`...`);
56599
56599
  await (0, import_dist$3.execCommand)(installCommand, {
56600
- ...spawnOpts,
56600
+ env: spawnEnv,
56601
56601
  cwd: entrypointFsDirname
56602
56602
  });
56603
56603
  } else console.log(`Skipping "install" command...`);
56604
- else await (0, import_dist$3.runNpmInstall)(entrypointFsDirname, [], spawnOpts, meta, config.projectSettings?.createdAt);
56604
+ else await (0, import_dist$3.runNpmInstall)(entrypointFsDirname, [], { env: spawnEnv }, meta, config.projectSettings?.createdAt);
56605
56605
  return {
56606
56606
  entrypointFsDirname,
56607
- nodeVersion,
56608
- spawnOpts
56607
+ spawnEnv
56609
56608
  };
56610
56609
  }
56611
- async function maybeExecBuildCommand(args, options) {
56610
+ async function maybeExecBuildCommand(args, { spawnEnv, entrypointFsDirname }) {
56612
56611
  const projectBuildCommand = args.config.projectSettings?.buildCommand;
56613
56612
  if (projectBuildCommand) {
56614
56613
  const nodeBinPath = (0, import_dist$3.getNodeBinPaths)({
56615
56614
  base: args.repoRootPath || args.workPath,
56616
56615
  start: args.workPath
56617
56616
  }).join(delimiter);
56618
- const env = {
56619
- ...options.spawnOpts.env,
56620
- PATH: `${nodeBinPath}${delimiter}${options.spawnOpts.env?.PATH || process.env.PATH}`
56621
- };
56622
56617
  return (0, import_dist$3.execCommand)(projectBuildCommand, {
56623
- ...options.spawnOpts,
56624
- env,
56618
+ env: {
56619
+ ...spawnEnv,
56620
+ PATH: `${nodeBinPath}${delimiter}${spawnEnv?.PATH || process.env.PATH}`
56621
+ },
56625
56622
  cwd: args.workPath
56626
56623
  });
56627
56624
  }
56628
- return (0, import_dist$3.runPackageJsonScript)(options.entrypointFsDirname, ["build"], options.spawnOpts, args.config.projectSettings?.createdAt);
56625
+ return (0, import_dist$3.runPackageJsonScript)(entrypointFsDirname, ["build"], { env: spawnEnv }, args.config.projectSettings?.createdAt);
56629
56626
  }
56630
56627
 
56631
56628
  //#endregion
56632
56629
  //#region src/node-file-trace.ts
56633
56630
  var import_dist$2 = require_dist$1();
56634
- const nodeFileTrace$1 = async (args, downloadResult, output) => {
56631
+ const nodeFileTrace$1 = async (args, nodeVersion, output) => {
56635
56632
  const { dir: outputDir, handler } = output;
56636
56633
  const entry = join(outputDir, handler);
56637
56634
  const files = {};
56638
- const conditions = (0, import_dist$2.isBunVersion)(downloadResult.nodeVersion) ? ["bun"] : void 0;
56635
+ const conditions = (0, import_dist$2.isBunVersion)(nodeVersion) ? ["bun"] : void 0;
56639
56636
  const nftResult = await nodeFileTrace([entry], {
56640
56637
  base: args.repoRootPath,
56641
56638
  ignore: args.config.excludeFiles,
@@ -56766,8 +56763,9 @@ var import_dist = require_dist$1();
56766
56763
  const version = 2;
56767
56764
  const build = async (args) => {
56768
56765
  const downloadResult = await downloadInstallAndBundle(args);
56766
+ const nodeVersion = await (0, import_dist.getRuntimeNodeVersion)(args.workPath);
56769
56767
  const outputConfig = await doBuild(args, downloadResult);
56770
- const { files } = await nodeFileTrace$1(args, downloadResult, outputConfig);
56768
+ const { files } = await nodeFileTrace$1(args, nodeVersion, outputConfig);
56771
56769
  (0, import_dist.debug)("Building route mapping..");
56772
56770
  const { routes, framework } = await introspectApp({
56773
56771
  ...outputConfig,
@@ -56781,7 +56779,7 @@ const build = async (args) => {
56781
56779
  else (0, import_dist.debug)(`Route mapping failed to detect routes`);
56782
56780
  const handler = relative$1(args.repoRootPath, join$1(outputConfig.dir, outputConfig.handler));
56783
56781
  const lambda = new import_dist.NodejsLambda({
56784
- runtime: downloadResult.nodeVersion.runtime,
56782
+ runtime: nodeVersion.runtime,
56785
56783
  handler,
56786
56784
  files,
56787
56785
  shouldAddHelpers: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/backends",
3
- "version": "0.0.19",
3
+ "version": "0.0.21",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index.mjs",
6
6
  "homepage": "https://vercel.com/docs",
@@ -24,8 +24,8 @@
24
24
  "@vercel/nft": "1.1.1",
25
25
  "fs-extra": "11.1.0",
26
26
  "@vercel/cervel": "0.0.9",
27
- "@vercel/static-config": "3.1.2",
28
- "@vercel/introspection": "0.0.8"
27
+ "@vercel/introspection": "0.0.8",
28
+ "@vercel/static-config": "3.1.2"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@types/express": "5.0.3",
@@ -38,7 +38,7 @@
38
38
  "tsdown": "0.16.3",
39
39
  "vite": "^5.1.6",
40
40
  "vitest": "^2.0.1",
41
- "@vercel/build-utils": "13.2.6"
41
+ "@vercel/build-utils": "13.2.8"
42
42
  },
43
43
  "module": "./dist/index.mjs",
44
44
  "types": "./dist/index.d.mts",