@vercel/build-utils 12.2.0 → 12.2.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,17 @@
1
1
  # @vercel/build-utils
2
2
 
3
+ ## 12.2.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Allow Node.js 24 behind env var feature flag ([#14160](https://github.com/vercel/vercel/pull/14160))
8
+
9
+ ## 12.2.1
10
+
11
+ ### Patch Changes
12
+
13
+ - Add backend util helpers ([#14152](https://github.com/vercel/vercel/pull/14152))
14
+
3
15
  ## 12.2.0
4
16
 
5
17
  ### Minor Changes
@@ -0,0 +1,17 @@
1
+ /**
2
+ * List of backend frameworks supported by the experimental backends feature
3
+ */
4
+ export declare const BACKEND_FRAMEWORKS: readonly ["express", "hono", "h3", "nestjs", "fastify"];
5
+ export type BackendFramework = (typeof BACKEND_FRAMEWORKS)[number];
6
+ /**
7
+ * Checks if the given framework is a backend framework
8
+ */
9
+ export declare function isBackendFramework(framework: string | null | undefined): framework is BackendFramework;
10
+ /**
11
+ * Checks if experimental backends are enabled via environment variable
12
+ */
13
+ export declare function isExperimentalBackendsEnabled(): boolean;
14
+ /**
15
+ * Checks if experimental backends are enabled AND the framework is a backend framework
16
+ */
17
+ export declare function shouldUseExperimentalBackends(framework: string | null | undefined): boolean;
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var framework_helpers_exports = {};
20
+ __export(framework_helpers_exports, {
21
+ BACKEND_FRAMEWORKS: () => BACKEND_FRAMEWORKS,
22
+ isBackendFramework: () => isBackendFramework,
23
+ isExperimentalBackendsEnabled: () => isExperimentalBackendsEnabled,
24
+ shouldUseExperimentalBackends: () => shouldUseExperimentalBackends
25
+ });
26
+ module.exports = __toCommonJS(framework_helpers_exports);
27
+ const BACKEND_FRAMEWORKS = [
28
+ "express",
29
+ "hono",
30
+ "h3",
31
+ "nestjs",
32
+ "fastify"
33
+ ];
34
+ function isBackendFramework(framework) {
35
+ if (!framework)
36
+ return false;
37
+ return BACKEND_FRAMEWORKS.includes(framework);
38
+ }
39
+ function isExperimentalBackendsEnabled() {
40
+ return process.env.VERCEL_EXPERIMENTAL_BACKENDS === "1" || // Previously used for experimental express and hono builds
41
+ process.env.VERCEL_EXPERIMENTAL_EXPRESS_BUILD === "1" || process.env.VERCEL_EXPERIMENTAL_HONO_BUILD === "1";
42
+ }
43
+ function shouldUseExperimentalBackends(framework) {
44
+ return isExperimentalBackendsEnabled() && isBackendFramework(framework);
45
+ }
46
+ // Annotate the CommonJS export names for ESM import in node:
47
+ 0 && (module.exports = {
48
+ BACKEND_FRAMEWORKS,
49
+ isBackendFramework,
50
+ isExperimentalBackendsEnabled,
51
+ shouldUseExperimentalBackends
52
+ });
@@ -100,9 +100,19 @@ const BUN_VERSIONS = [
100
100
  })
101
101
  ];
102
102
  function getNodeVersionByMajor(major) {
103
- return NODE_VERSIONS.find((v) => v.major === major);
103
+ return getOptions().find((v) => v.major === major);
104
104
  }
105
105
  function getOptions() {
106
+ if (process.env.VERCEL_ALLOW_NODEJS_24 === "1") {
107
+ return [
108
+ new import_types.NodeVersion({
109
+ major: 24,
110
+ range: "24.x",
111
+ runtime: "nodejs24.x"
112
+ }),
113
+ ...NODE_VERSIONS
114
+ ];
115
+ }
106
116
  return NODE_VERSIONS;
107
117
  }
