@vercel/build-utils 7.2.4 → 7.2.5
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 +6 -0
- package/dist/fs/node-version.d.ts +4 -33
- package/dist/fs/node-version.js +5 -9
- package/dist/index.js +5 -9
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
@@ -1,35 +1,6 @@
|
|
1
1
|
import { NodeVersion } from '../types';
|
2
2
|
export type NodeVersionMajor = ReturnType<typeof getOptions>[number]['major'];
|
3
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
4
|
readonly major: 20;
|
34
5
|
readonly range: "20.x";
|
35
6
|
readonly runtime: "nodejs20.x";
|
@@ -65,6 +36,10 @@ declare function getOptions(): readonly [{
|
|
65
36
|
}];
|
66
37
|
export declare function getAvailableNodeVersions(): NodeVersionMajor[];
|
67
38
|
export declare function getLatestNodeVersion(availableVersions?: NodeVersionMajor[]): {
|
39
|
+
readonly major: 20;
|
40
|
+
readonly range: "20.x";
|
41
|
+
readonly runtime: "nodejs20.x";
|
42
|
+
} | {
|
68
43
|
readonly major: 18;
|
69
44
|
readonly range: "18.x";
|
70
45
|
readonly runtime: "nodejs18.x";
|
@@ -93,10 +68,6 @@ export declare function getLatestNodeVersion(availableVersions?: NodeVersionMajo
|
|
93
68
|
readonly range: "8.10.x";
|
94
69
|
readonly runtime: "nodejs8.10";
|
95
70
|
readonly discontinueDate: Date;
|
96
|
-
} | {
|
97
|
-
readonly major: 20;
|
98
|
-
readonly range: "20.x";
|
99
|
-
readonly runtime: "nodejs20.x";
|
100
71
|
};
|
101
72
|
export declare function getDiscontinuedNodeVersions(): NodeVersion[];
|
102
73
|
export declare function getSupportedNodeVersion(engineRange: string | undefined, isAuto?: boolean, availableVersions?: NodeVersionMajor[]): Promise<NodeVersion>;
|
package/dist/fs/node-version.js
CHANGED
@@ -40,6 +40,7 @@ var import_errors = require("../errors");
|
|
40
40
|
var import_debug = __toESM(require("../debug"));
|
41
41
|
function getOptions() {
|
42
42
|
const options = [
|
43
|
+
{ major: 20, range: "20.x", runtime: "nodejs20.x" },
|
43
44
|
{ major: 18, range: "18.x", runtime: "nodejs18.x" },
|
44
45
|
{
|
45
46
|
major: 16,
|
@@ -72,12 +73,6 @@ function getOptions() {
|
|
72
73
|
discontinueDate: /* @__PURE__ */ new Date("2020-01-06")
|
73
74
|
}
|
74
75
|
];
|
75
|
-
if (process.env.VERCEL_ALLOW_NODEJS20 === "1") {
|
76
|
-
return [
|
77
|
-
{ major: 20, range: "20.x", runtime: "nodejs20.x" },
|
78
|
-
...options
|
79
|
-
];
|
80
|
-
}
|
81
76
|
return options;
|
82
77
|
}
|
83
78
|
function isNodeVersionAvailable(version) {
|
@@ -90,8 +85,8 @@ function isNodeVersionAvailable(version) {
|
|
90
85
|
function getAvailableNodeVersions() {
|
91
86
|
return getOptions().filter(isNodeVersionAvailable).map((n) => n.major);
|
92
87
|
}
|
93
|
-
function getHint(isAuto = false) {
|
94
|
-
const { major, range } = getLatestNodeVersion();
|
88
|
+
function getHint(isAuto = false, availableVersions) {
|
89
|
+
const { major, range } = getLatestNodeVersion(availableVersions);
|
95
90
|
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
91
|
}
|
97
92
|
function getLatestNodeVersion(availableVersions) {
|
@@ -122,7 +117,8 @@ async function getSupportedNodeVersion(engineRange, isAuto = false, availableVer
|
|
122
117
|
code: "BUILD_UTILS_NODE_VERSION_INVALID",
|
123
118
|
link: "http://vercel.link/node-version",
|
124
119
|
message: `Found invalid Node.js Version: "${engineRange}". ${getHint(
|
125
|
-
isAuto
|
120
|
+
isAuto,
|
121
|
+
availableVersions
|
126
122
|
)}`
|
127
123
|
});
|
128
124
|
}
|
package/dist/index.js
CHANGED
@@ -21593,6 +21593,7 @@ var import_fs = require("fs");
|
|
21593
21593
|
var import_semver = __toESM(require_semver2());
|
21594
21594
|
function getOptions() {
|
21595
21595
|
const options = [
|
21596
|
+
{ major: 20, range: "20.x", runtime: "nodejs20.x" },
|
21596
21597
|
{ major: 18, range: "18.x", runtime: "nodejs18.x" },
|
21597
21598
|
{
|
21598
21599
|
major: 16,
|
@@ -21625,12 +21626,6 @@ function getOptions() {
|
|
21625
21626
|
discontinueDate: /* @__PURE__ */ new Date("2020-01-06")
|
21626
21627
|
}
|
21627
21628
|
];
|
21628
|
-
if (process.env.VERCEL_ALLOW_NODEJS20 === "1") {
|
21629
|
-
return [
|
21630
|
-
{ major: 20, range: "20.x", runtime: "nodejs20.x" },
|
21631
|
-
...options
|
21632
|
-
];
|
21633
|
-
}
|
21634
21629
|
return options;
|
21635
21630
|
}
|
21636
21631
|
function isNodeVersionAvailable(version) {
|
@@ -21643,8 +21638,8 @@ function isNodeVersionAvailable(version) {
|
|
21643
21638
|
function getAvailableNodeVersions() {
|
21644
21639
|
return getOptions().filter(isNodeVersionAvailable).map((n) => n.major);
|
21645
21640
|
}
|
21646
|
-
function getHint(isAuto = false) {
|
21647
|
-
const { major, range } = getLatestNodeVersion();
|
21641
|
+
function getHint(isAuto = false, availableVersions) {
|
21642
|
+
const { major, range } = getLatestNodeVersion(availableVersions);
|
21648
21643
|
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
21644
|
}
|
21650
21645
|
function getLatestNodeVersion(availableVersions) {
|
@@ -21675,7 +21670,8 @@ async function getSupportedNodeVersion(engineRange, isAuto = false, availableVer
|
|
21675
21670
|
code: "BUILD_UTILS_NODE_VERSION_INVALID",
|
21676
21671
|
link: "http://vercel.link/node-version",
|
21677
21672
|
message: `Found invalid Node.js Version: "${engineRange}". ${getHint(
|
21678
|
-
isAuto
|
21673
|
+
isAuto,
|
21674
|
+
availableVersions
|
21679
21675
|
)}`
|
21680
21676
|
});
|
21681
21677
|
}
|