@astryxdesign/cli 0.7.2-canary.fc12a18 → 0.7.2-canary.fdd384f

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 (174) hide show
  1. package/README.md +9 -8
  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/component.test.mjs +420 -167
  7. package/api/component/integration-export-name.test.mjs +644 -0
  8. package/api/component/list/list.mjs +42 -4
  9. package/api/docs/_adapter.d.mts +11 -0
  10. package/api/docs/_adapter.mjs +244 -1
  11. package/api/docs/integrationDocs.test.mjs +124 -0
  12. package/api/doctor/theme-checks.mjs +1 -1
  13. package/api/gap-report/gap-report.mjs +67 -4
  14. package/api/index.d.mts +2 -0
  15. package/api/index.mjs +2 -0
  16. package/api/init/run/run.mjs +2 -2
  17. package/api/integration/_adapter.d.mts +12 -0
  18. package/api/integration/_adapter.mjs +54 -0
  19. package/api/integration/add-contribution.component-names.test.mjs +66 -0
  20. package/api/integration/add-contribution.mjs +8 -4
  21. package/api/integration/add-contribution.test.mjs +4 -2
  22. package/api/integration/authoring-checks.mjs +11 -2
  23. package/api/integration/authoring-checks.test.mjs +39 -0
  24. package/api/integration/authoring-checks.type.d.mts +9 -0
  25. package/api/integration/authoring-checks.type.mjs +14 -1
  26. package/api/integration/check/check.d.mts +96 -0
  27. package/api/integration/check/check.mjs +357 -0
  28. package/api/integration/check/check.test.mjs +489 -0
  29. package/api/integration/integration-check.type.d.mts +118 -0
  30. package/api/integration/integration-check.type.mjs +84 -0
  31. package/api/integration/integrationCheck.doc.d.mts +10 -0
  32. package/api/integration/integrationCheck.doc.mjs +73 -0
  33. package/api/integration/integrationComponentConflicts.doc.mjs +36 -5
  34. package/api/integration/pack-check.mjs +61 -107
  35. package/api/integration/pack-check.test.mjs +359 -0
  36. package/api/integration/validate-integration.mjs +8 -0
  37. package/api/integration/validate-integration.test.mjs +11 -0
  38. package/api/integration/validate-integration.type.d.mts +8 -0
  39. package/api/integration/validate-integration.type.mjs +12 -1
  40. package/api/integration/validateIntegration.doc.mjs +17 -3
  41. package/api/search/search.d.mts +9 -0
  42. package/api/search/search.integration-check.test.mjs +24 -0
  43. package/api/search/search.mjs +108 -16
  44. package/api/search/search.test.mjs +36 -0
  45. package/api/swizzle/copy/copy.mjs +28 -14
  46. package/api/template/template.test.mjs +120 -3
  47. package/api/theme/build/build.family.test.mjs +64 -0
  48. package/api/theme/build/build.mjs +180 -24
  49. package/api/theme/themeBuild.doc.mjs +4 -4
  50. package/assets/codemods/transforms/next/__tests__/migrate-list-edge-compensation-to-edge.test.mjs +120 -0
  51. package/assets/codemods/transforms/next/index.mjs +11 -1
  52. package/assets/codemods/transforms/next/migrate-list-edge-compensation-to-edge.mjs +198 -0
  53. package/assets/docs/README.md +10 -0
  54. package/assets/docs/author-a-theme.doc.mjs +1 -1
  55. package/assets/docs/getting-started.doc.mjs +3 -3
  56. package/assets/docs/theme.doc.dense.mjs +1 -1
  57. package/assets/docs/theme.doc.mjs +1 -1
  58. package/assets/docs/theme.doc.zh.mjs +1 -1
  59. package/assets/docs/tree/add-a-component.doc.mjs +10 -0
  60. package/assets/docs/tree/block-template.doc.mjs +2 -2
  61. package/assets/docs/tree/check-the-props.doc.mjs +196 -0
  62. package/assets/docs/tree/check-your-docs.doc.mjs +44 -3
  63. package/assets/docs/tree/checks.doc.mjs +21 -13
  64. package/assets/docs/tree/component-family.doc.mjs +5 -1
  65. package/assets/docs/tree/component-imports.doc.mjs +8 -0
  66. package/assets/docs/tree/describe-the-component.doc.mjs +1 -1
  67. package/assets/docs/tree/links.doc.mjs +2 -2
  68. package/assets/docs/tree/page-template.doc.mjs +1 -1
  69. package/assets/docs/tree/quick-start.doc.mjs +1 -1
  70. package/assets/docs/tree/replace-a-core-template.doc.mjs +1 -1
  71. package/assets/docs/tree/single-component.doc.mjs +3 -2
  72. package/assets/docs/tree/troubleshooting.doc.mjs +9 -1
  73. package/assets/docs/tree/type-scale.doc.mjs +3 -3
  74. package/assets/docs/tree/versioning.doc.mjs +1 -0
  75. package/assets/docs/tree/write-the-template-file.doc.mjs +2 -1
  76. package/assets/docs/use-a-theme.doc.mjs +2 -2
  77. package/assets/docs/working-with-ai.doc.mjs +43 -4
  78. package/assets/templates/blocks/components/Drawer/DrawerForm.doc.mjs +24 -0
  79. package/assets/templates/blocks/components/Drawer/DrawerForm.tsx +62 -0
  80. package/assets/templates/blocks/components/Drawer/DrawerScrim.doc.mjs +22 -0
  81. package/assets/templates/blocks/components/Drawer/DrawerScrim.tsx +68 -0
  82. package/assets/templates/blocks/components/Drawer/DrawerShowcase.doc.mjs +22 -0
  83. package/assets/templates/blocks/components/Drawer/DrawerShowcase.tsx +41 -0
  84. package/assets/templates/blocks/components/Drawer/DrawerStart.doc.mjs +21 -0
  85. package/assets/templates/blocks/components/Drawer/DrawerStart.tsx +41 -0
  86. package/assets/templates/blocks/components/Drawer/DrawerWidths.doc.mjs +22 -0
  87. package/assets/templates/blocks/components/Drawer/DrawerWidths.tsx +54 -0
  88. package/assets/templates/blocks/components/DrawerHeader/DrawerHeaderShowcase.doc.mjs +15 -0
  89. package/assets/templates/blocks/components/DrawerHeader/DrawerHeaderShowcase.tsx +73 -0
  90. package/assets/templates/blocks/components/DrawerHeader/DrawerHeaderSubtitleEndContent.doc.mjs +22 -0
  91. package/assets/templates/blocks/components/DrawerHeader/DrawerHeaderSubtitleEndContent.tsx +49 -0
  92. package/assets/templates/blocks/components/DrawerHeader/DrawerHeaderWithCloseButton.doc.mjs +21 -0
  93. package/assets/templates/blocks/components/DrawerHeader/DrawerHeaderWithCloseButton.tsx +42 -0
  94. package/assets/templates/pages/detail-page/page.tsx +3 -3
  95. package/assets/templates/pages/table-inbox/page.tsx +10 -8
  96. package/assets/theme.template.ts +1 -1
  97. package/authoring/doctypes/base/type.ts +6 -0
  98. package/authoring/doctypes/component/component.doc.mjs +4 -4
  99. package/authoring/doctypes/component/type.ts +6 -3
  100. package/authoring/doctypes/template/integration-template.doc.d.mts +11 -0
  101. package/authoring/doctypes/template/integration-template.doc.mjs +49 -0
  102. package/authoring/doctypes/template/parse.d.mts +6 -2
  103. package/authoring/doctypes/template/parse.mjs +3 -1
  104. package/authoring/doctypes/template/template.doc.mjs +1 -1
  105. package/authoring/doctypes/template/type.ts +22 -0
  106. package/authoring/index.d.ts +1 -0
  107. package/authoring/integration/integration.doc.mjs +8 -1
  108. package/authoring/integration/parse.test.mjs +10 -0
  109. package/authoring/integration/schema.d.mts +2 -0
  110. package/authoring/integration/schema.mjs +1 -0
  111. package/authoring/integration/type.ts +4 -0
  112. package/clients/cli/commands/build-theme.batch-report.test.mjs +3 -1
  113. package/clients/cli/commands/build-theme.mjs +1 -1
  114. package/clients/cli/commands/build-theme.path-safety.test.mjs +224 -6
  115. package/clients/cli/commands/build-theme.registry.test.mjs +5 -2
  116. package/clients/cli/commands/doctor-integration-components.doc.mjs +15 -4
  117. package/clients/cli/commands/doctor-integration-validate.doc.mjs +11 -2
  118. package/clients/cli/commands/doctor-integration.test.mjs +837 -0
  119. package/clients/cli/commands/doctor.mjs +190 -0
  120. package/clients/cli/commands/integration-check.doc.mjs +85 -0
  121. package/clients/cli/commands/integration-check.test.mjs +267 -0
  122. package/clients/cli/commands/integration.doc.mjs +6 -2
  123. package/clients/cli/commands/integration.mjs +107 -1
  124. package/clients/cli/commands/text-json-parity.test.mjs +5 -0
  125. package/clients/cli/commands/theme-build.doc.mjs +2 -2
  126. package/clients/cli/index.mjs +1 -0
  127. package/clients/cli/lib/component-format.mjs +5 -1
  128. package/foundation/config/project.mjs +82 -0
  129. package/foundation/discovery/authoring-self-docs.mjs +1 -0
  130. package/foundation/discovery/component-discovery.d.mts +190 -10
  131. package/foundation/discovery/component-discovery.export-names.test.mjs +760 -0
  132. package/foundation/discovery/component-discovery.mjs +864 -56
  133. package/foundation/discovery/component-discovery.test.mjs +96 -0
  134. package/foundation/discovery/component-replacement.mjs +18 -0
  135. package/foundation/discovery/component-replacement.test.mjs +40 -0
  136. package/foundation/discovery/doc-types.d.mts +157 -0
  137. package/foundation/discovery/doc-types.mjs +1224 -0
  138. package/foundation/discovery/doc-types.test.mjs +652 -0
  139. package/foundation/discovery/docs-discovery.d.mts +81 -0
  140. package/foundation/discovery/docs-discovery.mjs +57 -0
  141. package/foundation/discovery/integration-doc-files.d.mts +22 -0
  142. package/foundation/discovery/integration-doc-files.mjs +231 -0
  143. package/foundation/discovery/integration-doc-files.test.mjs +246 -0
  144. package/foundation/discovery/module-exports.d.mts +27 -0
  145. package/foundation/discovery/module-exports.mjs +356 -31
  146. package/foundation/discovery/module-exports.test.mjs +172 -0
  147. package/foundation/discovery/package-tsconfig.d.mts +14 -0
  148. package/foundation/discovery/package-tsconfig.mjs +228 -0
  149. package/foundation/discovery/package-tsconfig.test.mjs +210 -0
  150. package/foundation/discovery/project-typescript.d.mts +23 -0
  151. package/foundation/discovery/project-typescript.mjs +61 -0
  152. package/foundation/discovery/prop-drift.d.mts +278 -0
  153. package/foundation/discovery/prop-drift.mjs +2263 -0
  154. package/foundation/discovery/prop-drift.test.mjs +2219 -0
  155. package/foundation/discovery/template-adapter.mjs +74 -5
  156. package/foundation/discovery/type-match.d.mts +53 -0
  157. package/foundation/discovery/type-match.mjs +660 -0
  158. package/foundation/discovery/type-match.test.mjs +169 -0
  159. package/foundation/discovery/type-text.d.mts +68 -0
  160. package/foundation/discovery/type-text.mjs +658 -0
  161. package/foundation/discovery/type-text.test.mjs +196 -0
  162. package/foundation/discovery/unresolved-references.d.mts +62 -0
  163. package/foundation/discovery/unresolved-references.mjs +790 -0
  164. package/foundation/discovery/unresolved-references.test.mjs +567 -0
  165. package/foundation/doc-compiler/doc-loads.test.mjs +11 -1
  166. package/foundation/doc-compiler/inputs.mjs +23 -0
  167. package/foundation/doc-compiler/inputs.test.mjs +0 -1
  168. package/foundation/doc-compiler/links.d.mts +9 -5
  169. package/foundation/doc-compiler/links.mjs +4 -2
  170. package/foundation/integrations/contribution-inventory.mjs +6 -1
  171. package/foundation/response/response-types.doc.mjs +7 -2
  172. package/foundation/xle/registry.mjs +4 -0
  173. package/foundation/xle/registry.test.mjs +28 -0
  174. package/package.json +10 -10
