@astryxdesign/cli 0.6.3-canary.bcf01fe → 0.6.3-canary.c13ef6b

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 (101) hide show
  1. package/api/build/build.type.d.mts +2 -2
  2. package/api/build/build.type.mjs +2 -2
  3. package/api/component/component.type.d.mts +6 -6
  4. package/api/component/component.type.mjs +19 -19
  5. package/api/discover/discover.type.d.mts +4 -4
  6. package/api/discover/discover.type.mjs +10 -10
  7. package/api/docs/docs.type.d.mts +4 -4
  8. package/api/docs/docs.type.mjs +10 -10
  9. package/api/hook/hook.type.d.mts +3 -3
  10. package/api/hook/hook.type.mjs +11 -11
  11. package/api/integration/add-contribution.mjs +5 -3
  12. package/api/integration/add-contribution.test.mjs +4 -4
  13. package/api/integration/pack-check.mjs +49 -7
  14. package/api/integration/pack-check.test.mjs +249 -0
  15. package/api/search/search.type.d.mts +1 -1
  16. package/api/search/search.type.mjs +1 -1
  17. package/api/swizzle/swizzle.type.d.mts +2 -2
  18. package/api/swizzle/swizzle.type.mjs +2 -2
  19. package/api/template/template.type.d.mts +5 -5
  20. package/api/template/template.type.mjs +12 -12
  21. package/api/theme/build/build.mjs +20 -6
  22. package/api/theme/build/build.test.mjs +127 -0
  23. package/api/theme/palette/generate/generate.mjs +1 -1
  24. package/api/theme/palette/generate/generator.d.mts +10 -13
  25. package/api/theme/palette/generate/generator.mjs +7 -3
  26. package/api/theme/theme.type.d.mts +170 -11
  27. package/api/theme/theme.type.mjs +94 -27
  28. package/api/upgrade/upgrade.type.d.mts +4 -4
  29. package/api/upgrade/upgrade.type.mjs +10 -10
  30. package/assets/docs/styling-libraries.doc.mjs +1 -1
  31. package/assets/docs/working-with-ai.doc.mjs +1 -1
  32. package/authoring/_shared/contract.ts +22 -0
  33. package/authoring/codemod/codemod.doc.mjs +6 -1
  34. package/authoring/codemod/parse.d.mts +8 -8
  35. package/authoring/codemod/parse.mjs +8 -6
  36. package/authoring/config/parse.d.mts +13 -13
  37. package/authoring/config/parse.mjs +8 -8
  38. package/authoring/config/type.ts +3 -3
  39. package/authoring/debug/parse.d.mts +4 -4
  40. package/authoring/debug/parse.mjs +3 -3
  41. package/authoring/doctypes/_schema.d.mts +121 -11
  42. package/authoring/doctypes/_schema.mjs +144 -13
  43. package/authoring/doctypes/base/graph-fields.doc.mjs +11 -4
  44. package/authoring/doctypes/base/type.ts +8 -4
  45. package/authoring/doctypes/command/command.doc.mjs +3 -2
  46. package/authoring/doctypes/command/parse.d.mts +2 -2
  47. package/authoring/doctypes/command/parse.mjs +1 -1
  48. package/authoring/doctypes/command/type.ts +2 -2
  49. package/authoring/doctypes/component/component.doc.mjs +5 -2
  50. package/authoring/doctypes/component/parse.d.mts +2 -2
  51. package/authoring/doctypes/component/parse.mjs +1 -1
  52. package/authoring/doctypes/component/type.ts +1 -1
  53. package/authoring/doctypes/enum/parse.d.mts +2 -2
  54. package/authoring/doctypes/enum/parse.mjs +1 -1
  55. package/authoring/doctypes/enum/type.ts +1 -1
  56. package/authoring/doctypes/function/function.doc.mjs +4 -0
  57. package/authoring/doctypes/function/parse.d.mts +2 -2
  58. package/authoring/doctypes/function/parse.mjs +1 -1
  59. package/authoring/doctypes/function/type.ts +1 -1
  60. package/authoring/doctypes/hook/hook.doc.mjs +4 -0
  61. package/authoring/doctypes/hook/parse.d.mts +2 -2
  62. package/authoring/doctypes/hook/parse.mjs +1 -1
  63. package/authoring/doctypes/hook/type.ts +1 -1
  64. package/authoring/doctypes/legacy.d.mts +6 -6
  65. package/authoring/doctypes/legacy.mjs +3 -3
  66. package/authoring/doctypes/load-contract.test.mjs +207 -0
  67. package/authoring/doctypes/namespace/namespace.doc.mjs +7 -3
  68. package/authoring/doctypes/namespace/parse.d.mts +2 -2
  69. package/authoring/doctypes/namespace/parse.mjs +1 -1
  70. package/authoring/doctypes/namespace/type.ts +2 -2
  71. package/authoring/doctypes/parse.d.mts +18 -18
  72. package/authoring/doctypes/parse.mjs +9 -9
  73. package/authoring/doctypes/reference/parse.d.mts +2 -2
  74. package/authoring/doctypes/reference/parse.mjs +1 -1
  75. package/authoring/doctypes/reference/reference.doc.mjs +6 -2
  76. package/authoring/doctypes/reference/type.ts +1 -1
  77. package/authoring/doctypes/schema/parse.d.mts +2 -2
  78. package/authoring/doctypes/schema/parse.mjs +1 -1
  79. package/authoring/doctypes/schema/type.ts +2 -2
  80. package/authoring/doctypes/template/parse.d.mts +92 -1
  81. package/authoring/doctypes/template/parse.mjs +33 -1
  82. package/authoring/doctypes/template/template.doc.mjs +4 -0
  83. package/authoring/doctypes/template/type.ts +4 -1
  84. package/authoring/doctypes/types.ts +10 -10
  85. package/authoring/gap-report/parse.d.mts +9 -9
  86. package/authoring/gap-report/parse.mjs +6 -6
  87. package/authoring/gap-report/type.ts +1 -1
  88. package/authoring/identity/identity.doc.mjs +3 -2
  89. package/authoring/identity/type.ts +10 -10
  90. package/authoring/index.d.ts +19 -19
  91. package/authoring/integration/parse.d.mts +2 -2
  92. package/authoring/integration/parse.mjs +1 -1
  93. package/authoring/integration/schema.d.mts +4 -4
  94. package/authoring/integration/schema.mjs +3 -3
  95. package/authoring/integration/type.ts +1 -1
  96. package/clients/cli/commands/integration-authoring.test.mjs +13 -9
  97. package/foundation/discovery/authoring-self-docs.test.mjs +71 -12
  98. package/foundation/discovery/docs-discovery.d.mts +4 -0
  99. package/foundation/discovery/docs-discovery.mjs +16 -2
  100. package/foundation/discovery/docs-discovery.test.mjs +47 -11
  101. package/package.json +9 -11
