@vercel/introspection 0.0.8 → 0.0.9

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 CHANGED
@@ -261,7 +261,7 @@ var require_dist$1 = /* @__PURE__ */ __commonJS$1({ "../build-utils/dist/index.j
261
261
  this.head = this.tail = null;
262
262
  this.length = 0;
263
263
  };
264
- BufferList.prototype.join = function join5(s) {
264
+ BufferList.prototype.join = function join6(s) {
265
265
  if (this.length === 0) return "";
266
266
  var p = this.head;
267
267
  var ret = "" + p.data;
@@ -54366,13 +54366,14 @@ ${error.message}`;
54366
54366
  getLatestNodeVersion: () => getLatestNodeVersion,
54367
54367
  getNodeBinPath: () => getNodeBinPath,
54368
54368
  getNodeBinPaths: () => getNodeBinPaths,
54369
- getNodeVersion: () => getNodeVersion,
54370
54369
  getOsRelease: () => getOsRelease,
54370
+ getPackageJson: () => getPackageJson,
54371
54371
  getPathForPackageManager: () => getPathForPackageManager,
54372
54372
  getPlatformEnv: () => getPlatformEnv,
54373
54373
  getPrefixedEnvVars: () => getPrefixedEnvVars,
54374
54374
  getPrettyError: () => getPrettyError,
54375
54375
  getProvidedRuntime: () => getProvidedRuntime,
54376
+ getRuntimeNodeVersion: () => getRuntimeNodeVersion,
54376
54377
  getScriptName: () => getScriptName,
54377
54378
  getSpawnOptions: () => getSpawnOptions,
54378
54379
  getSupportedBunVersion: () => getSupportedBunVersion,
@@ -54392,6 +54393,7 @@ ${error.message}`;
54392
54393
  normalizePath: () => normalizePath,
54393
54394
  readConfigFile: () => readConfigFile,
54394
54395
  rename: () => rename,
54396
+ resetCustomInstallCommandSet: () => resetCustomInstallCommandSet,
54395
54397
  runBundleInstall: () => runBundleInstall,
54396
54398
  runCustomInstallCommand: () => runCustomInstallCommand,
54397
54399
  runNpmInstall: () => runNpmInstall,
@@ -55137,7 +55139,7 @@ ${error.message}`;
55137
55139
  }
55138
55140
  var import_assert6 = __toESM(__require("assert"));
55139
55141
  var import_fs_extra7 = __toESM(require_lib());
55140
- var import_path5 = __toESM(__require("path"));
55142
+ var import_path6 = __toESM(__require("path"));
55141
55143
  var import_async_sema4 = __toESM(require_async_sema());
55142
55144
  var import_cross_spawn = __toESM(require_cross_spawn());
55143
55145
  var import_semver2 = __toESM(require_semver2());
@@ -55257,14 +55259,14 @@ ${error.message}`;
55257
55259
  return (0, import_semver.intersects)(o.range, engineRange) && (availableVersions?.length ? availableVersions.includes(o.major) : true);
55258
55260
  }))) throw new NowBuildError({
55259
55261
  code: "BUILD_UTILS_NODE_VERSION_INVALID",
55260
- link: "http://vercel.link/node-version",
55262
+ link: "https://vercel.link/node-version",
55261
55263
  message: `Found invalid Node.js Version: "${engineRange}". ${getHint(isAuto, availableVersions)}`
55262
55264
  });
55263
55265
  }
55264
55266
  if (!selection) selection = getLatestNodeVersion(availableVersions);
55265
55267
  if (selection.state === "discontinued") throw new NowBuildError({
55266
55268
  code: "BUILD_UTILS_NODE_VERSION_DISCONTINUED",
55267
- link: "http://vercel.link/node-version",
55269
+ link: "https://vercel.link/node-version",
55268
55270
  message: `${`Node.js Version "${selection.range}" is discontinued and must be upgraded.`} ${getHint(isAuto)}`
55269
55271
  });
55270
55272
  debug$1(`Selected Node.js ${selection.range}`);
@@ -55298,6 +55300,7 @@ ${error.message}`;
55298
55300
  var import_toml = __toESM(require_toml());
55299
55301
  var import_fs_extra6 = __toESM(require_lib());
55300
55302
  var import_error_utils = __toESM(require_dist());
55303
+ var import_path5 = __require("path");
55301
55304
  async function readFileOrNull(file) {
55302
55305
  try {
55303
55306
  return await (0, import_fs_extra6.readFile)(file);
@@ -55324,6 +55327,14 @@ ${error.message}`;
55324
55327
  }
