@jomae/catalog 0.4.0 → 0.7.0

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 (244) hide show
  1. package/README.md +21 -3
  2. package/dist/baseline.d.ts +25 -0
  3. package/dist/baseline.d.ts.map +1 -1
  4. package/dist/baseline.js +25 -1
  5. package/dist/baseline.js.map +1 -1
  6. package/dist/categories.d.ts +20 -0
  7. package/dist/categories.d.ts.map +1 -0
  8. package/dist/categories.js +62 -0
  9. package/dist/categories.js.map +1 -0
  10. package/dist/detect.d.ts +2 -1
  11. package/dist/detect.d.ts.map +1 -1
  12. package/dist/detect.js +17 -2
  13. package/dist/detect.js.map +1 -1
  14. package/dist/generated/baseline-history.d.ts +21 -0
  15. package/dist/generated/baseline-history.d.ts.map +1 -0
  16. package/dist/generated/baseline-history.js +20 -0
  17. package/dist/generated/baseline-history.js.map +1 -0
  18. package/dist/generated/baseline.d.ts +10 -0
  19. package/dist/generated/baseline.d.ts.map +1 -1
  20. package/dist/generated/baseline.js +250 -67
  21. package/dist/generated/baseline.js.map +1 -1
  22. package/dist/generated/guides.d.ts +16 -0
  23. package/dist/generated/guides.d.ts.map +1 -0
  24. package/dist/generated/guides.js +153 -0
  25. package/dist/generated/guides.js.map +1 -0
  26. package/dist/generated/sizes.d.ts.map +1 -1
  27. package/dist/generated/sizes.js +280 -55
  28. package/dist/generated/sizes.js.map +1 -1
  29. package/dist/generated/support-claims.d.ts +15 -0
  30. package/dist/generated/support-claims.d.ts.map +1 -0
  31. package/dist/generated/support-claims.js +69 -0
  32. package/dist/generated/support-claims.js.map +1 -0
  33. package/dist/guides.d.ts +46 -0
  34. package/dist/guides.d.ts.map +1 -0
  35. package/dist/guides.js +55 -0
  36. package/dist/guides.js.map +1 -0
  37. package/dist/history.d.ts +11 -0
  38. package/dist/history.d.ts.map +1 -0
  39. package/dist/history.js +14 -0
  40. package/dist/history.js.map +1 -0
  41. package/dist/index.d.ts +7 -1
  42. package/dist/index.d.ts.map +1 -1
  43. package/dist/index.js +7 -1
  44. package/dist/index.js.map +1 -1
  45. package/dist/markdown.d.ts +24 -0
  46. package/dist/markdown.d.ts.map +1 -0
  47. package/dist/markdown.js +194 -0
  48. package/dist/markdown.js.map +1 -0
  49. package/dist/rules/abort-controller.d.ts.map +1 -1
  50. package/dist/rules/abort-controller.js +2 -1
  51. package/dist/rules/abort-controller.js.map +1 -1
  52. package/dist/rules/accordion.d.ts.map +1 -1
  53. package/dist/rules/accordion.js +3 -0
  54. package/dist/rules/accordion.js.map +1 -1
  55. package/dist/rules/array-grouping.d.ts +3 -0
  56. package/dist/rules/array-grouping.d.ts.map +1 -0
  57. package/dist/rules/array-grouping.js +29 -0
  58. package/dist/rules/array-grouping.js.map +1 -0
  59. package/dist/rules/aspect-ratio.d.ts.map +1 -1
  60. package/dist/rules/aspect-ratio.js +1 -0
  61. package/dist/rules/aspect-ratio.js.map +1 -1
  62. package/dist/rules/base64.d.ts +3 -0
  63. package/dist/rules/base64.d.ts.map +1 -0
  64. package/dist/rules/base64.js +41 -0
  65. package/dist/rules/base64.js.map +1 -0
  66. package/dist/rules/broadcast-channel.d.ts.map +1 -1
  67. package/dist/rules/broadcast-channel.js +1 -0
  68. package/dist/rules/broadcast-channel.js.map +1 -1
  69. package/dist/rules/carousel.d.ts.map +1 -1
  70. package/dist/rules/carousel.js +7 -0
  71. package/dist/rules/carousel.js.map +1 -1
  72. package/dist/rules/clipboard.d.ts.map +1 -1
  73. package/dist/rules/clipboard.js +4 -1
  74. package/dist/rules/clipboard.js.map +1 -1
  75. package/dist/rules/color-functions.d.ts.map +1 -1
  76. package/dist/rules/color-functions.js +1 -0
  77. package/dist/rules/color-functions.js.map +1 -1
  78. package/dist/rules/compression-streams.d.ts.map +1 -1
  79. package/dist/rules/compression-streams.js +2 -1
  80. package/dist/rules/compression-streams.js.map +1 -1
  81. package/dist/rules/container-queries.d.ts.map +1 -1
  82. package/dist/rules/container-queries.js +2 -0
  83. package/dist/rules/container-queries.js.map +1 -1
  84. package/dist/rules/content-visibility.d.ts.map +1 -1
  85. package/dist/rules/content-visibility.js +3 -1
  86. package/dist/rules/content-visibility.js.map +1 -1
  87. package/dist/rules/custom-highlight.d.ts +3 -0
  88. package/dist/rules/custom-highlight.d.ts.map +1 -0
  89. package/dist/rules/custom-highlight.js +39 -0
  90. package/dist/rules/custom-highlight.js.map +1 -0
  91. package/dist/rules/date-time-input.d.ts.map +1 -1
  92. package/dist/rules/date-time-input.js +2 -0
  93. package/dist/rules/date-time-input.js.map +1 -1
  94. package/dist/rules/dialog.d.ts.map +1 -1
  95. package/dist/rules/dialog.js +8 -0
  96. package/dist/rules/dialog.js.map +1 -1
  97. package/dist/rules/discrete-transitions.d.ts.map +1 -1
  98. package/dist/rules/discrete-transitions.js +6 -0
  99. package/dist/rules/discrete-transitions.js.map +1 -1
  100. package/dist/rules/drag-and-drop.d.ts.map +1 -1
  101. package/dist/rules/drag-and-drop.js +26 -8
  102. package/dist/rules/drag-and-drop.js.map +1 -1
  103. package/dist/rules/duration-format.d.ts +3 -0
  104. package/dist/rules/duration-format.d.ts.map +1 -0
  105. package/dist/rules/duration-format.js +37 -0
  106. package/dist/rules/duration-format.js.map +1 -0
  107. package/dist/rules/event-target.d.ts +3 -0
  108. package/dist/rules/event-target.d.ts.map +1 -0
  109. package/dist/rules/event-target.js +51 -0
  110. package/dist/rules/event-target.js.map +1 -0
  111. package/dist/rules/fetch.d.ts +3 -0
  112. package/dist/rules/fetch.d.ts.map +1 -0
  113. package/dist/rules/fetch.js +46 -0
  114. package/dist/rules/fetch.js.map +1 -0
  115. package/dist/rules/field-sizing.d.ts.map +1 -1
  116. package/dist/rules/field-sizing.js +3 -1
  117. package/dist/rules/field-sizing.js.map +1 -1
  118. package/dist/rules/fluid-type.d.ts.map +1 -1
  119. package/dist/rules/fluid-type.js +3 -1
  120. package/dist/rules/fluid-type.js.map +1 -1
  121. package/dist/rules/focus-visible.d.ts.map +1 -1
  122. package/dist/rules/focus-visible.js +1 -0
  123. package/dist/rules/focus-visible.js.map +1 -1
  124. package/dist/rules/fullscreen.d.ts.map +1 -1
  125. package/dist/rules/fullscreen.js +2 -1
  126. package/dist/rules/fullscreen.js.map +1 -1
  127. package/dist/rules/height-animation.d.ts.map +1 -1
  128. package/dist/rules/height-animation.js +2 -0
  129. package/dist/rules/height-animation.js.map +1 -1
  130. package/dist/rules/index.d.ts.map +1 -1
  131. package/dist/rules/index.js +64 -3
  132. package/dist/rules/index.js.map +1 -1
  133. package/dist/rules/inert.d.ts +3 -0
  134. package/dist/rules/inert.d.ts.map +1 -0
  135. package/dist/rules/inert.js +37 -0
  136. package/dist/rules/inert.js.map +1 -0
  137. package/dist/rules/intersection-observer.d.ts.map +1 -1
  138. package/dist/rules/intersection-observer.js +2 -0
  139. package/dist/rules/intersection-observer.js.map +1 -1
  140. package/dist/rules/lazy-loading.d.ts.map +1 -1
  141. package/dist/rules/lazy-loading.js +2 -0
  142. package/dist/rules/lazy-loading.js.map +1 -1
  143. package/dist/rules/line-clamp.d.ts.map +1 -1
  144. package/dist/rules/line-clamp.js +2 -1
  145. package/dist/rules/line-clamp.js.map +1 -1
  146. package/dist/rules/masonry.d.ts.map +1 -1
  147. package/dist/rules/masonry.js +1 -0
  148. package/dist/rules/masonry.js.map +1 -1
  149. package/dist/rules/natural-sort.d.ts +3 -0
  150. package/dist/rules/natural-sort.d.ts.map +1 -0
  151. package/dist/rules/natural-sort.js +41 -0
  152. package/dist/rules/natural-sort.js.map +1 -0
  153. package/dist/rules/number-format.d.ts.map +1 -1
  154. package/dist/rules/number-format.js +3 -1
  155. package/dist/rules/number-format.js.map +1 -1
  156. package/dist/rules/page-visibility.d.ts.map +1 -1
  157. package/dist/rules/page-visibility.js +5 -0
  158. package/dist/rules/page-visibility.js.map +1 -1
  159. package/dist/rules/popover.d.ts.map +1 -1
  160. package/dist/rules/popover.js +8 -1
  161. package/dist/rules/popover.js.map +1 -1
  162. package/dist/rules/random-uuid.d.ts +3 -0
  163. package/dist/rules/random-uuid.d.ts.map +1 -0
  164. package/dist/rules/random-uuid.js +31 -0
  165. package/dist/rules/random-uuid.js.map +1 -0
  166. package/dist/rules/relative-time.d.ts.map +1 -1
  167. package/dist/rules/relative-time.js +1 -0
  168. package/dist/rules/relative-time.js.map +1 -1
  169. package/dist/rules/resizable-panels.d.ts.map +1 -1
  170. package/dist/rules/resizable-panels.js +4 -7
  171. package/dist/rules/resizable-panels.js.map +1 -1
  172. package/dist/rules/resize-observer.d.ts.map +1 -1
  173. package/dist/rules/resize-observer.js +2 -1
  174. package/dist/rules/resize-observer.js.map +1 -1
  175. package/dist/rules/screen-wake-lock.d.ts.map +1 -1
  176. package/dist/rules/screen-wake-lock.js +3 -1
  177. package/dist/rules/screen-wake-lock.js.map +1 -1
  178. package/dist/rules/scroll-animations.d.ts.map +1 -1
  179. package/dist/rules/scroll-animations.js +9 -1
  180. package/dist/rules/scroll-animations.js.map +1 -1
  181. package/dist/rules/scroll-lock.d.ts.map +1 -1
  182. package/dist/rules/scroll-lock.js +8 -7
  183. package/dist/rules/scroll-lock.js.map +1 -1
  184. package/dist/rules/scrollbars.d.ts.map +1 -1
  185. package/dist/rules/scrollbars.js +5 -0
  186. package/dist/rules/scrollbars.js.map +1 -1
  187. package/dist/rules/select.d.ts.map +1 -1
  188. package/dist/rules/select.js +7 -0
  189. package/dist/rules/select.js.map +1 -1
  190. package/dist/rules/server-sent-events.d.ts +3 -0
  191. package/dist/rules/server-sent-events.d.ts.map +1 -0
  192. package/dist/rules/server-sent-events.js +38 -0
  193. package/dist/rules/server-sent-events.js.map +1 -0
  194. package/dist/rules/smooth-scroll.d.ts.map +1 -1
  195. package/dist/rules/smooth-scroll.js +2 -0
  196. package/dist/rules/smooth-scroll.js.map +1 -1
  197. package/dist/rules/speech-recognition.d.ts.map +1 -1
  198. package/dist/rules/speech-recognition.js +19 -10
  199. package/dist/rules/speech-recognition.js.map +1 -1
  200. package/dist/rules/speech-synthesis.d.ts.map +1 -1
  201. package/dist/rules/speech-synthesis.js +3 -0
  202. package/dist/rules/speech-synthesis.js.map +1 -1
  203. package/dist/rules/sticky.d.ts.map +1 -1
  204. package/dist/rules/sticky.js +2 -0
  205. package/dist/rules/sticky.js.map +1 -1
  206. package/dist/rules/structured-clone.d.ts.map +1 -1
  207. package/dist/rules/structured-clone.js +13 -2
  208. package/dist/rules/structured-clone.js.map +1 -1
  209. package/dist/rules/text-box-trim.d.ts.map +1 -1
  210. package/dist/rules/text-box-trim.js +3 -1
  211. package/dist/rules/text-box-trim.js.map +1 -1
  212. package/dist/rules/text-wrap-balance.d.ts.map +1 -1
  213. package/dist/rules/text-wrap-balance.js +2 -0
  214. package/dist/rules/text-wrap-balance.js.map +1 -1
  215. package/dist/rules/url-search-params.d.ts +3 -0
  216. package/dist/rules/url-search-params.d.ts.map +1 -0
  217. package/dist/rules/url-search-params.js +42 -0
  218. package/dist/rules/url-search-params.js.map +1 -0
  219. package/dist/rules/view-transitions.d.ts.map +1 -1
  220. package/dist/rules/view-transitions.js +9 -0
  221. package/dist/rules/view-transitions.js.map +1 -1
  222. package/dist/rules/web-bluetooth.d.ts.map +1 -1
  223. package/dist/rules/web-bluetooth.js +1 -0
  224. package/dist/rules/web-bluetooth.js.map +1 -1
  225. package/dist/rules/web-crypto.d.ts +3 -0
  226. package/dist/rules/web-crypto.d.ts.map +1 -0
  227. package/dist/rules/web-crypto.js +32 -0
  228. package/dist/rules/web-crypto.js.map +1 -0
  229. package/dist/rules/web-share.d.ts.map +1 -1
  230. package/dist/rules/web-share.js +1 -0
  231. package/dist/rules/web-share.js.map +1 -1
  232. package/dist/schema.d.ts +22 -0
  233. package/dist/schema.d.ts.map +1 -1
  234. package/dist/schema.js +63 -4
  235. package/dist/schema.js.map +1 -1
  236. package/dist/search.d.ts +29 -0
  237. package/dist/search.d.ts.map +1 -0
  238. package/dist/search.js +84 -0
  239. package/dist/search.js.map +1 -0
  240. package/dist/support.d.ts +11 -0
  241. package/dist/support.d.ts.map +1 -0
  242. package/dist/support.js +31 -0
  243. package/dist/support.js.map +1 -0
  244. package/package.json +2 -2
