@astryxdesign/cli 0.7.2-canary.405bb94 → 0.7.2-canary.40b21e5

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 (262) hide show
  1. package/README.md +21 -20
  2. package/api/build/help/help.mjs +1 -1
  3. package/api/component/_adapter.d.mts +41 -1
  4. package/api/component/_adapter.mjs +93 -7
  5. package/api/component/component.mjs +22 -5
  6. package/api/component/integration-export-name.test.mjs +644 -0
  7. package/api/discover/_adapter.d.mts +119 -12
  8. package/api/discover/_adapter.mjs +449 -10
  9. package/api/discover/_adapter.test.mjs +599 -17
  10. package/api/discover/_catalog-view.d.mts +16 -5
  11. package/api/discover/_catalog-view.mjs +32 -8
  12. package/api/discover/discover.d.mts +11 -0
  13. package/api/discover/discover.doc.mjs +7 -6
  14. package/api/discover/discover.mjs +107 -19
  15. package/api/discover/discover.type.d.mts +18 -7
  16. package/api/discover/discover.type.mjs +15 -7
  17. package/api/discover/list/list.d.mts +4 -3
  18. package/api/discover/list/list.mjs +17 -10
  19. package/api/docs/_adapter.d.mts +11 -0
  20. package/api/docs/_adapter.mjs +244 -1
  21. package/api/docs/integrationDocs.test.mjs +124 -0
  22. package/api/doctor/doctor.mjs +27 -3
  23. package/api/doctor/doctor.test.mjs +43 -0
  24. package/api/doctor/theme-checks.mjs +1 -1
  25. package/api/doctor/theme-checks.test.mjs +136 -0
  26. package/api/gap-report/gap-report.d.mts +3 -0
  27. package/api/gap-report/gap-report.doc.mjs +11 -3
  28. package/api/gap-report/gap-report.mjs +219 -52
  29. package/api/gap-report/gap-report.test.mjs +233 -0
  30. package/api/gap-report/gap-report.type.d.mts +41 -0
  31. package/api/gap-report/gap-report.type.mjs +18 -0
  32. package/api/index.d.mts +2 -0
  33. package/api/index.mjs +2 -0
  34. package/api/init/run/run.mjs +2 -2
  35. package/api/integration/_adapter.d.mts +22 -0
  36. package/api/integration/_adapter.mjs +67 -0
  37. package/api/integration/add-contribution.component-names.test.mjs +66 -0
  38. package/api/integration/add-contribution.mjs +8 -4
  39. package/api/integration/add-contribution.test.mjs +4 -2
  40. package/api/integration/authoring-checks.mjs +24 -4
  41. package/api/integration/authoring-checks.test.mjs +365 -0
  42. package/api/integration/authoring-checks.type.d.mts +59 -0
  43. package/api/integration/authoring-checks.type.mjs +35 -2
  44. package/api/integration/check/check.d.mts +96 -0
  45. package/api/integration/check/check.mjs +357 -0
  46. package/api/integration/check/check.test.mjs +489 -0
  47. package/api/integration/integration-check.type.d.mts +118 -0
  48. package/api/integration/integration-check.type.mjs +84 -0
  49. package/api/integration/integrationCheck.doc.d.mts +10 -0
  50. package/api/integration/integrationCheck.doc.mjs +73 -0
  51. package/api/integration/integrationComponentConflicts.doc.mjs +43 -6
  52. package/api/integration/integrationDocConflicts.doc.mjs +17 -5
  53. package/api/integration/pack-check.mjs +343 -104
  54. package/api/integration/pack-check.test.mjs +700 -0
  55. package/api/integration/validate-integration.mjs +8 -0
  56. package/api/integration/validate-integration.test.mjs +11 -0
  57. package/api/integration/validate-integration.type.d.mts +8 -0
  58. package/api/integration/validate-integration.type.mjs +12 -1
  59. package/api/integration/validateIntegration.doc.mjs +19 -3
  60. package/api/search/search.d.mts +81 -12
  61. package/api/search/search.domain-priority.test.mjs +108 -18
  62. package/api/search/search.integration-check.test.mjs +24 -0
  63. package/api/search/search.mjs +601 -50
  64. package/api/search/search.test.mjs +139 -0
  65. package/api/swizzle/copy/copy.mjs +28 -14
  66. package/api/theme/build/build.family.test.mjs +54 -6
  67. package/api/theme/build/build.mjs +114 -17
  68. package/api/theme/themeBuild.doc.mjs +4 -4
  69. package/api/upgrade/_adapter.d.mts +40 -2
  70. package/api/upgrade/_adapter.mjs +117 -4
  71. package/api/upgrade/run/cli-behind-core.test.mjs +438 -0
  72. package/api/upgrade/run/run.mjs +30 -1
  73. package/api/upgrade/status/status.d.mts +21 -5
  74. package/api/upgrade/status/status.mjs +45 -8
  75. package/api/upgrade/upgrade.doc.mjs +5 -3
  76. package/api/upgrade/upgrade.type.d.mts +23 -0
  77. package/api/upgrade/upgrade.type.mjs +16 -1
  78. package/assets/codemods/runner.mjs +7 -1
  79. package/assets/discover/official-packages.json +367 -0
  80. package/assets/docs/README.md +10 -0
  81. package/assets/docs/author-a-theme.doc.mjs +3 -3
  82. package/assets/docs/getting-started.doc.mjs +3 -3
  83. package/assets/docs/styling-overview.doc.mjs +1 -1
  84. package/assets/docs/theme.doc.dense.mjs +1 -1
  85. package/assets/docs/theme.doc.mjs +2 -2
  86. package/assets/docs/theme.doc.zh.mjs +1 -1
  87. package/assets/docs/tree/add-a-component.doc.mjs +11 -1
  88. package/assets/docs/tree/add-a-theme.doc.mjs +1 -1
  89. package/assets/docs/tree/add-a-topic.doc.mjs +11 -8
  90. package/assets/docs/tree/agent-guidance.doc.mjs +2 -2
  91. package/assets/docs/tree/block-template.doc.mjs +8 -20
  92. package/assets/docs/tree/build-the-template.doc.mjs +1 -1
  93. package/assets/docs/tree/check-the-props.doc.mjs +196 -0
  94. package/assets/docs/tree/check-your-docs.doc.mjs +57 -7
  95. package/assets/docs/tree/checks.doc.mjs +26 -18
  96. package/assets/docs/tree/codemods.doc.mjs +4 -4
  97. package/assets/docs/tree/component-family.doc.mjs +8 -6
  98. package/assets/docs/tree/component-imports.doc.mjs +10 -2
  99. package/assets/docs/tree/components.doc.mjs +1 -1
  100. package/assets/docs/tree/debug-and-gap-reports.doc.mjs +25 -16
  101. package/assets/docs/tree/define-the-theme.doc.mjs +6 -5
  102. package/assets/docs/tree/describe-the-component.doc.mjs +2 -2
  103. package/assets/docs/tree/docs.doc.mjs +3 -3
  104. package/assets/docs/tree/document-the-template.doc.mjs +1 -1
  105. package/assets/docs/tree/document-the-theme.doc.mjs +1 -1
  106. package/assets/docs/tree/export-template-assets.doc.mjs +1 -1
  107. package/assets/docs/tree/extend-or-replace.doc.mjs +6 -6
  108. package/assets/docs/tree/fonts-and-assets.doc.mjs +2 -2
  109. package/assets/docs/tree/generate-a-palette.doc.mjs +5 -3
  110. package/assets/docs/tree/grade-template-with-agent.doc.mjs +1 -1
  111. package/assets/docs/tree/integrations.doc.mjs +8 -0
  112. package/assets/docs/tree/layout-spacing.doc.mjs +2 -3
  113. package/assets/docs/tree/layout.doc.mjs +6 -6
  114. package/assets/docs/tree/links.doc.mjs +6 -5
  115. package/assets/docs/tree/migration-setup.doc.mjs +3 -2
  116. package/assets/docs/tree/migration-verification.doc.mjs +0 -1
  117. package/assets/docs/tree/migration.doc.mjs +0 -1
  118. package/assets/docs/tree/package-and-test.doc.mjs +1 -1
  119. package/assets/docs/tree/page-template.doc.mjs +4 -8
  120. package/assets/docs/tree/publishing.doc.mjs +2 -2
  121. package/assets/docs/tree/quick-start.doc.mjs +38 -22
  122. package/assets/docs/tree/replace-a-core-component.doc.mjs +4 -6
  123. package/assets/docs/tree/replace-a-core-template.doc.mjs +6 -8
  124. package/assets/docs/tree/sections-and-placement.doc.mjs +4 -6
  125. package/assets/docs/tree/see-it-in-an-app.doc.mjs +4 -2
  126. package/assets/docs/tree/short-and-findable.doc.mjs +6 -5
  127. package/assets/docs/tree/single-component.doc.mjs +15 -6
  128. package/assets/docs/tree/start-a-template.doc.mjs +3 -3
  129. package/assets/docs/tree/subcomponent.doc.mjs +6 -6
  130. package/assets/docs/tree/template-assets.doc.mjs +2 -2
  131. package/assets/docs/tree/template-doc-overview.doc.mjs +5 -16
  132. package/assets/docs/tree/template-fonts.doc.mjs +1 -1
  133. package/assets/docs/tree/template-icons.doc.mjs +1 -1
  134. package/assets/docs/tree/template-images-media.doc.mjs +1 -1
  135. package/assets/docs/tree/template-styles.doc.mjs +2 -2
  136. package/assets/docs/tree/templates.doc.mjs +1 -1
  137. package/assets/docs/tree/test-in-an-app.doc.mjs +3 -3
  138. package/assets/docs/tree/test-template-in-app.doc.mjs +1 -1
  139. package/assets/docs/tree/tokens-and-setup.doc.mjs +19 -15
  140. package/assets/docs/tree/troubleshooting.doc.mjs +16 -8
  141. package/assets/docs/tree/type-scale.doc.mjs +3 -3
  142. package/assets/docs/tree/upgrading.doc.mjs +4 -4
  143. package/assets/docs/tree/use-a-theme-in-an-app.doc.mjs +3 -1
  144. package/assets/docs/tree/verify-packed-template.doc.mjs +1 -1
  145. package/assets/docs/tree/versioning.doc.mjs +7 -6
  146. package/assets/docs/tree/write-the-template-file.doc.mjs +4 -3
  147. package/assets/docs/use-a-theme.doc.mjs +2 -2
  148. package/assets/theme.template.ts +1 -1
  149. package/authoring/codemod/codemod.doc.mjs +7 -3
  150. package/authoring/config/config.doc.mjs +9 -6
  151. package/authoring/config/type.ts +4 -2
  152. package/authoring/discover/discover.doc.mjs +1 -1
  153. package/authoring/doctypes/base/graph-fields.doc.mjs +6 -4
  154. package/authoring/doctypes/command/command.doc.mjs +14 -12
  155. package/authoring/doctypes/component/component.doc.mjs +30 -27
  156. package/authoring/doctypes/component/type.ts +13 -8
  157. package/authoring/doctypes/enum/enum.doc.mjs +7 -4
  158. package/authoring/doctypes/function/function.doc.mjs +9 -8
  159. package/authoring/doctypes/hook/hook.doc.mjs +5 -4
  160. package/authoring/doctypes/namespace/namespace.doc.mjs +7 -6
  161. package/authoring/doctypes/reference/reference.doc.mjs +11 -10
  162. package/authoring/doctypes/schema/schema.doc.mjs +9 -9
  163. package/authoring/doctypes/template/integration-template.doc.d.mts +11 -0
  164. package/authoring/doctypes/template/integration-template.doc.mjs +49 -0
  165. package/authoring/doctypes/template/parse.d.mts +6 -2
  166. package/authoring/doctypes/template/parse.mjs +3 -1
  167. package/authoring/doctypes/template/template.doc.mjs +3 -3
  168. package/authoring/doctypes/template/type.ts +22 -0
  169. package/authoring/doctypes/theme/theme.doc.mjs +2 -2
  170. package/authoring/gap-report/gap-report.doc.mjs +2 -2
  171. package/authoring/identity/identity.doc.mjs +3 -3
  172. package/authoring/index.d.ts +1 -0
  173. package/authoring/integration/integration.doc.mjs +12 -4
  174. package/authoring/integration/parse.test.mjs +10 -0
  175. package/authoring/integration/schema.d.mts +2 -0
  176. package/authoring/integration/schema.mjs +1 -0
  177. package/authoring/integration/type.ts +4 -0
  178. package/clients/cli/commands/build-theme.batch-report.test.mjs +3 -1
  179. package/clients/cli/commands/build-theme.mjs +1 -1
  180. package/clients/cli/commands/build-theme.path-safety.test.mjs +155 -21
  181. package/clients/cli/commands/cli-postinstall.test.mjs +49 -1
  182. package/clients/cli/commands/discover.broken-integration.test.mjs +4 -1
  183. package/clients/cli/commands/discover.doc.mjs +1 -1
  184. package/clients/cli/commands/discover.mjs +144 -93
  185. package/clients/cli/commands/discover.no-source.test.mjs +447 -33
  186. package/clients/cli/commands/discover.sources.test.mjs +20 -1
  187. package/clients/cli/commands/doctor-integration-components.doc.mjs +17 -4
  188. package/clients/cli/commands/doctor-integration-docs.doc.mjs +17 -5
  189. package/clients/cli/commands/doctor-integration-validate.doc.mjs +13 -2
  190. package/clients/cli/commands/doctor-integration.test.mjs +837 -0
  191. package/clients/cli/commands/doctor.mjs +224 -3
  192. package/clients/cli/commands/gap-report.doc.mjs +14 -2
  193. package/clients/cli/commands/gap-report.mjs +24 -2
  194. package/clients/cli/commands/gap-report.test.mjs +79 -0
  195. package/clients/cli/commands/integration-check.doc.mjs +85 -0
  196. package/clients/cli/commands/integration-check.test.mjs +332 -0
  197. package/clients/cli/commands/integration.doc.mjs +6 -2
  198. package/clients/cli/commands/integration.mjs +106 -1
  199. package/clients/cli/commands/json-contract.test.mjs +5 -1
  200. package/clients/cli/commands/setup-nudge.test.mjs +79 -1
  201. package/clients/cli/commands/swizzle.mjs +5 -3
  202. package/clients/cli/commands/swizzle.routing.test.mjs +18 -1
  203. package/clients/cli/commands/text-json-parity.test.mjs +5 -0
  204. package/clients/cli/commands/theme-build.doc.mjs +2 -2
  205. package/clients/cli/commands/upgrade.doc.mjs +14 -0
  206. package/clients/cli/commands/upgrade.older-cli.test.mjs +160 -0
  207. package/clients/cli/index.mjs +30 -5
  208. package/foundation/agent-docs/agent-doc-state.d.mts +14 -0
  209. package/foundation/agent-docs/agent-doc-state.mjs +38 -0
  210. package/foundation/agent-docs/agent-docs.d.mts +2 -1
  211. package/foundation/agent-docs/agent-docs.mjs +8 -6
  212. package/foundation/config/project.mjs +82 -0
  213. package/foundation/discovery/authoring-self-docs.mjs +2 -1
  214. package/foundation/discovery/component-discovery.d.mts +178 -10
  215. package/foundation/discovery/component-discovery.export-names.test.mjs +760 -0
  216. package/foundation/discovery/component-discovery.mjs +659 -62
  217. package/foundation/discovery/component-replacement.mjs +18 -0
  218. package/foundation/discovery/component-replacement.test.mjs +40 -0
  219. package/foundation/discovery/copied-passages.d.mts +208 -0
  220. package/foundation/discovery/copied-passages.mjs +720 -0
  221. package/foundation/discovery/copied-passages.test.mjs +124 -0
  222. package/foundation/discovery/doc-types.d.mts +157 -0
  223. package/foundation/discovery/doc-types.mjs +1224 -0
  224. package/foundation/discovery/doc-types.test.mjs +700 -0
  225. package/foundation/discovery/docs-discovery.d.mts +88 -0
  226. package/foundation/discovery/docs-discovery.mjs +83 -2
  227. package/foundation/discovery/integration-doc-files.d.mts +22 -0
  228. package/foundation/discovery/integration-doc-files.mjs +231 -0
  229. package/foundation/discovery/integration-doc-files.test.mjs +246 -0
  230. package/foundation/discovery/module-exports.d.mts +27 -0
  231. package/foundation/discovery/module-exports.mjs +356 -31
  232. package/foundation/discovery/module-exports.test.mjs +172 -0
  233. package/foundation/discovery/package-tsconfig.d.mts +14 -0
  234. package/foundation/discovery/package-tsconfig.mjs +228 -0
  235. package/foundation/discovery/package-tsconfig.test.mjs +210 -0
  236. package/foundation/discovery/project-typescript.d.mts +32 -0
  237. package/foundation/discovery/project-typescript.mjs +89 -0
  238. package/foundation/discovery/prop-drift.d.mts +278 -0
  239. package/foundation/discovery/prop-drift.mjs +2263 -0
  240. package/foundation/discovery/prop-drift.test.mjs +2272 -0
  241. package/foundation/discovery/type-match.d.mts +53 -0
  242. package/foundation/discovery/type-match.mjs +660 -0
  243. package/foundation/discovery/type-match.test.mjs +169 -0
  244. package/foundation/discovery/type-text.d.mts +68 -0
  245. package/foundation/discovery/type-text.mjs +658 -0
  246. package/foundation/discovery/type-text.test.mjs +196 -0
  247. package/foundation/discovery/unresolved-references.d.mts +62 -0
  248. package/foundation/discovery/unresolved-references.mjs +790 -0
  249. package/foundation/discovery/unresolved-references.test.mjs +567 -0
  250. package/foundation/doc-compiler/doc-loads.test.mjs +14 -0
  251. package/foundation/doc-compiler/links.d.mts +9 -5
  252. package/foundation/doc-compiler/links.mjs +4 -2
  253. package/foundation/env/package-manager.d.mts +32 -0
  254. package/foundation/env/package-manager.mjs +47 -0
  255. package/foundation/env/package-manager.test.mjs +194 -7
  256. package/foundation/fs/module-loader.d.mts +2 -1
  257. package/foundation/fs/module-loader.mjs +60 -4
  258. package/foundation/fs/module-loader.test.mjs +194 -0
  259. package/foundation/integrations/contribution-inventory.mjs +6 -1
  260. package/foundation/response/response-types.doc.mjs +14 -8
  261. package/package.json +9 -9
  262. package/scripts/postinstall.mjs +3 -3
