@vercel/ruby 2.1.0 → 2.2.1

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 (2) hide show
  1. package/dist/index.js +91 -888
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -2371,12 +2371,16 @@ var require_end_of_stream = __commonJS({
2371
2371
  }
2372
2372
  });
2373
2373
 
2374
- // ../../node_modules/.pnpm/pump@3.0.0/node_modules/pump/index.js
2374
+ // ../../node_modules/.pnpm/pump@3.0.2/node_modules/pump/index.js
2375
2375
  var require_pump = __commonJS({
2376
- "../../node_modules/.pnpm/pump@3.0.0/node_modules/pump/index.js"(exports, module2) {
2376
+ "../../node_modules/.pnpm/pump@3.0.2/node_modules/pump/index.js"(exports, module2) {
2377
2377
  var once = require_once();
2378
2378
  var eos = require_end_of_stream();
2379
- var fs = require("fs");
2379
+ var fs;
2380
+ try {
2381
+ fs = require("fs");
2382
+ } catch (e) {
2383
+ }
2380
2384
  var noop = function() {
2381
2385
  };
2382
2386
  var ancient = /^v?\.0/.test(process.version);
@@ -2997,9 +3001,9 @@ var require_universalify = __commonJS({
2997
3001
  }
2998
3002
  });
2999
3003
 
3000
- // ../../node_modules/.pnpm/graceful-fs@4.2.10/node_modules/graceful-fs/polyfills.js
3004
+ // ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/polyfills.js
3001
3005
  var require_polyfills = __commonJS({
3002
- "../../node_modules/.pnpm/graceful-fs@4.2.10/node_modules/graceful-fs/polyfills.js"(exports, module2) {
3006
+ "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/polyfills.js"(exports, module2) {
3003
3007
  var constants = require("constants");
3004
3008
  var origCwd = process.cwd;
3005
3009
  var cwd = null;
@@ -3071,7 +3075,7 @@ var require_polyfills = __commonJS({
3071
3075
  var start = Date.now();
3072
3076
  var backoff = 0;
3073
3077
  fs$rename(from, to, function CB(er) {
3074
- if (er && (er.code === "EACCES" || er.code === "EPERM") && Date.now() - start < 6e4) {
3078
+ if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 6e4) {
3075
3079
  setTimeout(function() {
3076
3080
  fs.stat(to, function(stater, st) {
3077
3081
  if (stater && stater.code === "ENOENT")
@@ -3313,9 +3317,9 @@ var require_polyfills = __commonJS({
3313
3317
  }
3314
3318
  });
3315
3319
 
3316
- // ../../node_modules/.pnpm/graceful-fs@4.2.10/node_modules/graceful-fs/legacy-streams.js
3320
+ // ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/legacy-streams.js
3317
3321
  var require_legacy_streams = __commonJS({
3318
- "../../node_modules/.pnpm/graceful-fs@4.2.10/node_modules/graceful-fs/legacy-streams.js"(exports, module2) {
3322
+ "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/legacy-streams.js"(exports, module2) {
3319
3323
  var Stream = require("stream").Stream;
3320
3324
  module2.exports = legacy;
3321
3325
  function legacy(fs) {
@@ -3412,9 +3416,9 @@ var require_legacy_streams = __commonJS({
3412
3416
  }
3413
3417
  });
3414
3418
 
3415
- // ../../node_modules/.pnpm/graceful-fs@4.2.10/node_modules/graceful-fs/clone.js
3419
+ // ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/clone.js
3416
3420
  var require_clone = __commonJS({
3417
- "../../node_modules/.pnpm/graceful-fs@4.2.10/node_modules/graceful-fs/clone.js"(exports, module2) {
3421
+ "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/clone.js"(exports, module2) {
3418
3422
  "use strict";
3419
3423
  module2.exports = clone;
3420
3424
  var getPrototypeOf = Object.getPrototypeOf || function(obj) {
@@ -3435,9 +3439,9 @@ var require_clone = __commonJS({
3435
3439
  }
3436
3440
  });
3437
3441
 
3438
- // ../../node_modules/.pnpm/graceful-fs@4.2.10/node_modules/graceful-fs/graceful-fs.js
3442
+ // ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js
3439
3443
  var require_graceful_fs = __commonJS({
3440
- "../../node_modules/.pnpm/graceful-fs@4.2.10/node_modules/graceful-fs/graceful-fs.js"(exports, module2) {
3444
+ "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js"(exports, module2) {
3441
3445
  var fs = require("fs");
3442
3446
  var polyfills = require_polyfills();
3443
3447
  var legacy = require_legacy_streams();
@@ -5236,875 +5240,67 @@ var require_ensure = __commonJS({
5236
5240
  }
5237
5241
  });
5238
5242
 
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
- };
5243
+ // ../../node_modules/.pnpm/jsonfile@4.0.0/node_modules/jsonfile/index.js
5244
+ var require_jsonfile = __commonJS({
5245
+ "../../node_modules/.pnpm/jsonfile@4.0.0/node_modules/jsonfile/index.js"(exports, module2) {
5246
+ var _fs;
5251
5247
  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);
5248
+ _fs = require_graceful_fs();
5249
+ } catch (_) {
5250
+ _fs = require("fs");
5263
5251
  }
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);
5252
+ function readFile2(file, options, callback) {
5253
+ if (callback == null) {
5254
+ callback = options;
5255
+ options = {};
5272
5256
  }
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
- };
5257
+ if (typeof options === "string") {
5258
+ options = { encoding: options };
5298
5259
  }
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
- };
5260
+ options = options || {};
5261
+ var fs = options.fs || _fs;
5262
+ var shouldThrow = true;
5263
+ if ("throws" in options) {
5264
+ shouldThrow = options.throws;
5306
5265
  }
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
- });
5266
+ fs.readFile(file, options, function(err, data) {
5267
+ if (err)
5268
+ return callback(err);
5269
+ data = stripBom(data);
5270
+ var obj;
5271
+ try {
5272
+ obj = JSON.parse(data, options ? options.reviver : null);
5273
+ } catch (err2) {
5274
+ if (shouldThrow) {
5275
+ err2.message = file + ": " + err2.message;
5276
+ return callback(err2);
5277
+ } else {
5278
+ return callback(null, null);
5329
5279
  }
5330
- if (Object.setPrototypeOf)
5331
- Object.setPrototypeOf(rename, fs$rename);
5332
- return rename;
5333
- }(fs.rename);
5280
+ }
5281
+ callback(null, obj);
5282
+ });
5283
+ }
5284
+ function readFileSync(file, options) {
5285
+ options = options || {};
5286
+ if (typeof options === "string") {
5287
+ options = { encoding: options };
5334
5288
  }
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;
5289
+ var fs = options.fs || _fs;
5290
+ var shouldThrow = true;
5291
+ if ("throws" in options) {
5292
+ shouldThrow = options.throws;
5293
+ }
5294
+ try {
5295
+ var content = fs.readFileSync(file, options);
5296
+ content = stripBom(content);
5297
+ return JSON.parse(content, options.reviver);
5298
+ } catch (err) {
5299
+ if (shouldThrow) {
5300
+ err.message = file + ": " + err.message;
5301
+ throw err;
5302
+ } else {
5303
+ return null;
6108
5304
  }
6109
5305
  }
6110
5306
  }
@@ -7759,23 +6955,35 @@ var import_which = __toESM(require_lib2());
7759
6955
  var import_path = require("path");
7760
6956
  var import_semver = __toESM(require_semver2());
7761
6957
  var import_build_utils = require("@vercel/build-utils");
6958
+ var RubyVersion = class extends import_build_utils.Version {
6959
+ };
7762
6960
  var allOptions = [
7763
- { major: 3, minor: 3, range: "3.3.x", runtime: "ruby3.3" },
7764
- { major: 3, minor: 2, range: "3.2.x", runtime: "ruby3.2" },
7765
- {
6961
+ new RubyVersion({
6962
+ major: 3,
6963
+ minor: 3,
6964
+ range: "3.3.x",
6965
+ runtime: "ruby3.3"
6966
+ }),
6967
+ new RubyVersion({
6968
+ major: 3,
6969
+ minor: 2,
6970
+ range: "3.2.x",
6971
+ runtime: "ruby3.2"
6972
+ }),
6973
+ new RubyVersion({
7766
6974
  major: 2,
7767
6975
  minor: 7,
7768
6976
  range: "2.7.x",
7769
6977
  runtime: "ruby2.7",
7770
6978
  discontinueDate: /* @__PURE__ */ new Date("2023-12-07")
7771
- },
7772
- {
6979
+ }),
6980
+ new RubyVersion({
7773
6981
  major: 2,
7774
6982
  minor: 5,
7775
6983
  range: "2.5.x",
7776
6984
  runtime: "ruby2.5",
7777
6985
  discontinueDate: /* @__PURE__ */ new Date("2021-11-30")
7778
- }
6986
+ })
7779
6987
  ];
7780
6988
  function getLatestRubyVersion() {
7781
6989
  const selection = allOptions.find(isInstalled);
@@ -7788,10 +6996,6 @@ function getLatestRubyVersion() {
7788
6996
  }
7789
6997
  return selection;
7790
6998
  }
7791
- function isDiscontinued({ discontinueDate }) {
7792
- const today = Date.now();
7793
- return discontinueDate !== void 0 && discontinueDate.getTime() <= today;
7794
- }
7795
6999
  function getRubyPath(meta, gemfileContents) {
7796
7000
  let selection = getLatestRubyVersion();
7797
7001
  if (meta.isDev) {
@@ -7813,13 +7017,12 @@ function getRubyPath(meta, gemfileContents) {
7813
7017
  link: "http://vercel.link/ruby-version"
7814
7018
  });
7815
7019
  }
7816
- const discontinued = isDiscontinued(selection);
7817
- if (discontinued || !isInstalled(selection)) {
7020
+ if (selection.state === "discontinued" || !isInstalled(selection)) {
7818
7021
  const latest = getLatestRubyVersion();
7819
- const intro = `Found \`Gemfile\` with ${discontinued ? "discontinued" : "invalid"} Ruby version: \`${line}.\``;
7022
+ const intro = `Found \`Gemfile\` with ${selection.state === "discontinued" ? "discontinued" : "invalid"} Ruby version: \`${line}.\``;
7820
7023
  const hint = `Please set \`ruby "~> ${latest.range}"\` in your \`Gemfile\` to use Ruby ${latest.range}.`;
7821
7024
  throw new import_build_utils.NowBuildError({
7822
- code: discontinued ? "RUBY_DISCONTINUED_VERSION" : "RUBY_INVALID_VERSION",
7025
+ code: selection.state === "discontinued" ? "RUBY_DISCONTINUED_VERSION" : "RUBY_INVALID_VERSION",
7823
7026
  link: "http://vercel.link/ruby-version",
7824
7027
  message: `${intro} ${hint}`
7825
7028
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vercel/ruby",
3
3
  "author": "Nathan Cahill <nathan@nathancahill.com>",
4
- "version": "2.1.0",
4
+ "version": "2.2.1",
5
5
  "license": "Apache-2.0",
6
6
  "main": "./dist/index",
7
7
  "homepage": "https://vercel.com/docs/runtimes#official-runtimes/ruby",
@@ -18,7 +18,7 @@
18
18
  "@types/fs-extra": "8.0.0",
19
19
  "@types/semver": "6.0.0",
20
20
  "@types/which": "3.0.0",
21
- "@vercel/build-utils": "8.0.0",
21
+ "@vercel/build-utils": "10.6.7",
22
22
  "execa": "2.0.4",
23
23
  "fs-extra": "^7.0.1",
24
24
  "jest-junit": "16.0.0",