55325
55328
  return null;
55326
55329
  }
55330
+ async function getPackageJson(dir) {
55331
+ const packagePath = (0, import_path5.join)(dir, "package.json");
55332
+ try {
55333
+ return JSON.parse(await (0, import_fs_extra6.readFile)(packagePath, "utf8"));
55334
+ } catch (err) {
55335
+ return {};
55336
+ }
55337
+ }
55327
55338
  var { hasOwnProperty: hasOwnProperty2 } = Object.prototype;
55328
55339
  function cloneEnv(...envs) {
55329
55340
  return envs.reduce((obj, env) => {
@@ -55381,12 +55392,12 @@ ${error.message}`;
55381
55392
  return true;
55382
55393
  }
55383
55394
  function* traverseUpDirectories({ start, base }) {
55384
- let current = import_path5.default.normalize(start);
55385
- const normalizedRoot = base ? import_path5.default.normalize(base) : void 0;
55395
+ let current = import_path6.default.normalize(start);
55396
+ const normalizedRoot = base ? import_path6.default.normalize(base) : void 0;
55386
55397
  while (current) {
55387
55398
  yield current;
55388
55399
  if (current === normalizedRoot) break;
55389
- const next = import_path5.default.join(current, "..");
55400
+ const next = import_path6.default.join(current, "..");
55390
55401
  current = next === current ? void 0 : next;
55391
55402
  }
55392
55403
  }
@@ -55396,24 +55407,24 @@ ${error.message}`;
55396
55407
  start,
55397
55408
  base
55398
55409
  })) {
55399
- const packageJsonPath = import_path5.default.join(dir, "package.json");
55410
+ const packageJsonPath = import_path6.default.join(dir, "package.json");
55400
55411
  if (await import_fs_extra7.default.pathExists(packageJsonPath)) curRootPackageJsonPath = packageJsonPath;
55401
55412
  }
55402
55413
  return curRootPackageJsonPath ? {
55403
55414
  packageJson: await import_fs_extra7.default.readJson(curRootPackageJsonPath),
55404
- rootDir: import_path5.default.dirname(curRootPackageJsonPath)
55415
+ rootDir: import_path6.default.dirname(curRootPackageJsonPath)
55405
55416
  } : void 0;
55406
55417
  }
55407
55418
  async function getNodeBinPath({ cwd }) {
55408
55419
  const { lockfilePath } = await scanParentDirs(cwd);
55409
- const dir = import_path5.default.dirname(lockfilePath || cwd);
55410
- return import_path5.default.join(dir, "node_modules", ".bin");
55420
+ const dir = import_path6.default.dirname(lockfilePath || cwd);
55421
+ return import_path6.default.join(dir, "node_modules", ".bin");
55411
55422
  }
55412
55423
  function getNodeBinPaths({ start, base }) {
55413
55424
  return Array.from(traverseUpDirectories({
55414
55425
  start,
55415
55426
  base
55416
- })).map((dir) => import_path5.default.join(dir, "node_modules/.bin"));
55427
+ })).map((dir) => import_path6.default.join(dir, "node_modules/.bin"));
55417
55428
  }
