@vercel/build-utils 13.2.15 → 13.2.17

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,21 @@
1
1
  # @vercel/build-utils
2
2
 
3
+ ## 13.2.17
4
+
5
+ ### Patch Changes
6
+
7
+ - Add `exposeErrBody` optional boolean property to Prerender object ([#14845](https://github.com/vercel/vercel/pull/14845))
8
+
9
+ - Move backends builder detection to detectBuilders phase ([#14830](https://github.com/vercel/vercel/pull/14830))
10
+
11
+ ## 13.2.16
12
+
13
+ ### Patch Changes
14
+
15
+ - Add maxConcurrency to experimentalTriggers ([#14725](https://github.com/vercel/vercel/pull/14725))
16
+
17
+ - Add maxConcurrency trigger field ([#14725](https://github.com/vercel/vercel/pull/14725))
18
+
3
19
  ## 13.2.15
4
20
 
5
21
  ### Patch Changes
@@ -5,7 +5,15 @@ import { Builder } from '.';
5
5
  export declare const BACKEND_FRAMEWORKS: readonly ["express", "hono", "h3", "koa", "nestjs", "fastify", "elysia"];
6
6
  export declare const PYTHON_FRAMEWORKS: readonly ["fastapi", "flask", "python"];
7
7
  export declare const RUNTIME_FRAMEWORKS: readonly ["python"];
8
+ /**
9
+ * List of framework-specific backend builders that get replaced by UNIFIED_BACKEND_BUILDER
10
+ * when experimental backends is enabled
11
+ */
8
12
  export declare const BACKEND_BUILDERS: readonly ["@vercel/express", "@vercel/hono", "@vercel/h3", "@vercel/koa", "@vercel/nestjs", "@vercel/fastify", "@vercel/elysia"];
13
+ /**
14
+ * The unified backend builder that replaces framework-specific backend builders
15
+ */
16
+ export declare const UNIFIED_BACKEND_BUILDER: "@vercel/backends";
9
17
  export type BackendFramework = (typeof BACKEND_FRAMEWORKS)[number];
10
18
  export type PythonFramework = (typeof PYTHON_FRAMEWORKS)[number];
11
19
  /**
@@ -22,6 +22,7 @@ __export(framework_helpers_exports, {
22
22
  BACKEND_FRAMEWORKS: () => BACKEND_FRAMEWORKS,
23
23
  PYTHON_FRAMEWORKS: () => PYTHON_FRAMEWORKS,
24
24
  RUNTIME_FRAMEWORKS: () => RUNTIME_FRAMEWORKS,
25
+ UNIFIED_BACKEND_BUILDER: () => UNIFIED_BACKEND_BUILDER,
25
26
  isBackendBuilder: () => isBackendBuilder,
26
27
  isBackendFramework: () => isBackendFramework,
27
28
  isExperimentalBackendsEnabled: () => isExperimentalBackendsEnabled,
@@ -55,6 +56,7 @@ const BACKEND_BUILDERS = [
55
56
  "@vercel/fastify",
56
57
  "@vercel/elysia"
57
58
  ];
59
+ const UNIFIED_BACKEND_BUILDER = "@vercel/backends";
58
60
  function isBackendFramework(framework) {
59
61
  if (!framework)
60
62
  return false;
@@ -75,6 +77,8 @@ function isExperimentalBackendsEnabled() {
75
77
  function isBackendBuilder(builder) {
76
78
  if (!builder)
77
79
  return false;
80
+ if (builder.use === UNIFIED_BACKEND_BUILDER)
81
+ return true;
78
82
  const use = builder.use;
79
83
  return BACKEND_BUILDERS.includes(use);
80
84
  }
@@ -87,6 +91,7 @@ function shouldUseExperimentalBackends(framework) {
87
91
  BACKEND_FRAMEWORKS,
88
92
  PYTHON_FRAMEWORKS,
89
93
  RUNTIME_FRAMEWORKS,
94
+ UNIFIED_BACKEND_BUILDER,
90
95
  isBackendBuilder,
91
96
  isBackendFramework,
92
97
  isExperimentalBackendsEnabled,
package/dist/index.d.ts CHANGED
@@ -32,5 +32,5 @@ 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, isBackendBuilder, isExperimentalBackendsEnabled, isExperimentalBackendsWithoutIntrospectionEnabled, shouldUseExperimentalBackends, PYTHON_FRAMEWORKS, PythonFramework, isPythonFramework, } from './framework-helpers';
35
+ export { BACKEND_FRAMEWORKS, BACKEND_BUILDERS, UNIFIED_BACKEND_BUILDER, BackendFramework, isBackendFramework, isBackendBuilder, isExperimentalBackendsEnabled, isExperimentalBackendsWithoutIntrospectionEnabled, shouldUseExperimentalBackends, PYTHON_FRAMEWORKS, PythonFramework, isPythonFramework, } from './framework-helpers';
36
36
  export * from './python';
package/dist/index.js CHANGED
@@ -23715,6 +23715,7 @@ var require_execa = __commonJS({
23715
23715
  // src/index.ts
23716
23716
  var src_exports = {};
23717
23717
  __export(src_exports, {
23718
+ BACKEND_BUILDERS: () => BACKEND_BUILDERS,
23718
23719
  BACKEND_FRAMEWORKS: () => BACKEND_FRAMEWORKS,
23719
23720
  BUILDER_COMPILE_STEP: () => BUILDER_COMPILE_STEP,
23720
23721
  BUILDER_INSTALLER_STEP: () => BUILDER_INSTALLER_STEP,
@@ -23731,6 +23732,7 @@ __export(src_exports, {
23731
23732
  PYTHON_FRAMEWORKS: () => PYTHON_FRAMEWORKS,
23732
23733
  Prerender: () => Prerender,
23733
23734
  Span: () => Span,
23735
+ UNIFIED_BACKEND_BUILDER: () => UNIFIED_BACKEND_BUILDER,
23734
23736
  Version: () => Version,
23735
23737
  buildsSchema: () => buildsSchema,
23736
23738
  cloneEnv: () => cloneEnv,
@@ -24454,6 +24456,16 @@ var Lambda = class {
24454
24456
  `${prefix}.initialDelaySeconds must be a non-negative number`
24455
24457
  );
24456
24458
  }
24459
+ if (trigger.maxConcurrency !== void 0) {
24460
+ (0, import_assert4.default)(
24461
+ typeof trigger.maxConcurrency === "number",
24462
+ `${prefix}.maxConcurrency must be a number`
24463
+ );
24464
+ (0, import_assert4.default)(
24465
+ Number.isInteger(trigger.maxConcurrency) && trigger.maxConcurrency >= 1,
24466
+ `${prefix}.maxConcurrency must be at least 1`
24467
+ );
24468
+ }
24457
24469
  }
24458
24470
  }
24459
24471
  if (supportsCancellation !== void 0) {
@@ -24602,7 +24614,8 @@ var Prerender = class {
24602
24614
  sourcePath,
24603
24615
  experimentalBypassFor,
24604
24616
  experimentalStreamingLambdaPath,
24605
- chain
24617
+ chain,
24618
+ exposeErrBody
24606
24619
  }) {
24607
24620
  this.type = "Prerender";
24608
24621
  this.expiration = expiration;
@@ -24727,6 +24740,13 @@ var Prerender = class {
24727
24740
  }
24728
24741
  this.chain = chain;
24729
24742
  }
24743
+ if (exposeErrBody === true) {
24744
+ this.exposeErrBody = true;
24745
+ } else if (typeof exposeErrBody !== "boolean" && typeof exposeErrBody !== "undefined") {
24746
+ throw new Error(
24747
+ `The \`exposeErrBody\` argument for \`Prerender\` must be a boolean.`
24748
+ );
24749
+ }
24730
24750
  }
24731
24751
  };
24732
24752
 
@@ -26412,6 +26432,10 @@ var triggerEventSchema = {
26412
26432
  initialDelaySeconds: {
26413
26433
  type: "number",
26414
26434
  minimum: 0
26435
+ },
26436
+ maxConcurrency: {
26437
+ type: "number",
26438
+ minimum: 1
26415
26439
  }
26416
26440
  },
26417
26441
  required: ["type", "topic", "consumer"],
@@ -26765,6 +26789,7 @@ var BACKEND_BUILDERS = [
26765
26789
  "@vercel/fastify",
26766
26790
  "@vercel/elysia"
26767
26791
  ];
26792
+ var UNIFIED_BACKEND_BUILDER = "@vercel/backends";
26768
26793
  function isBackendFramework(framework) {
26769
26794
  if (!framework)
26770
26795
  return false;
@@ -26785,6 +26810,8 @@ function isExperimentalBackendsEnabled() {
26785
26810
  function isBackendBuilder(builder) {
26786
26811
  if (!builder)
26787
26812
  return false;
26813
+ if (builder.use === UNIFIED_BACKEND_BUILDER)
26814
+ return true;
26788
26815
  const use = builder.use;
26789
26816
  return BACKEND_BUILDERS.includes(use);
26790
26817
  }
@@ -26840,6 +26867,7 @@ async function isPythonEntrypoint(file) {
26840
26867
  }
26841
26868
  // Annotate the CommonJS export names for ESM import in node:
26842
26869
  0 && (module.exports = {
26870
+ BACKEND_BUILDERS,
26843
26871
  BACKEND_FRAMEWORKS,
26844
26872
  BUILDER_COMPILE_STEP,
26845
26873
  BUILDER_INSTALLER_STEP,
@@ -26856,6 +26884,7 @@ async function isPythonEntrypoint(file) {
26856
26884
  PYTHON_FRAMEWORKS,
26857
26885
  Prerender,
26858
26886
  Span,
26887
+ UNIFIED_BACKEND_BUILDER,
26859
26888
  Version,
26860
26889
  buildsSchema,
26861
26890
  cloneEnv,
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) {
@@ -16,6 +16,7 @@ interface PrerenderOptions {
16
16
  experimentalBypassFor?: HasField;
17
17
  experimentalStreamingLambdaPath?: string;
18
18
  chain?: Chain;
19
+ exposeErrBody?: boolean;
19
20
  }
20
21
  export declare class Prerender {
21
22
  type: 'Prerender';
@@ -43,6 +44,7 @@ export declare class Prerender {
43
44
  experimentalBypassFor?: HasField;
44
45
  experimentalStreamingLambdaPath?: string;
45
46
  chain?: Chain;
46
- constructor({ expiration, staleExpiration, lambda, fallback, group, bypassToken, allowQuery, allowHeader, initialHeaders, initialStatus, passQuery, sourcePath, experimentalBypassFor, experimentalStreamingLambdaPath, chain, }: PrerenderOptions);
47
+ exposeErrBody?: boolean;
48
+ constructor({ expiration, staleExpiration, lambda, fallback, group, bypassToken, allowQuery, allowHeader, initialHeaders, initialStatus, passQuery, sourcePath, experimentalBypassFor, experimentalStreamingLambdaPath, chain, exposeErrBody, }: PrerenderOptions);
47
49
  }
48
50
  export {};
package/dist/prerender.js CHANGED
@@ -37,7 +37,8 @@ class Prerender {
37
37
  sourcePath,
38
38
  experimentalBypassFor,
39
39
  experimentalStreamingLambdaPath,
40
- chain
40
+ chain,
41
+ exposeErrBody
41
42
  }) {
42
43
  this.type = "Prerender";
43
44
  this.expiration = expiration;
@@ -162,6 +163,13 @@ class Prerender {
162
163
  }
163
164
  this.chain = chain;
164
165
  }
166
+ if (exposeErrBody === true) {
167
+ this.exposeErrBody = true;
168
+ } else if (typeof exposeErrBody !== "boolean" && typeof exposeErrBody !== "undefined") {
169
+ throw new Error(
170
+ `The \`exposeErrBody\` argument for \`Prerender\` must be a boolean.`
171
+ );
172
+ }
165
173
  }
166
174
  }
167
175
  // Annotate the CommonJS export names for ESM import in node:
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.15",
3
+ "version": "13.2.17",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.js",