@vercel/backends 0.0.21 → 0.0.22

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 +36 -26
  2. package/package.json +3 -3
package/dist/index.mjs CHANGED
@@ -54352,7 +54352,7 @@ ${error.message}`;
54352
54352
  buildsSchema: () => buildsSchema,
54353
54353
  cloneEnv: () => cloneEnv,
54354
54354
  createLambda: () => createLambda,
54355
- debug: () => debug$1,
54355
+ debug: () => debug$2,
54356
54356
  defaultCachePathGlob: () => defaultCachePathGlob$1,
54357
54357
  detectPackageManager: () => detectPackageManager,
54358
54358
  download: () => download$1,
@@ -54708,7 +54708,7 @@ ${error.message}`;
54708
54708
  }
54709
54709
  return n;
54710
54710
  };
54711
- function debug$1(message, ...additional) {
54711
+ function debug$2(message, ...additional) {
54712
54712
  if (getPlatformEnv("BUILDER_DEBUG")) console.log(message, ...additional);
54713
54713
  else if (process.env.VERCEL_DEBUG_PREFIX) console.log(`${process.env.VERCEL_DEBUG_PREFIX}${message}`, ...additional);
54714
54714
  }
@@ -54813,7 +54813,7 @@ ${error.message}`;
54813
54813
  async function download$1(files, basePath, meta) {
54814
54814
  const { isDev = false, skipDownload = false, filesChanged = null, filesRemoved = null } = meta || {};
54815
54815
  if (isDev || skipDownload) return files;
54816
- debug$1("Downloading deployment source files...");
54816
+ debug$2("Downloading deployment source files...");
54817
54817
  const start = Date.now();
54818
54818
  const files2 = {};
54819
54819
  const filenames = Object.keys(files);
@@ -54836,7 +54836,7 @@ ${error.message}`;
54836
54836
  files2[name] = await downloadFile(file, import_path2.default.join(basePath, name));
54837
54837
  }));
54838
54838
  const duration = Date.now() - start;
54839
- debug$1(`Downloaded ${filenames.length} source files: ${duration}ms`);
54839
+ debug$2(`Downloaded ${filenames.length} source files: ${duration}ms`);
54840
54840
  return files2;
54841
54841
  }
54842
54842
  function getDefaultLambdaArchitecture(architecture) {
@@ -55271,7 +55271,7 @@ ${error.message}`;
55271
55271
  link: "https://vercel.link/node-version",
55272
55272
  message: `${`Node.js Version "${selection.range}" is discontinued and must be upgraded.`} ${getHint(isAuto)}`
55273
55273
  });
55274
- debug$1(`Selected Node.js ${selection.range}`);
55274
+ debug$2(`Selected Node.js ${selection.range}`);
55275
55275
  if (selection.state === "deprecated") {
55276
55276
  const d = selection.formattedDate;
55277
55277
  if (d) console.warn(`Error: Node.js version ${selection.range} is deprecated. Deployments created on or after ${d} will fail to build. ${getHint(isAuto)}`);
@@ -55700,7 +55700,7 @@ ${error.message}`;
55700
55700
  }
55701
55701
  async function runNpmInstall$1(destPath, args = [], spawnOpts, meta, projectCreatedAt) {
55702
55702
  if (meta?.isDev) {
55703
- debug$1("Skipping dependency installation because dev mode is enabled");
55703
+ debug$2("Skipping dependency installation because dev mode is enabled");
55704
55704
  return false;
55705
55705
  }
55706
55706
  (0, import_assert6.default)(import_path6.default.isAbsolute(destPath));
@@ -55708,7 +55708,7 @@ ${error.message}`;
55708
55708
  await runNpmInstallSema.acquire();
55709
55709
  const { cliType, packageJsonPath, packageJson, lockfileVersion, packageJsonPackageManager, turboSupportsCorepackHome } = await scanParentDirs$1(destPath, true);
55710
55710
  if (!packageJsonPath) {
55711
- debug$1(`Skipping dependency installation because no package.json was found for ${destPath}`);
55711
+ debug$2(`Skipping dependency installation because no package.json was found for ${destPath}`);
55712
55712
  return false;
55713
55713
  }
55714
55714
  const defaultInstall = args.length === 0;
@@ -55716,7 +55716,7 @@ ${error.message}`;
55716
55716
  const { alreadyInstalled, runNpmInstallSet } = checkIfAlreadyInstalled(meta.runNpmInstallSet, packageJsonPath);
55717
55717
  if (alreadyInstalled) return false;
55718
55718
  if (process.env.VERCEL_INSTALL_COMPLETED === "1") {
55719
- debug$1(`Skipping dependency installation for ${packageJsonPath} because VERCEL_INSTALL_COMPLETED is set`);
55719
+ debug$2(`Skipping dependency installation for ${packageJsonPath} because VERCEL_INSTALL_COMPLETED is set`);
55720
55720
  runNpmInstallSet.add(packageJsonPath);
55721
55721
  meta.runNpmInstallSet = runNpmInstallSet;
55722
55722
  return false;
@@ -55734,7 +55734,7 @@ ${error.message}`;
55734
55734
  }
55735
55735
  const installTime = Date.now();
55736
55736
  console.log("Installing dependencies...");
55737
- debug$1(`Installing to ${destPath}`);
55737
+ debug$2(`Installing to ${destPath}`);
55738
55738
  const opts = {
55739
55739
  cwd: destPath,
55740
55740
  ...spawnOpts
@@ -55756,7 +55756,7 @@ ${error.message}`;
55756
55756
  args,
55757
55757
  opts
55758
55758
  });
