@vercel/python 6.33.1 → 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 +141 -163
- 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";
|
|
@@ -4375,13 +4375,11 @@ var PythonDependencyExternalizer = class {
|
|
|
4375
4375
|
code: "LAMBDA_SIZE_EXCEEDED",
|
|
4376
4376
|
message: shouldShowFunctionsBetaHint() ? `Total bundle size (${totalBundleSizeMB} MB) exceeds the size limit (${limitMB} MB).
|
|
4377
4377
|
|
|
4378
|
-
` + FUNCTIONS_BETA_CTA : `Total bundle size (${totalBundleSizeMB} MB) exceeds the
|
|
4379
|
-
|
|
4380
|
-
Runtime dependency installation is not available for projects that use a custom build or install command, because custom commands may install dependencies that are not tracked in uv.lock.
|
|
4378
|
+
` + FUNCTIONS_BETA_CTA : `Total bundle size (${totalBundleSizeMB} MB) exceeds the size limit (${limitMB} MB).
|
|
4381
4379
|
|
|
4382
|
-
To
|
|
4383
|
-
1. Remove
|
|
4384
|
-
2.
|
|
4380
|
+
When using a custom install command, Vercel cannot automatically optimize dependency bundling. To reduce the size of your dependencies, you can:
|
|
4381
|
+
1. Remove unused dependencies from your project
|
|
4382
|
+
2. Remove the custom install command to allow Vercel to manage and optimize dependencies automatically`,
|
|
4385
4383
|
link: "https://vercel.com/docs/functions/runtimes/python#controlling-what-gets-bundled",
|
|
4386
4384
|
action: "Learn More"
|
|
4387
4385
|
});
|
|
@@ -4427,9 +4425,9 @@ To resolve this, either:
|
|
|
4427
4425
|
const ephemeralLimitMB = (LAMBDA_EPHEMERAL_STORAGE_BYTES / (1024 * 1024)).toFixed(0);
|
|
4428
4426
|
throw new import_build_utils5.NowBuildError({
|
|
4429
4427
|
code: "LAMBDA_SIZE_EXCEEDED",
|
|
4430
|
-
message: shouldShowFunctionsBetaHint() ? `Total
|
|
4428
|
+
message: shouldShowFunctionsBetaHint() ? `Total bundle size (${totalBundleSizeMB} MB) exceeds the ephemeral storage limit (${ephemeralLimitMB} MB).
|
|
4431
4429
|
|
|
4432
|
-
` + FUNCTIONS_BETA_CTA : `Total
|
|
4430
|
+
` + FUNCTIONS_BETA_CTA : `Total bundle size (${totalBundleSizeMB} MB) exceeds Lambda ephemeral storage limit (${ephemeralLimitMB} MB). Even with runtime dependency installation, all packages must fit within the ${ephemeralLimitMB} MB ephemeral storage available to Lambda functions. Consider removing unused dependencies or splitting your application into smaller functions.`,
|
|
4433
4431
|
link: "https://vercel.com/docs/functions/runtimes/python#controlling-what-gets-bundled",
|
|
4434
4432
|
action: "Learn More"
|
|
4435
4433
|
});
|
|
@@ -4623,9 +4621,9 @@ To fix this, either:
|
|
|
4623
4621
|
const limitMB = (LAMBDA_SIZE_THRESHOLD_BYTES / (1024 * 1024)).toFixed(0);
|
|
4624
4622
|
throw new import_build_utils5.NowBuildError({
|
|
4625
4623
|
code: "LAMBDA_SIZE_EXCEEDED",
|
|
4626
|
-
message: shouldShowFunctionsBetaHint() ? `
|
|
4624
|
+
message: shouldShowFunctionsBetaHint() ? `Total bundle size (${finalSizeMB} MB) exceeds the size limit (${limitMB} MB).
|
|
4627
4625
|
|
|
4628
|
-
` + FUNCTIONS_BETA_CTA : `
|
|
4626
|
+
` + FUNCTIONS_BETA_CTA : `Total bundle size (${finalSizeMB} MB) exceeds Lambda limit (${limitMB} MB) even after deferring public packages to runtime installation. This usually means your private packages or source code are too large. Consider reducing the size of private dependencies or splitting your application.`,
|
|
4629
4627
|
link: "https://vercel.com/docs/functions/runtimes/python#controlling-what-gets-bundled",
|
|
4630
4628
|
action: "Learn More"
|
|
4631
4629
|
});
|
|
@@ -4875,12 +4873,8 @@ async function calculatePerPackageSizes(venvPath) {
|
|
|
4875
4873
|
|
|
4876
4874
|
// src/diagnostics.ts
|
|
4877
4875
|
var import_fs6 = __toESM(require("fs"));
|
|
4878
|
-
var import_path7 = require("path");
|
|
4879
4876
|
var import_build_utils6 = require("@vercel/build-utils");
|
|
4880
4877
|
var import_python_analysis4 = require("@vercel/python-analysis");
|
|
4881
|
-
var MANIFEST_FILENAME = "package-manifest.json";
|
|
4882
|
-
var DIAGNOSTICS_PATH = (0, import_path7.join)(".vercel", "python", MANIFEST_FILENAME);
|
|
4883
|
-
var MANIFEST_VERSION = "20260304";
|
|
4884
4878
|
function isDependencyGroupInclude(entry) {
|
|
4885
4879
|
return typeof entry === "object" && "include-group" in entry;
|
|
4886
4880
|
}
|
|
@@ -5052,10 +5046,10 @@ async function generateProjectManifest({
|
|
|
5052
5046
|
name,
|
|
5053
5047
|
type: "direct",
|
|
5054
5048
|
scopes: [...scopes].sort(),
|
|
5055
|
-
requested: directRequested.get(name)
|
|
5049
|
+
requested: directRequested.get(name),
|
|
5050
|
+
resolved: info?.version ?? ""
|
|
5056
5051
|
};
|
|
5057
5052
|
if (info) {
|
|
5058
|
-
entry.resolved = info.version;
|
|
5059
5053
|
const src = mapSource(info.source);
|
|
5060
5054
|
if (src.source)
|
|
5061
5055
|
entry.source = src.source;
|
|
@@ -5082,7 +5076,7 @@ async function generateProjectManifest({
|
|
|
5082
5076
|
}
|
|
5083
5077
|
}
|
|
5084
5078
|
const manifest = {
|
|
5085
|
-
version: MANIFEST_VERSION,
|
|
5079
|
+
version: import_build_utils6.MANIFEST_VERSION,
|
|
5086
5080
|
runtime: "python",
|
|
5087
5081
|
runtimeVersion: {
|
|
5088
5082
|
...requested ? { requested } : {},
|
|
@@ -5094,37 +5088,20 @@ async function generateProjectManifest({
|
|
|
5094
5088
|
...transitiveEntries.sort((a, b) => a.name.localeCompare(b.name))
|
|
5095
5089
|
]
|
|
5096
5090
|
};
|
|
5097
|
-
|
|
5098
|
-
await import_fs6.default.promises.mkdir((0, import_path7.dirname)(outPath), { recursive: true });
|
|
5099
|
-
await import_fs6.default.promises.writeFile(outPath, JSON.stringify(manifest, null, 2));
|
|
5091
|
+
await (0, import_build_utils6.writeProjectManifest)(manifest, workPath, "python");
|
|
5100
5092
|
}
|
|
5101
|
-
var diagnostics =
|
|
5102
|
-
workPath
|
|
5103
|
-
}) => {
|
|
5104
|
-
try {
|
|
5105
|
-
const manifestPath = (0, import_path7.join)(workPath, DIAGNOSTICS_PATH);
|
|
5106
|
-
const data = await import_fs6.default.promises.readFile(manifestPath, "utf-8");
|
|
5107
|
-
return {
|
|
5108
|
-
[MANIFEST_FILENAME]: new import_build_utils6.FileBlob({ data })
|
|
5109
|
-
};
|
|
5110
|
-
} catch (err) {
|
|
5111
|
-
(0, import_build_utils6.debug)(
|
|
5112
|
-
`Diagnostics: no cached manifest found: ${err instanceof Error ? err.message : String(err)}`
|
|
5113
|
-
);
|
|
5114
|
-
return {};
|
|
5115
|
-
}
|
|
5116
|
-
};
|
|
5093
|
+
var diagnostics = (0, import_build_utils6.createDiagnostics)("python");
|
|
5117
5094
|
|
|
5118
5095
|
// src/crons.ts
|
|
5119
5096
|
var import_fs7 = __toESM(require("fs"));
|
|
5120
|
-
var
|
|
5097
|
+
var import_path7 = require("path");
|
|
5121
5098
|
var import_execa4 = __toESM(require_execa());
|
|
5122
5099
|
var import_build_utils7 = require("@vercel/build-utils");
|
|
5123
5100
|
var DYNAMIC_SCHEDULE = "<dynamic>";
|
|
5124
5101
|
function entrypointToModule(entrypoint) {
|
|
5125
5102
|
return entrypoint.replace(/\\/g, "/").replace(/\.py$/i, "").replace(/\//g, ".");
|
|
5126
5103
|
}
|
|
5127
|
-
var scriptPath = (0,
|
|
5104
|
+
var scriptPath = (0, import_path7.join)(__dirname, "..", "templates", "vc_cron_detect.py");
|
|
5128
5105
|
var script = import_fs7.default.readFileSync(scriptPath, "utf-8");
|
|
5129
5106
|
function buildCronRouteTable(crons) {
|
|
5130
5107
|
const table = {};
|
|
@@ -5135,7 +5112,8 @@ function buildCronRouteTable(crons) {
|
|
|
5135
5112
|
}
|
|
5136
5113
|
async function getServiceCrons(opts) {
|
|
5137
5114
|
const { service, entrypoint, rawEntrypoint, handlerFunction } = opts;
|
|
5138
|
-
|
|
5115
|
+
const isScheduledService = service?.type === "cron" || service?.type === "job" && service.trigger === "schedule";
|
|
5116
|
+
if (!isScheduledService || !service.name || typeof service.schedule !== "string") {
|
|
5139
5117
|
return void 0;
|
|
5140
5118
|
}
|
|
5141
5119
|
const cronEntrypoint = entrypoint || rawEntrypoint;
|
|
@@ -5259,14 +5237,14 @@ function moduleColonFuncToCronPath(serviceName, moduleFunction) {
|
|
|
5259
5237
|
// src/start-dev-server.ts
|
|
5260
5238
|
var import_child_process2 = require("child_process");
|
|
5261
5239
|
var import_fs9 = require("fs");
|
|
5262
|
-
var
|
|
5240
|
+
var import_path9 = require("path");
|
|
5263
5241
|
var import_build_utils11 = require("@vercel/build-utils");
|
|
5264
5242
|
var import_get_port = __toESM(require_get_port());
|
|
5265
5243
|
var import_is_port_reachable = __toESM(require_is_port_reachable());
|
|
5266
5244
|
|
|
5267
5245
|
// src/entrypoint.ts
|
|
5268
5246
|
var import_fs8 = __toESM(require("fs"));
|
|
5269
|
-
var
|
|
5247
|
+
var import_path8 = require("path");
|
|
5270
5248
|
var import_build_utils8 = require("@vercel/build-utils");
|
|
5271
5249
|
var import_build_utils9 = require("@vercel/build-utils");
|
|
5272
5250
|
var import_build_utils10 = require("@vercel/build-utils");
|
|
@@ -5286,7 +5264,7 @@ var PYTHON_CANDIDATE_ENTRYPOINTS = getCandidateEntrypointsInDirs(
|
|
|
5286
5264
|
function getCandidateEntrypointsInDirs(dirs) {
|
|
5287
5265
|
return dirs.flatMap(
|
|
5288
5266
|
(dir) => PYTHON_ENTRYPOINT_FILENAMES.map(
|
|
5289
|
-
(filename) =>
|
|
5267
|
+
(filename) => import_path8.posix.join(dir, `${filename}.py`)
|
|
5290
5268
|
)
|
|
5291
5269
|
);
|
|
5292
5270
|
}
|
|
@@ -5299,14 +5277,14 @@ async function fileExists(filePath) {
|
|
|
5299
5277
|
}
|
|
5300
5278
|
}
|
|
5301
5279
|
async function checkEntrypoint(workPath, relPath) {
|
|
5302
|
-
const absPath = (0,
|
|
5280
|
+
const absPath = (0, import_path8.join)(workPath, relPath);
|
|
5303
5281
|
if (!await fileExists(absPath))
|
|
5304
5282
|
return null;
|
|
5305
5283
|
const content = await import_fs8.default.promises.readFile(absPath, "utf-8");
|
|
5306
5284
|
return (0, import_python_analysis5.findAppOrHandler)(content);
|
|
5307
5285
|
}
|
|
5308
5286
|
async function getPyprojectEntrypoint(workPath) {
|
|
5309
|
-
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"));
|
|
5310
5288
|
if (!pyprojectData)
|
|
5311
5289
|
return null;
|
|
5312
5290
|
const scripts = pyprojectData.project?.scripts;
|
|
@@ -5321,7 +5299,7 @@ async function getPyprojectEntrypoint(workPath) {
|
|
|
5321
5299
|
const relPath = modulePath.replace(/\./g, "/");
|
|
5322
5300
|
const candidates = [`${relPath}.py`, `${relPath}/__init__.py`];
|
|
5323
5301
|
for (const candidate of candidates) {
|
|
5324
|
-
if (await fileExists((0,
|
|
5302
|
+
if (await fileExists((0, import_path8.join)(workPath, candidate))) {
|
|
5325
5303
|
return { entrypoint: candidate, variableName };
|
|
5326
5304
|
}
|
|
5327
5305
|
}
|
|
@@ -5338,7 +5316,7 @@ async function findValidEntrypoint(workPath, candidates) {
|
|
|
5338
5316
|
return null;
|
|
5339
5317
|
}
|
|
5340
5318
|
async function checkDjangoManage(workPath) {
|
|
5341
|
-
const managePath = (0,
|
|
5319
|
+
const managePath = (0, import_path8.join)(workPath, "manage.py");
|
|
5342
5320
|
try {
|
|
5343
5321
|
const content = await import_fs8.default.promises.readFile(managePath, "utf-8");
|
|
5344
5322
|
if (!content.includes("DJANGO_SETTINGS_MODULE"))
|
|
@@ -5385,7 +5363,7 @@ async function detectDjangoPythonEntrypoint(workPath) {
|
|
|
5385
5363
|
const subdirs = await getSubdirectories(workPath);
|
|
5386
5364
|
const rootDirs = ["", ...subdirs];
|
|
5387
5365
|
for (const rootDir of rootDirs) {
|
|
5388
|
-
const currPath = (0,
|
|
5366
|
+
const currPath = (0, import_path8.join)(workPath, rootDir);
|
|
5389
5367
|
const isDjango = await checkDjangoManage(currPath);
|
|
5390
5368
|
if (isDjango) {
|
|
5391
5369
|
return { baseDir: rootDir, error: makeDetectError("django") };
|
|
@@ -5405,8 +5383,8 @@ async function detectPythonEntrypoint(framework, workPath, configuredEntrypoint,
|
|
|
5405
5383
|
const entrypoint = configEntryFile.endsWith(".py") ? configEntryFile : `${configEntryFile}.py`;
|
|
5406
5384
|
let varName = configEntryVar ?? await checkEntrypoint(workPath, entrypoint);
|
|
5407
5385
|
if (!varName) {
|
|
5408
|
-
const
|
|
5409
|
-
if (
|
|
5386
|
+
const needsDynamicApp = !!service && ((0, import_build_utils8.isScheduleTriggeredService)(service) || (0, import_build_utils8.isQueueTriggeredService)(service));
|
|
5387
|
+
if (needsDynamicApp) {
|
|
5410
5388
|
varName = "app";
|
|
5411
5389
|
}
|
|
5412
5390
|
}
|
|
@@ -5525,9 +5503,9 @@ async function syncDependencies({
|
|
|
5525
5503
|
return;
|
|
5526
5504
|
}
|
|
5527
5505
|
if (manifest?.origin && manifestType === "pyproject.toml") {
|
|
5528
|
-
const syncDir = (0,
|
|
5506
|
+
const syncDir = (0, import_path9.join)(workPath, ".vercel", "python", "sync");
|
|
5529
5507
|
(0, import_fs9.mkdirSync)(syncDir, { recursive: true });
|
|
5530
|
-
const tempPyproject = (0,
|
|
5508
|
+
const tempPyproject = (0, import_path9.join)(syncDir, "pyproject.toml");
|
|
5531
5509
|
const content = (0, import_python_analysis6.stringifyManifest)(manifest.data);
|
|
5532
5510
|
(0, import_fs9.writeFileSync)(tempPyproject, content, "utf8");
|
|
5533
5511
|
manifestPath = tempPyproject;
|
|
@@ -5579,7 +5557,7 @@ async function runSync({
|
|
|
5579
5557
|
onStdout,
|
|
5580
5558
|
onStderr
|
|
5581
5559
|
}) {
|
|
5582
|
-
const projectDir = (0,
|
|
5560
|
+
const projectDir = (0, import_path9.dirname)(manifestPath);
|
|
5583
5561
|
const pip = uvPath ? { cmd: uvPath, prefix: ["pip", "install"] } : { cmd: pythonBin, prefix: ["-m", "pip", "install"] };
|
|
5584
5562
|
let spawnCmd;
|
|
5585
5563
|
let spawnArgs;
|
|
@@ -5656,7 +5634,7 @@ async function installVercelRuntime({
|
|
|
5656
5634
|
onStdout,
|
|
5657
5635
|
onStderr
|
|
5658
5636
|
}) {
|
|
5659
|
-
const targetDir = (0,
|
|
5637
|
+
const targetDir = (0, import_path9.join)(workPath, ".vercel", "python");
|
|
5660
5638
|
let pending = PENDING_RUNTIME_INSTALLS.get(targetDir);
|
|
5661
5639
|
if (!pending) {
|
|
5662
5640
|
pending = doInstallVercelRuntime({
|
|
@@ -5683,7 +5661,7 @@ async function doInstallVercelRuntime({
|
|
|
5683
5661
|
onStderr
|
|
5684
5662
|
}) {
|
|
5685
5663
|
(0, import_fs9.mkdirSync)(targetDir, { recursive: true });
|
|
5686
|
-
const localRuntimeDir = (0,
|
|
5664
|
+
const localRuntimeDir = (0, import_path9.join)(
|
|
5687
5665
|
__dirname,
|
|
5688
5666
|
"..",
|
|
5689
5667
|
"..",
|
|
@@ -5691,10 +5669,10 @@ async function doInstallVercelRuntime({
|
|
|
5691
5669
|
"python",
|
|
5692
5670
|
"vercel-runtime"
|
|
5693
5671
|
);
|
|
5694
|
-
const isLocalDev = (0, import_fs9.existsSync)((0,
|
|
5672
|
+
const isLocalDev = (0, import_fs9.existsSync)((0, import_path9.join)(localRuntimeDir, "pyproject.toml"));
|
|
5695
5673
|
const runtimeDep = env.VERCEL_RUNTIME_PYTHON || (isLocalDev ? localRuntimeDir : `vercel-runtime==${VERCEL_RUNTIME_VERSION}`);
|
|
5696
5674
|
if (!isLocalDev && !env.VERCEL_RUNTIME_PYTHON) {
|
|
5697
|
-
const distInfo = (0,
|
|
5675
|
+
const distInfo = (0, import_path9.join)(
|
|
5698
5676
|
targetDir,
|
|
5699
5677
|
`vercel_runtime-${VERCEL_RUNTIME_VERSION}.dist-info`
|
|
5700
5678
|
);
|
|
@@ -5752,7 +5730,7 @@ async function installVercelWorkers({
|
|
|
5752
5730
|
onStdout,
|
|
5753
5731
|
onStderr
|
|
5754
5732
|
}) {
|
|
5755
|
-
const targetDir = (0,
|
|
5733
|
+
const targetDir = (0, import_path9.join)(workPath, ".vercel", "python");
|
|
5756
5734
|
let pending = PENDING_WORKERS_INSTALLS.get(targetDir);
|
|
5757
5735
|
if (!pending) {
|
|
5758
5736
|
pending = doInstallVercelWorkers({
|
|
@@ -5779,7 +5757,7 @@ async function doInstallVercelWorkers({
|
|
|
5779
5757
|
onStderr
|
|
5780
5758
|
}) {
|
|
5781
5759
|
(0, import_fs9.mkdirSync)(targetDir, { recursive: true });
|
|
5782
|
-
const localWorkersDir = (0,
|
|
5760
|
+
const localWorkersDir = (0, import_path9.join)(
|
|
5783
5761
|
__dirname,
|
|
5784
5762
|
"..",
|
|
5785
5763
|
"..",
|
|
@@ -5787,10 +5765,10 @@ async function doInstallVercelWorkers({
|
|
|
5787
5765
|
"python",
|
|
5788
5766
|
"vercel-workers"
|
|
5789
5767
|
);
|
|
5790
|
-
const isLocalDev = (0, import_fs9.existsSync)((0,
|
|
5768
|
+
const isLocalDev = (0, import_fs9.existsSync)((0, import_path9.join)(localWorkersDir, "pyproject.toml"));
|
|
5791
5769
|
const workersDep = env.VERCEL_WORKERS_PYTHON || (isLocalDev ? localWorkersDir : `vercel-workers==${VERCEL_WORKERS_VERSION}`);
|
|
5792
5770
|
if (!isLocalDev && !env.VERCEL_WORKERS_PYTHON) {
|
|
5793
|
-
const distInfo = (0,
|
|
5771
|
+
const distInfo = (0, import_path9.join)(
|
|
5794
5772
|
targetDir,
|
|
5795
5773
|
`vercel_workers-${VERCEL_WORKERS_VERSION}.dist-info`
|
|
5796
5774
|
);
|
|
@@ -5883,18 +5861,18 @@ function installGlobalCleanupHandlers() {
|
|
|
5883
5861
|
}
|
|
5884
5862
|
function createDevShim(workPath, entry, modulePath, serviceName, framework, variableName) {
|
|
5885
5863
|
try {
|
|
5886
|
-
const vercelPythonDir = serviceName ? (0,
|
|
5864
|
+
const vercelPythonDir = serviceName ? (0, import_path9.join)(workPath, ".vercel", "python", "services", serviceName) : (0, import_path9.join)(workPath, ".vercel", "python");
|
|
5887
5865
|
(0, import_fs9.mkdirSync)(vercelPythonDir, { recursive: true });
|
|
5888
5866
|
let qualifiedModule = modulePath;
|
|
5889
5867
|
let extraPythonPath;
|
|
5890
|
-
if ((0, import_fs9.existsSync)((0,
|
|
5891
|
-
const pkgName = (0,
|
|
5868
|
+
if ((0, import_fs9.existsSync)((0, import_path9.join)(workPath, "__init__.py"))) {
|
|
5869
|
+
const pkgName = (0, import_path9.basename)(workPath);
|
|
5892
5870
|
qualifiedModule = `${pkgName}.${modulePath}`;
|
|
5893
|
-
extraPythonPath = (0,
|
|
5871
|
+
extraPythonPath = (0, import_path9.dirname)(workPath);
|
|
5894
5872
|
}
|
|
5895
|
-
const entryAbs = (0,
|
|
5896
|
-
const shimPath = (0,
|
|
5897
|
-
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)(
|
|
5898
5876
|
__dirname,
|
|
5899
5877
|
"..",
|
|
5900
5878
|
"templates",
|
|
@@ -5920,7 +5898,7 @@ async function getMultiServicePythonRunner(workPath, env, systemPython, uvPath)
|
|
|
5920
5898
|
(0, import_build_utils11.debug)(`Using existing virtualenv at ${venvRoot} for multi-service dev`);
|
|
5921
5899
|
return { command: pythonCmd, args: [] };
|
|
5922
5900
|
}
|
|
5923
|
-
const venvPath = (0,
|
|
5901
|
+
const venvPath = (0, import_path9.join)(workPath, ".venv");
|
|
5924
5902
|
await ensureVenv({
|
|
5925
5903
|
pythonVersion: { pythonPath: systemPython },
|
|
5926
5904
|
venvPath,
|
|
@@ -5931,7 +5909,7 @@ async function getMultiServicePythonRunner(workPath, env, systemPython, uvPath)
|
|
|
5931
5909
|
const pythonBin = getVenvPythonBin(venvPath);
|
|
5932
5910
|
const binDir = getVenvBinDir(venvPath);
|
|
5933
5911
|
env.VIRTUAL_ENV = venvPath;
|
|
5934
|
-
env.PATH = `${binDir}${
|
|
5912
|
+
env.PATH = `${binDir}${import_path9.delimiter}${env.PATH || ""}`;
|
|
5935
5913
|
return { command: pythonBin, args: [] };
|
|
5936
5914
|
}
|
|
5937
5915
|
var startDevServer = async (opts) => {
|
|
@@ -5983,9 +5961,9 @@ var startDevServer = async (opts) => {
|
|
|
5983
5961
|
workPath,
|
|
5984
5962
|
entrypoint ? {
|
|
5985
5963
|
filePath: entrypoint,
|
|
5986
|
-
//
|
|
5987
|
-
//
|
|
5988
|
-
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
|
|
5989
5967
|
} : void 0,
|
|
5990
5968
|
service
|
|
5991
5969
|
);
|
|
@@ -5994,7 +5972,7 @@ var startDevServer = async (opts) => {
|
|
|
5994
5972
|
} else {
|
|
5995
5973
|
const hookResult = await runFrameworkHook(framework, {
|
|
5996
5974
|
pythonEnv: env,
|
|
5997
|
-
projectDir: (0,
|
|
5975
|
+
projectDir: (0, import_path9.join)(workPath, detected?.baseDir ?? ""),
|
|
5998
5976
|
workPath,
|
|
5999
5977
|
entrypoint,
|
|
6000
5978
|
detected: detected ?? void 0
|
|
@@ -6130,7 +6108,7 @@ If you are using a virtual environment, activate it before running "vercel dev",
|
|
|
6130
6108
|
const port = typeof meta.port === "number" ? meta.port : await (0, import_get_port.default)();
|
|
6131
6109
|
env.PORT = `${port}`;
|
|
6132
6110
|
if (entry) {
|
|
6133
|
-
env.__VC_HANDLER_ENTRYPOINT_ABS = (0,
|
|
6111
|
+
env.__VC_HANDLER_ENTRYPOINT_ABS = (0, import_path9.join)(workPath, entry);
|
|
6134
6112
|
}
|
|
6135
6113
|
const devShim = createDevShim(
|
|
6136
6114
|
workPath,
|
|
@@ -6141,8 +6119,8 @@ If you are using a virtual environment, activate it before running "vercel dev",
|
|
|
6141
6119
|
variableName ?? ""
|
|
6142
6120
|
);
|
|
6143
6121
|
if (devShim) {
|
|
6144
|
-
const shimDir = devShim.shimDir || (0,
|
|
6145
|
-
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");
|
|
6146
6124
|
const pathParts = shimDir !== runtimeDir ? [shimDir, runtimeDir] : [shimDir];
|
|
6147
6125
|
if (devShim.extraPythonPath) {
|
|
6148
6126
|
pathParts.push(devShim.extraPythonPath);
|
|
@@ -6151,7 +6129,7 @@ If you are using a virtual environment, activate it before running "vercel dev",
|
|
|
6151
6129
|
if (existingPythonPath) {
|
|
6152
6130
|
pathParts.push(existingPythonPath);
|
|
6153
6131
|
}
|
|
6154
|
-
env.PYTHONPATH = pathParts.join(
|
|
6132
|
+
env.PYTHONPATH = pathParts.join(import_path9.delimiter);
|
|
6155
6133
|
}
|
|
6156
6134
|
const moduleToRun = devShim?.module || modulePath;
|
|
6157
6135
|
const pythonArgs = ["-u", "-m", moduleToRun];
|
|
@@ -6225,7 +6203,7 @@ var matplotlibQuirk = {
|
|
|
6225
6203
|
|
|
6226
6204
|
// src/quirks/litellm.ts
|
|
6227
6205
|
var import_fs10 = __toESM(require("fs"));
|
|
6228
|
-
var
|
|
6206
|
+
var import_path10 = require("path");
|
|
6229
6207
|
var import_build_utils12 = require("@vercel/build-utils");
|
|
6230
6208
|
var LAMBDA_ROOT = "/var/task";
|
|
6231
6209
|
var CONFIG_CANDIDATES = [
|
|
@@ -6236,7 +6214,7 @@ var CONFIG_CANDIDATES = [
|
|
|
6236
6214
|
];
|
|
6237
6215
|
async function findConfigFile(workPath) {
|
|
6238
6216
|
for (const name of CONFIG_CANDIDATES) {
|
|
6239
|
-
const candidate = (0,
|
|
6217
|
+
const candidate = (0, import_path10.join)(workPath, name);
|
|
6240
6218
|
try {
|
|
6241
6219
|
await import_fs10.default.promises.access(candidate);
|
|
6242
6220
|
return name;
|
|
@@ -6253,7 +6231,7 @@ var litellmQuirk = {
|
|
|
6253
6231
|
const env = {};
|
|
6254
6232
|
const sitePackagesDirs = await getVenvSitePackagesDirs(ctx.venvPath);
|
|
6255
6233
|
for (const sitePackages of sitePackagesDirs) {
|
|
6256
|
-
const schemaPath = (0,
|
|
6234
|
+
const schemaPath = (0, import_path10.join)(
|
|
6257
6235
|
sitePackages,
|
|
6258
6236
|
"litellm",
|
|
6259
6237
|
"proxy",
|
|
@@ -6274,8 +6252,8 @@ var litellmQuirk = {
|
|
|
6274
6252
|
const configName = await findConfigFile(ctx.workPath);
|
|
6275
6253
|
if (configName) {
|
|
6276
6254
|
(0, import_build_utils12.debug)(`LiteLLM quirk: found config at ${configName}`);
|
|
6277
|
-
buildEnv.CONFIG_FILE_PATH = (0,
|
|
6278
|
-
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);
|
|
6279
6257
|
}
|
|
6280
6258
|
} else {
|
|
6281
6259
|
(0, import_build_utils12.debug)(
|
|
@@ -6288,7 +6266,7 @@ var litellmQuirk = {
|
|
|
6288
6266
|
|
|
6289
6267
|
// src/quirks/prisma.ts
|
|
6290
6268
|
var import_fs11 = __toESM(require("fs"));
|
|
6291
|
-
var
|
|
6269
|
+
var import_path11 = require("path");
|
|
6292
6270
|
var import_execa5 = __toESM(require_execa());
|
|
6293
6271
|
var import_build_utils13 = require("@vercel/build-utils");
|
|
6294
6272
|
var import_python_analysis7 = require("@vercel/python-analysis");
|
|
@@ -6328,7 +6306,7 @@ model DummyModel {
|
|
|
6328
6306
|
async function findUserSchema(workPath) {
|
|
6329
6307
|
const envPath = process.env.PRISMA_SCHEMA_PATH;
|
|
6330
6308
|
if (envPath) {
|
|
6331
|
-
const resolved = (0,
|
|
6309
|
+
const resolved = (0, import_path11.isAbsolute)(envPath) ? envPath : (0, import_path11.join)(workPath, envPath);
|
|
6332
6310
|
try {
|
|
6333
6311
|
await import_fs11.default.promises.access(resolved);
|
|
6334
6312
|
return resolved;
|
|
@@ -6338,8 +6316,8 @@ async function findUserSchema(workPath) {
|
|
|
6338
6316
|
}
|
|
6339
6317
|
}
|
|
6340
6318
|
const candidates = [
|
|
6341
|
-
(0,
|
|
6342
|
-
(0,
|
|
6319
|
+
(0, import_path11.join)(workPath, "schema.prisma"),
|
|
6320
|
+
(0, import_path11.join)(workPath, "prisma", "schema.prisma")
|
|
6343
6321
|
];
|
|
6344
6322
|
for (const candidate of candidates) {
|
|
6345
6323
|
try {
|
|
@@ -6361,20 +6339,20 @@ async function collectFiles(dir, base) {
|
|
|
6361
6339
|
for (const entry of entries) {
|
|
6362
6340
|
if (entry.name === "__pycache__")
|
|
6363
6341
|
continue;
|
|
6364
|
-
const full = (0,
|
|
6342
|
+
const full = (0, import_path11.join)(dir, entry.name);
|
|
6365
6343
|
if (entry.isDirectory()) {
|
|
6366
6344
|
result.push(...await collectFiles(full, base));
|
|
6367
6345
|
} else {
|
|
6368
|
-
result.push((0,
|
|
6346
|
+
result.push((0, import_path11.relative)(base, full));
|
|
6369
6347
|
}
|
|
6370
6348
|
}
|
|
6371
6349
|
return result;
|
|
6372
6350
|
}
|
|
6373
6351
|
async function cleanCacheArtifacts(cacheDir, extras = []) {
|
|
6374
6352
|
const paths = [
|
|
6375
|
-
(0,
|
|
6376
|
-
(0,
|
|
6377
|
-
(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"),
|
|
6378
6356
|
...extras
|
|
6379
6357
|
];
|
|
6380
6358
|
for (const p of paths) {
|
|
@@ -6403,7 +6381,7 @@ var prismaQuirk = {
|
|
|
6403
6381
|
async run(ctx) {
|
|
6404
6382
|
const { venvPath, pythonEnv, workPath } = ctx;
|
|
6405
6383
|
const pythonPath = getVenvPythonBin(venvPath);
|
|
6406
|
-
const runtimeCacheDir = (0,
|
|
6384
|
+
const runtimeCacheDir = (0, import_path11.join)(
|
|
6407
6385
|
LAMBDA_ROOT2,
|
|
6408
6386
|
resolveVendorDir(),
|
|
6409
6387
|
"prisma",
|
|
@@ -6413,7 +6391,7 @@ var prismaQuirk = {
|
|
|
6413
6391
|
let sitePackages;
|
|
6414
6392
|
for (const dir of sitePackagesDirs) {
|
|
6415
6393
|
try {
|
|
6416
|
-
await import_fs11.default.promises.access((0,
|
|
6394
|
+
await import_fs11.default.promises.access((0, import_path11.join)(dir, "prisma"));
|
|
6417
6395
|
sitePackages = dir;
|
|
6418
6396
|
break;
|
|
6419
6397
|
} catch {
|
|
@@ -6425,14 +6403,14 @@ var prismaQuirk = {
|
|
|
6425
6403
|
);
|
|
6426
6404
|
return {};
|
|
6427
6405
|
}
|
|
6428
|
-
const cacheDir = (0,
|
|
6406
|
+
const cacheDir = (0, import_path11.join)(sitePackages, "prisma", "__bincache__");
|
|
6429
6407
|
await import_fs11.default.promises.mkdir(cacheDir, { recursive: true });
|
|
6430
6408
|
const generateEnv = {
|
|
6431
6409
|
...pythonEnv,
|
|
6432
6410
|
PRISMA_BINARY_CACHE_DIR: cacheDir
|
|
6433
6411
|
};
|
|
6434
|
-
const generatedDir = (0,
|
|
6435
|
-
const dummySchemaPath = (0,
|
|
6412
|
+
const generatedDir = (0, import_path11.join)(workPath, "_prisma_generated");
|
|
6413
|
+
const dummySchemaPath = (0, import_path11.join)(workPath, DUMMY_SCHEMA_NAME);
|
|
6436
6414
|
await import_fs11.default.promises.writeFile(
|
|
6437
6415
|
dummySchemaPath,
|
|
6438
6416
|
buildDummySchema(generatedDir)
|
|
@@ -6461,15 +6439,15 @@ var prismaQuirk = {
|
|
|
6461
6439
|
}
|
|
6462
6440
|
const srcBinaryPrefix = `query-engine-${getLambdaBinaryTarget()}`;
|
|
6463
6441
|
const runtimeName = `prisma-query-engine-rhel-openssl-${RUNTIME_OPENSSL_VERSION}.x`;
|
|
6464
|
-
const nodeModulesDir = (0,
|
|
6442
|
+
const nodeModulesDir = (0, import_path11.join)(cacheDir, "node_modules", "prisma");
|
|
6465
6443
|
let engineCopied = false;
|
|
6466
6444
|
try {
|
|
6467
6445
|
const entries = await import_fs11.default.promises.readdir(nodeModulesDir);
|
|
6468
6446
|
for (const entry of entries) {
|
|
6469
6447
|
if (!entry.startsWith(srcBinaryPrefix))
|
|
6470
6448
|
continue;
|
|
6471
|
-
const srcPath = (0,
|
|
6472
|
-
const destPath = (0,
|
|
6449
|
+
const srcPath = (0, import_path11.join)(nodeModulesDir, entry);
|
|
6450
|
+
const destPath = (0, import_path11.join)(cacheDir, runtimeName);
|
|
6473
6451
|
try {
|
|
6474
6452
|
await import_fs11.default.promises.access(destPath);
|
|
6475
6453
|
(0, import_build_utils13.debug)(`Engine binary: ${runtimeName} already exists, skipping`);
|
|
@@ -6492,7 +6470,7 @@ var prismaQuirk = {
|
|
|
6492
6470
|
message: `could not find engine binary matching "${srcBinaryPrefix}*" in "${nodeModulesDir}". This may indicate an incompatible prisma version or an unsupported platform (${process.arch}).`
|
|
6493
6471
|
});
|
|
6494
6472
|
}
|
|
6495
|
-
const shimPath = (0,
|
|
6473
|
+
const shimPath = (0, import_path11.join)(cacheDir, "openssl");
|
|
6496
6474
|
await import_fs11.default.promises.writeFile(
|
|
6497
6475
|
shimPath,
|
|
6498
6476
|
`#!/bin/sh
|
|
@@ -6548,7 +6526,7 @@ echo "OpenSSL ${RUNTIME_OPENSSL_VERSION}.0 1 Jan 2024 (Library: OpenSSL ${RUNTIM
|
|
|
6548
6526
|
}
|
|
6549
6527
|
try {
|
|
6550
6528
|
const allFiles = await collectFiles(
|
|
6551
|
-
(0,
|
|
6529
|
+
(0, import_path11.join)(sitePackages, "prisma"),
|
|
6552
6530
|
sitePackages
|
|
6553
6531
|
);
|
|
6554
6532
|
const count = await (0, import_python_analysis7.extendDistRecord)(sitePackages, "prisma", allFiles);
|
|
@@ -6675,10 +6653,10 @@ async function runQuirks(ctx) {
|
|
|
6675
6653
|
|
|
6676
6654
|
// src/django.ts
|
|
6677
6655
|
var import_fs12 = __toESM(require("fs"));
|
|
6678
|
-
var
|
|
6656
|
+
var import_path12 = require("path");
|
|
6679
6657
|
var import_execa6 = __toESM(require_execa());
|
|
6680
6658
|
var import_build_utils15 = require("@vercel/build-utils");
|
|
6681
|
-
var scriptPath2 = (0,
|
|
6659
|
+
var scriptPath2 = (0, import_path12.join)(__dirname, "..", "templates", "vc_django_settings.py");
|
|
6682
6660
|
var script2 = import_fs12.default.readFileSync(scriptPath2, "utf-8");
|
|
6683
6661
|
async function getDjangoSettings(projectDir, env) {
|
|
6684
6662
|
const { stdout } = await (0, import_execa6.default)("python", ["-c", script2], {
|
|
@@ -6707,7 +6685,7 @@ async function runDjangoCollectStatic(venvPath, workPath, env, outputStaticDir,
|
|
|
6707
6685
|
const installedApps = djangoSettings["INSTALLED_APPS"] ?? [];
|
|
6708
6686
|
const staticfilesDirs = djangoSettings["STATICFILES_DIRS"] ?? [];
|
|
6709
6687
|
const staticSourceDirs = [
|
|
6710
|
-
...installedApps.map((app) => (0,
|
|
6688
|
+
...installedApps.map((app) => (0, import_path12.join)(workPath, ...app.split("."), "static")),
|
|
6711
6689
|
// TODO: Deal with optional prefixes in STATICFILES_DIRS.
|
|
6712
6690
|
...staticfilesDirs.map((d) => Array.isArray(d) ? d[1] : d)
|
|
6713
6691
|
].filter((d) => import_fs12.default.existsSync(d));
|
|
@@ -6721,7 +6699,7 @@ async function runDjangoCollectStatic(venvPath, workPath, env, outputStaticDir,
|
|
|
6721
6699
|
});
|
|
6722
6700
|
return {
|
|
6723
6701
|
staticSourceDirs,
|
|
6724
|
-
staticRoot: staticRoot ? (0,
|
|
6702
|
+
staticRoot: staticRoot ? (0, import_path12.resolve)(workPath, staticRoot) : null,
|
|
6725
6703
|
cdnOutputDir: null,
|
|
6726
6704
|
manifestRelPath: null
|
|
6727
6705
|
};
|
|
@@ -6733,9 +6711,9 @@ async function runDjangoCollectStatic(venvPath, workPath, env, outputStaticDir,
|
|
|
6733
6711
|
return null;
|
|
6734
6712
|
}
|
|
6735
6713
|
const staticUrlPath = staticUrl.replace(/^\/|\/$/g, "") || "static";
|
|
6736
|
-
const staticOutputDir = (0,
|
|
6714
|
+
const staticOutputDir = (0, import_path12.join)(outputStaticDir, staticUrlPath);
|
|
6737
6715
|
await import_fs12.default.promises.mkdir(staticOutputDir, { recursive: true });
|
|
6738
|
-
const shimPath = (0,
|
|
6716
|
+
const shimPath = (0, import_path12.join)(workPath, "_vercel_collectstatic_settings.py");
|
|
6739
6717
|
const shimLines = [
|
|
6740
6718
|
`from ${settingsModule} import *`,
|
|
6741
6719
|
`STATIC_ROOT = ${JSON.stringify(staticOutputDir)}`
|
|
@@ -6763,17 +6741,17 @@ async function runDjangoCollectStatic(venvPath, workPath, env, outputStaticDir,
|
|
|
6763
6741
|
];
|
|
6764
6742
|
let manifestRelPath = null;
|
|
6765
6743
|
if (MANIFEST_STORAGE_BACKENDS.includes(storageBackend) && staticRoot) {
|
|
6766
|
-
const manifestSrc = (0,
|
|
6767
|
-
const resolvedStaticRoot = (0,
|
|
6768
|
-
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");
|
|
6769
6747
|
await import_fs12.default.promises.mkdir(resolvedStaticRoot, { recursive: true });
|
|
6770
6748
|
await import_fs12.default.promises.copyFile(manifestSrc, manifestDest);
|
|
6771
|
-
manifestRelPath = (0,
|
|
6749
|
+
manifestRelPath = (0, import_path12.relative)(workPath, manifestDest);
|
|
6772
6750
|
(0, import_build_utils15.debug)(`Copied staticfiles.json to ${manifestDest} for Lambda bundle`);
|
|
6773
6751
|
}
|
|
6774
6752
|
return {
|
|
6775
6753
|
staticSourceDirs,
|
|
6776
|
-
staticRoot: staticRoot ? (0,
|
|
6754
|
+
staticRoot: staticRoot ? (0, import_path12.resolve)(workPath, staticRoot) : null,
|
|
6777
6755
|
cdnOutputDir: outputStaticDir,
|
|
6778
6756
|
manifestRelPath
|
|
6779
6757
|
};
|
|
@@ -6846,7 +6824,7 @@ ${detail}`
|
|
|
6846
6824
|
}
|
|
6847
6825
|
let djangoStatic = null;
|
|
6848
6826
|
if (workPath && venvPath) {
|
|
6849
|
-
const outputStaticDir = (0,
|
|
6827
|
+
const outputStaticDir = (0, import_path13.join)(workPath, ".vercel", "output", "static");
|
|
6850
6828
|
djangoStatic = await runDjangoCollectStatic(
|
|
6851
6829
|
venvPath,
|
|
6852
6830
|
workPath,
|
|
@@ -6869,9 +6847,9 @@ async function downloadFilesInWorkPath({
|
|
|
6869
6847
|
(0, import_build_utils16.debug)("Downloading user files...");
|
|
6870
6848
|
let downloadedFiles = await (0, import_build_utils16.download)(files, workPath, meta);
|
|
6871
6849
|
if (meta.isDev && entrypoint) {
|
|
6872
|
-
const { devCacheDir = (0,
|
|
6873
|
-
const cacheKey = (0,
|
|
6874
|
-
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);
|
|
6875
6853
|
await (0, import_build_utils16.download)(downloadedFiles, destCache);
|
|
6876
6854
|
downloadedFiles = await (0, import_build_utils16.glob)("**", destCache);
|
|
6877
6855
|
workPath = destCache;
|
|
@@ -6904,7 +6882,7 @@ var build = async ({
|
|
|
6904
6882
|
});
|
|
6905
6883
|
try {
|
|
6906
6884
|
if (meta.isDev) {
|
|
6907
|
-
const setupCfg = (0,
|
|
6885
|
+
const setupCfg = (0, import_path13.join)(workPath, "setup.cfg");
|
|
6908
6886
|
await writeFile(setupCfg, "[install]\nprefix=\n");
|
|
6909
6887
|
}
|
|
6910
6888
|
} catch (err) {
|
|
@@ -6918,17 +6896,17 @@ var build = async ({
|
|
|
6918
6896
|
workPath,
|
|
6919
6897
|
entrypoint ? {
|
|
6920
6898
|
filePath: entrypoint,
|
|
6921
|
-
// For
|
|
6899
|
+
// For schedule-triggered jobs, the WSGI variable is always 'app' (created dynamically).
|
|
6922
6900
|
// For other services, handlerFunction is used as the entrypoint variable name.
|
|
6923
|
-
varName: service?.type === "cron" ? void 0 : handlerFunction
|
|
6901
|
+
varName: service?.type === "cron" || service?.type === "job" && service.trigger === "schedule" ? void 0 : handlerFunction
|
|
6924
6902
|
} : void 0,
|
|
6925
6903
|
service
|
|
6926
6904
|
) ?? void 0;
|
|
6927
6905
|
if (detected?.error && detected?.baseDir === void 0) {
|
|
6928
6906
|
throw detected?.error;
|
|
6929
6907
|
}
|
|
6930
|
-
const entryDirectory = detected?.baseDir ?? (entrypoint ? (0,
|
|
6931
|
-
const entrypointAbsDir = (0,
|
|
6908
|
+
const entryDirectory = detected?.baseDir ?? (entrypoint ? (0, import_path13.dirname)(entrypoint) : ".");
|
|
6909
|
+
const entrypointAbsDir = (0, import_path13.join)(workPath, entryDirectory);
|
|
6932
6910
|
const rootDir = repoRootPath ?? workPath;
|
|
6933
6911
|
const pythonPackage = await builderSpan.child("vc.builder.python.discover").trace(
|
|
6934
6912
|
() => discoverPackage({
|
|
@@ -6973,8 +6951,8 @@ var build = async ({
|
|
|
6973
6951
|
`uv is required for this project but failed to install: ${err instanceof Error ? err.message : String(err)}`
|
|
6974
6952
|
);
|
|
6975
6953
|
}
|
|
6976
|
-
const venvPath = service?.name ? (0,
|
|
6977
|
-
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"));
|
|
6978
6956
|
const hasCachedUv = import_fs13.default.existsSync(uvCacheDir);
|
|
6979
6957
|
if (hasCachedVenv || hasCachedUv) {
|
|
6980
6958
|
(0, import_build_utils16.debug)(
|
|
@@ -7057,7 +7035,7 @@ var build = async ({
|
|
|
7057
7035
|
}
|
|
7058
7036
|
if (!assumeDepsInstalled) {
|
|
7059
7037
|
const lockCacheKey = service?.name ? `uv.lock.${service.name}` : "uv.lock";
|
|
7060
|
-
const cachedLockPath = (0,
|
|
7038
|
+
const cachedLockPath = (0, import_path13.join)(uvCacheDir, lockCacheKey);
|
|
7061
7039
|
const { projectDir, lockPath, lockFileProvidedByUser } = await ensureUvProject({
|
|
7062
7040
|
workPath,
|
|
7063
7041
|
rootDir,
|
|
@@ -7106,7 +7084,7 @@ var build = async ({
|
|
|
7106
7084
|
}
|
|
7107
7085
|
const hookResult = await runFrameworkHook(framework, {
|
|
7108
7086
|
pythonEnv,
|
|
7109
|
-
projectDir: (0,
|
|
7087
|
+
projectDir: (0, import_path13.join)(workPath, entryDirectory),
|
|
7110
7088
|
workPath,
|
|
7111
7089
|
venvPath,
|
|
7112
7090
|
entrypoint,
|
|
@@ -7128,7 +7106,7 @@ var build = async ({
|
|
|
7128
7106
|
(0, import_build_utils16.debug)(`Installing ${runtimeDep}`);
|
|
7129
7107
|
await uv.pip({
|
|
7130
7108
|
venvPath,
|
|
7131
|
-
projectDir: (0,
|
|
7109
|
+
projectDir: (0, import_path13.join)(workPath, entryDirectory),
|
|
7132
7110
|
args: ["install", runtimeDep]
|
|
7133
7111
|
});
|
|
7134
7112
|
if (shouldInstallVercelWorkers) {
|
|
@@ -7136,7 +7114,7 @@ var build = async ({
|
|
|
7136
7114
|
(0, import_build_utils16.debug)(`Installing ${workersDep}`);
|
|
7137
7115
|
await uv.pip({
|
|
7138
7116
|
venvPath,
|
|
7139
|
-
projectDir: (0,
|
|
7117
|
+
projectDir: (0, import_path13.join)(workPath, entryDirectory),
|
|
7140
7118
|
args: ["install", workersDep]
|
|
7141
7119
|
});
|
|
7142
7120
|
}
|
|
@@ -7147,7 +7125,7 @@ var build = async ({
|
|
|
7147
7125
|
(0, import_build_utils16.debug)("Entrypoint is", entrypoint);
|
|
7148
7126
|
const moduleName = entrypoint.replace(/\//g, ".").replace(/\.py$/i, "");
|
|
7149
7127
|
if (handlerFunction) {
|
|
7150
|
-
const entrypointPath = (0,
|
|
7128
|
+
const entrypointPath = (0, import_path13.join)(workPath, entrypoint);
|
|
7151
7129
|
const source = await import_fs13.default.promises.readFile(entrypointPath, "utf-8");
|
|
7152
7130
|
const found = await (0, import_python_analysis9.containsTopLevelCallable)(source, handlerFunction);
|
|
7153
7131
|
if (!found) {
|
|
@@ -7248,7 +7226,7 @@ from vercel_runtime.vc_init import vc_handler
|
|
|
7248
7226
|
const files = await (0, import_build_utils16.glob)("**", globOptions);
|
|
7249
7227
|
if (djangoStatic?.manifestRelPath) {
|
|
7250
7228
|
files[djangoStatic.manifestRelPath] = new import_build_utils16.FileFsRef({
|
|
7251
|
-
fsPath: (0,
|
|
7229
|
+
fsPath: (0, import_path13.join)(workPath, djangoStatic.manifestRelPath)
|
|
7252
7230
|
});
|
|
7253
7231
|
}
|
|
7254
7232
|
const depExternalizer = new PythonDependencyExternalizer({
|
|
@@ -7372,7 +7350,7 @@ var defaultShouldServe = ({
|
|
|
7372
7350
|
if (entrypoint === requestPath && hasProp(files, entrypoint)) {
|
|
7373
7351
|
return true;
|
|
7374
7352
|
}
|
|
7375
|
-
const { dir, name } = (0,
|
|
7353
|
+
const { dir, name } = (0, import_path13.parse)(entrypoint);
|
|
7376
7354
|
if (name === "index" && dir === requestPath && hasProp(files, entrypoint)) {
|
|
7377
7355
|
return true;
|
|
7378
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
|
},
|