venerate 0.0.3 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,5 @@
1
+ Mozilla Public License Version 2.0
2
+
3
+ This Source Code Form is subject to the terms of the Mozilla Public
4
+ License, v. 2.0. If a copy of the MPL was not distributed with this
5
+ file, You can obtain one at https://mozilla.org/MPL/2.0/.
package/README.md CHANGED
@@ -1,14 +1,30 @@
1
1
  # venerate
2
2
 
3
3
  <a aria-label="NPM version" href="https://www.npmjs.com/package/venerate">
4
- <img alt="NPM Version" src="https://img.shields.io/npm/v/treetrunks?style=for-the-badge">
4
+ <img
5
+ alt="NPM Version"
6
+ src="https://img.shields.io/npm/v/treetrunks?style=for-the-badge"
7
+ >
5
8
  </a>
6
9
  <a aria-label="Dependencies 0" href="https://www.npmjs.com/package/treetrunks">
7
- <img alt="Dependencies 0" src="https://img.shields.io/badge/dependencies-0-0?style=for-the-badge">
8
- </a>
9
- <a href="https://bundlephobia.com/result?p=venerate">
10
- <img alt="Bundlephobia" src="https://img.shields.io/bundlephobia/minzip/venerate?style=for-the-badge">
10
+ <img
11
+ alt="Dependencies 0"
12
+ src="https://img.shields.io/badge/dependencies-0-0?style=for-the-badge"
13
+ >
11
14
  </a>
15
+ <!-- tonnage:default:start -->
16
+
17
+ ## Bundle size
18
+
19
+ Public-module rows retain complete runtime export surfaces. Recipe rows bundle their reviewable entry files and tree-shake unused exports. Both report exact minified and level-9 gzip JavaScript byte counts; declarations, source maps, CSS, and other assets are excluded. Peer dependencies stay external, and shared modules are counted once per bundle.
20
+
21
+ ### Public modules (whole export surface)
22
+
23
+ | Import | Minified JS | Gzip JS |
24
+ | --------------------- | ----------: | ------: |
25
+ | <code>venerate</code> | 1,318 B | 572 B |
26
+
27
+ <!-- tonnage:default:end -->
12
28
 
13
29
  ```sh
14
30
  npm i venerate
@@ -19,15 +35,15 @@ venerate is a small, pure library implementing venn diagram logic for iterables.
19
35
  ## usage
20
36
 
21
37
  ```ts
22
- import * as V from "venerate";
38
+ import * as V from "venerate"
23
39
 
24
- const a = [1, 2, 3];
25
- const b = new Set([2, 3, 4]);
40
+ const a = [1, 2, 3]
41
+ const b = new Set([2, 3, 4])
26
42
  const c = (function* () {
27
- yield 3;
28
- yield 4;
29
- yield 5;
30
- })();
43
+ yield 3
44
+ yield 4
45
+ yield 5
46
+ })()
31
47
 
