@vercel/build-utils 13.6.3 → 13.8.0

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,41 @@
1
1
  # @vercel/build-utils
2
2
 
3
+ ## 13.8.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Support `maxDuration: 'max'` to allow the backend to resolve the maximum duration based on account plan type ([#15217](https://github.com/vercel/vercel/pull/15217))
8
+
9
+ ### Patch Changes
10
+
11
+ - Fix EEXIST error when using `--standalone` flag in monorepos by handling pre-existing symlinks in the shared output directory. ([#15322](https://github.com/vercel/vercel/pull/15322))
12
+
13
+ ## 13.7.2
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies [[`a67131396956632b060895afe44b26bb99941817`](https://github.com/vercel/vercel/commit/a67131396956632b060895afe44b26bb99941817)]:
18
+ - @vercel/python-analysis@0.9.1
19
+
20
+ ## 13.7.1
21
+
22
+ ### Patch Changes
23
+
24
+ - [services] adds support for subdomai configuration in experimentalServices ([#15401](https://github.com/vercel/vercel/pull/15401))
25
+
26
+ ## 13.7.0
27
+
28
+ ### Minor Changes
29
+
30
+ - [python] add support for module-based entrypoints for cron jobs ([#15393](https://github.com/vercel/vercel/pull/15393))
31
+
32
+ - For the django frontend, dynamically load settings.py instead of parsing it ([#15367](https://github.com/vercel/vercel/pull/15367))
33
+
34
+ ### Patch Changes
35
+
36
+ - Updated dependencies [[`83e804013528fc54de31082960ae31f58339bd71`](https://github.com/vercel/vercel/commit/83e804013528fc54de31082960ae31f58339bd71), [`921314f958c4ec85adb09e020310a5becb7f866c`](https://github.com/vercel/vercel/commit/921314f958c4ec85adb09e020310a5becb7f866c)]:
37
+ - @vercel/python-analysis@0.9.0
38
+
3
39
  ## 13.6.3
4
40
 
5
41
  ### Patch Changes
package/dist/clone-env.js CHANGED
@@ -21,14 +21,14 @@ __export(clone_env_exports, {
21
21
  cloneEnv: () => cloneEnv
22
22
  });
23
23
  module.exports = __toCommonJS(clone_env_exports);
24
- const { hasOwnProperty } = Object.prototype;
24
+ const hasProp = Object.prototype.hasOwnProperty;
25
25
  function cloneEnv(...envs) {
26
26
  return envs.reduce((obj, env) => {
27
27
  if (env === void 0 || env === null) {
28
28
  return obj;
29
29
  }
30
30
  obj = Object.assign(obj, env);
31
- if (hasOwnProperty.call(env, "Path")) {
31
+ if (hasProp.call(env, "Path")) {
32
32
  if (obj.Path !== void 0) {
33
33
  obj.PATH = obj.Path;
34
34
  }
@@ -75,7 +75,19 @@ async function downloadFile(file, fsPath) {
75
75
  }
76
76
  if (isSymbolicLink(mode)) {
77
77
  const target = await prepareSymlinkTarget(file, fsPath);
78
- await (0, import_fs_extra.symlink)(target, fsPath);
78
+ try {
79
+ await (0, import_fs_extra.symlink)(target, fsPath);
80
+ } catch (err) {
81
+ if (err.code === "EEXIST") {
82
+ const existingTarget = await (0, import_fs_extra.readlink)(fsPath);
83
+ if (existingTarget !== target) {
84
+ await (0, import_fs_extra.remove)(fsPath);
85
+ await (0, import_fs_extra.symlink)(target, fsPath);
86
+ }
87
+ } else {
88
+ throw err;
89
+ }
90
+ }
79
91
  return import_file_fs_ref.default.fromFsPath({ mode, fsPath });
80
92
  }
81
93
  const stream = file.toStream();
package/dist/index.js CHANGED
@@ -318,7 +318,7 @@ var require_BufferList = __commonJS({
318
318
  this.head = this.tail = null;
319
319
  this.length = 0;
320
320
  };
321
- BufferList.prototype.join = function join6(s) {
321
+ BufferList.prototype.join = function join5(s) {
322
322
  if (this.length === 0)
323
323
  return "";
324
324
  var p = this.head;
@@ -21849,8 +21849,6 @@ __export(src_exports, {
21849
21849
  functionsSchema: () => functionsSchema,
21850
21850
  generateNodeBuilderFunctions: () => generateNodeBuilderFunctions,
21851
21851
  getDiscontinuedNodeVersions: () => getDiscontinuedNodeVersions,
21852
- getDjangoEntrypoint: () => getDjangoEntrypoint,
21853
- getDjangoSettingsModule: () => getDjangoSettingsModule,
21854
21852
  getEnvForPackageManager: () => getEnvForPackageManager,
21855
21853
  getIgnoreFilter: () => get_ignore_filter_default,
21856
21854
  getInstalledPackageVersion: () => getInstalledPackageVersion,
@@ -22348,7 +22346,19 @@ async function downloadFile(file, fsPath) {
22348
22346
  }
22349
22347
  if (isSymbolicLink(mode)) {
22350
22348
  const target = await prepareSymlinkTarget(file, fsPath);
22351
- await (0, import_fs_extra2.symlink)(target, fsPath);
22349
+ try {
22350
+ await (0, import_fs_extra2.symlink)(target, fsPath);
22351
+ } catch (err) {
22352
+ if (err.code === "EEXIST") {
22353
+ const existingTarget = await (0, import_fs_extra2.readlink)(fsPath);
22354
+ if (existingTarget !== target) {
22355
+ await (0, import_fs_extra2.remove)(fsPath);
22356
+ await (0, import_fs_extra2.symlink)(target, fsPath);
22357
+ }
22358
+ } else {
22359
+ throw err;
22360
+ }
22361
+ }
22352
22362
  return file_fs_ref_default.fromFsPath({ mode, fsPath });
22353
22363
  }
22354
22364
  const stream = file.toStream();
@@ -22488,7 +22498,10 @@ var Lambda = class {
22488
22498
  (0, import_assert4.default)(typeof memory === "number", '"memory" is not a number');
22489
22499
  }
22490
22500
  if (maxDuration !== void 0) {
22491
- (0, import_assert4.default)(typeof maxDuration === "number", '"maxDuration" is not a number');
22501
+ (0, import_assert4.default)(
22502
+ typeof maxDuration === "number" || maxDuration === "max",
22503
+ '"maxDuration" is not a number or "max"'
22504
+ );
22492
22505
  }
22493
22506
  if (allowQuery !== void 0) {
22494
22507
  (0, import_assert4.default)(Array.isArray(allowQuery), '"allowQuery" is not an Array');
@@ -23279,14 +23292,14 @@ async function getPackageJson(dir) {
23279
23292
  }
23280
23293
 
23281
23294
  // src/clone-env.ts
23282
- var { hasOwnProperty: hasOwnProperty2 } = Object.prototype;
23295
+ var hasProp = Object.prototype.hasOwnProperty;
23283
23296
  function cloneEnv(...envs) {
23284
23297
  return envs.reduce((obj, env) => {
23285
23298
  if (env === void 0 || env === null) {
23286
23299
  return obj;
23287
23300
  }
23288
23301
  obj = Object.assign(obj, env);
23289
- if (hasOwnProperty2.call(env, "Path")) {
23302
+ if (hasProp.call(env, "Path")) {
23290
23303
  if (obj.Path !== void 0) {
23291
23304
  obj.PATH = obj.Path;
23292
23305
  }
@@ -24647,16 +24660,16 @@ var shouldServe = ({
24647
24660
  }) => {
24648
24661
  requestPath = requestPath.replace(/\/$/, "");
24649
24662
  entrypoint = entrypoint.replace(/\\/, "/");
24650
- if (entrypoint === requestPath && hasProp(files, entrypoint)) {
24663
+ if (entrypoint === requestPath && hasProp2(files, entrypoint)) {
24651
24664
  return true;
24652
24665
  }
24653
24666
  const { dir, name } = (0, import_path10.parse)(entrypoint);
24654
- if (name === "index" && dir === requestPath && hasProp(files, entrypoint)) {
24667
+ if (name === "index" && dir === requestPath && hasProp2(files, entrypoint)) {
24655
24668
  return true;
24656
24669
  }
24657
24670
  return false;
24658
24671
  };
24659
- function hasProp(obj, key) {
24672
+ function hasProp2(obj, key) {
24660
24673
  return Object.hasOwnProperty.call(obj, key);
24661
24674
  }
24662
24675
 
@@ -24753,9 +24766,10 @@ var functionsSchema = {
24753
24766
  maximum: 10240
24754
24767
  },
24755
24768
  maxDuration: {
24756
- type: "number",
24757
- minimum: 1,
24758
- maximum: 900
24769
+ oneOf: [
24770
+ { type: "integer", minimum: 1, maximum: 900 },
24771
+ { type: "string", enum: ["max"] }
24772
+ ]
24759
24773
  },
24760
24774
  regions: {
24761
24775
  type: "array",
@@ -25123,7 +25137,6 @@ function shouldUseExperimentalBackends(framework) {
25123
25137
 
25124
25138
  // src/python.ts
25125
25139
  var import_fs3 = __toESM(require("fs"));
25126
- var import_path11 = require("path");
25127
25140
  var import_python_analysis = require("@vercel/python-analysis");
25128
25141
  async function isPythonEntrypoint(file) {
25129
25142
  try {
@@ -25137,55 +25150,6 @@ async function isPythonEntrypoint(file) {
25137
25150
  return false;
25138
25151
  }
25139
25152
  }
25140
- async function getDjangoSettingsModule(workPath) {
25141
- const managePath = (0, import_path11.join)(workPath, "manage.py");
25142
- try {
25143
- const content = await import_fs3.default.promises.readFile(managePath, "utf-8");
25144
- const value = await (0, import_python_analysis.parseDjangoSettingsModule)(content);
25145
- if (value) {
25146
- debug(`Django DJANGO_SETTINGS_MODULE from manage.py: ${value}`);
25147
- return value;
25148
- }
25149
- } catch {
25150
- debug("manage.py not found or unreadable, skipping Django settings module");
25151
- }
25152
- return null;
25153
- }
25154
- async function getDjangoEntrypoint(workPath) {
25155
- const settingsModule = await getDjangoSettingsModule(workPath);
25156
- if (!settingsModule)
25157
- return null;
25158
- const settingsPath = (0, import_path11.join)(
25159
- workPath,
25160
- `${settingsModule.replace(/\./g, "/")}.py`
25161
- );
25162
- try {
25163
- const settingsContent = await import_fs3.default.promises.readFile(settingsPath, "utf-8");
25164
- const asgiApplication = await (0, import_python_analysis.getStringConstant)(
25165
- settingsContent,
25166
- "ASGI_APPLICATION"
25167
- );
25168
- if (asgiApplication) {
25169
- const modulePath = asgiApplication.split(".").slice(0, -1).join("/");
25170
- const asgiPath = `${modulePath}.py`;
25171
- debug(`Django ASGI entrypoint from ${settingsModule}: ${asgiPath}`);
25172
- return asgiPath;
25173
- }
25174
- const wsgiApplication = await (0, import_python_analysis.getStringConstant)(
25175
- settingsContent,
25176
- "WSGI_APPLICATION"
25177
- );
25178
- if (wsgiApplication) {
25179
- const modulePath = wsgiApplication.split(".").slice(0, -1).join("/");
25180
- const wsgiPath = `${modulePath}.py`;
25181
- debug(`Django WSGI entrypoint from ${settingsModule}: ${wsgiPath}`);
25182
- return wsgiPath;
25183
- }
25184
- } catch {
25185
- debug(`Failed to read or parse settings file: ${settingsPath}`);
25186
- }
25187
- return null;
25188
- }
25189
25153
  // Annotate the CommonJS export names for ESM import in node:
25190
25154
  0 && (module.exports = {
25191
25155
  BACKEND_BUILDERS,
@@ -25220,8 +25184,6 @@ async function getDjangoEntrypoint(workPath) {
25220
25184
  functionsSchema,
25221
25185
  generateNodeBuilderFunctions,
25222
25186
  getDiscontinuedNodeVersions,
25223
- getDjangoEntrypoint,
25224
- getDjangoSettingsModule,
25225
25187
  getEnvForPackageManager,
25226
25188
  getIgnoreFilter,
25227
25189
  getInstalledPackageVersion,
package/dist/lambda.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /// <reference types="node" />
2
- import type { Config, Env, Files, FunctionFramework, TriggerEvent, TriggerEventInput } from './types';
2
+ import type { Config, Env, Files, FunctionFramework, MaxDuration, TriggerEvent, TriggerEventInput } from './types';
3
3
  export type { TriggerEvent, TriggerEventInput };
4
4
  /**
5
5
  * Encodes a function path into a valid consumer name using mnemonic escapes.
@@ -27,7 +27,7 @@ export interface LambdaOptionsBase {
27
27
  runtimeLanguage?: LambdaExecutableRuntimeLanguages;
28
28
  architecture?: LambdaArchitecture;
29
29
  memory?: number;
30
- maxDuration?: number;
30
+ maxDuration?: MaxDuration;
31
31
  environment?: Env;
32
32
  allowQuery?: string[];
33
33
  regions?: string[];
@@ -102,7 +102,7 @@ export declare class Lambda {
102
102
  runtimeLanguage?: LambdaExecutableRuntimeLanguages;
103
103
  architecture: LambdaArchitecture;
104
104
  memory?: number;
105
- maxDuration?: number;
105
+ maxDuration?: MaxDuration;
106
106
  environment: Env;
107
107
  allowQuery?: string[];
108
108
  regions?: string[];
package/dist/lambda.js CHANGED
@@ -127,7 +127,10 @@ class Lambda {
127
127
  (0, import_assert.default)(typeof memory === "number", '"memory" is not a number');
128
128
  }
129
129
  if (maxDuration !== void 0) {
130
- (0, import_assert.default)(typeof maxDuration === "number", '"maxDuration" is not a number');
130
+ (0, import_assert.default)(
131
+ typeof maxDuration === "number" || maxDuration === "max",
132
+ '"maxDuration" is not a number or "max"'
133
+ );
131
134
  }
132
135
  if (allowQuery !== void 0) {
133
136
  (0, import_assert.default)(Array.isArray(allowQuery), '"allowQuery" is not an Array');
package/dist/python.d.ts CHANGED
@@ -8,16 +8,3 @@ import FileFsRef from './file-fs-ref';
8
8
  export declare function isPythonEntrypoint(file: FileFsRef | {
9
9
  fsPath?: string;
10
10
  }): Promise<boolean>;
11
- /**
12
- * For Django projects: read manage.py if present and return the value set for
13
- * DJANGO_SETTINGS_MODULE (e.g. from os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'app.settings')).
14
- * Returns null if manage.py is missing or the pattern is not found.
15
- */
16
- export declare function getDjangoSettingsModule(workPath: string): Promise<string | null>;
17
- /**
18
- * For Django projects: resolve the ASGI or WSGI application entrypoint by reading
19
- * DJANGO_SETTINGS_MODULE from manage.py, loading that settings file, and
20
- * returning the file path for ASGI_APPLICATION or WSGI_APPLICATION (e.g.
21
- * 'myapp.asgi.application' -> 'myapp/asgi.py'). Returns null if any step fails.
22
- */
23
- export declare function getDjangoEntrypoint(workPath: string): Promise<string | null>;
package/dist/python.js CHANGED
@@ -28,13 +28,10 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
  var python_exports = {};
30
30
  __export(python_exports, {
31
- getDjangoEntrypoint: () => getDjangoEntrypoint,
32
- getDjangoSettingsModule: () => getDjangoSettingsModule,
33
31
  isPythonEntrypoint: () => isPythonEntrypoint
34
32
  });
35
33
  module.exports = __toCommonJS(python_exports);
36
34
  var import_fs = __toESM(require("fs"));
37
- var import_path = require("path");
38
35
  var import_python_analysis = require("@vercel/python-analysis");
39
36
  var import_debug = __toESM(require("./debug"));
40
37
  async function isPythonEntrypoint(file) {
@@ -49,58 +46,7 @@ async function isPythonEntrypoint(file) {
49
46
  return false;
50
47
  }
51
48
  }
52
- async function getDjangoSettingsModule(workPath) {
53
- const managePath = (0, import_path.join)(workPath, "manage.py");
54
- try {
55
- const content = await import_fs.default.promises.readFile(managePath, "utf-8");
56
- const value = await (0, import_python_analysis.parseDjangoSettingsModule)(content);
57
- if (value) {
58
- (0, import_debug.default)(`Django DJANGO_SETTINGS_MODULE from manage.py: ${value}`);
59
- return value;
60
- }
61
- } catch {
62
- (0, import_debug.default)("manage.py not found or unreadable, skipping Django settings module");
63
- }
64
- return null;
65
- }
66
- async function getDjangoEntrypoint(workPath) {
67
- const settingsModule = await getDjangoSettingsModule(workPath);
68
- if (!settingsModule)
69
- return null;
70
- const settingsPath = (0, import_path.join)(
71
- workPath,
72
- `${settingsModule.replace(/\./g, "/")}.py`
73
- );
74
- try {
75
- const settingsContent = await import_fs.default.promises.readFile(settingsPath, "utf-8");
76
- const asgiApplication = await (0, import_python_analysis.getStringConstant)(
77
- settingsContent,
78
- "ASGI_APPLICATION"
79
- );
80
- if (asgiApplication) {
81
- const modulePath = asgiApplication.split(".").slice(0, -1).join("/");
82
- const asgiPath = `${modulePath}.py`;
83
- (0, import_debug.default)(`Django ASGI entrypoint from ${settingsModule}: ${asgiPath}`);
84
- return asgiPath;
85
- }
86
- const wsgiApplication = await (0, import_python_analysis.getStringConstant)(
87
- settingsContent,
88
- "WSGI_APPLICATION"
89
- );
90
- if (wsgiApplication) {
91
- const modulePath = wsgiApplication.split(".").slice(0, -1).join("/");
92
- const wsgiPath = `${modulePath}.py`;
93
- (0, import_debug.default)(`Django WSGI entrypoint from ${settingsModule}: ${wsgiPath}`);
94
- return wsgiPath;
95
- }
96
- } catch {
97
- (0, import_debug.default)(`Failed to read or parse settings file: ${settingsPath}`);
98
- }
99
- return null;
100
- }
101
49
  // Annotate the CommonJS export names for ESM import in node:
102
50
  0 && (module.exports = {
103
- getDjangoEntrypoint,
104
- getDjangoSettingsModule,
105
51
  isPythonEntrypoint
106
52
  });
package/dist/schemas.d.ts CHANGED
@@ -21,9 +21,17 @@ export declare const functionsSchema: {
21
21
  maximum: number;
22
22
  };
23
23
  maxDuration: {
24
- type: string;
25
- minimum: number;
26
- maximum: number;
24
+ oneOf: ({
25
+ type: string;
26
+ minimum: number;
27
+ maximum: number;
28
+ enum?: undefined;
29
+ } | {
30
+ type: string;
31
+ enum: string[];
32
+ minimum?: undefined;
33
+ maximum?: undefined;
34
+ })[];
27
35
  };
28
36
  regions: {
29
37
  type: string;
package/dist/schemas.js CHANGED
@@ -114,9 +114,10 @@ const functionsSchema = {
114
114
  maximum: 10240
115
115
  },
116
116
  maxDuration: {
117
- type: "number",
118
- minimum: 1,
119
- maximum: 900
117
+ oneOf: [
118
+ { type: "integer", minimum: 1, maximum: 900 },
119
+ { type: "string", enum: ["max"] }
120
+ ]
120
121
  },
121
122
  regions: {
122
123
  type: "array",
package/dist/types.d.ts CHANGED
@@ -110,6 +110,8 @@ export interface BuildOptions {
110
110
  service?: {
111
111
  /** URL path prefix where the service is mounted (e.g., "/api"). */
112
112
  routePrefix?: string;
113
+ /** Optional subdomain this service is mounted on (e.g., "api"). */
114
+ subdomain?: string;
113
115
  /** Workspace directory for this service, relative to the project root. */
114
116
  workspace?: string;
115
117
  };
@@ -349,11 +351,12 @@ export interface Builder {
349
351
  src?: string;
350
352
  config?: Config;
351
353
  }
354
+ export type MaxDuration = number | 'max';
352
355
  export interface BuilderFunctions {
353
356
  [key: string]: {
354
357
  architecture?: LambdaArchitecture;
355
358
  memory?: number;
356
- maxDuration?: number;
359
+ maxDuration?: MaxDuration;
357
360
  regions?: string[];
358
361
  functionFailoverRegions?: string[];
359
362
  runtime?: string;
@@ -483,7 +486,9 @@ export interface Service {
483
486
  installCommand?: string;
484
487
  routePrefix?: string;
485
488
  routePrefixSource?: 'configured' | 'generated';
489
+ subdomain?: string;
486
490
  schedule?: string;
491
+ handlerFunction?: string;
487
492
  topic?: string;
488
493
  consumer?: string;
489
494
  }
@@ -648,11 +653,13 @@ export interface ExperimentalServiceConfig {
648
653
  installCommand?: string;
649
654
  /** Lambda config */
650
655
  memory?: number;
651
- maxDuration?: number;
656
+ maxDuration?: MaxDuration;
652
657
  includeFiles?: string | string[];
653
658
  excludeFiles?: string | string[];
654
659
  /** URL prefix for routing */
655
660
  routePrefix?: string;
661
+ /** Subdomain this service should respond to (web services only). */
662
+ subdomain?: string;
656
663
  /** Cron schedule expression (e.g., "0 0 * * *") */
657
664
  schedule?: string;
658
665
  topic?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/build-utils",
3
- "version": "13.6.3",
3
+ "version": "13.8.0",
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.8.2"
14
+ "@vercel/python-analysis": "0.9.1"
15
15
  },
16
16
  "devDependencies": {
17
17
  "@iarna/toml": "2.2.3",