@vercel/ruby 2.2.1 → 2.2.2
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 +618 -192
- package/package.json +4 -3
- package/vc_init_dev.rb +83 -0
package/dist/index.js
CHANGED
|
@@ -174,8 +174,8 @@ var require_isexe = __commonJS({
|
|
|
174
174
|
// ../../node_modules/.pnpm/which@1.3.1/node_modules/which/which.js
|
|
175
175
|
var require_which = __commonJS({
|
|
176
176
|
"../../node_modules/.pnpm/which@1.3.1/node_modules/which/which.js"(exports, module2) {
|
|
177
|
-
module2.exports =
|
|
178
|
-
|
|
177
|
+
module2.exports = which3;
|
|
178
|
+
which3.sync = whichSync;
|
|
179
179
|
var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
|
|
180
180
|
var path = require("path");
|
|
181
181
|
var COLON = isWindows ? ";" : ":";
|
|
@@ -206,7 +206,7 @@ var require_which = __commonJS({
|
|
|
206
206
|
extExe: pathExtExe
|
|
207
207
|
};
|
|
208
208
|
}
|
|
209
|
-
function
|
|
209
|
+
function which3(cmd, opt, cb) {
|
|
210
210
|
if (typeof opt === "function") {
|
|
211
211
|
cb = opt;
|
|
212
212
|
opt = {};
|
|
@@ -307,7 +307,7 @@ var require_resolveCommand = __commonJS({
|
|
|
307
307
|
"../../node_modules/.pnpm/cross-spawn@6.0.5/node_modules/cross-spawn/lib/util/resolveCommand.js"(exports, module2) {
|
|
308
308
|
"use strict";
|
|
309
309
|
var path = require("path");
|
|
310
|
-
var
|
|
310
|
+
var which3 = require_which();
|
|
311
311
|
var pathKey = require_path_key()();
|
|
312
312
|
function resolveCommandAttempt(parsed, withoutPathExt) {
|
|
313
313
|
const cwd = process.cwd();
|
|
@@ -320,7 +320,7 @@ var require_resolveCommand = __commonJS({
|
|
|
320
320
|
}
|
|
321
321
|
let resolved;
|
|
322
322
|
try {
|
|
323
|
-
resolved =
|
|
323
|
+
resolved = which3.sync(parsed.command, {
|
|
324
324
|
path: (parsed.options.env || process.env)[pathKey],
|
|
325
325
|
pathExt: withoutPathExt ? path.delimiter : void 0
|
|
326
326
|
});
|
|
@@ -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 debug4;
|
|
427
427
|
if (typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG)) {
|
|
428
|
-
|
|
428
|
+
debug4 = 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
|
+
debug4 = 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
|
+
debug4(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
|
+
debug4("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
|
+
debug4("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
|
+
debug4("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) {
|
|
@@ -695,8 +695,8 @@ var require_semver = __commonJS({
|
|
|
695
695
|
}
|
|
696
696
|
} while (++i2);
|
|
697
697
|
};
|
|
698
|
-
SemVer.prototype.inc = function(
|
|
699
|
-
switch (
|
|
698
|
+
SemVer.prototype.inc = function(release2, identifier) {
|
|
699
|
+
switch (release2) {
|
|
700
700
|
case "premajor":
|
|
701
701
|
this.prerelease.length = 0;
|
|
702
702
|
this.patch = 0;
|
|
@@ -768,20 +768,20 @@ var require_semver = __commonJS({
|
|
|
768
768
|
}
|
|
769
769
|
break;
|
|
770
770
|
default:
|
|
771
|
-
throw new Error("invalid increment argument: " +
|
|
771
|
+
throw new Error("invalid increment argument: " + release2);
|
|
772
772
|
}
|
|
773
773
|
this.format();
|
|
774
774
|
this.raw = this.version;
|
|
775
775
|
return this;
|
|
776
776
|
};
|
|
777
777
|
exports.inc = inc;
|
|
778
|
-
function inc(version2,
|
|
778
|
+
function inc(version2, release2, loose, identifier) {
|
|
779
779
|
if (typeof loose === "string") {
|
|
780
780
|
identifier = loose;
|
|
781
781
|
loose = void 0;
|
|
782
782
|
}
|
|
783
783
|
try {
|
|
784
|
-
return new SemVer(version2, loose).inc(
|
|
784
|
+
return new SemVer(version2, loose).inc(release2, identifier).version;
|
|
785
785
|
} catch (er) {
|
|
786
786
|
return null;
|
|
787
787
|
}
|
|
@@ -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
|
+
debug4("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
|
+
debug4("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
|
+
debug4("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
|
+
debug4("hyphen replace", range);
|
|
1054
1054
|
range = range.replace(safeRe[COMPARATORTRIM], comparatorTrimReplace);
|
|
1055
|
-
|
|
1055
|
+
debug4("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
|
+
debug4("comp", comp, options);
|
|
1096
1096
|
comp = replaceCarets(comp, options);
|
|
1097
|
-
|
|
1097
|
+
debug4("caret", comp);
|
|
1098
1098
|
comp = replaceTildes(comp, options);
|
|
1099
|
-
|
|
1099
|
+
debug4("tildes", comp);
|
|
1100
1100
|
comp = replaceXRanges(comp, options);
|
|
1101
|
-
|
|
1101
|
+
debug4("xrange", comp);
|
|
1102
1102
|
comp = replaceStars(comp, options);
|
|
1103
|
-
|
|
1103
|
+
debug4("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
|
+
debug4("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
|
+
debug4("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
|
+
debug4("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
|
+
debug4("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
|
+
debug4("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
|
+
debug4("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
|
+
debug4("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
|
+
debug4("caret return", ret);
|
|
1180
1180
|
return ret;
|
|
1181
1181
|
});
|
|
1182
1182
|
}
|
|
1183
1183
|
function replaceXRanges(comp, options) {
|
|
1184
|
-
|
|
1184
|
+
debug4("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
|
+
debug4("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
|
+
debug4("xRange return", ret);
|
|
1237
1237
|
return ret;
|
|
1238
1238
|
});
|
|
1239
1239
|
}
|
|
1240
1240
|
function replaceStars(comp, options) {
|
|
1241
|
-
|
|
1241
|
+
debug4("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
|
+
debug4(set[i2].semver);
|
|
1290
1290
|
if (set[i2].semver === ANY) {
|
|
1291
1291
|
continue;
|
|
1292
1292
|
}
|
|
@@ -1631,21 +1631,21 @@ var require_cross_spawn = __commonJS({
|
|
|
1631
1631
|
var cp = require("child_process");
|
|
1632
1632
|
var parse = require_parse();
|
|
1633
1633
|
var enoent = require_enoent();
|
|
1634
|
-
function
|
|
1634
|
+
function spawn2(command, args, options) {
|
|
1635
1635
|
const parsed = parse(command, args, options);
|
|
1636
1636
|
const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
|
|
1637
1637
|
enoent.hookChildProcess(spawned, parsed);
|
|
1638
1638
|
return spawned;
|
|
1639
1639
|
}
|
|
1640
|
-
function
|
|
1640
|
+
function spawnSync2(command, args, options) {
|
|
1641
1641
|
const parsed = parse(command, args, options);
|
|
1642
1642
|
const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
|
|
1643
1643
|
result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
|
|
1644
1644
|
return result;
|
|
1645
1645
|
}
|
|
1646
|
-
module2.exports =
|
|
1647
|
-
module2.exports.spawn =
|
|
1648
|
-
module2.exports.sync =
|
|
1646
|
+
module2.exports = spawn2;
|
|
1647
|
+
module2.exports.spawn = spawn2;
|
|
1648
|
+
module2.exports.sync = spawnSync2;
|
|
1649
1649
|
module2.exports._parse = parse;
|
|
1650
1650
|
module2.exports._enoent = enoent;
|
|
1651
1651
|
}
|
|
@@ -3465,11 +3465,11 @@ var require_graceful_fs = __commonJS({
|
|
|
3465
3465
|
}
|
|
3466
3466
|
});
|
|
3467
3467
|
}
|
|
3468
|
-
var
|
|
3468
|
+
var debug4 = noop;
|
|
3469
3469
|
if (util.debuglog)
|
|
3470
|
-
|
|
3470
|
+
debug4 = util.debuglog("gfs4");
|
|
3471
3471
|
else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ""))
|
|
3472
|
-
|
|
3472
|
+
debug4 = function() {
|
|
3473
3473
|
var m = util.format.apply(util, arguments);
|
|
3474
3474
|
m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
|
|
3475
3475
|
console.error(m);
|
|
@@ -3504,7 +3504,7 @@ var require_graceful_fs = __commonJS({
|
|
|
3504
3504
|
}(fs.closeSync);
|
|
3505
3505
|
if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) {
|
|
3506
3506
|
process.on("exit", function() {
|
|
3507
|
-
|
|
3507
|
+
debug4(fs[gracefulQueue]);
|
|
3508
3508
|
require("assert").equal(fs[gracefulQueue].length, 0);
|
|
3509
3509
|
});
|
|
3510
3510
|
}
|
|
@@ -3757,7 +3757,7 @@ var require_graceful_fs = __commonJS({
|
|
|
3757
3757
|
return fs2;
|
|
3758
3758
|
}
|
|
3759
3759
|
function enqueue(elem) {
|
|
3760
|
-
|
|
3760
|
+
debug4("ENQUEUE", elem[0].name, elem[1]);
|
|
3761
3761
|
fs[gracefulQueue].push(elem);
|
|
3762
3762
|
retry();
|
|
3763
3763
|
}
|
|
@@ -3784,10 +3784,10 @@ var require_graceful_fs = __commonJS({
|
|
|
3784
3784
|
var startTime = elem[3];
|
|
3785
3785
|
var lastTime = elem[4];
|
|
3786
3786
|
if (startTime === void 0) {
|
|
3787
|
-
|
|
3787
|
+
debug4("RETRY", fn.name, args);
|
|
3788
3788
|
fn.apply(null, args);
|
|
3789
3789
|
} else if (Date.now() - startTime >= 6e4) {
|
|
3790
|
-
|
|
3790
|
+
debug4("TIMEOUT", fn.name, args);
|
|
3791
3791
|
var cb = args.pop();
|
|
3792
3792
|
if (typeof cb === "function")
|
|
3793
3793
|
cb.call(null, err);
|
|
@@ -3796,7 +3796,7 @@ var require_graceful_fs = __commonJS({
|
|
|
3796
3796
|
var sinceStart = Math.max(lastTime - startTime, 1);
|
|
3797
3797
|
var desiredDelay = Math.min(sinceStart * 1.2, 100);
|
|
3798
3798
|
if (sinceAttempt >= desiredDelay) {
|
|
3799
|
-
|
|
3799
|
+
debug4("RETRY", fn.name, args);
|
|
3800
3800
|
fn.apply(null, args.concat([startTime]));
|
|
3801
3801
|
} else {
|
|
3802
3802
|
fs[gracefulQueue].push(elem);
|
|
@@ -5281,7 +5281,7 @@ var require_jsonfile = __commonJS({
|
|
|
5281
5281
|
callback(null, obj);
|
|
5282
5282
|
});
|
|
5283
5283
|
}
|
|
5284
|
-
function
|
|
5284
|
+
function readFileSync2(file, options) {
|
|
5285
5285
|
options = options || {};
|
|
5286
5286
|
if (typeof options === "string") {
|
|
5287
5287
|
options = { encoding: options };
|
|
@@ -5335,7 +5335,7 @@ var require_jsonfile = __commonJS({
|
|
|
5335
5335
|
}
|
|
5336
5336
|
fs.writeFile(file, str, options, callback);
|
|
5337
5337
|
}
|
|
5338
|
-
function
|
|
5338
|
+
function writeFileSync2(file, obj, options) {
|
|
5339
5339
|
options = options || {};
|
|
5340
5340
|
var fs = options.fs || _fs;
|
|
5341
5341
|
var str = stringify(obj, options);
|
|
@@ -5349,9 +5349,9 @@ var require_jsonfile = __commonJS({
|
|
|
5349
5349
|
}
|
|
5350
5350
|
var jsonfile = {
|
|
5351
5351
|
readFile: readFile2,
|
|
5352
|
-
readFileSync,
|
|
5352
|
+
readFileSync: readFileSync2,
|
|
5353
5353
|
writeFile: writeFile2,
|
|
5354
|
-
writeFileSync
|
|
5354
|
+
writeFileSync: writeFileSync2
|
|
5355
5355
|
};
|
|
5356
5356
|
module2.exports = jsonfile;
|
|
5357
5357
|
}
|
|
@@ -5702,7 +5702,7 @@ var require_lib = __commonJS({
|
|
|
5702
5702
|
var require_lib2 = __commonJS({
|
|
5703
5703
|
"../../node_modules/.pnpm/which@3.0.0/node_modules/which/lib/index.js"(exports, module2) {
|
|
5704
5704
|
var isexe = require_isexe();
|
|
5705
|
-
var { join:
|
|
5705
|
+
var { join: join4, delimiter, sep, posix } = require("path");
|
|
5706
5706
|
var isWindows = process.platform === "win32";
|
|
5707
5707
|
var rSlash = new RegExp(`[${posix.sep}${sep === posix.sep ? "" : sep}]`.replace(/(\\)/g, "\\$1"));
|
|
5708
5708
|
var rRel = new RegExp(`^\\.${rSlash.source}`);
|
|
@@ -5731,9 +5731,9 @@ var require_lib2 = __commonJS({
|
|
|
5731
5731
|
var getPathPart = (raw, cmd) => {
|
|
5732
5732
|
const pathPart = /^".*"$/.test(raw) ? raw.slice(1, -1) : raw;
|
|
5733
5733
|
const prefix = !pathPart && rRel.test(cmd) ? cmd.slice(0, 2) : "";
|
|
5734
|
-
return prefix +
|
|
5734
|
+
return prefix + join4(pathPart, cmd);
|
|
5735
5735
|
};
|
|
5736
|
-
var
|
|
5736
|
+
var which3 = async (cmd, opt = {}) => {
|
|
5737
5737
|
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
5738
5738
|
const found = [];
|
|
5739
5739
|
for (const envPart of pathEnv) {
|
|
@@ -5781,8 +5781,8 @@ var require_lib2 = __commonJS({
|
|
|
5781
5781
|
}
|
|
5782
5782
|
throw getNotFoundError(cmd);
|
|
5783
5783
|
};
|
|
5784
|
-
module2.exports =
|
|
5785
|
-
|
|
5784
|
+
module2.exports = which3;
|
|
5785
|
+
which3.sync = whichSync;
|
|
5786
5786
|
}
|
|
5787
5787
|
});
|
|
5788
5788
|
|
|
@@ -5790,15 +5790,15 @@ var require_lib2 = __commonJS({
|
|
|
5790
5790
|
var require_semver2 = __commonJS({
|
|
5791
5791
|
"../../node_modules/.pnpm/semver@6.3.1/node_modules/semver/semver.js"(exports, module2) {
|
|
5792
5792
|
exports = module2.exports = SemVer;
|
|
5793
|
-
var
|
|
5793
|
+
var debug4;
|
|
5794
5794
|
if (typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG)) {
|
|
5795
|
-
|
|
5795
|
+
debug4 = function() {
|
|
5796
5796
|
var args = Array.prototype.slice.call(arguments, 0);
|
|
5797
5797
|
args.unshift("SEMVER");
|
|
5798
5798
|
console.log.apply(console, args);
|
|
5799
5799
|
};
|
|
5800
5800
|
} else {
|
|
5801
|
-
|
|
5801
|
+
debug4 = function() {
|
|
5802
5802
|
};
|
|
5803
5803
|
}
|
|
5804
5804
|
exports.SEMVER_SPEC_VERSION = "2.0.0";
|
|
@@ -5916,7 +5916,7 @@ var require_semver2 = __commonJS({
|
|
|
5916
5916
|
tok("STAR");
|
|
5917
5917
|
src[t.STAR] = "(<|>)?=?\\s*\\*";
|
|
5918
5918
|
for (i = 0; i < R; i++) {
|
|
5919
|
-
|
|
5919
|
+
debug4(i, src[i]);
|
|
5920
5920
|
if (!re[i]) {
|
|
5921
5921
|
re[i] = new RegExp(src[i]);
|
|
5922
5922
|
safeRe[i] = new RegExp(makeSafeRe(src[i]));
|
|
@@ -5983,7 +5983,7 @@ var require_semver2 = __commonJS({
|
|
|
5983
5983
|
if (!(this instanceof SemVer)) {
|
|
5984
5984
|
return new SemVer(version2, options);
|
|
5985
5985
|
}
|
|
5986
|
-
|
|
5986
|
+
debug4("SemVer", version2, options);
|
|
5987
5987
|
this.options = options;
|
|
5988
5988
|
this.loose = !!options.loose;
|
|
5989
5989
|
var m = version2.trim().match(options.loose ? safeRe[t.LOOSE] : safeRe[t.FULL]);
|
|
@@ -6030,7 +6030,7 @@ var require_semver2 = __commonJS({
|
|
|
6030
6030
|
return this.version;
|
|
6031
6031
|
};
|
|
6032
6032
|
SemVer.prototype.compare = function(other) {
|
|
6033
|
-
|
|
6033
|
+
debug4("SemVer.compare", this.version, this.options, other);
|
|
6034
6034
|
if (!(other instanceof SemVer)) {
|
|
6035
6035
|
other = new SemVer(other, this.options);
|
|
6036
6036
|
}
|
|
@@ -6057,7 +6057,7 @@ var require_semver2 = __commonJS({
|
|
|
6057
6057
|
do {
|
|
6058
6058
|
var a = this.prerelease[i2];
|
|
6059
6059
|
var b = other.prerelease[i2];
|
|
6060
|
-
|
|
6060
|
+
debug4("prerelease compare", i2, a, b);
|
|
6061
6061
|
if (a === void 0 && b === void 0) {
|
|
6062
6062
|
return 0;
|
|
6063
6063
|
} else if (b === void 0) {
|
|
@@ -6079,7 +6079,7 @@ var require_semver2 = __commonJS({
|
|
|
6079
6079
|
do {
|
|
6080
6080
|
var a = this.build[i2];
|
|
6081
6081
|
var b = other.build[i2];
|
|
6082
|
-
|
|
6082
|
+
debug4("prerelease compare", i2, a, b);
|
|
6083
6083
|
if (a === void 0 && b === void 0) {
|
|
6084
6084
|
return 0;
|
|
6085
6085
|
} else if (b === void 0) {
|
|
@@ -6093,8 +6093,8 @@ var require_semver2 = __commonJS({
|
|
|
6093
6093
|
}
|
|
6094
6094
|
} while (++i2);
|
|
6095
6095
|
};
|
|
6096
|
-
SemVer.prototype.inc = function(
|
|
6097
|
-
switch (
|
|
6096
|
+
SemVer.prototype.inc = function(release2, identifier) {
|
|
6097
|
+
switch (release2) {
|
|
6098
6098
|
case "premajor":
|
|
6099
6099
|
this.prerelease.length = 0;
|
|
6100
6100
|
this.patch = 0;
|
|
@@ -6166,20 +6166,20 @@ var require_semver2 = __commonJS({
|
|
|
6166
6166
|
}
|
|
6167
6167
|
break;
|
|
6168
6168
|
default:
|
|
6169
|
-
throw new Error("invalid increment argument: " +
|
|
6169
|
+
throw new Error("invalid increment argument: " + release2);
|
|
6170
6170
|
}
|
|
6171
6171
|
this.format();
|
|
6172
6172
|
this.raw = this.version;
|
|
6173
6173
|
return this;
|
|
6174
6174
|
};
|
|
6175
6175
|
exports.inc = inc;
|
|
6176
|
-
function inc(version2,
|
|
6176
|
+
function inc(version2, release2, loose, identifier) {
|
|
6177
6177
|
if (typeof loose === "string") {
|
|
6178
6178
|
identifier = loose;
|
|
6179
6179
|
loose = void 0;
|
|
6180
6180
|
}
|
|
6181
6181
|
try {
|
|
6182
|
-
return new SemVer(version2, loose).inc(
|
|
6182
|
+
return new SemVer(version2, loose).inc(release2, identifier).version;
|
|
6183
6183
|
} catch (er) {
|
|
6184
6184
|
return null;
|
|
6185
6185
|
}
|
|
@@ -6339,7 +6339,7 @@ var require_semver2 = __commonJS({
|
|
|
6339
6339
|
return new Comparator(comp, options);
|
|
6340
6340
|
}
|
|
6341
6341
|
comp = comp.trim().split(/\s+/).join(" ");
|
|
6342
|
-
|
|
6342
|
+
debug4("comparator", comp, options);
|
|
6343
6343
|
this.options = options;
|
|
6344
6344
|
this.loose = !!options.loose;
|
|
6345
6345
|
this.parse(comp);
|
|
@@ -6348,7 +6348,7 @@ var require_semver2 = __commonJS({
|
|
|
6348
6348
|
} else {
|
|
6349
6349
|
this.value = this.operator + this.semver.version;
|
|
6350
6350
|
}
|
|
6351
|
-
|
|
6351
|
+
debug4("comp", this);
|
|
6352
6352
|
}
|
|
6353
6353
|
var ANY = {};
|
|
6354
6354
|
Comparator.prototype.parse = function(comp) {
|
|
@@ -6371,7 +6371,7 @@ var require_semver2 = __commonJS({
|
|
|
6371
6371
|
return this.value;
|
|
6372
6372
|
};
|
|
6373
6373
|
Comparator.prototype.test = function(version2) {
|
|
6374
|
-
|
|
6374
|
+
debug4("Comparator.test", version2, this.options.loose);
|
|
6375
6375
|
if (this.semver === ANY || version2 === ANY) {
|
|
6376
6376
|
return true;
|
|
6377
6377
|
}
|
|
@@ -6464,9 +6464,9 @@ var require_semver2 = __commonJS({
|
|
|
6464
6464
|
var loose = this.options.loose;
|
|
6465
6465
|
var hr = loose ? safeRe[t.HYPHENRANGELOOSE] : safeRe[t.HYPHENRANGE];
|
|
6466
6466
|
range = range.replace(hr, hyphenReplace);
|
|
6467
|
-
|
|
6467
|
+
debug4("hyphen replace", range);
|
|
6468
6468
|
range = range.replace(safeRe[t.COMPARATORTRIM], comparatorTrimReplace);
|
|
6469
|
-
|
|
6469
|
+
debug4("comparator trim", range, safeRe[t.COMPARATORTRIM]);
|
|
6470
6470
|
range = range.replace(safeRe[t.TILDETRIM], tildeTrimReplace);
|
|
6471
6471
|
range = range.replace(safeRe[t.CARETTRIM], caretTrimReplace);
|
|
6472
6472
|
range = range.split(/\s+/).join(" ");
|
|
@@ -6519,15 +6519,15 @@ var require_semver2 = __commonJS({
|
|
|
6519
6519
|
});
|
|
6520
6520
|
}
|
|
6521
6521
|
function parseComparator(comp, options) {
|
|
6522
|
-
|
|
6522
|
+
debug4("comp", comp, options);
|
|
6523
6523
|
comp = replaceCarets(comp, options);
|
|
6524
|
-
|
|
6524
|
+
debug4("caret", comp);
|
|
6525
6525
|
comp = replaceTildes(comp, options);
|
|
6526
|
-
|
|
6526
|
+
debug4("tildes", comp);
|
|
6527
6527
|
comp = replaceXRanges(comp, options);
|
|
6528
|
-
|
|
6528
|
+
debug4("xrange", comp);
|
|
6529
6529
|
comp = replaceStars(comp, options);
|
|
6530
|
-
|
|
6530
|
+
debug4("stars", comp);
|
|
6531
6531
|
return comp;
|
|
6532
6532
|
}
|
|
6533
6533
|
function isX(id) {
|
|
@@ -6541,7 +6541,7 @@ var require_semver2 = __commonJS({
|
|
|
6541
6541
|
function replaceTilde(comp, options) {
|
|
6542
6542
|
var r = options.loose ? safeRe[t.TILDELOOSE] : safeRe[t.TILDE];
|
|
6543
6543
|
return comp.replace(r, function(_, M, m, p, pr) {
|
|
6544
|
-
|
|
6544
|
+
debug4("tilde", comp, _, M, m, p, pr);
|
|
6545
6545
|
var ret;
|
|
6546
6546
|
if (isX(M)) {
|
|
6547
6547
|
ret = "";
|
|
@@ -6550,12 +6550,12 @@ var require_semver2 = __commonJS({
|
|
|
6550
6550
|
} else if (isX(p)) {
|
|
6551
6551
|
ret = ">=" + M + "." + m + ".0 <" + M + "." + (+m + 1) + ".0";
|
|
6552
6552
|
} else if (pr) {
|
|
6553
|
-
|
|
6553
|
+
debug4("replaceTilde pr", pr);
|
|
6554
6554
|
ret = ">=" + M + "." + m + "." + p + "-" + pr + " <" + M + "." + (+m + 1) + ".0";
|
|
6555
6555
|
} else {
|
|
6556
6556
|
ret = ">=" + M + "." + m + "." + p + " <" + M + "." + (+m + 1) + ".0";
|
|
6557
6557
|
}
|
|
6558
|
-
|
|
6558
|
+
debug4("tilde return", ret);
|
|
6559
6559
|
return ret;
|
|
6560
6560
|
});
|
|
6561
6561
|
}
|
|
@@ -6565,10 +6565,10 @@ var require_semver2 = __commonJS({
|
|
|
6565
6565
|
}).join(" ");
|
|
6566
6566
|
}
|
|
6567
6567
|
function replaceCaret(comp, options) {
|
|
6568
|
-
|
|
6568
|
+
debug4("caret", comp, options);
|
|
6569
6569
|
var r = options.loose ? safeRe[t.CARETLOOSE] : safeRe[t.CARET];
|
|
6570
6570
|
return comp.replace(r, function(_, M, m, p, pr) {
|
|
6571
|
-
|
|
6571
|
+
debug4("caret", comp, _, M, m, p, pr);
|
|
6572
6572
|
var ret;
|
|
6573
6573
|
if (isX(M)) {
|
|
6574
6574
|
ret = "";
|
|
@@ -6581,7 +6581,7 @@ var require_semver2 = __commonJS({
|
|
|
6581
6581
|
ret = ">=" + M + "." + m + ".0 <" + (+M + 1) + ".0.0";
|
|
6582
6582
|
}
|
|
6583
6583
|
} else if (pr) {
|
|
6584
|
-
|
|
6584
|
+
debug4("replaceCaret pr", pr);
|
|
6585
6585
|
if (M === "0") {
|
|
6586
6586
|
if (m === "0") {
|
|
6587
6587
|
ret = ">=" + M + "." + m + "." + p + "-" + pr + " <" + M + "." + m + "." + (+p + 1);
|
|
@@ -6592,7 +6592,7 @@ var require_semver2 = __commonJS({
|
|
|
6592
6592
|
ret = ">=" + M + "." + m + "." + p + "-" + pr + " <" + (+M + 1) + ".0.0";
|
|
6593
6593
|
}
|
|
6594
6594
|
} else {
|
|
6595
|
-
|
|
6595
|
+
debug4("no pr");
|
|
6596
6596
|
if (M === "0") {
|
|
6597
6597
|
if (m === "0") {
|
|
6598
6598
|
ret = ">=" + M + "." + m + "." + p + " <" + M + "." + m + "." + (+p + 1);
|
|
@@ -6603,12 +6603,12 @@ var require_semver2 = __commonJS({
|
|
|
6603
6603
|
ret = ">=" + M + "." + m + "." + p + " <" + (+M + 1) + ".0.0";
|
|
6604
6604
|
}
|
|
6605
6605
|
}
|
|
6606
|
-
|
|
6606
|
+
debug4("caret return", ret);
|
|
6607
6607
|
return ret;
|
|
6608
6608
|
});
|
|
6609
6609
|
}
|
|
6610
6610
|
function replaceXRanges(comp, options) {
|
|
6611
|
-
|
|
6611
|
+
debug4("replaceXRanges", comp, options);
|
|
6612
6612
|
return comp.split(/\s+/).map(function(comp2) {
|
|
6613
6613
|
return replaceXRange(comp2, options);
|
|
6614
6614
|
}).join(" ");
|
|
@@ -6617,7 +6617,7 @@ var require_semver2 = __commonJS({
|
|
|
6617
6617
|
comp = comp.trim();
|
|
6618
6618
|
var r = options.loose ? safeRe[t.XRANGELOOSE] : safeRe[t.XRANGE];
|
|
6619
6619
|
return comp.replace(r, function(ret, gtlt, M, m, p, pr) {
|
|
6620
|
-
|
|
6620
|
+
debug4("xRange", comp, ret, gtlt, M, m, p, pr);
|
|
6621
6621
|
var xM = isX(M);
|
|
6622
6622
|
var xm = xM || isX(m);
|
|
6623
6623
|
var xp = xm || isX(p);
|
|
@@ -6661,12 +6661,12 @@ var require_semver2 = __commonJS({
|
|
|
6661
6661
|
} else if (xp) {
|
|
6662
6662
|
ret = ">=" + M + "." + m + ".0" + pr + " <" + M + "." + (+m + 1) + ".0" + pr;
|
|
6663
6663
|
}
|
|
6664
|
-
|
|
6664
|
+
debug4("xRange return", ret);
|
|
6665
6665
|
return ret;
|
|
6666
6666
|
});
|
|
6667
6667
|
}
|
|
6668
6668
|
function replaceStars(comp, options) {
|
|
6669
|
-
|
|
6669
|
+
debug4("replaceStars", comp, options);
|
|
6670
6670
|
return comp.trim().replace(safeRe[t.STAR], "");
|
|
6671
6671
|
}
|
|
6672
6672
|
function hyphenReplace($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr, tb) {
|
|
@@ -6718,7 +6718,7 @@ var require_semver2 = __commonJS({
|
|
|
6718
6718
|
}
|
|
6719
6719
|
if (version2.prerelease.length && !options.includePrerelease) {
|
|
6720
6720
|
for (i2 = 0; i2 < set.length; i2++) {
|
|
6721
|
-
|
|
6721
|
+
debug4(set[i2].semver);
|
|
6722
6722
|
if (set[i2].semver === ANY) {
|
|
6723
6723
|
continue;
|
|
6724
6724
|
}
|
|
@@ -6940,14 +6940,16 @@ var require_semver2 = __commonJS({
|
|
|
6940
6940
|
var src_exports = {};
|
|
6941
6941
|
__export(src_exports, {
|
|
6942
6942
|
build: () => build,
|
|
6943
|
+
shouldServe: () => shouldServe,
|
|
6944
|
+
startDevServer: () => startDevServer,
|
|
6943
6945
|
version: () => version
|
|
6944
6946
|
});
|
|
6945
6947
|
module.exports = __toCommonJS(src_exports);
|
|
6946
|
-
var
|
|
6947
|
-
var
|
|
6948
|
+
var import_os2 = require("os");
|
|
6949
|
+
var import_path3 = require("path");
|
|
6948
6950
|
var import_execa2 = __toESM(require_execa());
|
|
6949
6951
|
var import_fs_extra = __toESM(require_lib());
|
|
6950
|
-
var
|
|
6952
|
+
var import_build_utils3 = require("@vercel/build-utils");
|
|
6951
6953
|
|
|
6952
6954
|
// src/install-ruby.ts
|
|
6953
6955
|
var import_execa = __toESM(require_execa());
|
|
@@ -6955,6 +6957,8 @@ var import_which = __toESM(require_lib2());
|
|
|
6955
6957
|
var import_path = require("path");
|
|
6956
6958
|
var import_semver = __toESM(require_semver2());
|
|
6957
6959
|
var import_build_utils = require("@vercel/build-utils");
|
|
6960
|
+
var import_child_process = require("child_process");
|
|
6961
|
+
var import_os = require("os");
|
|
6958
6962
|
var RubyVersion = class extends import_build_utils.Version {
|
|
6959
6963
|
};
|
|
6960
6964
|
var allOptions = [
|
|
@@ -6996,12 +7000,68 @@ function getLatestRubyVersion() {
|
|
|
6996
7000
|
}
|
|
6997
7001
|
return selection;
|
|
6998
7002
|
}
|
|
7003
|
+
function resolveSystemRuby() {
|
|
7004
|
+
const rubyPath = import_which.default.sync("ruby", { nothrow: true });
|
|
7005
|
+
const gemPath = import_which.default.sync("gem", { nothrow: true });
|
|
7006
|
+
if (!rubyPath || !gemPath)
|
|
7007
|
+
return null;
|
|
7008
|
+
const ver = (0, import_child_process.spawnSync)(rubyPath, ["-e", "print RUBY_VERSION"], {
|
|
7009
|
+
encoding: "utf8"
|
|
7010
|
+
});
|
|
7011
|
+
if (ver.status !== 0 || !ver.stdout)
|
|
7012
|
+
return null;
|
|
7013
|
+
const [mj, mn] = String(ver.stdout).trim().split(".");
|
|
7014
|
+
const major = Number(mj) ?? 3;
|
|
7015
|
+
const minor = Number(mn) ?? 3;
|
|
7016
|
+
return { rubyPath, gemPath, major, minor };
|
|
7017
|
+
}
|
|
7018
|
+
function makeLocalRubyEnv({
|
|
7019
|
+
major,
|
|
7020
|
+
minor,
|
|
7021
|
+
rubyPath,
|
|
7022
|
+
gemPath
|
|
7023
|
+
}) {
|
|
7024
|
+
const gemHome = (0, import_path.join)((0, import_os.tmpdir)(), `vercel-ruby-${major}${minor}-${process.pid}`);
|
|
7025
|
+
const matchedOption = allOptions.find(
|
|
7026
|
+
(o) => o.major === major && o.minor === minor && o.state !== "discontinued"
|
|
7027
|
+
);
|
|
7028
|
+
if (!matchedOption) {
|
|
7029
|
+
throw new import_build_utils.NowBuildError({
|
|
7030
|
+
code: "RUBY_INVALID_VERSION",
|
|
7031
|
+
link: "http://vercel.link/ruby-version",
|
|
7032
|
+
message: `Local Ruby ${major}.${minor} does not match any supported Vercel runtime. Supported: ${allOptions.filter((o) => o.state !== "discontinued").map((o) => `${o.major}.${o.minor}`).join(", ")}`
|
|
7033
|
+
});
|
|
7034
|
+
}
|
|
7035
|
+
return {
|
|
7036
|
+
major,
|
|
7037
|
+
gemHome,
|
|
7038
|
+
runtime: matchedOption.runtime,
|
|
7039
|
+
rubyPath,
|
|
7040
|
+
gemPath,
|
|
7041
|
+
vendorPath: `vendor/bundle/ruby/${major}.${minor}.0`
|
|
7042
|
+
};
|
|
7043
|
+
}
|
|
6999
7044
|
function getRubyPath(meta, gemfileContents) {
|
|
7000
|
-
let selection =
|
|
7045
|
+
let selection = null;
|
|
7046
|
+
try {
|
|
7047
|
+
selection = getLatestRubyVersion();
|
|
7048
|
+
} catch {
|
|
7049
|
+
selection = null;
|
|
7050
|
+
}
|
|
7001
7051
|
if (meta.isDev) {
|
|
7002
|
-
|
|
7003
|
-
|
|
7004
|
-
|
|
7052
|
+
const sys2 = resolveSystemRuby();
|
|
7053
|
+
if (sys2) {
|
|
7054
|
+
const result = makeLocalRubyEnv(sys2);
|
|
7055
|
+
(0, import_build_utils.debug)(
|
|
7056
|
+
`ruby: using system ruby for local dev: ${JSON.stringify({ ruby: sys2.rubyPath, gem: sys2.gemPath, version: `${sys2.major}.${sys2.minor}` })}`
|
|
7057
|
+
);
|
|
7058
|
+
return result;
|
|
7059
|
+
}
|
|
7060
|
+
throw new import_build_utils.NowBuildError({
|
|
7061
|
+
code: "RUBY_INVALID_VERSION",
|
|
7062
|
+
link: "http://vercel.link/ruby-version",
|
|
7063
|
+
message: "Unable to find any supported Ruby versions (local). Ensure ruby and gem are on PATH."
|
|
7064
|
+
});
|
|
7005
7065
|
} else if (gemfileContents) {
|
|
7006
7066
|
const line = gemfileContents.split("\n").find((line2) => line2.startsWith("ruby"));
|
|
7007
7067
|
if (line) {
|
|
@@ -7017,30 +7077,60 @@ function getRubyPath(meta, gemfileContents) {
|
|
|
7017
7077
|
link: "http://vercel.link/ruby-version"
|
|
7018
7078
|
});
|
|
7019
7079
|
}
|
|
7020
|
-
if (selection.state === "discontinued" || !isInstalled(selection)) {
|
|
7021
|
-
const
|
|
7022
|
-
|
|
7023
|
-
|
|
7080
|
+
if (!selection || selection.state === "discontinued" || !isInstalled(selection)) {
|
|
7081
|
+
const sys2 = resolveSystemRuby();
|
|
7082
|
+
if (sys2) {
|
|
7083
|
+
const sysRange = `${sys2.major}.${sys2.minor}.x`;
|
|
7084
|
+
if (!strVersion || (0, import_semver.intersects)(sysRange, strVersion)) {
|
|
7085
|
+
const result = makeLocalRubyEnv(sys2);
|
|
7086
|
+
(0, import_build_utils.debug)(
|
|
7087
|
+
`ruby: using system ruby (Gemfile) version=${sys2.major}.${sys2.minor} ruby=${sys2.rubyPath}`
|
|
7088
|
+
);
|
|
7089
|
+
return result;
|
|
7090
|
+
}
|
|
7091
|
+
}
|
|
7092
|
+
let latest = null;
|
|
7093
|
+
try {
|
|
7094
|
+
latest = getLatestRubyVersion();
|
|
7095
|
+
} catch {
|
|
7096
|
+
}
|
|
7097
|
+
const intro = `Found \`Gemfile\` with ${selection && selection.state === "discontinued" ? "discontinued" : "invalid"} Ruby version: \`${line}.\``;
|
|
7098
|
+
const hint = latest ? `Please set \`ruby "~> ${latest.range}"\` in your \`Gemfile\` to use Ruby ${latest.range}.` : "Please update your `Gemfile` to use a supported Ruby version.";
|
|
7024
7099
|
throw new import_build_utils.NowBuildError({
|
|
7025
|
-
code: selection.state === "discontinued" ? "RUBY_DISCONTINUED_VERSION" : "RUBY_INVALID_VERSION",
|
|
7100
|
+
code: selection && selection.state === "discontinued" ? "RUBY_DISCONTINUED_VERSION" : "RUBY_INVALID_VERSION",
|
|
7026
7101
|
link: "http://vercel.link/ruby-version",
|
|
7027
7102
|
message: `${intro} ${hint}`
|
|
7028
7103
|
});
|
|
7029
7104
|
}
|
|
7030
7105
|
}
|
|
7031
7106
|
}
|
|
7032
|
-
|
|
7033
|
-
|
|
7034
|
-
|
|
7035
|
-
|
|
7036
|
-
|
|
7037
|
-
|
|
7038
|
-
|
|
7039
|
-
|
|
7040
|
-
|
|
7041
|
-
|
|
7042
|
-
|
|
7043
|
-
|
|
7107
|
+
if (selection) {
|
|
7108
|
+
const { major, minor, runtime } = selection;
|
|
7109
|
+
const gemHome = "/ruby" + major + minor;
|
|
7110
|
+
const result = {
|
|
7111
|
+
major,
|
|
7112
|
+
gemHome,
|
|
7113
|
+
runtime,
|
|
7114
|
+
rubyPath: (0, import_path.join)(gemHome, "bin", "ruby"),
|
|
7115
|
+
gemPath: (0, import_path.join)(gemHome, "bin", "gem"),
|
|
7116
|
+
vendorPath: `vendor/bundle/ruby/${major}.${minor}.0`
|
|
7117
|
+
};
|
|
7118
|
+
(0, import_build_utils.debug)(JSON.stringify(result, null, " "));
|
|
7119
|
+
return result;
|
|
7120
|
+
}
|
|
7121
|
+
const sys = resolveSystemRuby();
|
|
7122
|
+
if (sys) {
|
|
7123
|
+
const result = makeLocalRubyEnv(sys);
|
|
7124
|
+
(0, import_build_utils.debug)(
|
|
7125
|
+
`ruby: using system ruby (fallback) version=${sys.major}.${sys.minor} ruby=${sys.rubyPath}`
|
|
7126
|
+
);
|
|
7127
|
+
return result;
|
|
7128
|
+
}
|
|
7129
|
+
throw new import_build_utils.NowBuildError({
|
|
7130
|
+
code: "RUBY_INVALID_VERSION",
|
|
7131
|
+
link: "http://vercel.link/ruby-version",
|
|
7132
|
+
message: "Unable to find any supported Ruby versions."
|
|
7133
|
+
});
|
|
7044
7134
|
}
|
|
7045
7135
|
async function installBundler(meta, gemfileContents) {
|
|
7046
7136
|
const { gemHome, rubyPath, gemPath, vendorPath, runtime, major } = getRubyPath(meta, gemfileContents);
|
|
@@ -7066,6 +7156,292 @@ function isInstalled({ major, minor }) {
|
|
|
7066
7156
|
return Boolean(import_which.default.sync((0, import_path.join)(gemHome, "bin/ruby"), { nothrow: true })) && Boolean(import_which.default.sync((0, import_path.join)(gemHome, "bin/gem"), { nothrow: true }));
|
|
7067
7157
|
}
|
|
7068
7158
|
|
|
7159
|
+
// src/start-dev-server.ts
|
|
7160
|
+
var import_child_process2 = require("child_process");
|
|
7161
|
+
var import_fs = require("fs");
|
|
7162
|
+
var import_path2 = require("path");
|
|
7163
|
+
var import_which2 = __toESM(require_lib2());
|
|
7164
|
+
var import_build_utils2 = require("@vercel/build-utils");
|
|
7165
|
+
function silenceNodeWarnings() {
|
|
7166
|
+
const original = process.emitWarning.bind(
|
|
7167
|
+
process
|
|
7168
|
+
);
|
|
7169
|
+
let active = true;
|
|
7170
|
+
const wrapped = (warning, ...args) => {
|
|
7171
|
+
if (!active) {
|
|
7172
|
+
return original(
|
|
7173
|
+
warning,
|
|
7174
|
+
...args
|
|
7175
|
+
);
|
|
7176
|
+
}
|
|
7177
|
+
return;
|
|
7178
|
+
};
|
|
7179
|
+
process.emitWarning = wrapped;
|
|
7180
|
+
return () => {
|
|
7181
|
+
if (!active)
|
|
7182
|
+
return;
|
|
7183
|
+
active = false;
|
|
7184
|
+
if (process.emitWarning === wrapped) {
|
|
7185
|
+
process.emitWarning = original;
|
|
7186
|
+
}
|
|
7187
|
+
};
|
|
7188
|
+
}
|
|
7189
|
+
var PERSISTENT_SERVERS = /* @__PURE__ */ new Map();
|
|
7190
|
+
var PENDING_STARTS = /* @__PURE__ */ new Map();
|
|
7191
|
+
var restoreWarnings = null;
|
|
7192
|
+
var cleanupHandlersInstalled = false;
|
|
7193
|
+
function installGlobalCleanupHandlers() {
|
|
7194
|
+
if (cleanupHandlersInstalled)
|
|
7195
|
+
return;
|
|
7196
|
+
cleanupHandlersInstalled = true;
|
|
7197
|
+
const killAll = () => {
|
|
7198
|
+
for (const [key, info] of PERSISTENT_SERVERS.entries()) {
|
|
7199
|
+
try {
|
|
7200
|
+
process.kill(info.pid, "SIGTERM");
|
|
7201
|
+
} catch (err) {
|
|
7202
|
+
(0, import_build_utils2.debug)(`Error sending SIGTERM to ${info.pid}: ${err}`);
|
|
7203
|
+
}
|
|
7204
|
+
try {
|
|
7205
|
+
process.kill(info.pid, "SIGKILL");
|
|
7206
|
+
} catch (err) {
|
|
7207
|
+
(0, import_build_utils2.debug)(`Error sending SIGKILL to ${info.pid}: ${err}`);
|
|
7208
|
+
}
|
|
7209
|
+
PERSISTENT_SERVERS.delete(key);
|
|
7210
|
+
}
|
|
7211
|
+
if (restoreWarnings) {
|
|
7212
|
+
try {
|
|
7213
|
+
restoreWarnings();
|
|
7214
|
+
} catch (err) {
|
|
7215
|
+
(0, import_build_utils2.debug)(`Error restoring warnings: ${err}`);
|
|
7216
|
+
}
|
|
7217
|
+
restoreWarnings = null;
|
|
7218
|
+
}
|
|
7219
|
+
};
|
|
7220
|
+
process.on("SIGINT", () => {
|
|
7221
|
+
killAll();
|
|
7222
|
+
process.exit(130);
|
|
7223
|
+
});
|
|
7224
|
+
process.on("SIGTERM", () => {
|
|
7225
|
+
killAll();
|
|
7226
|
+
process.exit(143);
|
|
7227
|
+
});
|
|
7228
|
+
process.on("exit", () => {
|
|
7229
|
+
killAll();
|
|
7230
|
+
});
|
|
7231
|
+
}
|
|
7232
|
+
function createDevRubyShim(workPath, entrypoint) {
|
|
7233
|
+
try {
|
|
7234
|
+
const vercelRubyDir = (0, import_path2.join)(workPath, ".vercel", "ruby");
|
|
7235
|
+
(0, import_fs.mkdirSync)(vercelRubyDir, { recursive: true });
|
|
7236
|
+
const shimPath = (0, import_path2.join)(vercelRubyDir, `vc_init_dev.rb`);
|
|
7237
|
+
const templatePath = (0, import_path2.join)(__dirname, "..", "vc_init_dev.rb");
|
|
7238
|
+
const template = (0, import_fs.readFileSync)(templatePath, "utf8");
|
|
7239
|
+
const shimSource = template.replace(/__VC_DEV_ENTRYPOINT__/g, entrypoint);
|
|
7240
|
+
(0, import_fs.writeFileSync)(shimPath, shimSource, "utf8");
|
|
7241
|
+
(0, import_build_utils2.debug)(`Prepared Ruby dev shim at ${shimPath}`);
|
|
7242
|
+
return shimPath;
|
|
7243
|
+
} catch (err) {
|
|
7244
|
+
(0, import_build_utils2.debug)(`Failed to prepare Ruby dev shim: ${err?.message || err}`);
|
|
7245
|
+
return null;
|
|
7246
|
+
}
|
|
7247
|
+
}
|
|
7248
|
+
function detectGemfile(workPath, entrypoint) {
|
|
7249
|
+
const entryDir = (0, import_path2.dirname)(entrypoint);
|
|
7250
|
+
const localGemfile = (0, import_path2.join)(workPath, entryDir, "Gemfile");
|
|
7251
|
+
if ((0, import_fs.existsSync)(localGemfile))
|
|
7252
|
+
return localGemfile;
|
|
7253
|
+
const rootGemfile = (0, import_path2.join)(workPath, "Gemfile");
|
|
7254
|
+
if ((0, import_fs.existsSync)(rootGemfile))
|
|
7255
|
+
return rootGemfile;
|
|
7256
|
+
return null;
|
|
7257
|
+
}
|
|
7258
|
+
async function run(cmd, args, opts) {
|
|
7259
|
+
return await new Promise((resolve) => {
|
|
7260
|
+
const child = (0, import_child_process2.spawn)(cmd, args, {
|
|
7261
|
+
cwd: opts.cwd,
|
|
7262
|
+
env: opts.env,
|
|
7263
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
7264
|
+
});
|
|
7265
|
+
child.stdout?.on("data", (buf) => process.stdout.write(buf));
|
|
7266
|
+
child.stderr?.on("data", (buf) => process.stderr.write(buf));
|
|
7267
|
+
child.on("close", (code, signal) => resolve({ code, signal }));
|
|
7268
|
+
});
|
|
7269
|
+
}
|
|
7270
|
+
var startDevServer = async (opts) => {
|
|
7271
|
+
const { entrypoint: rawEntrypoint, workPath, meta = {} } = opts;
|
|
7272
|
+
if (!rawEntrypoint.endsWith(".ru")) {
|
|
7273
|
+
return null;
|
|
7274
|
+
}
|
|
7275
|
+
if (!restoreWarnings)
|
|
7276
|
+
restoreWarnings = silenceNodeWarnings();
|
|
7277
|
+
installGlobalCleanupHandlers();
|
|
7278
|
+
const entrypoint = rawEntrypoint;
|
|
7279
|
+
const env = { ...process.env, ...meta.env || {} };
|
|
7280
|
+
const serverKey = `${workPath}::${entrypoint}::ruby`;
|
|
7281
|
+
const existing = PERSISTENT_SERVERS.get(serverKey);
|
|
7282
|
+
if (existing) {
|
|
7283
|
+
return {
|
|
7284
|
+
port: existing.port,
|
|
7285
|
+
pid: existing.pid,
|
|
7286
|
+
shutdown: async () => {
|
|
7287
|
+
}
|
|
7288
|
+
};
|
|
7289
|
+
}
|
|
7290
|
+
const pending = PENDING_STARTS.get(serverKey);
|
|
7291
|
+
if (pending) {
|
|
7292
|
+
const { port, pid } = await pending;
|
|
7293
|
+
return { port, pid, shutdown: async () => {
|
|
7294
|
+
} };
|
|
7295
|
+
}
|
|
7296
|
+
let childProcess = null;
|
|
7297
|
+
let stdoutLogListener = null;
|
|
7298
|
+
let stderrLogListener = null;
|
|
7299
|
+
let resolveChildReady;
|
|
7300
|
+
let rejectChildReady;
|
|
7301
|
+
const childReady = new Promise(
|
|
7302
|
+
(resolve, reject) => {
|
|
7303
|
+
resolveChildReady = resolve;
|
|
7304
|
+
rejectChildReady = reject;
|
|
7305
|
+
}
|
|
7306
|
+
);
|
|
7307
|
+
PENDING_STARTS.set(serverKey, childReady);
|
|
7308
|
+
try {
|
|
7309
|
+
await new Promise((resolve, reject) => {
|
|
7310
|
+
let resolved = false;
|
|
7311
|
+
const shimPath = createDevRubyShim(workPath, entrypoint);
|
|
7312
|
+
if (!shimPath) {
|
|
7313
|
+
rejectChildReady(
|
|
7314
|
+
new import_build_utils2.NowBuildError({
|
|
7315
|
+
code: "RUBY_DEV_SHIM_ERROR",
|
|
7316
|
+
message: "Failed to create Ruby dev shim."
|
|
7317
|
+
})
|
|
7318
|
+
);
|
|
7319
|
+
return reject(new Error("Failed to create Ruby dev shim"));
|
|
7320
|
+
}
|
|
7321
|
+
const gemfile = detectGemfile(workPath, entrypoint);
|
|
7322
|
+
const bundlePath = import_which2.default.sync("bundle", { nothrow: true });
|
|
7323
|
+
const bundlerPath = bundlePath || import_which2.default.sync("bundler", { nothrow: true });
|
|
7324
|
+
const projectDir = gemfile ? (0, import_path2.dirname)(gemfile) : workPath;
|
|
7325
|
+
if (gemfile) {
|
|
7326
|
+
env.BUNDLE_GEMFILE = gemfile;
|
|
7327
|
+
}
|
|
7328
|
+
const checkDeps = async () => {
|
|
7329
|
+
if (gemfile && bundlerPath) {
|
|
7330
|
+
(0, import_build_utils2.debug)(`Running "bundle check" for ${gemfile}`);
|
|
7331
|
+
const check = await run(
|
|
7332
|
+
bundlerPath,
|
|
7333
|
+
["check", "--gemfile", gemfile],
|
|
7334
|
+
{ cwd: projectDir, env }
|
|
7335
|
+
);
|
|
7336
|
+
if (check.code !== 0) {
|
|
7337
|
+
return false;
|
|
7338
|
+
}
|
|
7339
|
+
}
|
|
7340
|
+
return true;
|
|
7341
|
+
};
|
|
7342
|
+
checkDeps().then((ok) => {
|
|
7343
|
+
if (!ok) {
|
|
7344
|
+
const err = new import_build_utils2.NowBuildError({
|
|
7345
|
+
code: "RUBY_GEMS_MISSING",
|
|
7346
|
+
message: 'Required gems are not installed. Run "vercel build" and try again.'
|
|
7347
|
+
});
|
|
7348
|
+
rejectChildReady(err);
|
|
7349
|
+
return reject(err);
|
|
7350
|
+
}
|
|
7351
|
+
let cmd = "ruby";
|
|
7352
|
+
let args = [shimPath];
|
|
7353
|
+
if (gemfile && bundlerPath) {
|
|
7354
|
+
cmd = bundlerPath;
|
|
7355
|
+
args = ["exec", "ruby", shimPath];
|
|
7356
|
+
}
|
|
7357
|
+
(0, import_build_utils2.debug)(`Starting Ruby dev server: ${cmd} ${args.join(" ")}`);
|
|
7358
|
+
const child = (0, import_child_process2.spawn)(cmd, args, {
|
|
7359
|
+
cwd: workPath,
|
|
7360
|
+
env,
|
|
7361
|
+
stdio: ["inherit", "pipe", "pipe"]
|
|
7362
|
+
});
|
|
7363
|
+
childProcess = child;
|
|
7364
|
+
stdoutLogListener = (buf) => {
|
|
7365
|
+
const s = buf.toString();
|
|
7366
|
+
for (const line of s.split(/\r?\n/)) {
|
|
7367
|
+
if (line)
|
|
7368
|
+
process.stdout.write(line.endsWith("\n") ? line : line + "\n");
|
|
7369
|
+
}
|
|
7370
|
+
};
|
|
7371
|
+
stderrLogListener = (buf) => {
|
|
7372
|
+
const s = buf.toString();
|
|
7373
|
+
for (const line of s.split(/\r?\n/)) {
|
|
7374
|
+
if (line)
|
|
7375
|
+
process.stderr.write(line.endsWith("\n") ? line : line + "\n");
|
|
7376
|
+
}
|
|
7377
|
+
};
|
|
7378
|
+
child.stdout?.on("data", stdoutLogListener);
|
|
7379
|
+
child.stderr?.on("data", stderrLogListener);
|
|
7380
|
+
const readinessRegexes = [
|
|
7381
|
+
/Serving on https?:\/\/(?:\[[^\]]+\]|[^:\s]+):(\d+)/i,
|
|
7382
|
+
/WEBrick.*?listening on.*?:(\d+)/i
|
|
7383
|
+
];
|
|
7384
|
+
const onDetect = (chunk) => {
|
|
7385
|
+
const text = chunk.toString();
|
|
7386
|
+
let portMatch = null;
|
|
7387
|
+
for (const rx of readinessRegexes) {
|
|
7388
|
+
const m = text.match(rx);
|
|
7389
|
+
if (m) {
|
|
7390
|
+
portMatch = m;
|
|
7391
|
+
break;
|
|
7392
|
+
}
|
|
7393
|
+
}
|
|
7394
|
+
if (portMatch && child.pid) {
|
|
7395
|
+
if (!resolved) {
|
|
7396
|
+
resolved = true;
|
|
7397
|
+
child.stdout?.removeListener("data", onDetect);
|
|
7398
|
+
child.stderr?.removeListener("data", onDetect);
|
|
7399
|
+
const port2 = Number(portMatch[1]);
|
|
7400
|
+
resolveChildReady({ port: port2, pid: child.pid });
|
|
7401
|
+
resolve();
|
|
7402
|
+
}
|
|
7403
|
+
}
|
|
7404
|
+
};
|
|
7405
|
+
child.stdout?.on("data", onDetect);
|
|
7406
|
+
child.stderr?.on("data", onDetect);
|
|
7407
|
+
child.once("error", (err) => {
|
|
7408
|
+
if (!resolved) {
|
|
7409
|
+
rejectChildReady(err);
|
|
7410
|
+
reject(err);
|
|
7411
|
+
}
|
|
7412
|
+
});
|
|
7413
|
+
child.once("exit", (code, signal) => {
|
|
7414
|
+
if (!resolved) {
|
|
7415
|
+
const err = new Error(
|
|
7416
|
+
`Ruby dev server exited before binding (code=${code}, signal=${signal})`
|
|
7417
|
+
);
|
|
7418
|
+
rejectChildReady(err);
|
|
7419
|
+
reject(err);
|
|
7420
|
+
}
|
|
7421
|
+
});
|
|
7422
|
+
}).catch((err) => {
|
|
7423
|
+
if (!resolved) {
|
|
7424
|
+
rejectChildReady(err);
|
|
7425
|
+
reject(err);
|
|
7426
|
+
}
|
|
7427
|
+
});
|
|
7428
|
+
});
|
|
7429
|
+
const { port, pid } = await childReady;
|
|
7430
|
+
PERSISTENT_SERVERS.set(serverKey, {
|
|
7431
|
+
port,
|
|
7432
|
+
pid,
|
|
7433
|
+
child: childProcess,
|
|
7434
|
+
stdoutLogListener,
|
|
7435
|
+
stderrLogListener
|
|
7436
|
+
});
|
|
7437
|
+
const shutdown = async () => {
|
|
7438
|
+
};
|
|
7439
|
+
return { port, pid, shutdown };
|
|
7440
|
+
} finally {
|
|
7441
|
+
PENDING_STARTS.delete(serverKey);
|
|
7442
|
+
}
|
|
7443
|
+
};
|
|
7444
|
+
|
|
7069
7445
|
// src/index.ts
|
|
7070
7446
|
async function matchPaths(configPatterns, workPath) {
|
|
7071
7447
|
const patterns = typeof configPatterns === "string" ? [configPatterns] : configPatterns;
|
|
@@ -7074,65 +7450,98 @@ async function matchPaths(configPatterns, workPath) {
|
|
|
7074
7450
|
}
|
|
7075
7451
|
const patternPaths = await Promise.all(
|
|
7076
7452
|
patterns.map(async (pattern) => {
|
|
7077
|
-
const files = await (0,
|
|
7453
|
+
const files = await (0, import_build_utils3.glob)(pattern, workPath);
|
|
7078
7454
|
return Object.keys(files);
|
|
7079
7455
|
})
|
|
7080
7456
|
);
|
|
7081
7457
|
return patternPaths.reduce((a, b) => a.concat(b), []);
|
|
7082
7458
|
}
|
|
7083
|
-
async function
|
|
7084
|
-
(0,
|
|
7085
|
-
|
|
7086
|
-
const
|
|
7087
|
-
|
|
7088
|
-
|
|
7089
|
-
|
|
7090
|
-
|
|
7091
|
-
|
|
7092
|
-
|
|
7093
|
-
|
|
7094
|
-
|
|
7095
|
-
|
|
7096
|
-
|
|
7097
|
-
|
|
7098
|
-
|
|
7099
|
-
gemfilePath,
|
|
7100
|
-
gemfileContent.replace('ruby "~> 3.3.x"', 'ruby "~> 3.3.0"')
|
|
7101
|
-
);
|
|
7459
|
+
async function prepareGemfile(gemfilePath, major) {
|
|
7460
|
+
let gemfile = await (0, import_fs_extra.readFile)(gemfilePath, "utf8");
|
|
7461
|
+
let modified = false;
|
|
7462
|
+
const patchRuby = (from, to) => {
|
|
7463
|
+
if (gemfile.includes(from)) {
|
|
7464
|
+
gemfile = gemfile.replace(from, to);
|
|
7465
|
+
modified = true;
|
|
7466
|
+
}
|
|
7467
|
+
};
|
|
7468
|
+
patchRuby('ruby "~> 3.3.x"', 'ruby "~> 3.3.0"');
|
|
7469
|
+
patchRuby('ruby "~> 3.2.x"', 'ruby "~> 3.2.0"');
|
|
7470
|
+
patchRuby('ruby "~> 2.7.x"', 'ruby "~> 2.7.0"');
|
|
7471
|
+
const containsWebrick = /^[^#]*\bgem\s+["']webrick["']/m.test(gemfile);
|
|
7472
|
+
if (major >= 3 && !containsWebrick) {
|
|
7473
|
+
gemfile += `${import_os2.EOL}gem "webrick"${import_os2.EOL}`;
|
|
7474
|
+
modified = true;
|
|
7102
7475
|
}
|
|
7103
|
-
|
|
7104
|
-
|
|
7105
|
-
|
|
7476
|
+
if (modified) {
|
|
7477
|
+
await (0, import_fs_extra.writeFile)(gemfilePath, gemfile);
|
|
7478
|
+
}
|
|
7479
|
+
return { modified };
|
|
7480
|
+
}
|
|
7481
|
+
async function bundleLock(bundlerPath, gemfilePath, rubyPath) {
|
|
7482
|
+
const bundleAppConfig = await (0, import_build_utils3.getWriteableDirectory)();
|
|
7483
|
+
const bundlerEnv = (0, import_build_utils3.cloneEnv)(process.env, {
|
|
7484
|
+
PATH: `${(0, import_path3.dirname)(rubyPath)}:${(0, import_path3.dirname)(bundlerPath)}:${process.env.PATH}`,
|
|
7106
7485
|
BUNDLE_SILENCE_ROOT_WARNING: "1",
|
|
7107
7486
|
BUNDLE_APP_CONFIG: bundleAppConfig,
|
|
7108
7487
|
BUNDLE_JOBS: "4"
|
|
7109
7488
|
});
|
|
7110
|
-
|
|
7111
|
-
|
|
7112
|
-
|
|
7113
|
-
|
|
7114
|
-
|
|
7115
|
-
|
|
7116
|
-
}
|
|
7117
|
-
|
|
7118
|
-
|
|
7119
|
-
|
|
7120
|
-
|
|
7121
|
-
|
|
7489
|
+
const archTokenLinux = process.arch === "arm64" ? "aarch64" : "x86_64";
|
|
7490
|
+
const linuxPlatform = `${archTokenLinux}-linux`;
|
|
7491
|
+
const platforms = [linuxPlatform];
|
|
7492
|
+
if (process.platform === "darwin") {
|
|
7493
|
+
const darwinArchToken = process.arch === "arm64" ? "arm64" : "x86_64";
|
|
7494
|
+
const darwinMajor = Number((0, import_os2.release)().split(".")[0]) || void 0;
|
|
7495
|
+
const darwinPlatform = darwinMajor ? `${darwinArchToken}-darwin-${darwinMajor}` : `${darwinArchToken}-darwin`;
|
|
7496
|
+
platforms.push(darwinPlatform);
|
|
7497
|
+
}
|
|
7498
|
+
(0, import_build_utils3.debug)(`ruby: ensuring Gemfile.lock has platforms ${platforms.join(", ")}`);
|
|
7499
|
+
const lockArgs = ["lock"];
|
|
7500
|
+
for (const platform of platforms) {
|
|
7501
|
+
lockArgs.push("--add-platform", platform);
|
|
7502
|
+
}
|
|
7503
|
+
const lockRes = await (0, import_execa2.default)(bundlerPath, lockArgs, {
|
|
7504
|
+
cwd: (0, import_path3.dirname)(gemfilePath),
|
|
7505
|
+
stdio: "pipe",
|
|
7506
|
+
env: bundlerEnv,
|
|
7507
|
+
reject: false
|
|
7508
|
+
});
|
|
7509
|
+
if (lockRes.exitCode !== 0) {
|
|
7510
|
+
console.log(lockRes.stdout);
|
|
7511
|
+
console.error(lockRes.stderr);
|
|
7512
|
+
throw lockRes;
|
|
7122
7513
|
}
|
|
7123
|
-
|
|
7514
|
+
}
|
|
7515
|
+
async function bundleInstall(bundlePath, bundleDir, gemfilePath, rubyPath) {
|
|
7516
|
+
const bundleAppConfig = await (0, import_build_utils3.getWriteableDirectory)();
|
|
7517
|
+
const bundlerEnv = (0, import_build_utils3.cloneEnv)(process.env, {
|
|
7518
|
+
PATH: `${(0, import_path3.dirname)(rubyPath)}:${(0, import_path3.dirname)(bundlePath)}:${process.env.PATH}`,
|
|
7519
|
+
BUNDLE_SILENCE_ROOT_WARNING: "1",
|
|
7520
|
+
BUNDLE_APP_CONFIG: bundleAppConfig,
|
|
7521
|
+
BUNDLE_JOBS: "4"
|
|
7522
|
+
});
|
|
7523
|
+
(0, import_build_utils3.debug)('running "bundle install --deployment --frozen"');
|
|
7524
|
+
const installRes = await (0, import_execa2.default)(
|
|
7124
7525
|
bundlePath,
|
|
7125
|
-
[
|
|
7526
|
+
[
|
|
7527
|
+
"install",
|
|
7528
|
+
"--deployment",
|
|
7529
|
+
"--frozen",
|
|
7530
|
+
"--gemfile",
|
|
7531
|
+
gemfilePath,
|
|
7532
|
+
"--path",
|
|
7533
|
+
bundleDir
|
|
7534
|
+
],
|
|
7126
7535
|
{
|
|
7127
7536
|
stdio: "pipe",
|
|
7128
7537
|
env: bundlerEnv,
|
|
7129
7538
|
reject: false
|
|
7130
7539
|
}
|
|
7131
7540
|
);
|
|
7132
|
-
if (
|
|
7133
|
-
console.log(
|
|
7134
|
-
console.error(
|
|
7135
|
-
throw
|
|
7541
|
+
if (installRes.exitCode !== 0) {
|
|
7542
|
+
console.log(installRes.stdout);
|
|
7543
|
+
console.error(installRes.stderr);
|
|
7544
|
+
throw installRes;
|
|
7136
7545
|
}
|
|
7137
7546
|
}
|
|
7138
7547
|
var version = 3;
|
|
@@ -7143,66 +7552,80 @@ var build = async ({
|
|
|
7143
7552
|
config,
|
|
7144
7553
|
meta = {}
|
|
7145
7554
|
}) => {
|
|
7146
|
-
await (0,
|
|
7147
|
-
const entrypointFsDirname = (0,
|
|
7555
|
+
await (0, import_build_utils3.download)(files, workPath, meta);
|
|
7556
|
+
const entrypointFsDirname = (0, import_path3.join)(workPath, (0, import_path3.dirname)(entrypoint));
|
|
7148
7557
|
const gemfileName = "Gemfile";
|
|
7149
|
-
let gemfilePath = await (0,
|
|
7558
|
+
let gemfilePath = await (0, import_build_utils3.walkParentDirs)({
|
|
7150
7559
|
base: workPath,
|
|
7151
7560
|
start: entrypointFsDirname,
|
|
7152
7561
|
filename: gemfileName
|
|
7153
7562
|
});
|
|
7154
7563
|
if (!gemfilePath) {
|
|
7155
|
-
gemfilePath = (0,
|
|
7156
|
-
await (0, import_fs_extra.writeFile)(gemfilePath, `source "https://rubygems.org"${
|
|
7564
|
+
gemfilePath = (0, import_path3.join)(entrypointFsDirname, gemfileName);
|
|
7565
|
+
await (0, import_fs_extra.writeFile)(gemfilePath, `source "https://rubygems.org"${import_os2.EOL}`);
|
|
7157
7566
|
}
|
|
7158
7567
|
const gemfileContents = gemfilePath ? await (0, import_fs_extra.readFile)(gemfilePath, "utf8") : "";
|
|
7159
7568
|
const { gemHome, bundlerPath, vendorPath, runtime, rubyPath, major } = await installBundler(meta, gemfileContents);
|
|
7160
7569
|
process.env.GEM_HOME = gemHome;
|
|
7161
|
-
|
|
7162
|
-
|
|
7163
|
-
|
|
7164
|
-
|
|
7570
|
+
try {
|
|
7571
|
+
(0, import_build_utils3.debug)("preparing Gemfile");
|
|
7572
|
+
await prepareGemfile(gemfilePath, major);
|
|
7573
|
+
(0, import_build_utils3.debug)('running "bundle lock"');
|
|
7574
|
+
await bundleLock(bundlerPath, gemfilePath, rubyPath);
|
|
7575
|
+
} catch (err) {
|
|
7576
|
+
(0, import_build_utils3.debug)(
|
|
7577
|
+
"failed to normalize Gemfile/lockfile before vendor check",
|
|
7578
|
+
err
|
|
7579
|
+
);
|
|
7580
|
+
}
|
|
7581
|
+
(0, import_build_utils3.debug)(`Checking existing vendor directory at "${vendorPath}"`);
|
|
7582
|
+
const vendorDir = (0, import_path3.join)(workPath, vendorPath);
|
|
7583
|
+
const bundleDir = (0, import_path3.join)(workPath, "vendor", "bundle");
|
|
7584
|
+
const relativeVendorDir = (0, import_path3.join)(entrypointFsDirname, vendorPath);
|
|
7165
7585
|
const hasRootVendorDir = await (0, import_fs_extra.pathExists)(vendorDir);
|
|
7166
7586
|
const hasRelativeVendorDir = await (0, import_fs_extra.pathExists)(relativeVendorDir);
|
|
7167
|
-
const hasVendorDir = hasRootVendorDir || hasRelativeVendorDir;
|
|
7168
7587
|
if (hasRelativeVendorDir) {
|
|
7169
7588
|
if (hasRootVendorDir) {
|
|
7170
|
-
(0,
|
|
7589
|
+
(0, import_build_utils3.debug)(
|
|
7171
7590
|
"found two vendor directories, choosing the vendor directory relative to entrypoint"
|
|
7172
7591
|
);
|
|
7173
7592
|
} else {
|
|
7174
|
-
(0,
|
|
7593
|
+
(0, import_build_utils3.debug)("found vendor directory relative to entrypoint");
|
|
7175
7594
|
}
|
|
7176
7595
|
await (0, import_fs_extra.move)(relativeVendorDir, vendorDir);
|
|
7177
7596
|
} else if (hasRootVendorDir) {
|
|
7178
|
-
(0,
|
|
7597
|
+
(0, import_build_utils3.debug)("found vendor directory in project root");
|
|
7179
7598
|
}
|
|
7180
7599
|
await (0, import_fs_extra.ensureDir)(vendorDir);
|
|
7181
|
-
|
|
7182
|
-
if (gemfilePath) {
|
|
7183
|
-
(0, import_build_utils2.debug)(
|
|
7184
|
-
"did not find a vendor directory but found a Gemfile, bundling gems..."
|
|
7185
|
-
);
|
|
7186
|
-
await bundleInstall(bundlerPath, bundleDir, gemfilePath, rubyPath, major);
|
|
7187
|
-
}
|
|
7188
|
-
} else {
|
|
7189
|
-
(0, import_build_utils2.debug)('found vendor directory, skipping "bundle install"...');
|
|
7190
|
-
}
|
|
7600
|
+
await bundleInstall(bundlerPath, bundleDir, gemfilePath, rubyPath);
|
|
7191
7601
|
try {
|
|
7192
|
-
await (0, import_fs_extra.remove)((0,
|
|
7602
|
+
await (0, import_fs_extra.remove)((0, import_path3.join)(vendorDir, "cache"));
|
|
7193
7603
|
} catch (e) {
|
|
7194
7604
|
}
|
|
7195
|
-
const originalRbPath = (0,
|
|
7605
|
+
const originalRbPath = (0, import_path3.join)(__dirname, "..", "vc_init.rb");
|
|
7196
7606
|
const originalHandlerRbContents = await (0, import_fs_extra.readFile)(originalRbPath, "utf8");
|
|
7197
|
-
(0,
|
|
7607
|
+
(0, import_build_utils3.debug)("entrypoint is", entrypoint);
|
|
7198
7608
|
const userHandlerFilePath = entrypoint.replace(/\.rb$/, "");
|
|
7199
7609
|
const nowHandlerRbContents = originalHandlerRbContents.replace(
|
|
7200
7610
|
/__VC_HANDLER_FILENAME/g,
|
|
7201
7611
|
userHandlerFilePath
|
|
7202
7612
|
);
|
|
7203
7613
|
const handlerRbFilename = "vc__handler__ruby";
|
|
7204
|
-
const
|
|
7205
|
-
|
|
7614
|
+
const predefinedExcludes = [
|
|
7615
|
+
".git/**",
|
|
7616
|
+
".gitignore",
|
|
7617
|
+
".vercel/**",
|
|
7618
|
+
".pnpm-store/**",
|
|
7619
|
+
"**/node_modules/**",
|
|
7620
|
+
"**/.next/**",
|
|
7621
|
+
"**/.nuxt/**"
|
|
7622
|
+
];
|
|
7623
|
+
const globOptions = {
|
|
7624
|
+
cwd: workPath,
|
|
7625
|
+
ignore: predefinedExcludes
|
|
7626
|
+
};
|
|
7627
|
+
const outputFiles = await (0, import_build_utils3.glob)("**", globOptions);
|
|
7628
|
+
outputFiles[`${handlerRbFilename}.rb`] = new import_build_utils3.FileBlob({
|
|
7206
7629
|
data: nowHandlerRbContents
|
|
7207
7630
|
});
|
|
7208
7631
|
if (config && (config.includeFiles || config.excludeFiles)) {
|
|
@@ -7224,7 +7647,7 @@ var build = async ({
|
|
|
7224
7647
|
delete outputFiles[excludedPaths[i]];
|
|
7225
7648
|
}
|
|
7226
7649
|
}
|
|
7227
|
-
const output = new
|
|
7650
|
+
const output = new import_build_utils3.Lambda({
|
|
7228
7651
|
files: outputFiles,
|
|
7229
7652
|
handler: `${handlerRbFilename}.vc__handler`,
|
|
7230
7653
|
runtime,
|
|
@@ -7232,8 +7655,11 @@ var build = async ({
|
|
|
7232
7655
|
});
|
|
7233
7656
|
return { output };
|
|
7234
7657
|
};
|
|
7658
|
+
var shouldServe = () => true;
|
|
7235
7659
|
// Annotate the CommonJS export names for ESM import in node:
|
|
7236
7660
|
0 && (module.exports = {
|
|
7237
7661
|
build,
|
|
7662
|
+
shouldServe,
|
|
7663
|
+
startDevServer,
|
|
7238
7664
|
version
|
|
7239
7665
|
});
|