@vercel/build-utils 13.36.1 → 13.36.3

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,18 @@
1
1
  # @vercel/build-utils
2
2
 
3
+ ## 13.36.3
4
+
5
+ ### Patch Changes
6
+
7
+ - a69c714: Propagate per-function `maxConcurrency` configuration into build outputs and keep every configured Next.js route in its own Lambda group, including routes with the same limit.
8
+ - 654e898: Type shared function settings in container image build outputs.
9
+
10
+ ## 13.36.2
11
+
12
+ ### Patch Changes
13
+
14
+ - 2c75803: Preserve 4-byte UTF-8 characters when streaming string `FileBlob` contents (fixes Edge Function corruption during `vercel build`).
15
+
3
16
  ## 13.36.1
4
17
 
5
18
  ### Patch Changes
@@ -1,16 +1,15 @@
1
+ import type { LambdaOptionsBase } from './lambda';
1
2
  import type { Env, Files } from './types';
2
- export interface ContainerImageConfig {
3
+ export interface ContainerImageConfig extends Pick<LambdaOptionsBase, 'handler' | 'architecture' | 'memory' | 'maxDuration' | 'maxConcurrency' | 'environment' | 'regions' | 'functionFailoverRegions' | 'experimentalTriggers' | 'supportsCancellation'> {
3
4
  /**
4
- * The OCI image reference (e.g. `vcr.vercel.com/team/project/svc@sha256:...`).
5
- * Carried in `handler` per the build-output contract; api-builds surfaces it
6
- * as `image` downstream (see vercel/api#76729).
5
+ * The OCI image reference, for example
6
+ * `vcr.vercel.com/team/project/svc@sha256:...`.
7
+ * The build output contract carries this value in `handler`.
7
8
  */
8
- handler: string;
9
9
  runtime: 'container';
10
10
  command?: string[];
11
- environment?: Env;
12
11
  }
13
- export declare class ContainerImage {
12
+ export declare class ContainerImage implements ContainerImageConfig {
14
13
  type: 'ContainerImage';
15
14
  files: Files;
16
15
  /** The OCI image reference, carried in `handler` (see ContainerImageConfig). */
@@ -18,5 +17,15 @@ export declare class ContainerImage {
18
17
  runtime: 'container';
19
18
  command?: string[];
20
19
  environment: Env;
21
- constructor(params: Omit<ContainerImage, 'type'>);
20
+ architecture?: ContainerImageConfig['architecture'];
21
+ memory?: ContainerImageConfig['memory'];
22
+ maxDuration?: ContainerImageConfig['maxDuration'];
23
+ maxConcurrency?: ContainerImageConfig['maxConcurrency'];
24
+ regions?: ContainerImageConfig['regions'];
25
+ functionFailoverRegions?: ContainerImageConfig['functionFailoverRegions'];
26
+ experimentalTriggers?: ContainerImageConfig['experimentalTriggers'];
27
+ supportsCancellation?: ContainerImageConfig['supportsCancellation'];
28
+ constructor(params: ContainerImageConfig & {
29
+ files: Files;
30
+ });
22
31
  }
@@ -28,7 +28,15 @@ class ContainerImage {
28
28
  this.handler = params.handler;
29
29
  this.runtime = params.runtime;
30
30
  this.command = params.command;
31
- this.environment = params.environment;
31
+ this.environment = params.environment ?? {};
32
+ this.architecture = params.architecture;
33
+ this.memory = params.memory;
34
+ this.maxDuration = params.maxDuration;
35
+ this.maxConcurrency = params.maxConcurrency;
36
+ this.regions = params.regions;
37
+ this.functionFailoverRegions = params.functionFailoverRegions;
38
+ this.experimentalTriggers = params.experimentalTriggers;
39
+ this.supportsCancellation = params.supportsCancellation;
32
40
  }
33
41
  }
34
42
  // Annotate the CommonJS export names for ESM import in node:
package/dist/file-blob.js CHANGED
@@ -71,6 +71,7 @@ class FileBlob {
71
71
  return this.toStream();
72
72
  }
73
73
  toStream() {
74
- return (0, import_into_stream.default)(this.data);
74
+ const data = typeof this.data === "string" ? Buffer.from(this.data, "utf8") : this.data;
75
+ return (0, import_into_stream.default)(data);
75
76
  }
76
77
  }
package/dist/index.js CHANGED
@@ -31744,7 +31744,8 @@ var FileBlob = class _FileBlob {
31744
31744
  return this.toStream();
31745
31745
  }
31746
31746
  toStream() {
31747
- return (0, import_into_stream.default)(this.data);
31747
+ const data = typeof this.data === "string" ? Buffer.from(this.data, "utf8") : this.data;
31748
+ return (0, import_into_stream.default)(data);
31748
31749
  }
31749
31750
  };
