@vercel/build-utils 13.6.3 → 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,18 @@
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
+
3
16
  ## 13.6.3
4
17
 
5
18
  ### 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/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,
@@ -23279,14 +23277,14 @@ async function getPackageJson(dir) {
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
  }
@@ -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
 
@@ -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.3",
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.2"
14
+ "@vercel/python-analysis": "0.9.0"
15
15
  },
16
16
  "devDependencies": {
17
17
  "@iarna/toml": "2.2.3",