@vercel/build-utils 5.5.5 → 5.5.6

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.
@@ -34,6 +34,6 @@ export declare class EdgeFunction {
34
34
  path: string;
35
35
  }[];
36
36
  /** The regions where the edge function will be executed on */
37
- regions?: 'auto' | string[] | 'all' | 'default';
37
+ regions?: string | string[];
38
38
  constructor(params: Omit<EdgeFunction, 'type'>);
39
39
  }
@@ -3,6 +3,10 @@ export declare function getLatestNodeVersion(): {
3
3
  readonly major: 16;
4
4
  readonly range: "16.x";
5
5
  readonly runtime: "nodejs16.x";
6
+ } | {
7
+ readonly major: 18;
8
+ readonly range: "18.x";
9
+ readonly runtime: "nodejs18.x";
6
10
  };
7
11
  export declare function getDiscontinuedNodeVersions(): NodeVersion[];
8
12
  export declare function getSupportedNodeVersion(engineRange: string | undefined, isAuto?: boolean): Promise<NodeVersion>;
@@ -7,28 +7,37 @@ exports.getSupportedNodeVersion = exports.getDiscontinuedNodeVersions = exports.
7
7
  const semver_1 = require("semver");
8
8
  const errors_1 = require("../errors");
9
9
  const debug_1 = __importDefault(require("../debug"));
10
- const allOptions = [
11
- { major: 16, range: '16.x', runtime: 'nodejs16.x' },
12
- { major: 14, range: '14.x', runtime: 'nodejs14.x' },
13
- {
14
- major: 12,
15
- range: '12.x',
16
- runtime: 'nodejs12.x',
17
- discontinueDate: new Date('2022-10-03'),
18
- },
19
- {
20
- major: 10,
21
- range: '10.x',
22
- runtime: 'nodejs10.x',
23
- discontinueDate: new Date('2021-04-20'),
24
- },
25
- {
26
- major: 8,
27
- range: '8.10.x',
28
- runtime: 'nodejs8.10',
29
- discontinueDate: new Date('2020-01-06'),
30
- },
31
- ];
10
+ function getOptions() {
11
+ const options = [
12
+ { major: 16, range: '16.x', runtime: 'nodejs16.x' },
13
+ { major: 14, range: '14.x', runtime: 'nodejs14.x' },
14
+ {
15
+ major: 12,
16
+ range: '12.x',
17
+ runtime: 'nodejs12.x',
18
+ discontinueDate: new Date('2022-10-03'),
19
+ },
20
+ {
21
+ major: 10,
22
+ range: '10.x',
23
+ runtime: 'nodejs10.x',
24
+ discontinueDate: new Date('2021-04-20'),
25
+ },
26
+ {
27
+ major: 8,
28
+ range: '8.10.x',
29
+ runtime: 'nodejs8.10',
30
+ discontinueDate: new Date('2020-01-06'),
31
+ },
32
+ ];
33
+ if (process.env.VERCEL_ALLOW_NODEJS18 === '1') {
34
+ return [
35
+ { major: 18, range: '18.x', runtime: 'nodejs18.x' },
36
+ ...options,
37
+ ];
38
+ }
39
+ return options;
40
+ }
32
41
  function getHint(isAuto = false) {
33
42
  const { major, range } = getLatestNodeVersion();
34
43
  return isAuto
@@ -36,18 +45,18 @@ function getHint(isAuto = false) {
36
45
  : `Please set "engines": { "node": "${range}" } in your \`package.json\` file to use Node.js ${major}.`;
37
46
  }
38
47
  function getLatestNodeVersion() {
39
- return allOptions[0];
48
+ return getOptions()[0];
40
49
  }
41
50
  exports.getLatestNodeVersion = getLatestNodeVersion;
42
51
  function getDiscontinuedNodeVersions() {
43
- return allOptions.filter(isDiscontinued);
52
+ return getOptions().filter(isDiscontinued);
44
53
  }
45
54
  exports.getDiscontinuedNodeVersions = getDiscontinuedNodeVersions;
46
55
  async function getSupportedNodeVersion(engineRange, isAuto = false) {
47
56
  let selection = getLatestNodeVersion();
48
57
  if (engineRange) {
49
58
  const found = semver_1.validRange(engineRange) &&
50
- allOptions.some(o => {
59
+ getOptions().some(o => {
51
60
  // the array is already in order so return the first
52
61
  // match which will be the newest version of node
53
62
  selection = o;