@@ -16,6 +16,7 @@ import {fileURLToPath} from 'node:url';
16
16
  import {
17
17
  CORE_PACKAGE,
18
18
  discoverComponents,
19
+ familyMember,
19
20
  findComponentReadme,
20
21
  findComponentSource,
21
22
  resolveImportPath,
@@ -121,6 +122,91 @@ describe('discoverComponents (real core)', () => {
121
122
  expect(discoverComponents(core)).toEqual({});
122
123
  });
123
124
 
125
+ it('lists HStack, VStack and Heading, whose docs live in their family folders', () => {
126
+ // Each has its own folder and import path; Stack's doc documents HStack and
127
+ // VStack as members, and Heading's own doc sits in the Text folder.
128
+ const comps = discoverComponents(CORE);
129
+ expect(comps.Layout).toEqual(expect.arrayContaining(['HStack', 'Stack', 'VStack']));
130
+ expect(comps.Heading).toEqual(['Heading']);
131
+ expect(findComponentReadme(CORE, 'VStack')).toMatch(/[\\/]Stack[\\/]Stack\.doc\.mjs$/);
132
+ expect(findComponentReadme(CORE, 'HStack')).toMatch(/[\\/]Stack[\\/]Stack\.doc\.mjs$/);
133
+ expect(findComponentReadme(CORE, 'Heading')).toMatch(/[\\/]Text[\\/]Heading\.doc\.mjs$/);
134
+ expect(resolveImportPath(CORE, 'VStack')).toBe('@astryxdesign/core/VStack');
135
+ expect(resolveImportPath(CORE, 'Heading')).toBe('@astryxdesign/core/Heading');
136
+ }, SLOW);
137
+
138
+ it('lists a component folder with no doc when its family doc lists it as a member', () => {
139
+ const core = mkTmp('as-cd-family-');
140
+ const write = (rel, text) => {
141
+ fs.mkdirSync(path.dirname(path.join(core, 'src', rel)), {recursive: true});
142
+ fs.writeFileSync(path.join(core, 'src', rel), text);
143
+ };
144
+ write('Stack/Stack.tsx', 'x');
145
+ write('VStack/VStack.tsx', "import {Stack} from '../Stack/Stack';\n");
146
+ write('Prose/Prose.tsx', "import {Stack} from '../Stack/Stack';\n");
147
+ // Listed by Stack's doc, but builds on nothing in Stack's folder.
148
+ write('Orphan/Orphan.tsx', "import {x} from '../utils';\n");
149
+ write(
150
+ 'Stack/Stack.doc.mjs',
151
+ 'export const docs = {\n' +
152
+ " name: 'Stack',\n" +
153
+ " group: 'Layout',\n" +
154
+ " relatedComponents: ['Prose'],\n" +
155
+ " usage: {description: 'Pair with Prose.', examples: [{code: \"<Prose label='Prose' />\"}]},\n" +
156
+ " components: [{name: 'Stack'}, {name: 'VStack', description: 'Vertical.'}, {name: 'Orphan'}],\n" +
157
+ '};\n',
158
+ );
159
+ expect(discoverComponents(core)).toEqual({Layout: ['Stack', 'VStack']});
160
+ expect(findComponentReadme(core, 'VStack')).toBe(
161
+ path.join(core, 'src', 'Stack', 'Stack.doc.mjs'),
162
+ );
163
+ // Named only in relatedComponents, prose, and an example: not documented.
164
+ expect(findComponentReadme(core, 'Prose')).toBeNull();
165
+ // A family doc is read only from the folders the component imports.
166
+ expect(findComponentReadme(core, 'Orphan')).toBeNull();
167
+ });
168
+
169
+ it('lists a component folder with no doc when its own doc sits in a family folder', () => {
170
+ const core = mkTmp('as-cd-sibling-');
171
+ for (const dir of ['Text', 'Heading']) {
172
+ fs.mkdirSync(path.join(core, 'src', dir), {recursive: true});
173
+ }
174
+ fs.writeFileSync(path.join(core, 'src', 'Text', 'Text.tsx'), 'x');
175
+ fs.writeFileSync(path.join(core, 'src', 'Heading', 'Heading.tsx'), 'x');
176
+ fs.writeFileSync(
177
+ path.join(core, 'src', 'Text', 'Text.doc.mjs'),
178
+ "export const docs = {name: 'Text', components: [{name: 'Heading'}]};\n",
179
+ );
180
+ fs.writeFileSync(
181
+ path.join(core, 'src', 'Text', 'Heading.doc.mjs'),
182
+ "export const docs = {name: 'Heading'};\n",
183
+ );
184
+ expect(discoverComponents(core)).toEqual({Heading: ['Heading'], Text: ['Text']});
185
+ expect(findComponentReadme(core, 'Heading')).toBe(
186
+ path.join(core, 'src', 'Text', 'Heading.doc.mjs'),
187
+ );
188
+ });
189
+
190
+ it('keeps a member its family hides, and a context folder, unlisted', () => {
191
+ const core = mkTmp('as-cd-family-hidden-');
192
+ for (const dir of ['Stack', 'VStack', 'SizeContext']) {
193
+ fs.mkdirSync(path.join(core, 'src', dir), {recursive: true});
194
+ fs.writeFileSync(
195
+ path.join(core, 'src', dir, `${dir}.tsx`),
196
+ "import {Stack} from '../Stack/Stack';\n",
197
+ );
198
+ }
199
+ fs.writeFileSync(
200
+ path.join(core, 'src', 'Stack', 'Stack.doc.mjs'),
201
+ 'export const docs = {\n' +
202
+ " name: 'Stack',\n" +
203
+ " hiddenComponents: ['VStack'],\n" +
204
+ " components: [{name: 'Stack'}, {name: 'VStack'}, {name: 'SizeContext'}],\n" +
205
+ '};\n',
206
+ );
207
+ expect(discoverComponents(core)).toEqual({Stack: ['Stack']});
208
+ });
209
+
124
210
  it('returns {} for an empty src/ dir', () => {
125
211
  const core = mkTmp('as-cd-emptysrc-');
126
212
  fs.mkdirSync(path.join(core, 'src'));
@@ -133,6 +219,16 @@ describe('discoverComponents (real core)', () => {
133
219
  });
134
220
  });
135
221
 
222
+ describe('familyMember', () => {
223
+ it("returns a family doc's entry for a member, and null for a component's own doc", () => {
224
+ const stack = {name: 'Stack', components: [{name: 'Stack'}, {name: 'VStack', description: 'v'}]};
225
+ expect(familyMember(stack, 'VStack')).toEqual({name: 'VStack', description: 'v'});
226
+ expect(familyMember(stack, 'Stack')).toBeNull();
227
+ expect(familyMember({name: 'Button'}, 'Button')).toBeNull();
228
+ expect(familyMember(stack, 'HStack')).toBeNull();
229
+ });
230
+ });
231
+
136
232
  describe('findComponentReadme / findComponentSource / resolveImportPath', () => {
137
233
  it('finds the doc + source for a top-level component', () => {
138
234
  expect(findComponentReadme(CORE, 'Button')).toMatch(/Button\.doc\.mjs$/);
@@ -161,6 +161,24 @@ export async function resolveComponentReplacements(
161
161
  typeof name === 'string' ? byTarget.get(name) : undefined,
162
162
  };
163
163
 
164
+ // A first read under file names alone settles the common case, no
165
+ // declaration anywhere, without reading the names docs document.
166
+ let declares = false;
167
+ for (const integration of loadedIntegrations) {
168
+ if (declares || !integration?.components || integration.__loadError)
169
+ continue;
170
+ try {
171
+ const {components} = await discoverValidIntegrationComponents(
172
+ integration,
173
+ {documentedNames: false},
174
+ );
175
+ declares = components.some(record => record.replaces !== undefined);
176
+ } catch {
177
+ // Read again below, where a root that cannot be read is skipped.
178
+ }
179
+ }
180
+ if (!declares) return result;
181
+
164
182
  /** @type {Declaration[]} */
165
183
  const declarations = [];
166
184
  /** @type {Array<{name: string, package: string}>} */
@@ -259,6 +259,46 @@ describe('resolveComponentReplacements', () => {
259
259
  ]);
260
260
  });
261
261
 
262
+ it('applies a replacement under the export a doc names when its file is named otherwise', async () => {
263
+ // Nav.doc.mjs documents AcmeSideNav, the export of a Nav.tsx that exports
264
+ // nothing named Nav.
265
+ const acme = integrationWithDocSource(
266
+ '@acme/nav',
267
+ 'Nav',
268
+ BASE_DOC.replace("name: 'AcmeNav'", "name: 'AcmeSideNav'"),
269
+ );
270
+ fs.writeFileSync(
271
+ path.join(acme.components, 'Nav.tsx'),
272
+ 'export function AcmeSideNav() { return null; }\n',
273
+ );
274
+ const result = await resolveComponentReplacements(CORE_DIR, [acme]);
275
+ expect(result.findings).toEqual([]);
276
+ expect(result.forTarget('SideNav')).toMatchObject({
277
+ name: 'AcmeSideNav',
278
+ package: '@acme/nav',
279
+ });
280
+ });
281
+
282
+ it("counts a doc's replaces once when the doc lists its own name as a member", async () => {
283
+ // Chip.doc.mjs documents AcmeChip beside a Chip.tsx that exports both, and
284
+ // lists itself first, as the component-family guide asks.
285
+ const acme = integrationWithDocSource(
286
+ '@acme/chips',
287
+ 'Chip',
288
+ `export default {type: 'component', name: 'AcmeChip', replaces: 'Badge', usage: {description: 'Acme chip.'}, components: [{name: 'AcmeChip', description: 'A chip.', props: []}]};\n`,
289
+ );
290
+ fs.writeFileSync(
291
+ path.join(acme.components, 'Chip.tsx'),
292
+ 'export function Chip() { return null; }\nexport function AcmeChip() { return null; }\n',
293
+ );
294
+ const result = await resolveComponentReplacements(CORE_DIR, [acme]);
295
+ expect(result.findings).toEqual([]);
296
+ expect(result.forTarget('Badge')).toMatchObject({
297
+ name: 'Chip',
298
+ package: '@acme/chips',
299
+ });
300
+ });
301
+
262
302
  it('lets a replacement keep the Core name it replaces', async () => {
263
303
  const acme = integration(
264
304
  '@acme/nav',
@@ -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. Install typescript and 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
+ };