@vercel/ruby 2.0.5 → 2.2.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.
Files changed (3) hide show
  1. package/dist/index.js +260 -967
  2. package/package.json +5 -3
  3. package/vc_init.rb +1 -1
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 = which;
178
- which.sync = whichSync;
177
+ module2.exports = which2;
178
+ which2.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 which(cmd, opt, cb) {
209
+ function which2(cmd, opt, cb) {
210
210
  if (typeof opt === "function") {
211
211
  cb = opt;
212
212
  opt = {};
@@ -302,17 +302,18 @@ var require_path_key = __commonJS({
302
302
  }
303
303
  });
304
304
 
305
- // ../../node_modules/.pnpm/cross-spawn@6.0.5/node_modules/cross-spawn/lib/util/resolveCommand.js
305
+ // ../../node_modules/.pnpm/cross-spawn@6.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js
306
306
  var require_resolveCommand = __commonJS({
307
- "../../node_modules/.pnpm/cross-spawn@6.0.5/node_modules/cross-spawn/lib/util/resolveCommand.js"(exports, module2) {
307
+ "../../node_modules/.pnpm/cross-spawn@6.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js"(exports, module2) {
308
308
  "use strict";
309
309
  var path = require("path");
310
- var which = require_which();
310
+ var which2 = require_which();
311
311
  var pathKey = require_path_key()();
312
312
  function resolveCommandAttempt(parsed, withoutPathExt) {
313
313
  const cwd = process.cwd();
314
314
  const hasCustomCwd = parsed.options.cwd != null;
315
- if (hasCustomCwd) {
315
+ const shouldSwitchCwd = hasCustomCwd && process.chdir !== void 0;
316
+ if (shouldSwitchCwd) {
316
317
  try {
317
318
  process.chdir(parsed.options.cwd);
318
319
  } catch (err) {
@@ -320,13 +321,15 @@ var require_resolveCommand = __commonJS({
320
321
  }
321
322
  let resolved;
322
323
  try {
323
- resolved = which.sync(parsed.command, {
324
+ resolved = which2.sync(parsed.command, {
324
325
  path: (parsed.options.env || process.env)[pathKey],
325
326
  pathExt: withoutPathExt ? path.delimiter : void 0
326
327
  });
327
328
  } catch (e) {
328
329
  } finally {
329
- process.chdir(cwd);
330
+ if (shouldSwitchCwd) {
331
+ process.chdir(cwd);
332
+ }
330
333
  }
331
334
  if (resolved) {
332
335
  resolved = path.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
@@ -340,9 +343,9 @@ var require_resolveCommand = __commonJS({
340
343
  }
341
344
  });
342
345
 
343
- // ../../node_modules/.pnpm/cross-spawn@6.0.5/node_modules/cross-spawn/lib/util/escape.js
346
+ // ../../node_modules/.pnpm/cross-spawn@6.0.6/node_modules/cross-spawn/lib/util/escape.js
344
347
  var require_escape = __commonJS({
345
- "../../node_modules/.pnpm/cross-spawn@6.0.5/node_modules/cross-spawn/lib/util/escape.js"(exports, module2) {
348
+ "../../node_modules/.pnpm/cross-spawn@6.0.6/node_modules/cross-spawn/lib/util/escape.js"(exports, module2) {
346
349
  "use strict";
347
350
  var metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
348
351
  function escapeCommand(arg) {
@@ -351,8 +354,8 @@ var require_escape = __commonJS({
351
354
  }
352
355
  function escapeArgument(arg, doubleEscapeMetaChars) {
353
356
  arg = `${arg}`;
354
- arg = arg.replace(/(\\*)"/g, '$1$1\\"');
355
- arg = arg.replace(/(\\*)$/, "$1$1");
357
+ arg = arg.replace(/(?=(\\+?)?)\1"/g, '$1$1\\"');
358
+ arg = arg.replace(/(?=(\\+?)?)\1$/, "$1$1");
356
359
  arg = `"${arg}"`;
357
360
  arg = arg.replace(metaCharsRegExp, "^$1");
358
361
  if (doubleEscapeMetaChars) {
@@ -391,9 +394,9 @@ var require_shebang_command = __commonJS({
391
394
  }
392
395
  });
393
396
 
394
- // ../../node_modules/.pnpm/cross-spawn@6.0.5/node_modules/cross-spawn/lib/util/readShebang.js
397
+ // ../../node_modules/.pnpm/cross-spawn@6.0.6/node_modules/cross-spawn/lib/util/readShebang.js
395
398
  var require_readShebang = __commonJS({
396
- "../../node_modules/.pnpm/cross-spawn@6.0.5/node_modules/cross-spawn/lib/util/readShebang.js"(exports, module2) {
399
+ "../../node_modules/.pnpm/cross-spawn@6.0.6/node_modules/cross-spawn/lib/util/readShebang.js"(exports, module2) {
397
400
  "use strict";
398
401
  var fs = require("fs");
399
402
  var shebangCommand = require_shebang_command();
@@ -1488,9 +1491,9 @@ var require_semver = __commonJS({
1488
1491
  }
1489
1492
  });
1490
1493
 
1491
- // ../../node_modules/.pnpm/cross-spawn@6.0.5/node_modules/cross-spawn/lib/parse.js
1494
+ // ../../node_modules/.pnpm/cross-spawn@6.0.6/node_modules/cross-spawn/lib/parse.js
1492
1495
  var require_parse = __commonJS({
1493
- "../../node_modules/.pnpm/cross-spawn@6.0.5/node_modules/cross-spawn/lib/parse.js"(exports, module2) {
1496
+ "../../node_modules/.pnpm/cross-spawn@6.0.6/node_modules/cross-spawn/lib/parse.js"(exports, module2) {
1494
1497
  "use strict";
1495
1498
  var path = require("path");
1496
1499
  var niceTry = require_src();
@@ -1574,9 +1577,9 @@ var require_parse = __commonJS({
1574
1577
  }
1575
1578
  });
1576
1579
 
1577
- // ../../node_modules/.pnpm/cross-spawn@6.0.5/node_modules/cross-spawn/lib/enoent.js
1580
+ // ../../node_modules/.pnpm/cross-spawn@6.0.6/node_modules/cross-spawn/lib/enoent.js
1578
1581
  var require_enoent = __commonJS({
1579
- "../../node_modules/.pnpm/cross-spawn@6.0.5/node_modules/cross-spawn/lib/enoent.js"(exports, module2) {
1582
+ "../../node_modules/.pnpm/cross-spawn@6.0.6/node_modules/cross-spawn/lib/enoent.js"(exports, module2) {
1580
1583
  "use strict";
1581
1584
  var isWin = process.platform === "win32";
1582
1585
  function notFoundError(original, syscall) {
@@ -1624,9 +1627,9 @@ var require_enoent = __commonJS({
1624
1627
  }
1625
1628
  });
1626
1629
 
1627
- // ../../node_modules/.pnpm/cross-spawn@6.0.5/node_modules/cross-spawn/index.js
1630
+ // ../../node_modules/.pnpm/cross-spawn@6.0.6/node_modules/cross-spawn/index.js
1628
1631
  var require_cross_spawn = __commonJS({
1629
- "../../node_modules/.pnpm/cross-spawn@6.0.5/node_modules/cross-spawn/index.js"(exports, module2) {
1632
+ "../../node_modules/.pnpm/cross-spawn@6.0.6/node_modules/cross-spawn/index.js"(exports, module2) {
1630
1633
  "use strict";
1631
1634
  var cp = require("child_process");
1632
1635
  var parse = require_parse();
@@ -2283,9 +2286,9 @@ var require_once = __commonJS({
2283
2286
  }
2284
2287
  });
2285
2288
 
2286
- // ../../node_modules/.pnpm/end-of-stream@1.4.1/node_modules/end-of-stream/index.js
2289
+ // ../../node_modules/.pnpm/end-of-stream@1.4.4/node_modules/end-of-stream/index.js
2287
2290
  var require_end_of_stream = __commonJS({
2288
- "../../node_modules/.pnpm/end-of-stream@1.4.1/node_modules/end-of-stream/index.js"(exports, module2) {
2291
+ "../../node_modules/.pnpm/end-of-stream@1.4.4/node_modules/end-of-stream/index.js"(exports, module2) {
2289
2292
  var once = require_once();
2290
2293
  var noop = function() {
2291
2294
  };
@@ -2305,6 +2308,7 @@ var require_end_of_stream = __commonJS({
2305
2308
  var rs = stream._readableState;
2306
2309
  var readable = opts.readable || opts.readable !== false && stream.readable;
2307
2310
  var writable = opts.writable || opts.writable !== false && stream.writable;
2311
+ var cancelled = false;
2308
2312
  var onlegacyfinish = function() {
2309
2313
  if (!stream.writable)
2310
2314
  onfinish();
@@ -2326,9 +2330,14 @@ var require_end_of_stream = __commonJS({
2326
2330
  callback.call(stream, err);
2327
2331
  };
2328
2332
  var onclose = function() {
2329
- if (readable && !(rs && rs.ended))
2333
+ process.nextTick(onclosenexttick);
2334
+ };
2335
+ var onclosenexttick = function() {
2336
+ if (cancelled)
2337
+ return;
2338
+ if (readable && !(rs && (rs.ended && !rs.destroyed)))
2330
2339
  return callback.call(stream, new Error("premature close"));
2331
- if (writable && !(ws && ws.ended))
2340
+ if (writable && !(ws && (ws.ended && !ws.destroyed)))
2332
2341
  return callback.call(stream, new Error("premature close"));
2333
2342
  };
2334
2343
  var onrequest = function() {
@@ -2353,6 +2362,7 @@ var require_end_of_stream = __commonJS({
2353
2362
  stream.on("error", onerror);
2354
2363
  stream.on("close", onclose);
2355
2364
  return function() {
2365
+ cancelled = true;
2356
2366
  stream.removeListener("complete", onfinish);
2357
2367
  stream.removeListener("abort", onclose);
2358
2368
  stream.removeListener("request", onrequest);
@@ -2371,12 +2381,16 @@ var require_end_of_stream = __commonJS({
2371
2381
  }
2372
2382
  });
2373
2383
 
2374
- // ../../node_modules/.pnpm/pump@3.0.0/node_modules/pump/index.js
2384
+ // ../../node_modules/.pnpm/pump@3.0.2/node_modules/pump/index.js
2375
2385
  var require_pump = __commonJS({
2376
- "../../node_modules/.pnpm/pump@3.0.0/node_modules/pump/index.js"(exports, module2) {
2386
+ "../../node_modules/.pnpm/pump@3.0.2/node_modules/pump/index.js"(exports, module2) {
2377
2387
  var once = require_once();
2378
2388
  var eos = require_end_of_stream();
2379
- var fs = require("fs");
2389
+ var fs;
2390
+ try {
2391
+ fs = require("fs");
2392
+ } catch (e) {
2393
+ }
2380
2394
  var noop = function() {
2381
2395
  };
2382
2396
  var ancient = /^v?\.0/.test(process.version);
@@ -2997,9 +3011,9 @@ var require_universalify = __commonJS({
2997
3011
  }
2998
3012
  });
2999
3013
 
3000
- // ../../node_modules/.pnpm/graceful-fs@4.2.10/node_modules/graceful-fs/polyfills.js
3014
+ // ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/polyfills.js
3001
3015
  var require_polyfills = __commonJS({
3002
- "../../node_modules/.pnpm/graceful-fs@4.2.10/node_modules/graceful-fs/polyfills.js"(exports, module2) {
3016
+ "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/polyfills.js"(exports, module2) {
3003
3017
  var constants = require("constants");
3004
3018
  var origCwd = process.cwd;
3005
3019
  var cwd = null;
@@ -3071,7 +3085,7 @@ var require_polyfills = __commonJS({
3071
3085
  var start = Date.now();
3072
3086
  var backoff = 0;
3073
3087
  fs$rename(from, to, function CB(er) {
3074
- if (er && (er.code === "EACCES" || er.code === "EPERM") && Date.now() - start < 6e4) {
3088
+ if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 6e4) {
3075
3089
  setTimeout(function() {
3076
3090
  fs.stat(to, function(stater, st) {
3077
3091
  if (stater && stater.code === "ENOENT")
@@ -3313,9 +3327,9 @@ var require_polyfills = __commonJS({
3313
3327
  }
3314
3328
  });
3315
3329
 
3316
- // ../../node_modules/.pnpm/graceful-fs@4.2.10/node_modules/graceful-fs/legacy-streams.js
3330
+ // ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/legacy-streams.js
3317
3331
  var require_legacy_streams = __commonJS({
3318
- "../../node_modules/.pnpm/graceful-fs@4.2.10/node_modules/graceful-fs/legacy-streams.js"(exports, module2) {
3332
+ "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/legacy-streams.js"(exports, module2) {
3319
3333
  var Stream = require("stream").Stream;
3320
3334
  module2.exports = legacy;
3321
3335
  function legacy(fs) {
@@ -3412,9 +3426,9 @@ var require_legacy_streams = __commonJS({
3412
3426
  }
3413
3427
  });
3414
3428
 
3415
- // ../../node_modules/.pnpm/graceful-fs@4.2.10/node_modules/graceful-fs/clone.js
3429
+ // ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/clone.js
3416
3430
  var require_clone = __commonJS({
3417
- "../../node_modules/.pnpm/graceful-fs@4.2.10/node_modules/graceful-fs/clone.js"(exports, module2) {
3431
+ "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/clone.js"(exports, module2) {
3418
3432
  "use strict";
3419
3433
  module2.exports = clone;
3420
3434
  var getPrototypeOf = Object.getPrototypeOf || function(obj) {
@@ -3435,9 +3449,9 @@ var require_clone = __commonJS({
3435
3449
  }
3436
3450
  });
3437
3451
 
3438
- // ../../node_modules/.pnpm/graceful-fs@4.2.10/node_modules/graceful-fs/graceful-fs.js
3452
+ // ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js
3439
3453
  var require_graceful_fs = __commonJS({
3440
- "../../node_modules/.pnpm/graceful-fs@4.2.10/node_modules/graceful-fs/graceful-fs.js"(exports, module2) {
3454
+ "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js"(exports, module2) {
3441
3455
  var fs = require("fs");
3442
3456
  var polyfills = require_polyfills();
3443
3457
  var legacy = require_legacy_streams();
@@ -5165,11 +5179,11 @@ var require_symlink = __commonJS({
5165
5179
  return callback(err);
5166
5180
  if (destinationExists)
5167
5181
  return callback(null);
5168
- symlinkPaths(srcpath, dstpath, (err2, relative2) => {
5182
+ symlinkPaths(srcpath, dstpath, (err2, relative) => {
5169
5183
  if (err2)
5170
5184
  return callback(err2);
5171
- srcpath = relative2.toDst;
5172
- symlinkType(relative2.toCwd, type, (err3, type2) => {
5185
+ srcpath = relative.toDst;
5186
+ symlinkType(relative.toCwd, type, (err3, type2) => {
5173
5187
  if (err3)
5174
5188
  return callback(err3);
5175
5189
  const dir = path.dirname(dstpath);
@@ -5192,9 +5206,9 @@ var require_symlink = __commonJS({
5192
5206
  const destinationExists = fs.existsSync(dstpath);
5193
5207
  if (destinationExists)
5194
5208
  return void 0;
5195
- const relative2 = symlinkPathsSync(srcpath, dstpath);
5196
- srcpath = relative2.toDst;
5197
- type = symlinkTypeSync(relative2.toCwd, type);
5209
+ const relative = symlinkPathsSync(srcpath, dstpath);
5210
+ srcpath = relative.toDst;
5211
+ type = symlinkTypeSync(relative.toCwd, type);
5198
5212
  const dir = path.dirname(dstpath);
5199
5213
  const exists = fs.existsSync(dir);
5200
5214
  if (exists)
@@ -5236,875 +5250,67 @@ var require_ensure = __commonJS({
5236
5250
  }
5237
5251
  });
5238
5252
 
5239
- // ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/polyfills.js
5240
- var require_polyfills2 = __commonJS({
5241
- "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/polyfills.js"(exports, module2) {
5242
- var constants = require("constants");
5243
- var origCwd = process.cwd;
5244
- var cwd = null;
5245
- var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform;
5246
- process.cwd = function() {
5247
- if (!cwd)
5248
- cwd = origCwd.call(process);
5249
- return cwd;
5250
- };
5253
+ // ../../node_modules/.pnpm/jsonfile@4.0.0/node_modules/jsonfile/index.js
5254
+ var require_jsonfile = __commonJS({
5255
+ "../../node_modules/.pnpm/jsonfile@4.0.0/node_modules/jsonfile/index.js"(exports, module2) {
5256
+ var _fs;
5251
5257
  try {
5252
- process.cwd();
5253
- } catch (er) {
5254
- }
5255
- if (typeof process.chdir === "function") {
5256
- chdir = process.chdir;
5257
- process.chdir = function(d) {
5258
- cwd = null;
5259
- chdir.call(process, d);
5260
- };
5261
- if (Object.setPrototypeOf)
5262
- Object.setPrototypeOf(process.chdir, chdir);
5258
+ _fs = require_graceful_fs();
5259
+ } catch (_) {
5260
+ _fs = require("fs");
5263
5261
  }
5264
- var chdir;
5265
- module2.exports = patch;
5266
- function patch(fs) {
5267
- if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
5268
- patchLchmod(fs);
5269
- }
5270
- if (!fs.lutimes) {
5271
- patchLutimes(fs);
5262
+ function readFile2(file, options, callback) {
5263
+ if (callback == null) {
5264
+ callback = options;
5265
+ options = {};
5272
5266
  }
5273
- fs.chown = chownFix(fs.chown);
5274
- fs.fchown = chownFix(fs.fchown);
5275
- fs.lchown = chownFix(fs.lchown);
5276
- fs.chmod = chmodFix(fs.chmod);
5277
- fs.fchmod = chmodFix(fs.fchmod);
5278
- fs.lchmod = chmodFix(fs.lchmod);
5279
- fs.chownSync = chownFixSync(fs.chownSync);
5280
- fs.fchownSync = chownFixSync(fs.fchownSync);
5281
- fs.lchownSync = chownFixSync(fs.lchownSync);
5282
- fs.chmodSync = chmodFixSync(fs.chmodSync);
5283
- fs.fchmodSync = chmodFixSync(fs.fchmodSync);
5284
- fs.lchmodSync = chmodFixSync(fs.lchmodSync);
5285
- fs.stat = statFix(fs.stat);
5286
- fs.fstat = statFix(fs.fstat);
5287
- fs.lstat = statFix(fs.lstat);
5288
- fs.statSync = statFixSync(fs.statSync);
5289
- fs.fstatSync = statFixSync(fs.fstatSync);
5290
- fs.lstatSync = statFixSync(fs.lstatSync);
5291
- if (fs.chmod && !fs.lchmod) {
5292
- fs.lchmod = function(path, mode, cb) {
5293
- if (cb)
5294
- process.nextTick(cb);
5295
- };
5296
- fs.lchmodSync = function() {
5297
- };
5267
+ if (typeof options === "string") {
5268
+ options = { encoding: options };
5298
5269
  }
5299
- if (fs.chown && !fs.lchown) {
5300
- fs.lchown = function(path, uid, gid, cb) {
5301
- if (cb)
5302
- process.nextTick(cb);
5303
- };
5304
- fs.lchownSync = function() {
5305
- };
5270
+ options = options || {};
5271
+ var fs = options.fs || _fs;
5272
+ var shouldThrow = true;
5273
+ if ("throws" in options) {
5274
+ shouldThrow = options.throws;
5306
5275
  }
5307
- if (platform === "win32") {
5308
- fs.rename = typeof fs.rename !== "function" ? fs.rename : function(fs$rename) {
5309
- function rename(from, to, cb) {
5310
- var start = Date.now();
5311
- var backoff = 0;
5312
- fs$rename(from, to, function CB(er) {
5313
- if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 6e4) {
5314
- setTimeout(function() {
5315
- fs.stat(to, function(stater, st) {
5316
- if (stater && stater.code === "ENOENT")
5317
- fs$rename(from, to, CB);
5318
- else
5319
- cb(er);
5320
- });
5321
- }, backoff);
5322
- if (backoff < 100)
5323
- backoff += 10;
5324
- return;
5325
- }
5326
- if (cb)
5327
- cb(er);
5328
- });
5276
+ fs.readFile(file, options, function(err, data) {
5277
+ if (err)
5278
+ return callback(err);
5279
+ data = stripBom(data);
5280
+ var obj;
5281
+ try {
5282
+ obj = JSON.parse(data, options ? options.reviver : null);
5283
+ } catch (err2) {
5284
+ if (shouldThrow) {
5285
+ err2.message = file + ": " + err2.message;
5286
+ return callback(err2);
5287
+ } else {
5288
+ return callback(null, null);
5329
5289
  }
5330
- if (Object.setPrototypeOf)
5331
- Object.setPrototypeOf(rename, fs$rename);
5332
- return rename;
5333
- }(fs.rename);
5290
+ }
5291
+ callback(null, obj);
5292
+ });
5293
+ }
5294
+ function readFileSync(file, options) {
5295
+ options = options || {};
5296
+ if (typeof options === "string") {
5297
+ options = { encoding: options };
5334
5298
  }
5335
- fs.read = typeof fs.read !== "function" ? fs.read : function(fs$read) {
5336
- function read(fd, buffer, offset, length, position, callback_) {
5337
- var callback;
5338
- if (callback_ && typeof callback_ === "function") {
5339
- var eagCounter = 0;
5340
- callback = function(er, _, __) {
5341
- if (er && er.code === "EAGAIN" && eagCounter < 10) {
5342
- eagCounter++;
5343
- return fs$read.call(fs, fd, buffer, offset, length, position, callback);
5344
- }
5345
- callback_.apply(this, arguments);
5346
- };
5347
- }
5348
- return fs$read.call(fs, fd, buffer, offset, length, position, callback);
5349
- }
5350
- if (Object.setPrototypeOf)
5351
- Object.setPrototypeOf(read, fs$read);
5352
- return read;
5353
- }(fs.read);
5354
- fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) {
5355
- return function(fd, buffer, offset, length, position) {
5356
- var eagCounter = 0;
5357
- while (true) {
5358
- try {
5359
- return fs$readSync.call(fs, fd, buffer, offset, length, position);
5360
- } catch (er) {
5361
- if (er.code === "EAGAIN" && eagCounter < 10) {
5362
- eagCounter++;
5363
- continue;
5364
- }
5365
- throw er;
5366
- }
5367
- }
5368
- };
5369
- }(fs.readSync);
5370
- function patchLchmod(fs2) {
5371
- fs2.lchmod = function(path, mode, callback) {
5372
- fs2.open(
5373
- path,
5374
- constants.O_WRONLY | constants.O_SYMLINK,
5375
- mode,
5376
- function(err, fd) {
5377
- if (err) {
5378
- if (callback)
5379
- callback(err);
5380
- return;
5381
- }
5382
- fs2.fchmod(fd, mode, function(err2) {
5383
- fs2.close(fd, function(err22) {
5384
- if (callback)
5385
- callback(err2 || err22);
5386
- });
5387
- });
5388
- }
5389
- );
5390
- };
5391
- fs2.lchmodSync = function(path, mode) {
5392
- var fd = fs2.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode);
5393
- var threw = true;
5394
- var ret;
5395
- try {
5396
- ret = fs2.fchmodSync(fd, mode);
5397
- threw = false;
5398
- } finally {
5399
- if (threw) {
5400
- try {
5401
- fs2.closeSync(fd);
5402
- } catch (er) {
5403
- }
5404
- } else {
5405
- fs2.closeSync(fd);
5406
- }
5407
- }
5408
- return ret;
5409
- };
5410
- }
5411
- function patchLutimes(fs2) {
5412
- if (constants.hasOwnProperty("O_SYMLINK") && fs2.futimes) {
5413
- fs2.lutimes = function(path, at, mt, cb) {
5414
- fs2.open(path, constants.O_SYMLINK, function(er, fd) {
5415
- if (er) {
5416
- if (cb)
5417
- cb(er);
5418
- return;
5419
- }
5420
- fs2.futimes(fd, at, mt, function(er2) {
5421
- fs2.close(fd, function(er22) {
5422
- if (cb)
5423
- cb(er2 || er22);
5424
- });
5425
- });
5426
- });
5427
- };
5428
- fs2.lutimesSync = function(path, at, mt) {
5429
- var fd = fs2.openSync(path, constants.O_SYMLINK);
5430
- var ret;
5431
- var threw = true;
5432
- try {
5433
- ret = fs2.futimesSync(fd, at, mt);
5434
- threw = false;
5435
- } finally {
5436
- if (threw) {
5437
- try {
5438
- fs2.closeSync(fd);
5439
- } catch (er) {
5440
- }
5441
- } else {
5442
- fs2.closeSync(fd);
5443
- }
5444
- }
5445
- return ret;
5446
- };
5447
- } else if (fs2.futimes) {
5448
- fs2.lutimes = function(_a, _b, _c, cb) {
5449
- if (cb)
5450
- process.nextTick(cb);
5451
- };
5452
- fs2.lutimesSync = function() {
5453
- };
5454
- }
5455
- }
5456
- function chmodFix(orig) {
5457
- if (!orig)
5458
- return orig;
5459
- return function(target, mode, cb) {
5460
- return orig.call(fs, target, mode, function(er) {
5461
- if (chownErOk(er))
5462
- er = null;
5463
- if (cb)
5464
- cb.apply(this, arguments);
5465
- });
5466
- };
5467
- }
5468
- function chmodFixSync(orig) {
5469
- if (!orig)
5470
- return orig;
5471
- return function(target, mode) {
5472
- try {
5473
- return orig.call(fs, target, mode);
5474
- } catch (er) {
5475
- if (!chownErOk(er))
5476
- throw er;
5477
- }
5478
- };
5479
- }
5480
- function chownFix(orig) {
5481
- if (!orig)
5482
- return orig;
5483
- return function(target, uid, gid, cb) {
5484
- return orig.call(fs, target, uid, gid, function(er) {
5485
- if (chownErOk(er))
5486
- er = null;
5487
- if (cb)
5488
- cb.apply(this, arguments);
5489
- });
5490
- };
5491
- }
5492
- function chownFixSync(orig) {
5493
- if (!orig)
5494
- return orig;
5495
- return function(target, uid, gid) {
5496
- try {
5497
- return orig.call(fs, target, uid, gid);
5498
- } catch (er) {
5499
- if (!chownErOk(er))
5500
- throw er;
5501
- }
5502
- };
5503
- }
5504
- function statFix(orig) {
5505
- if (!orig)
5506
- return orig;
5507
- return function(target, options, cb) {
5508
- if (typeof options === "function") {
5509
- cb = options;
5510
- options = null;
5511
- }
5512
- function callback(er, stats) {
5513
- if (stats) {
5514
- if (stats.uid < 0)
5515
- stats.uid += 4294967296;
5516
- if (stats.gid < 0)
5517
- stats.gid += 4294967296;
5518
- }
5519
- if (cb)
5520
- cb.apply(this, arguments);
5521
- }
5522
- return options ? orig.call(fs, target, options, callback) : orig.call(fs, target, callback);
5523
- };
5524
- }
5525
- function statFixSync(orig) {
5526
- if (!orig)
5527
- return orig;
5528
- return function(target, options) {
5529
- var stats = options ? orig.call(fs, target, options) : orig.call(fs, target);
5530
- if (stats) {
5531
- if (stats.uid < 0)
5532
- stats.uid += 4294967296;
5533
- if (stats.gid < 0)
5534
- stats.gid += 4294967296;
5535
- }
5536
- return stats;
5537
- };
5538
- }
5539
- function chownErOk(er) {
5540
- if (!er)
5541
- return true;
5542
- if (er.code === "ENOSYS")
5543
- return true;
5544
- var nonroot = !process.getuid || process.getuid() !== 0;
5545
- if (nonroot) {
5546
- if (er.code === "EINVAL" || er.code === "EPERM")
5547
- return true;
5548
- }
5549
- return false;
5550
- }
5551
- }
5552
- }
5553
- });
5554
-
5555
- // ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/legacy-streams.js
5556
- var require_legacy_streams2 = __commonJS({
5557
- "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/legacy-streams.js"(exports, module2) {
5558
- var Stream = require("stream").Stream;
5559
- module2.exports = legacy;
5560
- function legacy(fs) {
5561
- return {
5562
- ReadStream,
5563
- WriteStream
5564
- };
5565
- function ReadStream(path, options) {
5566
- if (!(this instanceof ReadStream))
5567
- return new ReadStream(path, options);
5568
- Stream.call(this);
5569
- var self = this;
5570
- this.path = path;
5571
- this.fd = null;
5572
- this.readable = true;
5573
- this.paused = false;
5574
- this.flags = "r";
5575
- this.mode = 438;
5576
- this.bufferSize = 64 * 1024;
5577
- options = options || {};
5578
- var keys = Object.keys(options);
5579
- for (var index = 0, length = keys.length; index < length; index++) {
5580
- var key = keys[index];
5581
- this[key] = options[key];
5582
- }
5583
- if (this.encoding)
5584
- this.setEncoding(this.encoding);
5585
- if (this.start !== void 0) {
5586
- if ("number" !== typeof this.start) {
5587
- throw TypeError("start must be a Number");
5588
- }
5589
- if (this.end === void 0) {
5590
- this.end = Infinity;
5591
- } else if ("number" !== typeof this.end) {
5592
- throw TypeError("end must be a Number");
5593
- }
5594
- if (this.start > this.end) {
5595
- throw new Error("start must be <= end");
5596
- }
5597
- this.pos = this.start;
5598
- }
5599
- if (this.fd !== null) {
5600
- process.nextTick(function() {
5601
- self._read();
5602
- });
5603
- return;
5604
- }
5605
- fs.open(this.path, this.flags, this.mode, function(err, fd) {
5606
- if (err) {
5607
- self.emit("error", err);
5608
- self.readable = false;
5609
- return;
5610
- }
5611
- self.fd = fd;
5612
- self.emit("open", fd);
5613
- self._read();
5614
- });
5615
- }
5616
- function WriteStream(path, options) {
5617
- if (!(this instanceof WriteStream))
5618
- return new WriteStream(path, options);
5619
- Stream.call(this);
5620
- this.path = path;
5621
- this.fd = null;
5622
- this.writable = true;
5623
- this.flags = "w";
5624
- this.encoding = "binary";
5625
- this.mode = 438;
5626
- this.bytesWritten = 0;
5627
- options = options || {};
5628
- var keys = Object.keys(options);
5629
- for (var index = 0, length = keys.length; index < length; index++) {
5630
- var key = keys[index];
5631
- this[key] = options[key];
5632
- }
5633
- if (this.start !== void 0) {
5634
- if ("number" !== typeof this.start) {
5635
- throw TypeError("start must be a Number");
5636
- }
5637
- if (this.start < 0) {
5638
- throw new Error("start must be >= zero");
5639
- }
5640
- this.pos = this.start;
5641
- }
5642
- this.busy = false;
5643
- this._queue = [];
5644
- if (this.fd === null) {
5645
- this._open = fs.open;
5646
- this._queue.push([this._open, this.path, this.flags, this.mode, void 0]);
5647
- this.flush();
5648
- }
5649
- }
5650
- }
5651
- }
5652
- });
5653
-
5654
- // ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/clone.js
5655
- var require_clone2 = __commonJS({
5656
- "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/clone.js"(exports, module2) {
5657
- "use strict";
5658
- module2.exports = clone;
5659
- var getPrototypeOf = Object.getPrototypeOf || function(obj) {
5660
- return obj.__proto__;
5661
- };
5662
- function clone(obj) {
5663
- if (obj === null || typeof obj !== "object")
5664
- return obj;
5665
- if (obj instanceof Object)
5666
- var copy = { __proto__: getPrototypeOf(obj) };
5667
- else
5668
- var copy = /* @__PURE__ */ Object.create(null);
5669
- Object.getOwnPropertyNames(obj).forEach(function(key) {
5670
- Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key));
5671
- });
5672
- return copy;
5673
- }
5674
- }
5675
- });
5676
-
5677
- // ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js
5678
- var require_graceful_fs2 = __commonJS({
5679
- "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js"(exports, module2) {
5680
- var fs = require("fs");
5681
- var polyfills = require_polyfills2();
5682
- var legacy = require_legacy_streams2();
5683
- var clone = require_clone2();
5684
- var util = require("util");
5685
- var gracefulQueue;
5686
- var previousSymbol;
5687
- if (typeof Symbol === "function" && typeof Symbol.for === "function") {
5688
- gracefulQueue = Symbol.for("graceful-fs.queue");
5689
- previousSymbol = Symbol.for("graceful-fs.previous");
5690
- } else {
5691
- gracefulQueue = "___graceful-fs.queue";
5692
- previousSymbol = "___graceful-fs.previous";
5693
- }
5694
- function noop() {
5695
- }
5696
- function publishQueue(context, queue2) {
5697
- Object.defineProperty(context, gracefulQueue, {
5698
- get: function() {
5699
- return queue2;
5700
- }
5701
- });
5702
- }
5703
- var debug3 = noop;
5704
- if (util.debuglog)
5705
- debug3 = util.debuglog("gfs4");
5706
- else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ""))
5707
- debug3 = function() {
5708
- var m = util.format.apply(util, arguments);
5709
- m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
5710
- console.error(m);
5711
- };
5712
- if (!fs[gracefulQueue]) {
5713
- queue = global[gracefulQueue] || [];
5714
- publishQueue(fs, queue);
5715
- fs.close = function(fs$close) {
5716
- function close(fd, cb) {
5717
- return fs$close.call(fs, fd, function(err) {
5718
- if (!err) {
5719
- resetQueue();
5720
- }
5721
- if (typeof cb === "function")
5722
- cb.apply(this, arguments);
5723
- });
5724
- }
5725
- Object.defineProperty(close, previousSymbol, {
5726
- value: fs$close
5727
- });
5728
- return close;
5729
- }(fs.close);
5730
- fs.closeSync = function(fs$closeSync) {
5731
- function closeSync(fd) {
5732
- fs$closeSync.apply(fs, arguments);
5733
- resetQueue();
5734
- }
5735
- Object.defineProperty(closeSync, previousSymbol, {
5736
- value: fs$closeSync
5737
- });
5738
- return closeSync;
5739
- }(fs.closeSync);
5740
- if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) {
5741
- process.on("exit", function() {
5742
- debug3(fs[gracefulQueue]);
5743
- require("assert").equal(fs[gracefulQueue].length, 0);
5744
- });
5745
- }
5746
- }
5747
- var queue;
5748
- if (!global[gracefulQueue]) {
5749
- publishQueue(global, fs[gracefulQueue]);
5750
- }
5751
- module2.exports = patch(clone(fs));
5752
- if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) {
5753
- module2.exports = patch(fs);
5754
- fs.__patched = true;
5755
- }
5756
- function patch(fs2) {
5757
- polyfills(fs2);
5758
- fs2.gracefulify = patch;
5759
- fs2.createReadStream = createReadStream;
5760
- fs2.createWriteStream = createWriteStream;
5761
- var fs$readFile = fs2.readFile;
5762
- fs2.readFile = readFile2;
5763
- function readFile2(path, options, cb) {
5764
- if (typeof options === "function")
5765
- cb = options, options = null;
5766
- return go$readFile(path, options, cb);
5767
- function go$readFile(path2, options2, cb2, startTime) {
5768
- return fs$readFile(path2, options2, function(err) {
5769
- if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
5770
- enqueue([go$readFile, [path2, options2, cb2], err, startTime || Date.now(), Date.now()]);
5771
- else {
5772
- if (typeof cb2 === "function")
5773
- cb2.apply(this, arguments);
5774
- }
5775
- });
5776
- }
5777
- }
5778
- var fs$writeFile = fs2.writeFile;
5779
- fs2.writeFile = writeFile2;
5780
- function writeFile2(path, data, options, cb) {
5781
- if (typeof options === "function")
5782
- cb = options, options = null;
5783
- return go$writeFile(path, data, options, cb);
5784
- function go$writeFile(path2, data2, options2, cb2, startTime) {
5785
- return fs$writeFile(path2, data2, options2, function(err) {
5786
- if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
5787
- enqueue([go$writeFile, [path2, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
5788
- else {
5789
- if (typeof cb2 === "function")
5790
- cb2.apply(this, arguments);
5791
- }
5792
- });
5793
- }
5794
- }
5795
- var fs$appendFile = fs2.appendFile;
5796
- if (fs$appendFile)
5797
- fs2.appendFile = appendFile;
5798
- function appendFile(path, data, options, cb) {
5799
- if (typeof options === "function")
5800
- cb = options, options = null;
5801
- return go$appendFile(path, data, options, cb);
5802
- function go$appendFile(path2, data2, options2, cb2, startTime) {
5803
- return fs$appendFile(path2, data2, options2, function(err) {
5804
- if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
5805
- enqueue([go$appendFile, [path2, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
5806
- else {
5807
- if (typeof cb2 === "function")
5808
- cb2.apply(this, arguments);
5809
- }
5810
- });
5811
- }
5812
- }
5813
- var fs$copyFile = fs2.copyFile;
5814
- if (fs$copyFile)
5815
- fs2.copyFile = copyFile;
5816
- function copyFile(src, dest, flags, cb) {
5817
- if (typeof flags === "function") {
5818
- cb = flags;
5819
- flags = 0;
5820
- }
5821
- return go$copyFile(src, dest, flags, cb);
5822
- function go$copyFile(src2, dest2, flags2, cb2, startTime) {
5823
- return fs$copyFile(src2, dest2, flags2, function(err) {
5824
- if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
5825
- enqueue([go$copyFile, [src2, dest2, flags2, cb2], err, startTime || Date.now(), Date.now()]);
5826
- else {
5827
- if (typeof cb2 === "function")
5828
- cb2.apply(this, arguments);
5829
- }
5830
- });
5831
- }
5832
- }
5833
- var fs$readdir = fs2.readdir;
5834
- fs2.readdir = readdir;
5835
- var noReaddirOptionVersions = /^v[0-5]\./;
5836
- function readdir(path, options, cb) {
5837
- if (typeof options === "function")
5838
- cb = options, options = null;
5839
- var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path2, options2, cb2, startTime) {
5840
- return fs$readdir(path2, fs$readdirCallback(
5841
- path2,
5842
- options2,
5843
- cb2,
5844
- startTime
5845
- ));
5846
- } : function go$readdir2(path2, options2, cb2, startTime) {
5847
- return fs$readdir(path2, options2, fs$readdirCallback(
5848
- path2,
5849
- options2,
5850
- cb2,
5851
- startTime
5852
- ));
5853
- };
5854
- return go$readdir(path, options, cb);
5855
- function fs$readdirCallback(path2, options2, cb2, startTime) {
5856
- return function(err, files) {
5857
- if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
5858
- enqueue([
5859
- go$readdir,
5860
- [path2, options2, cb2],
5861
- err,
5862
- startTime || Date.now(),
5863
- Date.now()
5864
- ]);
5865
- else {
5866
- if (files && files.sort)
5867
- files.sort();
5868
- if (typeof cb2 === "function")
5869
- cb2.call(this, err, files);
5870
- }
5871
- };
5872
- }
5873
- }
5874
- if (process.version.substr(0, 4) === "v0.8") {
5875
- var legStreams = legacy(fs2);
5876
- ReadStream = legStreams.ReadStream;
5877
- WriteStream = legStreams.WriteStream;
5878
- }
5879
- var fs$ReadStream = fs2.ReadStream;
5880
- if (fs$ReadStream) {
5881
- ReadStream.prototype = Object.create(fs$ReadStream.prototype);
5882
- ReadStream.prototype.open = ReadStream$open;
5883
- }
5884
- var fs$WriteStream = fs2.WriteStream;
5885
- if (fs$WriteStream) {
5886
- WriteStream.prototype = Object.create(fs$WriteStream.prototype);
5887
- WriteStream.prototype.open = WriteStream$open;
5888
- }
5889
- Object.defineProperty(fs2, "ReadStream", {
5890
- get: function() {
5891
- return ReadStream;
5892
- },
5893
- set: function(val) {
5894
- ReadStream = val;
5895
- },
5896
- enumerable: true,
5897
- configurable: true
5898
- });
5899
- Object.defineProperty(fs2, "WriteStream", {
5900
- get: function() {
5901
- return WriteStream;
5902
- },
5903
- set: function(val) {
5904
- WriteStream = val;
5905
- },
5906
- enumerable: true,
5907
- configurable: true
5908
- });
5909
- var FileReadStream = ReadStream;
5910
- Object.defineProperty(fs2, "FileReadStream", {
5911
- get: function() {
5912
- return FileReadStream;
5913
- },
5914
- set: function(val) {
5915
- FileReadStream = val;
5916
- },
5917
- enumerable: true,
5918
- configurable: true
5919
- });
5920
- var FileWriteStream = WriteStream;
5921
- Object.defineProperty(fs2, "FileWriteStream", {
5922
- get: function() {
5923
- return FileWriteStream;
5924
- },
5925
- set: function(val) {
5926
- FileWriteStream = val;
5927
- },
5928
- enumerable: true,
5929
- configurable: true
5930
- });
5931
- function ReadStream(path, options) {
5932
- if (this instanceof ReadStream)
5933
- return fs$ReadStream.apply(this, arguments), this;
5934
- else
5935
- return ReadStream.apply(Object.create(ReadStream.prototype), arguments);
5936
- }
5937
- function ReadStream$open() {
5938
- var that = this;
5939
- open(that.path, that.flags, that.mode, function(err, fd) {
5940
- if (err) {
5941
- if (that.autoClose)
5942
- that.destroy();
5943
- that.emit("error", err);
5944
- } else {
5945
- that.fd = fd;
5946
- that.emit("open", fd);
5947
- that.read();
5948
- }
5949
- });
5950
- }
5951
- function WriteStream(path, options) {
5952
- if (this instanceof WriteStream)
5953
- return fs$WriteStream.apply(this, arguments), this;
5954
- else
5955
- return WriteStream.apply(Object.create(WriteStream.prototype), arguments);
5956
- }
5957
- function WriteStream$open() {
5958
- var that = this;
5959
- open(that.path, that.flags, that.mode, function(err, fd) {
5960
- if (err) {
5961
- that.destroy();
5962
- that.emit("error", err);
5963
- } else {
5964
- that.fd = fd;
5965
- that.emit("open", fd);
5966
- }
5967
- });
5968
- }
5969
- function createReadStream(path, options) {
5970
- return new fs2.ReadStream(path, options);
5971
- }
5972
- function createWriteStream(path, options) {
5973
- return new fs2.WriteStream(path, options);
5974
- }
5975
- var fs$open = fs2.open;
5976
- fs2.open = open;
5977
- function open(path, flags, mode, cb) {
5978
- if (typeof mode === "function")
5979
- cb = mode, mode = null;
5980
- return go$open(path, flags, mode, cb);
5981
- function go$open(path2, flags2, mode2, cb2, startTime) {
5982
- return fs$open(path2, flags2, mode2, function(err, fd) {
5983
- if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
5984
- enqueue([go$open, [path2, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
5985
- else {
5986
- if (typeof cb2 === "function")
5987
- cb2.apply(this, arguments);
5988
- }
5989
- });
5990
- }
5991
- }
5992
- return fs2;
5993
- }
5994
- function enqueue(elem) {
5995
- debug3("ENQUEUE", elem[0].name, elem[1]);
5996
- fs[gracefulQueue].push(elem);
5997
- retry();
5998
- }
5999
- var retryTimer;
6000
- function resetQueue() {
6001
- var now = Date.now();
6002
- for (var i = 0; i < fs[gracefulQueue].length; ++i) {
6003
- if (fs[gracefulQueue][i].length > 2) {
6004
- fs[gracefulQueue][i][3] = now;
6005
- fs[gracefulQueue][i][4] = now;
6006
- }
6007
- }
6008
- retry();
6009
- }
6010
- function retry() {
6011
- clearTimeout(retryTimer);
6012
- retryTimer = void 0;
6013
- if (fs[gracefulQueue].length === 0)
6014
- return;
6015
- var elem = fs[gracefulQueue].shift();
6016
- var fn = elem[0];
6017
- var args = elem[1];
6018
- var err = elem[2];
6019
- var startTime = elem[3];
6020
- var lastTime = elem[4];
6021
- if (startTime === void 0) {
6022
- debug3("RETRY", fn.name, args);
6023
- fn.apply(null, args);
6024
- } else if (Date.now() - startTime >= 6e4) {
6025
- debug3("TIMEOUT", fn.name, args);
6026
- var cb = args.pop();
6027
- if (typeof cb === "function")
6028
- cb.call(null, err);
6029
- } else {
6030
- var sinceAttempt = Date.now() - lastTime;
6031
- var sinceStart = Math.max(lastTime - startTime, 1);
6032
- var desiredDelay = Math.min(sinceStart * 1.2, 100);
6033
- if (sinceAttempt >= desiredDelay) {
6034
- debug3("RETRY", fn.name, args);
6035
- fn.apply(null, args.concat([startTime]));
6036
- } else {
6037
- fs[gracefulQueue].push(elem);
6038
- }
6039
- }
6040
- if (retryTimer === void 0) {
6041
- retryTimer = setTimeout(retry, 0);
6042
- }
6043
- }
6044
- }
6045
- });
6046
-
6047
- // ../../node_modules/.pnpm/jsonfile@4.0.0/node_modules/jsonfile/index.js
6048
- var require_jsonfile = __commonJS({
6049
- "../../node_modules/.pnpm/jsonfile@4.0.0/node_modules/jsonfile/index.js"(exports, module2) {
6050
- var _fs;
6051
- try {
6052
- _fs = require_graceful_fs2();
6053
- } catch (_) {
6054
- _fs = require("fs");
6055
- }
6056
- function readFile2(file, options, callback) {
6057
- if (callback == null) {
6058
- callback = options;
6059
- options = {};
6060
- }
6061
- if (typeof options === "string") {
6062
- options = { encoding: options };
6063
- }
6064
- options = options || {};
6065
- var fs = options.fs || _fs;
6066
- var shouldThrow = true;
6067
- if ("throws" in options) {
6068
- shouldThrow = options.throws;
6069
- }
6070
- fs.readFile(file, options, function(err, data) {
6071
- if (err)
6072
- return callback(err);
6073
- data = stripBom(data);
6074
- var obj;
6075
- try {
6076
- obj = JSON.parse(data, options ? options.reviver : null);
6077
- } catch (err2) {
6078
- if (shouldThrow) {
6079
- err2.message = file + ": " + err2.message;
6080
- return callback(err2);
6081
- } else {
6082
- return callback(null, null);
6083
- }
6084
- }
6085
- callback(null, obj);
6086
- });
6087
- }
6088
- function readFileSync(file, options) {
6089
- options = options || {};
6090
- if (typeof options === "string") {
6091
- options = { encoding: options };
6092
- }
6093
- var fs = options.fs || _fs;
6094
- var shouldThrow = true;
6095
- if ("throws" in options) {
6096
- shouldThrow = options.throws;
6097
- }
6098
- try {
6099
- var content = fs.readFileSync(file, options);
6100
- content = stripBom(content);
6101
- return JSON.parse(content, options.reviver);
6102
- } catch (err) {
6103
- if (shouldThrow) {
6104
- err.message = file + ": " + err.message;
6105
- throw err;
6106
- } else {
6107
- return null;
5299
+ var fs = options.fs || _fs;
5300
+ var shouldThrow = true;
5301
+ if ("throws" in options) {
5302
+ shouldThrow = options.throws;
5303
+ }
5304
+ try {
5305
+ var content = fs.readFileSync(file, options);
5306
+ content = stripBom(content);
5307
+ return JSON.parse(content, options.reviver);
5308
+ } catch (err) {
5309
+ if (shouldThrow) {
5310
+ err.message = file + ": " + err.message;
5311
+ throw err;
5312
+ } else {
5313
+ return null;
6108
5314
  }
6109
5315
  }
6110
5316
  }
@@ -6502,6 +5708,94 @@ var require_lib = __commonJS({
6502
5708
  }
6503
5709
  });
6504
5710
 
5711
+ // ../../node_modules/.pnpm/which@3.0.0/node_modules/which/lib/index.js
5712
+ var require_lib2 = __commonJS({
5713
+ "../../node_modules/.pnpm/which@3.0.0/node_modules/which/lib/index.js"(exports, module2) {
5714
+ var isexe = require_isexe();
5715
+ var { join: join3, delimiter, sep, posix } = require("path");
5716
+ var isWindows = process.platform === "win32";
5717
+ var rSlash = new RegExp(`[${posix.sep}${sep === posix.sep ? "" : sep}]`.replace(/(\\)/g, "\\$1"));
5718
+ var rRel = new RegExp(`^\\.${rSlash.source}`);
5719
+ var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
5720
+ var getPathInfo = (cmd, {
5721
+ path: optPath = process.env.PATH,
5722
+ pathExt: optPathExt = process.env.PATHEXT,
5723
+ delimiter: optDelimiter = delimiter
5724
+ }) => {
5725
+ const pathEnv = cmd.match(rSlash) ? [""] : [
5726
+ // windows always checks the cwd first
5727
+ ...isWindows ? [process.cwd()] : [],
5728
+ ...(optPath || /* istanbul ignore next: very unusual */
5729
+ "").split(optDelimiter)
5730
+ ];
5731
+ if (isWindows) {
5732
+ const pathExtExe = optPathExt || [".EXE", ".CMD", ".BAT", ".COM"].join(optDelimiter);
5733
+ const pathExt = pathExtExe.split(optDelimiter);
5734
+ if (cmd.includes(".") && pathExt[0] !== "") {
5735
+ pathExt.unshift("");
5736
+ }
5737
+ return { pathEnv, pathExt, pathExtExe };
5738
+ }
5739
+ return { pathEnv, pathExt: [""] };
5740
+ };
5741
+ var getPathPart = (raw, cmd) => {
5742
+ const pathPart = /^".*"$/.test(raw) ? raw.slice(1, -1) : raw;
5743
+ const prefix = !pathPart && rRel.test(cmd) ? cmd.slice(0, 2) : "";
5744
+ return prefix + join3(pathPart, cmd);
5745
+ };
5746
+ var which2 = async (cmd, opt = {}) => {
5747
+ const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
5748
+ const found = [];
5749
+ for (const envPart of pathEnv) {
5750
+ const p = getPathPart(envPart, cmd);
5751
+ for (const ext of pathExt) {
5752
+ const withExt = p + ext;
5753
+ const is = await isexe(withExt, { pathExt: pathExtExe, ignoreErrors: true });
5754
+ if (is) {
5755
+ if (!opt.all) {
5756
+ return withExt;
5757
+ }
5758
+ found.push(withExt);
5759
+ }
5760
+ }
5761
+ }
5762
+ if (opt.all && found.length) {
5763
+ return found;
5764
+ }
5765
+ if (opt.nothrow) {
5766
+ return null;
5767
+ }
5768
+ throw getNotFoundError(cmd);
5769
+ };
5770
+ var whichSync = (cmd, opt = {}) => {
5771
+ const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
5772
+ const found = [];
5773
+ for (const pathEnvPart of pathEnv) {
5774
+ const p = getPathPart(pathEnvPart, cmd);
5775
+ for (const ext of pathExt) {
5776
+ const withExt = p + ext;
5777
+ const is = isexe.sync(withExt, { pathExt: pathExtExe, ignoreErrors: true });
5778
+ if (is) {
5779
+ if (!opt.all) {
5780
+ return withExt;
5781
+ }
5782
+ found.push(withExt);
5783
+ }
5784
+ }
5785
+ }
5786
+ if (opt.all && found.length) {
5787
+ return found;
5788
+ }
5789
+ if (opt.nothrow) {
5790
+ return null;
5791
+ }
5792
+ throw getNotFoundError(cmd);
5793
+ };
5794
+ module2.exports = which2;
5795
+ which2.sync = whichSync;
5796
+ }
5797
+ });
5798
+
6505
5799
  // ../../node_modules/.pnpm/semver@6.3.1/node_modules/semver/semver.js
6506
5800
  var require_semver2 = __commonJS({
6507
5801
  "../../node_modules/.pnpm/semver@6.3.1/node_modules/semver/semver.js"(exports, module2) {
@@ -7666,36 +6960,51 @@ var import_fs_extra = __toESM(require_lib());
7666
6960
  var import_build_utils2 = require("@vercel/build-utils");
7667
6961
 
7668
6962
  // src/install-ruby.ts
6963
+ var import_execa = __toESM(require_execa());
6964
+ var import_which = __toESM(require_lib2());
7669
6965
  var import_path = require("path");
7670
6966
  var import_semver = __toESM(require_semver2());
7671
- var import_execa = __toESM(require_execa());
7672
6967
  var import_build_utils = require("@vercel/build-utils");
7673
- function getOptions() {
7674
- const options = [
7675
- { major: 3, minor: 2, range: "3.2.x", runtime: "ruby3.2" },
7676
- {
7677
- major: 2,
7678
- minor: 7,
7679
- range: "2.7.x",
7680
- runtime: "ruby2.7",
7681
- discontinueDate: /* @__PURE__ */ new Date("2023-12-07")
7682
- },
7683
- {
7684
- major: 2,
7685
- minor: 5,
7686
- range: "2.5.x",
7687
- runtime: "ruby2.5",
7688
- discontinueDate: /* @__PURE__ */ new Date("2021-11-30")
7689
- }
7690
- ];
7691
- return options;
7692
- }
6968
+ var RubyVersion = class extends import_build_utils.Version {
6969
+ };
6970
+ var allOptions = [
6971
+ new RubyVersion({
6972
+ major: 3,
6973
+ minor: 3,
6974
+ range: "3.3.x",
6975
+ runtime: "ruby3.3"
6976
+ }),
6977
+ new RubyVersion({
6978
+ major: 3,
6979
+ minor: 2,
6980
+ range: "3.2.x",
6981
+ runtime: "ruby3.2"
6982
+ }),
6983
+ new RubyVersion({
6984
+ major: 2,
6985
+ minor: 7,
6986
+ range: "2.7.x",
6987
+ runtime: "ruby2.7",
6988
+ discontinueDate: /* @__PURE__ */ new Date("2023-12-07")
6989
+ }),
6990
+ new RubyVersion({
6991
+ major: 2,
6992
+ minor: 5,
6993
+ range: "2.5.x",
6994
+ runtime: "ruby2.5",
6995
+ discontinueDate: /* @__PURE__ */ new Date("2021-11-30")
6996
+ })
6997
+ ];
7693
6998
  function getLatestRubyVersion() {
7694
- return getOptions()[0];
7695
- }
7696
- function isDiscontinued({ discontinueDate }) {
7697
- const today = Date.now();
7698
- return discontinueDate !== void 0 && discontinueDate.getTime() <= today;
6999
+ const selection = allOptions.find(isInstalled);
7000
+ if (!selection) {
7001
+ throw new import_build_utils.NowBuildError({
7002
+ code: "RUBY_INVALID_VERSION",
7003
+ link: "http://vercel.link/ruby-version",
7004
+ message: `Unable to find any supported Ruby versions.`
7005
+ });
7006
+ }
7007
+ return selection;
7699
7008
  }
7700
7009
  function getRubyPath(meta, gemfileContents) {
7701
7010
  let selection = getLatestRubyVersion();
@@ -7707,7 +7016,7 @@ function getRubyPath(meta, gemfileContents) {
7707
7016
  const line = gemfileContents.split("\n").find((line2) => line2.startsWith("ruby"));
7708
7017
  if (line) {
7709
7018
  const strVersion = line.slice(4).trim().slice(1, -1).replace("~>", "");
7710
- const found = getOptions().some((o) => {
7019
+ const found = allOptions.some((o) => {
7711
7020
  selection = o;
7712
7021
  return (0, import_semver.intersects)(o.range, strVersion);
7713
7022
  });
@@ -7718,12 +7027,12 @@ function getRubyPath(meta, gemfileContents) {
7718
7027
  link: "http://vercel.link/ruby-version"
7719
7028
  });
7720
7029
  }
7721
- if (isDiscontinued(selection)) {
7030
+ if (selection.state === "discontinued" || !isInstalled(selection)) {
7722
7031
  const latest = getLatestRubyVersion();
7723
- const intro = `Found \`Gemfile\` with discontinued Ruby version: \`${line}.\``;
7032
+ const intro = `Found \`Gemfile\` with ${selection.state === "discontinued" ? "discontinued" : "invalid"} Ruby version: \`${line}.\``;
7724
7033
  const hint = `Please set \`ruby "~> ${latest.range}"\` in your \`Gemfile\` to use Ruby ${latest.range}.`;
7725
7034
  throw new import_build_utils.NowBuildError({
7726
- code: "RUBY_DISCONTINUED_VERSION",
7035
+ code: selection.state === "discontinued" ? "RUBY_DISCONTINUED_VERSION" : "RUBY_INVALID_VERSION",
7727
7036
  link: "http://vercel.link/ruby-version",
7728
7037
  message: `${intro} ${hint}`
7729
7038
  });
@@ -7733,6 +7042,7 @@ function getRubyPath(meta, gemfileContents) {
7733
7042
  const { major, minor, runtime } = selection;
7734
7043
  const gemHome = "/ruby" + major + minor;
7735
7044
  const result = {
7045
+ major,
7736
7046
  gemHome,
7737
7047
  runtime,
7738
7048
  rubyPath: (0, import_path.join)(gemHome, "bin", "ruby"),
@@ -7743,23 +7053,7 @@ function getRubyPath(meta, gemfileContents) {
7743
7053
  return result;
7744
7054
  }
7745
7055
  async function installBundler(meta, gemfileContents) {
7746
- const { gemHome, rubyPath, gemPath, vendorPath, runtime } = getRubyPath(
7747
- meta,
7748
- gemfileContents
7749
- );
7750
- if (meta.avoidTopLevelInstall) {
7751
- (0, import_build_utils.debug)(
7752
- `Skipping bundler installation, already installed by Install Command`
7753
- );
7754
- return {
7755
- gemHome,
7756
- rubyPath,
7757
- gemPath,
7758
- vendorPath,
7759
- runtime,
7760
- bundlerPath: (0, import_path.join)(gemHome, "bin", "bundler")
7761
- };
7762
- }
7056
+ const { gemHome, rubyPath, gemPath, vendorPath, runtime, major } = getRubyPath(meta, gemfileContents);
7763
7057
  (0, import_build_utils.debug)("installing bundler...");
7764
7058
  await (0, import_execa.default)(gemPath, ["install", "bundler", "--no-document"], {
7765
7059
  stdio: "pipe",
@@ -7768,6 +7062,7 @@ async function installBundler(meta, gemfileContents) {
7768
7062
  }
7769
7063
  });
7770
7064
  return {
7065
+ major,
7771
7066
  gemHome,
7772
7067
  rubyPath,
7773
7068
  gemPath,
@@ -7776,6 +7071,10 @@ async function installBundler(meta, gemfileContents) {
7776
7071
  bundlerPath: (0, import_path.join)(gemHome, "bin", "bundler")
7777
7072
  };
7778
7073
  }
7074
+ function isInstalled({ major, minor }) {
7075
+ const gemHome = "/ruby" + major + minor;
7076
+ 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 }));
7077
+ }
7779
7078
 
7780
7079
  // src/index.ts
7781
7080
  async function matchPaths(configPatterns, workPath) {
@@ -7791,7 +7090,7 @@ async function matchPaths(configPatterns, workPath) {
7791
7090
  );
7792
7091
  return patternPaths.reduce((a, b) => a.concat(b), []);
7793
7092
  }
7794
- async function bundleInstall(bundlePath, bundleDir, gemfilePath, rubyPath, runtime) {
7093
+ async function bundleInstall(bundlePath, bundleDir, gemfilePath, rubyPath, major) {
7795
7094
  (0, import_build_utils2.debug)(`running "bundle install --deployment"...`);
7796
7095
  const bundleAppConfig = await (0, import_build_utils2.getWriteableDirectory)();
7797
7096
  const gemfileContent = await (0, import_fs_extra.readFile)(gemfilePath, "utf8");
@@ -7805,6 +7104,11 @@ async function bundleInstall(bundlePath, bundleDir, gemfilePath, rubyPath, runti
7805
7104
  gemfilePath,
7806
7105
  gemfileContent.replace('ruby "~> 3.2.x"', 'ruby "~> 3.2.0"')
7807
7106
  );
7107
+ } else if (gemfileContent.includes('ruby "~> 3.3.x"')) {
7108
+ await (0, import_fs_extra.writeFile)(
7109
+ gemfilePath,
7110
+ gemfileContent.replace('ruby "~> 3.3.x"', 'ruby "~> 3.3.0"')
7111
+ );
7808
7112
  }
7809
7113
  const bundlerEnv = (0, import_build_utils2.cloneEnv)(process.env, {
7810
7114
  // Ensure the correct version of `ruby` is in front of the $PATH
@@ -7813,7 +7117,7 @@ async function bundleInstall(bundlePath, bundleDir, gemfilePath, rubyPath, runti
7813
7117
  BUNDLE_APP_CONFIG: bundleAppConfig,
7814
7118
  BUNDLE_JOBS: "4"
7815
7119
  });
7816
- if (runtime === "ruby3.2") {
7120
+ if (major >= 3) {
7817
7121
  const result2 = await (0, import_execa2.default)("bundler", ["add", "webrick"], {
7818
7122
  cwd: (0, import_path2.dirname)(gemfilePath),
7819
7123
  stdio: "pipe",
@@ -7862,7 +7166,7 @@ var build = async ({
7862
7166
  await (0, import_fs_extra.writeFile)(gemfilePath, `source "https://rubygems.org"${import_os.EOL}`);
7863
7167
  }
7864
7168
  const gemfileContents = gemfilePath ? await (0, import_fs_extra.readFile)(gemfilePath, "utf8") : "";
7865
- const { gemHome, bundlerPath, vendorPath, runtime, rubyPath } = await installBundler(meta, gemfileContents);
7169
+ const { gemHome, bundlerPath, vendorPath, runtime, rubyPath, major } = await installBundler(meta, gemfileContents);
7866
7170
  process.env.GEM_HOME = gemHome;
7867
7171
  (0, import_build_utils2.debug)(`Checking existing vendor directory at "${vendorPath}"`);
7868
7172
  const vendorDir = (0, import_path2.join)(workPath, vendorPath);
@@ -7889,18 +7193,7 @@ var build = async ({
7889
7193
  (0, import_build_utils2.debug)(
7890
7194
  "did not find a vendor directory but found a Gemfile, bundling gems..."
7891
7195
  );
7892
- const fileAtRoot = (0, import_path2.relative)(workPath, gemfilePath) === gemfileName;
7893
- if (meta.avoidTopLevelInstall && fileAtRoot) {
7894
- (0, import_build_utils2.debug)("Skipping `bundle install` \u2014 already handled by Install Command");
7895
- } else {
7896
- await bundleInstall(
7897
- bundlerPath,
7898
- bundleDir,
7899
- gemfilePath,
7900
- rubyPath,
7901
- runtime
7902
- );
7903
- }
7196
+ await bundleInstall(bundlerPath, bundleDir, gemfilePath, rubyPath, major);
7904
7197
  }
7905
7198
  } else {
7906
7199
  (0, import_build_utils2.debug)('found vendor directory, skipping "bundle install"...');