@rstest/core 0.9.5 → 0.9.6

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.
@@ -1,4 +1,4 @@
1
- import { __webpack_require__ } from "./rslib-runtime.js";
1
+ import { __webpack_require__ } from "./723.js";
2
2
  import "./723.js";
3
3
  __webpack_require__.add({
4
4
  "../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/called-in-order.js" (module, __unused_rspack_exports, __webpack_require__) {
@@ -183,7 +183,7 @@ __webpack_require__.add({
183
183
  }
184
184
  module.exports = valueToString;
185
185
  },
186
- "../../node_modules/.pnpm/@sinonjs+fake-timers@15.1.1/node_modules/@sinonjs/fake-timers/src/fake-timers-src.js" (__unused_rspack_module, exports, __webpack_require__) {
186
+ "../../node_modules/.pnpm/@sinonjs+fake-timers@15.2.0/node_modules/@sinonjs/fake-timers/src/fake-timers-src.js" (__unused_rspack_module, exports, __webpack_require__) {
187
187
  const globalObject = __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/index.js").global;
188
188
  let timersModule, timersPromisesModule;
189
189
  try {
@@ -220,11 +220,11 @@ __webpack_require__.add({
220
220
  isPresent.performance = _global.performance && "function" == typeof _global.performance.now;
221
221
  const hasPerformancePrototype = _global.Performance && (typeof _global.Performance).match(/^(function|object)$/);
222
222
  const hasPerformanceConstructorPrototype = _global.performance && _global.performance.constructor && _global.performance.constructor.prototype;
223
- isPresent.queueMicrotask = _global.hasOwnProperty("queueMicrotask");
223
+ isPresent.queueMicrotask = Object.prototype.hasOwnProperty.call(_global, "queueMicrotask");
224
224
  isPresent.requestAnimationFrame = _global.requestAnimationFrame && "function" == typeof _global.requestAnimationFrame;
225
225
  isPresent.cancelAnimationFrame = _global.cancelAnimationFrame && "function" == typeof _global.cancelAnimationFrame;
226
226
  isPresent.requestIdleCallback = _global.requestIdleCallback && "function" == typeof _global.requestIdleCallback;
227
- isPresent.cancelIdleCallbackPresent = _global.cancelIdleCallback && "function" == typeof _global.cancelIdleCallback;
227
+ isPresent.cancelIdleCallback = _global.cancelIdleCallback && "function" == typeof _global.cancelIdleCallback;
228
228
  isPresent.setImmediate = _global.setImmediate && "function" == typeof _global.setImmediate;
229
229
  isPresent.clearImmediate = _global.clearImmediate && "function" == typeof _global.clearImmediate;
230
230
  isPresent.Intl = _global.Intl && "object" == typeof _global.Intl;
@@ -232,6 +232,7 @@ __webpack_require__.add({
232
232
  const NativeDate = _global.Date;
233
233
  const NativeIntl = isPresent.Intl ? Object.defineProperties(Object.create(null), Object.getOwnPropertyDescriptors(_global.Intl)) : void 0;
234
234
  let uniqueTimerId = idCounterStart;
235
+ let uniqueTimerOrder = 0;
235
236
  if (void 0 === NativeDate) throw new Error("The global scope doesn't have a `Date` object (see https://github.com/sinonjs/sinon/issues/1852#issuecomment-419622780)");
236
237
  isPresent.Date = true;
237
238
  class FakePerformanceEntry {
@@ -392,52 +393,63 @@ __webpack_require__.add({
392
393
  }
393
394
  function addTimer(clock, timer) {
394
395
  if (void 0 === timer.func) throw new Error("Callback must be provided to timer calls");
395
- if (addTimerReturnsObject) {
396
- if ("function" != typeof timer.func) throw new TypeError(`[ERR_INVALID_CALLBACK]: Callback must be a function. Received ${timer.func} of type ${typeof timer.func}`);
397
- }
396
+ if ("function" != typeof timer.func) throw new TypeError(`[ERR_INVALID_CALLBACK]: Callback must be a function. Received ${timer.func} of type ${typeof timer.func}`);
398
397
  if (isNearInfiniteLimit) timer.error = new Error();
399
398
  timer.type = timer.immediate ? "Immediate" : "Timeout";
400
- if (timer.hasOwnProperty("delay")) {
399
+ if (Object.prototype.hasOwnProperty.call(timer, "delay")) {
401
400
  if ("number" != typeof timer.delay) timer.delay = parseInt(timer.delay, 10);
402
401
  if (!isNumberFinite(timer.delay)) timer.delay = 0;
403
402
  timer.delay = timer.delay > maxTimeout ? 1 : timer.delay;
404
403
  timer.delay = Math.max(0, timer.delay);
405
404
  }
406
- if (timer.hasOwnProperty("interval")) {
405
+ if (Object.prototype.hasOwnProperty.call(timer, "interval")) {
407
406
  timer.type = "Interval";
408
407
  timer.interval = timer.interval > maxTimeout ? 1 : timer.interval;
409
408
  }
410
- if (timer.hasOwnProperty("animation")) {
409
+ if (Object.prototype.hasOwnProperty.call(timer, "animation")) {
411
410
  timer.type = "AnimationFrame";
412
411
  timer.animation = true;
413
412
  }
414
- if (timer.hasOwnProperty("idleCallback")) {
415
- timer.type = "IdleCallback";
416
- timer.idleCallback = true;
413
+ if (Object.prototype.hasOwnProperty.call(timer, "requestIdleCallback")) {
414
+ if (!timer.delay) timer.type = "IdleCallback";
415
+ timer.requestIdleCallback = true;
416
+ }
417
+ if (!clock.timers) {
418
+ clock.timers = {};
419
+ clock.timerHeap = new TimerHeap();
420
+ }
421
+ while(clock.timers && clock.timers[uniqueTimerId]){
422
+ uniqueTimerId++;
423
+ if (uniqueTimerId >= Number.MAX_SAFE_INTEGER) uniqueTimerId = idCounterStart;
417
424
  }
418
- if (!clock.timers) clock.timers = {};
419
425
  timer.id = uniqueTimerId++;
426
+ if (uniqueTimerId >= Number.MAX_SAFE_INTEGER) uniqueTimerId = idCounterStart;
427
+ timer.order = uniqueTimerOrder++;
420
428
  timer.createdAt = clock.now;
421
429
  timer.callAt = clock.now + (parseInt(timer.delay) || (clock.duringTick ? 1 : 0));
422
430
  clock.timers[timer.id] = timer;
431
+ clock.timerHeap.push(timer);
423
432
  if (addTimerReturnsObject) {
424
433
  const res = {
425
434
  refed: true,
426
435
  ref: function() {
427
436
  this.refed = true;
428
- return res;
437
+ return this;
429
438
  },
430
439
  unref: function() {
431
440
  this.refed = false;
432
- return res;
441
+ return this;
433
442
  },
434
443
  hasRef: function() {
435
444
  return this.refed;
436
445
  },
437
446
  refresh: function() {
438
447
  timer.callAt = clock.now + (parseInt(timer.delay) || (clock.duringTick ? 1 : 0));
448
+ clock.timerHeap.remove(timer);
449
+ timer.order = uniqueTimerOrder++;
439
450
  clock.timers[timer.id] = timer;
440
- return res;
451
+ clock.timerHeap.push(timer);
452
+ return this;
441
453
  },
442
454
  [Symbol.toPrimitive]: function() {
443
455
  return timer.id;
@@ -448,53 +460,124 @@ __webpack_require__.add({
448
460
  return timer.id;
449
461
  }
450
462
  function compareTimers(a, b) {
463
+ if ("IdleCallback" === a.type && "IdleCallback" !== b.type) return 1;
464
+ if ("IdleCallback" !== a.type && "IdleCallback" === b.type) return -1;
451
465
  if (a.callAt < b.callAt) return -1;
452
466
  if (a.callAt > b.callAt) return 1;
453
467
  if (a.immediate && !b.immediate) return -1;
454
468
  if (!a.immediate && b.immediate) return 1;
469
+ if (a.order < b.order) return -1;
470
+ if (a.order > b.order) return 1;
455
471
  if (a.createdAt < b.createdAt) return -1;
456
472
  if (a.createdAt > b.createdAt) return 1;
457
473
  if (a.id < b.id) return -1;
458
474
  if (a.id > b.id) return 1;
475
+ return 0;
476
+ }
477
+ function TimerHeap() {
478
+ this.timers = [];
459
479
  }
480
+ TimerHeap.prototype.peek = function() {
481
+ return this.timers[0];
482
+ };
483
+ TimerHeap.prototype.push = function(timer) {
484
+ this.timers.push(timer);
485
+ this.bubbleUp(this.timers.length - 1);
486
+ };
487
+ TimerHeap.prototype.pop = function() {
488
+ if (0 === this.timers.length) return;
489
+ const first = this.timers[0];
490
+ const last = this.timers.pop();
491
+ if (this.timers.length > 0) {
492
+ this.timers[0] = last;
493
+ last.heapIndex = 0;
494
+ this.bubbleDown(0);
495
+ }
496
+ delete first.heapIndex;
497
+ return first;
498
+ };
499
+ TimerHeap.prototype.remove = function(timer) {
500
+ const index = timer.heapIndex;
501
+ if (void 0 === index || this.timers[index] !== timer) return false;
502
+ const last = this.timers.pop();
503
+ if (timer !== last) {
504
+ this.timers[index] = last;
505
+ last.heapIndex = index;
506
+ if (compareTimers(last, timer) < 0) this.bubbleUp(index);
507
+ else this.bubbleDown(index);
508
+ }
509
+ delete timer.heapIndex;
510
+ return true;
511
+ };
512
+ TimerHeap.prototype.bubbleUp = function(index) {
513
+ const timer = this.timers[index];
514
+ let currentIndex = index;
515
+ while(currentIndex > 0){
516
+ const parentIndex = Math.floor((currentIndex - 1) / 2);
517
+ const parent = this.timers[parentIndex];
518
+ if (compareTimers(timer, parent) < 0) {
519
+ this.timers[currentIndex] = parent;
520
+ parent.heapIndex = currentIndex;
521
+ currentIndex = parentIndex;
522
+ } else break;
523
+ }
524
+ this.timers[currentIndex] = timer;
525
+ timer.heapIndex = currentIndex;
526
+ };
527
+ TimerHeap.prototype.bubbleDown = function(index) {
528
+ const timer = this.timers[index];
529
+ let currentIndex = index;
530
+ const halfLength = Math.floor(this.timers.length / 2);
531
+ while(currentIndex < halfLength){
532
+ const leftIndex = 2 * currentIndex + 1;
533
+ const rightIndex = leftIndex + 1;
534
+ let bestChildIndex = leftIndex;
535
+ let bestChild = this.timers[leftIndex];
536
+ if (rightIndex < this.timers.length && compareTimers(this.timers[rightIndex], bestChild) < 0) {
537
+ bestChildIndex = rightIndex;
538
+ bestChild = this.timers[rightIndex];
539
+ }
540
+ if (compareTimers(bestChild, timer) < 0) {
541
+ this.timers[currentIndex] = bestChild;
542
+ bestChild.heapIndex = currentIndex;
543
+ currentIndex = bestChildIndex;
544
+ } else break;
545
+ }
546
+ this.timers[currentIndex] = timer;
547
+ timer.heapIndex = currentIndex;
548
+ };
460
549
  function firstTimerInRange(clock, from, to) {
461
- const timers = clock.timers;
550
+ if (!clock.timerHeap) return null;
551
+ const timers = clock.timerHeap.timers;
552
+ if (1 === timers.length && timers[0].requestIdleCallback) return timers[0];
553
+ const first = clock.timerHeap.peek();
554
+ if (first && inRange(from, to, first)) return first;
462
555
  let timer = null;
463
- let id, isInRange;
464
- for(id in timers)if (timers.hasOwnProperty(id)) {
465
- isInRange = inRange(from, to, timers[id]);
466
- if (isInRange && (!timer || 1 === compareTimers(timer, timers[id]))) timer = timers[id];
467
- }
556
+ for(let i = 0; i < timers.length; i++)if (inRange(from, to, timers[i]) && (!timer || 1 === compareTimers(timer, timers[i]))) timer = timers[i];
468
557
  return timer;
469
558
  }
470
559
  function firstTimer(clock) {
471
- const timers = clock.timers;
472
- let timer = null;
473
- let id;
474
- for(id in timers)if (timers.hasOwnProperty(id)) {
475
- if (!timer || 1 === compareTimers(timer, timers[id])) timer = timers[id];
476
- }
477
- return timer;
560
+ if (!clock.timerHeap) return null;
561
+ return clock.timerHeap.peek() || null;
478
562
  }
479
563
  function lastTimer(clock) {
480
- const timers = clock.timers;
564
+ if (!clock.timerHeap) return null;
565
+ const timers = clock.timerHeap.timers;
481
566
  let timer = null;
482
- let id;
483
- for(id in timers)if (timers.hasOwnProperty(id)) {
484
- if (!timer || -1 === compareTimers(timer, timers[id])) timer = timers[id];
485
- }
567
+ for(let i = 0; i < timers.length; i++)if (!timer || -1 === compareTimers(timer, timers[i])) timer = timers[i];
486
568
  return timer;
487
569
  }
488
570
  function callTimer(clock, timer) {
489
- if ("number" == typeof timer.interval) clock.timers[timer.id].callAt += timer.interval;
490
- else delete clock.timers[timer.id];
491
- if ("function" == typeof timer.func) timer.func.apply(null, timer.args);
492
- else {
493
- const eval2 = eval;
494
- (function() {
495
- eval2(timer.func);
496
- })();
571
+ if ("number" == typeof timer.interval) {
572
+ clock.timerHeap.remove(timer);
573
+ timer.callAt += timer.interval;
574
+ timer.order = uniqueTimerOrder++;
575
+ clock.timerHeap.push(timer);
576
+ } else {
577
+ delete clock.timers[timer.id];
578
+ clock.timerHeap.remove(timer);
497
579
  }
580
+ if ("function" == typeof timer.func) timer.func.apply(null, timer.args);
498
581
  }
499
582
  function getClearHandler(ttype) {
500
583
  if ("IdleCallback" === ttype || "AnimationFrame" === ttype) return `cancel${ttype}`;
@@ -524,10 +607,12 @@ __webpack_require__.add({
524
607
  const stackTrace = new Error().stack.split("\n").slice(1).join("\n");
525
608
  warnOnce(`FakeTimers: ${handlerName} was invoked to clear a native timer instead of one created by this library.\nTo automatically clean-up native timers, use \`shouldClearNativeTimers\`.\n${stackTrace}`);
526
609
  }
527
- if (clock.timers.hasOwnProperty(id)) {
610
+ if (Object.prototype.hasOwnProperty.call(clock.timers, id)) {
528
611
  const timer = clock.timers[id];
529
- if (timer.type === ttype || "Timeout" === timer.type && "Interval" === ttype || "Interval" === timer.type && "Timeout" === ttype) delete clock.timers[id];
530
- else {
612
+ if (timer.type === ttype || "Timeout" === timer.type && "Interval" === ttype || "Interval" === timer.type && "Timeout" === ttype) {
613
+ delete clock.timers[id];
614
+ clock.timerHeap.remove(timer);
615
+ } else {
531
616
  const clear = getClearHandler(ttype);
532
617
  const schedule = getScheduleHandler(timer.type);
533
618
  throw new Error(`Cannot clear timer: timer created with ${schedule}() but cleared with ${clear}()`);
@@ -546,7 +631,7 @@ __webpack_require__.add({
546
631
  const originalPerfDescriptor = Object.getOwnPropertyDescriptor(clock, `_${method}`);
547
632
  if (originalPerfDescriptor && originalPerfDescriptor.get && !originalPerfDescriptor.set) Object.defineProperty(_global, method, originalPerfDescriptor);
548
633
  else if (originalPerfDescriptor.configurable) _global[method] = clock[`_${method}`];
549
- } else if (_global[method] && _global[method].hadOwnProperty) _global[method] = clock[`_${method}`];
634
+ } else if (clock[method] && clock[method].hasOwnProperty) _global[method] = clock[`_${method}`];
550
635
  else try {
551
636
  delete _global[method];
552
637
  } catch (ignore) {}
@@ -565,13 +650,11 @@ __webpack_require__.add({
565
650
  signal.removeEventListener("abort", listener);
566
651
  clock.abortListenerMap.delete(listener);
567
652
  }
568
- if (!clock.timers) return [];
569
- return Object.keys(clock.timers).map(function mapper(key) {
570
- return clock.timers[key];
571
- });
653
+ if (!clock.timerHeap) return [];
654
+ return clock.timerHeap.timers.slice();
572
655
  }
573
656
  function hijackMethod(target, method, clock) {
574
- clock[method].hadOwnProperty = Object.prototype.hasOwnProperty.call(target, method);
657
+ clock[method].hasOwnProperty = Object.prototype.hasOwnProperty.call(target, method);
575
658
  clock[`_${method}`] = target[method];
576
659
  if ("Date" === method) target[method] = clock[method];
577
660
  else if ("Intl" === method) target[method] = clock[method];
@@ -719,14 +802,23 @@ __webpack_require__.add({
719
802
  });
720
803
  });
721
804
  }
722
- clock.requestIdleCallback = function requestIdleCallback(func, timeout) {
805
+ function getTimeToNextIdlePeriod() {
723
806
  let timeToNextIdlePeriod = 0;
724
807
  if (clock.countTimers() > 0) timeToNextIdlePeriod = 50;
808
+ return timeToNextIdlePeriod;
809
+ }
810
+ clock.requestIdleCallback = function requestIdleCallback(func, { timeout } = {}) {
811
+ const idleDeadline = {
812
+ didTimeout: true,
813
+ timeRemaining: getTimeToNextIdlePeriod
814
+ };
725
815
  const result = addTimer(clock, {
726
816
  func: func,
727
- args: Array.prototype.slice.call(arguments, 2),
728
- delay: void 0 === timeout ? timeToNextIdlePeriod : Math.min(timeout, timeToNextIdlePeriod),
729
- idleCallback: true
817
+ args: [
818
+ idleDeadline
819
+ ],
820
+ delay: timeout,
821
+ requestIdleCallback: true
730
822
  });
731
823
  return Number(result);
732
824
  };
@@ -800,7 +892,7 @@ __webpack_require__.add({
800
892
  };
801
893
  }
802
894
  clock.countTimers = function countTimers() {
803
- return Object.keys(clock.timers || {}).length + (clock.jobs || []).length;
895
+ return (clock.timerHeap ? clock.timerHeap.timers.length : 0) + (clock.jobs || []).length;
804
896
  };
805
897
  clock.requestAnimationFrame = function requestAnimationFrame(func) {
806
898
  const result = addTimer(clock, {
@@ -965,7 +1057,7 @@ __webpack_require__.add({
965
1057
  resetIsNearInfiniteLimit();
966
1058
  return clock.now;
967
1059
  }
968
- numTimers = Object.keys(clock.timers).length;
1060
+ numTimers = clock.timerHeap.timers.length;
969
1061
  if (0 === numTimers) {
970
1062
  resetIsNearInfiniteLimit();
971
1063
  return clock.now;
@@ -988,12 +1080,12 @@ __webpack_require__.add({
988
1080
  runJobs(clock);
989
1081
  let numTimers;
990
1082
  if (i < clock.loopLimit) {
991
- if (!clock.timers) {
1083
+ if (!clock.timerHeap) {
992
1084
  resetIsNearInfiniteLimit();
993
1085
  resolve(clock.now);
994
1086
  return;
995
1087
  }
996
- numTimers = Object.keys(clock.timers).length;
1088
+ numTimers = clock.timerHeap.timers.length;
997
1089
  if (0 === numTimers) {
998
1090
  resetIsNearInfiniteLimit();
999
1091
  resolve(clock.now);
@@ -1042,6 +1134,7 @@ __webpack_require__.add({
1042
1134
  clock.reset = function reset() {
1043
1135
  nanos = 0;
1044
1136
  clock.timers = {};
1137
+ clock.timerHeap = new TimerHeap();
1045
1138
  clock.jobs = [];
1046
1139
  clock.now = start;
1047
1140
  };
@@ -1053,7 +1146,7 @@ __webpack_require__.add({
1053
1146
  adjustedSystemTime[1] = adjustedSystemTime[1] + nanos;
1054
1147
  clock.now = newNow;
1055
1148
  nanos = 0;
1056
- for(id in clock.timers)if (clock.timers.hasOwnProperty(id)) {
1149
+ for(id in clock.timers)if (Object.prototype.hasOwnProperty.call(clock.timers, id)) {
1057
1150
  timer = clock.timers[id];
1058
1151
  timer.createdAt += difference;
1059
1152
  timer.callAt += difference;
@@ -1062,8 +1155,13 @@ __webpack_require__.add({
1062
1155
  clock.jump = function jump(tickValue) {
1063
1156
  const msFloat = "number" == typeof tickValue ? tickValue : parseTime(tickValue);
1064
1157
  const ms = Math.floor(msFloat);
1065
- for (const timer of Object.values(clock.timers))if (clock.now + ms > timer.callAt) timer.callAt = clock.now + ms;
1158
+ if (clock.timers) {
1159
+ for (const timer of Object.values(clock.timers))if (clock.now + ms > timer.callAt) timer.callAt = clock.now + ms;
1160
+ clock.timerHeap = new TimerHeap();
1161
+ for (const timer of Object.values(clock.timers))clock.timerHeap.push(timer);
1162
+ }
1066
1163
  clock.tick(ms);
1164
+ return clock.now;
1067
1165
  };
1068
1166
  if (isPresent.performance) {
1069
1167
  clock.performance = Object.create(null);
@@ -1084,6 +1182,9 @@ __webpack_require__.add({
1084
1182
  config.shouldAdvanceTime = config.shouldAdvanceTime || false;
1085
1183
  config.advanceTimeDelta = config.advanceTimeDelta || 20;
1086
1184
  config.shouldClearNativeTimers = config.shouldClearNativeTimers || false;
1185
+ const hasToFake = Object.prototype.hasOwnProperty.call(config, "toFake");
1186
+ const hasToNotFake = Object.prototype.hasOwnProperty.call(config, "toNotFake");
1187
+ if (hasToFake && hasToNotFake) throw new TypeError("config.toFake and config.toNotFake cannot be used together");
1087
1188
  if (config.target) throw new TypeError("config.target is no longer supported. Use `withGlobal(target)` instead.");
1088
1189
  function handleMissingTimer(timer) {
1089
1190
  if (config.ignoreMissingTimers) return;
@@ -1096,8 +1197,13 @@ __webpack_require__.add({
1096
1197
  return uninstall(clock);
1097
1198
  };
1098
1199
  clock.abortListenerMap = new Map();
1099
- clock.methods = config.toFake || [];
1100
- if (0 === clock.methods.length) clock.methods = Object.keys(timers);
1200
+ if (hasToFake) {
1201
+ clock.methods = config.toFake || [];
1202
+ if (0 === clock.methods.length) clock.methods = Object.keys(timers);
1203
+ } else if (hasToNotFake) {
1204
+ const methodsToNotFake = config.toNotFake || [];
1205
+ clock.methods = Object.keys(timers).filter((method)=>!methodsToNotFake.includes(method));
1206
+ } else clock.methods = Object.keys(timers);
1101
1207
  if (true === config.shouldAdvanceTime) clock.setTickMode({
1102
1208
  mode: "interval",
1103
1209
  delta: config.advanceTimeDelta
@@ -1539,7 +1645,7 @@ __webpack_require__.add({
1539
1645
  var process = __webpack_require__("../../node_modules/.pnpm/process@0.11.10/node_modules/process/browser.js");
1540
1646
  const RealDate = Date;
1541
1647
  const loadFakeTimersModule = ()=>{
1542
- const loaded = __webpack_require__("../../node_modules/.pnpm/@sinonjs+fake-timers@15.1.1/node_modules/@sinonjs/fake-timers/src/fake-timers-src.js");
1648
+ const loaded = __webpack_require__("../../node_modules/.pnpm/@sinonjs+fake-timers@15.2.0/node_modules/@sinonjs/fake-timers/src/fake-timers-src.js");
1543
1649
  return {
1544
1650
  withGlobal: loaded.withGlobal
1545
1651
  };
@@ -1619,6 +1725,7 @@ class FakeTimers {
1619
1725
  ignoreMissingTimers: true,
1620
1726
  ...fakeTimersConfig
1621
1727
  });
1728
+ this._clock.reset();
1622
1729
  this._fakingTime = true;
1623
1730
  }
1624
1731
  reset() {
@@ -1,12 +1,5 @@
1
- import { __webpack_require__ } from "./rslib-runtime.js";
1
+ import { __webpack_require__ } from "./723.js";
2
2
  import "./723.js";
3
- var magic_string_es_namespaceObject = {};
4
- __webpack_require__.r(magic_string_es_namespaceObject);
5
- __webpack_require__.d(magic_string_es_namespaceObject, {
6
- Bundle: ()=>Bundle,
7
- SourceMap: ()=>SourceMap,
8
- default: ()=>MagicString
9
- });
10
3
  var Buffer = __webpack_require__("../../node_modules/.pnpm/buffer@5.7.1/node_modules/buffer/index.js")["Buffer"];
11
4
  var comma = ",".charCodeAt(0);
12
5
  var semicolon = ";".charCodeAt(0);
@@ -1033,184 +1026,5 @@ class MagicString {
1033
1026
  return this._replaceRegexp(searchValue, replacement);
1034
1027
  }
1035
1028
  }
1036
- const hasOwnProp = Object.prototype.hasOwnProperty;
1037
- class Bundle {
1038
- constructor(options = {}){
1039
- this.intro = options.intro || '';
1040
- this.separator = void 0 !== options.separator ? options.separator : '\n';
1041
- this.sources = [];
1042
- this.uniqueSources = [];
1043
- this.uniqueSourceIndexByFilename = {};
1044
- }
1045
- addSource(source) {
1046
- if (source instanceof MagicString) return this.addSource({
1047
- content: source,
1048
- filename: source.filename,
1049
- separator: this.separator
1050
- });
1051
- if (!isObject(source) || !source.content) throw new Error('bundle.addSource() takes an object with a `content` property, which should be an instance of MagicString, and an optional `filename`');
1052
- [
1053
- 'filename',
1054
- 'ignoreList',
1055
- 'indentExclusionRanges',
1056
- 'separator'
1057
- ].forEach((option)=>{
1058
- if (!hasOwnProp.call(source, option)) source[option] = source.content[option];
1059
- });
1060
- if (void 0 === source.separator) source.separator = this.separator;
1061
- if (source.filename) if (hasOwnProp.call(this.uniqueSourceIndexByFilename, source.filename)) {
1062
- const uniqueSource = this.uniqueSources[this.uniqueSourceIndexByFilename[source.filename]];
1063
- if (source.content.original !== uniqueSource.content) throw new Error(`Illegal source: same filename (${source.filename}), different contents`);
1064
- } else {
1065
- this.uniqueSourceIndexByFilename[source.filename] = this.uniqueSources.length;
1066
- this.uniqueSources.push({
1067
- filename: source.filename,
1068
- content: source.content.original
1069
- });
1070
- }
1071
- this.sources.push(source);
1072
- return this;
1073
- }
1074
- append(str, options) {
1075
- this.addSource({
1076
- content: new MagicString(str),
1077
- separator: options && options.separator || ''
1078
- });
1079
- return this;
1080
- }
1081
- clone() {
1082
- const bundle = new Bundle({
1083
- intro: this.intro,
1084
- separator: this.separator
1085
- });
1086
- this.sources.forEach((source)=>{
1087
- bundle.addSource({
1088
- filename: source.filename,
1089
- content: source.content.clone(),
1090
- separator: source.separator
1091
- });
1092
- });
1093
- return bundle;
1094
- }
1095
- generateDecodedMap(options = {}) {
1096
- const names = [];
1097
- let x_google_ignoreList;
1098
- this.sources.forEach((source)=>{
1099
- Object.keys(source.content.storedNames).forEach((name)=>{
1100
- if (!~names.indexOf(name)) names.push(name);
1101
- });
1102
- });
1103
- const mappings = new Mappings(options.hires);
1104
- if (this.intro) mappings.advance(this.intro);
1105
- this.sources.forEach((source, i)=>{
1106
- if (i > 0) mappings.advance(this.separator);
1107
- const sourceIndex = source.filename ? this.uniqueSourceIndexByFilename[source.filename] : -1;
1108
- const magicString = source.content;
1109
- const locate = getLocator(magicString.original);
1110
- if (magicString.intro) mappings.advance(magicString.intro);
1111
- magicString.firstChunk.eachNext((chunk)=>{
1112
- const loc = locate(chunk.start);
1113
- if (chunk.intro.length) mappings.advance(chunk.intro);
1114
- if (source.filename) if (chunk.edited) mappings.addEdit(sourceIndex, chunk.content, loc, chunk.storeName ? names.indexOf(chunk.original) : -1);
1115
- else mappings.addUneditedChunk(sourceIndex, chunk, magicString.original, loc, magicString.sourcemapLocations);
1116
- else mappings.advance(chunk.content);
1117
- if (chunk.outro.length) mappings.advance(chunk.outro);
1118
- });
1119
- if (magicString.outro) mappings.advance(magicString.outro);
1120
- if (source.ignoreList && -1 !== sourceIndex) {
1121
- if (void 0 === x_google_ignoreList) x_google_ignoreList = [];
1122
- x_google_ignoreList.push(sourceIndex);
1123
- }
1124
- });
1125
- return {
1126
- file: options.file ? options.file.split(/[/\\]/).pop() : void 0,
1127
- sources: this.uniqueSources.map((source)=>options.file ? getRelativePath(options.file, source.filename) : source.filename),
1128
- sourcesContent: this.uniqueSources.map((source)=>options.includeContent ? source.content : null),
1129
- names,
1130
- mappings: mappings.raw,
1131
- x_google_ignoreList
1132
- };
1133
- }
1134
- generateMap(options) {
1135
- return new SourceMap(this.generateDecodedMap(options));
1136
- }
1137
- getIndentString() {
1138
- const indentStringCounts = {};
1139
- this.sources.forEach((source)=>{
1140
- const indentStr = source.content._getRawIndentString();
1141
- if (null === indentStr) return;
1142
- if (!indentStringCounts[indentStr]) indentStringCounts[indentStr] = 0;
1143
- indentStringCounts[indentStr] += 1;
1144
- });
1145
- return Object.keys(indentStringCounts).sort((a, b)=>indentStringCounts[a] - indentStringCounts[b])[0] || '\t';
1146
- }
1147
- indent(indentStr) {
1148
- if (!arguments.length) indentStr = this.getIndentString();
1149
- if ('' === indentStr) return this;
1150
- let trailingNewline = !this.intro || '\n' === this.intro.slice(-1);
1151
- this.sources.forEach((source, i)=>{
1152
- const separator = void 0 !== source.separator ? source.separator : this.separator;
1153
- const indentStart = trailingNewline || i > 0 && /\r?\n$/.test(separator);
1154
- source.content.indent(indentStr, {
1155
- exclude: source.indentExclusionRanges,
1156
- indentStart
1157
- });
1158
- trailingNewline = '\n' === source.content.lastChar();
1159
- });
1160
- if (this.intro) this.intro = indentStr + this.intro.replace(/^[^\n]/gm, (match, index)=>index > 0 ? indentStr + match : match);
1161
- return this;
1162
- }
1163
- prepend(str) {
1164
- this.intro = str + this.intro;
1165
- return this;
1166
- }
1167
- toString() {
1168
- const body = this.sources.map((source, i)=>{
1169
- const separator = void 0 !== source.separator ? source.separator : this.separator;
1170
- const str = (i > 0 ? separator : '') + source.content.toString();
1171
- return str;
1172
- }).join('');
1173
- return this.intro + body;
1174
- }
1175
- isEmpty() {
1176
- if (this.intro.length && this.intro.trim()) return false;
1177
- if (this.sources.some((source)=>!source.content.isEmpty())) return false;
1178
- return true;
1179
- }
1180
- length() {
1181
- return this.sources.reduce((length, source)=>length + source.content.length(), this.intro.length);
1182
- }
1183
- trimLines() {
1184
- return this.trim('[\\r\\n]');
1185
- }
1186
- trim(charType) {
1187
- return this.trimStart(charType).trimEnd(charType);
1188
- }
1189
- trimStart(charType) {
1190
- const rx = new RegExp('^' + (charType || '\\s') + '+');
1191
- this.intro = this.intro.replace(rx, '');
1192
- if (!this.intro) {
1193
- let source;
1194
- let i = 0;
1195
- do {
1196
- source = this.sources[i++];
1197
- if (!source) break;
1198
- }while (!source.content.trimStartAborted(charType))
1199
- }
1200
- return this;
1201
- }
1202
- trimEnd(charType) {
1203
- const rx = new RegExp((charType || '\\s') + '+$');
1204
- let source;
1205
- let i = this.sources.length - 1;
1206
- do {
1207
- source = this.sources[i--];
1208
- if (!source) {
1209
- this.intro = this.intro.replace(rx, '');
1210
- break;
1211
- }
1212
- }while (!source.content.trimEndAborted(charType))
1213
- return this;
1214
- }
1215
- }
1216
- export { magic_string_es_namespaceObject };
1029
+ Object.prototype.hasOwnProperty;
1030
+ export default MagicString;
@@ -1,5 +1,5 @@
1
1
  /*! LICENSE: 2~snapshot.js.LICENSE.txt */
2
- import { __webpack_require__ } from "./rslib-runtime.js";
2
+ import { __webpack_require__ } from "./723.js";
3
3
  import { dist_format, dist_plugins, getTaskNameWithPrefix, subsetEquality, pathe_M_eThtNZ_resolve, dist_equals, iterableEquality } from "./723.js";
4
4
  var snapshot_namespaceObject = {};
5
5
  __webpack_require__.r(snapshot_namespaceObject);
@@ -1260,7 +1260,7 @@ function offsetToLineNumber(source, offset) {
1260
1260
  return line + 1;
1261
1261
  }
1262
1262
  async function saveInlineSnapshots(environment, snapshots) {
1263
- const MagicString = (await import("./2~magic-string.es.js").then((m)=>m.magic_string_es_namespaceObject)).default;
1263
+ const MagicString = (await import("./2~magic-string.es.js")).default;
1264
1264
  const files = new Set(snapshots.map((i)=>i.file));
1265
1265
  await Promise.all(Array.from(files).map(async (file)=>{
1266
1266
  const snaps = snapshots.filter((i)=>i.file === file);