@@ -11,10 +11,18 @@
11
11
 
12
12
  import {z} from 'zod';
13
13
 
14
- /** @typedef {import('./base/type').AuthoredDocGraphFields} AuthoredDocGraphFieldsType */
15
- /** @typedef {import('./base/type').AuthoredDocKind} AuthoredDocKind */
16
- /** @typedef {import('./namespace/type').NamespaceDoc} NamespaceDoc */
17
- /** @typedef {import('./reference/type').ReferenceContentBlock} ReferenceContentBlock */
14
+ /** @typedef {import('./base/type.js').AuthoredDocGraphFields} AuthoredDocGraphFieldsType */
15
+ /** @typedef {import('./base/type.js').AuthoredDocKind} AuthoredDocKind */
16
+ /** @typedef {import('./namespace/type.js').NamespaceDoc} NamespaceDoc */
17
+ /** @typedef {import('./reference/type.js').ReferenceContentBlock} ReferenceContentBlock */
18
+ /** @typedef {import('./reference/type.js').ReferenceDoc} ReferenceDoc */
19
+ /** @typedef {import('./component/type.js').SingleComponentDoc} SingleComponentDoc */
20
+ /** @typedef {import('./base/type.js').ComponentPropDoc} ComponentPropDoc */
21
+ /** @typedef {import('./hook/type.js').HookDoc} HookDoc */
22
+ /** @typedef {import('./function/type.js').FunctionDoc} FunctionDoc */
23
+ /** @typedef {import('./schema/type.js').SchemaDoc} SchemaDoc */
24
+ /** @typedef {import('./command/type.js').CommandDoc} CommandDoc */
25
+ /** @typedef {import('./enum/type.js').EnumDoc} EnumDoc */
18
26
 
19
27
  const nonEmptyString = z.string().min(1);
20
28
 
@@ -31,6 +39,12 @@ export const AuthoredDocKindSchema = z.enum([
31
39
  'namespace',
32
40
  ]);
33
41
 
