@vercel/build-utils 7.2.4 → 7.3.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @vercel/build-utils
2
2
 
3
+ ## 7.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [cli] add `--deprecated` option to `vc project ls` command ([#10919](https://github.com/vercel/vercel/pull/10919))
8
+
9
+ ## 7.2.5
10
+
11
+ ### Patch Changes
12
+
13
+ - Remove Node.js v20 env var check ([#10834](https://github.com/vercel/vercel/pull/10834))
14
+
3
15
  ## 7.2.4
4
16
 
5
17
  ### Patch Changes
@@ -1,103 +1,9 @@
1
1
  import { NodeVersion } from '../types';
2
2
  export type NodeVersionMajor = ReturnType<typeof getOptions>[number]['major'];
3
- declare function getOptions(): readonly [{
4
- readonly major: 18;
5
- readonly range: "18.x";
6
- readonly runtime: "nodejs18.x";
7
- }, {
8
- readonly major: 16;
9
- readonly range: "16.x";
10
- readonly runtime: "nodejs16.x";
11
- readonly discontinueDate: Date;
12
- }, {
13
- readonly major: 14;
14
- readonly range: "14.x";
15
- readonly runtime: "nodejs14.x";
16
- readonly discontinueDate: Date;
17
- }, {
18
- readonly major: 12;
19
- readonly range: "12.x";
20
- readonly runtime: "nodejs12.x";
21
- readonly discontinueDate: Date;
22
- }, {
23
- readonly major: 10;
24
- readonly range: "10.x";
25
- readonly runtime: "nodejs10.x";
26
- readonly discontinueDate: Date;
27
- }, {
28
- readonly major: 8;
29
- readonly range: "8.10.x";
30
- readonly runtime: "nodejs8.10";
31
- readonly discontinueDate: Date;
32
- }] | readonly [{
33
- readonly major: 20;
34
- readonly range: "20.x";
35
- readonly runtime: "nodejs20.x";
36
- }, {
37
- readonly major: 18;
38
- readonly range: "18.x";
39
- readonly runtime: "nodejs18.x";
40
- }, {
41
- readonly major: 16;
42
- readonly range: "16.x";
43
- readonly runtime: "nodejs16.x";
44
- readonly discontinueDate: Date;
45
- }, {
46
- readonly major: 14;
47
- readonly range: "14.x";
48
- readonly runtime: "nodejs14.x";
49
- readonly discontinueDate: Date;
50
- }, {
51
- readonly major: 12;
52
- readonly range: "12.x";
53
- readonly runtime: "nodejs12.x";
54
- readonly discontinueDate: Date;
55
- }, {
56
- readonly major: 10;
57
- readonly range: "10.x";
58
- readonly runtime: "nodejs10.x";
59
- readonly discontinueDate: Date;
60
- }, {
61
- readonly major: 8;
62
- readonly range: "8.10.x";
63
- readonly runtime: "nodejs8.10";
64
- readonly discontinueDate: Date;
65
- }];
3
+ export declare const NODE_VERSIONS: NodeVersion[];
4
+ declare function getOptions(): NodeVersion[];
66
5
  export declare function getAvailableNodeVersions(): NodeVersionMajor[];
67
- export declare function getLatestNodeVersion(availableVersions?: NodeVersionMajor[]): {
68
- readonly major: 18;
69
- readonly range: "18.x";
70
- readonly runtime: "nodejs18.x";
71
- } | {
72
- readonly major: 16;
73
- readonly range: "16.x";
74
- readonly runtime: "nodejs16.x";
75
- readonly discontinueDate: Date;
76
- } | {
77
- readonly major: 14;
78
- readonly range: "14.x";
79
- readonly runtime: "nodejs14.x";
80
- readonly discontinueDate: Date;
81
- } | {
82
- readonly major: 12;
83
- readonly range: "12.x";
84
- readonly runtime: "nodejs12.x";
85
- readonly discontinueDate: Date;
86
- } | {
87
- readonly major: 10;
88
- readonly range: "10.x";
89
- readonly runtime: "nodejs10.x";
90
- readonly discontinueDate: Date;
91
- } | {
92
- readonly major: 8;
93
- readonly range: "8.10.x";
94
- readonly runtime: "nodejs8.10";
95
- readonly discontinueDate: Date;
96
- } | {
97
- readonly major: 20;
98
- readonly range: "20.x";
99
- readonly runtime: "nodejs20.x";
100
- };
6
+ export declare function getLatestNodeVersion(availableVersions?: NodeVersionMajor[]): NodeVersion;
101
7
  export declare function getDiscontinuedNodeVersions(): NodeVersion[];
102
8
  export declare function getSupportedNodeVersion(engineRange: string | undefined, isAuto?: boolean, availableVersions?: NodeVersionMajor[]): Promise<NodeVersion>;
103
9
  export {};
@@ -28,6 +28,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
  var node_version_exports = {};
30
30
  __export(node_version_exports, {
31
+ NODE_VERSIONS: () => NODE_VERSIONS,
31
32
  getAvailableNodeVersions: () => getAvailableNodeVersions,
32
33
  getDiscontinuedNodeVersions: () => getDiscontinuedNodeVersions,
33
34
  getLatestNodeVersion: () => getLatestNodeVersion,
@@ -38,47 +39,42 @@ var import_fs = require("fs");
38
39
  var import_semver = require("semver");
39
40
  var import_errors = require("../errors");
40
41
  var import_debug = __toESM(require("../debug"));
41
- function getOptions() {
42
- const options = [
43
- { major: 18, range: "18.x", runtime: "nodejs18.x" },
44
- {
45
- major: 16,
46
- range: "16.x",
47
- runtime: "nodejs16.x",
48
- discontinueDate: /* @__PURE__ */ new Date("2024-02-06")
49
- },
50
- {
51
- major: 14,
52
- range: "14.x",
53
- runtime: "nodejs14.x",
54
- discontinueDate: /* @__PURE__ */ new Date("2023-08-15")
55
- },
56
- {
57
- major: 12,
58
- range: "12.x",
59
- runtime: "nodejs12.x",
60
- discontinueDate: /* @__PURE__ */ new Date("2022-10-03")
61
- },
62
- {
63
- major: 10,
64
- range: "10.x",
65
- runtime: "nodejs10.x",
66
- discontinueDate: /* @__PURE__ */ new Date("2021-04-20")
67
- },
68
- {
69
- major: 8,
70
- range: "8.10.x",
71
- runtime: "nodejs8.10",
72
- discontinueDate: /* @__PURE__ */ new Date("2020-01-06")
73
- }
74
- ];
75
- if (process.env.VERCEL_ALLOW_NODEJS20 === "1") {
76
- return [
77
- { major: 20, range: "20.x", runtime: "nodejs20.x" },
78
- ...options
79
- ];
42
+ const NODE_VERSIONS = [
43
+ { major: 20, range: "20.x", runtime: "nodejs20.x" },
44
+ { major: 18, range: "18.x", runtime: "nodejs18.x" },
45
+ {
46
+ major: 16,
47
+ range: "16.x",
48
+ runtime: "nodejs16.x",
49
+ discontinueDate: /* @__PURE__ */ new Date("2024-02-06")
50
+ },
51
+ {
52
+ major: 14,
53
+ range: "14.x",
54
+ runtime: "nodejs14.x",
55
+ discontinueDate: /* @__PURE__ */ new Date("2023-08-15")
56
+ },
57
+ {
58
+ major: 12,
59
+ range: "12.x",
60
+ runtime: "nodejs12.x",
61
+ discontinueDate: /* @__PURE__ */ new Date("2022-10-03")
62
+ },
63
+ {
64
+ major: 10,
65
+ range: "10.x",
66
+ runtime: "nodejs10.x",
67
+ discontinueDate: /* @__PURE__ */ new Date("2021-04-20")
68
+ },
69
+ {
70
+ major: 8,
71
+ range: "8.10.x",
72
+ runtime: "nodejs8.10",
73
+ discontinueDate: /* @__PURE__ */ new Date("2020-01-06")
80
74
  }
81
- return options;
75
+ ];
76
+ function getOptions() {
77
+ return NODE_VERSIONS;
82
78
  }
83
79
  function isNodeVersionAvailable(version) {
84
80
  try {
@@ -90,8 +86,8 @@ function isNodeVersionAvailable(version) {
90
86
  function getAvailableNodeVersions() {
91
87
  return getOptions().filter(isNodeVersionAvailable).map((n) => n.major);
92
88
  }
93
- function getHint(isAuto = false) {
94
- const { major, range } = getLatestNodeVersion();
89
+ function getHint(isAuto = false, availableVersions) {
90
+ const { major, range } = getLatestNodeVersion(availableVersions);
95
91
  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}.`;
96
92
  }
97
93
  function getLatestNodeVersion(availableVersions) {
@@ -122,7 +118,8 @@ async function getSupportedNodeVersion(engineRange, isAuto = false, availableVer
122
118
  code: "BUILD_UTILS_NODE_VERSION_INVALID",
123
119
  link: "http://vercel.link/node-version",
124
120
  message: `Found invalid Node.js Version: "${engineRange}". ${getHint(
125
- isAuto
121
+ isAuto,
122
+ availableVersions
126
123
  )}`
127
124
  });
128
125
  }
@@ -155,6 +152,7 @@ function isDiscontinued({ discontinueDate }) {
155
152
  }
156
153
  // Annotate the CommonJS export names for ESM import in node:
157
154
  0 && (module.exports = {
155
+ NODE_VERSIONS,
158
156
  getAvailableNodeVersions,
159
157
  getDiscontinuedNodeVersions,
160
158
  getLatestNodeVersion,
@@ -74,7 +74,7 @@ export declare function getNodeBinPath({ cwd, }: {
74
74
  export declare function getNodeBinPaths({ start, base, }: TraverseUpDirectoriesProps): string[];
75
75
  export declare function runShellScript(fsPath: string, args?: string[], spawnOpts?: SpawnOptions): Promise<boolean>;
76
76
  export declare function getSpawnOptions(meta: Meta, nodeVersion: NodeVersion): SpawnOptions;
77
- export declare function getNodeVersion(destPath: string, nodeVersionFallback?: string | undefined, config?: Config, meta?: Meta, availableVersions?: (20 | 10 | 16 | 18 | 14 | 12 | 8)[]): Promise<NodeVersion>;
77
+ export declare function getNodeVersion(destPath: string, nodeVersionFallback?: string | undefined, config?: Config, meta?: Meta, availableVersions?: number[]): Promise<NodeVersion>;
78
78
  export declare function scanParentDirs(destPath: string, readPackageJson?: boolean): Promise<ScanParentDirsResult>;
79
79
  export declare function walkParentDirs({ base, start, filename, }: WalkParentDirsProps): Promise<string | null>;
80
80
  export declare function runNpmInstall(destPath: string, args?: string[], spawnOpts?: SpawnOptions, meta?: Meta, nodeVersion?: NodeVersion): Promise<boolean>;
package/dist/index.d.ts CHANGED
@@ -26,3 +26,4 @@ export * from './should-serve';
26
26
  export * from './schemas';
27
27
  export * from './types';
28
28
  export * from './errors';
29
+ export { NODE_VERSIONS } from './fs/node-version';
package/dist/index.js CHANGED
@@ -20714,6 +20714,7 @@ __export(src_exports, {
20714
20714
  FileFsRef: () => file_fs_ref_default,
20715
20715
  FileRef: () => FileRef,
20716
20716
  Lambda: () => Lambda,
20717
+ NODE_VERSIONS: () => NODE_VERSIONS,
20717
20718
  NodejsLambda: () => NodejsLambda,
20718
20719
  NowBuildError: () => NowBuildError,
20719
20720
  Prerender: () => Prerender,
@@ -21591,47 +21592,42 @@ var import_util2 = require("util");
21591
21592
  // src/fs/node-version.ts
21592
21593
  var import_fs = require("fs");
21593
21594
  var import_semver = __toESM(require_semver2());
21594
- function getOptions() {
21595
- const options = [
21596
- { major: 18, range: "18.x", runtime: "nodejs18.x" },
21597
- {
21598
- major: 16,
21599
- range: "16.x",
21600
- runtime: "nodejs16.x",
21601
- discontinueDate: /* @__PURE__ */ new Date("2024-02-06")
21602
- },
21603
- {
21604
- major: 14,
21605
- range: "14.x",
21606
- runtime: "nodejs14.x",
21607
- discontinueDate: /* @__PURE__ */ new Date("2023-08-15")
21608
- },
21609
- {
21610
- major: 12,
21611
- range: "12.x",
21612
- runtime: "nodejs12.x",
21613
- discontinueDate: /* @__PURE__ */ new Date("2022-10-03")
21614
- },
21615
- {
21616
- major: 10,
21617
- range: "10.x",
21618
- runtime: "nodejs10.x",
21619
- discontinueDate: /* @__PURE__ */ new Date("2021-04-20")
21620
- },
21621
- {
21622
- major: 8,
21623
- range: "8.10.x",
21624
- runtime: "nodejs8.10",
21625
- discontinueDate: /* @__PURE__ */ new Date("2020-01-06")
21626
- }
21627
- ];
21628
- if (process.env.VERCEL_ALLOW_NODEJS20 === "1") {
21629
- return [
21630
- { major: 20, range: "20.x", runtime: "nodejs20.x" },
21631
- ...options
21632
- ];
21595
+ var NODE_VERSIONS = [
21596
+ { major: 20, range: "20.x", runtime: "nodejs20.x" },
21597
+ { major: 18, range: "18.x", runtime: "nodejs18.x" },
21598
+ {
21599
+ major: 16,
21600
+ range: "16.x",
21601
+ runtime: "nodejs16.x",
21602
+ discontinueDate: /* @__PURE__ */ new Date("2024-02-06")
21603
+ },
21604
+ {
21605
+ major: 14,
21606
+ range: "14.x",
21607
+ runtime: "nodejs14.x",
21608
+ discontinueDate: /* @__PURE__ */ new Date("2023-08-15")
21609
+ },
21610
+ {
21611
+ major: 12,
21612
+ range: "12.x",
21613
+ runtime: "nodejs12.x",
21614
+ discontinueDate: /* @__PURE__ */ new Date("2022-10-03")
21615
+ },
21616
+ {
21617
+ major: 10,
21618
+ range: "10.x",
21619
+ runtime: "nodejs10.x",
21620
+ discontinueDate: /* @__PURE__ */ new Date("2021-04-20")
21621
+ },
21622
+ {
21623
+ major: 8,
21624
+ range: "8.10.x",
21625
+ runtime: "nodejs8.10",
21626
+ discontinueDate: /* @__PURE__ */ new Date("2020-01-06")
21633
21627
  }
21634
- return options;
21628
+ ];
21629
+ function getOptions() {
21630
+ return NODE_VERSIONS;
21635
21631
  }
21636
21632
  function isNodeVersionAvailable(version) {
21637
21633
  try {
@@ -21643,8 +21639,8 @@ function isNodeVersionAvailable(version) {
21643
21639
  function getAvailableNodeVersions() {
21644
21640
  return getOptions().filter(isNodeVersionAvailable).map((n) => n.major);
21645
21641
  }
21646
- function getHint(isAuto = false) {
21647
- const { major, range } = getLatestNodeVersion();
21642
+ function getHint(isAuto = false, availableVersions) {
21643
+ const { major, range } = getLatestNodeVersion(availableVersions);
21648
21644
  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}.`;
21649
21645
  }
21650
21646
  function getLatestNodeVersion(availableVersions) {
@@ -21675,7 +21671,8 @@ async function getSupportedNodeVersion(engineRange, isAuto = false, availableVer
21675
21671
  code: "BUILD_UTILS_NODE_VERSION_INVALID",
21676
21672
  link: "http://vercel.link/node-version",
21677
21673
  message: `Found invalid Node.js Version: "${engineRange}". ${getHint(
21678
- isAuto
21674
+ isAuto,
21675
+ availableVersions
21679
21676
  )}`
21680
21677
  });
21681
21678
  }
@@ -22488,6 +22485,7 @@ var buildsSchema = {
22488
22485
  FileFsRef,
22489
22486
  FileRef,
22490
22487
  Lambda,
22488
+ NODE_VERSIONS,
22491
22489
  NodejsLambda,
22492
22490
  NowBuildError,
22493
22491
  Prerender,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/build-utils",
3
- "version": "7.2.4",
3
+ "version": "7.3.0",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.js",