@vercel/build-utils 13.3.3 → 13.3.5

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,24 @@
1
1
  # @vercel/build-utils
2
2
 
3
+ ## 13.3.5
4
+
5
+ ### Patch Changes
6
+
7
+ - Add service configuration to BuildOptions ([#14918](https://github.com/vercel/vercel/pull/14918))
8
+
9
+ - Updated dependencies [[`9b8f974bbb64fb857b068428b0c2fdccee6ad83c`](https://github.com/vercel/vercel/commit/9b8f974bbb64fb857b068428b0c2fdccee6ad83c)]:
10
+ - @vercel/python-analysis@0.4.0
11
+
12
+ ## 13.3.4
13
+
14
+ ### Patch Changes
15
+
16
+ - Add support for `regions` in `vercel.json` function-level configuration. ([#14963](https://github.com/vercel/vercel/pull/14963))
17
+
18
+ Matching function `regions` are now parsed from `functions` config, written into lambda output config, and documented in config types so they override top-level deployment regions for that function.
19
+
20
+ - [services] set framework prefixed env var urls to relative path ([#14958](https://github.com/vercel/vercel/pull/14958))
21
+
3
22
  ## 13.3.3
4
23
 
5
24
  ### Patch Changes
@@ -16,10 +16,13 @@ export interface GetServiceUrlEnvVarsOptions {
16
16
  * Generate environment variables for service URLs.
17
17
  *
18
18
  * For each web service, generates:
19
- * 1. A base env var (e.g., BACKEND_URL)
20
- * 2. Framework-prefixed versions for each frontend framework in the deployment
21
- * (e.g., VITE_BACKEND_URL, NEXT_PUBLIC_BACKEND_URL) so they can be accessed
22
- * in client-side code.
19
+ * 1. A base env var with the full absolute URL (e.g., BACKEND_URL=https://deploy.vercel.app/api)
20
+ * for server-side use.
21
+ * 2. Framework-prefixed versions with only the route prefix path
22
+ * (e.g., NEXT_PUBLIC_BACKEND_URL=/api, VITE_BACKEND_URL=/api) for client-side use.
23
+ * Using relative paths avoids CORS issues since the browser resolves them against
24
+ * the current origin, which works correctly across production domains, preview
25
+ * deployments, and custom domains.
23
26
  *
24
27
  * Environment variables that are already set in `currentEnv` will NOT be overwritten,
25
28
  * allowing user-defined values to take precedence.
@@ -57,14 +57,14 @@ function getServiceUrlEnvVars(options) {
57
57
  continue;
58
58
  }
59
59
  const baseEnvVarName = serviceNameToEnvVar(service.name);
60
- const url = computeServiceUrl(deploymentUrl, service.routePrefix);
60
+ const absoluteUrl = computeServiceUrl(deploymentUrl, service.routePrefix);
61
61
  if (!(baseEnvVarName in currentEnv)) {
62
- envVars[baseEnvVarName] = url;
62
+ envVars[baseEnvVarName] = absoluteUrl;
63
63
  }
64
64
  for (const prefix of frameworkPrefixes) {
65
65
  const prefixedEnvVarName = `${prefix}${baseEnvVarName}`;
66
66
  if (!(prefixedEnvVarName in currentEnv)) {
67
- envVars[prefixedEnvVarName] = url;
67
+ envVars[prefixedEnvVarName] = service.routePrefix;
68
68
  }
69
69
  }
70
70
  }
package/dist/index.js CHANGED
@@ -22679,6 +22679,7 @@ async function getLambdaOptionsFromFunction({
22679
22679
  architecture: fn.architecture,
22680
22680
  memory: fn.memory,
22681
22681
  maxDuration: fn.maxDuration,
22682
+ regions: fn.regions,
22682
22683
  experimentalTriggers: fn.experimentalTriggers,
22683
22684
  supportsCancellation: fn.supportsCancellation
22684
22685
  };
@@ -24396,14 +24397,14 @@ function getServiceUrlEnvVars(options) {
24396
24397
  continue;
24397
24398
  }
24398
24399
  const baseEnvVarName = serviceNameToEnvVar(service.name);
24399
- const url = computeServiceUrl(deploymentUrl, service.routePrefix);
24400
+ const absoluteUrl = computeServiceUrl(deploymentUrl, service.routePrefix);
24400
24401
  if (!(baseEnvVarName in currentEnv)) {
24401
- envVars[baseEnvVarName] = url;
24402
+ envVars[baseEnvVarName] = absoluteUrl;
24402
24403
  }
24403
24404
  for (const prefix of frameworkPrefixes) {
24404
24405
  const prefixedEnvVarName = `${prefix}${baseEnvVarName}`;
24405
24406
  if (!(prefixedEnvVarName in currentEnv)) {
24406
- envVars[prefixedEnvVarName] = url;
24407
+ envVars[prefixedEnvVarName] = service.routePrefix;
24407
24408
  }
24408
24409
  }
24409
24410
  }
@@ -24628,6 +24629,12 @@ var functionsSchema = {
24628
24629
  minimum: 1,
24629
24630
  maximum: 900
24630
24631
  },
24632
+ regions: {
24633
+ type: "array",
24634
+ items: {
24635
+ type: "string"
24636
+ }
24637
+ },
24631
24638
  includeFiles: {
24632
24639
  type: "string",
24633
24640
  maxLength: 256
package/dist/lambda.d.ts CHANGED
@@ -135,4 +135,4 @@ export declare class Lambda {
135
135
  */
136
136
  export declare function createLambda(opts: LambdaOptions): Promise<Lambda>;
137
137
  export declare function createZip(files: Files): Promise<Buffer>;
138
- export declare function getLambdaOptionsFromFunction({ sourceFile, config, }: GetLambdaOptionsFromFunctionOptions): Promise<Pick<LambdaOptions, 'architecture' | 'memory' | 'maxDuration' | 'experimentalTriggers' | 'supportsCancellation'>>;
138
+ export declare function getLambdaOptionsFromFunction({ sourceFile, config, }: GetLambdaOptionsFromFunctionOptions): Promise<Pick<LambdaOptions, 'architecture' | 'memory' | 'maxDuration' | 'regions' | 'experimentalTriggers' | 'supportsCancellation'>>;
package/dist/lambda.js CHANGED
@@ -322,6 +322,7 @@ async function getLambdaOptionsFromFunction({
322
322
  architecture: fn.architecture,
323
323
  memory: fn.memory,
324
324
  maxDuration: fn.maxDuration,
325
+ regions: fn.regions,
325
326
  experimentalTriggers: fn.experimentalTriggers,
326
327
  supportsCancellation: fn.supportsCancellation
327
328
  };
package/dist/schemas.d.ts CHANGED
@@ -25,6 +25,12 @@ export declare const functionsSchema: {
25
25
  minimum: number;
26
26
  maximum: number;
27
27
  };
28
+ regions: {
29
+ type: string;
30
+ items: {
31
+ type: string;
32
+ };
33
+ };
28
34
  includeFiles: {
29
35
  type: string;
30
36
  maxLength: number;
package/dist/schemas.js CHANGED
@@ -84,6 +84,12 @@ const functionsSchema = {
84
84
  minimum: 1,
85
85
  maximum: 900
86
86
  },
87
+ regions: {
88
+ type: "array",
89
+ items: {
90
+ type: "string"
91
+ }
92
+ },
87
93
  includeFiles: {
88
94
  type: "string",
89
95
  maxLength: 256
package/dist/types.d.ts CHANGED
@@ -103,6 +103,16 @@ export interface BuildOptions {
103
103
  * The current trace state from the internal vc tracing
104
104
  */
105
105
  span?: Span;
106
+ /**
107
+ * Service-specific options. Only present when the build is part of a
108
+ * multi-service project.
109
+ */
110
+ service?: {
111
+ /** URL path prefix where the service is mounted (e.g., "/api"). */
112
+ routePrefix?: string;
113
+ /** Workspace directory for this service, relative to the project root. */
114
+ workspace?: string;
115
+ };
106
116
  }
107
117
  export interface PrepareCacheOptions {
108
118
  /**
@@ -344,6 +354,7 @@ export interface BuilderFunctions {
344
354
  architecture?: LambdaArchitecture;
345
355
  memory?: number;
346
356
  maxDuration?: number;
357
+ regions?: string[];
347
358
  runtime?: string;
348
359
  includeFiles?: string;
349
360
  excludeFiles?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/build-utils",
3
- "version": "13.3.3",
3
+ "version": "13.3.5",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.js",
@@ -11,7 +11,7 @@
11
11
  "directory": "packages/now-build-utils"
12
12
  },
13
13
  "dependencies": {
14
- "@vercel/python-analysis": "0.3.2"
14
+ "@vercel/python-analysis": "0.4.0"
15
15
  },
16
16
  "devDependencies": {
17
17
  "@iarna/toml": "2.2.3",