@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
@@ -63,11 +63,13 @@ export const doc = {
63
63
  name: 'file.path',
64
64
  type: 'string',
65
65
  description: 'Absolute path to the file being transformed.',
66
+ required: true,
66
67
  },
67
68
  {
68
69
  name: 'file.source',
69
70
  type: 'string',
70
71
  description: 'The current source contents of the file.',
72
+ required: true,
71
73
  },
72
74
  ],
73
75
  },
@@ -81,18 +83,21 @@ export const doc = {
81
83
  type: 'unknown',
82
84
  description:
83
85
  'A jscodeshift instance configured with a parser for the file.',
86
+ required: true,
84
87
  },
85
88
  {
86
89
  name: 'api.stats',
87
90
  type: '(...args: unknown[]) => void',
88
91
  description:
89
92
  'Report a statistic (no-op-friendly; provided for jscodeshift parity).',
93
+ required: true,
90
94
  },
91
95
  {
92
96
  name: 'api.report',
93
97
  type: '(...args: unknown[]) => void',
94
98
  description:
95
99
  'Report progress (no-op-friendly; provided for jscodeshift parity).',
100
+ required: true,
96
101
  },
97
102
  ],
98
103
  },
@@ -100,7 +105,7 @@ export const doc = {
100
105
  },
