@gapi/gcli 1.8.209 → 1.8.211

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/release/index.js CHANGED
@@ -15,11 +15,11 @@ var __export = (target, all) => {
15
15
  for (var name2 in all)
16
16
  __defProp(target, name2, { get: all[name2], enumerable: true });
17
17
  };
18
- var __copyProps = (to, from12, except, desc) => {
19
- if (from12 && typeof from12 === "object" || typeof from12 === "function") {
20
- for (let key of __getOwnPropNames(from12))
18
+ var __copyProps = (to, from11, except, desc) => {
19
+ if (from11 && typeof from11 === "object" || typeof from11 === "function") {
20
+ for (let key of __getOwnPropNames(from11))
21
21
  if (!__hasOwnProp.call(to, key) && key !== except)
22
- __defProp(to, key, { get: () => from12[key], enumerable: !(desc = __getOwnPropDesc(from12, key)) || desc.enumerable });
22
+ __defProp(to, key, { get: () => from11[key], enumerable: !(desc = __getOwnPropDesc(from11, key)) || desc.enumerable });
23
23
  }
24
24
  return to;
25
25
  };
@@ -8917,9 +8917,9 @@ var require_Subscription = __commonJS({
8917
8917
  }
8918
8918
  return ar;
8919
8919
  };
8920
- var __spreadArray2 = exports2 && exports2.__spreadArray || function(to, from12) {
8921
- for (var i2 = 0, il = from12.length, j = to.length; i2 < il; i2++, j++)
8922
- to[j] = from12[i2];
8920
+ var __spreadArray2 = exports2 && exports2.__spreadArray || function(to, from11) {
8921
+ for (var i2 = 0, il = from11.length, j = to.length; i2 < il; i2++, j++)
8922
+ to[j] = from11[i2];
8923
8923
  return to;
8924
8924
  };
8925
8925
  Object.defineProperty(exports2, "__esModule", { value: true });
@@ -9100,9 +9100,9 @@ var require_timeoutProvider = __commonJS({
9100
9100
  }
9101
9101
  return ar;
9102
9102
  };
9103
- var __spreadArray2 = exports2 && exports2.__spreadArray || function(to, from12) {
9104
- for (var i2 = 0, il = from12.length, j = to.length; i2 < il; i2++, j++)
9105
- to[j] = from12[i2];
9103
+ var __spreadArray2 = exports2 && exports2.__spreadArray || function(to, from11) {
9104
+ for (var i2 = 0, il = from11.length, j = to.length; i2 < il; i2++, j++)
9105
+ to[j] = from11[i2];
9106
9106
  return to;
9107
9107
  };
9108
9108
  Object.defineProperty(exports2, "__esModule", { value: true });
@@ -9860,9 +9860,9 @@ var require_animationFrameProvider = __commonJS({
9860
9860
  }
9861
9861
  return ar;
9862
9862
  };
9863
- var __spreadArray2 = exports2 && exports2.__spreadArray || function(to, from12) {
9864
- for (var i2 = 0, il = from12.length, j = to.length; i2 < il; i2++, j++)
9865
- to[j] = from12[i2];
9863
+ var __spreadArray2 = exports2 && exports2.__spreadArray || function(to, from11) {
9864
+ for (var i2 = 0, il = from11.length, j = to.length; i2 < il; i2++, j++)
9865
+ to[j] = from11[i2];
9866
9866
  return to;
9867
9867
  };
9868
9868
  Object.defineProperty(exports2, "__esModule", { value: true });
@@ -10460,9 +10460,9 @@ var require_intervalProvider = __commonJS({
10460
10460
  }
10461
10461
  return ar;
10462
10462
  };
10463
- var __spreadArray2 = exports2 && exports2.__spreadArray || function(to, from12) {
10464
- for (var i2 = 0, il = from12.length, j = to.length; i2 < il; i2++, j++)
10465
- to[j] = from12[i2];
10463
+ var __spreadArray2 = exports2 && exports2.__spreadArray || function(to, from11) {
10464
+ for (var i2 = 0, il = from11.length, j = to.length; i2 < il; i2++, j++)
10465
+ to[j] = from11[i2];
10466
10466
  return to;
10467
10467
  };
10468
10468
  Object.defineProperty(exports2, "__esModule", { value: true });
@@ -10669,9 +10669,9 @@ var require_immediateProvider = __commonJS({
10669
10669
  }
10670
10670
  return ar;
10671
10671
  };
10672
- var __spreadArray2 = exports2 && exports2.__spreadArray || function(to, from12) {
10673
- for (var i2 = 0, il = from12.length, j = to.length; i2 < il; i2++, j++)
10674
- to[j] = from12[i2];
10672
+ var __spreadArray2 = exports2 && exports2.__spreadArray || function(to, from11) {
10673
+ for (var i2 = 0, il = from11.length, j = to.length; i2 < il; i2++, j++)
10674
+ to[j] = from11[i2];
10675
10675
  return to;
10676
10676
  };
10677
10677
  Object.defineProperty(exports2, "__esModule", { value: true });
@@ -12233,10 +12233,10 @@ var require_from = __commonJS({
12233
12233
  exports2.from = void 0;
12234
12234
  var scheduled_1 = require_scheduled();
12235
12235
  var innerFrom_1 = require_innerFrom();
12236
- function from12(input, scheduler) {
12236
+ function from11(input, scheduler) {
12237
12237
  return scheduler ? scheduled_1.scheduled(input, scheduler) : innerFrom_1.innerFrom(input);
12238
12238
  }
12239
- exports2.from = from12;
12239
+ exports2.from = from11;
12240
12240
  }
12241
12241
  });
12242
12242
 
@@ -12248,7 +12248,7 @@ var require_of = __commonJS({
12248
12248
  exports2.of = void 0;
12249
12249
  var args_1 = require_args();
12250
12250
  var from_1 = require_from();
12251
- function of10() {
12251
+ function of11() {
12252
12252
  var args = [];
12253
12253
  for (var _i = 0; _i < arguments.length; _i++) {
12254
12254
  args[_i] = arguments[_i];
@@ -12256,7 +12256,7 @@ var require_of = __commonJS({
12256
12256
  var scheduler = args_1.popScheduler(args);
12257
12257
  return from_1.from(args, scheduler);
12258
12258
  }
12259
- exports2.of = of10;
12259
+ exports2.of = of11;
12260
12260
  }
12261
12261
  });
12262
12262
 
@@ -12624,9 +12624,9 @@ var require_mapOneOrManyArgs = __commonJS({
12624
12624
  }
12625
12625
  return ar;
12626
12626
  };
12627
- var __spreadArray2 = exports2 && exports2.__spreadArray || function(to, from12) {
12628
- for (var i2 = 0, il = from12.length, j = to.length; i2 < il; i2++, j++)
12629
- to[j] = from12[i2];
12627
+ var __spreadArray2 = exports2 && exports2.__spreadArray || function(to, from11) {
12628
+ for (var i2 = 0, il = from11.length, j = to.length; i2 < il; i2++, j++)
12629
+ to[j] = from11[i2];
12630
12630
  return to;
12631
12631
  };
12632
12632
  Object.defineProperty(exports2, "__esModule", { value: true });
@@ -12666,9 +12666,9 @@ var require_bindCallbackInternals = __commonJS({
12666
12666
  }
12667
12667
  return ar;
12668
12668
  };
12669
- var __spreadArray2 = exports2 && exports2.__spreadArray || function(to, from12) {
12670
- for (var i2 = 0, il = from12.length, j = to.length; i2 < il; i2++, j++)
12671
- to[j] = from12[i2];
12669
+ var __spreadArray2 = exports2 && exports2.__spreadArray || function(to, from11) {
12670
+ for (var i2 = 0, il = from11.length, j = to.length; i2 < il; i2++, j++)
12671
+ to[j] = from11[i2];
12672
12672
  return to;
12673
12673
  };
12674
12674
  Object.defineProperty(exports2, "__esModule", { value: true });
@@ -13800,9 +13800,9 @@ var require_zip = __commonJS({
13800
13800
  }
13801
13801
  return ar;
13802
13802
  };
13803
- var __spreadArray2 = exports2 && exports2.__spreadArray || function(to, from12) {
13804
- for (var i2 = 0, il = from12.length, j = to.length; i2 < il; i2++, j++)
13805
- to[j] = from12[i2];
13803
+ var __spreadArray2 = exports2 && exports2.__spreadArray || function(to, from11) {
13804
+ for (var i2 = 0, il = from11.length, j = to.length; i2 < il; i2++, j++)
13805
+ to[j] = from11[i2];
13806
13806
  return to;
13807
13807
  };
13808
13808
  Object.defineProperty(exports2, "__esModule", { value: true });
@@ -14430,9 +14430,9 @@ var require_combineLatest2 = __commonJS({
14430
14430
  }
14431
14431
  return ar;
14432
14432
  };
14433
- var __spreadArray2 = exports2 && exports2.__spreadArray || function(to, from12) {
14434
- for (var i2 = 0, il = from12.length, j = to.length; i2 < il; i2++, j++)
14435
- to[j] = from12[i2];
14433
+ var __spreadArray2 = exports2 && exports2.__spreadArray || function(to, from11) {
14434
+ for (var i2 = 0, il = from11.length, j = to.length; i2 < il; i2++, j++)
14435
+ to[j] = from11[i2];
14436
14436
  return to;
14437
14437
  };
14438
14438
  Object.defineProperty(exports2, "__esModule", { value: true });
@@ -14478,9 +14478,9 @@ var require_combineLatestWith = __commonJS({
14478
14478
  }
14479
14479
  return ar;
14480
14480
  };
14481
- var __spreadArray2 = exports2 && exports2.__spreadArray || function(to, from12) {
14482
- for (var i2 = 0, il = from12.length, j = to.length; i2 < il; i2++, j++)
14483
- to[j] = from12[i2];
14481
+ var __spreadArray2 = exports2 && exports2.__spreadArray || function(to, from11) {
14482
+ for (var i2 = 0, il = from11.length, j = to.length; i2 < il; i2++, j++)
14483
+ to[j] = from11[i2];
14484
14484
  return to;
14485
14485
  };
14486
14486
  Object.defineProperty(exports2, "__esModule", { value: true });
@@ -14552,9 +14552,9 @@ var require_concat2 = __commonJS({
14552
14552
  }
14553
14553
  return ar;
14554
14554
  };
14555
- var __spreadArray2 = exports2 && exports2.__spreadArray || function(to, from12) {
14556
- for (var i2 = 0, il = from12.length, j = to.length; i2 < il; i2++, j++)
14557
- to[j] = from12[i2];
14555
+ var __spreadArray2 = exports2 && exports2.__spreadArray || function(to, from11) {
14556
+ for (var i2 = 0, il = from11.length, j = to.length; i2 < il; i2++, j++)
14557
+ to[j] = from11[i2];
14558
14558
  return to;
14559
14559
  };
14560
14560
  Object.defineProperty(exports2, "__esModule", { value: true });
@@ -14598,9 +14598,9 @@ var require_concatWith = __commonJS({
14598
14598
  }
14599
14599
  return ar;
14600
14600
  };
14601
- var __spreadArray2 = exports2 && exports2.__spreadArray || function(to, from12) {
14602
- for (var i2 = 0, il = from12.length, j = to.length; i2 < il; i2++, j++)
14603
- to[j] = from12[i2];
14601
+ var __spreadArray2 = exports2 && exports2.__spreadArray || function(to, from11) {
14602
+ for (var i2 = 0, il = from11.length, j = to.length; i2 < il; i2++, j++)
14603
+ to[j] = from11[i2];
14604
14604
  return to;
14605
14605
  };
14606
14606
  Object.defineProperty(exports2, "__esModule", { value: true });
@@ -15091,9 +15091,9 @@ var require_endWith = __commonJS({
15091
15091
  }
15092
15092
  return ar;
15093
15093
  };
15094
- var __spreadArray2 = exports2 && exports2.__spreadArray || function(to, from12) {
15095
- for (var i2 = 0, il = from12.length, j = to.length; i2 < il; i2++, j++)
15096
- to[j] = from12[i2];
15094
+ var __spreadArray2 = exports2 && exports2.__spreadArray || function(to, from11) {
15095
+ for (var i2 = 0, il = from11.length, j = to.length; i2 < il; i2++, j++)
15096
+ to[j] = from11[i2];
15097
15097
  return to;
15098
15098
  };
15099
15099
  Object.defineProperty(exports2, "__esModule", { value: true });
@@ -15638,9 +15638,9 @@ var require_merge2 = __commonJS({
15638
15638
  }
15639
15639
  return ar;
15640
15640
  };
15641
- var __spreadArray2 = exports2 && exports2.__spreadArray || function(to, from12) {
15642
- for (var i2 = 0, il = from12.length, j = to.length; i2 < il; i2++, j++)
15643
- to[j] = from12[i2];
15641
+ var __spreadArray2 = exports2 && exports2.__spreadArray || function(to, from11) {
15642
+ for (var i2 = 0, il = from11.length, j = to.length; i2 < il; i2++, j++)
15643
+ to[j] = from11[i2];
15644
15644
  return to;
15645
15645
  };
15646
15646
  Object.defineProperty(exports2, "__esModule", { value: true });
@@ -15685,9 +15685,9 @@ var require_mergeWith = __commonJS({
15685
15685
  }
15686
15686
  return ar;
15687
15687
  };
15688
- var __spreadArray2 = exports2 && exports2.__spreadArray || function(to, from12) {
15689
- for (var i2 = 0, il = from12.length, j = to.length; i2 < il; i2++, j++)
15690
- to[j] = from12[i2];
15688
+ var __spreadArray2 = exports2 && exports2.__spreadArray || function(to, from11) {
15689
+ for (var i2 = 0, il = from11.length, j = to.length; i2 < il; i2++, j++)
15690
+ to[j] = from11[i2];
15691
15691
  return to;
15692
15692
  };
15693
15693
  Object.defineProperty(exports2, "__esModule", { value: true });
@@ -15770,9 +15770,9 @@ var require_onErrorResumeNextWith = __commonJS({
15770
15770
  }
15771
15771
  return ar;
15772
15772
  };
15773
- var __spreadArray2 = exports2 && exports2.__spreadArray || function(to, from12) {
15774
- for (var i2 = 0, il = from12.length, j = to.length; i2 < il; i2++, j++)
15775
- to[j] = from12[i2];
15773
+ var __spreadArray2 = exports2 && exports2.__spreadArray || function(to, from11) {
15774
+ for (var i2 = 0, il = from11.length, j = to.length; i2 < il; i2++, j++)
15775
+ to[j] = from11[i2];
15776
15776
  return to;
15777
15777
  };
15778
15778
  Object.defineProperty(exports2, "__esModule", { value: true });
@@ -15954,9 +15954,9 @@ var require_raceWith = __commonJS({
15954
15954
  }
15955
15955
  return ar;
15956
15956
  };
15957
- var __spreadArray2 = exports2 && exports2.__spreadArray || function(to, from12) {
15958
- for (var i2 = 0, il = from12.length, j = to.length; i2 < il; i2++, j++)
15959
- to[j] = from12[i2];
15957
+ var __spreadArray2 = exports2 && exports2.__spreadArray || function(to, from11) {
15958
+ for (var i2 = 0, il = from11.length, j = to.length; i2 < il; i2++, j++)
15959
+ to[j] = from11[i2];
15960
15960
  return to;
15961
15961
  };
15962
15962
  Object.defineProperty(exports2, "__esModule", { value: true });
@@ -16352,9 +16352,9 @@ var require_share = __commonJS({
16352
16352
  }
16353
16353
  return ar;
16354
16354
  };
16355
- var __spreadArray2 = exports2 && exports2.__spreadArray || function(to, from12) {
16356
- for (var i2 = 0, il = from12.length, j = to.length; i2 < il; i2++, j++)
16357
- to[j] = from12[i2];
16355
+ var __spreadArray2 = exports2 && exports2.__spreadArray || function(to, from11) {
16356
+ for (var i2 = 0, il = from11.length, j = to.length; i2 < il; i2++, j++)
16357
+ to[j] = from11[i2];
16358
16358
  return to;
16359
16359
  };
16360
16360
  Object.defineProperty(exports2, "__esModule", { value: true });
@@ -17354,9 +17354,9 @@ var require_withLatestFrom = __commonJS({
17354
17354
  }
17355
17355
  return ar;
17356
17356
  };
17357
- var __spreadArray2 = exports2 && exports2.__spreadArray || function(to, from12) {
17358
- for (var i2 = 0, il = from12.length, j = to.length; i2 < il; i2++, j++)
17359
- to[j] = from12[i2];
17357
+ var __spreadArray2 = exports2 && exports2.__spreadArray || function(to, from11) {
17358
+ for (var i2 = 0, il = from11.length, j = to.length; i2 < il; i2++, j++)
17359
+ to[j] = from11[i2];
17360
17360
  return to;
17361
17361
  };
17362
17362
  Object.defineProperty(exports2, "__esModule", { value: true });
@@ -17440,9 +17440,9 @@ var require_zip2 = __commonJS({
17440
17440
  }
17441
17441
  return ar;
17442
17442
  };
17443
- var __spreadArray2 = exports2 && exports2.__spreadArray || function(to, from12) {
17444
- for (var i2 = 0, il = from12.length, j = to.length; i2 < il; i2++, j++)
17445
- to[j] = from12[i2];
17443
+ var __spreadArray2 = exports2 && exports2.__spreadArray || function(to, from11) {
17444
+ for (var i2 = 0, il = from11.length, j = to.length; i2 < il; i2++, j++)
17445
+ to[j] = from11[i2];
17446
17446
  return to;
17447
17447
  };
17448
17448
  Object.defineProperty(exports2, "__esModule", { value: true });
@@ -17483,9 +17483,9 @@ var require_zipWith = __commonJS({
17483
17483
  }
17484
17484
  return ar;
17485
17485
  };
17486
- var __spreadArray2 = exports2 && exports2.__spreadArray || function(to, from12) {
17487
- for (var i2 = 0, il = from12.length, j = to.length; i2 < il; i2++, j++)
17488
- to[j] = from12[i2];
17486
+ var __spreadArray2 = exports2 && exports2.__spreadArray || function(to, from11) {
17487
+ for (var i2 = 0, il = from11.length, j = to.length; i2 < il; i2++, j++)
17488
+ to[j] = from11[i2];
17489
17489
  return to;
17490
17490
  };
17491
17491
  Object.defineProperty(exports2, "__esModule", { value: true });
@@ -18251,9 +18251,9 @@ var require_race2 = __commonJS({
18251
18251
  }
18252
18252
  return ar;
18253
18253
  };
18254
- var __spreadArray2 = exports2 && exports2.__spreadArray || function(to, from12) {
18255
- for (var i2 = 0, il = from12.length, j = to.length; i2 < il; i2++, j++)
18256
- to[j] = from12[i2];
18254
+ var __spreadArray2 = exports2 && exports2.__spreadArray || function(to, from11) {
18255
+ for (var i2 = 0, il = from11.length, j = to.length; i2 < il; i2++, j++)
18256
+ to[j] = from11[i2];
18257
18257
  return to;
18258
18258
  };
18259
18259
  Object.defineProperty(exports2, "__esModule", { value: true });
@@ -24479,7 +24479,7 @@ var require_auth = __commonJS({
24479
24479
  var b = a && (a[mf] ? "phone" : null);
24480
24480
  if (b && a && a[nf]) {
24481
24481
  K(this, "uid", a[nf]);
24482
- K(this, "displayName", a[of10] || null);
24482
+ K(this, "displayName", a[of11] || null);
24483
24483
  var c = null;
24484
24484
  a[pf] && (c = new Date(a[pf]).toUTCString());
24485
24485
  K(this, "enrollmentTime", c);
@@ -24497,7 +24497,7 @@ var require_auth = __commonJS({
24497
24497
  }
24498
24498
  return b;
24499
24499
  }
24500
- var of10 = "displayName", pf = "enrolledAt", nf = "mfaEnrollmentId", mf = "phoneInfo";
24500
+ var of11 = "displayName", pf = "enrolledAt", nf = "mfaEnrollmentId", mf = "phoneInfo";
24501
24501
  function rf(a) {
24502
24502
  lf.call(this, a);
24503
24503
  K(this, "phoneNumber", a[mf]);
@@ -27878,7 +27878,7 @@ var require_auth = __commonJS({
27878
27878
  var e2 = null, f3 = {};
27879
27879
  if (d) {
27880
27880
  d.uid && (f3[nf] = d.uid);
27881
- d.displayName && (f3[of10] = d.displayName);
27881
+ d.displayName && (f3[of11] = d.displayName);
27882
27882
  d.enrollmentTime && (f3[pf] = new Date(d.enrollmentTime).toISOString());
27883
27883
  d.phoneNumber && (f3[mf] = d.phoneNumber);
27884
27884
  try {
@@ -31500,7 +31500,7 @@ var require_from2 = __commonJS({
31500
31500
  return obj;
31501
31501
  }
31502
31502
  var ERR_INVALID_ARG_TYPE = require_errors().codes.ERR_INVALID_ARG_TYPE;
31503
- function from12(Readable2, iterable, opts) {
31503
+ function from11(Readable2, iterable, opts) {
31504
31504
  var iterator;
31505
31505
  if (iterable && typeof iterable.next === "function") {
31506
31506
  iterator = iterable;
@@ -31539,7 +31539,7 @@ var require_from2 = __commonJS({
31539
31539
  }
31540
31540
  return readable;
31541
31541
  }
31542
- module2.exports = from12;
31542
+ module2.exports = from11;
31543
31543
  }
31544
31544
  });
31545
31545
 
@@ -31583,7 +31583,7 @@ var require_stream_readable = __commonJS({
31583
31583
  var ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;
31584
31584
  var StringDecoder;
31585
31585
  var createReadableStreamAsyncIterator;
31586
- var from12;
31586
+ var from11;
31587
31587
  require_inherits()(Readable2, Stream3);
31588
31588
  var errorOrDestroy = destroyImpl.errorOrDestroy;
31589
31589
  var kProxyEvents = ["error", "close", "destroy", "pause", "resume"];
@@ -32265,10 +32265,10 @@ var require_stream_readable = __commonJS({
32265
32265
  }
32266
32266
  if (typeof Symbol === "function") {
32267
32267
  Readable2.from = function(iterable, opts) {
32268
- if (from12 === void 0) {
32269
- from12 = require_from2();
32268
+ if (from11 === void 0) {
32269
+ from11 = require_from2();
32270
32270
  }
32271
- return from12(Readable2, iterable, opts);
32271
+ return from11(Readable2, iterable, opts);
32272
32272
  };
32273
32273
  }
32274
32274
  function indexOf(xs, x2) {
@@ -32448,8 +32448,8 @@ var require_pipeline = __commonJS({
32448
32448
  function call(fn) {
32449
32449
  fn();
32450
32450
  }
32451
- function pipe2(from12, to) {
32452
- return from12.pipe(to);
32451
+ function pipe2(from11, to) {
32452
+ return from11.pipe(to);
32453
32453
  }
32454
32454
  function popCallback(streams) {
32455
32455
  if (!streams.length) return noop3;
@@ -34227,7 +34227,7 @@ var require_from3 = __commonJS({
34227
34227
  return obj;
34228
34228
  }
34229
34229
  var ERR_INVALID_ARG_TYPE = require_errors2().codes.ERR_INVALID_ARG_TYPE;
34230
- function from12(Readable2, iterable, opts) {
34230
+ function from11(Readable2, iterable, opts) {
34231
34231
  var iterator;
34232
34232
  if (iterable && typeof iterable.next === "function") {
34233
34233
  iterator = iterable;
@@ -34266,7 +34266,7 @@ var require_from3 = __commonJS({
34266
34266
  }
34267
34267
  return readable;
34268
34268
  }
34269
- module2.exports = from12;
34269
+ module2.exports = from11;
34270
34270
  }
34271
34271
  });
34272
34272
 
@@ -34310,7 +34310,7 @@ var require_stream_readable2 = __commonJS({
34310
34310
  var ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;
34311
34311
  var StringDecoder;
34312
34312
  var createReadableStreamAsyncIterator;
34313
- var from12;
34313
+ var from11;
34314
34314
  require_inherits()(Readable2, Stream3);
34315
34315
  var errorOrDestroy = destroyImpl.errorOrDestroy;
34316
34316
  var kProxyEvents = ["error", "close", "destroy", "pause", "resume"];
@@ -34992,10 +34992,10 @@ var require_stream_readable2 = __commonJS({
34992
34992
  }
34993
34993
  if (typeof Symbol === "function") {
34994
34994
  Readable2.from = function(iterable, opts) {
34995
- if (from12 === void 0) {
34996
- from12 = require_from3();
34995
+ if (from11 === void 0) {
34996
+ from11 = require_from3();
34997
34997
  }
34998
- return from12(Readable2, iterable, opts);
34998
+ return from11(Readable2, iterable, opts);
34999
34999
  };
35000
35000
  }
35001
35001
  function indexOf(xs, x2) {
@@ -35175,8 +35175,8 @@ var require_pipeline2 = __commonJS({
35175
35175
  function call(fn) {
35176
35176
  fn();
35177
35177
  }
35178
- function pipe2(from12, to) {
35179
- return from12.pipe(to);
35178
+ function pipe2(from11, to) {
35179
+ return from11.pipe(to);
35180
35180
  }
35181
35181
  function popCallback(streams) {
35182
35182
  if (!streams.length) return noop3;
@@ -36995,14 +36995,14 @@ function __spreadArrays() {
36995
36995
  r2[k] = a[j];
36996
36996
  return r2;
36997
36997
  }
36998
- function __spreadArray(to, from12, pack) {
36999
- if (pack || arguments.length === 2) for (var i2 = 0, l = from12.length, ar; i2 < l; i2++) {
37000
- if (ar || !(i2 in from12)) {
37001
- if (!ar) ar = Array.prototype.slice.call(from12, 0, i2);
37002
- ar[i2] = from12[i2];
36998
+ function __spreadArray(to, from11, pack) {
36999
+ if (pack || arguments.length === 2) for (var i2 = 0, l = from11.length, ar; i2 < l; i2++) {
37000
+ if (ar || !(i2 in from11)) {
37001
+ if (!ar) ar = Array.prototype.slice.call(from11, 0, i2);
37002
+ ar[i2] = from11[i2];
37003
37003
  }
37004
37004
  }
37005
- return to.concat(ar || Array.prototype.slice.call(from12));
37005
+ return to.concat(ar || Array.prototype.slice.call(from11));
37006
37006
  }
37007
37007
  function __await(v) {
37008
37008
  return this instanceof __await ? (this.v = v, this) : new __await(v);
@@ -39526,11 +39526,11 @@ var require_typescript = __commonJS({
39526
39526
  for (var name2 in all)
39527
39527
  __defProp2(target, name2, { get: all[name2], enumerable: true });
39528
39528
  };
39529
- var __copyProps2 = (to, from12, except, desc) => {
39530
- if (from12 && typeof from12 === "object" || typeof from12 === "function") {
39531
- for (let key of __getOwnPropNames2(from12))
39529
+ var __copyProps2 = (to, from11, except, desc) => {
39530
+ if (from11 && typeof from11 === "object" || typeof from11 === "function") {
39531
+ for (let key of __getOwnPropNames2(from11))
39532
39532
  if (!__hasOwnProp2.call(to, key) && key !== except)
39533
- __defProp2(to, key, { get: () => from12[key], enumerable: !(desc = __getOwnPropDesc2(from12, key)) || desc.enumerable });
39533
+ __defProp2(to, key, { get: () => from11[key], enumerable: !(desc = __getOwnPropDesc2(from11, key)) || desc.enumerable });
39534
39534
  }
39535
39535
  return to;
39536
39536
  };
@@ -42374,14 +42374,14 @@ var require_typescript = __commonJS({
42374
42374
  function toOffset(array2, offset) {
42375
42375
  return offset < 0 ? array2.length + offset : offset;
42376
42376
  }
42377
- function addRange(to, from12, start2, end) {
42378
- if (from12 === void 0 || from12.length === 0) return to;
42379
- if (to === void 0) return from12.slice(start2, end);
42380
- start2 = start2 === void 0 ? 0 : toOffset(from12, start2);
42381
- end = end === void 0 ? from12.length : toOffset(from12, end);
42382
- for (let i2 = start2; i2 < end && i2 < from12.length; i2++) {
42383
- if (from12[i2] !== void 0) {
42384
- to.push(from12[i2]);
42377
+ function addRange(to, from11, start2, end) {
42378
+ if (from11 === void 0 || from11.length === 0) return to;
42379
+ if (to === void 0) return from11.slice(start2, end);
42380
+ start2 = start2 === void 0 ? 0 : toOffset(from11, start2);
42381
+ end = end === void 0 ? from11.length : toOffset(from11, end);
42382
+ for (let i2 = start2; i2 < end && i2 < from11.length; i2++) {
42383
+ if (from11[i2] !== void 0) {
42384
+ to.push(from11[i2]);
42385
42385
  }
42386
42386
  }
42387
42387
  return to;
@@ -48890,8 +48890,8 @@ ${lanes.join("\n")}
48890
48890
  const canonicalDirectoryName = getCanonicalFileName(directoryName);
48891
48891
  return startsWith(canonicalFileName, canonicalDirectoryName + "/") || startsWith(canonicalFileName, canonicalDirectoryName + "\\");
48892
48892
  }
48893
- function getPathComponentsRelativeTo(from12, to, stringEqualityComparer, getCanonicalFileName) {
48894
- const fromComponents = reducePathComponents(getPathComponents(from12));
48893
+ function getPathComponentsRelativeTo(from11, to, stringEqualityComparer, getCanonicalFileName) {
48894
+ const fromComponents = reducePathComponents(getPathComponents(from11));
48895
48895
  const toComponents = reducePathComponents(getPathComponents(to));
48896
48896
  let start2;
48897
48897
  for (start2 = 0; start2 < fromComponents.length && start2 < toComponents.length; start2++) {
@@ -48927,8 +48927,8 @@ ${lanes.join("\n")}
48927
48927
  false
48928
48928
  );
48929
48929
  }
48930
- function getRelativePathFromFile(from12, to, getCanonicalFileName) {
48931
- return ensurePathIsNonModuleName(getRelativePathFromDirectory(getDirectoryPath(from12), to, getCanonicalFileName));
48930
+ function getRelativePathFromFile(from11, to, getCanonicalFileName) {
48931
+ return ensurePathIsNonModuleName(getRelativePathFromDirectory(getDirectoryPath(from11), to, getCanonicalFileName));
48932
48932
  }
48933
48933
  function getRelativePathToDirectoryOrUrl(directoryPathOrUrl, relativeOrAbsolutePath, currentDirectory, getCanonicalFileName, isAbsolutePathAnUrl) {
48934
48934
  const pathComponents2 = getPathComponentsRelativeTo(
@@ -56479,15 +56479,15 @@ ${lanes.join("\n")}
56479
56479
  if (!nodeArray || isArray(child) || !isElement(child)) return false;
56480
56480
  return contains(nodeArray, child);
56481
56481
  }
56482
- function insertStatementsAfterPrologue(to, from12, isPrologueDirective2) {
56483
- if (from12 === void 0 || from12.length === 0) return to;
56482
+ function insertStatementsAfterPrologue(to, from11, isPrologueDirective2) {
56483
+ if (from11 === void 0 || from11.length === 0) return to;
56484
56484
  let statementIndex = 0;
56485
56485
  for (; statementIndex < to.length; ++statementIndex) {
56486
56486
  if (!isPrologueDirective2(to[statementIndex])) {
56487
56487
  break;
56488
56488
  }
56489
56489
  }
56490
- to.splice(statementIndex, 0, ...from12);
56490
+ to.splice(statementIndex, 0, ...from11);
56491
56491
  return to;
56492
56492
  }
56493
56493
  function insertStatementAfterPrologue(to, statement, isPrologueDirective2) {
@@ -56504,11 +56504,11 @@ ${lanes.join("\n")}
56504
56504
  function isAnyPrologueDirective(node) {
56505
56505
  return isPrologueDirective(node) || !!(getEmitFlags(node) & 2097152);
56506
56506
  }
56507
- function insertStatementsAfterStandardPrologue(to, from12) {
56508
- return insertStatementsAfterPrologue(to, from12, isPrologueDirective);
56507
+ function insertStatementsAfterStandardPrologue(to, from11) {
56508
+ return insertStatementsAfterPrologue(to, from11, isPrologueDirective);
56509
56509
  }
56510
- function insertStatementsAfterCustomPrologue(to, from12) {
56511
- return insertStatementsAfterPrologue(to, from12, isAnyPrologueDirective);
56510
+ function insertStatementsAfterCustomPrologue(to, from11) {
56511
+ return insertStatementsAfterPrologue(to, from11, isAnyPrologueDirective);
56512
56512
  }
56513
56513
  function insertStatementAfterStandardPrologue(to, statement) {
56514
56514
  return insertStatementAfterPrologue(to, statement, isPrologueDirective);
@@ -70987,13 +70987,13 @@ ${lanes.join("\n")}
70987
70987
  [cooked, raw]
70988
70988
  );
70989
70989
  }
70990
- function createSpreadArrayHelper(to, from12, packFrom) {
70990
+ function createSpreadArrayHelper(to, from11, packFrom) {
70991
70991
  context.requestEmitHelper(spreadArrayHelper);
70992
70992
  return factory2.createCallExpression(
70993
70993
  getUnscopedHelperName("__spreadArray"),
70994
70994
  /*typeArguments*/
70995
70995
  void 0,
70996
- [to, from12, packFrom ? immutableTrue() : immutableFalse()]
70996
+ [to, from11, packFrom ? immutableTrue() : immutableFalse()]
70997
70997
  );
70998
70998
  }
70999
70999
  function createPropKeyHelper(expr) {
@@ -203357,8 +203357,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
203357
203357
  }
203358
203358
  } else {
203359
203359
  for (const pos2 of positions) {
203360
- const from12 = pos2 - closeMultiline.length > 0 ? pos2 - closeMultiline.length : 0;
203361
- const offset = text.substr(from12, closeMultiline.length) === closeMultiline ? closeMultiline.length : 0;
203360
+ const from11 = pos2 - closeMultiline.length > 0 ? pos2 - closeMultiline.length : 0;
203361
+ const offset = text.substr(from11, closeMultiline.length) === closeMultiline ? closeMultiline.length : 0;
203362
203362
  textChanges2.push({
203363
203363
  newText: "",
203364
203364
  span: {
@@ -204543,8 +204543,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
204543
204543
  function getCallSiteGroupKey(entry) {
204544
204544
  return getNodeId(entry.declaration);
204545
204545
  }
204546
- function createCallHierarchyIncomingCall(from12, fromSpans) {
204547
- return { from: from12, fromSpans };
204546
+ function createCallHierarchyIncomingCall(from11, fromSpans) {
204547
+ return { from: from11, fromSpans };
204548
204548
  }
204549
204549
  function convertCallSiteGroupToIncomingCall(program2, entries) {
204550
204550
  return createCallHierarchyIncomingCall(createCallHierarchyItem(program2, entries[0].declaration), map21(entries, (entry) => createTextSpanFromRange(entry.range)));
@@ -207718,11 +207718,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
207718
207718
  const rightSibling = currentNodeIndex < maxChildIndex ? commentNode.getChildAt(currentNodeIndex + 1) : void 0;
207719
207719
  return { leftSibling, rightSibling };
207720
207720
  }
207721
- function findEndOfTextBetween(jsDocComment, from12, to) {
207722
- const comment = jsDocComment.getText().substring(from12 - jsDocComment.getStart(), to - jsDocComment.getStart());
207721
+ function findEndOfTextBetween(jsDocComment, from11, to) {
207722
+ const comment = jsDocComment.getText().substring(from11 - jsDocComment.getStart(), to - jsDocComment.getStart());
207723
207723
  for (let i2 = comment.length; i2 > 0; i2--) {
207724
207724
  if (!/[*/\s]/.test(comment.substring(i2 - 1, i2))) {
207725
- return from12 + i2;
207725
+ return from11 + i2;
207726
207726
  }
207727
207727
  }
207728
207728
  return to;
@@ -232798,9 +232798,9 @@ ${options.prefix}` : "\n" : options.prefix
232798
232798
  function toTokenRange(arg) {
232799
232799
  return typeof arg === "number" ? tokenRangeFrom([arg]) : isArray(arg) ? tokenRangeFrom(arg) : arg;
232800
232800
  }
232801
- function tokenRangeFromRange(from12, to, except = []) {
232801
+ function tokenRangeFromRange(from11, to, except = []) {
232802
232802
  const tokens = [];
232803
- for (let token = from12; token <= to; token++) {
232803
+ for (let token = from11; token <= to; token++) {
232804
232804
  if (!contains(except, token)) {
232805
232805
  tokens.push(token);
232806
232806
  }
@@ -250485,2219 +250485,6 @@ var require_src = __commonJS({
250485
250485
  }
250486
250486
  });
250487
250487
 
250488
- // ../../node_modules/esbuild/lib/main.js
250489
- var require_main = __commonJS({
250490
- "../../node_modules/esbuild/lib/main.js"(exports2, module2) {
250491
- "use strict";
250492
- var __defProp2 = Object.defineProperty;
250493
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
250494
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
250495
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
250496
- var __export2 = (target, all) => {
250497
- for (var name2 in all)
250498
- __defProp2(target, name2, { get: all[name2], enumerable: true });
250499
- };
250500
- var __copyProps2 = (to, from12, except, desc) => {
250501
- if (from12 && typeof from12 === "object" || typeof from12 === "function") {
250502
- for (let key of __getOwnPropNames2(from12))
250503
- if (!__hasOwnProp2.call(to, key) && key !== except)
250504
- __defProp2(to, key, { get: () => from12[key], enumerable: !(desc = __getOwnPropDesc2(from12, key)) || desc.enumerable });
250505
- }
250506
- return to;
250507
- };
250508
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
250509
- var node_exports = {};
250510
- __export2(node_exports, {
250511
- analyzeMetafile: () => analyzeMetafile,
250512
- analyzeMetafileSync: () => analyzeMetafileSync,
250513
- build: () => build,
250514
- buildSync: () => buildSync,
250515
- context: () => context,
250516
- default: () => node_default,
250517
- formatMessages: () => formatMessages,
250518
- formatMessagesSync: () => formatMessagesSync,
250519
- initialize: () => initialize,
250520
- stop: () => stop,
250521
- transform: () => transform2,
250522
- transformSync: () => transformSync,
250523
- version: () => version2
250524
- });
250525
- module2.exports = __toCommonJS2(node_exports);
250526
- function encodePacket(packet) {
250527
- let visit = (value) => {
250528
- if (value === null) {
250529
- bb.write8(0);
250530
- } else if (typeof value === "boolean") {
250531
- bb.write8(1);
250532
- bb.write8(+value);
250533
- } else if (typeof value === "number") {
250534
- bb.write8(2);
250535
- bb.write32(value | 0);
250536
- } else if (typeof value === "string") {
250537
- bb.write8(3);
250538
- bb.write(encodeUTF8(value));
250539
- } else if (value instanceof Uint8Array) {
250540
- bb.write8(4);
250541
- bb.write(value);
250542
- } else if (value instanceof Array) {
250543
- bb.write8(5);
250544
- bb.write32(value.length);
250545
- for (let item of value) {
250546
- visit(item);
250547
- }
250548
- } else {
250549
- let keys = Object.keys(value);
250550
- bb.write8(6);
250551
- bb.write32(keys.length);
250552
- for (let key of keys) {
250553
- bb.write(encodeUTF8(key));
250554
- visit(value[key]);
250555
- }
250556
- }
250557
- };
250558
- let bb = new ByteBuffer();
250559
- bb.write32(0);
250560
- bb.write32(packet.id << 1 | +!packet.isRequest);
250561
- visit(packet.value);
250562
- writeUInt32LE(bb.buf, bb.len - 4, 0);
250563
- return bb.buf.subarray(0, bb.len);
250564
- }
250565
- function decodePacket(bytes) {
250566
- let visit = () => {
250567
- switch (bb.read8()) {
250568
- case 0:
250569
- return null;
250570
- case 1:
250571
- return !!bb.read8();
250572
- case 2:
250573
- return bb.read32();
250574
- case 3:
250575
- return decodeUTF8(bb.read());
250576
- case 4:
250577
- return bb.read();
250578
- case 5: {
250579
- let count = bb.read32();
250580
- let value2 = [];
250581
- for (let i2 = 0; i2 < count; i2++) {
250582
- value2.push(visit());
250583
- }
250584
- return value2;
250585
- }
250586
- case 6: {
250587
- let count = bb.read32();
250588
- let value2 = {};
250589
- for (let i2 = 0; i2 < count; i2++) {
250590
- value2[decodeUTF8(bb.read())] = visit();
250591
- }
250592
- return value2;
250593
- }
250594
- default:
250595
- throw new Error("Invalid packet");
250596
- }
250597
- };
250598
- let bb = new ByteBuffer(bytes);
250599
- let id = bb.read32();
250600
- let isRequest2 = (id & 1) === 0;
250601
- id >>>= 1;
250602
- let value = visit();
250603
- if (bb.ptr !== bytes.length) {
250604
- throw new Error("Invalid packet");
250605
- }
250606
- return { id, isRequest: isRequest2, value };
250607
- }
250608
- var ByteBuffer = class {
250609
- constructor(buf = new Uint8Array(1024)) {
250610
- this.buf = buf;
250611
- this.len = 0;
250612
- this.ptr = 0;
250613
- }
250614
- _write(delta) {
250615
- if (this.len + delta > this.buf.length) {
250616
- let clone3 = new Uint8Array((this.len + delta) * 2);
250617
- clone3.set(this.buf);
250618
- this.buf = clone3;
250619
- }
250620
- this.len += delta;
250621
- return this.len - delta;
250622
- }
250623
- write8(value) {
250624
- let offset = this._write(1);
250625
- this.buf[offset] = value;
250626
- }
250627
- write32(value) {
250628
- let offset = this._write(4);
250629
- writeUInt32LE(this.buf, value, offset);
250630
- }
250631
- write(bytes) {
250632
- let offset = this._write(4 + bytes.length);
250633
- writeUInt32LE(this.buf, bytes.length, offset);
250634
- this.buf.set(bytes, offset + 4);
250635
- }
250636
- _read(delta) {
250637
- if (this.ptr + delta > this.buf.length) {
250638
- throw new Error("Invalid packet");
250639
- }
250640
- this.ptr += delta;
250641
- return this.ptr - delta;
250642
- }
250643
- read8() {
250644
- return this.buf[this._read(1)];
250645
- }
250646
- read32() {
250647
- return readUInt32LE(this.buf, this._read(4));
250648
- }
250649
- read() {
250650
- let length = this.read32();
250651
- let bytes = new Uint8Array(length);
250652
- let ptr = this._read(bytes.length);
250653
- bytes.set(this.buf.subarray(ptr, ptr + length));
250654
- return bytes;
250655
- }
250656
- };
250657
- var encodeUTF8;
250658
- var decodeUTF8;
250659
- var encodeInvariant;
250660
- if (typeof TextEncoder !== "undefined" && typeof TextDecoder !== "undefined") {
250661
- let encoder = new TextEncoder();
250662
- let decoder = new TextDecoder();
250663
- encodeUTF8 = (text) => encoder.encode(text);
250664
- decodeUTF8 = (bytes) => decoder.decode(bytes);
250665
- encodeInvariant = 'new TextEncoder().encode("")';
250666
- } else if (typeof Buffer !== "undefined") {
250667
- encodeUTF8 = (text) => Buffer.from(text);
250668
- decodeUTF8 = (bytes) => {
250669
- let { buffer, byteOffset, byteLength } = bytes;
250670
- return Buffer.from(buffer, byteOffset, byteLength).toString();
250671
- };
250672
- encodeInvariant = 'Buffer.from("")';
250673
- } else {
250674
- throw new Error("No UTF-8 codec found");
250675
- }
250676
- if (!(encodeUTF8("") instanceof Uint8Array))
250677
- throw new Error(`Invariant violation: "${encodeInvariant} instanceof Uint8Array" is incorrectly false
250678
-
250679
- This indicates that your JavaScript environment is broken. You cannot use
250680
- esbuild in this environment because esbuild relies on this invariant. This
250681
- is not a problem with esbuild. You need to fix your environment instead.
250682
- `);
250683
- function readUInt32LE(buffer, offset) {
250684
- return buffer[offset++] | buffer[offset++] << 8 | buffer[offset++] << 16 | buffer[offset++] << 24;
250685
- }
250686
- function writeUInt32LE(buffer, value, offset) {
250687
- buffer[offset++] = value;
250688
- buffer[offset++] = value >> 8;
250689
- buffer[offset++] = value >> 16;
250690
- buffer[offset++] = value >> 24;
250691
- }
250692
- var quote = JSON.stringify;
250693
- var buildLogLevelDefault = "warning";
250694
- var transformLogLevelDefault = "silent";
250695
- function validateAndJoinStringArray(values, what) {
250696
- const toJoin = [];
250697
- for (const value of values) {
250698
- validateStringValue(value, what);
250699
- if (value.indexOf(",") >= 0) throw new Error(`Invalid ${what}: ${value}`);
250700
- toJoin.push(value);
250701
- }
250702
- return toJoin.join(",");
250703
- }
250704
- var canBeAnything = () => null;
250705
- var mustBeBoolean = (value) => typeof value === "boolean" ? null : "a boolean";
250706
- var mustBeString = (value) => typeof value === "string" ? null : "a string";
250707
- var mustBeRegExp = (value) => value instanceof RegExp ? null : "a RegExp object";
250708
- var mustBeInteger = (value) => typeof value === "number" && value === (value | 0) ? null : "an integer";
250709
- var mustBeValidPortNumber = (value) => typeof value === "number" && value === (value | 0) && value >= 0 && value <= 65535 ? null : "a valid port number";
250710
- var mustBeFunction = (value) => typeof value === "function" ? null : "a function";
250711
- var mustBeArray = (value) => Array.isArray(value) ? null : "an array";
250712
- var mustBeArrayOfStrings = (value) => Array.isArray(value) && value.every((x2) => typeof x2 === "string") ? null : "an array of strings";
250713
- var mustBeObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value) ? null : "an object";
250714
- var mustBeEntryPoints = (value) => typeof value === "object" && value !== null ? null : "an array or an object";
250715
- var mustBeWebAssemblyModule = (value) => value instanceof WebAssembly.Module ? null : "a WebAssembly.Module";
250716
- var mustBeObjectOrNull = (value) => typeof value === "object" && !Array.isArray(value) ? null : "an object or null";
250717
- var mustBeStringOrBoolean = (value) => typeof value === "string" || typeof value === "boolean" ? null : "a string or a boolean";
250718
- var mustBeStringOrObject = (value) => typeof value === "string" || typeof value === "object" && value !== null && !Array.isArray(value) ? null : "a string or an object";
250719
- var mustBeStringOrArrayOfStrings = (value) => typeof value === "string" || Array.isArray(value) && value.every((x2) => typeof x2 === "string") ? null : "a string or an array of strings";
250720
- var mustBeStringOrUint8Array = (value) => typeof value === "string" || value instanceof Uint8Array ? null : "a string or a Uint8Array";
250721
- var mustBeStringOrURL = (value) => typeof value === "string" || value instanceof URL ? null : "a string or a URL";
250722
- function getFlag(object3, keys, key, mustBeFn) {
250723
- let value = object3[key];
250724
- keys[key + ""] = true;
250725
- if (value === void 0) return void 0;
250726
- let mustBe = mustBeFn(value);
250727
- if (mustBe !== null) throw new Error(`${quote(key)} must be ${mustBe}`);
250728
- return value;
250729
- }
250730
- function checkForInvalidFlags(object3, keys, where) {
250731
- for (let key in object3) {
250732
- if (!(key in keys)) {
250733
- throw new Error(`Invalid option ${where}: ${quote(key)}`);
250734
- }
250735
- }
250736
- }
250737
- function validateInitializeOptions(options) {
250738
- let keys = /* @__PURE__ */ Object.create(null);
250739
- let wasmURL = getFlag(options, keys, "wasmURL", mustBeStringOrURL);
250740
- let wasmModule = getFlag(options, keys, "wasmModule", mustBeWebAssemblyModule);
250741
- let worker = getFlag(options, keys, "worker", mustBeBoolean);
250742
- checkForInvalidFlags(options, keys, "in initialize() call");
250743
- return {
250744
- wasmURL,
250745
- wasmModule,
250746
- worker
250747
- };
250748
- }
250749
- function validateMangleCache(mangleCache) {
250750
- let validated;
250751
- if (mangleCache !== void 0) {
250752
- validated = /* @__PURE__ */ Object.create(null);
250753
- for (let key in mangleCache) {
250754
- let value = mangleCache[key];
250755
- if (typeof value === "string" || value === false) {
250756
- validated[key] = value;
250757
- } else {
250758
- throw new Error(`Expected ${quote(key)} in mangle cache to map to either a string or false`);
250759
- }
250760
- }
250761
- }
250762
- return validated;
250763
- }
250764
- function pushLogFlags(flags, options, keys, isTTY2, logLevelDefault) {
250765
- let color = getFlag(options, keys, "color", mustBeBoolean);
250766
- let logLevel = getFlag(options, keys, "logLevel", mustBeString);
250767
- let logLimit = getFlag(options, keys, "logLimit", mustBeInteger);
250768
- if (color !== void 0) flags.push(`--color=${color}`);
250769
- else if (isTTY2) flags.push(`--color=true`);
250770
- flags.push(`--log-level=${logLevel || logLevelDefault}`);
250771
- flags.push(`--log-limit=${logLimit || 0}`);
250772
- }
250773
- function validateStringValue(value, what, key) {
250774
- if (typeof value !== "string") {
250775
- throw new Error(`Expected value for ${what}${key !== void 0 ? " " + quote(key) : ""} to be a string, got ${typeof value} instead`);
250776
- }
250777
- return value;
250778
- }
250779
- function pushCommonFlags(flags, options, keys) {
250780
- let legalComments = getFlag(options, keys, "legalComments", mustBeString);
250781
- let sourceRoot = getFlag(options, keys, "sourceRoot", mustBeString);
250782
- let sourcesContent = getFlag(options, keys, "sourcesContent", mustBeBoolean);
250783
- let target = getFlag(options, keys, "target", mustBeStringOrArrayOfStrings);
250784
- let format = getFlag(options, keys, "format", mustBeString);
250785
- let globalName = getFlag(options, keys, "globalName", mustBeString);
250786
- let mangleProps = getFlag(options, keys, "mangleProps", mustBeRegExp);
250787
- let reserveProps = getFlag(options, keys, "reserveProps", mustBeRegExp);
250788
- let mangleQuoted = getFlag(options, keys, "mangleQuoted", mustBeBoolean);
250789
- let minify = getFlag(options, keys, "minify", mustBeBoolean);
250790
- let minifySyntax = getFlag(options, keys, "minifySyntax", mustBeBoolean);
250791
- let minifyWhitespace = getFlag(options, keys, "minifyWhitespace", mustBeBoolean);
250792
- let minifyIdentifiers = getFlag(options, keys, "minifyIdentifiers", mustBeBoolean);
250793
- let lineLimit = getFlag(options, keys, "lineLimit", mustBeInteger);
250794
- let drop = getFlag(options, keys, "drop", mustBeArrayOfStrings);
250795
- let dropLabels = getFlag(options, keys, "dropLabels", mustBeArrayOfStrings);
250796
- let charset = getFlag(options, keys, "charset", mustBeString);
250797
- let treeShaking = getFlag(options, keys, "treeShaking", mustBeBoolean);
250798
- let ignoreAnnotations = getFlag(options, keys, "ignoreAnnotations", mustBeBoolean);
250799
- let jsx = getFlag(options, keys, "jsx", mustBeString);
250800
- let jsxFactory = getFlag(options, keys, "jsxFactory", mustBeString);
250801
- let jsxFragment = getFlag(options, keys, "jsxFragment", mustBeString);
250802
- let jsxImportSource = getFlag(options, keys, "jsxImportSource", mustBeString);
250803
- let jsxDev = getFlag(options, keys, "jsxDev", mustBeBoolean);
250804
- let jsxSideEffects = getFlag(options, keys, "jsxSideEffects", mustBeBoolean);
250805
- let define2 = getFlag(options, keys, "define", mustBeObject);
250806
- let logOverride = getFlag(options, keys, "logOverride", mustBeObject);
250807
- let supported = getFlag(options, keys, "supported", mustBeObject);
250808
- let pure = getFlag(options, keys, "pure", mustBeArrayOfStrings);
250809
- let keepNames = getFlag(options, keys, "keepNames", mustBeBoolean);
250810
- let platform = getFlag(options, keys, "platform", mustBeString);
250811
- let tsconfigRaw = getFlag(options, keys, "tsconfigRaw", mustBeStringOrObject);
250812
- let absPaths = getFlag(options, keys, "absPaths", mustBeArrayOfStrings);
250813
- if (legalComments) flags.push(`--legal-comments=${legalComments}`);
250814
- if (sourceRoot !== void 0) flags.push(`--source-root=${sourceRoot}`);
250815
- if (sourcesContent !== void 0) flags.push(`--sources-content=${sourcesContent}`);
250816
- if (target) flags.push(`--target=${validateAndJoinStringArray(Array.isArray(target) ? target : [target], "target")}`);
250817
- if (format) flags.push(`--format=${format}`);
250818
- if (globalName) flags.push(`--global-name=${globalName}`);
250819
- if (platform) flags.push(`--platform=${platform}`);
250820
- if (tsconfigRaw) flags.push(`--tsconfig-raw=${typeof tsconfigRaw === "string" ? tsconfigRaw : JSON.stringify(tsconfigRaw)}`);
250821
- if (minify) flags.push("--minify");
250822
- if (minifySyntax) flags.push("--minify-syntax");
250823
- if (minifyWhitespace) flags.push("--minify-whitespace");
250824
- if (minifyIdentifiers) flags.push("--minify-identifiers");
250825
- if (lineLimit) flags.push(`--line-limit=${lineLimit}`);
250826
- if (charset) flags.push(`--charset=${charset}`);
250827
- if (treeShaking !== void 0) flags.push(`--tree-shaking=${treeShaking}`);
250828
- if (ignoreAnnotations) flags.push(`--ignore-annotations`);
250829
- if (drop) for (let what of drop) flags.push(`--drop:${validateStringValue(what, "drop")}`);
250830
- if (dropLabels) flags.push(`--drop-labels=${validateAndJoinStringArray(dropLabels, "drop label")}`);
250831
- if (absPaths) flags.push(`--abs-paths=${validateAndJoinStringArray(absPaths, "abs paths")}`);
250832
- if (mangleProps) flags.push(`--mangle-props=${jsRegExpToGoRegExp(mangleProps)}`);
250833
- if (reserveProps) flags.push(`--reserve-props=${jsRegExpToGoRegExp(reserveProps)}`);
250834
- if (mangleQuoted !== void 0) flags.push(`--mangle-quoted=${mangleQuoted}`);
250835
- if (jsx) flags.push(`--jsx=${jsx}`);
250836
- if (jsxFactory) flags.push(`--jsx-factory=${jsxFactory}`);
250837
- if (jsxFragment) flags.push(`--jsx-fragment=${jsxFragment}`);
250838
- if (jsxImportSource) flags.push(`--jsx-import-source=${jsxImportSource}`);
250839
- if (jsxDev) flags.push(`--jsx-dev`);
250840
- if (jsxSideEffects) flags.push(`--jsx-side-effects`);
250841
- if (define2) {
250842
- for (let key in define2) {
250843
- if (key.indexOf("=") >= 0) throw new Error(`Invalid define: ${key}`);
250844
- flags.push(`--define:${key}=${validateStringValue(define2[key], "define", key)}`);
250845
- }
250846
- }
250847
- if (logOverride) {
250848
- for (let key in logOverride) {
250849
- if (key.indexOf("=") >= 0) throw new Error(`Invalid log override: ${key}`);
250850
- flags.push(`--log-override:${key}=${validateStringValue(logOverride[key], "log override", key)}`);
250851
- }
250852
- }
250853
- if (supported) {
250854
- for (let key in supported) {
250855
- if (key.indexOf("=") >= 0) throw new Error(`Invalid supported: ${key}`);
250856
- const value = supported[key];
250857
- if (typeof value !== "boolean") throw new Error(`Expected value for supported ${quote(key)} to be a boolean, got ${typeof value} instead`);
250858
- flags.push(`--supported:${key}=${value}`);
250859
- }
250860
- }
250861
- if (pure) for (let fn of pure) flags.push(`--pure:${validateStringValue(fn, "pure")}`);
250862
- if (keepNames) flags.push(`--keep-names`);
250863
- }
250864
- function flagsForBuildOptions(callName, options, isTTY2, logLevelDefault, writeDefault) {
250865
- var _a22;
250866
- let flags = [];
250867
- let entries = [];
250868
- let keys = /* @__PURE__ */ Object.create(null);
250869
- let stdinContents = null;
250870
- let stdinResolveDir = null;
250871
- pushLogFlags(flags, options, keys, isTTY2, logLevelDefault);
250872
- pushCommonFlags(flags, options, keys);
250873
- let sourcemap = getFlag(options, keys, "sourcemap", mustBeStringOrBoolean);
250874
- let bundle = getFlag(options, keys, "bundle", mustBeBoolean);
250875
- let splitting = getFlag(options, keys, "splitting", mustBeBoolean);
250876
- let preserveSymlinks = getFlag(options, keys, "preserveSymlinks", mustBeBoolean);
250877
- let metafile = getFlag(options, keys, "metafile", mustBeBoolean);
250878
- let outfile = getFlag(options, keys, "outfile", mustBeString);
250879
- let outdir = getFlag(options, keys, "outdir", mustBeString);
250880
- let outbase = getFlag(options, keys, "outbase", mustBeString);
250881
- let tsconfig = getFlag(options, keys, "tsconfig", mustBeString);
250882
- let resolveExtensions = getFlag(options, keys, "resolveExtensions", mustBeArrayOfStrings);
250883
- let nodePathsInput = getFlag(options, keys, "nodePaths", mustBeArrayOfStrings);
250884
- let mainFields = getFlag(options, keys, "mainFields", mustBeArrayOfStrings);
250885
- let conditions = getFlag(options, keys, "conditions", mustBeArrayOfStrings);
250886
- let external = getFlag(options, keys, "external", mustBeArrayOfStrings);
250887
- let packages = getFlag(options, keys, "packages", mustBeString);
250888
- let alias = getFlag(options, keys, "alias", mustBeObject);
250889
- let loader2 = getFlag(options, keys, "loader", mustBeObject);
250890
- let outExtension = getFlag(options, keys, "outExtension", mustBeObject);
250891
- let publicPath = getFlag(options, keys, "publicPath", mustBeString);
250892
- let entryNames = getFlag(options, keys, "entryNames", mustBeString);
250893
- let chunkNames = getFlag(options, keys, "chunkNames", mustBeString);
250894
- let assetNames = getFlag(options, keys, "assetNames", mustBeString);
250895
- let inject = getFlag(options, keys, "inject", mustBeArrayOfStrings);
250896
- let banner = getFlag(options, keys, "banner", mustBeObject);
250897
- let footer = getFlag(options, keys, "footer", mustBeObject);
250898
- let entryPoints = getFlag(options, keys, "entryPoints", mustBeEntryPoints);
250899
- let absWorkingDir = getFlag(options, keys, "absWorkingDir", mustBeString);
250900
- let stdin = getFlag(options, keys, "stdin", mustBeObject);
250901
- let write = (_a22 = getFlag(options, keys, "write", mustBeBoolean)) != null ? _a22 : writeDefault;
250902
- let allowOverwrite = getFlag(options, keys, "allowOverwrite", mustBeBoolean);
250903
- let mangleCache = getFlag(options, keys, "mangleCache", mustBeObject);
250904
- keys.plugins = true;
250905
- checkForInvalidFlags(options, keys, `in ${callName}() call`);
250906
- if (sourcemap) flags.push(`--sourcemap${sourcemap === true ? "" : `=${sourcemap}`}`);
250907
- if (bundle) flags.push("--bundle");
250908
- if (allowOverwrite) flags.push("--allow-overwrite");
250909
- if (splitting) flags.push("--splitting");
250910
- if (preserveSymlinks) flags.push("--preserve-symlinks");
250911
- if (metafile) flags.push(`--metafile`);
250912
- if (outfile) flags.push(`--outfile=${outfile}`);
250913
- if (outdir) flags.push(`--outdir=${outdir}`);
250914
- if (outbase) flags.push(`--outbase=${outbase}`);
250915
- if (tsconfig) flags.push(`--tsconfig=${tsconfig}`);
250916
- if (packages) flags.push(`--packages=${packages}`);
250917
- if (resolveExtensions) flags.push(`--resolve-extensions=${validateAndJoinStringArray(resolveExtensions, "resolve extension")}`);
250918
- if (publicPath) flags.push(`--public-path=${publicPath}`);
250919
- if (entryNames) flags.push(`--entry-names=${entryNames}`);
250920
- if (chunkNames) flags.push(`--chunk-names=${chunkNames}`);
250921
- if (assetNames) flags.push(`--asset-names=${assetNames}`);
250922
- if (mainFields) flags.push(`--main-fields=${validateAndJoinStringArray(mainFields, "main field")}`);
250923
- if (conditions) flags.push(`--conditions=${validateAndJoinStringArray(conditions, "condition")}`);
250924
- if (external) for (let name2 of external) flags.push(`--external:${validateStringValue(name2, "external")}`);
250925
- if (alias) {
250926
- for (let old in alias) {
250927
- if (old.indexOf("=") >= 0) throw new Error(`Invalid package name in alias: ${old}`);
250928
- flags.push(`--alias:${old}=${validateStringValue(alias[old], "alias", old)}`);
250929
- }
250930
- }
250931
- if (banner) {
250932
- for (let type2 in banner) {
250933
- if (type2.indexOf("=") >= 0) throw new Error(`Invalid banner file type: ${type2}`);
250934
- flags.push(`--banner:${type2}=${validateStringValue(banner[type2], "banner", type2)}`);
250935
- }
250936
- }
250937
- if (footer) {
250938
- for (let type2 in footer) {
250939
- if (type2.indexOf("=") >= 0) throw new Error(`Invalid footer file type: ${type2}`);
250940
- flags.push(`--footer:${type2}=${validateStringValue(footer[type2], "footer", type2)}`);
250941
- }
250942
- }
250943
- if (inject) for (let path3 of inject) flags.push(`--inject:${validateStringValue(path3, "inject")}`);
250944
- if (loader2) {
250945
- for (let ext in loader2) {
250946
- if (ext.indexOf("=") >= 0) throw new Error(`Invalid loader extension: ${ext}`);
250947
- flags.push(`--loader:${ext}=${validateStringValue(loader2[ext], "loader", ext)}`);
250948
- }
250949
- }
250950
- if (outExtension) {
250951
- for (let ext in outExtension) {
250952
- if (ext.indexOf("=") >= 0) throw new Error(`Invalid out extension: ${ext}`);
250953
- flags.push(`--out-extension:${ext}=${validateStringValue(outExtension[ext], "out extension", ext)}`);
250954
- }
250955
- }
250956
- if (entryPoints) {
250957
- if (Array.isArray(entryPoints)) {
250958
- for (let i2 = 0, n = entryPoints.length; i2 < n; i2++) {
250959
- let entryPoint = entryPoints[i2];
250960
- if (typeof entryPoint === "object" && entryPoint !== null) {
250961
- let entryPointKeys = /* @__PURE__ */ Object.create(null);
250962
- let input = getFlag(entryPoint, entryPointKeys, "in", mustBeString);
250963
- let output = getFlag(entryPoint, entryPointKeys, "out", mustBeString);
250964
- checkForInvalidFlags(entryPoint, entryPointKeys, "in entry point at index " + i2);
250965
- if (input === void 0) throw new Error('Missing property "in" for entry point at index ' + i2);
250966
- if (output === void 0) throw new Error('Missing property "out" for entry point at index ' + i2);
250967
- entries.push([output, input]);
250968
- } else {
250969
- entries.push(["", validateStringValue(entryPoint, "entry point at index " + i2)]);
250970
- }
250971
- }
250972
- } else {
250973
- for (let key in entryPoints) {
250974
- entries.push([key, validateStringValue(entryPoints[key], "entry point", key)]);
250975
- }
250976
- }
250977
- }
250978
- if (stdin) {
250979
- let stdinKeys = /* @__PURE__ */ Object.create(null);
250980
- let contents = getFlag(stdin, stdinKeys, "contents", mustBeStringOrUint8Array);
250981
- let resolveDir = getFlag(stdin, stdinKeys, "resolveDir", mustBeString);
250982
- let sourcefile = getFlag(stdin, stdinKeys, "sourcefile", mustBeString);
250983
- let loader22 = getFlag(stdin, stdinKeys, "loader", mustBeString);
250984
- checkForInvalidFlags(stdin, stdinKeys, 'in "stdin" object');
250985
- if (sourcefile) flags.push(`--sourcefile=${sourcefile}`);
250986
- if (loader22) flags.push(`--loader=${loader22}`);
250987
- if (resolveDir) stdinResolveDir = resolveDir;
250988
- if (typeof contents === "string") stdinContents = encodeUTF8(contents);
250989
- else if (contents instanceof Uint8Array) stdinContents = contents;
250990
- }
250991
- let nodePaths = [];
250992
- if (nodePathsInput) {
250993
- for (let value of nodePathsInput) {
250994
- value += "";
250995
- nodePaths.push(value);
250996
- }
250997
- }
250998
- return {
250999
- entries,
251000
- flags,
251001
- write,
251002
- stdinContents,
251003
- stdinResolveDir,
251004
- absWorkingDir,
251005
- nodePaths,
251006
- mangleCache: validateMangleCache(mangleCache)
251007
- };
251008
- }
251009
- function flagsForTransformOptions(callName, options, isTTY2, logLevelDefault) {
251010
- let flags = [];
251011
- let keys = /* @__PURE__ */ Object.create(null);
251012
- pushLogFlags(flags, options, keys, isTTY2, logLevelDefault);
251013
- pushCommonFlags(flags, options, keys);
251014
- let sourcemap = getFlag(options, keys, "sourcemap", mustBeStringOrBoolean);
251015
- let sourcefile = getFlag(options, keys, "sourcefile", mustBeString);
251016
- let loader2 = getFlag(options, keys, "loader", mustBeString);
251017
- let banner = getFlag(options, keys, "banner", mustBeString);
251018
- let footer = getFlag(options, keys, "footer", mustBeString);
251019
- let mangleCache = getFlag(options, keys, "mangleCache", mustBeObject);
251020
- checkForInvalidFlags(options, keys, `in ${callName}() call`);
251021
- if (sourcemap) flags.push(`--sourcemap=${sourcemap === true ? "external" : sourcemap}`);
251022
- if (sourcefile) flags.push(`--sourcefile=${sourcefile}`);
251023
- if (loader2) flags.push(`--loader=${loader2}`);
251024
- if (banner) flags.push(`--banner=${banner}`);
251025
- if (footer) flags.push(`--footer=${footer}`);
251026
- return {
251027
- flags,
251028
- mangleCache: validateMangleCache(mangleCache)
251029
- };
251030
- }
251031
- function createChannel(streamIn) {
251032
- const requestCallbacksByKey = {};
251033
- const closeData = { didClose: false, reason: "" };
251034
- let responseCallbacks = {};
251035
- let nextRequestID = 0;
251036
- let nextBuildKey = 0;
251037
- let stdout = new Uint8Array(16 * 1024);
251038
- let stdoutUsed = 0;
251039
- let readFromStdout = (chunk) => {
251040
- let limit = stdoutUsed + chunk.length;
251041
- if (limit > stdout.length) {
251042
- let swap = new Uint8Array(limit * 2);
251043
- swap.set(stdout);
251044
- stdout = swap;
251045
- }
251046
- stdout.set(chunk, stdoutUsed);
251047
- stdoutUsed += chunk.length;
251048
- let offset = 0;
251049
- while (offset + 4 <= stdoutUsed) {
251050
- let length = readUInt32LE(stdout, offset);
251051
- if (offset + 4 + length > stdoutUsed) {
251052
- break;
251053
- }
251054
- offset += 4;
251055
- handleIncomingPacket(stdout.subarray(offset, offset + length));
251056
- offset += length;
251057
- }
251058
- if (offset > 0) {
251059
- stdout.copyWithin(0, offset, stdoutUsed);
251060
- stdoutUsed -= offset;
251061
- }
251062
- };
251063
- let afterClose = (error48) => {
251064
- closeData.didClose = true;
251065
- if (error48) closeData.reason = ": " + (error48.message || error48);
251066
- const text = "The service was stopped" + closeData.reason;
251067
- for (let id in responseCallbacks) {
251068
- responseCallbacks[id](text, null);
251069
- }
251070
- responseCallbacks = {};
251071
- };
251072
- let sendRequest = (refs, value, callback) => {
251073
- if (closeData.didClose) return callback("The service is no longer running" + closeData.reason, null);
251074
- let id = nextRequestID++;
251075
- responseCallbacks[id] = (error48, response) => {
251076
- try {
251077
- callback(error48, response);
251078
- } finally {
251079
- if (refs) refs.unref();
251080
- }
251081
- };
251082
- if (refs) refs.ref();
251083
- streamIn.writeToStdin(encodePacket({ id, isRequest: true, value }));
251084
- };
251085
- let sendResponse = (id, value) => {
251086
- if (closeData.didClose) throw new Error("The service is no longer running" + closeData.reason);
251087
- streamIn.writeToStdin(encodePacket({ id, isRequest: false, value }));
251088
- };
251089
- let handleRequest = async (id, request) => {
251090
- try {
251091
- if (request.command === "ping") {
251092
- sendResponse(id, {});
251093
- return;
251094
- }
251095
- if (typeof request.key === "number") {
251096
- const requestCallbacks = requestCallbacksByKey[request.key];
251097
- if (!requestCallbacks) {
251098
- return;
251099
- }
251100
- const callback = requestCallbacks[request.command];
251101
- if (callback) {
251102
- await callback(id, request);
251103
- return;
251104
- }
251105
- }
251106
- throw new Error(`Invalid command: ` + request.command);
251107
- } catch (e2) {
251108
- const errors = [extractErrorMessageV8(e2, streamIn, null, void 0, "")];
251109
- try {
251110
- sendResponse(id, { errors });
251111
- } catch {
251112
- }
251113
- }
251114
- };
251115
- let isFirstPacket = true;
251116
- let handleIncomingPacket = (bytes) => {
251117
- if (isFirstPacket) {
251118
- isFirstPacket = false;
251119
- let binaryVersion = String.fromCharCode(...bytes);
251120
- if (binaryVersion !== "0.27.3") {
251121
- throw new Error(`Cannot start service: Host version "${"0.27.3"}" does not match binary version ${quote(binaryVersion)}`);
251122
- }
251123
- return;
251124
- }
251125
- let packet = decodePacket(bytes);
251126
- if (packet.isRequest) {
251127
- handleRequest(packet.id, packet.value);
251128
- } else {
251129
- let callback = responseCallbacks[packet.id];
251130
- delete responseCallbacks[packet.id];
251131
- if (packet.value.error) callback(packet.value.error, {});
251132
- else callback(null, packet.value);
251133
- }
251134
- };
251135
- let buildOrContext = ({ callName, refs, options, isTTY: isTTY2, defaultWD: defaultWD2, callback }) => {
251136
- let refCount = 0;
251137
- const buildKey = nextBuildKey++;
251138
- const requestCallbacks = {};
251139
- const buildRefs = {
251140
- ref() {
251141
- if (++refCount === 1) {
251142
- if (refs) refs.ref();
251143
- }
251144
- },
251145
- unref() {
251146
- if (--refCount === 0) {
251147
- delete requestCallbacksByKey[buildKey];
251148
- if (refs) refs.unref();
251149
- }
251150
- }
251151
- };
251152
- requestCallbacksByKey[buildKey] = requestCallbacks;
251153
- buildRefs.ref();
251154
- buildOrContextImpl(
251155
- callName,
251156
- buildKey,
251157
- sendRequest,
251158
- sendResponse,
251159
- buildRefs,
251160
- streamIn,
251161
- requestCallbacks,
251162
- options,
251163
- isTTY2,
251164
- defaultWD2,
251165
- (err, res) => {
251166
- try {
251167
- callback(err, res);
251168
- } finally {
251169
- buildRefs.unref();
251170
- }
251171
- }
251172
- );
251173
- };
251174
- let transform22 = ({ callName, refs, input, options, isTTY: isTTY2, fs: fs3, callback }) => {
251175
- const details = createObjectStash();
251176
- let start2 = (inputPath) => {
251177
- try {
251178
- if (typeof input !== "string" && !(input instanceof Uint8Array))
251179
- throw new Error('The input to "transform" must be a string or a Uint8Array');
251180
- let {
251181
- flags,
251182
- mangleCache
251183
- } = flagsForTransformOptions(callName, options, isTTY2, transformLogLevelDefault);
251184
- let request = {
251185
- command: "transform",
251186
- flags,
251187
- inputFS: inputPath !== null,
251188
- input: inputPath !== null ? encodeUTF8(inputPath) : typeof input === "string" ? encodeUTF8(input) : input
251189
- };
251190
- if (mangleCache) request.mangleCache = mangleCache;
251191
- sendRequest(refs, request, (error48, response) => {
251192
- if (error48) return callback(new Error(error48), null);
251193
- let errors = replaceDetailsInMessages(response.errors, details);
251194
- let warnings = replaceDetailsInMessages(response.warnings, details);
251195
- let outstanding = 1;
251196
- let next = () => {
251197
- if (--outstanding === 0) {
251198
- let result = {
251199
- warnings,
251200
- code: response.code,
251201
- map: response.map,
251202
- mangleCache: void 0,
251203
- legalComments: void 0
251204
- };
251205
- if ("legalComments" in response) result.legalComments = response == null ? void 0 : response.legalComments;
251206
- if (response.mangleCache) result.mangleCache = response == null ? void 0 : response.mangleCache;
251207
- callback(null, result);
251208
- }
251209
- };
251210
- if (errors.length > 0) return callback(failureErrorWithLog("Transform failed", errors, warnings), null);
251211
- if (response.codeFS) {
251212
- outstanding++;
251213
- fs3.readFile(response.code, (err, contents) => {
251214
- if (err !== null) {
251215
- callback(err, null);
251216
- } else {
251217
- response.code = contents;
251218
- next();
251219
- }
251220
- });
251221
- }
251222
- if (response.mapFS) {
251223
- outstanding++;
251224
- fs3.readFile(response.map, (err, contents) => {
251225
- if (err !== null) {
251226
- callback(err, null);
251227
- } else {
251228
- response.map = contents;
251229
- next();
251230
- }
251231
- });
251232
- }
251233
- next();
251234
- });
251235
- } catch (e2) {
251236
- let flags = [];
251237
- try {
251238
- pushLogFlags(flags, options, {}, isTTY2, transformLogLevelDefault);
251239
- } catch {
251240
- }
251241
- const error48 = extractErrorMessageV8(e2, streamIn, details, void 0, "");
251242
- sendRequest(refs, { command: "error", flags, error: error48 }, () => {
251243
- error48.detail = details.load(error48.detail);
251244
- callback(failureErrorWithLog("Transform failed", [error48], []), null);
251245
- });
251246
- }
251247
- };
251248
- if ((typeof input === "string" || input instanceof Uint8Array) && input.length > 1024 * 1024) {
251249
- let next = start2;
251250
- start2 = () => fs3.writeFile(input, next);
251251
- }
251252
- start2(null);
251253
- };
251254
- let formatMessages2 = ({ callName, refs, messages, options, callback }) => {
251255
- if (!options) throw new Error(`Missing second argument in ${callName}() call`);
251256
- let keys = {};
251257
- let kind = getFlag(options, keys, "kind", mustBeString);
251258
- let color = getFlag(options, keys, "color", mustBeBoolean);
251259
- let terminalWidth = getFlag(options, keys, "terminalWidth", mustBeInteger);
251260
- checkForInvalidFlags(options, keys, `in ${callName}() call`);
251261
- if (kind === void 0) throw new Error(`Missing "kind" in ${callName}() call`);
251262
- if (kind !== "error" && kind !== "warning") throw new Error(`Expected "kind" to be "error" or "warning" in ${callName}() call`);
251263
- let request = {
251264
- command: "format-msgs",
251265
- messages: sanitizeMessages(messages, "messages", null, "", terminalWidth),
251266
- isWarning: kind === "warning"
251267
- };
251268
- if (color !== void 0) request.color = color;
251269
- if (terminalWidth !== void 0) request.terminalWidth = terminalWidth;
251270
- sendRequest(refs, request, (error48, response) => {
251271
- if (error48) return callback(new Error(error48), null);
251272
- callback(null, response.messages);
251273
- });
251274
- };
251275
- let analyzeMetafile2 = ({ callName, refs, metafile, options, callback }) => {
251276
- if (options === void 0) options = {};
251277
- let keys = {};
251278
- let color = getFlag(options, keys, "color", mustBeBoolean);
251279
- let verbose = getFlag(options, keys, "verbose", mustBeBoolean);
251280
- checkForInvalidFlags(options, keys, `in ${callName}() call`);
251281
- let request = {
251282
- command: "analyze-metafile",
251283
- metafile
251284
- };
251285
- if (color !== void 0) request.color = color;
251286
- if (verbose !== void 0) request.verbose = verbose;
251287
- sendRequest(refs, request, (error48, response) => {
251288
- if (error48) return callback(new Error(error48), null);
251289
- callback(null, response.result);
251290
- });
251291
- };
251292
- return {
251293
- readFromStdout,
251294
- afterClose,
251295
- service: {
251296
- buildOrContext,
251297
- transform: transform22,
251298
- formatMessages: formatMessages2,
251299
- analyzeMetafile: analyzeMetafile2
251300
- }
251301
- };
251302
- }
251303
- function buildOrContextImpl(callName, buildKey, sendRequest, sendResponse, refs, streamIn, requestCallbacks, options, isTTY2, defaultWD2, callback) {
251304
- const details = createObjectStash();
251305
- const isContext = callName === "context";
251306
- const handleError = (e2, pluginName) => {
251307
- const flags = [];
251308
- try {
251309
- pushLogFlags(flags, options, {}, isTTY2, buildLogLevelDefault);
251310
- } catch {
251311
- }
251312
- const message = extractErrorMessageV8(e2, streamIn, details, void 0, pluginName);
251313
- sendRequest(refs, { command: "error", flags, error: message }, () => {
251314
- message.detail = details.load(message.detail);
251315
- callback(failureErrorWithLog(isContext ? "Context failed" : "Build failed", [message], []), null);
251316
- });
251317
- };
251318
- let plugins;
251319
- if (typeof options === "object") {
251320
- const value = options.plugins;
251321
- if (value !== void 0) {
251322
- if (!Array.isArray(value)) return handleError(new Error(`"plugins" must be an array`), "");
251323
- plugins = value;
251324
- }
251325
- }
251326
- if (plugins && plugins.length > 0) {
251327
- if (streamIn.isSync) return handleError(new Error("Cannot use plugins in synchronous API calls"), "");
251328
- handlePlugins(
251329
- buildKey,
251330
- sendRequest,
251331
- sendResponse,
251332
- refs,
251333
- streamIn,
251334
- requestCallbacks,
251335
- options,
251336
- plugins,
251337
- details
251338
- ).then(
251339
- (result) => {
251340
- if (!result.ok) return handleError(result.error, result.pluginName);
251341
- try {
251342
- buildOrContextContinue(result.requestPlugins, result.runOnEndCallbacks, result.scheduleOnDisposeCallbacks);
251343
- } catch (e2) {
251344
- handleError(e2, "");
251345
- }
251346
- },
251347
- (e2) => handleError(e2, "")
251348
- );
251349
- return;
251350
- }
251351
- try {
251352
- buildOrContextContinue(null, (result, done) => done([], []), () => {
251353
- });
251354
- } catch (e2) {
251355
- handleError(e2, "");
251356
- }
251357
- function buildOrContextContinue(requestPlugins, runOnEndCallbacks, scheduleOnDisposeCallbacks) {
251358
- const writeDefault = streamIn.hasFS;
251359
- const {
251360
- entries,
251361
- flags,
251362
- write,
251363
- stdinContents,
251364
- stdinResolveDir,
251365
- absWorkingDir,
251366
- nodePaths,
251367
- mangleCache
251368
- } = flagsForBuildOptions(callName, options, isTTY2, buildLogLevelDefault, writeDefault);
251369
- if (write && !streamIn.hasFS) throw new Error(`The "write" option is unavailable in this environment`);
251370
- const request = {
251371
- command: "build",
251372
- key: buildKey,
251373
- entries,
251374
- flags,
251375
- write,
251376
- stdinContents,
251377
- stdinResolveDir,
251378
- absWorkingDir: absWorkingDir || defaultWD2,
251379
- nodePaths,
251380
- context: isContext
251381
- };
251382
- if (requestPlugins) request.plugins = requestPlugins;
251383
- if (mangleCache) request.mangleCache = mangleCache;
251384
- const buildResponseToResult = (response, callback2) => {
251385
- const result = {
251386
- errors: replaceDetailsInMessages(response.errors, details),
251387
- warnings: replaceDetailsInMessages(response.warnings, details),
251388
- outputFiles: void 0,
251389
- metafile: void 0,
251390
- mangleCache: void 0
251391
- };
251392
- const originalErrors = result.errors.slice();
251393
- const originalWarnings = result.warnings.slice();
251394
- if (response.outputFiles) result.outputFiles = response.outputFiles.map(convertOutputFiles);
251395
- if (response.metafile) result.metafile = JSON.parse(response.metafile);
251396
- if (response.mangleCache) result.mangleCache = response.mangleCache;
251397
- if (response.writeToStdout !== void 0) console.log(decodeUTF8(response.writeToStdout).replace(/\n$/, ""));
251398
- runOnEndCallbacks(result, (onEndErrors, onEndWarnings) => {
251399
- if (originalErrors.length > 0 || onEndErrors.length > 0) {
251400
- const error48 = failureErrorWithLog("Build failed", originalErrors.concat(onEndErrors), originalWarnings.concat(onEndWarnings));
251401
- return callback2(error48, null, onEndErrors, onEndWarnings);
251402
- }
251403
- callback2(null, result, onEndErrors, onEndWarnings);
251404
- });
251405
- };
251406
- let latestResultPromise;
251407
- let provideLatestResult;
251408
- if (isContext)
251409
- requestCallbacks["on-end"] = (id, request2) => new Promise((resolve) => {
251410
- buildResponseToResult(request2, (err, result, onEndErrors, onEndWarnings) => {
251411
- const response = {
251412
- errors: onEndErrors,
251413
- warnings: onEndWarnings
251414
- };
251415
- if (provideLatestResult) provideLatestResult(err, result);
251416
- latestResultPromise = void 0;
251417
- provideLatestResult = void 0;
251418
- sendResponse(id, response);
251419
- resolve();
251420
- });
251421
- });
251422
- sendRequest(refs, request, (error48, response) => {
251423
- if (error48) return callback(new Error(error48), null);
251424
- if (!isContext) {
251425
- return buildResponseToResult(response, (err, res) => {
251426
- scheduleOnDisposeCallbacks();
251427
- return callback(err, res);
251428
- });
251429
- }
251430
- if (response.errors.length > 0) {
251431
- return callback(failureErrorWithLog("Context failed", response.errors, response.warnings), null);
251432
- }
251433
- let didDispose = false;
251434
- const result = {
251435
- rebuild: () => {
251436
- if (!latestResultPromise) latestResultPromise = new Promise((resolve, reject) => {
251437
- let settlePromise;
251438
- provideLatestResult = (err, result2) => {
251439
- if (!settlePromise) settlePromise = () => err ? reject(err) : resolve(result2);
251440
- };
251441
- const triggerAnotherBuild = () => {
251442
- const request2 = {
251443
- command: "rebuild",
251444
- key: buildKey
251445
- };
251446
- sendRequest(refs, request2, (error210, response2) => {
251447
- if (error210) {
251448
- reject(new Error(error210));
251449
- } else if (settlePromise) {
251450
- settlePromise();
251451
- } else {
251452
- triggerAnotherBuild();
251453
- }
251454
- });
251455
- };
251456
- triggerAnotherBuild();
251457
- });
251458
- return latestResultPromise;
251459
- },
251460
- watch: (options2 = {}) => new Promise((resolve, reject) => {
251461
- if (!streamIn.hasFS) throw new Error(`Cannot use the "watch" API in this environment`);
251462
- const keys = {};
251463
- const delay = getFlag(options2, keys, "delay", mustBeInteger);
251464
- checkForInvalidFlags(options2, keys, `in watch() call`);
251465
- const request2 = {
251466
- command: "watch",
251467
- key: buildKey
251468
- };
251469
- if (delay) request2.delay = delay;
251470
- sendRequest(refs, request2, (error210) => {
251471
- if (error210) reject(new Error(error210));
251472
- else resolve(void 0);
251473
- });
251474
- }),
251475
- serve: (options2 = {}) => new Promise((resolve, reject) => {
251476
- if (!streamIn.hasFS) throw new Error(`Cannot use the "serve" API in this environment`);
251477
- const keys = {};
251478
- const port = getFlag(options2, keys, "port", mustBeValidPortNumber);
251479
- const host = getFlag(options2, keys, "host", mustBeString);
251480
- const servedir = getFlag(options2, keys, "servedir", mustBeString);
251481
- const keyfile = getFlag(options2, keys, "keyfile", mustBeString);
251482
- const certfile = getFlag(options2, keys, "certfile", mustBeString);
251483
- const fallback = getFlag(options2, keys, "fallback", mustBeString);
251484
- const cors = getFlag(options2, keys, "cors", mustBeObject);
251485
- const onRequest = getFlag(options2, keys, "onRequest", mustBeFunction);
251486
- checkForInvalidFlags(options2, keys, `in serve() call`);
251487
- const request2 = {
251488
- command: "serve",
251489
- key: buildKey,
251490
- onRequest: !!onRequest
251491
- };
251492
- if (port !== void 0) request2.port = port;
251493
- if (host !== void 0) request2.host = host;
251494
- if (servedir !== void 0) request2.servedir = servedir;
251495
- if (keyfile !== void 0) request2.keyfile = keyfile;
251496
- if (certfile !== void 0) request2.certfile = certfile;
251497
- if (fallback !== void 0) request2.fallback = fallback;
251498
- if (cors) {
251499
- const corsKeys = {};
251500
- const origin = getFlag(cors, corsKeys, "origin", mustBeStringOrArrayOfStrings);
251501
- checkForInvalidFlags(cors, corsKeys, `on "cors" object`);
251502
- if (Array.isArray(origin)) request2.corsOrigin = origin;
251503
- else if (origin !== void 0) request2.corsOrigin = [origin];
251504
- }
251505
- sendRequest(refs, request2, (error210, response2) => {
251506
- if (error210) return reject(new Error(error210));
251507
- if (onRequest) {
251508
- requestCallbacks["serve-request"] = (id, request3) => {
251509
- onRequest(request3.args);
251510
- sendResponse(id, {});
251511
- };
251512
- }
251513
- resolve(response2);
251514
- });
251515
- }),
251516
- cancel: () => new Promise((resolve) => {
251517
- if (didDispose) return resolve();
251518
- const request2 = {
251519
- command: "cancel",
251520
- key: buildKey
251521
- };
251522
- sendRequest(refs, request2, () => {
251523
- resolve();
251524
- });
251525
- }),
251526
- dispose: () => new Promise((resolve) => {
251527
- if (didDispose) return resolve();
251528
- didDispose = true;
251529
- const request2 = {
251530
- command: "dispose",
251531
- key: buildKey
251532
- };
251533
- sendRequest(refs, request2, () => {
251534
- resolve();
251535
- scheduleOnDisposeCallbacks();
251536
- refs.unref();
251537
- });
251538
- })
251539
- };
251540
- refs.ref();
251541
- callback(null, result);
251542
- });
251543
- }
251544
- }
251545
- var handlePlugins = async (buildKey, sendRequest, sendResponse, refs, streamIn, requestCallbacks, initialOptions, plugins, details) => {
251546
- let onStartCallbacks = [];
251547
- let onEndCallbacks = [];
251548
- let onResolveCallbacks = {};
251549
- let onLoadCallbacks = {};
251550
- let onDisposeCallbacks = [];
251551
- let nextCallbackID = 0;
251552
- let i2 = 0;
251553
- let requestPlugins = [];
251554
- let isSetupDone = false;
251555
- plugins = [...plugins];
251556
- for (let item of plugins) {
251557
- let keys = {};
251558
- if (typeof item !== "object") throw new Error(`Plugin at index ${i2} must be an object`);
251559
- const name2 = getFlag(item, keys, "name", mustBeString);
251560
- if (typeof name2 !== "string" || name2 === "") throw new Error(`Plugin at index ${i2} is missing a name`);
251561
- try {
251562
- let setup = getFlag(item, keys, "setup", mustBeFunction);
251563
- if (typeof setup !== "function") throw new Error(`Plugin is missing a setup function`);
251564
- checkForInvalidFlags(item, keys, `on plugin ${quote(name2)}`);
251565
- let plugin = {
251566
- name: name2,
251567
- onStart: false,
251568
- onEnd: false,
251569
- onResolve: [],
251570
- onLoad: []
251571
- };
251572
- i2++;
251573
- let resolve = (path3, options = {}) => {
251574
- if (!isSetupDone) throw new Error('Cannot call "resolve" before plugin setup has completed');
251575
- if (typeof path3 !== "string") throw new Error(`The path to resolve must be a string`);
251576
- let keys2 = /* @__PURE__ */ Object.create(null);
251577
- let pluginName = getFlag(options, keys2, "pluginName", mustBeString);
251578
- let importer = getFlag(options, keys2, "importer", mustBeString);
251579
- let namespace = getFlag(options, keys2, "namespace", mustBeString);
251580
- let resolveDir = getFlag(options, keys2, "resolveDir", mustBeString);
251581
- let kind = getFlag(options, keys2, "kind", mustBeString);
251582
- let pluginData = getFlag(options, keys2, "pluginData", canBeAnything);
251583
- let importAttributes = getFlag(options, keys2, "with", mustBeObject);
251584
- checkForInvalidFlags(options, keys2, "in resolve() call");
251585
- return new Promise((resolve2, reject) => {
251586
- const request = {
251587
- command: "resolve",
251588
- path: path3,
251589
- key: buildKey,
251590
- pluginName: name2
251591
- };
251592
- if (pluginName != null) request.pluginName = pluginName;
251593
- if (importer != null) request.importer = importer;
251594
- if (namespace != null) request.namespace = namespace;
251595
- if (resolveDir != null) request.resolveDir = resolveDir;
251596
- if (kind != null) request.kind = kind;
251597
- else throw new Error(`Must specify "kind" when calling "resolve"`);
251598
- if (pluginData != null) request.pluginData = details.store(pluginData);
251599
- if (importAttributes != null) request.with = sanitizeStringMap(importAttributes, "with");
251600
- sendRequest(refs, request, (error48, response) => {
251601
- if (error48 !== null) reject(new Error(error48));
251602
- else resolve2({
251603
- errors: replaceDetailsInMessages(response.errors, details),
251604
- warnings: replaceDetailsInMessages(response.warnings, details),
251605
- path: response.path,
251606
- external: response.external,
251607
- sideEffects: response.sideEffects,
251608
- namespace: response.namespace,
251609
- suffix: response.suffix,
251610
- pluginData: details.load(response.pluginData)
251611
- });
251612
- });
251613
- });
251614
- };
251615
- let promise2 = setup({
251616
- initialOptions,
251617
- resolve,
251618
- onStart(callback) {
251619
- let registeredText = `This error came from the "onStart" callback registered here:`;
251620
- let registeredNote = extractCallerV8(new Error(registeredText), streamIn, "onStart");
251621
- onStartCallbacks.push({ name: name2, callback, note: registeredNote });
251622
- plugin.onStart = true;
251623
- },
251624
- onEnd(callback) {
251625
- let registeredText = `This error came from the "onEnd" callback registered here:`;
251626
- let registeredNote = extractCallerV8(new Error(registeredText), streamIn, "onEnd");
251627
- onEndCallbacks.push({ name: name2, callback, note: registeredNote });
251628
- plugin.onEnd = true;
251629
- },
251630
- onResolve(options, callback) {
251631
- let registeredText = `This error came from the "onResolve" callback registered here:`;
251632
- let registeredNote = extractCallerV8(new Error(registeredText), streamIn, "onResolve");
251633
- let keys2 = {};
251634
- let filter3 = getFlag(options, keys2, "filter", mustBeRegExp);
251635
- let namespace = getFlag(options, keys2, "namespace", mustBeString);
251636
- checkForInvalidFlags(options, keys2, `in onResolve() call for plugin ${quote(name2)}`);
251637
- if (filter3 == null) throw new Error(`onResolve() call is missing a filter`);
251638
- let id = nextCallbackID++;
251639
- onResolveCallbacks[id] = { name: name2, callback, note: registeredNote };
251640
- plugin.onResolve.push({ id, filter: jsRegExpToGoRegExp(filter3), namespace: namespace || "" });
251641
- },
251642
- onLoad(options, callback) {
251643
- let registeredText = `This error came from the "onLoad" callback registered here:`;
251644
- let registeredNote = extractCallerV8(new Error(registeredText), streamIn, "onLoad");
251645
- let keys2 = {};
251646
- let filter3 = getFlag(options, keys2, "filter", mustBeRegExp);
251647
- let namespace = getFlag(options, keys2, "namespace", mustBeString);
251648
- checkForInvalidFlags(options, keys2, `in onLoad() call for plugin ${quote(name2)}`);
251649
- if (filter3 == null) throw new Error(`onLoad() call is missing a filter`);
251650
- let id = nextCallbackID++;
251651
- onLoadCallbacks[id] = { name: name2, callback, note: registeredNote };
251652
- plugin.onLoad.push({ id, filter: jsRegExpToGoRegExp(filter3), namespace: namespace || "" });
251653
- },
251654
- onDispose(callback) {
251655
- onDisposeCallbacks.push(callback);
251656
- },
251657
- esbuild: streamIn.esbuild
251658
- });
251659
- if (promise2) await promise2;
251660
- requestPlugins.push(plugin);
251661
- } catch (e2) {
251662
- return { ok: false, error: e2, pluginName: name2 };
251663
- }
251664
- }
251665
- requestCallbacks["on-start"] = async (id, request) => {
251666
- details.clear();
251667
- let response = { errors: [], warnings: [] };
251668
- await Promise.all(onStartCallbacks.map(async ({ name: name2, callback, note }) => {
251669
- try {
251670
- let result = await callback();
251671
- if (result != null) {
251672
- if (typeof result !== "object") throw new Error(`Expected onStart() callback in plugin ${quote(name2)} to return an object`);
251673
- let keys = {};
251674
- let errors = getFlag(result, keys, "errors", mustBeArray);
251675
- let warnings = getFlag(result, keys, "warnings", mustBeArray);
251676
- checkForInvalidFlags(result, keys, `from onStart() callback in plugin ${quote(name2)}`);
251677
- if (errors != null) response.errors.push(...sanitizeMessages(errors, "errors", details, name2, void 0));
251678
- if (warnings != null) response.warnings.push(...sanitizeMessages(warnings, "warnings", details, name2, void 0));
251679
- }
251680
- } catch (e2) {
251681
- response.errors.push(extractErrorMessageV8(e2, streamIn, details, note && note(), name2));
251682
- }
251683
- }));
251684
- sendResponse(id, response);
251685
- };
251686
- requestCallbacks["on-resolve"] = async (id, request) => {
251687
- let response = {}, name2 = "", callback, note;
251688
- for (let id2 of request.ids) {
251689
- try {
251690
- ({ name: name2, callback, note } = onResolveCallbacks[id2]);
251691
- let result = await callback({
251692
- path: request.path,
251693
- importer: request.importer,
251694
- namespace: request.namespace,
251695
- resolveDir: request.resolveDir,
251696
- kind: request.kind,
251697
- pluginData: details.load(request.pluginData),
251698
- with: request.with
251699
- });
251700
- if (result != null) {
251701
- if (typeof result !== "object") throw new Error(`Expected onResolve() callback in plugin ${quote(name2)} to return an object`);
251702
- let keys = {};
251703
- let pluginName = getFlag(result, keys, "pluginName", mustBeString);
251704
- let path3 = getFlag(result, keys, "path", mustBeString);
251705
- let namespace = getFlag(result, keys, "namespace", mustBeString);
251706
- let suffix = getFlag(result, keys, "suffix", mustBeString);
251707
- let external = getFlag(result, keys, "external", mustBeBoolean);
251708
- let sideEffects = getFlag(result, keys, "sideEffects", mustBeBoolean);
251709
- let pluginData = getFlag(result, keys, "pluginData", canBeAnything);
251710
- let errors = getFlag(result, keys, "errors", mustBeArray);
251711
- let warnings = getFlag(result, keys, "warnings", mustBeArray);
251712
- let watchFiles = getFlag(result, keys, "watchFiles", mustBeArrayOfStrings);
251713
- let watchDirs = getFlag(result, keys, "watchDirs", mustBeArrayOfStrings);
251714
- checkForInvalidFlags(result, keys, `from onResolve() callback in plugin ${quote(name2)}`);
251715
- response.id = id2;
251716
- if (pluginName != null) response.pluginName = pluginName;
251717
- if (path3 != null) response.path = path3;
251718
- if (namespace != null) response.namespace = namespace;
251719
- if (suffix != null) response.suffix = suffix;
251720
- if (external != null) response.external = external;
251721
- if (sideEffects != null) response.sideEffects = sideEffects;
251722
- if (pluginData != null) response.pluginData = details.store(pluginData);
251723
- if (errors != null) response.errors = sanitizeMessages(errors, "errors", details, name2, void 0);
251724
- if (warnings != null) response.warnings = sanitizeMessages(warnings, "warnings", details, name2, void 0);
251725
- if (watchFiles != null) response.watchFiles = sanitizeStringArray(watchFiles, "watchFiles");
251726
- if (watchDirs != null) response.watchDirs = sanitizeStringArray(watchDirs, "watchDirs");
251727
- break;
251728
- }
251729
- } catch (e2) {
251730
- response = { id: id2, errors: [extractErrorMessageV8(e2, streamIn, details, note && note(), name2)] };
251731
- break;
251732
- }
251733
- }
251734
- sendResponse(id, response);
251735
- };
251736
- requestCallbacks["on-load"] = async (id, request) => {
251737
- let response = {}, name2 = "", callback, note;
251738
- for (let id2 of request.ids) {
251739
- try {
251740
- ({ name: name2, callback, note } = onLoadCallbacks[id2]);
251741
- let result = await callback({
251742
- path: request.path,
251743
- namespace: request.namespace,
251744
- suffix: request.suffix,
251745
- pluginData: details.load(request.pluginData),
251746
- with: request.with
251747
- });
251748
- if (result != null) {
251749
- if (typeof result !== "object") throw new Error(`Expected onLoad() callback in plugin ${quote(name2)} to return an object`);
251750
- let keys = {};
251751
- let pluginName = getFlag(result, keys, "pluginName", mustBeString);
251752
- let contents = getFlag(result, keys, "contents", mustBeStringOrUint8Array);
251753
- let resolveDir = getFlag(result, keys, "resolveDir", mustBeString);
251754
- let pluginData = getFlag(result, keys, "pluginData", canBeAnything);
251755
- let loader2 = getFlag(result, keys, "loader", mustBeString);
251756
- let errors = getFlag(result, keys, "errors", mustBeArray);
251757
- let warnings = getFlag(result, keys, "warnings", mustBeArray);
251758
- let watchFiles = getFlag(result, keys, "watchFiles", mustBeArrayOfStrings);
251759
- let watchDirs = getFlag(result, keys, "watchDirs", mustBeArrayOfStrings);
251760
- checkForInvalidFlags(result, keys, `from onLoad() callback in plugin ${quote(name2)}`);
251761
- response.id = id2;
251762
- if (pluginName != null) response.pluginName = pluginName;
251763
- if (contents instanceof Uint8Array) response.contents = contents;
251764
- else if (contents != null) response.contents = encodeUTF8(contents);
251765
- if (resolveDir != null) response.resolveDir = resolveDir;
251766
- if (pluginData != null) response.pluginData = details.store(pluginData);
251767
- if (loader2 != null) response.loader = loader2;
251768
- if (errors != null) response.errors = sanitizeMessages(errors, "errors", details, name2, void 0);
251769
- if (warnings != null) response.warnings = sanitizeMessages(warnings, "warnings", details, name2, void 0);
251770
- if (watchFiles != null) response.watchFiles = sanitizeStringArray(watchFiles, "watchFiles");
251771
- if (watchDirs != null) response.watchDirs = sanitizeStringArray(watchDirs, "watchDirs");
251772
- break;
251773
- }
251774
- } catch (e2) {
251775
- response = { id: id2, errors: [extractErrorMessageV8(e2, streamIn, details, note && note(), name2)] };
251776
- break;
251777
- }
251778
- }
251779
- sendResponse(id, response);
251780
- };
251781
- let runOnEndCallbacks = (result, done) => done([], []);
251782
- if (onEndCallbacks.length > 0) {
251783
- runOnEndCallbacks = (result, done) => {
251784
- (async () => {
251785
- const onEndErrors = [];
251786
- const onEndWarnings = [];
251787
- for (const { name: name2, callback, note } of onEndCallbacks) {
251788
- let newErrors;
251789
- let newWarnings;
251790
- try {
251791
- const value = await callback(result);
251792
- if (value != null) {
251793
- if (typeof value !== "object") throw new Error(`Expected onEnd() callback in plugin ${quote(name2)} to return an object`);
251794
- let keys = {};
251795
- let errors = getFlag(value, keys, "errors", mustBeArray);
251796
- let warnings = getFlag(value, keys, "warnings", mustBeArray);
251797
- checkForInvalidFlags(value, keys, `from onEnd() callback in plugin ${quote(name2)}`);
251798
- if (errors != null) newErrors = sanitizeMessages(errors, "errors", details, name2, void 0);
251799
- if (warnings != null) newWarnings = sanitizeMessages(warnings, "warnings", details, name2, void 0);
251800
- }
251801
- } catch (e2) {
251802
- newErrors = [extractErrorMessageV8(e2, streamIn, details, note && note(), name2)];
251803
- }
251804
- if (newErrors) {
251805
- onEndErrors.push(...newErrors);
251806
- try {
251807
- result.errors.push(...newErrors);
251808
- } catch {
251809
- }
251810
- }
251811
- if (newWarnings) {
251812
- onEndWarnings.push(...newWarnings);
251813
- try {
251814
- result.warnings.push(...newWarnings);
251815
- } catch {
251816
- }
251817
- }
251818
- }
251819
- done(onEndErrors, onEndWarnings);
251820
- })();
251821
- };
251822
- }
251823
- let scheduleOnDisposeCallbacks = () => {
251824
- for (const cb of onDisposeCallbacks) {
251825
- setTimeout(() => cb(), 0);
251826
- }
251827
- };
251828
- isSetupDone = true;
251829
- return {
251830
- ok: true,
251831
- requestPlugins,
251832
- runOnEndCallbacks,
251833
- scheduleOnDisposeCallbacks
251834
- };
251835
- };
251836
- function createObjectStash() {
251837
- const map21 = /* @__PURE__ */ new Map();
251838
- let nextID = 0;
251839
- return {
251840
- clear() {
251841
- map21.clear();
251842
- },
251843
- load(id) {
251844
- return map21.get(id);
251845
- },
251846
- store(value) {
251847
- if (value === void 0) return -1;
251848
- const id = nextID++;
251849
- map21.set(id, value);
251850
- return id;
251851
- }
251852
- };
251853
- }
251854
- function extractCallerV8(e2, streamIn, ident) {
251855
- let note;
251856
- let tried = false;
251857
- return () => {
251858
- if (tried) return note;
251859
- tried = true;
251860
- try {
251861
- let lines = (e2.stack + "").split("\n");
251862
- lines.splice(1, 1);
251863
- let location = parseStackLinesV8(streamIn, lines, ident);
251864
- if (location) {
251865
- note = { text: e2.message, location };
251866
- return note;
251867
- }
251868
- } catch {
251869
- }
251870
- };
251871
- }
251872
- function extractErrorMessageV8(e2, streamIn, stash, note, pluginName) {
251873
- let text = "Internal error";
251874
- let location = null;
251875
- try {
251876
- text = (e2 && e2.message || e2) + "";
251877
- } catch {
251878
- }
251879
- try {
251880
- location = parseStackLinesV8(streamIn, (e2.stack + "").split("\n"), "");
251881
- } catch {
251882
- }
251883
- return { id: "", pluginName, text, location, notes: note ? [note] : [], detail: stash ? stash.store(e2) : -1 };
251884
- }
251885
- function parseStackLinesV8(streamIn, lines, ident) {
251886
- let at = " at ";
251887
- if (streamIn.readFileSync && !lines[0].startsWith(at) && lines[1].startsWith(at)) {
251888
- for (let i2 = 1; i2 < lines.length; i2++) {
251889
- let line = lines[i2];
251890
- if (!line.startsWith(at)) continue;
251891
- line = line.slice(at.length);
251892
- while (true) {
251893
- let match = /^(?:new |async )?\S+ \((.*)\)$/.exec(line);
251894
- if (match) {
251895
- line = match[1];
251896
- continue;
251897
- }
251898
- match = /^eval at \S+ \((.*)\)(?:, \S+:\d+:\d+)?$/.exec(line);
251899
- if (match) {
251900
- line = match[1];
251901
- continue;
251902
- }
251903
- match = /^(\S+):(\d+):(\d+)$/.exec(line);
251904
- if (match) {
251905
- let contents;
251906
- try {
251907
- contents = streamIn.readFileSync(match[1], "utf8");
251908
- } catch {
251909
- break;
251910
- }
251911
- let lineText = contents.split(/\r\n|\r|\n|\u2028|\u2029/)[+match[2] - 1] || "";
251912
- let column = +match[3] - 1;
251913
- let length = lineText.slice(column, column + ident.length) === ident ? ident.length : 0;
251914
- return {
251915
- file: match[1],
251916
- namespace: "file",
251917
- line: +match[2],
251918
- column: encodeUTF8(lineText.slice(0, column)).length,
251919
- length: encodeUTF8(lineText.slice(column, column + length)).length,
251920
- lineText: lineText + "\n" + lines.slice(1).join("\n"),
251921
- suggestion: ""
251922
- };
251923
- }
251924
- break;
251925
- }
251926
- }
251927
- }
251928
- return null;
251929
- }
251930
- function failureErrorWithLog(text, errors, warnings) {
251931
- let limit = 5;
251932
- text += errors.length < 1 ? "" : ` with ${errors.length} error${errors.length < 2 ? "" : "s"}:` + errors.slice(0, limit + 1).map((e2, i2) => {
251933
- if (i2 === limit) return "\n...";
251934
- if (!e2.location) return `
251935
- error: ${e2.text}`;
251936
- let { file: file2, line, column } = e2.location;
251937
- let pluginText = e2.pluginName ? `[plugin: ${e2.pluginName}] ` : "";
251938
- return `
251939
- ${file2}:${line}:${column}: ERROR: ${pluginText}${e2.text}`;
251940
- }).join("");
251941
- let error48 = new Error(text);
251942
- for (const [key, value] of [["errors", errors], ["warnings", warnings]]) {
251943
- Object.defineProperty(error48, key, {
251944
- configurable: true,
251945
- enumerable: true,
251946
- get: () => value,
251947
- set: (value2) => Object.defineProperty(error48, key, {
251948
- configurable: true,
251949
- enumerable: true,
251950
- value: value2
251951
- })
251952
- });
251953
- }
251954
- return error48;
251955
- }
251956
- function replaceDetailsInMessages(messages, stash) {
251957
- for (const message of messages) {
251958
- message.detail = stash.load(message.detail);
251959
- }
251960
- return messages;
251961
- }
251962
- function sanitizeLocation(location, where, terminalWidth) {
251963
- if (location == null) return null;
251964
- let keys = {};
251965
- let file2 = getFlag(location, keys, "file", mustBeString);
251966
- let namespace = getFlag(location, keys, "namespace", mustBeString);
251967
- let line = getFlag(location, keys, "line", mustBeInteger);
251968
- let column = getFlag(location, keys, "column", mustBeInteger);
251969
- let length = getFlag(location, keys, "length", mustBeInteger);
251970
- let lineText = getFlag(location, keys, "lineText", mustBeString);
251971
- let suggestion = getFlag(location, keys, "suggestion", mustBeString);
251972
- checkForInvalidFlags(location, keys, where);
251973
- if (lineText) {
251974
- const relevantASCII = lineText.slice(
251975
- 0,
251976
- (column && column > 0 ? column : 0) + (length && length > 0 ? length : 0) + (terminalWidth && terminalWidth > 0 ? terminalWidth : 80)
251977
- );
251978
- if (!/[\x7F-\uFFFF]/.test(relevantASCII) && !/\n/.test(lineText)) {
251979
- lineText = relevantASCII;
251980
- }
251981
- }
251982
- return {
251983
- file: file2 || "",
251984
- namespace: namespace || "",
251985
- line: line || 0,
251986
- column: column || 0,
251987
- length: length || 0,
251988
- lineText: lineText || "",
251989
- suggestion: suggestion || ""
251990
- };
251991
- }
251992
- function sanitizeMessages(messages, property, stash, fallbackPluginName, terminalWidth) {
251993
- let messagesClone = [];
251994
- let index = 0;
251995
- for (const message of messages) {
251996
- let keys = {};
251997
- let id = getFlag(message, keys, "id", mustBeString);
251998
- let pluginName = getFlag(message, keys, "pluginName", mustBeString);
251999
- let text = getFlag(message, keys, "text", mustBeString);
252000
- let location = getFlag(message, keys, "location", mustBeObjectOrNull);
252001
- let notes = getFlag(message, keys, "notes", mustBeArray);
252002
- let detail = getFlag(message, keys, "detail", canBeAnything);
252003
- let where = `in element ${index} of "${property}"`;
252004
- checkForInvalidFlags(message, keys, where);
252005
- let notesClone = [];
252006
- if (notes) {
252007
- for (const note of notes) {
252008
- let noteKeys = {};
252009
- let noteText = getFlag(note, noteKeys, "text", mustBeString);
252010
- let noteLocation = getFlag(note, noteKeys, "location", mustBeObjectOrNull);
252011
- checkForInvalidFlags(note, noteKeys, where);
252012
- notesClone.push({
252013
- text: noteText || "",
252014
- location: sanitizeLocation(noteLocation, where, terminalWidth)
252015
- });
252016
- }
252017
- }
252018
- messagesClone.push({
252019
- id: id || "",
252020
- pluginName: pluginName || fallbackPluginName,
252021
- text: text || "",
252022
- location: sanitizeLocation(location, where, terminalWidth),
252023
- notes: notesClone,
252024
- detail: stash ? stash.store(detail) : -1
252025
- });
252026
- index++;
252027
- }
252028
- return messagesClone;
252029
- }
252030
- function sanitizeStringArray(values, property) {
252031
- const result = [];
252032
- for (const value of values) {
252033
- if (typeof value !== "string") throw new Error(`${quote(property)} must be an array of strings`);
252034
- result.push(value);
252035
- }
252036
- return result;
252037
- }
252038
- function sanitizeStringMap(map21, property) {
252039
- const result = /* @__PURE__ */ Object.create(null);
252040
- for (const key in map21) {
252041
- const value = map21[key];
252042
- if (typeof value !== "string") throw new Error(`key ${quote(key)} in object ${quote(property)} must be a string`);
252043
- result[key] = value;
252044
- }
252045
- return result;
252046
- }
252047
- function convertOutputFiles({ path: path3, contents, hash: hash2 }) {
252048
- let text = null;
252049
- return {
252050
- path: path3,
252051
- contents,
252052
- hash: hash2,
252053
- get text() {
252054
- const binary2 = this.contents;
252055
- if (text === null || binary2 !== contents) {
252056
- contents = binary2;
252057
- text = decodeUTF8(binary2);
252058
- }
252059
- return text;
252060
- }
252061
- };
252062
- }
252063
- function jsRegExpToGoRegExp(regexp) {
252064
- let result = regexp.source;
252065
- if (regexp.flags) result = `(?${regexp.flags})${result}`;
252066
- return result;
252067
- }
252068
- var fs2 = require("fs");
252069
- var os2 = require("os");
252070
- var path2 = require("path");
252071
- var ESBUILD_BINARY_PATH = process.env.ESBUILD_BINARY_PATH || ESBUILD_BINARY_PATH;
252072
- var isValidBinaryPath = (x2) => !!x2 && x2 !== "/usr/bin/esbuild";
252073
- var packageDarwin_arm64 = "@esbuild/darwin-arm64";
252074
- var packageDarwin_x64 = "@esbuild/darwin-x64";
252075
- var knownWindowsPackages = {
252076
- "win32 arm64 LE": "@esbuild/win32-arm64",
252077
- "win32 ia32 LE": "@esbuild/win32-ia32",
252078
- "win32 x64 LE": "@esbuild/win32-x64"
252079
- };
252080
- var knownUnixlikePackages = {
252081
- "aix ppc64 BE": "@esbuild/aix-ppc64",
252082
- "android arm64 LE": "@esbuild/android-arm64",
252083
- "darwin arm64 LE": "@esbuild/darwin-arm64",
252084
- "darwin x64 LE": "@esbuild/darwin-x64",
252085
- "freebsd arm64 LE": "@esbuild/freebsd-arm64",
252086
- "freebsd x64 LE": "@esbuild/freebsd-x64",
252087
- "linux arm LE": "@esbuild/linux-arm",
252088
- "linux arm64 LE": "@esbuild/linux-arm64",
252089
- "linux ia32 LE": "@esbuild/linux-ia32",
252090
- "linux mips64el LE": "@esbuild/linux-mips64el",
252091
- "linux ppc64 LE": "@esbuild/linux-ppc64",
252092
- "linux riscv64 LE": "@esbuild/linux-riscv64",
252093
- "linux s390x BE": "@esbuild/linux-s390x",
252094
- "linux x64 LE": "@esbuild/linux-x64",
252095
- "linux loong64 LE": "@esbuild/linux-loong64",
252096
- "netbsd arm64 LE": "@esbuild/netbsd-arm64",
252097
- "netbsd x64 LE": "@esbuild/netbsd-x64",
252098
- "openbsd arm64 LE": "@esbuild/openbsd-arm64",
252099
- "openbsd x64 LE": "@esbuild/openbsd-x64",
252100
- "sunos x64 LE": "@esbuild/sunos-x64"
252101
- };
252102
- var knownWebAssemblyFallbackPackages = {
252103
- "android arm LE": "@esbuild/android-arm",
252104
- "android x64 LE": "@esbuild/android-x64",
252105
- "openharmony arm64 LE": "@esbuild/openharmony-arm64"
252106
- };
252107
- function pkgAndSubpathForCurrentPlatform() {
252108
- let pkg;
252109
- let subpath;
252110
- let isWASM = false;
252111
- let platformKey = `${process.platform} ${os2.arch()} ${os2.endianness()}`;
252112
- if (platformKey in knownWindowsPackages) {
252113
- pkg = knownWindowsPackages[platformKey];
252114
- subpath = "esbuild.exe";
252115
- } else if (platformKey in knownUnixlikePackages) {
252116
- pkg = knownUnixlikePackages[platformKey];
252117
- subpath = "bin/esbuild";
252118
- } else if (platformKey in knownWebAssemblyFallbackPackages) {
252119
- pkg = knownWebAssemblyFallbackPackages[platformKey];
252120
- subpath = "bin/esbuild";
252121
- isWASM = true;
252122
- } else {
252123
- throw new Error(`Unsupported platform: ${platformKey}`);
252124
- }
252125
- return { pkg, subpath, isWASM };
252126
- }
252127
- function pkgForSomeOtherPlatform() {
252128
- const libMainJS = require.resolve("esbuild");
252129
- const nodeModulesDirectory = path2.dirname(path2.dirname(path2.dirname(libMainJS)));
252130
- if (path2.basename(nodeModulesDirectory) === "node_modules") {
252131
- for (const unixKey in knownUnixlikePackages) {
252132
- try {
252133
- const pkg = knownUnixlikePackages[unixKey];
252134
- if (fs2.existsSync(path2.join(nodeModulesDirectory, pkg))) return pkg;
252135
- } catch {
252136
- }
252137
- }
252138
- for (const windowsKey in knownWindowsPackages) {
252139
- try {
252140
- const pkg = knownWindowsPackages[windowsKey];
252141
- if (fs2.existsSync(path2.join(nodeModulesDirectory, pkg))) return pkg;
252142
- } catch {
252143
- }
252144
- }
252145
- }
252146
- return null;
252147
- }
252148
- function downloadedBinPath(pkg, subpath) {
252149
- const esbuildLibDir = path2.dirname(require.resolve("esbuild"));
252150
- return path2.join(esbuildLibDir, `downloaded-${pkg.replace("/", "-")}-${path2.basename(subpath)}`);
252151
- }
252152
- function generateBinPath() {
252153
- if (isValidBinaryPath(ESBUILD_BINARY_PATH)) {
252154
- if (!fs2.existsSync(ESBUILD_BINARY_PATH)) {
252155
- console.warn(`[esbuild] Ignoring bad configuration: ESBUILD_BINARY_PATH=${ESBUILD_BINARY_PATH}`);
252156
- } else {
252157
- return { binPath: ESBUILD_BINARY_PATH, isWASM: false };
252158
- }
252159
- }
252160
- const { pkg, subpath, isWASM } = pkgAndSubpathForCurrentPlatform();
252161
- let binPath;
252162
- try {
252163
- binPath = require.resolve(`${pkg}/${subpath}`);
252164
- } catch (e2) {
252165
- binPath = downloadedBinPath(pkg, subpath);
252166
- if (!fs2.existsSync(binPath)) {
252167
- try {
252168
- require.resolve(pkg);
252169
- } catch {
252170
- const otherPkg = pkgForSomeOtherPlatform();
252171
- if (otherPkg) {
252172
- let suggestions = `
252173
- Specifically the "${otherPkg}" package is present but this platform
252174
- needs the "${pkg}" package instead. People often get into this
252175
- situation by installing esbuild on Windows or macOS and copying "node_modules"
252176
- into a Docker image that runs Linux, or by copying "node_modules" between
252177
- Windows and WSL environments.
252178
-
252179
- If you are installing with npm, you can try not copying the "node_modules"
252180
- directory when you copy the files over, and running "npm ci" or "npm install"
252181
- on the destination platform after the copy. Or you could consider using yarn
252182
- instead of npm which has built-in support for installing a package on multiple
252183
- platforms simultaneously.
252184
-
252185
- If you are installing with yarn, you can try listing both this platform and the
252186
- other platform in your ".yarnrc.yml" file using the "supportedArchitectures"
252187
- feature: https://yarnpkg.com/configuration/yarnrc/#supportedArchitectures
252188
- Keep in mind that this means multiple copies of esbuild will be present.
252189
- `;
252190
- if (pkg === packageDarwin_x64 && otherPkg === packageDarwin_arm64 || pkg === packageDarwin_arm64 && otherPkg === packageDarwin_x64) {
252191
- suggestions = `
252192
- Specifically the "${otherPkg}" package is present but this platform
252193
- needs the "${pkg}" package instead. People often get into this
252194
- situation by installing esbuild with npm running inside of Rosetta 2 and then
252195
- trying to use it with node running outside of Rosetta 2, or vice versa (Rosetta
252196
- 2 is Apple's on-the-fly x86_64-to-arm64 translation service).
252197
-
252198
- If you are installing with npm, you can try ensuring that both npm and node are
252199
- not running under Rosetta 2 and then reinstalling esbuild. This likely involves
252200
- changing how you installed npm and/or node. For example, installing node with
252201
- the universal installer here should work: https://nodejs.org/en/download/. Or
252202
- you could consider using yarn instead of npm which has built-in support for
252203
- installing a package on multiple platforms simultaneously.
252204
-
252205
- If you are installing with yarn, you can try listing both "arm64" and "x64"
252206
- in your ".yarnrc.yml" file using the "supportedArchitectures" feature:
252207
- https://yarnpkg.com/configuration/yarnrc/#supportedArchitectures
252208
- Keep in mind that this means multiple copies of esbuild will be present.
252209
- `;
252210
- }
252211
- throw new Error(`
252212
- You installed esbuild for another platform than the one you're currently using.
252213
- This won't work because esbuild is written with native code and needs to
252214
- install a platform-specific binary executable.
252215
- ${suggestions}
252216
- Another alternative is to use the "esbuild-wasm" package instead, which works
252217
- the same way on all platforms. But it comes with a heavy performance cost and
252218
- can sometimes be 10x slower than the "esbuild" package, so you may also not
252219
- want to do that.
252220
- `);
252221
- }
252222
- throw new Error(`The package "${pkg}" could not be found, and is needed by esbuild.
252223
-
252224
- If you are installing esbuild with npm, make sure that you don't specify the
252225
- "--no-optional" or "--omit=optional" flags. The "optionalDependencies" feature
252226
- of "package.json" is used by esbuild to install the correct binary executable
252227
- for your current platform.`);
252228
- }
252229
- throw e2;
252230
- }
252231
- }
252232
- if (/\.zip\//.test(binPath)) {
252233
- let pnpapi;
252234
- try {
252235
- pnpapi = require("pnpapi");
252236
- } catch (e2) {
252237
- }
252238
- if (pnpapi) {
252239
- const root = pnpapi.getPackageInformation(pnpapi.topLevel).packageLocation;
252240
- const binTargetPath = path2.join(
252241
- root,
252242
- "node_modules",
252243
- ".cache",
252244
- "esbuild",
252245
- `pnpapi-${pkg.replace("/", "-")}-${"0.27.3"}-${path2.basename(subpath)}`
252246
- );
252247
- if (!fs2.existsSync(binTargetPath)) {
252248
- fs2.mkdirSync(path2.dirname(binTargetPath), { recursive: true });
252249
- fs2.copyFileSync(binPath, binTargetPath);
252250
- fs2.chmodSync(binTargetPath, 493);
252251
- }
252252
- return { binPath: binTargetPath, isWASM };
252253
- }
252254
- }
252255
- return { binPath, isWASM };
252256
- }
252257
- var child_process = require("child_process");
252258
- var crypto2 = require("crypto");
252259
- var path22 = require("path");
252260
- var fs22 = require("fs");
252261
- var os22 = require("os");
252262
- var tty = require("tty");
252263
- var worker_threads;
252264
- if (process.env.ESBUILD_WORKER_THREADS !== "0") {
252265
- try {
252266
- worker_threads = require("worker_threads");
252267
- } catch {
252268
- }
252269
- let [major, minor] = process.versions.node.split(".");
252270
- if (
252271
- // <v12.17.0 does not work
252272
- +major < 12 || +major === 12 && +minor < 17 || +major === 13 && +minor < 13
252273
- ) {
252274
- worker_threads = void 0;
252275
- }
252276
- }
252277
- var _a2;
252278
- var isInternalWorkerThread = ((_a2 = worker_threads == null ? void 0 : worker_threads.workerData) == null ? void 0 : _a2.esbuildVersion) === "0.27.3";
252279
- var esbuildCommandAndArgs = () => {
252280
- if ((!ESBUILD_BINARY_PATH || false) && (path22.basename(__filename) !== "main.js" || path22.basename(__dirname) !== "lib")) {
252281
- throw new Error(
252282
- `The esbuild JavaScript API cannot be bundled. Please mark the "esbuild" package as external so it's not included in the bundle.
252283
-
252284
- More information: The file containing the code for esbuild's JavaScript API (${__filename}) does not appear to be inside the esbuild package on the file system, which usually means that the esbuild package was bundled into another file. This is problematic because the API needs to run a binary executable inside the esbuild package which is located using a relative path from the API code to the executable. If the esbuild package is bundled, the relative path will be incorrect and the executable won't be found.`
252285
- );
252286
- }
252287
- if (false) {
252288
- return ["node", [path22.join(__dirname, "..", "bin", "esbuild")]];
252289
- } else {
252290
- const { binPath, isWASM } = generateBinPath();
252291
- if (isWASM) {
252292
- return ["node", [binPath]];
252293
- } else {
252294
- return [binPath, []];
252295
- }
252296
- }
252297
- };
252298
- var isTTY = () => tty.isatty(2);
252299
- var fsSync = {
252300
- readFile(tempFile, callback) {
252301
- try {
252302
- let contents = fs22.readFileSync(tempFile, "utf8");
252303
- try {
252304
- fs22.unlinkSync(tempFile);
252305
- } catch {
252306
- }
252307
- callback(null, contents);
252308
- } catch (err) {
252309
- callback(err, null);
252310
- }
252311
- },
252312
- writeFile(contents, callback) {
252313
- try {
252314
- let tempFile = randomFileName();
252315
- fs22.writeFileSync(tempFile, contents);
252316
- callback(tempFile);
252317
- } catch {
252318
- callback(null);
252319
- }
252320
- }
252321
- };
252322
- var fsAsync = {
252323
- readFile(tempFile, callback) {
252324
- try {
252325
- fs22.readFile(tempFile, "utf8", (err, contents) => {
252326
- try {
252327
- fs22.unlink(tempFile, () => callback(err, contents));
252328
- } catch {
252329
- callback(err, contents);
252330
- }
252331
- });
252332
- } catch (err) {
252333
- callback(err, null);
252334
- }
252335
- },
252336
- writeFile(contents, callback) {
252337
- try {
252338
- let tempFile = randomFileName();
252339
- fs22.writeFile(tempFile, contents, (err) => err !== null ? callback(null) : callback(tempFile));
252340
- } catch {
252341
- callback(null);
252342
- }
252343
- }
252344
- };
252345
- var version2 = "0.27.3";
252346
- var build = (options) => ensureServiceIsRunning().build(options);
252347
- var context = (buildOptions) => ensureServiceIsRunning().context(buildOptions);
252348
- var transform2 = (input, options) => ensureServiceIsRunning().transform(input, options);
252349
- var formatMessages = (messages, options) => ensureServiceIsRunning().formatMessages(messages, options);
252350
- var analyzeMetafile = (messages, options) => ensureServiceIsRunning().analyzeMetafile(messages, options);
252351
- var buildSync = (options) => {
252352
- if (worker_threads && !isInternalWorkerThread) {
252353
- if (!workerThreadService) workerThreadService = startWorkerThreadService(worker_threads);
252354
- return workerThreadService.buildSync(options);
252355
- }
252356
- let result;
252357
- runServiceSync((service) => service.buildOrContext({
252358
- callName: "buildSync",
252359
- refs: null,
252360
- options,
252361
- isTTY: isTTY(),
252362
- defaultWD,
252363
- callback: (err, res) => {
252364
- if (err) throw err;
252365
- result = res;
252366
- }
252367
- }));
252368
- return result;
252369
- };
252370
- var transformSync = (input, options) => {
252371
- if (worker_threads && !isInternalWorkerThread) {
252372
- if (!workerThreadService) workerThreadService = startWorkerThreadService(worker_threads);
252373
- return workerThreadService.transformSync(input, options);
252374
- }
252375
- let result;
252376
- runServiceSync((service) => service.transform({
252377
- callName: "transformSync",
252378
- refs: null,
252379
- input,
252380
- options: options || {},
252381
- isTTY: isTTY(),
252382
- fs: fsSync,
252383
- callback: (err, res) => {
252384
- if (err) throw err;
252385
- result = res;
252386
- }
252387
- }));
252388
- return result;
252389
- };
252390
- var formatMessagesSync = (messages, options) => {
252391
- if (worker_threads && !isInternalWorkerThread) {
252392
- if (!workerThreadService) workerThreadService = startWorkerThreadService(worker_threads);
252393
- return workerThreadService.formatMessagesSync(messages, options);
252394
- }
252395
- let result;
252396
- runServiceSync((service) => service.formatMessages({
252397
- callName: "formatMessagesSync",
252398
- refs: null,
252399
- messages,
252400
- options,
252401
- callback: (err, res) => {
252402
- if (err) throw err;
252403
- result = res;
252404
- }
252405
- }));
252406
- return result;
252407
- };
252408
- var analyzeMetafileSync = (metafile, options) => {
252409
- if (worker_threads && !isInternalWorkerThread) {
252410
- if (!workerThreadService) workerThreadService = startWorkerThreadService(worker_threads);
252411
- return workerThreadService.analyzeMetafileSync(metafile, options);
252412
- }
252413
- let result;
252414
- runServiceSync((service) => service.analyzeMetafile({
252415
- callName: "analyzeMetafileSync",
252416
- refs: null,
252417
- metafile: typeof metafile === "string" ? metafile : JSON.stringify(metafile),
252418
- options,
252419
- callback: (err, res) => {
252420
- if (err) throw err;
252421
- result = res;
252422
- }
252423
- }));
252424
- return result;
252425
- };
252426
- var stop = () => {
252427
- if (stopService) stopService();
252428
- if (workerThreadService) workerThreadService.stop();
252429
- return Promise.resolve();
252430
- };
252431
- var initializeWasCalled = false;
252432
- var initialize = (options) => {
252433
- options = validateInitializeOptions(options || {});
252434
- if (options.wasmURL) throw new Error(`The "wasmURL" option only works in the browser`);
252435
- if (options.wasmModule) throw new Error(`The "wasmModule" option only works in the browser`);
252436
- if (options.worker) throw new Error(`The "worker" option only works in the browser`);
252437
- if (initializeWasCalled) throw new Error('Cannot call "initialize" more than once');
252438
- ensureServiceIsRunning();
252439
- initializeWasCalled = true;
252440
- return Promise.resolve();
252441
- };
252442
- var defaultWD = process.cwd();
252443
- var longLivedService;
252444
- var stopService;
252445
- var ensureServiceIsRunning = () => {
252446
- if (longLivedService) return longLivedService;
252447
- let [command, args] = esbuildCommandAndArgs();
252448
- let child = child_process.spawn(command, args.concat(`--service=${"0.27.3"}`, "--ping"), {
252449
- windowsHide: true,
252450
- stdio: ["pipe", "pipe", "inherit"],
252451
- cwd: defaultWD
252452
- });
252453
- let { readFromStdout, afterClose, service } = createChannel({
252454
- writeToStdin(bytes) {
252455
- child.stdin.write(bytes, (err) => {
252456
- if (err) afterClose(err);
252457
- });
252458
- },
252459
- readFileSync: fs22.readFileSync,
252460
- isSync: false,
252461
- hasFS: true,
252462
- esbuild: node_exports
252463
- });
252464
- child.stdin.on("error", afterClose);
252465
- child.on("error", afterClose);
252466
- const stdin = child.stdin;
252467
- const stdout = child.stdout;
252468
- stdout.on("data", readFromStdout);
252469
- stdout.on("end", afterClose);
252470
- stopService = () => {
252471
- stdin.destroy();
252472
- stdout.destroy();
252473
- child.kill();
252474
- initializeWasCalled = false;
252475
- longLivedService = void 0;
252476
- stopService = void 0;
252477
- };
252478
- let refCount = 0;
252479
- child.unref();
252480
- if (stdin.unref) {
252481
- stdin.unref();
252482
- }
252483
- if (stdout.unref) {
252484
- stdout.unref();
252485
- }
252486
- const refs = {
252487
- ref() {
252488
- if (++refCount === 1) child.ref();
252489
- },
252490
- unref() {
252491
- if (--refCount === 0) child.unref();
252492
- }
252493
- };
252494
- longLivedService = {
252495
- build: (options) => new Promise((resolve, reject) => {
252496
- service.buildOrContext({
252497
- callName: "build",
252498
- refs,
252499
- options,
252500
- isTTY: isTTY(),
252501
- defaultWD,
252502
- callback: (err, res) => err ? reject(err) : resolve(res)
252503
- });
252504
- }),
252505
- context: (options) => new Promise((resolve, reject) => service.buildOrContext({
252506
- callName: "context",
252507
- refs,
252508
- options,
252509
- isTTY: isTTY(),
252510
- defaultWD,
252511
- callback: (err, res) => err ? reject(err) : resolve(res)
252512
- })),
252513
- transform: (input, options) => new Promise((resolve, reject) => service.transform({
252514
- callName: "transform",
252515
- refs,
252516
- input,
252517
- options: options || {},
252518
- isTTY: isTTY(),
252519
- fs: fsAsync,
252520
- callback: (err, res) => err ? reject(err) : resolve(res)
252521
- })),
252522
- formatMessages: (messages, options) => new Promise((resolve, reject) => service.formatMessages({
252523
- callName: "formatMessages",
252524
- refs,
252525
- messages,
252526
- options,
252527
- callback: (err, res) => err ? reject(err) : resolve(res)
252528
- })),
252529
- analyzeMetafile: (metafile, options) => new Promise((resolve, reject) => service.analyzeMetafile({
252530
- callName: "analyzeMetafile",
252531
- refs,
252532
- metafile: typeof metafile === "string" ? metafile : JSON.stringify(metafile),
252533
- options,
252534
- callback: (err, res) => err ? reject(err) : resolve(res)
252535
- }))
252536
- };
252537
- return longLivedService;
252538
- };
252539
- var runServiceSync = (callback) => {
252540
- let [command, args] = esbuildCommandAndArgs();
252541
- let stdin = new Uint8Array();
252542
- let { readFromStdout, afterClose, service } = createChannel({
252543
- writeToStdin(bytes) {
252544
- if (stdin.length !== 0) throw new Error("Must run at most one command");
252545
- stdin = bytes;
252546
- },
252547
- isSync: true,
252548
- hasFS: true,
252549
- esbuild: node_exports
252550
- });
252551
- callback(service);
252552
- let stdout = child_process.execFileSync(command, args.concat(`--service=${"0.27.3"}`), {
252553
- cwd: defaultWD,
252554
- windowsHide: true,
252555
- input: stdin,
252556
- // We don't know how large the output could be. If it's too large, the
252557
- // command will fail with ENOBUFS. Reserve 16mb for now since that feels
252558
- // like it should be enough. Also allow overriding this with an environment
252559
- // variable.
252560
- maxBuffer: +process.env.ESBUILD_MAX_BUFFER || 16 * 1024 * 1024
252561
- });
252562
- readFromStdout(stdout);
252563
- afterClose(null);
252564
- };
252565
- var randomFileName = () => {
252566
- return path22.join(os22.tmpdir(), `esbuild-${crypto2.randomBytes(32).toString("hex")}`);
252567
- };
252568
- var workerThreadService = null;
252569
- var startWorkerThreadService = (worker_threads2) => {
252570
- let { port1: mainPort, port2: workerPort } = new worker_threads2.MessageChannel();
252571
- let worker = new worker_threads2.Worker(__filename, {
252572
- workerData: { workerPort, defaultWD, esbuildVersion: "0.27.3" },
252573
- transferList: [workerPort],
252574
- // From node's documentation: https://nodejs.org/api/worker_threads.html
252575
- //
252576
- // Take care when launching worker threads from preload scripts (scripts loaded
252577
- // and run using the `-r` command line flag). Unless the `execArgv` option is
252578
- // explicitly set, new Worker threads automatically inherit the command line flags
252579
- // from the running process and will preload the same preload scripts as the main
252580
- // thread. If the preload script unconditionally launches a worker thread, every
252581
- // thread spawned will spawn another until the application crashes.
252582
- //
252583
- execArgv: []
252584
- });
252585
- let nextID = 0;
252586
- let fakeBuildError = (text) => {
252587
- let error48 = new Error(`Build failed with 1 error:
252588
- error: ${text}`);
252589
- let errors = [{ id: "", pluginName: "", text, location: null, notes: [], detail: void 0 }];
252590
- error48.errors = errors;
252591
- error48.warnings = [];
252592
- return error48;
252593
- };
252594
- let validateBuildSyncOptions = (options) => {
252595
- if (!options) return;
252596
- let plugins = options.plugins;
252597
- if (plugins && plugins.length > 0) throw fakeBuildError(`Cannot use plugins in synchronous API calls`);
252598
- };
252599
- let applyProperties = (object3, properties) => {
252600
- for (let key in properties) {
252601
- object3[key] = properties[key];
252602
- }
252603
- };
252604
- let runCallSync = (command, args) => {
252605
- let id = nextID++;
252606
- let sharedBuffer = new SharedArrayBuffer(8);
252607
- let sharedBufferView = new Int32Array(sharedBuffer);
252608
- let msg = { sharedBuffer, id, command, args };
252609
- worker.postMessage(msg);
252610
- let status = Atomics.wait(sharedBufferView, 0, 0);
252611
- if (status !== "ok" && status !== "not-equal") throw new Error("Internal error: Atomics.wait() failed: " + status);
252612
- let { message: { id: id2, resolve, reject, properties } } = worker_threads2.receiveMessageOnPort(mainPort);
252613
- if (id !== id2) throw new Error(`Internal error: Expected id ${id} but got id ${id2}`);
252614
- if (reject) {
252615
- applyProperties(reject, properties);
252616
- throw reject;
252617
- }
252618
- return resolve;
252619
- };
252620
- worker.unref();
252621
- return {
252622
- buildSync(options) {
252623
- validateBuildSyncOptions(options);
252624
- return runCallSync("build", [options]);
252625
- },
252626
- transformSync(input, options) {
252627
- return runCallSync("transform", [input, options]);
252628
- },
252629
- formatMessagesSync(messages, options) {
252630
- return runCallSync("formatMessages", [messages, options]);
252631
- },
252632
- analyzeMetafileSync(metafile, options) {
252633
- return runCallSync("analyzeMetafile", [metafile, options]);
252634
- },
252635
- stop() {
252636
- worker.terminate();
252637
- workerThreadService = null;
252638
- }
252639
- };
252640
- };
252641
- var startSyncServiceWorker = () => {
252642
- let workerPort = worker_threads.workerData.workerPort;
252643
- let parentPort = worker_threads.parentPort;
252644
- let extractProperties = (object3) => {
252645
- let properties = {};
252646
- if (object3 && typeof object3 === "object") {
252647
- for (let key in object3) {
252648
- properties[key] = object3[key];
252649
- }
252650
- }
252651
- return properties;
252652
- };
252653
- try {
252654
- let service = ensureServiceIsRunning();
252655
- defaultWD = worker_threads.workerData.defaultWD;
252656
- parentPort.on("message", (msg) => {
252657
- (async () => {
252658
- let { sharedBuffer, id, command, args } = msg;
252659
- let sharedBufferView = new Int32Array(sharedBuffer);
252660
- try {
252661
- switch (command) {
252662
- case "build":
252663
- workerPort.postMessage({ id, resolve: await service.build(args[0]) });
252664
- break;
252665
- case "transform":
252666
- workerPort.postMessage({ id, resolve: await service.transform(args[0], args[1]) });
252667
- break;
252668
- case "formatMessages":
252669
- workerPort.postMessage({ id, resolve: await service.formatMessages(args[0], args[1]) });
252670
- break;
252671
- case "analyzeMetafile":
252672
- workerPort.postMessage({ id, resolve: await service.analyzeMetafile(args[0], args[1]) });
252673
- break;
252674
- default:
252675
- throw new Error(`Invalid command: ${command}`);
252676
- }
252677
- } catch (reject) {
252678
- workerPort.postMessage({ id, reject, properties: extractProperties(reject) });
252679
- }
252680
- Atomics.add(sharedBufferView, 0, 1);
252681
- Atomics.notify(sharedBufferView, 0, Infinity);
252682
- })();
252683
- });
252684
- } catch (reject) {
252685
- parentPort.on("message", (msg) => {
252686
- let { sharedBuffer, id } = msg;
252687
- let sharedBufferView = new Int32Array(sharedBuffer);
252688
- workerPort.postMessage({ id, reject, properties: extractProperties(reject) });
252689
- Atomics.add(sharedBufferView, 0, 1);
252690
- Atomics.notify(sharedBufferView, 0, Infinity);
252691
- });
252692
- }
252693
- };
252694
- if (isInternalWorkerThread) {
252695
- startSyncServiceWorker();
252696
- }
252697
- var node_default = node_exports;
252698
- }
252699
- });
252700
-
252701
250488
  // ../../node_modules/js-yaml/dist/js-yaml.mjs
252702
250489
  function isNothing(subject) {
252703
250490
  return typeof subject === "undefined" || subject === null;
@@ -254875,9 +252662,9 @@ function dump$1(input, options) {
254875
252662
  if (writeNode(state, 0, value, true, true)) return state.dump + "\n";
254876
252663
  return "";
254877
252664
  }
254878
- function renamed(from12, to) {
252665
+ function renamed(from11, to) {
254879
252666
  return function() {
254880
- throw new Error("Function yaml." + from12 + " is removed in js-yaml 4. Use yaml." + to + " instead, which is now safe by default.");
252667
+ throw new Error("Function yaml." + from11 + " is removed in js-yaml 4. Use yaml." + to + " instead, which is now safe by default.");
254881
252668
  };
254882
252669
  }
254883
252670
  var isNothing_1, isObject_1, toArray_1, repeat_1, isNegativeZero_1, extend_1, common, exception, snippet, TYPE_CONSTRUCTOR_OPTIONS, YAML_NODE_KINDS, type, schema, str, seq, map4, failsafe, _null, bool, int, YAML_FLOAT_PATTERN, SCIENTIFIC_WITHOUT_DOT, float, json, core, YAML_DATE_REGEXP, YAML_TIMESTAMP_REGEXP, timestamp, merge, BASE64_MAP, binary, _hasOwnProperty$3, _toString$2, omap, _toString$1, pairs, _hasOwnProperty$2, set, _default, _hasOwnProperty$1, CONTEXT_FLOW_IN, CONTEXT_FLOW_OUT, CONTEXT_BLOCK_IN, CONTEXT_BLOCK_OUT, CHOMPING_CLIP, CHOMPING_STRIP, CHOMPING_KEEP, PATTERN_NON_PRINTABLE, PATTERN_NON_ASCII_LINE_BREAKS, PATTERN_FLOW_INDICATORS, PATTERN_TAG_HANDLE, PATTERN_TAG_URI, simpleEscapeCheck, simpleEscapeMap, i2, directiveHandlers, loadAll_1, load_1, loader, _toString, _hasOwnProperty, CHAR_BOM, CHAR_TAB, CHAR_LINE_FEED, CHAR_CARRIAGE_RETURN, CHAR_SPACE, CHAR_EXCLAMATION, CHAR_DOUBLE_QUOTE, CHAR_SHARP, CHAR_PERCENT, CHAR_AMPERSAND, CHAR_SINGLE_QUOTE, CHAR_ASTERISK, CHAR_COMMA, CHAR_MINUS, CHAR_COLON, CHAR_EQUALS, CHAR_GREATER_THAN, CHAR_QUESTION, CHAR_COMMERCIAL_AT, CHAR_LEFT_SQUARE_BRACKET, CHAR_RIGHT_SQUARE_BRACKET, CHAR_GRAVE_ACCENT, CHAR_LEFT_CURLY_BRACKET, CHAR_VERTICAL_LINE, CHAR_RIGHT_CURLY_BRACKET, ESCAPE_SEQUENCES, DEPRECATED_BOOLEANS_SYNTAX, DEPRECATED_BASE60_SYNTAX, QUOTING_TYPE_SINGLE, QUOTING_TYPE_DOUBLE, STYLE_PLAIN, STYLE_SINGLE, STYLE_LITERAL, STYLE_FOLDED, STYLE_DOUBLE, dump_1, dumper, load, loadAll, dump, safeLoad, safeLoadAll, safeDump;
@@ -255331,22 +253118,11 @@ var build_exports = {};
255331
253118
  __export(build_exports, {
255332
253119
  default: () => build_default
255333
253120
  });
255334
- async function getEsbuild() {
255335
- if (!!process.versions.webcontainer) {
255336
- const esbuildWasm = await import("esbuild-wasm");
255337
- await esbuildWasm.initialize({
255338
- worker: false
255339
- });
255340
- return esbuildWasm;
255341
- } else {
255342
- return import_esbuild.default;
255343
- }
255344
- }
255345
253121
  var import_esbuild_decorators, import_esbuild, import_rxjs6, import_operators5, build_default;
255346
253122
  var init_build = __esm({
255347
253123
  "src/commands/build/build.ts"() {
255348
253124
  import_esbuild_decorators = __toESM(require_src());
255349
- import_esbuild = __toESM(require_main());
253125
+ import_esbuild = __toESM(require("esbuild"));
255350
253126
  import_rxjs6 = __toESM(require_cjs());
255351
253127
  import_operators5 = __toESM(require_operators());
255352
253128
  init_log();
@@ -255361,17 +253137,17 @@ var init_build = __esm({
255361
253137
  );
255362
253138
  }),
255363
253139
  (0, import_operators5.switchMap)(
255364
- (config2) => (0, import_rxjs6.from)(getEsbuild()).pipe(
255365
- (0, import_operators5.map)((esbuild2) => ({
255366
- esbuild: esbuild2,
253140
+ (config2) => (0, import_rxjs6.of)(config2).pipe(
253141
+ (0, import_operators5.map)((config3) => ({
253142
+ esbuild: import_esbuild.default,
255367
253143
  options: {
255368
- entryPoints: args.files?.length ? args.files : [config2?.function?.file ?? config2?.file ?? "index.ts"],
255369
- bundle: args.bundle ?? config2?.options?.bundler?.bundle ?? true,
255370
- minify: args.minify ?? config2?.options?.bundler?.minify ?? false,
253144
+ entryPoints: args.files?.length ? args.files : [config3?.function?.file ?? config3?.file ?? "index.ts"],
253145
+ bundle: args.bundle ?? config3?.options?.bundler?.bundle ?? true,
253146
+ minify: args.minify ?? config3?.options?.bundler?.minify ?? false,
255371
253147
  platform: args.platform ?? "node",
255372
- target: args.target ?? config2?.options?.bundler?.target ?? "node24",
255373
- outfile: args.outfile ?? config2?.options?.bundler?.outfile ?? "index.js",
255374
- external: args.external ?? config2?.options?.bundler?.external ?? []
253148
+ target: args.target ?? config3?.options?.bundler?.target ?? "node24",
253149
+ outfile: args.outfile ?? config3?.options?.bundler?.outfile ?? "index.js",
253150
+ external: args.external ?? config3?.options?.bundler?.external ?? []
255375
253151
  }
255376
253152
  })),
255377
253153
  (0, import_operators5.switchMap)(
@@ -264317,9 +262093,9 @@ var require_mime_types = __commonJS({
264317
262093
  for (var i2 = 0; i2 < exts.length; i2++) {
264318
262094
  var extension2 = exts[i2];
264319
262095
  if (types3[extension2]) {
264320
- var from12 = preference.indexOf(db[types3[extension2]].source);
262096
+ var from11 = preference.indexOf(db[types3[extension2]].source);
264321
262097
  var to = preference.indexOf(mime.source);
264322
- if (types3[extension2] !== "application/octet-stream" && (from12 > to || from12 === to && types3[extension2].substr(0, 12) === "application/")) {
262098
+ if (types3[extension2] !== "application/octet-stream" && (from11 > to || from11 === to && types3[extension2].substr(0, 12) === "application/")) {
264323
262099
  continue;
264324
262100
  }
264325
262101
  }
@@ -268875,15 +266651,15 @@ var require_polyfills = __commonJS({
268875
266651
  }
268876
266652
  if (platform === "win32") {
268877
266653
  fs2.rename = /* @__PURE__ */ (function(fs$rename) {
268878
- return function(from12, to, cb) {
266654
+ return function(from11, to, cb) {
268879
266655
  var start2 = Date.now();
268880
266656
  var backoff = 0;
268881
- fs$rename(from12, to, function CB(er) {
266657
+ fs$rename(from11, to, function CB(er) {
268882
266658
  if (er && (er.code === "EACCES" || er.code === "EPERM") && Date.now() - start2 < 6e4) {
268883
266659
  setTimeout(function() {
268884
266660
  fs2.stat(to, function(stater, st) {
268885
266661
  if (stater && stater.code === "ENOENT")
268886
- fs$rename(from12, to, CB);
266662
+ fs$rename(from11, to, CB);
268887
266663
  else
268888
266664
  cb(er);
268889
266665
  });
@@ -275791,7 +273567,7 @@ var require_from4 = __commonJS({
275791
273567
  return obj;
275792
273568
  }
275793
273569
  var ERR_INVALID_ARG_TYPE = require_errors3().codes.ERR_INVALID_ARG_TYPE;
275794
- function from12(Readable2, iterable, opts) {
273570
+ function from11(Readable2, iterable, opts) {
275795
273571
  var iterator;
275796
273572
  if (iterable && typeof iterable.next === "function") {
275797
273573
  iterator = iterable;
@@ -275830,7 +273606,7 @@ var require_from4 = __commonJS({
275830
273606
  }
275831
273607
  return readable;
275832
273608
  }
275833
- module2.exports = from12;
273609
+ module2.exports = from11;
275834
273610
  }
275835
273611
  });
275836
273612
 
@@ -275874,7 +273650,7 @@ var require_stream_readable4 = __commonJS({
275874
273650
  var ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;
275875
273651
  var StringDecoder;
275876
273652
  var createReadableStreamAsyncIterator;
275877
- var from12;
273653
+ var from11;
275878
273654
  require_inherits()(Readable2, Stream3);
275879
273655
  var errorOrDestroy = destroyImpl.errorOrDestroy;
275880
273656
  var kProxyEvents = ["error", "close", "destroy", "pause", "resume"];
@@ -276556,10 +274332,10 @@ var require_stream_readable4 = __commonJS({
276556
274332
  }
276557
274333
  if (typeof Symbol === "function") {
276558
274334
  Readable2.from = function(iterable, opts) {
276559
- if (from12 === void 0) {
276560
- from12 = require_from4();
274335
+ if (from11 === void 0) {
274336
+ from11 = require_from4();
276561
274337
  }
276562
- return from12(Readable2, iterable, opts);
274338
+ return from11(Readable2, iterable, opts);
276563
274339
  };
276564
274340
  }
276565
274341
  function indexOf(xs, x2) {
@@ -276739,8 +274515,8 @@ var require_pipeline3 = __commonJS({
276739
274515
  function call(fn) {
276740
274516
  fn();
276741
274517
  }
276742
- function pipe2(from12, to) {
276743
- return from12.pipe(to);
274518
+ function pipe2(from11, to) {
274519
+ return from11.pipe(to);
276744
274520
  }
276745
274521
  function popCallback(streams) {
276746
274522
  if (!streams.length) return noop3;
@@ -279133,7 +276909,7 @@ var require_from5 = __commonJS({
279133
276909
  return obj;
279134
276910
  }
279135
276911
  var ERR_INVALID_ARG_TYPE = require_errors4().codes.ERR_INVALID_ARG_TYPE;
279136
- function from12(Readable2, iterable, opts) {
276912
+ function from11(Readable2, iterable, opts) {
279137
276913
  var iterator;
279138
276914
  if (iterable && typeof iterable.next === "function") {
279139
276915
  iterator = iterable;
@@ -279172,7 +276948,7 @@ var require_from5 = __commonJS({
279172
276948
  }
279173
276949
  return readable;
279174
276950
  }
279175
- module2.exports = from12;
276951
+ module2.exports = from11;
279176
276952
  }
279177
276953
  });
279178
276954
 
@@ -279216,7 +276992,7 @@ var require_stream_readable5 = __commonJS({
279216
276992
  var ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;
279217
276993
  var StringDecoder;
279218
276994
  var createReadableStreamAsyncIterator;
279219
- var from12;
276995
+ var from11;
279220
276996
  require_inherits()(Readable2, Stream3);
279221
276997
  var errorOrDestroy = destroyImpl.errorOrDestroy;
279222
276998
  var kProxyEvents = ["error", "close", "destroy", "pause", "resume"];
@@ -279898,10 +277674,10 @@ var require_stream_readable5 = __commonJS({
279898
277674
  }
279899
277675
  if (typeof Symbol === "function") {
279900
277676
  Readable2.from = function(iterable, opts) {
279901
- if (from12 === void 0) {
279902
- from12 = require_from5();
277677
+ if (from11 === void 0) {
277678
+ from11 = require_from5();
279903
277679
  }
279904
- return from12(Readable2, iterable, opts);
277680
+ return from11(Readable2, iterable, opts);
279905
277681
  };
279906
277682
  }
279907
277683
  function indexOf(xs, x2) {
@@ -280081,8 +277857,8 @@ var require_pipeline4 = __commonJS({
280081
277857
  function call(fn) {
280082
277858
  fn();
280083
277859
  }
280084
- function pipe2(from12, to) {
280085
- return from12.pipe(to);
277860
+ function pipe2(from11, to) {
277861
+ return from11.pipe(to);
280086
277862
  }
280087
277863
  function popCallback(streams) {
280088
277864
  if (!streams.length) return noop3;
@@ -281905,7 +279681,7 @@ var require_from6 = __commonJS({
281905
279681
  return obj;
281906
279682
  }
281907
279683
  var ERR_INVALID_ARG_TYPE = require_errors5().codes.ERR_INVALID_ARG_TYPE;
281908
- function from12(Readable2, iterable, opts) {
279684
+ function from11(Readable2, iterable, opts) {
281909
279685
  var iterator;
281910
279686
  if (iterable && typeof iterable.next === "function") {
281911
279687
  iterator = iterable;
@@ -281944,7 +279720,7 @@ var require_from6 = __commonJS({
281944
279720
  }
281945
279721
  return readable;
281946
279722
  }
281947
- module2.exports = from12;
279723
+ module2.exports = from11;
281948
279724
  }
281949
279725
  });
281950
279726
 
@@ -281988,7 +279764,7 @@ var require_stream_readable6 = __commonJS({
281988
279764
  var ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;
281989
279765
  var StringDecoder;
281990
279766
  var createReadableStreamAsyncIterator;
281991
- var from12;
279767
+ var from11;
281992
279768
  require_inherits()(Readable2, Stream3);
281993
279769
  var errorOrDestroy = destroyImpl.errorOrDestroy;
281994
279770
  var kProxyEvents = ["error", "close", "destroy", "pause", "resume"];
@@ -282670,10 +280446,10 @@ var require_stream_readable6 = __commonJS({
282670
280446
  }
282671
280447
  if (typeof Symbol === "function") {
282672
280448
  Readable2.from = function(iterable, opts) {
282673
- if (from12 === void 0) {
282674
- from12 = require_from6();
280449
+ if (from11 === void 0) {
280450
+ from11 = require_from6();
282675
280451
  }
282676
- return from12(Readable2, iterable, opts);
280452
+ return from11(Readable2, iterable, opts);
282677
280453
  };
282678
280454
  }
282679
280455
  function indexOf(xs, x2) {
@@ -282853,8 +280629,8 @@ var require_pipeline5 = __commonJS({
282853
280629
  function call(fn) {
282854
280630
  fn();
282855
280631
  }
282856
- function pipe2(from12, to) {
282857
- return from12.pipe(to);
280632
+ function pipe2(from11, to) {
280633
+ return from11.pipe(to);
282858
280634
  }
282859
280635
  function popCallback(streams) {
282860
280636
  if (!streams.length) return noop3;
@@ -285142,7 +282918,7 @@ var require_from7 = __commonJS({
285142
282918
  return obj;
285143
282919
  }
285144
282920
  var ERR_INVALID_ARG_TYPE = require_errors6().codes.ERR_INVALID_ARG_TYPE;
285145
- function from12(Readable2, iterable, opts) {
282921
+ function from11(Readable2, iterable, opts) {
285146
282922
  var iterator;
285147
282923
  if (iterable && typeof iterable.next === "function") {
285148
282924
  iterator = iterable;
@@ -285181,7 +282957,7 @@ var require_from7 = __commonJS({
285181
282957
  }
285182
282958
  return readable;
285183
282959
  }
285184
- module2.exports = from12;
282960
+ module2.exports = from11;
285185
282961
  }
285186
282962
  });
285187
282963
 
@@ -285225,7 +283001,7 @@ var require_stream_readable7 = __commonJS({
285225
283001
  var ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;
285226
283002
  var StringDecoder;
285227
283003
  var createReadableStreamAsyncIterator;
285228
- var from12;
283004
+ var from11;
285229
283005
  require_inherits()(Readable2, Stream3);
285230
283006
  var errorOrDestroy = destroyImpl.errorOrDestroy;
285231
283007
  var kProxyEvents = ["error", "close", "destroy", "pause", "resume"];
@@ -285907,10 +283683,10 @@ var require_stream_readable7 = __commonJS({
285907
283683
  }
285908
283684
  if (typeof Symbol === "function") {
285909
283685
  Readable2.from = function(iterable, opts) {
285910
- if (from12 === void 0) {
285911
- from12 = require_from7();
283686
+ if (from11 === void 0) {
283687
+ from11 = require_from7();
285912
283688
  }
285913
- return from12(Readable2, iterable, opts);
283689
+ return from11(Readable2, iterable, opts);
285914
283690
  };
285915
283691
  }
285916
283692
  function indexOf(xs, x2) {
@@ -286090,8 +283866,8 @@ var require_pipeline6 = __commonJS({
286090
283866
  function call(fn) {
286091
283867
  fn();
286092
283868
  }
286093
- function pipe2(from12, to) {
286094
- return from12.pipe(to);
283869
+ function pipe2(from11, to) {
283870
+ return from11.pipe(to);
286095
283871
  }
286096
283872
  function popCallback(streams) {
286097
283873
  if (!streams.length) return noop3;
@@ -309292,17 +307068,17 @@ var require_codegen = __commonJS({
309292
307068
  }
309293
307069
  };
309294
307070
  var ForRange = class extends For {
309295
- constructor(varKind, name2, from12, to) {
307071
+ constructor(varKind, name2, from11, to) {
309296
307072
  super();
309297
307073
  this.varKind = varKind;
309298
307074
  this.name = name2;
309299
- this.from = from12;
307075
+ this.from = from11;
309300
307076
  this.to = to;
309301
307077
  }
309302
307078
  render(opts) {
309303
307079
  const varKind = opts.es5 ? scope_1.varKinds.var : this.varKind;
309304
- const { name: name2, from: from12, to } = this;
309305
- return `for(${varKind} ${name2}=${from12}; ${name2}<${to}; ${name2}++)` + super.render(opts);
307080
+ const { name: name2, from: from11, to } = this;
307081
+ return `for(${varKind} ${name2}=${from11}; ${name2}<${to}; ${name2}++)` + super.render(opts);
309306
307082
  }
309307
307083
  get names() {
309308
307084
  const names = addExprNames(super.names, this.from);
@@ -309521,9 +307297,9 @@ var require_codegen = __commonJS({
309521
307297
  return this._for(new ForLoop(iteration), forBody);
309522
307298
  }
309523
307299
  // `for` statement for a range of values
309524
- forRange(nameOrPrefix, from12, to, forBody, varKind = this.opts.es5 ? scope_1.varKinds.var : scope_1.varKinds.let) {
307300
+ forRange(nameOrPrefix, from11, to, forBody, varKind = this.opts.es5 ? scope_1.varKinds.var : scope_1.varKinds.let) {
309525
307301
  const name2 = this._scope.toName(nameOrPrefix);
309526
- return this._for(new ForRange(varKind, name2, from12, to), () => forBody(name2));
307302
+ return this._for(new ForRange(varKind, name2, from11, to), () => forBody(name2));
309527
307303
  }
309528
307304
  // `for-of` statement (in es5 mode replace with a normal for loop)
309529
307305
  forOf(nameOrPrefix, iterable, forBody, varKind = scope_1.varKinds.const) {
@@ -309662,13 +307438,13 @@ var require_codegen = __commonJS({
309662
307438
  }
309663
307439
  };
309664
307440
  exports2.CodeGen = CodeGen;
309665
- function addNames(names, from12) {
309666
- for (const n in from12)
309667
- names[n] = (names[n] || 0) + (from12[n] || 0);
307441
+ function addNames(names, from11) {
307442
+ for (const n in from11)
307443
+ names[n] = (names[n] || 0) + (from11[n] || 0);
309668
307444
  return names;
309669
307445
  }
309670
- function addExprNames(names, from12) {
309671
- return from12 instanceof code_1._CodeOrName ? addNames(names, from12.names) : names;
307446
+ function addExprNames(names, from11) {
307447
+ return from11 instanceof code_1._CodeOrName ? addNames(names, from11.names) : names;
309672
307448
  }
309673
307449
  function optimizeExpr(expr, names, constants) {
309674
307450
  if (expr instanceof code_1.Name)
@@ -309695,9 +307471,9 @@ var require_codegen = __commonJS({
309695
307471
  return e2 instanceof code_1._Code && e2._items.some((c) => c instanceof code_1.Name && names[c.str] === 1 && constants[c.str] !== void 0);
309696
307472
  }
309697
307473
  }
309698
- function subtractNames(names, from12) {
309699
- for (const n in from12)
309700
- names[n] = (names[n] || 0) - (from12[n] || 0);
307474
+ function subtractNames(names, from11) {
307475
+ for (const n in from11)
307476
+ names[n] = (names[n] || 0) - (from11[n] || 0);
309701
307477
  }
309702
307478
  function not(x2) {
309703
307479
  return typeof x2 == "boolean" || typeof x2 == "number" || x2 === null ? !x2 : (0, code_1._)`!${par(x2)}`;
@@ -309815,31 +307591,31 @@ var require_util5 = __commonJS({
309815
307591
  }
309816
307592
  exports2.eachItem = eachItem;
309817
307593
  function makeMergeEvaluated({ mergeNames, mergeToName, mergeValues: mergeValues3, resultToName }) {
309818
- return (gen, from12, to, toName) => {
309819
- const res = to === void 0 ? from12 : to instanceof codegen_1.Name ? (from12 instanceof codegen_1.Name ? mergeNames(gen, from12, to) : mergeToName(gen, from12, to), to) : from12 instanceof codegen_1.Name ? (mergeToName(gen, to, from12), from12) : mergeValues3(from12, to);
307594
+ return (gen, from11, to, toName) => {
307595
+ const res = to === void 0 ? from11 : to instanceof codegen_1.Name ? (from11 instanceof codegen_1.Name ? mergeNames(gen, from11, to) : mergeToName(gen, from11, to), to) : from11 instanceof codegen_1.Name ? (mergeToName(gen, to, from11), from11) : mergeValues3(from11, to);
309820
307596
  return toName === codegen_1.Name && !(res instanceof codegen_1.Name) ? resultToName(gen, res) : res;
309821
307597
  };
309822
307598
  }
309823
307599
  exports2.mergeEvaluated = {
309824
307600
  props: makeMergeEvaluated({
309825
- mergeNames: (gen, from12, to) => gen.if((0, codegen_1._)`${to} !== true && ${from12} !== undefined`, () => {
309826
- gen.if((0, codegen_1._)`${from12} === true`, () => gen.assign(to, true), () => gen.assign(to, (0, codegen_1._)`${to} || {}`).code((0, codegen_1._)`Object.assign(${to}, ${from12})`));
307601
+ mergeNames: (gen, from11, to) => gen.if((0, codegen_1._)`${to} !== true && ${from11} !== undefined`, () => {
307602
+ gen.if((0, codegen_1._)`${from11} === true`, () => gen.assign(to, true), () => gen.assign(to, (0, codegen_1._)`${to} || {}`).code((0, codegen_1._)`Object.assign(${to}, ${from11})`));
309827
307603
  }),
309828
- mergeToName: (gen, from12, to) => gen.if((0, codegen_1._)`${to} !== true`, () => {
309829
- if (from12 === true) {
307604
+ mergeToName: (gen, from11, to) => gen.if((0, codegen_1._)`${to} !== true`, () => {
307605
+ if (from11 === true) {
309830
307606
  gen.assign(to, true);
309831
307607
  } else {
309832
307608
  gen.assign(to, (0, codegen_1._)`${to} || {}`);
309833
- setEvaluated(gen, to, from12);
307609
+ setEvaluated(gen, to, from11);
309834
307610
  }
309835
307611
  }),
309836
- mergeValues: (from12, to) => from12 === true ? true : { ...from12, ...to },
307612
+ mergeValues: (from11, to) => from11 === true ? true : { ...from11, ...to },
309837
307613
  resultToName: evaluatedPropsToName
309838
307614
  }),
309839
307615
  items: makeMergeEvaluated({
309840
- mergeNames: (gen, from12, to) => gen.if((0, codegen_1._)`${to} !== true && ${from12} !== undefined`, () => gen.assign(to, (0, codegen_1._)`${from12} === true ? true : ${to} > ${from12} ? ${to} : ${from12}`)),
309841
- mergeToName: (gen, from12, to) => gen.if((0, codegen_1._)`${to} !== true`, () => gen.assign(to, from12 === true ? true : (0, codegen_1._)`${to} > ${from12} ? ${to} : ${from12}`)),
309842
- mergeValues: (from12, to) => from12 === true ? true : Math.max(from12, to),
307616
+ mergeNames: (gen, from11, to) => gen.if((0, codegen_1._)`${to} !== true && ${from11} !== undefined`, () => gen.assign(to, (0, codegen_1._)`${from11} === true ? true : ${to} > ${from11} ? ${to} : ${from11}`)),
307617
+ mergeToName: (gen, from11, to) => gen.if((0, codegen_1._)`${to} !== true`, () => gen.assign(to, from11 === true ? true : (0, codegen_1._)`${to} > ${from11} ? ${to} : ${from11}`)),
307618
+ mergeValues: (from11, to) => from11 === true ? true : Math.max(from11, to),
309843
307619
  resultToName: (gen, items) => gen.var("items", items)
309844
307620
  })
309845
307621
  };