@@ -0,0 +1,69 @@
1
+ // Generated by scripts/refresh-support.ts. Do not edit by hand.
2
+ // Run `pnpm refresh:support` to update.
3
+ /**
4
+ * Every browser version the catalog's prose cites, resolved from web-features
5
+ * and MDN's browser-compat-data. No rule writes a version number by hand.
6
+ */
7
+ export const supportClaims = {
8
+ "generatedOn": "2026-09-06",
9
+ "webFeaturesVersion": "3.36.0",
10
+ "bcdVersion": "8.1.0",
11
+ "claims": {
12
+ "chrome:abortsignal-timeout": "124",
13
+ "chrome:api.Crypto.randomUUID": "92",
14
+ "chrome:api.ResizeObserverEntry.devicePixelContentBoxSize": "84",
15
+ "chrome:api.URLSearchParams": "49",
16
+ "chrome:css.properties.anchor-name": "125",
17
+ "chrome:css.properties.content-visibility.auto": "85",
18
+ "chrome:css.properties.overscroll-behavior.contain": "63",
19
+ "chrome:css.properties.resize.block": "118",
20
+ "chrome:css.properties.text-box": "133",
21
+ "chrome:field-sizing": "123",
22
+ "chrome:inert": "102",
23
+ "chrome:javascript.builtins.Intl.NumberFormat.NumberFormat.options_parameter.options_unit_parameter": "77",
24
+ "chrome:overscroll-behavior": "144",
25
+ "chrome:scroll-driven-animations": "115",
26
+ "chrome:speech-recognition": "139",
27
+ "chrome:url": "32",
28
+ "firefox:abortsignal-timeout": "100",
29
+ "firefox:api.Clipboard.writeText": "63",
30
+ "firefox:api.Crypto.randomUUID": "95",
31
+ "firefox:api.ResizeObserverEntry.devicePixelContentBoxSize": "108",
32
+ "firefox:api.URLSearchParams": "29",
33
+ "firefox:css.properties.anchor-name": "147",
34
+ "firefox:css.properties.content-visibility.auto": "125",
35
+ "firefox:css.properties.overscroll-behavior.contain": "59",
36
+ "firefox:css.properties.resize.block": "63",
37
+ "firefox:css.properties.text-box": "154",
38
+ "firefox:field-sizing": "152",
39
+ "firefox:highlight": "149",
40
+ "firefox:inert": "112",
41
+ "firefox:javascript.builtins.Intl.NumberFormat.NumberFormat.options_parameter.options_unit_parameter": "78",
42
+ "firefox:overscroll-behavior": "150",
43
+ "nodejs:api.EventTarget": "15.0.0",
44
+ "nodejs:api.fetch": "18.0.0",
45
+ "safari:abortsignal-timeout": "16",
46
+ "safari:api.Clipboard.writeText": "13.1",
47
+ "safari:api.Crypto.randomUUID": "15.4",
48
+ "safari:api.Element.requestFullscreen": "16.4",
49
+ "safari:api.EventTarget.EventTarget": "14",
50
+ "safari:api.EventTarget.addEventListener.options_parameter.options_signal_parameter": "15",
51
+ "safari:api.URLSearchParams": "10.1",
52
+ "safari:api.WakeLock": "16.4",
53
+ "safari:css.properties.anchor-name": "26",
54
+ "safari:css.properties.content-visibility.auto": "26",
55
+ "safari:css.properties.overscroll-behavior.contain": "16",
56
+ "safari:css.properties.resize.block": "16",
57
+ "safari:css.properties.text-box": "18.2",
58
+ "safari:events": "1",
59
+ "safari:field-sizing": "26.2",
60
+ "safari:highlight": "17.2",
61
+ "safari:inert": "15.5",
62
+ "safari:javascript.builtins.Intl.NumberFormat.NumberFormat.options_parameter.options_unit_parameter": "14.1",
63
+ "safari:scroll-driven-animations": "26",
64
+ "safari:url": "7",
65
+ "safari:web-cryptography": "11",
66
+ "safari_ios:api.WakeLock": "18.4"
67
+ }
68
+ };
69
+ //# sourceMappingURL=support-claims.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"support-claims.js","sourceRoot":"","sources":["../../src/generated/support-claims.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,wCAAwC;AAYxC;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAkB;IAC1C,aAAa,EAAE,YAAY;IAC3B,oBAAoB,EAAE,QAAQ;IAC9B,YAAY,EAAE,OAAO;IACrB,QAAQ,EAAE;QACR,4BAA4B,EAAE,KAAK;QACnC,8BAA8B,EAAE,IAAI;QACpC,0DAA0D,EAAE,IAAI;QAChE,4BAA4B,EAAE,IAAI;QAClC,mCAAmC,EAAE,KAAK;QAC1C,+C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iC,EAAE,IAAI;QACvC,YAAY,EAAE,GAAG;QACjB,yBAAyB,EAAE,IAAI;QAC/B,yBAAyB,EAAE,MAAM;KAClC;CACF,CAAC"}
@@ -0,0 +1,46 @@
1
+ import { type GuideSnapshot, guideSnapshot } from "./generated/guides.ts";
2
+ import type { Rule } from "./schema.ts";
3
+ /**
4
+ * Resolution for the long-form guides a rule can point at.
5
+ *
6
+ * The catalog answers which dependency has a native equivalent. It does not
7
+ * try to be a tutorial, and the agent projection has a token budget that a
8
+ * tutorial would blow. GoogleChrome/modern-web-guidance already writes the
9
+ * long form, keyed by use case rather than by package, so a rule stores guide
10
+ * IDs and this resolves them into a URL and a retrieval command.
11
+ *
12
+ * Pure, like everything else the surfaces share. IDs are checked against a
13
+ * committed snapshot (`pnpm refresh:guides`), so a guide that moves upstream
14
+ * fails a test rather than shipping as a dead link.
15
+ */
16
+ /** Where the guides come from, shown wherever they are linked. */
17
+ export declare const GUIDE_SOURCE: {
18
+ readonly name: "modern-web-guidance";
19
+ readonly owner: "Google Chrome";
20
+ readonly licence: "Apache-2.0";
21
+ readonly repo: string;
22
+ readonly version: string;
23
+ readonly fetchedOn: string;
24
+ };
25
+ export interface ResolvedGuide {
26
+ id: string;
27
+ /** The category directory, e.g. "ui-behaviors". Empty when unresolved. */
28
+ category: string;
29
+ /** Permalink to the markdown, or null when the ID is not in the snapshot. */
30
+ url: string | null;
31
+ /** What to run to pull the guide into an agent's context. */
32
+ command: string;
33
+ }
34
+ /** The command their SKILL.md documents. Kept in one place. */
35
+ export declare function guideCommand(ids: readonly string[]): string;
36
+ /**
37
+ * Looks up one guide. Returns a `url` of null for an unknown ID rather than
38
+ * throwing, matching resolveFeature()'s behaviour for an unknown feature.
39
+ */
40
+ export declare function resolveGuide(id: string): ResolvedGuide;
41
+ /** Every guide a rule points at, in the order the rule lists them. */
42
+ export declare function resolveGuides(rule: Rule): ResolvedGuide[];
43
+ /** True when the snapshot knows this ID. Used by the tests and the scripts. */
44
+ export declare function isKnownGuide(id: string): boolean;
45
+ export { type GuideSnapshot, guideSnapshot };
46
+ //# sourceMappingURL=guides.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guides.d.ts","sourceRoot":"","sources":["../src/guides.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC1E,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAExC;;;;;;;;;;;;GAYG;AAEH,kEAAkE;AAClE,eAAO,MAAM,YAAY;aACvB,IAAI,EAAE,qBAAqB;aAC3B,KAAK,EAAE,eAAe;aACtB,OAAO,EAAE,YAAY;aACrB,IAAI;aACJ,OAAO;aACP,SAAS;CACD,CAAC;AAEX,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,0EAA0E;IAC1E,QAAQ,EAAE,MAAM,CAAC;IACjB,6EAA6E;IAC7E,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,6DAA6D;IAC7D,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,+DAA+D;AAC/D,wBAAgB,YAAY,CAAC,GAAG,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAE3D;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,aAAa,CAatD;AAED,sEAAsE;AACtE,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,GAAG,aAAa,EAAE,CAEzD;AAED,+EAA+E;AAC/E,wBAAgB,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAEhD;AAED,OAAO,EAAE,KAAK,aAAa,EAAE,aAAa,EAAE,CAAC"}
package/dist/guides.js ADDED
@@ -0,0 +1,55 @@
1
+ import { guideSnapshot } from "./generated/guides.js";
2
+ /**
3
+ * Resolution for the long-form guides a rule can point at.
4
+ *
5
+ * The catalog answers which dependency has a native equivalent. It does not
6
+ * try to be a tutorial, and the agent projection has a token budget that a
7
+ * tutorial would blow. GoogleChrome/modern-web-guidance already writes the
8
+ * long form, keyed by use case rather than by package, so a rule stores guide
9
+ * IDs and this resolves them into a URL and a retrieval command.
10
+ *
11
+ * Pure, like everything else the surfaces share. IDs are checked against a
12
+ * committed snapshot (`pnpm refresh:guides`), so a guide that moves upstream
13
+ * fails a test rather than shipping as a dead link.
14
+ */
15
+ /** Where the guides come from, shown wherever they are linked. */
16
+ export const GUIDE_SOURCE = {
17
+ name: "modern-web-guidance",
18
+ owner: "Google Chrome",
19
+ licence: "Apache-2.0",
20
+ repo: guideSnapshot.repo,
21
+ version: guideSnapshot.version,
22
+ fetchedOn: guideSnapshot.fetchedOn,
23
+ };
24
+ /** The command their SKILL.md documents. Kept in one place. */
25
+ export function guideCommand(ids) {
26
+ return `npx -y modern-web-guidance@latest retrieve "${ids.join(",")}"`;
27
+ }
28
+ /**
29
+ * Looks up one guide. Returns a `url` of null for an unknown ID rather than
30
+ * throwing, matching resolveFeature()'s behaviour for an unknown feature.
31
+ */
32
+ export function resolveGuide(id) {
33
+ // Object.hasOwn, not `in` or a bare read: the snapshot is a plain object, so
34
+ // an id like "constructor" or "toString" would otherwise resolve to
35
+ // something off Object.prototype and build a nonsense URL from it.
36
+ const category = isKnownGuide(id) ? guideSnapshot.guides[id] : undefined;
37
+ return {
38
+ id,
39
+ category: category ?? "",
40
+ url: category
41
+ ? `${guideSnapshot.repo}/blob/main/skills/modern-web-guidance/guides/${category}/${id}.md`
42
+ : null,
43
+ command: guideCommand([id]),
44
+ };
45
+ }
46
+ /** Every guide a rule points at, in the order the rule lists them. */
47
+ export function resolveGuides(rule) {
48
+ return (rule.guides ?? []).map(resolveGuide);
49
+ }
50
+ /** True when the snapshot knows this ID. Used by the tests and the scripts. */
51
+ export function isKnownGuide(id) {
52
+ return Object.hasOwn(guideSnapshot.guides, id);
53
+ }
54
+ export { guideSnapshot };
55
+ //# sourceMappingURL=guides.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":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,CAAC,aAAa,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AACjD,CAAC;AAED,OAAO,EAAsB,aAAa,EAAE,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { BaselineHistoryEntry } from "./generated/baseline-history.ts";
2
+ export interface TierShare {
3
+ widely: number;
4
+ newly: number;
5
+ limited: number;
6
+ unknown: number;
7
+ }
8
+ /** Each tier's percentage share of the catalog at that point. Computed, not
9
+ * stored, so the chart isn't fooled by the catalog simply growing. */
10
+ export declare function tierShareOf(entry: BaselineHistoryEntry): TierShare;
11
+ //# sourceMappingURL=history.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../src/history.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAE5E,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;sEACsE;AACtE,wBAAgB,WAAW,CAAC,KAAK,EAAE,oBAAoB,GAAG,SAAS,CASlE"}
@@ -0,0 +1,14 @@
1
+ /** Each tier's percentage share of the catalog at that point. Computed, not
2
+ * stored, so the chart isn't fooled by the catalog simply growing. */
3
+ export function tierShareOf(entry) {
4
+ const { ruleCount, tally } = entry;
5
+ if (ruleCount === 0)
6
+ return { widely: 0, newly: 0, limited: 0, unknown: 0 };
7
+ return {
8
+ widely: (tally.widely / ruleCount) * 100,
9
+ newly: (tally.newly / ruleCount) * 100,
10
+ limited: (tally.limited / ruleCount) * 100,
11
+ unknown: (tally.unknown / ruleCount) * 100,
12
+ };
13
+ }
14
+ //# sourceMappingURL=history.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"history.js","sourceRoot":"","sources":["../src/history.ts"],"names":[],"mappings":"AASA;sEACsE;AACtE,MAAM,UAAU,WAAW,CAAC,KAA2B;IACrD,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;IACnC,IAAI,SAAS,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;IAC5E,OAAO;QACL,MAAM,EAAE,CAAC,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC,GAAG,GAAG;QACxC,KAAK,EAAE,CAAC,KAAK,CAAC,KAAK,GAAG,SAAS,CAAC,GAAG,GAAG;QACtC,OAAO,EAAE,CAAC,KAAK,CAAC,OAAO,GAAG,SAAS,CAAC,GAAG,GAAG;QAC1C,OAAO,EAAE,CAAC,KAAK,CAAC,OAAO,GAAG,SAAS,CAAC,GAAG,GAAG;KAC3C,CAAC;AACJ,CAAC"}
package/dist/index.d.ts CHANGED
@@ -4,10 +4,16 @@
4
4
  * The rule catalog, the pure detection function, and the Baseline resolution
