@gapi/gcli 1.8.207 → 1.8.208

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, from11, except, desc) => {
19
- if (from11 && typeof from11 === "object" || typeof from11 === "function") {
20
- for (let key of __getOwnPropNames(from11))
18
+ var __copyProps = (to, from12, except, desc) => {
19
+ if (from12 && typeof from12 === "object" || typeof from12 === "function") {
20
+ for (let key of __getOwnPropNames(from12))
21
21
  if (!__hasOwnProp.call(to, key) && key !== except)
22
- __defProp(to, key, { get: () => from11[key], enumerable: !(desc = __getOwnPropDesc(from11, key)) || desc.enumerable });
22
+ __defProp(to, key, { get: () => from12[key], enumerable: !(desc = __getOwnPropDesc(from12, 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, from11) {
8921
- for (var i2 = 0, il = from11.length, j = to.length; i2 < il; i2++, j++)
8922
- to[j] = from11[i2];
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];
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, from11) {
9104
- for (var i2 = 0, il = from11.length, j = to.length; i2 < il; i2++, j++)
9105
- to[j] = from11[i2];
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];
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, from11) {
9864
- for (var i2 = 0, il = from11.length, j = to.length; i2 < il; i2++, j++)
9865
- to[j] = from11[i2];
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];
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, from11) {
10464
- for (var i2 = 0, il = from11.length, j = to.length; i2 < il; i2++, j++)
10465
- to[j] = from11[i2];
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];
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, from11) {
10673
- for (var i2 = 0, il = from11.length, j = to.length; i2 < il; i2++, j++)
10674
- to[j] = from11[i2];
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];
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 from11(input, scheduler) {
12236
+ function from12(input, scheduler) {
12237
12237
  return scheduler ? scheduled_1.scheduled(input, scheduler) : innerFrom_1.innerFrom(input);
12238
12238
  }
12239
- exports2.from = from11;
12239
+ exports2.from = from12;
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 of11() {
12251
+ function of10() {
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 = of11;
12259
+ exports2.of = of10;
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, from11) {
12628
- for (var i2 = 0, il = from11.length, j = to.length; i2 < il; i2++, j++)
12629
- to[j] = from11[i2];
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];
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, from11) {
12670
- for (var i2 = 0, il = from11.length, j = to.length; i2 < il; i2++, j++)
12671
- to[j] = from11[i2];
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];
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, from11) {
13804
- for (var i2 = 0, il = from11.length, j = to.length; i2 < il; i2++, j++)
13805
- to[j] = from11[i2];
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];
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, from11) {
14434
- for (var i2 = 0, il = from11.length, j = to.length; i2 < il; i2++, j++)
14435
- to[j] = from11[i2];
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];
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, from11) {
14482
- for (var i2 = 0, il = from11.length, j = to.length; i2 < il; i2++, j++)
14483
- to[j] = from11[i2];
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];
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, from11) {
14556
- for (var i2 = 0, il = from11.length, j = to.length; i2 < il; i2++, j++)
14557
- to[j] = from11[i2];
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];
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, from11) {
14602
- for (var i2 = 0, il = from11.length, j = to.length; i2 < il; i2++, j++)
14603
- to[j] = from11[i2];
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];
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, from11) {
15095
- for (var i2 = 0, il = from11.length, j = to.length; i2 < il; i2++, j++)
15096
- to[j] = from11[i2];
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];
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, from11) {
15642
- for (var i2 = 0, il = from11.length, j = to.length; i2 < il; i2++, j++)
15643
- to[j] = from11[i2];
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];
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, from11) {
15689
- for (var i2 = 0, il = from11.length, j = to.length; i2 < il; i2++, j++)
15690
- to[j] = from11[i2];
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];
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, from11) {
15774
- for (var i2 = 0, il = from11.length, j = to.length; i2 < il; i2++, j++)
15775
- to[j] = from11[i2];
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];
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, from11) {
15958
- for (var i2 = 0, il = from11.length, j = to.length; i2 < il; i2++, j++)
15959
- to[j] = from11[i2];
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];
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, from11) {
16356
- for (var i2 = 0, il = from11.length, j = to.length; i2 < il; i2++, j++)
16357
- to[j] = from11[i2];
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];
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, from11) {
17358
- for (var i2 = 0, il = from11.length, j = to.length; i2 < il; i2++, j++)
17359
- to[j] = from11[i2];
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];
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, from11) {
17444
- for (var i2 = 0, il = from11.length, j = to.length; i2 < il; i2++, j++)
17445
- to[j] = from11[i2];
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];
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, from11) {
17487
- for (var i2 = 0, il = from11.length, j = to.length; i2 < il; i2++, j++)
17488
- to[j] = from11[i2];
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];
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, from11) {
18255
- for (var i2 = 0, il = from11.length, j = to.length; i2 < il; i2++, j++)
18256
- to[j] = from11[i2];
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];
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[of11] || null);
24482
+ K(this, "displayName", a[of10] || 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 of11 = "displayName", pf = "enrolledAt", nf = "mfaEnrollmentId", mf = "phoneInfo";
24500
+ var of10 = "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[of11] = d.displayName);
27881
+ d.displayName && (f3[of10] = d.displayName);
27882
27882
  d.enrollmentTime && (f3[pf] = new Date(d.enrollmentTime).toISOString());
27883
27883
  d.phoneNumber && (f3[mf] = d.phoneNumber);
27884
27884
  try {
@@ -29982,7 +29982,7 @@ var require_buffer_list = __commonJS({
29982
29982
  }
29983
29983
  }, {
29984
29984
  key: "join",
29985
- value: function join(s2) {
29985
+ value: function join2(s2) {
29986
29986
  if (this.length === 0) return "";
29987
29987
  var p = this.head;
29988
29988
  var ret = "" + p.data;
@@ -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 from11(Readable2, iterable, opts) {
31503
+ function from12(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 = from11;
31542
+ module2.exports = from12;
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 from11;
31586
+ var from12;
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 (from11 === void 0) {
32269
- from11 = require_from2();
32268
+ if (from12 === void 0) {
32269
+ from12 = require_from2();
32270
32270
  }
32271
- return from11(Readable2, iterable, opts);
32271
+ return from12(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(from11, to) {
32452
- return from11.pipe(to);
32451
+ function pipe2(from12, to) {
32452
+ return from12.pipe(to);
32453
32453
  }
32454
32454
  function popCallback(streams) {
32455
32455
  if (!streams.length) return noop3;
@@ -33000,7 +33000,7 @@ var require_buffer_list2 = __commonJS({
33000
33000
  }
33001
33001
  }, {
33002
33002
  key: "join",
33003
- value: function join(s2) {
33003
+ value: function join2(s2) {
33004
33004
  if (this.length === 0) return "";
33005
33005
  var p = this.head;
33006
33006
  var ret = "" + p.data;
@@ -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 from11(Readable2, iterable, opts) {
34230
+ function from12(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 = from11;
34269
+ module2.exports = from12;
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 from11;
34313
+ var from12;
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 (from11 === void 0) {
34996
- from11 = require_from3();
34995
+ if (from12 === void 0) {
34996
+ from12 = require_from3();
34997
34997
  }
34998
- return from11(Readable2, iterable, opts);
34998
+ return from12(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(from11, to) {
35179
- return from11.pipe(to);
35178
+ function pipe2(from12, to) {
35179
+ return from12.pipe(to);
35180
35180
  }
35181
35181
  function popCallback(streams) {
35182
35182
  if (!streams.length) return noop3;
@@ -36157,7 +36157,22 @@ secrets {
36157
36157
  }
36158
36158
  type
36159
36159
  }
36160
- config
36160
+ config {
36161
+ id
36162
+ projectId
36163
+ name
36164
+ apiVersion
36165
+ data
36166
+ kind
36167
+ metadata {
36168
+ creationTimestamp
36169
+ name
36170
+ namespace
36171
+ resourceVersion
36172
+ uid
36173
+ }
36174
+ type
36175
+ }
36161
36176
  env
36162
36177
  method
36163
36178
  createdBy
@@ -36980,14 +36995,14 @@ function __spreadArrays() {
36980
36995
  r2[k] = a[j];
36981
36996
  return r2;
36982
36997
  }
36983
- function __spreadArray(to, from11, pack) {
36984
- if (pack || arguments.length === 2) for (var i2 = 0, l = from11.length, ar; i2 < l; i2++) {
36985
- if (ar || !(i2 in from11)) {
36986
- if (!ar) ar = Array.prototype.slice.call(from11, 0, i2);
36987
- ar[i2] = from11[i2];
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];
36988
37003
  }
36989
37004
  }
36990
- return to.concat(ar || Array.prototype.slice.call(from11));
37005
+ return to.concat(ar || Array.prototype.slice.call(from12));
36991
37006
  }
36992
37007
  function __await(v) {
36993
37008
  return this instanceof __await ? (this.v = v, this) : new __await(v);
@@ -37432,7 +37447,7 @@ var require_util = __commonJS({
37432
37447
  return path2;
37433
37448
  }
37434
37449
  exports2.normalize = normalize;
37435
- function join(aRoot, aPath) {
37450
+ function join2(aRoot, aPath) {
37436
37451
  if (aRoot === "") {
37437
37452
  aRoot = ".";
37438
37453
  }
@@ -37464,7 +37479,7 @@ var require_util = __commonJS({
37464
37479
  }
37465
37480
  return joined;
37466
37481
  }
37467
- exports2.join = join;
37482
+ exports2.join = join2;
37468
37483
  exports2.isAbsolute = function(aPath) {
37469
37484
  return aPath.charAt(0) === "/" || urlRegexp.test(aPath);
37470
37485
  };
@@ -37637,7 +37652,7 @@ var require_util = __commonJS({
37637
37652
  parsed.path = parsed.path.substring(0, index + 1);
37638
37653
  }
37639
37654
  }
37640
- sourceURL = join(urlGenerate(parsed), sourceURL);
37655
+ sourceURL = join2(urlGenerate(parsed), sourceURL);
37641
37656
  }
37642
37657
  return normalize(sourceURL);
37643
37658
  }
@@ -39511,11 +39526,11 @@ var require_typescript = __commonJS({
39511
39526
  for (var name2 in all)
39512
39527
  __defProp2(target, name2, { get: all[name2], enumerable: true });
39513
39528
  };
39514
- var __copyProps2 = (to, from11, except, desc) => {
39515
- if (from11 && typeof from11 === "object" || typeof from11 === "function") {
39516
- for (let key of __getOwnPropNames2(from11))
39529
+ var __copyProps2 = (to, from12, except, desc) => {
39530
+ if (from12 && typeof from12 === "object" || typeof from12 === "function") {
39531
+ for (let key of __getOwnPropNames2(from12))
39517
39532
  if (!__hasOwnProp2.call(to, key) && key !== except)
39518
- __defProp2(to, key, { get: () => from11[key], enumerable: !(desc = __getOwnPropDesc2(from11, key)) || desc.enumerable });
39533
+ __defProp2(to, key, { get: () => from12[key], enumerable: !(desc = __getOwnPropDesc2(from12, key)) || desc.enumerable });
39519
39534
  }
39520
39535
  return to;
39521
39536
  };
@@ -42359,14 +42374,14 @@ var require_typescript = __commonJS({
42359
42374
  function toOffset(array2, offset) {
42360
42375
  return offset < 0 ? array2.length + offset : offset;
42361
42376
  }
42362
- function addRange(to, from11, start2, end) {
42363
- if (from11 === void 0 || from11.length === 0) return to;
42364
- if (to === void 0) return from11.slice(start2, end);
42365
- start2 = start2 === void 0 ? 0 : toOffset(from11, start2);
42366
- end = end === void 0 ? from11.length : toOffset(from11, end);
42367
- for (let i2 = start2; i2 < end && i2 < from11.length; i2++) {
42368
- if (from11[i2] !== void 0) {
42369
- to.push(from11[i2]);
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]);
42370
42385
  }
42371
42386
  }
42372
42387
  return to;
@@ -48875,8 +48890,8 @@ ${lanes.join("\n")}
48875
48890
  const canonicalDirectoryName = getCanonicalFileName(directoryName);
48876
48891
  return startsWith(canonicalFileName, canonicalDirectoryName + "/") || startsWith(canonicalFileName, canonicalDirectoryName + "\\");
48877
48892
  }
48878
- function getPathComponentsRelativeTo(from11, to, stringEqualityComparer, getCanonicalFileName) {
48879
- const fromComponents = reducePathComponents(getPathComponents(from11));
48893
+ function getPathComponentsRelativeTo(from12, to, stringEqualityComparer, getCanonicalFileName) {
48894
+ const fromComponents = reducePathComponents(getPathComponents(from12));
48880
48895
  const toComponents = reducePathComponents(getPathComponents(to));
48881
48896
  let start2;
48882
48897
  for (start2 = 0; start2 < fromComponents.length && start2 < toComponents.length; start2++) {
@@ -48912,8 +48927,8 @@ ${lanes.join("\n")}
48912
48927
  false
48913
48928
  );
48914
48929
  }
48915
- function getRelativePathFromFile(from11, to, getCanonicalFileName) {
48916
- return ensurePathIsNonModuleName(getRelativePathFromDirectory(getDirectoryPath(from11), to, getCanonicalFileName));
48930
+ function getRelativePathFromFile(from12, to, getCanonicalFileName) {
48931
+ return ensurePathIsNonModuleName(getRelativePathFromDirectory(getDirectoryPath(from12), to, getCanonicalFileName));
48917
48932
  }
48918
48933
  function getRelativePathToDirectoryOrUrl(directoryPathOrUrl, relativeOrAbsolutePath, currentDirectory, getCanonicalFileName, isAbsolutePathAnUrl) {
48919
48934
  const pathComponents2 = getPathComponentsRelativeTo(
@@ -56464,15 +56479,15 @@ ${lanes.join("\n")}
56464
56479
  if (!nodeArray || isArray(child) || !isElement(child)) return false;
56465
56480
  return contains(nodeArray, child);
56466
56481
  }
56467
- function insertStatementsAfterPrologue(to, from11, isPrologueDirective2) {
56468
- if (from11 === void 0 || from11.length === 0) return to;
56482
+ function insertStatementsAfterPrologue(to, from12, isPrologueDirective2) {
56483
+ if (from12 === void 0 || from12.length === 0) return to;
56469
56484
  let statementIndex = 0;
56470
56485
  for (; statementIndex < to.length; ++statementIndex) {
56471
56486
  if (!isPrologueDirective2(to[statementIndex])) {
56472
56487
  break;
56473
56488
  }
56474
56489
  }
56475
- to.splice(statementIndex, 0, ...from11);
56490
+ to.splice(statementIndex, 0, ...from12);
56476
56491
  return to;
56477
56492
  }
56478
56493
  function insertStatementAfterPrologue(to, statement, isPrologueDirective2) {
@@ -56489,11 +56504,11 @@ ${lanes.join("\n")}
56489
56504
  function isAnyPrologueDirective(node) {
56490
56505
  return isPrologueDirective(node) || !!(getEmitFlags(node) & 2097152);
56491
56506
  }
56492
- function insertStatementsAfterStandardPrologue(to, from11) {
56493
- return insertStatementsAfterPrologue(to, from11, isPrologueDirective);
56507
+ function insertStatementsAfterStandardPrologue(to, from12) {
56508
+ return insertStatementsAfterPrologue(to, from12, isPrologueDirective);
56494
56509
  }
56495
- function insertStatementsAfterCustomPrologue(to, from11) {
56496
- return insertStatementsAfterPrologue(to, from11, isAnyPrologueDirective);
56510
+ function insertStatementsAfterCustomPrologue(to, from12) {
56511
+ return insertStatementsAfterPrologue(to, from12, isAnyPrologueDirective);
56497
56512
  }
56498
56513
  function insertStatementAfterStandardPrologue(to, statement) {
56499
56514
  return insertStatementAfterPrologue(to, statement, isPrologueDirective);
@@ -70972,13 +70987,13 @@ ${lanes.join("\n")}
70972
70987
  [cooked, raw]
70973
70988
  );
70974
70989
  }
70975
- function createSpreadArrayHelper(to, from11, packFrom) {
70990
+ function createSpreadArrayHelper(to, from12, packFrom) {
70976
70991
  context.requestEmitHelper(spreadArrayHelper);
70977
70992
  return factory2.createCallExpression(
70978
70993
  getUnscopedHelperName("__spreadArray"),
70979
70994
  /*typeArguments*/
70980
70995
  void 0,
70981
- [to, from11, packFrom ? immutableTrue() : immutableFalse()]
70996
+ [to, from12, packFrom ? immutableTrue() : immutableFalse()]
70982
70997
  );
70983
70998
  }
70984
70999
  function createPropKeyHelper(expr) {
@@ -203342,8 +203357,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
203342
203357
  }
203343
203358
  } else {
203344
203359
  for (const pos2 of positions) {
203345
- const from11 = pos2 - closeMultiline.length > 0 ? pos2 - closeMultiline.length : 0;
203346
- const offset = text.substr(from11, closeMultiline.length) === closeMultiline ? closeMultiline.length : 0;
203360
+ const from12 = pos2 - closeMultiline.length > 0 ? pos2 - closeMultiline.length : 0;
203361
+ const offset = text.substr(from12, closeMultiline.length) === closeMultiline ? closeMultiline.length : 0;
203347
203362
  textChanges2.push({
203348
203363
  newText: "",
203349
203364
  span: {
@@ -204528,8 +204543,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
204528
204543
  function getCallSiteGroupKey(entry) {
204529
204544
  return getNodeId(entry.declaration);
204530
204545
  }
204531
- function createCallHierarchyIncomingCall(from11, fromSpans) {
204532
- return { from: from11, fromSpans };
204546
+ function createCallHierarchyIncomingCall(from12, fromSpans) {
204547
+ return { from: from12, fromSpans };
204533
204548
  }
204534
204549
  function convertCallSiteGroupToIncomingCall(program2, entries) {
204535
204550
  return createCallHierarchyIncomingCall(createCallHierarchyItem(program2, entries[0].declaration), map21(entries, (entry) => createTextSpanFromRange(entry.range)));
@@ -207703,11 +207718,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
207703
207718
  const rightSibling = currentNodeIndex < maxChildIndex ? commentNode.getChildAt(currentNodeIndex + 1) : void 0;
207704
207719
  return { leftSibling, rightSibling };
207705
207720
  }
207706
- function findEndOfTextBetween(jsDocComment, from11, to) {
207707
- const comment = jsDocComment.getText().substring(from11 - jsDocComment.getStart(), to - jsDocComment.getStart());
207721
+ function findEndOfTextBetween(jsDocComment, from12, to) {
207722
+ const comment = jsDocComment.getText().substring(from12 - jsDocComment.getStart(), to - jsDocComment.getStart());
207708
207723
  for (let i2 = comment.length; i2 > 0; i2--) {
207709
207724
  if (!/[*/\s]/.test(comment.substring(i2 - 1, i2))) {
207710
- return from11 + i2;
207725
+ return from12 + i2;
207711
207726
  }
207712
207727
  }
207713
207728
  return to;
@@ -232783,9 +232798,9 @@ ${options.prefix}` : "\n" : options.prefix
232783
232798
  function toTokenRange(arg) {
232784
232799
  return typeof arg === "number" ? tokenRangeFrom([arg]) : isArray(arg) ? tokenRangeFrom(arg) : arg;
232785
232800
  }
232786
- function tokenRangeFromRange(from11, to, except = []) {
232801
+ function tokenRangeFromRange(from12, to, except = []) {
232787
232802
  const tokens = [];
232788
- for (let token = from11; token <= to; token++) {
232803
+ for (let token = from12; token <= to; token++) {
232789
232804
  if (!contains(except, token)) {
232790
232805
  tokens.push(token);
232791
232806
  }
@@ -250482,11 +250497,11 @@ var require_main = __commonJS({
250482
250497
  for (var name2 in all)
250483
250498
  __defProp2(target, name2, { get: all[name2], enumerable: true });
250484
250499
  };
250485
- var __copyProps2 = (to, from11, except, desc) => {
250486
- if (from11 && typeof from11 === "object" || typeof from11 === "function") {
250487
- for (let key of __getOwnPropNames2(from11))
250500
+ var __copyProps2 = (to, from12, except, desc) => {
250501
+ if (from12 && typeof from12 === "object" || typeof from12 === "function") {
250502
+ for (let key of __getOwnPropNames2(from12))
250488
250503
  if (!__hasOwnProp2.call(to, key) && key !== except)
250489
- __defProp2(to, key, { get: () => from11[key], enumerable: !(desc = __getOwnPropDesc2(from11, key)) || desc.enumerable });
250504
+ __defProp2(to, key, { get: () => from12[key], enumerable: !(desc = __getOwnPropDesc2(from12, key)) || desc.enumerable });
250490
250505
  }
250491
250506
  return to;
250492
250507
  };
@@ -252134,7 +252149,7 @@ ${file2}:${line}:${column}: ERROR: ${pluginText}${e2.text}`;
252134
252149
  const esbuildLibDir = path2.dirname(require.resolve("esbuild"));
252135
252150
  return path2.join(esbuildLibDir, `downloaded-${pkg.replace("/", "-")}-${path2.basename(subpath)}`);
252136
252151
  }
252137
- function generateBinPath() {
252152
+ function generateBinPath2() {
252138
252153
  if (isValidBinaryPath(ESBUILD_BINARY_PATH)) {
252139
252154
  if (!fs2.existsSync(ESBUILD_BINARY_PATH)) {
252140
252155
  console.warn(`[esbuild] Ignoring bad configuration: ESBUILD_BINARY_PATH=${ESBUILD_BINARY_PATH}`);
@@ -252272,7 +252287,7 @@ More information: The file containing the code for esbuild's JavaScript API (${_
252272
252287
  if (false) {
252273
252288
  return ["node", [path22.join(__dirname, "..", "bin", "esbuild")]];
252274
252289
  } else {
252275
- const { binPath, isWASM } = generateBinPath();
252290
+ const { binPath, isWASM } = generateBinPath2();
252276
252291
  if (isWASM) {
252277
252292
  return ["node", [binPath]];
252278
252293
  } else {
@@ -254860,9 +254875,9 @@ function dump$1(input, options) {
254860
254875
  if (writeNode(state, 0, value, true, true)) return state.dump + "\n";
254861
254876
  return "";
254862
254877
  }
254863
- function renamed(from11, to) {
254878
+ function renamed(from12, to) {
254864
254879
  return function() {
254865
- throw new Error("Function yaml." + from11 + " is removed in js-yaml 4. Use yaml." + to + " instead, which is now safe by default.");
254880
+ throw new Error("Function yaml." + from12 + " is removed in js-yaml 4. Use yaml." + to + " instead, which is now safe by default.");
254866
254881
  };
254867
254882
  }
254868
254883
  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;
@@ -255311,596 +255326,2925 @@ var init_load_spec = __esm({
255311
255326
  }
255312
255327
  });
255313
255328
 
255314
- // src/commands/build/build.ts
255315
- var build_exports = {};
255316
- __export(build_exports, {
255317
- default: () => build_default
255318
- });
255319
- var import_esbuild_decorators, import_esbuild, import_rxjs6, import_operators5, build_default;
255320
- var init_build = __esm({
255321
- "src/commands/build/build.ts"() {
255322
- import_esbuild_decorators = __toESM(require_src());
255323
- import_esbuild = __toESM(require_main());
255324
- import_rxjs6 = __toESM(require_cjs());
255325
- import_operators5 = __toESM(require_operators());
255326
- init_log();
255327
- init_load_spec();
255328
- build_default = async (args) => {
255329
- const time3 = Date.now();
255330
- return (0, import_rxjs6.lastValueFrom)(
255331
- loadSpec().pipe(
255332
- (0, import_operators5.tap)((config2) => {
255333
- Logger.info(
255334
- `\u{1F528} Bundling ${args.files?.length ? args.files.join("") : config2?.function?.file ?? config2?.file ?? "index.ts"}`
255335
- );
255336
- }),
255337
- (0, import_operators5.switchMap)(
255338
- (config2) => (0, import_rxjs6.of)(config2).pipe(
255339
- (0, import_operators5.map)((config3) => ({
255340
- esbuild: import_esbuild.default,
255341
- options: {
255342
- entryPoints: args.files?.length ? args.files : [config3?.function?.file ?? config3?.file ?? "index.ts"],
255343
- bundle: args.bundle ?? config3?.options?.bundler?.bundle ?? true,
255344
- minify: args.minify ?? config3?.options?.bundler?.minify ?? false,
255345
- platform: args.platform ?? "node",
255346
- target: args.target ?? config3?.options?.bundler?.target ?? "node24",
255347
- outfile: args.outfile ?? config3?.options?.bundler?.outfile ?? "index.js",
255348
- external: args.external ?? config3?.options?.bundler?.external ?? []
255349
- }
255350
- })),
255351
- (0, import_operators5.switchMap)(
255352
- ({ esbuild: esbuild2, options }) => esbuild2.build({
255353
- ...options,
255354
- plugins: [
255355
- (0, import_esbuild_decorators.esbuildDecorators)({
255356
- tsconfig: "./tsconfig.json",
255357
- cwd: process.cwd()
255358
- })
255359
- ]
255360
- })
255361
- ),
255362
- (0, import_operators5.tap)((data) => {
255363
- if (data.warnings.length) {
255364
- Logger.warn(data.warnings);
255365
- }
255366
- if (data.errors.length) {
255367
- Logger.error(data.errors);
255368
- }
255369
- Logger.warn(`\u{1F3D7}\uFE0F Bundling finish in ${Date.now() - time3}ms`);
255370
- Logger.info(
255371
- `\u2705 Finished bundling output file ${args.outfile ?? config2?.options?.bundler?.outfile ?? "index.js"}`
255372
- );
255373
- })
255374
- )
255375
- )
255376
- )
255377
- ).catch((e2) => {
255378
- console.error(e2);
255379
- process.exit(1);
255380
- });
255329
+ // ../../node_modules/esbuild-wasm/lib/main.js
255330
+ var require_main2 = __commonJS({
255331
+ "../../node_modules/esbuild-wasm/lib/main.js"(exports2, module2) {
255332
+ "use strict";
255333
+ var __defProp2 = Object.defineProperty;
255334
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
255335
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
255336
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
255337
+ var __export2 = (target, all) => {
255338
+ for (var name2 in all)
255339
+ __defProp2(target, name2, { get: all[name2], enumerable: true });
255381
255340
  };
255382
- }
255383
- });
255384
-
255385
- // src/commands/environment/list-environments.ts
255386
- var list_environments_exports = {};
255387
- __export(list_environments_exports, {
255388
- default: () => list_environments_default
255389
- });
255390
- var import_rxjs7, import_operators6, list_environments_default;
255391
- var init_list_environments = __esm({
255392
- "src/commands/environment/list-environments.ts"() {
255393
- import_rxjs7 = __toESM(require_cjs());
255394
- import_operators6 = __toESM(require_operators());
255395
- init_helpers();
255396
- init_gql_client();
255397
- init_log();
255398
- list_environments_default = (cmd) => (0, import_rxjs7.lastValueFrom)(
255399
- parseProjectId(cmd.project).pipe(
255400
- (0, import_operators6.switchMap)((projectId) => GraphqlClienAPI.listEnvironments(projectId)),
255401
- (0, import_operators6.tap)((data) => {
255402
- const columns = [
255403
- "id",
255404
- "name",
255405
- "image",
255406
- "builder",
255407
- "poolSize",
255408
- "minCpu",
255409
- "maxCpu",
255410
- "minMemory",
255411
- "maxMemory",
255412
- "region"
255413
- ];
255414
- Logger.log("-------------------");
255415
- Logger.log("[Action][listEnvironments]");
255416
- Logger.table(data, columns);
255417
- Logger.log("-------------------");
255418
- })
255419
- )
255420
- );
255421
- }
255422
- });
255423
-
255424
- // src/commands/environment/create-environment.ts
255425
- var create_environment_exports = {};
255426
- __export(create_environment_exports, {
255427
- default: () => create_environment_default
255428
- });
255429
- var import_rxjs8, import_operators7, create_environment_default;
255430
- var init_create_environment = __esm({
255431
- "src/commands/environment/create-environment.ts"() {
255432
- import_rxjs8 = __toESM(require_cjs());
255433
- import_operators7 = __toESM(require_operators());
255434
- init_helpers();
255435
- init_gql_client();
255436
- init_log();
255437
- init_load_spec();
255438
- create_environment_default = (cmd) => (0, import_rxjs8.lastValueFrom)(
255439
- parseProjectId(cmd.project).pipe(
255440
- (0, import_operators7.switchMap)(
255441
- (projectId) => loadSpec(cmd.spec ?? "env.yaml").pipe(
255442
- (0, import_operators7.map)((data) => ({
255443
- projectId,
255444
- ...data?.environment ?? data
255445
- }))
255446
- )
255447
- ),
255448
- (0, import_operators7.switchMap)(
255449
- ({ projectId, ...data }) => GraphqlClienAPI.createEnvironment(projectId, {
255450
- ...data,
255451
- ...cmd
255452
- })
255453
- ),
255454
- (0, import_operators7.tap)((data) => {
255455
- const columns = [
255456
- "id",
255457
- "name",
255458
- "image",
255459
- "builder",
255460
- "poolSize",
255461
- "minCpu",
255462
- "maxCpu",
255463
- "minMemory",
255464
- "maxMemory",
255465
- "region"
255466
- ];
255467
- Logger.log("-------------------");
255468
- Logger.log("[Action][createEnvironment]");
255469
- Logger.table([data], columns);
255470
- Logger.log("-------------------");
255471
- })
255472
- )
255473
- );
255474
- }
255475
- });
255476
-
255477
- // src/commands/environment/update-environment.ts
255478
- var update_environment_exports = {};
255479
- __export(update_environment_exports, {
255480
- default: () => update_environment_default
255481
- });
255482
- var import_rxjs9, import_operators8, update_environment_default;
255483
- var init_update_environment = __esm({
255484
- "src/commands/environment/update-environment.ts"() {
255485
- import_rxjs9 = __toESM(require_cjs());
255486
- import_operators8 = __toESM(require_operators());
255487
- init_helpers();
255488
- init_gql_client();
255489
- init_log();
255490
- init_load_spec();
255491
- update_environment_default = (cmd) => (0, import_rxjs9.lastValueFrom)(
255492
- parseProjectId(cmd.project).pipe(
255493
- (0, import_operators8.switchMap)(
255494
- (projectId) => loadSpec(cmd.spec ?? "env.yaml").pipe(
255495
- (0, import_operators8.map)((data) => ({
255496
- projectId,
255497
- ...data?.environment ?? data
255498
- }))
255499
- )
255500
- ),
255501
- (0, import_operators8.tap)(Logger.log),
255502
- (0, import_operators8.switchMap)(
255503
- ({ projectId, ...data }) => GraphqlClienAPI.updateEnvironment(projectId, {
255504
- ...data,
255505
- ...cmd
255506
- })
255507
- ),
255508
- (0, import_operators8.tap)((data) => {
255509
- const columns = [
255510
- "id",
255511
- "name",
255512
- "image",
255513
- "builder",
255514
- "poolSize",
255515
- "minCpu",
255516
- "maxCpu",
255517
- "minMemory",
255518
- "maxMemory",
255519
- "region"
255520
- ];
255521
- Logger.log("-------------------");
255522
- Logger.log("[Action][updateEnvironment]");
255523
- Logger.table([data], columns);
255524
- Logger.log("-------------------");
255525
- })
255526
- )
255527
- );
255528
- }
255529
- });
255530
-
255531
- // src/commands/environment/delete-environment.ts
255532
- var delete_environment_exports = {};
255533
- __export(delete_environment_exports, {
255534
- default: () => delete_environment_default
255535
- });
255536
- var import_rxjs10, import_operators9, delete_environment_default;
255537
- var init_delete_environment = __esm({
255538
- "src/commands/environment/delete-environment.ts"() {
255539
- import_rxjs10 = __toESM(require_cjs());
255540
- import_operators9 = __toESM(require_operators());
255541
- init_helpers();
255542
- init_gql_client();
255543
- init_log();
255544
- init_load_spec();
255545
- delete_environment_default = (cmd) => (0, import_rxjs10.lastValueFrom)(
255546
- parseProjectId(cmd.project).pipe(
255547
- (0, import_operators9.switchMap)(
255548
- (projectId) => loadSpec(cmd.spec ?? "env.yaml").pipe(
255549
- (0, import_operators9.map)((data) => ({
255550
- projectId,
255551
- ...data?.environment ?? data
255552
- }))
255553
- )
255554
- ),
255555
- (0, import_operators9.switchMap)(
255556
- ({ projectId, name: name2 }) => GraphqlClienAPI.deleteEnvironment(name2, projectId, cmd.force)
255557
- ),
255558
- (0, import_operators9.tap)((data) => {
255559
- const columns = [
255560
- "id",
255561
- "name",
255562
- "image",
255563
- "builder",
255564
- "poolSize",
255565
- "minCpu",
255566
- "maxCpu",
255567
- "minMemory",
255568
- "maxMemory",
255569
- "region"
255570
- ];
255571
- Logger.log("-------------------");
255572
- Logger.log("[Action][deleteEnvironment]");
255573
- Logger.table([data], columns);
255574
- Logger.log("-------------------");
255575
- })
255576
- )
255577
- );
255578
- }
255579
- });
255580
-
255581
- // src/commands/environment/get-environment.ts
255582
- var get_environment_exports = {};
255583
- __export(get_environment_exports, {
255584
- default: () => get_environment_default
255585
- });
255586
- var import_rxjs11, import_operators10, get_environment_default;
255587
- var init_get_environment = __esm({
255588
- "src/commands/environment/get-environment.ts"() {
255589
- import_rxjs11 = __toESM(require_cjs());
255590
- import_operators10 = __toESM(require_operators());
255591
- init_helpers();
255592
- init_gql_client();
255593
- init_log();
255594
- init_load_spec();
255595
- get_environment_default = (cmd) => (0, import_rxjs11.lastValueFrom)(
255596
- parseProjectId(cmd.project).pipe(
255597
- (0, import_operators10.switchMap)(
255598
- (projectId) => loadSpec(cmd.spec ?? "env.yaml").pipe(
255599
- (0, import_operators10.map)((data) => ({
255600
- projectId,
255601
- ...data?.environment ?? data
255602
- }))
255603
- )
255604
- ),
255605
- (0, import_operators10.switchMap)(
255606
- ({ projectId, name: name2 }) => GraphqlClienAPI.getEnvironment(cmd.name ?? name2, projectId)
255607
- ),
255608
- (0, import_operators10.tap)((data) => {
255609
- const columns = [
255610
- "id",
255611
- "name",
255612
- "image",
255613
- "builder",
255614
- "poolSize",
255615
- "minCpu",
255616
- "maxCpu",
255617
- "minMemory",
255618
- "maxMemory",
255619
- "region"
255620
- ];
255621
- Logger.log("-------------------");
255622
- Logger.log("[Action][getEnvironment]");
255623
- Logger.table([data], columns);
255624
- Logger.log("-------------------");
255625
- })
255626
- )
255627
- );
255628
- }
255629
- });
255630
-
255631
- // ../../node_modules/delayed-stream/lib/delayed_stream.js
255632
- var require_delayed_stream = __commonJS({
255633
- "../../node_modules/delayed-stream/lib/delayed_stream.js"(exports2, module2) {
255634
- var Stream3 = require("stream").Stream;
255635
- var util2 = require("util");
255636
- module2.exports = DelayedStream;
255637
- function DelayedStream() {
255638
- this.source = null;
255639
- this.dataSize = 0;
255640
- this.maxDataSize = 1024 * 1024;
255641
- this.pauseStream = true;
255642
- this._maxDataSizeExceeded = false;
255643
- this._released = false;
255644
- this._bufferedEvents = [];
255645
- }
255646
- util2.inherits(DelayedStream, Stream3);
255647
- DelayedStream.create = function(source, options) {
255648
- var delayedStream = new this();
255649
- options = options || {};
255650
- for (var option in options) {
255651
- delayedStream[option] = options[option];
255341
+ var __copyProps2 = (to, from12, except, desc) => {
255342
+ if (from12 && typeof from12 === "object" || typeof from12 === "function") {
255343
+ for (let key of __getOwnPropNames2(from12))
255344
+ if (!__hasOwnProp2.call(to, key) && key !== except)
255345
+ __defProp2(to, key, { get: () => from12[key], enumerable: !(desc = __getOwnPropDesc2(from12, key)) || desc.enumerable });
255652
255346
  }
255653
- delayedStream.source = source;
255654
- var realEmit = source.emit;
255655
- source.emit = function() {
255656
- delayedStream._handleEmit(arguments);
255657
- return realEmit.apply(source, arguments);
255347
+ return to;
255348
+ };
255349
+ var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
255350
+ var node_exports = {};
255351
+ __export2(node_exports, {
255352
+ analyzeMetafile: () => analyzeMetafile,
255353
+ analyzeMetafileSync: () => analyzeMetafileSync,
255354
+ build: () => build,
255355
+ buildSync: () => buildSync,
255356
+ context: () => context,
255357
+ default: () => node_default,
255358
+ formatMessages: () => formatMessages,
255359
+ formatMessagesSync: () => formatMessagesSync,
255360
+ initialize: () => initialize,
255361
+ stop: () => stop,
255362
+ transform: () => transform2,
255363
+ transformSync: () => transformSync,
255364
+ version: () => version2
255365
+ });
255366
+ module2.exports = __toCommonJS2(node_exports);
255367
+ function encodePacket(packet) {
255368
+ let visit = (value) => {
255369
+ if (value === null) {
255370
+ bb.write8(0);
255371
+ } else if (typeof value === "boolean") {
255372
+ bb.write8(1);
255373
+ bb.write8(+value);
255374
+ } else if (typeof value === "number") {
255375
+ bb.write8(2);
255376
+ bb.write32(value | 0);
255377
+ } else if (typeof value === "string") {
255378
+ bb.write8(3);
255379
+ bb.write(encodeUTF8(value));
255380
+ } else if (value instanceof Uint8Array) {
255381
+ bb.write8(4);
255382
+ bb.write(value);
255383
+ } else if (value instanceof Array) {
255384
+ bb.write8(5);
255385
+ bb.write32(value.length);
255386
+ for (let item of value) {
255387
+ visit(item);
255388
+ }
255389
+ } else {
255390
+ let keys = Object.keys(value);
255391
+ bb.write8(6);
255392
+ bb.write32(keys.length);
255393
+ for (let key of keys) {
255394
+ bb.write(encodeUTF8(key));
255395
+ visit(value[key]);
255396
+ }
255397
+ }
255658
255398
  };
255659
- source.on("error", function() {
255660
- });
255661
- if (delayedStream.pauseStream) {
255662
- source.pause();
255399
+ let bb = new ByteBuffer();
255400
+ bb.write32(0);
255401
+ bb.write32(packet.id << 1 | +!packet.isRequest);
255402
+ visit(packet.value);
255403
+ writeUInt32LE(bb.buf, bb.len - 4, 0);
255404
+ return bb.buf.subarray(0, bb.len);
255405
+ }
255406
+ function decodePacket(bytes) {
255407
+ let visit = () => {
255408
+ switch (bb.read8()) {
255409
+ case 0:
255410
+ return null;
255411
+ case 1:
255412
+ return !!bb.read8();
255413
+ case 2:
255414
+ return bb.read32();
255415
+ case 3:
255416
+ return decodeUTF8(bb.read());
255417
+ case 4:
255418
+ return bb.read();
255419
+ case 5: {
255420
+ let count = bb.read32();
255421
+ let value2 = [];
255422
+ for (let i2 = 0; i2 < count; i2++) {
255423
+ value2.push(visit());
255424
+ }
255425
+ return value2;
255426
+ }
255427
+ case 6: {
255428
+ let count = bb.read32();
255429
+ let value2 = {};
255430
+ for (let i2 = 0; i2 < count; i2++) {
255431
+ value2[decodeUTF8(bb.read())] = visit();
255432
+ }
255433
+ return value2;
255434
+ }
255435
+ default:
255436
+ throw new Error("Invalid packet");
255437
+ }
255438
+ };
255439
+ let bb = new ByteBuffer(bytes);
255440
+ let id = bb.read32();
255441
+ let isRequest2 = (id & 1) === 0;
255442
+ id >>>= 1;
255443
+ let value = visit();
255444
+ if (bb.ptr !== bytes.length) {
255445
+ throw new Error("Invalid packet");
255663
255446
  }
255664
- return delayedStream;
255665
- };
255666
- Object.defineProperty(DelayedStream.prototype, "readable", {
255667
- configurable: true,
255668
- enumerable: true,
255669
- get: function() {
255670
- return this.source.readable;
255447
+ return { id, isRequest: isRequest2, value };
255448
+ }
255449
+ var ByteBuffer = class {
255450
+ constructor(buf = new Uint8Array(1024)) {
255451
+ this.buf = buf;
255452
+ this.len = 0;
255453
+ this.ptr = 0;
255671
255454
  }
255672
- });
255673
- DelayedStream.prototype.setEncoding = function() {
255674
- return this.source.setEncoding.apply(this.source, arguments);
255675
- };
255676
- DelayedStream.prototype.resume = function() {
255677
- if (!this._released) {
255678
- this.release();
255455
+ _write(delta) {
255456
+ if (this.len + delta > this.buf.length) {
255457
+ let clone3 = new Uint8Array((this.len + delta) * 2);
255458
+ clone3.set(this.buf);
255459
+ this.buf = clone3;
255460
+ }
255461
+ this.len += delta;
255462
+ return this.len - delta;
255679
255463
  }
255680
- this.source.resume();
255681
- };
255682
- DelayedStream.prototype.pause = function() {
255683
- this.source.pause();
255684
- };
255685
- DelayedStream.prototype.release = function() {
255686
- this._released = true;
255687
- this._bufferedEvents.forEach(function(args) {
255688
- this.emit.apply(this, args);
255689
- }.bind(this));
255690
- this._bufferedEvents = [];
255691
- };
255692
- DelayedStream.prototype.pipe = function() {
255693
- var r2 = Stream3.prototype.pipe.apply(this, arguments);
255694
- this.resume();
255695
- return r2;
255696
- };
255697
- DelayedStream.prototype._handleEmit = function(args) {
255698
- if (this._released) {
255699
- this.emit.apply(this, args);
255700
- return;
255464
+ write8(value) {
255465
+ let offset = this._write(1);
255466
+ this.buf[offset] = value;
255701
255467
  }
255702
- if (args[0] === "data") {
255703
- this.dataSize += args[1].length;
255704
- this._checkIfMaxDataSizeExceeded();
255468
+ write32(value) {
255469
+ let offset = this._write(4);
255470
+ writeUInt32LE(this.buf, value, offset);
255705
255471
  }
255706
- this._bufferedEvents.push(args);
255707
- };
255708
- DelayedStream.prototype._checkIfMaxDataSizeExceeded = function() {
255709
- if (this._maxDataSizeExceeded) {
255710
- return;
255472
+ write(bytes) {
255473
+ let offset = this._write(4 + bytes.length);
255474
+ writeUInt32LE(this.buf, bytes.length, offset);
255475
+ this.buf.set(bytes, offset + 4);
255711
255476
  }
255712
- if (this.dataSize <= this.maxDataSize) {
255713
- return;
255477
+ _read(delta) {
255478
+ if (this.ptr + delta > this.buf.length) {
255479
+ throw new Error("Invalid packet");
255480
+ }
255481
+ this.ptr += delta;
255482
+ return this.ptr - delta;
255483
+ }
255484
+ read8() {
255485
+ return this.buf[this._read(1)];
255486
+ }
255487
+ read32() {
255488
+ return readUInt32LE(this.buf, this._read(4));
255489
+ }
255490
+ read() {
255491
+ let length = this.read32();
255492
+ let bytes = new Uint8Array(length);
255493
+ let ptr = this._read(bytes.length);
255494
+ bytes.set(this.buf.subarray(ptr, ptr + length));
255495
+ return bytes;
255714
255496
  }
255715
- this._maxDataSizeExceeded = true;
255716
- var message = "DelayedStream#maxDataSize of " + this.maxDataSize + " bytes exceeded.";
255717
- this.emit("error", new Error(message));
255718
255497
  };
255719
- }
255720
- });
255498
+ var encodeUTF8;
255499
+ var decodeUTF8;
255500
+ var encodeInvariant;
255501
+ if (typeof TextEncoder !== "undefined" && typeof TextDecoder !== "undefined") {
255502
+ let encoder = new TextEncoder();
255503
+ let decoder = new TextDecoder();
255504
+ encodeUTF8 = (text) => encoder.encode(text);
255505
+ decodeUTF8 = (bytes) => decoder.decode(bytes);
255506
+ encodeInvariant = 'new TextEncoder().encode("")';
255507
+ } else if (typeof Buffer !== "undefined") {
255508
+ encodeUTF8 = (text) => Buffer.from(text);
255509
+ decodeUTF8 = (bytes) => {
255510
+ let { buffer, byteOffset, byteLength } = bytes;
255511
+ return Buffer.from(buffer, byteOffset, byteLength).toString();
255512
+ };
255513
+ encodeInvariant = 'Buffer.from("")';
255514
+ } else {
255515
+ throw new Error("No UTF-8 codec found");
255516
+ }
255517
+ if (!(encodeUTF8("") instanceof Uint8Array))
255518
+ throw new Error(`Invariant violation: "${encodeInvariant} instanceof Uint8Array" is incorrectly false
255721
255519
 
255722
- // ../../node_modules/combined-stream/lib/combined_stream.js
255723
- var require_combined_stream = __commonJS({
255724
- "../../node_modules/combined-stream/lib/combined_stream.js"(exports2, module2) {
255725
- var util2 = require("util");
255726
- var Stream3 = require("stream").Stream;
255727
- var DelayedStream = require_delayed_stream();
255728
- module2.exports = CombinedStream;
255729
- function CombinedStream() {
255730
- this.writable = false;
255731
- this.readable = true;
255732
- this.dataSize = 0;
255733
- this.maxDataSize = 2 * 1024 * 1024;
255734
- this.pauseStreams = true;
255735
- this._released = false;
255736
- this._streams = [];
255737
- this._currentStream = null;
255738
- this._insideLoop = false;
255739
- this._pendingNext = false;
255520
+ This indicates that your JavaScript environment is broken. You cannot use
255521
+ esbuild in this environment because esbuild relies on this invariant. This
255522
+ is not a problem with esbuild. You need to fix your environment instead.
255523
+ `);
255524
+ function readUInt32LE(buffer, offset) {
255525
+ return (buffer[offset++] | buffer[offset++] << 8 | buffer[offset++] << 16 | buffer[offset++] << 24) >>> 0;
255740
255526
  }
255741
- util2.inherits(CombinedStream, Stream3);
255742
- CombinedStream.create = function(options) {
255743
- var combinedStream = new this();
255744
- options = options || {};
255745
- for (var option in options) {
255746
- combinedStream[option] = options[option];
255527
+ function writeUInt32LE(buffer, value, offset) {
255528
+ buffer[offset++] = value;
255529
+ buffer[offset++] = value >> 8;
255530
+ buffer[offset++] = value >> 16;
255531
+ buffer[offset++] = value >> 24;
255532
+ }
255533
+ var fromCharCode = String.fromCharCode;
255534
+ function throwSyntaxError(bytes, index, message) {
255535
+ const c = bytes[index];
255536
+ let line = 1;
255537
+ let column = 0;
255538
+ for (let i2 = 0; i2 < index; i2++) {
255539
+ if (bytes[i2] === 10) {
255540
+ line++;
255541
+ column = 0;
255542
+ } else {
255543
+ column++;
255544
+ }
255747
255545
  }
255748
- return combinedStream;
255749
- };
255750
- CombinedStream.isStreamLike = function(stream) {
255751
- return typeof stream !== "function" && typeof stream !== "string" && typeof stream !== "boolean" && typeof stream !== "number" && !Buffer.isBuffer(stream);
255752
- };
255753
- CombinedStream.prototype.append = function(stream) {
255754
- var isStreamLike = CombinedStream.isStreamLike(stream);
255755
- if (isStreamLike) {
255756
- if (!(stream instanceof DelayedStream)) {
255757
- var newStream = DelayedStream.create(stream, {
255758
- maxDataSize: Infinity,
255759
- pauseStream: this.pauseStreams
255760
- });
255761
- stream.on("data", this._checkDataSize.bind(this));
255762
- stream = newStream;
255546
+ throw new SyntaxError(
255547
+ message ? message : index === bytes.length ? "Unexpected end of input while parsing JSON" : c >= 32 && c <= 126 ? `Unexpected character ${fromCharCode(c)} in JSON at position ${index} (line ${line}, column ${column})` : `Unexpected byte 0x${c.toString(16)} in JSON at position ${index} (line ${line}, column ${column})`
255548
+ );
255549
+ }
255550
+ function JSON_parse(bytes) {
255551
+ if (!(bytes instanceof Uint8Array)) {
255552
+ throw new Error(`JSON input must be a Uint8Array`);
255553
+ }
255554
+ const propertyStack = [];
255555
+ const objectStack = [];
255556
+ const stateStack = [];
255557
+ const length = bytes.length;
255558
+ let property = null;
255559
+ let state = 0;
255560
+ let object3;
255561
+ let i2 = 0;
255562
+ while (i2 < length) {
255563
+ let c = bytes[i2++];
255564
+ if (c <= 32) {
255565
+ continue;
255763
255566
  }
255764
- this._handleErrors(stream);
255765
- if (this.pauseStreams) {
255766
- stream.pause();
255567
+ let value;
255568
+ if (state === 2 && property === null && c !== 34 && c !== 125) {
255569
+ throwSyntaxError(bytes, --i2);
255767
255570
  }
255571
+ switch (c) {
255572
+ // True
255573
+ case 116: {
255574
+ if (bytes[i2++] !== 114 || bytes[i2++] !== 117 || bytes[i2++] !== 101) {
255575
+ throwSyntaxError(bytes, --i2);
255576
+ }
255577
+ value = true;
255578
+ break;
255579
+ }
255580
+ // False
255581
+ case 102: {
255582
+ if (bytes[i2++] !== 97 || bytes[i2++] !== 108 || bytes[i2++] !== 115 || bytes[i2++] !== 101) {
255583
+ throwSyntaxError(bytes, --i2);
255584
+ }
255585
+ value = false;
255586
+ break;
255587
+ }
255588
+ // Null
255589
+ case 110: {
255590
+ if (bytes[i2++] !== 117 || bytes[i2++] !== 108 || bytes[i2++] !== 108) {
255591
+ throwSyntaxError(bytes, --i2);
255592
+ }
255593
+ value = null;
255594
+ break;
255595
+ }
255596
+ // Number begin
255597
+ case 45:
255598
+ case 46:
255599
+ case 48:
255600
+ case 49:
255601
+ case 50:
255602
+ case 51:
255603
+ case 52:
255604
+ case 53:
255605
+ case 54:
255606
+ case 55:
255607
+ case 56:
255608
+ case 57: {
255609
+ let index = i2;
255610
+ value = fromCharCode(c);
255611
+ c = bytes[i2];
255612
+ while (true) {
255613
+ switch (c) {
255614
+ case 43:
255615
+ case 45:
255616
+ case 46:
255617
+ case 48:
255618
+ case 49:
255619
+ case 50:
255620
+ case 51:
255621
+ case 52:
255622
+ case 53:
255623
+ case 54:
255624
+ case 55:
255625
+ case 56:
255626
+ case 57:
255627
+ case 101:
255628
+ case 69: {
255629
+ value += fromCharCode(c);
255630
+ c = bytes[++i2];
255631
+ continue;
255632
+ }
255633
+ }
255634
+ break;
255635
+ }
255636
+ value = +value;
255637
+ if (isNaN(value)) {
255638
+ throwSyntaxError(bytes, --index, "Invalid number");
255639
+ }
255640
+ break;
255641
+ }
255642
+ // String begin
255643
+ case 34: {
255644
+ value = "";
255645
+ while (true) {
255646
+ if (i2 >= length) {
255647
+ throwSyntaxError(bytes, length);
255648
+ }
255649
+ c = bytes[i2++];
255650
+ if (c === 34) {
255651
+ break;
255652
+ } else if (c === 92) {
255653
+ switch (bytes[i2++]) {
255654
+ // Normal escape sequence
255655
+ case 34:
255656
+ value += '"';
255657
+ break;
255658
+ case 47:
255659
+ value += "/";
255660
+ break;
255661
+ case 92:
255662
+ value += "\\";
255663
+ break;
255664
+ case 98:
255665
+ value += "\b";
255666
+ break;
255667
+ case 102:
255668
+ value += "\f";
255669
+ break;
255670
+ case 110:
255671
+ value += "\n";
255672
+ break;
255673
+ case 114:
255674
+ value += "\r";
255675
+ break;
255676
+ case 116:
255677
+ value += " ";
255678
+ break;
255679
+ // Unicode escape sequence
255680
+ case 117: {
255681
+ let code = 0;
255682
+ for (let j = 0; j < 4; j++) {
255683
+ c = bytes[i2++];
255684
+ code <<= 4;
255685
+ if (c >= 48 && c <= 57) code |= c - 48;
255686
+ else if (c >= 97 && c <= 102) code |= c + (10 - 97);
255687
+ else if (c >= 65 && c <= 70) code |= c + (10 - 65);
255688
+ else throwSyntaxError(bytes, --i2);
255689
+ }
255690
+ value += fromCharCode(code);
255691
+ break;
255692
+ }
255693
+ // Invalid escape sequence
255694
+ default:
255695
+ throwSyntaxError(bytes, --i2);
255696
+ break;
255697
+ }
255698
+ } else if (c <= 127) {
255699
+ value += fromCharCode(c);
255700
+ } else if ((c & 224) === 192) {
255701
+ value += fromCharCode((c & 31) << 6 | bytes[i2++] & 63);
255702
+ } else if ((c & 240) === 224) {
255703
+ value += fromCharCode((c & 15) << 12 | (bytes[i2++] & 63) << 6 | bytes[i2++] & 63);
255704
+ } else if ((c & 248) == 240) {
255705
+ let codePoint = (c & 7) << 18 | (bytes[i2++] & 63) << 12 | (bytes[i2++] & 63) << 6 | bytes[i2++] & 63;
255706
+ if (codePoint > 65535) {
255707
+ codePoint -= 65536;
255708
+ value += fromCharCode(codePoint >> 10 & 1023 | 55296);
255709
+ codePoint = 56320 | codePoint & 1023;
255710
+ }
255711
+ value += fromCharCode(codePoint);
255712
+ }
255713
+ }
255714
+ value[0];
255715
+ break;
255716
+ }
255717
+ // Array begin
255718
+ case 91: {
255719
+ value = [];
255720
+ propertyStack.push(property);
255721
+ objectStack.push(object3);
255722
+ stateStack.push(state);
255723
+ property = null;
255724
+ object3 = value;
255725
+ state = 1;
255726
+ continue;
255727
+ }
255728
+ // Object begin
255729
+ case 123: {
255730
+ value = {};
255731
+ propertyStack.push(property);
255732
+ objectStack.push(object3);
255733
+ stateStack.push(state);
255734
+ property = null;
255735
+ object3 = value;
255736
+ state = 2;
255737
+ continue;
255738
+ }
255739
+ // Array end
255740
+ case 93: {
255741
+ if (state !== 1) {
255742
+ throwSyntaxError(bytes, --i2);
255743
+ }
255744
+ value = object3;
255745
+ property = propertyStack.pop();
255746
+ object3 = objectStack.pop();
255747
+ state = stateStack.pop();
255748
+ break;
255749
+ }
255750
+ // Object end
255751
+ case 125: {
255752
+ if (state !== 2) {
255753
+ throwSyntaxError(bytes, --i2);
255754
+ }
255755
+ value = object3;
255756
+ property = propertyStack.pop();
255757
+ object3 = objectStack.pop();
255758
+ state = stateStack.pop();
255759
+ break;
255760
+ }
255761
+ default: {
255762
+ throwSyntaxError(bytes, --i2);
255763
+ }
255764
+ }
255765
+ c = bytes[i2];
255766
+ while (c <= 32) {
255767
+ c = bytes[++i2];
255768
+ }
255769
+ switch (state) {
255770
+ case 0: {
255771
+ if (i2 === length) {
255772
+ return value;
255773
+ }
255774
+ break;
255775
+ }
255776
+ case 1: {
255777
+ object3.push(value);
255778
+ if (c === 44) {
255779
+ i2++;
255780
+ continue;
255781
+ }
255782
+ if (c === 93) {
255783
+ continue;
255784
+ }
255785
+ break;
255786
+ }
255787
+ case 2: {
255788
+ if (property === null) {
255789
+ property = value;
255790
+ if (c === 58) {
255791
+ i2++;
255792
+ continue;
255793
+ }
255794
+ } else {
255795
+ object3[property] = value;
255796
+ property = null;
255797
+ if (c === 44) {
255798
+ i2++;
255799
+ continue;
255800
+ }
255801
+ if (c === 125) {
255802
+ continue;
255803
+ }
255804
+ }
255805
+ break;
255806
+ }
255807
+ }
255808
+ break;
255768
255809
  }
255769
- this._streams.push(stream);
255770
- return this;
255771
- };
255772
- CombinedStream.prototype.pipe = function(dest, options) {
255773
- Stream3.prototype.pipe.call(this, dest, options);
255774
- this.resume();
255775
- return dest;
255776
- };
255777
- CombinedStream.prototype._getNext = function() {
255778
- this._currentStream = null;
255779
- if (this._insideLoop) {
255780
- this._pendingNext = true;
255781
- return;
255782
- }
255783
- this._insideLoop = true;
255784
- try {
255785
- do {
255786
- this._pendingNext = false;
255787
- this._realGetNext();
255788
- } while (this._pendingNext);
255789
- } finally {
255790
- this._insideLoop = false;
255791
- }
255792
- };
255793
- CombinedStream.prototype._realGetNext = function() {
255794
- var stream = this._streams.shift();
255795
- if (typeof stream == "undefined") {
255796
- this.end();
255797
- return;
255810
+ throwSyntaxError(bytes, i2);
255811
+ }
255812
+ var quote = JSON.stringify;
255813
+ var buildLogLevelDefault = "warning";
255814
+ var transformLogLevelDefault = "silent";
255815
+ function validateAndJoinStringArray(values, what) {
255816
+ const toJoin = [];
255817
+ for (const value of values) {
255818
+ validateStringValue(value, what);
255819
+ if (value.indexOf(",") >= 0) throw new Error(`Invalid ${what}: ${value}`);
255820
+ toJoin.push(value);
255798
255821
  }
255799
- if (typeof stream !== "function") {
255800
- this._pipeNext(stream);
255801
- return;
255822
+ return toJoin.join(",");
255823
+ }
255824
+ var canBeAnything = () => null;
255825
+ var mustBeBoolean = (value) => typeof value === "boolean" ? null : "a boolean";
255826
+ var mustBeString = (value) => typeof value === "string" ? null : "a string";
255827
+ var mustBeRegExp = (value) => value instanceof RegExp ? null : "a RegExp object";
255828
+ var mustBeInteger = (value) => typeof value === "number" && value === (value | 0) ? null : "an integer";
255829
+ var mustBeValidPortNumber = (value) => typeof value === "number" && value === (value | 0) && value >= 0 && value <= 65535 ? null : "a valid port number";
255830
+ var mustBeFunction = (value) => typeof value === "function" ? null : "a function";
255831
+ var mustBeArray = (value) => Array.isArray(value) ? null : "an array";
255832
+ var mustBeArrayOfStrings = (value) => Array.isArray(value) && value.every((x2) => typeof x2 === "string") ? null : "an array of strings";
255833
+ var mustBeObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value) ? null : "an object";
255834
+ var mustBeEntryPoints = (value) => typeof value === "object" && value !== null ? null : "an array or an object";
255835
+ var mustBeWebAssemblyModule = (value) => value instanceof WebAssembly.Module ? null : "a WebAssembly.Module";
255836
+ var mustBeObjectOrNull = (value) => typeof value === "object" && !Array.isArray(value) ? null : "an object or null";
255837
+ var mustBeStringOrBoolean = (value) => typeof value === "string" || typeof value === "boolean" ? null : "a string or a boolean";
255838
+ var mustBeStringOrObject = (value) => typeof value === "string" || typeof value === "object" && value !== null && !Array.isArray(value) ? null : "a string or an object";
255839
+ var mustBeStringOrArrayOfStrings = (value) => typeof value === "string" || Array.isArray(value) && value.every((x2) => typeof x2 === "string") ? null : "a string or an array of strings";
255840
+ var mustBeStringOrUint8Array = (value) => typeof value === "string" || value instanceof Uint8Array ? null : "a string or a Uint8Array";
255841
+ var mustBeStringOrURL = (value) => typeof value === "string" || value instanceof URL ? null : "a string or a URL";
255842
+ function getFlag(object3, keys, key, mustBeFn) {
255843
+ let value = object3[key];
255844
+ keys[key + ""] = true;
255845
+ if (value === void 0) return void 0;
255846
+ let mustBe = mustBeFn(value);
255847
+ if (mustBe !== null) throw new Error(`${quote(key)} must be ${mustBe}`);
255848
+ return value;
255849
+ }
255850
+ function checkForInvalidFlags(object3, keys, where) {
255851
+ for (let key in object3) {
255852
+ if (!(key in keys)) {
255853
+ throw new Error(`Invalid option ${where}: ${quote(key)}`);
255854
+ }
255802
255855
  }
255803
- var getStream = stream;
255804
- getStream(function(stream2) {
255805
- var isStreamLike = CombinedStream.isStreamLike(stream2);
255806
- if (isStreamLike) {
255807
- stream2.on("data", this._checkDataSize.bind(this));
255808
- this._handleErrors(stream2);
255856
+ }
255857
+ function validateInitializeOptions(options) {
255858
+ let keys = /* @__PURE__ */ Object.create(null);
255859
+ let wasmURL = getFlag(options, keys, "wasmURL", mustBeStringOrURL);
255860
+ let wasmModule = getFlag(options, keys, "wasmModule", mustBeWebAssemblyModule);
255861
+ let worker = getFlag(options, keys, "worker", mustBeBoolean);
255862
+ checkForInvalidFlags(options, keys, "in initialize() call");
255863
+ return {
255864
+ wasmURL,
255865
+ wasmModule,
255866
+ worker
255867
+ };
255868
+ }
255869
+ function validateMangleCache(mangleCache) {
255870
+ let validated;
255871
+ if (mangleCache !== void 0) {
255872
+ validated = /* @__PURE__ */ Object.create(null);
255873
+ for (let key in mangleCache) {
255874
+ let value = mangleCache[key];
255875
+ if (typeof value === "string" || value === false) {
255876
+ validated[key] = value;
255877
+ } else {
255878
+ throw new Error(`Expected ${quote(key)} in mangle cache to map to either a string or false`);
255879
+ }
255809
255880
  }
255810
- this._pipeNext(stream2);
255811
- }.bind(this));
255812
- };
255813
- CombinedStream.prototype._pipeNext = function(stream) {
255814
- this._currentStream = stream;
255815
- var isStreamLike = CombinedStream.isStreamLike(stream);
255816
- if (isStreamLike) {
255817
- stream.on("end", this._getNext.bind(this));
255818
- stream.pipe(this, { end: false });
255819
- return;
255820
255881
  }
255821
- var value = stream;
255822
- this.write(value);
255823
- this._getNext();
255824
- };
255825
- CombinedStream.prototype._handleErrors = function(stream) {
255826
- var self2 = this;
255827
- stream.on("error", function(err) {
255828
- self2._emitError(err);
255829
- });
255830
- };
255831
- CombinedStream.prototype.write = function(data) {
255832
- this.emit("data", data);
255833
- };
255834
- CombinedStream.prototype.pause = function() {
255835
- if (!this.pauseStreams) {
255836
- return;
255882
+ return validated;
255883
+ }
255884
+ function pushLogFlags(flags, options, keys, isTTY2, logLevelDefault) {
255885
+ let color = getFlag(options, keys, "color", mustBeBoolean);
255886
+ let logLevel = getFlag(options, keys, "logLevel", mustBeString);
255887
+ let logLimit = getFlag(options, keys, "logLimit", mustBeInteger);
255888
+ if (color !== void 0) flags.push(`--color=${color}`);
255889
+ else if (isTTY2) flags.push(`--color=true`);
255890
+ flags.push(`--log-level=${logLevel || logLevelDefault}`);
255891
+ flags.push(`--log-limit=${logLimit || 0}`);
255892
+ }
255893
+ function validateStringValue(value, what, key) {
255894
+ if (typeof value !== "string") {
255895
+ throw new Error(`Expected value for ${what}${key !== void 0 ? " " + quote(key) : ""} to be a string, got ${typeof value} instead`);
255837
255896
  }
255838
- if (this.pauseStreams && this._currentStream && typeof this._currentStream.pause == "function") this._currentStream.pause();
255839
- this.emit("pause");
255840
- };
255841
- CombinedStream.prototype.resume = function() {
255842
- if (!this._released) {
255843
- this._released = true;
255844
- this.writable = true;
255845
- this._getNext();
255897
+ return value;
255898
+ }
255899
+ function pushCommonFlags(flags, options, keys) {
255900
+ let legalComments = getFlag(options, keys, "legalComments", mustBeString);
255901
+ let sourceRoot = getFlag(options, keys, "sourceRoot", mustBeString);
255902
+ let sourcesContent = getFlag(options, keys, "sourcesContent", mustBeBoolean);
255903
+ let target = getFlag(options, keys, "target", mustBeStringOrArrayOfStrings);
255904
+ let format = getFlag(options, keys, "format", mustBeString);
255905
+ let globalName = getFlag(options, keys, "globalName", mustBeString);
255906
+ let mangleProps = getFlag(options, keys, "mangleProps", mustBeRegExp);
255907
+ let reserveProps = getFlag(options, keys, "reserveProps", mustBeRegExp);
255908
+ let mangleQuoted = getFlag(options, keys, "mangleQuoted", mustBeBoolean);
255909
+ let minify = getFlag(options, keys, "minify", mustBeBoolean);
255910
+ let minifySyntax = getFlag(options, keys, "minifySyntax", mustBeBoolean);
255911
+ let minifyWhitespace = getFlag(options, keys, "minifyWhitespace", mustBeBoolean);
255912
+ let minifyIdentifiers = getFlag(options, keys, "minifyIdentifiers", mustBeBoolean);
255913
+ let lineLimit = getFlag(options, keys, "lineLimit", mustBeInteger);
255914
+ let drop = getFlag(options, keys, "drop", mustBeArrayOfStrings);
255915
+ let dropLabels = getFlag(options, keys, "dropLabels", mustBeArrayOfStrings);
255916
+ let charset = getFlag(options, keys, "charset", mustBeString);
255917
+ let treeShaking = getFlag(options, keys, "treeShaking", mustBeBoolean);
255918
+ let ignoreAnnotations = getFlag(options, keys, "ignoreAnnotations", mustBeBoolean);
255919
+ let jsx = getFlag(options, keys, "jsx", mustBeString);
255920
+ let jsxFactory = getFlag(options, keys, "jsxFactory", mustBeString);
255921
+ let jsxFragment = getFlag(options, keys, "jsxFragment", mustBeString);
255922
+ let jsxImportSource = getFlag(options, keys, "jsxImportSource", mustBeString);
255923
+ let jsxDev = getFlag(options, keys, "jsxDev", mustBeBoolean);
255924
+ let jsxSideEffects = getFlag(options, keys, "jsxSideEffects", mustBeBoolean);
255925
+ let define2 = getFlag(options, keys, "define", mustBeObject);
255926
+ let logOverride = getFlag(options, keys, "logOverride", mustBeObject);
255927
+ let supported = getFlag(options, keys, "supported", mustBeObject);
255928
+ let pure = getFlag(options, keys, "pure", mustBeArrayOfStrings);
255929
+ let keepNames = getFlag(options, keys, "keepNames", mustBeBoolean);
255930
+ let platform = getFlag(options, keys, "platform", mustBeString);
255931
+ let tsconfigRaw = getFlag(options, keys, "tsconfigRaw", mustBeStringOrObject);
255932
+ let absPaths = getFlag(options, keys, "absPaths", mustBeArrayOfStrings);
255933
+ if (legalComments) flags.push(`--legal-comments=${legalComments}`);
255934
+ if (sourceRoot !== void 0) flags.push(`--source-root=${sourceRoot}`);
255935
+ if (sourcesContent !== void 0) flags.push(`--sources-content=${sourcesContent}`);
255936
+ if (target) flags.push(`--target=${validateAndJoinStringArray(Array.isArray(target) ? target : [target], "target")}`);
255937
+ if (format) flags.push(`--format=${format}`);
255938
+ if (globalName) flags.push(`--global-name=${globalName}`);
255939
+ if (platform) flags.push(`--platform=${platform}`);
255940
+ if (tsconfigRaw) flags.push(`--tsconfig-raw=${typeof tsconfigRaw === "string" ? tsconfigRaw : JSON.stringify(tsconfigRaw)}`);
255941
+ if (minify) flags.push("--minify");
255942
+ if (minifySyntax) flags.push("--minify-syntax");
255943
+ if (minifyWhitespace) flags.push("--minify-whitespace");
255944
+ if (minifyIdentifiers) flags.push("--minify-identifiers");
255945
+ if (lineLimit) flags.push(`--line-limit=${lineLimit}`);
255946
+ if (charset) flags.push(`--charset=${charset}`);
255947
+ if (treeShaking !== void 0) flags.push(`--tree-shaking=${treeShaking}`);
255948
+ if (ignoreAnnotations) flags.push(`--ignore-annotations`);
255949
+ if (drop) for (let what of drop) flags.push(`--drop:${validateStringValue(what, "drop")}`);
255950
+ if (dropLabels) flags.push(`--drop-labels=${validateAndJoinStringArray(dropLabels, "drop label")}`);
255951
+ if (absPaths) flags.push(`--abs-paths=${validateAndJoinStringArray(absPaths, "abs paths")}`);
255952
+ if (mangleProps) flags.push(`--mangle-props=${jsRegExpToGoRegExp(mangleProps)}`);
255953
+ if (reserveProps) flags.push(`--reserve-props=${jsRegExpToGoRegExp(reserveProps)}`);
255954
+ if (mangleQuoted !== void 0) flags.push(`--mangle-quoted=${mangleQuoted}`);
255955
+ if (jsx) flags.push(`--jsx=${jsx}`);
255956
+ if (jsxFactory) flags.push(`--jsx-factory=${jsxFactory}`);
255957
+ if (jsxFragment) flags.push(`--jsx-fragment=${jsxFragment}`);
255958
+ if (jsxImportSource) flags.push(`--jsx-import-source=${jsxImportSource}`);
255959
+ if (jsxDev) flags.push(`--jsx-dev`);
255960
+ if (jsxSideEffects) flags.push(`--jsx-side-effects`);
255961
+ if (define2) {
255962
+ for (let key in define2) {
255963
+ if (key.indexOf("=") >= 0) throw new Error(`Invalid define: ${key}`);
255964
+ flags.push(`--define:${key}=${validateStringValue(define2[key], "define", key)}`);
255965
+ }
255846
255966
  }
255847
- if (this.pauseStreams && this._currentStream && typeof this._currentStream.resume == "function") this._currentStream.resume();
255848
- this.emit("resume");
255849
- };
255850
- CombinedStream.prototype.end = function() {
255851
- this._reset();
255852
- this.emit("end");
255853
- };
255854
- CombinedStream.prototype.destroy = function() {
255855
- this._reset();
255856
- this.emit("close");
255857
- };
255858
- CombinedStream.prototype._reset = function() {
255859
- this.writable = false;
255860
- this._streams = [];
255861
- this._currentStream = null;
255862
- };
255863
- CombinedStream.prototype._checkDataSize = function() {
255864
- this._updateDataSize();
255865
- if (this.dataSize <= this.maxDataSize) {
255866
- return;
255967
+ if (logOverride) {
255968
+ for (let key in logOverride) {
255969
+ if (key.indexOf("=") >= 0) throw new Error(`Invalid log override: ${key}`);
255970
+ flags.push(`--log-override:${key}=${validateStringValue(logOverride[key], "log override", key)}`);
255971
+ }
255867
255972
  }
255868
- var message = "DelayedStream#maxDataSize of " + this.maxDataSize + " bytes exceeded.";
255869
- this._emitError(new Error(message));
255870
- };
255871
- CombinedStream.prototype._updateDataSize = function() {
255872
- this.dataSize = 0;
255873
- var self2 = this;
255874
- this._streams.forEach(function(stream) {
255875
- if (!stream.dataSize) {
255876
- return;
255973
+ if (supported) {
255974
+ for (let key in supported) {
255975
+ if (key.indexOf("=") >= 0) throw new Error(`Invalid supported: ${key}`);
255976
+ const value = supported[key];
255977
+ if (typeof value !== "boolean") throw new Error(`Expected value for supported ${quote(key)} to be a boolean, got ${typeof value} instead`);
255978
+ flags.push(`--supported:${key}=${value}`);
255877
255979
  }
255878
- self2.dataSize += stream.dataSize;
255879
- });
255880
- if (this._currentStream && this._currentStream.dataSize) {
255881
- this.dataSize += this._currentStream.dataSize;
255882
255980
  }
255883
- };
255884
- CombinedStream.prototype._emitError = function(err) {
255885
- this._reset();
255886
- this.emit("error", err);
255887
- };
255888
- }
255889
- });
255890
-
255891
- // ../../node_modules/mime-db/db.json
255892
- var require_db = __commonJS({
255893
- "../../node_modules/mime-db/db.json"(exports2, module2) {
255894
- module2.exports = {
255895
- "application/1d-interleaved-parityfec": {
255896
- source: "iana"
255897
- },
255898
- "application/3gpdash-qoe-report+xml": {
255899
- source: "iana",
255900
- charset: "UTF-8",
255901
- compressible: true
255902
- },
255903
- "application/3gpp-ims+xml": {
255981
+ if (pure) for (let fn of pure) flags.push(`--pure:${validateStringValue(fn, "pure")}`);
255982
+ if (keepNames) flags.push(`--keep-names`);
255983
+ }
255984
+ function flagsForBuildOptions(callName, options, isTTY2, logLevelDefault, writeDefault) {
255985
+ var _a22;
255986
+ let flags = [];
255987
+ let entries = [];
255988
+ let keys = /* @__PURE__ */ Object.create(null);
255989
+ let stdinContents = null;
255990
+ let stdinResolveDir = null;
255991
+ pushLogFlags(flags, options, keys, isTTY2, logLevelDefault);
255992
+ pushCommonFlags(flags, options, keys);
255993
+ let sourcemap = getFlag(options, keys, "sourcemap", mustBeStringOrBoolean);
255994
+ let bundle = getFlag(options, keys, "bundle", mustBeBoolean);
255995
+ let splitting = getFlag(options, keys, "splitting", mustBeBoolean);
255996
+ let preserveSymlinks = getFlag(options, keys, "preserveSymlinks", mustBeBoolean);
255997
+ let metafile = getFlag(options, keys, "metafile", mustBeBoolean);
255998
+ let outfile = getFlag(options, keys, "outfile", mustBeString);
255999
+ let outdir = getFlag(options, keys, "outdir", mustBeString);
256000
+ let outbase = getFlag(options, keys, "outbase", mustBeString);
256001
+ let tsconfig = getFlag(options, keys, "tsconfig", mustBeString);
256002
+ let resolveExtensions = getFlag(options, keys, "resolveExtensions", mustBeArrayOfStrings);
256003
+ let nodePathsInput = getFlag(options, keys, "nodePaths", mustBeArrayOfStrings);
256004
+ let mainFields = getFlag(options, keys, "mainFields", mustBeArrayOfStrings);
256005
+ let conditions = getFlag(options, keys, "conditions", mustBeArrayOfStrings);
256006
+ let external = getFlag(options, keys, "external", mustBeArrayOfStrings);
256007
+ let packages = getFlag(options, keys, "packages", mustBeString);
256008
+ let alias = getFlag(options, keys, "alias", mustBeObject);
256009
+ let loader2 = getFlag(options, keys, "loader", mustBeObject);
256010
+ let outExtension = getFlag(options, keys, "outExtension", mustBeObject);
256011
+ let publicPath = getFlag(options, keys, "publicPath", mustBeString);
256012
+ let entryNames = getFlag(options, keys, "entryNames", mustBeString);
256013
+ let chunkNames = getFlag(options, keys, "chunkNames", mustBeString);
256014
+ let assetNames = getFlag(options, keys, "assetNames", mustBeString);
256015
+ let inject = getFlag(options, keys, "inject", mustBeArrayOfStrings);
256016
+ let banner = getFlag(options, keys, "banner", mustBeObject);
256017
+ let footer = getFlag(options, keys, "footer", mustBeObject);
256018
+ let entryPoints = getFlag(options, keys, "entryPoints", mustBeEntryPoints);
256019
+ let absWorkingDir = getFlag(options, keys, "absWorkingDir", mustBeString);
256020
+ let stdin = getFlag(options, keys, "stdin", mustBeObject);
256021
+ let write = (_a22 = getFlag(options, keys, "write", mustBeBoolean)) != null ? _a22 : writeDefault;
256022
+ let allowOverwrite = getFlag(options, keys, "allowOverwrite", mustBeBoolean);
256023
+ let mangleCache = getFlag(options, keys, "mangleCache", mustBeObject);
256024
+ keys.plugins = true;
256025
+ checkForInvalidFlags(options, keys, `in ${callName}() call`);
256026
+ if (sourcemap) flags.push(`--sourcemap${sourcemap === true ? "" : `=${sourcemap}`}`);
256027
+ if (bundle) flags.push("--bundle");
256028
+ if (allowOverwrite) flags.push("--allow-overwrite");
256029
+ if (splitting) flags.push("--splitting");
256030
+ if (preserveSymlinks) flags.push("--preserve-symlinks");
256031
+ if (metafile) flags.push(`--metafile`);
256032
+ if (outfile) flags.push(`--outfile=${outfile}`);
256033
+ if (outdir) flags.push(`--outdir=${outdir}`);
256034
+ if (outbase) flags.push(`--outbase=${outbase}`);
256035
+ if (tsconfig) flags.push(`--tsconfig=${tsconfig}`);
256036
+ if (packages) flags.push(`--packages=${packages}`);
256037
+ if (resolveExtensions) flags.push(`--resolve-extensions=${validateAndJoinStringArray(resolveExtensions, "resolve extension")}`);
256038
+ if (publicPath) flags.push(`--public-path=${publicPath}`);
256039
+ if (entryNames) flags.push(`--entry-names=${entryNames}`);
256040
+ if (chunkNames) flags.push(`--chunk-names=${chunkNames}`);
256041
+ if (assetNames) flags.push(`--asset-names=${assetNames}`);
256042
+ if (mainFields) flags.push(`--main-fields=${validateAndJoinStringArray(mainFields, "main field")}`);
256043
+ if (conditions) flags.push(`--conditions=${validateAndJoinStringArray(conditions, "condition")}`);
256044
+ if (external) for (let name2 of external) flags.push(`--external:${validateStringValue(name2, "external")}`);
256045
+ if (alias) {
256046
+ for (let old in alias) {
256047
+ if (old.indexOf("=") >= 0) throw new Error(`Invalid package name in alias: ${old}`);
256048
+ flags.push(`--alias:${old}=${validateStringValue(alias[old], "alias", old)}`);
256049
+ }
256050
+ }
256051
+ if (banner) {
256052
+ for (let type2 in banner) {
256053
+ if (type2.indexOf("=") >= 0) throw new Error(`Invalid banner file type: ${type2}`);
256054
+ flags.push(`--banner:${type2}=${validateStringValue(banner[type2], "banner", type2)}`);
256055
+ }
256056
+ }
256057
+ if (footer) {
256058
+ for (let type2 in footer) {
256059
+ if (type2.indexOf("=") >= 0) throw new Error(`Invalid footer file type: ${type2}`);
256060
+ flags.push(`--footer:${type2}=${validateStringValue(footer[type2], "footer", type2)}`);
256061
+ }
256062
+ }
256063
+ if (inject) for (let path3 of inject) flags.push(`--inject:${validateStringValue(path3, "inject")}`);
256064
+ if (loader2) {
256065
+ for (let ext in loader2) {
256066
+ if (ext.indexOf("=") >= 0) throw new Error(`Invalid loader extension: ${ext}`);
256067
+ flags.push(`--loader:${ext}=${validateStringValue(loader2[ext], "loader", ext)}`);
256068
+ }
256069
+ }
256070
+ if (outExtension) {
256071
+ for (let ext in outExtension) {
256072
+ if (ext.indexOf("=") >= 0) throw new Error(`Invalid out extension: ${ext}`);
256073
+ flags.push(`--out-extension:${ext}=${validateStringValue(outExtension[ext], "out extension", ext)}`);
256074
+ }
256075
+ }
256076
+ if (entryPoints) {
256077
+ if (Array.isArray(entryPoints)) {
256078
+ for (let i2 = 0, n = entryPoints.length; i2 < n; i2++) {
256079
+ let entryPoint = entryPoints[i2];
256080
+ if (typeof entryPoint === "object" && entryPoint !== null) {
256081
+ let entryPointKeys = /* @__PURE__ */ Object.create(null);
256082
+ let input = getFlag(entryPoint, entryPointKeys, "in", mustBeString);
256083
+ let output = getFlag(entryPoint, entryPointKeys, "out", mustBeString);
256084
+ checkForInvalidFlags(entryPoint, entryPointKeys, "in entry point at index " + i2);
256085
+ if (input === void 0) throw new Error('Missing property "in" for entry point at index ' + i2);
256086
+ if (output === void 0) throw new Error('Missing property "out" for entry point at index ' + i2);
256087
+ entries.push([output, input]);
256088
+ } else {
256089
+ entries.push(["", validateStringValue(entryPoint, "entry point at index " + i2)]);
256090
+ }
256091
+ }
256092
+ } else {
256093
+ for (let key in entryPoints) {
256094
+ entries.push([key, validateStringValue(entryPoints[key], "entry point", key)]);
256095
+ }
256096
+ }
256097
+ }
256098
+ if (stdin) {
256099
+ let stdinKeys = /* @__PURE__ */ Object.create(null);
256100
+ let contents = getFlag(stdin, stdinKeys, "contents", mustBeStringOrUint8Array);
256101
+ let resolveDir = getFlag(stdin, stdinKeys, "resolveDir", mustBeString);
256102
+ let sourcefile = getFlag(stdin, stdinKeys, "sourcefile", mustBeString);
256103
+ let loader22 = getFlag(stdin, stdinKeys, "loader", mustBeString);
256104
+ checkForInvalidFlags(stdin, stdinKeys, 'in "stdin" object');
256105
+ if (sourcefile) flags.push(`--sourcefile=${sourcefile}`);
256106
+ if (loader22) flags.push(`--loader=${loader22}`);
256107
+ if (resolveDir) stdinResolveDir = resolveDir;
256108
+ if (typeof contents === "string") stdinContents = encodeUTF8(contents);
256109
+ else if (contents instanceof Uint8Array) stdinContents = contents;
256110
+ }
256111
+ let nodePaths = [];
256112
+ if (nodePathsInput) {
256113
+ for (let value of nodePathsInput) {
256114
+ value += "";
256115
+ nodePaths.push(value);
256116
+ }
256117
+ }
256118
+ return {
256119
+ entries,
256120
+ flags,
256121
+ write,
256122
+ stdinContents,
256123
+ stdinResolveDir,
256124
+ absWorkingDir,
256125
+ nodePaths,
256126
+ mangleCache: validateMangleCache(mangleCache)
256127
+ };
256128
+ }
256129
+ function flagsForTransformOptions(callName, options, isTTY2, logLevelDefault) {
256130
+ let flags = [];
256131
+ let keys = /* @__PURE__ */ Object.create(null);
256132
+ pushLogFlags(flags, options, keys, isTTY2, logLevelDefault);
256133
+ pushCommonFlags(flags, options, keys);
256134
+ let sourcemap = getFlag(options, keys, "sourcemap", mustBeStringOrBoolean);
256135
+ let sourcefile = getFlag(options, keys, "sourcefile", mustBeString);
256136
+ let loader2 = getFlag(options, keys, "loader", mustBeString);
256137
+ let banner = getFlag(options, keys, "banner", mustBeString);
256138
+ let footer = getFlag(options, keys, "footer", mustBeString);
256139
+ let mangleCache = getFlag(options, keys, "mangleCache", mustBeObject);
256140
+ checkForInvalidFlags(options, keys, `in ${callName}() call`);
256141
+ if (sourcemap) flags.push(`--sourcemap=${sourcemap === true ? "external" : sourcemap}`);
256142
+ if (sourcefile) flags.push(`--sourcefile=${sourcefile}`);
256143
+ if (loader2) flags.push(`--loader=${loader2}`);
256144
+ if (banner) flags.push(`--banner=${banner}`);
256145
+ if (footer) flags.push(`--footer=${footer}`);
256146
+ return {
256147
+ flags,
256148
+ mangleCache: validateMangleCache(mangleCache)
256149
+ };
256150
+ }
256151
+ function createChannel(streamIn) {
256152
+ const requestCallbacksByKey = {};
256153
+ const closeData = { didClose: false, reason: "" };
256154
+ let responseCallbacks = {};
256155
+ let nextRequestID = 0;
256156
+ let nextBuildKey = 0;
256157
+ let stdout = new Uint8Array(16 * 1024);
256158
+ let stdoutUsed = 0;
256159
+ let readFromStdout = (chunk) => {
256160
+ let limit = stdoutUsed + chunk.length;
256161
+ if (limit > stdout.length) {
256162
+ let swap = new Uint8Array(limit * 2);
256163
+ swap.set(stdout);
256164
+ stdout = swap;
256165
+ }
256166
+ stdout.set(chunk, stdoutUsed);
256167
+ stdoutUsed += chunk.length;
256168
+ let offset = 0;
256169
+ while (offset + 4 <= stdoutUsed) {
256170
+ let length = readUInt32LE(stdout, offset);
256171
+ if (offset + 4 + length > stdoutUsed) {
256172
+ break;
256173
+ }
256174
+ offset += 4;
256175
+ handleIncomingPacket(stdout.subarray(offset, offset + length));
256176
+ offset += length;
256177
+ }
256178
+ if (offset > 0) {
256179
+ stdout.copyWithin(0, offset, stdoutUsed);
256180
+ stdoutUsed -= offset;
256181
+ }
256182
+ };
256183
+ let afterClose = (error48) => {
256184
+ closeData.didClose = true;
256185
+ if (error48) closeData.reason = ": " + (error48.message || error48);
256186
+ const text = "The service was stopped" + closeData.reason;
256187
+ for (let id in responseCallbacks) {
256188
+ responseCallbacks[id](text, null);
256189
+ }
256190
+ responseCallbacks = {};
256191
+ };
256192
+ let sendRequest = (refs, value, callback) => {
256193
+ if (closeData.didClose) return callback("The service is no longer running" + closeData.reason, null);
256194
+ let id = nextRequestID++;
256195
+ responseCallbacks[id] = (error48, response) => {
256196
+ try {
256197
+ callback(error48, response);
256198
+ } finally {
256199
+ if (refs) refs.unref();
256200
+ }
256201
+ };
256202
+ if (refs) refs.ref();
256203
+ streamIn.writeToStdin(encodePacket({ id, isRequest: true, value }));
256204
+ };
256205
+ let sendResponse = (id, value) => {
256206
+ if (closeData.didClose) throw new Error("The service is no longer running" + closeData.reason);
256207
+ streamIn.writeToStdin(encodePacket({ id, isRequest: false, value }));
256208
+ };
256209
+ let handleRequest = async (id, request) => {
256210
+ try {
256211
+ if (request.command === "ping") {
256212
+ sendResponse(id, {});
256213
+ return;
256214
+ }
256215
+ if (typeof request.key === "number") {
256216
+ const requestCallbacks = requestCallbacksByKey[request.key];
256217
+ if (!requestCallbacks) {
256218
+ return;
256219
+ }
256220
+ const callback = requestCallbacks[request.command];
256221
+ if (callback) {
256222
+ await callback(id, request);
256223
+ return;
256224
+ }
256225
+ }
256226
+ throw new Error(`Invalid command: ` + request.command);
256227
+ } catch (e2) {
256228
+ const errors = [extractErrorMessageV8(e2, streamIn, null, void 0, "")];
256229
+ try {
256230
+ sendResponse(id, { errors });
256231
+ } catch {
256232
+ }
256233
+ }
256234
+ };
256235
+ let isFirstPacket = true;
256236
+ let handleIncomingPacket = (bytes) => {
256237
+ if (isFirstPacket) {
256238
+ isFirstPacket = false;
256239
+ let binaryVersion = String.fromCharCode(...bytes);
256240
+ if (binaryVersion !== "0.27.4") {
256241
+ throw new Error(`Cannot start service: Host version "${"0.27.4"}" does not match binary version ${quote(binaryVersion)}`);
256242
+ }
256243
+ return;
256244
+ }
256245
+ let packet = decodePacket(bytes);
256246
+ if (packet.isRequest) {
256247
+ handleRequest(packet.id, packet.value);
256248
+ } else {
256249
+ let callback = responseCallbacks[packet.id];
256250
+ delete responseCallbacks[packet.id];
256251
+ if (packet.value.error) callback(packet.value.error, {});
256252
+ else callback(null, packet.value);
256253
+ }
256254
+ };
256255
+ let buildOrContext = ({ callName, refs, options, isTTY: isTTY2, defaultWD: defaultWD2, callback }) => {
256256
+ let refCount = 0;
256257
+ const buildKey = nextBuildKey++;
256258
+ const requestCallbacks = {};
256259
+ const buildRefs = {
256260
+ ref() {
256261
+ if (++refCount === 1) {
256262
+ if (refs) refs.ref();
256263
+ }
256264
+ },
256265
+ unref() {
256266
+ if (--refCount === 0) {
256267
+ delete requestCallbacksByKey[buildKey];
256268
+ if (refs) refs.unref();
256269
+ }
256270
+ }
256271
+ };
256272
+ requestCallbacksByKey[buildKey] = requestCallbacks;
256273
+ buildRefs.ref();
256274
+ buildOrContextImpl(
256275
+ callName,
256276
+ buildKey,
256277
+ sendRequest,
256278
+ sendResponse,
256279
+ buildRefs,
256280
+ streamIn,
256281
+ requestCallbacks,
256282
+ options,
256283
+ isTTY2,
256284
+ defaultWD2,
256285
+ (err, res) => {
256286
+ try {
256287
+ callback(err, res);
256288
+ } finally {
256289
+ buildRefs.unref();
256290
+ }
256291
+ }
256292
+ );
256293
+ };
256294
+ let transform22 = ({ callName, refs, input, options, isTTY: isTTY2, fs: fs3, callback }) => {
256295
+ const details = createObjectStash();
256296
+ let start2 = (inputPath) => {
256297
+ try {
256298
+ if (typeof input !== "string" && !(input instanceof Uint8Array))
256299
+ throw new Error('The input to "transform" must be a string or a Uint8Array');
256300
+ let {
256301
+ flags,
256302
+ mangleCache
256303
+ } = flagsForTransformOptions(callName, options, isTTY2, transformLogLevelDefault);
256304
+ let request = {
256305
+ command: "transform",
256306
+ flags,
256307
+ inputFS: inputPath !== null,
256308
+ input: inputPath !== null ? encodeUTF8(inputPath) : typeof input === "string" ? encodeUTF8(input) : input
256309
+ };
256310
+ if (mangleCache) request.mangleCache = mangleCache;
256311
+ sendRequest(refs, request, (error48, response) => {
256312
+ if (error48) return callback(new Error(error48), null);
256313
+ let errors = replaceDetailsInMessages(response.errors, details);
256314
+ let warnings = replaceDetailsInMessages(response.warnings, details);
256315
+ let outstanding = 1;
256316
+ let next = () => {
256317
+ if (--outstanding === 0) {
256318
+ let result = {
256319
+ warnings,
256320
+ code: response.code,
256321
+ map: response.map,
256322
+ mangleCache: void 0,
256323
+ legalComments: void 0
256324
+ };
256325
+ if ("legalComments" in response) result.legalComments = response == null ? void 0 : response.legalComments;
256326
+ if (response.mangleCache) result.mangleCache = response == null ? void 0 : response.mangleCache;
256327
+ callback(null, result);
256328
+ }
256329
+ };
256330
+ if (errors.length > 0) return callback(failureErrorWithLog("Transform failed", errors, warnings), null);
256331
+ if (response.codeFS) {
256332
+ outstanding++;
256333
+ fs3.readFile(response.code, (err, contents) => {
256334
+ if (err !== null) {
256335
+ callback(err, null);
256336
+ } else {
256337
+ response.code = contents;
256338
+ next();
256339
+ }
256340
+ });
256341
+ }
256342
+ if (response.mapFS) {
256343
+ outstanding++;
256344
+ fs3.readFile(response.map, (err, contents) => {
256345
+ if (err !== null) {
256346
+ callback(err, null);
256347
+ } else {
256348
+ response.map = contents;
256349
+ next();
256350
+ }
256351
+ });
256352
+ }
256353
+ next();
256354
+ });
256355
+ } catch (e2) {
256356
+ let flags = [];
256357
+ try {
256358
+ pushLogFlags(flags, options, {}, isTTY2, transformLogLevelDefault);
256359
+ } catch {
256360
+ }
256361
+ const error48 = extractErrorMessageV8(e2, streamIn, details, void 0, "");
256362
+ sendRequest(refs, { command: "error", flags, error: error48 }, () => {
256363
+ error48.detail = details.load(error48.detail);
256364
+ callback(failureErrorWithLog("Transform failed", [error48], []), null);
256365
+ });
256366
+ }
256367
+ };
256368
+ if ((typeof input === "string" || input instanceof Uint8Array) && input.length > 1024 * 1024) {
256369
+ let next = start2;
256370
+ start2 = () => fs3.writeFile(input, next);
256371
+ }
256372
+ start2(null);
256373
+ };
256374
+ let formatMessages2 = ({ callName, refs, messages, options, callback }) => {
256375
+ if (!options) throw new Error(`Missing second argument in ${callName}() call`);
256376
+ let keys = {};
256377
+ let kind = getFlag(options, keys, "kind", mustBeString);
256378
+ let color = getFlag(options, keys, "color", mustBeBoolean);
256379
+ let terminalWidth = getFlag(options, keys, "terminalWidth", mustBeInteger);
256380
+ checkForInvalidFlags(options, keys, `in ${callName}() call`);
256381
+ if (kind === void 0) throw new Error(`Missing "kind" in ${callName}() call`);
256382
+ if (kind !== "error" && kind !== "warning") throw new Error(`Expected "kind" to be "error" or "warning" in ${callName}() call`);
256383
+ let request = {
256384
+ command: "format-msgs",
256385
+ messages: sanitizeMessages(messages, "messages", null, "", terminalWidth),
256386
+ isWarning: kind === "warning"
256387
+ };
256388
+ if (color !== void 0) request.color = color;
256389
+ if (terminalWidth !== void 0) request.terminalWidth = terminalWidth;
256390
+ sendRequest(refs, request, (error48, response) => {
256391
+ if (error48) return callback(new Error(error48), null);
256392
+ callback(null, response.messages);
256393
+ });
256394
+ };
256395
+ let analyzeMetafile2 = ({ callName, refs, metafile, options, callback }) => {
256396
+ if (options === void 0) options = {};
256397
+ let keys = {};
256398
+ let color = getFlag(options, keys, "color", mustBeBoolean);
256399
+ let verbose = getFlag(options, keys, "verbose", mustBeBoolean);
256400
+ checkForInvalidFlags(options, keys, `in ${callName}() call`);
256401
+ let request = {
256402
+ command: "analyze-metafile",
256403
+ metafile
256404
+ };
256405
+ if (color !== void 0) request.color = color;
256406
+ if (verbose !== void 0) request.verbose = verbose;
256407
+ sendRequest(refs, request, (error48, response) => {
256408
+ if (error48) return callback(new Error(error48), null);
256409
+ callback(null, response.result);
256410
+ });
256411
+ };
256412
+ return {
256413
+ readFromStdout,
256414
+ afterClose,
256415
+ service: {
256416
+ buildOrContext,
256417
+ transform: transform22,
256418
+ formatMessages: formatMessages2,
256419
+ analyzeMetafile: analyzeMetafile2
256420
+ }
256421
+ };
256422
+ }
256423
+ function buildOrContextImpl(callName, buildKey, sendRequest, sendResponse, refs, streamIn, requestCallbacks, options, isTTY2, defaultWD2, callback) {
256424
+ const details = createObjectStash();
256425
+ const isContext = callName === "context";
256426
+ const handleError = (e2, pluginName) => {
256427
+ const flags = [];
256428
+ try {
256429
+ pushLogFlags(flags, options, {}, isTTY2, buildLogLevelDefault);
256430
+ } catch {
256431
+ }
256432
+ const message = extractErrorMessageV8(e2, streamIn, details, void 0, pluginName);
256433
+ sendRequest(refs, { command: "error", flags, error: message }, () => {
256434
+ message.detail = details.load(message.detail);
256435
+ callback(failureErrorWithLog(isContext ? "Context failed" : "Build failed", [message], []), null);
256436
+ });
256437
+ };
256438
+ let plugins;
256439
+ if (typeof options === "object") {
256440
+ const value = options.plugins;
256441
+ if (value !== void 0) {
256442
+ if (!Array.isArray(value)) return handleError(new Error(`"plugins" must be an array`), "");
256443
+ plugins = value;
256444
+ }
256445
+ }
256446
+ if (plugins && plugins.length > 0) {
256447
+ if (streamIn.isSync) return handleError(new Error("Cannot use plugins in synchronous API calls"), "");
256448
+ handlePlugins(
256449
+ buildKey,
256450
+ sendRequest,
256451
+ sendResponse,
256452
+ refs,
256453
+ streamIn,
256454
+ requestCallbacks,
256455
+ options,
256456
+ plugins,
256457
+ details
256458
+ ).then(
256459
+ (result) => {
256460
+ if (!result.ok) return handleError(result.error, result.pluginName);
256461
+ try {
256462
+ buildOrContextContinue(result.requestPlugins, result.runOnEndCallbacks, result.scheduleOnDisposeCallbacks);
256463
+ } catch (e2) {
256464
+ handleError(e2, "");
256465
+ }
256466
+ },
256467
+ (e2) => handleError(e2, "")
256468
+ );
256469
+ return;
256470
+ }
256471
+ try {
256472
+ buildOrContextContinue(null, (result, done) => done([], []), () => {
256473
+ });
256474
+ } catch (e2) {
256475
+ handleError(e2, "");
256476
+ }
256477
+ function buildOrContextContinue(requestPlugins, runOnEndCallbacks, scheduleOnDisposeCallbacks) {
256478
+ const writeDefault = streamIn.hasFS;
256479
+ const {
256480
+ entries,
256481
+ flags,
256482
+ write,
256483
+ stdinContents,
256484
+ stdinResolveDir,
256485
+ absWorkingDir,
256486
+ nodePaths,
256487
+ mangleCache
256488
+ } = flagsForBuildOptions(callName, options, isTTY2, buildLogLevelDefault, writeDefault);
256489
+ if (write && !streamIn.hasFS) throw new Error(`The "write" option is unavailable in this environment`);
256490
+ const request = {
256491
+ command: "build",
256492
+ key: buildKey,
256493
+ entries,
256494
+ flags,
256495
+ write,
256496
+ stdinContents,
256497
+ stdinResolveDir,
256498
+ absWorkingDir: absWorkingDir || defaultWD2,
256499
+ nodePaths,
256500
+ context: isContext
256501
+ };
256502
+ if (requestPlugins) request.plugins = requestPlugins;
256503
+ if (mangleCache) request.mangleCache = mangleCache;
256504
+ const buildResponseToResult = (response, callback2) => {
256505
+ const result = {
256506
+ errors: replaceDetailsInMessages(response.errors, details),
256507
+ warnings: replaceDetailsInMessages(response.warnings, details),
256508
+ outputFiles: void 0,
256509
+ metafile: void 0,
256510
+ mangleCache: void 0
256511
+ };
256512
+ const originalErrors = result.errors.slice();
256513
+ const originalWarnings = result.warnings.slice();
256514
+ if (response.outputFiles) result.outputFiles = response.outputFiles.map(convertOutputFiles);
256515
+ if (response.metafile) result.metafile = parseJSON(response.metafile);
256516
+ if (response.mangleCache) result.mangleCache = response.mangleCache;
256517
+ if (response.writeToStdout !== void 0) console.log(decodeUTF8(response.writeToStdout).replace(/\n$/, ""));
256518
+ runOnEndCallbacks(result, (onEndErrors, onEndWarnings) => {
256519
+ if (originalErrors.length > 0 || onEndErrors.length > 0) {
256520
+ const error48 = failureErrorWithLog("Build failed", originalErrors.concat(onEndErrors), originalWarnings.concat(onEndWarnings));
256521
+ return callback2(error48, null, onEndErrors, onEndWarnings);
256522
+ }
256523
+ callback2(null, result, onEndErrors, onEndWarnings);
256524
+ });
256525
+ };
256526
+ let latestResultPromise;
256527
+ let provideLatestResult;
256528
+ if (isContext)
256529
+ requestCallbacks["on-end"] = (id, request2) => new Promise((resolve) => {
256530
+ buildResponseToResult(request2, (err, result, onEndErrors, onEndWarnings) => {
256531
+ const response = {
256532
+ errors: onEndErrors,
256533
+ warnings: onEndWarnings
256534
+ };
256535
+ if (provideLatestResult) provideLatestResult(err, result);
256536
+ latestResultPromise = void 0;
256537
+ provideLatestResult = void 0;
256538
+ sendResponse(id, response);
256539
+ resolve();
256540
+ });
256541
+ });
256542
+ sendRequest(refs, request, (error48, response) => {
256543
+ if (error48) return callback(new Error(error48), null);
256544
+ if (!isContext) {
256545
+ return buildResponseToResult(response, (err, res) => {
256546
+ scheduleOnDisposeCallbacks();
256547
+ return callback(err, res);
256548
+ });
256549
+ }
256550
+ if (response.errors.length > 0) {
256551
+ return callback(failureErrorWithLog("Context failed", response.errors, response.warnings), null);
256552
+ }
256553
+ let didDispose = false;
256554
+ const result = {
256555
+ rebuild: () => {
256556
+ if (!latestResultPromise) latestResultPromise = new Promise((resolve, reject) => {
256557
+ let settlePromise;
256558
+ provideLatestResult = (err, result2) => {
256559
+ if (!settlePromise) settlePromise = () => err ? reject(err) : resolve(result2);
256560
+ };
256561
+ const triggerAnotherBuild = () => {
256562
+ const request2 = {
256563
+ command: "rebuild",
256564
+ key: buildKey
256565
+ };
256566
+ sendRequest(refs, request2, (error210, response2) => {
256567
+ if (error210) {
256568
+ reject(new Error(error210));
256569
+ } else if (settlePromise) {
256570
+ settlePromise();
256571
+ } else {
256572
+ triggerAnotherBuild();
256573
+ }
256574
+ });
256575
+ };
256576
+ triggerAnotherBuild();
256577
+ });
256578
+ return latestResultPromise;
256579
+ },
256580
+ watch: (options2 = {}) => new Promise((resolve, reject) => {
256581
+ if (!streamIn.hasFS) throw new Error(`Cannot use the "watch" API in this environment`);
256582
+ const keys = {};
256583
+ const delay = getFlag(options2, keys, "delay", mustBeInteger);
256584
+ checkForInvalidFlags(options2, keys, `in watch() call`);
256585
+ const request2 = {
256586
+ command: "watch",
256587
+ key: buildKey
256588
+ };
256589
+ if (delay) request2.delay = delay;
256590
+ sendRequest(refs, request2, (error210) => {
256591
+ if (error210) reject(new Error(error210));
256592
+ else resolve(void 0);
256593
+ });
256594
+ }),
256595
+ serve: (options2 = {}) => new Promise((resolve, reject) => {
256596
+ if (!streamIn.hasFS) throw new Error(`Cannot use the "serve" API in this environment`);
256597
+ const keys = {};
256598
+ const port = getFlag(options2, keys, "port", mustBeValidPortNumber);
256599
+ const host = getFlag(options2, keys, "host", mustBeString);
256600
+ const servedir = getFlag(options2, keys, "servedir", mustBeString);
256601
+ const keyfile = getFlag(options2, keys, "keyfile", mustBeString);
256602
+ const certfile = getFlag(options2, keys, "certfile", mustBeString);
256603
+ const fallback = getFlag(options2, keys, "fallback", mustBeString);
256604
+ const cors = getFlag(options2, keys, "cors", mustBeObject);
256605
+ const onRequest = getFlag(options2, keys, "onRequest", mustBeFunction);
256606
+ checkForInvalidFlags(options2, keys, `in serve() call`);
256607
+ const request2 = {
256608
+ command: "serve",
256609
+ key: buildKey,
256610
+ onRequest: !!onRequest
256611
+ };
256612
+ if (port !== void 0) request2.port = port;
256613
+ if (host !== void 0) request2.host = host;
256614
+ if (servedir !== void 0) request2.servedir = servedir;
256615
+ if (keyfile !== void 0) request2.keyfile = keyfile;
256616
+ if (certfile !== void 0) request2.certfile = certfile;
256617
+ if (fallback !== void 0) request2.fallback = fallback;
256618
+ if (cors) {
256619
+ const corsKeys = {};
256620
+ const origin = getFlag(cors, corsKeys, "origin", mustBeStringOrArrayOfStrings);
256621
+ checkForInvalidFlags(cors, corsKeys, `on "cors" object`);
256622
+ if (Array.isArray(origin)) request2.corsOrigin = origin;
256623
+ else if (origin !== void 0) request2.corsOrigin = [origin];
256624
+ }
256625
+ sendRequest(refs, request2, (error210, response2) => {
256626
+ if (error210) return reject(new Error(error210));
256627
+ if (onRequest) {
256628
+ requestCallbacks["serve-request"] = (id, request3) => {
256629
+ onRequest(request3.args);
256630
+ sendResponse(id, {});
256631
+ };
256632
+ }
256633
+ resolve(response2);
256634
+ });
256635
+ }),
256636
+ cancel: () => new Promise((resolve) => {
256637
+ if (didDispose) return resolve();
256638
+ const request2 = {
256639
+ command: "cancel",
256640
+ key: buildKey
256641
+ };
256642
+ sendRequest(refs, request2, () => {
256643
+ resolve();
256644
+ });
256645
+ }),
256646
+ dispose: () => new Promise((resolve) => {
256647
+ if (didDispose) return resolve();
256648
+ didDispose = true;
256649
+ const request2 = {
256650
+ command: "dispose",
256651
+ key: buildKey
256652
+ };
256653
+ sendRequest(refs, request2, () => {
256654
+ resolve();
256655
+ scheduleOnDisposeCallbacks();
256656
+ refs.unref();
256657
+ });
256658
+ })
256659
+ };
256660
+ refs.ref();
256661
+ callback(null, result);
256662
+ });
256663
+ }
256664
+ }
256665
+ var handlePlugins = async (buildKey, sendRequest, sendResponse, refs, streamIn, requestCallbacks, initialOptions, plugins, details) => {
256666
+ let onStartCallbacks = [];
256667
+ let onEndCallbacks = [];
256668
+ let onResolveCallbacks = {};
256669
+ let onLoadCallbacks = {};
256670
+ let onDisposeCallbacks = [];
256671
+ let nextCallbackID = 0;
256672
+ let i2 = 0;
256673
+ let requestPlugins = [];
256674
+ let isSetupDone = false;
256675
+ plugins = [...plugins];
256676
+ for (let item of plugins) {
256677
+ let keys = {};
256678
+ if (typeof item !== "object") throw new Error(`Plugin at index ${i2} must be an object`);
256679
+ const name2 = getFlag(item, keys, "name", mustBeString);
256680
+ if (typeof name2 !== "string" || name2 === "") throw new Error(`Plugin at index ${i2} is missing a name`);
256681
+ try {
256682
+ let setup = getFlag(item, keys, "setup", mustBeFunction);
256683
+ if (typeof setup !== "function") throw new Error(`Plugin is missing a setup function`);
256684
+ checkForInvalidFlags(item, keys, `on plugin ${quote(name2)}`);
256685
+ let plugin = {
256686
+ name: name2,
256687
+ onStart: false,
256688
+ onEnd: false,
256689
+ onResolve: [],
256690
+ onLoad: []
256691
+ };
256692
+ i2++;
256693
+ let resolve = (path3, options = {}) => {
256694
+ if (!isSetupDone) throw new Error('Cannot call "resolve" before plugin setup has completed');
256695
+ if (typeof path3 !== "string") throw new Error(`The path to resolve must be a string`);
256696
+ let keys2 = /* @__PURE__ */ Object.create(null);
256697
+ let pluginName = getFlag(options, keys2, "pluginName", mustBeString);
256698
+ let importer = getFlag(options, keys2, "importer", mustBeString);
256699
+ let namespace = getFlag(options, keys2, "namespace", mustBeString);
256700
+ let resolveDir = getFlag(options, keys2, "resolveDir", mustBeString);
256701
+ let kind = getFlag(options, keys2, "kind", mustBeString);
256702
+ let pluginData = getFlag(options, keys2, "pluginData", canBeAnything);
256703
+ let importAttributes = getFlag(options, keys2, "with", mustBeObject);
256704
+ checkForInvalidFlags(options, keys2, "in resolve() call");
256705
+ return new Promise((resolve2, reject) => {
256706
+ const request = {
256707
+ command: "resolve",
256708
+ path: path3,
256709
+ key: buildKey,
256710
+ pluginName: name2
256711
+ };
256712
+ if (pluginName != null) request.pluginName = pluginName;
256713
+ if (importer != null) request.importer = importer;
256714
+ if (namespace != null) request.namespace = namespace;
256715
+ if (resolveDir != null) request.resolveDir = resolveDir;
256716
+ if (kind != null) request.kind = kind;
256717
+ else throw new Error(`Must specify "kind" when calling "resolve"`);
256718
+ if (pluginData != null) request.pluginData = details.store(pluginData);
256719
+ if (importAttributes != null) request.with = sanitizeStringMap(importAttributes, "with");
256720
+ sendRequest(refs, request, (error48, response) => {
256721
+ if (error48 !== null) reject(new Error(error48));
256722
+ else resolve2({
256723
+ errors: replaceDetailsInMessages(response.errors, details),
256724
+ warnings: replaceDetailsInMessages(response.warnings, details),
256725
+ path: response.path,
256726
+ external: response.external,
256727
+ sideEffects: response.sideEffects,
256728
+ namespace: response.namespace,
256729
+ suffix: response.suffix,
256730
+ pluginData: details.load(response.pluginData)
256731
+ });
256732
+ });
256733
+ });
256734
+ };
256735
+ let promise2 = setup({
256736
+ initialOptions,
256737
+ resolve,
256738
+ onStart(callback) {
256739
+ let registeredText = `This error came from the "onStart" callback registered here:`;
256740
+ let registeredNote = extractCallerV8(new Error(registeredText), streamIn, "onStart");
256741
+ onStartCallbacks.push({ name: name2, callback, note: registeredNote });
256742
+ plugin.onStart = true;
256743
+ },
256744
+ onEnd(callback) {
256745
+ let registeredText = `This error came from the "onEnd" callback registered here:`;
256746
+ let registeredNote = extractCallerV8(new Error(registeredText), streamIn, "onEnd");
256747
+ onEndCallbacks.push({ name: name2, callback, note: registeredNote });
256748
+ plugin.onEnd = true;
256749
+ },
256750
+ onResolve(options, callback) {
256751
+ let registeredText = `This error came from the "onResolve" callback registered here:`;
256752
+ let registeredNote = extractCallerV8(new Error(registeredText), streamIn, "onResolve");
256753
+ let keys2 = {};
256754
+ let filter3 = getFlag(options, keys2, "filter", mustBeRegExp);
256755
+ let namespace = getFlag(options, keys2, "namespace", mustBeString);
256756
+ checkForInvalidFlags(options, keys2, `in onResolve() call for plugin ${quote(name2)}`);
256757
+ if (filter3 == null) throw new Error(`onResolve() call is missing a filter`);
256758
+ let id = nextCallbackID++;
256759
+ onResolveCallbacks[id] = { name: name2, callback, note: registeredNote };
256760
+ plugin.onResolve.push({ id, filter: jsRegExpToGoRegExp(filter3), namespace: namespace || "" });
256761
+ },
256762
+ onLoad(options, callback) {
256763
+ let registeredText = `This error came from the "onLoad" callback registered here:`;
256764
+ let registeredNote = extractCallerV8(new Error(registeredText), streamIn, "onLoad");
256765
+ let keys2 = {};
256766
+ let filter3 = getFlag(options, keys2, "filter", mustBeRegExp);
256767
+ let namespace = getFlag(options, keys2, "namespace", mustBeString);
256768
+ checkForInvalidFlags(options, keys2, `in onLoad() call for plugin ${quote(name2)}`);
256769
+ if (filter3 == null) throw new Error(`onLoad() call is missing a filter`);
256770
+ let id = nextCallbackID++;
256771
+ onLoadCallbacks[id] = { name: name2, callback, note: registeredNote };
256772
+ plugin.onLoad.push({ id, filter: jsRegExpToGoRegExp(filter3), namespace: namespace || "" });
256773
+ },
256774
+ onDispose(callback) {
256775
+ onDisposeCallbacks.push(callback);
256776
+ },
256777
+ esbuild: streamIn.esbuild
256778
+ });
256779
+ if (promise2) await promise2;
256780
+ requestPlugins.push(plugin);
256781
+ } catch (e2) {
256782
+ return { ok: false, error: e2, pluginName: name2 };
256783
+ }
256784
+ }
256785
+ requestCallbacks["on-start"] = async (id, request) => {
256786
+ details.clear();
256787
+ let response = { errors: [], warnings: [] };
256788
+ await Promise.all(onStartCallbacks.map(async ({ name: name2, callback, note }) => {
256789
+ try {
256790
+ let result = await callback();
256791
+ if (result != null) {
256792
+ if (typeof result !== "object") throw new Error(`Expected onStart() callback in plugin ${quote(name2)} to return an object`);
256793
+ let keys = {};
256794
+ let errors = getFlag(result, keys, "errors", mustBeArray);
256795
+ let warnings = getFlag(result, keys, "warnings", mustBeArray);
256796
+ checkForInvalidFlags(result, keys, `from onStart() callback in plugin ${quote(name2)}`);
256797
+ if (errors != null) response.errors.push(...sanitizeMessages(errors, "errors", details, name2, void 0));
256798
+ if (warnings != null) response.warnings.push(...sanitizeMessages(warnings, "warnings", details, name2, void 0));
256799
+ }
256800
+ } catch (e2) {
256801
+ response.errors.push(extractErrorMessageV8(e2, streamIn, details, note && note(), name2));
256802
+ }
256803
+ }));
256804
+ sendResponse(id, response);
256805
+ };
256806
+ requestCallbacks["on-resolve"] = async (id, request) => {
256807
+ let response = {}, name2 = "", callback, note;
256808
+ for (let id2 of request.ids) {
256809
+ try {
256810
+ ({ name: name2, callback, note } = onResolveCallbacks[id2]);
256811
+ let result = await callback({
256812
+ path: request.path,
256813
+ importer: request.importer,
256814
+ namespace: request.namespace,
256815
+ resolveDir: request.resolveDir,
256816
+ kind: request.kind,
256817
+ pluginData: details.load(request.pluginData),
256818
+ with: request.with
256819
+ });
256820
+ if (result != null) {
256821
+ if (typeof result !== "object") throw new Error(`Expected onResolve() callback in plugin ${quote(name2)} to return an object`);
256822
+ let keys = {};
256823
+ let pluginName = getFlag(result, keys, "pluginName", mustBeString);
256824
+ let path3 = getFlag(result, keys, "path", mustBeString);
256825
+ let namespace = getFlag(result, keys, "namespace", mustBeString);
256826
+ let suffix = getFlag(result, keys, "suffix", mustBeString);
256827
+ let external = getFlag(result, keys, "external", mustBeBoolean);
256828
+ let sideEffects = getFlag(result, keys, "sideEffects", mustBeBoolean);
256829
+ let pluginData = getFlag(result, keys, "pluginData", canBeAnything);
256830
+ let errors = getFlag(result, keys, "errors", mustBeArray);
256831
+ let warnings = getFlag(result, keys, "warnings", mustBeArray);
256832
+ let watchFiles = getFlag(result, keys, "watchFiles", mustBeArrayOfStrings);
256833
+ let watchDirs = getFlag(result, keys, "watchDirs", mustBeArrayOfStrings);
256834
+ checkForInvalidFlags(result, keys, `from onResolve() callback in plugin ${quote(name2)}`);
256835
+ response.id = id2;
256836
+ if (pluginName != null) response.pluginName = pluginName;
256837
+ if (path3 != null) response.path = path3;
256838
+ if (namespace != null) response.namespace = namespace;
256839
+ if (suffix != null) response.suffix = suffix;
256840
+ if (external != null) response.external = external;
256841
+ if (sideEffects != null) response.sideEffects = sideEffects;
256842
+ if (pluginData != null) response.pluginData = details.store(pluginData);
256843
+ if (errors != null) response.errors = sanitizeMessages(errors, "errors", details, name2, void 0);
256844
+ if (warnings != null) response.warnings = sanitizeMessages(warnings, "warnings", details, name2, void 0);
256845
+ if (watchFiles != null) response.watchFiles = sanitizeStringArray(watchFiles, "watchFiles");
256846
+ if (watchDirs != null) response.watchDirs = sanitizeStringArray(watchDirs, "watchDirs");
256847
+ break;
256848
+ }
256849
+ } catch (e2) {
256850
+ response = { id: id2, errors: [extractErrorMessageV8(e2, streamIn, details, note && note(), name2)] };
256851
+ break;
256852
+ }
256853
+ }
256854
+ sendResponse(id, response);
256855
+ };
256856
+ requestCallbacks["on-load"] = async (id, request) => {
256857
+ let response = {}, name2 = "", callback, note;
256858
+ for (let id2 of request.ids) {
256859
+ try {
256860
+ ({ name: name2, callback, note } = onLoadCallbacks[id2]);
256861
+ let result = await callback({
256862
+ path: request.path,
256863
+ namespace: request.namespace,
256864
+ suffix: request.suffix,
256865
+ pluginData: details.load(request.pluginData),
256866
+ with: request.with
256867
+ });
256868
+ if (result != null) {
256869
+ if (typeof result !== "object") throw new Error(`Expected onLoad() callback in plugin ${quote(name2)} to return an object`);
256870
+ let keys = {};
256871
+ let pluginName = getFlag(result, keys, "pluginName", mustBeString);
256872
+ let contents = getFlag(result, keys, "contents", mustBeStringOrUint8Array);
256873
+ let resolveDir = getFlag(result, keys, "resolveDir", mustBeString);
256874
+ let pluginData = getFlag(result, keys, "pluginData", canBeAnything);
256875
+ let loader2 = getFlag(result, keys, "loader", mustBeString);
256876
+ let errors = getFlag(result, keys, "errors", mustBeArray);
256877
+ let warnings = getFlag(result, keys, "warnings", mustBeArray);
256878
+ let watchFiles = getFlag(result, keys, "watchFiles", mustBeArrayOfStrings);
256879
+ let watchDirs = getFlag(result, keys, "watchDirs", mustBeArrayOfStrings);
256880
+ checkForInvalidFlags(result, keys, `from onLoad() callback in plugin ${quote(name2)}`);
256881
+ response.id = id2;
256882
+ if (pluginName != null) response.pluginName = pluginName;
256883
+ if (contents instanceof Uint8Array) response.contents = contents;
256884
+ else if (contents != null) response.contents = encodeUTF8(contents);
256885
+ if (resolveDir != null) response.resolveDir = resolveDir;
256886
+ if (pluginData != null) response.pluginData = details.store(pluginData);
256887
+ if (loader2 != null) response.loader = loader2;
256888
+ if (errors != null) response.errors = sanitizeMessages(errors, "errors", details, name2, void 0);
256889
+ if (warnings != null) response.warnings = sanitizeMessages(warnings, "warnings", details, name2, void 0);
256890
+ if (watchFiles != null) response.watchFiles = sanitizeStringArray(watchFiles, "watchFiles");
256891
+ if (watchDirs != null) response.watchDirs = sanitizeStringArray(watchDirs, "watchDirs");
256892
+ break;
256893
+ }
256894
+ } catch (e2) {
256895
+ response = { id: id2, errors: [extractErrorMessageV8(e2, streamIn, details, note && note(), name2)] };
256896
+ break;
256897
+ }
256898
+ }
256899
+ sendResponse(id, response);
256900
+ };
256901
+ let runOnEndCallbacks = (result, done) => done([], []);
256902
+ if (onEndCallbacks.length > 0) {
256903
+ runOnEndCallbacks = (result, done) => {
256904
+ (async () => {
256905
+ const onEndErrors = [];
256906
+ const onEndWarnings = [];
256907
+ for (const { name: name2, callback, note } of onEndCallbacks) {
256908
+ let newErrors;
256909
+ let newWarnings;
256910
+ try {
256911
+ const value = await callback(result);
256912
+ if (value != null) {
256913
+ if (typeof value !== "object") throw new Error(`Expected onEnd() callback in plugin ${quote(name2)} to return an object`);
256914
+ let keys = {};
256915
+ let errors = getFlag(value, keys, "errors", mustBeArray);
256916
+ let warnings = getFlag(value, keys, "warnings", mustBeArray);
256917
+ checkForInvalidFlags(value, keys, `from onEnd() callback in plugin ${quote(name2)}`);
256918
+ if (errors != null) newErrors = sanitizeMessages(errors, "errors", details, name2, void 0);
256919
+ if (warnings != null) newWarnings = sanitizeMessages(warnings, "warnings", details, name2, void 0);
256920
+ }
256921
+ } catch (e2) {
256922
+ newErrors = [extractErrorMessageV8(e2, streamIn, details, note && note(), name2)];
256923
+ }
256924
+ if (newErrors) {
256925
+ onEndErrors.push(...newErrors);
256926
+ try {
256927
+ result.errors.push(...newErrors);
256928
+ } catch {
256929
+ }
256930
+ }
256931
+ if (newWarnings) {
256932
+ onEndWarnings.push(...newWarnings);
256933
+ try {
256934
+ result.warnings.push(...newWarnings);
256935
+ } catch {
256936
+ }
256937
+ }
256938
+ }
256939
+ done(onEndErrors, onEndWarnings);
256940
+ })();
256941
+ };
256942
+ }
256943
+ let scheduleOnDisposeCallbacks = () => {
256944
+ for (const cb of onDisposeCallbacks) {
256945
+ setTimeout(() => cb(), 0);
256946
+ }
256947
+ };
256948
+ isSetupDone = true;
256949
+ return {
256950
+ ok: true,
256951
+ requestPlugins,
256952
+ runOnEndCallbacks,
256953
+ scheduleOnDisposeCallbacks
256954
+ };
256955
+ };
256956
+ function createObjectStash() {
256957
+ const map21 = /* @__PURE__ */ new Map();
256958
+ let nextID = 0;
256959
+ return {
256960
+ clear() {
256961
+ map21.clear();
256962
+ },
256963
+ load(id) {
256964
+ return map21.get(id);
256965
+ },
256966
+ store(value) {
256967
+ if (value === void 0) return -1;
256968
+ const id = nextID++;
256969
+ map21.set(id, value);
256970
+ return id;
256971
+ }
256972
+ };
256973
+ }
256974
+ function extractCallerV8(e2, streamIn, ident) {
256975
+ let note;
256976
+ let tried = false;
256977
+ return () => {
256978
+ if (tried) return note;
256979
+ tried = true;
256980
+ try {
256981
+ let lines = (e2.stack + "").split("\n");
256982
+ lines.splice(1, 1);
256983
+ let location = parseStackLinesV8(streamIn, lines, ident);
256984
+ if (location) {
256985
+ note = { text: e2.message, location };
256986
+ return note;
256987
+ }
256988
+ } catch {
256989
+ }
256990
+ };
256991
+ }
256992
+ function extractErrorMessageV8(e2, streamIn, stash, note, pluginName) {
256993
+ let text = "Internal error";
256994
+ let location = null;
256995
+ try {
256996
+ text = (e2 && e2.message || e2) + "";
256997
+ } catch {
256998
+ }
256999
+ try {
257000
+ location = parseStackLinesV8(streamIn, (e2.stack + "").split("\n"), "");
257001
+ } catch {
257002
+ }
257003
+ return { id: "", pluginName, text, location, notes: note ? [note] : [], detail: stash ? stash.store(e2) : -1 };
257004
+ }
257005
+ function parseStackLinesV8(streamIn, lines, ident) {
257006
+ let at = " at ";
257007
+ if (streamIn.readFileSync && !lines[0].startsWith(at) && lines[1].startsWith(at)) {
257008
+ for (let i2 = 1; i2 < lines.length; i2++) {
257009
+ let line = lines[i2];
257010
+ if (!line.startsWith(at)) continue;
257011
+ line = line.slice(at.length);
257012
+ while (true) {
257013
+ let match = /^(?:new |async )?\S+ \((.*)\)$/.exec(line);
257014
+ if (match) {
257015
+ line = match[1];
257016
+ continue;
257017
+ }
257018
+ match = /^eval at \S+ \((.*)\)(?:, \S+:\d+:\d+)?$/.exec(line);
257019
+ if (match) {
257020
+ line = match[1];
257021
+ continue;
257022
+ }
257023
+ match = /^(\S+):(\d+):(\d+)$/.exec(line);
257024
+ if (match) {
257025
+ let contents;
257026
+ try {
257027
+ contents = streamIn.readFileSync(match[1], "utf8");
257028
+ } catch {
257029
+ break;
257030
+ }
257031
+ let lineText = contents.split(/\r\n|\r|\n|\u2028|\u2029/)[+match[2] - 1] || "";
257032
+ let column = +match[3] - 1;
257033
+ let length = lineText.slice(column, column + ident.length) === ident ? ident.length : 0;
257034
+ return {
257035
+ file: match[1],
257036
+ namespace: "file",
257037
+ line: +match[2],
257038
+ column: encodeUTF8(lineText.slice(0, column)).length,
257039
+ length: encodeUTF8(lineText.slice(column, column + length)).length,
257040
+ lineText: lineText + "\n" + lines.slice(1).join("\n"),
257041
+ suggestion: ""
257042
+ };
257043
+ }
257044
+ break;
257045
+ }
257046
+ }
257047
+ }
257048
+ return null;
257049
+ }
257050
+ function failureErrorWithLog(text, errors, warnings) {
257051
+ let limit = 5;
257052
+ text += errors.length < 1 ? "" : ` with ${errors.length} error${errors.length < 2 ? "" : "s"}:` + errors.slice(0, limit + 1).map((e2, i2) => {
257053
+ if (i2 === limit) return "\n...";
257054
+ if (!e2.location) return `
257055
+ error: ${e2.text}`;
257056
+ let { file: file2, line, column } = e2.location;
257057
+ let pluginText = e2.pluginName ? `[plugin: ${e2.pluginName}] ` : "";
257058
+ return `
257059
+ ${file2}:${line}:${column}: ERROR: ${pluginText}${e2.text}`;
257060
+ }).join("");
257061
+ let error48 = new Error(text);
257062
+ for (const [key, value] of [["errors", errors], ["warnings", warnings]]) {
257063
+ Object.defineProperty(error48, key, {
257064
+ configurable: true,
257065
+ enumerable: true,
257066
+ get: () => value,
257067
+ set: (value2) => Object.defineProperty(error48, key, {
257068
+ configurable: true,
257069
+ enumerable: true,
257070
+ value: value2
257071
+ })
257072
+ });
257073
+ }
257074
+ return error48;
257075
+ }
257076
+ function replaceDetailsInMessages(messages, stash) {
257077
+ for (const message of messages) {
257078
+ message.detail = stash.load(message.detail);
257079
+ }
257080
+ return messages;
257081
+ }
257082
+ function sanitizeLocation(location, where, terminalWidth) {
257083
+ if (location == null) return null;
257084
+ let keys = {};
257085
+ let file2 = getFlag(location, keys, "file", mustBeString);
257086
+ let namespace = getFlag(location, keys, "namespace", mustBeString);
257087
+ let line = getFlag(location, keys, "line", mustBeInteger);
257088
+ let column = getFlag(location, keys, "column", mustBeInteger);
257089
+ let length = getFlag(location, keys, "length", mustBeInteger);
257090
+ let lineText = getFlag(location, keys, "lineText", mustBeString);
257091
+ let suggestion = getFlag(location, keys, "suggestion", mustBeString);
257092
+ checkForInvalidFlags(location, keys, where);
257093
+ if (lineText) {
257094
+ const relevantASCII = lineText.slice(
257095
+ 0,
257096
+ (column && column > 0 ? column : 0) + (length && length > 0 ? length : 0) + (terminalWidth && terminalWidth > 0 ? terminalWidth : 80)
257097
+ );
257098
+ if (!/[\x7F-\uFFFF]/.test(relevantASCII) && !/\n/.test(lineText)) {
257099
+ lineText = relevantASCII;
257100
+ }
257101
+ }
257102
+ return {
257103
+ file: file2 || "",
257104
+ namespace: namespace || "",
257105
+ line: line || 0,
257106
+ column: column || 0,
257107
+ length: length || 0,
257108
+ lineText: lineText || "",
257109
+ suggestion: suggestion || ""
257110
+ };
257111
+ }
257112
+ function sanitizeMessages(messages, property, stash, fallbackPluginName, terminalWidth) {
257113
+ let messagesClone = [];
257114
+ let index = 0;
257115
+ for (const message of messages) {
257116
+ let keys = {};
257117
+ let id = getFlag(message, keys, "id", mustBeString);
257118
+ let pluginName = getFlag(message, keys, "pluginName", mustBeString);
257119
+ let text = getFlag(message, keys, "text", mustBeString);
257120
+ let location = getFlag(message, keys, "location", mustBeObjectOrNull);
257121
+ let notes = getFlag(message, keys, "notes", mustBeArray);
257122
+ let detail = getFlag(message, keys, "detail", canBeAnything);
257123
+ let where = `in element ${index} of "${property}"`;
257124
+ checkForInvalidFlags(message, keys, where);
257125
+ let notesClone = [];
257126
+ if (notes) {
257127
+ for (const note of notes) {
257128
+ let noteKeys = {};
257129
+ let noteText = getFlag(note, noteKeys, "text", mustBeString);
257130
+ let noteLocation = getFlag(note, noteKeys, "location", mustBeObjectOrNull);
257131
+ checkForInvalidFlags(note, noteKeys, where);
257132
+ notesClone.push({
257133
+ text: noteText || "",
257134
+ location: sanitizeLocation(noteLocation, where, terminalWidth)
257135
+ });
257136
+ }
257137
+ }
257138
+ messagesClone.push({
257139
+ id: id || "",
257140
+ pluginName: pluginName || fallbackPluginName,
257141
+ text: text || "",
257142
+ location: sanitizeLocation(location, where, terminalWidth),
257143
+ notes: notesClone,
257144
+ detail: stash ? stash.store(detail) : -1
257145
+ });
257146
+ index++;
257147
+ }
257148
+ return messagesClone;
257149
+ }
257150
+ function sanitizeStringArray(values, property) {
257151
+ const result = [];
257152
+ for (const value of values) {
257153
+ if (typeof value !== "string") throw new Error(`${quote(property)} must be an array of strings`);
257154
+ result.push(value);
257155
+ }
257156
+ return result;
257157
+ }
257158
+ function sanitizeStringMap(map21, property) {
257159
+ const result = /* @__PURE__ */ Object.create(null);
257160
+ for (const key in map21) {
257161
+ const value = map21[key];
257162
+ if (typeof value !== "string") throw new Error(`key ${quote(key)} in object ${quote(property)} must be a string`);
257163
+ result[key] = value;
257164
+ }
257165
+ return result;
257166
+ }
257167
+ function convertOutputFiles({ path: path3, contents, hash: hash2 }) {
257168
+ let text = null;
257169
+ return {
257170
+ path: path3,
257171
+ contents,
257172
+ hash: hash2,
257173
+ get text() {
257174
+ const binary2 = this.contents;
257175
+ if (text === null || binary2 !== contents) {
257176
+ contents = binary2;
257177
+ text = decodeUTF8(binary2);
257178
+ }
257179
+ return text;
257180
+ }
257181
+ };
257182
+ }
257183
+ function jsRegExpToGoRegExp(regexp) {
257184
+ let result = regexp.source;
257185
+ if (regexp.flags) result = `(?${regexp.flags})${result}`;
257186
+ return result;
257187
+ }
257188
+ function parseJSON(bytes) {
257189
+ let text;
257190
+ try {
257191
+ text = decodeUTF8(bytes);
257192
+ } catch {
257193
+ return JSON_parse(bytes);
257194
+ }
257195
+ return JSON.parse(text);
257196
+ }
257197
+ var fs2 = require("fs");
257198
+ var os2 = require("os");
257199
+ var path2 = require("path");
257200
+ var ESBUILD_BINARY_PATH = process.env.ESBUILD_BINARY_PATH || ESBUILD_BINARY_PATH;
257201
+ var child_process = require("child_process");
257202
+ var crypto2 = require("crypto");
257203
+ var path22 = require("path");
257204
+ var fs22 = require("fs");
257205
+ var os22 = require("os");
257206
+ var tty = require("tty");
257207
+ var worker_threads;
257208
+ if (process.env.ESBUILD_WORKER_THREADS !== "0") {
257209
+ try {
257210
+ worker_threads = require("worker_threads");
257211
+ } catch {
257212
+ }
257213
+ let [major, minor] = process.versions.node.split(".");
257214
+ if (
257215
+ // <v12.17.0 does not work
257216
+ +major < 12 || +major === 12 && +minor < 17 || +major === 13 && +minor < 13
257217
+ ) {
257218
+ worker_threads = void 0;
257219
+ }
257220
+ }
257221
+ var _a2;
257222
+ var isInternalWorkerThread = ((_a2 = worker_threads == null ? void 0 : worker_threads.workerData) == null ? void 0 : _a2.esbuildVersion) === "0.27.4";
257223
+ var esbuildCommandAndArgs = () => {
257224
+ if ((!ESBUILD_BINARY_PATH || true) && (path22.basename(__filename) !== "main.js" || path22.basename(__dirname) !== "lib")) {
257225
+ throw new Error(
257226
+ `The esbuild JavaScript API cannot be bundled. Please mark the "esbuild" package as external so it's not included in the bundle.
257227
+
257228
+ 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.`
257229
+ );
257230
+ }
257231
+ if (true) {
257232
+ return ["node", [path22.join(__dirname, "..", "bin", "esbuild")]];
257233
+ } else {
257234
+ const { binPath, isWASM } = generateBinPath();
257235
+ if (isWASM) {
257236
+ return ["node", [binPath]];
257237
+ } else {
257238
+ return [binPath, []];
257239
+ }
257240
+ }
257241
+ };
257242
+ var isTTY = () => tty.isatty(2);
257243
+ var fsSync = {
257244
+ readFile(tempFile, callback) {
257245
+ try {
257246
+ let contents = fs22.readFileSync(tempFile, "utf8");
257247
+ try {
257248
+ fs22.unlinkSync(tempFile);
257249
+ } catch {
257250
+ }
257251
+ callback(null, contents);
257252
+ } catch (err) {
257253
+ callback(err, null);
257254
+ }
257255
+ },
257256
+ writeFile(contents, callback) {
257257
+ try {
257258
+ let tempFile = randomFileName();
257259
+ fs22.writeFileSync(tempFile, contents);
257260
+ callback(tempFile);
257261
+ } catch {
257262
+ callback(null);
257263
+ }
257264
+ }
257265
+ };
257266
+ var fsAsync = {
257267
+ readFile(tempFile, callback) {
257268
+ try {
257269
+ fs22.readFile(tempFile, "utf8", (err, contents) => {
257270
+ try {
257271
+ fs22.unlink(tempFile, () => callback(err, contents));
257272
+ } catch {
257273
+ callback(err, contents);
257274
+ }
257275
+ });
257276
+ } catch (err) {
257277
+ callback(err, null);
257278
+ }
257279
+ },
257280
+ writeFile(contents, callback) {
257281
+ try {
257282
+ let tempFile = randomFileName();
257283
+ fs22.writeFile(tempFile, contents, (err) => err !== null ? callback(null) : callback(tempFile));
257284
+ } catch {
257285
+ callback(null);
257286
+ }
257287
+ }
257288
+ };
257289
+ var version2 = "0.27.4";
257290
+ var build = (options) => ensureServiceIsRunning().build(options);
257291
+ var context = (buildOptions) => ensureServiceIsRunning().context(buildOptions);
257292
+ var transform2 = (input, options) => ensureServiceIsRunning().transform(input, options);
257293
+ var formatMessages = (messages, options) => ensureServiceIsRunning().formatMessages(messages, options);
257294
+ var analyzeMetafile = (messages, options) => ensureServiceIsRunning().analyzeMetafile(messages, options);
257295
+ var buildSync = (options) => {
257296
+ if (worker_threads && !isInternalWorkerThread) {
257297
+ if (!workerThreadService) workerThreadService = startWorkerThreadService(worker_threads);
257298
+ return workerThreadService.buildSync(options);
257299
+ }
257300
+ let result;
257301
+ runServiceSync((service) => service.buildOrContext({
257302
+ callName: "buildSync",
257303
+ refs: null,
257304
+ options,
257305
+ isTTY: isTTY(),
257306
+ defaultWD,
257307
+ callback: (err, res) => {
257308
+ if (err) throw err;
257309
+ result = res;
257310
+ }
257311
+ }));
257312
+ return result;
257313
+ };
257314
+ var transformSync = (input, options) => {
257315
+ if (worker_threads && !isInternalWorkerThread) {
257316
+ if (!workerThreadService) workerThreadService = startWorkerThreadService(worker_threads);
257317
+ return workerThreadService.transformSync(input, options);
257318
+ }
257319
+ let result;
257320
+ runServiceSync((service) => service.transform({
257321
+ callName: "transformSync",
257322
+ refs: null,
257323
+ input,
257324
+ options: options || {},
257325
+ isTTY: isTTY(),
257326
+ fs: fsSync,
257327
+ callback: (err, res) => {
257328
+ if (err) throw err;
257329
+ result = res;
257330
+ }
257331
+ }));
257332
+ return result;
257333
+ };
257334
+ var formatMessagesSync = (messages, options) => {
257335
+ if (worker_threads && !isInternalWorkerThread) {
257336
+ if (!workerThreadService) workerThreadService = startWorkerThreadService(worker_threads);
257337
+ return workerThreadService.formatMessagesSync(messages, options);
257338
+ }
257339
+ let result;
257340
+ runServiceSync((service) => service.formatMessages({
257341
+ callName: "formatMessagesSync",
257342
+ refs: null,
257343
+ messages,
257344
+ options,
257345
+ callback: (err, res) => {
257346
+ if (err) throw err;
257347
+ result = res;
257348
+ }
257349
+ }));
257350
+ return result;
257351
+ };
257352
+ var analyzeMetafileSync = (metafile, options) => {
257353
+ if (worker_threads && !isInternalWorkerThread) {
257354
+ if (!workerThreadService) workerThreadService = startWorkerThreadService(worker_threads);
257355
+ return workerThreadService.analyzeMetafileSync(metafile, options);
257356
+ }
257357
+ let result;
257358
+ runServiceSync((service) => service.analyzeMetafile({
257359
+ callName: "analyzeMetafileSync",
257360
+ refs: null,
257361
+ metafile: typeof metafile === "string" ? metafile : JSON.stringify(metafile),
257362
+ options,
257363
+ callback: (err, res) => {
257364
+ if (err) throw err;
257365
+ result = res;
257366
+ }
257367
+ }));
257368
+ return result;
257369
+ };
257370
+ var stop = () => {
257371
+ if (stopService) stopService();
257372
+ if (workerThreadService) workerThreadService.stop();
257373
+ return Promise.resolve();
257374
+ };
257375
+ var initializeWasCalled = false;
257376
+ var initialize = (options) => {
257377
+ options = validateInitializeOptions(options || {});
257378
+ if (options.wasmURL) throw new Error(`The "wasmURL" option only works in the browser`);
257379
+ if (options.wasmModule) throw new Error(`The "wasmModule" option only works in the browser`);
257380
+ if (options.worker) throw new Error(`The "worker" option only works in the browser`);
257381
+ if (initializeWasCalled) throw new Error('Cannot call "initialize" more than once');
257382
+ ensureServiceIsRunning();
257383
+ initializeWasCalled = true;
257384
+ return Promise.resolve();
257385
+ };
257386
+ var defaultWD = process.cwd();
257387
+ var longLivedService;
257388
+ var stopService;
257389
+ var ensureServiceIsRunning = () => {
257390
+ if (longLivedService) return longLivedService;
257391
+ let [command, args] = esbuildCommandAndArgs();
257392
+ let child = child_process.spawn(command, args.concat(`--service=${"0.27.4"}`, "--ping"), {
257393
+ windowsHide: true,
257394
+ stdio: ["pipe", "pipe", "inherit"],
257395
+ cwd: defaultWD
257396
+ });
257397
+ let { readFromStdout, afterClose, service } = createChannel({
257398
+ writeToStdin(bytes) {
257399
+ child.stdin.write(bytes, (err) => {
257400
+ if (err) afterClose(err);
257401
+ });
257402
+ },
257403
+ readFileSync: fs22.readFileSync,
257404
+ isSync: false,
257405
+ hasFS: true,
257406
+ esbuild: node_exports
257407
+ });
257408
+ child.stdin.on("error", afterClose);
257409
+ child.on("error", afterClose);
257410
+ const stdin = child.stdin;
257411
+ const stdout = child.stdout;
257412
+ stdout.on("data", readFromStdout);
257413
+ stdout.on("end", afterClose);
257414
+ stopService = () => {
257415
+ stdin.destroy();
257416
+ stdout.destroy();
257417
+ child.kill();
257418
+ initializeWasCalled = false;
257419
+ longLivedService = void 0;
257420
+ stopService = void 0;
257421
+ };
257422
+ let refCount = 0;
257423
+ child.unref();
257424
+ if (stdin.unref) {
257425
+ stdin.unref();
257426
+ }
257427
+ if (stdout.unref) {
257428
+ stdout.unref();
257429
+ }
257430
+ const refs = {
257431
+ ref() {
257432
+ if (++refCount === 1) child.ref();
257433
+ },
257434
+ unref() {
257435
+ if (--refCount === 0) child.unref();
257436
+ }
257437
+ };
257438
+ longLivedService = {
257439
+ build: (options) => new Promise((resolve, reject) => {
257440
+ service.buildOrContext({
257441
+ callName: "build",
257442
+ refs,
257443
+ options,
257444
+ isTTY: isTTY(),
257445
+ defaultWD,
257446
+ callback: (err, res) => err ? reject(err) : resolve(res)
257447
+ });
257448
+ }),
257449
+ context: (options) => new Promise((resolve, reject) => service.buildOrContext({
257450
+ callName: "context",
257451
+ refs,
257452
+ options,
257453
+ isTTY: isTTY(),
257454
+ defaultWD,
257455
+ callback: (err, res) => err ? reject(err) : resolve(res)
257456
+ })),
257457
+ transform: (input, options) => new Promise((resolve, reject) => service.transform({
257458
+ callName: "transform",
257459
+ refs,
257460
+ input,
257461
+ options: options || {},
257462
+ isTTY: isTTY(),
257463
+ fs: fsAsync,
257464
+ callback: (err, res) => err ? reject(err) : resolve(res)
257465
+ })),
257466
+ formatMessages: (messages, options) => new Promise((resolve, reject) => service.formatMessages({
257467
+ callName: "formatMessages",
257468
+ refs,
257469
+ messages,
257470
+ options,
257471
+ callback: (err, res) => err ? reject(err) : resolve(res)
257472
+ })),
257473
+ analyzeMetafile: (metafile, options) => new Promise((resolve, reject) => service.analyzeMetafile({
257474
+ callName: "analyzeMetafile",
257475
+ refs,
257476
+ metafile: typeof metafile === "string" ? metafile : JSON.stringify(metafile),
257477
+ options,
257478
+ callback: (err, res) => err ? reject(err) : resolve(res)
257479
+ }))
257480
+ };
257481
+ return longLivedService;
257482
+ };
257483
+ var runServiceSync = (callback) => {
257484
+ let [command, args] = esbuildCommandAndArgs();
257485
+ let stdin = new Uint8Array();
257486
+ let { readFromStdout, afterClose, service } = createChannel({
257487
+ writeToStdin(bytes) {
257488
+ if (stdin.length !== 0) throw new Error("Must run at most one command");
257489
+ stdin = bytes;
257490
+ },
257491
+ isSync: true,
257492
+ hasFS: true,
257493
+ esbuild: node_exports
257494
+ });
257495
+ callback(service);
257496
+ let stdout = child_process.execFileSync(command, args.concat(`--service=${"0.27.4"}`), {
257497
+ cwd: defaultWD,
257498
+ windowsHide: true,
257499
+ input: stdin,
257500
+ // We don't know how large the output could be. If it's too large, the
257501
+ // command will fail with ENOBUFS. Reserve 16mb for now since that feels
257502
+ // like it should be enough. Also allow overriding this with an environment
257503
+ // variable.
257504
+ maxBuffer: +process.env.ESBUILD_MAX_BUFFER || 16 * 1024 * 1024
257505
+ });
257506
+ readFromStdout(stdout);
257507
+ afterClose(null);
257508
+ };
257509
+ var randomFileName = () => {
257510
+ return path22.join(os22.tmpdir(), `esbuild-${crypto2.randomBytes(32).toString("hex")}`);
257511
+ };
257512
+ var workerThreadService = null;
257513
+ var startWorkerThreadService = (worker_threads2) => {
257514
+ let { port1: mainPort, port2: workerPort } = new worker_threads2.MessageChannel();
257515
+ let worker = new worker_threads2.Worker(__filename, {
257516
+ workerData: { workerPort, defaultWD, esbuildVersion: "0.27.4" },
257517
+ transferList: [workerPort],
257518
+ // From node's documentation: https://nodejs.org/api/worker_threads.html
257519
+ //
257520
+ // Take care when launching worker threads from preload scripts (scripts loaded
257521
+ // and run using the `-r` command line flag). Unless the `execArgv` option is
257522
+ // explicitly set, new Worker threads automatically inherit the command line flags
257523
+ // from the running process and will preload the same preload scripts as the main
257524
+ // thread. If the preload script unconditionally launches a worker thread, every
257525
+ // thread spawned will spawn another until the application crashes.
257526
+ //
257527
+ execArgv: []
257528
+ });
257529
+ let nextID = 0;
257530
+ let fakeBuildError = (text) => {
257531
+ let error48 = new Error(`Build failed with 1 error:
257532
+ error: ${text}`);
257533
+ let errors = [{ id: "", pluginName: "", text, location: null, notes: [], detail: void 0 }];
257534
+ error48.errors = errors;
257535
+ error48.warnings = [];
257536
+ return error48;
257537
+ };
257538
+ let validateBuildSyncOptions = (options) => {
257539
+ if (!options) return;
257540
+ let plugins = options.plugins;
257541
+ if (plugins && plugins.length > 0) throw fakeBuildError(`Cannot use plugins in synchronous API calls`);
257542
+ };
257543
+ let applyProperties = (object3, properties) => {
257544
+ for (let key in properties) {
257545
+ object3[key] = properties[key];
257546
+ }
257547
+ };
257548
+ let runCallSync = (command, args) => {
257549
+ let id = nextID++;
257550
+ let sharedBuffer = new SharedArrayBuffer(8);
257551
+ let sharedBufferView = new Int32Array(sharedBuffer);
257552
+ let msg = { sharedBuffer, id, command, args };
257553
+ worker.postMessage(msg);
257554
+ let status = Atomics.wait(sharedBufferView, 0, 0);
257555
+ if (status !== "ok" && status !== "not-equal") throw new Error("Internal error: Atomics.wait() failed: " + status);
257556
+ let { message: { id: id2, resolve, reject, properties } } = worker_threads2.receiveMessageOnPort(mainPort);
257557
+ if (id !== id2) throw new Error(`Internal error: Expected id ${id} but got id ${id2}`);
257558
+ if (reject) {
257559
+ applyProperties(reject, properties);
257560
+ throw reject;
257561
+ }
257562
+ return resolve;
257563
+ };
257564
+ worker.unref();
257565
+ return {
257566
+ buildSync(options) {
257567
+ validateBuildSyncOptions(options);
257568
+ return runCallSync("build", [options]);
257569
+ },
257570
+ transformSync(input, options) {
257571
+ return runCallSync("transform", [input, options]);
257572
+ },
257573
+ formatMessagesSync(messages, options) {
257574
+ return runCallSync("formatMessages", [messages, options]);
257575
+ },
257576
+ analyzeMetafileSync(metafile, options) {
257577
+ return runCallSync("analyzeMetafile", [metafile, options]);
257578
+ },
257579
+ stop() {
257580
+ worker.terminate();
257581
+ workerThreadService = null;
257582
+ }
257583
+ };
257584
+ };
257585
+ var startSyncServiceWorker = () => {
257586
+ let workerPort = worker_threads.workerData.workerPort;
257587
+ let parentPort = worker_threads.parentPort;
257588
+ let extractProperties = (object3) => {
257589
+ let properties = {};
257590
+ if (object3 && typeof object3 === "object") {
257591
+ for (let key in object3) {
257592
+ properties[key] = object3[key];
257593
+ }
257594
+ }
257595
+ return properties;
257596
+ };
257597
+ try {
257598
+ let service = ensureServiceIsRunning();
257599
+ defaultWD = worker_threads.workerData.defaultWD;
257600
+ parentPort.on("message", (msg) => {
257601
+ (async () => {
257602
+ let { sharedBuffer, id, command, args } = msg;
257603
+ let sharedBufferView = new Int32Array(sharedBuffer);
257604
+ try {
257605
+ switch (command) {
257606
+ case "build":
257607
+ workerPort.postMessage({ id, resolve: await service.build(args[0]) });
257608
+ break;
257609
+ case "transform":
257610
+ workerPort.postMessage({ id, resolve: await service.transform(args[0], args[1]) });
257611
+ break;
257612
+ case "formatMessages":
257613
+ workerPort.postMessage({ id, resolve: await service.formatMessages(args[0], args[1]) });
257614
+ break;
257615
+ case "analyzeMetafile":
257616
+ workerPort.postMessage({ id, resolve: await service.analyzeMetafile(args[0], args[1]) });
257617
+ break;
257618
+ default:
257619
+ throw new Error(`Invalid command: ${command}`);
257620
+ }
257621
+ } catch (reject) {
257622
+ workerPort.postMessage({ id, reject, properties: extractProperties(reject) });
257623
+ }
257624
+ Atomics.add(sharedBufferView, 0, 1);
257625
+ Atomics.notify(sharedBufferView, 0, Infinity);
257626
+ })();
257627
+ });
257628
+ } catch (reject) {
257629
+ parentPort.on("message", (msg) => {
257630
+ let { sharedBuffer, id } = msg;
257631
+ let sharedBufferView = new Int32Array(sharedBuffer);
257632
+ workerPort.postMessage({ id, reject, properties: extractProperties(reject) });
257633
+ Atomics.add(sharedBufferView, 0, 1);
257634
+ Atomics.notify(sharedBufferView, 0, Infinity);
257635
+ });
257636
+ }
257637
+ };
257638
+ if (isInternalWorkerThread) {
257639
+ startSyncServiceWorker();
257640
+ }
257641
+ var node_default = node_exports;
257642
+ }
257643
+ });
257644
+
257645
+ // src/commands/build/build.ts
257646
+ var build_exports = {};
257647
+ __export(build_exports, {
257648
+ default: () => build_default
257649
+ });
257650
+ async function getEsbuild() {
257651
+ if (!!process.versions.webcontainer) {
257652
+ const esbuildWasm = await Promise.resolve().then(() => __toESM(require_main2()));
257653
+ await esbuildWasm.initialize({
257654
+ worker: false,
257655
+ wasmURL: (0, import_path.join)(__dirname, "esbuild.wasm")
257656
+ });
257657
+ return esbuildWasm;
257658
+ } else {
257659
+ return import_esbuild.default;
257660
+ }
257661
+ }
257662
+ var import_esbuild_decorators, import_esbuild, import_path, import_rxjs6, import_operators5, build_default;
257663
+ var init_build = __esm({
257664
+ "src/commands/build/build.ts"() {
257665
+ import_esbuild_decorators = __toESM(require_src());
257666
+ import_esbuild = __toESM(require_main());
257667
+ import_path = require("path");
257668
+ import_rxjs6 = __toESM(require_cjs());
257669
+ import_operators5 = __toESM(require_operators());
257670
+ init_log();
257671
+ init_load_spec();
257672
+ build_default = async (args) => {
257673
+ const time3 = Date.now();
257674
+ return (0, import_rxjs6.lastValueFrom)(
257675
+ loadSpec().pipe(
257676
+ (0, import_operators5.tap)((config2) => {
257677
+ Logger.info(
257678
+ `\u{1F528} Bundling ${args.files?.length ? args.files.join("") : config2?.function?.file ?? config2?.file ?? "index.ts"}`
257679
+ );
257680
+ }),
257681
+ (0, import_operators5.switchMap)(
257682
+ (config2) => (0, import_rxjs6.from)(getEsbuild()).pipe(
257683
+ (0, import_operators5.map)((esbuild2) => ({
257684
+ esbuild: esbuild2,
257685
+ options: {
257686
+ entryPoints: args.files?.length ? args.files : [config2?.function?.file ?? config2?.file ?? "index.ts"],
257687
+ bundle: args.bundle ?? config2?.options?.bundler?.bundle ?? true,
257688
+ minify: args.minify ?? config2?.options?.bundler?.minify ?? false,
257689
+ platform: args.platform ?? "node",
257690
+ target: args.target ?? config2?.options?.bundler?.target ?? "node24",
257691
+ outfile: args.outfile ?? config2?.options?.bundler?.outfile ?? "index.js",
257692
+ external: args.external ?? config2?.options?.bundler?.external ?? []
257693
+ }
257694
+ })),
257695
+ (0, import_operators5.switchMap)(
257696
+ ({ esbuild: esbuild2, options }) => esbuild2.build({
257697
+ ...options,
257698
+ plugins: [
257699
+ (0, import_esbuild_decorators.esbuildDecorators)({
257700
+ tsconfig: "./tsconfig.json",
257701
+ cwd: process.cwd()
257702
+ })
257703
+ ]
257704
+ })
257705
+ ),
257706
+ (0, import_operators5.tap)((data) => {
257707
+ if (data.warnings.length) {
257708
+ Logger.warn(data.warnings);
257709
+ }
257710
+ if (data.errors.length) {
257711
+ Logger.error(data.errors);
257712
+ }
257713
+ Logger.warn(`\u{1F3D7}\uFE0F Bundling finish in ${Date.now() - time3}ms`);
257714
+ Logger.info(
257715
+ `\u2705 Finished bundling output file ${args.outfile ?? config2?.options?.bundler?.outfile ?? "index.js"}`
257716
+ );
257717
+ })
257718
+ )
257719
+ )
257720
+ )
257721
+ ).catch((e2) => {
257722
+ console.error(e2);
257723
+ process.exit(1);
257724
+ });
257725
+ };
257726
+ }
257727
+ });
257728
+
257729
+ // src/commands/environment/list-environments.ts
257730
+ var list_environments_exports = {};
257731
+ __export(list_environments_exports, {
257732
+ default: () => list_environments_default
257733
+ });
257734
+ var import_rxjs7, import_operators6, list_environments_default;
257735
+ var init_list_environments = __esm({
257736
+ "src/commands/environment/list-environments.ts"() {
257737
+ import_rxjs7 = __toESM(require_cjs());
257738
+ import_operators6 = __toESM(require_operators());
257739
+ init_helpers();
257740
+ init_gql_client();
257741
+ init_log();
257742
+ list_environments_default = (cmd) => (0, import_rxjs7.lastValueFrom)(
257743
+ parseProjectId(cmd.project).pipe(
257744
+ (0, import_operators6.switchMap)((projectId) => GraphqlClienAPI.listEnvironments(projectId)),
257745
+ (0, import_operators6.tap)((data) => {
257746
+ const columns = [
257747
+ "id",
257748
+ "name",
257749
+ "image",
257750
+ "builder",
257751
+ "poolSize",
257752
+ "minCpu",
257753
+ "maxCpu",
257754
+ "minMemory",
257755
+ "maxMemory",
257756
+ "region"
257757
+ ];
257758
+ Logger.log("-------------------");
257759
+ Logger.log("[Action][listEnvironments]");
257760
+ Logger.table(data, columns);
257761
+ Logger.log("-------------------");
257762
+ })
257763
+ )
257764
+ );
257765
+ }
257766
+ });
257767
+
257768
+ // src/commands/environment/create-environment.ts
257769
+ var create_environment_exports = {};
257770
+ __export(create_environment_exports, {
257771
+ default: () => create_environment_default
257772
+ });
257773
+ var import_rxjs8, import_operators7, create_environment_default;
257774
+ var init_create_environment = __esm({
257775
+ "src/commands/environment/create-environment.ts"() {
257776
+ import_rxjs8 = __toESM(require_cjs());
257777
+ import_operators7 = __toESM(require_operators());
257778
+ init_helpers();
257779
+ init_gql_client();
257780
+ init_log();
257781
+ init_load_spec();
257782
+ create_environment_default = (cmd) => (0, import_rxjs8.lastValueFrom)(
257783
+ parseProjectId(cmd.project).pipe(
257784
+ (0, import_operators7.switchMap)(
257785
+ (projectId) => loadSpec(cmd.spec ?? "env.yaml").pipe(
257786
+ (0, import_operators7.map)((data) => ({
257787
+ projectId,
257788
+ ...data?.environment ?? data
257789
+ }))
257790
+ )
257791
+ ),
257792
+ (0, import_operators7.switchMap)(
257793
+ ({ projectId, ...data }) => GraphqlClienAPI.createEnvironment(projectId, {
257794
+ ...data,
257795
+ ...cmd
257796
+ })
257797
+ ),
257798
+ (0, import_operators7.tap)((data) => {
257799
+ const columns = [
257800
+ "id",
257801
+ "name",
257802
+ "image",
257803
+ "builder",
257804
+ "poolSize",
257805
+ "minCpu",
257806
+ "maxCpu",
257807
+ "minMemory",
257808
+ "maxMemory",
257809
+ "region"
257810
+ ];
257811
+ Logger.log("-------------------");
257812
+ Logger.log("[Action][createEnvironment]");
257813
+ Logger.table([data], columns);
257814
+ Logger.log("-------------------");
257815
+ })
257816
+ )
257817
+ );
257818
+ }
257819
+ });
257820
+
257821
+ // src/commands/environment/update-environment.ts
257822
+ var update_environment_exports = {};
257823
+ __export(update_environment_exports, {
257824
+ default: () => update_environment_default
257825
+ });
257826
+ var import_rxjs9, import_operators8, update_environment_default;
257827
+ var init_update_environment = __esm({
257828
+ "src/commands/environment/update-environment.ts"() {
257829
+ import_rxjs9 = __toESM(require_cjs());
257830
+ import_operators8 = __toESM(require_operators());
257831
+ init_helpers();
257832
+ init_gql_client();
257833
+ init_log();
257834
+ init_load_spec();
257835
+ update_environment_default = (cmd) => (0, import_rxjs9.lastValueFrom)(
257836
+ parseProjectId(cmd.project).pipe(
257837
+ (0, import_operators8.switchMap)(
257838
+ (projectId) => loadSpec(cmd.spec ?? "env.yaml").pipe(
257839
+ (0, import_operators8.map)((data) => ({
257840
+ projectId,
257841
+ ...data?.environment ?? data
257842
+ }))
257843
+ )
257844
+ ),
257845
+ (0, import_operators8.tap)(Logger.log),
257846
+ (0, import_operators8.switchMap)(
257847
+ ({ projectId, ...data }) => GraphqlClienAPI.updateEnvironment(projectId, {
257848
+ ...data,
257849
+ ...cmd
257850
+ })
257851
+ ),
257852
+ (0, import_operators8.tap)((data) => {
257853
+ const columns = [
257854
+ "id",
257855
+ "name",
257856
+ "image",
257857
+ "builder",
257858
+ "poolSize",
257859
+ "minCpu",
257860
+ "maxCpu",
257861
+ "minMemory",
257862
+ "maxMemory",
257863
+ "region"
257864
+ ];
257865
+ Logger.log("-------------------");
257866
+ Logger.log("[Action][updateEnvironment]");
257867
+ Logger.table([data], columns);
257868
+ Logger.log("-------------------");
257869
+ })
257870
+ )
257871
+ );
257872
+ }
257873
+ });
257874
+
257875
+ // src/commands/environment/delete-environment.ts
257876
+ var delete_environment_exports = {};
257877
+ __export(delete_environment_exports, {
257878
+ default: () => delete_environment_default
257879
+ });
257880
+ var import_rxjs10, import_operators9, delete_environment_default;
257881
+ var init_delete_environment = __esm({
257882
+ "src/commands/environment/delete-environment.ts"() {
257883
+ import_rxjs10 = __toESM(require_cjs());
257884
+ import_operators9 = __toESM(require_operators());
257885
+ init_helpers();
257886
+ init_gql_client();
257887
+ init_log();
257888
+ init_load_spec();
257889
+ delete_environment_default = (cmd) => (0, import_rxjs10.lastValueFrom)(
257890
+ parseProjectId(cmd.project).pipe(
257891
+ (0, import_operators9.switchMap)(
257892
+ (projectId) => loadSpec(cmd.spec ?? "env.yaml").pipe(
257893
+ (0, import_operators9.map)((data) => ({
257894
+ projectId,
257895
+ ...data?.environment ?? data
257896
+ }))
257897
+ )
257898
+ ),
257899
+ (0, import_operators9.switchMap)(
257900
+ ({ projectId, name: name2 }) => GraphqlClienAPI.deleteEnvironment(name2, projectId, cmd.force)
257901
+ ),
257902
+ (0, import_operators9.tap)((data) => {
257903
+ const columns = [
257904
+ "id",
257905
+ "name",
257906
+ "image",
257907
+ "builder",
257908
+ "poolSize",
257909
+ "minCpu",
257910
+ "maxCpu",
257911
+ "minMemory",
257912
+ "maxMemory",
257913
+ "region"
257914
+ ];
257915
+ Logger.log("-------------------");
257916
+ Logger.log("[Action][deleteEnvironment]");
257917
+ Logger.table([data], columns);
257918
+ Logger.log("-------------------");
257919
+ })
257920
+ )
257921
+ );
257922
+ }
257923
+ });
257924
+
257925
+ // src/commands/environment/get-environment.ts
257926
+ var get_environment_exports = {};
257927
+ __export(get_environment_exports, {
257928
+ default: () => get_environment_default
257929
+ });
257930
+ var import_rxjs11, import_operators10, get_environment_default;
257931
+ var init_get_environment = __esm({
257932
+ "src/commands/environment/get-environment.ts"() {
257933
+ import_rxjs11 = __toESM(require_cjs());
257934
+ import_operators10 = __toESM(require_operators());
257935
+ init_helpers();
257936
+ init_gql_client();
257937
+ init_log();
257938
+ init_load_spec();
257939
+ get_environment_default = (cmd) => (0, import_rxjs11.lastValueFrom)(
257940
+ parseProjectId(cmd.project).pipe(
257941
+ (0, import_operators10.switchMap)(
257942
+ (projectId) => loadSpec(cmd.spec ?? "env.yaml").pipe(
257943
+ (0, import_operators10.map)((data) => ({
257944
+ projectId,
257945
+ ...data?.environment ?? data
257946
+ }))
257947
+ )
257948
+ ),
257949
+ (0, import_operators10.switchMap)(
257950
+ ({ projectId, name: name2 }) => GraphqlClienAPI.getEnvironment(cmd.name ?? name2, projectId)
257951
+ ),
257952
+ (0, import_operators10.tap)((data) => {
257953
+ const columns = [
257954
+ "id",
257955
+ "name",
257956
+ "image",
257957
+ "builder",
257958
+ "poolSize",
257959
+ "minCpu",
257960
+ "maxCpu",
257961
+ "minMemory",
257962
+ "maxMemory",
257963
+ "region"
257964
+ ];
257965
+ Logger.log("-------------------");
257966
+ Logger.log("[Action][getEnvironment]");
257967
+ Logger.table([data], columns);
257968
+ Logger.log("-------------------");
257969
+ })
257970
+ )
257971
+ );
257972
+ }
257973
+ });
257974
+
257975
+ // ../../node_modules/delayed-stream/lib/delayed_stream.js
257976
+ var require_delayed_stream = __commonJS({
257977
+ "../../node_modules/delayed-stream/lib/delayed_stream.js"(exports2, module2) {
257978
+ var Stream3 = require("stream").Stream;
257979
+ var util2 = require("util");
257980
+ module2.exports = DelayedStream;
257981
+ function DelayedStream() {
257982
+ this.source = null;
257983
+ this.dataSize = 0;
257984
+ this.maxDataSize = 1024 * 1024;
257985
+ this.pauseStream = true;
257986
+ this._maxDataSizeExceeded = false;
257987
+ this._released = false;
257988
+ this._bufferedEvents = [];
257989
+ }
257990
+ util2.inherits(DelayedStream, Stream3);
257991
+ DelayedStream.create = function(source, options) {
257992
+ var delayedStream = new this();
257993
+ options = options || {};
257994
+ for (var option in options) {
257995
+ delayedStream[option] = options[option];
257996
+ }
257997
+ delayedStream.source = source;
257998
+ var realEmit = source.emit;
257999
+ source.emit = function() {
258000
+ delayedStream._handleEmit(arguments);
258001
+ return realEmit.apply(source, arguments);
258002
+ };
258003
+ source.on("error", function() {
258004
+ });
258005
+ if (delayedStream.pauseStream) {
258006
+ source.pause();
258007
+ }
258008
+ return delayedStream;
258009
+ };
258010
+ Object.defineProperty(DelayedStream.prototype, "readable", {
258011
+ configurable: true,
258012
+ enumerable: true,
258013
+ get: function() {
258014
+ return this.source.readable;
258015
+ }
258016
+ });
258017
+ DelayedStream.prototype.setEncoding = function() {
258018
+ return this.source.setEncoding.apply(this.source, arguments);
258019
+ };
258020
+ DelayedStream.prototype.resume = function() {
258021
+ if (!this._released) {
258022
+ this.release();
258023
+ }
258024
+ this.source.resume();
258025
+ };
258026
+ DelayedStream.prototype.pause = function() {
258027
+ this.source.pause();
258028
+ };
258029
+ DelayedStream.prototype.release = function() {
258030
+ this._released = true;
258031
+ this._bufferedEvents.forEach(function(args) {
258032
+ this.emit.apply(this, args);
258033
+ }.bind(this));
258034
+ this._bufferedEvents = [];
258035
+ };
258036
+ DelayedStream.prototype.pipe = function() {
258037
+ var r2 = Stream3.prototype.pipe.apply(this, arguments);
258038
+ this.resume();
258039
+ return r2;
258040
+ };
258041
+ DelayedStream.prototype._handleEmit = function(args) {
258042
+ if (this._released) {
258043
+ this.emit.apply(this, args);
258044
+ return;
258045
+ }
258046
+ if (args[0] === "data") {
258047
+ this.dataSize += args[1].length;
258048
+ this._checkIfMaxDataSizeExceeded();
258049
+ }
258050
+ this._bufferedEvents.push(args);
258051
+ };
258052
+ DelayedStream.prototype._checkIfMaxDataSizeExceeded = function() {
258053
+ if (this._maxDataSizeExceeded) {
258054
+ return;
258055
+ }
258056
+ if (this.dataSize <= this.maxDataSize) {
258057
+ return;
258058
+ }
258059
+ this._maxDataSizeExceeded = true;
258060
+ var message = "DelayedStream#maxDataSize of " + this.maxDataSize + " bytes exceeded.";
258061
+ this.emit("error", new Error(message));
258062
+ };
258063
+ }
258064
+ });
258065
+
258066
+ // ../../node_modules/combined-stream/lib/combined_stream.js
258067
+ var require_combined_stream = __commonJS({
258068
+ "../../node_modules/combined-stream/lib/combined_stream.js"(exports2, module2) {
258069
+ var util2 = require("util");
258070
+ var Stream3 = require("stream").Stream;
258071
+ var DelayedStream = require_delayed_stream();
258072
+ module2.exports = CombinedStream;
258073
+ function CombinedStream() {
258074
+ this.writable = false;
258075
+ this.readable = true;
258076
+ this.dataSize = 0;
258077
+ this.maxDataSize = 2 * 1024 * 1024;
258078
+ this.pauseStreams = true;
258079
+ this._released = false;
258080
+ this._streams = [];
258081
+ this._currentStream = null;
258082
+ this._insideLoop = false;
258083
+ this._pendingNext = false;
258084
+ }
258085
+ util2.inherits(CombinedStream, Stream3);
258086
+ CombinedStream.create = function(options) {
258087
+ var combinedStream = new this();
258088
+ options = options || {};
258089
+ for (var option in options) {
258090
+ combinedStream[option] = options[option];
258091
+ }
258092
+ return combinedStream;
258093
+ };
258094
+ CombinedStream.isStreamLike = function(stream) {
258095
+ return typeof stream !== "function" && typeof stream !== "string" && typeof stream !== "boolean" && typeof stream !== "number" && !Buffer.isBuffer(stream);
258096
+ };
258097
+ CombinedStream.prototype.append = function(stream) {
258098
+ var isStreamLike = CombinedStream.isStreamLike(stream);
258099
+ if (isStreamLike) {
258100
+ if (!(stream instanceof DelayedStream)) {
258101
+ var newStream = DelayedStream.create(stream, {
258102
+ maxDataSize: Infinity,
258103
+ pauseStream: this.pauseStreams
258104
+ });
258105
+ stream.on("data", this._checkDataSize.bind(this));
258106
+ stream = newStream;
258107
+ }
258108
+ this._handleErrors(stream);
258109
+ if (this.pauseStreams) {
258110
+ stream.pause();
258111
+ }
258112
+ }
258113
+ this._streams.push(stream);
258114
+ return this;
258115
+ };
258116
+ CombinedStream.prototype.pipe = function(dest, options) {
258117
+ Stream3.prototype.pipe.call(this, dest, options);
258118
+ this.resume();
258119
+ return dest;
258120
+ };
258121
+ CombinedStream.prototype._getNext = function() {
258122
+ this._currentStream = null;
258123
+ if (this._insideLoop) {
258124
+ this._pendingNext = true;
258125
+ return;
258126
+ }
258127
+ this._insideLoop = true;
258128
+ try {
258129
+ do {
258130
+ this._pendingNext = false;
258131
+ this._realGetNext();
258132
+ } while (this._pendingNext);
258133
+ } finally {
258134
+ this._insideLoop = false;
258135
+ }
258136
+ };
258137
+ CombinedStream.prototype._realGetNext = function() {
258138
+ var stream = this._streams.shift();
258139
+ if (typeof stream == "undefined") {
258140
+ this.end();
258141
+ return;
258142
+ }
258143
+ if (typeof stream !== "function") {
258144
+ this._pipeNext(stream);
258145
+ return;
258146
+ }
258147
+ var getStream = stream;
258148
+ getStream(function(stream2) {
258149
+ var isStreamLike = CombinedStream.isStreamLike(stream2);
258150
+ if (isStreamLike) {
258151
+ stream2.on("data", this._checkDataSize.bind(this));
258152
+ this._handleErrors(stream2);
258153
+ }
258154
+ this._pipeNext(stream2);
258155
+ }.bind(this));
258156
+ };
258157
+ CombinedStream.prototype._pipeNext = function(stream) {
258158
+ this._currentStream = stream;
258159
+ var isStreamLike = CombinedStream.isStreamLike(stream);
258160
+ if (isStreamLike) {
258161
+ stream.on("end", this._getNext.bind(this));
258162
+ stream.pipe(this, { end: false });
258163
+ return;
258164
+ }
258165
+ var value = stream;
258166
+ this.write(value);
258167
+ this._getNext();
258168
+ };
258169
+ CombinedStream.prototype._handleErrors = function(stream) {
258170
+ var self2 = this;
258171
+ stream.on("error", function(err) {
258172
+ self2._emitError(err);
258173
+ });
258174
+ };
258175
+ CombinedStream.prototype.write = function(data) {
258176
+ this.emit("data", data);
258177
+ };
258178
+ CombinedStream.prototype.pause = function() {
258179
+ if (!this.pauseStreams) {
258180
+ return;
258181
+ }
258182
+ if (this.pauseStreams && this._currentStream && typeof this._currentStream.pause == "function") this._currentStream.pause();
258183
+ this.emit("pause");
258184
+ };
258185
+ CombinedStream.prototype.resume = function() {
258186
+ if (!this._released) {
258187
+ this._released = true;
258188
+ this.writable = true;
258189
+ this._getNext();
258190
+ }
258191
+ if (this.pauseStreams && this._currentStream && typeof this._currentStream.resume == "function") this._currentStream.resume();
258192
+ this.emit("resume");
258193
+ };
258194
+ CombinedStream.prototype.end = function() {
258195
+ this._reset();
258196
+ this.emit("end");
258197
+ };
258198
+ CombinedStream.prototype.destroy = function() {
258199
+ this._reset();
258200
+ this.emit("close");
258201
+ };
258202
+ CombinedStream.prototype._reset = function() {
258203
+ this.writable = false;
258204
+ this._streams = [];
258205
+ this._currentStream = null;
258206
+ };
258207
+ CombinedStream.prototype._checkDataSize = function() {
258208
+ this._updateDataSize();
258209
+ if (this.dataSize <= this.maxDataSize) {
258210
+ return;
258211
+ }
258212
+ var message = "DelayedStream#maxDataSize of " + this.maxDataSize + " bytes exceeded.";
258213
+ this._emitError(new Error(message));
258214
+ };
258215
+ CombinedStream.prototype._updateDataSize = function() {
258216
+ this.dataSize = 0;
258217
+ var self2 = this;
258218
+ this._streams.forEach(function(stream) {
258219
+ if (!stream.dataSize) {
258220
+ return;
258221
+ }
258222
+ self2.dataSize += stream.dataSize;
258223
+ });
258224
+ if (this._currentStream && this._currentStream.dataSize) {
258225
+ this.dataSize += this._currentStream.dataSize;
258226
+ }
258227
+ };
258228
+ CombinedStream.prototype._emitError = function(err) {
258229
+ this._reset();
258230
+ this.emit("error", err);
258231
+ };
258232
+ }
258233
+ });
258234
+
258235
+ // ../../node_modules/mime-db/db.json
258236
+ var require_db = __commonJS({
258237
+ "../../node_modules/mime-db/db.json"(exports2, module2) {
258238
+ module2.exports = {
258239
+ "application/1d-interleaved-parityfec": {
258240
+ source: "iana"
258241
+ },
258242
+ "application/3gpdash-qoe-report+xml": {
258243
+ source: "iana",
258244
+ charset: "UTF-8",
258245
+ compressible: true
258246
+ },
258247
+ "application/3gpp-ims+xml": {
255904
258248
  source: "iana",
255905
258249
  compressible: true
255906
258250
  },
@@ -264291,9 +266635,9 @@ var require_mime_types = __commonJS({
264291
266635
  for (var i2 = 0; i2 < exts.length; i2++) {
264292
266636
  var extension2 = exts[i2];
264293
266637
  if (types3[extension2]) {
264294
- var from11 = preference.indexOf(db[types3[extension2]].source);
266638
+ var from12 = preference.indexOf(db[types3[extension2]].source);
264295
266639
  var to = preference.indexOf(mime.source);
264296
- if (types3[extension2] !== "application/octet-stream" && (from11 > to || from11 === to && types3[extension2].substr(0, 12) === "application/")) {
266640
+ if (types3[extension2] !== "application/octet-stream" && (from12 > to || from12 === to && types3[extension2].substr(0, 12) === "application/")) {
264297
266641
  continue;
264298
266642
  }
264299
266643
  }
@@ -268849,15 +271193,15 @@ var require_polyfills = __commonJS({
268849
271193
  }
268850
271194
  if (platform === "win32") {
268851
271195
  fs2.rename = /* @__PURE__ */ (function(fs$rename) {
268852
- return function(from11, to, cb) {
271196
+ return function(from12, to, cb) {
268853
271197
  var start2 = Date.now();
268854
271198
  var backoff = 0;
268855
- fs$rename(from11, to, function CB(er) {
271199
+ fs$rename(from12, to, function CB(er) {
268856
271200
  if (er && (er.code === "EACCES" || er.code === "EPERM") && Date.now() - start2 < 6e4) {
268857
271201
  setTimeout(function() {
268858
271202
  fs2.stat(to, function(stater, st) {
268859
271203
  if (stater && stater.code === "ENOENT")
268860
- fs$rename(from11, to, CB);
271204
+ fs$rename(from12, to, CB);
268861
271205
  else
268862
271206
  cb(er);
268863
271207
  });
@@ -269738,7 +272082,7 @@ var require_BufferList2 = __commonJS({
269738
272082
  this.head = this.tail = null;
269739
272083
  this.length = 0;
269740
272084
  };
269741
- BufferList.prototype.join = function join(s2) {
272085
+ BufferList.prototype.join = function join2(s2) {
269742
272086
  if (this.length === 0) return "";
269743
272087
  var p = this.head;
269744
272088
  var ret = "" + p.data;
@@ -274538,7 +276882,7 @@ var require_buffer_list3 = __commonJS({
274538
276882
  }
274539
276883
  }, {
274540
276884
  key: "join",
274541
- value: function join(s2) {
276885
+ value: function join2(s2) {
274542
276886
  if (this.length === 0) return "";
274543
276887
  var p = this.head;
274544
276888
  var ret = "" + p.data;
@@ -275765,7 +278109,7 @@ var require_from4 = __commonJS({
275765
278109
  return obj;
275766
278110
  }
275767
278111
  var ERR_INVALID_ARG_TYPE = require_errors3().codes.ERR_INVALID_ARG_TYPE;
275768
- function from11(Readable2, iterable, opts) {
278112
+ function from12(Readable2, iterable, opts) {
275769
278113
  var iterator;
275770
278114
  if (iterable && typeof iterable.next === "function") {
275771
278115
  iterator = iterable;
@@ -275804,7 +278148,7 @@ var require_from4 = __commonJS({
275804
278148
  }
275805
278149
  return readable;
275806
278150
  }
275807
- module2.exports = from11;
278151
+ module2.exports = from12;
275808
278152
  }
275809
278153
  });
275810
278154
 
@@ -275848,7 +278192,7 @@ var require_stream_readable4 = __commonJS({
275848
278192
  var ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;
275849
278193
  var StringDecoder;
275850
278194
  var createReadableStreamAsyncIterator;
275851
- var from11;
278195
+ var from12;
275852
278196
  require_inherits()(Readable2, Stream3);
275853
278197
  var errorOrDestroy = destroyImpl.errorOrDestroy;
275854
278198
  var kProxyEvents = ["error", "close", "destroy", "pause", "resume"];
@@ -276530,10 +278874,10 @@ var require_stream_readable4 = __commonJS({
276530
278874
  }
276531
278875
  if (typeof Symbol === "function") {
276532
278876
  Readable2.from = function(iterable, opts) {
276533
- if (from11 === void 0) {
276534
- from11 = require_from4();
278877
+ if (from12 === void 0) {
278878
+ from12 = require_from4();
276535
278879
  }
276536
- return from11(Readable2, iterable, opts);
278880
+ return from12(Readable2, iterable, opts);
276537
278881
  };
276538
278882
  }
276539
278883
  function indexOf(xs, x2) {
@@ -276713,8 +279057,8 @@ var require_pipeline3 = __commonJS({
276713
279057
  function call(fn) {
276714
279058
  fn();
276715
279059
  }
276716
- function pipe2(from11, to) {
276717
- return from11.pipe(to);
279060
+ function pipe2(from12, to) {
279061
+ return from12.pipe(to);
276718
279062
  }
276719
279063
  function popCallback(streams) {
276720
279064
  if (!streams.length) return noop3;
@@ -277880,7 +280224,7 @@ var require_buffer_list4 = __commonJS({
277880
280224
  }
277881
280225
  }, {
277882
280226
  key: "join",
277883
- value: function join(s2) {
280227
+ value: function join2(s2) {
277884
280228
  if (this.length === 0) return "";
277885
280229
  var p = this.head;
277886
280230
  var ret = "" + p.data;
@@ -279107,7 +281451,7 @@ var require_from5 = __commonJS({
279107
281451
  return obj;
279108
281452
  }
279109
281453
  var ERR_INVALID_ARG_TYPE = require_errors4().codes.ERR_INVALID_ARG_TYPE;
279110
- function from11(Readable2, iterable, opts) {
281454
+ function from12(Readable2, iterable, opts) {
279111
281455
  var iterator;
279112
281456
  if (iterable && typeof iterable.next === "function") {
279113
281457
  iterator = iterable;
@@ -279146,7 +281490,7 @@ var require_from5 = __commonJS({
279146
281490
  }
279147
281491
  return readable;
279148
281492
  }
279149
- module2.exports = from11;
281493
+ module2.exports = from12;
279150
281494
  }
279151
281495
  });
279152
281496
 
@@ -279190,7 +281534,7 @@ var require_stream_readable5 = __commonJS({
279190
281534
  var ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;
279191
281535
  var StringDecoder;
279192
281536
  var createReadableStreamAsyncIterator;
279193
- var from11;
281537
+ var from12;
279194
281538
  require_inherits()(Readable2, Stream3);
279195
281539
  var errorOrDestroy = destroyImpl.errorOrDestroy;
279196
281540
  var kProxyEvents = ["error", "close", "destroy", "pause", "resume"];
@@ -279872,10 +282216,10 @@ var require_stream_readable5 = __commonJS({
279872
282216
  }
279873
282217
  if (typeof Symbol === "function") {
279874
282218
  Readable2.from = function(iterable, opts) {
279875
- if (from11 === void 0) {
279876
- from11 = require_from5();
282219
+ if (from12 === void 0) {
282220
+ from12 = require_from5();
279877
282221
  }
279878
- return from11(Readable2, iterable, opts);
282222
+ return from12(Readable2, iterable, opts);
279879
282223
  };
279880
282224
  }
279881
282225
  function indexOf(xs, x2) {
@@ -280055,8 +282399,8 @@ var require_pipeline4 = __commonJS({
280055
282399
  function call(fn) {
280056
282400
  fn();
280057
282401
  }
280058
- function pipe2(from11, to) {
280059
- return from11.pipe(to);
282402
+ function pipe2(from12, to) {
282403
+ return from12.pipe(to);
280060
282404
  }
280061
282405
  function popCallback(streams) {
280062
282406
  if (!streams.length) return noop3;
@@ -280652,7 +282996,7 @@ var require_buffer_list5 = __commonJS({
280652
282996
  }
280653
282997
  }, {
280654
282998
  key: "join",
280655
- value: function join(s2) {
282999
+ value: function join2(s2) {
280656
283000
  if (this.length === 0) return "";
280657
283001
  var p = this.head;
280658
283002
  var ret = "" + p.data;
@@ -281879,7 +284223,7 @@ var require_from6 = __commonJS({
281879
284223
  return obj;
281880
284224
  }
281881
284225
  var ERR_INVALID_ARG_TYPE = require_errors5().codes.ERR_INVALID_ARG_TYPE;
281882
- function from11(Readable2, iterable, opts) {
284226
+ function from12(Readable2, iterable, opts) {
281883
284227
  var iterator;
281884
284228
  if (iterable && typeof iterable.next === "function") {
281885
284229
  iterator = iterable;
@@ -281918,7 +284262,7 @@ var require_from6 = __commonJS({
281918
284262
  }
281919
284263
  return readable;
281920
284264
  }
281921
- module2.exports = from11;
284265
+ module2.exports = from12;
281922
284266
  }
281923
284267
  });
281924
284268
 
@@ -281962,7 +284306,7 @@ var require_stream_readable6 = __commonJS({
281962
284306
  var ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;
281963
284307
  var StringDecoder;
281964
284308
  var createReadableStreamAsyncIterator;
281965
- var from11;
284309
+ var from12;
281966
284310
  require_inherits()(Readable2, Stream3);
281967
284311
  var errorOrDestroy = destroyImpl.errorOrDestroy;
281968
284312
  var kProxyEvents = ["error", "close", "destroy", "pause", "resume"];
@@ -282644,10 +284988,10 @@ var require_stream_readable6 = __commonJS({
282644
284988
  }
282645
284989
  if (typeof Symbol === "function") {
282646
284990
  Readable2.from = function(iterable, opts) {
282647
- if (from11 === void 0) {
282648
- from11 = require_from6();
284991
+ if (from12 === void 0) {
284992
+ from12 = require_from6();
282649
284993
  }
282650
- return from11(Readable2, iterable, opts);
284994
+ return from12(Readable2, iterable, opts);
282651
284995
  };
282652
284996
  }
282653
284997
  function indexOf(xs, x2) {
@@ -282827,8 +285171,8 @@ var require_pipeline5 = __commonJS({
282827
285171
  function call(fn) {
282828
285172
  fn();
282829
285173
  }
282830
- function pipe2(from11, to) {
282831
- return from11.pipe(to);
285174
+ function pipe2(from12, to) {
285175
+ return from12.pipe(to);
282832
285176
  }
282833
285177
  function popCallback(streams) {
282834
285178
  if (!streams.length) return noop3;
@@ -283889,7 +286233,7 @@ var require_buffer_list6 = __commonJS({
283889
286233
  }
283890
286234
  }, {
283891
286235
  key: "join",
283892
- value: function join(s2) {
286236
+ value: function join2(s2) {
283893
286237
  if (this.length === 0) return "";
283894
286238
  var p = this.head;
283895
286239
  var ret = "" + p.data;
@@ -285116,7 +287460,7 @@ var require_from7 = __commonJS({
285116
287460
  return obj;
285117
287461
  }
285118
287462
  var ERR_INVALID_ARG_TYPE = require_errors6().codes.ERR_INVALID_ARG_TYPE;
285119
- function from11(Readable2, iterable, opts) {
287463
+ function from12(Readable2, iterable, opts) {
285120
287464
  var iterator;
285121
287465
  if (iterable && typeof iterable.next === "function") {
285122
287466
  iterator = iterable;
@@ -285155,7 +287499,7 @@ var require_from7 = __commonJS({
285155
287499
  }
285156
287500
  return readable;
285157
287501
  }
285158
- module2.exports = from11;
287502
+ module2.exports = from12;
285159
287503
  }
285160
287504
  });
285161
287505
 
@@ -285199,7 +287543,7 @@ var require_stream_readable7 = __commonJS({
285199
287543
  var ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;
285200
287544
  var StringDecoder;
285201
287545
  var createReadableStreamAsyncIterator;
285202
- var from11;
287546
+ var from12;
285203
287547
  require_inherits()(Readable2, Stream3);
285204
287548
  var errorOrDestroy = destroyImpl.errorOrDestroy;
285205
287549
  var kProxyEvents = ["error", "close", "destroy", "pause", "resume"];
@@ -285881,10 +288225,10 @@ var require_stream_readable7 = __commonJS({
285881
288225
  }
285882
288226
  if (typeof Symbol === "function") {
285883
288227
  Readable2.from = function(iterable, opts) {
285884
- if (from11 === void 0) {
285885
- from11 = require_from7();
288228
+ if (from12 === void 0) {
288229
+ from12 = require_from7();
285886
288230
  }
285887
- return from11(Readable2, iterable, opts);
288231
+ return from12(Readable2, iterable, opts);
285888
288232
  };
285889
288233
  }
285890
288234
  function indexOf(xs, x2) {
@@ -286064,8 +288408,8 @@ var require_pipeline6 = __commonJS({
286064
288408
  function call(fn) {
286065
288409
  fn();
286066
288410
  }
286067
- function pipe2(from11, to) {
286068
- return from11.pipe(to);
288411
+ function pipe2(from12, to) {
288412
+ return from12.pipe(to);
286069
288413
  }
286070
288414
  function popCallback(streams) {
286071
288415
  if (!streams.length) return noop3;
@@ -286967,7 +289311,7 @@ var init_helpers2 = __esm({
286967
289311
  projectId: payload.projectId,
286968
289312
  route: cmd.route || payload.route || "",
286969
289313
  buildBashScript: cmd.buildBashScript || await (0, import_rxjs13.lastValueFrom)(ReadFile2(cmd.script || payload.script)) || "",
286970
- config: cmd.config || payload.config || "",
289314
+ configs: cmd.configs || payload.configs || [],
286971
289315
  env: cmd.env || payload.env || "nodejs",
286972
289316
  method: cmd.method || payload.method || ["GET"],
286973
289317
  packageJson: cmd.packageJson || await (0, import_rxjs13.lastValueFrom)(ReadFile2(cmd.package || payload.package)) || "{}",
@@ -309266,17 +311610,17 @@ var require_codegen = __commonJS({
309266
311610
  }
309267
311611
  };
309268
311612
  var ForRange = class extends For {
309269
- constructor(varKind, name2, from11, to) {
311613
+ constructor(varKind, name2, from12, to) {
309270
311614
  super();
309271
311615
  this.varKind = varKind;
309272
311616
  this.name = name2;
309273
- this.from = from11;
311617
+ this.from = from12;
309274
311618
  this.to = to;
309275
311619
  }
309276
311620
  render(opts) {
309277
311621
  const varKind = opts.es5 ? scope_1.varKinds.var : this.varKind;
309278
- const { name: name2, from: from11, to } = this;
309279
- return `for(${varKind} ${name2}=${from11}; ${name2}<${to}; ${name2}++)` + super.render(opts);
311622
+ const { name: name2, from: from12, to } = this;
311623
+ return `for(${varKind} ${name2}=${from12}; ${name2}<${to}; ${name2}++)` + super.render(opts);
309280
311624
  }
309281
311625
  get names() {
309282
311626
  const names = addExprNames(super.names, this.from);
@@ -309495,9 +311839,9 @@ var require_codegen = __commonJS({
309495
311839
  return this._for(new ForLoop(iteration), forBody);
309496
311840
  }
309497
311841
  // `for` statement for a range of values
309498
- forRange(nameOrPrefix, from11, to, forBody, varKind = this.opts.es5 ? scope_1.varKinds.var : scope_1.varKinds.let) {
311842
+ forRange(nameOrPrefix, from12, to, forBody, varKind = this.opts.es5 ? scope_1.varKinds.var : scope_1.varKinds.let) {
309499
311843
  const name2 = this._scope.toName(nameOrPrefix);
309500
- return this._for(new ForRange(varKind, name2, from11, to), () => forBody(name2));
311844
+ return this._for(new ForRange(varKind, name2, from12, to), () => forBody(name2));
309501
311845
  }
309502
311846
  // `for-of` statement (in es5 mode replace with a normal for loop)
309503
311847
  forOf(nameOrPrefix, iterable, forBody, varKind = scope_1.varKinds.const) {
@@ -309636,13 +311980,13 @@ var require_codegen = __commonJS({
309636
311980
  }
309637
311981
  };
309638
311982
  exports2.CodeGen = CodeGen;
309639
- function addNames(names, from11) {
309640
- for (const n in from11)
309641
- names[n] = (names[n] || 0) + (from11[n] || 0);
311983
+ function addNames(names, from12) {
311984
+ for (const n in from12)
311985
+ names[n] = (names[n] || 0) + (from12[n] || 0);
309642
311986
  return names;
309643
311987
  }
309644
- function addExprNames(names, from11) {
309645
- return from11 instanceof code_1._CodeOrName ? addNames(names, from11.names) : names;
311988
+ function addExprNames(names, from12) {
311989
+ return from12 instanceof code_1._CodeOrName ? addNames(names, from12.names) : names;
309646
311990
  }
309647
311991
  function optimizeExpr(expr, names, constants) {
309648
311992
  if (expr instanceof code_1.Name)
@@ -309669,9 +312013,9 @@ var require_codegen = __commonJS({
309669
312013
  return e2 instanceof code_1._Code && e2._items.some((c) => c instanceof code_1.Name && names[c.str] === 1 && constants[c.str] !== void 0);
309670
312014
  }
309671
312015
  }
309672
- function subtractNames(names, from11) {
309673
- for (const n in from11)
309674
- names[n] = (names[n] || 0) - (from11[n] || 0);
312016
+ function subtractNames(names, from12) {
312017
+ for (const n in from12)
312018
+ names[n] = (names[n] || 0) - (from12[n] || 0);
309675
312019
  }
309676
312020
  function not(x2) {
309677
312021
  return typeof x2 == "boolean" || typeof x2 == "number" || x2 === null ? !x2 : (0, code_1._)`!${par(x2)}`;
@@ -309789,31 +312133,31 @@ var require_util5 = __commonJS({
309789
312133
  }
309790
312134
  exports2.eachItem = eachItem;
309791
312135
  function makeMergeEvaluated({ mergeNames, mergeToName, mergeValues: mergeValues3, resultToName }) {
309792
- return (gen, from11, to, toName) => {
309793
- 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);
312136
+ return (gen, from12, to, toName) => {
312137
+ 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);
309794
312138
  return toName === codegen_1.Name && !(res instanceof codegen_1.Name) ? resultToName(gen, res) : res;
309795
312139
  };
309796
312140
  }
309797
312141
  exports2.mergeEvaluated = {
309798
312142
  props: makeMergeEvaluated({
309799
- mergeNames: (gen, from11, to) => gen.if((0, codegen_1._)`${to} !== true && ${from11} !== undefined`, () => {
309800
- 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})`));
312143
+ mergeNames: (gen, from12, to) => gen.if((0, codegen_1._)`${to} !== true && ${from12} !== undefined`, () => {
312144
+ 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})`));
309801
312145
  }),
309802
- mergeToName: (gen, from11, to) => gen.if((0, codegen_1._)`${to} !== true`, () => {
309803
- if (from11 === true) {
312146
+ mergeToName: (gen, from12, to) => gen.if((0, codegen_1._)`${to} !== true`, () => {
312147
+ if (from12 === true) {
309804
312148
  gen.assign(to, true);
309805
312149
  } else {
309806
312150
  gen.assign(to, (0, codegen_1._)`${to} || {}`);
309807
- setEvaluated(gen, to, from11);
312151
+ setEvaluated(gen, to, from12);
309808
312152
  }
309809
312153
  }),
309810
- mergeValues: (from11, to) => from11 === true ? true : { ...from11, ...to },
312154
+ mergeValues: (from12, to) => from12 === true ? true : { ...from12, ...to },
309811
312155
  resultToName: evaluatedPropsToName
309812
312156
  }),
309813
312157
  items: makeMergeEvaluated({
309814
- 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}`)),
309815
- mergeToName: (gen, from11, to) => gen.if((0, codegen_1._)`${to} !== true`, () => gen.assign(to, from11 === true ? true : (0, codegen_1._)`${to} > ${from11} ? ${to} : ${from11}`)),
309816
- mergeValues: (from11, to) => from11 === true ? true : Math.max(from11, to),
312158
+ 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}`)),
312159
+ mergeToName: (gen, from12, to) => gen.if((0, codegen_1._)`${to} !== true`, () => gen.assign(to, from12 === true ? true : (0, codegen_1._)`${to} > ${from12} ? ${to} : ${from12}`)),
312160
+ mergeValues: (from12, to) => from12 === true ? true : Math.max(from12, to),
309817
312161
  resultToName: (gen, items) => gen.var("items", items)
309818
312162
  })
309819
312163
  };
@@ -318888,23 +321232,26 @@ var tempBinaryPath = import_node_path.default.join(
318888
321232
  import_node_os.default.tmpdir(),
318889
321233
  "esbuild-gcli-" + import_node_os.default.userInfo().username
318890
321234
  );
318891
- if (typeof import_node_sea.isSea === "function" && (0, import_node_sea.isSea)()) {
318892
- try {
318893
- const assetArrayBuffer = (0, import_node_sea.getAsset)("esbuild-native");
318894
- if (assetArrayBuffer) {
318895
- const assetBuffer = Buffer.from(assetArrayBuffer);
318896
- if (!(0, import_node_fs3.existsSync)(tempBinaryPath)) {
318897
- (0, import_node_fs3.writeFileSync)(tempBinaryPath, assetBuffer, { mode: 493 });
321235
+ var isWebContainer = !!process.versions.webcontainer;
321236
+ if (!isWebContainer) {
321237
+ if (typeof import_node_sea.isSea === "function" && (0, import_node_sea.isSea)()) {
321238
+ try {
321239
+ const assetArrayBuffer = (0, import_node_sea.getAsset)("esbuild-native");
321240
+ if (assetArrayBuffer) {
321241
+ const assetBuffer = Buffer.from(assetArrayBuffer);
321242
+ if (!(0, import_node_fs3.existsSync)(tempBinaryPath)) {
321243
+ (0, import_node_fs3.writeFileSync)(tempBinaryPath, assetBuffer, { mode: 493 });
321244
+ }
321245
+ process.env.ESBUILD_BINARY_PATH = tempBinaryPath;
321246
+ }
321247
+ } catch (e2) {
321248
+ if (e2.code !== "ERR_NOT_IN_SINGLE_EXECUTABLE_APPLICATION") {
321249
+ console.error("SEA Initialization Error:", e2);
318898
321250
  }
318899
- process.env.ESBUILD_BINARY_PATH = tempBinaryPath;
318900
- }
318901
- } catch (e2) {
318902
- if (e2.code !== "ERR_NOT_IN_SINGLE_EXECUTABLE_APPLICATION") {
318903
- console.error("SEA Initialization Error:", e2);
318904
321251
  }
321252
+ } else {
321253
+ process.env.ESBUILD_BINARY_PATH = import_node_path.default.join(__dirname, "esbuild");
318905
321254
  }
318906
- } else {
318907
- process.env.ESBUILD_BINARY_PATH = import_node_path.default.join(__dirname, "esbuild");
318908
321255
  }
318909
321256
  var main = (argv) => {
318910
321257
  import_commander.program.name("gcli").version("0.0.1");