@vercel/backends 0.0.6 → 0.0.8

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.
@@ -52835,6 +52835,7 @@ var require_dist$1 = /* @__PURE__ */ __commonJS$1({ "../build-utils/dist/index.j
52835
52835
  getPrettyError: () => getPrettyError,
52836
52836
  getProvidedRuntime: () => getProvidedRuntime,
52837
52837
  getScriptName: () => getScriptName,
52838
+ getSpawnOptions: () => getSpawnOptions$1,
52838
52839
  getSupportedBunVersion: () => getSupportedBunVersion,
52839
52840
  getSupportedNodeVersion: () => getSupportedNodeVersion,
52840
52841
  getWriteableDirectory: () => getWritableDirectory,
@@ -53447,7 +53448,7 @@ var require_dist$1 = /* @__PURE__ */ __commonJS$1({ "../build-utils/dist/index.j
53447
53448
  return {};
53448
53449
  }
53449
53450
  var NodejsLambda$1 = class extends Lambda {
53450
- constructor({ shouldAddHelpers, shouldAddSourcemapSupport, awsLambdaHandler, useWebApi, ...opts }) {
53451
+ constructor({ shouldAddHelpers, shouldAddSourcemapSupport, awsLambdaHandler, useWebApi,...opts }) {
53451
53452
  super(opts);
53452
53453
  this.launcherType = "Nodejs";
53453
53454
  this.shouldAddHelpers = shouldAddHelpers;
@@ -53888,6 +53889,23 @@ var require_dist$1 = /* @__PURE__ */ __commonJS$1({ "../build-utils/dist/index.j
53888
53889
  });
53889
53890
  return true;
53890
53891
  }
53892
+ function getSpawnOptions$1(meta, nodeVersion) {
53893
+ const opts = { env: cloneEnv(process.env) };
53894
+ if (isBunVersion(nodeVersion)) return opts;
53895
+ if (!meta.isDev) {
53896
+ let found = false;
53897
+ const pathSegments = (opts.env.PATH || process.env.PATH || "").split(import_path5.default.delimiter).map((segment) => {
53898
+ if (/^\/node[0-9]+\/bin/.test(segment)) {
53899
+ found = true;
53900
+ return `/node${nodeVersion.major}/bin`;
53901
+ }
53902
+ return segment;
53903
+ });
53904
+ if (!found) pathSegments.unshift(`/node${nodeVersion.major}/bin`);
53905
+ opts.env.PATH = pathSegments.filter(Boolean).join(import_path5.default.delimiter);
53906
+ }
53907
+ return opts;
53908
+ }
53891
53909
  async function getNodeVersion$1(destPath, fallbackVersion = process.env.VERCEL_PROJECT_SETTINGS_NODE_VERSION, config = {}, meta = {}, availableVersions = getAvailableNodeVersions()) {
53892
53910
  if (config.bunVersion) return getSupportedBunVersion(config.bunVersion);
53893
53911
  const latestVersion = getLatestNodeVersion(availableVersions);
@@ -54945,12 +54963,13 @@ async function downloadInstallAndBundle(args) {
54945
54963
  await (0, import_dist$2.download)(files, workPath, meta);
54946
54964
  const entrypointFsDirname = join(workPath, dirname(entrypoint));
54947
54965
  const nodeVersion = await (0, import_dist$2.getNodeVersion)(entrypointFsDirname, void 0, config, meta);
54966
+ const spawnOpts = (0, import_dist$2.getSpawnOptions)(meta || {}, nodeVersion);
54948
54967
  const { cliType, lockfileVersion, packageJsonPackageManager, turboSupportsCorepackHome } = await (0, import_dist$2.scanParentDirs)(entrypointFsDirname, true, repoRootPath);
54949
- const spawnEnv = (0, import_dist$2.getEnvForPackageManager)({
54968
+ spawnOpts.env = (0, import_dist$2.getEnvForPackageManager)({
54950
54969
  cliType,
54951
54970
  lockfileVersion,
54952
54971
  packageJsonPackageManager,
54953
- env: process.env,
54972
+ env: spawnOpts.env || {},
54954
54973
  turboSupportsCorepackHome,
54955
54974
  projectCreatedAt: config.projectSettings?.createdAt
54956
54975
  });
@@ -54958,15 +54977,15 @@ async function downloadInstallAndBundle(args) {
54958
54977
  if (typeof installCommand === "string") if (installCommand.trim()) {
54959
54978
  console.log(`Running "install" command: \`${installCommand}\`...`);
54960
54979
  await (0, import_dist$2.execCommand)(installCommand, {
54961
- env: spawnEnv,
54980
+ ...spawnOpts,
54962
54981
  cwd: entrypointFsDirname
54963
54982
  });
54964
54983
  } else console.log(`Skipping "install" command...`);
54965
- else await (0, import_dist$2.runNpmInstall)(entrypointFsDirname, [], { env: spawnEnv }, meta, config.projectSettings?.createdAt);
54984
+ else await (0, import_dist$2.runNpmInstall)(entrypointFsDirname, [], spawnOpts, meta, config.projectSettings?.createdAt);
54966
54985
  return {
54967
54986
  entrypointFsDirname,
54968
54987
  nodeVersion,
54969
- spawnEnv
54988
+ spawnOpts
54970
54989
  };
54971
54990
  }
54972
54991
  async function maybeExecBuildCommand(args, options) {
@@ -54976,15 +54995,17 @@ async function maybeExecBuildCommand(args, options) {
54976
54995
  base: args.repoRootPath || args.workPath,
54977
54996
  start: args.workPath
54978
54997
  }).join(delimiter);
54998
+ const env = {
54999
+ ...options.spawnOpts.env,
55000
+ PATH: `${nodeBinPath}${delimiter}${options.spawnOpts.env?.PATH || process.env.PATH}`
55001
+ };
54979
55002
  return (0, import_dist$2.execCommand)(projectBuildCommand, {
54980
- env: {
54981
- ...options.spawnEnv,
54982
- PATH: `${nodeBinPath}${delimiter}${options.spawnEnv?.PATH || process.env.PATH}`
54983
- },
55003
+ ...options.spawnOpts,
55004
+ env,
54984
55005
  cwd: args.workPath
54985
55006
  });
54986
55007
  }
54987
- return (0, import_dist$2.runPackageJsonScript)(options.entrypointFsDirname, ["build"], options.spawnEnv, args.config.projectSettings?.createdAt);
55008
+ return (0, import_dist$2.runPackageJsonScript)(options.entrypointFsDirname, ["build"], options.spawnOpts, args.config.projectSettings?.createdAt);
54988
55009
  }
54989
55010
 
54990
55011
  //#endregion
package/package.json CHANGED
@@ -1,15 +1,16 @@
1
1
  {
2
2
  "name": "@vercel/backends",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "license": "Apache-2.0",
5
- "main": "./dist/index.js",
5
+ "main": "./dist/index.mjs",
6
6
  "homepage": "https://vercel.com/docs",
7
7
  "type": "module",
8
8
  "publishConfig": {
9
9
  "access": "public"
10
10
  },
11
11
  "exports": {
12
- ".": "./dist/index.js"
12
+ ".": "./dist/index.mjs",
13
+ "./package.json": "./package.json"
13
14
  },
14
15
  "repository": {
15
16
  "type": "git",
@@ -24,7 +25,7 @@
24
25
  "@vercel/static-config": "3.1.2",
25
26
  "fs-extra": "11.1.0",
26
27
  "rolldown": "1.0.0-beta.35",
27
- "@vercel/cervel": "0.0.3",
28
+ "@vercel/cervel": "0.0.4",
28
29
  "@vercel/introspection": "0.0.2"
29
30
  },
30
31
  "devDependencies": {
@@ -32,14 +33,16 @@
32
33
  "@types/fs-extra": "11",
33
34
  "@types/jest": "27.5.1",
34
35
  "@types/node": "22",
35
- "@vercel/build-utils": "13.0.0",
36
+ "@vercel/build-utils": "13.0.1",
36
37
  "execa": "3.2.0",
37
38
  "hono": "4.10.1",
38
39
  "jest-junit": "16.0.0",
39
- "tsdown": "0.15.6",
40
+ "tsdown": "0.16.3",
40
41
  "vite": "^5.1.6",
41
42
  "vitest": "^2.0.1"
42
43
  },
44
+ "module": "./dist/index.mjs",
45
+ "types": "./dist/index.d.mts",
43
46
  "scripts": {
44
47
  "build": "tsdown",
45
48
  "vitest-run": "vitest -c ../../vitest.config.mts",
File without changes