@vercel/node 5.9.8 → 5.10.0

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.
@@ -597,8 +597,10 @@ import { readFileSync } from "fs";
597
597
  // src/utils.ts
598
598
  import { debug, streamToBuffer } from "@vercel/build-utils";
599
599
  import { extname } from "path";
600
- import { pathToRegexp as pathToRegexpCurrent } from "path-to-regexp";
601
- import { pathToRegexp as pathToRegexpUpdated } from "path-to-regexp-updated";
600
+ import {
601
+ getRegExpFromMatchers,
602
+ resolveMiddlewareMatcher
603
+ } from "@vercel/build-utils";
602
604
  var WAIT_UNTIL_TIMEOUT = 30;
603
605
  var waitUntilWarning = (entrypointPath, maxDuration) => `
604
606
  The function \`${entrypointPath.split("/").pop()}\` is still running after ${maxDuration}s.
package/dist/index.js CHANGED
@@ -71871,7 +71871,7 @@ __export(src_exports, {
71871
71871
  build: () => build,
71872
71872
  diagnostics: () => diagnostics,
71873
71873
  prepareCache: () => prepareCache,
71874
- shouldServe: () => import_build_utils10.shouldServe,
71874
+ shouldServe: () => import_build_utils11.shouldServe,
71875
71875
  startDevServer: () => startDevServer,
71876
71876
  version: () => version
71877
71877
  });
@@ -71885,7 +71885,7 @@ var import_path3 = require("path");
71885
71885
  var import_ts_morph = require("ts-morph");
71886
71886
  var import_nft = require("@vercel/nft");
71887
71887
  var import_resolve_dependency = __toESM(require("@vercel/nft/out/resolve-dependency"));
71888
- var import_build_utils5 = require("@vercel/build-utils");
71888
+ var import_build_utils6 = require("@vercel/build-utils");
71889
71889
  var import_static_config = require("@vercel/static-config");
71890
71890
 
71891
71891
  // src/typescript.ts
@@ -72446,86 +72446,7 @@ var diagnostics = (0, import_build_utils2.createDiagnostics)("node");
72446
72446
  // src/utils.ts
72447
72447
  var import_build_utils4 = require("@vercel/build-utils");
72448
72448
  var import_path2 = require("path");
72449
- var import_path_to_regexp = require("path-to-regexp");
72450
- var import_path_to_regexp_updated = require("path-to-regexp-updated");
72451
- function cloneKeys(keys) {
72452
- if (typeof keys === "undefined") {
72453
- return void 0;
72454
- }
72455
- return keys.slice(0);
72456
- }
72457
- function compareKeys(left, right) {
72458
- const leftSerialized = typeof left === "undefined" ? "undefined" : left.toString();
72459
- const rightSerialized = typeof right === "undefined" ? "undefined" : right.toString();
72460
- return leftSerialized === rightSerialized;
72461
- }
72462
- function pathToRegexp(callerId, path, keys, options) {
72463
- const newKeys = cloneKeys(keys);
72464
- const currentRegExp = (0, import_path_to_regexp.pathToRegexp)(path, keys, options);
72465
- try {
72466
- const currentKeys = keys;
72467
- const newRegExp = (0, import_path_to_regexp_updated.pathToRegexp)(path, newKeys, options);
72468
- const isDiffRegExp = currentRegExp.toString() !== newRegExp.toString();
72469
- if (process.env.FORCE_PATH_TO_REGEXP_LOG || isDiffRegExp) {
72470
- const message = JSON.stringify({
72471
- path,
72472
- currentRegExp: currentRegExp.toString(),
72473
- newRegExp: newRegExp.toString()
72474
- });
72475
- console.error(`[vc] PATH TO REGEXP PATH DIFF @ #${callerId}: ${message}`);
72476
- }
72477
- const isDiffKeys = !compareKeys(keys, newKeys);
72478
- if (process.env.FORCE_PATH_TO_REGEXP_LOG || isDiffKeys) {
72479
- const message = JSON.stringify({
72480
- isDiffKeys,
72481
- currentKeys,
72482
- newKeys
72483
- });
72484
- console.error(`[vc] PATH TO REGEXP KEYS DIFF @ #${callerId}: ${message}`);
72485
- }
72486
- } catch (err) {
72487
- const error = err;
72488
- const message = JSON.stringify({
72489
- path,
72490
- error: error.message
72491
- });
72492
- console.error(`[vc] PATH TO REGEXP ERROR @ #${callerId}: ${message}`);
72493
- }
72494
- return currentRegExp;
72495
- }
72496
- function getRegExpFromMatchers(matcherOrMatchers) {
72497
- if (!matcherOrMatchers) {
72498
- return "^/.*$";
72499
- }
72500
- const matchers = Array.isArray(matcherOrMatchers) ? matcherOrMatchers : [matcherOrMatchers];
72501
- const regExps = matchers.flatMap(getRegExpFromMatcher).join("|");
72502
- return regExps;
72503
- }
72504
- function resolveMiddlewareMatcher(configuredMatcher, sourceMatcher, entrypoint) {
72505
- if (configuredMatcher !== void 0 && sourceMatcher !== void 0) {
72506
- throw new Error(
72507
- `${entrypoint}: \`proxy.matcher\` in vercel.json conflicts with \`config.matcher\` exported from the proxy entrypoint. Configure the matcher in only one location.`
72508
- );
72509
- }
72510
- return configuredMatcher ?? sourceMatcher;
72511
- }
72512
- function getRegExpFromMatcher(matcher, index, allMatchers) {
72513
- if (typeof matcher !== "string") {
72514
- throw new Error(
72515
- "Middleware's `config.matcher` must be a path matcher (string) or an array of path matchers (string[])"
72516
- );
72517
- }
72518
- if (!matcher.startsWith("/")) {
72519
- throw new Error(
72520
- `Middleware's \`config.matcher\` values must start with "/". Received: ${matcher}`
72521
- );
72522
- }
72523
- const regExps = [pathToRegexp("316", matcher).source];
72524
- if (matcher === "/" && !allMatchers.includes("/index")) {
72525
- regExps.push(pathToRegexp("491", "/index").source);
72526
- }
72527
- return regExps;
72528
- }
72449
+ var import_build_utils5 = require("@vercel/build-utils");
72529
72450
  function entrypointToOutputPath(entrypoint, zeroConfig) {
72530
72451
  if (zeroConfig) {
72531
72452
  const ext = (0, import_path2.extname)(entrypoint);
@@ -72575,9 +72496,9 @@ async function downloadInstallAndBundle({
72575
72496
  meta,
72576
72497
  considerBuildCommand
72577
72498
  }) {
72578
- const downloadedFiles = await (0, import_build_utils5.download)(files, workPath, meta);
72499
+ const downloadedFiles = await (0, import_build_utils6.download)(files, workPath, meta);
72579
72500
  const entrypointFsDirname = (0, import_path3.join)(workPath, (0, import_path3.dirname)(entrypoint));
72580
- const nodeVersion = await (0, import_build_utils5.getNodeVersion)(
72501
+ const nodeVersion = await (0, import_build_utils6.getNodeVersion)(
72581
72502
  entrypointFsDirname,
72582
72503
  void 0,
72583
72504
  config,
@@ -72589,8 +72510,8 @@ async function downloadInstallAndBundle({
72589
72510
  lockfileVersion,
72590
72511
  packageJsonPackageManager,
72591
72512
  turboSupportsCorepackHome
72592
- } = await (0, import_build_utils5.scanParentDirs)(entrypointFsDirname, true);
72593
- const spawnEnv = (0, import_build_utils5.getEnvForPackageManager)({
72513
+ } = await (0, import_build_utils6.scanParentDirs)(entrypointFsDirname, true);
72514
+ const spawnEnv = (0, import_build_utils6.getEnvForPackageManager)({
72594
72515
  cliType,
72595
72516
  lockfileVersion,
72596
72517
  packageJsonPackageManager,
@@ -72602,7 +72523,7 @@ async function downloadInstallAndBundle({
72602
72523
  if (typeof installCommand === "string" && considerBuildCommand) {
72603
72524
  if (installCommand.trim()) {
72604
72525
  console.log(`Running "install" command: \`${installCommand}\`...`);
72605
- await (0, import_build_utils5.execCommand)(installCommand, {
72526
+ await (0, import_build_utils6.execCommand)(installCommand, {
72606
72527
  env: spawnEnv,
72607
72528
  cwd: entrypointFsDirname
72608
72529
  });
@@ -72610,7 +72531,7 @@ async function downloadInstallAndBundle({
72610
72531
  console.log(`Skipping "install" command...`);
72611
72532
  }
72612
72533
  } else {
72613
- await (0, import_build_utils5.runNpmInstall)(
72534
+ await (0, import_build_utils6.runNpmInstall)(
72614
72535
  entrypointFsDirname,
72615
72536
  [],
72616
72537
  { env: spawnEnv },
@@ -72655,7 +72576,7 @@ async function compile2(workPath, baseDir, entrypointPath, config, meta, nodeVer
72655
72576
  if (config.includeFiles) {
72656
72577
  const includeFiles = typeof config.includeFiles === "string" ? [config.includeFiles] : config.includeFiles;
72657
72578
  for (const pattern of includeFiles) {
72658
- const files = await (0, import_build_utils5.glob)(pattern, workPath);
72579
+ const files = await (0, import_build_utils6.glob)(pattern, workPath);
72659
72580
  await Promise.all(
72660
72581
  Object.values(files).map(async (entry) => {
72661
72582
  const { fsPath } = entry;
@@ -72683,14 +72604,14 @@ async function compile2(workPath, baseDir, entrypointPath, config, meta, nodeVer
72683
72604
  }
72684
72605
  const { code, map } = await tsCompile(source, path);
72685
72606
  tsCompiled.add(relPath);
72686
- preparedFiles[renameTStoJS(relPath) + ".map"] = new import_build_utils5.FileBlob({
72607
+ preparedFiles[renameTStoJS(relPath) + ".map"] = new import_build_utils6.FileBlob({
72687
72608
  data: JSON.stringify(map)
72688
72609
  });
72689
72610
  source = code;
72690
72611
  shouldAddSourcemapSupport = true;
72691
72612
  return source;
72692
72613
  }
72693
- const isBun = (0, import_build_utils5.isBunVersion)(nodeVersion);
72614
+ const isBun = (0, import_build_utils6.isBunVersion)(nodeVersion);
72694
72615
  const conditions = isEdgeFunction ? ["edge-light", "browser", "module", "import", "require"] : isBun ? ["bun"] : void 0;
72695
72616
  const { fileList, esmFileList, warnings } = await (0, import_nft.nodeFileTrace)(
72696
72617
  [...inputFiles],
@@ -72720,18 +72641,18 @@ async function compile2(workPath, baseDir, entrypointPath, config, meta, nodeVer
72720
72641
  let entry;
72721
72642
  let source = (0, import_fs.readFileSync)(fsPath);
72722
72643
  const { mode } = (0, import_fs.lstatSync)(fsPath);
72723
- if ((0, import_build_utils5.isSymbolicLink)(mode)) {
72724
- entry = new import_build_utils5.FileFsRef({ fsPath, mode });
72644
+ if ((0, import_build_utils6.isSymbolicLink)(mode)) {
72645
+ entry = new import_build_utils6.FileFsRef({ fsPath, mode });
72725
72646
  }
72726
72647
  if (isEdgeFunction && (0, import_path3.basename)(fsPath) === "package.json") {
72727
72648
  const pkgJson = JSON.parse(source.toString());
72728
72649
  for (const prop of ["browser", "module"]) {
72729
72650
  const val = pkgJson[prop];
72730
72651
  if (typeof val === "string") {
72731
- (0, import_build_utils5.debug)(`Using "${prop}" field in ${fsPath}`);
72652
+ (0, import_build_utils6.debug)(`Using "${prop}" field in ${fsPath}`);
72732
72653
  pkgJson.main = val;
72733
72654
  if (!entry) {
72734
- entry = new import_build_utils5.FileBlob({ data: source, mode });
72655
+ entry = new import_build_utils6.FileBlob({ data: source, mode });
72735
72656
  }
72736
72657
  source = JSON.stringify(pkgJson);
72737
72658
  break;
@@ -72742,7 +72663,7 @@ async function compile2(workPath, baseDir, entrypointPath, config, meta, nodeVer
72742
72663
  source = await compileTypeScript(fsPath, source.toString());
72743
72664
  }
72744
72665
  if (!entry) {
72745
- entry = new import_build_utils5.FileBlob({ data: source, mode });
72666
+ entry = new import_build_utils6.FileBlob({ data: source, mode });
72746
72667
  }
72747
72668
  fsCache.set(relPath, entry);
72748
72669
  sourceCache.set(relPath, source);
@@ -72758,21 +72679,21 @@ async function compile2(workPath, baseDir, entrypointPath, config, meta, nodeVer
72758
72679
  }
72759
72680
  );
72760
72681
  for (const warning of warnings) {
72761
- (0, import_build_utils5.debug)(`Warning from trace: ${warning.message}`);
72682
+ (0, import_build_utils6.debug)(`Warning from trace: ${warning.message}`);
72762
72683
  }
72763
72684
  for (const path of fileList) {
72764
72685
  let entry = fsCache.get(path);
72765
72686
  if (!entry) {
72766
72687
  const fsPath = (0, import_path3.resolve)(baseDir, path);
72767
72688
  const { mode } = (0, import_fs.lstatSync)(fsPath);
72768
- if ((0, import_build_utils5.isSymbolicLink)(mode)) {
72769
- entry = new import_build_utils5.FileFsRef({ fsPath, mode });
72689
+ if ((0, import_build_utils6.isSymbolicLink)(mode)) {
72690
+ entry = new import_build_utils6.FileFsRef({ fsPath, mode });
72770
72691
  } else {
72771
72692
  const source = (0, import_fs.readFileSync)(fsPath);
72772
- entry = new import_build_utils5.FileBlob({ data: source, mode });
72693
+ entry = new import_build_utils6.FileBlob({ data: source, mode });
72773
72694
  }
72774
72695
  }
72775
- if ((0, import_build_utils5.isSymbolicLink)(entry.mode) && entry.type === "FileFsRef") {
72696
+ if ((0, import_build_utils6.isSymbolicLink)(entry.mode) && entry.type === "FileFsRef") {
72776
72697
  const symlinkTarget = (0, import_path3.relative)(
72777
72698
  baseDir,
72778
72699
  (0, import_path3.resolve)((0, import_path3.dirname)(entry.fsPath), (0, import_fs.readlinkSync)(entry.fsPath))
@@ -72799,7 +72720,7 @@ async function compile2(workPath, baseDir, entrypointPath, config, meta, nodeVer
72799
72720
  for (const path of esmPaths) {
72800
72721
  const pathDir = (0, import_path3.join)(workPath, (0, import_path3.dirname)(path));
72801
72722
  if (!pkgCache.has(pathDir)) {
72802
- const pathToPkg = await (0, import_build_utils5.walkParentDirs)({
72723
+ const pathToPkg = await (0, import_build_utils6.walkParentDirs)({
72803
72724
  base: workPath,
72804
72725
  start: pathDir,
72805
72726
  filename: "package.json"
@@ -72812,7 +72733,7 @@ async function compile2(workPath, baseDir, entrypointPath, config, meta, nodeVer
72812
72733
  continue;
72813
72734
  }
72814
72735
  const filename = (0, import_path3.basename)(path);
72815
- const { data: source } = await import_build_utils5.FileBlob.fromStream({
72736
+ const { data: source } = await import_build_utils6.FileBlob.fromStream({
72816
72737
  stream: preparedFiles[path].toStream()
72817
72738
  });
72818
72739
  if (!meta.compiledToCommonJS) {
@@ -72824,12 +72745,12 @@ async function compile2(workPath, baseDir, entrypointPath, config, meta, nodeVer
72824
72745
  console.log(`Compiling "${filename}" from ESM to CommonJS...`);
72825
72746
  const { code, map } = babelCompile(filename, String(source));
72826
72747
  shouldAddSourcemapSupport = true;
72827
- preparedFiles[path] = new import_build_utils5.FileBlob({
72748
+ preparedFiles[path] = new import_build_utils6.FileBlob({
72828
72749
  data: `${code}
72829
72750
  //# sourceMappingURL=${filename}.map`
72830
72751
  });
72831
72752
  delete map.sourcesContent;
72832
- preparedFiles[path + ".map"] = new import_build_utils5.FileBlob({
72753
+ preparedFiles[path + ".map"] = new import_build_utils6.FileBlob({
72833
72754
  data: JSON.stringify(map)
72834
72755
  });
72835
72756
  }
@@ -72889,7 +72810,7 @@ var build = async ({
72889
72810
  let entrypointPath = _entrypointPath;
72890
72811
  const projectBuildCommand = config.projectSettings?.buildCommand;
72891
72812
  if (projectBuildCommand && considerBuildCommand) {
72892
- await (0, import_build_utils5.execCommand)(projectBuildCommand, {
72813
+ await (0, import_build_utils6.execCommand)(projectBuildCommand, {
72893
72814
  // Yarn v2 PnP mode may be activated, so force
72894
72815
  // "node-modules" linker style
72895
72816
  env: {
@@ -72900,7 +72821,7 @@ var build = async ({
72900
72821
  });
72901
72822
  } else {
72902
72823
  const possibleScripts = considerBuildCommand ? ["vercel-build", "now-build", "build"] : ["vercel-build", "now-build"];
72903
- await (0, import_build_utils5.runPackageJsonScript)(
72824
+ await (0, import_build_utils6.runPackageJsonScript)(
72904
72825
  entrypointFsDirname,
72905
72826
  possibleScripts,
72906
72827
  { env: spawnEnv },
@@ -72940,9 +72861,9 @@ var build = async ({
72940
72861
  }
72941
72862
  checks({
72942
72863
  config,
72943
- isBun: (0, import_build_utils5.isBunVersion)(nodeVersion)
72864
+ isBun: (0, import_build_utils6.isBunVersion)(nodeVersion)
72944
72865
  });
72945
- (0, import_build_utils5.debug)("Tracing input files...");
72866
+ (0, import_build_utils6.debug)("Tracing input files...");
72946
72867
  const traceTime = Date.now();
72947
72868
  const { preparedFiles, shouldAddSourcemapSupport } = await compile2(
72948
72869
  workPath,
@@ -72953,18 +72874,18 @@ var build = async ({
72953
72874
  nodeVersion,
72954
72875
  isEdgeFunction
72955
72876
  );
72956
- (0, import_build_utils5.debug)(`Trace complete [${Date.now() - traceTime}ms]`);
72877
+ (0, import_build_utils6.debug)(`Trace complete [${Date.now() - traceTime}ms]`);
72957
72878
  let routes;
72958
72879
  let output;
72959
72880
  let handler = renameTStoJS((0, import_path3.relative)(baseDir, entrypointPath));
72960
72881
  const outputPath = entrypointToOutputPath(entrypoint, config.zeroConfig);
72961
72882
  if (isMiddleware) {
72962
- const matcher = resolveMiddlewareMatcher(
72883
+ const matcher = (0, import_build_utils5.resolveMiddlewareMatcher)(
72963
72884
  config.middlewareMatcher,
72964
72885
  staticConfig?.matcher,
72965
72886
  entrypoint
72966
72887
  );
72967
- const src = getRegExpFromMatchers(matcher);
72888
+ const src = (0, import_build_utils5.getRegExpFromMatchers)(matcher);
72968
72889
  const middlewareRawSrc = [];
72969
72890
  if (matcher) {
72970
72891
  if (Array.isArray(matcher)) {
@@ -73000,13 +72921,13 @@ var build = async ({
73000
72921
  }
73001
72922
  const filename = `shim${ext}`;
73002
72923
  const shimHandler = handlerDir === "." ? filename : (0, import_path3.join)(handlerDir, filename);
73003
- preparedFiles[shimHandler] = new import_build_utils5.FileBlob({
72924
+ preparedFiles[shimHandler] = new import_build_utils6.FileBlob({
73004
72925
  data: shim(handlerFilename)
73005
72926
  });
73006
72927
  handler = shimHandler;
73007
72928
  }
73008
72929
  if (isEdgeFunction) {
73009
- output = new import_build_utils5.EdgeFunction({
72930
+ output = new import_build_utils6.EdgeFunction({
73010
72931
  entrypoint: handler,
73011
72932
  files: preparedFiles,
73012
72933
  regions: staticConfig?.regions,
@@ -73024,7 +72945,7 @@ var build = async ({
73024
72945
  if (enableBundling) {
73025
72946
  const bundledHandlerName = "___vc_bundled_api_handler.js";
73026
72947
  const entrypointPrefix = (0, import_path3.relative)(baseDir, workPath).split(import_path3.sep).join("/");
73027
- preparedFiles[bundledHandlerName] = new import_build_utils5.FileBlob({
72948
+ preparedFiles[bundledHandlerName] = new import_build_utils6.FileBlob({
73028
72949
  data: (0, import_fs.readFileSync)(
73029
72950
  (0, import_path3.join)((0, import_path3.dirname)(__filename), "bundling-handler.js"),
73030
72951
  "utf8"
@@ -73067,7 +72988,7 @@ var build = async ({
73067
72988
  ];
73068
72989
  }
73069
72990
  }
73070
- output = new import_build_utils5.NodejsLambda({
72991
+ output = new import_build_utils6.NodejsLambda({
73071
72992
  files: preparedFiles,
73072
72993
  handler,
73073
72994
  experimentalAllowBundling: enableBundling || void 0,
@@ -73093,10 +73014,10 @@ var build = async ({
73093
73014
  lockfilePath,
73094
73015
  lockfileVersion,
73095
73016
  framework: config.framework ?? void 0,
73096
- serviceType: service ? (0, import_build_utils5.getReportedServiceType)(service) : void 0
73017
+ serviceType: service ? (0, import_build_utils6.getReportedServiceType)(service) : void 0
73097
73018
  });
73098
73019
  } catch (err) {
73099
- (0, import_build_utils5.debug)(
73020
+ (0, import_build_utils6.debug)(
73100
73021
  `Failed to write node manifest: ${err instanceof Error ? err.message : String(err)}`
73101
73022
  );
73102
73023
  }
@@ -73115,9 +73036,9 @@ function normalizeRequestedRegions(regions) {
73115
73036
  }
73116
73037
 
73117
73038
  // src/prepare-cache.ts
73118
- var import_build_utils6 = require("@vercel/build-utils");
73039
+ var import_build_utils7 = require("@vercel/build-utils");
73119
73040
  var prepareCache = ({ repoRootPath, workPath }) => {
73120
- return (0, import_build_utils6.glob)(import_build_utils6.defaultCachePathGlob, repoRootPath || workPath);
73041
+ return (0, import_build_utils7.glob)(import_build_utils7.defaultCachePathGlob, repoRootPath || workPath);
73121
73042
  };
73122
73043
 
73123
73044
  // src/start-dev-server.ts
@@ -73127,20 +73048,20 @@ var import_path6 = require("path");
73127
73048
  var import_tree_kill = __toESM(require_tree_kill());
73128
73049
  var import_util = require("util");
73129
73050
  var import_stream = require("stream");
73130
- var import_build_utils9 = require("@vercel/build-utils");
73051
+ var import_build_utils10 = require("@vercel/build-utils");
73131
73052
  var import_error_utils2 = require("@vercel/error-utils");
73132
73053
  var import_static_config2 = require("@vercel/static-config");
73133
73054
  var import_ts_morph2 = require("ts-morph");
73134
73055
 
73135
73056
  // src/fork-dev-server.ts
73136
73057
  var import_once2 = __toESM(require_dist2());
73137
- var import_build_utils8 = require("@vercel/build-utils");
73058
+ var import_build_utils9 = require("@vercel/build-utils");
73138
73059
  var import_child_process3 = require("child_process");
73139
73060
  var import_url = require("url");
73140
73061
  var import_path5 = require("path");
73141
73062
 
73142
73063
  // src/bun-helpers.ts
73143
- var import_build_utils7 = require("@vercel/build-utils");
73064
+ var import_build_utils8 = require("@vercel/build-utils");
73144
73065
  var import_child_process2 = require("child_process");
73145
73066
  var import_once = __toESM(require_dist2());
73146
73067
  var import_os2 = require("os");
@@ -73159,22 +73080,22 @@ async function getOrCreateBunBinary() {
73159
73080
  stdio: "ignore"
73160
73081
  });
73161
73082
  if (exitCode === 0) {
73162
- (0, import_build_utils7.debug)("Bun already installed and available in PATH");
73083
+ (0, import_build_utils8.debug)("Bun already installed and available in PATH");
73163
73084
  return bunCommand;
73164
73085
  }
73165
73086
  } catch {
73166
- (0, import_build_utils7.debug)("Bun not found in PATH");
73087
+ (0, import_build_utils8.debug)("Bun not found in PATH");
73167
73088
  }
73168
73089
  try {
73169
73090
  const exitCode = await spawnAsync(installPath, ["--version"], {
73170
73091
  stdio: "ignore"
73171
73092
  });
73172
73093
  if (exitCode === 0) {
73173
- (0, import_build_utils7.debug)("Bun already installed in default location");
73094
+ (0, import_build_utils8.debug)("Bun already installed in default location");
73174
73095
  return installPath;
73175
73096
  }
73176
73097
  } catch {
73177
- (0, import_build_utils7.debug)("Bun not found in default location");
73098
+ (0, import_build_utils8.debug)("Bun not found in default location");
73178
73099
  }
73179
73100
  console.log("Installing Bun...");
73180
73101
  try {
@@ -73203,7 +73124,7 @@ async function getOrCreateBunBinary() {
73203
73124
  stdio: "ignore"
73204
73125
  });
73205
73126
  if (exitCode === 0) {
73206
- (0, import_build_utils7.debug)("Bun was installed successfully");
73127
+ (0, import_build_utils8.debug)("Bun was installed successfully");
73207
73128
  return installPath;
73208
73129
  }
73209
73130
  } catch {
@@ -73221,7 +73142,7 @@ async function forkDevServer(options) {
73221
73142
  const bun = await getOrCreateBunBinary();
73222
73143
  const spawnOptions = {
73223
73144
  cwd: options.workPath,
73224
- env: (0, import_build_utils8.cloneEnv)(process.env, options.meta.env, {
73145
+ env: (0, import_build_utils9.cloneEnv)(process.env, options.meta.env, {
73225
73146
  VERCEL_DEV_ENTRYPOINT: options.entrypoint,
73226
73147
  VERCEL_DEV_CONFIG: JSON.stringify(options.config),
73227
73148
  VERCEL_DEV_BUILD_ENV: JSON.stringify(options.meta.buildEnv || {}),
@@ -73260,7 +73181,7 @@ async function forkDevServer(options) {
73260
73181
  const forkOptions = {
73261
73182
  cwd: options.workPath,
73262
73183
  execArgv: [],
73263
- env: (0, import_build_utils8.cloneEnv)(process.env, options.meta.env, {
73184
+ env: (0, import_build_utils9.cloneEnv)(process.env, options.meta.env, {
73264
73185
  VERCEL_DEV_ENTRYPOINT: options.entrypoint,
73265
73186
  VERCEL_DEV_CONFIG: JSON.stringify(options.config),
73266
73187
  VERCEL_DEV_BUILD_ENV: JSON.stringify(options.meta.buildEnv || {}),
@@ -73341,7 +73262,7 @@ async function syncDependencies(workPath, onStdout, onStderr) {
73341
73262
  }
73342
73263
  });
73343
73264
  try {
73344
- await (0, import_build_utils9.runNpmInstall)(workPath, [], void 0, void 0, void 0, {
73265
+ await (0, import_build_utils10.runNpmInstall)(workPath, [], void 0, void 0, void 0, {
73345
73266
  stdout: bufStdout,
73346
73267
  stderr: bufStderr
73347
73268
  });
@@ -73349,7 +73270,7 @@ async function syncDependencies(workPath, onStdout, onStderr) {
73349
73270
  for (const [channel, chunk] of captured) {
73350
73271
  (channel === "stdout" ? writeOut : writeErr)(chunk.toString());
73351
73272
  }
73352
- throw new import_build_utils9.NowBuildError({
73273
+ throw new import_build_utils10.NowBuildError({
73353
73274
  code: "NODE_DEPENDENCY_SYNC_FAILED",
73354
73275
  message: `Failed to install Node.JS dependencies: ${err instanceof Error ? err.message : String(err)}`
73355
73276
  });
@@ -73391,7 +73312,7 @@ var startDevServer = async (opts) => {
73391
73312
  try {
73392
73313
  const vercelConfig = JSON.parse(vercelConfigContents);
73393
73314
  if (vercelConfig.bunVersion) {
73394
- bunVersion = (0, import_build_utils9.getSupportedBunVersion)(vercelConfig.bunVersion);
73315
+ bunVersion = (0, import_build_utils10.getSupportedBunVersion)(vercelConfig.bunVersion);
73395
73316
  }
73396
73317
  } catch {
73397
73318
  }
@@ -73401,12 +73322,12 @@ var startDevServer = async (opts) => {
73401
73322
  }
73402
73323
  const runtime = bunVersion ? "bun" : "node";
73403
73324
  if (config.middleware === true && typeof meta.requestUrl === "string") {
73404
- const matcher = resolveMiddlewareMatcher(
73325
+ const matcher = (0, import_build_utils5.resolveMiddlewareMatcher)(
73405
73326
  config.middlewareMatcher,
73406
73327
  staticConfig?.matcher,
73407
73328
  entrypoint
73408
73329
  );
73409
- const matchers = new RegExp(getRegExpFromMatchers(matcher));
73330
+ const matchers = new RegExp((0, import_build_utils5.getRegExpFromMatchers)(matcher));
73410
73331
  const parsed = new URL(meta.requestUrl, "http://localhost");
73411
73332
  if (!matchers.test(parsed.pathname)) {
73412
73333
  return null;
@@ -73414,12 +73335,12 @@ var startDevServer = async (opts) => {
73414
73335
  }
73415
73336
  const entryDir = (0, import_path6.dirname)(entrypointPath);
73416
73337
  const ext = (0, import_path6.extname)(entrypoint);
73417
- const pathToTsConfig = await (0, import_build_utils9.walkParentDirs)({
73338
+ const pathToTsConfig = await (0, import_build_utils10.walkParentDirs)({
73418
73339
  base: workPath,
73419
73340
  start: entryDir,
73420
73341
  filename: "tsconfig.json"
73421
73342
  });
73422
- const pathToPkg = await (0, import_build_utils9.walkParentDirs)({
73343
+ const pathToPkg = await (0, import_build_utils10.walkParentDirs)({
73423
73344
  base: workPath,
73424
73345
  start: entryDir,
73425
73346
  filename: "package.json"
@@ -73524,7 +73445,7 @@ var startDevServer = async (opts) => {
73524
73445
  };
73525
73446
 
73526
73447
  // src/index.ts
73527
- var import_build_utils10 = require("@vercel/build-utils");
73448
+ var import_build_utils11 = require("@vercel/build-utils");
73528
73449
  var version = 3;
73529
73450
  // Annotate the CommonJS export names for ESM import in node:
73530
73451
  0 && (module.exports = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/node",
3
- "version": "5.9.8",
3
+ "version": "5.10.0",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index",
6
6
  "homepage": "https://vercel.com/docs/runtimes#official-runtimes/node-js",
@@ -32,9 +32,9 @@
32
32
  "tsx": "4.21.0",
33
33
  "typescript": "npm:typescript@5.9.3",
34
34
  "undici": "5.28.4",
35
- "@vercel/build-utils": "14.0.4",
35
+ "@vercel/static-config": "3.4.1",
36
36
  "@vercel/error-utils": "2.2.1",
37
- "@vercel/static-config": "3.4.1"
37
+ "@vercel/build-utils": "14.1.0"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@babel/core": "7.24.4",
@@ -57,7 +57,7 @@
57
57
  "tree-kill": "1.2.2",
58
58
  "vite": "^6.4.3",
59
59
  "vitest": "^4.1.10",
60
- "@vercel/functions": "3.9.2"
60
+ "@vercel/functions": "3.9.3"
61
61
  },
62
62
  "scripts": {
63
63
  "build": "node build.mjs",