55418
55429
  async function chmodPlusX(fsPath) {
55419
55430
  const s = await import_fs_extra7.default.stat(fsPath);
@@ -55423,10 +55434,10 @@ ${error.message}`;
55423
55434
  await import_fs_extra7.default.chmod(fsPath, base8);
55424
55435
  }
55425
55436
  async function runShellScript(fsPath, args = [], spawnOpts) {
55426
- (0, import_assert6.default)(import_path5.default.isAbsolute(fsPath));
55427
- const destPath = import_path5.default.dirname(fsPath);
55437
+ (0, import_assert6.default)(import_path6.default.isAbsolute(fsPath));
55438
+ const destPath = import_path6.default.dirname(fsPath);
55428
55439
  await chmodPlusX(fsPath);
55429
- const command = `./${import_path5.default.basename(fsPath)}`;
55440
+ const command = `./${import_path6.default.basename(fsPath)}`;
55430
55441
  await spawnAsync(command, args, {
55431
55442
  ...spawnOpts,
55432
55443
  cwd: destPath,
@@ -55439,7 +55450,7 @@ ${error.message}`;
55439
55450
  if (isBunVersion(nodeVersion)) return opts;
55440
55451
  if (!meta.isDev) {
55441
55452
  let found = false;
55442
- const pathSegments = (opts.env.PATH || process.env.PATH || "").split(import_path5.default.delimiter).map((segment) => {
55453
+ const pathSegments = (opts.env.PATH || process.env.PATH || "").split(import_path6.default.delimiter).map((segment) => {
55443
55454
  if (/^\/node[0-9]+\/bin/.test(segment)) {
55444
55455
  found = true;
55445
55456
  return `/node${nodeVersion.major}/bin`;
@@ -55447,11 +55458,11 @@ ${error.message}`;
55447
55458
  return segment;
55448
55459
  });
55449
55460
  if (!found) pathSegments.unshift(`/node${nodeVersion.major}/bin`);
55450
- opts.env.PATH = pathSegments.filter(Boolean).join(import_path5.default.delimiter);
55461
+ opts.env.PATH = pathSegments.filter(Boolean).join(import_path6.default.delimiter);
55451
55462
  }
55452
55463
  return opts;
55453
55464
  }
55454
- async function getNodeVersion(destPath, fallbackVersion = process.env.VERCEL_PROJECT_SETTINGS_NODE_VERSION, config = {}, meta = {}, availableVersions = getAvailableNodeVersions()) {
55465
+ async function getRuntimeNodeVersion(destPath, fallbackVersion = process.env.VERCEL_PROJECT_SETTINGS_NODE_VERSION, config = {}, meta = {}, availableVersions = getAvailableNodeVersions()) {
55455
55466
  if (config.bunVersion) return getSupportedBunVersion(config.bunVersion);
55456
55467
  const latestVersion = getLatestNodeVersion(availableVersions);
55457
55468
  if (meta.isDev) {
@@ -55464,14 +55475,14 @@ ${error.message}`;
55464
55475
  const supportedNodeVersion = await getSupportedNodeVersion(packageJsonVersion || configuredVersion, !packageJsonVersion, availableVersions);
55465
55476
  if (packageJson?.engines?.node) {
55466
55477
  const { node } = packageJson.engines;
55467
- if (configuredVersion && !(0, import_semver2.intersects)(configuredVersion, supportedNodeVersion.range)) console.warn(`Warning: Due to "engines": { "node": "${node}" } in your \`package.json\` file, the Node.js Version defined in your Project Settings ("${configuredVersion}") will not apply, Node.js Version "${supportedNodeVersion.range}" will be used instead. Learn More: http://vercel.link/node-version`);
55468
- if ((0, import_semver2.coerce)(node)?.raw === node) console.warn(`Warning: Detected "engines": { "node": "${node}" } in your \`package.json\` with major.minor.patch, but only major Node.js Version can be selected. Learn More: http://vercel.link/node-version`);
55469
- else if ((0, import_semver2.validRange)(node) && (0, import_semver2.intersects)(`${latestVersion.major + 1}.x`, node)) console.warn(`Warning: Detected "engines": { "node": "${node}" } in your \`package.json\` that will automatically upgrade when a new major Node.js Version is released. Learn More: http://vercel.link/node-version`);
55478
+ if (configuredVersion && !(0, import_semver2.intersects)(configuredVersion, supportedNodeVersion.range)) console.warn(`Warning: Due to "engines": { "node": "${node}" } in your \`package.json\` file, the Node.js Version defined in your Project Settings ("${configuredVersion}") will not apply, Node.js Version "${supportedNodeVersion.range}" will be used instead. Learn More: https://vercel.link/node-version`);
55479
+ if ((0, import_semver2.coerce)(node)?.raw === node) console.warn(`Warning: Detected "engines": { "node": "${node}" } in your \`package.json\` with major.minor.patch, but only major Node.js Version can be selected. Learn More: https://vercel.link/node-version`);
55480
+ else if ((0, import_semver2.validRange)(node) && (0, import_semver2.intersects)(`${latestVersion.major + 1}.x`, node)) console.warn(`Warning: Detected "engines": { "node": "${node}" } in your \`package.json\` that will automatically upgrade when a new major Node.js Version is released. Learn More: https://vercel.link/node-version`);
55470
55481
  }
55471
55482
  return supportedNodeVersion;
55472
55483
  }
55473
55484
  async function scanParentDirs(destPath, readPackageJson = false, base = "/") {
55474
- (0, import_assert6.default)(import_path5.default.isAbsolute(destPath));
55485
+ (0, import_assert6.default)(import_path6.default.isAbsolute(destPath));
55475
55486
  const pkgJsonPath = await walkParentDirs({
55476
55487
  base,
55477
55488
  start: destPath,
@@ -55557,8 +55568,8 @@ ${error.message}`;
55557
55568
  }
55558
55569
  async function checkTurboSupportsCorepack(turboVersionRange, rootDir) {
55559
55570
  if (turboVersionSpecifierSupportsCorepack(turboVersionRange)) return true;
55560
- const turboJsonPath = import_path5.default.join(rootDir, "turbo.json");
55561
- const turboJsoncPath = import_path5.default.join(rootDir, "turbo.jsonc");
55571
+ const turboJsonPath = import_path6.default.join(rootDir, "turbo.json");
55572
+ const turboJsoncPath = import_path6.default.join(rootDir, "turbo.jsonc");
55562
55573
  const [turboJsonExists, turboJsoncExists] = await Promise.all([import_fs_extra7.default.pathExists(turboJsonPath), import_fs_extra7.default.pathExists(turboJsoncPath)]);
55563
55574
  let turboJson = null;
55564
55575
  let turboConfigPath = null;
@@ -55567,7 +55578,7 @@ ${error.message}`;
55567
55578
  if (turboConfigPath) try {
55568
55579
  turboJson = import_json5.default.parse(await import_fs_extra7.default.readFile(turboConfigPath, "utf8"));
55569
55580
  } catch (err) {
55570
- console.warn(`WARNING: Failed to parse ${import_path5.default.basename(turboConfigPath)}`);
55581
+ console.warn(`WARNING: Failed to parse ${import_path6.default.basename(turboConfigPath)}`);
55571
55582
  }
55572
55583
  return turboJson !== null && typeof turboJson === "object" && "globalPassThroughEnv" in turboJson && Array.isArray(turboJson.globalPassThroughEnv) && turboJson.globalPassThroughEnv.includes("COREPACK_HOME");
55573
55584
  }
@@ -55601,13 +55612,13 @@ ${error.message}`;
55601
55612
  return true;
55602
55613
  }
55603
55614
  async function walkParentDirs({ base, start, filename }) {
55604
- (0, import_assert6.default)(import_path5.default.isAbsolute(base), "Expected \"base\" to be absolute path");
55605
- (0, import_assert6.default)(import_path5.default.isAbsolute(start), "Expected \"start\" to be absolute path");
55615
+ (0, import_assert6.default)(import_path6.default.isAbsolute(base), "Expected \"base\" to be absolute path");
55616
+ (0, import_assert6.default)(import_path6.default.isAbsolute(start), "Expected \"start\" to be absolute path");
55606
55617
  for (const dir of traverseUpDirectories({
55607
55618
  start,
55608
55619
  base
55609
55620
  })) {
55610
- const fullPath = import_path5.default.join(dir, filename);
55621
+ const fullPath = import_path6.default.join(dir, filename);
55611
55622
  if (await import_fs_extra7.default.pathExists(fullPath)) return fullPath;
55612
55623
  }
55613
55624
  return null;
@@ -55618,10 +55629,10 @@ ${error.message}`;
55618
55629
  start,
55619
55630
  base
55620
55631
  })) {
55621
- const fullPaths = filenames.map((f) => import_path5.default.join(dir, f));
55632
+ const fullPaths = filenames.map((f) => import_path6.default.join(dir, f));
55622
55633
  const existResults = await Promise.all(fullPaths.map((f) => import_fs_extra7.default.pathExists(f)));
55623
55634
  const foundOneOrMore = existResults.some((b) => b);
55624
- const packageJsonPath = import_path5.default.join(dir, "package.json");
55635
+ const packageJsonPath = import_path6.default.join(dir, "package.json");
55625
55636
  const packageJson = await import_fs_extra7.default.readJSON(packageJsonPath).catch(() => null);
55626
55637
  if (packageJson?.packageManager) packageManager = packageJson.packageManager;
55627
55638
  if (foundOneOrMore) return {
@@ -55681,12 +55692,16 @@ ${error.message}`;
55681
55692
  };
55682
55693
  }
55683
55694
  var runNpmInstallSema = new import_async_sema4.default(1);
55695
+ var customInstallCommandSet;
55696
+ function resetCustomInstallCommandSet() {
55697
+ customInstallCommandSet = void 0;
55698
+ }
55684
55699
  async function runNpmInstall(destPath, args = [], spawnOpts, meta, projectCreatedAt) {
55685
55700
  if (meta?.isDev) {
55686
55701
  debug$1("Skipping dependency installation because dev mode is enabled");
55687
55702
  return false;
55688
55703
  }
55689
- (0, import_assert6.default)(import_path5.default.isAbsolute(destPath));
55704
+ (0, import_assert6.default)(import_path6.default.isAbsolute(destPath));
55690
55705
  try {
55691
55706
  await runNpmInstallSema.acquire();
55692
55707
  const { cliType, packageJsonPath, packageJson, lockfileVersion, packageJsonPackageManager, turboSupportsCorepackHome } = await scanParentDirs(destPath, true);
@@ -55698,6 +55713,12 @@ ${error.message}`;
55698
55713
  if (meta && packageJsonPath && defaultInstall) {
55699
55714
  const { alreadyInstalled, runNpmInstallSet } = checkIfAlreadyInstalled(meta.runNpmInstallSet, packageJsonPath);
55700
55715
  if (alreadyInstalled) return false;
55716
+ if (process.env.VERCEL_INSTALL_COMPLETED === "1") {
55717
+ debug$1(`Skipping dependency installation for ${packageJsonPath} because VERCEL_INSTALL_COMPLETED is set`);
55718
+ runNpmInstallSet.add(packageJsonPath);
55719
+ meta.runNpmInstallSet = runNpmInstallSet;
55720
+ return false;
55721
+ }
55701
55722
  meta.runNpmInstallSet = runNpmInstallSet;
55702
55723
  }
55703
55724
  if (cliType === "yarn") {
@@ -55753,11 +55774,11 @@ ${error.message}`;
55753
55774
  else debug$1(`Detected ${detectedPackageManager}. Added "${newPath}" to path. Based on assumed package manager "${cliType}", lockfile "${detectedLockfile}", and lockfileVersion "${lockfileVersion}"`);
55754
55775
  const newEnv = { ...env };
55755
55776
  const alreadyInPath = (newPath2) => {
55756
- return (env.PATH ?? "").split(import_path5.default.delimiter).includes(newPath2);
55777
+ return (env.PATH ?? "").split(import_path6.default.delimiter).includes(newPath2);
55757
55778
  };
55758
55779
  if (newPath && !alreadyInPath(newPath)) {
55759
55780
  const oldPath = env.PATH + "";
55760
- newEnv.PATH = `${newPath}${import_path5.default.delimiter}${oldPath}`;
55781
+ newEnv.PATH = `${newPath}${import_path6.default.delimiter}${oldPath}`;
55761
55782
  if (detectedLockfile && detectedPackageManager) {
55762
55783
  const detectedV9PnpmLockfile = detectedLockfile === "pnpm-lock.yaml" && lockfileVersion === 9;
55763
55784
  if (detectedPackageManager === "pnpm@10.x" && packageJsonPackageManager) {
@@ -55924,7 +55945,7 @@ To use ${otherVersion}, manually opt in using corepack (https://vercel.com/docs/
55924
55945
  });
55925
55946
  if (corepackEnabled) overrides = NO_OVERRIDE;
55926
55947
  const alreadyInPath = (newPath) => {
55927
- return (env.PATH ?? "").split(import_path5.default.delimiter).includes(newPath);
55948
+ return (env.PATH ?? "").split(import_path6.default.delimiter).includes(newPath);
55928
55949
  };
55929
55950
  switch (true) {
55930
55951
  case cliType === "yarn" && !env.YARN_NODE_LINKER: return {
@@ -55944,6 +55965,17 @@ To use ${otherVersion}, manually opt in using corepack (https://vercel.com/docs/
55944
55965
  }
55945
55966
  }
55946
55967
  async function runCustomInstallCommand({ destPath, installCommand, spawnOpts, projectCreatedAt }) {
55968
+ const normalizedPath = import_path6.default.normalize(destPath);
55969
+ const { alreadyInstalled, runNpmInstallSet } = checkIfAlreadyInstalled(customInstallCommandSet, normalizedPath);
55970
+ customInstallCommandSet = runNpmInstallSet;
55971
+ if (alreadyInstalled) {
55972
+ debug$1(`Skipping custom install command for ${normalizedPath} because it was already run`);
55973
+ return false;
55974
+ }
55975
+ if (process.env.VERCEL_INSTALL_COMPLETED === "1") {
55976
+ debug$1(`Skipping custom install command for ${normalizedPath} because VERCEL_INSTALL_COMPLETED is set`);
55977
+ return false;
55978
+ }
55947
55979
  console.log(`Running "install" command: \`${installCommand}\`...`);
55948
55980
  const { cliType, lockfileVersion, packageJson, packageJsonPackageManager, turboSupportsCorepackHome } = await scanParentDirs(destPath, true);
55949
55981
  const env = getEnvForPackageManager({
@@ -55961,9 +55993,10 @@ To use ${otherVersion}, manually opt in using corepack (https://vercel.com/docs/
55961
55993
  env,
55962
55994
  cwd: destPath
55963
55995
  });
55996
+ return true;
55964
55997
  }
55965
55998
  async function runPackageJsonScript(destPath, scriptNames, spawnOpts, projectCreatedAt) {
55966
- (0, import_assert6.default)(import_path5.default.isAbsolute(destPath));
55999
+ (0, import_assert6.default)(import_path6.default.isAbsolute(destPath));
55967
56000
  const { packageJson, cliType, lockfileVersion, packageJsonPackageManager, turboSupportsCorepackHome } = await scanParentDirs(destPath, true);
55968
56001
  const scriptName = getScriptName(packageJson, typeof scriptNames === "string" ? [scriptNames] : scriptNames);
55969
56002
  if (!scriptName) return false;
@@ -55997,7 +56030,7 @@ To use ${otherVersion}, manually opt in using corepack (https://vercel.com/docs/
55997
56030
  debug$1("Skipping dependency installation because dev mode is enabled");
55998
56031
  return;
55999
56032
  }
56000
- (0, import_assert6.default)(import_path5.default.isAbsolute(destPath));
56033
+ (0, import_assert6.default)(import_path6.default.isAbsolute(destPath));
56001
56034
  const opts = {
56002
56035
  ...spawnOpts,
56003
56036
  cwd: destPath,
@@ -56010,7 +56043,7 @@ To use ${otherVersion}, manually opt in using corepack (https://vercel.com/docs/
56010
56043
  debug$1("Skipping dependency installation because dev mode is enabled");
56011
56044
  return;
56012
56045
  }
56013
- (0, import_assert6.default)(import_path5.default.isAbsolute(destPath));
56046
+ (0, import_assert6.default)(import_path6.default.isAbsolute(destPath));
56014
56047
  const opts = {
56015
56048
  ...spawnOpts,
56016
56049
  cwd: destPath,
@@ -56028,7 +56061,7 @@ To use ${otherVersion}, manually opt in using corepack (https://vercel.com/docs/
56028
56061
  }
56029
56062
  }
56030
56063
  var installDependencies = (0, import_util2.deprecate)(runNpmInstall, "installDependencies() is deprecated. Please use runNpmInstall() instead.");
56031
- var import_path6 = __toESM(__require("path"));
56064
+ var import_path7 = __toESM(__require("path"));
56032
56065
  var import_fs_extra8 = __toESM(require_lib());
56033
56066
  var import_ignore = __toESM(require_ignore());
56034
56067
  function isCodedError(error) {
@@ -56046,8 +56079,8 @@ To use ${otherVersion}, manually opt in using corepack (https://vercel.com/docs/
56046
56079
  throw error;
56047
56080
  }
56048
56081
  };
56049
- const vercelIgnorePath = import_path6.default.join(downloadPath, rootDirectory || "", ".vercelignore");
56050
- const nowIgnorePath = import_path6.default.join(downloadPath, rootDirectory || "", ".nowignore");
56082
+ const vercelIgnorePath = import_path7.default.join(downloadPath, rootDirectory || "", ".vercelignore");
56083
+ const nowIgnorePath = import_path7.default.join(downloadPath, rootDirectory || "", ".nowignore");
56051
56084
  const ignoreContents = [];
56052
56085
  try {
56053
56086
  ignoreContents.push(...(await Promise.all([readFile4(vercelIgnorePath), readFile4(nowIgnorePath)])).filter(Boolean));
@@ -56085,18 +56118,18 @@ To use ${otherVersion}, manually opt in using corepack (https://vercel.com/docs/
56085
56118
  }
56086
56119
  return newEnvs;
56087
56120
  }
56088
- var import_path7 = __toESM(__require("path"));
56121
+ var import_path8 = __toESM(__require("path"));
56089
56122
  var import_fs2 = __require("fs");
56090
56123
  async function hardLinkDir(src, destDirs) {
56091
56124
  if (destDirs.length === 0) return;
56092
- destDirs = destDirs.filter((destDir) => import_path7.default.relative(destDir, src) !== "");
56125
+ destDirs = destDirs.filter((destDir) => import_path8.default.relative(destDir, src) !== "");
56093
56126
  const files = await import_fs2.promises.readdir(src);
56094
56127
  await Promise.all(files.map(async (file) => {
56095
56128
  if (file === "node_modules") return;
56096
- const srcFile = import_path7.default.join(src, file);
56129
+ const srcFile = import_path8.default.join(src, file);
56097
56130
  if ((await import_fs2.promises.lstat(srcFile)).isDirectory()) {
56098
56131
  await hardLinkDir(srcFile, await Promise.all(destDirs.map(async (destDir) => {
56099
- const destSubdir = import_path7.default.join(destDir, file);
56132
+ const destSubdir = import_path8.default.join(destDir, file);
56100
56133
  try {
56101
56134
  await import_fs2.promises.mkdir(destSubdir, { recursive: true });
56102
56135
  } catch (err) {
@@ -56107,7 +56140,7 @@ To use ${otherVersion}, manually opt in using corepack (https://vercel.com/docs/
56107
56140
  return;
56108
56141
  }
56109
56142
  await Promise.all(destDirs.map(async (destDir) => {
56110
- const destFile = import_path7.default.join(destDir, file);
56143
+ const destFile = import_path8.default.join(destDir, file);
56111
56144
  try {
56112
56145
  await linkOrCopyFile(srcFile, destFile);
56113
56146
  } catch (err) {
@@ -56122,7 +56155,7 @@ To use ${otherVersion}, manually opt in using corepack (https://vercel.com/docs/
56122
56155
  await linkOrCopy(srcFile, destFile);
56123
56156
  } catch (err) {
56124
56157
  if (err.code === "ENOENT") {
56125
- await import_fs2.promises.mkdir(import_path7.default.dirname(destFile), { recursive: true });
56158
+ await import_fs2.promises.mkdir(import_path8.default.dirname(destFile), { recursive: true });
56126
56159
  await linkOrCopy(srcFile, destFile);
56127
56160
  return;
56128
56161
  }
@@ -56137,10 +56170,10 @@ To use ${otherVersion}, manually opt in using corepack (https://vercel.com/docs/
56137
56170
  await import_fs2.promises.copyFile(srcFile, destFile);
56138
56171
  }
56139
56172
  }
56140
- var import_path8 = __require("path");
56173
+ var import_path9 = __require("path");
56141
56174
  var import_promises = __require("fs/promises");
56142
56175
  async function validateNpmrc(cwd) {
56143
- if ((await (0, import_promises.readFile)((0, import_path8.join)(cwd, ".npmrc"), "utf-8").catch((err) => {
56176
+ if ((await (0, import_promises.readFile)((0, import_path9.join)(cwd, ".npmrc"), "utf-8").catch((err) => {
56144
56177
  if (err.code !== "ENOENT") throw err;
56145
56178
  }))?.match(/(?<!#.*)use-node-version/)) throw new Error("Detected unsupported \"use-node-version\" in your \".npmrc\". Please use \"engines\" in your \"package.json\" instead.");
56146
56179
  }
@@ -56181,12 +56214,12 @@ To use ${otherVersion}, manually opt in using corepack (https://vercel.com/docs/
56181
56214
  if (!os) return "provided.al2023";
56182
56215
  return os.PRETTY_NAME === "Amazon Linux 2" ? "provided.al2" : "provided.al2023";
56183
56216
  }
56184
- var import_path9 = __require("path");
56217
+ var import_path10 = __require("path");
56185
56218
  var shouldServe = ({ entrypoint, files, requestPath }) => {
56186
56219
  requestPath = requestPath.replace(/\/$/, "");
56187
56220
  entrypoint = entrypoint.replace(/\\/, "/");
56188
56221
  if (entrypoint === requestPath && hasProp(files, entrypoint)) return true;
56189
- const { dir, name } = (0, import_path9.parse)(entrypoint);
56222
+ const { dir, name } = (0, import_path10.parse)(entrypoint);
56190
56223
  if (name === "index" && dir === requestPath && hasProp(files, entrypoint)) return true;
56191
56224
  return false;
56192
56225
  };
@@ -56467,6 +56500,7 @@ ${entrypointsForMessage}`);
56467
56500
  "express",
56468
56501
  "hono",
56469
56502
  "h3",
56503
+ "koa",
56470
56504
  "nestjs",
56471
56505
  "fastify",
56472
56506
  "elysia"
@@ -56475,6 +56509,7 @@ ${entrypointsForMessage}`);
56475
56509
  "@vercel/express",
56476
56510
  "@vercel/hono",
56477
56511
  "@vercel/h3",
56512
+ "@vercel/koa",
56478
56513
  "@vercel/nestjs",
56479
56514
  "@vercel/fastify",
56480
56515
  "@vercel/elysia"
@@ -56498,12 +56533,12 @@ ${entrypointsForMessage}`);
56498
56533
  return isExperimentalBackendsEnabled() && isBackendFramework(framework);
56499
56534
  }
56500
56535
  var import_fs3 = __toESM(__require("fs"));
56501
- var import_path10 = __require("path");
56536
+ var import_path11 = __require("path");
56502
56537
  var import_execa = __toESM(require_execa());
56503
56538
  var isWin2 = process.platform === "win32";
56504
56539
  async function runStdlibPyScript(options) {
56505
56540
  const { scriptName, pythonPath, args = [], cwd } = options;
56506
- const scriptPath = (0, import_path10.join)(__dirname, "..", "lib", "python", `${scriptName}.py`);
56541
+ const scriptPath = (0, import_path11.join)(__dirname, "..", "lib", "python", `${scriptName}.py`);
56507
56542
  if (!import_fs3.default.existsSync(scriptPath)) throw new Error(`Python script not found: ${scriptPath}`);
56508
56543
  const pythonCmd = pythonPath ?? (isWin2 ? "python" : "python3");
56509
56544
  debug$1(`Running stdlib Python script: ${pythonCmd} ${scriptPath} ${args.join(" ")}`);
@@ -56567,6 +56602,7 @@ const introspectApp = async (args) => {
56567
56602
  let introspectionData;
56568
56603
  await new Promise((resolvePromise) => {
56569
56604
  try {
56605
+ (0, import_dist.debug)("Spawning introspection process");
56570
56606
  const child = spawn("node", [
56571
56607
  "-r",
56572
56608
  cjsLoaderPath,
@@ -56588,26 +56624,33 @@ const introspectApp = async (args) => {
56588
56624
  child.stdout?.on("data", (data) => {
56589
56625
  try {
56590
56626
  introspectionData = introspectionSchema.parse(JSON.parse(data.toString() || "{}"));
56591
- } catch (error) {}
56627
+ (0, import_dist.debug)(`Introspection data parsed successfully`);
56628
+ } catch (error) {
56629
+ (0, import_dist.debug)("Error parsing introspection data", error);
56630
+ }
56592
56631
  });
56593
56632
  const timeout = setTimeout(() => {
56633
+ (0, import_dist.debug)("Introspection timeout, killing process with SIGTERM");
56594
56634
  child.kill("SIGTERM");
56595
- }, 2e3);
56635
+ }, 8e3);
56596
56636
  const timeout2 = setTimeout(() => {
56637
+ (0, import_dist.debug)("Introspection timeout, killing process with SIGKILL");
56597
56638
  child.kill("SIGKILL");
56598
- }, 3e3);
56639
+ }, 9e3);
56599
56640
  child.on("error", (err) => {
56600
56641
  clearTimeout(timeout);
56601
56642
  clearTimeout(timeout2);
56602
- console.log(`Loader error: ${err.message}`);
56643
+ (0, import_dist.debug)(`Loader error: ${err.message}`);
56603
56644
  resolvePromise(void 0);
56604
56645
  });
56605
56646
  child.on("close", () => {
56606
56647
  clearTimeout(timeout);
56607
56648
  clearTimeout(timeout2);
56649
+ (0, import_dist.debug)("Introspection process closed");
56608
56650
  resolvePromise(void 0);
56609
56651
  });
56610
56652
  } catch (error) {
56653
+ (0, import_dist.debug)("Introspection error", error);
56611
56654
  resolvePromise(void 0);
56612
56655
  }
56613
56656
  });