@vercel/python 6.18.0 → 6.18.1

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 +211 -148
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -48,7 +48,7 @@ var require_windows = __commonJS({
48
48
  "../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js"(exports, module2) {
49
49
  module2.exports = isexe;
50
50
  isexe.sync = sync;
51
- var fs7 = require("fs");
51
+ var fs8 = require("fs");
52
52
  function checkPathExt(path, options) {
53
53
  var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
54
54
  if (!pathext) {
@@ -73,12 +73,12 @@ var require_windows = __commonJS({
73
73
  return checkPathExt(path, options);
74
74
  }
75
75
  function isexe(path, options, cb) {
76
- fs7.stat(path, function(er, stat) {
76
+ fs8.stat(path, function(er, stat) {
77
77
  cb(er, er ? false : checkStat(stat, path, options));
78
78
  });
79
79
  }
80
80
  function sync(path, options) {
81
- return checkStat(fs7.statSync(path), path, options);
81
+ return checkStat(fs8.statSync(path), path, options);
82
82
  }
83
83
  }
84
84
  });
@@ -88,14 +88,14 @@ var require_mode = __commonJS({
88
88
  "../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js"(exports, module2) {
89
89
  module2.exports = isexe;
90
90
  isexe.sync = sync;
91
- var fs7 = require("fs");
91
+ var fs8 = require("fs");
92
92
  function isexe(path, options, cb) {
93
- fs7.stat(path, function(er, stat) {
93
+ fs8.stat(path, function(er, stat) {
94
94
  cb(er, er ? false : checkStat(stat, options));
95
95
  });
96
96
  }
97
97
  function sync(path, options) {
98
- return checkStat(fs7.statSync(path), options);
98
+ return checkStat(fs8.statSync(path), options);
99
99
  }
100
100
  function checkStat(stat, options) {
101
101
  return stat.isFile() && checkMode(stat, options);
@@ -119,7 +119,7 @@ var require_mode = __commonJS({
119
119
  // ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js
120
120
  var require_isexe = __commonJS({
121
121
  "../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js"(exports, module2) {
122
- var fs7 = require("fs");
122
+ var fs8 = require("fs");
123
123
  var core;
124
124
  if (process.platform === "win32" || global.TESTING_WINDOWS) {
125
125
  core = require_windows();
@@ -395,7 +395,7 @@ var require_shebang_command = __commonJS({
395
395
  var require_readShebang = __commonJS({
396
396
  "../../node_modules/.pnpm/cross-spawn@6.0.5/node_modules/cross-spawn/lib/util/readShebang.js"(exports, module2) {
397
397
  "use strict";
398
- var fs7 = require("fs");
398
+ var fs8 = require("fs");
399
399
  var shebangCommand = require_shebang_command();
400
400
  function readShebang(command) {
401
401
  const size = 150;
@@ -408,9 +408,9 @@ var require_readShebang = __commonJS({
408
408
  }
409
409
  let fd;
410
410
  try {
411
- fd = fs7.openSync(command, "r");
412
- fs7.readSync(fd, buffer, 0, size, 0);
413
- fs7.closeSync(fd);
411
+ fd = fs8.openSync(command, "r");
412
+ fs8.readSync(fd, buffer, 0, size, 0);
413
+ fs8.closeSync(fd);
414
414
  } catch (e) {
415
415
  }
416
416
  return shebangCommand(buffer.toString());
@@ -423,15 +423,15 @@ var require_readShebang = __commonJS({
423
423
  var require_semver = __commonJS({
424
424
  "../../node_modules/.pnpm/semver@5.7.2/node_modules/semver/semver.js"(exports, module2) {
425
425
  exports = module2.exports = SemVer;
426
- var debug9;
426
+ var debug10;
427
427
  if (typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG)) {
428
- debug9 = function() {
428
+ debug10 = function() {
429
429
  var args = Array.prototype.slice.call(arguments, 0);
430
430
  args.unshift("SEMVER");
431
431
  console.log.apply(console, args);
432
432
  };
433
433
  } else {
434
- debug9 = function() {
434
+ debug10 = function() {
435
435
  };
436
436
  }
437
437
  exports.SEMVER_SPEC_VERSION = "2.0.0";
@@ -540,7 +540,7 @@ var require_semver = __commonJS({
540
540
  var STAR = R++;
541
541
  src[STAR] = "(<|>)?=?\\s*\\*";
542
542
  for (i = 0; i < R; i++) {
543
- debug9(i, src[i]);
543
+ debug10(i, src[i]);
544
544
  if (!re[i]) {
545
545
  re[i] = new RegExp(src[i]);
546
546
  safeRe[i] = new RegExp(makeSafeRe(src[i]));
@@ -607,7 +607,7 @@ var require_semver = __commonJS({
607
607
  if (!(this instanceof SemVer)) {
608
608
  return new SemVer(version2, options);
609
609
  }
610
- debug9("SemVer", version2, options);
610
+ debug10("SemVer", version2, options);
611
611
  this.options = options;
612
612
  this.loose = !!options.loose;
613
613
  var m = version2.trim().match(options.loose ? safeRe[LOOSE] : safeRe[FULL]);
@@ -654,7 +654,7 @@ var require_semver = __commonJS({
654
654
  return this.version;
655
655
  };
656
656
  SemVer.prototype.compare = function(other) {
657
- debug9("SemVer.compare", this.version, this.options, other);
657
+ debug10("SemVer.compare", this.version, this.options, other);
658
658
  if (!(other instanceof SemVer)) {
659
659
  other = new SemVer(other, this.options);
660
660
  }
@@ -681,7 +681,7 @@ var require_semver = __commonJS({
681
681
  do {
682
682
  var a = this.prerelease[i2];
683
683
  var b = other.prerelease[i2];
684
- debug9("prerelease compare", i2, a, b);
684
+ debug10("prerelease compare", i2, a, b);
685
685
  if (a === void 0 && b === void 0) {
686
686
  return 0;
687
687
  } else if (b === void 0) {
@@ -935,7 +935,7 @@ var require_semver = __commonJS({
935
935
  return new Comparator(comp, options);
936
936
  }
937
937
  comp = comp.trim().split(/\s+/).join(" ");
938
- debug9("comparator", comp, options);
938
+ debug10("comparator", comp, options);
939
939
  this.options = options;
940
940
  this.loose = !!options.loose;
941
941
  this.parse(comp);
@@ -944,7 +944,7 @@ var require_semver = __commonJS({
944
944
  } else {
945
945
  this.value = this.operator + this.semver.version;
946
946
  }
947
- debug9("comp", this);
947
+ debug10("comp", this);
948
948
  }
949
949
  var ANY = {};
950
950
  Comparator.prototype.parse = function(comp) {
@@ -967,7 +967,7 @@ var require_semver = __commonJS({
967
967
  return this.value;
968
968
  };
969
969
  Comparator.prototype.test = function(version2) {
970
- debug9("Comparator.test", version2, this.options.loose);
970
+ debug10("Comparator.test", version2, this.options.loose);
971
971
  if (this.semver === ANY) {
972
972
  return true;
973
973
  }
@@ -1050,9 +1050,9 @@ var require_semver = __commonJS({
1050
1050
  var loose = this.options.loose;
1051
1051
  var hr = loose ? safeRe[HYPHENRANGELOOSE] : safeRe[HYPHENRANGE];
1052
1052
  range = range.replace(hr, hyphenReplace);
1053
- debug9("hyphen replace", range);
1053
+ debug10("hyphen replace", range);
1054
1054
  range = range.replace(safeRe[COMPARATORTRIM], comparatorTrimReplace);
1055
- debug9("comparator trim", range, safeRe[COMPARATORTRIM]);
1055
+ debug10("comparator trim", range, safeRe[COMPARATORTRIM]);
1056
1056
  range = range.replace(safeRe[TILDETRIM], tildeTrimReplace);
1057
1057
  range = range.replace(safeRe[CARETTRIM], caretTrimReplace);
1058
1058
  var compRe = loose ? safeRe[COMPARATORLOOSE] : safeRe[COMPARATOR];
@@ -1092,15 +1092,15 @@ var require_semver = __commonJS({
1092
1092
  });
1093
1093
  }
1094
1094
  function parseComparator(comp, options) {
1095
- debug9("comp", comp, options);
1095
+ debug10("comp", comp, options);
1096
1096
  comp = replaceCarets(comp, options);
1097
- debug9("caret", comp);
1097
+ debug10("caret", comp);
1098
1098
  comp = replaceTildes(comp, options);
1099
- debug9("tildes", comp);
1099
+ debug10("tildes", comp);
1100
1100
  comp = replaceXRanges(comp, options);
1101
- debug9("xrange", comp);
1101
+ debug10("xrange", comp);
1102
1102
  comp = replaceStars(comp, options);
1103
- debug9("stars", comp);
1103
+ debug10("stars", comp);
1104
1104
  return comp;
1105
1105
  }
1106
1106
  function isX(id) {
@@ -1114,7 +1114,7 @@ var require_semver = __commonJS({
1114
1114
  function replaceTilde(comp, options) {
1115
1115
  var r = options.loose ? safeRe[TILDELOOSE] : safeRe[TILDE];
1116
1116
  return comp.replace(r, function(_, M, m, p, pr) {
1117
- debug9("tilde", comp, _, M, m, p, pr);
1117
+ debug10("tilde", comp, _, M, m, p, pr);
1118
1118
  var ret;
1119
1119
  if (isX(M)) {
1120
1120
  ret = "";
@@ -1123,12 +1123,12 @@ var require_semver = __commonJS({
1123
1123
  } else if (isX(p)) {
1124
1124
  ret = ">=" + M + "." + m + ".0 <" + M + "." + (+m + 1) + ".0";
1125
1125
  } else if (pr) {
1126
- debug9("replaceTilde pr", pr);
1126
+ debug10("replaceTilde pr", pr);
1127
1127
  ret = ">=" + M + "." + m + "." + p + "-" + pr + " <" + M + "." + (+m + 1) + ".0";
1128
1128
  } else {
1129
1129
  ret = ">=" + M + "." + m + "." + p + " <" + M + "." + (+m + 1) + ".0";
1130
1130
  }
1131
- debug9("tilde return", ret);
1131
+ debug10("tilde return", ret);
1132
1132
  return ret;
1133
1133
  });
1134
1134
  }
@@ -1138,10 +1138,10 @@ var require_semver = __commonJS({
1138
1138
  }).join(" ");
1139
1139
  }
1140
1140
  function replaceCaret(comp, options) {
1141
- debug9("caret", comp, options);
1141
+ debug10("caret", comp, options);
1142
1142
  var r = options.loose ? safeRe[CARETLOOSE] : safeRe[CARET];
1143
1143
  return comp.replace(r, function(_, M, m, p, pr) {
1144
- debug9("caret", comp, _, M, m, p, pr);
1144
+ debug10("caret", comp, _, M, m, p, pr);
1145
1145
  var ret;
1146
1146
  if (isX(M)) {
1147
1147
  ret = "";
@@ -1154,7 +1154,7 @@ var require_semver = __commonJS({
1154
1154
  ret = ">=" + M + "." + m + ".0 <" + (+M + 1) + ".0.0";
1155
1155
  }
1156
1156
  } else if (pr) {
1157
- debug9("replaceCaret pr", pr);
1157
+ debug10("replaceCaret pr", pr);
1158
1158
  if (M === "0") {
1159
1159
  if (m === "0") {
1160
1160
  ret = ">=" + M + "." + m + "." + p + "-" + pr + " <" + M + "." + m + "." + (+p + 1);
@@ -1165,7 +1165,7 @@ var require_semver = __commonJS({
1165
1165
  ret = ">=" + M + "." + m + "." + p + "-" + pr + " <" + (+M + 1) + ".0.0";
1166
1166
  }
1167
1167
  } else {
1168
- debug9("no pr");
1168
+ debug10("no pr");
1169
1169
  if (M === "0") {
1170
1170
  if (m === "0") {
1171
1171
  ret = ">=" + M + "." + m + "." + p + " <" + M + "." + m + "." + (+p + 1);
@@ -1176,12 +1176,12 @@ var require_semver = __commonJS({
1176
1176
  ret = ">=" + M + "." + m + "." + p + " <" + (+M + 1) + ".0.0";
1177
1177
  }
1178
1178
  }
1179
- debug9("caret return", ret);
1179
+ debug10("caret return", ret);
1180
1180
  return ret;
1181
1181
  });
1182
1182
  }
1183
1183
  function replaceXRanges(comp, options) {
1184
- debug9("replaceXRanges", comp, options);
1184
+ debug10("replaceXRanges", comp, options);
1185
1185
  return comp.split(/\s+/).map(function(comp2) {
1186
1186
  return replaceXRange(comp2, options);
1187
1187
  }).join(" ");
@@ -1190,7 +1190,7 @@ var require_semver = __commonJS({
1190
1190
  comp = comp.trim();
1191
1191
  var r = options.loose ? safeRe[XRANGELOOSE] : safeRe[XRANGE];
1192
1192
  return comp.replace(r, function(ret, gtlt, M, m, p, pr) {
1193
- debug9("xRange", comp, ret, gtlt, M, m, p, pr);
1193
+ debug10("xRange", comp, ret, gtlt, M, m, p, pr);
1194
1194
  var xM = isX(M);
1195
1195
  var xm = xM || isX(m);
1196
1196
  var xp = xm || isX(p);
@@ -1233,12 +1233,12 @@ var require_semver = __commonJS({
1233
1233
  } else if (xp) {
1234
1234
  ret = ">=" + M + "." + m + ".0 <" + M + "." + (+m + 1) + ".0";
1235
1235
  }
1236
- debug9("xRange return", ret);
1236
+ debug10("xRange return", ret);
1237
1237
  return ret;
1238
1238
  });
1239
1239
  }
1240
1240
  function replaceStars(comp, options) {
1241
- debug9("replaceStars", comp, options);
1241
+ debug10("replaceStars", comp, options);
1242
1242
  return comp.trim().replace(safeRe[STAR], "");
1243
1243
  }
1244
1244
  function hyphenReplace($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr, tb) {
@@ -1286,7 +1286,7 @@ var require_semver = __commonJS({
1286
1286
  }
1287
1287
  if (version2.prerelease.length && !options.includePrerelease) {
1288
1288
  for (i2 = 0; i2 < set.length; i2++) {
1289
- debug9(set[i2].semver);
1289
+ debug10(set[i2].semver);
1290
1290
  if (set[i2].semver === ANY) {
1291
1291
  continue;
1292
1292
  }
@@ -1895,9 +1895,9 @@ var require_pump = __commonJS({
1895
1895
  "../../node_modules/.pnpm/pump@3.0.2/node_modules/pump/index.js"(exports, module2) {
1896
1896
  var once = require_once();
1897
1897
  var eos = require_end_of_stream();
1898
- var fs7;
1898
+ var fs8;
1899
1899
  try {
1900
- fs7 = require("fs");
1900
+ fs8 = require("fs");
1901
1901
  } catch (e) {
1902
1902
  }
1903
1903
  var noop = function() {
@@ -1909,9 +1909,9 @@ var require_pump = __commonJS({
1909
1909
  var isFS = function(stream) {
1910
1910
  if (!ancient)
1911
1911
  return false;
1912
- if (!fs7)
1912
+ if (!fs8)
1913
1913
  return false;
1914
- return (stream instanceof (fs7.ReadStream || noop) || stream instanceof (fs7.WriteStream || noop)) && isFn(stream.close);
1914
+ return (stream instanceof (fs8.ReadStream || noop) || stream instanceof (fs8.WriteStream || noop)) && isFn(stream.close);
1915
1915
  };
1916
1916
  var isRequest = function(stream) {
1917
1917
  return stream.setHeader && isFn(stream.abort);
@@ -2651,7 +2651,7 @@ ${stderr}${stdout}`;
2651
2651
  var require_lib = __commonJS({
2652
2652
  "../../node_modules/.pnpm/which@3.0.0/node_modules/which/lib/index.js"(exports, module2) {
2653
2653
  var isexe = require_isexe();
2654
- var { join: join9, delimiter: delimiter2, sep: sep2, posix } = require("path");
2654
+ var { join: join10, delimiter: delimiter2, sep: sep2, posix } = require("path");
2655
2655
  var isWindows = process.platform === "win32";
2656
2656
  var rSlash = new RegExp(`[${posix.sep}${sep2 === posix.sep ? "" : sep2}]`.replace(/(\\)/g, "\\$1"));
2657
2657
  var rRel = new RegExp(`^\\.${rSlash.source}`);
@@ -2680,7 +2680,7 @@ var require_lib = __commonJS({
2680
2680
  var getPathPart = (raw, cmd) => {
2681
2681
  const pathPart = /^".*"$/.test(raw) ? raw.slice(1, -1) : raw;
2682
2682
  const prefix = !pathPart && rRel.test(cmd) ? cmd.slice(0, 2) : "";
2683
- return prefix + join9(pathPart, cmd);
2683
+ return prefix + join10(pathPart, cmd);
2684
2684
  };
2685
2685
  var which2 = async (cmd, opt = {}) => {
2686
2686
  const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
@@ -2867,15 +2867,15 @@ __export(src_exports, {
2867
2867
  version: () => version
2868
2868
  });
2869
2869
  module.exports = __toCommonJS(src_exports);
2870
- var import_fs7 = __toESM(require("fs"));
2870
+ var import_fs8 = __toESM(require("fs"));
2871
2871
  var import_util2 = require("util");
2872
- var import_path9 = require("path");
2872
+ var import_path10 = require("path");
2873
2873
 
2874
2874
  // src/package-versions.ts
2875
2875
  var VERCEL_RUNTIME_VERSION = "0.5.3";
2876
2876
 
2877
2877
  // src/index.ts
2878
- var import_build_utils11 = require("@vercel/build-utils");
2878
+ var import_build_utils12 = require("@vercel/build-utils");
2879
2879
 
2880
2880
  // src/install.ts
2881
2881
  var import_execa3 = __toESM(require_execa());
@@ -4244,7 +4244,7 @@ async function calculatePerPackageSizes(venvPath) {
4244
4244
  }
4245
4245
 
4246
4246
  // src/index.ts
4247
- var import_build_utils12 = require("@vercel/build-utils");
4247
+ var import_build_utils13 = require("@vercel/build-utils");
4248
4248
 
4249
4249
  // src/start-dev-server.ts
4250
4250
  var import_child_process2 = require("child_process");
@@ -4881,14 +4881,77 @@ If you are using a virtual environment, activate it before running "vercel dev",
4881
4881
  };
4882
4882
 
4883
4883
  // src/quirks/index.ts
4884
- var import_build_utils10 = require("@vercel/build-utils");
4884
+ var import_build_utils11 = require("@vercel/build-utils");
4885
4885
  var import_python_analysis5 = require("@vercel/python-analysis");
4886
4886
 
4887
- // src/quirks/prisma.ts
4887
+ // src/quirks/litellm.ts
4888
4888
  var import_fs6 = __toESM(require("fs"));
4889
4889
  var import_path8 = require("path");
4890
- var import_execa4 = __toESM(require_execa());
4891
4890
  var import_build_utils9 = require("@vercel/build-utils");
4891
+ var LAMBDA_ROOT = "/var/task";
4892
+ var CONFIG_CANDIDATES = [
4893
+ "litellm_config.yaml",
4894
+ "litellm_config.yml",
4895
+ "litellm.yaml",
4896
+ "litellm.yml"
4897
+ ];
4898
+ async function findConfigFile(workPath) {
4899
+ for (const name of CONFIG_CANDIDATES) {
4900
+ const candidate = (0, import_path8.join)(workPath, name);
4901
+ try {
4902
+ await import_fs6.default.promises.access(candidate);
4903
+ return name;
4904
+ } catch {
4905
+ }
4906
+ }
4907
+ return null;
4908
+ }
4909
+ var litellmQuirk = {
4910
+ dependency: "litellm",
4911
+ runsBefore: ["prisma"],
4912
+ async run(ctx) {
4913
+ const buildEnv = {};
4914
+ const env = {};
4915
+ const sitePackagesDirs = await getVenvSitePackagesDirs(ctx.venvPath);
4916
+ for (const sitePackages of sitePackagesDirs) {
4917
+ const schemaPath = (0, import_path8.join)(
4918
+ sitePackages,
4919
+ "litellm",
4920
+ "proxy",
4921
+ "schema.prisma"
4922
+ );
4923
+ try {
4924
+ await import_fs6.default.promises.access(schemaPath);
4925
+ (0, import_build_utils9.debug)(`LiteLLM quirk: found schema at ${schemaPath}`);
4926
+ buildEnv.PRISMA_SCHEMA_PATH = schemaPath;
4927
+ break;
4928
+ } catch {
4929
+ }
4930
+ }
4931
+ if (!buildEnv.PRISMA_SCHEMA_PATH) {
4932
+ (0, import_build_utils9.debug)("LiteLLM quirk: schema.prisma not found in any site-packages");
4933
+ }
4934
+ if (!process.env.CONFIG_FILE_PATH) {
4935
+ const configName = await findConfigFile(ctx.workPath);
4936
+ if (configName) {
4937
+ (0, import_build_utils9.debug)(`LiteLLM quirk: found config at ${configName}`);
4938
+ buildEnv.CONFIG_FILE_PATH = (0, import_path8.join)(ctx.workPath, configName);
4939
+ env.CONFIG_FILE_PATH = (0, import_path8.join)(LAMBDA_ROOT, configName);
4940
+ }
4941
+ } else {
4942
+ (0, import_build_utils9.debug)(
4943
+ `LiteLLM quirk: CONFIG_FILE_PATH already set to ${process.env.CONFIG_FILE_PATH}`
4944
+ );
4945
+ }
4946
+ return { buildEnv, env };
4947
+ }
4948
+ };
4949
+
4950
+ // src/quirks/prisma.ts
4951
+ var import_fs7 = __toESM(require("fs"));
4952
+ var import_path9 = require("path");
4953
+ var import_execa4 = __toESM(require_execa());
4954
+ var import_build_utils10 = require("@vercel/build-utils");
4892
4955
  var import_python_analysis4 = require("@vercel/python-analysis");
4893
4956
  function execErrorMessage(err) {
4894
4957
  if (err != null && typeof err === "object" && "stderr" in err) {
@@ -4899,7 +4962,7 @@ function execErrorMessage(err) {
4899
4962
  return err instanceof Error ? err.message : String(err);
4900
4963
  }
4901
4964
  var DUMMY_SCHEMA_NAME = "_prisma_dummy.prisma";
4902
- var LAMBDA_ROOT = "/var/task";
4965
+ var LAMBDA_ROOT2 = "/var/task";
4903
4966
  var RUNTIME_OPENSSL_VERSION = "3.2";
4904
4967
  function getLambdaBinaryTarget() {
4905
4968
  return process.arch === "arm64" ? "linux-arm64-openssl-3.0.x" : "rhel-openssl-3.0.x";
@@ -4925,22 +4988,22 @@ model DummyModel {
4925
4988
  async function findUserSchema(workPath) {
4926
4989
  const envPath = process.env.PRISMA_SCHEMA_PATH;
4927
4990
  if (envPath) {
4928
- const resolved = (0, import_path8.isAbsolute)(envPath) ? envPath : (0, import_path8.join)(workPath, envPath);
4991
+ const resolved = (0, import_path9.isAbsolute)(envPath) ? envPath : (0, import_path9.join)(workPath, envPath);
4929
4992
  try {
4930
- await import_fs6.default.promises.access(resolved);
4993
+ await import_fs7.default.promises.access(resolved);
4931
4994
  return resolved;
4932
4995
  } catch {
4933
- (0, import_build_utils9.debug)(`PRISMA_SCHEMA_PATH=${envPath} not found at ${resolved}`);
4996
+ (0, import_build_utils10.debug)(`PRISMA_SCHEMA_PATH=${envPath} not found at ${resolved}`);
4934
4997
  return null;
4935
4998
  }
4936
4999
  }
4937
5000
  const candidates = [
4938
- (0, import_path8.join)(workPath, "schema.prisma"),
4939
- (0, import_path8.join)(workPath, "prisma", "schema.prisma")
5001
+ (0, import_path9.join)(workPath, "schema.prisma"),
5002
+ (0, import_path9.join)(workPath, "prisma", "schema.prisma")
4940
5003
  ];
4941
5004
  for (const candidate of candidates) {
4942
5005
  try {
4943
- await import_fs6.default.promises.access(candidate);
5006
+ await import_fs7.default.promises.access(candidate);
4944
5007
  return candidate;
4945
5008
  } catch {
4946
5009
  }
@@ -4951,32 +5014,32 @@ async function collectFiles(dir, base) {
4951
5014
  const result = [];
4952
5015
  let entries;
4953
5016
  try {
4954
- entries = await import_fs6.default.promises.readdir(dir, { withFileTypes: true });
5017
+ entries = await import_fs7.default.promises.readdir(dir, { withFileTypes: true });
4955
5018
  } catch {
4956
5019
  return result;
4957
5020
  }
4958
5021
  for (const entry of entries) {
4959
5022
  if (entry.name === "__pycache__")
4960
5023
  continue;
4961
- const full = (0, import_path8.join)(dir, entry.name);
5024
+ const full = (0, import_path9.join)(dir, entry.name);
4962
5025
  if (entry.isDirectory()) {
4963
5026
  result.push(...await collectFiles(full, base));
4964
5027
  } else {
4965
- result.push((0, import_path8.relative)(base, full));
5028
+ result.push((0, import_path9.relative)(base, full));
4966
5029
  }
4967
5030
  }
4968
5031
  return result;
4969
5032
  }
4970
5033
  async function cleanCacheArtifacts(cacheDir, extras = []) {
4971
5034
  const paths = [
4972
- (0, import_path8.join)(cacheDir, "node_modules"),
4973
- (0, import_path8.join)(cacheDir, "package.json"),
4974
- (0, import_path8.join)(cacheDir, "package-lock.json"),
5035
+ (0, import_path9.join)(cacheDir, "node_modules"),
5036
+ (0, import_path9.join)(cacheDir, "package.json"),
5037
+ (0, import_path9.join)(cacheDir, "package-lock.json"),
4975
5038
  ...extras
4976
5039
  ];
4977
5040
  for (const p of paths) {
4978
5041
  try {
4979
- await import_fs6.default.promises.rm(p, { recursive: true, force: true });
5042
+ await import_fs7.default.promises.rm(p, { recursive: true, force: true });
4980
5043
  } catch (err) {
4981
5044
  console.warn(
4982
5045
  `could not clean up ${p}: ${err instanceof Error ? err.message : String(err)}`
@@ -5000,8 +5063,8 @@ var prismaQuirk = {
5000
5063
  async run(ctx) {
5001
5064
  const { venvPath, pythonEnv, workPath } = ctx;
5002
5065
  const pythonPath = getVenvPythonBin(venvPath);
5003
- const runtimeCacheDir = (0, import_path8.join)(
5004
- LAMBDA_ROOT,
5066
+ const runtimeCacheDir = (0, import_path9.join)(
5067
+ LAMBDA_ROOT2,
5005
5068
  resolveVendorDir(),
5006
5069
  "prisma",
5007
5070
  "__bincache__"
@@ -5010,7 +5073,7 @@ var prismaQuirk = {
5010
5073
  let sitePackages;
5011
5074
  for (const dir of sitePackagesDirs) {
5012
5075
  try {
5013
- await import_fs6.default.promises.access((0, import_path8.join)(dir, "prisma"));
5076
+ await import_fs7.default.promises.access((0, import_path9.join)(dir, "prisma"));
5014
5077
  sitePackages = dir;
5015
5078
  break;
5016
5079
  } catch {
@@ -5022,19 +5085,19 @@ var prismaQuirk = {
5022
5085
  );
5023
5086
  return {};
5024
5087
  }
5025
- const cacheDir = (0, import_path8.join)(sitePackages, "prisma", "__bincache__");
5026
- await import_fs6.default.promises.mkdir(cacheDir, { recursive: true });
5088
+ const cacheDir = (0, import_path9.join)(sitePackages, "prisma", "__bincache__");
5089
+ await import_fs7.default.promises.mkdir(cacheDir, { recursive: true });
5027
5090
  const generateEnv = {
5028
5091
  ...pythonEnv,
5029
5092
  PRISMA_BINARY_CACHE_DIR: cacheDir
5030
5093
  };
5031
- const generatedDir = (0, import_path8.join)(workPath, "_prisma_generated");
5032
- const dummySchemaPath = (0, import_path8.join)(workPath, DUMMY_SCHEMA_NAME);
5033
- await import_fs6.default.promises.writeFile(
5094
+ const generatedDir = (0, import_path9.join)(workPath, "_prisma_generated");
5095
+ const dummySchemaPath = (0, import_path9.join)(workPath, DUMMY_SCHEMA_NAME);
5096
+ await import_fs7.default.promises.writeFile(
5034
5097
  dummySchemaPath,
5035
5098
  buildDummySchema(generatedDir)
5036
5099
  );
5037
- (0, import_build_utils9.debug)(`Running prisma generate (dummy) with cache dir: ${cacheDir}`);
5100
+ (0, import_build_utils10.debug)(`Running prisma generate (dummy) with cache dir: ${cacheDir}`);
5038
5101
  try {
5039
5102
  const dummyResult = await (0, import_execa4.default)(
5040
5103
  pythonPath,
@@ -5046,11 +5109,11 @@ var prismaQuirk = {
5046
5109
  }
5047
5110
  );
5048
5111
  if (dummyResult.stdout)
5049
- (0, import_build_utils9.debug)(`prisma generate (dummy) stdout: ${dummyResult.stdout}`);
5112
+ (0, import_build_utils10.debug)(`prisma generate (dummy) stdout: ${dummyResult.stdout}`);
5050
5113
  if (dummyResult.stderr)
5051
- (0, import_build_utils9.debug)(`prisma generate (dummy) stderr: ${dummyResult.stderr}`);
5114
+ (0, import_build_utils10.debug)(`prisma generate (dummy) stderr: ${dummyResult.stderr}`);
5052
5115
  } catch (err) {
5053
- throw new import_build_utils9.NowBuildError({
5116
+ throw new import_build_utils10.NowBuildError({
5054
5117
  code: "PRISMA_GENERATE_FAILED",
5055
5118
  message: `Prisma engine download failed during \`prisma generate\`. Check that your prisma version is compatible with this Python version.
5056
5119
  ` + execErrorMessage(err)
@@ -5058,47 +5121,47 @@ var prismaQuirk = {
5058
5121
  }
5059
5122
  const srcBinaryPrefix = `query-engine-${getLambdaBinaryTarget()}`;
5060
5123
  const runtimeName = `prisma-query-engine-rhel-openssl-${RUNTIME_OPENSSL_VERSION}.x`;
5061
- const nodeModulesDir = (0, import_path8.join)(cacheDir, "node_modules", "prisma");
5124
+ const nodeModulesDir = (0, import_path9.join)(cacheDir, "node_modules", "prisma");
5062
5125
  let engineCopied = false;
5063
5126
  try {
5064
- const entries = await import_fs6.default.promises.readdir(nodeModulesDir);
5127
+ const entries = await import_fs7.default.promises.readdir(nodeModulesDir);
5065
5128
  for (const entry of entries) {
5066
5129
  if (!entry.startsWith(srcBinaryPrefix))
5067
5130
  continue;
5068
- const srcPath = (0, import_path8.join)(nodeModulesDir, entry);
5069
- const destPath = (0, import_path8.join)(cacheDir, runtimeName);
5131
+ const srcPath = (0, import_path9.join)(nodeModulesDir, entry);
5132
+ const destPath = (0, import_path9.join)(cacheDir, runtimeName);
5070
5133
  try {
5071
- await import_fs6.default.promises.access(destPath);
5072
- (0, import_build_utils9.debug)(`Engine binary: ${runtimeName} already exists, skipping`);
5134
+ await import_fs7.default.promises.access(destPath);
5135
+ (0, import_build_utils10.debug)(`Engine binary: ${runtimeName} already exists, skipping`);
5073
5136
  } catch {
5074
- (0, import_build_utils9.debug)(`Engine binary: copying ${entry} -> ${runtimeName}`);
5075
- await import_fs6.default.promises.copyFile(srcPath, destPath);
5137
+ (0, import_build_utils10.debug)(`Engine binary: copying ${entry} -> ${runtimeName}`);
5138
+ await import_fs7.default.promises.copyFile(srcPath, destPath);
5076
5139
  }
5077
5140
  engineCopied = true;
5078
5141
  }
5079
5142
  } catch (err) {
5080
- throw new import_build_utils9.NowBuildError({
5143
+ throw new import_build_utils10.NowBuildError({
5081
5144
  code: "PRISMA_ENGINE_NOT_FOUND",
5082
5145
  message: `could not read Prisma engine directory "${nodeModulesDir}". This may indicate an incompatible prisma version.
5083
5146
  ` + (err instanceof Error ? err.message : String(err))
5084
5147
  });
5085
5148
  }
5086
5149
  if (!engineCopied) {
5087
- throw new import_build_utils9.NowBuildError({
5150
+ throw new import_build_utils10.NowBuildError({
5088
5151
  code: "PRISMA_ENGINE_NOT_FOUND",
5089
5152
  message: `could not find engine binary matching "${srcBinaryPrefix}*" in "${nodeModulesDir}". This may indicate an incompatible prisma version or an unsupported platform (${process.arch}).`
5090
5153
  });
5091
5154
  }
5092
- const shimPath = (0, import_path8.join)(cacheDir, "openssl");
5093
- await import_fs6.default.promises.writeFile(
5155
+ const shimPath = (0, import_path9.join)(cacheDir, "openssl");
5156
+ await import_fs7.default.promises.writeFile(
5094
5157
  shimPath,
5095
5158
  `#!/bin/sh
5096
5159
  echo "OpenSSL ${RUNTIME_OPENSSL_VERSION}.0 1 Jan 2024 (Library: OpenSSL ${RUNTIME_OPENSSL_VERSION}.0)"
5097
5160
  `
5098
5161
  );
5099
- await import_fs6.default.promises.chmod(shimPath, 493);
5162
+ await import_fs7.default.promises.chmod(shimPath, 493);
5100
5163
  for (const p of [generatedDir, dummySchemaPath]) {
5101
- await import_fs6.default.promises.rm(p, { recursive: true, force: true });
5164
+ await import_fs7.default.promises.rm(p, { recursive: true, force: true });
5102
5165
  }
5103
5166
  await cleanCacheArtifacts(cacheDir);
5104
5167
  const generateMode = (process.env.VERCEL_PRISMA_GENERATE_CLIENT ?? "auto").toLowerCase();
@@ -5111,14 +5174,14 @@ echo "OpenSSL ${RUNTIME_OPENSSL_VERSION}.0 1 Jan 2024 (Library: OpenSSL ${RUNTIM
5111
5174
  pythonEnv
5112
5175
  );
5113
5176
  if (clientAlreadyGenerated) {
5114
- (0, import_build_utils9.debug)(
5177
+ (0, import_build_utils10.debug)(
5115
5178
  "Prisma quirk: client already generated, skipping user schema generate"
5116
5179
  );
5117
5180
  shouldGenerate = false;
5118
5181
  }
5119
5182
  }
5120
5183
  if (shouldGenerate) {
5121
- (0, import_build_utils9.debug)(`Running prisma generate with user schema: ${userSchema}`);
5184
+ (0, import_build_utils10.debug)(`Running prisma generate with user schema: ${userSchema}`);
5122
5185
  try {
5123
5186
  const userResult = await (0, import_execa4.default)(
5124
5187
  pythonPath,
@@ -5130,11 +5193,11 @@ echo "OpenSSL ${RUNTIME_OPENSSL_VERSION}.0 1 Jan 2024 (Library: OpenSSL ${RUNTIM
5130
5193
  }
5131
5194
  );
5132
5195
  if (userResult.stdout)
5133
- (0, import_build_utils9.debug)(`prisma generate stdout: ${userResult.stdout}`);
5196
+ (0, import_build_utils10.debug)(`prisma generate stdout: ${userResult.stdout}`);
5134
5197
  if (userResult.stderr)
5135
- (0, import_build_utils9.debug)(`prisma generate stderr: ${userResult.stderr}`);
5198
+ (0, import_build_utils10.debug)(`prisma generate stderr: ${userResult.stderr}`);
5136
5199
  } catch (err) {
5137
- throw new import_build_utils9.NowBuildError({
5200
+ throw new import_build_utils10.NowBuildError({
5138
5201
  code: "PRISMA_GENERATE_FAILED",
5139
5202
  message: `\`prisma generate\` failed for schema "${userSchema}".
5140
5203
  ` + execErrorMessage(err)
@@ -5145,12 +5208,12 @@ echo "OpenSSL ${RUNTIME_OPENSSL_VERSION}.0 1 Jan 2024 (Library: OpenSSL ${RUNTIM
5145
5208
  }
5146
5209
  try {
5147
5210
  const allFiles = await collectFiles(
5148
- (0, import_path8.join)(sitePackages, "prisma"),
5211
+ (0, import_path9.join)(sitePackages, "prisma"),
5149
5212
  sitePackages
5150
5213
  );
5151
5214
  const count = await (0, import_python_analysis4.extendDistRecord)(sitePackages, "prisma", allFiles);
5152
5215
  if (count > 0) {
5153
- (0, import_build_utils9.debug)(`Appended ${count} entries to prisma RECORD`);
5216
+ (0, import_build_utils10.debug)(`Appended ${count} entries to prisma RECORD`);
5154
5217
  }
5155
5218
  } catch (err) {
5156
5219
  console.warn(
@@ -5169,7 +5232,7 @@ echo "OpenSSL ${RUNTIME_OPENSSL_VERSION}.0 1 Jan 2024 (Library: OpenSSL ${RUNTIM
5169
5232
  };
5170
5233
 
5171
5234
  // src/quirks/index.ts
5172
- var quirks = [prismaQuirk];
5235
+ var quirks = [litellmQuirk, prismaQuirk];
5173
5236
  function toposortQuirks(activated) {
5174
5237
  const nameToQuirk = /* @__PURE__ */ new Map();
5175
5238
  for (const q of activated) {
@@ -5244,13 +5307,13 @@ async function runQuirks(ctx) {
5244
5307
  (0, import_python_analysis5.normalizePackageName)(quirk.dependency)
5245
5308
  );
5246
5309
  if (!installed) {
5247
- (0, import_build_utils10.debug)(`Quirk "${quirk.dependency}": not installed, skipping`);
5310
+ (0, import_build_utils11.debug)(`Quirk "${quirk.dependency}": not installed, skipping`);
5248
5311
  }
5249
5312
  return installed;
5250
5313
  });
5251
5314
  const sorted = toposortQuirks(activated);
5252
5315
  for (const quirk of sorted) {
5253
- (0, import_build_utils10.debug)(`Quirk "${quirk.dependency}": detected, running fix-up`);
5316
+ (0, import_build_utils11.debug)(`Quirk "${quirk.dependency}": detected, running fix-up`);
5254
5317
  const result = await quirk.run(ctx);
5255
5318
  if (result.env) {
5256
5319
  Object.assign(mergedEnv, result.env);
@@ -5271,8 +5334,8 @@ async function runQuirks(ctx) {
5271
5334
  }
5272
5335
 
5273
5336
  // src/index.ts
5274
- var readFile2 = (0, import_util2.promisify)(import_fs7.default.readFile);
5275
- var writeFile = (0, import_util2.promisify)(import_fs7.default.writeFile);
5337
+ var readFile2 = (0, import_util2.promisify)(import_fs8.default.readFile);
5338
+ var writeFile = (0, import_util2.promisify)(import_fs8.default.writeFile);
5276
5339
  var version = 3;
5277
5340
  async function downloadFilesInWorkPath({
5278
5341
  entrypoint,
@@ -5280,13 +5343,13 @@ async function downloadFilesInWorkPath({
5280
5343
  files,
5281
5344
  meta = {}
5282
5345
  }) {
5283
- (0, import_build_utils11.debug)("Downloading user files...");
5284
- let downloadedFiles = await (0, import_build_utils11.download)(files, workPath, meta);
5346
+ (0, import_build_utils12.debug)("Downloading user files...");
5347
+ let downloadedFiles = await (0, import_build_utils12.download)(files, workPath, meta);
5285
5348
  if (meta.isDev) {
5286
- const { devCacheDir = (0, import_path9.join)(workPath, ".now", "cache") } = meta;
5287
- const destCache = (0, import_path9.join)(devCacheDir, (0, import_path9.basename)(entrypoint, ".py"));
5288
- await (0, import_build_utils11.download)(downloadedFiles, destCache);
5289
- downloadedFiles = await (0, import_build_utils11.glob)("**", destCache);
5349
+ const { devCacheDir = (0, import_path10.join)(workPath, ".now", "cache") } = meta;
5350
+ const destCache = (0, import_path10.join)(devCacheDir, (0, import_path10.basename)(entrypoint, ".py"));
5351
+ await (0, import_build_utils12.download)(downloadedFiles, destCache);
5352
+ downloadedFiles = await (0, import_build_utils12.glob)("**", destCache);
5290
5353
  workPath = destCache;
5291
5354
  }
5292
5355
  return workPath;
@@ -5303,7 +5366,7 @@ var build = async ({
5303
5366
  let spawnEnv;
5304
5367
  let projectInstallCommand;
5305
5368
  let hasCustomCommand = false;
5306
- (0, import_build_utils11.debug)(`workPath: ${workPath}`);
5369
+ (0, import_build_utils12.debug)(`workPath: ${workPath}`);
5307
5370
  workPath = await downloadFilesInWorkPath({
5308
5371
  workPath,
5309
5372
  files: originalFiles,
@@ -5312,28 +5375,28 @@ var build = async ({
5312
5375
  });
5313
5376
  try {
5314
5377
  if (meta.isDev) {
5315
- const setupCfg = (0, import_path9.join)(workPath, "setup.cfg");
5378
+ const setupCfg = (0, import_path10.join)(workPath, "setup.cfg");
5316
5379
  await writeFile(setupCfg, "[install]\nprefix=\n");
5317
5380
  }
5318
5381
  } catch (err) {
5319
5382
  console.log('Failed to create "setup.cfg" file');
5320
5383
  throw err;
5321
5384
  }
5322
- let fsFiles = await (0, import_build_utils11.glob)("**", workPath);
5323
- if ((0, import_build_utils11.isPythonFramework)(framework) && (!fsFiles[entrypoint] || !entrypoint.endsWith(".py"))) {
5385
+ let fsFiles = await (0, import_build_utils12.glob)("**", workPath);
5386
+ if ((0, import_build_utils12.isPythonFramework)(framework) && (!fsFiles[entrypoint] || !entrypoint.endsWith(".py"))) {
5324
5387
  const detected = await detectPythonEntrypoint(
5325
5388
  config.framework,
5326
5389
  workPath,
5327
5390
  entrypoint
5328
5391
  );
5329
5392
  if (detected) {
5330
- (0, import_build_utils11.debug)(
5393
+ (0, import_build_utils12.debug)(
5331
5394
  `Resolved Python entrypoint to "${detected}" (configured "${entrypoint}" not found).`
5332
5395
  );
5333
5396
  entrypoint = detected;
5334
5397
  } else {
5335
5398
  const searchedList = PYTHON_CANDIDATE_ENTRYPOINTS.join(", ");
5336
- throw new import_build_utils11.NowBuildError({
5399
+ throw new import_build_utils12.NowBuildError({
5337
5400
  code: `${framework.toUpperCase()}_ENTRYPOINT_NOT_FOUND`,
5338
5401
  message: `No ${framework} entrypoint found. Add an 'app' script in pyproject.toml or define an entrypoint in one of: ${searchedList}.`,
5339
5402
  link: `https://vercel.com/docs/frameworks/backend/${framework}#exporting-the-${framework}-application`,
@@ -5341,7 +5404,7 @@ var build = async ({
5341
5404
  });
5342
5405
  }
5343
5406
  }
5344
- const entryDirectory = (0, import_path9.dirname)(entrypoint);
5407
+ const entryDirectory = (0, import_path10.dirname)(entrypoint);
5345
5408
  const pyprojectDir = findDir({
5346
5409
  file: "pyproject.toml",
5347
5410
  entryDirectory,
@@ -5364,37 +5427,37 @@ var build = async ({
5364
5427
  if (pythonVersionFileDir) {
5365
5428
  try {
5366
5429
  const content = await readFile2(
5367
- (0, import_path9.join)(pythonVersionFileDir, ".python-version"),
5430
+ (0, import_path10.join)(pythonVersionFileDir, ".python-version"),
5368
5431
  "utf8"
5369
5432
  );
5370
5433
  const version2 = parsePythonVersionFile(content);
5371
5434
  if (version2) {
5372
5435
  declaredPythonVersion = { version: version2, source: ".python-version" };
5373
- (0, import_build_utils11.debug)(`Found Python version ${version2} in .python-version`);
5436
+ (0, import_build_utils12.debug)(`Found Python version ${version2} in .python-version`);
5374
5437
  }
5375
5438
  } catch (err) {
5376
- (0, import_build_utils11.debug)("Failed to read .python-version file", err);
5439
+ (0, import_build_utils12.debug)("Failed to read .python-version file", err);
5377
5440
  }
5378
5441
  }
5379
5442
  if (!declaredPythonVersion && pyprojectDir) {
5380
5443
  let requiresPython;
5381
5444
  try {
5382
- const pyproject = await (0, import_build_utils12.readConfigFile)((0, import_path9.join)(pyprojectDir, "pyproject.toml"));
5445
+ const pyproject = await (0, import_build_utils13.readConfigFile)((0, import_path10.join)(pyprojectDir, "pyproject.toml"));
5383
5446
  requiresPython = pyproject?.project?.["requires-python"];
5384
5447
  } catch (err) {
5385
- (0, import_build_utils11.debug)("Failed to parse pyproject.toml", err);
5448
+ (0, import_build_utils12.debug)("Failed to parse pyproject.toml", err);
5386
5449
  }
5387
5450
  if (typeof requiresPython === "string" && requiresPython.trim()) {
5388
5451
  declaredPythonVersion = {
5389
5452
  version: requiresPython.trim(),
5390
5453
  source: "pyproject.toml"
5391
5454
  };
5392
- (0, import_build_utils11.debug)(`Found requires-python "${requiresPython}" in pyproject.toml`);
5455
+ (0, import_build_utils12.debug)(`Found requires-python "${requiresPython}" in pyproject.toml`);
5393
5456
  }
5394
5457
  }
5395
5458
  if (!declaredPythonVersion && pipfileLockDir) {
5396
5459
  let lock = {};
5397
- const pipfileLockPath = (0, import_path9.join)(pipfileLockDir, "Pipfile.lock");
5460
+ const pipfileLockPath = (0, import_path10.join)(pipfileLockDir, "Pipfile.lock");
5398
5461
  try {
5399
5462
  const pipfileLockContent = await readFile2(pipfileLockPath, "utf8");
5400
5463
  try {
@@ -5407,7 +5470,7 @@ ${pipfileLockContent}`
5407
5470
  throw err;
5408
5471
  }
5409
5472
  } catch (err) {
5410
- throw new import_build_utils11.NowBuildError({
5473
+ throw new import_build_utils12.NowBuildError({
5411
5474
  code: "INVALID_PIPFILE_LOCK",
5412
5475
  message: "Unable to parse Pipfile.lock"
5413
5476
  });
@@ -5415,7 +5478,7 @@ ${pipfileLockContent}`
5415
5478
  const pyFromLock = lock?._meta?.requires?.python_version;
5416
5479
  if (pyFromLock) {
5417
5480
  declaredPythonVersion = { version: pyFromLock, source: "Pipfile.lock" };
5418
- (0, import_build_utils11.debug)(`Found Python version ${pyFromLock} in Pipfile.lock`);
5481
+ (0, import_build_utils12.debug)(`Found Python version ${pyFromLock} in Pipfile.lock`);
5419
5482
  }
5420
5483
  }
5421
5484
  const pythonVersion = getSupportedPythonVersion({
@@ -5425,27 +5488,27 @@ ${pipfileLockContent}`
5425
5488
  const selectedVersionTuple = parseVersionTuple(pythonVersion.version);
5426
5489
  const defaultVersionTuple = parseVersionTuple(DEFAULT_PYTHON_VERSION);
5427
5490
  if (!pythonVersionFileDir && pyprojectDir && declaredPythonVersion?.source === "pyproject.toml" && selectedVersionTuple && defaultVersionTuple && compareTuples(selectedVersionTuple, defaultVersionTuple) <= 0) {
5428
- const pythonVersionFilePath = (0, import_path9.join)(pyprojectDir, ".python-version");
5491
+ const pythonVersionFilePath = (0, import_path10.join)(pyprojectDir, ".python-version");
5429
5492
  await writeFile(pythonVersionFilePath, `${pythonVersion.version}
5430
5493
  `);
5431
5494
  console.log(
5432
5495
  `Writing .python-version file with version ${pythonVersion.version}`
5433
5496
  );
5434
5497
  }
5435
- fsFiles = await (0, import_build_utils11.glob)("**", workPath);
5436
- const venvPath = (0, import_path9.join)(workPath, ".vercel", "python", ".venv");
5498
+ fsFiles = await (0, import_build_utils12.glob)("**", workPath);
5499
+ const venvPath = (0, import_path10.join)(workPath, ".vercel", "python", ".venv");
5437
5500
  await ensureVenv({
5438
5501
  pythonPath: pythonVersion.pythonPath,
5439
5502
  venvPath
5440
5503
  });
5441
- if ((0, import_build_utils11.isPythonFramework)(framework)) {
5504
+ if ((0, import_build_utils12.isPythonFramework)(framework)) {
5442
5505
  const {
5443
5506
  cliType,
5444
5507
  lockfileVersion,
5445
5508
  packageJsonPackageManager,
5446
5509
  turboSupportsCorepackHome
5447
- } = await (0, import_build_utils11.scanParentDirs)(workPath, true);
5448
- spawnEnv = (0, import_build_utils11.getEnvForPackageManager)({
5510
+ } = await (0, import_build_utils12.scanParentDirs)(workPath, true);
5511
+ spawnEnv = (0, import_build_utils12.getEnvForPackageManager)({
5449
5512
  cliType,
5450
5513
  lockfileVersion,
5451
5514
  packageJsonPackageManager,
@@ -5469,7 +5532,7 @@ ${pipfileLockContent}`
5469
5532
  let assumeDepsInstalled = false;
5470
5533
  if (projectInstallCommand) {
5471
5534
  console.log(`Running "install" command: \`${projectInstallCommand}\`...`);
5472
- await (0, import_build_utils11.execCommand)(projectInstallCommand, {
5535
+ await (0, import_build_utils12.execCommand)(projectInstallCommand, {
5473
5536
  env: pythonEnv,
5474
5537
  cwd: workPath
5475
5538
  });
@@ -5530,7 +5593,7 @@ ${pipfileLockContent}`
5530
5593
  });
5531
5594
  } catch (err) {
5532
5595
  noBuildCheckFailed = true;
5533
- (0, import_build_utils11.debug)(
5596
+ (0, import_build_utils12.debug)(
5534
5597
  `--no-build check failed: ${err instanceof Error ? err.message : String(err)}`
5535
5598
  );
5536
5599
  }
@@ -5542,12 +5605,12 @@ ${pipfileLockContent}`
5542
5605
  locked: !lockFileProvidedByUser
5543
5606
  });
5544
5607
  }
5545
- if ((0, import_build_utils11.isPythonFramework)(framework)) {
5608
+ if ((0, import_build_utils12.isPythonFramework)(framework)) {
5546
5609
  const projectBuildCommand = config?.projectSettings?.buildCommand ?? // fallback if provided directly on config (some callers set this)
5547
5610
  config?.buildCommand;
5548
5611
  if (projectBuildCommand) {
5549
5612
  console.log(`Running "${projectBuildCommand}"`);
5550
- await (0, import_build_utils11.execCommand)(projectBuildCommand, {
5613
+ await (0, import_build_utils12.execCommand)(projectBuildCommand, {
5551
5614
  env: pythonEnv,
5552
5615
  cwd: workPath
5553
5616
  });
@@ -5560,22 +5623,22 @@ ${pipfileLockContent}`
5560
5623
  }
5561
5624
  }
5562
5625
  const runtimeDep = baseEnv.VERCEL_RUNTIME_PYTHON || `vercel-runtime==${VERCEL_RUNTIME_VERSION}`;
5563
- (0, import_build_utils11.debug)(`Installing ${runtimeDep}`);
5626
+ (0, import_build_utils12.debug)(`Installing ${runtimeDep}`);
5564
5627
  await uv.pip({
5565
5628
  venvPath,
5566
- projectDir: (0, import_path9.join)(workPath, entryDirectory),
5629
+ projectDir: (0, import_path10.join)(workPath, entryDirectory),
5567
5630
  args: ["install", runtimeDep]
5568
5631
  });
5569
5632
  const quirksResult = await runQuirks({ venvPath, pythonEnv, workPath });
5570
5633
  if (quirksResult.buildEnv) {
5571
5634
  Object.assign(pythonEnv, quirksResult.buildEnv);
5572
5635
  }
5573
- (0, import_build_utils11.debug)("Entrypoint is", entrypoint);
5636
+ (0, import_build_utils12.debug)("Entrypoint is", entrypoint);
5574
5637
  const moduleName = entrypoint.replace(/\//g, ".").replace(/\.py$/i, "");
5575
5638
  const vendorDir = resolveVendorDir();
5576
5639
  const suffix = meta.isDev && !entrypoint.endsWith(".py") ? ".py" : "";
5577
5640
  const entrypointWithSuffix = `${entrypoint}${suffix}`;
5578
- (0, import_build_utils11.debug)("Entrypoint with suffix is", entrypointWithSuffix);
5641
+ (0, import_build_utils12.debug)("Entrypoint with suffix is", entrypointWithSuffix);
5579
5642
  const runtimeTrampoline = `
5580
5643
  import importlib
5581
5644
  import os
@@ -5639,7 +5702,7 @@ from vercel_runtime.vc_init import vc_handler
5639
5702
  cwd: workPath,
5640
5703
  ignore: config && typeof config.excludeFiles === "string" ? [...predefinedExcludes, config.excludeFiles] : predefinedExcludes
5641
5704
  };
5642
- const files = await (0, import_build_utils11.glob)("**", globOptions);
5705
+ const files = await (0, import_build_utils12.glob)("**", globOptions);
5643
5706
  const depExternalizer = new PythonDependencyExternalizer({
5644
5707
  venvPath,
5645
5708
  vendorDir,
@@ -5661,12 +5724,12 @@ from vercel_runtime.vc_init import vc_handler
5661
5724
  }
5662
5725
  }
5663
5726
  const handlerPyFilename = "vc__handler__python";
5664
- files[`${handlerPyFilename}.py`] = new import_build_utils11.FileBlob({ data: runtimeTrampoline });
5727
+ files[`${handlerPyFilename}.py`] = new import_build_utils12.FileBlob({ data: runtimeTrampoline });
5665
5728
  if (config.framework === "fasthtml") {
5666
5729
  const { SESSKEY = "" } = process.env;
5667
- files[".sesskey"] = new import_build_utils11.FileBlob({ data: `"${SESSKEY}"` });
5730
+ files[".sesskey"] = new import_build_utils12.FileBlob({ data: `"${SESSKEY}"` });
5668
5731
  }
5669
- const output = new import_build_utils11.Lambda({
5732
+ const output = new import_build_utils12.Lambda({
5670
5733
  files,
5671
5734
  handler: `${handlerPyFilename}.vc_handler`,
5672
5735
  runtime: pythonVersion.runtime,
@@ -5677,7 +5740,7 @@ from vercel_runtime.vc_init import vc_handler
5677
5740
  };
5678
5741
  var shouldServe = (opts) => {
5679
5742
  const framework = opts.config.framework;
5680
- if ((0, import_build_utils11.isPythonFramework)(framework)) {
5743
+ if ((0, import_build_utils12.isPythonFramework)(framework)) {
5681
5744
  const requestPath = opts.requestPath.replace(/\/$/, "");
5682
5745
  if (requestPath.startsWith("api") && opts.hasMatched) {
5683
5746
  return false;
@@ -5696,7 +5759,7 @@ var defaultShouldServe = ({
5696
5759
  if (entrypoint === requestPath && hasProp(files, entrypoint)) {
5697
5760
  return true;
5698
5761
  }
5699
- const { dir, name } = (0, import_path9.parse)(entrypoint);
5762
+ const { dir, name } = (0, import_path10.parse)(entrypoint);
5700
5763
  if (name === "index" && dir === requestPath && hasProp(files, entrypoint)) {
5701
5764
  return true;
5702
5765
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/python",
3
- "version": "6.18.0",
3
+ "version": "6.18.1",
4
4
  "main": "./dist/index.js",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://vercel.com/docs/runtimes#official-runtimes/python",