@vercel/build-utils 13.6.2 → 13.7.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,25 @@
1
1
  # @vercel/build-utils
2
2
 
3
+ ## 13.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [python] add support for module-based entrypoints for cron jobs ([#15393](https://github.com/vercel/vercel/pull/15393))
8
+
9
+ - For the django frontend, dynamically load settings.py instead of parsing it ([#15367](https://github.com/vercel/vercel/pull/15367))
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies [[`83e804013528fc54de31082960ae31f58339bd71`](https://github.com/vercel/vercel/commit/83e804013528fc54de31082960ae31f58339bd71), [`921314f958c4ec85adb09e020310a5becb7f866c`](https://github.com/vercel/vercel/commit/921314f958c4ec85adb09e020310a5becb7f866c)]:
14
+ - @vercel/python-analysis@0.9.0
15
+
16
+ ## 13.6.3
17
+
18
+ ### Patch Changes
19
+
20
+ - Updated dependencies [[`d1c4d7052033aaf7b3f2044aa24484cb143b9348`](https://github.com/vercel/vercel/commit/d1c4d7052033aaf7b3f2044aa24484cb143b9348)]:
21
+ - @vercel/python-analysis@0.8.2
22
+
3
23
  ## 13.6.2
4
24
 
5
25
  ### 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
  }
package/dist/errors.js CHANGED
@@ -51,7 +51,7 @@ function getPrettyError(obj) {
51
51
  link: prop ? `${docsUrl}#${prop.toLowerCase()}` : docsUrl,
52
52
  action: "View Documentation"
53
53
  });
54
- } catch (e) {
54
+ } catch (_e) {
55
55
  return new NowBuildError({
56
56
  code: "INVALID_VERCEL_CONFIG",
57
57
  message: `Failed to validate configuration.`,
@@ -65,7 +65,7 @@ async function readConfigFile(files) {
65
65
  } else if (name.endsWith(".yaml") || name.endsWith(".yml")) {
66
66
  return import_js_yaml.default.safeLoad(str, { filename: name });
67
67
  }
68
- } catch (error) {
68
+ } catch (_error) {
69
69
  console.log(`Error while parsing config file: "${name}"`);
70
70
  }
71
71
  }
@@ -76,7 +76,7 @@ async function getPackageJson(dir) {
76
76
  const packagePath = (0, import_path.join)(dir, "package.json");
77
77
  try {
78
78
  return JSON.parse(await (0, import_fs_extra.readFile)(packagePath, "utf8"));
79
- } catch (err) {
79
+ } catch (_err) {
80
80
  return {};
81
81
  }
82
82
  }
@@ -394,7 +394,7 @@ async function checkTurboSupportsCorepack(turboVersionRange, rootDir) {
394
394
  if (turboConfigPath) {
395
395
  try {
396
396
  turboJson = import_json5.default.parse(await import_fs_extra.default.readFile(turboConfigPath, "utf8"));
397
- } catch (err) {
397
+ } catch (_err) {
398
398
  console.warn(
399
399
  `WARNING: Failed to parse ${import_path.default.basename(turboConfigPath)}`
400
400
  );
@@ -70,7 +70,7 @@ function generateNodeBuilderFunctions(frameworkName, regex, validFilenames, vali
70
70
  if (frameworkVersion) {
71
71
  version = frameworkVersion;
72
72
  }
73
- } catch (e) {
73
+ } catch (_e) {
74
74
  }
75
75
  res.output.framework = {
76
76
  slug: frameworkName,
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,
@@ -22189,7 +22187,7 @@ function getPrettyError(obj) {
22189
22187
  link: prop ? `${docsUrl}#${prop.toLowerCase()}` : docsUrl,
22190
22188
  action: "View Documentation"
22191
22189
  });
22192
- } catch (e) {
22190
+ } catch (_e) {
22193
22191
  return new NowBuildError({
22194
22192
  code: "INVALID_VERCEL_CONFIG",
22195
22193
  message: `Failed to validate configuration.`,
@@ -23262,7 +23260,7 @@ async function readConfigFile(files) {
23262
23260
  } else if (name.endsWith(".yaml") || name.endsWith(".yml")) {
23263
23261
  return import_js_yaml.default.safeLoad(str, { filename: name });
23264
23262
  }
23265
- } catch (error) {
23263
+ } catch (_error) {
23266
23264
  console.log(`Error while parsing config file: "${name}"`);
23267
23265
  }
23268
23266
  }
@@ -23273,20 +23271,20 @@ async function getPackageJson(dir) {
23273
23271
  const packagePath = (0, import_path5.join)(dir, "package.json");
23274
23272
  try {
23275
23273
  return JSON.parse(await (0, import_fs_extra6.readFile)(packagePath, "utf8"));
23276
- } catch (err) {
23274
+ } catch (_err) {
23277
23275
  return {};
23278
23276
  }
23279
23277
  }
23280
23278
 
23281
23279
  // src/clone-env.ts
23282
- var { hasOwnProperty: hasOwnProperty2 } = Object.prototype;
23280
+ var hasProp = Object.prototype.hasOwnProperty;
23283
23281
  function cloneEnv(...envs) {
23284
23282
  return envs.reduce((obj, env) => {
23285
23283
  if (env === void 0 || env === null) {
23286
23284
  return obj;
23287
23285
  }
23288
23286
  obj = Object.assign(obj, env);
23289
- if (hasOwnProperty2.call(env, "Path")) {
23287
+ if (hasProp.call(env, "Path")) {
23290
23288
  if (obj.Path !== void 0) {
23291
23289
  obj.PATH = obj.Path;
23292
23290
  }
@@ -23622,7 +23620,7 @@ async function checkTurboSupportsCorepack(turboVersionRange, rootDir) {
23622
23620
  if (turboConfigPath) {
23623
23621
  try {
23624
23622
  turboJson = import_json5.default.parse(await import_fs_extra7.default.readFile(turboConfigPath, "utf8"));
23625
- } catch (err) {
23623
+ } catch (_err) {
23626
23624
  console.warn(
23627
23625
  `WARNING: Failed to parse ${import_path6.default.basename(turboConfigPath)}`
23628
23626
  );
@@ -24647,16 +24645,16 @@ var shouldServe = ({
24647
24645
  }) => {
24648
24646
  requestPath = requestPath.replace(/\/$/, "");
24649
24647
  entrypoint = entrypoint.replace(/\\/, "/");
24650
- if (entrypoint === requestPath && hasProp(files, entrypoint)) {
24648
+ if (entrypoint === requestPath && hasProp2(files, entrypoint)) {
24651
24649
  return true;
24652
24650
  }
24653
24651
  const { dir, name } = (0, import_path10.parse)(entrypoint);
24654
- if (name === "index" && dir === requestPath && hasProp(files, entrypoint)) {
24652
+ if (name === "index" && dir === requestPath && hasProp2(files, entrypoint)) {
24655
24653
  return true;
24656
24654
  }
24657
24655
  return false;
24658
24656
  };
24659
- function hasProp(obj, key) {
24657
+ function hasProp2(obj, key) {
24660
24658
  return Object.hasOwnProperty.call(obj, key);
24661
24659
  }
24662
24660
 
@@ -24942,7 +24940,7 @@ function generateNodeBuilderFunctions(frameworkName, regex, validFilenames, vali
24942
24940
  if (frameworkVersion) {
24943
24941
  version = frameworkVersion;
24944
24942
  }
24945
- } catch (e) {
24943
+ } catch (_e) {
24946
24944
  }
24947
24945
  res.output.framework = {
24948
24946
  slug: frameworkName,
@@ -25123,7 +25121,6 @@ function shouldUseExperimentalBackends(framework) {
25123
25121
 
25124
25122
  // src/python.ts
25125
25123
  var import_fs3 = __toESM(require("fs"));
25126
- var import_path11 = require("path");
25127
25124
  var import_python_analysis = require("@vercel/python-analysis");
25128
25125
  async function isPythonEntrypoint(file) {
25129
25126
  try {
@@ -25137,55 +25134,6 @@ async function isPythonEntrypoint(file) {
25137
25134
  return false;
25138
25135
  }
25139
25136
  }
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
25137
  // Annotate the CommonJS export names for ESM import in node:
25190
25138
  0 && (module.exports = {
25191
25139
  BACKEND_BUILDERS,
@@ -25220,8 +25168,6 @@ async function getDjangoEntrypoint(workPath) {
25220
25168
  functionsSchema,
25221
25169
  generateNodeBuilderFunctions,
25222
25170
  getDiscontinuedNodeVersions,
25223
- getDjangoEntrypoint,
25224
- getDjangoSettingsModule,
25225
25171
  getEnvForPackageManager,
25226
25172
  getIgnoreFilter,
25227
25173
  getInstalledPackageVersion,
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/types.d.ts CHANGED
@@ -484,6 +484,7 @@ export interface Service {
484
484
  routePrefix?: string;
485
485
  routePrefixSource?: 'configured' | 'generated';
486
486
  schedule?: string;
487
+ handlerFunction?: string;
487
488
  topic?: string;
488
489
  consumer?: string;
489
490
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/build-utils",
3
- "version": "13.6.2",
3
+ "version": "13.7.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.1"
14
+ "@vercel/python-analysis": "0.9.0"
15
15
  },
16
16
  "devDependencies": {
17
17
  "@iarna/toml": "2.2.3",
@@ -51,7 +51,7 @@
51
51
  "vitest": "2.0.1",
52
52
  "json5": "2.2.3",
53
53
  "@vercel/error-utils": "2.0.3",
54
- "@vercel/routing-utils": "6.0.1"
54
+ "@vercel/routing-utils": "6.0.2"
55
55
  },
56
56
  "scripts": {
57
57
  "build": "node build.mjs",