5
5
  * that sits between them. Every surface is a thin adapter over this package.
6
6
  */
7
- export { BASELINE_DATA_DATE, type BaselineInfo, baselineLabel, baselineRank, baselineShortLabel, combinedSupport, compareBaseline, type ResolvedFeature, resolveBaseline, resolveFeature, TRACKED_BROWSERS, type TrackedBrowser, WEB_FEATURES_VERSION, } from "./baseline.ts";
7
+ export { BASELINE_DATA_DATE, type BaselineInfo, baselineLabel, baselineRank, baselineShortLabel, combinedSupport, compareBaseline, hasNoVersions, type ResolvedFeature, resolveBaseline, resolveFeature, TRACKED_BROWSERS, type TrackedBrowser, unpublishedSupport, WEB_FEATURES_VERSION, } from "./baseline.ts";
8
+ export { CATEGORIES, CATEGORIES_BY_ID, type CategoryId, categorySchema, } from "./categories.ts";
8
9
  export { analyze, DEPENDENCY_FIELDS, type DependencyField, type DetectOptions, detect, type Finding, type MatchedPackage, type PackageJsonLike, type Report, type Summary, sortFindings, summarize, } from "./detect.ts";
9
10
  export { formatBytes, formatConditional, formatHeadline, formatList, } from "./format.ts";