55759
- debug$1(`Install complete [${Date.now() - installTime}ms]`);
55759
+ debug$2(`Install complete [${Date.now() - installTime}ms]`);
55760
55760
  return true;
55761
55761
  } finally {
55762
55762
  runNpmInstallSema.release();
@@ -55772,8 +55772,8 @@ ${error.message}`;
55772
55772
  packageJsonEngines,
55773
55773
  projectCreatedAt
55774
55774
  });
55775
- if (corepackEnabled) debug$1(`Detected corepack use for "${packageJsonPackageManager}". Not overriding package manager version.`);
55776
- else debug$1(`Detected ${detectedPackageManager}. Added "${newPath}" to path. Based on assumed package manager "${cliType}", lockfile "${detectedLockfile}", and lockfileVersion "${lockfileVersion}"`);
55775
+ if (corepackEnabled) debug$2(`Detected corepack use for "${packageJsonPackageManager}". Not overriding package manager version.`);
55776
+ else debug$2(`Detected ${detectedPackageManager}. Added "${newPath}" to path. Based on assumed package manager "${cliType}", lockfile "${detectedLockfile}", and lockfileVersion "${lockfileVersion}"`);
55777
55777
  const newEnv = { ...env };
55778
55778
  const alreadyInPath = (newPath2) => {
55779
55779
  return (env.PATH ?? "").split(import_path6.default.delimiter).includes(newPath2);
@@ -55971,11 +55971,11 @@ To use ${otherVersion}, manually opt in using corepack (https://vercel.com/docs/
55971
55971
  const { alreadyInstalled, runNpmInstallSet } = checkIfAlreadyInstalled(customInstallCommandSet, normalizedPath);
55972
55972
  customInstallCommandSet = runNpmInstallSet;
55973
55973
  if (alreadyInstalled) {
55974
- debug$1(`Skipping custom install command for ${normalizedPath} because it was already run`);
55974
+ debug$2(`Skipping custom install command for ${normalizedPath} because it was already run`);
55975
55975
  return false;
55976
55976
  }
55977
55977
  if (process.env.VERCEL_INSTALL_COMPLETED === "1") {
55978
- debug$1(`Skipping custom install command for ${normalizedPath} because VERCEL_INSTALL_COMPLETED is set`);
55978
+ debug$2(`Skipping custom install command for ${normalizedPath} because VERCEL_INSTALL_COMPLETED is set`);
55979
55979
  return false;
55980
55980
  }
55981
55981
  console.log(`Running "install" command: \`${installCommand}\`...`);
@@ -55989,7 +55989,7 @@ To use ${otherVersion}, manually opt in using corepack (https://vercel.com/docs/
55989
55989
  turboSupportsCorepackHome,
55990
55990
  projectCreatedAt
55991
55991
  });
