@vercel/build-utils 10.6.0 → 10.6.1

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,15 @@
1
1
  # @vercel/build-utils
2
2
 
3
+ ## 10.6.1
4
+
5
+ ### Patch Changes
6
+
7
+ - next package uses @vercel/routing-utils HasField rather than redefining & stricter validation. ([#13409](https://github.com/vercel/vercel/pull/13409))
8
+
9
+ - Make architecture a defined property on Lambda classes to apply when creating ([#13398](https://github.com/vercel/vercel/pull/13398))
10
+
11
+ - [env-vars] expose VERCEL_PROJECT_ID as NEXT_PUBLIC_VERCEL_PROJECT_ID ([#13431](https://github.com/vercel/vercel/pull/13431))
12
+
3
13
  ## 10.6.0
4
14
 
5
15
  ### Minor Changes
@@ -33,7 +33,8 @@ function getPrefixedEnvVars({
33
33
  "VERCEL_REGION",
34
34
  "VERCEL_BRANCH_URL",
35
35
  "VERCEL_PROJECT_PRODUCTION_URL",
36
- "VERCEL_DEPLOYMENT_ID"
36
+ "VERCEL_DEPLOYMENT_ID",
37
+ "VERCEL_PROJECT_ID"
37
38
  ];
38
39
  const newEnvs = {};
39
40
  if (envPrefix && envs.VERCEL_URL) {
package/dist/index.js CHANGED
@@ -22372,6 +22372,20 @@ async function download(files, basePath, meta) {
22372
22372
  }
22373
22373
 
22374
22374
  // src/lambda.ts
22375
+ function getDefaultLambdaArchitecture(architecture) {
22376
+ if (architecture) {
22377
+ return architecture;
22378
+ }
22379
+ switch (process.arch) {
22380
+ case "arm":
22381
+ case "arm64": {
22382
+ return "arm64";
22383
+ }
22384
+ default: {
22385
+ return "x86_64";
22386
+ }
22387
+ }
22388
+ }
22375
22389
  var Lambda = class {
22376
22390
  constructor(opts) {
22377
22391
  const {
@@ -22461,7 +22475,7 @@ var Lambda = class {
22461
22475
  this.files = "files" in opts ? opts.files : void 0;
22462
22476
  this.handler = handler;
22463
22477
  this.runtime = runtime;
22464
- this.architecture = architecture;
22478
+ this.architecture = getDefaultLambdaArchitecture(architecture);
22465
22479
  this.memory = memory;
22466
22480
  this.maxDuration = maxDuration;
22467
22481
  this.environment = environment;
@@ -22629,8 +22643,7 @@ var Prerender = class {
22629
22643
  }
22630
22644
  if (experimentalBypassFor !== void 0) {
22631
22645
  if (!Array.isArray(experimentalBypassFor) || experimentalBypassFor.some(
22632
- (field) => typeof field !== "object" || // host doesn't need a key
22633
- field.type !== "host" && typeof field.key !== "string" || typeof field.type !== "string" || field.value !== void 0 && typeof field.value !== "string"
22646
+ (field) => typeof field !== "object" || typeof field.type !== "string" || field.type === "host" && "key" in field || field.type !== "host" && typeof field.key !== "string" || field.value !== void 0 && typeof field.value !== "string" && (typeof field.value !== "object" || field.value === null || Array.isArray(field.value))
22634
22647
  )) {
22635
22648
  throw new Error(
22636
22649
  "The `experimentalBypassFor` argument for `Prerender` must be Array of objects with fields `type`, `key` and optionally `value`."
@@ -24087,7 +24100,8 @@ function getPrefixedEnvVars({
24087
24100
  "VERCEL_REGION",
24088
24101
  "VERCEL_BRANCH_URL",
24089
24102
  "VERCEL_PROJECT_PRODUCTION_URL",
24090
- "VERCEL_DEPLOYMENT_ID"
24103
+ "VERCEL_DEPLOYMENT_ID",
24104
+ "VERCEL_PROJECT_ID"
24091
24105
  ];
24092
24106
  const newEnvs = {};
24093
24107
  if (envPrefix && envs.VERCEL_URL) {
package/dist/lambda.d.ts CHANGED
@@ -49,7 +49,7 @@ export declare class Lambda {
49
49
  files?: Files;
50
50
  handler: string;
51
51
  runtime: string;
52
- architecture?: LambdaArchitecture;
52
+ architecture: LambdaArchitecture;
53
53
  memory?: number;
54
54
  maxDuration?: number;
55
55
  environment: Env;
package/dist/lambda.js CHANGED
@@ -41,6 +41,20 @@ var import_minimatch = __toESM(require("minimatch"));
41
41
  var import_fs_extra = require("fs-extra");
42
42
  var import_download = require("./fs/download");
43
43
  var import_stream_to_buffer = __toESM(require("./fs/stream-to-buffer"));
44
+ function getDefaultLambdaArchitecture(architecture) {
45
+ if (architecture) {
46
+ return architecture;
47
+ }
48
+ switch (process.arch) {
49
+ case "arm":
50
+ case "arm64": {
51
+ return "arm64";
52
+ }
53
+ default: {
54
+ return "x86_64";
55
+ }
56
+ }
57
+ }
44
58
  class Lambda {
45
59
  constructor(opts) {
46
60
  const {
@@ -130,7 +144,7 @@ class Lambda {
130
144
  this.files = "files" in opts ? opts.files : void 0;
131
145
  this.handler = handler;
132
146
  this.runtime = runtime;
133
- this.architecture = architecture;
147
+ this.architecture = getDefaultLambdaArchitecture(architecture);
134
148
  this.memory = memory;
135
149
  this.maxDuration = maxDuration;
136
150
  this.environment = environment;
package/dist/prerender.js CHANGED
@@ -76,8 +76,7 @@ class Prerender {
76
76
  }
77
77
  if (experimentalBypassFor !== void 0) {
78
78
  if (!Array.isArray(experimentalBypassFor) || experimentalBypassFor.some(
79
- (field) => typeof field !== "object" || // host doesn't need a key
80
- field.type !== "host" && typeof field.key !== "string" || typeof field.type !== "string" || field.value !== void 0 && typeof field.value !== "string"
79
+ (field) => typeof field !== "object" || typeof field.type !== "string" || field.type === "host" && "key" in field || field.type !== "host" && typeof field.key !== "string" || field.value !== void 0 && typeof field.value !== "string" && (typeof field.value !== "object" || field.value === null || Array.isArray(field.value))
81
80
  )) {
82
81
  throw new Error(
83
82
  "The `experimentalBypassFor` argument for `Prerender` must be Array of objects with fields `type`, `key` and optionally `value`."
package/dist/types.d.ts CHANGED
@@ -6,6 +6,7 @@ import type { Lambda, LambdaArchitecture } from './lambda';
6
6
  import type { Prerender } from './prerender';
7
7
  import type { EdgeFunction } from './edge-function';
8
8
  import type { Span } from './trace';
9
+ import type { HasField } from '@vercel/routing-utils';
9
10
  export interface Env {
10
11
  [name: string]: string | undefined;
11
12
  }
@@ -44,14 +45,7 @@ export interface Config {
44
45
  middleware?: boolean;
45
46
  [key: string]: unknown;
46
47
  }
47
- export type HasField = Array<{
48
- type: 'host';
49
- value: string;
50
- } | {
51
- type: 'header' | 'cookie' | 'query';
52
- key: string;
53
- value?: string;
54
- }>;
48
+ export type { HasField };
55
49
  export interface Meta {
56
50
  isDev?: boolean;
57
51
  devCacheDir?: string;
@@ -502,4 +496,3 @@ export interface Chain {
502
496
  */
503
497
  headers: Record<string, string>;
504
498
  }
505
- export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/build-utils",
3
- "version": "10.6.0",
3
+ "version": "10.6.1",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.js",
@@ -27,6 +27,7 @@
27
27
  "@types/semver": "6.0.0",
28
28
  "@types/yazl": "2.4.2",
29
29
  "@vercel/error-utils": "2.0.3",
30
+ "@vercel/routing-utils": "5.0.6",
30
31
  "aggregate-error": "3.0.1",
31
32
  "async-retry": "1.2.3",
32
33
  "async-sema": "2.1.4",