11
+ export { type BaselineHistory, type BaselineHistoryEntry, baselineHistory, } from "./generated/baseline-history.ts";
10
12
  export { packageSizes, type SizeSnapshot } from "./generated/sizes.ts";
13
+ export { GUIDE_SOURCE, type GuideSnapshot, guideCommand, guideSnapshot, isKnownGuide, type ResolvedGuide, resolveGuide, resolveGuides, } from "./guides.ts";
14
+ export { type TierShare, tierShareOf } from "./history.ts";
15
+ export { renderRuleMarkdown, renderUseCaseTable, ruleMarkdownUrl, } from "./markdown.ts";
11
16
  export { rules, rulesById, rulesByPackage } from "./rules/index.ts";
12
17
  export { type BaselineStatus, baselineStatusSchema, type ManualBaseline, manualBaselineSchema, parseCatalog, type Rule, ruleSchema, SCHEMA_VERSION, } from "./schema.ts";
18
+ export { MIN_QUERY_LENGTH, type SearchOptions, type SearchResult, searchRules, } from "./search.ts";
13
19
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,kBAAkB,EAClB,KAAK,YAAY,EACjB,aAAa,EACb,YAAY,EACZ,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,KAAK,eAAe,EACpB,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,KAAK,cAAc,EACnB,oBAAoB,GACrB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,OAAO,EACP,iBAAiB,EACjB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,MAAM,EACN,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,MAAM,EACX,KAAK,OAAO,EACZ,YAAY,EACZ,SAAS,GACV,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,cAAc,EACd,UAAU,GACX,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,YAAY,EAAE,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EACL,KAAK,cAAc,EACnB,oBAAoB,EACpB,KAAK,cAAc,EACnB,oBAAoB,EACpB,YAAY,EACZ,KAAK,IAAI,EACT,UAAU,EACV,cAAc,GACf,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,kBAAkB,EAClB,KAAK,YAAY,EACjB,aAAa,EACb,YAAY,EACZ,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,aAAa,EACb,KAAK,eAAe,EACpB,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,KAAK,cAAc,EACnB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,KAAK,UAAU,EACf,cAAc,GACf,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,OAAO,EACP,iBAAiB,EACjB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,MAAM,EACN,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,MAAM,EACX,KAAK,OAAO,EACZ,YAAY,EACZ,SAAS,GACV,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,cAAc,EACd,UAAU,GACX,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,eAAe,GAChB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EACL,YAAY,EACZ,KAAK,aAAa,EAClB,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,KAAK,aAAa,EAClB,YAAY,EACZ,aAAa,GACd,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,KAAK,SAAS,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,GAChB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EACL,KAAK,cAAc,EACnB,oBAAoB,EACpB,KAAK,cAAc,EACnB,oBAAoB,EACpB,YAAY,EACZ,KAAK,IAAI,EACT,UAAU,EACV,cAAc,GACf,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,gBAAgB,EAChB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,WAAW,GACZ,MAAM,aAAa,CAAC"}
package/dist/index.js CHANGED
@@ -4,10 +4,16 @@
4
4
  * The rule catalog, the pure detection function, and the Baseline resolution
