@vercel/build-utils 14.21.1 → 14.21.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @vercel/build-utils
2
2
 
3
+ ## 14.21.2
4
+
5
+ ### Patch Changes
6
+
7
+ - cd68435: Add opt-in support for Node.js 26.
8
+
3
9
  ## 14.21.1
4
10
 
5
11
  ### Patch Changes
@@ -1,5 +1,5 @@
1
1
  import type { BuildResultV2Typical, BuildResultV3, BuilderFunctions, Config } from '../types';
2
- export declare const SUPPORTED_AL2023_RUNTIMES: readonly ["nodejs20.x", "nodejs22.x", "nodejs24.x", "provided.al2023", "python3.12", "python3.13", "python3.14", "ruby3.3", "bun1.4.x", "bun1.x", "executable"];
2
+ export declare const SUPPORTED_AL2023_RUNTIMES: readonly ["nodejs20.x", "nodejs22.x", "nodejs24.x", "nodejs26.x", "provided.al2023", "python3.12", "python3.13", "python3.14", "ruby3.3", "bun1.4.x", "bun1.x", "executable"];
3
3
  type BuildConfigWithVercelConfig = Config & {
4
4
  vercelConfig?: {
5
5
  functions?: BuilderFunctions;
@@ -38,6 +38,7 @@ const SUPPORTED_AL2023_RUNTIMES = [
38
38
  "nodejs20.x",
39
39
  "nodejs22.x",
40
40
  "nodejs24.x",
41
+ "nodejs26.x",
41
42
  "provided.al2023",
42
43
  "python3.12",
43
44
  "python3.13",
@@ -7,7 +7,7 @@ declare function getOptions(): NodeVersion[];
7
7
  export declare function getAvailableNodeVersions(): NodeVersionMajor[];
8
8
  export declare function getLatestNodeVersion(availableVersions?: NodeVersionMajor[]): NodeVersion;
9
9
  export declare function getDiscontinuedNodeVersions(): NodeVersion[];
10
- export declare function getSupportedNodeVersion(engineRange: string | undefined, isAuto?: boolean, availableVersions?: NodeVersionMajor[]): Promise<NodeVersion>;
10
+ export declare function getSupportedNodeVersion(engineRange: string | undefined, isAuto?: boolean, availableVersions?: NodeVersionMajor[], configuredNodeVersion?: string): Promise<NodeVersion>;
11
11
  export declare function getSupportedBunVersion(engineRange: string): BunVersion;
12
12
  export declare function isBunVersion(version: Version): boolean;
13
13
  export {};
@@ -45,6 +45,11 @@ var import_types = require("../types");
45
45
  var import_errors = require("../errors");
46
46
  var import_debug = __toESM(require("../debug"));
47
47
  const NODE_VERSIONS = [
48
+ new import_types.NodeVersion({
49
+ major: 26,
50
+ range: "26.x",
51
+ runtime: "nodejs26.x"
52
+ }),
48
53
  new import_types.NodeVersion({
49
54
  major: 24,
50
55
  range: "24.x",
@@ -115,15 +120,19 @@ function getNodeVersionByMajor(major) {
115
120
  return getOptions().find((v) => v.major === major);
116
121
  }
117
122
  function getOptions() {
123
+ let versions = NODE_VERSIONS;
124
+ if (process.env.VERCEL_ALLOW_NODEJS_26 !== "1") {
125
+ versions = versions.filter((version) => version.major !== 26);
126
+ }
118
127
  if (process.env.VERCEL_ALLOW_DISCONTINUED_NODEJS20 === "1") {
119
- return NODE_VERSIONS.map(
128
+ versions = versions.map(
120
129
  (version) => version.major === 20 ? new import_types.NodeVersion({
121
130
  ...version,
122
131
  discontinueDate: /* @__PURE__ */ new Date("2026-11-01")
123
132
  }) : version
124
133
  );
125
134
  }
126
- return NODE_VERSIONS;
135
+ return versions;
127
136
  }
128
137
  function isNodeVersionAvailable(version) {
129
138
  const stat = (0, import_fs.statSync)(`/node${version.major}`, { throwIfNoEntry: false });
@@ -137,7 +146,9 @@ function getHint(isAuto = false, availableVersions) {
137
146
  return isAuto ? `Please set Node.js Version to ${range} in your Project Settings to use Node.js ${major}.` : `Please set "engines": { "node": "${range}" } in your \`package.json\` file to use Node.js ${major}.`;
138
147
  }
139
148
  function getLatestNodeVersion(availableVersions) {
140
- const all = getOptions();
149
+ const all = getOptions().filter(
150
+ (version) => version.major !== 26 || process.env.VERCEL_DEFAULT_NODE_26 === "1"
151
+ );
141
152
  if (availableVersions) {
142
153
  for (const version of all) {
143
154
  for (const major of availableVersions) {
@@ -154,12 +165,13 @@ function getDiscontinuedNodeVersions() {
154
165
  return version.state === "discontinued";
155
166
  });
156
167
  }
157
- async function getSupportedNodeVersion(engineRange, isAuto = false, availableVersions) {
168
+ async function getSupportedNodeVersion(engineRange, isAuto = false, availableVersions, configuredNodeVersion) {
158
169
  let selection;
159
170
  if (engineRange) {
160
171
  const found = (0, import_semver.validRange)(engineRange) && getOptions().some((o) => {
161
172
  selection = o;
162
- return (0, import_semver.intersects)(o.range, engineRange) && (availableVersions?.length ? availableVersions.includes(o.major) : true);
173
+ const canSelectNode26 = o.major !== 26 || process.env.VERCEL_DEFAULT_NODE_26 === "1" || configuredNodeVersion === "26.x" || !(0, import_semver.intersects)(engineRange, "<26.0.0");
174
+ return canSelectNode26 && (0, import_semver.intersects)(o.range, engineRange) && (availableVersions?.length ? availableVersions.includes(o.major) : true);
163
175
  });
164
176
  if (!found) {
165
177
  throw new import_errors.NowBuildError({
@@ -254,7 +254,8 @@ async function getNodeVersion(destPath, fallbackVersion = process.env.VERCEL_PRO
254
254
  const supportedNodeVersion = await (0, import_node_version.getSupportedNodeVersion)(
255
255
  packageJsonNodeVersion || configuredNodeVersion,
256
256
  !packageJsonNodeVersion,
257
- availableVersions
257
+ availableVersions,
258
+ configuredNodeVersion
258
259
  );
259
260
  if (packageJson?.engines?.node) {
260
261
  const { node } = packageJson.engines;