@vercel/python 6.33.2 → 6.34.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/dist/index.js +133 -153
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -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
|
|
426
|
+
var debug12;
|
|
427
427
|
if (typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG)) {
|
|
428
|
-
|
|
428
|
+
debug12 = 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
|
-
|
|
434
|
+
debug12 = 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
|
-
|
|
543
|
+
debug12(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
|
-
|
|
610
|
+
debug12("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
|
-
|
|
657
|
+
debug12("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
|
-
|
|
684
|
+
debug12("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
|
-
|
|
938
|
+
debug12("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
|
-
|
|
947
|
+
debug12("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
|
-
|
|
970
|
+
debug12("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
|
-
|
|
1053
|
+
debug12("hyphen replace", range);
|
|
1054
1054
|
range = range.replace(safeRe[COMPARATORTRIM], comparatorTrimReplace);
|
|
1055
|
-
|
|
1055
|
+
debug12("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
|
-
|
|
1095
|
+
debug12("comp", comp, options);
|
|
1096
1096
|
comp = replaceCarets(comp, options);
|
|
1097
|
-
|
|
1097
|
+
debug12("caret", comp);
|
|
1098
1098
|
comp = replaceTildes(comp, options);
|
|
1099
|
-
|
|
1099
|
+
debug12("tildes", comp);
|
|
1100
1100
|
comp = replaceXRanges(comp, options);
|
|
1101
|
-
|
|
1101
|
+
debug12("xrange", comp);
|
|
1102
1102
|
comp = replaceStars(comp, options);
|
|
1103
|
-
|
|
1103
|
+
debug12("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
|
-
|
|
1117
|
+
debug12("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
|
-
|
|
1126
|
+
debug12("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
|
-
|
|
1131
|
+
debug12("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
|
-
|
|
1141
|
+
debug12("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
|
-
|
|
1144
|
+
debug12("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
|
-
|
|
1157
|
+
debug12("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
|
-
|
|
1168
|
+
debug12("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
|
-
|
|
1179
|
+
debug12("caret return", ret);
|
|
1180
1180
|
return ret;
|
|
1181
1181
|
});
|
|
1182
1182
|
}
|
|
1183
1183
|
function replaceXRanges(comp, options) {
|
|
1184
|
-
|
|
1184
|
+
debug12("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
|
-
|
|
1193
|
+
debug12("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
|
-
|
|
1236
|
+
debug12("xRange return", ret);
|
|
1237
1237
|
return ret;
|
|
1238
1238
|
});
|
|
1239
1239
|
}
|
|
1240
1240
|
function replaceStars(comp, options) {
|
|
1241
|
-
|
|
1241
|
+
debug12("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
|
-
|
|
1289
|
+
debug12(set[i2].semver);
|
|
1290
1290
|
if (set[i2].semver === ANY) {
|
|
1291
1291
|
continue;
|
|
1292
1292
|
}
|
|
@@ -3005,7 +3005,7 @@ var require_detect_libc = __commonJS({
|
|
|
3005
3005
|
var require_lib = __commonJS({
|
|
3006
3006
|
"../../node_modules/.pnpm/which@3.0.0/node_modules/which/lib/index.js"(exports, module2) {
|
|
3007
3007
|
var isexe = require_isexe();
|
|
3008
|
-
var { join:
|
|
3008
|
+
var { join: join13, delimiter: delimiter2, sep: sep2, posix } = require("path");
|
|
3009
3009
|
var isWindows = process.platform === "win32";
|
|
3010
3010
|
var rSlash = new RegExp(`[${posix.sep}${sep2 === posix.sep ? "" : sep2}]`.replace(/(\\)/g, "\\$1"));
|
|
3011
3011
|
var rRel = new RegExp(`^\\.${rSlash.source}`);
|
|
@@ -3034,7 +3034,7 @@ var require_lib = __commonJS({
|
|
|
3034
3034
|
var getPathPart = (raw, cmd) => {
|
|
3035
3035
|
const pathPart = /^".*"$/.test(raw) ? raw.slice(1, -1) : raw;
|
|
3036
3036
|
const prefix = !pathPart && rRel.test(cmd) ? cmd.slice(0, 2) : "";
|
|
3037
|
-
return prefix +
|
|
3037
|
+
return prefix + join13(pathPart, cmd);
|
|
3038
3038
|
};
|
|
3039
3039
|
var which2 = async (cmd, opt = {}) => {
|
|
3040
3040
|
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
@@ -3227,7 +3227,7 @@ module.exports = __toCommonJS(src_exports);
|
|
|
3227
3227
|
var import_assert = __toESM(require("assert"));
|
|
3228
3228
|
var import_child_process3 = require("child_process");
|
|
3229
3229
|
var import_fs13 = __toESM(require("fs"));
|
|
3230
|
-
var
|
|
3230
|
+
var import_path13 = require("path");
|
|
3231
3231
|
|
|
3232
3232
|
// src/package-versions.ts
|
|
3233
3233
|
var VERCEL_RUNTIME_VERSION = "0.13.0";
|
|
@@ -4873,12 +4873,8 @@ async function calculatePerPackageSizes(venvPath) {
|
|
|
4873
4873
|
|
|
4874
4874
|
// src/diagnostics.ts
|
|
4875
4875
|
var import_fs6 = __toESM(require("fs"));
|
|
4876
|
-
var import_path7 = require("path");
|
|
4877
4876
|
var import_build_utils6 = require("@vercel/build-utils");
|
|
4878
4877
|
var import_python_analysis4 = require("@vercel/python-analysis");
|
|
4879
|
-
var MANIFEST_FILENAME = "package-manifest.json";
|
|
4880
|
-
var DIAGNOSTICS_PATH = (0, import_path7.join)(".vercel", "python", MANIFEST_FILENAME);
|
|
4881
|
-
var MANIFEST_VERSION = "20260304";
|
|
4882
4878
|
function isDependencyGroupInclude(entry) {
|
|
4883
4879
|
return typeof entry === "object" && "include-group" in entry;
|
|
4884
4880
|
}
|
|
@@ -5050,10 +5046,10 @@ async function generateProjectManifest({
|
|
|
5050
5046
|
name,
|
|
5051
5047
|
type: "direct",
|
|
5052
5048
|
scopes: [...scopes].sort(),
|
|
5053
|
-
requested: directRequested.get(name)
|
|
5049
|
+
requested: directRequested.get(name),
|
|
5050
|
+
resolved: info?.version ?? ""
|
|
5054
5051
|
};
|
|
5055
5052
|
if (info) {
|
|
5056
|
-
entry.resolved = info.version;
|
|
5057
5053
|
const src = mapSource(info.source);
|
|
5058
5054
|
if (src.source)
|
|
5059
5055
|
entry.source = src.source;
|
|
@@ -5080,7 +5076,7 @@ async function generateProjectManifest({
|
|
|
5080
5076
|
}
|
|
5081
5077
|
}
|
|
5082
5078
|
const manifest = {
|
|
5083
|
-
version: MANIFEST_VERSION,
|
|
5079
|
+
version: import_build_utils6.MANIFEST_VERSION,
|
|
5084
5080
|
runtime: "python",
|
|
5085
5081
|
runtimeVersion: {
|
|
5086
5082
|
...requested ? { requested } : {},
|
|
@@ -5092,37 +5088,20 @@ async function generateProjectManifest({
|
|
|
5092
5088
|
...transitiveEntries.sort((a, b) => a.name.localeCompare(b.name))
|
|
5093
5089
|
]
|
|
5094
5090
|
};
|
|
5095
|
-
|
|
5096
|
-
await import_fs6.default.promises.mkdir((0, import_path7.dirname)(outPath), { recursive: true });
|
|
5097
|
-
await import_fs6.default.promises.writeFile(outPath, JSON.stringify(manifest, null, 2));
|
|
5091
|
+
await (0, import_build_utils6.writeProjectManifest)(manifest, workPath, "python");
|
|
5098
5092
|
}
|
|
5099
|
-
var diagnostics =
|
|
5100
|
-
workPath
|
|
5101
|
-
}) => {
|
|
5102
|
-
try {
|
|
5103
|
-
const manifestPath = (0, import_path7.join)(workPath, DIAGNOSTICS_PATH);
|
|
5104
|
-
const data = await import_fs6.default.promises.readFile(manifestPath, "utf-8");
|
|
5105
|
-
return {
|
|
5106
|
-
[MANIFEST_FILENAME]: new import_build_utils6.FileBlob({ data })
|
|
5107
|
-
};
|
|
5108
|
-
} catch (err) {
|
|
5109
|
-
(0, import_build_utils6.debug)(
|
|
5110
|
-
`Diagnostics: no cached manifest found: ${err instanceof Error ? err.message : String(err)}`
|
|
5111
|
-
);
|
|
5112
|
-
return {};
|
|
5113
|
-
}
|
|
5114
|
-
};
|
|
5093
|
+
var diagnostics = (0, import_build_utils6.createDiagnostics)("python");
|
|
5115
5094
|
|
|
5116
5095
|
// src/crons.ts
|
|
5117
5096
|
var import_fs7 = __toESM(require("fs"));
|
|
5118
|
-
var
|
|
5097
|
+
var import_path7 = require("path");
|
|
5119
5098
|
var import_execa4 = __toESM(require_execa());
|
|
5120
5099
|
var import_build_utils7 = require("@vercel/build-utils");
|
|
5121
5100
|
var DYNAMIC_SCHEDULE = "<dynamic>";
|
|
5122
5101
|
function entrypointToModule(entrypoint) {
|
|
5123
5102
|
return entrypoint.replace(/\\/g, "/").replace(/\.py$/i, "").replace(/\//g, ".");
|
|
5124
5103
|
}
|
|
5125
|
-
var scriptPath = (0,
|
|
5104
|
+
var scriptPath = (0, import_path7.join)(__dirname, "..", "templates", "vc_cron_detect.py");
|
|
5126
5105
|
var script = import_fs7.default.readFileSync(scriptPath, "utf-8");
|
|
5127
5106
|
function buildCronRouteTable(crons) {
|
|
5128
5107
|
const table = {};
|
|
@@ -5133,7 +5112,8 @@ function buildCronRouteTable(crons) {
|
|
|
5133
5112
|
}
|
|
5134
5113
|
async function getServiceCrons(opts) {
|
|
5135
5114
|
const { service, entrypoint, rawEntrypoint, handlerFunction } = opts;
|
|
5136
|
-
|
|
5115
|
+
const isScheduledService = service?.type === "cron" || service?.type === "job" && service.trigger === "schedule";
|
|
5116
|
+
if (!isScheduledService || !service.name || typeof service.schedule !== "string") {
|
|
5137
5117
|
return void 0;
|
|
5138
5118
|
}
|
|
5139
5119
|
const cronEntrypoint = entrypoint || rawEntrypoint;
|
|
@@ -5257,14 +5237,14 @@ function moduleColonFuncToCronPath(serviceName, moduleFunction) {
|
|
|
5257
5237
|
// src/start-dev-server.ts
|
|
5258
5238
|
var import_child_process2 = require("child_process");
|
|
5259
5239
|
var import_fs9 = require("fs");
|
|
5260
|
-
var
|
|
5240
|
+
var import_path9 = require("path");
|
|
5261
5241
|
var import_build_utils11 = require("@vercel/build-utils");
|
|
5262
5242
|
var import_get_port = __toESM(require_get_port());
|
|
5263
5243
|
var import_is_port_reachable = __toESM(require_is_port_reachable());
|
|
5264
5244
|
|
|
5265
5245
|
// src/entrypoint.ts
|
|
5266
5246
|
var import_fs8 = __toESM(require("fs"));
|
|
5267
|
-
var
|
|
5247
|
+
var import_path8 = require("path");
|
|
5268
5248
|
var import_build_utils8 = require("@vercel/build-utils");
|
|
5269
5249
|
var import_build_utils9 = require("@vercel/build-utils");
|
|
5270
5250
|
var import_build_utils10 = require("@vercel/build-utils");
|
|
@@ -5284,7 +5264,7 @@ var PYTHON_CANDIDATE_ENTRYPOINTS = getCandidateEntrypointsInDirs(
|
|
|
5284
5264
|
function getCandidateEntrypointsInDirs(dirs) {
|
|
5285
5265
|
return dirs.flatMap(
|
|
5286
5266
|
(dir) => PYTHON_ENTRYPOINT_FILENAMES.map(
|
|
5287
|
-
(filename) =>
|
|
5267
|
+
(filename) => import_path8.posix.join(dir, `${filename}.py`)
|
|
5288
5268
|
)
|
|
5289
5269
|
);
|
|
5290
5270
|
}
|
|
@@ -5297,14 +5277,14 @@ async function fileExists(filePath) {
|
|
|
5297
5277
|
}
|
|
5298
5278
|
}
|
|
5299
5279
|
async function checkEntrypoint(workPath, relPath) {
|
|
5300
|
-
const absPath = (0,
|
|
5280
|
+
const absPath = (0, import_path8.join)(workPath, relPath);
|
|
5301
5281
|
if (!await fileExists(absPath))
|
|
5302
5282
|
return null;
|
|
5303
5283
|
const content = await import_fs8.default.promises.readFile(absPath, "utf-8");
|
|
5304
5284
|
return (0, import_python_analysis5.findAppOrHandler)(content);
|
|
5305
5285
|
}
|
|
5306
5286
|
async function getPyprojectEntrypoint(workPath) {
|
|
5307
|
-
const pyprojectData = await (0, import_build_utils10.readConfigFile)((0,
|
|
5287
|
+
const pyprojectData = await (0, import_build_utils10.readConfigFile)((0, import_path8.join)(workPath, "pyproject.toml"));
|
|
5308
5288
|
if (!pyprojectData)
|
|
5309
5289
|
return null;
|
|
5310
5290
|
const scripts = pyprojectData.project?.scripts;
|
|
@@ -5319,7 +5299,7 @@ async function getPyprojectEntrypoint(workPath) {
|
|
|
5319
5299
|
const relPath = modulePath.replace(/\./g, "/");
|
|
5320
5300
|
const candidates = [`${relPath}.py`, `${relPath}/__init__.py`];
|
|
5321
5301
|
for (const candidate of candidates) {
|
|
5322
|
-
if (await fileExists((0,
|
|
5302
|
+
if (await fileExists((0, import_path8.join)(workPath, candidate))) {
|
|
5323
5303
|
return { entrypoint: candidate, variableName };
|
|
5324
5304
|
}
|
|
5325
5305
|
}
|
|
@@ -5336,7 +5316,7 @@ async function findValidEntrypoint(workPath, candidates) {
|
|
|
5336
5316
|
return null;
|
|
5337
5317
|
}
|
|
5338
5318
|
async function checkDjangoManage(workPath) {
|
|
5339
|
-
const managePath = (0,
|
|
5319
|
+
const managePath = (0, import_path8.join)(workPath, "manage.py");
|
|
5340
5320
|
try {
|
|
5341
5321
|
const content = await import_fs8.default.promises.readFile(managePath, "utf-8");
|
|
5342
5322
|
if (!content.includes("DJANGO_SETTINGS_MODULE"))
|
|
@@ -5383,7 +5363,7 @@ async function detectDjangoPythonEntrypoint(workPath) {
|
|
|
5383
5363
|
const subdirs = await getSubdirectories(workPath);
|
|
5384
5364
|
const rootDirs = ["", ...subdirs];
|
|
5385
5365
|
for (const rootDir of rootDirs) {
|
|
5386
|
-
const currPath = (0,
|
|
5366
|
+
const currPath = (0, import_path8.join)(workPath, rootDir);
|
|
5387
5367
|
const isDjango = await checkDjangoManage(currPath);
|
|
5388
5368
|
if (isDjango) {
|
|
5389
5369
|
return { baseDir: rootDir, error: makeDetectError("django") };
|
|
@@ -5403,8 +5383,8 @@ async function detectPythonEntrypoint(framework, workPath, configuredEntrypoint,
|
|
|
5403
5383
|
const entrypoint = configEntryFile.endsWith(".py") ? configEntryFile : `${configEntryFile}.py`;
|
|
5404
5384
|
let varName = configEntryVar ?? await checkEntrypoint(workPath, entrypoint);
|
|
5405
5385
|
if (!varName) {
|
|
5406
|
-
const
|
|
5407
|
-
if (
|
|
5386
|
+
const needsDynamicApp = !!service && ((0, import_build_utils8.isScheduleTriggeredService)(service) || (0, import_build_utils8.isQueueTriggeredService)(service));
|
|
5387
|
+
if (needsDynamicApp) {
|
|
5408
5388
|
varName = "app";
|
|
5409
5389
|
}
|
|
5410
5390
|
}
|
|
@@ -5523,9 +5503,9 @@ async function syncDependencies({
|
|
|
5523
5503
|
return;
|
|
5524
5504
|
}
|
|
5525
5505
|
if (manifest?.origin && manifestType === "pyproject.toml") {
|
|
5526
|
-
const syncDir = (0,
|
|
5506
|
+
const syncDir = (0, import_path9.join)(workPath, ".vercel", "python", "sync");
|
|
5527
5507
|
(0, import_fs9.mkdirSync)(syncDir, { recursive: true });
|
|
5528
|
-
const tempPyproject = (0,
|
|
5508
|
+
const tempPyproject = (0, import_path9.join)(syncDir, "pyproject.toml");
|
|
5529
5509
|
const content = (0, import_python_analysis6.stringifyManifest)(manifest.data);
|
|
5530
5510
|
(0, import_fs9.writeFileSync)(tempPyproject, content, "utf8");
|
|
5531
5511
|
manifestPath = tempPyproject;
|
|
@@ -5577,7 +5557,7 @@ async function runSync({
|
|
|
5577
5557
|
onStdout,
|
|
5578
5558
|
onStderr
|
|
5579
5559
|
}) {
|
|
5580
|
-
const projectDir = (0,
|
|
5560
|
+
const projectDir = (0, import_path9.dirname)(manifestPath);
|
|
5581
5561
|
const pip = uvPath ? { cmd: uvPath, prefix: ["pip", "install"] } : { cmd: pythonBin, prefix: ["-m", "pip", "install"] };
|
|
5582
5562
|
let spawnCmd;
|
|
5583
5563
|
let spawnArgs;
|
|
@@ -5654,7 +5634,7 @@ async function installVercelRuntime({
|
|
|
5654
5634
|
onStdout,
|
|
5655
5635
|
onStderr
|
|
5656
5636
|
}) {
|
|
5657
|
-
const targetDir = (0,
|
|
5637
|
+
const targetDir = (0, import_path9.join)(workPath, ".vercel", "python");
|
|
5658
5638
|
let pending = PENDING_RUNTIME_INSTALLS.get(targetDir);
|
|
5659
5639
|
if (!pending) {
|
|
5660
5640
|
pending = doInstallVercelRuntime({
|
|
@@ -5681,7 +5661,7 @@ async function doInstallVercelRuntime({
|
|
|
5681
5661
|
onStderr
|
|
5682
5662
|
}) {
|
|
5683
5663
|
(0, import_fs9.mkdirSync)(targetDir, { recursive: true });
|
|
5684
|
-
const localRuntimeDir = (0,
|
|
5664
|
+
const localRuntimeDir = (0, import_path9.join)(
|
|
5685
5665
|
__dirname,
|
|
5686
5666
|
"..",
|
|
5687
5667
|
"..",
|
|
@@ -5689,10 +5669,10 @@ async function doInstallVercelRuntime({
|
|
|
5689
5669
|
"python",
|
|
5690
5670
|
"vercel-runtime"
|
|
5691
5671
|
);
|
|
5692
|
-
const isLocalDev = (0, import_fs9.existsSync)((0,
|
|
5672
|
+
const isLocalDev = (0, import_fs9.existsSync)((0, import_path9.join)(localRuntimeDir, "pyproject.toml"));
|
|
5693
5673
|
const runtimeDep = env.VERCEL_RUNTIME_PYTHON || (isLocalDev ? localRuntimeDir : `vercel-runtime==${VERCEL_RUNTIME_VERSION}`);
|
|
5694
5674
|
if (!isLocalDev && !env.VERCEL_RUNTIME_PYTHON) {
|
|
5695
|
-
const distInfo = (0,
|
|
5675
|
+
const distInfo = (0, import_path9.join)(
|
|
5696
5676
|
targetDir,
|
|
5697
5677
|
`vercel_runtime-${VERCEL_RUNTIME_VERSION}.dist-info`
|
|
5698
5678
|
);
|
|
@@ -5750,7 +5730,7 @@ async function installVercelWorkers({
|
|
|
5750
5730
|
onStdout,
|
|
5751
5731
|
onStderr
|
|
5752
5732
|
}) {
|
|
5753
|
-
const targetDir = (0,
|
|
5733
|
+
const targetDir = (0, import_path9.join)(workPath, ".vercel", "python");
|
|
5754
5734
|
let pending = PENDING_WORKERS_INSTALLS.get(targetDir);
|
|
5755
5735
|
if (!pending) {
|
|
5756
5736
|
pending = doInstallVercelWorkers({
|
|
@@ -5777,7 +5757,7 @@ async function doInstallVercelWorkers({
|
|
|
5777
5757
|
onStderr
|
|
5778
5758
|
}) {
|
|
5779
5759
|
(0, import_fs9.mkdirSync)(targetDir, { recursive: true });
|
|
5780
|
-
const localWorkersDir = (0,
|
|
5760
|
+
const localWorkersDir = (0, import_path9.join)(
|
|
5781
5761
|
__dirname,
|
|
5782
5762
|
"..",
|
|
5783
5763
|
"..",
|
|
@@ -5785,10 +5765,10 @@ async function doInstallVercelWorkers({
|
|
|
5785
5765
|
"python",
|
|
5786
5766
|
"vercel-workers"
|
|
5787
5767
|
);
|
|
5788
|
-
const isLocalDev = (0, import_fs9.existsSync)((0,
|
|
5768
|
+
const isLocalDev = (0, import_fs9.existsSync)((0, import_path9.join)(localWorkersDir, "pyproject.toml"));
|
|
5789
5769
|
const workersDep = env.VERCEL_WORKERS_PYTHON || (isLocalDev ? localWorkersDir : `vercel-workers==${VERCEL_WORKERS_VERSION}`);
|
|
5790
5770
|
if (!isLocalDev && !env.VERCEL_WORKERS_PYTHON) {
|
|
5791
|
-
const distInfo = (0,
|
|
5771
|
+
const distInfo = (0, import_path9.join)(
|
|
5792
5772
|
targetDir,
|
|
5793
5773
|
`vercel_workers-${VERCEL_WORKERS_VERSION}.dist-info`
|
|
5794
5774
|
);
|
|
@@ -5881,18 +5861,18 @@ function installGlobalCleanupHandlers() {
|
|
|
5881
5861
|
}
|
|
5882
5862
|
function createDevShim(workPath, entry, modulePath, serviceName, framework, variableName) {
|
|
5883
5863
|
try {
|
|
5884
|
-
const vercelPythonDir = serviceName ? (0,
|
|
5864
|
+
const vercelPythonDir = serviceName ? (0, import_path9.join)(workPath, ".vercel", "python", "services", serviceName) : (0, import_path9.join)(workPath, ".vercel", "python");
|
|
5885
5865
|
(0, import_fs9.mkdirSync)(vercelPythonDir, { recursive: true });
|
|
5886
5866
|
let qualifiedModule = modulePath;
|
|
5887
5867
|
let extraPythonPath;
|
|
5888
|
-
if ((0, import_fs9.existsSync)((0,
|
|
5889
|
-
const pkgName = (0,
|
|
5868
|
+
if ((0, import_fs9.existsSync)((0, import_path9.join)(workPath, "__init__.py"))) {
|
|
5869
|
+
const pkgName = (0, import_path9.basename)(workPath);
|
|
5890
5870
|
qualifiedModule = `${pkgName}.${modulePath}`;
|
|
5891
|
-
extraPythonPath = (0,
|
|
5871
|
+
extraPythonPath = (0, import_path9.dirname)(workPath);
|
|
5892
5872
|
}
|
|
5893
|
-
const entryAbs = (0,
|
|
5894
|
-
const shimPath = (0,
|
|
5895
|
-
const templatePath = (0,
|
|
5873
|
+
const entryAbs = (0, import_path9.join)(workPath, entry);
|
|
5874
|
+
const shimPath = (0, import_path9.join)(vercelPythonDir, `${DEV_SHIM_MODULE}.py`);
|
|
5875
|
+
const templatePath = (0, import_path9.join)(
|
|
5896
5876
|
__dirname,
|
|
5897
5877
|
"..",
|
|
5898
5878
|
"templates",
|
|
@@ -5918,7 +5898,7 @@ async function getMultiServicePythonRunner(workPath, env, systemPython, uvPath)
|
|
|
5918
5898
|
(0, import_build_utils11.debug)(`Using existing virtualenv at ${venvRoot} for multi-service dev`);
|
|
5919
5899
|
return { command: pythonCmd, args: [] };
|
|
5920
5900
|
}
|
|
5921
|
-
const venvPath = (0,
|
|
5901
|
+
const venvPath = (0, import_path9.join)(workPath, ".venv");
|
|
5922
5902
|
await ensureVenv({
|
|
5923
5903
|
pythonVersion: { pythonPath: systemPython },
|
|
5924
5904
|
venvPath,
|
|
@@ -5929,7 +5909,7 @@ async function getMultiServicePythonRunner(workPath, env, systemPython, uvPath)
|
|
|
5929
5909
|
const pythonBin = getVenvPythonBin(venvPath);
|
|
5930
5910
|
const binDir = getVenvBinDir(venvPath);
|
|
5931
5911
|
env.VIRTUAL_ENV = venvPath;
|
|
5932
|
-
env.PATH = `${binDir}${
|
|
5912
|
+
env.PATH = `${binDir}${import_path9.delimiter}${env.PATH || ""}`;
|
|
5933
5913
|
return { command: pythonBin, args: [] };
|
|
5934
5914
|
}
|
|
5935
5915
|
var startDevServer = async (opts) => {
|
|
@@ -5981,9 +5961,9 @@ var startDevServer = async (opts) => {
|
|
|
5981
5961
|
workPath,
|
|
5982
5962
|
entrypoint ? {
|
|
5983
5963
|
filePath: entrypoint,
|
|
5984
|
-
//
|
|
5985
|
-
//
|
|
5986
|
-
varName: service?.type === "cron" ? void 0 : handlerFunction
|
|
5964
|
+
// Schedule-triggered services create their own "app" wrapper dynamically.
|
|
5965
|
+
// Other services use handlerFunction as the entrypoint variable name.
|
|
5966
|
+
varName: service?.type === "cron" || service?.type === "job" && service.trigger === "schedule" ? void 0 : handlerFunction
|
|
5987
5967
|
} : void 0,
|
|
5988
5968
|
service
|
|
5989
5969
|
);
|
|
@@ -5992,7 +5972,7 @@ var startDevServer = async (opts) => {
|
|
|
5992
5972
|
} else {
|
|
5993
5973
|
const hookResult = await runFrameworkHook(framework, {
|
|
5994
5974
|
pythonEnv: env,
|
|
5995
|
-
projectDir: (0,
|
|
5975
|
+
projectDir: (0, import_path9.join)(workPath, detected?.baseDir ?? ""),
|
|
5996
5976
|
workPath,
|
|
5997
5977
|
entrypoint,
|
|
5998
5978
|
detected: detected ?? void 0
|
|
@@ -6128,7 +6108,7 @@ If you are using a virtual environment, activate it before running "vercel dev",
|
|
|
6128
6108
|
const port = typeof meta.port === "number" ? meta.port : await (0, import_get_port.default)();
|
|
6129
6109
|
env.PORT = `${port}`;
|
|
6130
6110
|
if (entry) {
|
|
6131
|
-
env.__VC_HANDLER_ENTRYPOINT_ABS = (0,
|
|
6111
|
+
env.__VC_HANDLER_ENTRYPOINT_ABS = (0, import_path9.join)(workPath, entry);
|
|
6132
6112
|
}
|
|
6133
6113
|
const devShim = createDevShim(
|
|
6134
6114
|
workPath,
|
|
@@ -6139,8 +6119,8 @@ If you are using a virtual environment, activate it before running "vercel dev",
|
|
|
6139
6119
|
variableName ?? ""
|
|
6140
6120
|
);
|
|
6141
6121
|
if (devShim) {
|
|
6142
|
-
const shimDir = devShim.shimDir || (0,
|
|
6143
|
-
const runtimeDir = (0,
|
|
6122
|
+
const shimDir = devShim.shimDir || (0, import_path9.join)(workPath, ".vercel", "python");
|
|
6123
|
+
const runtimeDir = (0, import_path9.join)(workPath, ".vercel", "python");
|
|
6144
6124
|
const pathParts = shimDir !== runtimeDir ? [shimDir, runtimeDir] : [shimDir];
|
|
6145
6125
|
if (devShim.extraPythonPath) {
|
|
6146
6126
|
pathParts.push(devShim.extraPythonPath);
|
|
@@ -6149,7 +6129,7 @@ If you are using a virtual environment, activate it before running "vercel dev",
|
|
|
6149
6129
|
if (existingPythonPath) {
|
|
6150
6130
|
pathParts.push(existingPythonPath);
|
|
6151
6131
|
}
|
|
6152
|
-
env.PYTHONPATH = pathParts.join(
|
|
6132
|
+
env.PYTHONPATH = pathParts.join(import_path9.delimiter);
|
|
6153
6133
|
}
|
|
6154
6134
|
const moduleToRun = devShim?.module || modulePath;
|
|
6155
6135
|
const pythonArgs = ["-u", "-m", moduleToRun];
|
|
@@ -6223,7 +6203,7 @@ var matplotlibQuirk = {
|
|
|
6223
6203
|
|
|
6224
6204
|
// src/quirks/litellm.ts
|
|
6225
6205
|
var import_fs10 = __toESM(require("fs"));
|
|
6226
|
-
var
|
|
6206
|
+
var import_path10 = require("path");
|
|
6227
6207
|
var import_build_utils12 = require("@vercel/build-utils");
|
|
6228
6208
|
var LAMBDA_ROOT = "/var/task";
|
|
6229
6209
|
var CONFIG_CANDIDATES = [
|
|
@@ -6234,7 +6214,7 @@ var CONFIG_CANDIDATES = [
|
|
|
6234
6214
|
];
|
|
6235
6215
|
async function findConfigFile(workPath) {
|
|
6236
6216
|
for (const name of CONFIG_CANDIDATES) {
|
|
6237
|
-
const candidate = (0,
|
|
6217
|
+
const candidate = (0, import_path10.join)(workPath, name);
|
|
6238
6218
|
try {
|
|
6239
6219
|
await import_fs10.default.promises.access(candidate);
|
|
6240
6220
|
return name;
|
|
@@ -6251,7 +6231,7 @@ var litellmQuirk = {
|
|
|
6251
6231
|
const env = {};
|
|
6252
6232
|
const sitePackagesDirs = await getVenvSitePackagesDirs(ctx.venvPath);
|
|
6253
6233
|
for (const sitePackages of sitePackagesDirs) {
|
|
6254
|
-
const schemaPath = (0,
|
|
6234
|
+
const schemaPath = (0, import_path10.join)(
|
|
6255
6235
|
sitePackages,
|
|
6256
6236
|
"litellm",
|
|
6257
6237
|
"proxy",
|
|
@@ -6272,8 +6252,8 @@ var litellmQuirk = {
|
|
|
6272
6252
|
const configName = await findConfigFile(ctx.workPath);
|
|
6273
6253
|
if (configName) {
|
|
6274
6254
|
(0, import_build_utils12.debug)(`LiteLLM quirk: found config at ${configName}`);
|
|
6275
|
-
buildEnv.CONFIG_FILE_PATH = (0,
|
|
6276
|
-
env.CONFIG_FILE_PATH = (0,
|
|
6255
|
+
buildEnv.CONFIG_FILE_PATH = (0, import_path10.join)(ctx.workPath, configName);
|
|
6256
|
+
env.CONFIG_FILE_PATH = (0, import_path10.join)(LAMBDA_ROOT, configName);
|
|
6277
6257
|
}
|
|
6278
6258
|
} else {
|
|
6279
6259
|
(0, import_build_utils12.debug)(
|
|
@@ -6286,7 +6266,7 @@ var litellmQuirk = {
|
|
|
6286
6266
|
|
|
6287
6267
|
// src/quirks/prisma.ts
|
|
6288
6268
|
var import_fs11 = __toESM(require("fs"));
|
|
6289
|
-
var
|
|
6269
|
+
var import_path11 = require("path");
|
|
6290
6270
|
var import_execa5 = __toESM(require_execa());
|
|
6291
6271
|
var import_build_utils13 = require("@vercel/build-utils");
|
|
6292
6272
|
var import_python_analysis7 = require("@vercel/python-analysis");
|
|
@@ -6326,7 +6306,7 @@ model DummyModel {
|
|
|
6326
6306
|
async function findUserSchema(workPath) {
|
|
6327
6307
|
const envPath = process.env.PRISMA_SCHEMA_PATH;
|
|
6328
6308
|
if (envPath) {
|
|
6329
|
-
const resolved = (0,
|
|
6309
|
+
const resolved = (0, import_path11.isAbsolute)(envPath) ? envPath : (0, import_path11.join)(workPath, envPath);
|
|
6330
6310
|
try {
|
|
6331
6311
|
await import_fs11.default.promises.access(resolved);
|
|
6332
6312
|
return resolved;
|
|
@@ -6336,8 +6316,8 @@ async function findUserSchema(workPath) {
|
|
|
6336
6316
|
}
|
|
6337
6317
|
}
|
|
6338
6318
|
const candidates = [
|
|
6339
|
-
(0,
|
|
6340
|
-
(0,
|
|
6319
|
+
(0, import_path11.join)(workPath, "schema.prisma"),
|
|
6320
|
+
(0, import_path11.join)(workPath, "prisma", "schema.prisma")
|
|
6341
6321
|
];
|
|
6342
6322
|
for (const candidate of candidates) {
|
|
6343
6323
|
try {
|
|
@@ -6359,20 +6339,20 @@ async function collectFiles(dir, base) {
|
|
|
6359
6339
|
for (const entry of entries) {
|
|
6360
6340
|
if (entry.name === "__pycache__")
|
|
6361
6341
|
continue;
|
|
6362
|
-
const full = (0,
|
|
6342
|
+
const full = (0, import_path11.join)(dir, entry.name);
|
|
6363
6343
|
if (entry.isDirectory()) {
|
|
6364
6344
|
result.push(...await collectFiles(full, base));
|
|
6365
6345
|
} else {
|
|
6366
|
-
result.push((0,
|
|
6346
|
+
result.push((0, import_path11.relative)(base, full));
|
|
6367
6347
|
}
|
|
6368
6348
|
}
|
|
6369
6349
|
return result;
|
|
6370
6350
|
}
|
|
6371
6351
|
async function cleanCacheArtifacts(cacheDir, extras = []) {
|
|
6372
6352
|
const paths = [
|
|
6373
|
-
(0,
|
|
6374
|
-
(0,
|
|
6375
|
-
(0,
|
|
6353
|
+
(0, import_path11.join)(cacheDir, "node_modules"),
|
|
6354
|
+
(0, import_path11.join)(cacheDir, "package.json"),
|
|
6355
|
+
(0, import_path11.join)(cacheDir, "package-lock.json"),
|
|
6376
6356
|
...extras
|
|
6377
6357
|
];
|
|
6378
6358
|
for (const p of paths) {
|
|
@@ -6401,7 +6381,7 @@ var prismaQuirk = {
|
|
|
6401
6381
|
async run(ctx) {
|
|
6402
6382
|
const { venvPath, pythonEnv, workPath } = ctx;
|
|
6403
6383
|
const pythonPath = getVenvPythonBin(venvPath);
|
|
6404
|
-
const runtimeCacheDir = (0,
|
|
6384
|
+
const runtimeCacheDir = (0, import_path11.join)(
|
|
6405
6385
|
LAMBDA_ROOT2,
|
|
6406
6386
|
resolveVendorDir(),
|
|
6407
6387
|
"prisma",
|
|
@@ -6411,7 +6391,7 @@ var prismaQuirk = {
|
|
|
6411
6391
|
let sitePackages;
|
|
6412
6392
|
for (const dir of sitePackagesDirs) {
|
|
6413
6393
|
try {
|
|
6414
|
-
await import_fs11.default.promises.access((0,
|
|
6394
|
+
await import_fs11.default.promises.access((0, import_path11.join)(dir, "prisma"));
|
|
6415
6395
|
sitePackages = dir;
|
|
6416
6396
|
break;
|
|
6417
6397
|
} catch {
|
|
@@ -6423,14 +6403,14 @@ var prismaQuirk = {
|
|
|
6423
6403
|
);
|
|
6424
6404
|
return {};
|
|
6425
6405
|
}
|
|
6426
|
-
const cacheDir = (0,
|
|
6406
|
+
const cacheDir = (0, import_path11.join)(sitePackages, "prisma", "__bincache__");
|
|
6427
6407
|
await import_fs11.default.promises.mkdir(cacheDir, { recursive: true });
|
|
6428
6408
|
const generateEnv = {
|
|
6429
6409
|
...pythonEnv,
|
|
6430
6410
|
PRISMA_BINARY_CACHE_DIR: cacheDir
|
|
6431
6411
|
};
|
|
6432
|
-
const generatedDir = (0,
|
|
6433
|
-
const dummySchemaPath = (0,
|
|
6412
|
+
const generatedDir = (0, import_path11.join)(workPath, "_prisma_generated");
|
|
6413
|
+
const dummySchemaPath = (0, import_path11.join)(workPath, DUMMY_SCHEMA_NAME);
|
|
6434
6414
|
await import_fs11.default.promises.writeFile(
|
|
6435
6415
|
dummySchemaPath,
|
|
6436
6416
|
buildDummySchema(generatedDir)
|
|
@@ -6459,15 +6439,15 @@ var prismaQuirk = {
|
|
|
6459
6439
|
}
|
|
6460
6440
|
const srcBinaryPrefix = `query-engine-${getLambdaBinaryTarget()}`;
|
|
6461
6441
|
const runtimeName = `prisma-query-engine-rhel-openssl-${RUNTIME_OPENSSL_VERSION}.x`;
|
|
6462
|
-
const nodeModulesDir = (0,
|
|
6442
|
+
const nodeModulesDir = (0, import_path11.join)(cacheDir, "node_modules", "prisma");
|
|
6463
6443
|
let engineCopied = false;
|
|
6464
6444
|
try {
|
|
6465
6445
|
const entries = await import_fs11.default.promises.readdir(nodeModulesDir);
|
|
6466
6446
|
for (const entry of entries) {
|
|
6467
6447
|
if (!entry.startsWith(srcBinaryPrefix))
|
|
6468
6448
|
continue;
|
|
6469
|
-
const srcPath = (0,
|
|
6470
|
-
const destPath = (0,
|
|
6449
|
+
const srcPath = (0, import_path11.join)(nodeModulesDir, entry);
|
|
6450
|
+
const destPath = (0, import_path11.join)(cacheDir, runtimeName);
|
|
6471
6451
|
try {
|
|
6472
6452
|
await import_fs11.default.promises.access(destPath);
|
|
6473
6453
|
(0, import_build_utils13.debug)(`Engine binary: ${runtimeName} already exists, skipping`);
|
|
@@ -6490,7 +6470,7 @@ var prismaQuirk = {
|
|
|
6490
6470
|
message: `could not find engine binary matching "${srcBinaryPrefix}*" in "${nodeModulesDir}". This may indicate an incompatible prisma version or an unsupported platform (${process.arch}).`
|
|
6491
6471
|
});
|
|
6492
6472
|
}
|
|
6493
|
-
const shimPath = (0,
|
|
6473
|
+
const shimPath = (0, import_path11.join)(cacheDir, "openssl");
|
|
6494
6474
|
await import_fs11.default.promises.writeFile(
|
|
6495
6475
|
shimPath,
|
|
6496
6476
|
`#!/bin/sh
|
|
@@ -6546,7 +6526,7 @@ echo "OpenSSL ${RUNTIME_OPENSSL_VERSION}.0 1 Jan 2024 (Library: OpenSSL ${RUNTIM
|
|
|
6546
6526
|
}
|
|
6547
6527
|
try {
|
|
6548
6528
|
const allFiles = await collectFiles(
|
|
6549
|
-
(0,
|
|
6529
|
+
(0, import_path11.join)(sitePackages, "prisma"),
|
|
6550
6530
|
sitePackages
|
|
6551
6531
|
);
|
|
6552
6532
|
const count = await (0, import_python_analysis7.extendDistRecord)(sitePackages, "prisma", allFiles);
|
|
@@ -6673,10 +6653,10 @@ async function runQuirks(ctx) {
|
|
|
6673
6653
|
|
|
6674
6654
|
// src/django.ts
|
|
6675
6655
|
var import_fs12 = __toESM(require("fs"));
|
|
6676
|
-
var
|
|
6656
|
+
var import_path12 = require("path");
|
|
6677
6657
|
var import_execa6 = __toESM(require_execa());
|
|
6678
6658
|
var import_build_utils15 = require("@vercel/build-utils");
|
|
6679
|
-
var scriptPath2 = (0,
|
|
6659
|
+
var scriptPath2 = (0, import_path12.join)(__dirname, "..", "templates", "vc_django_settings.py");
|
|
6680
6660
|
var script2 = import_fs12.default.readFileSync(scriptPath2, "utf-8");
|
|
6681
6661
|
async function getDjangoSettings(projectDir, env) {
|
|
6682
6662
|
const { stdout } = await (0, import_execa6.default)("python", ["-c", script2], {
|
|
@@ -6705,7 +6685,7 @@ async function runDjangoCollectStatic(venvPath, workPath, env, outputStaticDir,
|
|
|
6705
6685
|
const installedApps = djangoSettings["INSTALLED_APPS"] ?? [];
|
|
6706
6686
|
const staticfilesDirs = djangoSettings["STATICFILES_DIRS"] ?? [];
|
|
6707
6687
|
const staticSourceDirs = [
|
|
6708
|
-
...installedApps.map((app) => (0,
|
|
6688
|
+
...installedApps.map((app) => (0, import_path12.join)(workPath, ...app.split("."), "static")),
|
|
6709
6689
|
// TODO: Deal with optional prefixes in STATICFILES_DIRS.
|
|
6710
6690
|
...staticfilesDirs.map((d) => Array.isArray(d) ? d[1] : d)
|
|
6711
6691
|
].filter((d) => import_fs12.default.existsSync(d));
|
|
@@ -6719,7 +6699,7 @@ async function runDjangoCollectStatic(venvPath, workPath, env, outputStaticDir,
|
|
|
6719
6699
|
});
|
|
6720
6700
|
return {
|
|
6721
6701
|
staticSourceDirs,
|
|
6722
|
-
staticRoot: staticRoot ? (0,
|
|
6702
|
+
staticRoot: staticRoot ? (0, import_path12.resolve)(workPath, staticRoot) : null,
|
|
6723
6703
|
cdnOutputDir: null,
|
|
6724
6704
|
manifestRelPath: null
|
|
6725
6705
|
};
|
|
@@ -6731,9 +6711,9 @@ async function runDjangoCollectStatic(venvPath, workPath, env, outputStaticDir,
|
|
|
6731
6711
|
return null;
|
|
6732
6712
|
}
|
|
6733
6713
|
const staticUrlPath = staticUrl.replace(/^\/|\/$/g, "") || "static";
|
|
6734
|
-
const staticOutputDir = (0,
|
|
6714
|
+
const staticOutputDir = (0, import_path12.join)(outputStaticDir, staticUrlPath);
|
|
6735
6715
|
await import_fs12.default.promises.mkdir(staticOutputDir, { recursive: true });
|
|
6736
|
-
const shimPath = (0,
|
|
6716
|
+
const shimPath = (0, import_path12.join)(workPath, "_vercel_collectstatic_settings.py");
|
|
6737
6717
|
const shimLines = [
|
|
6738
6718
|
`from ${settingsModule} import *`,
|
|
6739
6719
|
`STATIC_ROOT = ${JSON.stringify(staticOutputDir)}`
|
|
@@ -6761,17 +6741,17 @@ async function runDjangoCollectStatic(venvPath, workPath, env, outputStaticDir,
|
|
|
6761
6741
|
];
|
|
6762
6742
|
let manifestRelPath = null;
|
|
6763
6743
|
if (MANIFEST_STORAGE_BACKENDS.includes(storageBackend) && staticRoot) {
|
|
6764
|
-
const manifestSrc = (0,
|
|
6765
|
-
const resolvedStaticRoot = (0,
|
|
6766
|
-
const manifestDest = (0,
|
|
6744
|
+
const manifestSrc = (0, import_path12.join)(staticOutputDir, "staticfiles.json");
|
|
6745
|
+
const resolvedStaticRoot = (0, import_path12.resolve)(workPath, staticRoot);
|
|
6746
|
+
const manifestDest = (0, import_path12.join)(resolvedStaticRoot, "staticfiles.json");
|
|
6767
6747
|
await import_fs12.default.promises.mkdir(resolvedStaticRoot, { recursive: true });
|
|
6768
6748
|
await import_fs12.default.promises.copyFile(manifestSrc, manifestDest);
|
|
6769
|
-
manifestRelPath = (0,
|
|
6749
|
+
manifestRelPath = (0, import_path12.relative)(workPath, manifestDest);
|
|
6770
6750
|
(0, import_build_utils15.debug)(`Copied staticfiles.json to ${manifestDest} for Lambda bundle`);
|
|
6771
6751
|
}
|
|
6772
6752
|
return {
|
|
6773
6753
|
staticSourceDirs,
|
|
6774
|
-
staticRoot: staticRoot ? (0,
|
|
6754
|
+
staticRoot: staticRoot ? (0, import_path12.resolve)(workPath, staticRoot) : null,
|
|
6775
6755
|
cdnOutputDir: outputStaticDir,
|
|
6776
6756
|
manifestRelPath
|
|
6777
6757
|
};
|
|
@@ -6844,7 +6824,7 @@ ${detail}`
|
|
|
6844
6824
|
}
|
|
6845
6825
|
let djangoStatic = null;
|
|
6846
6826
|
if (workPath && venvPath) {
|
|
6847
|
-
const outputStaticDir = (0,
|
|
6827
|
+
const outputStaticDir = (0, import_path13.join)(workPath, ".vercel", "output", "static");
|
|
6848
6828
|
djangoStatic = await runDjangoCollectStatic(
|
|
6849
6829
|
venvPath,
|
|
6850
6830
|
workPath,
|
|
@@ -6867,9 +6847,9 @@ async function downloadFilesInWorkPath({
|
|
|
6867
6847
|
(0, import_build_utils16.debug)("Downloading user files...");
|
|
6868
6848
|
let downloadedFiles = await (0, import_build_utils16.download)(files, workPath, meta);
|
|
6869
6849
|
if (meta.isDev && entrypoint) {
|
|
6870
|
-
const { devCacheDir = (0,
|
|
6871
|
-
const cacheKey = (0,
|
|
6872
|
-
const destCache = (0,
|
|
6850
|
+
const { devCacheDir = (0, import_path13.join)(workPath, ".now", "cache") } = meta;
|
|
6851
|
+
const cacheKey = (0, import_path13.basename)(entrypoint).replace(/\./g, "_");
|
|
6852
|
+
const destCache = (0, import_path13.join)(devCacheDir, cacheKey);
|
|
6873
6853
|
await (0, import_build_utils16.download)(downloadedFiles, destCache);
|
|
6874
6854
|
downloadedFiles = await (0, import_build_utils16.glob)("**", destCache);
|
|
6875
6855
|
workPath = destCache;
|
|
@@ -6902,7 +6882,7 @@ var build = async ({
|
|
|
6902
6882
|
});
|
|
6903
6883
|
try {
|
|
6904
6884
|
if (meta.isDev) {
|
|
6905
|
-
const setupCfg = (0,
|
|
6885
|
+
const setupCfg = (0, import_path13.join)(workPath, "setup.cfg");
|
|
6906
6886
|
await writeFile(setupCfg, "[install]\nprefix=\n");
|
|
6907
6887
|
}
|
|
6908
6888
|
} catch (err) {
|
|
@@ -6916,17 +6896,17 @@ var build = async ({
|
|
|
6916
6896
|
workPath,
|
|
6917
6897
|
entrypoint ? {
|
|
6918
6898
|
filePath: entrypoint,
|
|
6919
|
-
// For
|
|
6899
|
+
// For schedule-triggered jobs, the WSGI variable is always 'app' (created dynamically).
|
|
6920
6900
|
// For other services, handlerFunction is used as the entrypoint variable name.
|
|
6921
|
-
varName: service?.type === "cron" ? void 0 : handlerFunction
|
|
6901
|
+
varName: service?.type === "cron" || service?.type === "job" && service.trigger === "schedule" ? void 0 : handlerFunction
|
|
6922
6902
|
} : void 0,
|
|
6923
6903
|
service
|
|
6924
6904
|
) ?? void 0;
|
|
6925
6905
|
if (detected?.error && detected?.baseDir === void 0) {
|
|
6926
6906
|
throw detected?.error;
|
|
6927
6907
|
}
|
|
6928
|
-
const entryDirectory = detected?.baseDir ?? (entrypoint ? (0,
|
|
6929
|
-
const entrypointAbsDir = (0,
|
|
6908
|
+
const entryDirectory = detected?.baseDir ?? (entrypoint ? (0, import_path13.dirname)(entrypoint) : ".");
|
|
6909
|
+
const entrypointAbsDir = (0, import_path13.join)(workPath, entryDirectory);
|
|
6930
6910
|
const rootDir = repoRootPath ?? workPath;
|
|
6931
6911
|
const pythonPackage = await builderSpan.child("vc.builder.python.discover").trace(
|
|
6932
6912
|
() => discoverPackage({
|
|
@@ -6971,8 +6951,8 @@ var build = async ({
|
|
|
6971
6951
|
`uv is required for this project but failed to install: ${err instanceof Error ? err.message : String(err)}`
|
|
6972
6952
|
);
|
|
6973
6953
|
}
|
|
6974
|
-
const venvPath = service?.name ? (0,
|
|
6975
|
-
const hasCachedVenv = import_fs13.default.existsSync((0,
|
|
6954
|
+
const venvPath = service?.name ? (0, import_path13.join)(workPath, ".vercel", "python", "services", service.name, ".venv") : (0, import_path13.join)(workPath, ".vercel", "python", ".venv");
|
|
6955
|
+
const hasCachedVenv = import_fs13.default.existsSync((0, import_path13.join)(venvPath, "pyvenv.cfg"));
|
|
6976
6956
|
const hasCachedUv = import_fs13.default.existsSync(uvCacheDir);
|
|
6977
6957
|
if (hasCachedVenv || hasCachedUv) {
|
|
6978
6958
|
(0, import_build_utils16.debug)(
|
|
@@ -7055,7 +7035,7 @@ var build = async ({
|
|
|
7055
7035
|
}
|
|
7056
7036
|
if (!assumeDepsInstalled) {
|
|
7057
7037
|
const lockCacheKey = service?.name ? `uv.lock.${service.name}` : "uv.lock";
|
|
7058
|
-
const cachedLockPath = (0,
|
|
7038
|
+
const cachedLockPath = (0, import_path13.join)(uvCacheDir, lockCacheKey);
|
|
7059
7039
|
const { projectDir, lockPath, lockFileProvidedByUser } = await ensureUvProject({
|
|
7060
7040
|
workPath,
|
|
7061
7041
|
rootDir,
|
|
@@ -7104,7 +7084,7 @@ var build = async ({
|
|
|
7104
7084
|
}
|
|
7105
7085
|
const hookResult = await runFrameworkHook(framework, {
|
|
7106
7086
|
pythonEnv,
|
|
7107
|
-
projectDir: (0,
|
|
7087
|
+
projectDir: (0, import_path13.join)(workPath, entryDirectory),
|
|
7108
7088
|
workPath,
|
|
7109
7089
|
venvPath,
|
|
7110
7090
|
entrypoint,
|
|
@@ -7126,7 +7106,7 @@ var build = async ({
|
|
|
7126
7106
|
(0, import_build_utils16.debug)(`Installing ${runtimeDep}`);
|
|
7127
7107
|
await uv.pip({
|
|
7128
7108
|
venvPath,
|
|
7129
|
-
projectDir: (0,
|
|
7109
|
+
projectDir: (0, import_path13.join)(workPath, entryDirectory),
|
|
7130
7110
|
args: ["install", runtimeDep]
|
|
7131
7111
|
});
|
|
7132
7112
|
if (shouldInstallVercelWorkers) {
|
|
@@ -7134,7 +7114,7 @@ var build = async ({
|
|
|
7134
7114
|
(0, import_build_utils16.debug)(`Installing ${workersDep}`);
|
|
7135
7115
|
await uv.pip({
|
|
7136
7116
|
venvPath,
|
|
7137
|
-
projectDir: (0,
|
|
7117
|
+
projectDir: (0, import_path13.join)(workPath, entryDirectory),
|
|
7138
7118
|
args: ["install", workersDep]
|
|
7139
7119
|
});
|
|
7140
7120
|
}
|
|
@@ -7145,7 +7125,7 @@ var build = async ({
|
|
|
7145
7125
|
(0, import_build_utils16.debug)("Entrypoint is", entrypoint);
|
|
7146
7126
|
const moduleName = entrypoint.replace(/\//g, ".").replace(/\.py$/i, "");
|
|
7147
7127
|
if (handlerFunction) {
|
|
7148
|
-
const entrypointPath = (0,
|
|
7128
|
+
const entrypointPath = (0, import_path13.join)(workPath, entrypoint);
|
|
7149
7129
|
const source = await import_fs13.default.promises.readFile(entrypointPath, "utf-8");
|
|
7150
7130
|
const found = await (0, import_python_analysis9.containsTopLevelCallable)(source, handlerFunction);
|
|
7151
7131
|
if (!found) {
|
|
@@ -7246,7 +7226,7 @@ from vercel_runtime.vc_init import vc_handler
|
|
|
7246
7226
|
const files = await (0, import_build_utils16.glob)("**", globOptions);
|
|
7247
7227
|
if (djangoStatic?.manifestRelPath) {
|
|
7248
7228
|
files[djangoStatic.manifestRelPath] = new import_build_utils16.FileFsRef({
|
|
7249
|
-
fsPath: (0,
|
|
7229
|
+
fsPath: (0, import_path13.join)(workPath, djangoStatic.manifestRelPath)
|
|
7250
7230
|
});
|
|
7251
7231
|
}
|
|
7252
7232
|
const depExternalizer = new PythonDependencyExternalizer({
|
|
@@ -7370,7 +7350,7 @@ var defaultShouldServe = ({
|
|
|
7370
7350
|
if (entrypoint === requestPath && hasProp(files, entrypoint)) {
|
|
7371
7351
|
return true;
|
|
7372
7352
|
}
|
|
7373
|
-
const { dir, name } = (0,
|
|
7353
|
+
const { dir, name } = (0, import_path13.parse)(entrypoint);
|
|
7374
7354
|
if (name === "index" && dir === requestPath && hasProp(files, entrypoint)) {
|
|
7375
7355
|
return true;
|
|
7376
7356
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/python",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.34.0",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/python",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"smol-toml": "1.5.2",
|
|
37
37
|
"vitest": "2.1.4",
|
|
38
38
|
"which": "3.0.0",
|
|
39
|
-
"@vercel/build-utils": "13.
|
|
39
|
+
"@vercel/build-utils": "13.18.0",
|
|
40
40
|
"@vercel/error-utils": "2.0.3",
|
|
41
41
|
"@vercel/python-runtime": "0.13.0"
|
|
42
42
|
},
|