31750
31751
 
@@ -32281,6 +32282,7 @@ var Lambda = class {
32281
32282
  runtime,
32282
32283
  runtimeLanguage,
32283
32284
  maxDuration,
32285
+ maxConcurrency,
32284
32286
  architecture,
32285
32287
  memory,
32286
32288
  environment = {},
@@ -32333,6 +32335,12 @@ var Lambda = class {
32333
32335
  '"maxDuration" is not a number or "max"'
32334
32336
  );
32335
32337
  }
32338
+ if (maxConcurrency !== void 0) {
32339
+ (0, import_assert4.default)(
32340
+ Number.isInteger(maxConcurrency) && maxConcurrency >= 1,
32341
+ '"maxConcurrency" must be an integer greater than or equal to 1'
32342
+ );
32343
+ }
32336
32344
  if (allowQuery !== void 0) {
32337
32345
  (0, import_assert4.default)(Array.isArray(allowQuery), '"allowQuery" is not an Array');
32338
32346
  (0, import_assert4.default)(
@@ -32468,6 +32476,7 @@ var Lambda = class {
32468
32476
  this.architecture = getDefaultLambdaArchitecture(architecture);
32469
32477
  this.memory = memory;
32470
32478
  this.maxDuration = maxDuration;
32479
+ this.maxConcurrency = maxConcurrency;
32471
32480
  this.environment = environment;
32472
32481
  this.allowQuery = allowQuery;
32473
32482
  this.regions = regions;
@@ -32576,6 +32585,7 @@ async function getLambdaOptionsFromFunction({
32576
32585
  architecture: fn.architecture,
32577
32586
  memory: fn.memory,
32578
32587
  maxDuration: fn.maxDuration,
32588
+ maxConcurrency: fn.maxConcurrency,
32579
32589
  regions: fn.regions,
32580
32590
  functionFailoverRegions: fn.functionFailoverRegions,
32581
32591
  experimentalTriggers,
@@ -35312,7 +35322,15 @@ var ContainerImage = class {
35312
35322
  this.handler = params.handler;
35313
35323
  this.runtime = params.runtime;
35314
35324
  this.command = params.command;
35315
- this.environment = params.environment;
35325
+ this.environment = params.environment ?? {};
35326
+ this.architecture = params.architecture;
35327
+ this.memory = params.memory;
35328
+ this.maxDuration = params.maxDuration;
35329
+ this.maxConcurrency = params.maxConcurrency;
35330
+ this.regions = params.regions;
35331
+ this.functionFailoverRegions = params.functionFailoverRegions;
35332
+ this.experimentalTriggers = params.experimentalTriggers;
35333
+ this.supportsCancellation = params.supportsCancellation;
35316
35334
  }
35317
35335
  };
35318
35336
 
@@ -35487,6 +35505,10 @@ var getFunctionsSchema = () => ({
35487
35505
  maximum: 10240
35488
35506
  },
35489
35507
  maxDuration: getMaxDurationSchema(),
35508
+ maxConcurrency: {
35509
+ type: "integer",
35510
+ minimum: 1
35511
+ },
35490
35512
  regions: {
35491
35513
  type: "array",
35492
35514
  items: {
package/dist/lambda.d.ts CHANGED
@@ -27,6 +27,7 @@ export interface LambdaOptionsBase {
27
27
  architecture?: LambdaArchitecture;
28
28
  memory?: number;
29
29
  maxDuration?: MaxDuration;
30
+ maxConcurrency?: number;
30
31
  environment?: Env;
31
32
  allowQuery?: string[];
32
33
  regions?: string[];
@@ -102,6 +103,8 @@ export declare class Lambda {
102
103
  architecture: LambdaArchitecture;
103
104
  memory?: number;
104
105
  maxDuration?: MaxDuration;
106
+ /** Maximum number of requests that one function instance can process concurrently. */
107
+ maxConcurrency?: number;
105
108
  environment: Env;
106
109
  allowQuery?: string[];
107
110
  regions?: string[];
@@ -153,4 +156,4 @@ export declare class Lambda {
153
156
  */
154
157
  export declare function createLambda(opts: LambdaOptions): Promise<Lambda>;
155
158
  export declare function createZip(files: Files): Promise<Buffer>;
156
- export declare function getLambdaOptionsFromFunction({ sourceFile, config, }: GetLambdaOptionsFromFunctionOptions): Promise<Pick<LambdaOptions, 'architecture' | 'memory' | 'maxDuration' | 'regions' | 'functionFailoverRegions' | 'experimentalTriggers' | 'supportsCancellation'>>;
159
+ export declare function getLambdaOptionsFromFunction({ sourceFile, config, }: GetLambdaOptionsFromFunctionOptions): Promise<Pick<LambdaOptions, 'architecture' | 'memory' | 'maxDuration' | 'maxConcurrency' | 'regions' | 'functionFailoverRegions' | 'experimentalTriggers' | 'supportsCancellation'>>;
package/dist/lambda.js CHANGED
@@ -80,6 +80,7 @@ class Lambda {
80
80
  runtime,
81
81
  runtimeLanguage,
82
82
  maxDuration,
83
+ maxConcurrency,
83
84
  architecture,
84
85
  memory,
85
86
  environment = {},
@@ -132,6 +133,12 @@ class Lambda {
132
133
  '"maxDuration" is not a number or "max"'
133
134
  );
134
135
  }
136
+ if (maxConcurrency !== void 0) {
137
+ (0, import_assert.default)(
138
+ Number.isInteger(maxConcurrency) && maxConcurrency >= 1,
139
+ '"maxConcurrency" must be an integer greater than or equal to 1'
140
+ );
141
+ }
135
142
  if (allowQuery !== void 0) {
136
143
  (0, import_assert.default)(Array.isArray(allowQuery), '"allowQuery" is not an Array');
137
144
  (0, import_assert.default)(
@@ -267,6 +274,7 @@ class Lambda {
267
274
  this.architecture = getDefaultLambdaArchitecture(architecture);
268
275
  this.memory = memory;
269
276
  this.maxDuration = maxDuration;
277
+ this.maxConcurrency = maxConcurrency;
270
278
  this.environment = environment;
271
279
  this.allowQuery = allowQuery;
272
280
  this.regions = regions;
@@ -375,6 +383,7 @@ async function getLambdaOptionsFromFunction({
375
383
  architecture: fn.architecture,
376
384
  memory: fn.memory,
377
385
  maxDuration: fn.maxDuration,
386
+ maxConcurrency: fn.maxConcurrency,
378
387
  regions: fn.regions,
379
388
  functionFailoverRegions: fn.functionFailoverRegions,
380
389
  experimentalTriggers,
package/dist/schemas.d.ts CHANGED
@@ -31,6 +31,10 @@ export declare const getFunctionsSchema: () => {
31
31
  enum: string[];
32
32
  })[];
33
33
  };
34
+ maxConcurrency: {
35
+ type: string;
36
+ minimum: number;
37
+ };
34
38
  regions: {
35
39
  type: string;
36
40
  items: {
@@ -133,6 +137,10 @@ export declare const functionsSchema: {
133
137
  enum: string[];
134
138
  })[];
135
139
  };
140
+ maxConcurrency: {
141
+ type: string;
142
+ minimum: number;
143
+ };
136
144
  regions: {
137
145
  type: string;
138
146
  items: {
package/dist/schemas.js CHANGED
@@ -117,6 +117,10 @@ const getFunctionsSchema = () => ({
117
117
  maximum: 10240
118
118
  },
119
119
  maxDuration: (0, import_max_duration.getMaxDurationSchema)(),
120
+ maxConcurrency: {
121
+ type: "integer",
122
+ minimum: 1
123
+ },
120
124
  regions: {
121
125
  type: "array",
122
126
  items: {
package/dist/types.d.ts CHANGED
@@ -406,6 +406,7 @@ export interface BuilderFunctions {
406
406
  architecture?: LambdaArchitecture;
407
407
  memory?: number;
408
408
  maxDuration?: MaxDuration;
409
+ maxConcurrency?: number;
409
410
  regions?: string[];
410
411
  functionFailoverRegions?: string[];
411
412
  runtime?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/build-utils",
3
- "version": "13.36.1",
3
+ "version": "13.36.3",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.js",