@vercel/build-utils 7.1.1 → 7.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.
package/dist/index.js CHANGED
@@ -2370,9 +2370,9 @@ var require_universalify = __commonJS({
2370
2370
  }
2371
2371
  });
2372
2372
 
2373
- // ../../node_modules/.pnpm/graceful-fs@4.2.10/node_modules/graceful-fs/polyfills.js
2373
+ // ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/polyfills.js
2374
2374
  var require_polyfills = __commonJS({
2375
- "../../node_modules/.pnpm/graceful-fs@4.2.10/node_modules/graceful-fs/polyfills.js"(exports2, module2) {
2375
+ "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/polyfills.js"(exports2, module2) {
2376
2376
  var constants = require("constants");
2377
2377
  var origCwd = process.cwd;
2378
2378
  var cwd = null;
@@ -2444,7 +2444,7 @@ var require_polyfills = __commonJS({
2444
2444
  var start = Date.now();
2445
2445
  var backoff = 0;
2446
2446
  fs$rename(from, to, function CB(er) {
2447
- if (er && (er.code === "EACCES" || er.code === "EPERM") && Date.now() - start < 6e4) {
2447
+ if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 6e4) {
2448
2448
  setTimeout(function() {
2449
2449
  fs5.stat(to, function(stater, st) {
2450
2450
  if (stater && stater.code === "ENOENT")
@@ -2686,9 +2686,9 @@ var require_polyfills = __commonJS({
2686
2686
  }
2687
2687
  });
2688
2688
 
2689
- // ../../node_modules/.pnpm/graceful-fs@4.2.10/node_modules/graceful-fs/legacy-streams.js
2689
+ // ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/legacy-streams.js
2690
2690
  var require_legacy_streams = __commonJS({
2691
- "../../node_modules/.pnpm/graceful-fs@4.2.10/node_modules/graceful-fs/legacy-streams.js"(exports2, module2) {
2691
+ "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/legacy-streams.js"(exports2, module2) {
2692
2692
  var Stream = require("stream").Stream;
2693
2693
  module2.exports = legacy;
2694
2694
  function legacy(fs5) {
@@ -2785,9 +2785,9 @@ var require_legacy_streams = __commonJS({
2785
2785
  }
2786
2786
  });
2787
2787
 
2788
- // ../../node_modules/.pnpm/graceful-fs@4.2.10/node_modules/graceful-fs/clone.js
2788
+ // ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/clone.js
2789
2789
  var require_clone = __commonJS({
2790
- "../../node_modules/.pnpm/graceful-fs@4.2.10/node_modules/graceful-fs/clone.js"(exports2, module2) {
2790
+ "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/clone.js"(exports2, module2) {
2791
2791
  "use strict";
2792
2792
  module2.exports = clone;
2793
2793
  var getPrototypeOf = Object.getPrototypeOf || function(obj) {
@@ -2808,9 +2808,9 @@ var require_clone = __commonJS({
2808
2808
  }
2809
2809
  });
2810
2810
 
2811
- // ../../node_modules/.pnpm/graceful-fs@4.2.10/node_modules/graceful-fs/graceful-fs.js
2811
+ // ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js
2812
2812
  var require_graceful_fs = __commonJS({
2813
- "../../node_modules/.pnpm/graceful-fs@4.2.10/node_modules/graceful-fs/graceful-fs.js"(exports2, module2) {
2813
+ "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js"(exports2, module2) {
2814
2814
  var fs5 = require("fs");
2815
2815
  var polyfills = require_polyfills();
2816
2816
  var legacy = require_legacy_streams();
@@ -4398,1003 +4398,195 @@ var require_symlink_paths = __commonJS({
4398
4398
  return callback(null, {
4399
4399
  toCwd: srcpath,
4400
4400
  toDst: path7.relative(dstdir, srcpath)
4401
- });
4402
- });
4403
- }
4404
- });
4405
- }
4406
- }
4407
- function symlinkPathsSync(srcpath, dstpath) {
4408
- let exists;
4409
- if (path7.isAbsolute(srcpath)) {
4410
- exists = fs5.existsSync(srcpath);
4411
- if (!exists)
4412
- throw new Error("absolute srcpath does not exist");
4413
- return {
4414
- toCwd: srcpath,
4415
- toDst: srcpath
4416
- };
4417
- } else {
4418
- const dstdir = path7.dirname(dstpath);
4419
- const relativeToDst = path7.join(dstdir, srcpath);
4420
- exists = fs5.existsSync(relativeToDst);
4421
- if (exists) {
4422
- return {
4423
- toCwd: relativeToDst,
4424
- toDst: srcpath
4425
- };
4426
- } else {
4427
- exists = fs5.existsSync(srcpath);
4428
- if (!exists)
4429
- throw new Error("relative srcpath does not exist");
4430
- return {
4431
- toCwd: srcpath,
4432
- toDst: path7.relative(dstdir, srcpath)
4433
- };
4434
- }
4435
- }
4436
- }
4437
- module2.exports = {
4438
- symlinkPaths,
4439
- symlinkPathsSync
4440
- };
4441
- }
4442
- });
4443
-
4444
- // ../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/ensure/symlink-type.js
4445
- var require_symlink_type = __commonJS({
4446
- "../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/ensure/symlink-type.js"(exports2, module2) {
4447
- "use strict";
4448
- var fs5 = require_graceful_fs();
4449
- function symlinkType(srcpath, type, callback) {
4450
- callback = typeof type === "function" ? type : callback;
4451
- type = typeof type === "function" ? false : type;
4452
- if (type)
4453
- return callback(null, type);
4454
- fs5.lstat(srcpath, (err, stats) => {
4455
- if (err)
4456
- return callback(null, "file");
4457
- type = stats && stats.isDirectory() ? "dir" : "file";
4458
- callback(null, type);
4459
- });
4460
- }
4461
- function symlinkTypeSync(srcpath, type) {
4462
- let stats;
4463
- if (type)
4464
- return type;
4465
- try {
4466
- stats = fs5.lstatSync(srcpath);
4467
- } catch {
4468
- return "file";
4469
- }
4470
- return stats && stats.isDirectory() ? "dir" : "file";
4471
- }
4472
- module2.exports = {
4473
- symlinkType,
4474
- symlinkTypeSync
4475
- };
4476
- }
4477
- });
4478
-
4479
- // ../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/ensure/symlink.js
4480
- var require_symlink = __commonJS({
4481
- "../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/ensure/symlink.js"(exports2, module2) {
4482
- "use strict";
4483
- var u = require_universalify().fromCallback;
4484
- var path7 = require("path");
4485
- var fs5 = require_fs();
4486
- var _mkdirs = require_mkdirs();
4487
- var mkdirs = _mkdirs.mkdirs;
4488
- var mkdirsSync = _mkdirs.mkdirsSync;
4489
- var _symlinkPaths = require_symlink_paths();
4490
- var symlinkPaths = _symlinkPaths.symlinkPaths;
4491
- var symlinkPathsSync = _symlinkPaths.symlinkPathsSync;
4492
- var _symlinkType = require_symlink_type();
4493
- var symlinkType = _symlinkType.symlinkType;
4494
- var symlinkTypeSync = _symlinkType.symlinkTypeSync;
4495
- var pathExists = require_path_exists().pathExists;
4496
- var { areIdentical } = require_stat();
4497
- function createSymlink(srcpath, dstpath, type, callback) {
4498
- callback = typeof type === "function" ? type : callback;
4499
- type = typeof type === "function" ? false : type;
4500
- fs5.lstat(dstpath, (err, stats) => {
4501
- if (!err && stats.isSymbolicLink()) {
4502
- Promise.all([
4503
- fs5.stat(srcpath),
4504
- fs5.stat(dstpath)
4505
- ]).then(([srcStat, dstStat]) => {
4506
- if (areIdentical(srcStat, dstStat))
4507
- return callback(null);
4508
- _createSymlink(srcpath, dstpath, type, callback);
4509
- });
4510
- } else
4511
- _createSymlink(srcpath, dstpath, type, callback);
4512
- });
4513
- }
4514
- function _createSymlink(srcpath, dstpath, type, callback) {
4515
- symlinkPaths(srcpath, dstpath, (err, relative) => {
4516
- if (err)
4517
- return callback(err);
4518
- srcpath = relative.toDst;
4519
- symlinkType(relative.toCwd, type, (err2, type2) => {
4520
- if (err2)
4521
- return callback(err2);
4522
- const dir = path7.dirname(dstpath);
4523
- pathExists(dir, (err3, dirExists) => {
4524
- if (err3)
4525
- return callback(err3);
4526
- if (dirExists)
4527
- return fs5.symlink(srcpath, dstpath, type2, callback);
4528
- mkdirs(dir, (err4) => {
4529
- if (err4)
4530
- return callback(err4);
4531
- fs5.symlink(srcpath, dstpath, type2, callback);
4532
- });
4533
- });
4534
- });
4535
- });
4536
- }
4537
- function createSymlinkSync(srcpath, dstpath, type) {
4538
- let stats;
4539
- try {
4540
- stats = fs5.lstatSync(dstpath);
4541
- } catch {
4542
- }
4543
- if (stats && stats.isSymbolicLink()) {
4544
- const srcStat = fs5.statSync(srcpath);
4545
- const dstStat = fs5.statSync(dstpath);
4546
- if (areIdentical(srcStat, dstStat))
4547
- return;
4548
- }
4549
- const relative = symlinkPathsSync(srcpath, dstpath);
4550
- srcpath = relative.toDst;
4551
- type = symlinkTypeSync(relative.toCwd, type);
4552
- const dir = path7.dirname(dstpath);
4553
- const exists = fs5.existsSync(dir);
4554
- if (exists)
4555
- return fs5.symlinkSync(srcpath, dstpath, type);
4556
- mkdirsSync(dir);
4557
- return fs5.symlinkSync(srcpath, dstpath, type);
4558
- }
4559
- module2.exports = {
4560
- createSymlink: u(createSymlink),
4561
- createSymlinkSync
4562
- };
4563
- }
4564
- });
4565
-
4566
- // ../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/ensure/index.js
4567
- var require_ensure = __commonJS({
4568
- "../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/ensure/index.js"(exports2, module2) {
4569
- "use strict";
4570
- var file = require_file();
4571
- var link = require_link();
4572
- var symlink2 = require_symlink();
4573
- module2.exports = {
4574
- // file
4575
- createFile: file.createFile,
4576
- createFileSync: file.createFileSync,
4577
- ensureFile: file.createFile,
4578
- ensureFileSync: file.createFileSync,
4579
- // link
4580
- createLink: link.createLink,
4581
- createLinkSync: link.createLinkSync,
4582
- ensureLink: link.createLink,
4583
- ensureLinkSync: link.createLinkSync,
4584
- // symlink
4585
- createSymlink: symlink2.createSymlink,
4586
- createSymlinkSync: symlink2.createSymlinkSync,
4587
- ensureSymlink: symlink2.createSymlink,
4588
- ensureSymlinkSync: symlink2.createSymlinkSync
4589
- };
4590
- }
4591
- });
4592
-
4593
- // ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/polyfills.js
4594
- var require_polyfills2 = __commonJS({
4595
- "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/polyfills.js"(exports2, module2) {
4596
- var constants = require("constants");
4597
- var origCwd = process.cwd;
4598
- var cwd = null;
4599
- var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform;
4600
- process.cwd = function() {
4601
- if (!cwd)
4602
- cwd = origCwd.call(process);
4603
- return cwd;
4604
- };
4605
- try {
4606
- process.cwd();
4607
- } catch (er) {
4608
- }
4609
- if (typeof process.chdir === "function") {
4610
- chdir = process.chdir;
4611
- process.chdir = function(d) {
4612
- cwd = null;
4613
- chdir.call(process, d);
4614
- };
4615
- if (Object.setPrototypeOf)
4616
- Object.setPrototypeOf(process.chdir, chdir);
4617
- }
4618
- var chdir;
4619
- module2.exports = patch;
4620
- function patch(fs5) {
4621
- if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
4622
- patchLchmod(fs5);
4623
- }
4624
- if (!fs5.lutimes) {
4625
- patchLutimes(fs5);
4626
- }
4627
- fs5.chown = chownFix(fs5.chown);
4628
- fs5.fchown = chownFix(fs5.fchown);
4629
- fs5.lchown = chownFix(fs5.lchown);
4630
- fs5.chmod = chmodFix(fs5.chmod);
4631
- fs5.fchmod = chmodFix(fs5.fchmod);
4632
- fs5.lchmod = chmodFix(fs5.lchmod);
4633
- fs5.chownSync = chownFixSync(fs5.chownSync);
4634
- fs5.fchownSync = chownFixSync(fs5.fchownSync);
4635
- fs5.lchownSync = chownFixSync(fs5.lchownSync);
4636
- fs5.chmodSync = chmodFixSync(fs5.chmodSync);
4637
- fs5.fchmodSync = chmodFixSync(fs5.fchmodSync);
4638
- fs5.lchmodSync = chmodFixSync(fs5.lchmodSync);
4639
- fs5.stat = statFix(fs5.stat);
4640
- fs5.fstat = statFix(fs5.fstat);
4641
- fs5.lstat = statFix(fs5.lstat);
4642
- fs5.statSync = statFixSync(fs5.statSync);
4643
- fs5.fstatSync = statFixSync(fs5.fstatSync);
4644
- fs5.lstatSync = statFixSync(fs5.lstatSync);
4645
- if (fs5.chmod && !fs5.lchmod) {
4646
- fs5.lchmod = function(path7, mode, cb) {
4647
- if (cb)
4648
- process.nextTick(cb);
4649
- };
4650
- fs5.lchmodSync = function() {
4651
- };
4652
- }
4653
- if (fs5.chown && !fs5.lchown) {
4654
- fs5.lchown = function(path7, uid, gid, cb) {
4655
- if (cb)
4656
- process.nextTick(cb);
4657
- };
4658
- fs5.lchownSync = function() {
4659
- };
4660
- }
4661
- if (platform === "win32") {
4662
- fs5.rename = typeof fs5.rename !== "function" ? fs5.rename : function(fs$rename) {
4663
- function rename2(from, to, cb) {
4664
- var start = Date.now();
4665
- var backoff = 0;
4666
- fs$rename(from, to, function CB(er) {
4667
- if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 6e4) {
4668
- setTimeout(function() {
4669
- fs5.stat(to, function(stater, st) {
4670
- if (stater && stater.code === "ENOENT")
4671
- fs$rename(from, to, CB);
4672
- else
4673
- cb(er);
4674
- });
4675
- }, backoff);
4676
- if (backoff < 100)
4677
- backoff += 10;
4678
- return;
4679
- }
4680
- if (cb)
4681
- cb(er);
4682
- });
4683
- }
4684
- if (Object.setPrototypeOf)
4685
- Object.setPrototypeOf(rename2, fs$rename);
4686
- return rename2;
4687
- }(fs5.rename);
4688
- }
4689
- fs5.read = typeof fs5.read !== "function" ? fs5.read : function(fs$read) {
4690
- function read(fd, buffer, offset, length, position, callback_) {
4691
- var callback;
4692
- if (callback_ && typeof callback_ === "function") {
4693
- var eagCounter = 0;
4694
- callback = function(er, _, __) {
4695
- if (er && er.code === "EAGAIN" && eagCounter < 10) {
4696
- eagCounter++;
4697
- return fs$read.call(fs5, fd, buffer, offset, length, position, callback);
4698
- }
4699
- callback_.apply(this, arguments);
4700
- };
4701
- }
4702
- return fs$read.call(fs5, fd, buffer, offset, length, position, callback);
4703
- }
4704
- if (Object.setPrototypeOf)
4705
- Object.setPrototypeOf(read, fs$read);
4706
- return read;
4707
- }(fs5.read);
4708
- fs5.readSync = typeof fs5.readSync !== "function" ? fs5.readSync : function(fs$readSync) {
4709
- return function(fd, buffer, offset, length, position) {
4710
- var eagCounter = 0;
4711
- while (true) {
4712
- try {
4713
- return fs$readSync.call(fs5, fd, buffer, offset, length, position);
4714
- } catch (er) {
4715
- if (er.code === "EAGAIN" && eagCounter < 10) {
4716
- eagCounter++;
4717
- continue;
4718
- }
4719
- throw er;
4720
- }
4721
- }
4722
- };
4723
- }(fs5.readSync);
4724
- function patchLchmod(fs6) {
4725
- fs6.lchmod = function(path7, mode, callback) {
4726
- fs6.open(
4727
- path7,
4728
- constants.O_WRONLY | constants.O_SYMLINK,
4729
- mode,
4730
- function(err, fd) {
4731
- if (err) {
4732
- if (callback)
4733
- callback(err);
4734
- return;
4735
- }
4736
- fs6.fchmod(fd, mode, function(err2) {
4737
- fs6.close(fd, function(err22) {
4738
- if (callback)
4739
- callback(err2 || err22);
4740
- });
4741
- });
4742
- }
4743
- );
4744
- };
4745
- fs6.lchmodSync = function(path7, mode) {
4746
- var fd = fs6.openSync(path7, constants.O_WRONLY | constants.O_SYMLINK, mode);
4747
- var threw = true;
4748
- var ret;
4749
- try {
4750
- ret = fs6.fchmodSync(fd, mode);
4751
- threw = false;
4752
- } finally {
4753
- if (threw) {
4754
- try {
4755
- fs6.closeSync(fd);
4756
- } catch (er) {
4757
- }
4758
- } else {
4759
- fs6.closeSync(fd);
4760
- }
4761
- }
4762
- return ret;
4763
- };
4764
- }
4765
- function patchLutimes(fs6) {
4766
- if (constants.hasOwnProperty("O_SYMLINK") && fs6.futimes) {
4767
- fs6.lutimes = function(path7, at, mt, cb) {
4768
- fs6.open(path7, constants.O_SYMLINK, function(er, fd) {
4769
- if (er) {
4770
- if (cb)
4771
- cb(er);
4772
- return;
4773
- }
4774
- fs6.futimes(fd, at, mt, function(er2) {
4775
- fs6.close(fd, function(er22) {
4776
- if (cb)
4777
- cb(er2 || er22);
4778
- });
4779
- });
4780
- });
4781
- };
4782
- fs6.lutimesSync = function(path7, at, mt) {
4783
- var fd = fs6.openSync(path7, constants.O_SYMLINK);
4784
- var ret;
4785
- var threw = true;
4786
- try {
4787
- ret = fs6.futimesSync(fd, at, mt);
4788
- threw = false;
4789
- } finally {
4790
- if (threw) {
4791
- try {
4792
- fs6.closeSync(fd);
4793
- } catch (er) {
4794
- }
4795
- } else {
4796
- fs6.closeSync(fd);
4797
- }
4798
- }
4799
- return ret;
4800
- };
4801
- } else if (fs6.futimes) {
4802
- fs6.lutimes = function(_a, _b, _c, cb) {
4803
- if (cb)
4804
- process.nextTick(cb);
4805
- };
4806
- fs6.lutimesSync = function() {
4807
- };
4808
- }
4809
- }
4810
- function chmodFix(orig) {
4811
- if (!orig)
4812
- return orig;
4813
- return function(target, mode, cb) {
4814
- return orig.call(fs5, target, mode, function(er) {
4815
- if (chownErOk(er))
4816
- er = null;
4817
- if (cb)
4818
- cb.apply(this, arguments);
4819
- });
4820
- };
4821
- }
4822
- function chmodFixSync(orig) {
4823
- if (!orig)
4824
- return orig;
4825
- return function(target, mode) {
4826
- try {
4827
- return orig.call(fs5, target, mode);
4828
- } catch (er) {
4829
- if (!chownErOk(er))
4830
- throw er;
4831
- }
4832
- };
4833
- }
4834
- function chownFix(orig) {
4835
- if (!orig)
4836
- return orig;
4837
- return function(target, uid, gid, cb) {
4838
- return orig.call(fs5, target, uid, gid, function(er) {
4839
- if (chownErOk(er))
4840
- er = null;
4841
- if (cb)
4842
- cb.apply(this, arguments);
4843
- });
4844
- };
4845
- }
4846
- function chownFixSync(orig) {
4847
- if (!orig)
4848
- return orig;
4849
- return function(target, uid, gid) {
4850
- try {
4851
- return orig.call(fs5, target, uid, gid);
4852
- } catch (er) {
4853
- if (!chownErOk(er))
4854
- throw er;
4855
- }
4856
- };
4857
- }
4858
- function statFix(orig) {
4859
- if (!orig)
4860
- return orig;
4861
- return function(target, options, cb) {
4862
- if (typeof options === "function") {
4863
- cb = options;
4864
- options = null;
4865
- }
4866
- function callback(er, stats) {
4867
- if (stats) {
4868
- if (stats.uid < 0)
4869
- stats.uid += 4294967296;
4870
- if (stats.gid < 0)
4871
- stats.gid += 4294967296;
4872
- }
4873
- if (cb)
4874
- cb.apply(this, arguments);
4875
- }
4876
- return options ? orig.call(fs5, target, options, callback) : orig.call(fs5, target, callback);
4877
- };
4878
- }
4879
- function statFixSync(orig) {
4880
- if (!orig)
4881
- return orig;
4882
- return function(target, options) {
4883
- var stats = options ? orig.call(fs5, target, options) : orig.call(fs5, target);
4884
- if (stats) {
4885
- if (stats.uid < 0)
4886
- stats.uid += 4294967296;
4887
- if (stats.gid < 0)
4888
- stats.gid += 4294967296;
4889
- }
4890
- return stats;
4891
- };
4892
- }
4893
- function chownErOk(er) {
4894
- if (!er)
4895
- return true;
4896
- if (er.code === "ENOSYS")
4897
- return true;
4898
- var nonroot = !process.getuid || process.getuid() !== 0;
4899
- if (nonroot) {
4900
- if (er.code === "EINVAL" || er.code === "EPERM")
4901
- return true;
4902
- }
4903
- return false;
4904
- }
4905
- }
4906
- }
4907
- });
4908
-
4909
- // ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/legacy-streams.js
4910
- var require_legacy_streams2 = __commonJS({
4911
- "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/legacy-streams.js"(exports2, module2) {
4912
- var Stream = require("stream").Stream;
4913
- module2.exports = legacy;
4914
- function legacy(fs5) {
4915
- return {
4916
- ReadStream,
4917
- WriteStream
4918
- };
4919
- function ReadStream(path7, options) {
4920
- if (!(this instanceof ReadStream))
4921
- return new ReadStream(path7, options);
4922
- Stream.call(this);
4923
- var self = this;
4924
- this.path = path7;
4925
- this.fd = null;
4926
- this.readable = true;
4927
- this.paused = false;
4928
- this.flags = "r";
4929
- this.mode = 438;
4930
- this.bufferSize = 64 * 1024;
4931
- options = options || {};
4932
- var keys = Object.keys(options);
4933
- for (var index = 0, length = keys.length; index < length; index++) {
4934
- var key = keys[index];
4935
- this[key] = options[key];
4936
- }
4937
- if (this.encoding)
4938
- this.setEncoding(this.encoding);
4939
- if (this.start !== void 0) {
4940
- if ("number" !== typeof this.start) {
4941
- throw TypeError("start must be a Number");
4942
- }
4943
- if (this.end === void 0) {
4944
- this.end = Infinity;
4945
- } else if ("number" !== typeof this.end) {
4946
- throw TypeError("end must be a Number");
4947
- }
4948
- if (this.start > this.end) {
4949
- throw new Error("start must be <= end");
4950
- }
4951
- this.pos = this.start;
4952
- }
4953
- if (this.fd !== null) {
4954
- process.nextTick(function() {
4955
- self._read();
4956
- });
4957
- return;
4958
- }
4959
- fs5.open(this.path, this.flags, this.mode, function(err, fd) {
4960
- if (err) {
4961
- self.emit("error", err);
4962
- self.readable = false;
4963
- return;
4964
- }
4965
- self.fd = fd;
4966
- self.emit("open", fd);
4967
- self._read();
4968
- });
4969
- }
4970
- function WriteStream(path7, options) {
4971
- if (!(this instanceof WriteStream))
4972
- return new WriteStream(path7, options);
4973
- Stream.call(this);
4974
- this.path = path7;
4975
- this.fd = null;
4976
- this.writable = true;
4977
- this.flags = "w";
4978
- this.encoding = "binary";
4979
- this.mode = 438;
4980
- this.bytesWritten = 0;
4981
- options = options || {};
4982
- var keys = Object.keys(options);
4983
- for (var index = 0, length = keys.length; index < length; index++) {
4984
- var key = keys[index];
4985
- this[key] = options[key];
4986
- }
4987
- if (this.start !== void 0) {
4988
- if ("number" !== typeof this.start) {
4989
- throw TypeError("start must be a Number");
4990
- }
4991
- if (this.start < 0) {
4992
- throw new Error("start must be >= zero");
4993
- }
4994
- this.pos = this.start;
4995
- }
4996
- this.busy = false;
4997
- this._queue = [];
4998
- if (this.fd === null) {
4999
- this._open = fs5.open;
5000
- this._queue.push([this._open, this.path, this.flags, this.mode, void 0]);
5001
- this.flush();
5002
- }
5003
- }
5004
- }
5005
- }
5006
- });
5007
-
5008
- // ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/clone.js
5009
- var require_clone2 = __commonJS({
5010
- "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/clone.js"(exports2, module2) {
5011
- "use strict";
5012
- module2.exports = clone;
5013
- var getPrototypeOf = Object.getPrototypeOf || function(obj) {
5014
- return obj.__proto__;
5015
- };
5016
- function clone(obj) {
5017
- if (obj === null || typeof obj !== "object")
5018
- return obj;
5019
- if (obj instanceof Object)
5020
- var copy = { __proto__: getPrototypeOf(obj) };
5021
- else
5022
- var copy = /* @__PURE__ */ Object.create(null);
5023
- Object.getOwnPropertyNames(obj).forEach(function(key) {
5024
- Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key));
5025
- });
5026
- return copy;
5027
- }
5028
- }
5029
- });
5030
-
5031
- // ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js
5032
- var require_graceful_fs2 = __commonJS({
5033
- "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js"(exports2, module2) {
5034
- var fs5 = require("fs");
5035
- var polyfills = require_polyfills2();
5036
- var legacy = require_legacy_streams2();
5037
- var clone = require_clone2();
5038
- var util = require("util");
5039
- var gracefulQueue;
5040
- var previousSymbol;
5041
- if (typeof Symbol === "function" && typeof Symbol.for === "function") {
5042
- gracefulQueue = Symbol.for("graceful-fs.queue");
5043
- previousSymbol = Symbol.for("graceful-fs.previous");
5044
- } else {
5045
- gracefulQueue = "___graceful-fs.queue";
5046
- previousSymbol = "___graceful-fs.previous";
5047
- }
5048
- function noop() {
5049
- }
5050
- function publishQueue(context, queue2) {
5051
- Object.defineProperty(context, gracefulQueue, {
5052
- get: function() {
5053
- return queue2;
5054
- }
5055
- });
5056
- }
5057
- var debug2 = noop;
5058
- if (util.debuglog)
5059
- debug2 = util.debuglog("gfs4");
5060
- else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ""))
5061
- debug2 = function() {
5062
- var m = util.format.apply(util, arguments);
5063
- m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
5064
- console.error(m);
5065
- };
5066
- if (!fs5[gracefulQueue]) {
5067
- queue = global[gracefulQueue] || [];
5068
- publishQueue(fs5, queue);
5069
- fs5.close = function(fs$close) {
5070
- function close(fd, cb) {
5071
- return fs$close.call(fs5, fd, function(err) {
5072
- if (!err) {
5073
- resetQueue();
5074
- }
5075
- if (typeof cb === "function")
5076
- cb.apply(this, arguments);
5077
- });
5078
- }
5079
- Object.defineProperty(close, previousSymbol, {
5080
- value: fs$close
5081
- });
5082
- return close;
5083
- }(fs5.close);
5084
- fs5.closeSync = function(fs$closeSync) {
5085
- function closeSync(fd) {
5086
- fs$closeSync.apply(fs5, arguments);
5087
- resetQueue();
5088
- }
5089
- Object.defineProperty(closeSync, previousSymbol, {
5090
- value: fs$closeSync
5091
- });
5092
- return closeSync;
5093
- }(fs5.closeSync);
5094
- if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) {
5095
- process.on("exit", function() {
5096
- debug2(fs5[gracefulQueue]);
5097
- require("assert").equal(fs5[gracefulQueue].length, 0);
5098
- });
5099
- }
5100
- }
5101
- var queue;
5102
- if (!global[gracefulQueue]) {
5103
- publishQueue(global, fs5[gracefulQueue]);
5104
- }
5105
- module2.exports = patch(clone(fs5));
5106
- if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs5.__patched) {
5107
- module2.exports = patch(fs5);
5108
- fs5.__patched = true;
5109
- }
5110
- function patch(fs6) {
5111
- polyfills(fs6);
5112
- fs6.gracefulify = patch;
5113
- fs6.createReadStream = createReadStream;
5114
- fs6.createWriteStream = createWriteStream;
5115
- var fs$readFile = fs6.readFile;
5116
- fs6.readFile = readFile3;
5117
- function readFile3(path7, options, cb) {
5118
- if (typeof options === "function")
5119
- cb = options, options = null;
5120
- return go$readFile(path7, options, cb);
5121
- function go$readFile(path8, options2, cb2, startTime) {
5122
- return fs$readFile(path8, options2, function(err) {
5123
- if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
5124
- enqueue([go$readFile, [path8, options2, cb2], err, startTime || Date.now(), Date.now()]);
5125
- else {
5126
- if (typeof cb2 === "function")
5127
- cb2.apply(this, arguments);
5128
- }
5129
- });
5130
- }
5131
- }
5132
- var fs$writeFile = fs6.writeFile;
5133
- fs6.writeFile = writeFile;
5134
- function writeFile(path7, data, options, cb) {
5135
- if (typeof options === "function")
5136
- cb = options, options = null;
5137
- return go$writeFile(path7, data, options, cb);
5138
- function go$writeFile(path8, data2, options2, cb2, startTime) {
5139
- return fs$writeFile(path8, data2, options2, function(err) {
5140
- if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
5141
- enqueue([go$writeFile, [path8, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
5142
- else {
5143
- if (typeof cb2 === "function")
5144
- cb2.apply(this, arguments);
5145
- }
5146
- });
5147
- }
5148
- }
5149
- var fs$appendFile = fs6.appendFile;
5150
- if (fs$appendFile)
5151
- fs6.appendFile = appendFile;
5152
- function appendFile(path7, data, options, cb) {
5153
- if (typeof options === "function")
5154
- cb = options, options = null;
5155
- return go$appendFile(path7, data, options, cb);
5156
- function go$appendFile(path8, data2, options2, cb2, startTime) {
5157
- return fs$appendFile(path8, data2, options2, function(err) {
5158
- if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
5159
- enqueue([go$appendFile, [path8, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
5160
- else {
5161
- if (typeof cb2 === "function")
5162
- cb2.apply(this, arguments);
5163
- }
5164
- });
5165
- }
5166
- }
5167
- var fs$copyFile = fs6.copyFile;
5168
- if (fs$copyFile)
5169
- fs6.copyFile = copyFile;
5170
- function copyFile(src, dest, flags, cb) {
5171
- if (typeof flags === "function") {
5172
- cb = flags;
5173
- flags = 0;
5174
- }
5175
- return go$copyFile(src, dest, flags, cb);
5176
- function go$copyFile(src2, dest2, flags2, cb2, startTime) {
5177
- return fs$copyFile(src2, dest2, flags2, function(err) {
5178
- if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
5179
- enqueue([go$copyFile, [src2, dest2, flags2, cb2], err, startTime || Date.now(), Date.now()]);
5180
- else {
5181
- if (typeof cb2 === "function")
5182
- cb2.apply(this, arguments);
5183
- }
5184
- });
5185
- }
5186
- }
5187
- var fs$readdir = fs6.readdir;
5188
- fs6.readdir = readdir;
5189
- var noReaddirOptionVersions = /^v[0-5]\./;
5190
- function readdir(path7, options, cb) {
5191
- if (typeof options === "function")
5192
- cb = options, options = null;
5193
- var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path8, options2, cb2, startTime) {
5194
- return fs$readdir(path8, fs$readdirCallback(
5195
- path8,
5196
- options2,
5197
- cb2,
5198
- startTime
5199
- ));
5200
- } : function go$readdir2(path8, options2, cb2, startTime) {
5201
- return fs$readdir(path8, options2, fs$readdirCallback(
5202
- path8,
5203
- options2,
5204
- cb2,
5205
- startTime
5206
- ));
5207
- };
5208
- return go$readdir(path7, options, cb);
5209
- function fs$readdirCallback(path8, options2, cb2, startTime) {
5210
- return function(err, files) {
5211
- if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
5212
- enqueue([
5213
- go$readdir,
5214
- [path8, options2, cb2],
5215
- err,
5216
- startTime || Date.now(),
5217
- Date.now()
5218
- ]);
5219
- else {
5220
- if (files && files.sort)
5221
- files.sort();
5222
- if (typeof cb2 === "function")
5223
- cb2.call(this, err, files);
5224
- }
5225
- };
5226
- }
5227
- }
5228
- if (process.version.substr(0, 4) === "v0.8") {
5229
- var legStreams = legacy(fs6);
5230
- ReadStream = legStreams.ReadStream;
5231
- WriteStream = legStreams.WriteStream;
5232
- }
5233
- var fs$ReadStream = fs6.ReadStream;
5234
- if (fs$ReadStream) {
5235
- ReadStream.prototype = Object.create(fs$ReadStream.prototype);
5236
- ReadStream.prototype.open = ReadStream$open;
5237
- }
5238
- var fs$WriteStream = fs6.WriteStream;
5239
- if (fs$WriteStream) {
5240
- WriteStream.prototype = Object.create(fs$WriteStream.prototype);
5241
- WriteStream.prototype.open = WriteStream$open;
5242
- }
5243
- Object.defineProperty(fs6, "ReadStream", {
5244
- get: function() {
5245
- return ReadStream;
5246
- },
5247
- set: function(val) {
5248
- ReadStream = val;
5249
- },
5250
- enumerable: true,
5251
- configurable: true
5252
- });
5253
- Object.defineProperty(fs6, "WriteStream", {
5254
- get: function() {
5255
- return WriteStream;
5256
- },
5257
- set: function(val) {
5258
- WriteStream = val;
5259
- },
5260
- enumerable: true,
5261
- configurable: true
5262
- });
5263
- var FileReadStream = ReadStream;
5264
- Object.defineProperty(fs6, "FileReadStream", {
5265
- get: function() {
5266
- return FileReadStream;
5267
- },
5268
- set: function(val) {
5269
- FileReadStream = val;
5270
- },
5271
- enumerable: true,
5272
- configurable: true
5273
- });
5274
- var FileWriteStream = WriteStream;
5275
- Object.defineProperty(fs6, "FileWriteStream", {
5276
- get: function() {
5277
- return FileWriteStream;
5278
- },
5279
- set: function(val) {
5280
- FileWriteStream = val;
5281
- },
5282
- enumerable: true,
5283
- configurable: true
5284
- });
5285
- function ReadStream(path7, options) {
5286
- if (this instanceof ReadStream)
5287
- return fs$ReadStream.apply(this, arguments), this;
5288
- else
5289
- return ReadStream.apply(Object.create(ReadStream.prototype), arguments);
5290
- }
5291
- function ReadStream$open() {
5292
- var that = this;
5293
- open(that.path, that.flags, that.mode, function(err, fd) {
5294
- if (err) {
5295
- if (that.autoClose)
5296
- that.destroy();
5297
- that.emit("error", err);
5298
- } else {
5299
- that.fd = fd;
5300
- that.emit("open", fd);
5301
- that.read();
5302
- }
5303
- });
5304
- }
5305
- function WriteStream(path7, options) {
5306
- if (this instanceof WriteStream)
5307
- return fs$WriteStream.apply(this, arguments), this;
5308
- else
5309
- return WriteStream.apply(Object.create(WriteStream.prototype), arguments);
5310
- }
5311
- function WriteStream$open() {
5312
- var that = this;
5313
- open(that.path, that.flags, that.mode, function(err, fd) {
5314
- if (err) {
5315
- that.destroy();
5316
- that.emit("error", err);
5317
- } else {
5318
- that.fd = fd;
5319
- that.emit("open", fd);
4401
+ });
4402
+ });
5320
4403
  }
5321
4404
  });
5322
4405
  }
5323
- function createReadStream(path7, options) {
5324
- return new fs6.ReadStream(path7, options);
5325
- }
5326
- function createWriteStream(path7, options) {
5327
- return new fs6.WriteStream(path7, options);
5328
- }
5329
- var fs$open = fs6.open;
5330
- fs6.open = open;
5331
- function open(path7, flags, mode, cb) {
5332
- if (typeof mode === "function")
5333
- cb = mode, mode = null;
5334
- return go$open(path7, flags, mode, cb);
5335
- function go$open(path8, flags2, mode2, cb2, startTime) {
5336
- return fs$open(path8, flags2, mode2, function(err, fd) {
5337
- if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
5338
- enqueue([go$open, [path8, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
5339
- else {
5340
- if (typeof cb2 === "function")
5341
- cb2.apply(this, arguments);
5342
- }
5343
- });
4406
+ }
4407
+ function symlinkPathsSync(srcpath, dstpath) {
4408
+ let exists;
4409
+ if (path7.isAbsolute(srcpath)) {
4410
+ exists = fs5.existsSync(srcpath);
4411
+ if (!exists)
4412
+ throw new Error("absolute srcpath does not exist");
4413
+ return {
4414
+ toCwd: srcpath,
4415
+ toDst: srcpath
4416
+ };
4417
+ } else {
4418
+ const dstdir = path7.dirname(dstpath);
4419
+ const relativeToDst = path7.join(dstdir, srcpath);
4420
+ exists = fs5.existsSync(relativeToDst);
4421
+ if (exists) {
4422
+ return {
4423
+ toCwd: relativeToDst,
4424
+ toDst: srcpath
4425
+ };
4426
+ } else {
4427
+ exists = fs5.existsSync(srcpath);
4428
+ if (!exists)
4429
+ throw new Error("relative srcpath does not exist");
4430
+ return {
4431
+ toCwd: srcpath,
4432
+ toDst: path7.relative(dstdir, srcpath)
4433
+ };
5344
4434
  }
5345
4435
  }
5346
- return fs6;
5347
4436
  }
5348
- function enqueue(elem) {
5349
- debug2("ENQUEUE", elem[0].name, elem[1]);
5350
- fs5[gracefulQueue].push(elem);
5351
- retry2();
4437
+ module2.exports = {
4438
+ symlinkPaths,
4439
+ symlinkPathsSync
4440
+ };
4441
+ }
4442
+ });
4443
+
4444
+ // ../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/ensure/symlink-type.js
4445
+ var require_symlink_type = __commonJS({
4446
+ "../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/ensure/symlink-type.js"(exports2, module2) {
4447
+ "use strict";
4448
+ var fs5 = require_graceful_fs();
4449
+ function symlinkType(srcpath, type, callback) {
4450
+ callback = typeof type === "function" ? type : callback;
4451
+ type = typeof type === "function" ? false : type;
4452
+ if (type)
4453
+ return callback(null, type);
4454
+ fs5.lstat(srcpath, (err, stats) => {
4455
+ if (err)
4456
+ return callback(null, "file");
4457
+ type = stats && stats.isDirectory() ? "dir" : "file";
4458
+ callback(null, type);
4459
+ });
5352
4460
  }
5353
- var retryTimer;
5354
- function resetQueue() {
5355
- var now = Date.now();
5356
- for (var i = 0; i < fs5[gracefulQueue].length; ++i) {
5357
- if (fs5[gracefulQueue][i].length > 2) {
5358
- fs5[gracefulQueue][i][3] = now;
5359
- fs5[gracefulQueue][i][4] = now;
5360
- }
4461
+ function symlinkTypeSync(srcpath, type) {
4462
+ let stats;
4463
+ if (type)
4464
+ return type;
4465
+ try {
4466
+ stats = fs5.lstatSync(srcpath);
4467
+ } catch {
4468
+ return "file";
5361
4469
  }
5362
- retry2();
4470
+ return stats && stats.isDirectory() ? "dir" : "file";
5363
4471
  }
5364
- function retry2() {
5365
- clearTimeout(retryTimer);
5366
- retryTimer = void 0;
5367
- if (fs5[gracefulQueue].length === 0)
5368
- return;
5369
- var elem = fs5[gracefulQueue].shift();
5370
- var fn = elem[0];
5371
- var args = elem[1];
5372
- var err = elem[2];
5373
- var startTime = elem[3];
5374
- var lastTime = elem[4];
5375
- if (startTime === void 0) {
5376
- debug2("RETRY", fn.name, args);
5377
- fn.apply(null, args);
5378
- } else if (Date.now() - startTime >= 6e4) {
5379
- debug2("TIMEOUT", fn.name, args);
5380
- var cb = args.pop();
5381
- if (typeof cb === "function")
5382
- cb.call(null, err);
5383
- } else {
5384
- var sinceAttempt = Date.now() - lastTime;
5385
- var sinceStart = Math.max(lastTime - startTime, 1);
5386
- var desiredDelay = Math.min(sinceStart * 1.2, 100);
5387
- if (sinceAttempt >= desiredDelay) {
5388
- debug2("RETRY", fn.name, args);
5389
- fn.apply(null, args.concat([startTime]));
5390
- } else {
5391
- fs5[gracefulQueue].push(elem);
5392
- }
4472
+ module2.exports = {
4473
+ symlinkType,
4474
+ symlinkTypeSync
4475
+ };
4476
+ }
4477
+ });
4478
+
4479
+ // ../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/ensure/symlink.js
4480
+ var require_symlink = __commonJS({
4481
+ "../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/ensure/symlink.js"(exports2, module2) {
4482
+ "use strict";
4483
+ var u = require_universalify().fromCallback;
4484
+ var path7 = require("path");
4485
+ var fs5 = require_fs();
4486
+ var _mkdirs = require_mkdirs();
4487
+ var mkdirs = _mkdirs.mkdirs;
4488
+ var mkdirsSync = _mkdirs.mkdirsSync;
4489
+ var _symlinkPaths = require_symlink_paths();
4490
+ var symlinkPaths = _symlinkPaths.symlinkPaths;
4491
+ var symlinkPathsSync = _symlinkPaths.symlinkPathsSync;
4492
+ var _symlinkType = require_symlink_type();
4493
+ var symlinkType = _symlinkType.symlinkType;
4494
+ var symlinkTypeSync = _symlinkType.symlinkTypeSync;
4495
+ var pathExists = require_path_exists().pathExists;
4496
+ var { areIdentical } = require_stat();
4497
+ function createSymlink(srcpath, dstpath, type, callback) {
4498
+ callback = typeof type === "function" ? type : callback;
4499
+ type = typeof type === "function" ? false : type;
4500
+ fs5.lstat(dstpath, (err, stats) => {
4501
+ if (!err && stats.isSymbolicLink()) {
4502
+ Promise.all([
4503
+ fs5.stat(srcpath),
4504
+ fs5.stat(dstpath)
4505
+ ]).then(([srcStat, dstStat]) => {
4506
+ if (areIdentical(srcStat, dstStat))
4507
+ return callback(null);
4508
+ _createSymlink(srcpath, dstpath, type, callback);
4509
+ });
4510
+ } else
4511
+ _createSymlink(srcpath, dstpath, type, callback);
4512
+ });
4513
+ }
4514
+ function _createSymlink(srcpath, dstpath, type, callback) {
4515
+ symlinkPaths(srcpath, dstpath, (err, relative) => {
4516
+ if (err)
4517
+ return callback(err);
4518
+ srcpath = relative.toDst;
4519
+ symlinkType(relative.toCwd, type, (err2, type2) => {
4520
+ if (err2)
4521
+ return callback(err2);
4522
+ const dir = path7.dirname(dstpath);
4523
+ pathExists(dir, (err3, dirExists) => {
4524
+ if (err3)
4525
+ return callback(err3);
4526
+ if (dirExists)
4527
+ return fs5.symlink(srcpath, dstpath, type2, callback);
4528
+ mkdirs(dir, (err4) => {
4529
+ if (err4)
4530
+ return callback(err4);
4531
+ fs5.symlink(srcpath, dstpath, type2, callback);
4532
+ });
4533
+ });
4534
+ });
4535
+ });
4536
+ }
4537
+ function createSymlinkSync(srcpath, dstpath, type) {
4538
+ let stats;
4539
+ try {
4540
+ stats = fs5.lstatSync(dstpath);
4541
+ } catch {
5393
4542
  }
5394
- if (retryTimer === void 0) {
5395
- retryTimer = setTimeout(retry2, 0);
4543
+ if (stats && stats.isSymbolicLink()) {
4544
+ const srcStat = fs5.statSync(srcpath);
4545
+ const dstStat = fs5.statSync(dstpath);
4546
+ if (areIdentical(srcStat, dstStat))
4547
+ return;
5396
4548
  }
4549
+ const relative = symlinkPathsSync(srcpath, dstpath);
4550
+ srcpath = relative.toDst;
4551
+ type = symlinkTypeSync(relative.toCwd, type);
4552
+ const dir = path7.dirname(dstpath);
4553
+ const exists = fs5.existsSync(dir);
4554
+ if (exists)
4555
+ return fs5.symlinkSync(srcpath, dstpath, type);
4556
+ mkdirsSync(dir);
4557
+ return fs5.symlinkSync(srcpath, dstpath, type);
5397
4558
  }
4559
+ module2.exports = {
4560
+ createSymlink: u(createSymlink),
4561
+ createSymlinkSync
4562
+ };
4563
+ }
4564
+ });
4565
+
4566
+ // ../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/ensure/index.js
4567
+ var require_ensure = __commonJS({
4568
+ "../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/ensure/index.js"(exports2, module2) {
4569
+ "use strict";
4570
+ var file = require_file();
4571
+ var link = require_link();
4572
+ var symlink2 = require_symlink();
4573
+ module2.exports = {
4574
+ // file
4575
+ createFile: file.createFile,
4576
+ createFileSync: file.createFileSync,
4577
+ ensureFile: file.createFile,
4578
+ ensureFileSync: file.createFileSync,
4579
+ // link
4580
+ createLink: link.createLink,
4581
+ createLinkSync: link.createLinkSync,
4582
+ ensureLink: link.createLink,
4583
+ ensureLinkSync: link.createLinkSync,
4584
+ // symlink
4585
+ createSymlink: symlink2.createSymlink,
4586
+ createSymlinkSync: symlink2.createSymlinkSync,
4587
+ ensureSymlink: symlink2.createSymlink,
4588
+ ensureSymlinkSync: symlink2.createSymlinkSync
4589
+ };
5398
4590
  }
5399
4591
  });
5400
4592
 
@@ -5420,7 +4612,7 @@ var require_jsonfile = __commonJS({
5420
4612
  "../../node_modules/.pnpm/jsonfile@6.1.0/node_modules/jsonfile/index.js"(exports2, module2) {
5421
4613
  var _fs;
5422
4614
  try {
5423
- _fs = require_graceful_fs2();
4615
+ _fs = require_graceful_fs();
5424
4616
  } catch (_) {
5425
4617
  _fs = require("fs");
5426
4618
  }
@@ -22182,7 +21374,9 @@ var Prerender = class {
22182
21374
  initialHeaders,
22183
21375
  initialStatus,
22184
21376
  passQuery,
22185
- sourcePath
21377
+ sourcePath,
21378
+ experimentalBypassFor,
21379
+ experimentalStreamingLambdaPath
22186
21380
  }) {
22187
21381
  this.type = "Prerender";
22188
21382
  this.expiration = expiration;
@@ -22218,6 +21412,17 @@ var Prerender = class {
22218
21412
  "The `bypassToken` argument for `Prerender` must be a `string`."
22219
21413
  );
22220
21414
  }
21415
+ if (experimentalBypassFor !== void 0) {
21416
+ if (!Array.isArray(experimentalBypassFor) || experimentalBypassFor.some(
21417
+ (field) => typeof field !== "object" || // host doesn't need a key
21418
+ field.type !== "host" && typeof field.key !== "string" || typeof field.type !== "string" || field.value !== void 0 && typeof field.value !== "string"
21419
+ )) {
21420
+ throw new Error(
21421
+ "The `experimentalBypassFor` argument for `Prerender` must be Array of objects with fields `type`, `key` and optionally `value`."
21422
+ );
21423
+ }
21424
+ this.experimentalBypassFor = experimentalBypassFor;
21425
+ }
22221
21426
  if (typeof fallback === "undefined") {
22222
21427
  throw new Error(
22223
21428
  "The `fallback` argument for `Prerender` needs to be a `FileBlob`, `FileFsRef`, `FileRef`, or null."
@@ -22255,6 +21460,14 @@ var Prerender = class {
22255
21460
  }
22256
21461
  this.allowQuery = allowQuery;
22257
21462
  }
21463
+ if (experimentalStreamingLambdaPath !== void 0) {
21464
+ if (typeof experimentalStreamingLambdaPath !== "string") {
21465
+ throw new Error(
21466
+ "The `experimentalStreamingLambdaPath` argument for `Prerender` must be a string."
21467
+ );
21468
+ }
21469
+ this.experimentalStreamingLambdaPath = experimentalStreamingLambdaPath;
21470
+ }
22258
21471
  }
22259
21472
  };
22260
21473
 
@@ -22668,18 +21881,24 @@ async function scanParentDirs(destPath, readPackageJson = false) {
22668
21881
  filename: "package.json"
22669
21882
  });
22670
21883
  const packageJson = readPackageJson && pkgJsonPath ? JSON.parse(await import_fs_extra7.default.readFile(pkgJsonPath, "utf8")) : void 0;
22671
- const [yarnLockPath, npmLockPath, pnpmLockPath] = await walkParentDirsMulti({
21884
+ const [yarnLockPath, npmLockPath, pnpmLockPath, bunLockPath] = await walkParentDirsMulti({
22672
21885
  base: "/",
22673
21886
  start: destPath,
22674
- filenames: ["yarn.lock", "package-lock.json", "pnpm-lock.yaml"]
21887
+ filenames: [
21888
+ "yarn.lock",
21889
+ "package-lock.json",
21890
+ "pnpm-lock.yaml",
21891
+ "bun.lockb"
21892
+ ]
22675
21893
  });
22676
21894
  let lockfilePath;
22677
21895
  let lockfileVersion;
22678
21896
  let cliType = "yarn";
22679
- const [hasYarnLock, packageLockJson, pnpmLockYaml] = await Promise.all([
21897
+ const [hasYarnLock, packageLockJson, pnpmLockYaml, bunLockBin] = await Promise.all([
22680
21898
  Boolean(yarnLockPath),
22681
21899
  npmLockPath ? readConfigFile(npmLockPath) : null,
22682
- pnpmLockPath ? readConfigFile(pnpmLockPath) : null
21900
+ pnpmLockPath ? readConfigFile(pnpmLockPath) : null,
21901
+ bunLockPath ? import_fs_extra7.default.readFile(bunLockPath, "utf8") : null
22683
21902
  ]);
22684
21903
  if (hasYarnLock) {
22685
21904
  cliType = "yarn";
@@ -22692,6 +21911,10 @@ async function scanParentDirs(destPath, readPackageJson = false) {
22692
21911
  cliType = "npm";
22693
21912
  lockfilePath = npmLockPath;
22694
21913
  lockfileVersion = packageLockJson.lockfileVersion;
21914
+ } else if (bunLockBin) {
21915
+ cliType = "bun";
21916
+ lockfilePath = bunLockPath;
21917
+ lockfileVersion = 0;
22695
21918
  }
22696
21919
  const packageJsonPath = pkgJsonPath || void 0;
22697
21920
  return {
@@ -22783,6 +22006,9 @@ async function runNpmInstall(destPath, args = [], spawnOpts, meta, nodeVersion)
22783
22006
  } else if (cliType === "pnpm") {
22784
22007
  opts.prettyCommand = "pnpm install";
22785
22008
  commandArgs = args.filter((a) => a !== "--prefer-offline").concat(["install", "--unsafe-perm"]);
22009
+ } else if (cliType === "bun") {
22010
+ opts.prettyCommand = "bun install";
22011
+ commandArgs = ["install", ...args];
22786
22012
  } else {
22787
22013
  opts.prettyCommand = "yarn install";
22788
22014
  commandArgs = ["install", ...args];
@@ -22825,22 +22051,31 @@ function getEnvForPackageManager({
22825
22051
  const npm7 = "/node16/bin-npm7";
22826
22052
  const pnpm7 = "/pnpm7/node_modules/.bin";
22827
22053
  const pnpm8 = "/pnpm8/node_modules/.bin";
22054
+ const bun1 = "/bun1";
22828
22055
  const corepackEnabled = env.ENABLE_EXPERIMENTAL_COREPACK === "1";
22829
22056
  if (cliType === "npm") {
22830
22057
  if (typeof lockfileVersion === "number" && lockfileVersion >= 2 && (nodeVersion?.major || 0) < 16 && !oldPath.includes(npm7) && !corepackEnabled) {
22831
22058
  newEnv.PATH = `${npm7}${import_path5.default.delimiter}${oldPath}`;
22832
- console.log("Detected `package-lock.json` generated by npm 7+...");
22059
+ console.log("Detected `package-lock.json` generated by npm 7+");
22833
22060
  }
22834
22061
  } else if (cliType === "pnpm") {
22835
22062
  if (typeof lockfileVersion === "number" && lockfileVersion === 5.4 && !oldPath.includes(pnpm7) && !corepackEnabled) {
22836
22063
  newEnv.PATH = `${pnpm7}${import_path5.default.delimiter}${oldPath}`;
22837
22064
  console.log(
22838
- `Detected \`pnpm-lock.yaml\` version ${lockfileVersion} generated by pnpm 7...`
22065
+ `Detected \`pnpm-lock.yaml\` version ${lockfileVersion} generated by pnpm 7`
22839
22066
  );
22840
22067
  } else if (typeof lockfileVersion === "number" && lockfileVersion >= 6 && !oldPath.includes(pnpm8) && !corepackEnabled) {
22841
22068
  newEnv.PATH = `${pnpm8}${import_path5.default.delimiter}${oldPath}`;
22842
22069
  console.log(
22843
- `Detected \`pnpm-lock.yaml\` version ${lockfileVersion} generated by pnpm 8...`
22070
+ `Detected \`pnpm-lock.yaml\` version ${lockfileVersion} generated by pnpm 8`
22071
+ );
22072
+ }
22073
+ } else if (cliType === "bun") {
22074
+ if (!oldPath.includes(bun1) && !corepackEnabled) {
22075
+ newEnv.PATH = `${bun1}${import_path5.default.delimiter}${oldPath}`;
22076
+ console.log("Detected `bun.lockb` generated by Bun");
22077
+ console.warn(
22078
+ "Warning: Bun is used as a package manager at build time only, not at runtime with Functions"
22844
22079
  );
22845
22080
  }
22846
22081
  } else {
@@ -22899,6 +22134,8 @@ async function runPackageJsonScript(destPath, scriptNames, spawnOpts) {
22899
22134
  opts.prettyCommand = `npm run ${scriptName}`;
22900
22135
  } else if (cliType === "pnpm") {
22901
22136
  opts.prettyCommand = `pnpm run ${scriptName}`;
22137
+ } else if (cliType === "bun") {
22138
+ opts.prettyCommand = `bun run ${scriptName}`;
22902
22139
  } else {
22903
22140
  opts.prettyCommand = `yarn run ${scriptName}`;
22904
22141
  }