5
5
  * that sits between them. Every surface is a thin adapter over this package.
6
6
  */
7
- export { BASELINE_DATA_DATE, baselineLabel, baselineRank, baselineShortLabel, combinedSupport, compareBaseline, resolveBaseline, resolveFeature, TRACKED_BROWSERS, WEB_FEATURES_VERSION, } from "./baseline.js";
7
+ export { BASELINE_DATA_DATE, baselineLabel, baselineRank, baselineShortLabel, combinedSupport, compareBaseline, hasNoVersions, resolveBaseline, resolveFeature, TRACKED_BROWSERS, unpublishedSupport, WEB_FEATURES_VERSION, } from "./baseline.js";
8
+ export { CATEGORIES, CATEGORIES_BY_ID, categorySchema, } from "./categories.js";
8
9
  export { analyze, DEPENDENCY_FIELDS, detect, sortFindings, summarize, } from "./detect.js";
9
10
  export { formatBytes, formatConditional, formatHeadline, formatList, } from "./format.js";
11
+ export { baselineHistory, } from "./generated/baseline-history.js";
10
12
  export { packageSizes } from "./generated/sizes.js";
13
+ export { GUIDE_SOURCE, guideCommand, guideSnapshot, isKnownGuide, resolveGuide, resolveGuides, } from "./guides.js";
14
+ export { tierShareOf } from "./history.js";
15
+ export { renderRuleMarkdown, renderUseCaseTable, ruleMarkdownUrl, } from "./markdown.js";
11
16
  export { rules, rulesById, rulesByPackage } from "./rules/index.js";
12
17
  export { baselineStatusSchema, manualBaselineSchema, parseCatalog, ruleSchema, SCHEMA_VERSION, } from "./schema.js";