108
118
  function isNodeVersionAvailable(version) {
package/dist/index.d.ts CHANGED
@@ -32,3 +32,4 @@ export { NODE_VERSIONS } from './fs/node-version';
32
32
  export { getInstalledPackageVersion } from './get-installed-package-version';
33
33
  export { defaultCachePathGlob } from './default-cache-path-glob';
34
34
  export { generateNodeBuilderFunctions } from './generate-node-builder-functions';
35
+ export { BACKEND_FRAMEWORKS, BackendFramework, isBackendFramework, isExperimentalBackendsEnabled, shouldUseExperimentalBackends, } from './framework-helpers';
package/dist/index.js CHANGED
@@ -21817,6 +21817,7 @@ var require_ignore = __commonJS({
21817
21817
  // src/index.ts
21818
21818
  var src_exports = {};
21819
21819
  __export(src_exports, {
21820
+ BACKEND_FRAMEWORKS: () => BACKEND_FRAMEWORKS,
21820
21821
  BUILDER_COMPILE_STEP: () => BUILDER_COMPILE_STEP,
21821
21822
  BUILDER_INSTALLER_STEP: () => BUILDER_INSTALLER_STEP,
21822
21823
  BunVersion: () => BunVersion,
@@ -21866,8 +21867,10 @@ __export(src_exports, {
21866
21867
  glob: () => glob,
21867
21868
  hardLinkDir: () => hardLinkDir,
21868
21869
  installDependencies: () => installDependencies,
21870
+ isBackendFramework: () => isBackendFramework,
21869
21871
  isBunVersion: () => isBunVersion,
21870
21872
  isDirectory: () => isDirectory,
21873
+ isExperimentalBackendsEnabled: () => isExperimentalBackendsEnabled,
21871
21874
  isSymbolicLink: () => isSymbolicLink,
21872
21875
  normalizePath: () => normalizePath,
21873
21876
  readConfigFile: () => readConfigFile,
@@ -21880,6 +21883,7 @@ __export(src_exports, {
21880
21883
  runShellScript: () => runShellScript,
21881
21884
  scanParentDirs: () => scanParentDirs,
21882
21885
  shouldServe: () => shouldServe,
21886
+ shouldUseExperimentalBackends: () => shouldUseExperimentalBackends,
21883
21887
  spawnAsync: () => spawnAsync,
21884
21888
  spawnCommand: () => spawnCommand,
21885
21889
  streamToBuffer: () => streamToBuffer,
@@ -23011,6 +23015,16 @@ var BUN_VERSIONS = [
23011
23015
  })
23012
23016
  ];
23013
23017
  function getOptions() {
23018
+ if (process.env.VERCEL_ALLOW_NODEJS_24 === "1") {
23019
+ return [
23020
+ new NodeVersion({
23021
+ major: 24,
23022
+ range: "24.x",
23023
+ runtime: "nodejs24.x"
23024
+ }),
23025
+ ...NODE_VERSIONS
23026
+ ];
23027
+ }
23014
23028
  return NODE_VERSIONS;
23015
23029
  }
23016
23030
  function isNodeVersionAvailable(version) {
@@ -24761,8 +24775,30 @@ ${entrypointsForMessage}`
24761
24775
  entrypointCallback
24762
24776
  };
24763
24777
  }
24778
+
24779
+ // src/framework-helpers.ts
24780
+ var BACKEND_FRAMEWORKS = [
24781
+ "express",
24782
+ "hono",
24783
+ "h3",
24784
+ "nestjs",
24785
+ "fastify"
24786
+ ];
24787
+ function isBackendFramework(framework) {
24788
+ if (!framework)
24789
+ return false;
24790
+ return BACKEND_FRAMEWORKS.includes(framework);
24791
+ }
24792
+ function isExperimentalBackendsEnabled() {
24793
+ return process.env.VERCEL_EXPERIMENTAL_BACKENDS === "1" || // Previously used for experimental express and hono builds
24794
+ process.env.VERCEL_EXPERIMENTAL_EXPRESS_BUILD === "1" || process.env.VERCEL_EXPERIMENTAL_HONO_BUILD === "1";
24795
+ }
24796
+ function shouldUseExperimentalBackends(framework) {
24797
+ return isExperimentalBackendsEnabled() && isBackendFramework(framework);
24798
+ }
24764
24799
  // Annotate the CommonJS export names for ESM import in node:
24765
24800
  0 && (module.exports = {
24801
+ BACKEND_FRAMEWORKS,
24766
24802
  BUILDER_COMPILE_STEP,
24767
24803
  BUILDER_INSTALLER_STEP,
24768
24804
  BunVersion,
@@ -24812,8 +24848,10 @@ ${entrypointsForMessage}`
24812
24848
  glob,
24813
24849
  hardLinkDir,
24814
24850
  installDependencies,
24851
+ isBackendFramework,
24815
24852
  isBunVersion,
24816
24853
  isDirectory,
24854
+ isExperimentalBackendsEnabled,
24817
24855
  isSymbolicLink,
24818
24856
  normalizePath,
24819
24857
  readConfigFile,
@@ -24826,6 +24864,7 @@ ${entrypointsForMessage}`
24826
24864
  runShellScript,
24827
24865
  scanParentDirs,
24828
24866
  shouldServe,
24867
+ shouldUseExperimentalBackends,
24829
24868
  spawnAsync,
24830
24869
  spawnCommand,
24831
24870
  streamToBuffer,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/build-utils",
3
- "version": "12.2.0",
3
+ "version": "12.2.2",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.js",
@@ -27,7 +27,7 @@
27
27
  "@types/semver": "6.0.0",
28
28
  "@types/yazl": "2.4.2",
29
29
  "@vercel/error-utils": "2.0.3",
30
- "@vercel/routing-utils": "5.2.0",
30
+ "@vercel/routing-utils": "5.2.1",
31
31
  "aggregate-error": "3.0.1",
32
32
  "async-retry": "1.2.3",
33
33
  "async-sema": "2.1.4",