@vercel/node 24.0.2 → 25.0.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.
Files changed (2) hide show
  1. package/dist/index.js +79 -3
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -71870,6 +71870,7 @@ __export(src_exports, {
71870
71870
  _resetBundlingRoutesEmitted: () => _resetBundlingRoutesEmitted,
71871
71871
  build: () => build,
71872
71872
  diagnostics: () => diagnostics,
71873
+ getDevWarnings: () => getDevWarnings,
71873
71874
  prepareCache: () => prepareCache,
71874
71875
  shouldServe: () => import_build_utils10.shouldServe,
71875
71876
  startDevServer: () => startDevServer,
@@ -72486,7 +72487,7 @@ function validateMiddlewareRuntime(runtime, entrypoint, requiredRuntime) {
72486
72487
  }
72487
72488
  var MIDDLEWARE_NODEJS_DEFAULT_ENV = "VERCEL_MIDDLEWARE_DEFAULT_RUNTIME_NODEJS";
72488
72489
  var MIDDLEWARE_NODEJS_DEFAULT_SINCE = /* @__PURE__ */ new Date("2026-09-01T00:00:00Z");
72489
- var edgeMiddlewareDeprecationWarning = (entrypoint) => `Warning: ${entrypoint} uses the deprecated "edge" runtime. Migrate to the Node.js runtime for better performance and reliability by exporting \`const config = { runtime: 'nodejs' }\`. Learn more: https://vercel.com/docs/routing-middleware#runtime-options`;
72490
+ var edgeMiddlewareDeprecationWarning = (entrypoint) => `${entrypoint} uses the deprecated "edge" runtime. Migrate to the Node.js runtime for better performance and reliability by exporting \`const config = { runtime: 'nodejs' }\`. Learn more: https://vercel.com/docs/routing-middleware#runtime-options`;
72490
72491
  function resolveMiddlewareRuntime({
72491
72492
  configuredRuntime,
72492
72493
  middlewareRuntime,
@@ -72548,8 +72549,18 @@ async function downloadInstallAndBundle({
72548
72549
  turboSupportsCorepackHome,
72549
72550
  projectCreatedAt: config.projectSettings?.createdAt
72550
72551
  });
72552
+ const functionInstallCommand = (0, import_build_utils6.findMatchingFunction)(config.functions, [
72553
+ entrypoint
72554
+ ])?.functionConfig?.installCommand;
72551
72555
  const installCommand = config.projectSettings?.installCommand;
72552
- if (typeof installCommand === "string" && considerBuildCommand) {
72556
+ if (typeof functionInstallCommand === "string") {
72557
+ await runFunctionInstallCommand({
72558
+ installCommand: functionInstallCommand,
72559
+ workPath,
72560
+ spawnEnv,
72561
+ meta
72562
+ });
72563
+ } else if (typeof installCommand === "string" && considerBuildCommand) {
72553
72564
  if (installCommand.trim()) {
72554
72565
  console.log(`Running "install" command: \`${installCommand}\`...`);
72555
72566
  await (0, import_build_utils6.execCommand)(installCommand, {
@@ -72584,6 +72595,41 @@ async function downloadInstallAndBundle({
72584
72595
  lockfileVersion
72585
72596
  };
72586
72597
  }
72598
+ var pendingFunctionInstalls = /* @__PURE__ */ new WeakMap();
72599
+ async function runFunctionInstallCommand({
72600
+ installCommand,
72601
+ workPath,
72602
+ spawnEnv,
72603
+ meta
72604
+ }) {
72605
+ if (!installCommand.trim()) {
72606
+ console.log(`Skipping "install" command...`);
72607
+ return;
72608
+ }
72609
+ if (meta.isDev) {
72610
+ (0, import_build_utils6.debug)("Skipping dependency installation because dev mode is enabled");
72611
+ return;
72612
+ }
72613
+ const ran = meta.functionInstallCommandSet instanceof Set ? meta.functionInstallCommandSet : /* @__PURE__ */ new Set();
72614
+ meta.functionInstallCommandSet = ran;
72615
+ const key = `${workPath}\0${installCommand}`;
72616
+ if (ran.has(key)) {
72617
+ return;
72618
+ }
72619
+ const pending = pendingFunctionInstalls.get(ran) ?? /* @__PURE__ */ new Map();
72620
+ pendingFunctionInstalls.set(ran, pending);
72621
+ let install = pending.get(key);
72622
+ if (!install) {
72623
+ console.log(`Running "install" command: \`${installCommand}\`...`);
72624
+ install = (0, import_build_utils6.execCommand)(installCommand, { env: spawnEnv, cwd: workPath }).then(() => {
72625
+ ran.add(key);
72626
+ }).finally(() => {
72627
+ pending.delete(key);
72628
+ });
72629
+ pending.set(key, install);
72630
+ }
72631
+ await install;
72632
+ }
72587
72633
  function renameTStoJS(path) {
72588
72634
  if (path.endsWith(".ts")) {
72589
72635
  return path.slice(0, -3) + ".js";
@@ -72902,7 +72948,9 @@ var build = async ({
72902
72948
  `Middleware runtime for "${entrypoint}": ${middleware.runtime} (${middleware.reason})`
72903
72949
  );
72904
72950
  if (isEdgeFunction) {
72905
- console.warn(edgeMiddlewareDeprecationWarning(entrypoint));
72951
+ console.warn(
72952
+ `\x1B[33m\x1B[1mWARNING! \x1B[22m${edgeMiddlewareDeprecationWarning(entrypoint)}\x1B[39m`
72953
+ );
72906
72954
  }
72907
72955
  } else if (runtime) {
72908
72956
  isEdgeFunction = isEdgeRuntime(runtime);
@@ -73419,6 +73467,33 @@ var startDevServer = async (opts) => {
73419
73467
  }
73420
73468
  };
73421
73469
 
73470
+ // src/get-dev-warnings.ts
73471
+ var import_static_config3 = require("@vercel/static-config");
73472
+ var import_path6 = require("path");
73473
+ var getDevWarnings = async ({
73474
+ entrypoint,
73475
+ workPath,
73476
+ config,
73477
+ meta = {}
73478
+ }) => {
73479
+ if (config.middleware !== true)
73480
+ return [];
73481
+ const staticConfig = (0, import_static_config3.getConfig)(null, (0, import_path6.join)(workPath, entrypoint));
73482
+ validateMiddlewareRuntime(
73483
+ staticConfig?.runtime,
73484
+ entrypoint,
73485
+ config.middlewareRuntime
73486
+ );
73487
+ const { runtime } = resolveMiddlewareRuntime({
73488
+ configuredRuntime: staticConfig?.runtime,
73489
+ middlewareRuntime: config.middlewareRuntime,
73490
+ projectCreatedAt: config.projectSettings?.createdAt,
73491
+ isDev: true,
73492
+ env: { ...process.env, ...meta.env, ...meta.buildEnv }
73493
+ });
73494
+ return runtime === "edge" ? [edgeMiddlewareDeprecationWarning(entrypoint)] : [];
73495
+ };
73496
+
73422
73497
  // src/index.ts
73423
73498
  var import_build_utils10 = require("@vercel/build-utils");
73424
73499
  var version = 3;
@@ -73427,6 +73502,7 @@ var version = 3;
73427
73502
  _resetBundlingRoutesEmitted,
73428
73503
  build,
73429
73504
  diagnostics,
73505
+ getDevWarnings,
73430
73506
  prepareCache,
73431
73507
  shouldServe,
73432
73508
  startDevServer,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/node",
3
- "version": "24.0.2",
3
+ "version": "25.0.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,11 +32,11 @@
32
32
  "tsx": "4.21.0",
33
33
  "typescript": "npm:typescript@5.9.3",
34
34
  "undici": "5.28.4",
35
- "@vercel/static-config": "3.4.4",
36
- "@vercel/error-utils": "2.2.1"
35
+ "@vercel/error-utils": "2.2.1",
36
+ "@vercel/static-config": "3.4.4"
37
37
  },
38
38
  "peerDependencies": {
39
- "@vercel/build-utils": "14.21.2"
39
+ "@vercel/build-utils": "14.22.0"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@babel/core": "7.24.4",
@@ -59,7 +59,7 @@
59
59
  "tree-kill": "1.2.2",
60
60
  "vite": "^6.4.3",
61
61
  "vitest": "^4.1.10",
62
- "@vercel/build-utils": "14.21.2",
62
+ "@vercel/build-utils": "14.22.0",
63
63
  "@vercel/functions": "3.10.1"
64
64
  },
65
65
  "scripts": {