55992
- debug$1(`Running with $PATH:`, env?.PATH || "");
55992
+ debug$2(`Running with $PATH:`, env?.PATH || "");
55993
55993
  await execCommand$1(installCommand, {
55994
55994
  ...spawnOpts,
55995
55995
  env,
@@ -56002,7 +56002,7 @@ To use ${otherVersion}, manually opt in using corepack (https://vercel.com/docs/
56002
56002
  const { packageJson, cliType, lockfileVersion, packageJsonPackageManager, turboSupportsCorepackHome } = await scanParentDirs$1(destPath, true);
56003
56003
  const scriptName = getScriptName$1(packageJson, typeof scriptNames === "string" ? [scriptNames] : scriptNames);
56004
56004
  if (!scriptName) return false;
56005
- debug$1("Running user script...");
56005
+ debug$2("Running user script...");
56006
56006
  const runScriptTime = Date.now();
56007
56007
  const opts = {
56008
56008
  cwd: destPath,
@@ -56024,12 +56024,12 @@ To use ${otherVersion}, manually opt in using corepack (https://vercel.com/docs/
56024
56024
  else opts.prettyCommand = `yarn run ${scriptName}`;
56025
56025
  console.log(`Running "${opts.prettyCommand}"`);
56026
56026
  await spawnAsync(cliType, ["run", scriptName], opts);
56027
- debug$1(`Script complete [${Date.now() - runScriptTime}ms]`);
56027
+ debug$2(`Script complete [${Date.now() - runScriptTime}ms]`);
56028
56028
  return true;
56029
56029
  }
56030
56030
  async function runBundleInstall(destPath, args = [], spawnOpts, meta) {
56031
56031
  if (meta && meta.isDev) {
56032
- debug$1("Skipping dependency installation because dev mode is enabled");
56032
+ debug$2("Skipping dependency installation because dev mode is enabled");
56033
56033
  return;
56034
56034
  }
56035
56035
  (0, import_assert6.default)(import_path6.default.isAbsolute(destPath));
@@ -56042,7 +56042,7 @@ To use ${otherVersion}, manually opt in using corepack (https://vercel.com/docs/
56042
56042
  }
56043
56043
  async function runPipInstall(destPath, args = [], spawnOpts, meta) {
56044
56044
  if (meta && meta.isDev) {
56045
- debug$1("Skipping dependency installation because dev mode is enabled");
56045
+ debug$2("Skipping dependency installation because dev mode is enabled");
56046
56046
  return;
56047
56047
  }
56048
56048
  (0, import_assert6.default)(import_path6.default.isAbsolute(destPath));
@@ -56387,7 +56387,7 @@ To use ${otherVersion}, manually opt in using corepack (https://vercel.com/docs/
56387
56387
  const resolved = __require.resolve(`${packageName}/package.json`, { paths: path7 ? Array.isArray(path7) ? path7 : [path7] : [process.cwd()] });
56388
56388
  return __require(resolved).version;
56389
56389
  } catch (err) {
56390
- debug$1(`Could not resolve package "${packageName}". Package is not installed.`, err);
56390
+ debug$2(`Could not resolve package "${packageName}". Package is not installed.`, err);
56391
56391
  return;
56392
56392
  }
56393
56393
  }
@@ -56543,7 +56543,7 @@ ${entrypointsForMessage}`);
56543
56543
  const scriptPath = (0, import_path11.join)(__dirname, "..", "lib", "python", `${scriptName}.py`);
56544
56544
  if (!import_fs3.default.existsSync(scriptPath)) throw new Error(`Python script not found: ${scriptPath}`);
56545
56545
  const pythonCmd = pythonPath ?? (isWin2 ? "python" : "python3");
56546
- debug$1(`Running stdlib Python script: ${pythonCmd} ${scriptPath} ${args.join(" ")}`);
56546
+ debug$2(`Running stdlib Python script: ${pythonCmd} ${scriptPath} ${args.join(" ")}`);
56547
56547
  try {
56548
56548
  const result = await (0, import_execa.default)(pythonCmd, [scriptPath, ...args], { cwd });
56549
56549
  return {
@@ -56571,7 +56571,7 @@ ${entrypointsForMessage}`);
56571
56571
  args: [fsPath]
56572
56572
  })).exitCode === 0;
56573
56573
  } catch (err) {
56574
- debug$1(`Failed to check Python entrypoint: ${err}`);
56574
+ debug$2(`Failed to check Python entrypoint: ${err}`);
56575
56575
  return false;
56576
56576
  }
56577
56577
  }
