@vercel/python 6.41.0 → 6.42.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.
Files changed (2) hide show
  1. package/dist/index.js +39 -2
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -3213,6 +3213,7 @@ var src_exports = {};
3213
3213
  __export(src_exports, {
3214
3214
  build: () => build,
3215
3215
  defaultShouldServe: () => defaultShouldServe,
3216
+ detectEntrypoint: () => detectEntrypoint,
3216
3217
  diagnostics: () => diagnostics,
3217
3218
  downloadFilesInWorkPath: () => downloadFilesInWorkPath,
3218
3219
  installRequirement: () => installRequirement,
@@ -3231,7 +3232,7 @@ var import_path13 = require("path");
3231
3232
 
3232
3233
  // src/package-versions.ts
3233
3234
  var VERCEL_RUNTIME_VERSION = "0.13.2";
3234
- var VERCEL_WORKERS_VERSION = "0.0.22";
3235
+ var VERCEL_WORKERS_VERSION = "0.0.23";
3235
3236
 
3236
3237
  // src/index.ts
3237
3238
  var import_build_utils16 = require("@vercel/build-utils");
@@ -5612,6 +5613,24 @@ async function detectPythonEntrypoint(framework, workPath, configuredEntrypoint,
5612
5613
  const error = makeDiagnosticError(framework, diagnostics2);
5613
5614
  return djangoManageBaseDir !== void 0 ? { baseDir: djangoManageBaseDir, error } : { error };
5614
5615
  }
5616
+ var detectEntrypoint = async ({
5617
+ workPath,
5618
+ framework
5619
+ }) => {
5620
+ if (!(0, import_build_utils7.isPythonFramework)(framework))
5621
+ return null;
5622
+ const detected = await detectPythonEntrypoint(
5623
+ framework,
5624
+ workPath
5625
+ );
5626
+ if (!detected?.entrypoint)
5627
+ return null;
5628
+ const { entrypoint, variableName } = detected.entrypoint;
5629
+ return {
5630
+ kind: "py-module:attr",
5631
+ entrypoint: `${entrypointToModule(entrypoint)}:${variableName}`
5632
+ };
5633
+ };
5615
5634
 
5616
5635
  // src/crons.ts
5617
5636
  var DYNAMIC_SCHEDULE = "<dynamic>";
@@ -7221,7 +7240,8 @@ var build = async ({
7221
7240
  meta = {},
7222
7241
  config,
7223
7242
  span: parentSpan,
7224
- service
7243
+ service,
7244
+ registerPreDeploy
7225
7245
  }) => {
7226
7246
  let entrypoint = rawEntrypoint === "<detect>" ? void 0 : rawEntrypoint;
7227
7247
  const builderSpan = parentSpan ?? new import_build_utils16.Span({ name: "vc.builder" });
@@ -7480,6 +7500,22 @@ var build = async ({
7480
7500
  if (quirksResult.buildEnv) {
7481
7501
  Object.assign(pythonEnv, quirksResult.buildEnv);
7482
7502
  }
7503
+ const preDeployCommand = config?.preDeployCommand;
7504
+ if (registerPreDeploy && typeof preDeployCommand === "string") {
7505
+ const capturedEnv = { ...pythonEnv };
7506
+ const capturedCwd = workPath;
7507
+ registerPreDeploy(async () => {
7508
+ await builderSpan.child(import_build_utils16.BUILDER_PRE_DEPLOY_STEP, {
7509
+ preDeployCommand
7510
+ }).trace(async () => {
7511
+ console.log(`Running pre-deploy command: \`${preDeployCommand}\``);
7512
+ await (0, import_build_utils16.execCommand)(preDeployCommand, {
7513
+ env: capturedEnv,
7514
+ cwd: capturedCwd
7515
+ });
7516
+ });
7517
+ });
7518
+ }
7483
7519
  (0, import_build_utils16.debug)("Entrypoint is", entrypoint);
7484
7520
  const moduleName = entrypointToModule(entrypoint);
7485
7521
  if (handlerFunction) {
@@ -7720,6 +7756,7 @@ function hasProp(obj, key) {
7720
7756
  0 && (module.exports = {
7721
7757
  build,
7722
7758
  defaultShouldServe,
7759
+ detectEntrypoint,
7723
7760
  diagnostics,
7724
7761
  downloadFilesInWorkPath,
7725
7762
  installRequirement,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/python",
3
- "version": "6.41.0",
3
+ "version": "6.42.0",
4
4
  "main": "./dist/index.js",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://vercel.com/docs/runtimes#official-runtimes/python",
@@ -34,9 +34,9 @@
34
34
  "smol-toml": "1.5.2",
35
35
  "vitest": "2.1.4",
36
36
  "which": "3.0.0",
37
- "@vercel/build-utils": "13.24.0",
38
- "@vercel/python-runtime": "0.13.2",
39
- "@vercel/error-utils": "2.1.0"
37
+ "@vercel/build-utils": "13.25.0",
38
+ "@vercel/error-utils": "2.1.0",
39
+ "@vercel/python-runtime": "0.13.2"
40
40
  },
41
41
  "scripts": {
42
42
  "build": "node ../../utils/build-builder.mjs",