32
- const union = [...V.union(a, b, c)]; // [1, 2, 3, 4, 5]
48
+ const union = [...V.union(a, b, c)] // [1, 2, 3, 4, 5]
33
49
  ```
@@ -1,48 +1,47 @@
1
1
  //#region src/venerate.d.ts
2
2
  /**
3
- * Cross-realm-safe check for anything that extends Set.
4
- */
5
- declare function isSet(value: unknown): value is Set<any>;
6
- /**
7
- * Materializes an unknown iterable as a Set, without providing for mutation.
8
- * Does not copy the input if it is already a Set.
9
- */
10
- declare const toSet: <T>(it: Iterable<T>) => ReadonlySet<T>;
11
- /**
12
- * Lazily yield the union of A, B, C, ... preserving first-seen order.
13
- * Only a small "seen" Set is maintained; inputs are streamed.
14
- */
15
- declare function union<T>(...iterables: Iterable<T>[]): Iterable<T>;
16
- /**
17
- * Lazily yield A \ (B ∪ C ∪ ...), streaming A and pre-materializing removals.
18
- */
19
- declare function difference<T>(base: Iterable<T>, ...rest: Iterable<T>[]): Iterable<T>;
20
- /**
21
- * Lazily yield A ∩ B ∩ C ∩ ...
22
- * Streams only the FIRST iterable; others are materialized as Sets for O(1) lookups.
23
- * If no others are provided, yields a shallow copy of A.
24
- */
25
- declare function intersection<T>(base: Iterable<T>, ...rest: Iterable<T>[]): Iterable<T>;
26
- /**
27
- * Lazily yield A △ B (pairwise symmetric difference).
28
- * Streams A and B once; materializes the opposite side for membership checks.
29
- * - First yields items unique to A (preserving A's order)
30
- * - Then yields items unique to B (preserving B's order)
31
- */
32
- declare function symmetricDifference<T>(a: Iterable<T>, b: Iterable<T>): Iterable<T>;
33
- /**
34
- * Variadic symmetric difference via left fold of the pairwise version.
35
- * Still lazy in the sense that we only materialize small per-step Sets;
36
- * each fold pass consumes its input generator.
37
- */
38
- declare function symmetricDifferenceVariadic<T>(acc: Iterable<T>, ...rest: Iterable<T>[]): Iterable<T>;
39
- /**
40
- * Predicates (not lazy outputs, but efficient w/ early exits)
41
- */
42
- declare function isSubset<T>(a: Iterable<T>, b: Iterable<T>): boolean;
43
- declare function isSuperset<T>(a: Iterable<T>, b: Iterable<T>): boolean;
44
- declare function isDisjoint<T>(a: Iterable<T>, b: Iterable<T>): boolean;
45
- declare function equals<T>(a: Iterable<T>, b: Iterable<T>): boolean;
3
+ * Cross-realm-safe check for anything that extends Set.
4
+ */
5
+ export declare function isSet(value: unknown): value is Set<any>;
6
+ /**
7
+ * Materializes an unknown iterable as a Set, without providing for mutation.
8
+ * Does not copy the input if it is already a Set.
9
+ */
10
+ export declare const toSet: <T>(it: Iterable<T>) => ReadonlySet<T>;
11
+ /**
12
+ * Lazily yield the union of A, B, C, ... preserving first-seen order.
13
+ * Only a small "seen" Set is maintained; inputs are streamed.
14
+ */
15
+ export declare function union<T>(...iterables: Iterable<T>[]): Iterable<T>;
16
+ /**
17
+ * Lazily yield A \ (B ∪ C ∪ ...), streaming A and pre-materializing removals.
18
+ */
19
+ export declare function difference<T>(base: Iterable<T>, ...rest: Iterable<T>[]): Iterable<T>;
20
+ /**
21
+ * Lazily yield A ∩ B ∩ C ∩ ...
22
+ * Streams only the FIRST iterable; others are materialized as Sets for O(1) lookups.
23
+ * If no others are provided, yields a shallow copy of A.
24
+ */
25
+ export declare function intersection<T>(base: Iterable<T>, ...rest: Iterable<T>[]): Iterable<T>;
26
+ /**
27
+ * Lazily yield A △ B (pairwise symmetric difference).
28
+ * Streams A and B once; materializes the opposite side for membership checks.
29
+ * - First yields items unique to A (preserving A's order)
30
+ * - Then yields items unique to B (preserving B's order)
31
+ */
32
+ export declare function symmetricDifference<T>(a: Iterable<T>, b: Iterable<T>): Iterable<T>;
33
+ /**
34
+ * Variadic symmetric difference via left fold of the pairwise version.
35
+ * Still lazy in the sense that we only materialize small per-step Sets;
36
+ * each fold pass consumes its input generator.
37
+ */
38
+ export declare function symmetricDifferenceVariadic<T>(acc: Iterable<T>, ...rest: Iterable<T>[]): Iterable<T>;
39
+ /**
40
+ * Predicates (not lazy outputs, but efficient w/ early exits)
41
+ */
42
+ export declare function isSubset<T>(a: Iterable<T>, b: Iterable<T>): boolean;
43
+ export declare function isSuperset<T>(a: Iterable<T>, b: Iterable<T>): boolean;
44
+ export declare function isDisjoint<T>(a: Iterable<T>, b: Iterable<T>): boolean;
45
+ export declare function equals<T>(a: Iterable<T>, b: Iterable<T>): boolean;
46
46
  //#endregion
47
- export { difference, equals, intersection, isDisjoint, isSet, isSubset, isSuperset, symmetricDifference, symmetricDifferenceVariadic, toSet, union };
48
47
  //# sourceMappingURL=venerate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"venerate.d.ts","names":[],"sources":["../src/venerate.ts"],"sourcesContent":[],"mappings":";;AAGA;AAeA;AAAuD,iBAfvC,KAAA,CAeuC,KAAA,EAAA,OAAA,CAAA,EAAA,KAAA,IAfP,GAeO,CAAA,GAAA,CAAA;;;;;AAAZ,cAA9B,KAA8B,EAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAd,QAAc,CAAL,CAAK,CAAA,EAAA,GAAA,WAAA,CAAY,CAAZ,CAAA;AAO3C;;;;AAAiE,iBAAhD,KAAgD,CAAA,CAAA,CAAA,CAAA,GAAA,SAAA,EAAzB,QAAyB,CAAhB,CAAgB,CAAA,EAAA,CAAA,EAAT,QAAS,CAAA,CAAA,CAAA;;;AAejE;AAAiB,iBAAA,UAAA,CAAA,CAAA,CAAA,CAAA,IAAA,EACV,QADU,CACD,CADC,CAAA,EAAA,GAAA,IAAA,EAEP,QAFO,CAEE,CAFF,CAAA,EAAA,CAAA,EAGd,QAHc,CAGL,CAHK,CAAA;;;;;;AAGd,iBAec,YAfd,CAAA,CAAA,CAAA,CA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ings":";;;;wBAGgB,MAAM,iBAAiB,SAAS;;;;;qBAenC,QAAS,GAAG,IAAI,SAAS,OAAK,YAAY;;;;;wBAOtC,MAAM,MAAM,WAAW,SAAS,OAAO,SAAS;;;;wBAehD,WAAW,GAC3B,MAAM,SAAS,OACZ,MAAM,SAAS,OAChB,SAAS;;;;;;wBAeK,aAAa,GAC7B,MAAM,SAAS,OACZ,MAAM,SAAS,OAChB,SAAS;;;;;;;wBAiBK,oBAAoB,GACpC,GAAG,SAAS,IACZ,GAAG,SAAS,KACV,SAAS;;;;;;wBAeK,4BAA4B,GAC5C,KAAK,SAAS,OACX,MAAM,SAAS,OAChB,SAAS;;;;wBAQI,SAAS,GAAG,GAAG,SAAS,IAAI,GAAG,SAAS;wBAQxC,WAAW,GAAG,GAAG,SAAS,IAAI,GAAG,SAAS;wBAI1C,WAAW,GAAG,GAAG,SAAS,IAAI,GAAG,SAAS;wBAU1C,OAAO,GAAG,GAAG,SAAS,IAAI,GAAG,SAAS"}
package/dist/venerate.js CHANGED
@@ -102,7 +102,7 @@ function equals(a, b) {
102
102
  for (const v of A) if (!B.has(v)) return false;
103
103
  return true;
104
104
  }
105
-
106
105
  //#endregion
107
106
  export { difference, equals, intersection, isDisjoint, isSet, isSubset, isSuperset, symmetricDifference, symmetricDifferenceVariadic, toSet, union };
107
+
108
108
  //# sourceMappingURL=venerate.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"venerate.js","names":[],"sources":["../src/venerate.ts"],"sourcesContent":["/**\n * Cross-realm-safe check for anything that extends Set.\n */\nexport function isSet(value: unknown): value is Set<any> {\n\tif (value == null) return false\n\ttry {\n\t\t// brand check: throws TypeError unless `value` has [[SetData]]\n\t\tSet.prototype.has.call(value, Symbol.for(`@@brandCheck`))\n\t\treturn true\n\t} catch {\n\t\treturn false\n\t}\n}\n\n/**\n * Materializes an unknown iterable as a Set, without providing for mutation.\n * Does not copy the input if it is already a Set.\n */\nexport const toSet = <T>(it: Iterable<T>): ReadonlySet<T> =>\n\tisSet(it) ? it : new Set(it)\n\n/**\n * Lazily yield the union of A, B, C, ... preserving first-seen order.\n * Only a small \"seen\" Set is maintained; inputs are streamed.\n */\nexport function* union<T>(...iterables: Iterable<T>[]): Iterable<T> {\n\tconst seen = new Set<T>()\n\tfor (const it of iterables) {\n\t\tfor (const v of it) {\n\t\t\tif (!seen.has(v)) {\n\t\t\t\tseen.add(v)\n\t\t\t\tyield v\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * Lazily yield A \\ (B ∪ C ∪ ...), streaming A and pre-materializing removals.\n */\nexport function* difference<T>(\n\tbase: Iterable<T>,\n\t...rest: Iterable<T>[]\n): Iterable<T> {\n\tif (rest.length === 0) {\n\t\tyield* base\n\t\treturn\n\t}\n\tconst remove = new Set<T>()\n\tfor (const it of rest) for (const v of it) remove.add(v)\n\tfor (const v of base) if (!remove.has(v)) yield v\n}\n\n/**\n * Lazily yield A ∩ B ∩ C ∩ ...\n * Streams only the FIRST iterable; others are materialized as Sets for O(1) lookups.\n * If no others are provided, yields a shallow copy of A.\n */\nexport function* intersection<T>(\n\tbase: Iterable<T>,\n\t...rest: Iterable<T>[]\n): Iterable<T> {\n\tif (rest.length === 0) {\n\t\tyield* base\n\t\treturn\n\t}\n\tconst sets = rest.map(toSet)\n\tfor (const v of base) {\n\t\tif (sets.every((s) => s.has(v))) yield v\n\t}\n}\n\n/**\n * Lazily yield A △ B (pairwise symmetric difference).\n * Streams A and B once; materializes the opposite side for membership checks.\n * - First yields items unique to A (preserving A's order)\n * - Then yields items unique to B (preserving B's order)\n */\nexport function* symmetricDifference<T>(\n\ta: Iterable<T>,\n\tb: Iterable<T>,\n): Iterable<T> {\n\tconst A = toSet(a)\n\tconst B = toSet(b)\n\n\t// Items unique to A\n\tfor (const v of A) if (!B.has(v)) yield v\n\t// Items unique to B\n\tfor (const v of B) if (!A.has(v)) yield v\n}\n\n/**\n * Variadic symmetric difference via left fold of the pairwise version.\n * Still lazy in the sense that we only materialize small per-step Sets;\n * each fold pass consumes its input generator.\n */\nexport function* symmetricDifferenceVariadic<T>(\n\tacc: Iterable<T>,\n\t...rest: Iterable<T>[]\n): Iterable<T> {\n\tfor (const it of rest) acc = symmetricDifference(acc, it)\n\tyield* acc\n}\n\n/**\n * Predicates (not lazy outputs, but efficient w/ early exits)\n */\nexport function isSubset<T>(a: Iterable<T>, b: Iterable<T>): boolean {\n\tconst A = toSet(a)\n\tconst B = toSet(b)\n\tif (A.size > B.size) return false\n\tfor (const v of A) if (!B.has(v)) return false\n\treturn true\n}\n\nexport function isSuperset<T>(a: Iterable<T>, b: Iterable<T>): boolean {\n\treturn isSubset(b, a)\n}\n\nexport function isDisjoint<T>(a: Iterable<T>, b: Iterable<T>): boolean {\n\tconst A = toSet(a)\n\tconst B = toSet(b)\n\tconst aIsSmall = A.size <= B.size\n\tconst small = aIsSmall ? A : B\n\tconst big = aIsSmall ? B : A\n\tfor (const v of small) if (big.has(v)) return false\n\treturn true\n}\n\nexport function equals<T>(a: Iterable<T>, b: Iterable<T>): boolean {\n\tconst A = toSet(a)\n\tconst B = toSet(b)\n\tif (A.size !== B.size) return false\n\tfor (const v of A) if (!B.has(v)) return false\n\treturn true\n}\n"],"mappings":";;;;AAGA,SAAgB,MAAM,OAAmC;AACxD,KAAI,SAAS,KAAM,QAAO;AAC1B,KAAI;AAEH,MAAI,UAAU,IAAI,KAAK,OAAO,OAAO,IAAI,eAAe,CAAC;AACzD,SAAO;SACA;AACP,SAAO;;;;;;;AAQT,MAAa,SAAY,OACxB,MAAM,GAAG,GAAG,KAAK,IAAI,IAAI,GAAG;;;;;AAM7B,UAAiB,MAAS,GAAG,WAAuC;CACnE,MAAM,uBAAO,IAAI,KAAQ;AACzB,MAAK,MAAM,MAAM,UAChB,MAAK,MAAM,KAAK,GACf,KAAI,CAAC,KAAK,IAAI,EAAE,EAAE;AACjB,OAAK,IAAI,EAAE;AACX,QAAM;;;;;;AASV,UAAiB,WAChB,MACA,GAAG,MACW;AACd,KAAI,KAAK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AAI;CAC7B,MAAM,MAAM,WAAW,IAAI;AAC3B,MAAK,MAAM,KAAK,MAAO,KAAI,IAAI,IAAI,EAAE,CAAE,QAAO;AAC9C,QAAO;;AAGR,SAAgB,OAAU,GAAgB,GAAyB;CAClE,MAAM,IAAI,MAAM,EAAE;CAClB,MAAM,IAAI,MAAM,EAAE;AAClB,KAAI,EAAE,SAAS,EAAE,KAAM,QAAO;AAC9B,MAAK,MAAM,KAAK,EAAG,KAAI,CAAC,EAAE,IAAI,EAAE,CAAE,QAAO;AACzC,QAAO"}
1
+ {"version":3,"file":"venerate.js","names":[],"sources":["../src/venerate.ts"],"sourcesContent":["/**\n * Cross-realm-safe check for anything that extends Set.\n */\nexport function isSet(value: unknown): value is Set<any> {\n\tif (value == null) return false\n\ttry {\n\t\t// brand check: throws TypeError unless `value` has [[SetData]]\n\t\tSet.prototype.has.call(value, Symbol.for(`@@brandCheck`))\n\t\treturn true\n\t} catch {\n\t\treturn false\n\t}\n}\n\n/**\n * Materializes an unknown iterable as a Set, without providing for mutation.\n * Does not copy the input if it is already a Set.\n */\nexport const toSet = <T>(it: Iterable<T>): ReadonlySet<T> =>\n\tisSet(it) ? it : new Set(it)\n\n/**\n * Lazily yield the union of A, B, C, ... preserving first-seen order.\n * Only a small \"seen\" Set is maintained; inputs are streamed.\n */\nexport function* union<T>(...iterables: Iterable<T>[]): Iterable<T> {\n\tconst seen = new Set<T>()\n\tfor (const it of iterables) {\n\t\tfor (const v of it) {\n\t\t\tif (!seen.has(v)) {\n\t\t\t\tseen.add(v)\n\t\t\t\tyield v\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * Lazily yield A \\ (B ∪ C ∪ ...), streaming A and pre-materializing removals.\n */\nexport function* difference<T>(\n\tbase: Iterable<T>,\n\t...rest: Iterable<T>[]\n): Iterable<T> {\n\tif (rest.length === 0) {\n\t\tyield* base\n\t\treturn\n\t}\n\tconst remove = new Set<T>()\n\tfor (const it of rest) for (const v of it) remove.add(v)\n\tfor (const v of base) if (!remove.has(v)) yield v\n}\n\n/**\n * Lazily yield A ∩ B ∩ C ∩ ...\n * Streams only the FIRST iterable; others are materialized as Sets for O(1) lookups.\n * If no others are provided, yields a shallow copy of A.\n */\nexport function* intersection<T>(\n\tbase: Iterable<T>,\n\t...rest: Iterable<T>[]\n): Iterable<T> {\n\tif (rest.length === 0) {\n\t\tyield* base\n\t\treturn\n\t}\n\tconst sets = rest.map(toSet)\n\tfor (const v of base) {\n\t\tif (sets.every((s) => s.has(v))) yield v\n\t}\n}\n\n/**\n * Lazily yield A △ B (pairwise symmetric difference).\n * Streams A and B once; materializes the opposite side for membership checks.\n * - First yields items unique to A (preserving A's order)\n * - Then yields items unique to B (preserving B's order)\n */\nexport function* symmetricDifference<T>(\n\ta: Iterable<T>,\n\tb: Iterable<T>,\n): Iterable<T> {\n\tconst A = toSet(a)\n\tconst B = toSet(b)\n\n\t// Items unique to A\n\tfor (const v of A) if (!B.has(v)) yield v\n\t// Items unique to B\n\tfor (const v of B) if (!A.has(v)) yield v\n}\n\n/**\n * Variadic symmetric difference via left fold of the pairwise version.\n * Still lazy in the sense that we only materialize small per-step Sets;\n * each fold pass consumes its input generator.\n */\nexport function* symmetricDifferenceVariadic<T>(\n\tacc: Iterable<T>,\n\t...rest: Iterable<T>[]\n): Iterable<T> {\n\tfor (const it of rest) acc = symmetricDifference(acc, it)\n\tyield* acc\n}\n\n/**\n * Predicates (not lazy outputs, but efficient w/ early exits)\n */\nexport function isSubset<T>(a: Iterable<T>, b: Iterable<T>): boolean {\n\tconst A = toSet(a)\n\tconst B = toSet(b)\n\tif (A.size > B.size) return false\n\tfor (const v of A) if (!B.has(v)) return false\n\treturn true\n}\n\nexport function isSuperset<T>(a: Iterable<T>, b: Iterable<T>): boolean {\n\treturn isSubset(b, a)\n}\n\nexport function isDisjoint<T>(a: Iterable<T>, b: Iterable<T>): boolean {\n\tconst A = toSet(a)\n\tconst B = toSet(b)\n\tconst aIsSmall = A.size <= B.size\n\tconst small = aIsSmall ? A : B\n\tconst big = aIsSmall ? B : A\n\tfor (const v of small) if (big.has(v)) return false\n\treturn true\n}\n\nexport function equals<T>(a: Iterable<T>, b: Iterable<T>): boolean {\n\tconst A = toSet(a)\n\tconst B = toSet(b)\n\tif (A.size !== B.size) return false\n\tfor (const v of A) if (!B.has(v)) return false\n\treturn true\n}\n"],"mappings":";;;;AAGA,SAAgB,MAAM,OAAmC;CACxD,IAAI,SAAS,MAAM,OAAO;CAC1B,IAAI;EAEH,IAAI,UAAU,IAAI,KAAK,OAAO,OAAO,IAAI,cAAc,CAAC;EACxD,OAAO;CACR,QAAQ;EACP,OAAO;CACR;AACD;;;;;AAMA,MAAa,SAAY,OACxB,MAAM,EAAE,IAAI,KAAK,IAAI,IAAI,EAAE;;;;;AAM5B,UAAiB,MAAS,GAAG,WAAuC;CACnE,MAAM,uBAAO,IAAI,IAAO;CACxB,KAAK,MAAM,MAAM,WAChB,KAAK,MAAM,KAAK,IACf,IAAI,CAAC,KAAK,IAAI,CAAC,GAAG;EACjB,KAAK,IAAI,CAAC;EACV,MAAM;CACP;AAGH;;;;AAKA,UAAiB,WAChB,MACA,GAAG,MACW;CACd,IAAI,KAAK,WAAW,GAAG;EACtB,OAAO;EACP;CACD;CACA,MAAM,yBAAS,IAAI,IAAO;CAC1B,KAAK,MAAM,MAAM,MAAM,KAAK,MAAM,KAAK,IAAI,OAAO,IAAI,CAAC;CACvD,KAAK,MAAM,KAAK,MAAM,IAAI,CAAC,OAAO,IAAI,CAAC,GAAG,MAAM;AACjD;;;;;;AAOA,UAAiB,aAChB,MACA,GAAG,MACW;CACd,IAAI,KAAK,WAAW,GAAG;EACtB,OAAO;EACP;CACD;CACA,MAAM,OAAO,KAAK,IAAI,KAAK;CAC3B,KAAK,MAAM,KAAK,MACf,IAAI,KAAK,OAAO,MAAM,EAAE,IAAI,CAAC,CAAC,GAAG,MAAM;AAEzC;;;;;;;AAQA,UAAiB,oBAChB,GACA,GACc;CACd,MAAM,IAAI,MAAM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-2.0",
5
5
  "author": {
6
6
  "name": "Jeremy Banka",
7
7
  "email": "hello@jeremybanka.com"
@@ -21,25 +21,26 @@
21
21
  ],
22
22
  "main": "dist/venerate.js",
23
23
  "devDependencies": {
24
- "@types/node": "24.3.1",
25
- "@vitest/coverage-v8": "3.2.4",
26
- "concurrently": "9.2.1",
27
- "eslint": "9.35.0",
28
- "recoverage": "0.1.11",
29
- "tsdown": "0.14.2",
30
- "vite": "7.1.5",
31
- "vitest": "3.2.4"
24
+ "@types/node": "25.9.5",
25
+ "typescript": "7.0.2",
26
+ "@vitest/coverage-v8": "4.1.11",
27
+ "concurrently": "10.0.5",
28
+ "eslint": "10.9.1",
29
+ "recoverage": "0.1.16",
30
+ "tsdown": "0.22.14",
31
+ "vite": "8.2.2",
32
+ "vitest": "4.1.11"
32
33
  },
33
34
  "scripts": {
34
35
  "build": "tsdown",
35
- "lint:biome": "biome check -- .",
36
36
  "lint:eslint": "eslint -- .",
37
- "lint:types": "tsgo --noEmit",
38
- "watch:types": "tsgo --watch --noEmit",
37
+ "lint:oxlint": "oxlint --type-aware -c ../../.oxlintrc.jsonc .",
38
+ "lint:types": "tsc --noEmit",
39
+ "watch:types": "tsc --watch --noEmit",
39
40
  "lint": "concurrently \"bun:lint:*\"",
40
41
  "test": "vitest",
41
42
  "test:coverage": "vitest run --coverage",
42
43
  "test:once": "vitest run",
43
- "postversion": "biome format --write package.json"
44
+ "postversion": "dprint fmt package.json"
44
45
  }
45
46
  }