@@ -56670,9 +56670,12 @@ const doBuild = async (args, downloadResult) => {
56670
56670
  let tsPromise;
56671
56671
  const isCervelCommand = buildCommand?.trim().startsWith("cervel");
56672
56672
  if (!outputSetting) {
56673
+ (0, import_dist$1.debug)("No output directory configured, using default output directory");
56673
56674
  if (isCervelCommand) {
56675
+ (0, import_dist$1.debug)("Cervel command ran, using its default output location");
56674
56676
  const cervelOutputDir = join$1(args.workPath, "dist");
56675
56677
  if (existsSync$1(join$1(cervelOutputDir, ".cervel.json"))) {
56678
+ (0, import_dist$1.debug)("Cervel JSON file found, using its handler");
56676
56679
  const { handler: handler$2 } = await getBuildSummary(cervelOutputDir);
56677
56680
  return {
56678
56681
  dir: cervelOutputDir,
@@ -56684,6 +56687,7 @@ const doBuild = async (args, downloadResult) => {
56684
56687
  }
56685
56688
  const distDir = join$1(args.workPath, "dist");
56686
56689
  if (existsSync$1(distDir)) {
56690
+ (0, import_dist$1.debug)("Dist directory found, checking for .cervel.json");
56687
56691
  const cervelJsonPath$1 = join$1(distDir, ".cervel.json");
56688
56692
  if (existsSync$1(cervelJsonPath$1)) {
56689
56693
  const { handler: handler$3 } = await getBuildSummary(distDir);
@@ -56695,8 +56699,10 @@ const doBuild = async (args, downloadResult) => {
56695
56699
  }
56696
56700
  let handler$2;
56697
56701
  try {
56702
+ (0, import_dist$1.debug)("Finding entrypoint in dist directory");
56698
56703
  handler$2 = await findEntrypoint(distDir);
56699
56704
  } catch (error) {
56705
+ (0, import_dist$1.debug)("Finding entrypoint in dist directory with ignoreRegex");
56700
56706
  handler$2 = await findEntrypoint(distDir, { ignoreRegex: true });
56701
56707
  }
56702
56708
  await writeFile(cervelJsonPath$1, JSON.stringify({ handler: handler$2 }, null, 2));
@@ -56706,6 +56712,7 @@ const doBuild = async (args, downloadResult) => {
56706
56712
  tsPromise
56707
56713
  };
56708
56714
  }
56715
+ (0, import_dist$1.debug)("No dist directory found, building ourselves");
56709
56716
  const buildResult = await build$1({
56710
56717
  cwd: args.workPath,
56711
56718
  out: defaultOutputDirectory
@@ -56765,8 +56772,9 @@ const build = async (args) => {
56765
56772
  const downloadResult = await downloadInstallAndBundle(args);
56766
56773
  const nodeVersion = await (0, import_dist.getRuntimeNodeVersion)(args.workPath);
56767
56774
  const outputConfig = await doBuild(args, downloadResult);
56768
- const { files } = await nodeFileTrace$1(args, nodeVersion, outputConfig);
56769
- (0, import_dist.debug)("Building route mapping..");
56775
+ (0, import_dist.debug)("Node file trace starting..");
56776
+ const nftPromise = nodeFileTrace$1(args, nodeVersion, outputConfig);
56777
+ (0, import_dist.debug)("Introspection starting..");
56770
56778
  const { routes, framework } = await introspectApp({
56771
56779
  ...outputConfig,
56772
56780
  framework: args.config.framework,
@@ -56775,9 +56783,11 @@ const build = async (args) => {
56775
56783
  ...args.meta?.buildEnv ?? {}
56776
56784
  }
56777
56785
  });
56778
- if (routes.length > 2) (0, import_dist.debug)(`Route mapping built successfully with ${routes.length} routes`);
56779
- else (0, import_dist.debug)(`Route mapping failed to detect routes`);
56786
+ if (routes.length > 2) (0, import_dist.debug)(`Introspection completed successfully with ${routes.length} routes`);
56787
+ else (0, import_dist.debug)(`Introspection failed to detect routes`);
56780
56788
  const handler = relative$1(args.repoRootPath, join$1(outputConfig.dir, outputConfig.handler));
56789
+ const { files } = await nftPromise;
56790
+ (0, import_dist.debug)("Node file trace complete");
56781
56791
  const lambda = new import_dist.NodejsLambda({
56782
56792
  runtime: nodeVersion.runtime,
56783
56793
  handler,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/backends",
3
- "version": "0.0.21",
3
+ "version": "0.0.22",
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/introspection": "0.0.8",
28
- "@vercel/static-config": "3.1.2"
27
+ "@vercel/static-config": "3.1.2",
28
+ "@vercel/introspection": "0.0.9"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@types/express": "5.0.3",