18
+ export { MIN_QUERY_LENGTH, searchRules, } from "./search.js";
13
19
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,kBAAkB,EAElB,aAAa,EACb,YAAY,EACZ,kBAAkB,EAClB,eAAe,EACf,eAAe,EAEf,eAAe,EACf,cAAc,EACd,gBAAgB,EAEhB,oBAAoB,GACrB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,OAAO,EACP,iBAAiB,EAGjB,MAAM,EAMN,YAAY,EACZ,SAAS,GACV,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,cAAc,EACd,UAAU,GACX,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,YAAY,EAAqB,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAEL,oBAAoB,EAEpB,oBAAoB,EACpB,YAAY,EAEZ,UAAU,EACV,cAAc,GACf,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,kBAAkB,EAElB,aAAa,EACb,YAAY,EACZ,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,aAAa,EAEb,eAAe,EACf,cAAc,EACd,gBAAgB,EAEhB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,UAAU,EACV,gBAAgB,EAEhB,cAAc,GACf,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,OAAO,EACP,iBAAiB,EAGjB,MAAM,EAMN,YAAY,EACZ,SAAS,GACV,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,cAAc,EACd,UAAU,GACX,MAAM,aAAa,CAAC;AACrB,OAAO,EAGL,eAAe,GAChB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,YAAY,EAAqB,MAAM,sBAAsB,CAAC;AACvE,OAAO,EACL,YAAY,EAEZ,YAAY,EACZ,aAAa,EACb,YAAY,EAEZ,YAAY,EACZ,aAAa,GACd,MAAM,aAAa,CAAC;AACrB,OAAO,EAAkB,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,GAChB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAEL,oBAAoB,EAEpB,oBAAoB,EACpB,YAAY,EAEZ,UAAU,EACV,cAAc,GACf,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,gBAAgB,EAGhB,WAAW,GACZ,MAAM,aAAa,CAAC"}
@@ -0,0 +1,24 @@
1
+ import type { Rule } from "./schema.ts";
2
+ /** The markdown URL for one rule. */
3
+ export declare function ruleMarkdownUrl(id: string): string;
4
+ /**
5
+ * The index that makes the catalog useful before a dependency exists. Keyed by
6
+ * `agent.when`, which is the use case rather than the package name, so an
7
+ * agent about to build a carousel can find the rule without knowing that
8
+ * swiper is the package it was reaching for.
9
+ */
10
+ export declare function renderUseCaseTable(): string;
11
+ /**
12
+ * One rule, in full. The `unless` conditions are the point of this: they are
13
+ * what stops a finding from overstating itself, and until this existed they
14
+ * were reachable only through the CLI's --verbose or the MCP server.
15
+ */
16
+ export declare function renderRuleMarkdown(rule: Rule): string;
17
+ /**
18
+ * The reference the agent skill loads on demand. Hybrid by design: the table
19
+ * works offline and with no network, and the per-rule detail is fetched, so
20
+ * the skill stops shipping a snapshot of prose that goes stale between
21
+ * releases.
22
+ */
23
+ export declare function renderCatalogReference(): string;
24
+ //# sourceMappingURL=markdown.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../src/markdown.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAWxC,qCAAqC;AACrC,wBAAgB,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAElD;AAcD;;;;;GAKG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAa3C;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAmCrD;AAgDD;;;;;GAKG;AACH,wBAAgB,sBAAsB,IAAI,MAAM,CAgD/C"}
@@ -0,0 +1,194 @@
1
+ /**
2
+ * The catalog rendered as markdown.
3
+ *
4
+ * Two consumers, one module. `scripts/build-skill.ts` writes the reference the
5
+ * agent skill ships, and `apps/web` serves a rule over HTTP so an agent that
6
+ * can only fetch a URL gets the same answer the CLI gives. Neither could
7
+ * import the other, and a second renderer would drift the first time a rule
8
+ * changed shape.
9
+ *
10
+ * Pure, and held to it: catalog.test.ts walks this module's imports the same
11
+ * way it walks detect()'s. No filesystem, no clock, so the file writing stays
12
+ * in the script.
13
+ */
14
+ import { baselineShortLabel, resolveBaseline } from "./baseline.js";
15
+ import { GUIDE_SOURCE, guideCommand, resolveGuides } from "./guides.js";
16
+ import { rules } from "./rules/index.js";
17
+ /**
18
+ * Where a rule is served as markdown.
19
+ *
20
+ * The second place the domain is written down, after apps/web/lib/site.ts.
21
+ * The catalog ships to npm and cannot import the website, so the two are tied
22
+ * together by a test in apps/web instead of by a shared constant.
23
+ */
24
+ const RULE_MARKDOWN_BASE = "https://youmightnotneed.dev/rules";
25
+ /** The markdown URL for one rule. */
26
+ export function ruleMarkdownUrl(id) {
27
+ return `${RULE_MARKDOWN_BASE}/${id}.md`;
28
+ }
29
+ /**
30
+ * Codepoint order, not localeCompare: check-freshness byte-compares the
31
+ * generated reference, and collation differs by locale and by ICU build. A
32
+ * maintainer on lt_LT would otherwise regenerate a file that fails CI with no
33
+ * data change.
34
+ */
35
+ function byText(a, b) {
36
+ if (a < b)
37
+ return -1;
38
+ if (a > b)
39
+ return 1;
40
+ return 0;
41
+ }
42
+ /**
43
+ * The index that makes the catalog useful before a dependency exists. Keyed by
44
+ * `agent.when`, which is the use case rather than the package name, so an
45
+ * agent about to build a carousel can find the rule without knowing that
46
+ * swiper is the package it was reaching for.
47
+ */
48
+ export function renderUseCaseTable() {
49
+ const rows = [...rules]
50
+ .sort((a, b) => byText(a.agent.when, b.agent.when))
51
+ .map((rule) => {
52
+ const status = baselineShortLabel(resolveBaseline(rule).status);
53
+ return `| ${rule.agent.when} | ${rule.native} | ${status} | \`${rule.id}\` |`;
54
+ });
55
+ return [
56
+ "| Building | The platform does | Support | Rule |",
57
+ "| --- | --- | --- | --- |",
58
+ ...rows,
59
+ ].join("\n");
60
+ }
61
+ /**
62
+ * One rule, in full. The `unless` conditions are the point of this: they are
63
+ * what stops a finding from overstating itself, and until this existed they
64
+ * were reachable only through the CLI's --verbose or the MCP server.
65
+ */
66
+ export function renderRuleMarkdown(rule) {
67
+ const baseline = resolveBaseline(rule);
68
+ const support = `${baselineShortLabel(baseline.status)}${baseline.limitedBy ? ` (capped by ${baseline.limitedBy.name})` : ""}`;
69
+ return `# ${rule.title}
70
+
71
+ - **id**: \`${rule.id}\`
72
+ - **native**: ${rule.native}
73
+ - **support**: Baseline ${support}
74
+ - **replaces**: ${rule.replaces.map((pkg) => `\`${pkg}\``).join(", ")}
75
+
76
+ ## When this applies
77
+
78
+ ${rule.agent.when}.
79
+
80
+ A match is a starting point, not a verdict. A package in package.json is not
81
+ evidence of what it is used for, so read the conditions below before changing
82
+ anything.
83
+
84
+ ## Keep the dependency if any of these apply
85
+
86
+ ${rule.agent.unless.map((condition) => `- ${condition}`).join("\n")}
87
+
88
+ ## The swap
89
+
90
+ \`\`\`
91
+ ${rule.agent.snippet}
92
+ \`\`\`
93
+
94
+ ## How to implement it
95
+
96
+ ${renderGuides(rule)}
97
+ `;
98
+ }
99
+ /**
100
+ * The hand-off from "which dependency can go" to "how to build the thing
101
+ * properly". IDs and links only: the catalog is a lookup table, so nothing
102
+ * here copies upstream prose. The attribution is what the licence asks for.
103
+ */
104
+ function renderGuides(rule) {
105
+ const linkable = resolveGuides(rule).filter((guide) => guide.url !== null);
106
+ const source = `Guides come from ${GUIDE_SOURCE.owner}'s ${GUIDE_SOURCE.name} (${GUIDE_SOURCE.licence}), ${GUIDE_SOURCE.repo}.`;
107
+ if (linkable.length === 0) {
108
+ return `No guide covers this rule yet. ${source}`;
109
+ }
110
+ const links = linkable
111
+ .map((guide) => `- [${guide.id}](${guide.url}) (${guide.category})`)
112
+ .join("\n");
113
+ return `This catalog stops at the swap. These go through the implementation,
114
+ the fallbacks and the platform quirks.
115
+
116
+ ${links}
117
+
118
+ Pull them into context with:
119
+
120
+ \`\`\`sh
121
+ ${guideCommand(linkable.map((guide) => guide.id))}
122
+ \`\`\`
123
+
124
+ ${source}`;
125
+ }
126
+ /**
127
+ * Every rule with the packages it claims, one line each.
128
+ *
129
+ * The reference used to carry this inside a much longer per-rule listing.
130
+ * Dropping that listing took the package names with it, which left an agent
131
+ * holding a package.json and no network unable to answer the question the
132
+ * skill exists for. This is the same lookup in 1/8th of the lines.
133
+ */
134
+ function renderPackageIndex() {
135
+ return [...rules]
136
+ .sort((a, b) => byText(a.id, b.id))
137
+ .map((rule) => `- \`${rule.id}\`: ${rule.replaces.join(", ")}`)
138
+ .join("\n");
139
+ }
140
+ /**
141
+ * The reference the agent skill loads on demand. Hybrid by design: the table
142
+ * works offline and with no network, and the per-rule detail is fetched, so
143
+ * the skill stops shipping a snapshot of prose that goes stale between
144
+ * releases.
145
+ */
146
+ export function renderCatalogReference() {
147
+ const packageCount = new Set(rules.flatMap((rule) => rule.replaces)).size;
148
+ return `<!-- Generated by scripts/build-skill.ts. Do not edit by hand. -->
149
+ <!-- Run \`pnpm refresh:skill\` to update. -->
150
+
151
+ # The catalog
152
+
153
+ Every rule, ${rules.length} of them, covering ${packageCount} npm packages.
154
+ Support is the Baseline tier of the least-supported feature the replacement
155
+ needs, so a rule reads as limited if any one part of it is.
156
+
157
+ ## By use case
158
+
159
+ Read this before reaching for a package. The left column is the case the
160
+ native approach covers, so it is searchable without knowing which library you
161
+ were about to install.
162
+
163
+ ${renderUseCaseTable()}
164
+
165
+ ## Reading one rule
166
+
167
+ A row is a starting point, not a verdict. Every rule also carries the
168
+ conditions where the dependency is still right, the swap, and the guides that
169
+ cover the implementation. Those are not in this file. Take the rule id from
170
+ the table and fetch it:
171
+
172
+ \`\`\`sh
173
+ curl --fail-with-body -sS ${ruleMarkdownUrl("<id>")}
174
+ \`\`\`
175
+
176
+ That is always the live catalog, where this table is only as fresh as the
177
+ version of the skill you have. The CLI answers the same question from a
178
+ package name, sends nothing anywhere, and works offline once npx has fetched
179
+ it:
180
+
181
+ \`\`\`sh
182
+ npx -y youmightnotneed@latest --package <name> --verbose
183
+ \`\`\`
184
+
185
+ ## By package
186
+
187
+ Which rule covers a package you already have. This is the only lookup here
188
+ that needs no network. It gives the rule id and stops there: the conditions
189
+ for keeping the dependency come from the URL or the CLI above.
190
+
191
+ ${renderPackageIndex()}
192
+ `;
193
+ }
194
+ //# sourceMappingURL=markdown.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdown.js","sourceRoot":"","sources":["../src/markdown.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAGzC;;;;;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;EAKL,YAAY,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;;;EAG/C,MAAM,EAAE,CAAC;AACX,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,kBAAkB;IACzB,OAAO,CAAC,GAAG,KAAK,CAAC;SACd,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;SAClC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,IAAI,CAAC,EAAE,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;SAC9D,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB;IACpC,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC;IAE1E,OAAO;;;;;cAKK,KAAK,CAAC,MAAM,sBAAsB,YAAY;;;;;;;;;;EAU1D,kBAAkB,EAAE;;;;;;;;;;4BAUM,eAAe,CAAC,MAAM,CAAC;;;;;;;;;;;;;;;;;;EAkBjD,kBAAkB,EAAE;CACrB,CAAC;AACF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"abort-controller.d.ts","sourceRoot":"","sources":["../../src/rules/abort-controller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEzC,eAAO,MAAM,eAAe,EAAE,IAwB7B,CAAC"}
1
+ {"version":3,"file":"abort-controller.d.ts","sourceRoot":"","sources":["../../src/rules/abort-controller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEzC,eAAO,MAAM,eAAe,EAAE,IAyB7B,CAAC"}
@@ -1,7 +1,8 @@
1
1
  export const abortController = {
2
2
  id: "abort-controller",
3
3
  title: "Cancelling async work",
4
- replaces: ["p-cancelable", "cancelable-promise"],
4
+ category: "async-data",
5
+ replaces: ["p-cancelable", "cancelable-promise", "abortcontroller-polyfill"],
5
6
  featureIds: ["aborting"],
6
7
  native: "AbortController and AbortSignal",
7
8
  human: {
@@ -1 +1 @@
1
- {"version":3,"file":"abort-controller.js","sourceRoot":"","sources":["../../src/rules/abort-controller.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,eAAe,GAAS;IACnC,EAAE,EAAE,kBAAkB;IACtB,KAAK,EAAE,uBAAuB;IAC9B,QAAQ,EAAE,CAAC,cAAc,EAAE,oBAAoB,CAAC;IAChD,UAAU,EAAE,CAAC,UAAU,CAAC;IACxB,MAAM,EAAE,iCAAiC;IACzC,KAAK,EAAE;QACL,SAAS,EACP,6TAA6T;QAC/T,OAAO,EAAE;;;oBAGO;QAChB,MAAM,EAAE,kEAAkE;KAC3E;IACD,KAAK,EAAE;QACL,IAAI,EAAE,qEAAqE;QAC3E,MAAM,EAAE;YACN,iNAAiN;YACjN,8IAA8I;SAC/I;QACD,OAAO,EAAE;2CAC8B;KACxC;CACF,CAAC"}
1
+ {"version":3,"file":"abort-controller.js","sourceRoot":"","sources":["../../src/rules/abort-controller.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,eAAe,GAAS;IACnC,EAAE,EAAE,kBAAkB;IACtB,KAAK,EAAE,uBAAuB;IAC9B,QAAQ,EAAE,YAAY;IACtB,QAAQ,EAAE,CAAC,cAAc,EAAE,oBAAoB,EAAE,0BAA0B,CAAC;IAC5E,UAAU,EAAE,CAAC,UAAU,CAAC;IACxB,MAAM,EAAE,iCAAiC;IACzC,KAAK,EAAE;QACL,SAAS,EACP,6TAA6T;QAC/T,OAAO,EAAE;;;oBAGO;QAChB,MAAM,EAAE,kEAAkE;KAC3E;IACD,KAAK,EAAE;QACL,IAAI,EAAE,qEAAqE;QAC3E,MAAM,EAAE;YACN,iNAAiN;YACjN,8IAA8I;SAC/I;QACD,OAAO,EAAE;2CAC8B;KACxC;CACF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"accordion.d.ts","sourceRoot":"","sources":["../../src/rules/accordion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEzC,eAAO,MAAM,SAAS,EAAE,IAmDvB,CAAC"}
1
+ {"version":3,"file":"accordion.d.ts","sourceRoot":"","sources":["../../src/rules/accordion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEzC,eAAO,MAAM,SAAS,EAAE,IAsDvB,CAAC"}
@@ -1,6 +1,7 @@
1
1
  export const accordion = {
2
2
  id: "exclusive-accordion",
3
3
  title: "Accordions",
4
+ category: "forms",
4
5
  replaces: ["react-accessible-accordion", "react-collapsible", "accordion-js"],
5
6
  featureIds: ["details-name"],
6
7
  native: "<details name> for an exclusive accordion",
@@ -33,6 +34,7 @@ export const accordion = {
33
34
  agent: {
34
35
  when: "building an FAQ or accordion where opening one panel should close the others",
35
36
  unless: [
37
+ "Your support target predates the name attribute on <details>. Older browsers ignore it silently rather than failing, so every panel opens independently and the one behaviour this rule promises is the one that quietly does not happen.",
36
38
  "You need to animate the panel height. That needs interpolate-size or calc-size(), which is Chromium-only today.",
37
39
  "You need several panels open at once with a controlled open state driven by application logic. Drop the name attribute for independent panels, but co-ordinated state still needs JavaScript.",
38
40
  "You need the header to be something other than a summary element, for example a heading that also holds a separate action button.",
@@ -47,5 +49,6 @@ export const accordion = {
47
49
  <p>Body</p>
48
50
  </details>`,
49
51
  },
52
+ guides: ["search-hidden-content"],
50
53
  };
51
54
  //# sourceMappingURL=accordion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"accordion.js","sourceRoot":"","sources":["../../src/rules/accordion.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,SAAS,GAAS;IAC7B,EAAE,EAAE,qBAAqB;IACzB,KAAK,EAAE,YAAY;IACnB,QAAQ,EAAE,CAAC,4BAA4B,EAAE,mBAAmB,EAAE,cAAc,CAAC;IAC7E,UAAU,EAAE,CAAC,cAAc,CAAC;IAC5B,MAAM,EAAE,2CAA2C;IACnD,KAAK,EAAE;QACL,SAAS,EACP,2WAA2W;QAC7W,OAAO,EAAE;;;;;;;;;;;;;;;;;;;;;SAqBJ;QACL,MAAM,EACJ,wEAAwE;KAC3E;IACD,KAAK,EAAE;QACL,IAAI,EAAE,8EAA8E;QACpF,MAAM,EAAE;YACN,iHAAiH;YACjH,+LAA+L;YAC/L,mIAAmI;YACnI,kHAAkH;SACnH;QACD,OAAO,EAAE;;;;;;;WAOF;KACR;CACF,CAAC"}
1
+ {"version":3,"file":"accordion.js","sourceRoot":"","sources":["../../src/rules/accordion.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,SAAS,GAAS;IAC7B,EAAE,EAAE,qBAAqB;IACzB,KAAK,EAAE,YAAY;IACnB,QAAQ,EAAE,OAAO;IACjB,QAAQ,EAAE,CAAC,4BAA4B,EAAE,mBAAmB,EAAE,cAAc,CAAC;IAC7E,UAAU,EAAE,CAAC,cAAc,CAAC;IAC5B,MAAM,EAAE,2CAA2C;IACnD,KAAK,EAAE;QACL,SAAS,EACP,2WAA2W;QAC7W,OAAO,EAAE;;;;;;;;;;;;;;;;;;;;;SAqBJ;QACL,MAAM,EACJ,wEAAwE;KAC3E;IACD,KAAK,EAAE;QACL,IAAI,EAAE,8EAA8E;QACpF,MAAM,EAAE;YACN,2OAA2O;YAC3O,iHAAiH;YACjH,+LAA+L;YAC/L,mIAAmI;YACnI,kHAAkH;SACnH;QACD,OAAO,EAAE;;;;;;;WAOF;KACR;IACD,MAAM,EAAE,CAAC,uBAAuB,CAAC;CAClC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Rule } from "../schema.ts";
2
+ export declare const arrayGrouping: Rule;
3
+ //# sourceMappingURL=array-grouping.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"array-grouping.d.ts","sourceRoot":"","sources":["../../src/rules/array-grouping.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEzC,eAAO,MAAM,aAAa,EAAE,IA6B3B,CAAC"}
@@ -0,0 +1,29 @@
1
+ export const arrayGrouping = {
2
+ id: "array-grouping",
3
+ title: "Grouping a list by key",
4
+ category: "async-data",
5
+ replaces: ["lodash.groupby", "just-group-by", "group-array"],
6
+ featureIds: ["array-group"],
7
+ native: "Object.groupBy() and Map.groupBy()",
8
+ human: {
9
+ explainer: 'Grouping a list by some property of each item is one reduce call people would rather not write twice, which is why the single-purpose packages exist. Object.groupBy() does it directly and returns a null-prototype object, so a key like "constructor" cannot collide with anything inherited. Map.groupBy() is the same for keys that are objects or anything else a plain object would stringify.',
10
+ snippet: `const byStatus = Object.groupBy(orders, (order) => order.status);
11
+ // { open: [...], shipped: [...] }
12
+
13
+ // Keys that are not strings keep their identity in a Map.
14
+ const byCustomer = Map.groupBy(orders, (order) => order.customer);`,
15
+ mdnUrl: "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/groupBy",
16
+ },
17
+ agent: {
18
+ when: "bucketing an array into groups keyed by a property of each item",
19
+ unless: [
20
+ "Your support target predates Array grouping becoming Baseline newly available in March 2024, in which case a reduce call or the library is the fallback.",
21
+ "You pass lodash a property name string rather than a function. Object.groupBy always takes a callback, so every call site gains an arrow function.",
22
+ "You depend on the result having Object.prototype. Object.groupBy returns a null-prototype object, so hasOwnProperty, toString and a plain {...spread} into a class all behave differently.",
23
+ "The package is a lodash.* module already shared with other code you are keeping, where removing one of them changes nothing about what ships.",
24
+ "You need the grouping to preserve a specific key order or to sort as it goes, which neither method offers.",
25
+ ],
26
+ snippet: "const byStatus = Object.groupBy(items, (item) => item.status);",
27
+ },
28
+ };
29
+ //# sourceMappingURL=array-grouping.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"array-grouping.js","sourceRoot":"","sources":["../../src/rules/array-grouping.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,aAAa,GAAS;IACjC,EAAE,EAAE,gBAAgB;IACpB,KAAK,EAAE,wBAAwB;IAC/B,QAAQ,EAAE,YAAY;IACtB,QAAQ,EAAE,CAAC,gBAAgB,EAAE,eAAe,EAAE,aAAa,CAAC;IAC5D,UAAU,EAAE,CAAC,aAAa,CAAC;IAC3B,MAAM,EAAE,oCAAoC;IAC5C,KAAK,EAAE;QACL,SAAS,EACP,uYAAuY;QACzY,OAAO,EAAE;;;;mEAIsD;QAC/D,MAAM,EACJ,iGAAiG;KACpG;IACD,KAAK,EAAE;QACL,IAAI,EAAE,iEAAiE;QACvE,MAAM,EAAE;YACN,0JAA0J;YAC1J,oJAAoJ;YACpJ,4LAA4L;YAC5L,+IAA+I;YAC/I,4GAA4G;SAC7G;QACD,OAAO,EAAE,gEAAgE;KAC1E;CACF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"aspect-ratio.d.ts","sourceRoot":"","sources":["../../src/rules/aspect-ratio.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEzC,eAAO,MAAM,WAAW,EAAE,IAiCzB,CAAC"}
1
+ {"version":3,"file":"aspect-ratio.d.ts","sourceRoot":"","sources":["../../src/rules/aspect-ratio.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEzC,eAAO,MAAM,WAAW,EAAE,IAkCzB,CAAC"}
@@ -1,6 +1,7 @@
1
1
  export const aspectRatio = {
2
2
  id: "aspect-ratio",
3
3
  title: "Fixed aspect ratios",
4
+ category: "layout",
4
5
  replaces: ["react-aspect-ratio"],
5
6
  featureIds: ["aspect-ratio"],
6
7
  native: "aspect-ratio",
@@ -1 +1 @@
1
- {"version":3,"file":"aspect-ratio.js","sourceRoot":"","sources":["../../src/rules/aspect-ratio.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,WAAW,GAAS;IAC/B,EAAE,EAAE,cAAc;IAClB,KAAK,EAAE,qBAAqB;IAC5B,QAAQ,EAAE,CAAC,oBAAoB,CAAC;IAChC,UAAU,EAAE,CAAC,cAAc,CAAC;IAC5B,MAAM,EAAE,cAAc;IACtB,KAAK,EAAE;QACL,SAAS,EACP,0SAA0S;QAC5S,OAAO,EAAE;;;;;;;;;;;EAWX;QACE,MAAM,EAAE,+DAA+D;KACxE;IACD,KAAK,EAAE;QACL,IAAI,EAAE,oFAAoF;QAC1F,MAAM,EAAE;YACN,0FAA0F;YAC1F,8JAA8J;YAC9J,mEAAmE;SACpE;QACD,OAAO,EAAE;+CACkC;KAC5C;CACF,CAAC"}
1
+ {"version":3,"file":"aspect-ratio.js","sourceRoot":"","sources":["../../src/rules/aspect-ratio.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,WAAW,GAAS;IAC/B,EAAE,EAAE,cAAc;IAClB,KAAK,EAAE,qBAAqB;IAC5B,QAAQ,EAAE,QAAQ;IAClB,QAAQ,EAAE,CAAC,oBAAoB,CAAC;IAChC,UAAU,EAAE,CAAC,cAAc,CAAC;IAC5B,MAAM,EAAE,cAAc;IACtB,KAAK,EAAE;QACL,SAAS,EACP,0SAA0S;QAC5S,OAAO,EAAE;;;;;;;;;;;EAWX;QACE,MAAM,EAAE,+DAA+D;KACxE;IACD,KAAK,EAAE;QACL,IAAI,EAAE,oFAAoF;QAC1F,MAAM,EAAE;YACN,0FAA0F;YAC1F,8JAA8J;YAC9J,mEAAmE;SACpE;QACD,OAAO,EAAE;+CACkC;KAC5C;CACF,CAAC"}