@@ -0,0 +1,124 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ import {describe, expect, it} from 'vitest';
4
+
5
+ import {
6
+ PASSAGE_WORDS,
7
+ contentWords,
8
+ passageWords,
9
+ wordSpans,
10
+ proseWords,
11
+ sharedPassages,
12
+ } from './copied-passages.mjs';
13
+
14
+ const words = (/** @type {string} */ text) =>
15
+ passageWords(text).map(word => ({word, section: null, block: 1}));
16
+
17
+ describe('passageWords', () => {
18
+ it('sets aside case, links, and Markdown emphasis', () => {
19
+ expect(
20
+ passageWords('Use **`Button`** for {@link component:Button} actions.'),
21
+ ).toEqual(['use', 'button', 'for', 'actions.']);
22
+ });
23
+ });
24
+
25
+ describe('proseWords', () => {
26
+ it('reads prose with its section, and skips code, references, and names', () => {
27
+ const doc = {
28
+ type: 'generic',
29
+ name: 'acme-guide',
30
+ title: 'Acme guide',
31
+ description: 'Intro words.',
32
+ sections: [
33
+ {
34
+ title: 'Setup',
35
+ content: [
36
+ {type: 'prose', text: 'Install it.'},
37
+ {type: 'code', lang: 'sh', code: 'npm install acme'},
38
+ {type: 'reference', ref: 'generic:other'},
39
+ {type: 'list', items: ['First step.']},
40
+ ],
41
+ },
42
+ ],
43
+ };
44
+ expect(proseWords(doc)).toEqual([
45
+ {word: 'intro', section: null, block: 1},
46
+ {word: 'words.', section: null, block: 1},
47
+ {word: 'install', section: 'Setup', block: 2},
48
+ {word: 'it.', section: 'Setup', block: 2},
49
+ {word: 'first', section: 'Setup', block: 3},
50
+ {word: 'step.', section: 'Setup', block: 3},
51
+ ]);
52
+ });
53
+ });
54
+
55
+ describe('sharedPassages', () => {
56
+ const passage = Array.from(
57
+ {length: PASSAGE_WORDS + 5},
58
+ (_, i) => `w${i}`,
59
+ ).join(' ');
60
+
61
+ it('finds the longest shared run', () => {
62
+ expect(
63
+ sharedPassages(words(`a b ${passage} c`), words(`x ${passage} y`)),
64
+ ).toEqual([{start: 2, length: PASSAGE_WORDS + 5}]);
65
+ });
66
+
67
+ it('never runs a passage from one string into the next', () => {
68
+ const half = Math.ceil(PASSAGE_WORDS / 2);
69
+ const first = passage.split(' ').slice(0, half).join(' ');
70
+ const second = passage.split(' ').slice(half, PASSAGE_WORDS).join(' ');
71
+ const split = [
72
+ ...passageWords(first).map(word => ({word, section: null, block: 1})),
73
+ ...passageWords(second).map(word => ({word, section: null, block: 2})),
74
+ ];
75
+ expect(sharedPassages(split, words(`${first} ${second}`))).toEqual([]);
76
+ });
77
+
78
+ it('ignores a run shorter than the passage size', () => {
79
+ const short = passage
80
+ .split(' ')
81
+ .slice(0, PASSAGE_WORDS - 1)
82
+ .join(' ');
83
+ expect(
84
+ sharedPassages(words(`a ${short} b`), words(`c ${short} d`)),
85
+ ).toEqual([]);
86
+ });
87
+ });
88
+
89
+ describe('contentWords', () => {
90
+ it('counts distinct words that are not function words', () => {
91
+ const run = words('and it is in the way that you can do it for them');
92
+ expect(contentWords(run, 0, run.length)).toBe(1);
93
+ const fact = words('Name each codemod folder after the Core version.');
94
+ expect(contentWords(fact, 0, fact.length)).toBe(5);
95
+ });
96
+ });
97
+
98
+ describe('wordSpans', () => {
99
+ it('reads the words passageWords reads, with where each sits as written', () => {
100
+ const text = 'Run `astryx docs`, then {@link generic:theme} *now*.';
101
+ const spans = wordSpans(text);
102
+ expect(spans.map(span => span.word)).toEqual(passageWords(text));
103
+ expect(text.slice(spans[1].start, spans[2].end)).toBe('`astryx docs`');
104
+ });
105
+ });
106
+
107
+ describe('passageWords and pointers', () => {
108
+ it('reads a link and a written docs command as no words', () => {
109
+ expect(
110
+ passageWords(
111
+ 'See {@link generic:theme} or `astryx docs theme` (Share it).',
112
+ ),
113
+ ).toEqual(['see', 'or', 'share', 'it']);
114
+ });
115
+
116
+ it('counts no punctuation-only token as a word', () => {
117
+ expect(
118
+ passageWords('Set the theme first, see {@link generic:theme}.'),
119
+ ).toEqual(['set', 'the', 'theme', 'first', 'see']);
120
+ expect(
121
+ wordSpans('Read it - then {@link generic:theme}.').map(s => s.word),
122
+ ).toEqual(['read', 'it', 'then']);
123
+ });
124
+ });
@@ -0,0 +1,157 @@
1
+ // @generated by scripts/sync-api-types.mjs from the JSDoc in foundation/**/*.mjs.
2
+ // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
+
4
+ /**
5
+ * Check each doc file's values against the published authoring types.
6
+ * @param {DocFile[]} files
7
+ * @param {{packageDir: string, resolveFrom: Array<string | null | undefined>, core?: boolean}} options
8
+ * `core`: the docs are Core's own, so templates are held to TemplateDoc
9
+ * @returns {Promise<DocTypesReport>}
10
+ */
11
+ export function checkDocTypes(files: DocFile[], options: {
12
+ packageDir: string;
13
+ resolveFrom: Array<string | null | undefined>;
14
+ core?: boolean;
15
+ }): Promise<DocTypesReport>;
16
+ /**
17
+ * @typedef {'components' | 'hooks' | 'templates' | 'docs' | 'docs-overlay' | 'themes'} DocRoot
18
+ */
19
+ /**
20
+ * @typedef {object} DocFile
21
+ * @property {string} path absolute path to the doc file
22
+ * @property {DocRoot} root the contribution root it was found in
23
+ */
24
+ /**
25
+ * @typedef {'unknown_field' | 'missing_field' | 'wrong_type'} DocTypeProblem
26
+ */
27
+ /**
28
+ * @typedef {object} DocTypeFinding
29
+ * @property {string} doc the doc file, relative to the package root
30
+ * @property {number} line 1-based line of the field (or of the doc value)
31
+ * @property {string} export the export checked (`default`, `docs`, `docsZh`, …)
32
+ * @property {string} type the authoring type it was checked against
33
+ * @property {string} field the field's path in the doc, such as
34
+ * `usage.bestPractices[2].guidance`; empty for the doc value as a whole
35
+ * @property {DocTypeProblem} problem
36
+ * @property {'warning'} severity
37
+ * @property {string} message what TypeScript reports, shortened
38
+ * @property {string} fix what to change
39
+ */
40
+ /**
41
+ * @typedef {object} DocTypesUnchecked
42
+ * @property {string} doc the doc file, relative to the package root
43
+ * @property {string} reason why it was not checked
44
+ */
45
+ /**
46
+ * @typedef {object} DocTypesReport
47
+ * @property {'checked' | 'skipped'} status `skipped` means nothing was checked,
48
+ * and `reason` says why
49
+ * @property {string} [reason]
50
+ * @property {string} [typescript] the version of the compiler that checked
51
+ * @property {number} docs how many doc values were checked
52
+ * @property {DocTypeFinding[]} findings
53
+ * @property {DocTypesUnchecked[]} unchecked doc files with nothing to check,
54
+ * or not fully checked
55
+ */
56
+ /** The line both surfaces print when the compiler is missing. */
57
+ export const DOC_TYPES_TYPESCRIPT_MISSING_REASON: "TypeScript is not installed in this project, so docs were not checked against the authoring types. On TypeScript 7, add its TypeScript 6 API package (`npm install -D @typescript/typescript6`); otherwise install TypeScript 5.0 through 6 (`npm install -D typescript@6`). Then run this check again.";
58
+ export type DocRoot = "components" | "hooks" | "templates" | "docs" | "docs-overlay" | "themes";
59
+ export type DocFile = {
60
+ /**
61
+ * absolute path to the doc file
62
+ */
63
+ path: string;
64
+ /**
65
+ * the contribution root it was found in
66
+ */
67
+ root: DocRoot;
68
+ };
69
+ export type DocTypeProblem = "unknown_field" | "missing_field" | "wrong_type";
70
+ export type DocTypeFinding = {
71
+ /**
72
+ * the doc file, relative to the package root
73
+ */
74
+ doc: string;
75
+ /**
76
+ * 1-based line of the field (or of the doc value)
77
+ */
78
+ line: number;
79
+ /**
80
+ * the export checked (`default`, `docs`, `docsZh`, …)
81
+ */
82
+ export: string;
83
+ /**
84
+ * the authoring type it was checked against
85
+ */
86
+ type: string;
87
+ /**
88
+ * the field's path in the doc, such as
89
+ * `usage.bestPractices[2].guidance`; empty for the doc value as a whole
90
+ */
91
+ field: string;
92
+ problem: DocTypeProblem;
93
+ severity: "warning";
94
+ /**
95
+ * what TypeScript reports, shortened
96
+ */
97
+ message: string;
98
+ /**
99
+ * what to change
100
+ */
101
+ fix: string;
102
+ };
103
+ export type DocTypesUnchecked = {
104
+ /**
105
+ * the doc file, relative to the package root
106
+ */
107
+ doc: string;
108
+ /**
109
+ * why it was not checked
110
+ */
111
+ reason: string;
112
+ };
113
+ export type DocTypesReport = {
114
+ /**
115
+ * `skipped` means nothing was checked,
116
+ * and `reason` says why
117
+ */
118
+ status: "checked" | "skipped";
119
+ reason?: string | undefined;
120
+ /**
121
+ * the version of the compiler that checked
122
+ */
123
+ typescript?: string | undefined;
124
+ /**
125
+ * how many doc values were checked
126
+ */
127
+ docs: number;
128
+ findings: DocTypeFinding[];
129
+ /**
130
+ * doc files with nothing to check,
131
+ * or not fully checked
132
+ */
133
+ unchecked: DocTypesUnchecked[];
134
+ };
135
+ export type Target = {
136
+ exportName: string;
137
+ /**
138
+ * the doc value's expression
139
+ */
140
+ node: any;
141
+ /**
142
+ * the authoring type, as a type expression
143
+ */
144
+ typeExpr: string;
145
+ /**
146
+ * how findings name that type
147
+ */
148
+ typeName: string;
149
+ /**
150
+ * nodes whose leading JSDoc annotations are blanked
151
+ */
152
+ blank: any[];
153
+ /**
154
+ * source ranges to blank
155
+ */
156
+ blankRanges: Array<[number, number]>;
157
+ };