@vercel/python 6.23.0 → 6.25.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 +1252 -358
- package/package.json +8 -6
- package/templates/vc_init_dev.py +2 -0
package/dist/index.js
CHANGED
|
@@ -48,7 +48,7 @@ var require_windows = __commonJS({
|
|
|
48
48
|
"../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js"(exports, module2) {
|
|
49
49
|
module2.exports = isexe;
|
|
50
50
|
isexe.sync = sync;
|
|
51
|
-
var
|
|
51
|
+
var fs11 = require("fs");
|
|
52
52
|
function checkPathExt(path, options) {
|
|
53
53
|
var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
|
|
54
54
|
if (!pathext) {
|
|
@@ -73,12 +73,12 @@ var require_windows = __commonJS({
|
|
|
73
73
|
return checkPathExt(path, options);
|
|
74
74
|
}
|
|
75
75
|
function isexe(path, options, cb) {
|
|
76
|
-
|
|
76
|
+
fs11.stat(path, function(er, stat) {
|
|
77
77
|
cb(er, er ? false : checkStat(stat, path, options));
|
|
78
78
|
});
|
|
79
79
|
}
|
|
80
80
|
function sync(path, options) {
|
|
81
|
-
return checkStat(
|
|
81
|
+
return checkStat(fs11.statSync(path), path, options);
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
});
|
|
@@ -88,14 +88,14 @@ var require_mode = __commonJS({
|
|
|
88
88
|
"../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js"(exports, module2) {
|
|
89
89
|
module2.exports = isexe;
|
|
90
90
|
isexe.sync = sync;
|
|
91
|
-
var
|
|
91
|
+
var fs11 = require("fs");
|
|
92
92
|
function isexe(path, options, cb) {
|
|
93
|
-
|
|
93
|
+
fs11.stat(path, function(er, stat) {
|
|
94
94
|
cb(er, er ? false : checkStat(stat, options));
|
|
95
95
|
});
|
|
96
96
|
}
|
|
97
97
|
function sync(path, options) {
|
|
98
|
-
return checkStat(
|
|
98
|
+
return checkStat(fs11.statSync(path), options);
|
|
99
99
|
}
|
|
100
100
|
function checkStat(stat, options) {
|
|
101
101
|
return stat.isFile() && checkMode(stat, options);
|
|
@@ -119,7 +119,7 @@ var require_mode = __commonJS({
|
|
|
119
119
|
// ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js
|
|
120
120
|
var require_isexe = __commonJS({
|
|
121
121
|
"../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js"(exports, module2) {
|
|
122
|
-
var
|
|
122
|
+
var fs11 = require("fs");
|
|
123
123
|
var core;
|
|
124
124
|
if (process.platform === "win32" || global.TESTING_WINDOWS) {
|
|
125
125
|
core = require_windows();
|
|
@@ -395,7 +395,7 @@ var require_shebang_command = __commonJS({
|
|
|
395
395
|
var require_readShebang = __commonJS({
|
|
396
396
|
"../../node_modules/.pnpm/cross-spawn@6.0.5/node_modules/cross-spawn/lib/util/readShebang.js"(exports, module2) {
|
|
397
397
|
"use strict";
|
|
398
|
-
var
|
|
398
|
+
var fs11 = require("fs");
|
|
399
399
|
var shebangCommand = require_shebang_command();
|
|
400
400
|
function readShebang(command) {
|
|
401
401
|
const size = 150;
|
|
@@ -408,9 +408,9 @@ var require_readShebang = __commonJS({
|
|
|
408
408
|
}
|
|
409
409
|
let fd;
|
|
410
410
|
try {
|
|
411
|
-
fd =
|
|
412
|
-
|
|
413
|
-
|
|
411
|
+
fd = fs11.openSync(command, "r");
|
|
412
|
+
fs11.readSync(fd, buffer, 0, size, 0);
|
|
413
|
+
fs11.closeSync(fd);
|
|
414
414
|
} catch (e) {
|
|
415
415
|
}
|
|
416
416
|
return shebangCommand(buffer.toString());
|
|
@@ -423,15 +423,15 @@ var require_readShebang = __commonJS({
|
|
|
423
423
|
var require_semver = __commonJS({
|
|
424
424
|
"../../node_modules/.pnpm/semver@5.7.2/node_modules/semver/semver.js"(exports, module2) {
|
|
425
425
|
exports = module2.exports = SemVer;
|
|
426
|
-
var
|
|
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
|
}
|
|
@@ -1895,9 +1895,9 @@ var require_pump = __commonJS({
|
|
|
1895
1895
|
"../../node_modules/.pnpm/pump@3.0.2/node_modules/pump/index.js"(exports, module2) {
|
|
1896
1896
|
var once = require_once();
|
|
1897
1897
|
var eos = require_end_of_stream();
|
|
1898
|
-
var
|
|
1898
|
+
var fs11;
|
|
1899
1899
|
try {
|
|
1900
|
-
|
|
1900
|
+
fs11 = require("fs");
|
|
1901
1901
|
} catch (e) {
|
|
1902
1902
|
}
|
|
1903
1903
|
var noop = function() {
|
|
@@ -1909,9 +1909,9 @@ var require_pump = __commonJS({
|
|
|
1909
1909
|
var isFS = function(stream) {
|
|
1910
1910
|
if (!ancient)
|
|
1911
1911
|
return false;
|
|
1912
|
-
if (!
|
|
1912
|
+
if (!fs11)
|
|
1913
1913
|
return false;
|
|
1914
|
-
return (stream instanceof (
|
|
1914
|
+
return (stream instanceof (fs11.ReadStream || noop) || stream instanceof (fs11.WriteStream || noop)) && isFn(stream.close);
|
|
1915
1915
|
};
|
|
1916
1916
|
var isRequest = function(stream) {
|
|
1917
1917
|
return stream.setHeader && isFn(stream.abort);
|
|
@@ -2647,11 +2647,365 @@ ${stderr}${stdout}`;
|
|
|
2647
2647
|
}
|
|
2648
2648
|
});
|
|
2649
2649
|
|
|
2650
|
+
// ../../node_modules/.pnpm/detect-libc@2.1.2/node_modules/detect-libc/lib/process.js
|
|
2651
|
+
var require_process = __commonJS({
|
|
2652
|
+
"../../node_modules/.pnpm/detect-libc@2.1.2/node_modules/detect-libc/lib/process.js"(exports, module2) {
|
|
2653
|
+
"use strict";
|
|
2654
|
+
var isLinux = () => process.platform === "linux";
|
|
2655
|
+
var report = null;
|
|
2656
|
+
var getReport = () => {
|
|
2657
|
+
if (!report) {
|
|
2658
|
+
if (isLinux() && process.report) {
|
|
2659
|
+
const orig = process.report.excludeNetwork;
|
|
2660
|
+
process.report.excludeNetwork = true;
|
|
2661
|
+
report = process.report.getReport();
|
|
2662
|
+
process.report.excludeNetwork = orig;
|
|
2663
|
+
} else {
|
|
2664
|
+
report = {};
|
|
2665
|
+
}
|
|
2666
|
+
}
|
|
2667
|
+
return report;
|
|
2668
|
+
};
|
|
2669
|
+
module2.exports = { isLinux, getReport };
|
|
2670
|
+
}
|
|
2671
|
+
});
|
|
2672
|
+
|
|
2673
|
+
// ../../node_modules/.pnpm/detect-libc@2.1.2/node_modules/detect-libc/lib/filesystem.js
|
|
2674
|
+
var require_filesystem = __commonJS({
|
|
2675
|
+
"../../node_modules/.pnpm/detect-libc@2.1.2/node_modules/detect-libc/lib/filesystem.js"(exports, module2) {
|
|
2676
|
+
"use strict";
|
|
2677
|
+
var fs11 = require("fs");
|
|
2678
|
+
var LDD_PATH = "/usr/bin/ldd";
|
|
2679
|
+
var SELF_PATH = "/proc/self/exe";
|
|
2680
|
+
var MAX_LENGTH = 2048;
|
|
2681
|
+
var readFileSync2 = (path) => {
|
|
2682
|
+
const fd = fs11.openSync(path, "r");
|
|
2683
|
+
const buffer = Buffer.alloc(MAX_LENGTH);
|
|
2684
|
+
const bytesRead = fs11.readSync(fd, buffer, 0, MAX_LENGTH, 0);
|
|
2685
|
+
fs11.close(fd, () => {
|
|
2686
|
+
});
|
|
2687
|
+
return buffer.subarray(0, bytesRead);
|
|
2688
|
+
};
|
|
2689
|
+
var readFile2 = (path) => new Promise((resolve3, reject) => {
|
|
2690
|
+
fs11.open(path, "r", (err, fd) => {
|
|
2691
|
+
if (err) {
|
|
2692
|
+
reject(err);
|
|
2693
|
+
} else {
|
|
2694
|
+
const buffer = Buffer.alloc(MAX_LENGTH);
|
|
2695
|
+
fs11.read(fd, buffer, 0, MAX_LENGTH, 0, (_, bytesRead) => {
|
|
2696
|
+
resolve3(buffer.subarray(0, bytesRead));
|
|
2697
|
+
fs11.close(fd, () => {
|
|
2698
|
+
});
|
|
2699
|
+
});
|
|
2700
|
+
}
|
|
2701
|
+
});
|
|
2702
|
+
});
|
|
2703
|
+
module2.exports = {
|
|
2704
|
+
LDD_PATH,
|
|
2705
|
+
SELF_PATH,
|
|
2706
|
+
readFileSync: readFileSync2,
|
|
2707
|
+
readFile: readFile2
|
|
2708
|
+
};
|
|
2709
|
+
}
|
|
2710
|
+
});
|
|
2711
|
+
|
|
2712
|
+
// ../../node_modules/.pnpm/detect-libc@2.1.2/node_modules/detect-libc/lib/elf.js
|
|
2713
|
+
var require_elf = __commonJS({
|
|
2714
|
+
"../../node_modules/.pnpm/detect-libc@2.1.2/node_modules/detect-libc/lib/elf.js"(exports, module2) {
|
|
2715
|
+
"use strict";
|
|
2716
|
+
var interpreterPath = (elf) => {
|
|
2717
|
+
if (elf.length < 64) {
|
|
2718
|
+
return null;
|
|
2719
|
+
}
|
|
2720
|
+
if (elf.readUInt32BE(0) !== 2135247942) {
|
|
2721
|
+
return null;
|
|
2722
|
+
}
|
|
2723
|
+
if (elf.readUInt8(4) !== 2) {
|
|
2724
|
+
return null;
|
|
2725
|
+
}
|
|
2726
|
+
if (elf.readUInt8(5) !== 1) {
|
|
2727
|
+
return null;
|
|
2728
|
+
}
|
|
2729
|
+
const offset = elf.readUInt32LE(32);
|
|
2730
|
+
const size = elf.readUInt16LE(54);
|
|
2731
|
+
const count = elf.readUInt16LE(56);
|
|
2732
|
+
for (let i = 0; i < count; i++) {
|
|
2733
|
+
const headerOffset = offset + i * size;
|
|
2734
|
+
const type = elf.readUInt32LE(headerOffset);
|
|
2735
|
+
if (type === 3) {
|
|
2736
|
+
const fileOffset = elf.readUInt32LE(headerOffset + 8);
|
|
2737
|
+
const fileSize = elf.readUInt32LE(headerOffset + 32);
|
|
2738
|
+
return elf.subarray(fileOffset, fileOffset + fileSize).toString().replace(/\0.*$/g, "");
|
|
2739
|
+
}
|
|
2740
|
+
}
|
|
2741
|
+
return null;
|
|
2742
|
+
};
|
|
2743
|
+
module2.exports = {
|
|
2744
|
+
interpreterPath
|
|
2745
|
+
};
|
|
2746
|
+
}
|
|
2747
|
+
});
|
|
2748
|
+
|
|
2749
|
+
// ../../node_modules/.pnpm/detect-libc@2.1.2/node_modules/detect-libc/lib/detect-libc.js
|
|
2750
|
+
var require_detect_libc = __commonJS({
|
|
2751
|
+
"../../node_modules/.pnpm/detect-libc@2.1.2/node_modules/detect-libc/lib/detect-libc.js"(exports, module2) {
|
|
2752
|
+
"use strict";
|
|
2753
|
+
var childProcess = require("child_process");
|
|
2754
|
+
var { isLinux, getReport } = require_process();
|
|
2755
|
+
var { LDD_PATH, SELF_PATH, readFile: readFile2, readFileSync: readFileSync2 } = require_filesystem();
|
|
2756
|
+
var { interpreterPath } = require_elf();
|
|
2757
|
+
var cachedFamilyInterpreter;
|
|
2758
|
+
var cachedFamilyFilesystem;
|
|
2759
|
+
var cachedVersionFilesystem;
|
|
2760
|
+
var command = "getconf GNU_LIBC_VERSION 2>&1 || true; ldd --version 2>&1 || true";
|
|
2761
|
+
var commandOut = "";
|
|
2762
|
+
var safeCommand = () => {
|
|
2763
|
+
if (!commandOut) {
|
|
2764
|
+
return new Promise((resolve3) => {
|
|
2765
|
+
childProcess.exec(command, (err, out) => {
|
|
2766
|
+
commandOut = err ? " " : out;
|
|
2767
|
+
resolve3(commandOut);
|
|
2768
|
+
});
|
|
2769
|
+
});
|
|
2770
|
+
}
|
|
2771
|
+
return commandOut;
|
|
2772
|
+
};
|
|
2773
|
+
var safeCommandSync = () => {
|
|
2774
|
+
if (!commandOut) {
|
|
2775
|
+
try {
|
|
2776
|
+
commandOut = childProcess.execSync(command, { encoding: "utf8" });
|
|
2777
|
+
} catch (_err) {
|
|
2778
|
+
commandOut = " ";
|
|
2779
|
+
}
|
|
2780
|
+
}
|
|
2781
|
+
return commandOut;
|
|
2782
|
+
};
|
|
2783
|
+
var GLIBC2 = "glibc";
|
|
2784
|
+
var RE_GLIBC_VERSION = /LIBC[a-z0-9 \-).]*?(\d+\.\d+)/i;
|
|
2785
|
+
var MUSL2 = "musl";
|
|
2786
|
+
var isFileMusl = (f) => f.includes("libc.musl-") || f.includes("ld-musl-");
|
|
2787
|
+
var familyFromReport = () => {
|
|
2788
|
+
const report = getReport();
|
|
2789
|
+
if (report.header && report.header.glibcVersionRuntime) {
|
|
2790
|
+
return GLIBC2;
|
|
2791
|
+
}
|
|
2792
|
+
if (Array.isArray(report.sharedObjects)) {
|
|
2793
|
+
if (report.sharedObjects.some(isFileMusl)) {
|
|
2794
|
+
return MUSL2;
|
|
2795
|
+
}
|
|
2796
|
+
}
|
|
2797
|
+
return null;
|
|
2798
|
+
};
|
|
2799
|
+
var familyFromCommand = (out) => {
|
|
2800
|
+
const [getconf, ldd1] = out.split(/[\r\n]+/);
|
|
2801
|
+
if (getconf && getconf.includes(GLIBC2)) {
|
|
2802
|
+
return GLIBC2;
|
|
2803
|
+
}
|
|
2804
|
+
if (ldd1 && ldd1.includes(MUSL2)) {
|
|
2805
|
+
return MUSL2;
|
|
2806
|
+
}
|
|
2807
|
+
return null;
|
|
2808
|
+
};
|
|
2809
|
+
var familyFromInterpreterPath = (path) => {
|
|
2810
|
+
if (path) {
|
|
2811
|
+
if (path.includes("/ld-musl-")) {
|
|
2812
|
+
return MUSL2;
|
|
2813
|
+
} else if (path.includes("/ld-linux-")) {
|
|
2814
|
+
return GLIBC2;
|
|
2815
|
+
}
|
|
2816
|
+
}
|
|
2817
|
+
return null;
|
|
2818
|
+
};
|
|
2819
|
+
var getFamilyFromLddContent = (content) => {
|
|
2820
|
+
content = content.toString();
|
|
2821
|
+
if (content.includes("musl")) {
|
|
2822
|
+
return MUSL2;
|
|
2823
|
+
}
|
|
2824
|
+
if (content.includes("GNU C Library")) {
|
|
2825
|
+
return GLIBC2;
|
|
2826
|
+
}
|
|
2827
|
+
return null;
|
|
2828
|
+
};
|
|
2829
|
+
var familyFromFilesystem = async () => {
|
|
2830
|
+
if (cachedFamilyFilesystem !== void 0) {
|
|
2831
|
+
return cachedFamilyFilesystem;
|
|
2832
|
+
}
|
|
2833
|
+
cachedFamilyFilesystem = null;
|
|
2834
|
+
try {
|
|
2835
|
+
const lddContent = await readFile2(LDD_PATH);
|
|
2836
|
+
cachedFamilyFilesystem = getFamilyFromLddContent(lddContent);
|
|
2837
|
+
} catch (e) {
|
|
2838
|
+
}
|
|
2839
|
+
return cachedFamilyFilesystem;
|
|
2840
|
+
};
|
|
2841
|
+
var familyFromFilesystemSync = () => {
|
|
2842
|
+
if (cachedFamilyFilesystem !== void 0) {
|
|
2843
|
+
return cachedFamilyFilesystem;
|
|
2844
|
+
}
|
|
2845
|
+
cachedFamilyFilesystem = null;
|
|
2846
|
+
try {
|
|
2847
|
+
const lddContent = readFileSync2(LDD_PATH);
|
|
2848
|
+
cachedFamilyFilesystem = getFamilyFromLddContent(lddContent);
|
|
2849
|
+
} catch (e) {
|
|
2850
|
+
}
|
|
2851
|
+
return cachedFamilyFilesystem;
|
|
2852
|
+
};
|
|
2853
|
+
var familyFromInterpreter = async () => {
|
|
2854
|
+
if (cachedFamilyInterpreter !== void 0) {
|
|
2855
|
+
return cachedFamilyInterpreter;
|
|
2856
|
+
}
|
|
2857
|
+
cachedFamilyInterpreter = null;
|
|
2858
|
+
try {
|
|
2859
|
+
const selfContent = await readFile2(SELF_PATH);
|
|
2860
|
+
const path = interpreterPath(selfContent);
|
|
2861
|
+
cachedFamilyInterpreter = familyFromInterpreterPath(path);
|
|
2862
|
+
} catch (e) {
|
|
2863
|
+
}
|
|
2864
|
+
return cachedFamilyInterpreter;
|
|
2865
|
+
};
|
|
2866
|
+
var familyFromInterpreterSync = () => {
|
|
2867
|
+
if (cachedFamilyInterpreter !== void 0) {
|
|
2868
|
+
return cachedFamilyInterpreter;
|
|
2869
|
+
}
|
|
2870
|
+
cachedFamilyInterpreter = null;
|
|
2871
|
+
try {
|
|
2872
|
+
const selfContent = readFileSync2(SELF_PATH);
|
|
2873
|
+
const path = interpreterPath(selfContent);
|
|
2874
|
+
cachedFamilyInterpreter = familyFromInterpreterPath(path);
|
|
2875
|
+
} catch (e) {
|
|
2876
|
+
}
|
|
2877
|
+
return cachedFamilyInterpreter;
|
|
2878
|
+
};
|
|
2879
|
+
var family = async () => {
|
|
2880
|
+
let family2 = null;
|
|
2881
|
+
if (isLinux()) {
|
|
2882
|
+
family2 = await familyFromInterpreter();
|
|
2883
|
+
if (!family2) {
|
|
2884
|
+
family2 = await familyFromFilesystem();
|
|
2885
|
+
if (!family2) {
|
|
2886
|
+
family2 = familyFromReport();
|
|
2887
|
+
}
|
|
2888
|
+
if (!family2) {
|
|
2889
|
+
const out = await safeCommand();
|
|
2890
|
+
family2 = familyFromCommand(out);
|
|
2891
|
+
}
|
|
2892
|
+
}
|
|
2893
|
+
}
|
|
2894
|
+
return family2;
|
|
2895
|
+
};
|
|
2896
|
+
var familySync2 = () => {
|
|
2897
|
+
let family2 = null;
|
|
2898
|
+
if (isLinux()) {
|
|
2899
|
+
family2 = familyFromInterpreterSync();
|
|
2900
|
+
if (!family2) {
|
|
2901
|
+
family2 = familyFromFilesystemSync();
|
|
2902
|
+
if (!family2) {
|
|
2903
|
+
family2 = familyFromReport();
|
|
2904
|
+
}
|
|
2905
|
+
if (!family2) {
|
|
2906
|
+
const out = safeCommandSync();
|
|
2907
|
+
family2 = familyFromCommand(out);
|
|
2908
|
+
}
|
|
2909
|
+
}
|
|
2910
|
+
}
|
|
2911
|
+
return family2;
|
|
2912
|
+
};
|
|
2913
|
+
var isNonGlibcLinux = async () => isLinux() && await family() !== GLIBC2;
|
|
2914
|
+
var isNonGlibcLinuxSync = () => isLinux() && familySync2() !== GLIBC2;
|
|
2915
|
+
var versionFromFilesystem = async () => {
|
|
2916
|
+
if (cachedVersionFilesystem !== void 0) {
|
|
2917
|
+
return cachedVersionFilesystem;
|
|
2918
|
+
}
|
|
2919
|
+
cachedVersionFilesystem = null;
|
|
2920
|
+
try {
|
|
2921
|
+
const lddContent = await readFile2(LDD_PATH);
|
|
2922
|
+
const versionMatch = lddContent.match(RE_GLIBC_VERSION);
|
|
2923
|
+
if (versionMatch) {
|
|
2924
|
+
cachedVersionFilesystem = versionMatch[1];
|
|
2925
|
+
}
|
|
2926
|
+
} catch (e) {
|
|
2927
|
+
}
|
|
2928
|
+
return cachedVersionFilesystem;
|
|
2929
|
+
};
|
|
2930
|
+
var versionFromFilesystemSync = () => {
|
|
2931
|
+
if (cachedVersionFilesystem !== void 0) {
|
|
2932
|
+
return cachedVersionFilesystem;
|
|
2933
|
+
}
|
|
2934
|
+
cachedVersionFilesystem = null;
|
|
2935
|
+
try {
|
|
2936
|
+
const lddContent = readFileSync2(LDD_PATH);
|
|
2937
|
+
const versionMatch = lddContent.match(RE_GLIBC_VERSION);
|
|
2938
|
+
if (versionMatch) {
|
|
2939
|
+
cachedVersionFilesystem = versionMatch[1];
|
|
2940
|
+
}
|
|
2941
|
+
} catch (e) {
|
|
2942
|
+
}
|
|
2943
|
+
return cachedVersionFilesystem;
|
|
2944
|
+
};
|
|
2945
|
+
var versionFromReport = () => {
|
|
2946
|
+
const report = getReport();
|
|
2947
|
+
if (report.header && report.header.glibcVersionRuntime) {
|
|
2948
|
+
return report.header.glibcVersionRuntime;
|
|
2949
|
+
}
|
|
2950
|
+
return null;
|
|
2951
|
+
};
|
|
2952
|
+
var versionSuffix = (s) => s.trim().split(/\s+/)[1];
|
|
2953
|
+
var versionFromCommand = (out) => {
|
|
2954
|
+
const [getconf, ldd1, ldd2] = out.split(/[\r\n]+/);
|
|
2955
|
+
if (getconf && getconf.includes(GLIBC2)) {
|
|
2956
|
+
return versionSuffix(getconf);
|
|
2957
|
+
}
|
|
2958
|
+
if (ldd1 && ldd2 && ldd1.includes(MUSL2)) {
|
|
2959
|
+
return versionSuffix(ldd2);
|
|
2960
|
+
}
|
|
2961
|
+
return null;
|
|
2962
|
+
};
|
|
2963
|
+
var version2 = async () => {
|
|
2964
|
+
let version3 = null;
|
|
2965
|
+
if (isLinux()) {
|
|
2966
|
+
version3 = await versionFromFilesystem();
|
|
2967
|
+
if (!version3) {
|
|
2968
|
+
version3 = versionFromReport();
|
|
2969
|
+
}
|
|
2970
|
+
if (!version3) {
|
|
2971
|
+
const out = await safeCommand();
|
|
2972
|
+
version3 = versionFromCommand(out);
|
|
2973
|
+
}
|
|
2974
|
+
}
|
|
2975
|
+
return version3;
|
|
2976
|
+
};
|
|
2977
|
+
var versionSync2 = () => {
|
|
2978
|
+
let version3 = null;
|
|
2979
|
+
if (isLinux()) {
|
|
2980
|
+
version3 = versionFromFilesystemSync();
|
|
2981
|
+
if (!version3) {
|
|
2982
|
+
version3 = versionFromReport();
|
|
2983
|
+
}
|
|
2984
|
+
if (!version3) {
|
|
2985
|
+
const out = safeCommandSync();
|
|
2986
|
+
version3 = versionFromCommand(out);
|
|
2987
|
+
}
|
|
2988
|
+
}
|
|
2989
|
+
return version3;
|
|
2990
|
+
};
|
|
2991
|
+
module2.exports = {
|
|
2992
|
+
GLIBC: GLIBC2,
|
|
2993
|
+
MUSL: MUSL2,
|
|
2994
|
+
family,
|
|
2995
|
+
familySync: familySync2,
|
|
2996
|
+
isNonGlibcLinux,
|
|
2997
|
+
isNonGlibcLinuxSync,
|
|
2998
|
+
version: version2,
|
|
2999
|
+
versionSync: versionSync2
|
|
3000
|
+
};
|
|
3001
|
+
}
|
|
3002
|
+
});
|
|
3003
|
+
|
|
2650
3004
|
// ../../node_modules/.pnpm/which@3.0.0/node_modules/which/lib/index.js
|
|
2651
3005
|
var require_lib = __commonJS({
|
|
2652
3006
|
"../../node_modules/.pnpm/which@3.0.0/node_modules/which/lib/index.js"(exports, module2) {
|
|
2653
3007
|
var isexe = require_isexe();
|
|
2654
|
-
var { join:
|
|
3008
|
+
var { join: join13, delimiter: delimiter2, sep: sep2, posix } = require("path");
|
|
2655
3009
|
var isWindows = process.platform === "win32";
|
|
2656
3010
|
var rSlash = new RegExp(`[${posix.sep}${sep2 === posix.sep ? "" : sep2}]`.replace(/(\\)/g, "\\$1"));
|
|
2657
3011
|
var rRel = new RegExp(`^\\.${rSlash.source}`);
|
|
@@ -2680,7 +3034,7 @@ var require_lib = __commonJS({
|
|
|
2680
3034
|
var getPathPart = (raw, cmd) => {
|
|
2681
3035
|
const pathPart = /^".*"$/.test(raw) ? raw.slice(1, -1) : raw;
|
|
2682
3036
|
const prefix = !pathPart && rRel.test(cmd) ? cmd.slice(0, 2) : "";
|
|
2683
|
-
return prefix +
|
|
3037
|
+
return prefix + join13(pathPart, cmd);
|
|
2684
3038
|
};
|
|
2685
3039
|
var which2 = async (cmd, opt = {}) => {
|
|
2686
3040
|
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
@@ -2859,6 +3213,7 @@ var src_exports = {};
|
|
|
2859
3213
|
__export(src_exports, {
|
|
2860
3214
|
build: () => build,
|
|
2861
3215
|
defaultShouldServe: () => defaultShouldServe,
|
|
3216
|
+
diagnostics: () => diagnostics,
|
|
2862
3217
|
downloadFilesInWorkPath: () => downloadFilesInWorkPath,
|
|
2863
3218
|
installRequirement: () => installRequirement,
|
|
2864
3219
|
installRequirementsFile: () => installRequirementsFile,
|
|
@@ -2868,15 +3223,15 @@ __export(src_exports, {
|
|
|
2868
3223
|
version: () => version
|
|
2869
3224
|
});
|
|
2870
3225
|
module.exports = __toCommonJS(src_exports);
|
|
2871
|
-
var
|
|
2872
|
-
var
|
|
3226
|
+
var import_fs11 = __toESM(require("fs"));
|
|
3227
|
+
var import_path13 = require("path");
|
|
2873
3228
|
|
|
2874
3229
|
// src/package-versions.ts
|
|
2875
|
-
var VERCEL_RUNTIME_VERSION = "0.
|
|
2876
|
-
var VERCEL_WORKERS_VERSION = "0.0.
|
|
3230
|
+
var VERCEL_RUNTIME_VERSION = "0.10.0";
|
|
3231
|
+
var VERCEL_WORKERS_VERSION = "0.0.13";
|
|
2877
3232
|
|
|
2878
3233
|
// src/index.ts
|
|
2879
|
-
var
|
|
3234
|
+
var import_build_utils14 = require("@vercel/build-utils");
|
|
2880
3235
|
|
|
2881
3236
|
// src/install.ts
|
|
2882
3237
|
var import_execa3 = __toESM(require_execa());
|
|
@@ -2887,8 +3242,10 @@ var import_python_analysis2 = require("@vercel/python-analysis");
|
|
|
2887
3242
|
|
|
2888
3243
|
// src/utils.ts
|
|
2889
3244
|
var import_fs2 = __toESM(require("fs"));
|
|
3245
|
+
var import_os2 = __toESM(require("os"));
|
|
2890
3246
|
var import_path3 = require("path");
|
|
2891
3247
|
var import_build_utils2 = require("@vercel/build-utils");
|
|
3248
|
+
var detectLibc = __toESM(require_detect_libc());
|
|
2892
3249
|
var import_execa2 = __toESM(require_execa());
|
|
2893
3250
|
|
|
2894
3251
|
// src/uv.ts
|
|
@@ -3269,6 +3626,41 @@ async function runPyprojectScript(workPath, scriptNames, env, useUserVirtualEnv
|
|
|
3269
3626
|
}
|
|
3270
3627
|
return false;
|
|
3271
3628
|
}
|
|
3629
|
+
var ARCH_MAP = {
|
|
3630
|
+
x64: "x86_64",
|
|
3631
|
+
arm64: "aarch64",
|
|
3632
|
+
ia32: "i686",
|
|
3633
|
+
arm: "armv7l",
|
|
3634
|
+
ppc64: "ppc64le",
|
|
3635
|
+
s390x: "s390x"
|
|
3636
|
+
};
|
|
3637
|
+
function detectPlatform() {
|
|
3638
|
+
const arch = import_os2.default.arch();
|
|
3639
|
+
const archName = ARCH_MAP[arch] || arch;
|
|
3640
|
+
const libcFamily = detectLibc.familySync();
|
|
3641
|
+
const libcVersion = detectLibc.versionSync();
|
|
3642
|
+
let osName;
|
|
3643
|
+
let osMajor;
|
|
3644
|
+
let osMinor;
|
|
3645
|
+
if (libcFamily === detectLibc.MUSL) {
|
|
3646
|
+
osName = "musllinux";
|
|
3647
|
+
} else {
|
|
3648
|
+
osName = "manylinux";
|
|
3649
|
+
}
|
|
3650
|
+
if (libcVersion) {
|
|
3651
|
+
const parts = libcVersion.split(".");
|
|
3652
|
+
osMajor = parseInt(parts[0], 10);
|
|
3653
|
+
osMinor = parseInt(parts[1], 10) || 0;
|
|
3654
|
+
} else if (libcFamily === detectLibc.GLIBC) {
|
|
3655
|
+
osMajor = 2;
|
|
3656
|
+
osMinor = 17;
|
|
3657
|
+
} else {
|
|
3658
|
+
osMajor = 2;
|
|
3659
|
+
osMinor = 17;
|
|
3660
|
+
}
|
|
3661
|
+
const libc = libcFamily === detectLibc.MUSL ? "musl" : "gnu";
|
|
3662
|
+
return { osName, archName, osMajor, osMinor, os: "linux", libc };
|
|
3663
|
+
}
|
|
3272
3664
|
|
|
3273
3665
|
// src/version.ts
|
|
3274
3666
|
var import_path4 = require("path");
|
|
@@ -3340,13 +3732,14 @@ function versionLessOrEqual(a, b) {
|
|
|
3340
3732
|
return a.minor <= b.minor;
|
|
3341
3733
|
}
|
|
3342
3734
|
function toPythonBuild(opt) {
|
|
3735
|
+
const platform = detectPlatform();
|
|
3343
3736
|
return {
|
|
3344
3737
|
version: { major: opt.major, minor: opt.minor },
|
|
3345
3738
|
implementation: "cpython",
|
|
3346
3739
|
variant: "default",
|
|
3347
|
-
os:
|
|
3348
|
-
architecture:
|
|
3349
|
-
libc:
|
|
3740
|
+
os: platform.os,
|
|
3741
|
+
architecture: platform.archName,
|
|
3742
|
+
libc: platform.libc
|
|
3350
3743
|
};
|
|
3351
3744
|
}
|
|
3352
3745
|
function getAvailablePythonBuilds() {
|
|
@@ -3817,8 +4210,7 @@ var import_path6 = require("path");
|
|
|
3817
4210
|
var import_build_utils5 = require("@vercel/build-utils");
|
|
3818
4211
|
var import_python_analysis3 = require("@vercel/python-analysis");
|
|
3819
4212
|
var readFile = (0, import_util.promisify)(import_fs4.default.readFile);
|
|
3820
|
-
var LAMBDA_SIZE_THRESHOLD_BYTES =
|
|
3821
|
-
var LAMBDA_PACKING_TARGET_BYTES = 240 * 1024 * 1024;
|
|
4213
|
+
var LAMBDA_SIZE_THRESHOLD_BYTES = 245 * 1024 * 1024;
|
|
3822
4214
|
var LAMBDA_EPHEMERAL_STORAGE_BYTES = 500 * 1024 * 1024;
|
|
3823
4215
|
var PythonDependencyExternalizer = class {
|
|
3824
4216
|
constructor(options) {
|
|
@@ -3832,7 +4224,8 @@ var PythonDependencyExternalizer = class {
|
|
|
3832
4224
|
this.uvLockPath = options.uvLockPath;
|
|
3833
4225
|
this.uvProjectDir = options.uvProjectDir;
|
|
3834
4226
|
this.projectName = options.projectName;
|
|
3835
|
-
this.
|
|
4227
|
+
this.pythonMajor = options.pythonMajor;
|
|
4228
|
+
this.pythonMinor = options.pythonMinor;
|
|
3836
4229
|
this.pythonPath = options.pythonPath;
|
|
3837
4230
|
this.hasCustomCommand = options.hasCustomCommand;
|
|
3838
4231
|
this.alwaysBundlePackages = options.alwaysBundlePackages ?? [];
|
|
@@ -3921,17 +4314,6 @@ To resolve this, either:
|
|
|
3921
4314
|
action: "Learn More"
|
|
3922
4315
|
});
|
|
3923
4316
|
}
|
|
3924
|
-
if (this.noBuildCheckFailed) {
|
|
3925
|
-
throw new import_build_utils5.NowBuildError({
|
|
3926
|
-
code: "RUNTIME_DEPENDENCY_INSTALLATION_FAILED",
|
|
3927
|
-
message: `Bundle size exceeds the Lambda limit and requires runtime dependency installation, but some packages in your uv.lock file do not have pre-built binary wheels available.
|
|
3928
|
-
Runtime dependency installation requires all public packages to have binary wheels.
|
|
3929
|
-
|
|
3930
|
-
To fix this, either:
|
|
3931
|
-
1. Regenerate your lock file with: uv lock --upgrade --no-build, or
|
|
3932
|
-
2. Switch the problematic packages to ones that have pre-built wheels available`
|
|
3933
|
-
});
|
|
3934
|
-
}
|
|
3935
4317
|
let lockContent;
|
|
3936
4318
|
try {
|
|
3937
4319
|
lockContent = await readFile(this.uvLockPath, "utf8");
|
|
@@ -3982,10 +4364,30 @@ ${error.fileContent}`
|
|
|
3982
4364
|
(0, import_build_utils5.debug)(
|
|
3983
4365
|
`Package classification: ${classification.privatePackages.length} private, ${classification.publicPackages.length} public`
|
|
3984
4366
|
);
|
|
3985
|
-
|
|
4367
|
+
const forceBundledDueToWheels = await this.findPackagesWithoutCompatibleWheels(
|
|
4368
|
+
lockFile,
|
|
4369
|
+
classification.publicPackages
|
|
4370
|
+
);
|
|
4371
|
+
if (forceBundledDueToWheels.length > 0) {
|
|
4372
|
+
console.log(
|
|
4373
|
+
`Force-bundling ${forceBundledDueToWheels.length} package(s) without compatible wheels: ` + forceBundledDueToWheels.join(", ")
|
|
4374
|
+
);
|
|
4375
|
+
}
|
|
4376
|
+
const forceBundledSet = new Set(
|
|
4377
|
+
forceBundledDueToWheels.map(import_python_analysis3.normalizePackageName)
|
|
4378
|
+
);
|
|
4379
|
+
const externalizablePublic = classification.publicPackages.filter(
|
|
4380
|
+
(name) => !forceBundledSet.has((0, import_python_analysis3.normalizePackageName)(name))
|
|
4381
|
+
);
|
|
4382
|
+
if (externalizablePublic.length === 0) {
|
|
3986
4383
|
throw new import_build_utils5.NowBuildError({
|
|
3987
4384
|
code: "RUNTIME_DEPENDENCY_INSTALLATION_FAILED",
|
|
3988
|
-
message:
|
|
4385
|
+
message: `Bundle size exceeds the Lambda limit and requires runtime dependency installation, but no public packages have compatible pre-built wheels for the Lambda platform.
|
|
4386
|
+
Runtime dependency installation requires packages to have binary wheels.
|
|
4387
|
+
|
|
4388
|
+
To fix this, either:
|
|
4389
|
+
1. Regenerate your lock file with: uv lock --upgrade, or
|
|
4390
|
+
2. Switch the problematic packages to ones that have pre-built wheels available`
|
|
3989
4391
|
});
|
|
3990
4392
|
}
|
|
3991
4393
|
const packageSizes = await calculatePerPackageSizes(this.venvPath);
|
|
@@ -3993,7 +4395,8 @@ ${error.fileContent}`
|
|
|
3993
4395
|
...classification.privatePackages,
|
|
3994
4396
|
"vercel-runtime",
|
|
3995
4397
|
"vercel_runtime",
|
|
3996
|
-
...this.alwaysBundlePackages
|
|
4398
|
+
...this.alwaysBundlePackages,
|
|
4399
|
+
...forceBundledDueToWheels
|
|
3997
4400
|
];
|
|
3998
4401
|
const alwaysBundledFiles = await mirrorPackagesIntoVendor({
|
|
3999
4402
|
venvPath: this.venvPath,
|
|
@@ -4015,13 +4418,16 @@ ${error.fileContent}`
|
|
|
4015
4418
|
runtimeToolingOverhead = 50 * 1024 * 1024;
|
|
4016
4419
|
}
|
|
4017
4420
|
}
|
|
4018
|
-
const remainingCapacity =
|
|
4421
|
+
const remainingCapacity = LAMBDA_SIZE_THRESHOLD_BYTES - fixedOverhead - runtimeToolingOverhead;
|
|
4019
4422
|
(0, import_build_utils5.debug)(
|
|
4020
4423
|
`Fixed overhead: ${(fixedOverhead / (1024 * 1024)).toFixed(2)} MB, runtime tooling: ${(runtimeToolingOverhead / (1024 * 1024)).toFixed(2)} MB, remaining capacity for public packages: ${(remainingCapacity / (1024 * 1024)).toFixed(2)} MB`
|
|
4021
4424
|
);
|
|
4425
|
+
const externalizableSet = new Set(
|
|
4426
|
+
externalizablePublic.map(import_python_analysis3.normalizePackageName)
|
|
4427
|
+
);
|
|
4022
4428
|
const publicPackageSizes = new Map(
|
|
4023
4429
|
[...packageSizes].filter(
|
|
4024
|
-
([name]) =>
|
|
4430
|
+
([name]) => externalizableSet.has((0, import_python_analysis3.normalizePackageName)(name))
|
|
4025
4431
|
)
|
|
4026
4432
|
);
|
|
4027
4433
|
const bundledPublic = lambdaKnapsack(publicPackageSizes, remainingCapacity);
|
|
@@ -4037,7 +4443,8 @@ ${error.fileContent}`
|
|
|
4037
4443
|
const bundledPackagesForConfig = [
|
|
4038
4444
|
...classification.privatePackages,
|
|
4039
4445
|
...bundledPublic,
|
|
4040
|
-
...this.alwaysBundlePackages
|
|
4446
|
+
...this.alwaysBundlePackages,
|
|
4447
|
+
...forceBundledDueToWheels
|
|
4041
4448
|
];
|
|
4042
4449
|
const projectDirRel = (0, import_path6.relative)(this.workPath, this.uvProjectDir);
|
|
4043
4450
|
const uvLockRel = (0, import_path6.relative)(this.workPath, this.uvLockPath);
|
|
@@ -4092,6 +4499,60 @@ ${error.fileContent}`
|
|
|
4092
4499
|
});
|
|
4093
4500
|
}
|
|
4094
4501
|
}
|
|
4502
|
+
/**
|
|
4503
|
+
* Identify public packages that have no compatible wheel for the Lambda platform.
|
|
4504
|
+
* These packages must be force-bundled because `uv sync --no-build` at cold start
|
|
4505
|
+
* will refuse to build from source.
|
|
4506
|
+
*/
|
|
4507
|
+
async findPackagesWithoutCompatibleWheels(lockFile, publicPackageNames) {
|
|
4508
|
+
const platform = detectPlatform();
|
|
4509
|
+
const publicSet = new Set(publicPackageNames.map(import_python_analysis3.normalizePackageName));
|
|
4510
|
+
const packageWheels = /* @__PURE__ */ new Map();
|
|
4511
|
+
for (const pkg of lockFile.packages) {
|
|
4512
|
+
const normalized = (0, import_python_analysis3.normalizePackageName)(pkg.name);
|
|
4513
|
+
if (publicSet.has(normalized) && pkg.wheels.length > 0) {
|
|
4514
|
+
packageWheels.set(normalized, pkg.wheels);
|
|
4515
|
+
}
|
|
4516
|
+
}
|
|
4517
|
+
const incompatible = [];
|
|
4518
|
+
for (const name of publicPackageNames) {
|
|
4519
|
+
const normalized = (0, import_python_analysis3.normalizePackageName)(name);
|
|
4520
|
+
const wheels = packageWheels.get(normalized);
|
|
4521
|
+
if (!wheels || wheels.length === 0) {
|
|
4522
|
+
incompatible.push(name);
|
|
4523
|
+
continue;
|
|
4524
|
+
}
|
|
4525
|
+
let hasCompatible = false;
|
|
4526
|
+
for (const wheel of wheels) {
|
|
4527
|
+
const filename = wheel.url.split("/").pop();
|
|
4528
|
+
if (!filename || !filename.endsWith(".whl"))
|
|
4529
|
+
continue;
|
|
4530
|
+
try {
|
|
4531
|
+
const compatible = await (0, import_python_analysis3.isWheelCompatible)(
|
|
4532
|
+
filename,
|
|
4533
|
+
this.pythonMajor,
|
|
4534
|
+
this.pythonMinor,
|
|
4535
|
+
platform.osName,
|
|
4536
|
+
platform.archName,
|
|
4537
|
+
platform.osMajor,
|
|
4538
|
+
platform.osMinor
|
|
4539
|
+
);
|
|
4540
|
+
if (compatible) {
|
|
4541
|
+
hasCompatible = true;
|
|
4542
|
+
break;
|
|
4543
|
+
}
|
|
4544
|
+
} catch (err) {
|
|
4545
|
+
(0, import_build_utils5.debug)(
|
|
4546
|
+
`Failed to check wheel compatibility for ${filename}: ${err instanceof Error ? err.message : String(err)}`
|
|
4547
|
+
);
|
|
4548
|
+
}
|
|
4549
|
+
}
|
|
4550
|
+
if (!hasCompatible) {
|
|
4551
|
+
incompatible.push(name);
|
|
4552
|
+
}
|
|
4553
|
+
}
|
|
4554
|
+
return incompatible;
|
|
4555
|
+
}
|
|
4095
4556
|
};
|
|
4096
4557
|
async function mirrorPackagesIntoVendor({
|
|
4097
4558
|
venvPath,
|
|
@@ -4201,19 +4662,261 @@ async function calculatePerPackageSizes(venvPath) {
|
|
|
4201
4662
|
return sizes;
|
|
4202
4663
|
}
|
|
4203
4664
|
|
|
4665
|
+
// src/diagnostics.ts
|
|
4666
|
+
var import_fs5 = __toESM(require("fs"));
|
|
4667
|
+
var import_path7 = require("path");
|
|
4668
|
+
var import_build_utils6 = require("@vercel/build-utils");
|
|
4669
|
+
var import_python_analysis4 = require("@vercel/python-analysis");
|
|
4670
|
+
var MANIFEST_FILENAME = "package-manifest.json";
|
|
4671
|
+
var DIAGNOSTICS_PATH = (0, import_path7.join)(".vercel", "python", MANIFEST_FILENAME);
|
|
4672
|
+
var MANIFEST_VERSION = "20260304";
|
|
4673
|
+
function isDependencyGroupInclude(entry) {
|
|
4674
|
+
return typeof entry === "object" && "include-group" in entry;
|
|
4675
|
+
}
|
|
4676
|
+
function resolveDependencyGroup(groupName, allGroups, ancestors = /* @__PURE__ */ new Set()) {
|
|
4677
|
+
if (ancestors.has(groupName))
|
|
4678
|
+
return [];
|
|
4679
|
+
const entries = allGroups[groupName];
|
|
4680
|
+
if (!Array.isArray(entries))
|
|
4681
|
+
return [];
|
|
4682
|
+
ancestors.add(groupName);
|
|
4683
|
+
const result = [];
|
|
4684
|
+
for (const entry of entries) {
|
|
4685
|
+
if (typeof entry === "string") {
|
|
4686
|
+
result.push(entry);
|
|
4687
|
+
} else if (isDependencyGroupInclude(entry)) {
|
|
4688
|
+
result.push(
|
|
4689
|
+
...resolveDependencyGroup(entry["include-group"], allGroups, ancestors)
|
|
4690
|
+
);
|
|
4691
|
+
}
|
|
4692
|
+
}
|
|
4693
|
+
ancestors.delete(groupName);
|
|
4694
|
+
return result;
|
|
4695
|
+
}
|
|
4696
|
+
function mapSource(src) {
|
|
4697
|
+
if (!src)
|
|
4698
|
+
return {};
|
|
4699
|
+
if (src.virtual)
|
|
4700
|
+
return {};
|
|
4701
|
+
if (src.registry) {
|
|
4702
|
+
try {
|
|
4703
|
+
const url = new URL(src.registry);
|
|
4704
|
+
return { source: "registry", sourceUrl: url.origin };
|
|
4705
|
+
} catch {
|
|
4706
|
+
return { source: "registry", sourceUrl: src.registry };
|
|
4707
|
+
}
|
|
4708
|
+
}
|
|
4709
|
+
if (src.git)
|
|
4710
|
+
return { source: "git", sourceUrl: src.git };
|
|
4711
|
+
if (src.url)
|
|
4712
|
+
return { source: "url", sourceUrl: src.url };
|
|
4713
|
+
if (src.editable)
|
|
4714
|
+
return { source: "editable", sourceUrl: src.editable };
|
|
4715
|
+
if (src.path)
|
|
4716
|
+
return { source: "path", sourceUrl: src.path };
|
|
4717
|
+
return {};
|
|
4718
|
+
}
|
|
4719
|
+
async function generateProjectManifest({
|
|
4720
|
+
workPath,
|
|
4721
|
+
pythonPackage,
|
|
4722
|
+
pythonVersion,
|
|
4723
|
+
uvLockPath
|
|
4724
|
+
}) {
|
|
4725
|
+
const resolved = pythonVersionString(pythonVersion);
|
|
4726
|
+
const constraint = pythonPackage.requiresPython?.[0];
|
|
4727
|
+
const requested = constraint?.specifier;
|
|
4728
|
+
const project = pythonPackage.manifest?.data?.project;
|
|
4729
|
+
const pyprojectData = pythonPackage.manifest?.data;
|
|
4730
|
+
const directScopesMap = /* @__PURE__ */ new Map();
|
|
4731
|
+
const directRequested = /* @__PURE__ */ new Map();
|
|
4732
|
+
const allRawDeps = [];
|
|
4733
|
+
if (project?.dependencies && Array.isArray(project.dependencies)) {
|
|
4734
|
+
for (const dep of project.dependencies) {
|
|
4735
|
+
allRawDeps.push({ dep, scope: "main" });
|
|
4736
|
+
}
|
|
4737
|
+
}
|
|
4738
|
+
const optDeps = project?.["optional-dependencies"];
|
|
4739
|
+
if (optDeps) {
|
|
4740
|
+
for (const [group, deps] of Object.entries(optDeps)) {
|
|
4741
|
+
if (Array.isArray(deps)) {
|
|
4742
|
+
for (const dep of deps) {
|
|
4743
|
+
allRawDeps.push({ dep, scope: group });
|
|
4744
|
+
}
|
|
4745
|
+
}
|
|
4746
|
+
}
|
|
4747
|
+
}
|
|
4748
|
+
const depGroups = pyprojectData?.["dependency-groups"];
|
|
4749
|
+
if (depGroups) {
|
|
4750
|
+
for (const group of Object.keys(depGroups)) {
|
|
4751
|
+
const groupDeps = resolveDependencyGroup(group, depGroups);
|
|
4752
|
+
for (const dep of groupDeps) {
|
|
4753
|
+
allRawDeps.push({ dep, scope: group });
|
|
4754
|
+
}
|
|
4755
|
+
}
|
|
4756
|
+
}
|
|
4757
|
+
const uvDevDeps = pyprojectData?.tool?.uv?.["dev-dependencies"];
|
|
4758
|
+
if (uvDevDeps && Array.isArray(uvDevDeps)) {
|
|
4759
|
+
for (const dep of uvDevDeps) {
|
|
4760
|
+
allRawDeps.push({ dep, scope: "dev" });
|
|
4761
|
+
}
|
|
4762
|
+
}
|
|
4763
|
+
const allParsed = await (0, import_python_analysis4.parsePep508)(allRawDeps.map((d) => d.dep));
|
|
4764
|
+
for (let i = 0; i < allRawDeps.length; i++) {
|
|
4765
|
+
const parsed = allParsed[i];
|
|
4766
|
+
if (!parsed)
|
|
4767
|
+
continue;
|
|
4768
|
+
const { dep, scope } = allRawDeps[i];
|
|
4769
|
+
const normalized = (0, import_python_analysis4.normalizePackageName)(parsed.name);
|
|
4770
|
+
let scopes = directScopesMap.get(normalized);
|
|
4771
|
+
if (!scopes) {
|
|
4772
|
+
scopes = /* @__PURE__ */ new Set();
|
|
4773
|
+
directScopesMap.set(normalized, scopes);
|
|
4774
|
+
}
|
|
4775
|
+
scopes.add(scope);
|
|
4776
|
+
if (!directRequested.has(normalized)) {
|
|
4777
|
+
directRequested.set(normalized, dep);
|
|
4778
|
+
}
|
|
4779
|
+
}
|
|
4780
|
+
const directEntries = [];
|
|
4781
|
+
const transitiveEntries = [];
|
|
4782
|
+
{
|
|
4783
|
+
const content = await import_fs5.default.promises.readFile(uvLockPath, "utf-8");
|
|
4784
|
+
const uvLock = (0, import_python_analysis4.parseUvLock)(content, uvLockPath);
|
|
4785
|
+
const projectName = project?.name;
|
|
4786
|
+
const excludeSet = new Set(
|
|
4787
|
+
projectName ? [(0, import_python_analysis4.normalizePackageName)(projectName)] : []
|
|
4788
|
+
);
|
|
4789
|
+
const lockMap = /* @__PURE__ */ new Map();
|
|
4790
|
+
const depGraph = /* @__PURE__ */ new Map();
|
|
4791
|
+
for (const pkg of uvLock.packages) {
|
|
4792
|
+
const normalized = (0, import_python_analysis4.normalizePackageName)(pkg.name);
|
|
4793
|
+
if (excludeSet.has(normalized))
|
|
4794
|
+
continue;
|
|
4795
|
+
if (pkg.source?.virtual)
|
|
4796
|
+
continue;
|
|
4797
|
+
lockMap.set(normalized, { version: pkg.version, source: pkg.source });
|
|
4798
|
+
if (pkg.dependencies) {
|
|
4799
|
+
const deps = /* @__PURE__ */ new Set();
|
|
4800
|
+
for (const d of pkg.dependencies) {
|
|
4801
|
+
deps.add((0, import_python_analysis4.normalizePackageName)(d.name));
|
|
4802
|
+
}
|
|
4803
|
+
depGraph.set(normalized, deps);
|
|
4804
|
+
}
|
|
4805
|
+
}
|
|
4806
|
+
const transitiveScopesMap = /* @__PURE__ */ new Map();
|
|
4807
|
+
for (const [name, scopes] of directScopesMap) {
|
|
4808
|
+
const queue = [name];
|
|
4809
|
+
let head = 0;
|
|
4810
|
+
const visited = /* @__PURE__ */ new Set();
|
|
4811
|
+
while (head < queue.length) {
|
|
4812
|
+
const current = queue[head++];
|
|
4813
|
+
if (visited.has(current))
|
|
4814
|
+
continue;
|
|
4815
|
+
visited.add(current);
|
|
4816
|
+
const children = depGraph.get(current);
|
|
4817
|
+
if (!children)
|
|
4818
|
+
continue;
|
|
4819
|
+
for (const child of children) {
|
|
4820
|
+
if (excludeSet.has(child))
|
|
4821
|
+
continue;
|
|
4822
|
+
if (!directScopesMap.has(child)) {
|
|
4823
|
+
let childScopes = transitiveScopesMap.get(child);
|
|
4824
|
+
if (!childScopes) {
|
|
4825
|
+
childScopes = /* @__PURE__ */ new Set();
|
|
4826
|
+
transitiveScopesMap.set(child, childScopes);
|
|
4827
|
+
}
|
|
4828
|
+
for (const s of scopes) {
|
|
4829
|
+
childScopes.add(s);
|
|
4830
|
+
}
|
|
4831
|
+
}
|
|
4832
|
+
if (!visited.has(child)) {
|
|
4833
|
+
queue.push(child);
|
|
4834
|
+
}
|
|
4835
|
+
}
|
|
4836
|
+
}
|
|
4837
|
+
}
|
|
4838
|
+
for (const [name, scopes] of directScopesMap) {
|
|
4839
|
+
const info = lockMap.get(name);
|
|
4840
|
+
const entry = {
|
|
4841
|
+
name,
|
|
4842
|
+
type: "direct",
|
|
4843
|
+
scopes: [...scopes].sort(),
|
|
4844
|
+
requested: directRequested.get(name)
|
|
4845
|
+
};
|
|
4846
|
+
if (info) {
|
|
4847
|
+
entry.resolved = info.version;
|
|
4848
|
+
const src = mapSource(info.source);
|
|
4849
|
+
if (src.source)
|
|
4850
|
+
entry.source = src.source;
|
|
4851
|
+
if (src.sourceUrl)
|
|
4852
|
+
entry.sourceUrl = src.sourceUrl;
|
|
4853
|
+
}
|
|
4854
|
+
directEntries.push(entry);
|
|
4855
|
+
}
|
|
4856
|
+
for (const [normalized, info] of lockMap) {
|
|
4857
|
+
if (directScopesMap.has(normalized))
|
|
4858
|
+
continue;
|
|
4859
|
+
const scopes = transitiveScopesMap.get(normalized);
|
|
4860
|
+
if (!scopes || scopes.size === 0)
|
|
4861
|
+
continue;
|
|
4862
|
+
const src = mapSource(info.source);
|
|
4863
|
+
transitiveEntries.push({
|
|
4864
|
+
name: normalized,
|
|
4865
|
+
type: "transitive",
|
|
4866
|
+
scopes: [...scopes].sort(),
|
|
4867
|
+
resolved: info.version,
|
|
4868
|
+
...src.source ? { source: src.source } : {},
|
|
4869
|
+
...src.sourceUrl ? { sourceUrl: src.sourceUrl } : {}
|
|
4870
|
+
});
|
|
4871
|
+
}
|
|
4872
|
+
}
|
|
4873
|
+
const manifest = {
|
|
4874
|
+
version: MANIFEST_VERSION,
|
|
4875
|
+
runtime: "python",
|
|
4876
|
+
runtimeVersion: {
|
|
4877
|
+
...requested ? { requested } : {},
|
|
4878
|
+
...constraint?.source ? { requestedSource: constraint.source } : {},
|
|
4879
|
+
resolved
|
|
4880
|
+
},
|
|
4881
|
+
dependencies: [
|
|
4882
|
+
...directEntries.sort((a, b) => a.name.localeCompare(b.name)),
|
|
4883
|
+
...transitiveEntries.sort((a, b) => a.name.localeCompare(b.name))
|
|
4884
|
+
]
|
|
4885
|
+
};
|
|
4886
|
+
const outPath = (0, import_path7.join)(workPath, DIAGNOSTICS_PATH);
|
|
4887
|
+
await import_fs5.default.promises.mkdir((0, import_path7.dirname)(outPath), { recursive: true });
|
|
4888
|
+
await import_fs5.default.promises.writeFile(outPath, JSON.stringify(manifest, null, 2));
|
|
4889
|
+
}
|
|
4890
|
+
var diagnostics = async ({
|
|
4891
|
+
workPath
|
|
4892
|
+
}) => {
|
|
4893
|
+
try {
|
|
4894
|
+
const manifestPath = (0, import_path7.join)(workPath, DIAGNOSTICS_PATH);
|
|
4895
|
+
const data = await import_fs5.default.promises.readFile(manifestPath, "utf-8");
|
|
4896
|
+
return {
|
|
4897
|
+
[MANIFEST_FILENAME]: new import_build_utils6.FileBlob({ data })
|
|
4898
|
+
};
|
|
4899
|
+
} catch (err) {
|
|
4900
|
+
(0, import_build_utils6.debug)(
|
|
4901
|
+
`Diagnostics: no cached manifest found: ${err instanceof Error ? err.message : String(err)}`
|
|
4902
|
+
);
|
|
4903
|
+
return {};
|
|
4904
|
+
}
|
|
4905
|
+
};
|
|
4906
|
+
|
|
4204
4907
|
// src/start-dev-server.ts
|
|
4205
4908
|
var import_child_process2 = require("child_process");
|
|
4206
|
-
var
|
|
4207
|
-
var
|
|
4208
|
-
var
|
|
4909
|
+
var import_fs7 = require("fs");
|
|
4910
|
+
var import_path9 = require("path");
|
|
4911
|
+
var import_build_utils9 = require("@vercel/build-utils");
|
|
4209
4912
|
var import_get_port = __toESM(require_get_port());
|
|
4210
4913
|
var import_is_port_reachable = __toESM(require_is_port_reachable());
|
|
4211
4914
|
|
|
4212
4915
|
// src/entrypoint.ts
|
|
4213
|
-
var
|
|
4214
|
-
var
|
|
4215
|
-
var import_build_utils6 = require("@vercel/build-utils");
|
|
4916
|
+
var import_fs6 = __toESM(require("fs"));
|
|
4917
|
+
var import_path8 = require("path");
|
|
4216
4918
|
var import_build_utils7 = require("@vercel/build-utils");
|
|
4919
|
+
var import_build_utils8 = require("@vercel/build-utils");
|
|
4217
4920
|
var PYTHON_ENTRYPOINT_FILENAMES = [
|
|
4218
4921
|
"app",
|
|
4219
4922
|
"index",
|
|
@@ -4229,26 +4932,26 @@ var PYTHON_CANDIDATE_ENTRYPOINTS = getCandidateEntrypointsInDirs(
|
|
|
4229
4932
|
function getCandidateEntrypointsInDirs(dirs) {
|
|
4230
4933
|
return dirs.flatMap(
|
|
4231
4934
|
(dir) => PYTHON_ENTRYPOINT_FILENAMES.map(
|
|
4232
|
-
(filename) =>
|
|
4935
|
+
(filename) => import_path8.posix.join(dir, `${filename}.py`)
|
|
4233
4936
|
)
|
|
4234
4937
|
);
|
|
4235
4938
|
}
|
|
4236
4939
|
async function fileExists(filePath) {
|
|
4237
4940
|
try {
|
|
4238
|
-
const stat = await
|
|
4941
|
+
const stat = await import_fs6.default.promises.stat(filePath);
|
|
4239
4942
|
return stat.isFile();
|
|
4240
4943
|
} catch {
|
|
4241
4944
|
return false;
|
|
4242
4945
|
}
|
|
4243
4946
|
}
|
|
4244
4947
|
async function checkEntrypoint(workPath, relPath) {
|
|
4245
|
-
const absPath = (0,
|
|
4948
|
+
const absPath = (0, import_path8.join)(workPath, relPath);
|
|
4246
4949
|
if (!await fileExists(absPath))
|
|
4247
4950
|
return false;
|
|
4248
|
-
return (0,
|
|
4951
|
+
return (0, import_build_utils7.isPythonEntrypoint)({ fsPath: absPath });
|
|
4249
4952
|
}
|
|
4250
4953
|
async function getPyprojectEntrypoint(workPath) {
|
|
4251
|
-
const pyprojectData = await (0,
|
|
4954
|
+
const pyprojectData = await (0, import_build_utils8.readConfigFile)((0, import_path8.join)(workPath, "pyproject.toml"));
|
|
4252
4955
|
if (!pyprojectData)
|
|
4253
4956
|
return null;
|
|
4254
4957
|
const scripts = pyprojectData.project?.scripts;
|
|
@@ -4259,30 +4962,32 @@ async function getPyprojectEntrypoint(workPath) {
|
|
|
4259
4962
|
if (!match)
|
|
4260
4963
|
return null;
|
|
4261
4964
|
const modulePath = match[1];
|
|
4965
|
+
const variableName = match[2];
|
|
4262
4966
|
const relPath = modulePath.replace(/\./g, "/");
|
|
4263
4967
|
const candidates = [`${relPath}.py`, `${relPath}/__init__.py`];
|
|
4264
4968
|
for (const candidate of candidates) {
|
|
4265
|
-
if (await fileExists((0,
|
|
4266
|
-
return candidate;
|
|
4969
|
+
if (await fileExists((0, import_path8.join)(workPath, candidate))) {
|
|
4970
|
+
return { entrypoint: candidate, variableName };
|
|
4971
|
+
}
|
|
4267
4972
|
}
|
|
4268
4973
|
return null;
|
|
4269
4974
|
}
|
|
4270
4975
|
async function findValidEntrypoint(workPath, candidates) {
|
|
4271
4976
|
for (const candidate of candidates) {
|
|
4272
4977
|
if (await checkEntrypoint(workPath, candidate)) {
|
|
4273
|
-
(0,
|
|
4978
|
+
(0, import_build_utils7.debug)(`Detected Python entrypoint: ${candidate}`);
|
|
4274
4979
|
return candidate;
|
|
4275
4980
|
}
|
|
4276
4981
|
}
|
|
4277
4982
|
return null;
|
|
4278
4983
|
}
|
|
4279
4984
|
async function checkDjangoManage(workPath) {
|
|
4280
|
-
const managePath = (0,
|
|
4985
|
+
const managePath = (0, import_path8.join)(workPath, "manage.py");
|
|
4281
4986
|
try {
|
|
4282
|
-
const content = await
|
|
4987
|
+
const content = await import_fs6.default.promises.readFile(managePath, "utf-8");
|
|
4283
4988
|
if (!content.includes("DJANGO_SETTINGS_MODULE"))
|
|
4284
4989
|
return false;
|
|
4285
|
-
(0,
|
|
4990
|
+
(0, import_build_utils7.debug)(`Found Django manage.py with DJANGO_SETTINGS_MODULE at ${workPath}`);
|
|
4286
4991
|
return true;
|
|
4287
4992
|
} catch {
|
|
4288
4993
|
return false;
|
|
@@ -4290,7 +4995,7 @@ async function checkDjangoManage(workPath) {
|
|
|
4290
4995
|
}
|
|
4291
4996
|
async function getSubdirectories(workPath) {
|
|
4292
4997
|
try {
|
|
4293
|
-
const entries = await
|
|
4998
|
+
const entries = await import_fs6.default.promises.readdir(workPath, {
|
|
4294
4999
|
withFileTypes: true
|
|
4295
5000
|
});
|
|
4296
5001
|
return entries.filter((e) => e.isDirectory() && !e.name.startsWith(".")).map((e) => e.name).sort();
|
|
@@ -4302,7 +5007,7 @@ async function detectGenericPythonEntrypoint(workPath, configuredEntrypoint) {
|
|
|
4302
5007
|
const entry = configuredEntrypoint.endsWith(".py") ? configuredEntrypoint : `${configuredEntrypoint}.py`;
|
|
4303
5008
|
try {
|
|
4304
5009
|
if (await checkEntrypoint(workPath, entry)) {
|
|
4305
|
-
(0,
|
|
5010
|
+
(0, import_build_utils7.debug)(`Using configured Python entrypoint: ${entry}`);
|
|
4306
5011
|
return { entrypoint: entry };
|
|
4307
5012
|
}
|
|
4308
5013
|
const found = await findValidEntrypoint(
|
|
@@ -4311,7 +5016,7 @@ async function detectGenericPythonEntrypoint(workPath, configuredEntrypoint) {
|
|
|
4311
5016
|
);
|
|
4312
5017
|
return found ? { entrypoint: found } : null;
|
|
4313
5018
|
} catch {
|
|
4314
|
-
(0,
|
|
5019
|
+
(0, import_build_utils7.debug)("Failed to discover Python entrypoint");
|
|
4315
5020
|
return null;
|
|
4316
5021
|
}
|
|
4317
5022
|
}
|
|
@@ -4319,13 +5024,13 @@ async function detectDjangoPythonEntrypoint(workPath, configuredEntrypoint) {
|
|
|
4319
5024
|
const entry = configuredEntrypoint.endsWith(".py") ? configuredEntrypoint : `${configuredEntrypoint}.py`;
|
|
4320
5025
|
try {
|
|
4321
5026
|
if (await checkEntrypoint(workPath, entry)) {
|
|
4322
|
-
(0,
|
|
5027
|
+
(0, import_build_utils7.debug)(`Using configured Python entrypoint: ${entry}`);
|
|
4323
5028
|
return { entrypoint: entry };
|
|
4324
5029
|
}
|
|
4325
5030
|
const subdirs = await getSubdirectories(workPath);
|
|
4326
5031
|
const rootDirs = ["", ...subdirs];
|
|
4327
5032
|
for (const rootDir of rootDirs) {
|
|
4328
|
-
const currPath = (0,
|
|
5033
|
+
const currPath = (0, import_path8.join)(workPath, rootDir);
|
|
4329
5034
|
const isDjango = await checkDjangoManage(currPath);
|
|
4330
5035
|
if (isDjango) {
|
|
4331
5036
|
return { baseDir: rootDir };
|
|
@@ -4335,7 +5040,7 @@ async function detectDjangoPythonEntrypoint(workPath, configuredEntrypoint) {
|
|
|
4335
5040
|
const found = await findValidEntrypoint(workPath, candidates);
|
|
4336
5041
|
return found ? { entrypoint: found } : null;
|
|
4337
5042
|
} catch {
|
|
4338
|
-
(0,
|
|
5043
|
+
(0, import_build_utils7.debug)("Failed to discover Django Python entrypoint");
|
|
4339
5044
|
return null;
|
|
4340
5045
|
}
|
|
4341
5046
|
}
|
|
@@ -4344,12 +5049,17 @@ async function detectPythonEntrypoint(framework, workPath, configuredEntrypoint)
|
|
|
4344
5049
|
if (result)
|
|
4345
5050
|
return result;
|
|
4346
5051
|
const pyprojectEntry = await getPyprojectEntrypoint(workPath);
|
|
4347
|
-
|
|
5052
|
+
if (!pyprojectEntry)
|
|
5053
|
+
return null;
|
|
5054
|
+
return {
|
|
5055
|
+
entrypoint: pyprojectEntry.entrypoint,
|
|
5056
|
+
variableName: pyprojectEntry.variableName
|
|
5057
|
+
};
|
|
4348
5058
|
}
|
|
4349
5059
|
|
|
4350
5060
|
// src/start-dev-server.ts
|
|
4351
|
-
var
|
|
4352
|
-
var DEV_SERVER_STARTUP_TIMEOUT =
|
|
5061
|
+
var import_python_analysis5 = require("@vercel/python-analysis");
|
|
5062
|
+
var DEV_SERVER_STARTUP_TIMEOUT = 5 * 6e4;
|
|
4353
5063
|
function silenceNodeWarnings() {
|
|
4354
5064
|
const original = process.emitWarning.bind(
|
|
4355
5065
|
process
|
|
@@ -4375,6 +5085,10 @@ function silenceNodeWarnings() {
|
|
|
4375
5085
|
};
|
|
4376
5086
|
}
|
|
4377
5087
|
var DEV_SHIM_MODULE = "vc_init_dev";
|
|
5088
|
+
function hasWorkerServicesEnabled(env) {
|
|
5089
|
+
const value = env.VERCEL_HAS_WORKER_SERVICES || "";
|
|
5090
|
+
return ["1", "true"].includes(value.trim().toLowerCase());
|
|
5091
|
+
}
|
|
4378
5092
|
function createLogListener(callback, stream) {
|
|
4379
5093
|
return (buf) => {
|
|
4380
5094
|
if (callback) {
|
|
@@ -4430,17 +5144,17 @@ async function syncDependencies({
|
|
|
4430
5144
|
let { manifestPath } = installInfo;
|
|
4431
5145
|
const manifest = pythonPackage.manifest;
|
|
4432
5146
|
if (!manifestType || !manifestPath) {
|
|
4433
|
-
(0,
|
|
5147
|
+
(0, import_build_utils9.debug)("No Python project manifest found, skipping dependency sync");
|
|
4434
5148
|
return;
|
|
4435
5149
|
}
|
|
4436
5150
|
if (manifest?.origin && manifestType === "pyproject.toml") {
|
|
4437
|
-
const syncDir = (0,
|
|
4438
|
-
(0,
|
|
4439
|
-
const tempPyproject = (0,
|
|
4440
|
-
const content = (0,
|
|
4441
|
-
(0,
|
|
5151
|
+
const syncDir = (0, import_path9.join)(workPath, ".vercel", "python", "sync");
|
|
5152
|
+
(0, import_fs7.mkdirSync)(syncDir, { recursive: true });
|
|
5153
|
+
const tempPyproject = (0, import_path9.join)(syncDir, "pyproject.toml");
|
|
5154
|
+
const content = (0, import_python_analysis5.stringifyManifest)(manifest.data);
|
|
5155
|
+
(0, import_fs7.writeFileSync)(tempPyproject, content, "utf8");
|
|
4442
5156
|
manifestPath = tempPyproject;
|
|
4443
|
-
(0,
|
|
5157
|
+
(0, import_build_utils9.debug)(
|
|
4444
5158
|
`Wrote converted ${manifest.origin.kind} manifest to ${tempPyproject}`
|
|
4445
5159
|
);
|
|
4446
5160
|
}
|
|
@@ -4473,7 +5187,7 @@ async function syncDependencies({
|
|
|
4473
5187
|
for (const [channel, chunk] of captured) {
|
|
4474
5188
|
(channel === "stdout" ? writeOut : writeErr)(chunk.toString());
|
|
4475
5189
|
}
|
|
4476
|
-
throw new
|
|
5190
|
+
throw new import_build_utils9.NowBuildError({
|
|
4477
5191
|
code: "PYTHON_DEPENDENCY_SYNC_FAILED",
|
|
4478
5192
|
message: `Failed to install Python dependencies from ${manifestType}: ${err instanceof Error ? err.message : String(err)}`
|
|
4479
5193
|
});
|
|
@@ -4488,14 +5202,14 @@ async function runSync({
|
|
|
4488
5202
|
onStdout,
|
|
4489
5203
|
onStderr
|
|
4490
5204
|
}) {
|
|
4491
|
-
const projectDir = (0,
|
|
5205
|
+
const projectDir = (0, import_path9.dirname)(manifestPath);
|
|
4492
5206
|
const pip = uvPath ? { cmd: uvPath, prefix: ["pip", "install"] } : { cmd: pythonBin, prefix: ["-m", "pip", "install"] };
|
|
4493
5207
|
let spawnCmd;
|
|
4494
5208
|
let spawnArgs;
|
|
4495
5209
|
switch (manifestType) {
|
|
4496
5210
|
case "uv.lock": {
|
|
4497
5211
|
if (!uvPath) {
|
|
4498
|
-
throw new
|
|
5212
|
+
throw new import_build_utils9.NowBuildError({
|
|
4499
5213
|
code: "PYTHON_DEPENDENCY_SYNC_FAILED",
|
|
4500
5214
|
message: "uv is required to install dependencies from uv.lock.",
|
|
4501
5215
|
link: "https://docs.astral.sh/uv/getting-started/installation/",
|
|
@@ -4517,11 +5231,11 @@ async function runSync({
|
|
|
4517
5231
|
break;
|
|
4518
5232
|
}
|
|
4519
5233
|
default:
|
|
4520
|
-
(0,
|
|
5234
|
+
(0, import_build_utils9.debug)(`Unknown manifest type: ${manifestType}`);
|
|
4521
5235
|
return;
|
|
4522
5236
|
}
|
|
4523
5237
|
await new Promise((resolve3, reject) => {
|
|
4524
|
-
(0,
|
|
5238
|
+
(0, import_build_utils9.debug)(`Running "${spawnCmd} ${spawnArgs.join(" ")}" in ${projectDir}...`);
|
|
4525
5239
|
const child = (0, import_child_process2.spawn)(spawnCmd, spawnArgs, {
|
|
4526
5240
|
cwd: projectDir,
|
|
4527
5241
|
env: getProtectedUvEnv(env),
|
|
@@ -4555,6 +5269,8 @@ async function runSync({
|
|
|
4555
5269
|
});
|
|
4556
5270
|
});
|
|
4557
5271
|
}
|
|
5272
|
+
var PENDING_RUNTIME_INSTALLS = /* @__PURE__ */ new Map();
|
|
5273
|
+
var PENDING_WORKERS_INSTALLS = /* @__PURE__ */ new Map();
|
|
4558
5274
|
async function installVercelRuntime({
|
|
4559
5275
|
workPath,
|
|
4560
5276
|
uvPath,
|
|
@@ -4563,9 +5279,34 @@ async function installVercelRuntime({
|
|
|
4563
5279
|
onStdout,
|
|
4564
5280
|
onStderr
|
|
4565
5281
|
}) {
|
|
4566
|
-
const targetDir = (0,
|
|
4567
|
-
|
|
4568
|
-
|
|
5282
|
+
const targetDir = (0, import_path9.join)(workPath, ".vercel", "python");
|
|
5283
|
+
let pending = PENDING_RUNTIME_INSTALLS.get(targetDir);
|
|
5284
|
+
if (!pending) {
|
|
5285
|
+
pending = doInstallVercelRuntime({
|
|
5286
|
+
targetDir,
|
|
5287
|
+
workPath,
|
|
5288
|
+
uvPath,
|
|
5289
|
+
pythonBin,
|
|
5290
|
+
env,
|
|
5291
|
+
onStdout,
|
|
5292
|
+
onStderr
|
|
5293
|
+
});
|
|
5294
|
+
PENDING_RUNTIME_INSTALLS.set(targetDir, pending);
|
|
5295
|
+
pending.finally(() => PENDING_RUNTIME_INSTALLS.delete(targetDir));
|
|
5296
|
+
}
|
|
5297
|
+
await pending;
|
|
5298
|
+
}
|
|
5299
|
+
async function doInstallVercelRuntime({
|
|
5300
|
+
targetDir,
|
|
5301
|
+
workPath,
|
|
5302
|
+
uvPath,
|
|
5303
|
+
pythonBin,
|
|
5304
|
+
env,
|
|
5305
|
+
onStdout,
|
|
5306
|
+
onStderr
|
|
5307
|
+
}) {
|
|
5308
|
+
(0, import_fs7.mkdirSync)(targetDir, { recursive: true });
|
|
5309
|
+
const localRuntimeDir = (0, import_path9.join)(
|
|
4569
5310
|
__dirname,
|
|
4570
5311
|
"..",
|
|
4571
5312
|
"..",
|
|
@@ -4573,21 +5314,21 @@ async function installVercelRuntime({
|
|
|
4573
5314
|
"python",
|
|
4574
5315
|
"vercel-runtime"
|
|
4575
5316
|
);
|
|
4576
|
-
const isLocalDev = (0,
|
|
5317
|
+
const isLocalDev = (0, import_fs7.existsSync)((0, import_path9.join)(localRuntimeDir, "pyproject.toml"));
|
|
4577
5318
|
const runtimeDep = env.VERCEL_RUNTIME_PYTHON || (isLocalDev ? localRuntimeDir : `vercel-runtime==${VERCEL_RUNTIME_VERSION}`);
|
|
4578
5319
|
if (!isLocalDev && !env.VERCEL_RUNTIME_PYTHON) {
|
|
4579
|
-
const distInfo = (0,
|
|
5320
|
+
const distInfo = (0, import_path9.join)(
|
|
4580
5321
|
targetDir,
|
|
4581
5322
|
`vercel_runtime-${VERCEL_RUNTIME_VERSION}.dist-info`
|
|
4582
5323
|
);
|
|
4583
|
-
if ((0,
|
|
4584
|
-
(0,
|
|
5324
|
+
if ((0, import_fs7.existsSync)(distInfo)) {
|
|
5325
|
+
(0, import_build_utils9.debug)(
|
|
4585
5326
|
`vercel-runtime ${VERCEL_RUNTIME_VERSION} already installed, skipping`
|
|
4586
5327
|
);
|
|
4587
5328
|
return;
|
|
4588
5329
|
}
|
|
4589
5330
|
}
|
|
4590
|
-
(0,
|
|
5331
|
+
(0, import_build_utils9.debug)(
|
|
4591
5332
|
`Installing vercel-runtime into ${targetDir} (type: ${isLocalDev ? "local" : "pypi"}, source: ${runtimeDep})`
|
|
4592
5333
|
);
|
|
4593
5334
|
const pip = uvPath ? { cmd: uvPath, prefix: ["pip", "install"] } : { cmd: pythonBin, prefix: ["-m", "pip", "install"] };
|
|
@@ -4602,14 +5343,14 @@ async function installVercelRuntime({
|
|
|
4602
5343
|
if (onStdout) {
|
|
4603
5344
|
onStdout(data);
|
|
4604
5345
|
} else {
|
|
4605
|
-
(0,
|
|
5346
|
+
(0, import_build_utils9.debug)(data.toString());
|
|
4606
5347
|
}
|
|
4607
5348
|
});
|
|
4608
5349
|
child.stderr?.on("data", (data) => {
|
|
4609
5350
|
if (onStderr) {
|
|
4610
5351
|
onStderr(data);
|
|
4611
5352
|
} else {
|
|
4612
|
-
(0,
|
|
5353
|
+
(0, import_build_utils9.debug)(data.toString());
|
|
4613
5354
|
}
|
|
4614
5355
|
});
|
|
4615
5356
|
child.on("error", reject);
|
|
@@ -4626,6 +5367,102 @@ async function installVercelRuntime({
|
|
|
4626
5367
|
});
|
|
4627
5368
|
});
|
|
4628
5369
|
}
|
|
5370
|
+
async function installVercelWorkers({
|
|
5371
|
+
workPath,
|
|
5372
|
+
uvPath,
|
|
5373
|
+
pythonBin,
|
|
5374
|
+
env,
|
|
5375
|
+
onStdout,
|
|
5376
|
+
onStderr
|
|
5377
|
+
}) {
|
|
5378
|
+
const targetDir = (0, import_path9.join)(workPath, ".vercel", "python");
|
|
5379
|
+
let pending = PENDING_WORKERS_INSTALLS.get(targetDir);
|
|
5380
|
+
if (!pending) {
|
|
5381
|
+
pending = doInstallVercelWorkers({
|
|
5382
|
+
targetDir,
|
|
5383
|
+
workPath,
|
|
5384
|
+
uvPath,
|
|
5385
|
+
pythonBin,
|
|
5386
|
+
env,
|
|
5387
|
+
onStdout,
|
|
5388
|
+
onStderr
|
|
5389
|
+
});
|
|
5390
|
+
PENDING_WORKERS_INSTALLS.set(targetDir, pending);
|
|
5391
|
+
pending.finally(() => PENDING_WORKERS_INSTALLS.delete(targetDir));
|
|
5392
|
+
}
|
|
5393
|
+
await pending;
|
|
5394
|
+
}
|
|
5395
|
+
async function doInstallVercelWorkers({
|
|
5396
|
+
targetDir,
|
|
5397
|
+
workPath,
|
|
5398
|
+
uvPath,
|
|
5399
|
+
pythonBin,
|
|
5400
|
+
env,
|
|
5401
|
+
onStdout,
|
|
5402
|
+
onStderr
|
|
5403
|
+
}) {
|
|
5404
|
+
(0, import_fs7.mkdirSync)(targetDir, { recursive: true });
|
|
5405
|
+
const localWorkersDir = (0, import_path9.join)(
|
|
5406
|
+
__dirname,
|
|
5407
|
+
"..",
|
|
5408
|
+
"..",
|
|
5409
|
+
"..",
|
|
5410
|
+
"python",
|
|
5411
|
+
"vercel-workers"
|
|
5412
|
+
);
|
|
5413
|
+
const isLocalDev = (0, import_fs7.existsSync)((0, import_path9.join)(localWorkersDir, "pyproject.toml"));
|
|
5414
|
+
const workersDep = env.VERCEL_WORKERS_PYTHON || (isLocalDev ? localWorkersDir : `vercel-workers==${VERCEL_WORKERS_VERSION}`);
|
|
5415
|
+
if (!isLocalDev && !env.VERCEL_WORKERS_PYTHON) {
|
|
5416
|
+
const distInfo = (0, import_path9.join)(
|
|
5417
|
+
targetDir,
|
|
5418
|
+
`vercel_workers-${VERCEL_WORKERS_VERSION}.dist-info`
|
|
5419
|
+
);
|
|
5420
|
+
if ((0, import_fs7.existsSync)(distInfo)) {
|
|
5421
|
+
(0, import_build_utils9.debug)(
|
|
5422
|
+
`vercel-workers ${VERCEL_WORKERS_VERSION} already installed, skipping`
|
|
5423
|
+
);
|
|
5424
|
+
return;
|
|
5425
|
+
}
|
|
5426
|
+
}
|
|
5427
|
+
(0, import_build_utils9.debug)(
|
|
5428
|
+
`Installing vercel-workers into ${targetDir} (type: ${isLocalDev ? "local" : "pypi"}, source: ${workersDep})`
|
|
5429
|
+
);
|
|
5430
|
+
const pip = uvPath ? { cmd: uvPath, prefix: ["pip", "install"] } : { cmd: pythonBin, prefix: ["-m", "pip", "install"] };
|
|
5431
|
+
const spawnArgs = [...pip.prefix, "--target", targetDir, workersDep];
|
|
5432
|
+
await new Promise((resolve3, reject) => {
|
|
5433
|
+
const child = (0, import_child_process2.spawn)(pip.cmd, spawnArgs, {
|
|
5434
|
+
cwd: workPath,
|
|
5435
|
+
env: getProtectedUvEnv(env),
|
|
5436
|
+
stdio: ["inherit", "pipe", "pipe"]
|
|
5437
|
+
});
|
|
5438
|
+
child.stdout?.on("data", (data) => {
|
|
5439
|
+
if (onStdout) {
|
|
5440
|
+
onStdout(data);
|
|
5441
|
+
} else {
|
|
5442
|
+
(0, import_build_utils9.debug)(data.toString());
|
|
5443
|
+
}
|
|
5444
|
+
});
|
|
5445
|
+
child.stderr?.on("data", (data) => {
|
|
5446
|
+
if (onStderr) {
|
|
5447
|
+
onStderr(data);
|
|
5448
|
+
} else {
|
|
5449
|
+
(0, import_build_utils9.debug)(data.toString());
|
|
5450
|
+
}
|
|
5451
|
+
});
|
|
5452
|
+
child.on("error", reject);
|
|
5453
|
+
child.on("exit", (code, signal) => {
|
|
5454
|
+
if (code === 0) {
|
|
5455
|
+
resolve3();
|
|
5456
|
+
} else {
|
|
5457
|
+
reject(
|
|
5458
|
+
new Error(
|
|
5459
|
+
`Installing vercel-workers failed with code ${code}, signal ${signal}`
|
|
5460
|
+
)
|
|
5461
|
+
);
|
|
5462
|
+
}
|
|
5463
|
+
});
|
|
5464
|
+
});
|
|
5465
|
+
}
|
|
4629
5466
|
var PERSISTENT_SERVERS = /* @__PURE__ */ new Map();
|
|
4630
5467
|
var PENDING_STARTS = /* @__PURE__ */ new Map();
|
|
4631
5468
|
var restoreWarnings = null;
|
|
@@ -4639,12 +5476,12 @@ function installGlobalCleanupHandlers() {
|
|
|
4639
5476
|
try {
|
|
4640
5477
|
process.kill(info.pid, "SIGTERM");
|
|
4641
5478
|
} catch (err) {
|
|
4642
|
-
(0,
|
|
5479
|
+
(0, import_build_utils9.debug)(`Error sending SIGTERM to ${info.pid}: ${err}`);
|
|
4643
5480
|
}
|
|
4644
5481
|
try {
|
|
4645
5482
|
process.kill(info.pid, "SIGKILL");
|
|
4646
5483
|
} catch (err) {
|
|
4647
|
-
(0,
|
|
5484
|
+
(0, import_build_utils9.debug)(`Error sending SIGKILL to ${info.pid}: ${err}`);
|
|
4648
5485
|
}
|
|
4649
5486
|
PERSISTENT_SERVERS.delete(key);
|
|
4650
5487
|
}
|
|
@@ -4652,7 +5489,7 @@ function installGlobalCleanupHandlers() {
|
|
|
4652
5489
|
try {
|
|
4653
5490
|
restoreWarnings();
|
|
4654
5491
|
} catch (err) {
|
|
4655
|
-
(0,
|
|
5492
|
+
(0, import_build_utils9.debug)(`Error restoring warnings: ${err}`);
|
|
4656
5493
|
}
|
|
4657
5494
|
restoreWarnings = null;
|
|
4658
5495
|
}
|
|
@@ -4667,48 +5504,52 @@ function installGlobalCleanupHandlers() {
|
|
|
4667
5504
|
killAll();
|
|
4668
5505
|
});
|
|
4669
5506
|
}
|
|
4670
|
-
function createDevShim(workPath, entry, modulePath) {
|
|
5507
|
+
function createDevShim(workPath, entry, modulePath, serviceName, framework, variableName) {
|
|
4671
5508
|
try {
|
|
4672
|
-
const vercelPythonDir = (0,
|
|
4673
|
-
(0,
|
|
5509
|
+
const vercelPythonDir = serviceName ? (0, import_path9.join)(workPath, ".vercel", "python", "services", serviceName) : (0, import_path9.join)(workPath, ".vercel", "python");
|
|
5510
|
+
(0, import_fs7.mkdirSync)(vercelPythonDir, { recursive: true });
|
|
4674
5511
|
let qualifiedModule = modulePath;
|
|
4675
5512
|
let extraPythonPath;
|
|
4676
|
-
if ((0,
|
|
4677
|
-
const pkgName = (0,
|
|
5513
|
+
if ((0, import_fs7.existsSync)((0, import_path9.join)(workPath, "__init__.py"))) {
|
|
5514
|
+
const pkgName = (0, import_path9.basename)(workPath);
|
|
4678
5515
|
qualifiedModule = `${pkgName}.${modulePath}`;
|
|
4679
|
-
extraPythonPath = (0,
|
|
5516
|
+
extraPythonPath = (0, import_path9.dirname)(workPath);
|
|
4680
5517
|
}
|
|
4681
|
-
const entryAbs = (0,
|
|
4682
|
-
const shimPath = (0,
|
|
4683
|
-
const templatePath = (0,
|
|
5518
|
+
const entryAbs = (0, import_path9.join)(workPath, entry);
|
|
5519
|
+
const shimPath = (0, import_path9.join)(vercelPythonDir, `${DEV_SHIM_MODULE}.py`);
|
|
5520
|
+
const templatePath = (0, import_path9.join)(
|
|
4684
5521
|
__dirname,
|
|
4685
5522
|
"..",
|
|
4686
5523
|
"templates",
|
|
4687
5524
|
`${DEV_SHIM_MODULE}.py`
|
|
4688
5525
|
);
|
|
4689
|
-
const template = (0,
|
|
4690
|
-
const shimSource = template.replace(/__VC_DEV_MODULE_NAME__/g, qualifiedModule).replace(/__VC_DEV_ENTRY_ABS__/g, entryAbs);
|
|
4691
|
-
(0,
|
|
4692
|
-
(0,
|
|
4693
|
-
return {
|
|
5526
|
+
const template = (0, import_fs7.readFileSync)(templatePath, "utf8");
|
|
5527
|
+
const shimSource = template.replace(/__VC_DEV_MODULE_NAME__/g, qualifiedModule).replace(/__VC_DEV_ENTRY_ABS__/g, entryAbs).replace(/__VC_DEV_FRAMEWORK__/g, framework).replace(/__VC_DEV_VARIABLE_NAME__/g, variableName);
|
|
5528
|
+
(0, import_fs7.writeFileSync)(shimPath, shimSource, "utf8");
|
|
5529
|
+
(0, import_build_utils9.debug)(`Prepared Python dev shim at ${shimPath}`);
|
|
5530
|
+
return {
|
|
5531
|
+
module: DEV_SHIM_MODULE,
|
|
5532
|
+
extraPythonPath,
|
|
5533
|
+
shimDir: vercelPythonDir
|
|
5534
|
+
};
|
|
4694
5535
|
} catch (err) {
|
|
4695
|
-
(0,
|
|
5536
|
+
(0, import_build_utils9.debug)(`Failed to prepare dev shim: ${err?.message || err}`);
|
|
4696
5537
|
return null;
|
|
4697
5538
|
}
|
|
4698
5539
|
}
|
|
4699
5540
|
async function getMultiServicePythonRunner(workPath, env, systemPython, uvPath) {
|
|
4700
5541
|
const { pythonCmd, venvRoot } = useVirtualEnv(workPath, env, systemPython);
|
|
4701
5542
|
if (venvRoot) {
|
|
4702
|
-
(0,
|
|
5543
|
+
(0, import_build_utils9.debug)(`Using existing virtualenv at ${venvRoot} for multi-service dev`);
|
|
4703
5544
|
return { command: pythonCmd, args: [] };
|
|
4704
5545
|
}
|
|
4705
|
-
const venvPath = (0,
|
|
5546
|
+
const venvPath = (0, import_path9.join)(workPath, ".venv");
|
|
4706
5547
|
await ensureVenv({ pythonPath: systemPython, venvPath, uvPath, quiet: true });
|
|
4707
|
-
(0,
|
|
5548
|
+
(0, import_build_utils9.debug)(`Created virtualenv at ${venvPath} for multi-service dev`);
|
|
4708
5549
|
const pythonBin = getVenvPythonBin(venvPath);
|
|
4709
5550
|
const binDir = getVenvBinDir(venvPath);
|
|
4710
5551
|
env.VIRTUAL_ENV = venvPath;
|
|
4711
|
-
env.PATH = `${binDir}${
|
|
5552
|
+
env.PATH = `${binDir}${import_path9.delimiter}${env.PATH || ""}`;
|
|
4712
5553
|
return { command: pythonBin, args: [] };
|
|
4713
5554
|
}
|
|
4714
5555
|
var startDevServer = async (opts) => {
|
|
@@ -4721,7 +5562,8 @@ var startDevServer = async (opts) => {
|
|
|
4721
5562
|
onStderr
|
|
4722
5563
|
} = opts;
|
|
4723
5564
|
const framework = config?.framework;
|
|
4724
|
-
const
|
|
5565
|
+
const serviceName = typeof meta.serviceName === "string" ? meta.serviceName : void 0;
|
|
5566
|
+
const serverKey = serviceName ? `${workPath}::${framework}::${serviceName}` : `${workPath}::${framework}`;
|
|
4725
5567
|
const existing = PERSISTENT_SERVERS.get(serverKey);
|
|
4726
5568
|
if (existing) {
|
|
4727
5569
|
return {
|
|
@@ -4749,30 +5591,40 @@ var startDevServer = async (opts) => {
|
|
|
4749
5591
|
if (!restoreWarnings)
|
|
4750
5592
|
restoreWarnings = silenceNodeWarnings();
|
|
4751
5593
|
installGlobalCleanupHandlers();
|
|
4752
|
-
const detected = await detectPythonEntrypoint(
|
|
4753
|
-
framework,
|
|
4754
|
-
workPath,
|
|
4755
|
-
rawEntrypoint
|
|
4756
|
-
);
|
|
4757
5594
|
const env = { ...process.env, ...meta.env || {} };
|
|
4758
|
-
|
|
4759
|
-
|
|
4760
|
-
|
|
4761
|
-
|
|
4762
|
-
|
|
4763
|
-
|
|
4764
|
-
|
|
4765
|
-
|
|
4766
|
-
|
|
4767
|
-
|
|
4768
|
-
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
|
|
5595
|
+
const serviceType = env.VERCEL_SERVICE_TYPE;
|
|
5596
|
+
let entry;
|
|
5597
|
+
let variableName;
|
|
5598
|
+
if ((serviceType === "cron" || serviceType === "worker") && rawEntrypoint?.endsWith(".py")) {
|
|
5599
|
+
entry = rawEntrypoint;
|
|
5600
|
+
} else {
|
|
5601
|
+
const detected = await detectPythonEntrypoint(
|
|
5602
|
+
framework,
|
|
5603
|
+
workPath,
|
|
5604
|
+
rawEntrypoint
|
|
5605
|
+
);
|
|
5606
|
+
entry = detected?.entrypoint;
|
|
5607
|
+
variableName = detected?.variableName;
|
|
5608
|
+
if (!entry) {
|
|
5609
|
+
const hookResult = await runFrameworkHook(framework, {
|
|
5610
|
+
pythonEnv: env,
|
|
5611
|
+
projectDir: (0, import_path9.join)(workPath, detected?.baseDir ?? ""),
|
|
5612
|
+
workPath,
|
|
5613
|
+
entrypoint: rawEntrypoint,
|
|
5614
|
+
detected: detected ?? void 0
|
|
5615
|
+
});
|
|
5616
|
+
entry = hookResult?.entrypoint;
|
|
5617
|
+
variableName = hookResult?.variableName;
|
|
5618
|
+
}
|
|
5619
|
+
if (!entry) {
|
|
5620
|
+
const searched = PYTHON_CANDIDATE_ENTRYPOINTS.join(", ");
|
|
5621
|
+
throw new import_build_utils9.NowBuildError({
|
|
5622
|
+
code: "PYTHON_ENTRYPOINT_NOT_FOUND",
|
|
5623
|
+
message: `No ${framework} entrypoint found. Add an 'app' script in pyproject.toml or define an entrypoint in one of: ${searched}.`,
|
|
5624
|
+
link: `https://vercel.com/docs/frameworks/backend/${framework?.toLowerCase()}#exporting-the-${framework?.toLowerCase()}-application`,
|
|
5625
|
+
action: "Learn More"
|
|
5626
|
+
});
|
|
5627
|
+
}
|
|
4776
5628
|
}
|
|
4777
5629
|
const modulePath = entry.replace(/\.py$/i, "").replace(/[\\/]/g, ".");
|
|
4778
5630
|
let childProcess = null;
|
|
@@ -4797,7 +5649,7 @@ var startDevServer = async (opts) => {
|
|
|
4797
5649
|
const yellow = "\x1B[33m";
|
|
4798
5650
|
const white = "\x1B[1m";
|
|
4799
5651
|
const reset = "\x1B[0m";
|
|
4800
|
-
throw new
|
|
5652
|
+
throw new import_build_utils9.NowBuildError({
|
|
4801
5653
|
code: "PYTHON_EXTERNAL_VENV_DETECTED",
|
|
4802
5654
|
message: `Detected activated venv at ${yellow}${venv}${reset}, ${white}vercel dev${reset} manages virtual environments automatically.
|
|
4803
5655
|
Run ${white}deactivate${reset} and try again.`
|
|
@@ -4814,11 +5666,11 @@ Run ${white}deactivate${reset} and try again.`
|
|
|
4814
5666
|
);
|
|
4815
5667
|
spawnCommand = runner.command;
|
|
4816
5668
|
spawnArgsPrefix = runner.args;
|
|
4817
|
-
(0,
|
|
5669
|
+
(0, import_build_utils9.debug)(
|
|
4818
5670
|
`Multi-service Python runner: ${spawnCommand} ${spawnArgsPrefix.join(" ")}`
|
|
4819
5671
|
);
|
|
4820
5672
|
} else if (venv) {
|
|
4821
|
-
(0,
|
|
5673
|
+
(0, import_build_utils9.debug)(`Running in virtualenv at ${venv}`);
|
|
4822
5674
|
} else {
|
|
4823
5675
|
const { pythonCmd: venvPythonCmd, venvRoot } = useVirtualEnv(
|
|
4824
5676
|
workPath,
|
|
@@ -4827,9 +5679,9 @@ Run ${white}deactivate${reset} and try again.`
|
|
|
4827
5679
|
);
|
|
4828
5680
|
spawnCommand = venvPythonCmd;
|
|
4829
5681
|
if (venvRoot) {
|
|
4830
|
-
(0,
|
|
5682
|
+
(0, import_build_utils9.debug)(`Using virtualenv at ${venvRoot}`);
|
|
4831
5683
|
} else {
|
|
4832
|
-
(0,
|
|
5684
|
+
(0, import_build_utils9.debug)("No virtualenv found");
|
|
4833
5685
|
try {
|
|
4834
5686
|
const yellow = "\x1B[33m";
|
|
4835
5687
|
const reset = "\x1B[0m";
|
|
@@ -4868,12 +5720,36 @@ If you are using a virtual environment, activate it before running "vercel dev",
|
|
|
4868
5720
|
pythonBin: spawnCommand,
|
|
4869
5721
|
env
|
|
4870
5722
|
});
|
|
5723
|
+
if (hasWorkerServicesEnabled(env)) {
|
|
5724
|
+
await installVercelWorkers({
|
|
5725
|
+
workPath,
|
|
5726
|
+
uvPath,
|
|
5727
|
+
pythonBin: spawnCommand,
|
|
5728
|
+
env,
|
|
5729
|
+
onStdout,
|
|
5730
|
+
onStderr
|
|
5731
|
+
});
|
|
5732
|
+
}
|
|
4871
5733
|
const port = typeof meta.port === "number" ? meta.port : await (0, import_get_port.default)();
|
|
4872
5734
|
env.PORT = `${port}`;
|
|
4873
|
-
|
|
5735
|
+
if (config.handlerFunction && typeof config?.handlerFunction === "string") {
|
|
5736
|
+
env.__VC_HANDLER_FUNC_NAME = config.handlerFunction;
|
|
5737
|
+
}
|
|
5738
|
+
if (entry) {
|
|
5739
|
+
env.__VC_HANDLER_ENTRYPOINT_ABS = (0, import_path9.join)(workPath, entry);
|
|
5740
|
+
}
|
|
5741
|
+
const devShim = createDevShim(
|
|
5742
|
+
workPath,
|
|
5743
|
+
entry,
|
|
5744
|
+
modulePath,
|
|
5745
|
+
serviceName,
|
|
5746
|
+
framework,
|
|
5747
|
+
variableName ?? ""
|
|
5748
|
+
);
|
|
4874
5749
|
if (devShim) {
|
|
4875
|
-
const
|
|
4876
|
-
const
|
|
5750
|
+
const shimDir = devShim.shimDir || (0, import_path9.join)(workPath, ".vercel", "python");
|
|
5751
|
+
const runtimeDir = (0, import_path9.join)(workPath, ".vercel", "python");
|
|
5752
|
+
const pathParts = shimDir !== runtimeDir ? [shimDir, runtimeDir] : [shimDir];
|
|
4877
5753
|
if (devShim.extraPythonPath) {
|
|
4878
5754
|
pathParts.push(devShim.extraPythonPath);
|
|
4879
5755
|
}
|
|
@@ -4881,12 +5757,12 @@ If you are using a virtual environment, activate it before running "vercel dev",
|
|
|
4881
5757
|
if (existingPythonPath) {
|
|
4882
5758
|
pathParts.push(existingPythonPath);
|
|
4883
5759
|
}
|
|
4884
|
-
env.PYTHONPATH = pathParts.join(
|
|
5760
|
+
env.PYTHONPATH = pathParts.join(import_path9.delimiter);
|
|
4885
5761
|
}
|
|
4886
5762
|
const moduleToRun = devShim?.module || modulePath;
|
|
4887
5763
|
const pythonArgs = ["-u", "-m", moduleToRun];
|
|
4888
5764
|
const argv = [...spawnArgsPrefix, ...pythonArgs];
|
|
4889
|
-
(0,
|
|
5765
|
+
(0, import_build_utils9.debug)(
|
|
4890
5766
|
`Starting Python dev server (${framework}): ${spawnCommand} ${argv.join(" ")} [PORT=${port}]`
|
|
4891
5767
|
);
|
|
4892
5768
|
if (process.stdout.columns) {
|
|
@@ -4940,8 +5816,8 @@ If you are using a virtual environment, activate it before running "vercel dev",
|
|
|
4940
5816
|
};
|
|
4941
5817
|
|
|
4942
5818
|
// src/quirks/index.ts
|
|
4943
|
-
var
|
|
4944
|
-
var
|
|
5819
|
+
var import_build_utils12 = require("@vercel/build-utils");
|
|
5820
|
+
var import_python_analysis7 = require("@vercel/python-analysis");
|
|
4945
5821
|
|
|
4946
5822
|
// src/quirks/matplotlib.ts
|
|
4947
5823
|
var matplotlibQuirk = {
|
|
@@ -4954,9 +5830,9 @@ var matplotlibQuirk = {
|
|
|
4954
5830
|
};
|
|
4955
5831
|
|
|
4956
5832
|
// src/quirks/litellm.ts
|
|
4957
|
-
var
|
|
4958
|
-
var
|
|
4959
|
-
var
|
|
5833
|
+
var import_fs8 = __toESM(require("fs"));
|
|
5834
|
+
var import_path10 = require("path");
|
|
5835
|
+
var import_build_utils10 = require("@vercel/build-utils");
|
|
4960
5836
|
var LAMBDA_ROOT = "/var/task";
|
|
4961
5837
|
var CONFIG_CANDIDATES = [
|
|
4962
5838
|
"litellm_config.yaml",
|
|
@@ -4966,9 +5842,9 @@ var CONFIG_CANDIDATES = [
|
|
|
4966
5842
|
];
|
|
4967
5843
|
async function findConfigFile(workPath) {
|
|
4968
5844
|
for (const name of CONFIG_CANDIDATES) {
|
|
4969
|
-
const candidate = (0,
|
|
5845
|
+
const candidate = (0, import_path10.join)(workPath, name);
|
|
4970
5846
|
try {
|
|
4971
|
-
await
|
|
5847
|
+
await import_fs8.default.promises.access(candidate);
|
|
4972
5848
|
return name;
|
|
4973
5849
|
} catch {
|
|
4974
5850
|
}
|
|
@@ -4983,32 +5859,32 @@ var litellmQuirk = {
|
|
|
4983
5859
|
const env = {};
|
|
4984
5860
|
const sitePackagesDirs = await getVenvSitePackagesDirs(ctx.venvPath);
|
|
4985
5861
|
for (const sitePackages of sitePackagesDirs) {
|
|
4986
|
-
const schemaPath = (0,
|
|
5862
|
+
const schemaPath = (0, import_path10.join)(
|
|
4987
5863
|
sitePackages,
|
|
4988
5864
|
"litellm",
|
|
4989
5865
|
"proxy",
|
|
4990
5866
|
"schema.prisma"
|
|
4991
5867
|
);
|
|
4992
5868
|
try {
|
|
4993
|
-
await
|
|
4994
|
-
(0,
|
|
5869
|
+
await import_fs8.default.promises.access(schemaPath);
|
|
5870
|
+
(0, import_build_utils10.debug)(`LiteLLM quirk: found schema at ${schemaPath}`);
|
|
4995
5871
|
buildEnv.PRISMA_SCHEMA_PATH = schemaPath;
|
|
4996
5872
|
break;
|
|
4997
5873
|
} catch {
|
|
4998
5874
|
}
|
|
4999
5875
|
}
|
|
5000
5876
|
if (!buildEnv.PRISMA_SCHEMA_PATH) {
|
|
5001
|
-
(0,
|
|
5877
|
+
(0, import_build_utils10.debug)("LiteLLM quirk: schema.prisma not found in any site-packages");
|
|
5002
5878
|
}
|
|
5003
5879
|
if (!process.env.CONFIG_FILE_PATH) {
|
|
5004
5880
|
const configName = await findConfigFile(ctx.workPath);
|
|
5005
5881
|
if (configName) {
|
|
5006
|
-
(0,
|
|
5007
|
-
buildEnv.CONFIG_FILE_PATH = (0,
|
|
5008
|
-
env.CONFIG_FILE_PATH = (0,
|
|
5882
|
+
(0, import_build_utils10.debug)(`LiteLLM quirk: found config at ${configName}`);
|
|
5883
|
+
buildEnv.CONFIG_FILE_PATH = (0, import_path10.join)(ctx.workPath, configName);
|
|
5884
|
+
env.CONFIG_FILE_PATH = (0, import_path10.join)(LAMBDA_ROOT, configName);
|
|
5009
5885
|
}
|
|
5010
5886
|
} else {
|
|
5011
|
-
(0,
|
|
5887
|
+
(0, import_build_utils10.debug)(
|
|
5012
5888
|
`LiteLLM quirk: CONFIG_FILE_PATH already set to ${process.env.CONFIG_FILE_PATH}`
|
|
5013
5889
|
);
|
|
5014
5890
|
}
|
|
@@ -5017,11 +5893,11 @@ var litellmQuirk = {
|
|
|
5017
5893
|
};
|
|
5018
5894
|
|
|
5019
5895
|
// src/quirks/prisma.ts
|
|
5020
|
-
var
|
|
5021
|
-
var
|
|
5896
|
+
var import_fs9 = __toESM(require("fs"));
|
|
5897
|
+
var import_path11 = require("path");
|
|
5022
5898
|
var import_execa4 = __toESM(require_execa());
|
|
5023
|
-
var
|
|
5024
|
-
var
|
|
5899
|
+
var import_build_utils11 = require("@vercel/build-utils");
|
|
5900
|
+
var import_python_analysis6 = require("@vercel/python-analysis");
|
|
5025
5901
|
function execErrorMessage(err) {
|
|
5026
5902
|
if (err != null && typeof err === "object" && "stderr" in err) {
|
|
5027
5903
|
const stderr = String(err.stderr);
|
|
@@ -5034,7 +5910,8 @@ var DUMMY_SCHEMA_NAME = "_prisma_dummy.prisma";
|
|
|
5034
5910
|
var LAMBDA_ROOT2 = "/var/task";
|
|
5035
5911
|
var RUNTIME_OPENSSL_VERSION = "3.2";
|
|
5036
5912
|
function getLambdaBinaryTarget() {
|
|
5037
|
-
|
|
5913
|
+
const platform = detectPlatform();
|
|
5914
|
+
return platform.archName === "aarch64" ? "linux-arm64-openssl-3.0.x" : "rhel-openssl-3.0.x";
|
|
5038
5915
|
}
|
|
5039
5916
|
function buildDummySchema(generatedDir) {
|
|
5040
5917
|
const lambdaTarget = getLambdaBinaryTarget();
|
|
@@ -5057,22 +5934,22 @@ model DummyModel {
|
|
|
5057
5934
|
async function findUserSchema(workPath) {
|
|
5058
5935
|
const envPath = process.env.PRISMA_SCHEMA_PATH;
|
|
5059
5936
|
if (envPath) {
|
|
5060
|
-
const resolved = (0,
|
|
5937
|
+
const resolved = (0, import_path11.isAbsolute)(envPath) ? envPath : (0, import_path11.join)(workPath, envPath);
|
|
5061
5938
|
try {
|
|
5062
|
-
await
|
|
5939
|
+
await import_fs9.default.promises.access(resolved);
|
|
5063
5940
|
return resolved;
|
|
5064
5941
|
} catch {
|
|
5065
|
-
(0,
|
|
5942
|
+
(0, import_build_utils11.debug)(`PRISMA_SCHEMA_PATH=${envPath} not found at ${resolved}`);
|
|
5066
5943
|
return null;
|
|
5067
5944
|
}
|
|
5068
5945
|
}
|
|
5069
5946
|
const candidates = [
|
|
5070
|
-
(0,
|
|
5071
|
-
(0,
|
|
5947
|
+
(0, import_path11.join)(workPath, "schema.prisma"),
|
|
5948
|
+
(0, import_path11.join)(workPath, "prisma", "schema.prisma")
|
|
5072
5949
|
];
|
|
5073
5950
|
for (const candidate of candidates) {
|
|
5074
5951
|
try {
|
|
5075
|
-
await
|
|
5952
|
+
await import_fs9.default.promises.access(candidate);
|
|
5076
5953
|
return candidate;
|
|
5077
5954
|
} catch {
|
|
5078
5955
|
}
|
|
@@ -5083,32 +5960,32 @@ async function collectFiles(dir, base) {
|
|
|
5083
5960
|
const result = [];
|
|
5084
5961
|
let entries;
|
|
5085
5962
|
try {
|
|
5086
|
-
entries = await
|
|
5963
|
+
entries = await import_fs9.default.promises.readdir(dir, { withFileTypes: true });
|
|
5087
5964
|
} catch {
|
|
5088
5965
|
return result;
|
|
5089
5966
|
}
|
|
5090
5967
|
for (const entry of entries) {
|
|
5091
5968
|
if (entry.name === "__pycache__")
|
|
5092
5969
|
continue;
|
|
5093
|
-
const full = (0,
|
|
5970
|
+
const full = (0, import_path11.join)(dir, entry.name);
|
|
5094
5971
|
if (entry.isDirectory()) {
|
|
5095
5972
|
result.push(...await collectFiles(full, base));
|
|
5096
5973
|
} else {
|
|
5097
|
-
result.push((0,
|
|
5974
|
+
result.push((0, import_path11.relative)(base, full));
|
|
5098
5975
|
}
|
|
5099
5976
|
}
|
|
5100
5977
|
return result;
|
|
5101
5978
|
}
|
|
5102
5979
|
async function cleanCacheArtifacts(cacheDir, extras = []) {
|
|
5103
5980
|
const paths = [
|
|
5104
|
-
(0,
|
|
5105
|
-
(0,
|
|
5106
|
-
(0,
|
|
5981
|
+
(0, import_path11.join)(cacheDir, "node_modules"),
|
|
5982
|
+
(0, import_path11.join)(cacheDir, "package.json"),
|
|
5983
|
+
(0, import_path11.join)(cacheDir, "package-lock.json"),
|
|
5107
5984
|
...extras
|
|
5108
5985
|
];
|
|
5109
5986
|
for (const p of paths) {
|
|
5110
5987
|
try {
|
|
5111
|
-
await
|
|
5988
|
+
await import_fs9.default.promises.rm(p, { recursive: true, force: true });
|
|
5112
5989
|
} catch (err) {
|
|
5113
5990
|
console.warn(
|
|
5114
5991
|
`could not clean up ${p}: ${err instanceof Error ? err.message : String(err)}`
|
|
@@ -5132,7 +6009,7 @@ var prismaQuirk = {
|
|
|
5132
6009
|
async run(ctx) {
|
|
5133
6010
|
const { venvPath, pythonEnv, workPath } = ctx;
|
|
5134
6011
|
const pythonPath = getVenvPythonBin(venvPath);
|
|
5135
|
-
const runtimeCacheDir = (0,
|
|
6012
|
+
const runtimeCacheDir = (0, import_path11.join)(
|
|
5136
6013
|
LAMBDA_ROOT2,
|
|
5137
6014
|
resolveVendorDir(),
|
|
5138
6015
|
"prisma",
|
|
@@ -5142,7 +6019,7 @@ var prismaQuirk = {
|
|
|
5142
6019
|
let sitePackages;
|
|
5143
6020
|
for (const dir of sitePackagesDirs) {
|
|
5144
6021
|
try {
|
|
5145
|
-
await
|
|
6022
|
+
await import_fs9.default.promises.access((0, import_path11.join)(dir, "prisma"));
|
|
5146
6023
|
sitePackages = dir;
|
|
5147
6024
|
break;
|
|
5148
6025
|
} catch {
|
|
@@ -5154,19 +6031,19 @@ var prismaQuirk = {
|
|
|
5154
6031
|
);
|
|
5155
6032
|
return {};
|
|
5156
6033
|
}
|
|
5157
|
-
const cacheDir = (0,
|
|
5158
|
-
await
|
|
6034
|
+
const cacheDir = (0, import_path11.join)(sitePackages, "prisma", "__bincache__");
|
|
6035
|
+
await import_fs9.default.promises.mkdir(cacheDir, { recursive: true });
|
|
5159
6036
|
const generateEnv = {
|
|
5160
6037
|
...pythonEnv,
|
|
5161
6038
|
PRISMA_BINARY_CACHE_DIR: cacheDir
|
|
5162
6039
|
};
|
|
5163
|
-
const generatedDir = (0,
|
|
5164
|
-
const dummySchemaPath = (0,
|
|
5165
|
-
await
|
|
6040
|
+
const generatedDir = (0, import_path11.join)(workPath, "_prisma_generated");
|
|
6041
|
+
const dummySchemaPath = (0, import_path11.join)(workPath, DUMMY_SCHEMA_NAME);
|
|
6042
|
+
await import_fs9.default.promises.writeFile(
|
|
5166
6043
|
dummySchemaPath,
|
|
5167
6044
|
buildDummySchema(generatedDir)
|
|
5168
6045
|
);
|
|
5169
|
-
(0,
|
|
6046
|
+
(0, import_build_utils11.debug)(`Running prisma generate (dummy) with cache dir: ${cacheDir}`);
|
|
5170
6047
|
try {
|
|
5171
6048
|
const dummyResult = await (0, import_execa4.default)(
|
|
5172
6049
|
pythonPath,
|
|
@@ -5178,11 +6055,11 @@ var prismaQuirk = {
|
|
|
5178
6055
|
}
|
|
5179
6056
|
);
|
|
5180
6057
|
if (dummyResult.stdout)
|
|
5181
|
-
(0,
|
|
6058
|
+
(0, import_build_utils11.debug)(`prisma generate (dummy) stdout: ${dummyResult.stdout}`);
|
|
5182
6059
|
if (dummyResult.stderr)
|
|
5183
|
-
(0,
|
|
6060
|
+
(0, import_build_utils11.debug)(`prisma generate (dummy) stderr: ${dummyResult.stderr}`);
|
|
5184
6061
|
} catch (err) {
|
|
5185
|
-
throw new
|
|
6062
|
+
throw new import_build_utils11.NowBuildError({
|
|
5186
6063
|
code: "PRISMA_GENERATE_FAILED",
|
|
5187
6064
|
message: `Prisma engine download failed during \`prisma generate\`. Check that your prisma version is compatible with this Python version.
|
|
5188
6065
|
` + execErrorMessage(err)
|
|
@@ -5190,47 +6067,47 @@ var prismaQuirk = {
|
|
|
5190
6067
|
}
|
|
5191
6068
|
const srcBinaryPrefix = `query-engine-${getLambdaBinaryTarget()}`;
|
|
5192
6069
|
const runtimeName = `prisma-query-engine-rhel-openssl-${RUNTIME_OPENSSL_VERSION}.x`;
|
|
5193
|
-
const nodeModulesDir = (0,
|
|
6070
|
+
const nodeModulesDir = (0, import_path11.join)(cacheDir, "node_modules", "prisma");
|
|
5194
6071
|
let engineCopied = false;
|
|
5195
6072
|
try {
|
|
5196
|
-
const entries = await
|
|
6073
|
+
const entries = await import_fs9.default.promises.readdir(nodeModulesDir);
|
|
5197
6074
|
for (const entry of entries) {
|
|
5198
6075
|
if (!entry.startsWith(srcBinaryPrefix))
|
|
5199
6076
|
continue;
|
|
5200
|
-
const srcPath = (0,
|
|
5201
|
-
const destPath = (0,
|
|
6077
|
+
const srcPath = (0, import_path11.join)(nodeModulesDir, entry);
|
|
6078
|
+
const destPath = (0, import_path11.join)(cacheDir, runtimeName);
|
|
5202
6079
|
try {
|
|
5203
|
-
await
|
|
5204
|
-
(0,
|
|
6080
|
+
await import_fs9.default.promises.access(destPath);
|
|
6081
|
+
(0, import_build_utils11.debug)(`Engine binary: ${runtimeName} already exists, skipping`);
|
|
5205
6082
|
} catch {
|
|
5206
|
-
(0,
|
|
5207
|
-
await
|
|
6083
|
+
(0, import_build_utils11.debug)(`Engine binary: copying ${entry} -> ${runtimeName}`);
|
|
6084
|
+
await import_fs9.default.promises.copyFile(srcPath, destPath);
|
|
5208
6085
|
}
|
|
5209
6086
|
engineCopied = true;
|
|
5210
6087
|
}
|
|
5211
6088
|
} catch (err) {
|
|
5212
|
-
throw new
|
|
6089
|
+
throw new import_build_utils11.NowBuildError({
|
|
5213
6090
|
code: "PRISMA_ENGINE_NOT_FOUND",
|
|
5214
6091
|
message: `could not read Prisma engine directory "${nodeModulesDir}". This may indicate an incompatible prisma version.
|
|
5215
6092
|
` + (err instanceof Error ? err.message : String(err))
|
|
5216
6093
|
});
|
|
5217
6094
|
}
|
|
5218
6095
|
if (!engineCopied) {
|
|
5219
|
-
throw new
|
|
6096
|
+
throw new import_build_utils11.NowBuildError({
|
|
5220
6097
|
code: "PRISMA_ENGINE_NOT_FOUND",
|
|
5221
6098
|
message: `could not find engine binary matching "${srcBinaryPrefix}*" in "${nodeModulesDir}". This may indicate an incompatible prisma version or an unsupported platform (${process.arch}).`
|
|
5222
6099
|
});
|
|
5223
6100
|
}
|
|
5224
|
-
const shimPath = (0,
|
|
5225
|
-
await
|
|
6101
|
+
const shimPath = (0, import_path11.join)(cacheDir, "openssl");
|
|
6102
|
+
await import_fs9.default.promises.writeFile(
|
|
5226
6103
|
shimPath,
|
|
5227
6104
|
`#!/bin/sh
|
|
5228
6105
|
echo "OpenSSL ${RUNTIME_OPENSSL_VERSION}.0 1 Jan 2024 (Library: OpenSSL ${RUNTIME_OPENSSL_VERSION}.0)"
|
|
5229
6106
|
`
|
|
5230
6107
|
);
|
|
5231
|
-
await
|
|
6108
|
+
await import_fs9.default.promises.chmod(shimPath, 493);
|
|
5232
6109
|
for (const p of [generatedDir, dummySchemaPath]) {
|
|
5233
|
-
await
|
|
6110
|
+
await import_fs9.default.promises.rm(p, { recursive: true, force: true });
|
|
5234
6111
|
}
|
|
5235
6112
|
await cleanCacheArtifacts(cacheDir);
|
|
5236
6113
|
const generateMode = (process.env.VERCEL_PRISMA_GENERATE_CLIENT ?? "auto").toLowerCase();
|
|
@@ -5243,14 +6120,14 @@ echo "OpenSSL ${RUNTIME_OPENSSL_VERSION}.0 1 Jan 2024 (Library: OpenSSL ${RUNTIM
|
|
|
5243
6120
|
pythonEnv
|
|
5244
6121
|
);
|
|
5245
6122
|
if (clientAlreadyGenerated) {
|
|
5246
|
-
(0,
|
|
6123
|
+
(0, import_build_utils11.debug)(
|
|
5247
6124
|
"Prisma quirk: client already generated, skipping user schema generate"
|
|
5248
6125
|
);
|
|
5249
6126
|
shouldGenerate = false;
|
|
5250
6127
|
}
|
|
5251
6128
|
}
|
|
5252
6129
|
if (shouldGenerate) {
|
|
5253
|
-
(0,
|
|
6130
|
+
(0, import_build_utils11.debug)(`Running prisma generate with user schema: ${userSchema}`);
|
|
5254
6131
|
try {
|
|
5255
6132
|
const userResult = await (0, import_execa4.default)(
|
|
5256
6133
|
pythonPath,
|
|
@@ -5262,11 +6139,11 @@ echo "OpenSSL ${RUNTIME_OPENSSL_VERSION}.0 1 Jan 2024 (Library: OpenSSL ${RUNTIM
|
|
|
5262
6139
|
}
|
|
5263
6140
|
);
|
|
5264
6141
|
if (userResult.stdout)
|
|
5265
|
-
(0,
|
|
6142
|
+
(0, import_build_utils11.debug)(`prisma generate stdout: ${userResult.stdout}`);
|
|
5266
6143
|
if (userResult.stderr)
|
|
5267
|
-
(0,
|
|
6144
|
+
(0, import_build_utils11.debug)(`prisma generate stderr: ${userResult.stderr}`);
|
|
5268
6145
|
} catch (err) {
|
|
5269
|
-
throw new
|
|
6146
|
+
throw new import_build_utils11.NowBuildError({
|
|
5270
6147
|
code: "PRISMA_GENERATE_FAILED",
|
|
5271
6148
|
message: `\`prisma generate\` failed for schema "${userSchema}".
|
|
5272
6149
|
` + execErrorMessage(err)
|
|
@@ -5277,12 +6154,12 @@ echo "OpenSSL ${RUNTIME_OPENSSL_VERSION}.0 1 Jan 2024 (Library: OpenSSL ${RUNTIM
|
|
|
5277
6154
|
}
|
|
5278
6155
|
try {
|
|
5279
6156
|
const allFiles = await collectFiles(
|
|
5280
|
-
(0,
|
|
6157
|
+
(0, import_path11.join)(sitePackages, "prisma"),
|
|
5281
6158
|
sitePackages
|
|
5282
6159
|
);
|
|
5283
|
-
const count = await (0,
|
|
6160
|
+
const count = await (0, import_python_analysis6.extendDistRecord)(sitePackages, "prisma", allFiles);
|
|
5284
6161
|
if (count > 0) {
|
|
5285
|
-
(0,
|
|
6162
|
+
(0, import_build_utils11.debug)(`Appended ${count} entries to prisma RECORD`);
|
|
5286
6163
|
}
|
|
5287
6164
|
} catch (err) {
|
|
5288
6165
|
console.warn(
|
|
@@ -5305,7 +6182,7 @@ var quirks = [litellmQuirk, prismaQuirk, matplotlibQuirk];
|
|
|
5305
6182
|
function toposortQuirks(activated) {
|
|
5306
6183
|
const nameToQuirk = /* @__PURE__ */ new Map();
|
|
5307
6184
|
for (const q of activated) {
|
|
5308
|
-
nameToQuirk.set((0,
|
|
6185
|
+
nameToQuirk.set((0, import_python_analysis7.normalizePackageName)(q.dependency), q);
|
|
5309
6186
|
}
|
|
5310
6187
|
const adj = /* @__PURE__ */ new Map();
|
|
5311
6188
|
const inDegree = /* @__PURE__ */ new Map();
|
|
@@ -5316,7 +6193,7 @@ function toposortQuirks(activated) {
|
|
|
5316
6193
|
for (const q of activated) {
|
|
5317
6194
|
if (q.runsBefore) {
|
|
5318
6195
|
for (const dep of q.runsBefore) {
|
|
5319
|
-
const target = nameToQuirk.get((0,
|
|
6196
|
+
const target = nameToQuirk.get((0, import_python_analysis7.normalizePackageName)(dep));
|
|
5320
6197
|
if (target) {
|
|
5321
6198
|
adj.get(q).add(target);
|
|
5322
6199
|
inDegree.set(target, inDegree.get(target) + 1);
|
|
@@ -5325,7 +6202,7 @@ function toposortQuirks(activated) {
|
|
|
5325
6202
|
}
|
|
5326
6203
|
if (q.runsAfter) {
|
|
5327
6204
|
for (const dep of q.runsAfter) {
|
|
5328
|
-
const source = nameToQuirk.get((0,
|
|
6205
|
+
const source = nameToQuirk.get((0, import_python_analysis7.normalizePackageName)(dep));
|
|
5329
6206
|
if (source) {
|
|
5330
6207
|
adj.get(source).add(q);
|
|
5331
6208
|
inDegree.set(q, inDegree.get(q) + 1);
|
|
@@ -5366,23 +6243,23 @@ async function runQuirks(ctx) {
|
|
|
5366
6243
|
const installedNames = /* @__PURE__ */ new Set();
|
|
5367
6244
|
const sitePackageDirs = await getVenvSitePackagesDirs(ctx.venvPath);
|
|
5368
6245
|
for (const dir of sitePackageDirs) {
|
|
5369
|
-
const distributions = await (0,
|
|
6246
|
+
const distributions = await (0, import_python_analysis7.scanDistributions)(dir);
|
|
5370
6247
|
for (const name of distributions.keys()) {
|
|
5371
|
-
installedNames.add((0,
|
|
6248
|
+
installedNames.add((0, import_python_analysis7.normalizePackageName)(name));
|
|
5372
6249
|
}
|
|
5373
6250
|
}
|
|
5374
6251
|
const activated = quirks.filter((quirk) => {
|
|
5375
6252
|
const installed = installedNames.has(
|
|
5376
|
-
(0,
|
|
6253
|
+
(0, import_python_analysis7.normalizePackageName)(quirk.dependency)
|
|
5377
6254
|
);
|
|
5378
6255
|
if (!installed) {
|
|
5379
|
-
(0,
|
|
6256
|
+
(0, import_build_utils12.debug)(`Quirk "${quirk.dependency}": not installed, skipping`);
|
|
5380
6257
|
}
|
|
5381
6258
|
return installed;
|
|
5382
6259
|
});
|
|
5383
6260
|
const sorted = toposortQuirks(activated);
|
|
5384
6261
|
for (const quirk of sorted) {
|
|
5385
|
-
(0,
|
|
6262
|
+
(0, import_build_utils12.debug)(`Quirk "${quirk.dependency}": detected, running fix-up`);
|
|
5386
6263
|
const result = await quirk.run(ctx);
|
|
5387
6264
|
if (result.env) {
|
|
5388
6265
|
Object.assign(mergedEnv, result.env);
|
|
@@ -5403,12 +6280,12 @@ async function runQuirks(ctx) {
|
|
|
5403
6280
|
}
|
|
5404
6281
|
|
|
5405
6282
|
// src/django.ts
|
|
5406
|
-
var
|
|
5407
|
-
var
|
|
6283
|
+
var import_fs10 = __toESM(require("fs"));
|
|
6284
|
+
var import_path12 = require("path");
|
|
5408
6285
|
var import_execa5 = __toESM(require_execa());
|
|
5409
|
-
var
|
|
5410
|
-
var scriptPath = (0,
|
|
5411
|
-
var script =
|
|
6286
|
+
var import_build_utils13 = require("@vercel/build-utils");
|
|
6287
|
+
var scriptPath = (0, import_path12.join)(__dirname, "..", "templates", "vc_django_settings.py");
|
|
6288
|
+
var script = import_fs10.default.readFileSync(scriptPath, "utf-8");
|
|
5412
6289
|
async function getDjangoSettings(projectDir, env) {
|
|
5413
6290
|
try {
|
|
5414
6291
|
const { stdout } = await (0, import_execa5.default)("python", ["-c", script], {
|
|
@@ -5423,7 +6300,7 @@ async function getDjangoSettings(projectDir, env) {
|
|
|
5423
6300
|
djangoSettings: parsed.django_settings
|
|
5424
6301
|
};
|
|
5425
6302
|
} catch (err) {
|
|
5426
|
-
(0,
|
|
6303
|
+
(0, import_build_utils13.debug)(`Django hook: failed to discover settings from manage.py: ${err}`);
|
|
5427
6304
|
return null;
|
|
5428
6305
|
}
|
|
5429
6306
|
}
|
|
@@ -5437,10 +6314,10 @@ async function runDjangoCollectStatic(venvPath, workPath, env, outputStaticDir,
|
|
|
5437
6314
|
const installedApps = djangoSettings["INSTALLED_APPS"] ?? [];
|
|
5438
6315
|
const staticfilesDirs = djangoSettings["STATICFILES_DIRS"] ?? [];
|
|
5439
6316
|
const staticSourceDirs = [
|
|
5440
|
-
...installedApps.map((app) => (0,
|
|
6317
|
+
...installedApps.map((app) => (0, import_path12.join)(workPath, ...app.split("."), "static")),
|
|
5441
6318
|
// TODO: Deal with optional prefixes in STATICFILES_DIRS.
|
|
5442
6319
|
...staticfilesDirs.map((d) => Array.isArray(d) ? d[1] : d)
|
|
5443
|
-
].filter((d) =>
|
|
6320
|
+
].filter((d) => import_fs10.default.existsSync(d));
|
|
5444
6321
|
if (storageBackend.startsWith("storages.backends.")) {
|
|
5445
6322
|
console.log(
|
|
5446
6323
|
"django-storages detected \u2014 running collectstatic with original settings"
|
|
@@ -5451,7 +6328,7 @@ async function runDjangoCollectStatic(venvPath, workPath, env, outputStaticDir,
|
|
|
5451
6328
|
});
|
|
5452
6329
|
return {
|
|
5453
6330
|
staticSourceDirs,
|
|
5454
|
-
staticRoot: staticRoot ? (0,
|
|
6331
|
+
staticRoot: staticRoot ? (0, import_path12.resolve)(workPath, staticRoot) : null,
|
|
5455
6332
|
manifestRelPath: null
|
|
5456
6333
|
};
|
|
5457
6334
|
}
|
|
@@ -5462,9 +6339,9 @@ async function runDjangoCollectStatic(venvPath, workPath, env, outputStaticDir,
|
|
|
5462
6339
|
return null;
|
|
5463
6340
|
}
|
|
5464
6341
|
const staticUrlPath = staticUrl.replace(/^\/|\/$/g, "") || "static";
|
|
5465
|
-
const staticOutputDir = (0,
|
|
5466
|
-
await
|
|
5467
|
-
const shimPath = (0,
|
|
6342
|
+
const staticOutputDir = (0, import_path12.join)(outputStaticDir, staticUrlPath);
|
|
6343
|
+
await import_fs10.default.promises.mkdir(staticOutputDir, { recursive: true });
|
|
6344
|
+
const shimPath = (0, import_path12.join)(workPath, "_vercel_collectstatic_settings.py");
|
|
5468
6345
|
const shimLines = [
|
|
5469
6346
|
`from ${settingsModule} import *`,
|
|
5470
6347
|
`STATIC_ROOT = ${JSON.stringify(staticOutputDir)}`
|
|
@@ -5472,7 +6349,7 @@ async function runDjangoCollectStatic(venvPath, workPath, env, outputStaticDir,
|
|
|
5472
6349
|
if (whitenoiseUseFinders) {
|
|
5473
6350
|
shimLines.push(`WHITENOISE_USE_FINDERS = False`);
|
|
5474
6351
|
}
|
|
5475
|
-
await
|
|
6352
|
+
await import_fs10.default.promises.writeFile(shimPath, shimLines.join("\n") + "\n");
|
|
5476
6353
|
try {
|
|
5477
6354
|
console.log("Running collectstatic...");
|
|
5478
6355
|
await (0, import_execa5.default)(pythonPath, ["manage.py", "collectstatic", "--noinput"], {
|
|
@@ -5483,7 +6360,7 @@ async function runDjangoCollectStatic(venvPath, workPath, env, outputStaticDir,
|
|
|
5483
6360
|
cwd: workPath
|
|
5484
6361
|
});
|
|
5485
6362
|
} finally {
|
|
5486
|
-
await
|
|
6363
|
+
await import_fs10.default.promises.unlink(shimPath).catch(() => {
|
|
5487
6364
|
});
|
|
5488
6365
|
}
|
|
5489
6366
|
const MANIFEST_STORAGE_BACKENDS = [
|
|
@@ -5492,24 +6369,24 @@ async function runDjangoCollectStatic(venvPath, workPath, env, outputStaticDir,
|
|
|
5492
6369
|
];
|
|
5493
6370
|
let manifestRelPath = null;
|
|
5494
6371
|
if (MANIFEST_STORAGE_BACKENDS.includes(storageBackend) && staticRoot) {
|
|
5495
|
-
const manifestSrc = (0,
|
|
5496
|
-
const resolvedStaticRoot = (0,
|
|
5497
|
-
const manifestDest = (0,
|
|
5498
|
-
await
|
|
5499
|
-
await
|
|
5500
|
-
manifestRelPath = (0,
|
|
5501
|
-
(0,
|
|
6372
|
+
const manifestSrc = (0, import_path12.join)(staticOutputDir, "staticfiles.json");
|
|
6373
|
+
const resolvedStaticRoot = (0, import_path12.resolve)(workPath, staticRoot);
|
|
6374
|
+
const manifestDest = (0, import_path12.join)(resolvedStaticRoot, "staticfiles.json");
|
|
6375
|
+
await import_fs10.default.promises.mkdir(resolvedStaticRoot, { recursive: true });
|
|
6376
|
+
await import_fs10.default.promises.copyFile(manifestSrc, manifestDest);
|
|
6377
|
+
manifestRelPath = (0, import_path12.relative)(workPath, manifestDest);
|
|
6378
|
+
(0, import_build_utils13.debug)(`Copied staticfiles.json to ${manifestDest} for Lambda bundle`);
|
|
5502
6379
|
}
|
|
5503
6380
|
return {
|
|
5504
6381
|
staticSourceDirs,
|
|
5505
|
-
staticRoot: staticRoot ? (0,
|
|
6382
|
+
staticRoot: staticRoot ? (0, import_path12.resolve)(workPath, staticRoot) : null,
|
|
5506
6383
|
manifestRelPath
|
|
5507
6384
|
};
|
|
5508
6385
|
}
|
|
5509
6386
|
|
|
5510
6387
|
// src/index.ts
|
|
5511
|
-
var
|
|
5512
|
-
var writeFile =
|
|
6388
|
+
var import_python_analysis8 = require("@vercel/python-analysis");
|
|
6389
|
+
var writeFile = import_fs11.default.promises.writeFile;
|
|
5513
6390
|
var version = 3;
|
|
5514
6391
|
async function runFrameworkHook(framework, ctx) {
|
|
5515
6392
|
const hook = framework ? frameworkHooks[framework] : void 0;
|
|
@@ -5524,39 +6401,51 @@ var frameworkHooks = {
|
|
|
5524
6401
|
detected
|
|
5525
6402
|
}) => {
|
|
5526
6403
|
if (detected?.baseDir === void 0) {
|
|
5527
|
-
(0,
|
|
6404
|
+
(0, import_build_utils14.debug)("Django hook: no manage.py detected, skipping");
|
|
5528
6405
|
return;
|
|
5529
6406
|
}
|
|
5530
6407
|
const settingsResult = await getDjangoSettings(projectDir, pythonEnv);
|
|
5531
|
-
(0,
|
|
6408
|
+
(0, import_build_utils14.debug)(`Django settings: ${JSON.stringify(settingsResult)}`);
|
|
5532
6409
|
if (!settingsResult)
|
|
5533
6410
|
return;
|
|
5534
6411
|
const { djangoSettings, settingsModule } = settingsResult;
|
|
5535
6412
|
let entrypoint;
|
|
6413
|
+
let variableName;
|
|
5536
6414
|
const baseDir = detected?.baseDir ?? "";
|
|
5537
6415
|
const asgiApp = djangoSettings["ASGI_APPLICATION"];
|
|
5538
6416
|
if (typeof asgiApp === "string") {
|
|
5539
|
-
const
|
|
6417
|
+
const parts = asgiApp.split(".");
|
|
6418
|
+
variableName = parts.at(-1);
|
|
6419
|
+
const rel = `${parts.slice(0, -1).join("/")}.py`;
|
|
5540
6420
|
entrypoint = baseDir ? `${baseDir}/${rel}` : rel;
|
|
5541
|
-
(0,
|
|
6421
|
+
(0, import_build_utils14.debug)(
|
|
6422
|
+
`Django hook: ASGI entrypoint: ${entrypoint} (variable: ${variableName})`
|
|
6423
|
+
);
|
|
5542
6424
|
} else {
|
|
5543
6425
|
const wsgiApp = djangoSettings["WSGI_APPLICATION"];
|
|
5544
6426
|
if (typeof wsgiApp === "string") {
|
|
5545
|
-
const
|
|
6427
|
+
const parts = wsgiApp.split(".");
|
|
6428
|
+
variableName = parts.at(-1);
|
|
6429
|
+
const rel = `${parts.slice(0, -1).join("/")}.py`;
|
|
5546
6430
|
entrypoint = baseDir ? `${baseDir}/${rel}` : rel;
|
|
5547
|
-
(0,
|
|
6431
|
+
(0, import_build_utils14.debug)(
|
|
6432
|
+
`Django hook: WSGI entrypoint: ${entrypoint} (variable: ${variableName})`
|
|
6433
|
+
);
|
|
5548
6434
|
}
|
|
5549
6435
|
}
|
|
5550
|
-
|
|
5551
|
-
|
|
5552
|
-
|
|
5553
|
-
|
|
5554
|
-
|
|
5555
|
-
|
|
5556
|
-
|
|
5557
|
-
|
|
5558
|
-
|
|
5559
|
-
|
|
6436
|
+
let djangoStatic = null;
|
|
6437
|
+
if (workPath && venvPath) {
|
|
6438
|
+
const outputStaticDir = (0, import_path13.join)(workPath, ".vercel", "output", "static");
|
|
6439
|
+
djangoStatic = await runDjangoCollectStatic(
|
|
6440
|
+
venvPath,
|
|
6441
|
+
workPath,
|
|
6442
|
+
pythonEnv,
|
|
6443
|
+
outputStaticDir,
|
|
6444
|
+
settingsModule,
|
|
6445
|
+
djangoSettings
|
|
6446
|
+
);
|
|
6447
|
+
}
|
|
6448
|
+
return { entrypoint, variableName, djangoStatic };
|
|
5560
6449
|
}
|
|
5561
6450
|
};
|
|
5562
6451
|
async function downloadFilesInWorkPath({
|
|
@@ -5565,13 +6454,13 @@ async function downloadFilesInWorkPath({
|
|
|
5565
6454
|
files,
|
|
5566
6455
|
meta = {}
|
|
5567
6456
|
}) {
|
|
5568
|
-
(0,
|
|
5569
|
-
let downloadedFiles = await (0,
|
|
6457
|
+
(0, import_build_utils14.debug)("Downloading user files...");
|
|
6458
|
+
let downloadedFiles = await (0, import_build_utils14.download)(files, workPath, meta);
|
|
5570
6459
|
if (meta.isDev) {
|
|
5571
|
-
const { devCacheDir = (0,
|
|
5572
|
-
const destCache = (0,
|
|
5573
|
-
await (0,
|
|
5574
|
-
downloadedFiles = await (0,
|
|
6460
|
+
const { devCacheDir = (0, import_path13.join)(workPath, ".now", "cache") } = meta;
|
|
6461
|
+
const destCache = (0, import_path13.join)(devCacheDir, (0, import_path13.basename)(entrypoint, ".py"));
|
|
6462
|
+
await (0, import_build_utils14.download)(downloadedFiles, destCache);
|
|
6463
|
+
downloadedFiles = await (0, import_build_utils14.glob)("**", destCache);
|
|
5575
6464
|
workPath = destCache;
|
|
5576
6465
|
}
|
|
5577
6466
|
return workPath;
|
|
@@ -5583,15 +6472,16 @@ var build = async ({
|
|
|
5583
6472
|
entrypoint,
|
|
5584
6473
|
meta = {},
|
|
5585
6474
|
config,
|
|
5586
|
-
span: parentSpan
|
|
6475
|
+
span: parentSpan,
|
|
6476
|
+
service
|
|
5587
6477
|
}) => {
|
|
5588
|
-
const builderSpan = parentSpan ?? new
|
|
6478
|
+
const builderSpan = parentSpan ?? new import_build_utils14.Span({ name: "vc.builder" });
|
|
5589
6479
|
const framework = config?.framework;
|
|
5590
6480
|
const shouldInstallVercelWorkers = config?.hasWorkerServices === true;
|
|
5591
6481
|
let spawnEnv;
|
|
5592
6482
|
let projectInstallCommand;
|
|
5593
6483
|
let hasCustomCommand = false;
|
|
5594
|
-
(0,
|
|
6484
|
+
(0, import_build_utils14.debug)(`workPath: ${workPath}`);
|
|
5595
6485
|
workPath = await downloadFilesInWorkPath({
|
|
5596
6486
|
workPath,
|
|
5597
6487
|
files: originalFiles,
|
|
@@ -5600,17 +6490,17 @@ var build = async ({
|
|
|
5600
6490
|
});
|
|
5601
6491
|
try {
|
|
5602
6492
|
if (meta.isDev) {
|
|
5603
|
-
const setupCfg = (0,
|
|
6493
|
+
const setupCfg = (0, import_path13.join)(workPath, "setup.cfg");
|
|
5604
6494
|
await writeFile(setupCfg, "[install]\nprefix=\n");
|
|
5605
6495
|
}
|
|
5606
6496
|
} catch (err) {
|
|
5607
6497
|
console.log('Failed to create "setup.cfg" file');
|
|
5608
6498
|
throw err;
|
|
5609
6499
|
}
|
|
5610
|
-
let fsFiles = await (0,
|
|
6500
|
+
let fsFiles = await (0, import_build_utils14.glob)("**", workPath);
|
|
5611
6501
|
let detected;
|
|
5612
6502
|
let entrypointNotFound;
|
|
5613
|
-
if ((0,
|
|
6503
|
+
if ((0, import_build_utils14.isPythonFramework)(framework) && // XXX: we might want to detect anyway for django!
|
|
5614
6504
|
(!fsFiles[entrypoint] || !entrypoint.endsWith(".py"))) {
|
|
5615
6505
|
detected = await detectPythonEntrypoint(
|
|
5616
6506
|
config.framework,
|
|
@@ -5618,13 +6508,13 @@ var build = async ({
|
|
|
5618
6508
|
entrypoint
|
|
5619
6509
|
) ?? void 0;
|
|
5620
6510
|
if (detected?.entrypoint) {
|
|
5621
|
-
(0,
|
|
6511
|
+
(0, import_build_utils14.debug)(
|
|
5622
6512
|
`Resolved Python entrypoint to "${detected.entrypoint}" (configured "${entrypoint}" not found).`
|
|
5623
6513
|
);
|
|
5624
6514
|
entrypoint = detected.entrypoint;
|
|
5625
6515
|
} else {
|
|
5626
6516
|
const searchedList = PYTHON_CANDIDATE_ENTRYPOINTS.join(", ");
|
|
5627
|
-
entrypointNotFound = new
|
|
6517
|
+
entrypointNotFound = new import_build_utils14.NowBuildError({
|
|
5628
6518
|
code: `${framework.toUpperCase()}_ENTRYPOINT_NOT_FOUND`,
|
|
5629
6519
|
message: `No ${framework} entrypoint found. Add an 'app' script in pyproject.toml or define an entrypoint in one of: ${searchedList}.`,
|
|
5630
6520
|
link: `https://vercel.com/docs/frameworks/backend/${framework}#exporting-the-${framework}-application`,
|
|
@@ -5635,8 +6525,8 @@ var build = async ({
|
|
|
5635
6525
|
if (entrypointNotFound && detected?.baseDir === void 0) {
|
|
5636
6526
|
throw entrypointNotFound;
|
|
5637
6527
|
}
|
|
5638
|
-
const entryDirectory = detected?.baseDir ?? (0,
|
|
5639
|
-
const entrypointAbsDir = (0,
|
|
6528
|
+
const entryDirectory = detected?.baseDir ?? (0, import_path13.dirname)(entrypoint);
|
|
6529
|
+
const entrypointAbsDir = (0, import_path13.join)(workPath, entryDirectory);
|
|
5640
6530
|
const rootDir = repoRootPath ?? workPath;
|
|
5641
6531
|
const pythonPackage = await builderSpan.child("vc.builder.python.discover").trace(
|
|
5642
6532
|
() => discoverPackage({
|
|
@@ -5666,22 +6556,22 @@ var build = async ({
|
|
|
5666
6556
|
`
|
|
5667
6557
|
);
|
|
5668
6558
|
}
|
|
5669
|
-
fsFiles = await (0,
|
|
5670
|
-
const venvPath = (0,
|
|
6559
|
+
fsFiles = await (0, import_build_utils14.glob)("**", workPath);
|
|
6560
|
+
const venvPath = service?.name ? (0, import_path13.join)(workPath, ".vercel", "python", "services", service.name, ".venv") : (0, import_path13.join)(workPath, ".vercel", "python", ".venv");
|
|
5671
6561
|
await builderSpan.child("vc.builder.python.venv").trace(async () => {
|
|
5672
6562
|
await ensureVenv({
|
|
5673
6563
|
pythonPath: pythonVersion.pythonPath,
|
|
5674
6564
|
venvPath
|
|
5675
6565
|
});
|
|
5676
6566
|
});
|
|
5677
|
-
if ((0,
|
|
6567
|
+
if ((0, import_build_utils14.isPythonFramework)(framework)) {
|
|
5678
6568
|
const {
|
|
5679
6569
|
cliType,
|
|
5680
6570
|
lockfileVersion,
|
|
5681
6571
|
packageJsonPackageManager,
|
|
5682
6572
|
turboSupportsCorepackHome
|
|
5683
|
-
} = await (0,
|
|
5684
|
-
spawnEnv = (0,
|
|
6573
|
+
} = await (0, import_build_utils14.scanParentDirs)(workPath, true);
|
|
6574
|
+
spawnEnv = (0, import_build_utils14.getEnvForPackageManager)({
|
|
5685
6575
|
cliType,
|
|
5686
6576
|
lockfileVersion,
|
|
5687
6577
|
packageJsonPackageManager,
|
|
@@ -5717,15 +6607,14 @@ var build = async ({
|
|
|
5717
6607
|
let uvLockPath = null;
|
|
5718
6608
|
let uvProjectDir = null;
|
|
5719
6609
|
let projectName;
|
|
5720
|
-
|
|
5721
|
-
await builderSpan.child(import_build_utils13.BUILDER_INSTALLER_STEP, {
|
|
6610
|
+
await builderSpan.child(import_build_utils14.BUILDER_INSTALLER_STEP, {
|
|
5722
6611
|
installCommand: projectInstallCommand || void 0
|
|
5723
6612
|
}).trace(async () => {
|
|
5724
6613
|
if (projectInstallCommand) {
|
|
5725
6614
|
console.log(
|
|
5726
6615
|
`Running "install" command: \`${projectInstallCommand}\`...`
|
|
5727
6616
|
);
|
|
5728
|
-
await (0,
|
|
6617
|
+
await (0, import_build_utils14.execCommand)(projectInstallCommand, {
|
|
5729
6618
|
env: pythonEnv,
|
|
5730
6619
|
cwd: workPath
|
|
5731
6620
|
});
|
|
@@ -5756,22 +6645,6 @@ var build = async ({
|
|
|
5756
6645
|
uvLockPath = lockPath;
|
|
5757
6646
|
uvProjectDir = projectDir;
|
|
5758
6647
|
projectName = pythonPackage?.manifest?.data?.project?.name;
|
|
5759
|
-
if (lockFileProvidedByUser) {
|
|
5760
|
-
try {
|
|
5761
|
-
await uv.sync({
|
|
5762
|
-
venvPath,
|
|
5763
|
-
projectDir,
|
|
5764
|
-
frozen: true,
|
|
5765
|
-
noBuild: true,
|
|
5766
|
-
noInstallProject: true
|
|
5767
|
-
});
|
|
5768
|
-
} catch (err) {
|
|
5769
|
-
noBuildCheckFailed = true;
|
|
5770
|
-
(0, import_build_utils13.debug)(
|
|
5771
|
-
`--no-build check failed: ${err instanceof Error ? err.message : String(err)}`
|
|
5772
|
-
);
|
|
5773
|
-
}
|
|
5774
|
-
}
|
|
5775
6648
|
await uv.sync({
|
|
5776
6649
|
venvPath,
|
|
5777
6650
|
projectDir,
|
|
@@ -5780,15 +6653,15 @@ var build = async ({
|
|
|
5780
6653
|
});
|
|
5781
6654
|
}
|
|
5782
6655
|
});
|
|
5783
|
-
if ((0,
|
|
6656
|
+
if ((0, import_build_utils14.isPythonFramework)(framework)) {
|
|
5784
6657
|
const projectBuildCommand = config?.projectSettings?.buildCommand ?? // fallback if provided directly on config (some callers set this)
|
|
5785
6658
|
config?.buildCommand;
|
|
5786
|
-
await builderSpan.child(
|
|
6659
|
+
await builderSpan.child(import_build_utils14.BUILDER_COMPILE_STEP, {
|
|
5787
6660
|
buildCommand: projectBuildCommand || void 0
|
|
5788
6661
|
}).trace(async () => {
|
|
5789
6662
|
if (projectBuildCommand) {
|
|
5790
6663
|
console.log(`Running "${projectBuildCommand}"`);
|
|
5791
|
-
await (0,
|
|
6664
|
+
await (0, import_build_utils14.execCommand)(projectBuildCommand, {
|
|
5792
6665
|
env: pythonEnv,
|
|
5793
6666
|
cwd: workPath
|
|
5794
6667
|
});
|
|
@@ -5803,7 +6676,7 @@ var build = async ({
|
|
|
5803
6676
|
}
|
|
5804
6677
|
const hookResult = await runFrameworkHook(framework, {
|
|
5805
6678
|
pythonEnv,
|
|
5806
|
-
projectDir: (0,
|
|
6679
|
+
projectDir: (0, import_path13.join)(workPath, entryDirectory),
|
|
5807
6680
|
workPath,
|
|
5808
6681
|
venvPath,
|
|
5809
6682
|
entrypoint,
|
|
@@ -5818,18 +6691,18 @@ var build = async ({
|
|
|
5818
6691
|
}
|
|
5819
6692
|
const djangoStatic = hookResult?.djangoStatic ?? null;
|
|
5820
6693
|
const runtimeDep = baseEnv.VERCEL_RUNTIME_PYTHON || `vercel-runtime==${VERCEL_RUNTIME_VERSION}`;
|
|
5821
|
-
(0,
|
|
6694
|
+
(0, import_build_utils14.debug)(`Installing ${runtimeDep}`);
|
|
5822
6695
|
await uv.pip({
|
|
5823
6696
|
venvPath,
|
|
5824
|
-
projectDir: (0,
|
|
6697
|
+
projectDir: (0, import_path13.join)(workPath, entryDirectory),
|
|
5825
6698
|
args: ["install", runtimeDep]
|
|
5826
6699
|
});
|
|
5827
6700
|
if (shouldInstallVercelWorkers) {
|
|
5828
6701
|
const workersDep = baseEnv.VERCEL_WORKERS_PYTHON || `vercel-workers==${VERCEL_WORKERS_VERSION}`;
|
|
5829
|
-
(0,
|
|
6702
|
+
(0, import_build_utils14.debug)(`Installing ${workersDep}`);
|
|
5830
6703
|
await uv.pip({
|
|
5831
6704
|
venvPath,
|
|
5832
|
-
projectDir: (0,
|
|
6705
|
+
projectDir: (0, import_path13.join)(workPath, entryDirectory),
|
|
5833
6706
|
args: ["install", workersDep]
|
|
5834
6707
|
});
|
|
5835
6708
|
}
|
|
@@ -5837,15 +6710,15 @@ var build = async ({
|
|
|
5837
6710
|
if (quirksResult.buildEnv) {
|
|
5838
6711
|
Object.assign(pythonEnv, quirksResult.buildEnv);
|
|
5839
6712
|
}
|
|
5840
|
-
(0,
|
|
6713
|
+
(0, import_build_utils14.debug)("Entrypoint is", entrypoint);
|
|
5841
6714
|
const moduleName = entrypoint.replace(/\//g, ".").replace(/\.py$/i, "");
|
|
5842
6715
|
const handlerFunction = typeof config?.handlerFunction === "string" ? config.handlerFunction : void 0;
|
|
5843
6716
|
if (handlerFunction) {
|
|
5844
|
-
const entrypointPath = (0,
|
|
5845
|
-
const source = await
|
|
5846
|
-
const found = await (0,
|
|
6717
|
+
const entrypointPath = (0, import_path13.join)(workPath, entrypoint);
|
|
6718
|
+
const source = await import_fs11.default.promises.readFile(entrypointPath, "utf-8");
|
|
6719
|
+
const found = await (0, import_python_analysis8.containsTopLevelCallable)(source, handlerFunction);
|
|
5847
6720
|
if (!found) {
|
|
5848
|
-
throw new
|
|
6721
|
+
throw new import_build_utils14.NowBuildError({
|
|
5849
6722
|
code: "PYTHON_HANDLER_NOT_FOUND",
|
|
5850
6723
|
message: `Handler function "${handlerFunction}" not found in ${entrypoint}. Ensure it is defined at the module's top level.`
|
|
5851
6724
|
});
|
|
@@ -5854,9 +6727,10 @@ var build = async ({
|
|
|
5854
6727
|
const vendorDir = resolveVendorDir();
|
|
5855
6728
|
const suffix = meta.isDev && !entrypoint.endsWith(".py") ? ".py" : "";
|
|
5856
6729
|
const entrypointWithSuffix = `${entrypoint}${suffix}`;
|
|
5857
|
-
(0,
|
|
6730
|
+
(0, import_build_utils14.debug)("Entrypoint with suffix is", entrypointWithSuffix);
|
|
5858
6731
|
const handlerFuncEnvLine = handlerFunction ? `
|
|
5859
6732
|
"__VC_HANDLER_FUNC_NAME": "${handlerFunction}",` : "";
|
|
6733
|
+
const variableName = hookResult?.variableName ?? detected?.variableName ?? "";
|
|
5860
6734
|
const runtimeTrampoline = `
|
|
5861
6735
|
import importlib
|
|
5862
6736
|
import os
|
|
@@ -5870,7 +6744,8 @@ os.environ.update({
|
|
|
5870
6744
|
"__VC_HANDLER_MODULE_NAME": "${moduleName}",
|
|
5871
6745
|
"__VC_HANDLER_ENTRYPOINT": "${entrypointWithSuffix}",
|
|
5872
6746
|
"__VC_HANDLER_ENTRYPOINT_ABS": os.path.join(_here, "${entrypointWithSuffix}"),
|
|
5873
|
-
"__VC_HANDLER_VENDOR_DIR": "${vendorDir}"
|
|
6747
|
+
"__VC_HANDLER_VENDOR_DIR": "${vendorDir}",
|
|
6748
|
+
"__VC_HANDLER_VARIABLE_NAME": "${variableName}",${handlerFuncEnvLine}
|
|
5874
6749
|
})
|
|
5875
6750
|
|
|
5876
6751
|
_vendor_rel = '${vendorDir}'
|
|
@@ -5919,7 +6794,7 @@ from vercel_runtime.vc_init import vc_handler
|
|
|
5919
6794
|
...djangoStatic.staticRoot ? [djangoStatic.staticRoot] : []
|
|
5920
6795
|
];
|
|
5921
6796
|
for (const absDir of dirsToExclude) {
|
|
5922
|
-
const rel = (0,
|
|
6797
|
+
const rel = (0, import_path13.relative)(workPath, absDir);
|
|
5923
6798
|
if (!rel.startsWith("..")) {
|
|
5924
6799
|
predefinedExcludes.push(`${rel}/**`);
|
|
5925
6800
|
}
|
|
@@ -5928,14 +6803,17 @@ from vercel_runtime.vc_init import vc_handler
|
|
|
5928
6803
|
const lambdaEnv = {};
|
|
5929
6804
|
lambdaEnv.PYTHONPATH = vendorDir;
|
|
5930
6805
|
Object.assign(lambdaEnv, quirksResult.env);
|
|
6806
|
+
if (shouldInstallVercelWorkers) {
|
|
6807
|
+
lambdaEnv.VERCEL_HAS_WORKER_SERVICES = "1";
|
|
6808
|
+
}
|
|
5931
6809
|
const globOptions = {
|
|
5932
6810
|
cwd: workPath,
|
|
5933
6811
|
ignore: config && typeof config.excludeFiles === "string" ? [...predefinedExcludes, config.excludeFiles] : predefinedExcludes
|
|
5934
6812
|
};
|
|
5935
|
-
const files = await (0,
|
|
6813
|
+
const files = await (0, import_build_utils14.glob)("**", globOptions);
|
|
5936
6814
|
if (djangoStatic?.manifestRelPath) {
|
|
5937
|
-
files[djangoStatic.manifestRelPath] = new
|
|
5938
|
-
fsPath: (0,
|
|
6815
|
+
files[djangoStatic.manifestRelPath] = new import_build_utils14.FileFsRef({
|
|
6816
|
+
fsPath: (0, import_path13.join)(workPath, djangoStatic.manifestRelPath)
|
|
5939
6817
|
});
|
|
5940
6818
|
}
|
|
5941
6819
|
const depExternalizer = new PythonDependencyExternalizer({
|
|
@@ -5945,7 +6823,8 @@ from vercel_runtime.vc_init import vc_handler
|
|
|
5945
6823
|
uvLockPath,
|
|
5946
6824
|
uvProjectDir,
|
|
5947
6825
|
projectName,
|
|
5948
|
-
|
|
6826
|
+
pythonMajor: pythonVersion.major,
|
|
6827
|
+
pythonMinor: pythonVersion.minor,
|
|
5949
6828
|
pythonPath: pythonVersion.pythonPath,
|
|
5950
6829
|
hasCustomCommand,
|
|
5951
6830
|
alwaysBundlePackages: [
|
|
@@ -5970,23 +6849,37 @@ from vercel_runtime.vc_init import vc_handler
|
|
|
5970
6849
|
}
|
|
5971
6850
|
});
|
|
5972
6851
|
const handlerPyFilename = "vc__handler__python";
|
|
5973
|
-
files[`${handlerPyFilename}.py`] = new
|
|
6852
|
+
files[`${handlerPyFilename}.py`] = new import_build_utils14.FileBlob({ data: runtimeTrampoline });
|
|
5974
6853
|
if (config.framework === "fasthtml") {
|
|
5975
6854
|
const { SESSKEY = "" } = process.env;
|
|
5976
|
-
files[".sesskey"] = new
|
|
6855
|
+
files[".sesskey"] = new import_build_utils14.FileBlob({ data: `"${SESSKEY}"` });
|
|
5977
6856
|
}
|
|
5978
|
-
const output = new
|
|
6857
|
+
const output = new import_build_utils14.Lambda({
|
|
5979
6858
|
files,
|
|
5980
6859
|
handler: `${handlerPyFilename}.vc_handler`,
|
|
5981
6860
|
runtime: pythonVersion.runtime,
|
|
5982
6861
|
environment: lambdaEnv,
|
|
5983
6862
|
supportsResponseStreaming: true
|
|
5984
6863
|
});
|
|
6864
|
+
if (uvLockPath) {
|
|
6865
|
+
try {
|
|
6866
|
+
await generateProjectManifest({
|
|
6867
|
+
workPath,
|
|
6868
|
+
pythonPackage,
|
|
6869
|
+
pythonVersion,
|
|
6870
|
+
uvLockPath
|
|
6871
|
+
});
|
|
6872
|
+
} catch (err) {
|
|
6873
|
+
(0, import_build_utils14.debug)(
|
|
6874
|
+
`Failed to write project manifest: ${err instanceof Error ? err.message : String(err)}`
|
|
6875
|
+
);
|
|
6876
|
+
}
|
|
6877
|
+
}
|
|
5985
6878
|
return { output };
|
|
5986
6879
|
};
|
|
5987
6880
|
var shouldServe = (opts) => {
|
|
5988
6881
|
const framework = opts.config.framework;
|
|
5989
|
-
if ((0,
|
|
6882
|
+
if ((0, import_build_utils14.isPythonFramework)(framework)) {
|
|
5990
6883
|
const requestPath = opts.requestPath.replace(/\/$/, "");
|
|
5991
6884
|
if (requestPath.startsWith("api") && opts.hasMatched) {
|
|
5992
6885
|
return false;
|
|
@@ -6005,7 +6898,7 @@ var defaultShouldServe = ({
|
|
|
6005
6898
|
if (entrypoint === requestPath && hasProp(files, entrypoint)) {
|
|
6006
6899
|
return true;
|
|
6007
6900
|
}
|
|
6008
|
-
const { dir, name } = (0,
|
|
6901
|
+
const { dir, name } = (0, import_path13.parse)(entrypoint);
|
|
6009
6902
|
if (name === "index" && dir === requestPath && hasProp(files, entrypoint)) {
|
|
6010
6903
|
return true;
|
|
6011
6904
|
}
|
|
@@ -6018,6 +6911,7 @@ function hasProp(obj, key) {
|
|
|
6018
6911
|
0 && (module.exports = {
|
|
6019
6912
|
build,
|
|
6020
6913
|
defaultShouldServe,
|
|
6914
|
+
diagnostics,
|
|
6021
6915
|
downloadFilesInWorkPath,
|
|
6022
6916
|
installRequirement,
|
|
6023
6917
|
installRequirementsFile,
|