semantic-release-lerna 2.18.1 → 2.18.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +1499 -1508
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -2465,1411 +2465,559 @@ var require_semver2 = __commonJS({
2465
2465
  }
2466
2466
  });
2467
2467
 
2468
- // node_modules/hosted-git-info/node_modules/lru-cache/dist/commonjs/index.js
2469
- var require_commonjs = __commonJS({
2470
- "node_modules/hosted-git-info/node_modules/lru-cache/dist/commonjs/index.js"(exports) {
2468
+ // node_modules/hosted-git-info/node_modules/lru-cache/dist/commonjs/index.min.js
2469
+ var require_index_min = __commonJS({
2470
+ "node_modules/hosted-git-info/node_modules/lru-cache/dist/commonjs/index.min.js"(exports) {
2471
2471
  "use strict";
2472
2472
  Object.defineProperty(exports, "__esModule", { value: true });
2473
2473
  exports.LRUCache = void 0;
2474
- var defaultPerf = typeof performance === "object" && performance && typeof performance.now === "function" ? performance : Date;
2475
- var warned = /* @__PURE__ */ new Set();
2476
- var PROCESS = typeof process === "object" && !!process ? process : {};
2477
- var emitWarning = (msg, type2, code, fn) => {
2478
- typeof PROCESS.emitWarning === "function" ? PROCESS.emitWarning(msg, type2, code, fn) : console.error(`[${code}] ${type2}: ${msg}`);
2479
- };
2480
- var AC = globalThis.AbortController;
2481
- var AS = globalThis.AbortSignal;
2482
- if (typeof AC === "undefined") {
2483
- AS = class AbortSignal {
2474
+ var G = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date;
2475
+ var U = /* @__PURE__ */ new Set();
2476
+ var R = typeof process == "object" && process ? process : {};
2477
+ var I = (c3, t, e, i2) => {
2478
+ typeof R.emitWarning == "function" ? R.emitWarning(c3, t, e, i2) : console.error(`[${e}] ${t}: ${c3}`);
2479
+ };
2480
+ var C = globalThis.AbortController;
2481
+ var L = globalThis.AbortSignal;
2482
+ if (typeof C > "u") {
2483
+ L = class {
2484
2484
  onabort;
2485
2485
  _onabort = [];
2486
2486
  reason;
2487
2487
  aborted = false;
2488
- addEventListener(_, fn) {
2489
- this._onabort.push(fn);
2488
+ addEventListener(i2, s) {
2489
+ this._onabort.push(s);
2490
2490
  }
2491
- };
2492
- AC = class AbortController {
2491
+ }, C = class {
2493
2492
  constructor() {
2494
- warnACPolyfill();
2493
+ t();
2495
2494
  }
2496
- signal = new AS();
2497
- abort(reason) {
2498
- if (this.signal.aborted)
2499
- return;
2500
- this.signal.reason = reason;
2501
- this.signal.aborted = true;
2502
- for (const fn of this.signal._onabort) {
2503
- fn(reason);
2495
+ signal = new L();
2496
+ abort(i2) {
2497
+ if (!this.signal.aborted) {
2498
+ this.signal.reason = i2, this.signal.aborted = true;
2499
+ for (let s of this.signal._onabort) s(i2);
2500
+ this.signal.onabort?.(i2);
2504
2501
  }
2505
- this.signal.onabort?.(reason);
2506
2502
  }
2507
2503
  };
2508
- let printACPolyfillWarning = PROCESS.env?.LRU_CACHE_IGNORE_AC_WARNING !== "1";
2509
- const warnACPolyfill = () => {
2510
- if (!printACPolyfillWarning)
2511
- return;
2512
- printACPolyfillWarning = false;
2513
- emitWarning("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.", "NO_ABORT_CONTROLLER", "ENOTSUP", warnACPolyfill);
2504
+ let c3 = R.env?.LRU_CACHE_IGNORE_AC_WARNING !== "1", t = () => {
2505
+ c3 && (c3 = false, I("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.", "NO_ABORT_CONTROLLER", "ENOTSUP", t));
2514
2506
  };
2515
2507
  }
2516
- var shouldWarn = (code) => !warned.has(code);
2517
- var isPosInt = (n2) => n2 && n2 === Math.floor(n2) && n2 > 0 && isFinite(n2);
2518
- var getUintArray = (max) => !isPosInt(max) ? null : max <= Math.pow(2, 8) ? Uint8Array : max <= Math.pow(2, 16) ? Uint16Array : max <= Math.pow(2, 32) ? Uint32Array : max <= Number.MAX_SAFE_INTEGER ? ZeroArray : null;
2519
- var ZeroArray = class extends Array {
2520
- constructor(size) {
2521
- super(size);
2522
- this.fill(0);
2508
+ var x = (c3) => !U.has(c3);
2509
+ var y = (c3) => c3 && c3 === Math.floor(c3) && c3 > 0 && isFinite(c3);
2510
+ var M = (c3) => y(c3) ? c3 <= Math.pow(2, 8) ? Uint8Array : c3 <= Math.pow(2, 16) ? Uint16Array : c3 <= Math.pow(2, 32) ? Uint32Array : c3 <= Number.MAX_SAFE_INTEGER ? z : null : null;
2511
+ var z = class extends Array {
2512
+ constructor(t) {
2513
+ super(t), this.fill(0);
2523
2514
  }
2524
2515
  };
2525
- var Stack = class _Stack {
2516
+ var W = class c3 {
2526
2517
  heap;
2527
2518
  length;
2528
- // private constructor
2529
- static #constructing = false;
2530
- static create(max) {
2531
- const HeapCls = getUintArray(max);
2532
- if (!HeapCls)
2533
- return [];
2534
- _Stack.#constructing = true;
2535
- const s = new _Stack(max, HeapCls);
2536
- _Stack.#constructing = false;
2537
- return s;
2538
- }
2539
- constructor(max, HeapCls) {
2540
- if (!_Stack.#constructing) {
2541
- throw new TypeError("instantiate Stack using Stack.create(n)");
2542
- }
2543
- this.heap = new HeapCls(max);
2544
- this.length = 0;
2545
- }
2546
- push(n2) {
2547
- this.heap[this.length++] = n2;
2519
+ static #o = false;
2520
+ static create(t) {
2521
+ let e = M(t);
2522
+ if (!e) return [];
2523
+ c3.#o = true;
2524
+ let i2 = new c3(t, e);
2525
+ return c3.#o = false, i2;
2526
+ }
2527
+ constructor(t, e) {
2528
+ if (!c3.#o) throw new TypeError("instantiate Stack using Stack.create(n)");
2529
+ this.heap = new e(t), this.length = 0;
2530
+ }
2531
+ push(t) {
2532
+ this.heap[this.length++] = t;
2548
2533
  }
2549
2534
  pop() {
2550
2535
  return this.heap[--this.length];
2551
2536
  }
2552
2537
  };
2553
- var LRUCache = class _LRUCache {
2554
- // options that cannot be changed without disaster
2555
- #max;
2556
- #maxSize;
2557
- #dispose;
2558
- #onInsert;
2559
- #disposeAfter;
2560
- #fetchMethod;
2561
- #memoMethod;
2562
- #perf;
2563
- /**
2564
- * {@link LRUCache.OptionsBase.perf}
2565
- */
2538
+ var D = class c3 {
2539
+ #o;
2540
+ #c;
2541
+ #w;
2542
+ #C;
2543
+ #S;
2544
+ #L;
2545
+ #U;
2546
+ #m;
2566
2547
  get perf() {
2567
- return this.#perf;
2548
+ return this.#m;
2568
2549
  }
2569
- /**
2570
- * {@link LRUCache.OptionsBase.ttl}
2571
- */
2572
2550
  ttl;
2573
- /**
2574
- * {@link LRUCache.OptionsBase.ttlResolution}
2575
- */
2576
2551
  ttlResolution;
2577
- /**
2578
- * {@link LRUCache.OptionsBase.ttlAutopurge}
2579
- */
2580
2552
  ttlAutopurge;
2581
- /**
2582
- * {@link LRUCache.OptionsBase.updateAgeOnGet}
2583
- */
2584
2553
  updateAgeOnGet;
2585
- /**
2586
- * {@link LRUCache.OptionsBase.updateAgeOnHas}
2587
- */
2588
2554
  updateAgeOnHas;
2589
- /**
2590
- * {@link LRUCache.OptionsBase.allowStale}
2591
- */
2592
2555
  allowStale;
2593
- /**
2594
- * {@link LRUCache.OptionsBase.noDisposeOnSet}
2595
- */
2596
2556
  noDisposeOnSet;
2597
- /**
2598
- * {@link LRUCache.OptionsBase.noUpdateTTL}
2599
- */
2600
2557
  noUpdateTTL;
2601
- /**
2602
- * {@link LRUCache.OptionsBase.maxEntrySize}
2603
- */
2604
2558
  maxEntrySize;
2605
- /**
2606
- * {@link LRUCache.OptionsBase.sizeCalculation}
2607
- */
2608
2559
  sizeCalculation;
2609
- /**
2610
- * {@link LRUCache.OptionsBase.noDeleteOnFetchRejection}
2611
- */
2612
2560
  noDeleteOnFetchRejection;
2613
- /**
2614
- * {@link LRUCache.OptionsBase.noDeleteOnStaleGet}
2615
- */
2616
2561
  noDeleteOnStaleGet;
2617
- /**
2618
- * {@link LRUCache.OptionsBase.allowStaleOnFetchAbort}
2619
- */
2620
2562
  allowStaleOnFetchAbort;
2621
- /**
2622
- * {@link LRUCache.OptionsBase.allowStaleOnFetchRejection}
2623
- */
2624
2563
  allowStaleOnFetchRejection;
2625
- /**
2626
- * {@link LRUCache.OptionsBase.ignoreFetchAbort}
2627
- */
2628
2564
  ignoreFetchAbort;
2629
- // computed properties
2630
- #size;
2631
- #calculatedSize;
2632
- #keyMap;
2633
- #keyList;
2634
- #valList;
2635
- #next;
2636
- #prev;
2637
- #head;
2638
- #tail;
2639
- #free;
2640
- #disposed;
2641
- #sizes;
2642
- #starts;
2643
- #ttls;
2644
- #hasDispose;
2645
- #hasFetchMethod;
2646
- #hasDisposeAfter;
2647
- #hasOnInsert;
2648
- /**
2649
- * Do not call this method unless you need to inspect the
2650
- * inner workings of the cache. If anything returned by this
2651
- * object is modified in any way, strange breakage may occur.
2652
- *
2653
- * These fields are private for a reason!
2654
- *
2655
- * @internal
2656
- */
2657
- static unsafeExposeInternals(c3) {
2658
- return {
2659
- // properties
2660
- starts: c3.#starts,
2661
- ttls: c3.#ttls,
2662
- sizes: c3.#sizes,
2663
- keyMap: c3.#keyMap,
2664
- keyList: c3.#keyList,
2665
- valList: c3.#valList,
2666
- next: c3.#next,
2667
- prev: c3.#prev,
2668
- get head() {
2669
- return c3.#head;
2670
- },
2671
- get tail() {
2672
- return c3.#tail;
2673
- },
2674
- free: c3.#free,
2675
- // methods
2676
- isBackgroundFetch: (p) => c3.#isBackgroundFetch(p),
2677
- backgroundFetch: (k, index, options, context) => c3.#backgroundFetch(k, index, options, context),
2678
- moveToTail: (index) => c3.#moveToTail(index),
2679
- indexes: (options) => c3.#indexes(options),
2680
- rindexes: (options) => c3.#rindexes(options),
2681
- isStale: (index) => c3.#isStale(index)
2682
- };
2565
+ #n;
2566
+ #_;
2567
+ #s;
2568
+ #i;
2569
+ #t;
2570
+ #a;
2571
+ #u;
2572
+ #l;
2573
+ #h;
2574
+ #b;
2575
+ #r;
2576
+ #y;
2577
+ #A;
2578
+ #d;
2579
+ #g;
2580
+ #T;
2581
+ #v;
2582
+ #f;
2583
+ #I;
2584
+ static unsafeExposeInternals(t) {
2585
+ return { starts: t.#A, ttls: t.#d, autopurgeTimers: t.#g, sizes: t.#y, keyMap: t.#s, keyList: t.#i, valList: t.#t, next: t.#a, prev: t.#u, get head() {
2586
+ return t.#l;
2587
+ }, get tail() {
2588
+ return t.#h;
2589
+ }, free: t.#b, isBackgroundFetch: (e) => t.#e(e), backgroundFetch: (e, i2, s, n2) => t.#x(e, i2, s, n2), moveToTail: (e) => t.#D(e), indexes: (e) => t.#F(e), rindexes: (e) => t.#O(e), isStale: (e) => t.#p(e) };
2683
2590
  }
2684
- // Protected read-only members
2685
- /**
2686
- * {@link LRUCache.OptionsBase.max} (read-only)
2687
- */
2688
2591
  get max() {
2689
- return this.#max;
2592
+ return this.#o;
2690
2593
  }
2691
- /**
2692
- * {@link LRUCache.OptionsBase.maxSize} (read-only)
2693
- */
2694
2594
  get maxSize() {
2695
- return this.#maxSize;
2595
+ return this.#c;
2696
2596
  }
2697
- /**
2698
- * The total computed size of items in the cache (read-only)
2699
- */
2700
2597
  get calculatedSize() {
2701
- return this.#calculatedSize;
2598
+ return this.#_;
2702
2599
  }
2703
- /**
2704
- * The number of items stored in the cache (read-only)
2705
- */
2706
2600
  get size() {
2707
- return this.#size;
2601
+ return this.#n;
2708
2602
  }
2709
- /**
2710
- * {@link LRUCache.OptionsBase.fetchMethod} (read-only)
2711
- */
2712
2603
  get fetchMethod() {
2713
- return this.#fetchMethod;
2604
+ return this.#L;
2714
2605
  }
2715
2606
  get memoMethod() {
2716
- return this.#memoMethod;
2607
+ return this.#U;
2717
2608
  }
2718
- /**
2719
- * {@link LRUCache.OptionsBase.dispose} (read-only)
2720
- */
2721
2609
  get dispose() {
2722
- return this.#dispose;
2610
+ return this.#w;
2723
2611
  }
2724
- /**
2725
- * {@link LRUCache.OptionsBase.onInsert} (read-only)
2726
- */
2727
2612
  get onInsert() {
2728
- return this.#onInsert;
2613
+ return this.#C;
2729
2614
  }
2730
- /**
2731
- * {@link LRUCache.OptionsBase.disposeAfter} (read-only)
2732
- */
2733
2615
  get disposeAfter() {
2734
- return this.#disposeAfter;
2735
- }
2736
- constructor(options) {
2737
- const { max = 0, ttl, ttlResolution = 1, ttlAutopurge, updateAgeOnGet, updateAgeOnHas, allowStale, dispose, onInsert, disposeAfter, noDisposeOnSet, noUpdateTTL, maxSize = 0, maxEntrySize = 0, sizeCalculation, fetchMethod, memoMethod, noDeleteOnFetchRejection, noDeleteOnStaleGet, allowStaleOnFetchRejection, allowStaleOnFetchAbort, ignoreFetchAbort, perf } = options;
2738
- if (perf !== void 0) {
2739
- if (typeof perf?.now !== "function") {
2740
- throw new TypeError("perf option must have a now() method if specified");
2741
- }
2742
- }
2743
- this.#perf = perf ?? defaultPerf;
2744
- if (max !== 0 && !isPosInt(max)) {
2745
- throw new TypeError("max option must be a nonnegative integer");
2746
- }
2747
- const UintArray = max ? getUintArray(max) : Array;
2748
- if (!UintArray) {
2749
- throw new Error("invalid max value: " + max);
2750
- }
2751
- this.#max = max;
2752
- this.#maxSize = maxSize;
2753
- this.maxEntrySize = maxEntrySize || this.#maxSize;
2754
- this.sizeCalculation = sizeCalculation;
2755
- if (this.sizeCalculation) {
2756
- if (!this.#maxSize && !this.maxEntrySize) {
2757
- throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");
2758
- }
2759
- if (typeof this.sizeCalculation !== "function") {
2760
- throw new TypeError("sizeCalculation set to non-function");
2761
- }
2762
- }
2763
- if (memoMethod !== void 0 && typeof memoMethod !== "function") {
2764
- throw new TypeError("memoMethod must be a function if defined");
2765
- }
2766
- this.#memoMethod = memoMethod;
2767
- if (fetchMethod !== void 0 && typeof fetchMethod !== "function") {
2768
- throw new TypeError("fetchMethod must be a function if specified");
2769
- }
2770
- this.#fetchMethod = fetchMethod;
2771
- this.#hasFetchMethod = !!fetchMethod;
2772
- this.#keyMap = /* @__PURE__ */ new Map();
2773
- this.#keyList = new Array(max).fill(void 0);
2774
- this.#valList = new Array(max).fill(void 0);
2775
- this.#next = new UintArray(max);
2776
- this.#prev = new UintArray(max);
2777
- this.#head = 0;
2778
- this.#tail = 0;
2779
- this.#free = Stack.create(max);
2780
- this.#size = 0;
2781
- this.#calculatedSize = 0;
2782
- if (typeof dispose === "function") {
2783
- this.#dispose = dispose;
2784
- }
2785
- if (typeof onInsert === "function") {
2786
- this.#onInsert = onInsert;
2787
- }
2788
- if (typeof disposeAfter === "function") {
2789
- this.#disposeAfter = disposeAfter;
2790
- this.#disposed = [];
2791
- } else {
2792
- this.#disposeAfter = void 0;
2793
- this.#disposed = void 0;
2794
- }
2795
- this.#hasDispose = !!this.#dispose;
2796
- this.#hasOnInsert = !!this.#onInsert;
2797
- this.#hasDisposeAfter = !!this.#disposeAfter;
2798
- this.noDisposeOnSet = !!noDisposeOnSet;
2799
- this.noUpdateTTL = !!noUpdateTTL;
2800
- this.noDeleteOnFetchRejection = !!noDeleteOnFetchRejection;
2801
- this.allowStaleOnFetchRejection = !!allowStaleOnFetchRejection;
2802
- this.allowStaleOnFetchAbort = !!allowStaleOnFetchAbort;
2803
- this.ignoreFetchAbort = !!ignoreFetchAbort;
2804
- if (this.maxEntrySize !== 0) {
2805
- if (this.#maxSize !== 0) {
2806
- if (!isPosInt(this.#maxSize)) {
2807
- throw new TypeError("maxSize must be a positive integer if specified");
2808
- }
2809
- }
2810
- if (!isPosInt(this.maxEntrySize)) {
2811
- throw new TypeError("maxEntrySize must be a positive integer if specified");
2812
- }
2813
- this.#initializeSizeTracking();
2814
- }
2815
- this.allowStale = !!allowStale;
2816
- this.noDeleteOnStaleGet = !!noDeleteOnStaleGet;
2817
- this.updateAgeOnGet = !!updateAgeOnGet;
2818
- this.updateAgeOnHas = !!updateAgeOnHas;
2819
- this.ttlResolution = isPosInt(ttlResolution) || ttlResolution === 0 ? ttlResolution : 1;
2820
- this.ttlAutopurge = !!ttlAutopurge;
2821
- this.ttl = ttl || 0;
2822
- if (this.ttl) {
2823
- if (!isPosInt(this.ttl)) {
2824
- throw new TypeError("ttl must be a positive integer if specified");
2825
- }
2826
- this.#initializeTTLTracking();
2827
- }
2828
- if (this.#max === 0 && this.ttl === 0 && this.#maxSize === 0) {
2829
- throw new TypeError("At least one of max, maxSize, or ttl is required");
2830
- }
2831
- if (!this.ttlAutopurge && !this.#max && !this.#maxSize) {
2832
- const code = "LRU_CACHE_UNBOUNDED";
2833
- if (shouldWarn(code)) {
2834
- warned.add(code);
2835
- const msg = "TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.";
2836
- emitWarning(msg, "UnboundedCacheWarning", code, _LRUCache);
2837
- }
2838
- }
2839
- }
2840
- /**
2841
- * Return the number of ms left in the item's TTL. If item is not in cache,
2842
- * returns `0`. Returns `Infinity` if item is in cache without a defined TTL.
2843
- */
2844
- getRemainingTTL(key) {
2845
- return this.#keyMap.has(key) ? Infinity : 0;
2846
- }
2847
- #initializeTTLTracking() {
2848
- const ttls = new ZeroArray(this.#max);
2849
- const starts = new ZeroArray(this.#max);
2850
- this.#ttls = ttls;
2851
- this.#starts = starts;
2852
- this.#setItemTTL = (index, ttl, start = this.#perf.now()) => {
2853
- starts[index] = ttl !== 0 ? start : 0;
2854
- ttls[index] = ttl;
2855
- if (ttl !== 0 && this.ttlAutopurge) {
2856
- const t = setTimeout(() => {
2857
- if (this.#isStale(index)) {
2858
- this.#delete(this.#keyList[index], "expire");
2859
- }
2860
- }, ttl + 1);
2861
- if (t.unref) {
2862
- t.unref();
2863
- }
2864
- }
2616
+ return this.#S;
2617
+ }
2618
+ constructor(t) {
2619
+ let { max: e = 0, ttl: i2, ttlResolution: s = 1, ttlAutopurge: n2, updateAgeOnGet: o2, updateAgeOnHas: h2, allowStale: r, dispose: a2, onInsert: w, disposeAfter: f, noDisposeOnSet: d, noUpdateTTL: g, maxSize: A = 0, maxEntrySize: p = 0, sizeCalculation: _, fetchMethod: l, memoMethod: S, noDeleteOnFetchRejection: b, noDeleteOnStaleGet: m, allowStaleOnFetchRejection: u2, allowStaleOnFetchAbort: T, ignoreFetchAbort: F, perf: v } = t;
2620
+ if (v !== void 0 && typeof v?.now != "function") throw new TypeError("perf option must have a now() method if specified");
2621
+ if (this.#m = v ?? G, e !== 0 && !y(e)) throw new TypeError("max option must be a nonnegative integer");
2622
+ let O = e ? M(e) : Array;
2623
+ if (!O) throw new Error("invalid max value: " + e);
2624
+ if (this.#o = e, this.#c = A, this.maxEntrySize = p || this.#c, this.sizeCalculation = _, this.sizeCalculation) {
2625
+ if (!this.#c && !this.maxEntrySize) throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");
2626
+ if (typeof this.sizeCalculation != "function") throw new TypeError("sizeCalculation set to non-function");
2627
+ }
2628
+ if (S !== void 0 && typeof S != "function") throw new TypeError("memoMethod must be a function if defined");
2629
+ if (this.#U = S, l !== void 0 && typeof l != "function") throw new TypeError("fetchMethod must be a function if specified");
2630
+ if (this.#L = l, this.#v = !!l, this.#s = /* @__PURE__ */ new Map(), this.#i = new Array(e).fill(void 0), this.#t = new Array(e).fill(void 0), this.#a = new O(e), this.#u = new O(e), this.#l = 0, this.#h = 0, this.#b = W.create(e), this.#n = 0, this.#_ = 0, typeof a2 == "function" && (this.#w = a2), typeof w == "function" && (this.#C = w), typeof f == "function" ? (this.#S = f, this.#r = []) : (this.#S = void 0, this.#r = void 0), this.#T = !!this.#w, this.#I = !!this.#C, this.#f = !!this.#S, this.noDisposeOnSet = !!d, this.noUpdateTTL = !!g, this.noDeleteOnFetchRejection = !!b, this.allowStaleOnFetchRejection = !!u2, this.allowStaleOnFetchAbort = !!T, this.ignoreFetchAbort = !!F, this.maxEntrySize !== 0) {
2631
+ if (this.#c !== 0 && !y(this.#c)) throw new TypeError("maxSize must be a positive integer if specified");
2632
+ if (!y(this.maxEntrySize)) throw new TypeError("maxEntrySize must be a positive integer if specified");
2633
+ this.#B();
2634
+ }
2635
+ if (this.allowStale = !!r, this.noDeleteOnStaleGet = !!m, this.updateAgeOnGet = !!o2, this.updateAgeOnHas = !!h2, this.ttlResolution = y(s) || s === 0 ? s : 1, this.ttlAutopurge = !!n2, this.ttl = i2 || 0, this.ttl) {
2636
+ if (!y(this.ttl)) throw new TypeError("ttl must be a positive integer if specified");
2637
+ this.#j();
2638
+ }
2639
+ if (this.#o === 0 && this.ttl === 0 && this.#c === 0) throw new TypeError("At least one of max, maxSize, or ttl is required");
2640
+ if (!this.ttlAutopurge && !this.#o && !this.#c) {
2641
+ let E = "LRU_CACHE_UNBOUNDED";
2642
+ x(E) && (U.add(E), I("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.", "UnboundedCacheWarning", E, c3));
2643
+ }
2644
+ }
2645
+ getRemainingTTL(t) {
2646
+ return this.#s.has(t) ? 1 / 0 : 0;
2647
+ }
2648
+ #j() {
2649
+ let t = new z(this.#o), e = new z(this.#o);
2650
+ this.#d = t, this.#A = e;
2651
+ let i2 = this.ttlAutopurge ? new Array(this.#o) : void 0;
2652
+ this.#g = i2, this.#N = (h2, r, a2 = this.#m.now()) => {
2653
+ e[h2] = r !== 0 ? a2 : 0, t[h2] = r, s(h2, r);
2654
+ }, this.#R = (h2) => {
2655
+ e[h2] = t[h2] !== 0 ? this.#m.now() : 0, s(h2, t[h2]);
2865
2656
  };
2866
- this.#updateItemAge = (index) => {
2867
- starts[index] = ttls[index] !== 0 ? this.#perf.now() : 0;
2657
+ let s = this.ttlAutopurge ? (h2, r) => {
2658
+ if (i2?.[h2] && (clearTimeout(i2[h2]), i2[h2] = void 0), r && r !== 0 && i2) {
2659
+ let a2 = setTimeout(() => {
2660
+ this.#p(h2) && this.#E(this.#i[h2], "expire");
2661
+ }, r + 1);
2662
+ a2.unref && a2.unref(), i2[h2] = a2;
2663
+ }
2664
+ } : () => {
2868
2665
  };
2869
- this.#statusTTL = (status, index) => {
2870
- if (ttls[index]) {
2871
- const ttl = ttls[index];
2872
- const start = starts[index];
2873
- if (!ttl || !start)
2874
- return;
2875
- status.ttl = ttl;
2876
- status.start = start;
2877
- status.now = cachedNow || getNow();
2878
- const age = status.now - start;
2879
- status.remainingTTL = ttl - age;
2666
+ this.#z = (h2, r) => {
2667
+ if (t[r]) {
2668
+ let a2 = t[r], w = e[r];
2669
+ if (!a2 || !w) return;
2670
+ h2.ttl = a2, h2.start = w, h2.now = n2 || o2();
2671
+ let f = h2.now - w;
2672
+ h2.remainingTTL = a2 - f;
2880
2673
  }
2881
2674
  };
2882
- let cachedNow = 0;
2883
- const getNow = () => {
2884
- const n2 = this.#perf.now();
2675
+ let n2 = 0, o2 = () => {
2676
+ let h2 = this.#m.now();
2885
2677
  if (this.ttlResolution > 0) {
2886
- cachedNow = n2;
2887
- const t = setTimeout(() => cachedNow = 0, this.ttlResolution);
2888
- if (t.unref) {
2889
- t.unref();
2890
- }
2891
- }
2892
- return n2;
2893
- };
2894
- this.getRemainingTTL = (key) => {
2895
- const index = this.#keyMap.get(key);
2896
- if (index === void 0) {
2897
- return 0;
2898
- }
2899
- const ttl = ttls[index];
2900
- const start = starts[index];
2901
- if (!ttl || !start) {
2902
- return Infinity;
2678
+ n2 = h2;
2679
+ let r = setTimeout(() => n2 = 0, this.ttlResolution);
2680
+ r.unref && r.unref();
2903
2681
  }
2904
- const age = (cachedNow || getNow()) - start;
2905
- return ttl - age;
2682
+ return h2;
2906
2683
  };
2907
- this.#isStale = (index) => {
2908
- const s = starts[index];
2909
- const t = ttls[index];
2910
- return !!t && !!s && (cachedNow || getNow()) - s > t;
2684
+ this.getRemainingTTL = (h2) => {
2685
+ let r = this.#s.get(h2);
2686
+ if (r === void 0) return 0;
2687
+ let a2 = t[r], w = e[r];
2688
+ if (!a2 || !w) return 1 / 0;
2689
+ let f = (n2 || o2()) - w;
2690
+ return a2 - f;
2691
+ }, this.#p = (h2) => {
2692
+ let r = e[h2], a2 = t[h2];
2693
+ return !!a2 && !!r && (n2 || o2()) - r > a2;
2911
2694
  };
2912
2695
  }
2913
- // conditionally set private methods related to TTL
2914
- #updateItemAge = () => {
2696
+ #R = () => {
2915
2697
  };
2916
- #statusTTL = () => {
2698
+ #z = () => {
2917
2699
  };
2918
- #setItemTTL = () => {
2700
+ #N = () => {
2919
2701
  };
2920
- /* c8 ignore stop */
2921
- #isStale = () => false;
2922
- #initializeSizeTracking() {
2923
- const sizes = new ZeroArray(this.#max);
2924
- this.#calculatedSize = 0;
2925
- this.#sizes = sizes;
2926
- this.#removeItemSize = (index) => {
2927
- this.#calculatedSize -= sizes[index];
2928
- sizes[index] = 0;
2929
- };
2930
- this.#requireSize = (k, v, size, sizeCalculation) => {
2931
- if (this.#isBackgroundFetch(v)) {
2932
- return 0;
2933
- }
2934
- if (!isPosInt(size)) {
2935
- if (sizeCalculation) {
2936
- if (typeof sizeCalculation !== "function") {
2937
- throw new TypeError("sizeCalculation must be a function");
2938
- }
2939
- size = sizeCalculation(v, k);
2940
- if (!isPosInt(size)) {
2941
- throw new TypeError("sizeCalculation return invalid (expect positive integer)");
2942
- }
2943
- } else {
2944
- throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");
2945
- }
2946
- }
2947
- return size;
2948
- };
2949
- this.#addItemSize = (index, size, status) => {
2950
- sizes[index] = size;
2951
- if (this.#maxSize) {
2952
- const maxSize = this.#maxSize - sizes[index];
2953
- while (this.#calculatedSize > maxSize) {
2954
- this.#evict(true);
2955
- }
2956
- }
2957
- this.#calculatedSize += sizes[index];
2958
- if (status) {
2959
- status.entrySize = size;
2960
- status.totalCalculatedSize = this.#calculatedSize;
2961
- }
2702
+ #p = () => false;
2703
+ #B() {
2704
+ let t = new z(this.#o);
2705
+ this.#_ = 0, this.#y = t, this.#W = (e) => {
2706
+ this.#_ -= t[e], t[e] = 0;
2707
+ }, this.#P = (e, i2, s, n2) => {
2708
+ if (this.#e(i2)) return 0;
2709
+ if (!y(s)) if (n2) {
2710
+ if (typeof n2 != "function") throw new TypeError("sizeCalculation must be a function");
2711
+ if (s = n2(i2, e), !y(s)) throw new TypeError("sizeCalculation return invalid (expect positive integer)");
2712
+ } else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");
2713
+ return s;
2714
+ }, this.#M = (e, i2, s) => {
2715
+ if (t[e] = i2, this.#c) {
2716
+ let n2 = this.#c - t[e];
2717
+ for (; this.#_ > n2; ) this.#G(true);
2718
+ }
2719
+ this.#_ += t[e], s && (s.entrySize = i2, s.totalCalculatedSize = this.#_);
2962
2720
  };
2963
2721
  }
2964
- #removeItemSize = (_i) => {
2722
+ #W = (t) => {
2965
2723
  };
2966
- #addItemSize = (_i, _s, _st) => {
2724
+ #M = (t, e, i2) => {
2967
2725
  };
2968
- #requireSize = (_k, _v, size, sizeCalculation) => {
2969
- if (size || sizeCalculation) {
2970
- throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");
2971
- }
2726
+ #P = (t, e, i2, s) => {
2727
+ if (i2 || s) throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");
2972
2728
  return 0;
2973
2729
  };
2974
- *#indexes({ allowStale = this.allowStale } = {}) {
2975
- if (this.#size) {
2976
- for (let i2 = this.#tail; true; ) {
2977
- if (!this.#isValidIndex(i2)) {
2978
- break;
2979
- }
2980
- if (allowStale || !this.#isStale(i2)) {
2981
- yield i2;
2982
- }
2983
- if (i2 === this.#head) {
2984
- break;
2985
- } else {
2986
- i2 = this.#prev[i2];
2987
- }
2988
- }
2989
- }
2730
+ *#F({ allowStale: t = this.allowStale } = {}) {
2731
+ if (this.#n) for (let e = this.#h; !(!this.#H(e) || ((t || !this.#p(e)) && (yield e), e === this.#l)); ) e = this.#u[e];
2990
2732
  }
2991
- *#rindexes({ allowStale = this.allowStale } = {}) {
2992
- if (this.#size) {
2993
- for (let i2 = this.#head; true; ) {
2994
- if (!this.#isValidIndex(i2)) {
2995
- break;
2996
- }
2997
- if (allowStale || !this.#isStale(i2)) {
2998
- yield i2;
2999
- }
3000
- if (i2 === this.#tail) {
3001
- break;
3002
- } else {
3003
- i2 = this.#next[i2];
3004
- }
3005
- }
3006
- }
2733
+ *#O({ allowStale: t = this.allowStale } = {}) {
2734
+ if (this.#n) for (let e = this.#l; !(!this.#H(e) || ((t || !this.#p(e)) && (yield e), e === this.#h)); ) e = this.#a[e];
3007
2735
  }
3008
- #isValidIndex(index) {
3009
- return index !== void 0 && this.#keyMap.get(this.#keyList[index]) === index;
2736
+ #H(t) {
2737
+ return t !== void 0 && this.#s.get(this.#i[t]) === t;
3010
2738
  }
3011
- /**
3012
- * Return a generator yielding `[key, value]` pairs,
3013
- * in order from most recently used to least recently used.
3014
- */
3015
2739
  *entries() {
3016
- for (const i2 of this.#indexes()) {
3017
- if (this.#valList[i2] !== void 0 && this.#keyList[i2] !== void 0 && !this.#isBackgroundFetch(this.#valList[i2])) {
3018
- yield [this.#keyList[i2], this.#valList[i2]];
3019
- }
3020
- }
2740
+ for (let t of this.#F()) this.#t[t] !== void 0 && this.#i[t] !== void 0 && !this.#e(this.#t[t]) && (yield [this.#i[t], this.#t[t]]);
3021
2741
  }
3022
- /**
3023
- * Inverse order version of {@link LRUCache.entries}
3024
- *
3025
- * Return a generator yielding `[key, value]` pairs,
3026
- * in order from least recently used to most recently used.
3027
- */
3028
2742
  *rentries() {
3029
- for (const i2 of this.#rindexes()) {
3030
- if (this.#valList[i2] !== void 0 && this.#keyList[i2] !== void 0 && !this.#isBackgroundFetch(this.#valList[i2])) {
3031
- yield [this.#keyList[i2], this.#valList[i2]];
3032
- }
3033
- }
2743
+ for (let t of this.#O()) this.#t[t] !== void 0 && this.#i[t] !== void 0 && !this.#e(this.#t[t]) && (yield [this.#i[t], this.#t[t]]);
3034
2744
  }
3035
- /**
3036
- * Return a generator yielding the keys in the cache,
3037
- * in order from most recently used to least recently used.
3038
- */
3039
2745
  *keys() {
3040
- for (const i2 of this.#indexes()) {
3041
- const k = this.#keyList[i2];
3042
- if (k !== void 0 && !this.#isBackgroundFetch(this.#valList[i2])) {
3043
- yield k;
3044
- }
2746
+ for (let t of this.#F()) {
2747
+ let e = this.#i[t];
2748
+ e !== void 0 && !this.#e(this.#t[t]) && (yield e);
3045
2749
  }
3046
2750
  }
3047
- /**
3048
- * Inverse order version of {@link LRUCache.keys}
3049
- *
3050
- * Return a generator yielding the keys in the cache,
3051
- * in order from least recently used to most recently used.
3052
- */
3053
2751
  *rkeys() {
3054
- for (const i2 of this.#rindexes()) {
3055
- const k = this.#keyList[i2];
3056
- if (k !== void 0 && !this.#isBackgroundFetch(this.#valList[i2])) {
3057
- yield k;
3058
- }
2752
+ for (let t of this.#O()) {
2753
+ let e = this.#i[t];
2754
+ e !== void 0 && !this.#e(this.#t[t]) && (yield e);
3059
2755
  }
3060
2756
  }
3061
- /**
3062
- * Return a generator yielding the values in the cache,
3063
- * in order from most recently used to least recently used.
3064
- */
3065
2757
  *values() {
3066
- for (const i2 of this.#indexes()) {
3067
- const v = this.#valList[i2];
3068
- if (v !== void 0 && !this.#isBackgroundFetch(this.#valList[i2])) {
3069
- yield this.#valList[i2];
3070
- }
3071
- }
2758
+ for (let t of this.#F()) this.#t[t] !== void 0 && !this.#e(this.#t[t]) && (yield this.#t[t]);
3072
2759
  }
3073
- /**
3074
- * Inverse order version of {@link LRUCache.values}
3075
- *
3076
- * Return a generator yielding the values in the cache,
3077
- * in order from least recently used to most recently used.
3078
- */
3079
2760
  *rvalues() {
3080
- for (const i2 of this.#rindexes()) {
3081
- const v = this.#valList[i2];
3082
- if (v !== void 0 && !this.#isBackgroundFetch(this.#valList[i2])) {
3083
- yield this.#valList[i2];
3084
- }
3085
- }
2761
+ for (let t of this.#O()) this.#t[t] !== void 0 && !this.#e(this.#t[t]) && (yield this.#t[t]);
3086
2762
  }
3087
- /**
3088
- * Iterating over the cache itself yields the same results as
3089
- * {@link LRUCache.entries}
3090
- */
3091
2763
  [Symbol.iterator]() {
3092
2764
  return this.entries();
3093
2765
  }
3094
- /**
3095
- * A String value that is used in the creation of the default string
3096
- * description of an object. Called by the built-in method
3097
- * `Object.prototype.toString`.
3098
- */
3099
2766
  [Symbol.toStringTag] = "LRUCache";
3100
- /**
3101
- * Find a value for which the supplied fn method returns a truthy value,
3102
- * similar to `Array.find()`. fn is called as `fn(value, key, cache)`.
3103
- */
3104
- find(fn, getOptions = {}) {
3105
- for (const i2 of this.#indexes()) {
3106
- const v = this.#valList[i2];
3107
- const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
3108
- if (value === void 0)
3109
- continue;
3110
- if (fn(value, this.#keyList[i2], this)) {
3111
- return this.get(this.#keyList[i2], getOptions);
3112
- }
2767
+ find(t, e = {}) {
2768
+ for (let i2 of this.#F()) {
2769
+ let s = this.#t[i2], n2 = this.#e(s) ? s.__staleWhileFetching : s;
2770
+ if (n2 !== void 0 && t(n2, this.#i[i2], this)) return this.get(this.#i[i2], e);
3113
2771
  }
3114
2772
  }
3115
- /**
3116
- * Call the supplied function on each item in the cache, in order from most
3117
- * recently used to least recently used.
3118
- *
3119
- * `fn` is called as `fn(value, key, cache)`.
3120
- *
3121
- * If `thisp` is provided, function will be called in the `this`-context of
3122
- * the provided object, or the cache if no `thisp` object is provided.
3123
- *
3124
- * Does not update age or recenty of use, or iterate over stale values.
3125
- */
3126
- forEach(fn, thisp = this) {
3127
- for (const i2 of this.#indexes()) {
3128
- const v = this.#valList[i2];
3129
- const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
3130
- if (value === void 0)
3131
- continue;
3132
- fn.call(thisp, value, this.#keyList[i2], this);
2773
+ forEach(t, e = this) {
2774
+ for (let i2 of this.#F()) {
2775
+ let s = this.#t[i2], n2 = this.#e(s) ? s.__staleWhileFetching : s;
2776
+ n2 !== void 0 && t.call(e, n2, this.#i[i2], this);
3133
2777
  }
3134
2778
  }
3135
- /**
3136
- * The same as {@link LRUCache.forEach} but items are iterated over in
3137
- * reverse order. (ie, less recently used items are iterated over first.)
3138
- */
3139
- rforEach(fn, thisp = this) {
3140
- for (const i2 of this.#rindexes()) {
3141
- const v = this.#valList[i2];
3142
- const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
3143
- if (value === void 0)
3144
- continue;
3145
- fn.call(thisp, value, this.#keyList[i2], this);
2779
+ rforEach(t, e = this) {
2780
+ for (let i2 of this.#O()) {
2781
+ let s = this.#t[i2], n2 = this.#e(s) ? s.__staleWhileFetching : s;
2782
+ n2 !== void 0 && t.call(e, n2, this.#i[i2], this);
3146
2783
  }
3147
2784
  }
3148
- /**
3149
- * Delete any stale entries. Returns true if anything was removed,
3150
- * false otherwise.
3151
- */
3152
2785
  purgeStale() {
3153
- let deleted = false;
3154
- for (const i2 of this.#rindexes({ allowStale: true })) {
3155
- if (this.#isStale(i2)) {
3156
- this.#delete(this.#keyList[i2], "expire");
3157
- deleted = true;
3158
- }
3159
- }
3160
- return deleted;
2786
+ let t = false;
2787
+ for (let e of this.#O({ allowStale: true })) this.#p(e) && (this.#E(this.#i[e], "expire"), t = true);
2788
+ return t;
3161
2789
  }
3162
- /**
3163
- * Get the extended info about a given entry, to get its value, size, and
3164
- * TTL info simultaneously. Returns `undefined` if the key is not present.
3165
- *
3166
- * Unlike {@link LRUCache#dump}, which is designed to be portable and survive
3167
- * serialization, the `start` value is always the current timestamp, and the
3168
- * `ttl` is a calculated remaining time to live (negative if expired).
3169
- *
3170
- * Always returns stale values, if their info is found in the cache, so be
3171
- * sure to check for expirations (ie, a negative {@link LRUCache.Entry#ttl})
3172
- * if relevant.
3173
- */
3174
- info(key) {
3175
- const i2 = this.#keyMap.get(key);
3176
- if (i2 === void 0)
3177
- return void 0;
3178
- const v = this.#valList[i2];
3179
- const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
3180
- if (value === void 0)
3181
- return void 0;
3182
- const entry = { value };
3183
- if (this.#ttls && this.#starts) {
3184
- const ttl = this.#ttls[i2];
3185
- const start = this.#starts[i2];
3186
- if (ttl && start) {
3187
- const remain = ttl - (this.#perf.now() - start);
3188
- entry.ttl = remain;
3189
- entry.start = Date.now();
2790
+ info(t) {
2791
+ let e = this.#s.get(t);
2792
+ if (e === void 0) return;
2793
+ let i2 = this.#t[e], s = this.#e(i2) ? i2.__staleWhileFetching : i2;
2794
+ if (s === void 0) return;
2795
+ let n2 = { value: s };
2796
+ if (this.#d && this.#A) {
2797
+ let o2 = this.#d[e], h2 = this.#A[e];
2798
+ if (o2 && h2) {
2799
+ let r = o2 - (this.#m.now() - h2);
2800
+ n2.ttl = r, n2.start = Date.now();
3190
2801
  }
3191
2802
  }
3192
- if (this.#sizes) {
3193
- entry.size = this.#sizes[i2];
3194
- }
3195
- return entry;
2803
+ return this.#y && (n2.size = this.#y[e]), n2;
3196
2804
  }
3197
- /**
3198
- * Return an array of [key, {@link LRUCache.Entry}] tuples which can be
3199
- * passed to {@link LRUCache#load}.
3200
- *
3201
- * The `start` fields are calculated relative to a portable `Date.now()`
3202
- * timestamp, even if `performance.now()` is available.
3203
- *
3204
- * Stale entries are always included in the `dump`, even if
3205
- * {@link LRUCache.OptionsBase.allowStale} is false.
3206
- *
3207
- * Note: this returns an actual array, not a generator, so it can be more
3208
- * easily passed around.
3209
- */
3210
2805
  dump() {
3211
- const arr = [];
3212
- for (const i2 of this.#indexes({ allowStale: true })) {
3213
- const key = this.#keyList[i2];
3214
- const v = this.#valList[i2];
3215
- const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
3216
- if (value === void 0 || key === void 0)
3217
- continue;
3218
- const entry = { value };
3219
- if (this.#ttls && this.#starts) {
3220
- entry.ttl = this.#ttls[i2];
3221
- const age = this.#perf.now() - this.#starts[i2];
3222
- entry.start = Math.floor(Date.now() - age);
3223
- }
3224
- if (this.#sizes) {
3225
- entry.size = this.#sizes[i2];
2806
+ let t = [];
2807
+ for (let e of this.#F({ allowStale: true })) {
2808
+ let i2 = this.#i[e], s = this.#t[e], n2 = this.#e(s) ? s.__staleWhileFetching : s;
2809
+ if (n2 === void 0 || i2 === void 0) continue;
2810
+ let o2 = { value: n2 };
2811
+ if (this.#d && this.#A) {
2812
+ o2.ttl = this.#d[e];
2813
+ let h2 = this.#m.now() - this.#A[e];
2814
+ o2.start = Math.floor(Date.now() - h2);
3226
2815
  }
3227
- arr.unshift([key, entry]);
2816
+ this.#y && (o2.size = this.#y[e]), t.unshift([i2, o2]);
3228
2817
  }
3229
- return arr;
2818
+ return t;
3230
2819
  }
3231
- /**
3232
- * Reset the cache and load in the items in entries in the order listed.
3233
- *
3234
- * The shape of the resulting cache may be different if the same options are
3235
- * not used in both caches.
3236
- *
3237
- * The `start` fields are assumed to be calculated relative to a portable
3238
- * `Date.now()` timestamp, even if `performance.now()` is available.
3239
- */
3240
- load(arr) {
2820
+ load(t) {
3241
2821
  this.clear();
3242
- for (const [key, entry] of arr) {
3243
- if (entry.start) {
3244
- const age = Date.now() - entry.start;
3245
- entry.start = this.#perf.now() - age;
3246
- }
3247
- this.set(key, entry.value, entry);
3248
- }
3249
- }
3250
- /**
3251
- * Add a value to the cache.
3252
- *
3253
- * Note: if `undefined` is specified as a value, this is an alias for
3254
- * {@link LRUCache#delete}
3255
- *
3256
- * Fields on the {@link LRUCache.SetOptions} options param will override
3257
- * their corresponding values in the constructor options for the scope
3258
- * of this single `set()` operation.
3259
- *
3260
- * If `start` is provided, then that will set the effective start
3261
- * time for the TTL calculation. Note that this must be a previous
3262
- * value of `performance.now()` if supported, or a previous value of
3263
- * `Date.now()` if not.
3264
- *
3265
- * Options object may also include `size`, which will prevent
3266
- * calling the `sizeCalculation` function and just use the specified
3267
- * number if it is a positive integer, and `noDisposeOnSet` which
3268
- * will prevent calling a `dispose` function in the case of
3269
- * overwrites.
3270
- *
3271
- * If the `size` (or return value of `sizeCalculation`) for a given
3272
- * entry is greater than `maxEntrySize`, then the item will not be
3273
- * added to the cache.
3274
- *
3275
- * Will update the recency of the entry.
3276
- *
3277
- * If the value is `undefined`, then this is an alias for
3278
- * `cache.delete(key)`. `undefined` is never stored in the cache.
3279
- */
3280
- set(k, v, setOptions = {}) {
3281
- if (v === void 0) {
3282
- this.delete(k);
3283
- return this;
3284
- }
3285
- const { ttl = this.ttl, start, noDisposeOnSet = this.noDisposeOnSet, sizeCalculation = this.sizeCalculation, status } = setOptions;
3286
- let { noUpdateTTL = this.noUpdateTTL } = setOptions;
3287
- const size = this.#requireSize(k, v, setOptions.size || 0, sizeCalculation);
3288
- if (this.maxEntrySize && size > this.maxEntrySize) {
3289
- if (status) {
3290
- status.set = "miss";
3291
- status.maxEntrySizeExceeded = true;
3292
- }
3293
- this.#delete(k, "set");
3294
- return this;
3295
- }
3296
- let index = this.#size === 0 ? void 0 : this.#keyMap.get(k);
3297
- if (index === void 0) {
3298
- index = this.#size === 0 ? this.#tail : this.#free.length !== 0 ? this.#free.pop() : this.#size === this.#max ? this.#evict(false) : this.#size;
3299
- this.#keyList[index] = k;
3300
- this.#valList[index] = v;
3301
- this.#keyMap.set(k, index);
3302
- this.#next[this.#tail] = index;
3303
- this.#prev[index] = this.#tail;
3304
- this.#tail = index;
3305
- this.#size++;
3306
- this.#addItemSize(index, size, status);
3307
- if (status)
3308
- status.set = "add";
3309
- noUpdateTTL = false;
3310
- if (this.#hasOnInsert) {
3311
- this.#onInsert?.(v, k, "add");
3312
- }
3313
- } else {
3314
- this.#moveToTail(index);
3315
- const oldVal = this.#valList[index];
3316
- if (v !== oldVal) {
3317
- if (this.#hasFetchMethod && this.#isBackgroundFetch(oldVal)) {
3318
- oldVal.__abortController.abort(new Error("replaced"));
3319
- const { __staleWhileFetching: s } = oldVal;
3320
- if (s !== void 0 && !noDisposeOnSet) {
3321
- if (this.#hasDispose) {
3322
- this.#dispose?.(s, k, "set");
3323
- }
3324
- if (this.#hasDisposeAfter) {
3325
- this.#disposed?.push([s, k, "set"]);
3326
- }
3327
- }
3328
- } else if (!noDisposeOnSet) {
3329
- if (this.#hasDispose) {
3330
- this.#dispose?.(oldVal, k, "set");
3331
- }
3332
- if (this.#hasDisposeAfter) {
3333
- this.#disposed?.push([oldVal, k, "set"]);
3334
- }
3335
- }
3336
- this.#removeItemSize(index);
3337
- this.#addItemSize(index, size, status);
3338
- this.#valList[index] = v;
3339
- if (status) {
3340
- status.set = "replace";
3341
- const oldValue = oldVal && this.#isBackgroundFetch(oldVal) ? oldVal.__staleWhileFetching : oldVal;
3342
- if (oldValue !== void 0)
3343
- status.oldValue = oldValue;
2822
+ for (let [e, i2] of t) {
2823
+ if (i2.start) {
2824
+ let s = Date.now() - i2.start;
2825
+ i2.start = this.#m.now() - s;
2826
+ }
2827
+ this.set(e, i2.value, i2);
2828
+ }
2829
+ }
2830
+ set(t, e, i2 = {}) {
2831
+ if (e === void 0) return this.delete(t), this;
2832
+ let { ttl: s = this.ttl, start: n2, noDisposeOnSet: o2 = this.noDisposeOnSet, sizeCalculation: h2 = this.sizeCalculation, status: r } = i2, { noUpdateTTL: a2 = this.noUpdateTTL } = i2, w = this.#P(t, e, i2.size || 0, h2);
2833
+ if (this.maxEntrySize && w > this.maxEntrySize) return r && (r.set = "miss", r.maxEntrySizeExceeded = true), this.#E(t, "set"), this;
2834
+ let f = this.#n === 0 ? void 0 : this.#s.get(t);
2835
+ if (f === void 0) f = this.#n === 0 ? this.#h : this.#b.length !== 0 ? this.#b.pop() : this.#n === this.#o ? this.#G(false) : this.#n, this.#i[f] = t, this.#t[f] = e, this.#s.set(t, f), this.#a[this.#h] = f, this.#u[f] = this.#h, this.#h = f, this.#n++, this.#M(f, w, r), r && (r.set = "add"), a2 = false, this.#I && this.#C?.(e, t, "add");
2836
+ else {
2837
+ this.#D(f);
2838
+ let d = this.#t[f];
2839
+ if (e !== d) {
2840
+ if (this.#v && this.#e(d)) {
2841
+ d.__abortController.abort(new Error("replaced"));
2842
+ let { __staleWhileFetching: g } = d;
2843
+ g !== void 0 && !o2 && (this.#T && this.#w?.(g, t, "set"), this.#f && this.#r?.push([g, t, "set"]));
2844
+ } else o2 || (this.#T && this.#w?.(d, t, "set"), this.#f && this.#r?.push([d, t, "set"]));
2845
+ if (this.#W(f), this.#M(f, w, r), this.#t[f] = e, r) {
2846
+ r.set = "replace";
2847
+ let g = d && this.#e(d) ? d.__staleWhileFetching : d;
2848
+ g !== void 0 && (r.oldValue = g);
3344
2849
  }
3345
- } else if (status) {
3346
- status.set = "update";
3347
- }
3348
- if (this.#hasOnInsert) {
3349
- this.onInsert?.(v, k, v === oldVal ? "update" : "replace");
3350
- }
3351
- }
3352
- if (ttl !== 0 && !this.#ttls) {
3353
- this.#initializeTTLTracking();
3354
- }
3355
- if (this.#ttls) {
3356
- if (!noUpdateTTL) {
3357
- this.#setItemTTL(index, ttl, start);
3358
- }
3359
- if (status)
3360
- this.#statusTTL(status, index);
2850
+ } else r && (r.set = "update");
2851
+ this.#I && this.onInsert?.(e, t, e === d ? "update" : "replace");
3361
2852
  }
3362
- if (!noDisposeOnSet && this.#hasDisposeAfter && this.#disposed) {
3363
- const dt = this.#disposed;
3364
- let task;
3365
- while (task = dt?.shift()) {
3366
- this.#disposeAfter?.(...task);
3367
- }
2853
+ if (s !== 0 && !this.#d && this.#j(), this.#d && (a2 || this.#N(f, s, n2), r && this.#z(r, f)), !o2 && this.#f && this.#r) {
2854
+ let d = this.#r, g;
2855
+ for (; g = d?.shift(); ) this.#S?.(...g);
3368
2856
  }
3369
2857
  return this;
3370
2858
  }
3371
- /**
3372
- * Evict the least recently used item, returning its value or
3373
- * `undefined` if cache is empty.
3374
- */
3375
2859
  pop() {
3376
2860
  try {
3377
- while (this.#size) {
3378
- const val = this.#valList[this.#head];
3379
- this.#evict(true);
3380
- if (this.#isBackgroundFetch(val)) {
3381
- if (val.__staleWhileFetching) {
3382
- return val.__staleWhileFetching;
3383
- }
3384
- } else if (val !== void 0) {
3385
- return val;
3386
- }
2861
+ for (; this.#n; ) {
2862
+ let t = this.#t[this.#l];
2863
+ if (this.#G(true), this.#e(t)) {
2864
+ if (t.__staleWhileFetching) return t.__staleWhileFetching;
2865
+ } else if (t !== void 0) return t;
3387
2866
  }
3388
2867
  } finally {
3389
- if (this.#hasDisposeAfter && this.#disposed) {
3390
- const dt = this.#disposed;
3391
- let task;
3392
- while (task = dt?.shift()) {
3393
- this.#disposeAfter?.(...task);
3394
- }
2868
+ if (this.#f && this.#r) {
2869
+ let t = this.#r, e;
2870
+ for (; e = t?.shift(); ) this.#S?.(...e);
3395
2871
  }
3396
2872
  }
3397
2873
  }
3398
- #evict(free) {
3399
- const head2 = this.#head;
3400
- const k = this.#keyList[head2];
3401
- const v = this.#valList[head2];
3402
- if (this.#hasFetchMethod && this.#isBackgroundFetch(v)) {
3403
- v.__abortController.abort(new Error("evicted"));
3404
- } else if (this.#hasDispose || this.#hasDisposeAfter) {
3405
- if (this.#hasDispose) {
3406
- this.#dispose?.(v, k, "evict");
3407
- }
3408
- if (this.#hasDisposeAfter) {
3409
- this.#disposed?.push([v, k, "evict"]);
3410
- }
3411
- }
3412
- this.#removeItemSize(head2);
3413
- if (free) {
3414
- this.#keyList[head2] = void 0;
3415
- this.#valList[head2] = void 0;
3416
- this.#free.push(head2);
3417
- }
3418
- if (this.#size === 1) {
3419
- this.#head = this.#tail = 0;
3420
- this.#free.length = 0;
3421
- } else {
3422
- this.#head = this.#next[head2];
3423
- }
3424
- this.#keyMap.delete(k);
3425
- this.#size--;
3426
- return head2;
2874
+ #G(t) {
2875
+ let e = this.#l, i2 = this.#i[e], s = this.#t[e];
2876
+ return this.#v && this.#e(s) ? s.__abortController.abort(new Error("evicted")) : (this.#T || this.#f) && (this.#T && this.#w?.(s, i2, "evict"), this.#f && this.#r?.push([s, i2, "evict"])), this.#W(e), this.#g?.[e] && (clearTimeout(this.#g[e]), this.#g[e] = void 0), t && (this.#i[e] = void 0, this.#t[e] = void 0, this.#b.push(e)), this.#n === 1 ? (this.#l = this.#h = 0, this.#b.length = 0) : this.#l = this.#a[e], this.#s.delete(i2), this.#n--, e;
3427
2877
  }
3428
- /**
3429
- * Check if a key is in the cache, without updating the recency of use.
3430
- * Will return false if the item is stale, even though it is technically
3431
- * in the cache.
3432
- *
3433
- * Check if a key is in the cache, without updating the recency of
3434
- * use. Age is updated if {@link LRUCache.OptionsBase.updateAgeOnHas} is set
3435
- * to `true` in either the options or the constructor.
3436
- *
3437
- * Will return `false` if the item is stale, even though it is technically in
3438
- * the cache. The difference can be determined (if it matters) by using a
3439
- * `status` argument, and inspecting the `has` field.
3440
- *
3441
- * Will not update item age unless
3442
- * {@link LRUCache.OptionsBase.updateAgeOnHas} is set.
3443
- */
3444
- has(k, hasOptions = {}) {
3445
- const { updateAgeOnHas = this.updateAgeOnHas, status } = hasOptions;
3446
- const index = this.#keyMap.get(k);
3447
- if (index !== void 0) {
3448
- const v = this.#valList[index];
3449
- if (this.#isBackgroundFetch(v) && v.__staleWhileFetching === void 0) {
3450
- return false;
3451
- }
3452
- if (!this.#isStale(index)) {
3453
- if (updateAgeOnHas) {
3454
- this.#updateItemAge(index);
3455
- }
3456
- if (status) {
3457
- status.has = "hit";
3458
- this.#statusTTL(status, index);
3459
- }
3460
- return true;
3461
- } else if (status) {
3462
- status.has = "stale";
3463
- this.#statusTTL(status, index);
3464
- }
3465
- } else if (status) {
3466
- status.has = "miss";
3467
- }
2878
+ has(t, e = {}) {
2879
+ let { updateAgeOnHas: i2 = this.updateAgeOnHas, status: s } = e, n2 = this.#s.get(t);
2880
+ if (n2 !== void 0) {
2881
+ let o2 = this.#t[n2];
2882
+ if (this.#e(o2) && o2.__staleWhileFetching === void 0) return false;
2883
+ if (this.#p(n2)) s && (s.has = "stale", this.#z(s, n2));
2884
+ else return i2 && this.#R(n2), s && (s.has = "hit", this.#z(s, n2)), true;
2885
+ } else s && (s.has = "miss");
3468
2886
  return false;
3469
2887
  }
3470
- /**
3471
- * Like {@link LRUCache#get} but doesn't update recency or delete stale
3472
- * items.
3473
- *
3474
- * Returns `undefined` if the item is stale, unless
3475
- * {@link LRUCache.OptionsBase.allowStale} is set.
3476
- */
3477
- peek(k, peekOptions = {}) {
3478
- const { allowStale = this.allowStale } = peekOptions;
3479
- const index = this.#keyMap.get(k);
3480
- if (index === void 0 || !allowStale && this.#isStale(index)) {
3481
- return;
3482
- }
3483
- const v = this.#valList[index];
3484
- return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
3485
- }
3486
- #backgroundFetch(k, index, options, context) {
3487
- const v = index === void 0 ? void 0 : this.#valList[index];
3488
- if (this.#isBackgroundFetch(v)) {
3489
- return v;
3490
- }
3491
- const ac = new AC();
3492
- const { signal } = options;
3493
- signal?.addEventListener("abort", () => ac.abort(signal.reason), {
3494
- signal: ac.signal
3495
- });
3496
- const fetchOpts = {
3497
- signal: ac.signal,
3498
- options,
3499
- context
3500
- };
3501
- const cb = (v2, updateCache = false) => {
3502
- const { aborted: aborted2 } = ac.signal;
3503
- const ignoreAbort = options.ignoreFetchAbort && v2 !== void 0;
3504
- if (options.status) {
3505
- if (aborted2 && !updateCache) {
3506
- options.status.fetchAborted = true;
3507
- options.status.fetchError = ac.signal.reason;
3508
- if (ignoreAbort)
3509
- options.status.fetchAbortIgnored = true;
3510
- } else {
3511
- options.status.fetchResolved = true;
3512
- }
3513
- }
3514
- if (aborted2 && !ignoreAbort && !updateCache) {
3515
- return fetchFail(ac.signal.reason);
3516
- }
3517
- const bf2 = p;
3518
- const vl = this.#valList[index];
3519
- if (vl === p || ignoreAbort && updateCache && vl === void 0) {
3520
- if (v2 === void 0) {
3521
- if (bf2.__staleWhileFetching !== void 0) {
3522
- this.#valList[index] = bf2.__staleWhileFetching;
3523
- } else {
3524
- this.#delete(k, "fetch");
3525
- }
3526
- } else {
3527
- if (options.status)
3528
- options.status.fetchUpdated = true;
3529
- this.set(k, v2, fetchOpts.options);
3530
- }
3531
- }
3532
- return v2;
3533
- };
3534
- const eb = (er) => {
3535
- if (options.status) {
3536
- options.status.fetchRejected = true;
3537
- options.status.fetchError = er;
3538
- }
3539
- return fetchFail(er);
3540
- };
3541
- const fetchFail = (er) => {
3542
- const { aborted: aborted2 } = ac.signal;
3543
- const allowStaleAborted = aborted2 && options.allowStaleOnFetchAbort;
3544
- const allowStale = allowStaleAborted || options.allowStaleOnFetchRejection;
3545
- const noDelete = allowStale || options.noDeleteOnFetchRejection;
3546
- const bf2 = p;
3547
- if (this.#valList[index] === p) {
3548
- const del = !noDelete || bf2.__staleWhileFetching === void 0;
3549
- if (del) {
3550
- this.#delete(k, "fetch");
3551
- } else if (!allowStaleAborted) {
3552
- this.#valList[index] = bf2.__staleWhileFetching;
3553
- }
3554
- }
3555
- if (allowStale) {
3556
- if (options.status && bf2.__staleWhileFetching !== void 0) {
3557
- options.status.returnedStale = true;
3558
- }
3559
- return bf2.__staleWhileFetching;
3560
- } else if (bf2.__returned === bf2) {
3561
- throw er;
3562
- }
3563
- };
3564
- const pcall = (res, rej) => {
3565
- const fmp = this.#fetchMethod?.(k, v, fetchOpts);
3566
- if (fmp && fmp instanceof Promise) {
3567
- fmp.then((v2) => res(v2 === void 0 ? void 0 : v2), rej);
3568
- }
3569
- ac.signal.addEventListener("abort", () => {
3570
- if (!options.ignoreFetchAbort || options.allowStaleOnFetchAbort) {
3571
- res(void 0);
3572
- if (options.allowStaleOnFetchAbort) {
3573
- res = (v2) => cb(v2, true);
3574
- }
3575
- }
2888
+ peek(t, e = {}) {
2889
+ let { allowStale: i2 = this.allowStale } = e, s = this.#s.get(t);
2890
+ if (s === void 0 || !i2 && this.#p(s)) return;
2891
+ let n2 = this.#t[s];
2892
+ return this.#e(n2) ? n2.__staleWhileFetching : n2;
2893
+ }
2894
+ #x(t, e, i2, s) {
2895
+ let n2 = e === void 0 ? void 0 : this.#t[e];
2896
+ if (this.#e(n2)) return n2;
2897
+ let o2 = new C(), { signal: h2 } = i2;
2898
+ h2?.addEventListener("abort", () => o2.abort(h2.reason), { signal: o2.signal });
2899
+ let r = { signal: o2.signal, options: i2, context: s }, a2 = (p, _ = false) => {
2900
+ let { aborted: l } = o2.signal, S = i2.ignoreFetchAbort && p !== void 0, b = i2.ignoreFetchAbort || !!(i2.allowStaleOnFetchAbort && p !== void 0);
2901
+ if (i2.status && (l && !_ ? (i2.status.fetchAborted = true, i2.status.fetchError = o2.signal.reason, S && (i2.status.fetchAbortIgnored = true)) : i2.status.fetchResolved = true), l && !S && !_) return f(o2.signal.reason, b);
2902
+ let m = g, u2 = this.#t[e];
2903
+ return (u2 === g || S && _ && u2 === void 0) && (p === void 0 ? m.__staleWhileFetching !== void 0 ? this.#t[e] = m.__staleWhileFetching : this.#E(t, "fetch") : (i2.status && (i2.status.fetchUpdated = true), this.set(t, p, r.options))), p;
2904
+ }, w = (p) => (i2.status && (i2.status.fetchRejected = true, i2.status.fetchError = p), f(p, false)), f = (p, _) => {
2905
+ let { aborted: l } = o2.signal, S = l && i2.allowStaleOnFetchAbort, b = S || i2.allowStaleOnFetchRejection, m = b || i2.noDeleteOnFetchRejection, u2 = g;
2906
+ if (this.#t[e] === g && (!m || !_ && u2.__staleWhileFetching === void 0 ? this.#E(t, "fetch") : S || (this.#t[e] = u2.__staleWhileFetching)), b) return i2.status && u2.__staleWhileFetching !== void 0 && (i2.status.returnedStale = true), u2.__staleWhileFetching;
2907
+ if (u2.__returned === u2) throw p;
2908
+ }, d = (p, _) => {
2909
+ let l = this.#L?.(t, n2, r);
2910
+ l && l instanceof Promise && l.then((S) => p(S === void 0 ? void 0 : S), _), o2.signal.addEventListener("abort", () => {
2911
+ (!i2.ignoreFetchAbort || i2.allowStaleOnFetchAbort) && (p(void 0), i2.allowStaleOnFetchAbort && (p = (S) => a2(S, true)));
3576
2912
  });
3577
2913
  };
3578
- if (options.status)
3579
- options.status.fetchDispatched = true;
3580
- const p = new Promise(pcall).then(cb, eb);
3581
- const bf = Object.assign(p, {
3582
- __abortController: ac,
3583
- __staleWhileFetching: v,
3584
- __returned: void 0
3585
- });
3586
- if (index === void 0) {
3587
- this.set(k, bf, { ...fetchOpts.options, status: void 0 });
3588
- index = this.#keyMap.get(k);
2914
+ i2.status && (i2.status.fetchDispatched = true);
2915
+ let g = new Promise(d).then(a2, w), A = Object.assign(g, { __abortController: o2, __staleWhileFetching: n2, __returned: void 0 });
2916
+ return e === void 0 ? (this.set(t, A, { ...r.options, status: void 0 }), e = this.#s.get(t)) : this.#t[e] = A, A;
2917
+ }
2918
+ #e(t) {
2919
+ if (!this.#v) return false;
2920
+ let e = t;
2921
+ return !!e && e instanceof Promise && e.hasOwnProperty("__staleWhileFetching") && e.__abortController instanceof C;
2922
+ }
2923
+ async fetch(t, e = {}) {
2924
+ let { allowStale: i2 = this.allowStale, updateAgeOnGet: s = this.updateAgeOnGet, noDeleteOnStaleGet: n2 = this.noDeleteOnStaleGet, ttl: o2 = this.ttl, noDisposeOnSet: h2 = this.noDisposeOnSet, size: r = 0, sizeCalculation: a2 = this.sizeCalculation, noUpdateTTL: w = this.noUpdateTTL, noDeleteOnFetchRejection: f = this.noDeleteOnFetchRejection, allowStaleOnFetchRejection: d = this.allowStaleOnFetchRejection, ignoreFetchAbort: g = this.ignoreFetchAbort, allowStaleOnFetchAbort: A = this.allowStaleOnFetchAbort, context: p, forceRefresh: _ = false, status: l, signal: S } = e;
2925
+ if (!this.#v) return l && (l.fetch = "get"), this.get(t, { allowStale: i2, updateAgeOnGet: s, noDeleteOnStaleGet: n2, status: l });
2926
+ let b = { allowStale: i2, updateAgeOnGet: s, noDeleteOnStaleGet: n2, ttl: o2, noDisposeOnSet: h2, size: r, sizeCalculation: a2, noUpdateTTL: w, noDeleteOnFetchRejection: f, allowStaleOnFetchRejection: d, allowStaleOnFetchAbort: A, ignoreFetchAbort: g, status: l, signal: S }, m = this.#s.get(t);
2927
+ if (m === void 0) {
2928
+ l && (l.fetch = "miss");
2929
+ let u2 = this.#x(t, m, b, p);
2930
+ return u2.__returned = u2;
3589
2931
  } else {
3590
- this.#valList[index] = bf;
3591
- }
3592
- return bf;
3593
- }
3594
- #isBackgroundFetch(p) {
3595
- if (!this.#hasFetchMethod)
3596
- return false;
3597
- const b = p;
3598
- return !!b && b instanceof Promise && b.hasOwnProperty("__staleWhileFetching") && b.__abortController instanceof AC;
3599
- }
3600
- async fetch(k, fetchOptions = {}) {
3601
- const {
3602
- // get options
3603
- allowStale = this.allowStale,
3604
- updateAgeOnGet = this.updateAgeOnGet,
3605
- noDeleteOnStaleGet = this.noDeleteOnStaleGet,
3606
- // set options
3607
- ttl = this.ttl,
3608
- noDisposeOnSet = this.noDisposeOnSet,
3609
- size = 0,
3610
- sizeCalculation = this.sizeCalculation,
3611
- noUpdateTTL = this.noUpdateTTL,
3612
- // fetch exclusive options
3613
- noDeleteOnFetchRejection = this.noDeleteOnFetchRejection,
3614
- allowStaleOnFetchRejection = this.allowStaleOnFetchRejection,
3615
- ignoreFetchAbort = this.ignoreFetchAbort,
3616
- allowStaleOnFetchAbort = this.allowStaleOnFetchAbort,
3617
- context,
3618
- forceRefresh = false,
3619
- status,
3620
- signal
3621
- } = fetchOptions;
3622
- if (!this.#hasFetchMethod) {
3623
- if (status)
3624
- status.fetch = "get";
3625
- return this.get(k, {
3626
- allowStale,
3627
- updateAgeOnGet,
3628
- noDeleteOnStaleGet,
3629
- status
3630
- });
3631
- }
3632
- const options = {
3633
- allowStale,
3634
- updateAgeOnGet,
3635
- noDeleteOnStaleGet,
3636
- ttl,
3637
- noDisposeOnSet,
3638
- size,
3639
- sizeCalculation,
3640
- noUpdateTTL,
3641
- noDeleteOnFetchRejection,
3642
- allowStaleOnFetchRejection,
3643
- allowStaleOnFetchAbort,
3644
- ignoreFetchAbort,
3645
- status,
3646
- signal
3647
- };
3648
- let index = this.#keyMap.get(k);
3649
- if (index === void 0) {
3650
- if (status)
3651
- status.fetch = "miss";
3652
- const p = this.#backgroundFetch(k, index, options, context);
3653
- return p.__returned = p;
3654
- } else {
3655
- const v = this.#valList[index];
3656
- if (this.#isBackgroundFetch(v)) {
3657
- const stale = allowStale && v.__staleWhileFetching !== void 0;
3658
- if (status) {
3659
- status.fetch = "inflight";
3660
- if (stale)
3661
- status.returnedStale = true;
3662
- }
3663
- return stale ? v.__staleWhileFetching : v.__returned = v;
3664
- }
3665
- const isStale = this.#isStale(index);
3666
- if (!forceRefresh && !isStale) {
3667
- if (status)
3668
- status.fetch = "hit";
3669
- this.#moveToTail(index);
3670
- if (updateAgeOnGet) {
3671
- this.#updateItemAge(index);
3672
- }
3673
- if (status)
3674
- this.#statusTTL(status, index);
3675
- return v;
3676
- }
3677
- const p = this.#backgroundFetch(k, index, options, context);
3678
- const hasStale = p.__staleWhileFetching !== void 0;
3679
- const staleVal = hasStale && allowStale;
3680
- if (status) {
3681
- status.fetch = isStale ? "stale" : "refresh";
3682
- if (staleVal && isStale)
3683
- status.returnedStale = true;
3684
- }
3685
- return staleVal ? p.__staleWhileFetching : p.__returned = p;
3686
- }
3687
- }
3688
- async forceFetch(k, fetchOptions = {}) {
3689
- const v = await this.fetch(k, fetchOptions);
3690
- if (v === void 0)
3691
- throw new Error("fetch() returned undefined");
3692
- return v;
3693
- }
3694
- memo(k, memoOptions = {}) {
3695
- const memoMethod = this.#memoMethod;
3696
- if (!memoMethod) {
3697
- throw new Error("no memoMethod provided to constructor");
3698
- }
3699
- const { context, forceRefresh, ...options } = memoOptions;
3700
- const v = this.get(k, options);
3701
- if (!forceRefresh && v !== void 0)
3702
- return v;
3703
- const vv = memoMethod(k, v, {
3704
- options,
3705
- context
3706
- });
3707
- this.set(k, vv, options);
3708
- return vv;
3709
- }
3710
- /**
3711
- * Return a value from the cache. Will update the recency of the cache
3712
- * entry found.
3713
- *
3714
- * If the key is not found, get() will return `undefined`.
3715
- */
3716
- get(k, getOptions = {}) {
3717
- const { allowStale = this.allowStale, updateAgeOnGet = this.updateAgeOnGet, noDeleteOnStaleGet = this.noDeleteOnStaleGet, status } = getOptions;
3718
- const index = this.#keyMap.get(k);
3719
- if (index !== void 0) {
3720
- const value = this.#valList[index];
3721
- const fetching = this.#isBackgroundFetch(value);
3722
- if (status)
3723
- this.#statusTTL(status, index);
3724
- if (this.#isStale(index)) {
3725
- if (status)
3726
- status.get = "stale";
3727
- if (!fetching) {
3728
- if (!noDeleteOnStaleGet) {
3729
- this.#delete(k, "expire");
3730
- }
3731
- if (status && allowStale)
3732
- status.returnedStale = true;
3733
- return allowStale ? value : void 0;
3734
- } else {
3735
- if (status && allowStale && value.__staleWhileFetching !== void 0) {
3736
- status.returnedStale = true;
3737
- }
3738
- return allowStale ? value.__staleWhileFetching : void 0;
3739
- }
3740
- } else {
3741
- if (status)
3742
- status.get = "hit";
3743
- if (fetching) {
3744
- return value.__staleWhileFetching;
3745
- }
3746
- this.#moveToTail(index);
3747
- if (updateAgeOnGet) {
3748
- this.#updateItemAge(index);
3749
- }
3750
- return value;
2932
+ let u2 = this.#t[m];
2933
+ if (this.#e(u2)) {
2934
+ let E = i2 && u2.__staleWhileFetching !== void 0;
2935
+ return l && (l.fetch = "inflight", E && (l.returnedStale = true)), E ? u2.__staleWhileFetching : u2.__returned = u2;
3751
2936
  }
3752
- } else if (status) {
3753
- status.get = "miss";
2937
+ let T = this.#p(m);
2938
+ if (!_ && !T) return l && (l.fetch = "hit"), this.#D(m), s && this.#R(m), l && this.#z(l, m), u2;
2939
+ let F = this.#x(t, m, b, p), O = F.__staleWhileFetching !== void 0 && i2;
2940
+ return l && (l.fetch = T ? "stale" : "refresh", O && T && (l.returnedStale = true)), O ? F.__staleWhileFetching : F.__returned = F;
3754
2941
  }
3755
2942
  }
3756
- #connect(p, n2) {
3757
- this.#prev[n2] = p;
3758
- this.#next[p] = n2;
3759
- }
3760
- #moveToTail(index) {
3761
- if (index !== this.#tail) {
3762
- if (index === this.#head) {
3763
- this.#head = this.#next[index];
3764
- } else {
3765
- this.#connect(this.#prev[index], this.#next[index]);
3766
- }
3767
- this.#connect(this.#tail, index);
3768
- this.#tail = index;
3769
- }
2943
+ async forceFetch(t, e = {}) {
2944
+ let i2 = await this.fetch(t, e);
2945
+ if (i2 === void 0) throw new Error("fetch() returned undefined");
2946
+ return i2;
3770
2947
  }
3771
- /**
3772
- * Deletes a key out of the cache.
3773
- *
3774
- * Returns true if the key was deleted, false otherwise.
3775
- */
3776
- delete(k) {
3777
- return this.#delete(k, "delete");
3778
- }
3779
- #delete(k, reason) {
3780
- let deleted = false;
3781
- if (this.#size !== 0) {
3782
- const index = this.#keyMap.get(k);
3783
- if (index !== void 0) {
3784
- deleted = true;
3785
- if (this.#size === 1) {
3786
- this.#clear(reason);
3787
- } else {
3788
- this.#removeItemSize(index);
3789
- const v = this.#valList[index];
3790
- if (this.#isBackgroundFetch(v)) {
3791
- v.__abortController.abort(new Error("deleted"));
3792
- } else if (this.#hasDispose || this.#hasDisposeAfter) {
3793
- if (this.#hasDispose) {
3794
- this.#dispose?.(v, k, reason);
3795
- }
3796
- if (this.#hasDisposeAfter) {
3797
- this.#disposed?.push([v, k, reason]);
3798
- }
3799
- }
3800
- this.#keyMap.delete(k);
3801
- this.#keyList[index] = void 0;
3802
- this.#valList[index] = void 0;
3803
- if (index === this.#tail) {
3804
- this.#tail = this.#prev[index];
3805
- } else if (index === this.#head) {
3806
- this.#head = this.#next[index];
3807
- } else {
3808
- const pi = this.#prev[index];
3809
- this.#next[pi] = this.#next[index];
3810
- const ni = this.#next[index];
3811
- this.#prev[ni] = this.#prev[index];
3812
- }
3813
- this.#size--;
3814
- this.#free.push(index);
2948
+ memo(t, e = {}) {
2949
+ let i2 = this.#U;
2950
+ if (!i2) throw new Error("no memoMethod provided to constructor");
2951
+ let { context: s, forceRefresh: n2, ...o2 } = e, h2 = this.get(t, o2);
2952
+ if (!n2 && h2 !== void 0) return h2;
2953
+ let r = i2(t, h2, { options: o2, context: s });
2954
+ return this.set(t, r, o2), r;
2955
+ }
2956
+ get(t, e = {}) {
2957
+ let { allowStale: i2 = this.allowStale, updateAgeOnGet: s = this.updateAgeOnGet, noDeleteOnStaleGet: n2 = this.noDeleteOnStaleGet, status: o2 } = e, h2 = this.#s.get(t);
2958
+ if (h2 !== void 0) {
2959
+ let r = this.#t[h2], a2 = this.#e(r);
2960
+ return o2 && this.#z(o2, h2), this.#p(h2) ? (o2 && (o2.get = "stale"), a2 ? (o2 && i2 && r.__staleWhileFetching !== void 0 && (o2.returnedStale = true), i2 ? r.__staleWhileFetching : void 0) : (n2 || this.#E(t, "expire"), o2 && i2 && (o2.returnedStale = true), i2 ? r : void 0)) : (o2 && (o2.get = "hit"), a2 ? r.__staleWhileFetching : (this.#D(h2), s && this.#R(h2), r));
2961
+ } else o2 && (o2.get = "miss");
2962
+ }
2963
+ #k(t, e) {
2964
+ this.#u[e] = t, this.#a[t] = e;
2965
+ }
2966
+ #D(t) {
2967
+ t !== this.#h && (t === this.#l ? this.#l = this.#a[t] : this.#k(this.#u[t], this.#a[t]), this.#k(this.#h, t), this.#h = t);
2968
+ }
2969
+ delete(t) {
2970
+ return this.#E(t, "delete");
2971
+ }
2972
+ #E(t, e) {
2973
+ let i2 = false;
2974
+ if (this.#n !== 0) {
2975
+ let s = this.#s.get(t);
2976
+ if (s !== void 0) if (this.#g?.[s] && (clearTimeout(this.#g?.[s]), this.#g[s] = void 0), i2 = true, this.#n === 1) this.#V(e);
2977
+ else {
2978
+ this.#W(s);
2979
+ let n2 = this.#t[s];
2980
+ if (this.#e(n2) ? n2.__abortController.abort(new Error("deleted")) : (this.#T || this.#f) && (this.#T && this.#w?.(n2, t, e), this.#f && this.#r?.push([n2, t, e])), this.#s.delete(t), this.#i[s] = void 0, this.#t[s] = void 0, s === this.#h) this.#h = this.#u[s];
2981
+ else if (s === this.#l) this.#l = this.#a[s];
2982
+ else {
2983
+ let o2 = this.#u[s];
2984
+ this.#a[o2] = this.#a[s];
2985
+ let h2 = this.#a[s];
2986
+ this.#u[h2] = this.#u[s];
3815
2987
  }
2988
+ this.#n--, this.#b.push(s);
3816
2989
  }
3817
2990
  }
3818
- if (this.#hasDisposeAfter && this.#disposed?.length) {
3819
- const dt = this.#disposed;
3820
- let task;
3821
- while (task = dt?.shift()) {
3822
- this.#disposeAfter?.(...task);
3823
- }
2991
+ if (this.#f && this.#r?.length) {
2992
+ let s = this.#r, n2;
2993
+ for (; n2 = s?.shift(); ) this.#S?.(...n2);
3824
2994
  }
3825
- return deleted;
2995
+ return i2;
3826
2996
  }
3827
- /**
3828
- * Clear the cache entirely, throwing away all values.
3829
- */
3830
2997
  clear() {
3831
- return this.#clear("delete");
2998
+ return this.#V("delete");
3832
2999
  }
3833
- #clear(reason) {
3834
- for (const index of this.#rindexes({ allowStale: true })) {
3835
- const v = this.#valList[index];
3836
- if (this.#isBackgroundFetch(v)) {
3837
- v.__abortController.abort(new Error("deleted"));
3838
- } else {
3839
- const k = this.#keyList[index];
3840
- if (this.#hasDispose) {
3841
- this.#dispose?.(v, k, reason);
3842
- }
3843
- if (this.#hasDisposeAfter) {
3844
- this.#disposed?.push([v, k, reason]);
3845
- }
3000
+ #V(t) {
3001
+ for (let e of this.#O({ allowStale: true })) {
3002
+ let i2 = this.#t[e];
3003
+ if (this.#e(i2)) i2.__abortController.abort(new Error("deleted"));
3004
+ else {
3005
+ let s = this.#i[e];
3006
+ this.#T && this.#w?.(i2, s, t), this.#f && this.#r?.push([i2, s, t]);
3846
3007
  }
3847
3008
  }
3848
- this.#keyMap.clear();
3849
- this.#valList.fill(void 0);
3850
- this.#keyList.fill(void 0);
3851
- if (this.#ttls && this.#starts) {
3852
- this.#ttls.fill(0);
3853
- this.#starts.fill(0);
3854
- }
3855
- if (this.#sizes) {
3856
- this.#sizes.fill(0);
3009
+ if (this.#s.clear(), this.#t.fill(void 0), this.#i.fill(void 0), this.#d && this.#A) {
3010
+ this.#d.fill(0), this.#A.fill(0);
3011
+ for (let e of this.#g ?? []) e !== void 0 && clearTimeout(e);
3012
+ this.#g?.fill(void 0);
3857
3013
  }
3858
- this.#head = 0;
3859
- this.#tail = 0;
3860
- this.#free.length = 0;
3861
- this.#calculatedSize = 0;
3862
- this.#size = 0;
3863
- if (this.#hasDisposeAfter && this.#disposed) {
3864
- const dt = this.#disposed;
3865
- let task;
3866
- while (task = dt?.shift()) {
3867
- this.#disposeAfter?.(...task);
3868
- }
3014
+ if (this.#y && this.#y.fill(0), this.#l = 0, this.#h = 0, this.#b.length = 0, this.#_ = 0, this.#n = 0, this.#f && this.#r) {
3015
+ let e = this.#r, i2;
3016
+ for (; i2 = e?.shift(); ) this.#S?.(...i2);
3869
3017
  }
3870
3018
  }
3871
3019
  };
3872
- exports.LRUCache = LRUCache;
3020
+ exports.LRUCache = D;
3873
3021
  }
3874
3022
  });
3875
3023
 
@@ -4188,7 +3336,7 @@ var require_from_url = __commonJS({
4188
3336
  var require_lib = __commonJS({
4189
3337
  "node_modules/hosted-git-info/lib/index.js"(exports, module) {
4190
3338
  "use strict";
4191
- var { LRUCache } = require_commonjs();
3339
+ var { LRUCache } = require_index_min();
4192
3340
  var hosts = require_hosts();
4193
3341
  var fromUrl = require_from_url();
4194
3342
  var parseUrl = require_parse_url();
@@ -4361,11 +3509,18 @@ var require_lib = __commonJS({
4361
3509
  }
4362
3510
  });
4363
3511
 
3512
+ // node_modules/npm-package-arg/node_modules/validate-npm-package-name/lib/builtin-modules.json
3513
+ var require_builtin_modules = __commonJS({
3514
+ "node_modules/npm-package-arg/node_modules/validate-npm-package-name/lib/builtin-modules.json"(exports, module) {
3515
+ module.exports = ["_http_agent", "_http_client", "_http_common", "_http_incoming", "_http_outgoing", "_http_server", "_stream_duplex", "_stream_passthrough", "_stream_readable", "_stream_transform", "_stream_wrap", "_stream_writable", "_tls_common", "_tls_wrap", "assert", "assert/strict", "async_hooks", "buffer", "child_process", "cluster", "console", "constants", "crypto", "dgram", "diagnostics_channel", "dns", "dns/promises", "domain", "events", "fs", "fs/promises", "http", "http2", "https", "inspector", "inspector/promises", "module", "net", "os", "path", "path/posix", "path/win32", "perf_hooks", "process", "punycode", "querystring", "readline", "readline/promises", "repl", "stream", "stream/consumers", "stream/promises", "stream/web", "string_decoder", "sys", "timers", "timers/promises", "tls", "trace_events", "tty", "url", "util", "util/types", "v8", "vm", "wasi", "worker_threads", "zlib", "node:sea", "node:sqlite", "node:test", "node:test/reporters"];
3516
+ }
3517
+ });
3518
+
4364
3519
  // node_modules/npm-package-arg/node_modules/validate-npm-package-name/lib/index.js
4365
3520
  var require_lib2 = __commonJS({
4366
3521
  "node_modules/npm-package-arg/node_modules/validate-npm-package-name/lib/index.js"(exports, module) {
4367
3522
  "use strict";
4368
- var { builtinModules: builtins } = __require("module");
3523
+ var builtins = require_builtin_modules();
4369
3524
  var scopedPackagePattern = new RegExp("^(?:@([^/]+?)[/])?([^/]+?)$");
4370
3525
  var exclusionList = [
4371
3526
  "node_modules",
@@ -4392,6 +3547,9 @@ var require_lib2 = __commonJS({
4392
3547
  if (name.startsWith(".")) {
4393
3548
  errors.push("name cannot start with a period");
4394
3549
  }
3550
+ if (name.startsWith("-")) {
3551
+ errors.push("name cannot start with a hyphen");
3552
+ }
4395
3553
  if (name.match(/^_/)) {
4396
3554
  errors.push("name cannot start with an underscore");
4397
3555
  }
@@ -4577,10 +3735,14 @@ var require_lib3 = __commonJS({
4577
3735
  end: "end",
4578
3736
  read: "read"
4579
3737
  },
4580
- start: function(fn) {
4581
- process.emit("input", "start");
3738
+ start: function(...args) {
3739
+ let fn;
3740
+ if (typeof args[0] === "function") {
3741
+ fn = args.shift();
3742
+ }
3743
+ process.emit("input", "start", ...args);
4582
3744
  function end() {
4583
- return process.emit("input", "end");
3745
+ return process.emit("input", "end", ...args);
4584
3746
  }
4585
3747
  if (typeof fn === "function") {
4586
3748
  const res = fn();
@@ -4592,8 +3754,8 @@ var require_lib3 = __commonJS({
4592
3754
  }
4593
3755
  return end;
4594
3756
  },
4595
- end: function() {
4596
- return process.emit("input", "end");
3757
+ end: function(...args) {
3758
+ return process.emit("input", "end", ...args);
4597
3759
  },
4598
3760
  read: function(...args) {
4599
3761
  let resolve2, reject;
@@ -5075,9 +4237,9 @@ var require_path = __commonJS({
5075
4237
  "use strict";
5076
4238
  Object.defineProperty(exports, "__esModule", { value: true });
5077
4239
  exports.convertPosixPathToPattern = exports.convertWindowsPathToPattern = exports.convertPathToPattern = exports.escapePosixPath = exports.escapeWindowsPath = exports.escape = exports.removeLeadingDotSegment = exports.makeAbsolute = exports.unixify = void 0;
5078
- var os4 = __require("os");
4240
+ var os5 = __require("os");
5079
4241
  var path26 = __require("path");
5080
- var IS_WINDOWS_PLATFORM = os4.platform() === "win32";
4242
+ var IS_WINDOWS_PLATFORM = os5.platform() === "win32";
5081
4243
  var LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2;
5082
4244
  var POSIX_UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\()|\\(?![!()*+?@[\]{|}]))/g;
5083
4245
  var WINDOWS_UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()[\]{}]|^!|[!+@](?=\())/g;
@@ -6381,13 +5543,14 @@ var require_braces = __commonJS({
6381
5543
  }
6382
5544
  });
6383
5545
 
6384
- // node_modules/picomatch/lib/constants.js
5546
+ // node_modules/micromatch/node_modules/picomatch/lib/constants.js
6385
5547
  var require_constants3 = __commonJS({
6386
- "node_modules/picomatch/lib/constants.js"(exports, module) {
5548
+ "node_modules/micromatch/node_modules/picomatch/lib/constants.js"(exports, module) {
6387
5549
  "use strict";
6388
5550
  var path26 = __require("path");
6389
5551
  var WIN_SLASH = "\\\\/";
6390
5552
  var WIN_NO_SLASH = `[^${WIN_SLASH}]`;
5553
+ var DEFAULT_MAX_EXTGLOB_RECURSION = 0;
6391
5554
  var DOT_LITERAL = "\\.";
6392
5555
  var PLUS_LITERAL = "\\+";
6393
5556
  var QMARK_LITERAL = "\\?";
@@ -6435,6 +5598,7 @@ var require_constants3 = __commonJS({
6435
5598
  END_ANCHOR: `(?:[${WIN_SLASH}]|$)`
6436
5599
  };
6437
5600
  var POSIX_REGEX_SOURCE = {
5601
+ __proto__: null,
6438
5602
  alnum: "a-zA-Z0-9",
6439
5603
  alpha: "a-zA-Z",
6440
5604
  ascii: "\\x00-\\x7F",
@@ -6451,6 +5615,7 @@ var require_constants3 = __commonJS({
6451
5615
  xdigit: "A-Fa-f0-9"
6452
5616
  };
6453
5617
  module.exports = {
5618
+ DEFAULT_MAX_EXTGLOB_RECURSION,
6454
5619
  MAX_LENGTH: 1024 * 64,
6455
5620
  POSIX_REGEX_SOURCE,
6456
5621
  // regular expressions
@@ -6462,6 +5627,7 @@ var require_constants3 = __commonJS({
6462
5627
  REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
6463
5628
  // Replace globs with equivalent patterns to reduce parsing time.
6464
5629
  REPLACEMENTS: {
5630
+ __proto__: null,
6465
5631
  "***": "*",
6466
5632
  "**/**": "**",
6467
5633
  "**/**/**": "**"
@@ -6578,9 +5744,9 @@ var require_constants3 = __commonJS({
6578
5744
  }
6579
5745
  });
6580
5746
 
6581
- // node_modules/picomatch/lib/utils.js
5747
+ // node_modules/micromatch/node_modules/picomatch/lib/utils.js
6582
5748
  var require_utils2 = __commonJS({
6583
- "node_modules/picomatch/lib/utils.js"(exports) {
5749
+ "node_modules/micromatch/node_modules/picomatch/lib/utils.js"(exports) {
6584
5750
  "use strict";
6585
5751
  var path26 = __require("path");
6586
5752
  var win32 = process.platform === "win32";
@@ -6639,9 +5805,9 @@ var require_utils2 = __commonJS({
6639
5805
  }
6640
5806
  });
6641
5807
 
6642
- // node_modules/picomatch/lib/scan.js
5808
+ // node_modules/micromatch/node_modules/picomatch/lib/scan.js
6643
5809
  var require_scan = __commonJS({
6644
- "node_modules/picomatch/lib/scan.js"(exports, module) {
5810
+ "node_modules/micromatch/node_modules/picomatch/lib/scan.js"(exports, module) {
6645
5811
  "use strict";
6646
5812
  var utils = require_utils2();
6647
5813
  var {
@@ -6963,40 +6129,247 @@ var require_scan = __commonJS({
6963
6129
  state.slashes = slashes;
6964
6130
  state.parts = parts;
6965
6131
  }
6966
- return state;
6967
- };
6968
- module.exports = scan;
6969
- }
6970
- });
6971
-
6972
- // node_modules/picomatch/lib/parse.js
6973
- var require_parse4 = __commonJS({
6974
- "node_modules/picomatch/lib/parse.js"(exports, module) {
6975
- "use strict";
6976
- var constants6 = require_constants3();
6977
- var utils = require_utils2();
6978
- var {
6979
- MAX_LENGTH,
6980
- POSIX_REGEX_SOURCE,
6981
- REGEX_NON_SPECIAL_CHARS,
6982
- REGEX_SPECIAL_CHARS_BACKREF,
6983
- REPLACEMENTS
6984
- } = constants6;
6985
- var expandRange = (args, options) => {
6986
- if (typeof options.expandRange === "function") {
6987
- return options.expandRange(...args, options);
6132
+ return state;
6133
+ };
6134
+ module.exports = scan;
6135
+ }
6136
+ });
6137
+
6138
+ // node_modules/micromatch/node_modules/picomatch/lib/parse.js
6139
+ var require_parse4 = __commonJS({
6140
+ "node_modules/micromatch/node_modules/picomatch/lib/parse.js"(exports, module) {
6141
+ "use strict";
6142
+ var constants6 = require_constants3();
6143
+ var utils = require_utils2();
6144
+ var {
6145
+ MAX_LENGTH,
6146
+ POSIX_REGEX_SOURCE,
6147
+ REGEX_NON_SPECIAL_CHARS,
6148
+ REGEX_SPECIAL_CHARS_BACKREF,
6149
+ REPLACEMENTS
6150
+ } = constants6;
6151
+ var expandRange = (args, options) => {
6152
+ if (typeof options.expandRange === "function") {
6153
+ return options.expandRange(...args, options);
6154
+ }
6155
+ args.sort();
6156
+ const value = `[${args.join("-")}]`;
6157
+ try {
6158
+ new RegExp(value);
6159
+ } catch (ex) {
6160
+ return args.map((v) => utils.escapeRegex(v)).join("..");
6161
+ }
6162
+ return value;
6163
+ };
6164
+ var syntaxError = (type2, char) => {
6165
+ return `Missing ${type2}: "${char}" - use "\\\\${char}" to match literal characters`;
6166
+ };
6167
+ var splitTopLevel = (input) => {
6168
+ const parts = [];
6169
+ let bracket = 0;
6170
+ let paren = 0;
6171
+ let quote = 0;
6172
+ let value = "";
6173
+ let escaped = false;
6174
+ for (const ch of input) {
6175
+ if (escaped === true) {
6176
+ value += ch;
6177
+ escaped = false;
6178
+ continue;
6179
+ }
6180
+ if (ch === "\\") {
6181
+ value += ch;
6182
+ escaped = true;
6183
+ continue;
6184
+ }
6185
+ if (ch === '"') {
6186
+ quote = quote === 1 ? 0 : 1;
6187
+ value += ch;
6188
+ continue;
6189
+ }
6190
+ if (quote === 0) {
6191
+ if (ch === "[") {
6192
+ bracket++;
6193
+ } else if (ch === "]" && bracket > 0) {
6194
+ bracket--;
6195
+ } else if (bracket === 0) {
6196
+ if (ch === "(") {
6197
+ paren++;
6198
+ } else if (ch === ")" && paren > 0) {
6199
+ paren--;
6200
+ } else if (ch === "|" && paren === 0) {
6201
+ parts.push(value);
6202
+ value = "";
6203
+ continue;
6204
+ }
6205
+ }
6206
+ }
6207
+ value += ch;
6208
+ }
6209
+ parts.push(value);
6210
+ return parts;
6211
+ };
6212
+ var isPlainBranch = (branch2) => {
6213
+ let escaped = false;
6214
+ for (const ch of branch2) {
6215
+ if (escaped === true) {
6216
+ escaped = false;
6217
+ continue;
6218
+ }
6219
+ if (ch === "\\") {
6220
+ escaped = true;
6221
+ continue;
6222
+ }
6223
+ if (/[?*+@!()[\]{}]/.test(ch)) {
6224
+ return false;
6225
+ }
6226
+ }
6227
+ return true;
6228
+ };
6229
+ var normalizeSimpleBranch = (branch2) => {
6230
+ let value = branch2.trim();
6231
+ let changed = true;
6232
+ while (changed === true) {
6233
+ changed = false;
6234
+ if (/^@\([^\\()[\]{}|]+\)$/.test(value)) {
6235
+ value = value.slice(2, -1);
6236
+ changed = true;
6237
+ }
6238
+ }
6239
+ if (!isPlainBranch(value)) {
6240
+ return;
6241
+ }
6242
+ return value.replace(/\\(.)/g, "$1");
6243
+ };
6244
+ var hasRepeatedCharPrefixOverlap = (branches) => {
6245
+ const values = branches.map(normalizeSimpleBranch).filter(Boolean);
6246
+ for (let i2 = 0; i2 < values.length; i2++) {
6247
+ for (let j = i2 + 1; j < values.length; j++) {
6248
+ const a2 = values[i2];
6249
+ const b = values[j];
6250
+ const char = a2[0];
6251
+ if (!char || a2 !== char.repeat(a2.length) || b !== char.repeat(b.length)) {
6252
+ continue;
6253
+ }
6254
+ if (a2 === b || a2.startsWith(b) || b.startsWith(a2)) {
6255
+ return true;
6256
+ }
6257
+ }
6258
+ }
6259
+ return false;
6260
+ };
6261
+ var parseRepeatedExtglob = (pattern, requireEnd = true) => {
6262
+ if (pattern[0] !== "+" && pattern[0] !== "*" || pattern[1] !== "(") {
6263
+ return;
6264
+ }
6265
+ let bracket = 0;
6266
+ let paren = 0;
6267
+ let quote = 0;
6268
+ let escaped = false;
6269
+ for (let i2 = 1; i2 < pattern.length; i2++) {
6270
+ const ch = pattern[i2];
6271
+ if (escaped === true) {
6272
+ escaped = false;
6273
+ continue;
6274
+ }
6275
+ if (ch === "\\") {
6276
+ escaped = true;
6277
+ continue;
6278
+ }
6279
+ if (ch === '"') {
6280
+ quote = quote === 1 ? 0 : 1;
6281
+ continue;
6282
+ }
6283
+ if (quote === 1) {
6284
+ continue;
6285
+ }
6286
+ if (ch === "[") {
6287
+ bracket++;
6288
+ continue;
6289
+ }
6290
+ if (ch === "]" && bracket > 0) {
6291
+ bracket--;
6292
+ continue;
6293
+ }
6294
+ if (bracket > 0) {
6295
+ continue;
6296
+ }
6297
+ if (ch === "(") {
6298
+ paren++;
6299
+ continue;
6300
+ }
6301
+ if (ch === ")") {
6302
+ paren--;
6303
+ if (paren === 0) {
6304
+ if (requireEnd === true && i2 !== pattern.length - 1) {
6305
+ return;
6306
+ }
6307
+ return {
6308
+ type: pattern[0],
6309
+ body: pattern.slice(2, i2),
6310
+ end: i2
6311
+ };
6312
+ }
6313
+ }
6314
+ }
6315
+ };
6316
+ var getStarExtglobSequenceOutput = (pattern) => {
6317
+ let index = 0;
6318
+ const chars = [];
6319
+ while (index < pattern.length) {
6320
+ const match2 = parseRepeatedExtglob(pattern.slice(index), false);
6321
+ if (!match2 || match2.type !== "*") {
6322
+ return;
6323
+ }
6324
+ const branches = splitTopLevel(match2.body).map((branch3) => branch3.trim());
6325
+ if (branches.length !== 1) {
6326
+ return;
6327
+ }
6328
+ const branch2 = normalizeSimpleBranch(branches[0]);
6329
+ if (!branch2 || branch2.length !== 1) {
6330
+ return;
6331
+ }
6332
+ chars.push(branch2);
6333
+ index += match2.end + 1;
6334
+ }
6335
+ if (chars.length < 1) {
6336
+ return;
6988
6337
  }
6989
- args.sort();
6990
- const value = `[${args.join("-")}]`;
6991
- try {
6992
- new RegExp(value);
6993
- } catch (ex) {
6994
- return args.map((v) => utils.escapeRegex(v)).join("..");
6338
+ const source = chars.length === 1 ? utils.escapeRegex(chars[0]) : `[${chars.map((ch) => utils.escapeRegex(ch)).join("")}]`;
6339
+ return `${source}*`;
6340
+ };
6341
+ var repeatedExtglobRecursion = (pattern) => {
6342
+ let depth = 0;
6343
+ let value = pattern.trim();
6344
+ let match2 = parseRepeatedExtglob(value);
6345
+ while (match2) {
6346
+ depth++;
6347
+ value = match2.body.trim();
6348
+ match2 = parseRepeatedExtglob(value);
6995
6349
  }
6996
- return value;
6350
+ return depth;
6997
6351
  };
6998
- var syntaxError = (type2, char) => {
6999
- return `Missing ${type2}: "${char}" - use "\\\\${char}" to match literal characters`;
6352
+ var analyzeRepeatedExtglob = (body, options) => {
6353
+ if (options.maxExtglobRecursion === false) {
6354
+ return { risky: false };
6355
+ }
6356
+ const max = typeof options.maxExtglobRecursion === "number" ? options.maxExtglobRecursion : constants6.DEFAULT_MAX_EXTGLOB_RECURSION;
6357
+ const branches = splitTopLevel(body).map((branch2) => branch2.trim());
6358
+ if (branches.length > 1) {
6359
+ if (branches.some((branch2) => branch2 === "") || branches.some((branch2) => /^[*?]+$/.test(branch2)) || hasRepeatedCharPrefixOverlap(branches)) {
6360
+ return { risky: true };
6361
+ }
6362
+ }
6363
+ for (const branch2 of branches) {
6364
+ const safeOutput = getStarExtglobSequenceOutput(branch2);
6365
+ if (safeOutput) {
6366
+ return { risky: true, safeOutput };
6367
+ }
6368
+ if (repeatedExtglobRecursion(branch2) > max) {
6369
+ return { risky: true };
6370
+ }
6371
+ }
6372
+ return { risky: false };
7000
6373
  };
7001
6374
  var parse2 = (input, options) => {
7002
6375
  if (typeof input !== "string") {
@@ -7129,6 +6502,8 @@ var require_parse4 = __commonJS({
7129
6502
  token.prev = prev;
7130
6503
  token.parens = state.parens;
7131
6504
  token.output = state.output;
6505
+ token.startIndex = state.index;
6506
+ token.tokensIndex = tokens.length;
7132
6507
  const output = (opts.capture ? "(" : "") + token.open;
7133
6508
  increment2("parens");
7134
6509
  push({ type: type2, value: value2, output: state.output ? "" : ONE_CHAR });
@@ -7136,6 +6511,26 @@ var require_parse4 = __commonJS({
7136
6511
  extglobs.push(token);
7137
6512
  };
7138
6513
  const extglobClose = (token) => {
6514
+ const literal = input.slice(token.startIndex, state.index + 1);
6515
+ const body = input.slice(token.startIndex + 2, state.index);
6516
+ const analysis = analyzeRepeatedExtglob(body, opts);
6517
+ if ((token.type === "plus" || token.type === "star") && analysis.risky) {
6518
+ const safeOutput = analysis.safeOutput ? (token.output ? "" : ONE_CHAR) + (opts.capture ? `(${analysis.safeOutput})` : analysis.safeOutput) : void 0;
6519
+ const open = tokens[token.tokensIndex];
6520
+ open.type = "text";
6521
+ open.value = literal;
6522
+ open.output = safeOutput || utils.escapeRegex(literal);
6523
+ for (let i2 = token.tokensIndex + 1; i2 < tokens.length; i2++) {
6524
+ tokens[i2].value = "";
6525
+ tokens[i2].output = "";
6526
+ delete tokens[i2].suffix;
6527
+ }
6528
+ state.output = token.output + open.output;
6529
+ state.backtrack = true;
6530
+ push({ type: "paren", extglob: true, value, output: "" });
6531
+ decrement("parens");
6532
+ return;
6533
+ }
7139
6534
  let output = token.close + (opts.capture ? ")" : "");
7140
6535
  let rest;
7141
6536
  if (token.type === "negate") {
@@ -7742,9 +7137,9 @@ var require_parse4 = __commonJS({
7742
7137
  }
7743
7138
  });
7744
7139
 
7745
- // node_modules/picomatch/lib/picomatch.js
7140
+ // node_modules/micromatch/node_modules/picomatch/lib/picomatch.js
7746
7141
  var require_picomatch = __commonJS({
7747
- "node_modules/picomatch/lib/picomatch.js"(exports, module) {
7142
+ "node_modules/micromatch/node_modules/picomatch/lib/picomatch.js"(exports, module) {
7748
7143
  "use strict";
7749
7144
  var path26 = __require("path");
7750
7145
  var scan = require_scan();
@@ -7883,9 +7278,9 @@ var require_picomatch = __commonJS({
7883
7278
  }
7884
7279
  });
7885
7280
 
7886
- // node_modules/picomatch/index.js
7281
+ // node_modules/micromatch/node_modules/picomatch/index.js
7887
7282
  var require_picomatch2 = __commonJS({
7888
- "node_modules/picomatch/index.js"(exports, module) {
7283
+ "node_modules/micromatch/node_modules/picomatch/index.js"(exports, module) {
7889
7284
  "use strict";
7890
7285
  module.exports = require_picomatch();
7891
7286
  }
@@ -9109,7 +8504,8 @@ var require_queue = __commonJS({
9109
8504
  empty: noop4,
9110
8505
  kill,
9111
8506
  killAndDrain,
9112
- error
8507
+ error,
8508
+ abort
9113
8509
  };
9114
8510
  return self;
9115
8511
  function running() {
@@ -9228,6 +8624,28 @@ var require_queue = __commonJS({
9228
8624
  self.drain();
9229
8625
  self.drain = noop4;
9230
8626
  }
8627
+ function abort() {
8628
+ var current = queueHead;
8629
+ queueHead = null;
8630
+ queueTail = null;
8631
+ while (current) {
8632
+ var next = current.next;
8633
+ var callback = current.callback;
8634
+ var errorHandler2 = current.errorHandler;
8635
+ var val = current.value;
8636
+ var context2 = current.context;
8637
+ current.value = null;
8638
+ current.callback = noop4;
8639
+ current.errorHandler = null;
8640
+ if (errorHandler2) {
8641
+ errorHandler2(new Error("abort"), val);
8642
+ }
8643
+ callback.call(context2, new Error("abort"));
8644
+ current.release(current);
8645
+ current = next;
8646
+ }
8647
+ self.drain = noop4;
8648
+ }
9231
8649
  function error(handler) {
9232
8650
  errorHandler = handler;
9233
8651
  }
@@ -10339,8 +9757,8 @@ var require_settings4 = __commonJS({
10339
9757
  Object.defineProperty(exports, "__esModule", { value: true });
10340
9758
  exports.DEFAULT_FILE_SYSTEM_ADAPTER = void 0;
10341
9759
  var fs11 = __require("fs");
10342
- var os4 = __require("os");
10343
- var CPU_COUNT = Math.max(os4.cpus().length, 1);
9760
+ var os5 = __require("os");
9761
+ var CPU_COUNT = Math.max(os5.cpus().length, 1);
10344
9762
  exports.DEFAULT_FILE_SYSTEM_ADAPTER = {
10345
9763
  lstat: fs11.lstat,
10346
9764
  lstatSync: fs11.lstatSync,
@@ -10493,9 +9911,9 @@ var require_out4 = __commonJS({
10493
9911
  }
10494
9912
  });
10495
9913
 
10496
- // node_modules/globby/node_modules/ignore/index.js
9914
+ // node_modules/ignore/index.js
10497
9915
  var require_ignore = __commonJS({
10498
- "node_modules/globby/node_modules/ignore/index.js"(exports, module) {
9916
+ "node_modules/ignore/index.js"(exports, module) {
10499
9917
  function makeArray(subject) {
10500
9918
  return Array.isArray(subject) ? subject : [subject];
10501
9919
  }
@@ -11561,7 +10979,7 @@ var require_minimist = __commonJS({
11561
10979
  var require_rc = __commonJS({
11562
10980
  "node_modules/rc/index.js"(exports, module) {
11563
10981
  var cc = require_utils5();
11564
- var join2 = __require("path").join;
10982
+ var join = __require("path").join;
11565
10983
  var deepExtend = require_deep_extend();
11566
10984
  var etc = "/etc";
11567
10985
  var win = process.platform === "win32";
@@ -11586,15 +11004,15 @@ var require_rc = __commonJS({
11586
11004
  }
11587
11005
  if (!win)
11588
11006
  [
11589
- join2(etc, name, "config"),
11590
- join2(etc, name + "rc")
11007
+ join(etc, name, "config"),
11008
+ join(etc, name + "rc")
11591
11009
  ].forEach(addConfigFile);
11592
11010
  if (home)
11593
11011
  [
11594
- join2(home, ".config", name, "config"),
11595
- join2(home, ".config", name),
11596
- join2(home, "." + name, "config"),
11597
- join2(home, "." + name + "rc")
11012
+ join(home, ".config", name, "config"),
11013
+ join(home, ".config", name),
11014
+ join(home, "." + name, "config"),
11015
+ join(home, "." + name + "rc")
11598
11016
  ].forEach(addConfigFile);
11599
11017
  addConfigFile(cc.find("." + name + "rc"));
11600
11018
  if (env.config) addConfigFile(env.config);
@@ -12310,7 +11728,7 @@ var require_has_flag = __commonJS({
12310
11728
  var require_supports_color = __commonJS({
12311
11729
  "node_modules/supports-color/index.js"(exports, module) {
12312
11730
  "use strict";
12313
- var os4 = __require("os");
11731
+ var os5 = __require("os");
12314
11732
  var tty3 = __require("tty");
12315
11733
  var hasFlag = require_has_flag();
12316
11734
  var { env } = process;
@@ -12358,7 +11776,7 @@ var require_supports_color = __commonJS({
12358
11776
  return min;
12359
11777
  }
12360
11778
  if (process.platform === "win32") {
12361
- const osRelease = os4.release().split(".");
11779
+ const osRelease = os5.release().split(".");
12362
11780
  if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
12363
11781
  return Number(osRelease[2]) >= 14931 ? 3 : 2;
12364
11782
  }
@@ -13091,6 +12509,7 @@ var require_spdx_license_ids = __commonJS({
13091
12509
  "AGPL-1.0-or-later",
13092
12510
  "AGPL-3.0-only",
13093
12511
  "AGPL-3.0-or-later",
12512
+ "ALGLIB-Documentation",
13094
12513
  "AMD-newlib",
13095
12514
  "AMDPLPA",
13096
12515
  "AML",
@@ -13112,6 +12531,7 @@ var require_spdx_license_ids = __commonJS({
13112
12531
  "Adobe-Display-PostScript",
13113
12532
  "Adobe-Glyph",
13114
12533
  "Adobe-Utopia",
12534
+ "Advanced-Cryptics-Dictionary",
13115
12535
  "Afmparse",
13116
12536
  "Aladdin",
13117
12537
  "Apache-1.0",
@@ -13125,6 +12545,7 @@ var require_spdx_license_ids = __commonJS({
13125
12545
  "Artistic-2.0",
13126
12546
  "Artistic-dist",
13127
12547
  "Aspell-RU",
12548
+ "BOLA-1.1",
13128
12549
  "BSD-1-Clause",
13129
12550
  "BSD-2-Clause",
13130
12551
  "BSD-2-Clause-Darwin",
@@ -13144,6 +12565,7 @@ var require_spdx_license_ids = __commonJS({
13144
12565
  "BSD-3-Clause-No-Nuclear-Warranty",
13145
12566
  "BSD-3-Clause-Open-MPI",
13146
12567
  "BSD-3-Clause-Sun",
12568
+ "BSD-3-Clause-Tso",
13147
12569
  "BSD-3-Clause-acpica",
13148
12570
  "BSD-3-Clause-flex",
13149
12571
  "BSD-4-Clause",
@@ -13154,6 +12576,7 @@ var require_spdx_license_ids = __commonJS({
13154
12576
  "BSD-Advertising-Acknowledgement",
13155
12577
  "BSD-Attribution-HPND-disclaimer",
13156
12578
  "BSD-Inferno-Nettverk",
12579
+ "BSD-Mark-Modifications",
13157
12580
  "BSD-Protection",
13158
12581
  "BSD-Source-Code",
13159
12582
  "BSD-Source-beginning-file",
@@ -13175,9 +12598,11 @@ var require_spdx_license_ids = __commonJS({
13175
12598
  "Borceux",
13176
12599
  "Brian-Gladman-2-Clause",
13177
12600
  "Brian-Gladman-3-Clause",
12601
+ "Buddy",
13178
12602
  "C-UDA-1.0",
13179
12603
  "CAL-1.0",
13180
12604
  "CAL-1.0-Combined-Work-Exception",
12605
+ "CAPEC-tou",
13181
12606
  "CATOSL-1.1",
13182
12607
  "CC-BY-1.0",
13183
12608
  "CC-BY-2.0",
@@ -13295,6 +12720,9 @@ var require_spdx_license_ids = __commonJS({
13295
12720
  "EPICS",
13296
12721
  "EPL-1.0",
13297
12722
  "EPL-2.0",
12723
+ "ESA-PL-permissive-2.4",
12724
+ "ESA-PL-strong-copyleft-2.4",
12725
+ "ESA-PL-weak-copyleft-2.4",
13298
12726
  "EUDatagrid",
13299
12727
  "EUPL-1.0",
13300
12728
  "EUPL-1.1",
@@ -13368,6 +12796,7 @@ var require_spdx_license_ids = __commonJS({
13368
12796
  "HPND-Markus-Kuhn",
13369
12797
  "HPND-Netrek",
13370
12798
  "HPND-Pbmplus",
12799
+ "HPND-SMC",
13371
12800
  "HPND-UC",
13372
12801
  "HPND-UC-export-US",
13373
12802
  "HPND-doc",
@@ -13382,6 +12811,7 @@ var require_spdx_license_ids = __commonJS({
13382
12811
  "HPND-sell-variant",
13383
12812
  "HPND-sell-variant-MIT-disclaimer",
13384
12813
  "HPND-sell-variant-MIT-disclaimer-rev",
12814
+ "HPND-sell-variant-critical-systems",
13385
12815
  "HTMLTIDY",
13386
12816
  "HaskellReport",
13387
12817
  "Hippocratic-2.1",
@@ -13394,6 +12824,7 @@ var require_spdx_license_ids = __commonJS({
13394
12824
  "IPL-1.0",
13395
12825
  "ISC",
13396
12826
  "ISC-Veillard",
12827
+ "ISO-permission",
13397
12828
  "ImageMagick",
13398
12829
  "Imlib2",
13399
12830
  "Info-ZIP",
@@ -13451,6 +12882,7 @@ var require_spdx_license_ids = __commonJS({
13451
12882
  "MIT-Festival",
13452
12883
  "MIT-Khronos-old",
13453
12884
  "MIT-Modern-Variant",
12885
+ "MIT-STK",
13454
12886
  "MIT-Wu",
13455
12887
  "MIT-advertising",
13456
12888
  "MIT-enna",
@@ -13459,6 +12891,7 @@ var require_spdx_license_ids = __commonJS({
13459
12891
  "MIT-testregex",
13460
12892
  "MITNFA",
13461
12893
  "MMIXware",
12894
+ "MMPL-1.0.1",
13462
12895
  "MPEG-SSG",
13463
12896
  "MPL-1.0",
13464
12897
  "MPL-1.1",
@@ -13490,6 +12923,7 @@ var require_spdx_license_ids = __commonJS({
13490
12923
  "NGPL",
13491
12924
  "NICTA-1.0",
13492
12925
  "NIST-PD",
12926
+ "NIST-PD-TNT",
13493
12927
  "NIST-PD-fallback",
13494
12928
  "NIST-Software",
13495
12929
  "NLOD-1.0",
@@ -13549,12 +12983,15 @@ var require_spdx_license_ids = __commonJS({
13549
12983
  "OPL-1.0",
13550
12984
  "OPL-UK-3.0",
13551
12985
  "OPUBL-1.0",
12986
+ "OSC-1.0",
13552
12987
  "OSET-PL-2.1",
13553
12988
  "OSL-1.0",
13554
12989
  "OSL-1.1",
13555
12990
  "OSL-2.0",
13556
12991
  "OSL-2.1",
13557
12992
  "OSL-3.0",
12993
+ "OSSP",
12994
+ "OpenMDW-1.0",
13558
12995
  "OpenPBS-2.3",
13559
12996
  "OpenSSL",
13560
12997
  "OpenSSL-standalone",
@@ -13565,6 +13002,7 @@ var require_spdx_license_ids = __commonJS({
13565
13002
  "PHP-3.01",
13566
13003
  "PPL",
13567
13004
  "PSF-2.0",
13005
+ "ParaType-Free-Font-1.3",
13568
13006
  "Parity-6.0.0",
13569
13007
  "Parity-7.0.0",
13570
13008
  "Pixar",
@@ -13593,6 +13031,7 @@ var require_spdx_license_ids = __commonJS({
13593
13031
  "SGI-B-1.1",
13594
13032
  "SGI-B-2.0",
13595
13033
  "SGI-OpenGL",
13034
+ "SGMLUG-PM",
13596
13035
  "SGP4",
13597
13036
  "SHL-0.5",
13598
13037
  "SHL-0.51",
@@ -13640,6 +13079,7 @@ var require_spdx_license_ids = __commonJS({
13640
13079
  "TTYP0",
13641
13080
  "TU-Berlin-1.0",
13642
13081
  "TU-Berlin-2.0",
13082
+ "TekHVC",
13643
13083
  "TermReadKey",
13644
13084
  "ThirdEye",
13645
13085
  "TrustedQSL",
@@ -13649,6 +13089,7 @@ var require_spdx_license_ids = __commonJS({
13649
13089
  "UPL-1.0",
13650
13090
  "URT-RLE",
13651
13091
  "Ubuntu-font-1.0",
13092
+ "UnRAR",
13652
13093
  "Unicode-3.0",
13653
13094
  "Unicode-DFS-2015",
13654
13095
  "Unicode-DFS-2016",
@@ -13660,15 +13101,19 @@ var require_spdx_license_ids = __commonJS({
13660
13101
  "VOSTROM",
13661
13102
  "VSL-1.0",
13662
13103
  "Vim",
13104
+ "Vixie-Cron",
13663
13105
  "W3C",
13664
13106
  "W3C-19980720",
13665
13107
  "W3C-20150513",
13108
+ "WTFNMFPL",
13666
13109
  "WTFPL",
13667
13110
  "Watcom-1.0",
13668
13111
  "Widget-Workshop",
13112
+ "WordNet",
13669
13113
  "Wsuipa",
13670
13114
  "X11",
13671
13115
  "X11-distribute-modifications-variant",
13116
+ "X11-no-permit-persons",
13672
13117
  "X11-swapped",
13673
13118
  "XFree86-1.1",
13674
13119
  "XSkat",
@@ -13709,6 +13154,7 @@ var require_spdx_license_ids = __commonJS({
13709
13154
  "gnuplot",
13710
13155
  "gtkbook",
13711
13156
  "hdparm",
13157
+ "hyphen-bulgarian",
13712
13158
  "iMatix",
13713
13159
  "jove",
13714
13160
  "libpng-1.6.35",
@@ -15102,7 +14548,7 @@ var require_normalize = __commonJS({
15102
14548
  // src/index.js
15103
14549
  import { randomBytes } from "node:crypto";
15104
14550
  import fs10, { realpathSync as realpathSync2 } from "node:fs";
15105
- import os3 from "node:os";
14551
+ import os4 from "node:os";
15106
14552
  import path25 from "node:path";
15107
14553
 
15108
14554
  // node_modules/indent-string/index.js
@@ -15141,7 +14587,7 @@ function indentString(string, count2 = 1, options = {}) {
15141
14587
  // node_modules/clean-stack/index.js
15142
14588
  import { fileURLToPath } from "node:url";
15143
14589
 
15144
- // node_modules/escape-string-regexp/index.js
14590
+ // node_modules/clean-stack/node_modules/escape-string-regexp/index.js
15145
14591
  function escapeStringRegexp(string) {
15146
14592
  if (typeof string !== "string") {
15147
14593
  throw new TypeError("Expected a string");
@@ -22287,6 +21733,7 @@ import process10 from "node:process";
22287
21733
  import fs3 from "node:fs";
22288
21734
  import fsPromises from "node:fs/promises";
22289
21735
  import path9 from "node:path";
21736
+ import os2 from "node:os";
22290
21737
 
22291
21738
  // node_modules/is-path-inside/index.js
22292
21739
  import path7 from "node:path";
@@ -22536,148 +21983,539 @@ var ignoreFilesGlobOptions = {
22536
21983
  dot: true
22537
21984
  };
22538
21985
  var GITIGNORE_FILES_PATTERN = "**/.gitignore";
21986
+ var MAX_INCLUDE_DEPTH = 10;
22539
21987
  var getReadFileMethod = (fsImplementation) => bindFsMethod(fsImplementation?.promises, "readFile") ?? bindFsMethod(fsPromises, "readFile") ?? promisifyFsMethod(fsImplementation, "readFile");
22540
21988
  var getReadFileSyncMethod = (fsImplementation) => bindFsMethod(fsImplementation, "readFileSync") ?? bindFsMethod(fs3, "readFileSync");
22541
21989
  var shouldSkipIgnoreFileError = (error, suppressErrors) => {
22542
21990
  if (!error) {
22543
21991
  return Boolean(suppressErrors);
22544
21992
  }
22545
- if (error.code === "ENOENT" || error.code === "ENOTDIR") {
22546
- return true;
21993
+ if (error.code === "ENOENT" || error.code === "ENOTDIR") {
21994
+ return true;
21995
+ }
21996
+ return Boolean(suppressErrors);
21997
+ };
21998
+ var createReadError = (kind, filePath, error) => {
21999
+ const prefix = `Failed to read ${kind} at ${filePath}`;
22000
+ if (error instanceof Error) {
22001
+ return new Error(`${prefix}: ${error.message}`, { cause: error });
22002
+ }
22003
+ return new Error(`${prefix}: ${String(error)}`);
22004
+ };
22005
+ var createIgnoreFileReadError = (filePath, error) => createReadError("ignore file", filePath, error);
22006
+ var createGitConfigReadError = (filePath, error) => createReadError("git config", filePath, error);
22007
+ var processIgnoreFileCore = (filePath, readMethod, suppressErrors) => {
22008
+ try {
22009
+ const content = readMethod(filePath, "utf8");
22010
+ return { filePath, content };
22011
+ } catch (error) {
22012
+ if (shouldSkipIgnoreFileError(error, suppressErrors)) {
22013
+ return void 0;
22014
+ }
22015
+ throw createIgnoreFileReadError(filePath, error);
22016
+ }
22017
+ };
22018
+ var readIgnoreFilesSafely = async (paths, readFileMethod, suppressErrors) => {
22019
+ const fileResults = await Promise.all(paths.map(async (filePath) => {
22020
+ try {
22021
+ const content = await readFileMethod(filePath, "utf8");
22022
+ return { filePath, content };
22023
+ } catch (error) {
22024
+ if (shouldSkipIgnoreFileError(error, suppressErrors)) {
22025
+ return void 0;
22026
+ }
22027
+ throw createIgnoreFileReadError(filePath, error);
22028
+ }
22029
+ }));
22030
+ return fileResults.filter(Boolean);
22031
+ };
22032
+ var readIgnoreFilesSafelySync = (paths, readFileSyncMethod, suppressErrors) => paths.map((filePath) => processIgnoreFileCore(filePath, readFileSyncMethod, suppressErrors)).filter(Boolean);
22033
+ var dedupePaths = (paths) => {
22034
+ const seen = /* @__PURE__ */ new Set();
22035
+ return paths.filter((filePath) => {
22036
+ if (seen.has(filePath)) {
22037
+ return false;
22038
+ }
22039
+ seen.add(filePath);
22040
+ return true;
22041
+ });
22042
+ };
22043
+ var globIgnoreFiles = (globFunction, patterns, normalizedOptions) => globFunction(patterns, {
22044
+ ...normalizedOptions,
22045
+ ...ignoreFilesGlobOptions
22046
+ // Must be last to ensure absolute/dot flags stick
22047
+ });
22048
+ var getParentIgnorePaths = (gitRoot, normalizedOptions) => gitRoot ? getParentGitignorePaths(gitRoot, normalizedOptions.cwd) : [];
22049
+ var combineIgnoreFilePaths = (gitRoot, normalizedOptions, childPaths) => dedupePaths([
22050
+ ...getParentIgnorePaths(gitRoot, normalizedOptions),
22051
+ ...childPaths
22052
+ ]);
22053
+ var buildIgnoreResult = (files, normalizedOptions, gitRoot) => {
22054
+ const baseDir = gitRoot || normalizedOptions.cwd;
22055
+ const patterns = getPatternsFromIgnoreFiles(files, baseDir);
22056
+ const matcher = createIgnoreMatcher(patterns, normalizedOptions.cwd, baseDir);
22057
+ return {
22058
+ patterns,
22059
+ matcher,
22060
+ predicate: (fileOrDirectory) => matcher(fileOrDirectory).ignored,
22061
+ usingGitRoot: Boolean(gitRoot && gitRoot !== normalizedOptions.cwd)
22062
+ };
22063
+ };
22064
+ var applyBaseToPattern = (pattern, base) => {
22065
+ if (!base) {
22066
+ return pattern;
22067
+ }
22068
+ const isNegative = isNegativePattern(pattern);
22069
+ const cleanPattern = isNegative ? pattern.slice(1) : pattern;
22070
+ const slashIndex = cleanPattern.indexOf("/");
22071
+ const hasNonTrailingSlash = slashIndex !== -1 && slashIndex !== cleanPattern.length - 1;
22072
+ let result;
22073
+ if (!hasNonTrailingSlash) {
22074
+ result = path9.posix.join(base, "**", cleanPattern);
22075
+ } else if (cleanPattern.startsWith("/")) {
22076
+ result = path9.posix.join(base, cleanPattern.slice(1));
22077
+ } else {
22078
+ result = path9.posix.join(base, cleanPattern);
22079
+ }
22080
+ return isNegative ? "!" + result : result;
22081
+ };
22082
+ var parseIgnoreFile = (file, cwd) => {
22083
+ const base = slash(path9.relative(cwd, path9.dirname(file.filePath)));
22084
+ return file.content.split(/\r?\n/).filter((line) => line && !line.startsWith("#")).map((pattern) => applyBaseToPattern(pattern, base));
22085
+ };
22086
+ var toRelativePath = (fileOrDirectory, cwd) => {
22087
+ if (path9.isAbsolute(fileOrDirectory)) {
22088
+ const relativePath = path9.relative(cwd, fileOrDirectory);
22089
+ if (relativePath && !isPathInside(fileOrDirectory, cwd)) {
22090
+ return void 0;
22091
+ }
22092
+ return relativePath;
22093
+ }
22094
+ if (fileOrDirectory.startsWith("./")) {
22095
+ return fileOrDirectory.slice(2);
22096
+ }
22097
+ if (fileOrDirectory.startsWith("../")) {
22098
+ return void 0;
22099
+ }
22100
+ return fileOrDirectory;
22101
+ };
22102
+ var notIgnored = { ignored: false, unignored: false };
22103
+ var createIgnoreMatcher = (patterns, cwd, baseDir) => {
22104
+ const ignores = (0, import_ignore.default)().add(patterns);
22105
+ const resolvedCwd = path9.normalize(path9.resolve(cwd));
22106
+ const resolvedBaseDir = path9.normalize(path9.resolve(baseDir));
22107
+ return (fileOrDirectory) => {
22108
+ fileOrDirectory = toPath2(fileOrDirectory);
22109
+ const hasTrailingSeparator = /[/\\]$/.test(fileOrDirectory);
22110
+ const normalizedPath = path9.normalize(path9.resolve(fileOrDirectory));
22111
+ if (normalizedPath === resolvedCwd) {
22112
+ return notIgnored;
22113
+ }
22114
+ let relativePath = toRelativePath(fileOrDirectory, resolvedBaseDir);
22115
+ if (relativePath === void 0) {
22116
+ return notIgnored;
22117
+ }
22118
+ if (!relativePath) {
22119
+ return notIgnored;
22120
+ }
22121
+ if (hasTrailingSeparator && !relativePath.endsWith(path9.sep)) {
22122
+ relativePath += path9.sep;
22123
+ }
22124
+ return ignores.test(slash(relativePath));
22125
+ };
22126
+ };
22127
+ var normalizeOptions2 = (options = {}) => {
22128
+ const ignoreOption = options.ignore ? Array.isArray(options.ignore) ? options.ignore : [options.ignore] : [];
22129
+ const cwd = toPath2(options.cwd) ?? process10.cwd();
22130
+ const deep = typeof options.deep === "number" ? Math.max(0, options.deep) + 1 : Number.POSITIVE_INFINITY;
22131
+ return {
22132
+ cwd,
22133
+ suppressErrors: options.suppressErrors ?? false,
22134
+ deep,
22135
+ ignore: [...ignoreOption, ...defaultIgnoredDirectories],
22136
+ followSymbolicLinks: options.followSymbolicLinks ?? true,
22137
+ concurrency: options.concurrency,
22138
+ throwErrorOnBrokenSymbolicLink: options.throwErrorOnBrokenSymbolicLink ?? false,
22139
+ fs: options.fs
22140
+ };
22141
+ };
22142
+ var unescapeGitQuotedValue = (value) => value.replaceAll(/\\(["\\abfnrtv])/g, (_match, escapedCharacter) => {
22143
+ switch (escapedCharacter) {
22144
+ case "a": {
22145
+ return "\x07";
22146
+ }
22147
+ case "b": {
22148
+ return "\b";
22149
+ }
22150
+ case "f": {
22151
+ return "\f";
22152
+ }
22153
+ case "n": {
22154
+ return "\n";
22155
+ }
22156
+ case "r": {
22157
+ return "\r";
22158
+ }
22159
+ case "t": {
22160
+ return " ";
22161
+ }
22162
+ case "v": {
22163
+ return "\v";
22164
+ }
22165
+ default: {
22166
+ return escapedCharacter;
22167
+ }
22168
+ }
22169
+ });
22170
+ var parseGitConfigValue = (value) => {
22171
+ const trimmedValue = value.trim();
22172
+ const quotedMatch = trimmedValue.match(/^"((?:[^"\\]|\\.)*)"\s*(?:[#;].*)?$/);
22173
+ if (quotedMatch) {
22174
+ return unescapeGitQuotedValue(quotedMatch[1]);
22175
+ }
22176
+ return trimmedValue.replace(/\s[#;].*$/, "").trim();
22177
+ };
22178
+ var resolveConfigPath = (filePath, configPath) => {
22179
+ if (configPath.startsWith("~/")) {
22180
+ const homeDirectory = os2.homedir();
22181
+ const resolved = path9.join(homeDirectory, configPath.slice(2));
22182
+ if (!isPathInside(resolved, homeDirectory)) {
22183
+ return path9.join(homeDirectory, ".globby-invalid-path-traversal");
22184
+ }
22185
+ return resolved;
22186
+ }
22187
+ if (path9.isAbsolute(configPath)) {
22188
+ return configPath;
22189
+ }
22190
+ return path9.resolve(path9.dirname(filePath), configPath);
22191
+ };
22192
+ var parseGitConfigSection = (line) => {
22193
+ if (!line.startsWith("[")) {
22194
+ return void 0;
22195
+ }
22196
+ let inQuotes = false;
22197
+ let isEscaped = false;
22198
+ for (let index = 1; index < line.length; index++) {
22199
+ const character = line[index];
22200
+ if (isEscaped) {
22201
+ isEscaped = false;
22202
+ continue;
22203
+ }
22204
+ if (character === "\\") {
22205
+ isEscaped = true;
22206
+ continue;
22207
+ }
22208
+ if (character === '"') {
22209
+ inQuotes = !inQuotes;
22210
+ continue;
22211
+ }
22212
+ if (character === "]" && !inQuotes) {
22213
+ const remainder = line.slice(index + 1).trimStart();
22214
+ if (remainder && !remainder.startsWith("#") && !remainder.startsWith(";")) {
22215
+ return void 0;
22216
+ }
22217
+ return line.slice(1, index).trim();
22218
+ }
22219
+ }
22220
+ return void 0;
22221
+ };
22222
+ var parseGitConfigEntry = (line) => {
22223
+ const match2 = line.match(/^([A-Za-z\d-.]+)\s*=\s*(.*)$/);
22224
+ if (!match2) {
22225
+ return void 0;
22226
+ }
22227
+ return {
22228
+ key: match2[1].toLowerCase(),
22229
+ value: parseGitConfigValue(match2[2])
22230
+ };
22231
+ };
22232
+ var parseIncludeIfCondition = (section) => {
22233
+ if (!section) {
22234
+ return void 0;
22235
+ }
22236
+ const match2 = section.match(/^includeif\s+"([^"]+)"$/i);
22237
+ return match2 ? match2[1] : void 0;
22238
+ };
22239
+ var normalizeGitConfigConditionPattern = (pattern, configFilePath) => {
22240
+ if (pattern.startsWith("~/")) {
22241
+ pattern = path9.join(os2.homedir(), pattern.slice(2));
22242
+ } else if (pattern.startsWith("./")) {
22243
+ pattern = path9.resolve(path9.dirname(configFilePath), pattern.slice(2));
22244
+ } else if (!path9.isAbsolute(pattern)) {
22245
+ pattern = `**/${pattern}`;
22246
+ }
22247
+ if (pattern.endsWith("/")) {
22248
+ pattern += "**";
22249
+ }
22250
+ return slash(pattern);
22251
+ };
22252
+ var gitConfigGlobToRegex = (pattern, flags) => {
22253
+ let regex = "";
22254
+ for (let index = 0; index < pattern.length; index++) {
22255
+ const character = pattern[index];
22256
+ const nextCharacter = pattern[index + 1];
22257
+ const nextNextCharacter = pattern[index + 2];
22258
+ if (character === "*" && nextCharacter === "*" && nextNextCharacter === "/") {
22259
+ regex += "(?:.*/)?";
22260
+ index += 2;
22261
+ continue;
22262
+ }
22263
+ if (character === "*" && nextCharacter === "*") {
22264
+ regex += ".*";
22265
+ index += 1;
22266
+ continue;
22267
+ }
22268
+ if (character === "*") {
22269
+ regex += "[^/]*";
22270
+ continue;
22271
+ }
22272
+ if (character === "?") {
22273
+ regex += "[^/]";
22274
+ continue;
22275
+ }
22276
+ if (character === "[") {
22277
+ const closingBracketIndex = pattern.indexOf("]", index + 1);
22278
+ if (closingBracketIndex !== -1) {
22279
+ const bracketContent = pattern.slice(index + 1, closingBracketIndex);
22280
+ if (bracketContent) {
22281
+ const negatedBracketContent = bracketContent[0] === "!" ? `^${bracketContent.slice(1)}` : bracketContent;
22282
+ regex += `[${negatedBracketContent}]`;
22283
+ index = closingBracketIndex;
22284
+ continue;
22285
+ }
22286
+ }
22287
+ }
22288
+ regex += /[|\\{}()[\]^$+?.]/.test(character) ? `\\${character}` : character;
22289
+ }
22290
+ try {
22291
+ return new RegExp(`^${regex}$`, flags);
22292
+ } catch {
22293
+ return /(?!)/;
22294
+ }
22295
+ };
22296
+ var matchesIncludeIfCondition = (condition, gitDirectory, configFilePath) => {
22297
+ if (!gitDirectory) {
22298
+ return false;
22299
+ }
22300
+ const match2 = condition.match(/^(gitdir|gitdir\/i):(.*)$/i);
22301
+ if (!match2) {
22302
+ return false;
22303
+ }
22304
+ const [, keyword, rawPattern] = match2;
22305
+ const pattern = normalizeGitConfigConditionPattern(rawPattern.trim(), configFilePath);
22306
+ const isCaseInsensitive = keyword.toLowerCase() === "gitdir/i";
22307
+ const regularExpression = gitConfigGlobToRegex(pattern, isCaseInsensitive ? "i" : void 0);
22308
+ const normalizedGitDirectory = slash(path9.resolve(gitDirectory));
22309
+ return regularExpression.test(normalizedGitDirectory);
22310
+ };
22311
+ var shouldIncludeConfigSection = (section, gitDirectory, configFilePath) => {
22312
+ if (section?.toLowerCase() === "include") {
22313
+ return true;
22314
+ }
22315
+ const condition = parseIncludeIfCondition(section);
22316
+ return condition ? matchesIncludeIfCondition(condition, gitDirectory, configFilePath) : false;
22317
+ };
22318
+ var createExcludesFileValue = (value, declaringFilePath) => ({
22319
+ value,
22320
+ declaringFilePath
22321
+ });
22322
+ var parseGitConfigForExcludesFile = (content, normalizedPath, gitDirectory) => {
22323
+ let currentSection;
22324
+ let excludesFile;
22325
+ const includePaths = [];
22326
+ for (const line of content.split(/\r?\n/)) {
22327
+ const trimmed = line.trim();
22328
+ if (!trimmed || trimmed.startsWith("#") || trimmed.startsWith(";")) {
22329
+ continue;
22330
+ }
22331
+ if (trimmed.startsWith("[")) {
22332
+ currentSection = parseGitConfigSection(trimmed);
22333
+ continue;
22334
+ }
22335
+ const entry = parseGitConfigEntry(trimmed);
22336
+ if (!entry) {
22337
+ continue;
22338
+ }
22339
+ if (currentSection?.toLowerCase() === "core" && entry.key === "excludesfile") {
22340
+ excludesFile = createExcludesFileValue(entry.value, normalizedPath);
22341
+ continue;
22342
+ }
22343
+ if (shouldIncludeConfigSection(currentSection, gitDirectory, normalizedPath) && entry.key === "path" && entry.value) {
22344
+ includePaths.push(resolveConfigPath(normalizedPath, entry.value));
22345
+ }
22346
+ }
22347
+ return { excludesFile, includePaths };
22348
+ };
22349
+ var readGitConfigFile = (normalizedPath, readMethod, suppressErrors) => {
22350
+ try {
22351
+ return readMethod(normalizedPath, "utf8");
22352
+ } catch (error) {
22353
+ if (shouldSkipIgnoreFileError(error, suppressErrors)) {
22354
+ return void 0;
22355
+ }
22356
+ throw createGitConfigReadError(normalizedPath, error);
22547
22357
  }
22548
- return Boolean(suppressErrors);
22549
22358
  };
22550
- var createIgnoreFileReadError = (filePath, error) => {
22551
- if (error instanceof Error) {
22552
- error.message = `Failed to read ignore file at ${filePath}: ${error.message}`;
22553
- return error;
22359
+ var getExcludesFileFromGitConfigSync = (filePath, readFileSync5, gitDirectory, options = {}) => {
22360
+ const { suppressErrors, includeStack = /* @__PURE__ */ new Set(), depth = 0 } = options;
22361
+ const normalizedPath = path9.resolve(filePath);
22362
+ if (includeStack.has(normalizedPath)) {
22363
+ return void 0;
22364
+ }
22365
+ if (depth >= MAX_INCLUDE_DEPTH) {
22366
+ return void 0;
22554
22367
  }
22555
- return new Error(`Failed to read ignore file at ${filePath}: ${String(error)}`);
22368
+ includeStack.add(normalizedPath);
22369
+ const content = readGitConfigFile(normalizedPath, readFileSync5, suppressErrors);
22370
+ if (content === void 0) {
22371
+ includeStack.delete(normalizedPath);
22372
+ return void 0;
22373
+ }
22374
+ let { excludesFile, includePaths } = parseGitConfigForExcludesFile(content, normalizedPath, gitDirectory);
22375
+ for (const includePath of includePaths) {
22376
+ const includedExcludesFile = getExcludesFileFromGitConfigSync(includePath, readFileSync5, gitDirectory, { suppressErrors, includeStack, depth: depth + 1 });
22377
+ if (includedExcludesFile !== void 0) {
22378
+ excludesFile = includedExcludesFile;
22379
+ }
22380
+ }
22381
+ includeStack.delete(normalizedPath);
22382
+ return excludesFile;
22556
22383
  };
22557
- var processIgnoreFileCore = (filePath, readMethod, suppressErrors) => {
22384
+ var getExcludesFileFromGitConfigAsync = async (filePath, readFile, gitDirectory, options = {}) => {
22385
+ const { suppressErrors, includeStack = /* @__PURE__ */ new Set(), depth = 0 } = options;
22386
+ const normalizedPath = path9.resolve(filePath);
22387
+ if (includeStack.has(normalizedPath)) {
22388
+ return void 0;
22389
+ }
22390
+ if (depth >= MAX_INCLUDE_DEPTH) {
22391
+ return void 0;
22392
+ }
22393
+ includeStack.add(normalizedPath);
22394
+ let content;
22558
22395
  try {
22559
- const content = readMethod(filePath, "utf8");
22560
- return { filePath, content };
22396
+ content = await readFile(normalizedPath, "utf8");
22561
22397
  } catch (error) {
22398
+ includeStack.delete(normalizedPath);
22562
22399
  if (shouldSkipIgnoreFileError(error, suppressErrors)) {
22563
22400
  return void 0;
22564
22401
  }
22565
- throw createIgnoreFileReadError(filePath, error);
22402
+ throw createGitConfigReadError(normalizedPath, error);
22566
22403
  }
22567
- };
22568
- var readIgnoreFilesSafely = async (paths, readFileMethod, suppressErrors) => {
22569
- const fileResults = await Promise.all(paths.map(async (filePath) => {
22570
- try {
22571
- const content = await readFileMethod(filePath, "utf8");
22572
- return { filePath, content };
22573
- } catch (error) {
22574
- if (shouldSkipIgnoreFileError(error, suppressErrors)) {
22575
- return void 0;
22576
- }
22577
- throw createIgnoreFileReadError(filePath, error);
22404
+ let { excludesFile, includePaths } = parseGitConfigForExcludesFile(content, normalizedPath, gitDirectory);
22405
+ for (const includePath of includePaths) {
22406
+ const includedExcludesFile = await getExcludesFileFromGitConfigAsync(includePath, readFile, gitDirectory, { suppressErrors, includeStack, depth: depth + 1 });
22407
+ if (includedExcludesFile !== void 0) {
22408
+ excludesFile = includedExcludesFile;
22578
22409
  }
22579
- }));
22580
- return fileResults.filter(Boolean);
22410
+ }
22411
+ includeStack.delete(normalizedPath);
22412
+ return excludesFile;
22581
22413
  };
22582
- var readIgnoreFilesSafelySync = (paths, readFileSyncMethod, suppressErrors) => paths.map((filePath) => processIgnoreFileCore(filePath, readFileSyncMethod, suppressErrors)).filter(Boolean);
22583
- var dedupePaths = (paths) => {
22584
- const seen = /* @__PURE__ */ new Set();
22585
- return paths.filter((filePath) => {
22586
- if (seen.has(filePath)) {
22587
- return false;
22588
- }
22589
- seen.add(filePath);
22590
- return true;
22591
- });
22414
+ var resolveGitDirectoryFromFile = (gitFilePath, content) => {
22415
+ const match2 = content.match(/^gitdir:\s*(.+?)\s*$/i);
22416
+ if (!match2) {
22417
+ return gitFilePath;
22418
+ }
22419
+ return path9.resolve(path9.dirname(gitFilePath), match2[1]);
22592
22420
  };
22593
- var globIgnoreFiles = (globFunction, patterns, normalizedOptions) => globFunction(patterns, {
22594
- ...normalizedOptions,
22595
- ...ignoreFilesGlobOptions
22596
- // Must be last to ensure absolute/dot flags stick
22597
- });
22598
- var getParentIgnorePaths = (gitRoot, normalizedOptions) => gitRoot ? getParentGitignorePaths(gitRoot, normalizedOptions.cwd) : [];
22599
- var combineIgnoreFilePaths = (gitRoot, normalizedOptions, childPaths) => dedupePaths([
22600
- ...getParentIgnorePaths(gitRoot, normalizedOptions),
22601
- ...childPaths
22602
- ]);
22603
- var buildIgnoreResult = (files, normalizedOptions, gitRoot) => {
22604
- const baseDir = gitRoot || normalizedOptions.cwd;
22605
- const patterns = getPatternsFromIgnoreFiles(files, baseDir);
22606
- return {
22607
- patterns,
22608
- predicate: createIgnorePredicate(patterns, normalizedOptions.cwd, baseDir),
22609
- usingGitRoot: Boolean(gitRoot && gitRoot !== normalizedOptions.cwd)
22610
- };
22421
+ var getGitDirectorySync = (gitRoot, readFileSync5) => {
22422
+ if (!gitRoot) {
22423
+ return void 0;
22424
+ }
22425
+ const gitFilePath = path9.join(gitRoot, ".git");
22426
+ try {
22427
+ return resolveGitDirectoryFromFile(gitFilePath, readFileSync5(gitFilePath, "utf8"));
22428
+ } catch {
22429
+ return gitFilePath;
22430
+ }
22611
22431
  };
22612
- var applyBaseToPattern = (pattern, base) => {
22613
- if (!base) {
22614
- return pattern;
22432
+ var getGitDirectoryAsync = async (gitRoot, readFile) => {
22433
+ if (!gitRoot) {
22434
+ return void 0;
22615
22435
  }
22616
- const isNegative = isNegativePattern(pattern);
22617
- const cleanPattern = isNegative ? pattern.slice(1) : pattern;
22618
- const slashIndex = cleanPattern.indexOf("/");
22619
- const hasNonTrailingSlash = slashIndex !== -1 && slashIndex !== cleanPattern.length - 1;
22620
- let result;
22621
- if (!hasNonTrailingSlash) {
22622
- result = path9.posix.join(base, "**", cleanPattern);
22623
- } else if (cleanPattern.startsWith("/")) {
22624
- result = path9.posix.join(base, cleanPattern.slice(1));
22625
- } else {
22626
- result = path9.posix.join(base, cleanPattern);
22436
+ const gitFilePath = path9.join(gitRoot, ".git");
22437
+ try {
22438
+ return resolveGitDirectoryFromFile(gitFilePath, await readFile(gitFilePath, "utf8"));
22439
+ } catch {
22440
+ return gitFilePath;
22627
22441
  }
22628
- return isNegative ? "!" + result : result;
22629
22442
  };
22630
- var parseIgnoreFile = (file, cwd) => {
22631
- const base = slash(path9.relative(cwd, path9.dirname(file.filePath)));
22632
- return file.content.split(/\r?\n/).filter((line) => line && !line.startsWith("#")).map((pattern) => applyBaseToPattern(pattern, base));
22443
+ var getXdgConfigHome = () => process10.env.XDG_CONFIG_HOME || path9.join(os2.homedir(), ".config");
22444
+ var getGitConfigPaths = () => {
22445
+ if ("GIT_CONFIG_GLOBAL" in process10.env) {
22446
+ const value = process10.env.GIT_CONFIG_GLOBAL;
22447
+ return value ? [value] : [];
22448
+ }
22449
+ return [
22450
+ path9.join(getXdgConfigHome(), "git", "config"),
22451
+ path9.join(os2.homedir(), ".gitconfig")
22452
+ ];
22633
22453
  };
22634
- var toRelativePath = (fileOrDirectory, cwd) => {
22635
- if (path9.isAbsolute(fileOrDirectory)) {
22636
- const relativePath = path9.relative(cwd, fileOrDirectory);
22637
- if (relativePath && !isPathInside(fileOrDirectory, cwd)) {
22454
+ var getDefaultGlobalGitignorePath = () => path9.join(getXdgConfigHome(), "git", "ignore");
22455
+ var resolveExcludesFilePath = (excludesFileConfig) => {
22456
+ if (excludesFileConfig?.value === "") {
22457
+ return void 0;
22458
+ }
22459
+ if (excludesFileConfig === void 0) {
22460
+ return getDefaultGlobalGitignorePath();
22461
+ }
22462
+ return resolveConfigPath(excludesFileConfig.declaringFilePath, excludesFileConfig.value);
22463
+ };
22464
+ var readGlobalGitignoreContent = (filePath, readMethod, suppressErrors) => {
22465
+ try {
22466
+ const content = readMethod(filePath, "utf8");
22467
+ return { filePath, content };
22468
+ } catch (error) {
22469
+ if (shouldSkipIgnoreFileError(error, suppressErrors)) {
22638
22470
  return void 0;
22639
22471
  }
22640
- return relativePath;
22472
+ throw createIgnoreFileReadError(filePath, error);
22641
22473
  }
22642
- if (fileOrDirectory.startsWith("./")) {
22643
- return fileOrDirectory.slice(2);
22474
+ };
22475
+ var getGlobalGitignoreFile = (options = {}) => {
22476
+ const cwd = toPath2(options.cwd) ?? process10.cwd();
22477
+ const readFileSync5 = getReadFileSyncMethod(options.fs);
22478
+ const gitRoot = findGitRootSync(cwd, options.fs);
22479
+ const gitDirectory = getGitDirectorySync(gitRoot, readFileSync5);
22480
+ let excludesFileConfig;
22481
+ for (const gitConfigPath of getGitConfigPaths()) {
22482
+ const value = getExcludesFileFromGitConfigSync(gitConfigPath, readFileSync5, gitDirectory, { suppressErrors: options.suppressErrors });
22483
+ if (value !== void 0) {
22484
+ excludesFileConfig = value;
22485
+ }
22644
22486
  }
22645
- if (fileOrDirectory.startsWith("../")) {
22487
+ const filePath = resolveExcludesFilePath(excludesFileConfig);
22488
+ return filePath === void 0 ? void 0 : readGlobalGitignoreContent(filePath, readFileSync5, options.suppressErrors);
22489
+ };
22490
+ var getGlobalGitignoreFileAsync = async (options = {}) => {
22491
+ const cwd = toPath2(options.cwd) ?? process10.cwd();
22492
+ const readFile = getReadFileMethod(options.fs);
22493
+ const gitRoot = await findGitRoot(cwd, options.fs);
22494
+ const gitDirectory = await getGitDirectoryAsync(gitRoot, readFile);
22495
+ const excludesFileValues = await Promise.all(getGitConfigPaths().map((gitConfigPath) => getExcludesFileFromGitConfigAsync(
22496
+ gitConfigPath,
22497
+ readFile,
22498
+ gitDirectory,
22499
+ { suppressErrors: options.suppressErrors }
22500
+ )));
22501
+ const excludesFileConfig = excludesFileValues.findLast((value) => value !== void 0);
22502
+ const filePath = resolveExcludesFilePath(excludesFileConfig);
22503
+ if (filePath === void 0) {
22646
22504
  return void 0;
22647
22505
  }
22648
- return fileOrDirectory;
22649
- };
22650
- var createIgnorePredicate = (patterns, cwd, baseDir) => {
22651
- const ignores = (0, import_ignore.default)().add(patterns);
22652
- const resolvedCwd = path9.normalize(path9.resolve(cwd));
22653
- const resolvedBaseDir = path9.normalize(path9.resolve(baseDir));
22654
- return (fileOrDirectory) => {
22655
- fileOrDirectory = toPath2(fileOrDirectory);
22656
- const normalizedPath = path9.normalize(path9.resolve(fileOrDirectory));
22657
- if (normalizedPath === resolvedCwd) {
22658
- return false;
22659
- }
22660
- const relativePath = toRelativePath(fileOrDirectory, resolvedBaseDir);
22661
- if (relativePath === void 0) {
22662
- return false;
22506
+ try {
22507
+ const content = await readFile(filePath, "utf8");
22508
+ return { filePath, content };
22509
+ } catch (error) {
22510
+ if (shouldSkipIgnoreFileError(error, options.suppressErrors)) {
22511
+ return void 0;
22663
22512
  }
22664
- return relativePath ? ignores.ignores(slash(relativePath)) : false;
22665
- };
22513
+ throw createIgnoreFileReadError(filePath, error);
22514
+ }
22666
22515
  };
22667
- var normalizeOptions2 = (options = {}) => {
22668
- const ignoreOption = options.ignore ? Array.isArray(options.ignore) ? options.ignore : [options.ignore] : [];
22669
- const cwd = toPath2(options.cwd) ?? process10.cwd();
22670
- const deep = typeof options.deep === "number" ? Math.max(0, options.deep) + 1 : Number.POSITIVE_INFINITY;
22671
- return {
22672
- cwd,
22673
- suppressErrors: options.suppressErrors ?? false,
22674
- deep,
22675
- ignore: [...ignoreOption, ...defaultIgnoredDirectories],
22676
- followSymbolicLinks: options.followSymbolicLinks ?? true,
22677
- concurrency: options.concurrency,
22678
- throwErrorOnBrokenSymbolicLink: options.throwErrorOnBrokenSymbolicLink ?? false,
22679
- fs: options.fs
22680
- };
22516
+ var buildGlobalMatcher = (globalIgnoreFile, cwd, rootDirectory = cwd) => {
22517
+ const patterns = parseIgnoreFile(globalIgnoreFile, path9.dirname(globalIgnoreFile.filePath));
22518
+ return createIgnoreMatcher(patterns, cwd, rootDirectory);
22681
22519
  };
22682
22520
  var collectIgnoreFileArtifactsAsync = async (patterns, options, includeParentIgnoreFiles) => {
22683
22521
  const normalizedOptions = normalizeOptions2(options);
@@ -22721,7 +22559,12 @@ var assertPatternsInput = (patterns) => {
22721
22559
  throw new TypeError("Patterns must be a string or an array of strings");
22722
22560
  }
22723
22561
  };
22724
- var getStatMethod = (fsImplementation) => bindFsMethod(fsImplementation?.promises, "stat") ?? bindFsMethod(fs4.promises, "stat") ?? promisifyFsMethod(fsImplementation, "stat");
22562
+ var getStatMethod = (fsImplementation) => {
22563
+ if (fsImplementation) {
22564
+ return bindFsMethod(fsImplementation.promises, "stat") ?? promisifyFsMethod(fsImplementation, "stat");
22565
+ }
22566
+ return bindFsMethod(fs4.promises, "stat");
22567
+ };
22725
22568
  var getStatSyncMethod2 = (fsImplementation) => bindFsMethod(fsImplementation, "statSync") ?? bindFsMethod(fs4, "statSync");
22726
22569
  var isDirectory = async (path26, fsImplementation) => {
22727
22570
  try {
@@ -22826,73 +22669,204 @@ var getIgnoreFilesPatterns = (options) => {
22826
22669
  }
22827
22670
  return patterns;
22828
22671
  };
22672
+ var isPathIgnored = (matcher, globalMatcher, path26) => {
22673
+ const globalResult = globalMatcher ? globalMatcher(path26) : void 0;
22674
+ const result = matcher ? matcher(path26) : void 0;
22675
+ if (result?.unignored) {
22676
+ return false;
22677
+ }
22678
+ return Boolean(result?.ignored || globalResult?.ignored);
22679
+ };
22680
+ var hasIgnoredAncestorDirectory = (matcher, globalMatcher, file) => {
22681
+ let currentPath = file;
22682
+ while (true) {
22683
+ const parentDirectory = nodePath.dirname(currentPath);
22684
+ if (parentDirectory === currentPath) {
22685
+ return false;
22686
+ }
22687
+ if (isPathIgnored(matcher, globalMatcher, `${parentDirectory}${nodePath.sep}`)) {
22688
+ return true;
22689
+ }
22690
+ currentPath = parentDirectory;
22691
+ }
22692
+ };
22693
+ var combinePredicate = (matcher, globalMatcher) => {
22694
+ if (!matcher && !globalMatcher) {
22695
+ return false;
22696
+ }
22697
+ return (file) => {
22698
+ const result = matcher ? matcher(file) : void 0;
22699
+ if (result?.unignored) {
22700
+ const globalResult = globalMatcher ? globalMatcher(file) : void 0;
22701
+ return globalResult?.ignored && hasIgnoredAncestorDirectory(matcher, globalMatcher, file);
22702
+ }
22703
+ return isPathIgnored(matcher, globalMatcher, file);
22704
+ };
22705
+ };
22706
+ var buildIgnoreFilterResult = (options, cwd, { patterns, matcher, usingGitRoot }, globalMatcher, createFilter) => {
22707
+ const finalPredicate = combinePredicate(matcher, globalMatcher);
22708
+ const patternsForFastGlob = convertPatternsForFastGlob(patterns, usingGitRoot, normalizeDirectoryPatternForFastGlob);
22709
+ return {
22710
+ options: {
22711
+ ...options,
22712
+ ignore: [...options.ignore, ...patternsForFastGlob]
22713
+ },
22714
+ filter: createFilter(finalPredicate, cwd, options.fs)
22715
+ };
22716
+ };
22829
22717
  var applyIgnoreFilesAndGetFilter = async (options) => {
22718
+ const cwd = options.cwd ?? process11.cwd();
22830
22719
  const ignoreFilesPatterns = getIgnoreFilesPatterns(options);
22831
- if (ignoreFilesPatterns.length === 0) {
22720
+ const globalIgnoreFile = options.globalGitignore ? await getGlobalGitignoreFileAsync(options) : void 0;
22721
+ if (ignoreFilesPatterns.length === 0 && !globalIgnoreFile) {
22832
22722
  return {
22833
22723
  options,
22834
- filter: createFilterFunction(false, options.cwd)
22724
+ filter: createFilterFunctionAsync(false, cwd, options.fs)
22835
22725
  };
22836
22726
  }
22837
22727
  const includeParentIgnoreFiles = options.gitignore === true;
22838
- const { patterns, predicate, usingGitRoot } = await getIgnorePatternsAndPredicate(ignoreFilesPatterns, options, includeParentIgnoreFiles);
22839
- const patternsForFastGlob = convertPatternsForFastGlob(patterns, usingGitRoot, normalizeDirectoryPatternForFastGlob);
22840
- const modifiedOptions = {
22841
- ...options,
22842
- ignore: [...options.ignore, ...patternsForFastGlob]
22843
- };
22844
- return {
22845
- options: modifiedOptions,
22846
- filter: createFilterFunction(predicate, options.cwd)
22847
- };
22728
+ const ignoreResult = ignoreFilesPatterns.length > 0 ? await getIgnorePatternsAndPredicate(ignoreFilesPatterns, options, includeParentIgnoreFiles) : { patterns: [], matcher: false, usingGitRoot: false };
22729
+ const globalGitRoot = globalIgnoreFile ? await findGitRoot(cwd, options.fs) : void 0;
22730
+ const globalMatcher = globalIgnoreFile ? buildGlobalMatcher(globalIgnoreFile, cwd, globalGitRoot ?? cwd) : void 0;
22731
+ return buildIgnoreFilterResult(options, cwd, ignoreResult, globalMatcher, createFilterFunctionAsync);
22848
22732
  };
22849
22733
  var applyIgnoreFilesAndGetFilterSync = (options) => {
22734
+ const cwd = options.cwd ?? process11.cwd();
22850
22735
  const ignoreFilesPatterns = getIgnoreFilesPatterns(options);
22851
- if (ignoreFilesPatterns.length === 0) {
22736
+ const globalIgnoreFile = options.globalGitignore ? getGlobalGitignoreFile(options) : void 0;
22737
+ if (ignoreFilesPatterns.length === 0 && !globalIgnoreFile) {
22852
22738
  return {
22853
22739
  options,
22854
- filter: createFilterFunction(false, options.cwd)
22740
+ filter: createFilterFunction(false, cwd, options.fs)
22855
22741
  };
22856
22742
  }
22857
22743
  const includeParentIgnoreFiles = options.gitignore === true;
22858
- const { patterns, predicate, usingGitRoot } = getIgnorePatternsAndPredicateSync(ignoreFilesPatterns, options, includeParentIgnoreFiles);
22859
- const patternsForFastGlob = convertPatternsForFastGlob(patterns, usingGitRoot, normalizeDirectoryPatternForFastGlob);
22860
- const modifiedOptions = {
22861
- ...options,
22862
- ignore: [...options.ignore, ...patternsForFastGlob]
22744
+ const ignoreResult = ignoreFilesPatterns.length > 0 ? getIgnorePatternsAndPredicateSync(ignoreFilesPatterns, options, includeParentIgnoreFiles) : { patterns: [], matcher: false, usingGitRoot: false };
22745
+ const globalGitRoot = globalIgnoreFile ? findGitRootSync(cwd, options.fs) : void 0;
22746
+ const globalMatcher = globalIgnoreFile ? buildGlobalMatcher(globalIgnoreFile, cwd, globalGitRoot ?? cwd) : void 0;
22747
+ return buildIgnoreFilterResult(options, cwd, ignoreResult, globalMatcher, createFilterFunction);
22748
+ };
22749
+ var assertGlobalGitignoreSyncSupport = (options) => {
22750
+ if (options.globalGitignore && options.fs && !options.fs.statSync) {
22751
+ throw new Error("The `globalGitignore` option in `globbySync()` requires `fs.statSync` when a custom `fs` is provided.");
22752
+ }
22753
+ };
22754
+ var globalGitignoreAsyncStatErrorMessage = "The `globalGitignore` option in `globby()` and `globbyStream()` requires `fs.promises.stat` or `fs.stat` when a custom `fs` is provided.";
22755
+ var assertGlobalGitignoreAsyncSupport = (options) => {
22756
+ if (!options.globalGitignore || !options.fs) {
22757
+ return;
22758
+ }
22759
+ if (!options.fs.promises?.stat && !options.fs.stat) {
22760
+ throw new Error(globalGitignoreAsyncStatErrorMessage);
22761
+ }
22762
+ };
22763
+ var createPathResolver = (cwd) => {
22764
+ const basePath = cwd || process11.cwd();
22765
+ const pathCache = /* @__PURE__ */ new Map();
22766
+ return (pathKey3) => {
22767
+ let absolutePath = pathCache.get(pathKey3);
22768
+ if (absolutePath === void 0) {
22769
+ if (pathCache.size > 1e4) {
22770
+ pathCache.clear();
22771
+ }
22772
+ absolutePath = nodePath.isAbsolute(pathKey3) ? pathKey3 : nodePath.resolve(basePath, pathKey3);
22773
+ pathCache.set(pathKey3, absolutePath);
22774
+ }
22775
+ return absolutePath;
22863
22776
  };
22864
- return {
22865
- options: modifiedOptions,
22866
- filter: createFilterFunction(predicate, options.cwd)
22777
+ };
22778
+ var createAsyncDirectoryCheck = (fsMethod) => {
22779
+ const directoryCache = /* @__PURE__ */ new Map();
22780
+ return async (absolutePath) => {
22781
+ let isDirectory2 = directoryCache.get(absolutePath);
22782
+ if (isDirectory2 !== void 0) {
22783
+ return isDirectory2;
22784
+ }
22785
+ try {
22786
+ const stats = await fsMethod?.(absolutePath);
22787
+ isDirectory2 = Boolean(stats?.isDirectory());
22788
+ } catch {
22789
+ isDirectory2 = false;
22790
+ }
22791
+ if (directoryCache.size > 1e4) {
22792
+ directoryCache.clear();
22793
+ }
22794
+ directoryCache.set(absolutePath, isDirectory2);
22795
+ return isDirectory2;
22796
+ };
22797
+ };
22798
+ var createDirectoryCheck = (fsMethod) => {
22799
+ const directoryCache = /* @__PURE__ */ new Map();
22800
+ return (absolutePath) => {
22801
+ let isDirectory2 = directoryCache.get(absolutePath);
22802
+ if (isDirectory2 !== void 0) {
22803
+ return isDirectory2;
22804
+ }
22805
+ try {
22806
+ isDirectory2 = Boolean(fsMethod?.(absolutePath)?.isDirectory());
22807
+ } catch {
22808
+ isDirectory2 = false;
22809
+ }
22810
+ if (directoryCache.size > 1e4) {
22811
+ directoryCache.clear();
22812
+ }
22813
+ directoryCache.set(absolutePath, isDirectory2);
22814
+ return isDirectory2;
22815
+ };
22816
+ };
22817
+ var createFilterFunctionAsync = (isIgnored, cwd, fsImplementation) => {
22818
+ const resolveAbsolutePath = createPathResolver(cwd);
22819
+ const isDirectoryEntry = createAsyncDirectoryCheck(getStatMethod(fsImplementation));
22820
+ return async (fastGlobResult) => {
22821
+ if (!isIgnored) {
22822
+ return true;
22823
+ }
22824
+ const absolutePath = resolveAbsolutePath(nodePath.normalize(fastGlobResult.path ?? fastGlobResult));
22825
+ if (isIgnored(absolutePath)) {
22826
+ return false;
22827
+ }
22828
+ return !(await isDirectoryEntry(absolutePath) && isIgnored(`${absolutePath}${nodePath.sep}`));
22867
22829
  };
22868
22830
  };
22869
- var createFilterFunction = (isIgnored, cwd) => {
22831
+ var createFilterFunction = (isIgnored, cwd, fsImplementation) => {
22870
22832
  const seen = /* @__PURE__ */ new Set();
22871
- const basePath = cwd || process11.cwd();
22872
- const pathCache = /* @__PURE__ */ new Map();
22833
+ const resolveAbsolutePath = createPathResolver(cwd);
22834
+ const isDirectoryEntry = createDirectoryCheck(getStatSyncMethod2(fsImplementation));
22873
22835
  return (fastGlobResult) => {
22874
22836
  const pathKey3 = nodePath.normalize(fastGlobResult.path ?? fastGlobResult);
22875
22837
  if (seen.has(pathKey3)) {
22876
22838
  return false;
22877
22839
  }
22878
22840
  if (isIgnored) {
22879
- let absolutePath = pathCache.get(pathKey3);
22880
- if (absolutePath === void 0) {
22881
- absolutePath = nodePath.isAbsolute(pathKey3) ? pathKey3 : nodePath.resolve(basePath, pathKey3);
22882
- pathCache.set(pathKey3, absolutePath);
22883
- if (pathCache.size > 1e4) {
22884
- pathCache.clear();
22885
- }
22886
- }
22841
+ const absolutePath = resolveAbsolutePath(pathKey3);
22887
22842
  if (isIgnored(absolutePath)) {
22888
22843
  return false;
22889
22844
  }
22845
+ if (isDirectoryEntry(absolutePath) && isIgnored(`${absolutePath}${nodePath.sep}`)) {
22846
+ return false;
22847
+ }
22890
22848
  }
22891
22849
  seen.add(pathKey3);
22892
22850
  return true;
22893
22851
  };
22894
22852
  };
22895
22853
  var unionFastGlobResults = (results, filter2) => results.flat().filter((fastGlobResult) => filter2(fastGlobResult));
22854
+ var unionFastGlobResultsAsync = async (results, filter2) => {
22855
+ results = results.flat();
22856
+ const matches = await Promise.all(results.map((fastGlobResult) => filter2(fastGlobResult)));
22857
+ const seen = /* @__PURE__ */ new Set();
22858
+ return results.filter((fastGlobResult, index) => {
22859
+ if (!matches[index]) {
22860
+ return false;
22861
+ }
22862
+ const pathKey3 = nodePath.normalize(fastGlobResult.path ?? fastGlobResult);
22863
+ if (seen.has(pathKey3)) {
22864
+ return false;
22865
+ }
22866
+ seen.add(pathKey3);
22867
+ return true;
22868
+ });
22869
+ };
22896
22870
  var convertNegativePatterns = (patterns, options) => {
22897
22871
  if (patterns.length > 0 && patterns.every((pattern) => isNegativePattern(pattern))) {
22898
22872
  if (options.expandNegationOnlyPatterns === false) {
@@ -22997,25 +22971,37 @@ var generateTasksSync = (patterns, options) => {
22997
22971
  });
22998
22972
  };
22999
22973
  var globby = normalizeArguments(async (patterns, options) => {
22974
+ assertGlobalGitignoreAsyncSupport(options);
23000
22975
  const { options: modifiedOptions, filter: filter2 } = await applyIgnoreFilesAndGetFilter(options);
23001
22976
  const tasks = await generateTasks(patterns, modifiedOptions);
23002
22977
  const results = await Promise.all(tasks.map((task) => (0, import_fast_glob3.default)(task.patterns, task.options)));
23003
- return unionFastGlobResults(results, filter2);
22978
+ return unionFastGlobResultsAsync(results, filter2);
23004
22979
  });
23005
22980
  var globbySync = normalizeArgumentsSync((patterns, options) => {
22981
+ assertGlobalGitignoreSyncSupport(options);
23006
22982
  const { options: modifiedOptions, filter: filter2 } = applyIgnoreFilesAndGetFilterSync(options);
23007
22983
  const tasks = generateTasksSync(patterns, modifiedOptions);
23008
22984
  const results = tasks.map((task) => import_fast_glob3.default.sync(task.patterns, task.options));
23009
22985
  return unionFastGlobResults(results, filter2);
23010
22986
  });
23011
22987
  var globbyStream = normalizeArgumentsSync((patterns, options) => {
23012
- const { options: modifiedOptions, filter: filter2 } = applyIgnoreFilesAndGetFilterSync(options);
23013
- const tasks = generateTasksSync(patterns, modifiedOptions);
23014
- const streams = tasks.map((task) => import_fast_glob3.default.stream(task.patterns, task.options));
23015
- if (streams.length === 0) {
23016
- return Readable4.from([]);
23017
- }
23018
- const stream = mergeStreams(streams).filter((fastGlobResult) => filter2(fastGlobResult));
22988
+ assertGlobalGitignoreAsyncSupport(options);
22989
+ const seen = /* @__PURE__ */ new Set();
22990
+ const stream = Readable4.from((async function* () {
22991
+ const { options: modifiedOptions, filter: filter2 } = await applyIgnoreFilesAndGetFilter(options);
22992
+ const tasks = await generateTasks(patterns, modifiedOptions);
22993
+ if (tasks.length === 0) {
22994
+ return;
22995
+ }
22996
+ const streams = tasks.map((task) => import_fast_glob3.default.stream(task.patterns, task.options));
22997
+ for await (const fastGlobResult of mergeStreams(streams)) {
22998
+ const pathKey3 = nodePath.normalize(fastGlobResult.path ?? fastGlobResult);
22999
+ if (!seen.has(pathKey3) && await filter2(fastGlobResult)) {
23000
+ seen.add(pathKey3);
23001
+ yield fastGlobResult;
23002
+ }
23003
+ }
23004
+ })());
23019
23005
  return stream;
23020
23006
  });
23021
23007
  var isDynamicPattern = normalizeArgumentsSync((patterns, options) => patterns.some((pattern) => import_fast_glob3.default.isDynamicPattern(pattern, options)));
@@ -25800,7 +25786,7 @@ function hasTags(opts, logger) {
25800
25786
  // src/utils/make-diff-predicate.js
25801
25787
  import path11 from "node:path/posix";
25802
25788
 
25803
- // node_modules/minimatch/node_modules/balanced-match/dist/esm/index.js
25789
+ // node_modules/balanced-match/dist/esm/index.js
25804
25790
  var balanced = (a2, b, str2) => {
25805
25791
  const ma = a2 instanceof RegExp ? maybeMatch(a2, str2) : a2;
25806
25792
  const mb = b instanceof RegExp ? maybeMatch(b, str2) : b;
@@ -25853,7 +25839,7 @@ var range = (a2, b, str2) => {
25853
25839
  return result;
25854
25840
  };
25855
25841
 
25856
- // node_modules/minimatch/node_modules/brace-expansion/dist/esm/index.js
25842
+ // node_modules/brace-expansion/dist/esm/index.js
25857
25843
  var escSlash = "\0SLASH" + Math.random() + "\0";
25858
25844
  var escOpen = "\0OPEN" + Math.random() + "\0";
25859
25845
  var escClose = "\0CLOSE" + Math.random() + "\0";
@@ -25868,7 +25854,7 @@ var slashPattern = /\\\\/g;
25868
25854
  var openPattern = /\\{/g;
25869
25855
  var closePattern = /\\}/g;
25870
25856
  var commaPattern = /\\,/g;
25871
- var periodPattern = /\\./g;
25857
+ var periodPattern = /\\\./g;
25872
25858
  var EXPANSION_MAX = 1e5;
25873
25859
  function numeric(str2) {
25874
25860
  return !isNaN(str2) ? parseInt(str2, 10) : str2.charCodeAt(0);
@@ -25963,7 +25949,7 @@ function expand_(str2, max, isTop) {
25963
25949
  const x = numeric(n2[0]);
25964
25950
  const y = numeric(n2[1]);
25965
25951
  const width = Math.max(n2[0].length, n2[1].length);
25966
- let incr = n2.length === 3 && n2[2] !== void 0 ? Math.abs(numeric(n2[2])) : 1;
25952
+ let incr = n2.length === 3 && n2[2] !== void 0 ? Math.max(Math.abs(numeric(n2[2])), 1) : 1;
25967
25953
  let test = lte;
25968
25954
  const reverse = y < x;
25969
25955
  if (reverse) {
@@ -26136,9 +26122,9 @@ var parseClass = (glob, position) => {
26136
26122
  // node_modules/minimatch/dist/esm/unescape.js
26137
26123
  var unescape2 = (s, { windowsPathsNoEscape = false, magicalBraces = true } = {}) => {
26138
26124
  if (magicalBraces) {
26139
- return windowsPathsNoEscape ? s.replace(/\[([^\/\\])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1");
26125
+ return windowsPathsNoEscape ? s.replace(/\[([^/\\])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^/\\])\]/g, "$1$2").replace(/\\([^/])/g, "$1");
26140
26126
  }
26141
- return windowsPathsNoEscape ? s.replace(/\[([^\/\\{}])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^\/\\{}])\]/g, "$1$2").replace(/\\([^\/{}])/g, "$1");
26127
+ return windowsPathsNoEscape ? s.replace(/\[([^/\\{}])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^/\\{}])\]/g, "$1$2").replace(/\\([^/{}])/g, "$1");
26142
26128
  };
26143
26129
 
26144
26130
  // node_modules/minimatch/dist/esm/ast.js
@@ -26258,13 +26244,7 @@ var AST = class {
26258
26244
  }
26259
26245
  // reconstructs the pattern
26260
26246
  toString() {
26261
- if (this.#toString !== void 0)
26262
- return this.#toString;
26263
- if (!this.type) {
26264
- return this.#toString = this.#parts.map((p) => String(p)).join("");
26265
- } else {
26266
- return this.#toString = this.type + "(" + this.#parts.map((p) => String(p)).join("|") + ")";
26267
- }
26247
+ return this.#toString !== void 0 ? this.#toString : !this.type ? this.#toString = this.#parts.map((p) => String(p)).join("") : this.#toString = this.type + "(" + this.#parts.map((p) => String(p)).join("|") + ")";
26268
26248
  }
26269
26249
  #fillNegs() {
26270
26250
  if (this !== this.#root)
@@ -26807,7 +26787,7 @@ var minimatch = (p, pattern, options = {}) => {
26807
26787
  }
26808
26788
  return new Minimatch(pattern, options).match(p);
26809
26789
  };
26810
- var starDotExtRE = /^\*+([^+@!?\*\[\(]*)$/;
26790
+ var starDotExtRE = /^\*+([^+@!?*[(]*)$/;
26811
26791
  var starDotExtTest = (ext2) => (f) => !f.startsWith(".") && f.endsWith(ext2);
26812
26792
  var starDotExtTestDot = (ext2) => (f) => f.endsWith(ext2);
26813
26793
  var starDotExtTestNocase = (ext2) => {
@@ -26826,7 +26806,7 @@ var dotStarTest = (f) => f !== "." && f !== ".." && f.startsWith(".");
26826
26806
  var starRE = /^\*+$/;
26827
26807
  var starTest = (f) => f.length !== 0 && !f.startsWith(".");
26828
26808
  var starTestDot = (f) => f.length !== 0 && f !== "." && f !== "..";
26829
- var qmarksRE = /^\?+([^+@!?\*\[\(]*)?$/;
26809
+ var qmarksRE = /^\?+([^+@!?*[(]*)?$/;
26830
26810
  var qmarksTestNocase = ([$0, ext2 = ""]) => {
26831
26811
  const noext = qmarksTestNoExt([$0]);
26832
26812
  if (!ext2)
@@ -27045,10 +27025,10 @@ var Minimatch = class {
27045
27025
  // of patterns that we have to process.
27046
27026
  preprocess(globParts) {
27047
27027
  if (this.options.noglobstar) {
27048
- for (let i2 = 0; i2 < globParts.length; i2++) {
27049
- for (let j = 0; j < globParts[i2].length; j++) {
27050
- if (globParts[i2][j] === "**") {
27051
- globParts[i2][j] = "*";
27028
+ for (const partset of globParts) {
27029
+ for (let j = 0; j < partset.length; j++) {
27030
+ if (partset[j] === "**") {
27031
+ partset[j] = "*";
27052
27032
  }
27053
27033
  }
27054
27034
  }
@@ -27126,7 +27106,7 @@ var Minimatch = class {
27126
27106
  let dd = 0;
27127
27107
  while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
27128
27108
  const p = parts[dd - 1];
27129
- if (p && p !== "." && p !== ".." && p !== "**") {
27109
+ if (p && p !== "." && p !== ".." && p !== "**" && !(this.isWindows && /^[a-z]:$/i.test(p))) {
27130
27110
  didSomething = true;
27131
27111
  parts.splice(dd - 1, 2);
27132
27112
  dd -= 2;
@@ -27542,7 +27522,7 @@ var Minimatch = class {
27542
27522
  re = "^(?!" + re + ").+$";
27543
27523
  try {
27544
27524
  this.regexp = new RegExp(re, [...flags].join(""));
27545
- } catch (ex) {
27525
+ } catch {
27546
27526
  this.regexp = false;
27547
27527
  }
27548
27528
  return this.regexp;
@@ -27550,7 +27530,7 @@ var Minimatch = class {
27550
27530
  slashSplit(p) {
27551
27531
  if (this.preserveMultipleSlashes) {
27552
27532
  return p.split("/");
27553
- } else if (this.isWindows && /^\/\/[^\/]+/.test(p)) {
27533
+ } else if (this.isWindows && /^\/\/[^/]+/.test(p)) {
27554
27534
  return ["", ...p.split(/\/+/)];
27555
27535
  } else {
27556
27536
  return p.split(/\/+/);
@@ -27581,8 +27561,7 @@ var Minimatch = class {
27581
27561
  filename = ff[i2];
27582
27562
  }
27583
27563
  }
27584
- for (let i2 = 0; i2 < set2.length; i2++) {
27585
- const pattern = set2[i2];
27564
+ for (const pattern of set2) {
27586
27565
  let file = ff;
27587
27566
  if (options.matchBase && pattern.length === 1) {
27588
27567
  file = [filename];
@@ -28963,7 +28942,7 @@ var npmRunPathEnv2 = ({ env = process12.env, ...options } = {}) => {
28963
28942
  return env;
28964
28943
  };
28965
28944
 
28966
- // node_modules/env-ci/node_modules/mimic-fn/index.js
28945
+ // node_modules/mimic-fn/index.js
28967
28946
  var copyProperty = (to, from, property, ignoreNonConfigurable) => {
28968
28947
  if (property === "length" || property === "prototype") {
28969
28948
  return;
@@ -29505,7 +29484,7 @@ var normalizeStdio = (options) => {
29505
29484
  };
29506
29485
 
29507
29486
  // node_modules/env-ci/node_modules/execa/lib/kill.js
29508
- import os2 from "node:os";
29487
+ import os3 from "node:os";
29509
29488
  var DEFAULT_FORCE_KILL_TIMEOUT2 = 1e3 * 5;
29510
29489
  var spawnedKill = (kill, signal = "SIGTERM", options = {}) => {
29511
29490
  const killResult = kill(signal);
@@ -29525,7 +29504,7 @@ var setKillTimeout2 = (kill, signal, options, killResult) => {
29525
29504
  }
29526
29505
  };
29527
29506
  var shouldForceKill = (signal, { forceKillAfterTimeout }, killResult) => isSigterm(signal) && forceKillAfterTimeout !== false && killResult;
29528
- var isSigterm = (signal) => signal === os2.constants.signals.SIGTERM || typeof signal === "string" && signal.toUpperCase() === "SIGTERM";
29507
+ var isSigterm = (signal) => signal === os3.constants.signals.SIGTERM || typeof signal === "string" && signal.toUpperCase() === "SIGTERM";
29529
29508
  var getForceKillAfterTimeout = ({ forceKillAfterTimeout = true }) => {
29530
29509
  if (forceKillAfterTimeout === true) {
29531
29510
  return DEFAULT_FORCE_KILL_TIMEOUT2;
@@ -31176,14 +31155,14 @@ var nomatchRegex = /(?!.*)/;
31176
31155
  function escape2(string) {
31177
31156
  return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
31178
31157
  }
31179
- function join(parts, joiner) {
31180
- return parts.map((val) => escape2(val.trim())).filter(Boolean).join(joiner);
31158
+ function joinOr(parts) {
31159
+ return parts.map((val) => typeof val === "string" ? escape2(val.trim()) : val.source).filter(Boolean).join("|");
31181
31160
  }
31182
31161
  function getNotesRegex(noteKeywords, notesPattern) {
31183
31162
  if (!noteKeywords) {
31184
31163
  return nomatchRegex;
31185
31164
  }
31186
- const noteKeywordsSelection = join(noteKeywords, "|");
31165
+ const noteKeywordsSelection = joinOr(noteKeywords);
31187
31166
  if (!notesPattern) {
31188
31167
  return new RegExp(`^[\\s|*]*(${noteKeywordsSelection})[:\\s]+(.*)`, "i");
31189
31168
  }
@@ -31194,13 +31173,13 @@ function getReferencePartsRegex(issuePrefixes, issuePrefixesCaseSensitive) {
31194
31173
  return nomatchRegex;
31195
31174
  }
31196
31175
  const flags = issuePrefixesCaseSensitive ? "g" : "gi";
31197
- return new RegExp(`(?:.*?)??\\s*([\\w-\\.\\/]*?)??(${join(issuePrefixes, "|")})([\\w-]+)(?=\\s|$|[,;)\\]])`, flags);
31176
+ return new RegExp(`(?:.*?)??\\s*([\\w-\\.\\/]*?)??(${joinOr(issuePrefixes)})([\\w-]+)(?=\\s|$|[,;)\\]])`, flags);
31198
31177
  }
31199
31178
  function getReferencesRegex(referenceActions) {
31200
31179
  if (!referenceActions) {
31201
31180
  return /()(.+)/gi;
31202
31181
  }
31203
- const joinedKeywords = join(referenceActions, "|");
31182
+ const joinedKeywords = joinOr(referenceActions);
31204
31183
  return new RegExp(`(${joinedKeywords})(?:\\s+(.*?))(?=(?:${joinedKeywords})|$)`, "gi");
31205
31184
  }
31206
31185
  function getParserRegexes(options = {}) {
@@ -33155,7 +33134,19 @@ function parseJson(string, reviver, fileName) {
33155
33134
 
33156
33135
  // node_modules/read-package-up/node_modules/read-pkg/index.js
33157
33136
  var import_normalize_package_data = __toESM(require_normalize(), 1);
33158
- var getPackagePath = (cwd) => path23.resolve(toPath(cwd) ?? ".", "package.json");
33137
+
33138
+ // node_modules/read-package-up/node_modules/unicorn-magic/node.js
33139
+ import { promisify as promisify5 } from "node:util";
33140
+ import { execFile as execFileCallback3, execFileSync as execFileSyncOriginal3 } from "node:child_process";
33141
+ import { fileURLToPath as fileURLToPath11 } from "node:url";
33142
+ var execFileOriginal3 = promisify5(execFileCallback3);
33143
+ function toPath4(urlOrPath) {
33144
+ return urlOrPath instanceof URL ? fileURLToPath11(urlOrPath) : urlOrPath;
33145
+ }
33146
+ var TEN_MEGABYTES_IN_BYTES3 = 10 * 1024 * 1024;
33147
+
33148
+ // node_modules/read-package-up/node_modules/read-pkg/index.js
33149
+ var getPackagePath = (cwd) => path23.resolve(toPath4(cwd) ?? ".", "package.json");
33159
33150
  var _readPackage = (file, normalize2) => {
33160
33151
  const json2 = typeof file === "string" ? parseJson(file) : file;
33161
33152
  if (normalize2) {
@@ -33360,7 +33351,7 @@ async function generateNotes(pluginConfig, context) {
33360
33351
 
33361
33352
  // src/index.js
33362
33353
  var verified;
33363
- var tempdir = realpathSync2(os3.tmpdir());
33354
+ var tempdir = realpathSync2(os4.tmpdir());
33364
33355
  var npmrc = temporaryFile({ name: ".npmrc" });
33365
33356
  var defaultConfig = {
33366
33357
  npmVerifyAuth: true,