@astryxdesign/cli 0.6.3-canary.98a2e4e → 0.6.3-canary.a860a50
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 +32 -18
- package/api/build/build.doc.mjs +3 -3
- package/api/build/build.test.mjs +14 -3
- package/api/build/build.type.d.mts +36 -2
- package/api/build/build.type.mjs +25 -4
- package/api/build/help/help.d.mts +8 -5
- package/api/build/help/help.mjs +56 -6
- package/api/component/component.doc.mjs +11 -2
- package/api/component/component.mjs +29 -0
- package/api/component/component.test.mjs +38 -0
- package/api/component/component.type.d.mts +17 -7
- package/api/component/component.type.mjs +27 -20
- package/api/discover/discover.doc.mjs +1 -1
- package/api/discover/discover.type.d.mts +4 -4
- package/api/discover/discover.type.mjs +10 -10
- package/api/docs/_adapter.d.mts +30 -27
- package/api/docs/_adapter.mjs +154 -124
- package/api/docs/compiled-topics.test.mjs +78 -0
- package/api/docs/detail/detail.d.mts +0 -15
- package/api/docs/detail/detail.mjs +14 -78
- package/api/docs/detail/section/section.mjs +22 -18
- package/api/docs/detail/section/section.test.mjs +4 -3
- package/api/docs/docs.type.d.mts +4 -4
- package/api/docs/docs.type.mjs +10 -10
- package/api/docs/index/index.mjs +6 -5
- package/api/doctor/doctor.mjs +3 -7
- package/api/gap-report/gap-report.doc.mjs +7 -4
- package/api/hook/hook.type.d.mts +3 -3
- package/api/hook/hook.type.mjs +11 -11
- package/api/init/init.doc.mjs +4 -0
- package/api/init/init.test.mjs +41 -1
- package/api/init/remove/remove.mjs +1 -1
- package/api/init/run/run.mjs +20 -10
- package/api/integration/add-contribution.component-names.test.mjs +120 -0
- package/api/integration/add-contribution.mjs +16 -3
- package/api/integration/add-contribution.test.mjs +84 -4
- package/api/integration/integrationAdd.doc.mjs +7 -4
- package/api/integration/integrationAddComponent.doc.mjs +1 -1
- package/api/integration/pack-check.mjs +49 -7
- package/api/integration/pack-check.test.mjs +249 -0
- package/api/integration/validate-integration.mjs +2 -0
- package/api/integration/validate-integration.test.mjs +91 -0
- package/api/integration/validateIntegration.doc.mjs +1 -1
- package/api/json/envelope-types.test.mjs +76 -0
- package/api/json/parseResponse.doc.mjs +2 -2
- package/api/layout/expand/expand.mjs +7 -5
- package/api/layout/expand/expand.path-safety.test.mjs +53 -0
- package/api/layout/grammar/grammar.mjs +2 -1
- package/api/layout/layoutExpand.doc.mjs +1 -1
- package/api/search/search-return-type.test.mjs +54 -0
- package/api/search/search.d.mts +2 -9
- package/api/search/search.doc.mjs +5 -1
- package/api/search/search.mjs +15 -8
- package/api/search/search.test.mjs +34 -0
- package/api/search/search.type.d.mts +1 -1
- package/api/search/search.type.mjs +1 -1
- package/api/swizzle/copy/copy.mjs +28 -11
- package/api/swizzle/swizzle.doc.mjs +1 -1
- package/api/swizzle/swizzle.type.d.mts +2 -2
- package/api/swizzle/swizzle.type.mjs +2 -2
- package/api/template/copy/copy.mjs +17 -23
- package/api/template/copy/copy.test.mjs +17 -0
- package/api/template/template.doc.mjs +2 -1
- package/api/template/template.type.d.mts +5 -5
- package/api/template/template.type.mjs +12 -12
- package/api/theme/add/add.binary.test.mjs +91 -0
- package/api/theme/add/add.mjs +15 -2
- package/api/theme/build/build.mjs +133 -42
- package/api/theme/build/build.public-component-vars.test.mjs +1 -1
- package/api/theme/build/build.receipt-doc.test.mjs +111 -0
- package/api/theme/build/build.test.mjs +127 -0
- package/api/theme/build/font-warning.mjs +3 -3
- package/api/theme/build/font-warning.test.mjs +5 -2
- package/api/theme/palette/generate/generate.mjs +8 -3
- package/api/theme/palette/generate/generate.test.mjs +96 -0
- package/api/theme/palette/generate/generator.d.mts +10 -13
- package/api/theme/palette/generate/generator.mjs +15 -4
- package/api/theme/palette/generate/generator.test.mjs +10 -0
- package/api/theme/template/template.mjs +11 -2
- package/api/theme/template/template.test.mjs +15 -0
- package/api/theme/theme.type.d.mts +170 -11
- package/api/theme/theme.type.mjs +94 -27
- package/api/theme/themeBuild.doc.mjs +7 -4
- package/api/theme/themeTemplate.doc.mjs +4 -1
- package/api/upgrade/_adapter.mjs +27 -4
- package/api/upgrade/list/list.mjs +2 -1
- package/api/upgrade/list/list.test.mjs +73 -0
- package/api/upgrade/status/status.mjs +2 -2
- package/api/upgrade/upgrade.doc.mjs +2 -1
- package/api/upgrade/upgrade.type.d.mts +8 -4
- package/api/upgrade/upgrade.type.mjs +11 -10
- package/assets/codemods/integration-discovery.mjs +40 -2
- package/assets/codemods/integration-discovery.test.mjs +58 -0
- package/assets/codemods/term-log.mjs +32 -8
- package/assets/codemods/term-log.test.mjs +19 -1
- 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/codemods/transforms/v0.6.0/__tests__/next-codemods.test.mjs +47 -0
- package/assets/codemods/transforms/v0.6.0/rename-resizable-pixel-bounds.mjs +57 -10
- package/assets/docs/cli-integrations.doc.mjs +9 -0
- package/assets/docs/styling-libraries.doc.mjs +1 -1
- package/assets/docs/working-with-ai.doc.mjs +1 -1
- package/assets/templates/pages/table-tree/page.tsx +1704 -0
- package/assets/templates/pages/table-tree/template.doc.mjs +12 -0
- 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/config.doc.mjs +1 -1
- package/authoring/config/debug-composition.test.mjs +92 -0
- package/authoring/config/parse.d.mts +13 -13
- package/authoring/config/parse.mjs +8 -8
- package/authoring/config/type.ts +18 -6
- package/authoring/debug/parse.d.mts +4 -4
- package/authoring/debug/parse.mjs +3 -3
- package/authoring/doctypes/_schema.d.mts +121 -11
- package/authoring/doctypes/_schema.mjs +144 -13
- package/authoring/doctypes/base/graph-fields.doc.mjs +11 -4
- package/authoring/doctypes/base/type.ts +8 -4
- 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 +2 -2
- package/authoring/doctypes/component/component.doc.mjs +5 -2
- package/authoring/doctypes/component/parse.d.mts +2 -2
- package/authoring/doctypes/component/parse.mjs +1 -1
- package/authoring/doctypes/component/type.ts +1 -1
- package/authoring/doctypes/enum/parse.d.mts +2 -2
- package/authoring/doctypes/enum/parse.mjs +1 -1
- package/authoring/doctypes/enum/type.ts +1 -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 +1 -1
- 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 +1 -1
- package/authoring/doctypes/legacy.d.mts +6 -6
- package/authoring/doctypes/legacy.mjs +3 -3
- package/authoring/doctypes/load-contract.test.mjs +207 -0
- package/authoring/doctypes/namespace/namespace.doc.mjs +7 -3
- package/authoring/doctypes/namespace/parse.d.mts +2 -2
- package/authoring/doctypes/namespace/parse.mjs +1 -1
- package/authoring/doctypes/namespace/type.ts +2 -2
- package/authoring/doctypes/parse.d.mts +18 -18
- package/authoring/doctypes/parse.mjs +9 -9
- package/authoring/doctypes/reference/parse.d.mts +2 -2
- package/authoring/doctypes/reference/parse.mjs +1 -1
- package/authoring/doctypes/reference/reference.doc.mjs +6 -2
- package/authoring/doctypes/reference/type.ts +1 -1
- package/authoring/doctypes/schema/parse.d.mts +2 -2
- package/authoring/doctypes/schema/parse.mjs +1 -1
- package/authoring/doctypes/schema/type.ts +2 -2
- package/authoring/doctypes/template/parse.d.mts +92 -1
- package/authoring/doctypes/template/parse.mjs +33 -1
- package/authoring/doctypes/template/template.doc.mjs +4 -0
- package/authoring/doctypes/template/type.ts +4 -1
- package/authoring/doctypes/types.ts +10 -10
- package/authoring/gap-report/parse.d.mts +9 -9
- package/authoring/gap-report/parse.mjs +6 -6
- package/authoring/gap-report/type.ts +1 -1
- package/authoring/identity/identity.doc.mjs +3 -2
- package/authoring/identity/type.ts +10 -10
- package/authoring/index.d.ts +19 -19
- package/authoring/integration/parse.d.mts +2 -2
- package/authoring/integration/parse.mjs +1 -1
- package/authoring/integration/schema.d.mts +4 -4
- package/authoring/integration/schema.mjs +3 -3
- package/authoring/integration/type.ts +1 -1
- package/clients/cli/command-load-failure.test.mjs +83 -0
- package/clients/cli/commands/blog.mjs +23 -8
- package/clients/cli/commands/blog.test.mjs +42 -1
- package/clients/cli/commands/build-theme.ascii-output.test.mjs +161 -0
- package/clients/cli/commands/build-theme.flag-docs.test.mjs +110 -0
- package/clients/cli/commands/build-theme.mjs +5 -5
- package/clients/cli/commands/build-theme.path-safety.test.mjs +86 -1
- package/clients/cli/commands/build-theme.variants.test.mjs +76 -0
- package/clients/cli/commands/build.doc.mjs +4 -1
- package/clients/cli/commands/build.exit-codes-doc.test.mjs +50 -0
- package/clients/cli/commands/build.mjs +32 -47
- package/clients/cli/commands/build.playbook.test.mjs +75 -0
- package/clients/cli/commands/build.text-fields.test.mjs +40 -0
- package/clients/cli/commands/component/index.mjs +2 -7
- package/clients/cli/commands/component-package.test.mjs +18 -0
- package/clients/cli/commands/component-resolution.test.mjs +21 -0
- package/clients/cli/commands/component.test.mjs +19 -0
- package/clients/cli/commands/detail-levels.test.mjs +2 -2
- package/clients/cli/commands/discover.broken-integration.test.mjs +48 -0
- package/clients/cli/commands/discover.components-flag.test.mjs +97 -0
- package/clients/cli/commands/discover.doc.mjs +4 -2
- package/clients/cli/commands/discover.mjs +3 -3
- package/clients/cli/commands/discover.text-projection.test.mjs +103 -0
- package/clients/cli/commands/doctor-integration.package-json.test.mjs +53 -0
- package/clients/cli/commands/doctor.mjs +6 -16
- package/clients/cli/commands/doctor.test.mjs +42 -0
- package/clients/cli/commands/gap-report.doc.mjs +16 -5
- package/clients/cli/commands/gap-report.test.mjs +72 -0
- package/clients/cli/commands/hook/index.mjs +7 -17
- package/clients/cli/commands/hook.text-projection.test.mjs +45 -0
- package/clients/cli/commands/init.doc.mjs +19 -8
- package/clients/cli/commands/init.flag-help.test.mjs +153 -0
- package/clients/cli/commands/integration-add.controls.test.mjs +132 -0
- package/clients/cli/commands/integration-add.doc.mjs +21 -5
- package/clients/cli/commands/integration-authoring.test.mjs +13 -9
- package/clients/cli/commands/interactive-guard.test.mjs +101 -24
- package/clients/cli/commands/json-contract.test.mjs +33 -0
- package/clients/cli/commands/layout-check.doc.mjs +14 -3
- package/clients/cli/commands/layout-expand.doc.mjs +21 -4
- package/clients/cli/commands/layout.doc.mjs +2 -2
- package/clients/cli/commands/layout.mjs +21 -9
- package/clients/cli/commands/layout.path-help.test.mjs +33 -0
- package/clients/cli/commands/layout.stdin-cap.test.mjs +47 -0
- package/clients/cli/commands/layout.text-fields.test.mjs +39 -0
- package/clients/cli/commands/no-prompt-wording.test.mjs +94 -0
- package/clients/cli/commands/search.doc.mjs +5 -2
- package/clients/cli/commands/search.mjs +13 -2
- package/clients/cli/commands/search.test.mjs +61 -0
- package/clients/cli/commands/swizzle.doc.mjs +2 -1
- package/clients/cli/commands/swizzle.path-safety.test.mjs +42 -0
- package/clients/cli/commands/template.doc.mjs +28 -6
- package/clients/cli/commands/template.flag-help.test.mjs +117 -0
- package/clients/cli/commands/template.path-help.test.mjs +40 -0
- package/clients/cli/commands/theme-add.doc.mjs +2 -1
- package/clients/cli/commands/theme-build.doc.mjs +7 -6
- package/clients/cli/commands/theme-palette-generate.test.mjs +19 -0
- package/clients/cli/commands/theme-template.behavior.test.mjs +12 -0
- package/clients/cli/commands/theme-template.doc.mjs +1 -1
- package/clients/cli/commands/upgrade.ascii-output.test.mjs +87 -0
- package/clients/cli/commands/upgrade.doc.mjs +17 -6
- package/clients/cli/commands/upgrade.flag-help.test.mjs +188 -0
- package/clients/cli/commands/upgrade.hook-output.test.mjs +88 -0
- package/clients/cli/index.mjs +13 -30
- package/clients/cli/latest-version-env.test.mjs +50 -0
- package/clients/cli/lib/cli-error.test.mjs +7 -0
- package/clients/cli/lib/component-format.mjs +9 -9
- package/clients/cli/lib/component-format.test.mjs +1 -1
- package/clients/cli/lib/define-command.mjs +32 -6
- package/clients/cli/lib/doc-text-ascii.test.mjs +82 -0
- package/clients/cli/lib/exit-codes.test.mjs +97 -0
- package/clients/cli/lib/hook-format.mjs +5 -5
- package/clients/cli/lib/json-shim.mjs +38 -2
- package/clients/cli/lib/json-shim.test.mjs +83 -0
- package/clients/cli/lib/manifest.d.ts +2 -0
- package/clients/cli/lib/manifest.mjs +22 -0
- package/clients/cli/lib/manifest.test.mjs +17 -0
- package/foundation/agent-docs/agent-docs.d.mts +4 -0
- package/foundation/agent-docs/agent-docs.mjs +69 -3
- package/foundation/agent-docs/agent-docs.path-safety.test.mjs +266 -4
- package/foundation/config/integration-debug.test.mjs +28 -3
- package/foundation/config/project.mjs +123 -9
- package/foundation/config/project.test.mjs +126 -0
- package/foundation/discovery/authoring-self-docs.test.mjs +71 -12
- package/foundation/discovery/docs-discovery.d.mts +4 -0
- package/foundation/discovery/docs-discovery.mjs +16 -2
- package/foundation/discovery/docs-discovery.test.mjs +47 -11
- package/foundation/discovery/template-adapter.d.mts +14 -5
- package/foundation/discovery/template-adapter.fixture-refs.test.mjs +248 -0
- package/foundation/discovery/template-adapter.integration-isolation.test.mjs +94 -0
- package/foundation/discovery/template-adapter.mjs +292 -25
- 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/fs/module-loader.d.mts +1 -0
- package/foundation/fs/module-loader.mjs +50 -1
- package/foundation/fs/module-loader.stdout.test.mjs +332 -0
- package/foundation/fs/path-safety.d.mts +3 -2
- package/foundation/fs/path-safety.mjs +49 -19
- package/foundation/fs/path-safety.test.mjs +50 -0
- package/foundation/fs/publish-file-hardlink-unavailable.test.mjs +129 -94
- package/foundation/integrations/autolink.mjs +6 -1
- package/foundation/response/base.d.ts +8 -4
- package/foundation/response/error-codes.doc.mjs +1 -2
- package/foundation/response/error-codes.mjs +1 -1
- package/foundation/response/error-codes.test.mjs +83 -0
- package/foundation/response/json-contract.test.mjs +11 -0
- package/foundation/response/json.d.mts +4 -2
- package/foundation/response/json.mjs +8 -10
- package/foundation/response/response-types.doc.mjs +3 -3
- package/foundation/xle/expand.d.mts +2 -0
- package/foundation/xle/expand.mjs +3 -2
- package/foundation/xle/expand.test.mjs +54 -0
- package/package.json +9 -11
- package/clients/cli/lib/update-check.mjs +0 -83
- package/clients/cli/lib/update-check.test.mjs +0 -137
- package/clients/cli/update-hint-commands.test.mjs +0 -54
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/** @type {import('@astryxdesign/cli/authoring').TemplateDoc} */
|
|
4
|
+
export const doc = {
|
|
5
|
+
type: 'page',
|
|
6
|
+
name: 'Tree Table',
|
|
7
|
+
displayName: 'Tree Table',
|
|
8
|
+
description:
|
|
9
|
+
'Hierarchical table where every parent row rolls up from its children — a code repository whose folders show the newest commit beneath them, beside a detail sidebar and a rendered README. Columns resize, siblings sort within their own level, arrow keys walk the rows, and search prunes the tree to matching branches. Tree, hierarchy, nested rows, drilldown, expand, collapse, resizable, expandable, file browser, repository, rolled-up parents.',
|
|
10
|
+
isReady: true,
|
|
11
|
+
category: 'Table - Tree/Hierarchical List',
|
|
12
|
+
};
|
|
@@ -28,5 +28,27 @@ export type MutuallyAssignable<A, B> = [A] extends [B]
|
|
|
28
28
|
: false
|
|
29
29
|
: false;
|
|
30
30
|
|
|
31
|
+
/**
|
|
32
|
+
* `T` without string or number index signatures, at every depth. A
|
|
33
|
+
* `.passthrough()` schema infers one and a hand-written interface never has
|
|
34
|
+
* one, so a lock drops them before comparing named fields. Recursive fields
|
|
35
|
+
* that a schema casts to their public type compare equal by construction.
|
|
36
|
+
*/
|
|
37
|
+
export type NamedFields<T> = T extends readonly (infer U)[]
|
|
38
|
+
? NamedFields<U>[]
|
|
39
|
+
: T extends (...args: never[]) => unknown
|
|
40
|
+
? T
|
|
41
|
+
: T extends object
|
|
42
|
+
? {
|
|
43
|
+
[
|
|
44
|
+
K in keyof T as string extends K
|
|
45
|
+
? never
|
|
46
|
+
: number extends K
|
|
47
|
+
? never
|
|
48
|
+
: K
|
|
49
|
+
]: NamedFields<T[K]>;
|
|
50
|
+
}
|
|
51
|
+
: T;
|
|
52
|
+
|
|
31
53
|
/** Compiles only when `T` is exactly `true`; otherwise a type error. */
|
|
32
54
|
export type Expect<T extends true> = T;
|
|
@@ -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', {
|
|
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
|
* >
|
|
@@ -48,7 +48,7 @@ export const doc = {
|
|
|
48
48
|
name: 'debug',
|
|
49
49
|
type: '(event: DebugEvent) => void',
|
|
50
50
|
description:
|
|
51
|
-
'Record every command run. The handler is synchronous; promises are not awaited and output goes to stderr. Declare `debug` directly in this file so early commands can discover it. An integration can supply one too, as a `debug` named export from its manifest
|
|
51
|
+
'Record every command run. The handler is synchronous; promises are not awaited and output goes to stderr. Declare `debug` directly in this file so early commands can discover it. An integration can supply one too, as a `debug` named export from its manifest. Every handler runs: yours first, then each integration\'s in load order (the `integrations` list, then autolinked ones). A handler that throws is skipped; the others still run and the command\'s result does not change. Set `{"astryx": {"inheritDebug": false}}` in package.json to take only your own.',
|
|
52
52
|
example:
|
|
53
53
|
"event => appendFileSync('runs.ndjson', JSON.stringify(event) + '\\n')",
|
|
54
54
|
},
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file `debug` accepts handlers from integrations, so both public entries for
|
|
5
|
+
* it — the exported `AstryxConfig` type and `astryx docs authoring config` —
|
|
6
|
+
* must state how those handlers combine with the app's own: the contribution
|
|
7
|
+
* form, the order, what a failing handler does, and the refusal control.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import * as fs from 'node:fs';
|
|
11
|
+
import * as path from 'node:path';
|
|
12
|
+
import {fileURLToPath} from 'node:url';
|
|
13
|
+
import ts from 'typescript';
|
|
14
|
+
import {describe, expect, it} from 'vitest';
|
|
15
|
+
import {doc} from './config.doc.mjs';
|
|
16
|
+
|
|
17
|
+
const TYPE_FILE = path.join(
|
|
18
|
+
path.dirname(fileURLToPath(import.meta.url)),
|
|
19
|
+
'type.ts',
|
|
20
|
+
);
|
|
21
|
+
const source = ts.createSourceFile(
|
|
22
|
+
TYPE_FILE,
|
|
23
|
+
fs.readFileSync(TYPE_FILE, 'utf8'),
|
|
24
|
+
ts.ScriptTarget.Latest,
|
|
25
|
+
true,
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
/** @param {ts.Node} node @returns {string} */
|
|
29
|
+
function jsdocText(node) {
|
|
30
|
+
return ts
|
|
31
|
+
.getJSDocCommentsAndTags(node)
|
|
32
|
+
.map(jsdoc => ts.getTextOfJSDocComment(jsdoc.comment) ?? '')
|
|
33
|
+
.join('\n');
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** @param {(node: ts.Node) => boolean} match @returns {ts.Node} */
|
|
37
|
+
function findTopLevel(match) {
|
|
38
|
+
const node = source.statements.find(match);
|
|
39
|
+
if (!node) throw new Error('declaration not found in config/type.ts');
|
|
40
|
+
return node;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const configInterface = /** @type {ts.InterfaceDeclaration} */ (
|
|
44
|
+
findTopLevel(
|
|
45
|
+
node => ts.isInterfaceDeclaration(node) && node.name.text === 'AstryxConfig',
|
|
46
|
+
)
|
|
47
|
+
);
|
|
48
|
+
const debugMember = configInterface.members.find(
|
|
49
|
+
member =>
|
|
50
|
+
ts.isPropertySignature(member) && member.name.getText(source) === 'debug',
|
|
51
|
+
);
|
|
52
|
+
if (!debugMember) throw new Error('AstryxConfig has no debug member');
|
|
53
|
+
|
|
54
|
+
const debugConfigAlias = findTopLevel(
|
|
55
|
+
node => ts.isTypeAliasDeclaration(node) && node.name.text === 'DebugConfig',
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
const schemaField = doc.fields.find(field => field.name === 'debug');
|
|
59
|
+
|
|
60
|
+
const ENTRIES = {
|
|
61
|
+
'the AstryxConfig type': jsdocText(debugMember),
|
|
62
|
+
'astryx docs authoring config': schemaField?.description ?? '',
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
describe.each(Object.entries(ENTRIES))('debug entry in %s', (_, text) => {
|
|
66
|
+
it('says integrations contribute, and in what form', () => {
|
|
67
|
+
expect(text).toMatch(/integration/i);
|
|
68
|
+
expect(text).toMatch(/`debug` named export/);
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it('says every handler runs, the app first, then integrations in load order', () => {
|
|
72
|
+
expect(text).toMatch(/\bfirst\b/i);
|
|
73
|
+
expect(text).toMatch(/load order/i);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
it('says a handler that throws is skipped without affecting the others', () => {
|
|
77
|
+
expect(text).toMatch(/throws is skipped/i);
|
|
78
|
+
expect(text).toMatch(/others still run/i);
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
it('names the one control that refuses inherited handlers', () => {
|
|
82
|
+
expect(text).toContain('{"astryx": {"inheritDebug": false}}');
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
describe('DebugConfig', () => {
|
|
87
|
+
it('does not claim that leaving debug out records nothing', () => {
|
|
88
|
+
const text = jsdocText(debugConfigAlias);
|
|
89
|
+
expect(text).not.toMatch(/nothing is recorded/i);
|
|
90
|
+
expect(text).toMatch(/integration/i);
|
|
91
|
+
});
|
|
92
|
+
});
|
|
@@ -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
|
|
package/authoring/config/type.ts
CHANGED
|
@@ -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?:
|
|
24
|
+
env?: Record<string, string | undefined>;
|
|
25
25
|
timeout?: number;
|
|
26
26
|
};
|
|
27
27
|
}
|
|
@@ -56,8 +56,9 @@ export interface XleComponent {
|
|
|
56
56
|
/**
|
|
57
57
|
* Record every astryx command run in this project.
|
|
58
58
|
*
|
|
59
|
-
* A function that receives each run.
|
|
60
|
-
*
|
|
59
|
+
* A function that receives each run. Leaving it out does not stop a handler an
|
|
60
|
+
* integration contributes; see {@link AstryxConfig.debug} for how the two
|
|
61
|
+
* combine and how to refuse inherited handlers.
|
|
61
62
|
*
|
|
62
63
|
* ```
|
|
63
64
|
* export default {
|
|
@@ -80,7 +81,18 @@ export interface AstryxConfig {
|
|
|
80
81
|
hooks?: {
|
|
81
82
|
postCodemod?: PostCodemodHook[];
|
|
82
83
|
};
|
|
83
|
-
/**
|
|
84
|
+
/**
|
|
85
|
+
* Record every astryx command run in this project. See {@link DebugConfig}.
|
|
86
|
+
*
|
|
87
|
+
* An integration can contribute a handler too, as a `debug` named export
|
|
88
|
+
* from its `astryx.integration.*` module. Every handler receives the run:
|
|
89
|
+
* this one first, then each integration's in load order (the ones
|
|
90
|
+
* `integrations` lists, in that order, then autolinked ones). A handler that
|
|
91
|
+
* throws is skipped; the others still run and the command's result does not
|
|
92
|
+
* change. To refuse inherited handlers, set
|
|
93
|
+
* `{"astryx": {"inheritDebug": false}}` in the project's package.json; this
|
|
94
|
+
* handler still runs.
|
|
95
|
+
*/
|
|
84
96
|
debug?: DebugConfig;
|
|
85
97
|
/** Route gap reports through a project-owned handler. See {@link GapReportHandler}. */
|
|
86
98
|
gapReport?: GapReportHandler;
|
|
@@ -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
|
-
/**
|
|
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
|
|
893
|
-
export type
|
|
894
|
-
export type
|
|
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<{
|