@astryxdesign/cli 0.6.3-canary.f22695a → 0.6.3
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 +1 -2
- 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 +24 -37
- package/api/docs/_adapter.mjs +83 -169
- package/api/docs/detail/detail.mjs +63 -14
- package/api/docs/detail/section/section.d.mts +1 -1
- package/api/docs/detail/section/section.mjs +20 -44
- package/api/docs/detail/section/section.test.mjs +0 -41
- package/api/docs/docs.d.mts +2 -7
- package/api/docs/docs.doc.mjs +10 -27
- package/api/docs/docs.mjs +9 -16
- package/api/docs/docs.test.mjs +0 -6
- package/api/docs/docs.type.d.mts +3 -40
- package/api/docs/docs.type.mjs +8 -36
- package/api/docs/integrationDocs.test.mjs +0 -106
- package/api/doctor/doctor.d.mts +0 -48
- package/api/doctor/doctor.mjs +0 -232
- package/api/doctor/doctor.test.mjs +0 -196
- 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 +3 -5
- 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 +7 -49
- package/api/integration/pack-check.test.mjs +0 -249
- 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 +6 -20
- package/api/theme/build/build.test.mjs +0 -127
- package/api/theme/palette/generate/generate.mjs +1 -1
- package/api/theme/palette/generate/generator.d.mts +13 -10
- package/api/theme/palette/generate/generator.mjs +3 -7
- package/api/theme/theme.type.d.mts +11 -170
- package/api/theme/theme.type.mjs +27 -94
- package/api/upgrade/_adapter.mjs +5 -71
- package/api/upgrade/upgrade.doc.mjs +3 -4
- package/api/upgrade/upgrade.type.d.mts +5 -5
- package/api/upgrade/upgrade.type.mjs +11 -11
- package/assets/codemods/integration-discovery.mjs +2 -40
- package/assets/codemods/integration-discovery.test.mjs +0 -58
- package/assets/codemods/transforms/v0.3.0/__tests__/unwrap-authoring-factories.test.mjs +5 -27
- package/assets/codemods/transforms/v0.3.0/unwrap-authoring-factories.mjs +5 -20
- package/assets/docs/README.md +0 -9
- package/assets/docs/cli-integrations.doc.mjs +15 -86
- package/assets/docs/styling-libraries.doc.mjs +1 -1
- package/assets/docs/working-with-ai.doc.mjs +1 -1
- package/assets/templates/blocks/components/Toolbar/ToolbarTableFilter.doc.mjs +3 -19
- package/assets/templates/blocks/components/Toolbar/ToolbarTableFilter.tsx +65 -383
- package/authoring/_shared/contract.ts +0 -22
- package/authoring/codemod/codemod.doc.mjs +1 -6
- package/authoring/codemod/parse.d.mts +8 -8
- package/authoring/codemod/parse.mjs +6 -8
- 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 +23 -788
- package/authoring/doctypes/_schema.mjs +39 -492
- package/authoring/doctypes/base/type.ts +0 -40
- package/authoring/doctypes/command/command.doc.mjs +2 -3
- package/authoring/doctypes/command/parse.d.mts +2 -2
- package/authoring/doctypes/command/parse.mjs +1 -1
- package/authoring/doctypes/command/type.ts +2 -3
- package/authoring/doctypes/component/component.doc.mjs +3 -6
- package/authoring/doctypes/component/parse.d.mts +2 -2
- package/authoring/doctypes/component/parse.mjs +1 -1
- package/authoring/doctypes/component/type.ts +3 -4
- package/authoring/doctypes/enum/parse.d.mts +2 -2
- package/authoring/doctypes/enum/parse.mjs +1 -1
- package/authoring/doctypes/enum/type.ts +1 -3
- package/authoring/doctypes/function/function.doc.mjs +0 -4
- package/authoring/doctypes/function/parse.d.mts +2 -2
- package/authoring/doctypes/function/parse.mjs +1 -1
- package/authoring/doctypes/function/type.ts +2 -6
- package/authoring/doctypes/hook/hook.doc.mjs +0 -4
- package/authoring/doctypes/hook/parse.d.mts +2 -2
- package/authoring/doctypes/hook/parse.mjs +1 -1
- package/authoring/doctypes/hook/type.ts +2 -3
- package/authoring/doctypes/legacy.d.mts +6 -8
- package/authoring/doctypes/legacy.mjs +4 -5
- package/authoring/doctypes/parse.d.mts +18 -20
- package/authoring/doctypes/parse.mjs +10 -16
- package/authoring/doctypes/parse.test.mjs +3 -77
- package/authoring/doctypes/reference/parse.d.mts +2 -2
- package/authoring/doctypes/reference/parse.mjs +5 -8
- package/authoring/doctypes/reference/reference.doc.mjs +4 -17
- package/authoring/doctypes/reference/type.ts +5 -51
- package/authoring/doctypes/schema/parse.d.mts +2 -2
- package/authoring/doctypes/schema/parse.mjs +1 -1
- package/authoring/doctypes/schema/type.ts +2 -3
- package/authoring/doctypes/template/parse.d.mts +1 -92
- package/authoring/doctypes/template/parse.mjs +2 -36
- package/authoring/doctypes/template/parse.test.mjs +2 -8
- package/authoring/doctypes/template/template.doc.mjs +0 -4
- package/authoring/doctypes/template/type.ts +2 -5
- package/authoring/doctypes/types.ts +9 -10
- 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/index.d.mts +0 -1
- package/authoring/index.d.ts +17 -49
- package/authoring/index.mjs +0 -1
- package/authoring/integration/integration.doc.mjs +6 -13
- package/authoring/integration/parse.d.mts +2 -2
- package/authoring/integration/parse.mjs +1 -1
- package/authoring/integration/parse.test.mjs +1 -10
- package/authoring/integration/schema.d.mts +4 -6
- package/authoring/integration/schema.mjs +3 -9
- package/authoring/integration/type.ts +6 -23
- package/authoring/shadcn/receipt.d.mts +6 -6
- package/clients/cli/commands/docs.doc.mjs +3 -13
- package/clients/cli/commands/docs.mjs +21 -121
- package/clients/cli/commands/docs.test.mjs +0 -88
- package/clients/cli/commands/integration-authoring.test.mjs +9 -13
- package/clients/cli/commands/theme-palette-generate.doc.mjs +4 -8
- package/clients/cli/commands/upgrade.doc.mjs +2 -2
- package/clients/cli/formatters/index.mjs +1 -162
- package/clients/cli/formatters/index.test.mjs +0 -91
- package/clients/cli/lib/manifest.mjs +2 -7
- package/foundation/config/project.mjs +6 -21
- package/foundation/discovery/component-discovery.d.mts +1 -1
- package/foundation/discovery/component-discovery.mjs +1 -2
- package/foundation/discovery/docs-discovery.d.mts +4 -11
- package/foundation/discovery/docs-discovery.mjs +88 -208
- package/foundation/discovery/docs-discovery.test.mjs +13 -279
- package/foundation/discovery/template-adapter.mjs +1 -2
- package/foundation/integrations/autolink.mjs +5 -12
- package/foundation/integrations/integration-warnings.mjs +0 -6
- package/foundation/integrations/integrations.d.mts +2 -46
- package/foundation/integrations/integrations.mjs +8 -167
- package/foundation/integrations/integrations.test.mjs +1 -384
- package/foundation/integrations/validate-contributions.d.mts +0 -2
- package/foundation/integrations/validate-contributions.mjs +0 -10
- package/foundation/response/json-contract.test.mjs +17 -46
- package/foundation/response/response-types.doc.mjs +1 -6
- package/package.json +11 -9
- package/api/docs/compiled-topics.test.mjs +0 -78
- package/api/docs/index/index.d.mts +0 -18
- package/api/docs/index/index.mjs +0 -32
- package/api/docs/index/index.test.mjs +0 -62
- package/api/upgrade/project-context.test.mjs +0 -272
- package/assets/docs/authoring.doc.mjs +0 -14
- package/assets/templates/blocks/components/Timer/TimerFormats.doc.mjs +0 -14
- package/assets/templates/blocks/components/Timer/TimerFormats.tsx +0 -34
- package/assets/templates/blocks/components/Timer/TimerInline.doc.mjs +0 -14
- package/assets/templates/blocks/components/Timer/TimerInline.tsx +0 -14
- package/assets/templates/blocks/components/Timer/TimerShowcase.doc.mjs +0 -13
- package/assets/templates/blocks/components/Timer/TimerShowcase.tsx +0 -47
- package/assets/templates/blocks/components/Timer/TimerTypography.doc.mjs +0 -14
- package/assets/templates/blocks/components/Timer/TimerTypography.tsx +0 -31
- package/authoring/doctypes/base/graph-fields.doc.d.mts +0 -9
- package/authoring/doctypes/base/graph-fields.doc.mjs +0 -62
- package/authoring/doctypes/load-contract.test.mjs +0 -207
- package/authoring/doctypes/namespace/namespace.doc.d.mts +0 -9
- package/authoring/doctypes/namespace/namespace.doc.mjs +0 -132
- package/authoring/doctypes/namespace/parse.d.mts +0 -12
- package/authoring/doctypes/namespace/parse.mjs +0 -25
- package/authoring/doctypes/namespace/parse.test.mjs +0 -165
- package/authoring/doctypes/namespace/type.ts +0 -71
- package/authoring/identity/identity.doc.d.mts +0 -9
- package/authoring/identity/identity.doc.mjs +0 -61
- package/authoring/identity/type.ts +0 -132
- package/foundation/discovery/authoring-self-docs.d.mts +0 -69
- package/foundation/discovery/authoring-self-docs.mjs +0 -214
- package/foundation/discovery/authoring-self-docs.test.mjs +0 -154
- package/foundation/discovery/docs-output-budget.d.mts +0 -28
- package/foundation/discovery/docs-output-budget.mjs +0 -50
- package/foundation/discovery/docs-section-key.d.mts +0 -98
- package/foundation/discovery/docs-section-key.mjs +0 -221
- package/foundation/discovery/docs-section-key.test.mjs +0 -224
- package/foundation/doc-compiler/compile.d.mts +0 -162
- package/foundation/doc-compiler/compile.mjs +0 -262
- package/foundation/doc-compiler/doc-compiler.test.mjs +0 -687
- package/foundation/doc-compiler/ir.d.mts +0 -9
- package/foundation/doc-compiler/ir.mjs +0 -287
- package/foundation/doc-compiler/lenses.d.mts +0 -33
- package/foundation/doc-compiler/lenses.mjs +0 -127
- package/foundation/identity/provider-identity.d.mts +0 -90
- package/foundation/identity/provider-identity.mjs +0 -320
- package/foundation/identity/provider-identity.test.mjs +0 -254
- package/foundation/identity/providers.d.mts +0 -7
- package/foundation/identity/providers.mjs +0 -16
- package/foundation/integrations/provider-conflicts.test.mjs +0 -125
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
/** @type {import('@astryxdesign/cli/authoring').TemplateDoc} */
|
|
4
|
-
export const doc = {
|
|
5
|
-
type: 'block',
|
|
6
|
-
exampleFor: 'Timer',
|
|
7
|
-
name: 'Timer — Formats',
|
|
8
|
-
displayName: 'Timer — Formats',
|
|
9
|
-
description:
|
|
10
|
-
'Elapsed compact units and stopwatch clock notation shown from the same start time.',
|
|
11
|
-
isReady: true,
|
|
12
|
-
aspectRatio: 16 / 9,
|
|
13
|
-
componentsUsed: ['Timer', 'Layout', 'Text'],
|
|
14
|
-
};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
'use client';
|
|
4
|
-
|
|
5
|
-
import {useState} from 'react';
|
|
6
|
-
import {Timer} from '@astryxdesign/core/Timer';
|
|
7
|
-
import {Stack} from '@astryxdesign/core/Layout';
|
|
8
|
-
import {Text} from '@astryxdesign/core/Text';
|
|
9
|
-
|
|
10
|
-
export default function TimerFormats() {
|
|
11
|
-
const [startedAt] = useState(() => Date.now() - 3_753_000);
|
|
12
|
-
|
|
13
|
-
return (
|
|
14
|
-
<Stack direction="vertical" gap={3}>
|
|
15
|
-
<Stack direction="horizontal" gap={3} vAlign="center">
|
|
16
|
-
<Text type="supporting" color="secondary">
|
|
17
|
-
Elapsed
|
|
18
|
-
</Text>
|
|
19
|
-
<Timer startTime={startedAt} type="body" color="primary" />
|
|
20
|
-
</Stack>
|
|
21
|
-
<Stack direction="horizontal" gap={3} vAlign="center">
|
|
22
|
-
<Text type="supporting" color="secondary">
|
|
23
|
-
Clock
|
|
24
|
-
</Text>
|
|
25
|
-
<Timer
|
|
26
|
-
format="clock"
|
|
27
|
-
startTime={startedAt}
|
|
28
|
-
type="body"
|
|
29
|
-
color="primary"
|
|
30
|
-
/>
|
|
31
|
-
</Stack>
|
|
32
|
-
</Stack>
|
|
33
|
-
);
|
|
34
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
/** @type {import('@astryxdesign/cli/authoring').TemplateDoc} */
|
|
4
|
-
export const doc = {
|
|
5
|
-
type: 'block',
|
|
6
|
-
exampleFor: 'Timer',
|
|
7
|
-
name: 'Timer — Inline',
|
|
8
|
-
displayName: 'Timer — Inline',
|
|
9
|
-
description:
|
|
10
|
-
'A Timer composed into status copy while inheriting the surrounding typography.',
|
|
11
|
-
isReady: true,
|
|
12
|
-
aspectRatio: 16 / 9,
|
|
13
|
-
componentsUsed: ['Timer', 'Text'],
|
|
14
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
'use client';
|
|
4
|
-
|
|
5
|
-
import {Timer} from '@astryxdesign/core/Timer';
|
|
6
|
-
import {Text} from '@astryxdesign/core/Text';
|
|
7
|
-
|
|
8
|
-
export default function TimerInline() {
|
|
9
|
-
return (
|
|
10
|
-
<Text type="body" color="primary">
|
|
11
|
-
Processing for <Timer type="inherit" color="inherit" />
|
|
12
|
-
</Text>
|
|
13
|
-
);
|
|
14
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
/** @type {import('@astryxdesign/cli/authoring').TemplateDoc} */
|
|
4
|
-
export const doc = {
|
|
5
|
-
type: 'block',
|
|
6
|
-
exampleFor: 'Timer',
|
|
7
|
-
name: 'Timer',
|
|
8
|
-
displayName: 'Timer',
|
|
9
|
-
isReady: true,
|
|
10
|
-
aspectRatio: 16 / 9,
|
|
11
|
-
isShowcase: true,
|
|
12
|
-
componentsUsed: ['Timer', 'Layout', 'Text'],
|
|
13
|
-
};
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
'use client';
|
|
4
|
-
|
|
5
|
-
import {useState} from 'react';
|
|
6
|
-
import {Timer} from '@astryxdesign/core/Timer';
|
|
7
|
-
import {Stack} from '@astryxdesign/core/Layout';
|
|
8
|
-
import {Text} from '@astryxdesign/core/Text';
|
|
9
|
-
|
|
10
|
-
export default function TimerShowcase() {
|
|
11
|
-
const [startedAt] = useState(() => Date.now() - 3_753_000);
|
|
12
|
-
|
|
13
|
-
return (
|
|
14
|
-
<Stack direction="vertical" gap={4}>
|
|
15
|
-
<Text type="large" color="primary" weight="semibold">
|
|
16
|
-
Processing
|
|
17
|
-
</Text>
|
|
18
|
-
<Stack direction="horizontal" gap={6} vAlign="center">
|
|
19
|
-
<Stack direction="vertical" gap={1}>
|
|
20
|
-
<Text type="supporting" color="secondary">
|
|
21
|
-
Elapsed
|
|
22
|
-
</Text>
|
|
23
|
-
<Timer
|
|
24
|
-
startTime={startedAt}
|
|
25
|
-
type="body"
|
|
26
|
-
size="xl"
|
|
27
|
-
color="primary"
|
|
28
|
-
weight="semibold"
|
|
29
|
-
/>
|
|
30
|
-
</Stack>
|
|
31
|
-
<Stack direction="vertical" gap={1}>
|
|
32
|
-
<Text type="supporting" color="secondary">
|
|
33
|
-
Clock
|
|
34
|
-
</Text>
|
|
35
|
-
<Timer
|
|
36
|
-
format="clock"
|
|
37
|
-
startTime={startedAt}
|
|
38
|
-
type="body"
|
|
39
|
-
size="xl"
|
|
40
|
-
color="primary"
|
|
41
|
-
weight="semibold"
|
|
42
|
-
/>
|
|
43
|
-
</Stack>
|
|
44
|
-
</Stack>
|
|
45
|
-
</Stack>
|
|
46
|
-
);
|
|
47
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
/** @type {import('@astryxdesign/cli/authoring').TemplateDoc} */
|
|
4
|
-
export const doc = {
|
|
5
|
-
type: 'block',
|
|
6
|
-
exampleFor: 'Timer',
|
|
7
|
-
name: 'Timer — Typography',
|
|
8
|
-
displayName: 'Timer — Typography',
|
|
9
|
-
description:
|
|
10
|
-
'Timer using its Timestamp-matched default typography and an emphasized override.',
|
|
11
|
-
isReady: true,
|
|
12
|
-
aspectRatio: 16 / 9,
|
|
13
|
-
componentsUsed: ['Timer', 'Layout', 'Text'],
|
|
14
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
'use client';
|
|
4
|
-
|
|
5
|
-
import {useState} from 'react';
|
|
6
|
-
import {Timer} from '@astryxdesign/core/Timer';
|
|
7
|
-
import {Stack} from '@astryxdesign/core/Layout';
|
|
8
|
-
import {Text} from '@astryxdesign/core/Text';
|
|
9
|
-
|
|
10
|
-
export default function TimerTypography() {
|
|
11
|
-
const [startedAt] = useState(() => Date.now() - 128_000);
|
|
12
|
-
|
|
13
|
-
return (
|
|
14
|
-
<Stack direction="vertical" gap={3}>
|
|
15
|
-
<Text type="supporting" color="secondary">
|
|
16
|
-
Default
|
|
17
|
-
</Text>
|
|
18
|
-
<Timer startTime={startedAt} />
|
|
19
|
-
<Text type="supporting" color="secondary">
|
|
20
|
-
Emphasized
|
|
21
|
-
</Text>
|
|
22
|
-
<Timer
|
|
23
|
-
startTime={startedAt}
|
|
24
|
-
type="body"
|
|
25
|
-
size="xl"
|
|
26
|
-
color="primary"
|
|
27
|
-
weight="semibold"
|
|
28
|
-
/>
|
|
29
|
-
</Stack>
|
|
30
|
-
);
|
|
31
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
// @generated by scripts/sync-api-types.mjs from the JSDoc in authoring/**/*.mjs.
|
|
2
|
-
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @file SchemaDoc for graph metadata shared by every authored doc kind.
|
|
6
|
-
* @position packages/cli/authoring/doctypes/base — doc-type documentation
|
|
7
|
-
*/
|
|
8
|
-
/** @type {import('@astryxdesign/cli/authoring').SchemaDoc} */
|
|
9
|
-
export const doc: import("@astryxdesign/cli/authoring").SchemaDoc;
|
|
@@ -1,62 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @file Every authored doc kind has a compile-time lock between its load check
|
|
5
|
-
* and its published type: the `_*DriftLock` typedefs in `_schema.mjs` and
|
|
6
|
-
* `template/parse.mjs`, which the strict typecheck evaluates. A lock names each
|
|
7
|
-
* place the loader is deliberately looser than the type. These tests pin that
|
|
8
|
-
* looser behavior and the published unknown-field policy, so tightening a load
|
|
9
|
-
* check is a reviewed change rather than a silent one.
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
import * as fs from 'node:fs';
|
|
13
|
-
import * as path from 'node:path';
|
|
14
|
-
import {fileURLToPath, pathToFileURL} from 'node:url';
|
|
15
|
-
import {describe, expect, it} from 'vitest';
|
|
16
|
-
import {parseDoc} from './parse.mjs';
|
|
17
|
-
import {AuthoredDocKindSchema} from './_schema.mjs';
|
|
18
|
-
import {doc as graphFieldsDoc} from './base/graph-fields.doc.mjs';
|
|
19
|
-
import {problemsInTopic} from '../../foundation/discovery/docs-discovery.mjs';
|
|
20
|
-
|
|
21
|
-
const HERE = path.dirname(fileURLToPath(import.meta.url));
|
|
22
|
-
const KINDS = AuthoredDocKindSchema.options;
|
|
23
|
-
|
|
24
|
-
/** The lock that pins each kind's load check to its published type. */
|
|
25
|
-
const LOCKS = {
|
|
26
|
-
component: '_ComponentDocDriftLock',
|
|
27
|
-
function: '_FunctionDocDriftLock',
|
|
28
|
-
generic: '_ReferenceDocDriftLock',
|
|
29
|
-
page: '_PageTemplateDocDriftLock',
|
|
30
|
-
block: '_BlockTemplateDocDriftLock',
|
|
31
|
-
schema: '_SchemaDocDriftLock',
|
|
32
|
-
command: '_CommandDocDriftLock',
|
|
33
|
-
enum: '_EnumDocDriftLock',
|
|
34
|
-
namespace: '_NamespaceDocDriftLock',
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
/** One valid example doc per kind, from the typed examples. */
|
|
38
|
-
const EXAMPLES = Object.fromEntries(
|
|
39
|
-
await Promise.all(
|
|
40
|
-
KINDS.map(async kind => {
|
|
41
|
-
const file = {generic: 'reference', function: 'function'}[kind] ?? kind;
|
|
42
|
-
const url = pathToFileURL(
|
|
43
|
-
path.join(HERE, '../../test/authoring-types', `${file}.doc.mjs`),
|
|
44
|
-
);
|
|
45
|
-
return [kind, (await import(url.href)).docs];
|
|
46
|
-
}),
|
|
47
|
-
),
|
|
48
|
-
);
|
|
49
|
-
|
|
50
|
-
describe('load check vs published type', () => {
|
|
51
|
-
it('locks every doc kind', () => {
|
|
52
|
-
const source = ['_schema.mjs', 'template/parse.mjs']
|
|
53
|
-
.map(file => fs.readFileSync(path.join(HERE, file), 'utf8'))
|
|
54
|
-
.join('\n');
|
|
55
|
-
expect(Object.keys(LOCKS).sort()).toEqual([...KINDS].sort());
|
|
56
|
-
const locks = [
|
|
57
|
-
...Object.values(LOCKS),
|
|
58
|
-
'_AuthoredDocKindDriftLock',
|
|
59
|
-
'_HookDocIsFunctionDocLock',
|
|
60
|
-
];
|
|
61
|
-
for (const lock of locks) {
|
|
62
|
-
expect(source, `${lock} is missing`).toMatch(
|
|
63
|
-
new RegExp(`\\}\\s*${lock}\\b`),
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
it('dispatches every doc kind and refuses any other', () => {
|
|
69
|
-
for (const kind of KINDS) {
|
|
70
|
-
expect(() => parseDoc(EXAMPLES[kind], `${kind}.doc.mjs`)).not.toThrow();
|
|
71
|
-
}
|
|
72
|
-
expect(() => parseDoc({type: 'widget', name: 'x'}, 'x.doc.mjs')).toThrow(
|
|
73
|
-
/unsupported type "widget"/,
|
|
74
|
-
);
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
describe('where loading is deliberately looser than the type', () => {
|
|
79
|
-
it('a stamped component needs no displayName; usage, theming and examples are unchecked', () => {
|
|
80
|
-
expect(() =>
|
|
81
|
-
parseDoc(
|
|
82
|
-
{
|
|
83
|
-
type: 'component',
|
|
84
|
-
name: 'Badge',
|
|
85
|
-
category: 'badges',
|
|
86
|
-
props: [],
|
|
87
|
-
usage: 'free text',
|
|
88
|
-
theming: 5,
|
|
89
|
-
examples: [{title: 'Basic'}],
|
|
90
|
-
},
|
|
91
|
-
'Badge.doc.mjs',
|
|
92
|
-
),
|
|
93
|
-
).not.toThrow();
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
it('each entry of a stamped group doc needs a name, and nothing more', () => {
|
|
97
|
-
const group = (/** @type {unknown[]} */ components) => ({
|
|
98
|
-
type: 'component',
|
|
99
|
-
name: 'Tabs',
|
|
100
|
-
components,
|
|
101
|
-
});
|
|
102
|
-
expect(() =>
|
|
103
|
-
parseDoc(
|
|
104
|
-
group([{name: 'Tab'}, {name: 'TabPanel', description: 'x'}]),
|
|
105
|
-
'Tabs.doc.mjs',
|
|
106
|
-
),
|
|
107
|
-
).not.toThrow();
|
|
108
|
-
for (const bad of [null, 5, 'Tab', {}, {name: ''}, {displayName: 'Tab'}]) {
|
|
109
|
-
expect(() => parseDoc(group([bad]), 'Tabs.doc.mjs')).toThrow(
|
|
110
|
-
/components\.0/,
|
|
111
|
-
);
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
it('a stamped function needs no displayName; usage is unchecked', () => {
|
|
116
|
-
expect(() =>
|
|
117
|
-
parseDoc(
|
|
118
|
-
{type: 'function', name: 'useX', params: [], returns: [], usage: 5},
|
|
119
|
-
'useX.doc.mjs',
|
|
120
|
-
),
|
|
121
|
-
).not.toThrow();
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
it('a stamped generic doc loads without title, description or sections, but is no topic', () => {
|
|
125
|
-
const doc = parseDoc({type: 'generic', name: 'notes'}, 'notes.doc.mjs');
|
|
126
|
-
expect(doc.title).toBe('notes');
|
|
127
|
-
expect(problemsInTopic(doc)).toEqual([
|
|
128
|
-
'description: expected a non-empty string',
|
|
129
|
-
'sections: expected at least one section',
|
|
130
|
-
]);
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
it('a template needs no displayName or aspectRatio and may use its own category', () => {
|
|
134
|
-
expect(() =>
|
|
135
|
-
parseDoc(
|
|
136
|
-
{type: 'block', name: 'widget-demo', category: 'components/Widget'},
|
|
137
|
-
'widget-demo.doc.mjs',
|
|
138
|
-
),
|
|
139
|
-
).not.toThrow();
|
|
140
|
-
expect(() =>
|
|
141
|
-
parseDoc(
|
|
142
|
-
{type: 'page', name: 'widget-page', category: 'Widgets'},
|
|
143
|
-
'widget-page.doc.mjs',
|
|
144
|
-
),
|
|
145
|
-
).not.toThrow();
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
it('schema, command and enum docs load only as their type allows', () => {
|
|
149
|
-
const {fields, ...schemaDoc} = EXAMPLES.schema;
|
|
150
|
-
const {summary, ...commandDoc} = EXAMPLES.command;
|
|
151
|
-
const {members, ...enumDoc} = EXAMPLES.enum;
|
|
152
|
-
expect(() => parseDoc(schemaDoc, 's.doc.mjs')).toThrow(/fields/);
|
|
153
|
-
expect(() => parseDoc(commandDoc, 'c.doc.mjs')).toThrow(/summary/);
|
|
154
|
-
expect(() => parseDoc(enumDoc, 'e.doc.mjs')).toThrow(/members/);
|
|
155
|
-
});
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
describe('unknown fields', () => {
|
|
159
|
-
const keeps = KINDS.filter(kind => {
|
|
160
|
-
try {
|
|
161
|
-
parseDoc({...EXAMPLES[kind], notAField: true}, `${kind}.doc.mjs`);
|
|
162
|
-
return true;
|
|
163
|
-
} catch {
|
|
164
|
-
return false;
|
|
165
|
-
}
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
it('match the published policy', () => {
|
|
169
|
-
const policy = graphFieldsDoc.notes
|
|
170
|
-
.map(note => ('text' in note ? note.text : ''))
|
|
171
|
-
.find(text => text.startsWith('Unknown fields'));
|
|
172
|
-
expect(policy, 'graph-fields.doc.mjs states the policy').toBeDefined();
|
|
173
|
-
const [kept, refused] = /** @type {string} */ (policy).split(
|
|
174
|
-
' docs accept',
|
|
175
|
-
);
|
|
176
|
-
const named = (/** @type {string} */ text) =>
|
|
177
|
-
[...text.matchAll(/`([a-z]+)`/g)].map(match => match[1]).sort();
|
|
178
|
-
expect(named(kept)).toEqual([...keeps].sort());
|
|
179
|
-
expect(named(refused).filter(kind => KINDS.includes(kind))).toEqual(
|
|
180
|
-
KINDS.filter(kind => !keeps.includes(kind)).sort(),
|
|
181
|
-
);
|
|
182
|
-
});
|
|
183
|
-
|
|
184
|
-
it('are refused inside sections and content blocks', () => {
|
|
185
|
-
const [section] = EXAMPLES.generic.sections;
|
|
186
|
-
expect(() =>
|
|
187
|
-
parseDoc(
|
|
188
|
-
{...EXAMPLES.generic, sections: [{...section, notAField: true}]},
|
|
189
|
-
'r.doc.mjs',
|
|
190
|
-
),
|
|
191
|
-
).toThrow();
|
|
192
|
-
expect(() =>
|
|
193
|
-
parseDoc(
|
|
194
|
-
{
|
|
195
|
-
...EXAMPLES.generic,
|
|
196
|
-
sections: [
|
|
197
|
-
{
|
|
198
|
-
...section,
|
|
199
|
-
content: [{type: 'prose', text: 'x', notAField: true}],
|
|
200
|
-
},
|
|
201
|
-
],
|
|
202
|
-
},
|
|
203
|
-
'r.doc.mjs',
|
|
204
|
-
),
|
|
205
|
-
).toThrow();
|
|
206
|
-
});
|
|
207
|
-
});
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
// @generated by scripts/sync-api-types.mjs from the JSDoc in authoring/**/*.mjs.
|
|
2
|
-
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @file SchemaDoc for NamespaceDoc, the authored hierarchy and layout owner.
|
|
6
|
-
* @position packages/cli/authoring/doctypes/namespace — doc-type documentation
|
|
7
|
-
*/
|
|
8
|
-
/** @type {import('@astryxdesign/cli/authoring').SchemaDoc} */
|
|
9
|
-
export const doc: import("@astryxdesign/cli/authoring").SchemaDoc;
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @file SchemaDoc for NamespaceDoc, the authored hierarchy and layout owner.
|
|
5
|
-
* @position packages/cli/authoring/doctypes/namespace — doc-type documentation
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
/** @type {import('@astryxdesign/cli/authoring').SchemaDoc} */
|
|
9
|
-
export const doc = {
|
|
10
|
-
type: 'schema',
|
|
11
|
-
name: 'namespace-doc',
|
|
12
|
-
displayName: 'NamespaceDoc',
|
|
13
|
-
namespace: 'authoring',
|
|
14
|
-
description:
|
|
15
|
-
"Declares named navigation slots and renderer-neutral layout blocks for already-discovered docs. It never scans folders or copies child documents. Not loaded yet: only the docs graph reads namespace docs, and it is not built, so keep them out of an integration's docs directory for now.",
|
|
16
|
-
appliesTo: '<namespace>.doc.mjs',
|
|
17
|
-
fields: [
|
|
18
|
-
{
|
|
19
|
-
name: 'type',
|
|
20
|
-
type: "'namespace'",
|
|
21
|
-
description: 'Doc-kind discriminant.',
|
|
22
|
-
required: true,
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
name: 'name',
|
|
26
|
-
type: 'string',
|
|
27
|
-
description:
|
|
28
|
-
'Stable provider-local identity. Moving the namespace does not change this value.',
|
|
29
|
-
required: true,
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
name: 'title',
|
|
33
|
-
type: 'string',
|
|
34
|
-
description: 'Human-readable page title.',
|
|
35
|
-
required: true,
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
name: 'summary',
|
|
39
|
-
type: 'string',
|
|
40
|
-
description: 'One-line summary used in listings and search results.',
|
|
41
|
-
required: true,
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
name: 'placement',
|
|
45
|
-
type: 'DocPlacement',
|
|
46
|
-
description:
|
|
47
|
-
'Optional canonical parent request: {parent, slot?, order?}. Invalid explicit placement will fail compilation instead of falling back.',
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
name: 'aliases',
|
|
51
|
-
type: 'string[]',
|
|
52
|
-
description:
|
|
53
|
-
'Prior names or routes the docs graph will keep resolving to this doc.',
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
name: 'audience',
|
|
57
|
-
type: "'public' | 'internal'",
|
|
58
|
-
description: "Bundle audience. Defaults to 'public'.",
|
|
59
|
-
default: "'public'",
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
name: 'keywords',
|
|
63
|
-
type: 'string[]',
|
|
64
|
-
description: 'Search terms not already present in the title or summary.',
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
name: 'slots',
|
|
68
|
-
type: 'Record<string, NamespaceSlot>',
|
|
69
|
-
description:
|
|
70
|
-
'Named placement and collection targets. Each slot declares a title and accepted doc kinds; configured providers require an explicit extension slot.',
|
|
71
|
-
required: true,
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
name: 'adopts',
|
|
75
|
-
type: 'NamespaceAdoptionRule[]',
|
|
76
|
-
description:
|
|
77
|
-
'Provider-local rules that adopt otherwise-unplaced docs from a logical discovery group. They never scan a folder.',
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
name: 'blocks',
|
|
81
|
-
type: 'ReferenceContentBlock[]',
|
|
82
|
-
description:
|
|
83
|
-
'Ordered layout content. V1 adds only workflow, collection, and reference to the existing prose, heading, code, table, list, and token-ref blocks.',
|
|
84
|
-
},
|
|
85
|
-
],
|
|
86
|
-
examples: [
|
|
87
|
-
{
|
|
88
|
-
label: 'A CLI namespace with one adopted source group',
|
|
89
|
-
code: `/** @type {import('@astryxdesign/cli/authoring').NamespaceDoc} */
|
|
90
|
-
export const docs = {
|
|
91
|
-
type: 'namespace',
|
|
92
|
-
name: 'cli',
|
|
93
|
-
title: 'Astryx CLI',
|
|
94
|
-
summary: 'Commands, APIs, and integration authoring.',
|
|
95
|
-
slots: {
|
|
96
|
-
guides: {title: 'Guides', accepts: {kinds: ['namespace', 'generic']}},
|
|
97
|
-
reference: {
|
|
98
|
-
title: 'Reference',
|
|
99
|
-
accepts: {kinds: ['namespace', 'command']},
|
|
100
|
-
},
|
|
101
|
-
},
|
|
102
|
-
adopts: [{
|
|
103
|
-
source: {group: 'cli-commands', kinds: ['command']},
|
|
104
|
-
into: 'reference',
|
|
105
|
-
}],
|
|
106
|
-
blocks: [
|
|
107
|
-
{type: 'collection', source: {slot: 'guides'}, presentation: 'cards'},
|
|
108
|
-
{type: 'collection', source: {slot: 'reference'}, presentation: 'compact'},
|
|
109
|
-
],
|
|
110
|
-
};`,
|
|
111
|
-
},
|
|
112
|
-
],
|
|
113
|
-
notes: [
|
|
114
|
-
{
|
|
115
|
-
type: 'prose',
|
|
116
|
-
text: "Namespace docs are not loaded yet. Only the docs graph reads them, and it is not built. A namespace doc in an integration's docs directory fails to load as a topic, and with it every topic that package contributes, until the file is removed.",
|
|
117
|
-
},
|
|
118
|
-
{
|
|
119
|
-
type: 'prose',
|
|
120
|
-
text: 'Child docs request one canonical home with placement. Collections store and render stable references to those docs; they never create a second identity or parent.',
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
type: 'list',
|
|
124
|
-
style: 'dont',
|
|
125
|
-
items: [
|
|
126
|
-
'Use a directory as implicit navigation.',
|
|
127
|
-
'Put JSX, HTML, ANSI, callbacks, or custom renderer code in a doc.',
|
|
128
|
-
'Use choice, callout, or checklist blocks before the full block-extension contract exists.',
|
|
129
|
-
],
|
|
130
|
-
},
|
|
131
|
-
],
|
|
132
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
// @generated by scripts/sync-api-types.mjs from the JSDoc in authoring/**/*.mjs.
|
|
2
|
-
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
|
-
|
|
4
|
-
/** @typedef {import('../types.js').NamespaceDoc} NamespaceDoc */
|
|
5
|
-
/**
|
|
6
|
-
* Validate an unknown value as a NamespaceDoc, or throw a readable error.
|
|
7
|
-
* @param {unknown} input
|
|
8
|
-
* @param {string} [label]
|
|
9
|
-
* @returns {NamespaceDoc}
|
|
10
|
-
*/
|
|
11
|
-
export function parseNamespace(input: unknown, label?: string): NamespaceDoc;
|
|
12
|
-
export type NamespaceDoc = import("../types.js").NamespaceDoc;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @file Namespace doc parser. Zod is sealed in `../_schema.mjs`; consumers call
|
|
5
|
-
* `parseNamespace` or use `parseDoc`.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import {NamespaceDocKindSchema} from '../_schema.mjs';
|
|
9
|
-
import {formatZodError} from '../../_shared/errors.mjs';
|
|
10
|
-
|
|
11
|
-
/** @typedef {import('../types.js').NamespaceDoc} NamespaceDoc */
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Validate an unknown value as a NamespaceDoc, or throw a readable error.
|
|
15
|
-
* @param {unknown} input
|
|
16
|
-
* @param {string} [label]
|
|
17
|
-
* @returns {NamespaceDoc}
|
|
18
|
-
*/
|
|
19
|
-
export function parseNamespace(input, label = 'namespace doc') {
|
|
20
|
-
const result = NamespaceDocKindSchema.safeParse(input);
|
|
21
|
-
if (!result.success) {
|
|
22
|
-
throw new Error(formatZodError(label, result.error));
|
|
23
|
-
}
|
|
24
|
-
return result.data;
|
|
25
|
-
}
|