42
+ /**
43
+ * @typedef {import('../_shared/contract.js').Expect<
44
+ * import('../_shared/contract.js').Equal<z.infer<typeof AuthoredDocKindSchema>, AuthoredDocKind>
45
+ * >} _AuthoredDocKindDriftLock
46
+ */
47
+
34
48
  /** Shared optional graph fields for every authored doc kind. */
35
49
  export const AuthoredDocGraphFields = {
36
50
  placement: z
@@ -48,8 +62,8 @@ export const AuthoredDocGraphFields = {
48
62
  const _AuthoredDocGraphSchema = z.object(AuthoredDocGraphFields).strict();
49
63
 
50
64
  /**
51
- * @typedef {import('../_shared/contract').Expect<
52
- * import('../_shared/contract').MutuallyAssignable<
65
+ * @typedef {import('../_shared/contract.js').Expect<
66
+ * import('../_shared/contract.js').MutuallyAssignable<
53
67
  * z.infer<typeof _AuthoredDocGraphSchema>,
54
68
  * AuthoredDocGraphFieldsType
55
69
  * >
@@ -161,8 +175,8 @@ export const ReferenceContentBlockSchema = z.discriminatedUnion('type', [
161
175
  ]);
162
176
 
163
177
  /**
164
- * @typedef {import('../_shared/contract').Expect<
165
- * import('../_shared/contract').Equal<
178
+ * @typedef {import('../_shared/contract.js').Expect<
179
+ * import('../_shared/contract.js').Equal<
166
180
  * z.infer<typeof ReferenceContentBlockSchema>,
167
181
  * ReferenceContentBlock
168
182
  * >
@@ -245,11 +259,58 @@ const ComponentBaseSchema = z
245
259
  })
246
260
  .passthrough();
247
261
 
248
- /** New-format stamped component doc (`type: 'component'`). */
262
+ /**
263
+ * One entry in a group doc's `components`: a full ComponentEntry or a
264
+ * name-only ComponentRef. Readers look every entry up by `name`, so that much
265
+ * is checked here; the rest passes through, as on an unstamped doc.
266
+ */
267
+ const ComponentGroupEntrySchema = z
268
+ .object({name: z.string().min(1, 'component name is required')})
269
+ .passthrough();
270
+
271
+ /**
272
+ * New-format stamped component doc (`type: 'component'`): one component's
273
+ * `props`, or the `components` a group doc documents together. These are the
274
+ * shapes the published ComponentDoc type allows, and the ones an unstamped doc
275
+ * may already take.
276
+ */
249
277
  export const ComponentDocKindSchema = ComponentBaseSchema.extend({
250
- props: z.array(PropSchema),
278
+ props: z.array(PropSchema).optional(),
279
+ components: z.array(ComponentGroupEntrySchema).optional(),
280
+ }).superRefine((doc, context) => {
281
+ if (doc.props == null && doc.components == null) {
282
+ context.addIssue({
283
+ code: 'custom',
284
+ path: ['props'],
285
+ message:
286
+ 'expected the props array, or `components` for a doc that groups several components',
287
+ });
288
+ }
251
289
  });
252
290
 
291
+ /**
292
+ * A stamped component doc as it loads. The loader accepts what the unstamped
293
+ * format always accepted, so stamping an existing doc never breaks it:
294
+ * `displayName` may be missing, `category` is any string, `usage`, `theming`,
295
+ * `playground` and `examples` pass through unchecked, and a doc has `props`,
296
+ * `components`, or both; each `components` entry needs only a `name`. Every
297
+ * other field matches the published type.
298
+ *
299
+ * @typedef {Omit<SingleComponentDoc,
300
+ * 'type' | 'displayName' | 'category' | 'usage' | 'theming' | 'examples' | 'playground' | 'props'>
301
+ * & {type: 'component', displayName?: string, category?: string, usage?: unknown,
302
+ * theming?: unknown, examples?: unknown[], playground?: unknown,
303
+ * props?: ComponentPropDoc[], components?: Array<{name: string}>}} LoadedComponentDoc
304
+ */
305
+ /**
306
+ * @typedef {import('../_shared/contract.js').Expect<
307
+ * import('../_shared/contract.js').MutuallyAssignable<
308
+ * import('../_shared/contract.js').NamedFields<z.infer<typeof ComponentDocKindSchema>>,
309
+ * import('../_shared/contract.js').NamedFields<LoadedComponentDoc>
310
+ * >
311
+ * >} _ComponentDocDriftLock
312
+ */
313
+
253
314
  /** Return entry for generalized function docs. */
254
315
  const FunctionReturnSchema = z
255
316
  .object({
@@ -269,6 +330,28 @@ export const FunctionDocKindSchema = z
269
330
  })
270
331
  .passthrough();
271
332
 
333
+ /**
334
+ * A stamped function doc as it loads: as with components, `displayName` may be
335
+ * missing and `usage` passes through unchecked.
336
+ *
337
+ * @typedef {Omit<FunctionDoc, 'type' | 'displayName' | 'usage'>
338
+ * & {type: 'function', displayName?: string, usage?: unknown}} LoadedFunctionDoc
339
+ */
340
+ /**
341
+ * @typedef {import('../_shared/contract.js').Expect<
342
+ * import('../_shared/contract.js').MutuallyAssignable<
343
+ * import('../_shared/contract.js').NamedFields<z.infer<typeof FunctionDocKindSchema>>,
344
+ * import('../_shared/contract.js').NamedFields<LoadedFunctionDoc>
345
+ * >
346
+ * >} _FunctionDocDriftLock
347
+ */
348
+
349
+ /**
350
+ * Every HookDoc is a FunctionDoc, so the one function schema covers both.
351
+ *
352
+ * @typedef {import('../_shared/contract.js').Expect<[HookDoc] extends [FunctionDoc] ? true : false>} _HookDocIsFunctionDocLock
353
+ */
354
+
272
355
  /**
273
356
  * Stamped generic reference/topic doc (`type: 'generic'`). `title` and
274
357
  * `sections` stay optional at this parser boundary for docs produced by the
@@ -308,9 +391,30 @@ export const GenericDocKindSchema = z
308
391
  });
309
392
  });
310
393
 
394
+ /**
395
+ * A stamped generic doc as the load check accepts it. `title`, `description`
396
+ * and `sections` may be missing, as in docs the v0.3.0 factory-removal codemod
397
+ * produced; `parseReference` then fills them (title from `displayName` or
398
+ * `name`, an empty description, no sections), so its result is a full
399
+ * ReferenceDoc. Only a doc with a description and sections is a usable topic
400
+ * (see `problemsInTopic`).
401
+ *
402
+ * @typedef {Omit<ReferenceDoc, 'type' | 'title' | 'description' | 'sections'>
403
+ * & {type: 'generic'}
404
+ * & Partial<Pick<ReferenceDoc, 'title' | 'description' | 'sections'>>} LoadedReferenceDoc
405
+ */
406
+ /**
407
+ * @typedef {import('../_shared/contract.js').Expect<
408
+ * import('../_shared/contract.js').MutuallyAssignable<
409
+ * import('../_shared/contract.js').NamedFields<z.infer<typeof GenericDocKindSchema>>,
410
+ * import('../_shared/contract.js').NamedFields<LoadedReferenceDoc>
411
+ * >
412
+ * >} _ReferenceDocDriftLock
413
+ */
414
+
311
415
  /** Recursive field descriptor for a SchemaDoc. */
312
416
  const SchemaFieldSchema =
313
- /** @type {import('zod').ZodType<import('./schema/type').SchemaFieldDoc>} */ (
417
+ /** @type {import('zod').ZodType<import('./schema/type.js').SchemaFieldDoc>} */ (
314
418
  z.lazy(() =>
315
419
  z
316
420
  .object({
@@ -351,6 +455,15 @@ export const SchemaDocKindSchema = z
351
455
  })
352
456
  .passthrough();
353
457
 
458
+ /**
459
+ * @typedef {import('../_shared/contract.js').Expect<
460
+ * import('../_shared/contract.js').MutuallyAssignable<
461
+ * import('../_shared/contract.js').NamedFields<z.infer<typeof SchemaDocKindSchema>>,
462
+ * import('../_shared/contract.js').NamedFields<SchemaDoc & {type: 'schema'}>
463
+ * >
464
+ * >} _SchemaDocDriftLock
465
+ */
466
+
354
467
  /** New stamped command doc (`type: 'command'`). */
355
468
  export const CommandDocKindSchema = z
356
469
  .object({
@@ -411,6 +524,15 @@ export const CommandDocKindSchema = z
411
524
  })
412
525
  .passthrough();
413
526
 
527
+ /**
528
+ * @typedef {import('../_shared/contract.js').Expect<
529
+ * import('../_shared/contract.js').MutuallyAssignable<
530
+ * import('../_shared/contract.js').NamedFields<z.infer<typeof CommandDocKindSchema>>,
531
+ * import('../_shared/contract.js').NamedFields<CommandDoc & {type: 'command'}>
532
+ * >
533
+ * >} _CommandDocDriftLock
534
+ */
535
+
414
536
  /** New stamped enum doc (`type: 'enum'`). */
415
537
  export const EnumDocKindSchema = z
416
538
  .object({
@@ -432,6 +554,15 @@ export const EnumDocKindSchema = z
432
554
  })
433
555
  .passthrough();
434
556
 
557
+ /**
558
+ * @typedef {import('../_shared/contract.js').Expect<
559
+ * import('../_shared/contract.js').MutuallyAssignable<
560
+ * import('../_shared/contract.js').NamedFields<z.infer<typeof EnumDocKindSchema>>,
561
+ * import('../_shared/contract.js').NamedFields<EnumDoc & {type: 'enum'}>
562
+ * >
563
+ * >} _EnumDocDriftLock
564
+ */
565
+
435
566
  const NamespaceSlotSchema = z
436
567
  .object({
437
568
  title: nonEmptyString,
@@ -514,8 +645,8 @@ export const NamespaceDocKindSchema = z
514
645
  });
515
646
 
516
647
  /**
517
- * @typedef {import('../_shared/contract').Expect<
518
- * import('../_shared/contract').Equal<
648
+ * @typedef {import('../_shared/contract.js').Expect<
649
+ * import('../_shared/contract.js').Equal<
519
650
  * z.infer<typeof NamespaceDocKindSchema>,
520
651
  * NamespaceDoc
521
652
  * >
@@ -12,14 +12,14 @@ export const doc = {
12
12
  displayName: 'Authored doc graph fields',
13
13
  namespace: 'authoring',
14
14
  description:
15
- 'Optional placement, compatibility aliases, and audience fields shared by every authored documentation kind.',
15
+ 'Placement, compatibility aliases, and audience: fields every authored doc kind declares for the docs graph. The docs graph is not built yet, so nothing reads them: a reference topic that sets one fails to load, and other doc kinds accept them and ignore them.',
16
16
  appliesTo: 'Every supported .doc.mjs object',
17
17
  fields: [
18
18
  {
19
19
  name: 'placement',
20
20
  type: 'DocPlacement',
21
21
  description:
22
- 'Requests one canonical parent. The compiler fails invalid explicit placement instead of silently using Unorganized.',
22
+ 'Requests one canonical parent in the docs graph. Not read yet: a topic that sets it fails to load.',
23
23
  fields: [
24
24
  {
25
25
  name: 'placement.parent',
@@ -43,13 +43,20 @@ export const doc = {
43
43
  name: 'aliases',
44
44
  type: 'string[]',
45
45
  description:
46
- 'Prior names or routes retained for compatibility. Aliases do not create another identity.',
46
+ 'Prior names or routes the docs graph will keep resolving to this doc, without creating another identity. Not read yet: a topic that sets it fails to load.',
47
47
  },
48
48
  {
49
49
  name: 'audience',
50
50
  type: "'public' | 'internal'",
51
- description: 'Bundle audience. Omit for public documentation.',
51
+ description:
52
+ "Which docs bundle includes this doc ('public' when omitted). Not read yet: a topic that sets it fails to load.",
52
53
  default: "'public'",
53
54
  },
54
55
  ],
56
+ notes: [
57
+ {
58
+ type: 'prose',
59
+ text: 'Unknown fields: `component`, `function`, `generic`, `schema`, `command` and `enum` docs accept a field they do not know, and nothing reads it, so a doc written for a newer CLI still loads here. `page`, `block` and `namespace` docs refuse one. Sections and content blocks refuse one in every doc.',
60
+ },
61
+ ],
55
62
  };
@@ -30,13 +30,17 @@ export interface DocPlacement {
30
30
  order?: number;
31
31
  }
32
32
 
33
- /** Graph metadata shared by every authored doc kind. */
33
+ /**
34
+ * Graph metadata shared by every authored doc kind. Reserved for the docs
35
+ * graph, which is not built yet: nothing reads these fields, and a reference
36
+ * topic that sets one fails to load.
37
+ */
34
38
  export interface AuthoredDocGraphFields {
35
- /** Requested canonical parent. Omit to use source adoption or Unorganized. */
39
+ /** Requested canonical parent in the docs graph. Not read yet. */
36
40
  placement?: DocPlacement;
37
- /** Prior routes or names that must continue to resolve to this stable doc. */
41
+ /** Prior routes or names the docs graph will keep resolving. Not read yet. */
38
42
  aliases?: string[];
39
- /** Bundle audience. Omit for public docs. */
43
+ /** Docs bundle audience; omit for public docs. Not read yet. */
40
44
  audience?: DocAudience;
41
45
  }
42
46
 
@@ -135,8 +135,9 @@ export const doc = {
135
135
  },
136
136
  {
137
137
  name: 'options[].default',
138
- type: 'string',
139
- description: 'Default value as a string.',
138
+ type: 'string | boolean | string[]',
139
+ description:
140
+ 'Default value: a string, a boolean, or a list of strings.',
140
141
  },
141
142
  {
142
143
  name: 'options[].cliOnly',
@@ -1,7 +1,7 @@
1
1
  // @generated by scripts/sync-api-types.mjs from the JSDoc in authoring/**/*.mjs.
2
2
  // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
3
 
4
- /** @typedef {import('../types').CommandDoc} CommandDoc */
4
+ /** @typedef {import('../types.js').CommandDoc} CommandDoc */
5
5
  /**
6
6
  * Validate an unknown value as a stamped command doc, or throw.
7
7
  *
@@ -10,4 +10,4 @@
10
10
  * @returns {CommandDoc}
11
11
  */
12
12
  export function parseCommand(input: unknown, label?: string): CommandDoc;
13
- export type CommandDoc = import("../types").CommandDoc;
13
+ export type CommandDoc = import("../types.js").CommandDoc;
@@ -8,7 +8,7 @@
8
8
  import {CommandDocKindSchema} from '../_schema.mjs';
9
9
  import {formatZodError} from '../../_shared/errors.mjs';
10
10
 
11
- /** @typedef {import('../types').CommandDoc} CommandDoc */
11
+ /** @typedef {import('../types.js').CommandDoc} CommandDoc */
12
12
 
13
13
  /**
14
14
  * Validate an unknown value as a stamped command doc, or throw.
@@ -9,8 +9,8 @@
9
9
  * `--help`. Colocated at `clients/cli/commands/<name>.doc.mjs`.
10
10
  */
11
11
 
12
- import type {AuthoredDocGraphFields} from '../base/type';
13
- import type {ReferenceContentBlock} from '../reference/type';
12
+ import type {AuthoredDocGraphFields} from '../base/type.js';
13
+ import type {ReferenceContentBlock} from '../reference/type.js';
14
14
 
15
15
  /** A positional argument. `param` links it to a FunctionDoc param for its description. */
16
16
  export interface CommandArgDoc {
@@ -124,8 +124,7 @@ export const doc = {
124
124
  name: 'usage',
125
125
  type: 'UsageDoc',
126
126
  description:
127
- 'Component usage documentation: concise summary, best practices, component-specific accessibility requirements, and optional visual anatomy. (Optional on SubComponentDoc, where the sub-component description is used instead.)',
128
- required: true,
127
+ 'Component usage documentation: concise summary, best practices, component-specific accessibility requirements, and optional visual anatomy. Required on a component doc; optional on a sub-component doc (`subComponentOf`), which uses its description instead.',
129
128
  fields: [
130
129
  {
131
130
  name: 'usage.description',
@@ -242,6 +241,10 @@ export const docs = {
242
241
  },
243
242
  ],
244
243
  notes: [
244
+ {
245
+ type: 'prose',
246
+ text: "When it loads, a stamped component doc is checked as loosely as an unstamped one, so adding `type: 'component'` to an existing doc never breaks it: `displayName` may be missing, `category` may be any string, and `usage`, `theming`, `playground` and `examples` are not checked. Each entry in a group doc's `components` must have a `name`. Write to the type anyway; it is the contract.",
247
+ },
245
248
  {
246
249
  type: 'prose',
247
250
  text: 'ComponentDoc is a discriminated union of three shapes that all extend ComponentBaseDoc. Pick the variant by which key you set: `props` (single), `components` (multi), or `subComponentOf` (sub).',
@@ -1,7 +1,7 @@
1
1
  // @generated by scripts/sync-api-types.mjs from the JSDoc in authoring/**/*.mjs.
2
2
  // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
3
 
4
- /** @typedef {import('../types').ComponentDoc} ComponentDoc */
4
+ /** @typedef {import('../types.js').ComponentDoc} ComponentDoc */
5
5
  /**
6
6
  * Validate an unknown value as a stamped component doc, or throw.
7
7
  *
@@ -10,4 +10,4 @@
10
10
  * @returns {ComponentDoc}
11
11
  */
12
12
  export function parseComponent(input: unknown, label?: string): ComponentDoc;
13
- export type ComponentDoc = import("../types").ComponentDoc;
13
+ export type ComponentDoc = import("../types.js").ComponentDoc;
@@ -8,7 +8,7 @@
8
8
  import {ComponentDocKindSchema} from '../_schema.mjs';
9
9
  import {formatZodError} from '../../_shared/errors.mjs';
10
10
 
11
- /** @typedef {import('../types').ComponentDoc} ComponentDoc */
11
+ /** @typedef {import('../types.js').ComponentDoc} ComponentDoc */
12
12
 
13
13
  /**
14
14
  * Validate an unknown value as a stamped component doc, or throw.
@@ -19,7 +19,7 @@ import type {
19
19
  HookReturnDoc,
20
20
  RegistryDocIdentity,
21
21
  UsageDoc,
22
- } from '../base/type';
22
+ } from '../base/type.js';
23
23
 
24
24
  /**
25
25
  * Shared fields between single-component and multi-component docs.
@@ -1,7 +1,7 @@
1
1
  // @generated by scripts/sync-api-types.mjs from the JSDoc in authoring/**/*.mjs.
2
2
  // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
3
 
4
- /** @typedef {import('../types').EnumDoc} EnumDoc */
4
+ /** @typedef {import('../types.js').EnumDoc} EnumDoc */
5
5
  /**
6
6
  * Validate an unknown value as a stamped enum doc, or throw.
7
7
  *
@@ -10,4 +10,4 @@
10
10
  * @returns {EnumDoc}
11
11
  */
12
12
  export function parseEnum(input: unknown, label?: string): EnumDoc;
13
- export type EnumDoc = import("../types").EnumDoc;
13
+ export type EnumDoc = import("../types.js").EnumDoc;
@@ -8,7 +8,7 @@
8
8
  import {EnumDocKindSchema} from '../_schema.mjs';
9
9
  import {formatZodError} from '../../_shared/errors.mjs';
10
10
 
11
- /** @typedef {import('../types').EnumDoc} EnumDoc */
11
+ /** @typedef {import('../types.js').EnumDoc} EnumDoc */
12
12
 
13
13
  /**
14
14
  * Validate an unknown value as a stamped enum doc, or throw.
@@ -5,7 +5,7 @@
5
5
  * discriminants). Colocated next to the source of truth it documents.
6
6
  */
7
7
 
8
- import type {AuthoredDocGraphFields} from '../base/type';
8
+ import type {AuthoredDocGraphFields} from '../base/type.js';
9
9
 
10
10
  /** One member of an enumerated vocabulary. */
11
11
  export interface EnumMemberDoc {
@@ -250,6 +250,10 @@ export const doc = {
250
250
  },
251
251
  ],
252
252
  notes: [
253
+ {
254
+ type: 'prose',
255
+ text: 'When it loads, a stamped function doc may leave out `displayName`, and its `usage` is not checked. Write to the type anyway; it is the contract.',
256
+ },
253
257
  {
254
258
  type: 'prose',
255
259
  text: "The `type` discriminant is 'function' for both flavors. Set `kind: 'hook'` or `kind: 'api'` to drive docsite sectioning; it is inferred from `importPath` when omitted.",
@@ -1,7 +1,7 @@
1
1
  // @generated by scripts/sync-api-types.mjs from the JSDoc in authoring/**/*.mjs.
2
2
  // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
3
 
4
- /** @typedef {import('../types').FunctionDoc} FunctionDoc */
4
+ /** @typedef {import('../types.js').FunctionDoc} FunctionDoc */
5
5
  /**
6
6
  * Validate an unknown value as a stamped function doc, or throw.
7
7
  *
@@ -10,4 +10,4 @@
10
10
  * @returns {FunctionDoc}
11
11
  */
12
12
  export function parseFunction(input: unknown, label?: string): FunctionDoc;
13
- export type FunctionDoc = import("../types").FunctionDoc;
13
+ export type FunctionDoc = import("../types.js").FunctionDoc;
@@ -14,7 +14,7 @@
14
14
 
15
15
  import {parseHook} from '../hook/parse.mjs';
16
16
 
17
- /** @typedef {import('../types').FunctionDoc} FunctionDoc */
17
+ /** @typedef {import('../types.js').FunctionDoc} FunctionDoc */
18
18
 
19
19
  /**
20
20
  * Validate an unknown value as a stamped function doc, or throw.
@@ -14,7 +14,7 @@ import type {
14
14
  AuthoredDocGraphFields,
15
15
  HookParamDoc,
16
16
  UsageDoc,
17
- } from '../base/type';
17
+ } from '../base/type.js';
18
18
 
19
19
  /**
20
20
  * A documented return. Hooks list named return fields (`name` set); CLI/API
@@ -200,6 +200,10 @@ export const docs = {
200
200
  },
201
201
  ],
202
202
  notes: [
203
+ {
204
+ type: 'prose',
205
+ text: 'When it loads, a hook doc may leave out `displayName`, and its `usage` is not checked. Write to the type anyway; it is the contract.',
206
+ },
203
207
  {
204
208
  type: 'prose',
205
209
  text: "A hook's discriminant is `type: 'function'`: HookDoc and FunctionDoc share the generalized function kind. HookDoc is the hook-flavored view: named `returns` fields and a required `usage` block.",
@@ -1,7 +1,7 @@
1
1
  // @generated by scripts/sync-api-types.mjs from the JSDoc in authoring/**/*.mjs.
2
2
  // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
3
 
4
- /** @typedef {import('../types').HookDoc} HookDoc */
4
+ /** @typedef {import('../types.js').HookDoc} HookDoc */
5
5
  /**
6
6
  * Validate an unknown value as a stamped function/hook doc, or throw.
7
7
  *
@@ -10,4 +10,4 @@
10
10
  * @returns {HookDoc}
11
11
  */
12
12
  export function parseHook(input: unknown, label?: string): HookDoc;
13
- export type HookDoc = import("../types").HookDoc;
13
+ export type HookDoc = import("../types.js").HookDoc;
@@ -8,7 +8,7 @@
8
8
  import {FunctionDocKindSchema} from '../_schema.mjs';
9
9
  import {formatZodError} from '../../_shared/errors.mjs';
10
10
 
11
- /** @typedef {import('../types').HookDoc} HookDoc */
11
+ /** @typedef {import('../types.js').HookDoc} HookDoc */
12
12
 
13
13
  /**
14
14
  * Validate an unknown value as a stamped function/hook doc, or throw.
@@ -12,7 +12,7 @@ import type {
12
12
  HookReturnDoc,
13
13
  RegistryDocIdentity,
14
14
  UsageDoc,
15
- } from '../base/type';
15
+ } from '../base/type.js';
16
16
 
17
17
  /**
18
18
  * Documentation for a standalone hook's .doc.mjs file.
@@ -1,9 +1,9 @@
1
1
  // @generated by scripts/sync-api-types.mjs from the JSDoc in authoring/**/*.mjs.
2
2
  // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
3
 
4
- /** @typedef {import('./types').ComponentDoc} ComponentDoc */
5
- /** @typedef {import('./types').HookDoc} HookDoc */
6
- /** @typedef {import('./types').ReferenceDoc} ReferenceDoc */
4
+ /** @typedef {import('./types.js').ComponentDoc} ComponentDoc */
5
+ /** @typedef {import('./types.js').HookDoc} HookDoc */
6
+ /** @typedef {import('./types.js').ReferenceDoc} ReferenceDoc */
7
7
  /**
8
8
  * Validate an unknown value as a legacy (unstamped) doc, or throw.
9
9
  *
@@ -12,6 +12,6 @@
12
12
  * @returns {ComponentDoc | HookDoc | ReferenceDoc}
13
13
  */
14
14
  export function parseLegacyDoc(input: unknown, label?: string): ComponentDoc | HookDoc | ReferenceDoc;
15
- export type ComponentDoc = import("./types").ComponentDoc;
16
- export type HookDoc = import("./types").HookDoc;
17
- export type ReferenceDoc = import("./types").ReferenceDoc;
15
+ export type ComponentDoc = import("./types.js").ComponentDoc;
16
+ export type HookDoc = import("./types.js").HookDoc;
17
+ export type ReferenceDoc = import("./types.js").ReferenceDoc;
@@ -10,9 +10,9 @@
10
10
  import {LegacyDocSchema} from './_schema.mjs';
11
11
  import {formatZodError} from '../_shared/errors.mjs';
12
12
 
13
- /** @typedef {import('./types').ComponentDoc} ComponentDoc */
14
- /** @typedef {import('./types').HookDoc} HookDoc */
15
- /** @typedef {import('./types').ReferenceDoc} ReferenceDoc */
13
+ /** @typedef {import('./types.js').ComponentDoc} ComponentDoc */
14
+ /** @typedef {import('./types.js').HookDoc} HookDoc */
15
+ /** @typedef {import('./types.js').ReferenceDoc} ReferenceDoc */
16
16
 
17
17
  /**
18
18
  * Validate an unknown value as a legacy (unstamped) doc, or throw.