@astryxdesign/cli 0.6.3-canary.ea2f048 → 0.6.3-canary.ebaebc4
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.
- package/README.md +2 -1
- package/api/build/build.type.d.mts +2 -2
- package/api/build/build.type.mjs +2 -2
- package/api/component/component.type.d.mts +6 -6
- package/api/component/component.type.mjs +19 -19
- package/api/discover/discover.type.d.mts +4 -4
- package/api/discover/discover.type.mjs +10 -10
- package/api/docs/_adapter.d.mts +37 -24
- package/api/docs/_adapter.mjs +169 -83
- package/api/docs/compiled-topics.test.mjs +78 -0
- package/api/docs/detail/detail.mjs +14 -63
- package/api/docs/detail/section/section.d.mts +1 -1
- package/api/docs/detail/section/section.mjs +44 -20
- package/api/docs/detail/section/section.test.mjs +41 -0
- package/api/docs/docs.d.mts +7 -2
- package/api/docs/docs.doc.mjs +27 -10
- package/api/docs/docs.mjs +16 -9
- package/api/docs/docs.test.mjs +6 -0
- package/api/docs/docs.type.d.mts +40 -3
- package/api/docs/docs.type.mjs +36 -8
- package/api/docs/index/index.d.mts +18 -0
- package/api/docs/index/index.mjs +32 -0
- package/api/docs/index/index.test.mjs +62 -0
- package/api/docs/integrationDocs.test.mjs +106 -0
- package/api/doctor/doctor.d.mts +48 -0
- package/api/doctor/doctor.mjs +232 -0
- package/api/doctor/doctor.test.mjs +196 -0
- package/api/hook/hook.type.d.mts +3 -3
- package/api/hook/hook.type.mjs +11 -11
- package/api/hook/list/list.d.mts +1 -1
- package/api/integration/add-contribution.mjs +5 -3
- package/api/integration/add-contribution.test.mjs +4 -4
- package/api/integration/integration-authoring.type.d.mts +1 -1
- package/api/integration/pack-check.mjs +49 -7
- package/api/integration/pack-check.test.mjs +249 -0
- package/api/search/search.d.mts +1 -1
- package/api/search/search.mjs +5 -5
- package/api/search/search.type.d.mts +2 -2
- package/api/search/search.type.mjs +1 -1
- package/api/swizzle/swizzle.type.d.mts +2 -2
- package/api/swizzle/swizzle.type.mjs +2 -2
- package/api/template/template.d.mts +1 -1
- package/api/template/template.type.d.mts +6 -6
- package/api/template/template.type.mjs +12 -12
- package/api/theme/build/build.mjs +20 -6
- package/api/theme/build/build.test.mjs +127 -0
- package/api/theme/palette/generate/generate.mjs +1 -1
- package/api/theme/palette/generate/generator.d.mts +10 -13
- package/api/theme/palette/generate/generator.mjs +7 -3
- package/api/theme/theme.type.d.mts +170 -11
- package/api/theme/theme.type.mjs +94 -27
- package/api/upgrade/_adapter.mjs +71 -5
- package/api/upgrade/project-context.test.mjs +272 -0
- package/api/upgrade/upgrade.doc.mjs +4 -3
- package/api/upgrade/upgrade.type.d.mts +5 -5
- package/api/upgrade/upgrade.type.mjs +11 -11
- package/assets/codemods/integration-discovery.mjs +40 -2
- package/assets/codemods/integration-discovery.test.mjs +58 -0
- package/assets/codemods/transforms/v0.3.0/__tests__/unwrap-authoring-factories.test.mjs +27 -5
- package/assets/codemods/transforms/v0.3.0/unwrap-authoring-factories.mjs +20 -5
- package/assets/docs/README.md +9 -0
- package/assets/docs/authoring.doc.mjs +14 -0
- package/assets/docs/cli-integrations.doc.mjs +86 -15
- package/assets/docs/styling-libraries.doc.mjs +1 -1
- package/assets/docs/working-with-ai.doc.mjs +1 -1
- package/authoring/_shared/contract.ts +22 -0
- package/authoring/codemod/codemod.doc.mjs +6 -1
- package/authoring/codemod/parse.d.mts +8 -8
- package/authoring/codemod/parse.mjs +8 -6
- package/authoring/config/parse.d.mts +13 -13
- package/authoring/config/parse.mjs +8 -8
- package/authoring/config/type.ts +3 -3
- package/authoring/debug/parse.d.mts +5 -5
- package/authoring/debug/parse.mjs +3 -3
- package/authoring/doctypes/_schema.d.mts +788 -23
- package/authoring/doctypes/_schema.mjs +492 -39
- package/authoring/doctypes/base/graph-fields.doc.d.mts +9 -0
- package/authoring/doctypes/base/graph-fields.doc.mjs +62 -0
- package/authoring/doctypes/base/type.ts +40 -0
- package/authoring/doctypes/command/command.doc.mjs +3 -2
- package/authoring/doctypes/command/parse.d.mts +2 -2
- package/authoring/doctypes/command/parse.mjs +1 -1
- package/authoring/doctypes/command/type.ts +3 -2
- package/authoring/doctypes/component/component.doc.mjs +6 -3
- package/authoring/doctypes/component/parse.d.mts +2 -2
- package/authoring/doctypes/component/parse.mjs +1 -1
- package/authoring/doctypes/component/type.ts +4 -3
- package/authoring/doctypes/enum/parse.d.mts +2 -2
- package/authoring/doctypes/enum/parse.mjs +1 -1
- package/authoring/doctypes/enum/type.ts +3 -1
- package/authoring/doctypes/function/function.doc.mjs +4 -0
- package/authoring/doctypes/function/parse.d.mts +2 -2
- package/authoring/doctypes/function/parse.mjs +1 -1
- package/authoring/doctypes/function/type.ts +6 -2
- package/authoring/doctypes/hook/hook.doc.mjs +4 -0
- package/authoring/doctypes/hook/parse.d.mts +2 -2
- package/authoring/doctypes/hook/parse.mjs +1 -1
- package/authoring/doctypes/hook/type.ts +3 -2
- package/authoring/doctypes/legacy.d.mts +8 -6
- package/authoring/doctypes/legacy.mjs +5 -4
- package/authoring/doctypes/load-contract.test.mjs +207 -0
- package/authoring/doctypes/namespace/namespace.doc.d.mts +9 -0
- package/authoring/doctypes/namespace/namespace.doc.mjs +132 -0
- package/authoring/doctypes/namespace/parse.d.mts +12 -0
- package/authoring/doctypes/namespace/parse.mjs +25 -0
- package/authoring/doctypes/namespace/parse.test.mjs +165 -0
- package/authoring/doctypes/namespace/type.ts +71 -0
- package/authoring/doctypes/parse.d.mts +20 -18
- package/authoring/doctypes/parse.mjs +16 -10
- package/authoring/doctypes/parse.test.mjs +77 -3
- package/authoring/doctypes/reference/parse.d.mts +2 -2
- package/authoring/doctypes/reference/parse.mjs +8 -5
- package/authoring/doctypes/reference/reference.doc.mjs +17 -4
- package/authoring/doctypes/reference/type.ts +51 -5
- package/authoring/doctypes/schema/parse.d.mts +2 -2
- package/authoring/doctypes/schema/parse.mjs +1 -1
- package/authoring/doctypes/schema/type.ts +3 -2
- package/authoring/doctypes/template/parse.d.mts +92 -1
- package/authoring/doctypes/template/parse.mjs +36 -2
- package/authoring/doctypes/template/parse.test.mjs +8 -2
- package/authoring/doctypes/template/template.doc.mjs +4 -0
- package/authoring/doctypes/template/type.ts +5 -2
- package/authoring/doctypes/types.ts +10 -9
- package/authoring/gap-report/parse.d.mts +10 -10
- package/authoring/gap-report/parse.mjs +6 -6
- package/authoring/gap-report/type.ts +1 -1
- package/authoring/identity/identity.doc.d.mts +9 -0
- package/authoring/identity/identity.doc.mjs +61 -0
- package/authoring/identity/type.ts +132 -0
- package/authoring/index.d.mts +1 -0
- package/authoring/index.d.ts +49 -17
- package/authoring/index.mjs +1 -0
- package/authoring/integration/integration.doc.mjs +13 -6
- package/authoring/integration/parse.d.mts +2 -2
- package/authoring/integration/parse.mjs +1 -1
- package/authoring/integration/parse.test.mjs +10 -1
- package/authoring/integration/schema.d.mts +6 -4
- package/authoring/integration/schema.mjs +9 -3
- package/authoring/integration/type.ts +23 -6
- package/authoring/shadcn/receipt.d.mts +6 -6
- package/clients/cli/commands/docs.doc.mjs +13 -3
- package/clients/cli/commands/docs.mjs +121 -21
- package/clients/cli/commands/docs.test.mjs +88 -0
- package/clients/cli/commands/integration-authoring.test.mjs +13 -9
- package/clients/cli/commands/theme-palette-generate.doc.mjs +8 -4
- package/clients/cli/commands/upgrade.doc.mjs +2 -2
- package/clients/cli/formatters/index.mjs +162 -1
- package/clients/cli/formatters/index.test.mjs +91 -0
- package/clients/cli/lib/manifest.mjs +7 -2
- package/foundation/config/project.mjs +21 -6
- package/foundation/discovery/authoring-self-docs.d.mts +69 -0
- package/foundation/discovery/authoring-self-docs.mjs +214 -0
- package/foundation/discovery/authoring-self-docs.test.mjs +154 -0
- package/foundation/discovery/component-discovery.d.mts +1 -1
- package/foundation/discovery/component-discovery.mjs +2 -1
- package/foundation/discovery/docs-discovery.d.mts +11 -4
- package/foundation/discovery/docs-discovery.mjs +208 -88
- package/foundation/discovery/docs-discovery.test.mjs +279 -13
- package/foundation/discovery/docs-output-budget.d.mts +28 -0
- package/foundation/discovery/docs-output-budget.mjs +50 -0
- package/foundation/discovery/docs-section-key.d.mts +98 -0
- package/foundation/discovery/docs-section-key.mjs +221 -0
- package/foundation/discovery/docs-section-key.test.mjs +224 -0
- package/foundation/discovery/template-adapter.mjs +2 -1
- package/foundation/discovery/theming-targets.test.mjs +4 -0
- package/foundation/doc-compiler/compile.d.mts +162 -0
- package/foundation/doc-compiler/compile.mjs +262 -0
- package/foundation/doc-compiler/doc-compiler.test.mjs +687 -0
- package/foundation/doc-compiler/ir.d.mts +9 -0
- package/foundation/doc-compiler/ir.mjs +287 -0
- package/foundation/doc-compiler/lenses.d.mts +33 -0
- package/foundation/doc-compiler/lenses.mjs +127 -0
- package/foundation/identity/provider-identity.d.mts +90 -0
- package/foundation/identity/provider-identity.mjs +320 -0
- package/foundation/identity/provider-identity.test.mjs +254 -0
- package/foundation/identity/providers.d.mts +7 -0
- package/foundation/identity/providers.mjs +16 -0
- package/foundation/integrations/autolink.mjs +12 -5
- package/foundation/integrations/integration-warnings.mjs +6 -0
- package/foundation/integrations/integrations.d.mts +46 -2
- package/foundation/integrations/integrations.mjs +167 -8
- package/foundation/integrations/integrations.test.mjs +384 -1
- package/foundation/integrations/provider-conflicts.test.mjs +125 -0
- package/foundation/integrations/validate-contributions.d.mts +2 -0
- package/foundation/integrations/validate-contributions.mjs +10 -0
- package/foundation/response/json-contract.test.mjs +46 -17
- package/foundation/response/response-types.doc.mjs +6 -1
- package/package.json +9 -11
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file SchemaDoc for graph metadata shared by every authored doc kind.
|
|
5
|
+
* @position packages/cli/authoring/doctypes/base — doc-type documentation
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/** @type {import('@astryxdesign/cli/authoring').SchemaDoc} */
|
|
9
|
+
export const doc = {
|
|
10
|
+
type: 'schema',
|
|
11
|
+
name: 'authored-doc-graph-fields',
|
|
12
|
+
displayName: 'Authored doc graph fields',
|
|
13
|
+
namespace: 'authoring',
|
|
14
|
+
description:
|
|
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
|
+
appliesTo: 'Every supported .doc.mjs object',
|
|
17
|
+
fields: [
|
|
18
|
+
{
|
|
19
|
+
name: 'placement',
|
|
20
|
+
type: 'DocPlacement',
|
|
21
|
+
description:
|
|
22
|
+
'Requests one canonical parent in the docs graph. Not read yet: a topic that sets it fails to load.',
|
|
23
|
+
fields: [
|
|
24
|
+
{
|
|
25
|
+
name: 'placement.parent',
|
|
26
|
+
type: 'string',
|
|
27
|
+
description: 'Stable reference to the requested parent namespace.',
|
|
28
|
+
required: true,
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: 'placement.slot',
|
|
32
|
+
type: 'string',
|
|
33
|
+
description: 'Named slot owned by the parent namespace.',
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: 'placement.order',
|
|
37
|
+
type: 'number',
|
|
38
|
+
description: 'Integer sibling order within the slot.',
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: 'aliases',
|
|
44
|
+
type: 'string[]',
|
|
45
|
+
description:
|
|
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
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: 'audience',
|
|
50
|
+
type: "'public' | 'internal'",
|
|
51
|
+
description:
|
|
52
|
+
"Which docs bundle includes this doc ('public' when omitted). Not read yet: a topic that sets it fails to load.",
|
|
53
|
+
default: "'public'",
|
|
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
|
+
],
|
|
62
|
+
};
|
|
@@ -4,6 +4,46 @@
|
|
|
4
4
|
* @file Shared leaf primitives used across the doc types.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
/** Every authored documentation kind accepted by `parseDoc`. */
|
|
8
|
+
export type AuthoredDocKind =
|
|
9
|
+
| 'component'
|
|
10
|
+
| 'function'
|
|
11
|
+
| 'generic'
|
|
12
|
+
| 'page'
|
|
13
|
+
| 'block'
|
|
14
|
+
| 'schema'
|
|
15
|
+
| 'command'
|
|
16
|
+
| 'enum'
|
|
17
|
+
| 'namespace';
|
|
18
|
+
|
|
19
|
+
/** Visibility of an authored doc in a compiled audience-specific bundle. */
|
|
20
|
+
export type DocAudience = 'public' | 'internal';
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Optional canonical placement request. The compiler resolves `parent` as a
|
|
24
|
+
* stable doc reference. `slot` selects one parent-owned slot, and `order`
|
|
25
|
+
* provides deterministic sibling ordering inside that slot.
|
|
26
|
+
*/
|
|
27
|
+
export interface DocPlacement {
|
|
28
|
+
parent: string;
|
|
29
|
+
slot?: string;
|
|
30
|
+
order?: number;
|
|
31
|
+
}
|
|
32
|
+
|
|
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
|
+
*/
|
|
38
|
+
export interface AuthoredDocGraphFields {
|
|
39
|
+
/** Requested canonical parent in the docs graph. Not read yet. */
|
|
40
|
+
placement?: DocPlacement;
|
|
41
|
+
/** Prior routes or names the docs graph will keep resolving. Not read yet. */
|
|
42
|
+
aliases?: string[];
|
|
43
|
+
/** Docs bundle audience; omit for public docs. Not read yet. */
|
|
44
|
+
audience?: DocAudience;
|
|
45
|
+
}
|
|
46
|
+
|
|
7
47
|
/**
|
|
8
48
|
* Stable public identity for generated registry resources.
|
|
9
49
|
*
|
|
@@ -135,8 +135,9 @@ export const doc = {
|
|
|
135
135
|
},
|
|
136
136
|
{
|
|
137
137
|
name: 'options[].default',
|
|
138
|
-
type: 'string',
|
|
139
|
-
description:
|
|
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,7 +9,8 @@
|
|
|
9
9
|
* `--help`. Colocated at `clients/cli/commands/<name>.doc.mjs`.
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
import type {
|
|
12
|
+
import type {AuthoredDocGraphFields} from '../base/type.js';
|
|
13
|
+
import type {ReferenceContentBlock} from '../reference/type.js';
|
|
13
14
|
|
|
14
15
|
/** A positional argument. `param` links it to a FunctionDoc param for its description. */
|
|
15
16
|
export interface CommandArgDoc {
|
|
@@ -53,7 +54,7 @@ export interface CommandExampleDoc {
|
|
|
53
54
|
* /\*\* @type {import('@astryxdesign/cli/authoring').CommandDoc} \*\/
|
|
54
55
|
* export const doc = { type: 'command', name: 'search', fn: 'search', ... };
|
|
55
56
|
*/
|
|
56
|
-
export interface CommandDoc {
|
|
57
|
+
export interface CommandDoc extends AuthoredDocGraphFields {
|
|
57
58
|
/** Doc-kind discriminant. */
|
|
58
59
|
type?: 'command';
|
|
59
60
|
/** Command path, e.g. 'search' | 'theme build'. */
|
|
@@ -56,7 +56,7 @@ export const doc = {
|
|
|
56
56
|
name: 'keywords',
|
|
57
57
|
type: 'string[]',
|
|
58
58
|
description:
|
|
59
|
-
'Search keywords for CLI discovery: synonyms and related UI concepts from other design systems (MUI, Chakra, Radix,
|
|
59
|
+
'Search keywords for CLI discovery: synonyms and related UI concepts from other design systems (MUI, Chakra, Radix, and others). Lowercase. Used by `astryx component <term>` fuzzy matching.',
|
|
60
60
|
},
|
|
61
61
|
{
|
|
62
62
|
name: 'hiddenComponents',
|
|
@@ -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.
|
|
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.
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import type {
|
|
8
|
+
AuthoredDocGraphFields,
|
|
8
9
|
ComponentAccessibilityRequirement,
|
|
9
10
|
ComponentAnatomyElement,
|
|
10
11
|
ComponentBestPractice,
|
|
@@ -18,13 +19,13 @@ import type {
|
|
|
18
19
|
HookReturnDoc,
|
|
19
20
|
RegistryDocIdentity,
|
|
20
21
|
UsageDoc,
|
|
21
|
-
} from '../base/type';
|
|
22
|
+
} from '../base/type.js';
|
|
22
23
|
|
|
23
24
|
/**
|
|
24
25
|
* Shared fields between single-component and multi-component docs.
|
|
25
26
|
* Do not use this interface directly — use `ComponentDoc` (the union type).
|
|
26
27
|
*/
|
|
27
|
-
export interface ComponentBaseDoc {
|
|
28
|
+
export interface ComponentBaseDoc extends AuthoredDocGraphFields {
|
|
28
29
|
/** Doc-kind discriminant for the stamped default-export format
|
|
29
30
|
* (`export default { type: 'component', ... }`). Optional: legacy
|
|
30
31
|
* `export const docs = {...}` docs omit it, and `parseDoc` falls back to
|
|
@@ -49,7 +50,7 @@ export interface ComponentBaseDoc {
|
|
|
49
50
|
import?: string;
|
|
50
51
|
/** Search keywords for CLI discovery. Terms a developer might type when
|
|
51
52
|
* looking for this component: synonyms, related UI concepts, and common
|
|
52
|
-
* names from other design systems (MUI, Chakra, Radix,
|
|
53
|
+
* names from other design systems (MUI, Chakra, Radix, and others).
|
|
53
54
|
* Lowercase only. Used by `astryx component <term>` for fuzzy matching.
|
|
54
55
|
* e.g. `['accordion', 'expand', 'toggle', 'disclosure']` for Collapsible */
|
|
55
56
|
keywords?: string[];
|
|
@@ -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,6 +5,8 @@
|
|
|
5
5
|
* discriminants). Colocated next to the source of truth it documents.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
import type {AuthoredDocGraphFields} from '../base/type.js';
|
|
9
|
+
|
|
8
10
|
/** One member of an enumerated vocabulary. */
|
|
9
11
|
export interface EnumMemberDoc {
|
|
10
12
|
/** The literal value, e.g. 'ERR_UNKNOWN_TOPIC' | 'component.list'. */
|
|
@@ -21,7 +23,7 @@ export interface EnumMemberDoc {
|
|
|
21
23
|
* /\*\* @type {import('@astryxdesign/cli/authoring').EnumDoc} \*\/
|
|
22
24
|
* export const doc = { type: 'enum', name: 'error-codes', ... };
|
|
23
25
|
*/
|
|
24
|
-
export interface EnumDoc {
|
|
26
|
+
export interface EnumDoc extends AuthoredDocGraphFields {
|
|
25
27
|
/** Doc-kind discriminant. */
|
|
26
28
|
type?: 'enum';
|
|
27
29
|
/** URL-safe identifier, used as the docs slug within its namespace. */
|
|
@@ -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.
|
|
@@ -10,7 +10,11 @@
|
|
|
10
10
|
* here — the function does not know it has a CLI.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import type {
|
|
13
|
+
import type {
|
|
14
|
+
AuthoredDocGraphFields,
|
|
15
|
+
HookParamDoc,
|
|
16
|
+
UsageDoc,
|
|
17
|
+
} from '../base/type.js';
|
|
14
18
|
|
|
15
19
|
/**
|
|
16
20
|
* A documented return. Hooks list named return fields (`name` set); CLI/API
|
|
@@ -45,7 +49,7 @@ export interface FunctionExampleDoc {
|
|
|
45
49
|
* /\*\* @type {import('@astryxdesign/cli/authoring').FunctionDoc} \*\/
|
|
46
50
|
* export const doc = { type: 'function', kind: 'api', name: 'search', ... };
|
|
47
51
|
*/
|
|
48
|
-
export interface FunctionDoc {
|
|
52
|
+
export interface FunctionDoc extends AuthoredDocGraphFields {
|
|
49
53
|
/** Doc-kind discriminant (shared with hooks). */
|
|
50
54
|
type?: 'function';
|
|
51
55
|
/** Export name, e.g. 'search' | 'useMediaQuery'. */
|
|
@@ -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.
|
|
@@ -5,13 +5,14 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import type {
|
|
8
|
+
AuthoredDocGraphFields,
|
|
8
9
|
ComponentAccessibilityRequirement,
|
|
9
10
|
ComponentBestPractice,
|
|
10
11
|
HookParamDoc,
|
|
11
12
|
HookReturnDoc,
|
|
12
13
|
RegistryDocIdentity,
|
|
13
14
|
UsageDoc,
|
|
14
|
-
} from '../base/type';
|
|
15
|
+
} from '../base/type.js';
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* Documentation for a standalone hook's .doc.mjs file.
|
|
@@ -27,7 +28,7 @@ import type {
|
|
|
27
28
|
* /\*\* @type {import('@astryxdesign/cli/authoring').HookDoc} \*\/
|
|
28
29
|
* export const docs = { ... };
|
|
29
30
|
*/
|
|
30
|
-
export interface HookDoc {
|
|
31
|
+
export interface HookDoc extends AuthoredDocGraphFields {
|
|
31
32
|
/** Doc-kind discriminant for the stamped default-export format
|
|
32
33
|
* (`export default { type: 'function', ... }`). Optional: legacy
|
|
33
34
|
* `export const docs = {...}` docs omit it. */
|
|
@@ -1,15 +1,17 @@
|
|
|
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 */
|
|
4
|
+
/** @typedef {import('./types.js').ComponentDoc} ComponentDoc */
|
|
5
|
+
/** @typedef {import('./types.js').HookDoc} HookDoc */
|
|
6
|
+
/** @typedef {import('./types.js').ReferenceDoc} ReferenceDoc */
|
|
6
7
|
/**
|
|
7
8
|
* Validate an unknown value as a legacy (unstamped) doc, or throw.
|
|
8
9
|
*
|
|
9
10
|
* @param {unknown} input
|
|
10
11
|
* @param {string} [label]
|
|
11
|
-
* @returns {ComponentDoc | HookDoc}
|
|
12
|
+
* @returns {ComponentDoc | HookDoc | ReferenceDoc}
|
|
12
13
|
*/
|
|
13
|
-
export function parseLegacyDoc(input: unknown, label?: string): ComponentDoc | HookDoc;
|
|
14
|
-
export type ComponentDoc = import("./types").ComponentDoc;
|
|
15
|
-
export type HookDoc = import("./types").HookDoc;
|
|
14
|
+
export function parseLegacyDoc(input: unknown, label?: string): ComponentDoc | HookDoc | 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,20 +10,21 @@
|
|
|
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 */
|
|
13
|
+
/** @typedef {import('./types.js').ComponentDoc} ComponentDoc */
|
|
14
|
+
/** @typedef {import('./types.js').HookDoc} HookDoc */
|
|
15
|
+
/** @typedef {import('./types.js').ReferenceDoc} ReferenceDoc */
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* Validate an unknown value as a legacy (unstamped) doc, or throw.
|
|
18
19
|
*
|
|
19
20
|
* @param {unknown} input
|
|
20
21
|
* @param {string} [label]
|
|
21
|
-
* @returns {ComponentDoc | HookDoc}
|
|
22
|
+
* @returns {ComponentDoc | HookDoc | ReferenceDoc}
|
|
22
23
|
*/
|
|
23
24
|
export function parseLegacyDoc(input, label = 'doc') {
|
|
24
25
|
const result = LegacyDocSchema.safeParse(input);
|
|
25
26
|
if (!result.success) {
|
|
26
27
|
throw new Error(formatZodError(label, result.error));
|
|
27
28
|
}
|
|
28
|
-
return /** @type {ComponentDoc | HookDoc} */ (result.data);
|
|
29
|
+
return /** @type {ComponentDoc | HookDoc | ReferenceDoc} */ (result.data);
|
|
29
30
|
}
|