101
106
  {
102
107
  name: 'type',
103
- type: "'code'",
108
+ type: "'code' | 'config'",
104
109
  description:
105
110
  "Discriminant for the file-transforming variant. Use 'config' for a " +
106
111
  'codemod that rewrites astryx.config.* instead (see notes).',
@@ -5,8 +5,8 @@
5
5
  * Compile-time drift-lock: sealed envelope must infer exactly the public
6
6
  * stamped-codemod union.
7
7
  *
8
- * @typedef {import('../_shared/contract').Expect<
9
- * import('../_shared/contract').Equal<
8
+ * @typedef {import('../_shared/contract.js').Expect<
9
+ * import('../_shared/contract.js').Equal<
10
10
  * z.infer<typeof codemodEnvelopeSchema>,
11
11
  * AstryxCodemod | AstryxConfigCodemod
12
12
  * >
@@ -24,10 +24,10 @@ export function parseCodemod(input: unknown, label?: string): AstryxCodemod | As
24
24
  * Compile-time drift-lock: sealed envelope must infer exactly the public
25
25
  * stamped-codemod union.
26
26
  */
27
- export type _CodemodDriftLock = import("../_shared/contract").Expect<import("../_shared/contract").Equal<z.infer<typeof codemodEnvelopeSchema>, AstryxCodemod | AstryxConfigCodemod>>;
28
- export type AstryxCodemod = import("./type").AstryxCodemod;
29
- export type AstryxConfigCodemod = import("./type").AstryxConfigCodemod;
30
- export type AstryxCodemodTransform = import("./type").AstryxCodemodTransform;
27
+ export type _CodemodDriftLock = import("../_shared/contract.js").Expect<import("../_shared/contract.js").Equal<z.infer<typeof codemodEnvelopeSchema>, AstryxCodemod | AstryxConfigCodemod>>;
28
+ export type AstryxCodemod = import("./type.js").AstryxCodemod;
29
+ export type AstryxConfigCodemod = import("./type.js").AstryxConfigCodemod;
30
+ export type AstryxCodemodTransform = import("./type.js").AstryxCodemodTransform;
31
31
  import { z } from 'zod';
32
32
  /**
33
33
  * The load-boundary contract: a stamped codemod default export, discriminated
@@ -38,13 +38,13 @@ declare const codemodEnvelopeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
38
38
  description: z.ZodOptional<z.ZodString>;
39
39
  isOptional: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
40
40
  fileExtensions: z.ZodOptional<z.ZodArray<z.ZodString>>;
41
- transform: z.ZodType<import("./type").AstryxCodemodTransform, any, z.core.$ZodTypeInternals<import("./type").AstryxCodemodTransform, any>>;
41
+ transform: z.ZodType<import("./type.js").AstryxCodemodTransform, any, z.core.$ZodTypeInternals<import("./type.js").AstryxCodemodTransform, any>>;
42
42
  type: z.ZodLiteral<"code">;
43
43
  }, z.core.$strict>, z.ZodObject<{
44
44
  title: z.ZodString;
45
45
  description: z.ZodOptional<z.ZodString>;
46
46
  isOptional: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
47
- transform: z.ZodType<import("./type").AstryxCodemodTransform, any, z.core.$ZodTypeInternals<import("./type").AstryxCodemodTransform, any>>;
47
+ transform: z.ZodType<import("./type.js").AstryxCodemodTransform, any, z.core.$ZodTypeInternals<import("./type.js").AstryxCodemodTransform, any>>;
48
48
  type: z.ZodLiteral<"config">;
49
49
  }, z.core.$strict>], "type">;
50
50
  export {};
@@ -10,12 +10,14 @@
10
10
  import {z} from 'zod';
11
11
  import {formatZodError} from '../_shared/errors.mjs';
12
12
 
13
- /** @typedef {import('./type').AstryxCodemod} AstryxCodemod */
14
- /** @typedef {import('./type').AstryxConfigCodemod} AstryxConfigCodemod */
15
- /** @typedef {import('./type').AstryxCodemodTransform} AstryxCodemodTransform */
13
+ /** @typedef {import('./type.js').AstryxCodemod} AstryxCodemod */
14
+ /** @typedef {import('./type.js').AstryxConfigCodemod} AstryxConfigCodemod */
15
+ /** @typedef {import('./type.js').AstryxCodemodTransform} AstryxCodemodTransform */
16
16
 
17
17
  const transform = /** @type {z.ZodType<AstryxCodemodTransform>} */ (
18
- z.custom(value => typeof value === 'function', {message: 'Expected a function'})
18
+ z.custom(value => typeof value === 'function', {
19
+ message: 'Expected a function',
20
+ })
19
21
  );
20
22
 
21
23
  const codeCodemodSchema = z
@@ -52,8 +54,8 @@ const codemodEnvelopeSchema = z.discriminatedUnion('type', [
52
54
  * Compile-time drift-lock: sealed envelope must infer exactly the public
53
55
  * stamped-codemod union.
54
56
  *
55
- * @typedef {import('../_shared/contract').Expect<
56
- * import('../_shared/contract').Equal<
57
+ * @typedef {import('../_shared/contract.js').Expect<
58
+ * import('../_shared/contract.js').Equal<
57
59
  * z.infer<typeof codemodEnvelopeSchema>,
58
60
  * AstryxCodemod | AstryxConfigCodemod
59
61
  * >
@@ -6,8 +6,8 @@
6
6
  * {@link AstryxConfig} type. If they drift, `Equal` becomes `false` and
7
7
  * `Expect<false>` fails the `tsconfig.authoring-contract.json` typecheck.
8
8
  *
9
- * @typedef {import('../_shared/contract').Expect<
10
- * import('../_shared/contract').MutuallyAssignable<z.infer<typeof configSchema>, AstryxConfig>
9
+ * @typedef {import('../_shared/contract.js').Expect<
10
+ * import('../_shared/contract.js').MutuallyAssignable<z.infer<typeof configSchema>, AstryxConfig>
11
11
  * >} _ConfigDriftLock
12
12
  */
13
13
  /**
@@ -23,13 +23,13 @@ export function parseConfig(input: unknown, label?: string): AstryxConfig;
23
23
  * {@link AstryxConfig} type. If they drift, `Equal` becomes `false` and
24
24
  * `Expect<false>` fails the `tsconfig.authoring-contract.json` typecheck.
25
25
  */
26
- export type _ConfigDriftLock = import("../_shared/contract").Expect<import("../_shared/contract").MutuallyAssignable<z.infer<typeof configSchema>, AstryxConfig>>;
27
- export type AstryxConfig = import("./type").AstryxConfig;
28
- export type PostCodemodHook = import("./type").PostCodemodHook;
29
- export type XleComponent = import("./type").XleComponent;
30
- export type DebugConfig = import("./type").DebugConfig;
31
- export type DebugEventHandler = import("../debug/type").DebugEventHandler;
32
- export type GapReportHandler = import("../gap-report/type").GapReportHandler;
26
+ export type _ConfigDriftLock = import("../_shared/contract.js").Expect<import("../_shared/contract.js").MutuallyAssignable<z.infer<typeof configSchema>, AstryxConfig>>;
27
+ export type AstryxConfig = import("./type.js").AstryxConfig;
28
+ export type PostCodemodHook = import("./type.js").PostCodemodHook;
29
+ export type XleComponent = import("./type.js").XleComponent;
30
+ export type DebugConfig = import("./type.js").DebugConfig;
31
+ export type DebugEventHandler = import("../debug/type.js").DebugEventHandler;
32
+ export type GapReportHandler = import("../gap-report/type.js").GapReportHandler;
33
33
  import { z } from 'zod';
34
34
  declare const configSchema: z.ZodObject<{
35
35
  integrations: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -40,14 +40,14 @@ declare const configSchema: z.ZodObject<{
40
40
  buildCommand: z.ZodType<(ctx: {
41
41
  packageDir: string;
42
42
  files: string[];
43
- }) => import("./type").PostCodemodCommand | null | undefined | Promise<import("./type").PostCodemodCommand | null | undefined>, any, z.core.$ZodTypeInternals<(ctx: {
43
+ }) => import("./type.js").PostCodemodCommand | null | undefined | Promise<import("./type.js").PostCodemodCommand | null | undefined>, any, z.core.$ZodTypeInternals<(ctx: {
44
44
  packageDir: string;
45
45
  files: string[];
46
- }) => import("./type").PostCodemodCommand | null | undefined | Promise<import("./type").PostCodemodCommand | null | undefined>, any>>;
46
+ }) => import("./type.js").PostCodemodCommand | null | undefined | Promise<import("./type.js").PostCodemodCommand | null | undefined>, any>>;
47
47
  }, z.core.$strict>>>;
48
48
  }, z.core.$strict>>;
49
- debug: z.ZodOptional<z.ZodType<import("../debug/type").DebugEventHandler, any, z.core.$ZodTypeInternals<import("../debug/type").DebugEventHandler, any>>>;
50
- gapReport: z.ZodOptional<z.ZodType<import("../gap-report/type").GapReportHandler, any, z.core.$ZodTypeInternals<import("../gap-report/type").GapReportHandler, any>>>;
49
+ debug: z.ZodOptional<z.ZodType<import("../debug/type.js").DebugEventHandler, any, z.core.$ZodTypeInternals<import("../debug/type.js").DebugEventHandler, any>>>;
50
+ gapReport: z.ZodOptional<z.ZodType<import("../gap-report/type.js").GapReportHandler, any, z.core.$ZodTypeInternals<import("../gap-report/type.js").GapReportHandler, any>>>;
51
51
  experimental: z.ZodOptional<z.ZodObject<{
52
52
  xle: z.ZodOptional<z.ZodObject<{
53
53
  components: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -13,12 +13,12 @@ import {z} from 'zod';
13
13
  import {formatZodError} from '../_shared/errors.mjs';
14
14
  import {parseGapReportHandler} from '../gap-report/parse.mjs';
15
15
 
16
- /** @typedef {import('./type').AstryxConfig} AstryxConfig */
17
- /** @typedef {import('./type').PostCodemodHook} PostCodemodHook */
18
- /** @typedef {import('./type').XleComponent} XleComponent */
19
- /** @typedef {import('./type').DebugConfig} DebugConfig */
20
- /** @typedef {import('../debug/type').DebugEventHandler} DebugEventHandler */
21
- /** @typedef {import('../gap-report/type').GapReportHandler} GapReportHandler */
16
+ /** @typedef {import('./type.js').AstryxConfig} AstryxConfig */
17
+ /** @typedef {import('./type.js').PostCodemodHook} PostCodemodHook */
18
+ /** @typedef {import('./type.js').XleComponent} XleComponent */
19
+ /** @typedef {import('./type.js').DebugConfig} DebugConfig */
20
+ /** @typedef {import('../debug/type.js').DebugEventHandler} DebugEventHandler */
21
+ /** @typedef {import('../gap-report/type.js').GapReportHandler} GapReportHandler */
22
22
 
23
23
  // Typed `z.custom` so `z.infer` reproduces the real function type (not `unknown`).
24
24
  const buildCommand = /** @type {z.ZodType<PostCodemodHook['buildCommand']>} */ (
@@ -95,8 +95,8 @@ const configSchema = z
95
95
  * {@link AstryxConfig} type. If they drift, `Equal` becomes `false` and
96
96
  * `Expect<false>` fails the `tsconfig.authoring-contract.json` typecheck.
97
97
  *
98
- * @typedef {import('../_shared/contract').Expect<
99
- * import('../_shared/contract').MutuallyAssignable<z.infer<typeof configSchema>, AstryxConfig>
98
+ * @typedef {import('../_shared/contract.js').Expect<
99
+ * import('../_shared/contract.js').MutuallyAssignable<z.infer<typeof configSchema>, AstryxConfig>
100
100
  * >} _ConfigDriftLock
101
101
  */
102
102
 
@@ -9,8 +9,8 @@
9
9
  * boundary; there is no factory to call.
10
10
  */
11
11
 
12
- import type {DebugEventHandler} from '../debug/type';
13
- import type {GapReportHandler} from '../gap-report/type';
12
+ import type {DebugEventHandler} from '../debug/type.js';
13
+ import type {GapReportHandler} from '../gap-report/type.js';
14
14
 
15
15
  /**
16
16
  * A command to run as part of a post-codemod hook. Returned by a hook's
@@ -21,7 +21,7 @@ export interface PostCodemodCommand {
21
21
  args?: string[];
22
22
  options?: {
23
23
  cwd?: string;
24
- env?: NodeJS.ProcessEnv;
24
+ env?: Record<string, string | undefined>;
25
25
  timeout?: number;
26
26
  };
27
27
  }
@@ -7,8 +7,8 @@
7
7
  * `Expect<false>` fails the `tsconfig.authoring-contract.json` typecheck —
8
8
  * so a field added to the recorder without being published here breaks CI.
9
9
  *
10
- * @typedef {import('../_shared/contract').Expect<
11
- * import('../_shared/contract').MutuallyAssignable<z.infer<typeof eventSchema>, DebugEvent>
10
+ * @typedef {import('../_shared/contract.js').Expect<
11
+ * import('../_shared/contract.js').MutuallyAssignable<z.infer<typeof eventSchema>, DebugEvent>
12
12
  * >} _DebugEventDriftLock
13
13
  */
14
14
  /**
@@ -29,8 +29,8 @@ export function parseDebugEvent(input: unknown, label?: string): DebugEvent;
29
29
  * `Expect<false>` fails the `tsconfig.authoring-contract.json` typecheck —
30
30
  * so a field added to the recorder without being published here breaks CI.
31
31
  */
32
- export type _DebugEventDriftLock = import("../_shared/contract").Expect<import("../_shared/contract").MutuallyAssignable<z.infer<typeof eventSchema>, DebugEvent>>;
33
- export type DebugEvent = import("./type").DebugEvent;
32
+ export type _DebugEventDriftLock = import("../_shared/contract.js").Expect<import("../_shared/contract.js").MutuallyAssignable<z.infer<typeof eventSchema>, DebugEvent>>;
33
+ export type DebugEvent = import("./type.js").DebugEvent;
34
34
  import { z } from 'zod';
35
35
  declare const eventSchema: z.ZodObject<{
36
36
  schemaVersion: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>]>;
@@ -22,7 +22,7 @@
22
22
  import {z} from 'zod';
23
23
  import {formatZodError} from '../_shared/errors.mjs';
24
24
 
25
- /** @typedef {import('./type').DebugEvent} DebugEvent */
25
+ /** @typedef {import('./type.js').DebugEvent} DebugEvent */
26
26
 
27
27
  const outcomeSchema = z.enum([
28
28
  'ok',
@@ -169,8 +169,8 @@ const eventSchema = z
169
169
  * `Expect<false>` fails the `tsconfig.authoring-contract.json` typecheck —
170
170
  * so a field added to the recorder without being published here breaks CI.
171
171
  *
172
- * @typedef {import('../_shared/contract').Expect<
173
- * import('../_shared/contract').MutuallyAssignable<z.infer<typeof eventSchema>, DebugEvent>
172
+ * @typedef {import('../_shared/contract.js').Expect<
173
+ * import('../_shared/contract.js').MutuallyAssignable<z.infer<typeof eventSchema>, DebugEvent>
174
174
  * >} _DebugEventDriftLock
175
175
  */
176
176
 
@@ -91,7 +91,12 @@ export const ReferenceContentBlockSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
91
91
  full: "full";
92
92
  }>>;
93
93
  }, z.core.$strict>], "type">;
94
- /** New-format stamped component doc (`type: 'component'`). */
94
+ /**
95
+ * New-format stamped component doc (`type: 'component'`): one component's
96
+ * `props`, or the `components` a group doc documents together. These are the
97
+ * shapes the published ComponentDoc type allows, and the ones an unstamped doc
98
+ * may already take.
99
+ */
95
100
  export const ComponentDocKindSchema: z.ZodObject<{
96
101
  type: z.ZodLiteral<"component">;
97
102
  theming: z.ZodOptional<z.ZodUnknown>;
@@ -119,13 +124,16 @@ export const ComponentDocKindSchema: z.ZodObject<{
119
124
  public: "public";
120
125
  internal: "internal";
121
126
  }>>;
122
- props: z.ZodArray<z.ZodObject<{
127
+ props: z.ZodOptional<z.ZodArray<z.ZodObject<{
123
128
  name: z.ZodString;
124
129
  type: z.ZodString;
125
130
  description: z.ZodString;
126
131
  default: z.ZodOptional<z.ZodString>;
127
132
  required: z.ZodOptional<z.ZodBoolean>;
128
- }, z.core.$loose>>;
133
+ }, z.core.$loose>>>;
134
+ components: z.ZodOptional<z.ZodArray<z.ZodObject<{
135
+ name: z.ZodString;
136
+ }, z.core.$loose>>>;
129
137
  }, z.core.$loose>;
130
138
  /** New-format stamped function doc (`type: 'function'`). */
131
139
  export const FunctionDocKindSchema: z.ZodObject<{
@@ -165,6 +173,26 @@ export const FunctionDocKindSchema: z.ZodObject<{
165
173
  internal: "internal";
166
174
  }>>;
167
175
  }, z.core.$loose>;
176
+ /**
177
+ * A stamped function doc as it loads: as with components, `displayName` may be
178
+ * missing and `usage` passes through unchecked.
179
+ *
180
+ * @typedef {Omit<FunctionDoc, 'type' | 'displayName' | 'usage'>
181
+ * & {type: 'function', displayName?: string, usage?: unknown}} LoadedFunctionDoc
182
+ */
183
+ /**
184
+ * @typedef {import('../_shared/contract.js').Expect<
185
+ * import('../_shared/contract.js').MutuallyAssignable<
186
+ * import('../_shared/contract.js').NamedFields<z.infer<typeof FunctionDocKindSchema>>,
187
+ * import('../_shared/contract.js').NamedFields<LoadedFunctionDoc>
188
+ * >
189
+ * >} _FunctionDocDriftLock
190
+ */
191
+ /**
192
+ * Every HookDoc is a FunctionDoc, so the one function schema covers both.
193
+ *
194
+ * @typedef {import('../_shared/contract.js').Expect<[HookDoc] extends [FunctionDoc] ? true : false>} _HookDocIsFunctionDocLock
195
+ */
168
196
  /**
169
197
  * Stamped generic reference/topic doc (`type: 'generic'`). `title` and
170
198
  * `sections` stay optional at this parser boundary for docs produced by the
@@ -289,7 +317,7 @@ export const SchemaDocKindSchema: z.ZodObject<{
289
317
  description: z.ZodString;
290
318
  namespace: z.ZodOptional<z.ZodString>;
291
319
  appliesTo: z.ZodOptional<z.ZodString>;
292
- fields: z.ZodArray<z.ZodType<import("./schema/type").SchemaFieldDoc, any, z.core.$ZodTypeInternals<import("./schema/type").SchemaFieldDoc, any>>>;
320
+ fields: z.ZodArray<z.ZodType<import("./schema/type.js").SchemaFieldDoc, any, z.core.$ZodTypeInternals<import("./schema/type.js").SchemaFieldDoc, any>>>;
293
321
  examples: z.ZodOptional<z.ZodArray<z.ZodObject<{
294
322
  label: z.ZodOptional<z.ZodString>;
295
323
  code: z.ZodString;
@@ -370,6 +398,14 @@ export const SchemaDocKindSchema: z.ZodObject<{
370
398
  internal: "internal";
371
399
  }>>;
372
400
  }, z.core.$loose>;
401
+ /**
402
+ * @typedef {import('../_shared/contract.js').Expect<
403
+ * import('../_shared/contract.js').MutuallyAssignable<
404
+ * import('../_shared/contract.js').NamedFields<z.infer<typeof SchemaDocKindSchema>>,
405
+ * import('../_shared/contract.js').NamedFields<SchemaDoc & {type: 'schema'}>
406
+ * >
407
+ * >} _SchemaDocDriftLock
408
+ */
373
409
  /** New stamped command doc (`type: 'command'`). */
374
410
  export const CommandDocKindSchema: z.ZodObject<{
375
411
  type: z.ZodLiteral<"command">;
@@ -481,6 +517,14 @@ export const CommandDocKindSchema: z.ZodObject<{
481
517
  internal: "internal";
482
518
  }>>;
483
519
  }, z.core.$loose>;
520
+ /**
521
+ * @typedef {import('../_shared/contract.js').Expect<
522
+ * import('../_shared/contract.js').MutuallyAssignable<
523
+ * import('../_shared/contract.js').NamedFields<z.infer<typeof CommandDocKindSchema>>,
524
+ * import('../_shared/contract.js').NamedFields<CommandDoc & {type: 'command'}>
525
+ * >
526
+ * >} _CommandDocDriftLock
527
+ */
484
528
  /** New stamped enum doc (`type: 'enum'`). */
485
529
  export const EnumDocKindSchema: z.ZodObject<{
486
530
  type: z.ZodLiteral<"enum">;
@@ -885,13 +929,79 @@ export const LegacyDocSchema: z.ZodUnion<readonly [z.ZodObject<{
885
929
  extends: z.ZodOptional<z.ZodString>;
886
930
  tokenCategory: z.ZodOptional<z.ZodString>;
887
931
  }, z.core.$loose>]>;
888
- export type AuthoredDocGraphFieldsType = import("./base/type").AuthoredDocGraphFields;
889
- export type AuthoredDocKind = import("./base/type").AuthoredDocKind;
890
- export type NamespaceDoc = import("./namespace/type").NamespaceDoc;
891
- export type ReferenceContentBlock = import("./reference/type").ReferenceContentBlock;
892
- export type _AuthoredDocGraphDriftLock = import("../_shared/contract").Expect<import("../_shared/contract").MutuallyAssignable<z.infer<typeof _AuthoredDocGraphSchema>, AuthoredDocGraphFieldsType>>;
893
- export type _ReferenceContentBlockDriftLock = import("../_shared/contract").Expect<import("../_shared/contract").Equal<z.infer<typeof ReferenceContentBlockSchema>, ReferenceContentBlock>>;
894
- export type _NamespaceDocDriftLock = import("../_shared/contract").Expect<import("../_shared/contract").Equal<z.infer<typeof NamespaceDocKindSchema>, NamespaceDoc>>;
932
+ export type AuthoredDocGraphFieldsType = import("./base/type.js").AuthoredDocGraphFields;
933
+ export type AuthoredDocKind = import("./base/type.js").AuthoredDocKind;
934
+ export type NamespaceDoc = import("./namespace/type.js").NamespaceDoc;
935
+ export type ReferenceContentBlock = import("./reference/type.js").ReferenceContentBlock;
936
+ export type ReferenceDoc = import("./reference/type.js").ReferenceDoc;
937
+ export type SingleComponentDoc = import("./component/type.js").SingleComponentDoc;
938
+ export type ComponentPropDoc = import("./base/type.js").ComponentPropDoc;
939
+ export type HookDoc = import("./hook/type.js").HookDoc;
940
+ export type FunctionDoc = import("./function/type.js").FunctionDoc;
941
+ export type SchemaDoc = import("./schema/type.js").SchemaDoc;
942
+ export type CommandDoc = import("./command/type.js").CommandDoc;
943
+ export type EnumDoc = import("./enum/type.js").EnumDoc;
944
+ export type _AuthoredDocKindDriftLock = import("../_shared/contract.js").Expect<import("../_shared/contract.js").Equal<z.infer<typeof AuthoredDocKindSchema>, AuthoredDocKind>>;
945
+ export type _AuthoredDocGraphDriftLock = import("../_shared/contract.js").Expect<import("../_shared/contract.js").MutuallyAssignable<z.infer<typeof _AuthoredDocGraphSchema>, AuthoredDocGraphFieldsType>>;
946
+ export type _ReferenceContentBlockDriftLock = import("../_shared/contract.js").Expect<import("../_shared/contract.js").Equal<z.infer<typeof ReferenceContentBlockSchema>, ReferenceContentBlock>>;
947
+ /**
948
+ * A stamped component doc as it loads. The loader accepts what the unstamped
949
+ * format always accepted, so stamping an existing doc never breaks it:
950
+ * `displayName` may be missing, `category` is any string, `usage`, `theming`,
951
+ * `playground` and `examples` pass through unchecked, and a doc has `props`,
952
+ * `components`, or both; each `components` entry needs only a `name`. Every
953
+ * other field matches the published type.
954
+ */
955
+ export type LoadedComponentDoc = Omit<SingleComponentDoc, "type" | "displayName" | "category" | "usage" | "theming" | "examples" | "playground" | "props"> & {
956
+ type: "component";
957
+ displayName?: string;
958
+ category?: string;
959
+ usage?: unknown;
960
+ theming?: unknown;
961
+ examples?: unknown[];
962
+ playground?: unknown;
963
+ props?: ComponentPropDoc[];
964
+ components?: Array<{
965
+ name: string;
966
+ }>;
967
+ };
968
+ export type _ComponentDocDriftLock = import("../_shared/contract.js").Expect<import("../_shared/contract.js").MutuallyAssignable<import("../_shared/contract.js").NamedFields<z.infer<typeof ComponentDocKindSchema>>, import("../_shared/contract.js").NamedFields<LoadedComponentDoc>>>;
969
+ /**
970
+ * A stamped function doc as it loads: as with components, `displayName` may be
971
+ * missing and `usage` passes through unchecked.
972
+ */
973
+ export type LoadedFunctionDoc = Omit<FunctionDoc, "type" | "displayName" | "usage"> & {
974
+ type: "function";
975
+ displayName?: string;
976
+ usage?: unknown;
977
+ };
978
+ export type _FunctionDocDriftLock = import("../_shared/contract.js").Expect<import("../_shared/contract.js").MutuallyAssignable<import("../_shared/contract.js").NamedFields<z.infer<typeof FunctionDocKindSchema>>, import("../_shared/contract.js").NamedFields<LoadedFunctionDoc>>>;
979
+ /**
980
+ * Every HookDoc is a FunctionDoc, so the one function schema covers both.
981
+ */
982
+ export type _HookDocIsFunctionDocLock = import("../_shared/contract.js").Expect<[HookDoc] extends [FunctionDoc] ? true : false>;
983
+ /**
984
+ * A stamped generic doc as the load check accepts it. `title`, `description`
985
+ * and `sections` may be missing, as in docs the v0.3.0 factory-removal codemod
986
+ * produced; `parseReference` then fills them (title from `displayName` or
987
+ * `name`, an empty description, no sections), so its result is a full
988
+ * ReferenceDoc. Only a doc with a description and sections is a usable topic
989
+ * (see `problemsInTopic`).
990
+ */
991
+ export type LoadedReferenceDoc = Omit<ReferenceDoc, "type" | "title" | "description" | "sections"> & {
992
+ type: "generic";
993
+ } & Partial<Pick<ReferenceDoc, "title" | "description" | "sections">>;
994
+ export type _ReferenceDocDriftLock = import("../_shared/contract.js").Expect<import("../_shared/contract.js").MutuallyAssignable<import("../_shared/contract.js").NamedFields<z.infer<typeof GenericDocKindSchema>>, import("../_shared/contract.js").NamedFields<LoadedReferenceDoc>>>;
995
+ export type _SchemaDocDriftLock = import("../_shared/contract.js").Expect<import("../_shared/contract.js").MutuallyAssignable<import("../_shared/contract.js").NamedFields<z.infer<typeof SchemaDocKindSchema>>, import("../_shared/contract.js").NamedFields<SchemaDoc & {
996
+ type: "schema";
997
+ }>>>;
998
+ export type _CommandDocDriftLock = import("../_shared/contract.js").Expect<import("../_shared/contract.js").MutuallyAssignable<import("../_shared/contract.js").NamedFields<z.infer<typeof CommandDocKindSchema>>, import("../_shared/contract.js").NamedFields<CommandDoc & {
999
+ type: "command";
1000
+ }>>>;
1001
+ export type _EnumDocDriftLock = import("../_shared/contract.js").Expect<import("../_shared/contract.js").MutuallyAssignable<import("../_shared/contract.js").NamedFields<z.infer<typeof EnumDocKindSchema>>, import("../_shared/contract.js").NamedFields<EnumDoc & {
1002
+ type: "enum";
1003
+ }>>>;
1004
+ export type _NamespaceDocDriftLock = import("../_shared/contract.js").Expect<import("../_shared/contract.js").Equal<z.infer<typeof NamespaceDocKindSchema>, NamespaceDoc>>;
895
1005
  import { z } from 'zod';
896
1006
  declare const _AuthoredDocGraphSchema: z.ZodObject<{
897
1007
  placement: z.ZodOptional<z.ZodObject<{