@vercel/build-utils 13.2.14 → 13.2.16

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,19 @@
1
1
  # @vercel/build-utils
2
2
 
3
+ ## 13.2.16
4
+
5
+ ### Patch Changes
6
+
7
+ - Add maxConcurrency to experimentalTriggers ([#14725](https://github.com/vercel/vercel/pull/14725))
8
+
9
+ - Add maxConcurrency trigger field ([#14725](https://github.com/vercel/vercel/pull/14725))
10
+
11
+ ## 13.2.15
12
+
13
+ ### Patch Changes
14
+
15
+ - Optimize `getAvailableNodeVersions` to skip discontinued versions and use non-throwing `statSync` ([#14686](https://github.com/vercel/vercel/pull/14686))
16
+
3
17
  ## 13.2.14
4
18
 
5
19
  ### Patch Changes
@@ -111,14 +111,11 @@ function getOptions() {
111
111
  return NODE_VERSIONS;
112
112
  }
113
113
  function isNodeVersionAvailable(version) {
114
- try {
115
- return (0, import_fs.statSync)(`/node${version.major}`).isDirectory();
116
- } catch {
117
- }
118
- return false;
114
+ const stat = (0, import_fs.statSync)(`/node${version.major}`, { throwIfNoEntry: false });
115
+ return stat?.isDirectory() ?? false;
119
116
  }
120
117
  function getAvailableNodeVersions() {
121
- return getOptions().filter(isNodeVersionAvailable).map((n) => n.major);
118
+ return getOptions().filter((v) => v.major >= 18).filter(isNodeVersionAvailable).map((n) => n.major);
122
119
  }
123
120
  function getHint(isAuto = false, availableVersions) {
124
121
  const { major, range } = getLatestNodeVersion(availableVersions);
@@ -153,7 +150,7 @@ async function getSupportedNodeVersion(engineRange, isAuto = false, availableVer
153
150
  throw new import_errors.NowBuildError({
154
151
  code: "BUILD_UTILS_NODE_VERSION_INVALID",
155
152
  link: "https://vercel.link/node-version",
156
- message: `Found invalid Node.js Version: "${engineRange}". ${getHint(
153
+ message: `Found invalid or discontinued Node.js Version: "${engineRange}". ${getHint(
157
154
  isAuto,
158
155
  availableVersions
159
156
  )}`
package/dist/index.js CHANGED
@@ -24454,6 +24454,16 @@ var Lambda = class {
24454
24454
  `${prefix}.initialDelaySeconds must be a non-negative number`
24455
24455
  );
24456
24456
  }
24457
+ if (trigger.maxConcurrency !== void 0) {
24458
+ (0, import_assert4.default)(
24459
+ typeof trigger.maxConcurrency === "number",
24460
+ `${prefix}.maxConcurrency must be a number`
24461
+ );
24462
+ (0, import_assert4.default)(
24463
+ Number.isInteger(trigger.maxConcurrency) && trigger.maxConcurrency >= 1,
24464
+ `${prefix}.maxConcurrency must be at least 1`
24465
+ );
24466
+ }
24457
24467
  }
24458
24468
  }
24459
24469
  if (supportsCancellation !== void 0) {
@@ -24940,14 +24950,11 @@ function getOptions() {
24940
24950
  return NODE_VERSIONS;
24941
24951
  }
24942
24952
  function isNodeVersionAvailable(version) {
24943
- try {
24944
- return (0, import_fs.statSync)(`/node${version.major}`).isDirectory();
24945
- } catch {
24946
- }
24947
- return false;
24953
+ const stat = (0, import_fs.statSync)(`/node${version.major}`, { throwIfNoEntry: false });
24954
+ return stat?.isDirectory() ?? false;
24948
24955
  }
24949
24956
  function getAvailableNodeVersions() {
24950
- return getOptions().filter(isNodeVersionAvailable).map((n) => n.major);
24957
+ return getOptions().filter((v) => v.major >= 18).filter(isNodeVersionAvailable).map((n) => n.major);
24951
24958
  }
24952
24959
  function getHint(isAuto = false, availableVersions) {
24953
24960
  const { major, range } = getLatestNodeVersion(availableVersions);
@@ -24982,7 +24989,7 @@ async function getSupportedNodeVersion(engineRange, isAuto = false, availableVer
24982
24989
  throw new NowBuildError({
24983
24990
  code: "BUILD_UTILS_NODE_VERSION_INVALID",
24984
24991
  link: "https://vercel.link/node-version",
24985
- message: `Found invalid Node.js Version: "${engineRange}". ${getHint(
24992
+ message: `Found invalid or discontinued Node.js Version: "${engineRange}". ${getHint(
24986
24993
  isAuto,
24987
24994
  availableVersions
24988
24995
  )}`
@@ -26415,6 +26422,10 @@ var triggerEventSchema = {
26415
26422
  initialDelaySeconds: {
26416
26423
  type: "number",
26417
26424
  minimum: 0
26425
+ },
26426
+ maxConcurrency: {
26427
+ type: "number",
26428
+ minimum: 1
26418
26429
  }
26419
26430
  },
26420
26431
  required: ["type", "topic", "consumer"],
package/dist/lambda.js CHANGED
@@ -208,6 +208,16 @@ class Lambda {
208
208
  `${prefix}.initialDelaySeconds must be a non-negative number`
209
209
  );
210
210
  }
211
+ if (trigger.maxConcurrency !== void 0) {
212
+ (0, import_assert.default)(
213
+ typeof trigger.maxConcurrency === "number",
214
+ `${prefix}.maxConcurrency must be a number`
215
+ );
216
+ (0, import_assert.default)(
217
+ Number.isInteger(trigger.maxConcurrency) && trigger.maxConcurrency >= 1,
218
+ `${prefix}.maxConcurrency must be at least 1`
219
+ );
220
+ }
211
221
  }
212
222
  }
213
223
  if (supportsCancellation !== void 0) {
package/dist/schemas.d.ts CHANGED
@@ -62,6 +62,10 @@ export declare const functionsSchema: {
62
62
  type: string;
63
63
  minimum: number;
64
64
  };
65
+ maxConcurrency: {
66
+ type: string;
67
+ minimum: number;
68
+ };
65
69
  };
66
70
  required: string[];
67
71
  additionalProperties: boolean;
package/dist/schemas.js CHANGED
@@ -48,6 +48,10 @@ const triggerEventSchema = {
48
48
  initialDelaySeconds: {
49
49
  type: "number",
50
50
  minimum: 0
51
+ },
52
+ maxConcurrency: {
53
+ type: "number",
54
+ minimum: 1
51
55
  }
52
56
  },
53
57
  required: ["type", "topic", "consumer"],
package/dist/types.d.ts CHANGED
@@ -548,6 +548,12 @@ export interface TriggerEvent {
548
548
  * Behavior when not specified depends on the server's default configuration.
549
549
  */
550
550
  initialDelaySeconds?: number;
551
+ /**
552
+ * Maximum number of concurrent executions for this consumer (OPTIONAL)
553
+ * Must be at least 1 if specified.
554
+ * Behavior when not specified depends on the server's default configuration.
555
+ */
556
+ maxConcurrency?: number;
551
557
  }
552
558
  export type ServiceRuntime = 'node' | 'python' | 'go' | 'rust' | 'ruby';
553
559
  export type ServiceType = 'web' | 'cron' | 'worker';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/build-utils",
3
- "version": "13.2.14",
3
+ "version": "13.2.16",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.js",
@@ -47,8 +47,8 @@
47
47
  "yazl": "2.5.1",
48
48
  "vitest": "2.0.1",
49
49
  "json5": "2.2.3",
50
- "@vercel/routing-utils": "5.3.2",
51
- "@vercel/error-utils": "2.0.3"
50
+ "@vercel/error-utils": "2.0.3",
51
+ "@vercel/routing-utils": "5.3.2"
52
52
  },
53
53
  "scripts": {
54
54
  "build": "node build.mjs",