@astryxdesign/cli 0.6.3-canary.98a2e4e → 0.6.3-canary.9e4c545
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/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/index/index.mjs +6 -5
- package/api/doctor/doctor.mjs +3 -7
- package/api/search/search.mjs +5 -5
- 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/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 +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/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/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/package.json +9 -9
|
@@ -11,4 +11,95 @@
|
|
|
11
11
|
* @returns {TemplateDoc}
|
|
12
12
|
*/
|
|
13
13
|
export function parseTemplate(input: unknown, label?: string): TemplateDoc;
|
|
14
|
-
export type TemplateDoc = import("../types").TemplateDoc;
|
|
14
|
+
export type TemplateDoc = import("../types.js").TemplateDoc;
|
|
15
|
+
export type PageTemplateDoc = import("./type.js").PageTemplateDoc;
|
|
16
|
+
export type BlockTemplateDoc = import("./type.js").BlockTemplateDoc;
|
|
17
|
+
/**
|
|
18
|
+
* Templates as they load. Integration templates already published omit
|
|
19
|
+
* `displayName` and `aspectRatio` and group themselves under their own
|
|
20
|
+
* `category`, so the loader accepts those (template discovery falls back to an
|
|
21
|
+
* aspect ratio of 1). The published types keep asking authors for all three.
|
|
22
|
+
*/
|
|
23
|
+
export type LoadedPageTemplateDoc = Omit<PageTemplateDoc, "displayName" | "category"> & {
|
|
24
|
+
displayName?: string;
|
|
25
|
+
category?: string;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Templates as they load. Integration templates already published omit
|
|
29
|
+
* `displayName` and `aspectRatio` and group themselves under their own
|
|
30
|
+
* `category`, so the loader accepts those (template discovery falls back to an
|
|
31
|
+
* aspect ratio of 1). The published types keep asking authors for all three.
|
|
32
|
+
*/
|
|
33
|
+
export type LoadedBlockTemplateDoc = Omit<BlockTemplateDoc, "displayName" | "aspectRatio" | "category"> & {
|
|
34
|
+
displayName?: string;
|
|
35
|
+
aspectRatio?: number;
|
|
36
|
+
category?: string;
|
|
37
|
+
};
|
|
38
|
+
export type _PageTemplateDocDriftLock = import("../../_shared/contract.js").Expect<import("../../_shared/contract.js").MutuallyAssignable<import("../../_shared/contract.js").NamedFields<z.infer<typeof pageTemplateSchema>>, import("../../_shared/contract.js").NamedFields<LoadedPageTemplateDoc>>>;
|
|
39
|
+
export type _BlockTemplateDocDriftLock = import("../../_shared/contract.js").Expect<import("../../_shared/contract.js").MutuallyAssignable<import("../../_shared/contract.js").NamedFields<z.infer<typeof blockTemplateSchema>>, import("../../_shared/contract.js").NamedFields<LoadedBlockTemplateDoc>>>;
|
|
40
|
+
import { z } from 'zod';
|
|
41
|
+
declare const pageTemplateSchema: z.ZodObject<{
|
|
42
|
+
type: z.ZodLiteral<"page">;
|
|
43
|
+
name: z.ZodString;
|
|
44
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
45
|
+
description: z.ZodOptional<z.ZodString>;
|
|
46
|
+
category: z.ZodOptional<z.ZodString>;
|
|
47
|
+
componentsUsed: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
48
|
+
preview: z.ZodOptional<z.ZodObject<{
|
|
49
|
+
image: z.ZodOptional<z.ZodString>;
|
|
50
|
+
aspectRatio: z.ZodOptional<z.ZodString>;
|
|
51
|
+
}, z.core.$strict>>;
|
|
52
|
+
isReady: z.ZodOptional<z.ZodBoolean>;
|
|
53
|
+
scaffold: z.ZodOptional<z.ZodBoolean>;
|
|
54
|
+
isHiddenFromOverview: z.ZodOptional<z.ZodBoolean>;
|
|
55
|
+
registry: z.ZodOptional<z.ZodObject<{
|
|
56
|
+
slug: z.ZodOptional<z.ZodString>;
|
|
57
|
+
aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
58
|
+
}, z.core.$strict>>;
|
|
59
|
+
placement: z.ZodOptional<z.ZodObject<{
|
|
60
|
+
parent: z.ZodString;
|
|
61
|
+
slot: z.ZodOptional<z.ZodString>;
|
|
62
|
+
order: z.ZodOptional<z.ZodNumber>;
|
|
63
|
+
}, z.core.$strict>>;
|
|
64
|
+
aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
65
|
+
audience: z.ZodOptional<z.ZodEnum<{
|
|
66
|
+
public: "public";
|
|
67
|
+
internal: "internal";
|
|
68
|
+
}>>;
|
|
69
|
+
}, z.core.$strict>;
|
|
70
|
+
declare const blockTemplateSchema: z.ZodObject<{
|
|
71
|
+
type: z.ZodLiteral<"block">;
|
|
72
|
+
exampleFor: z.ZodOptional<z.ZodString>;
|
|
73
|
+
alsoExampleFor: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
74
|
+
alsoShowcaseFor: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
75
|
+
aspectRatio: z.ZodOptional<z.ZodNumber>;
|
|
76
|
+
scale: z.ZodOptional<z.ZodNumber>;
|
|
77
|
+
isShowcase: z.ZodOptional<z.ZodBoolean>;
|
|
78
|
+
name: z.ZodString;
|
|
79
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
80
|
+
description: z.ZodOptional<z.ZodString>;
|
|
81
|
+
category: z.ZodOptional<z.ZodString>;
|
|
82
|
+
componentsUsed: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
83
|
+
preview: z.ZodOptional<z.ZodObject<{
|
|
84
|
+
image: z.ZodOptional<z.ZodString>;
|
|
85
|
+
aspectRatio: z.ZodOptional<z.ZodString>;
|
|
86
|
+
}, z.core.$strict>>;
|
|
87
|
+
isReady: z.ZodOptional<z.ZodBoolean>;
|
|
88
|
+
scaffold: z.ZodOptional<z.ZodBoolean>;
|
|
89
|
+
isHiddenFromOverview: z.ZodOptional<z.ZodBoolean>;
|
|
90
|
+
registry: z.ZodOptional<z.ZodObject<{
|
|
91
|
+
slug: z.ZodOptional<z.ZodString>;
|
|
92
|
+
aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
93
|
+
}, z.core.$strict>>;
|
|
94
|
+
placement: z.ZodOptional<z.ZodObject<{
|
|
95
|
+
parent: z.ZodString;
|
|
96
|
+
slot: z.ZodOptional<z.ZodString>;
|
|
97
|
+
order: z.ZodOptional<z.ZodNumber>;
|
|
98
|
+
}, z.core.$strict>>;
|
|
99
|
+
aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
100
|
+
audience: z.ZodOptional<z.ZodEnum<{
|
|
101
|
+
public: "public";
|
|
102
|
+
internal: "internal";
|
|
103
|
+
}>>;
|
|
104
|
+
}, z.core.$strict>;
|
|
105
|
+
export {};
|
|
@@ -12,7 +12,9 @@ import {z} from 'zod';
|
|
|
12
12
|
import {AuthoredDocGraphFields} from '../_schema.mjs';
|
|
13
13
|
import {formatZodError} from '../../_shared/errors.mjs';
|
|
14
14
|
|
|
15
|
-
/** @typedef {import('../types').TemplateDoc} TemplateDoc */
|
|
15
|
+
/** @typedef {import('../types.js').TemplateDoc} TemplateDoc */
|
|
16
|
+
/** @typedef {import('./type.js').PageTemplateDoc} PageTemplateDoc */
|
|
17
|
+
/** @typedef {import('./type.js').BlockTemplateDoc} BlockTemplateDoc */
|
|
16
18
|
|
|
17
19
|
const previewSchema = z
|
|
18
20
|
.object({
|
|
@@ -67,6 +69,36 @@ const blockTemplateSchema = z
|
|
|
67
69
|
})
|
|
68
70
|
.strict();
|
|
69
71
|
|
|
72
|
+
/**
|
|
73
|
+
* Templates as they load. Integration templates already published omit
|
|
74
|
+
* `displayName` and `aspectRatio` and group themselves under their own
|
|
75
|
+
* `category`, so the loader accepts those (template discovery falls back to an
|
|
76
|
+
* aspect ratio of 1). The published types keep asking authors for all three.
|
|
77
|
+
*
|
|
78
|
+
* @typedef {Omit<PageTemplateDoc, 'displayName' | 'category'>
|
|
79
|
+
* & {displayName?: string, category?: string}} LoadedPageTemplateDoc
|
|
80
|
+
* @typedef {Omit<BlockTemplateDoc, 'displayName' | 'aspectRatio' | 'category'>
|
|
81
|
+
* & {displayName?: string, aspectRatio?: number, category?: string}} LoadedBlockTemplateDoc
|
|
82
|
+
*/
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* @typedef {import('../../_shared/contract.js').Expect<
|
|
86
|
+
* import('../../_shared/contract.js').MutuallyAssignable<
|
|
87
|
+
* import('../../_shared/contract.js').NamedFields<z.infer<typeof pageTemplateSchema>>,
|
|
88
|
+
* import('../../_shared/contract.js').NamedFields<LoadedPageTemplateDoc>
|
|
89
|
+
* >
|
|
90
|
+
* >} _PageTemplateDocDriftLock
|
|
91
|
+
*/
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* @typedef {import('../../_shared/contract.js').Expect<
|
|
95
|
+
* import('../../_shared/contract.js').MutuallyAssignable<
|
|
96
|
+
* import('../../_shared/contract.js').NamedFields<z.infer<typeof blockTemplateSchema>>,
|
|
97
|
+
* import('../../_shared/contract.js').NamedFields<LoadedBlockTemplateDoc>
|
|
98
|
+
* >
|
|
99
|
+
* >} _BlockTemplateDocDriftLock
|
|
100
|
+
*/
|
|
101
|
+
|
|
70
102
|
const templateEnvelopeSchema = z
|
|
71
103
|
.discriminatedUnion('type', [pageTemplateSchema, blockTemplateSchema])
|
|
72
104
|
.superRefine((template, context) => {
|
|
@@ -148,6 +148,10 @@ export const doc = {
|
|
|
148
148
|
},
|
|
149
149
|
],
|
|
150
150
|
notes: [
|
|
151
|
+
{
|
|
152
|
+
type: 'prose',
|
|
153
|
+
text: 'When it loads, a template may leave out `displayName` and `aspectRatio` and use its own `category`, as integration templates already published do; a block with no `aspectRatio` previews at 1. Write to the type anyway; it is the contract.',
|
|
154
|
+
},
|
|
151
155
|
{
|
|
152
156
|
type: 'prose',
|
|
153
157
|
text: "TemplateDoc is a discriminated union keyed by `type`. Set `type: 'page'` for a full page template. Set `type: 'block'` for an editable composition; add `exampleFor` only when one component owns the example.",
|
|
@@ -4,7 +4,10 @@
|
|
|
4
4
|
* @file Template doc types.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import type {
|
|
7
|
+
import type {
|
|
8
|
+
AuthoredDocGraphFields,
|
|
9
|
+
RegistryDocIdentity,
|
|
10
|
+
} from '../base/type.js';
|
|
8
11
|
|
|
9
12
|
export interface BaseTemplateDoc extends AuthoredDocGraphFields {
|
|
10
13
|
/** Identifier name for the template. For block templates this matches
|
|
@@ -7,13 +7,13 @@
|
|
|
7
7
|
* behind `@astryxdesign/cli/authoring`.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
export type * from './base/type';
|
|
11
|
-
export type * from './component/type';
|
|
12
|
-
export type * from './hook/type';
|
|
13
|
-
export type * from './function/type';
|
|
14
|
-
export type * from './reference/type';
|
|
15
|
-
export type * from './namespace/type';
|
|
16
|
-
export type * from './template/type';
|
|
17
|
-
export type * from './schema/type';
|
|
18
|
-
export type * from './command/type';
|
|
19
|
-
export type * from './enum/type';
|
|
10
|
+
export type * from './base/type.js';
|
|
11
|
+
export type * from './component/type.js';
|
|
12
|
+
export type * from './hook/type.js';
|
|
13
|
+
export type * from './function/type.js';
|
|
14
|
+
export type * from './reference/type.js';
|
|
15
|
+
export type * from './namespace/type.js';
|
|
16
|
+
export type * from './template/type.js';
|
|
17
|
+
export type * from './schema/type.js';
|
|
18
|
+
export type * from './command/type.js';
|
|
19
|
+
export type * from './enum/type.js';
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* @typedef {import('../_shared/contract').Expect<
|
|
6
|
-
* import('../_shared/contract').MutuallyAssignable<z.infer<typeof receiptSchema>, GapReportHandlerReceipt>
|
|
5
|
+
* @typedef {import('../_shared/contract.js').Expect<
|
|
6
|
+
* import('../_shared/contract.js').MutuallyAssignable<z.infer<typeof receiptSchema>, GapReportHandlerReceipt>
|
|
7
7
|
* >} _GapReportReceiptDriftLock
|
|
8
8
|
*/
|
|
9
9
|
/**
|
|
@@ -25,23 +25,23 @@ export function parseGapReportHandler(input: unknown, label?: string): GapReport
|
|
|
25
25
|
* @returns {GapReportHandlerReceipt | null}
|
|
26
26
|
*/
|
|
27
27
|
export function parseGapReportReceipt(input: unknown): GapReportHandlerReceipt | null;
|
|
28
|
-
export type _GapReportReceiptDriftLock = import("../_shared/contract").Expect<import("../_shared/contract").MutuallyAssignable<z.infer<typeof receiptSchema>, GapReportHandlerReceipt>>;
|
|
29
|
-
export type GapReportHandler = import("./type").GapReportHandler;
|
|
30
|
-
export type GapReportHandlerReceipt = import("./type").GapReportHandlerReceipt;
|
|
28
|
+
export type _GapReportReceiptDriftLock = import("../_shared/contract.js").Expect<import("../_shared/contract.js").MutuallyAssignable<z.infer<typeof receiptSchema>, GapReportHandlerReceipt>>;
|
|
29
|
+
export type GapReportHandler = import("./type.js").GapReportHandler;
|
|
30
|
+
export type GapReportHandlerReceipt = import("./type.js").GapReportHandlerReceipt;
|
|
31
31
|
/**
|
|
32
32
|
* Compile-time drift-lock: the sealed schema must infer EXACTLY the public
|
|
33
33
|
* {@link GapReportHandler} type. If they drift, `MutuallyAssignable` becomes
|
|
34
34
|
* `false` and `Expect<false>` fails `tsconfig.authoring-contract.json`.
|
|
35
35
|
*/
|
|
36
|
-
export type _GapReportHandlerDriftLock = import("../_shared/contract").Expect<import("../_shared/contract").MutuallyAssignable<z.infer<typeof handlerSchema>, GapReportHandler>>;
|
|
36
|
+
export type _GapReportHandlerDriftLock = import("../_shared/contract.js").Expect<import("../_shared/contract.js").MutuallyAssignable<z.infer<typeof handlerSchema>, GapReportHandler>>;
|
|
37
37
|
import { z } from 'zod';
|
|
38
38
|
/**
|
|
39
39
|
* Compile-time drift-lock: the sealed schema must infer EXACTLY the public
|
|
40
40
|
* {@link GapReportHandler} type. If they drift, `MutuallyAssignable` becomes
|
|
41
41
|
* `false` and `Expect<false>` fails `tsconfig.authoring-contract.json`.
|
|
42
42
|
*
|
|
43
|
-
* @typedef {import('../_shared/contract').Expect<
|
|
44
|
-
* import('../_shared/contract').MutuallyAssignable<z.infer<typeof handlerSchema>, GapReportHandler>
|
|
43
|
+
* @typedef {import('../_shared/contract.js').Expect<
|
|
44
|
+
* import('../_shared/contract.js').MutuallyAssignable<z.infer<typeof handlerSchema>, GapReportHandler>
|
|
45
45
|
* >} _GapReportHandlerDriftLock
|
|
46
46
|
*/
|
|
47
47
|
declare const receiptSchema: z.ZodObject<{
|
|
@@ -58,6 +58,6 @@ declare const handlerSchema: z.ZodObject<{
|
|
|
58
58
|
public: "public";
|
|
59
59
|
internal: "internal";
|
|
60
60
|
}>;
|
|
61
|
-
handle: z.ZodType<(report: import("./type").GapReport, context: import("./type").GapReportHandlerContext) => import("./type").GapReportHandlerReceipt | Promise<import("./type").GapReportHandlerReceipt>, any, z.core.$ZodTypeInternals<(report: import("./type").GapReport, context: import("./type").GapReportHandlerContext) => import("./type").GapReportHandlerReceipt | Promise<import("./type").GapReportHandlerReceipt>, any>>;
|
|
61
|
+
handle: z.ZodType<(report: import("./type.js").GapReport, context: import("./type.js").GapReportHandlerContext) => import("./type.js").GapReportHandlerReceipt | Promise<import("./type.js").GapReportHandlerReceipt>, any, z.core.$ZodTypeInternals<(report: import("./type.js").GapReport, context: import("./type.js").GapReportHandlerContext) => import("./type.js").GapReportHandlerReceipt | Promise<import("./type.js").GapReportHandlerReceipt>, any>>;
|
|
62
62
|
}, z.core.$strict>;
|
|
63
63
|
export {};
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
import {z} from 'zod';
|
|
14
14
|
import {formatZodError} from '../_shared/errors.mjs';
|
|
15
15
|
|
|
16
|
-
/** @typedef {import('./type').GapReportHandler} GapReportHandler */
|
|
17
|
-
/** @typedef {import('./type').GapReportHandlerReceipt} GapReportHandlerReceipt */
|
|
16
|
+
/** @typedef {import('./type.js').GapReportHandler} GapReportHandler */
|
|
17
|
+
/** @typedef {import('./type.js').GapReportHandlerReceipt} GapReportHandlerReceipt */
|
|
18
18
|
|
|
19
19
|
// Typed z.custom so z.infer reproduces the real function type, matching the
|
|
20
20
|
// pattern used by the debug handler and post-codemod hook parsers.
|
|
@@ -36,8 +36,8 @@ const handlerSchema = z
|
|
|
36
36
|
* {@link GapReportHandler} type. If they drift, `MutuallyAssignable` becomes
|
|
37
37
|
* `false` and `Expect<false>` fails `tsconfig.authoring-contract.json`.
|
|
38
38
|
*
|
|
39
|
-
* @typedef {import('../_shared/contract').Expect<
|
|
40
|
-
* import('../_shared/contract').MutuallyAssignable<z.infer<typeof handlerSchema>, GapReportHandler>
|
|
39
|
+
* @typedef {import('../_shared/contract.js').Expect<
|
|
40
|
+
* import('../_shared/contract.js').MutuallyAssignable<z.infer<typeof handlerSchema>, GapReportHandler>
|
|
41
41
|
* >} _GapReportHandlerDriftLock
|
|
42
42
|
*/
|
|
43
43
|
|
|
@@ -50,8 +50,8 @@ const receiptSchema = z
|
|
|
50
50
|
.strict();
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
|
-
* @typedef {import('../_shared/contract').Expect<
|
|
54
|
-
* import('../_shared/contract').MutuallyAssignable<z.infer<typeof receiptSchema>, GapReportHandlerReceipt>
|
|
53
|
+
* @typedef {import('../_shared/contract.js').Expect<
|
|
54
|
+
* import('../_shared/contract.js').MutuallyAssignable<z.infer<typeof receiptSchema>, GapReportHandlerReceipt>
|
|
55
55
|
* >} _GapReportReceiptDriftLock
|
|
56
56
|
*/
|
|
57
57
|
|
|
@@ -12,8 +12,9 @@ export const doc = {
|
|
|
12
12
|
displayName: 'Provider and artifact identity',
|
|
13
13
|
namespace: 'authoring',
|
|
14
14
|
description:
|
|
15
|
-
'Separates stable provider/artifact identity from package instances and runtime lifecycle state.',
|
|
16
|
-
appliesTo:
|
|
15
|
+
'Separates stable provider/artifact identity from package instances and runtime lifecycle state. providerId is in use today: an integration manifest may declare it, and Doctor and every command report two packages that claim one. The artifact, doc, instance, and compiler-input identities are defined for the docs graph, which is not built yet, and no command reads them.',
|
|
16
|
+
appliesTo:
|
|
17
|
+
'Integration manifests and provider conflicts today; the docs graph once it ships',
|
|
17
18
|
fields: [
|
|
18
19
|
{
|
|
19
20
|
name: 'ProviderId',
|
|
@@ -8,16 +8,16 @@
|
|
|
8
8
|
* artifact ID stays stable across those instances.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import type {AuthoredDocKind} from '../doctypes/base/type';
|
|
12
|
-
import type {CommandDoc} from '../doctypes/command/type';
|
|
13
|
-
import type {ComponentDoc} from '../doctypes/component/type';
|
|
14
|
-
import type {EnumDoc} from '../doctypes/enum/type';
|
|
15
|
-
import type {FunctionDoc} from '../doctypes/function/type';
|
|
16
|
-
import type {HookDoc} from '../doctypes/hook/type';
|
|
17
|
-
import type {NamespaceDoc} from '../doctypes/namespace/type';
|
|
18
|
-
import type {ReferenceDoc} from '../doctypes/reference/type';
|
|
19
|
-
import type {SchemaDoc} from '../doctypes/schema/type';
|
|
20
|
-
import type {TemplateDoc} from '../doctypes/template/type';
|
|
11
|
+
import type {AuthoredDocKind} from '../doctypes/base/type.js';
|
|
12
|
+
import type {CommandDoc} from '../doctypes/command/type.js';
|
|
13
|
+
import type {ComponentDoc} from '../doctypes/component/type.js';
|
|
14
|
+
import type {EnumDoc} from '../doctypes/enum/type.js';
|
|
15
|
+
import type {FunctionDoc} from '../doctypes/function/type.js';
|
|
16
|
+
import type {HookDoc} from '../doctypes/hook/type.js';
|
|
17
|
+
import type {NamespaceDoc} from '../doctypes/namespace/type.js';
|
|
18
|
+
import type {ReferenceDoc} from '../doctypes/reference/type.js';
|
|
19
|
+
import type {SchemaDoc} from '../doctypes/schema/type.js';
|
|
20
|
+
import type {TemplateDoc} from '../doctypes/template/type.js';
|
|
21
21
|
|
|
22
22
|
declare const providerIdBrand: unique symbol;
|
|
23
23
|
declare const artifactIdBrand: unique symbol;
|
package/authoring/index.d.ts
CHANGED
|
@@ -23,18 +23,18 @@
|
|
|
23
23
|
// ═══════════════════════════════════════════════════════════════════════
|
|
24
24
|
// AUTHOR THESE — each is the default export of one authored file.
|
|
25
25
|
// ═══════════════════════════════════════════════════════════════════════
|
|
26
|
-
export type {ComponentDoc} from './doctypes/types'; // Button.doc.{ts,mjs}
|
|
27
|
-
export type {HookDoc} from './doctypes/types'; // useToast.doc.{ts,mjs}
|
|
28
|
-
export type {FunctionDoc} from './doctypes/types'; // search.doc.mjs (hook | api)
|
|
29
|
-
export type {ReferenceDoc} from './doctypes/types'; // theming.doc.{ts,mjs}
|
|
30
|
-
export type {TemplateDoc} from './doctypes/types'; // Foo.template.{ts,mjs}
|
|
31
|
-
export type {SchemaDoc} from './doctypes/types'; // config.doc.mjs (object shape)
|
|
32
|
-
export type {CommandDoc} from './doctypes/types'; // search.doc.mjs (CLI command)
|
|
33
|
-
export type {EnumDoc} from './doctypes/types'; // error-codes.doc.mjs (vocabulary)
|
|
34
|
-
export type {NamespaceDoc} from './doctypes/types'; // cli.doc.mjs (hierarchy)
|
|
35
|
-
export type {AstryxConfig} from './config/type'; // astryx.config.{ts,mjs}
|
|
36
|
-
export type {DebugEvent} from './debug/type'; // one recorded CLI run
|
|
37
|
-
export type {AstryxIntegration} from './integration/type'; // astryx.integration.{ts,mjs}
|
|
26
|
+
export type {ComponentDoc} from './doctypes/types.js'; // Button.doc.{ts,mjs}
|
|
27
|
+
export type {HookDoc} from './doctypes/types.js'; // useToast.doc.{ts,mjs}
|
|
28
|
+
export type {FunctionDoc} from './doctypes/types.js'; // search.doc.mjs (hook | api)
|
|
29
|
+
export type {ReferenceDoc} from './doctypes/types.js'; // theming.doc.{ts,mjs}
|
|
30
|
+
export type {TemplateDoc} from './doctypes/types.js'; // Foo.template.{ts,mjs}
|
|
31
|
+
export type {SchemaDoc} from './doctypes/types.js'; // config.doc.mjs (object shape)
|
|
32
|
+
export type {CommandDoc} from './doctypes/types.js'; // search.doc.mjs (CLI command)
|
|
33
|
+
export type {EnumDoc} from './doctypes/types.js'; // error-codes.doc.mjs (vocabulary)
|
|
34
|
+
export type {NamespaceDoc} from './doctypes/types.js'; // cli.doc.mjs (hierarchy)
|
|
35
|
+
export type {AstryxConfig} from './config/type.js'; // astryx.config.{ts,mjs}
|
|
36
|
+
export type {DebugEvent} from './debug/type.js'; // one recorded CLI run
|
|
37
|
+
export type {AstryxIntegration} from './integration/type.js'; // astryx.integration.{ts,mjs}
|
|
38
38
|
export type {
|
|
39
39
|
GapReportHandler,
|
|
40
40
|
GapReportHandlerContext,
|
|
@@ -42,8 +42,8 @@ export type {
|
|
|
42
42
|
GapReportCategory,
|
|
43
43
|
GapReportTarget,
|
|
44
44
|
GapReportHandlerReceipt,
|
|
45
|
-
} from './gap-report/type'; // gap-report handler contract
|
|
46
|
-
export type {AstryxCodemod, AstryxConfigCodemod} from './codemod/type'; // codemods/*
|
|
45
|
+
} from './gap-report/type.js'; // gap-report handler contract
|
|
46
|
+
export type {AstryxCodemod, AstryxConfigCodemod} from './codemod/type.js'; // codemods/*
|
|
47
47
|
|
|
48
48
|
// ═══════════════════════════════════════════════════════════════════════
|
|
49
49
|
// PARSERS — the CLI's load boundary (types come from each parser's JSDoc).
|
|
@@ -87,7 +87,7 @@ export type {
|
|
|
87
87
|
AuthoredDocSnapshot,
|
|
88
88
|
AuthoredDocSource,
|
|
89
89
|
AuthoredDocEntry,
|
|
90
|
-
} from './identity/type';
|
|
90
|
+
} from './identity/type.js';
|
|
91
91
|
export type {
|
|
92
92
|
// shared graph
|
|
93
93
|
AuthoredDocKind,
|
|
@@ -151,8 +151,8 @@ export type {
|
|
|
151
151
|
CommandExampleDoc,
|
|
152
152
|
// enum
|
|
153
153
|
EnumMemberDoc,
|
|
154
|
-
} from './doctypes/types';
|
|
155
|
-
export type {PostCodemodHook, DebugConfig} from './config/type';
|
|
154
|
+
} from './doctypes/types.js';
|
|
155
|
+
export type {PostCodemodHook, DebugConfig} from './config/type.js';
|
|
156
156
|
export type {
|
|
157
157
|
// debug
|
|
158
158
|
DebugSchemaVersion,
|
|
@@ -165,11 +165,11 @@ export type {
|
|
|
165
165
|
DebugEventEnv,
|
|
166
166
|
DebugEventProject,
|
|
167
167
|
DebugEventHandler,
|
|
168
|
-
} from './debug/type';
|
|
168
|
+
} from './debug/type.js';
|
|
169
169
|
export type {
|
|
170
170
|
AstryxCodemodDef,
|
|
171
171
|
AstryxConfigCodemodDef,
|
|
172
172
|
AstryxCodemodFile,
|
|
173
173
|
AstryxCodemodApi,
|
|
174
174
|
AstryxCodemodTransform,
|
|
175
|
-
} from './codemod/type';
|
|
175
|
+
} from './codemod/type.js';
|
|
@@ -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('./type').AstryxIntegration} AstryxIntegration */
|
|
4
|
+
/** @typedef {import('./type.js').AstryxIntegration} AstryxIntegration */
|
|
5
5
|
/**
|
|
6
6
|
* Validate an unknown value as an Astryx integration manifest, or throw.
|
|
7
7
|
*
|
|
@@ -14,4 +14,4 @@
|
|
|
14
14
|
* @returns {AstryxIntegration}
|
|
15
15
|
*/
|
|
16
16
|
export function parseIntegration(input: unknown, label?: string): AstryxIntegration;
|
|
17
|
-
export type AstryxIntegration = import("./type").AstryxIntegration;
|
|
17
|
+
export type AstryxIntegration = import("./type.js").AstryxIntegration;
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
import {formatZodError} from '../_shared/errors.mjs';
|
|
15
15
|
import {integrationSchema} from './schema.mjs';
|
|
16
16
|
|
|
17
|
-
/** @typedef {import('./type').AstryxIntegration} AstryxIntegration */
|
|
17
|
+
/** @typedef {import('./type.js').AstryxIntegration} AstryxIntegration */
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* Validate an unknown value as an Astryx integration manifest, or throw.
|
|
@@ -55,8 +55,8 @@ export const integrationSchema: z.ZodObject<{
|
|
|
55
55
|
/**
|
|
56
56
|
* Compile-time drift-lock: sealed schema must infer exactly {@link AstryxIntegration}.
|
|
57
57
|
*
|
|
58
|
-
* @typedef {import('../_shared/contract').Expect<
|
|
59
|
-
* import('../_shared/contract').Equal<z.infer<typeof integrationSchema>, AstryxIntegration>
|
|
58
|
+
* @typedef {import('../_shared/contract.js').Expect<
|
|
59
|
+
* import('../_shared/contract.js').Equal<z.infer<typeof integrationSchema>, AstryxIntegration>
|
|
60
60
|
* >} _IntegrationDriftLock
|
|
61
61
|
*/
|
|
62
62
|
/**
|
|
@@ -69,9 +69,9 @@ export const integrationSchema: z.ZodObject<{
|
|
|
69
69
|
* @type {string[]}
|
|
70
70
|
*/
|
|
71
71
|
export const KNOWN_INTEGRATION_KEYS: string[];
|
|
72
|
-
export type AstryxIntegration = import("./type").AstryxIntegration;
|
|
72
|
+
export type AstryxIntegration = import("./type.js").AstryxIntegration;
|
|
73
73
|
/**
|
|
74
74
|
* Compile-time drift-lock: sealed schema must infer exactly {@link AstryxIntegration}.
|
|
75
75
|
*/
|
|
76
|
-
export type _IntegrationDriftLock = import("../_shared/contract").Expect<import("../_shared/contract").Equal<z.infer<typeof integrationSchema>, AstryxIntegration>>;
|
|
76
|
+
export type _IntegrationDriftLock = import("../_shared/contract.js").Expect<import("../_shared/contract.js").Equal<z.infer<typeof integrationSchema>, AstryxIntegration>>;
|
|
77
77
|
import { z } from 'zod';
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
import {z} from 'zod';
|
|
17
17
|
import {formatZodError} from '../_shared/errors.mjs';
|
|
18
18
|
|
|
19
|
-
/** @typedef {import('./type').AstryxIntegration} AstryxIntegration */
|
|
19
|
+
/** @typedef {import('./type.js').AstryxIntegration} AstryxIntegration */
|
|
20
20
|
|
|
21
21
|
const MAX_AGENT_DOC_LINES = 8;
|
|
22
22
|
const MAX_AGENT_DOC_LINE_CODE_POINTS = 240;
|
|
@@ -121,8 +121,8 @@ export function parseAgentDocsField(input, label) {
|
|
|
121
121
|
/**
|
|
122
122
|
* Compile-time drift-lock: sealed schema must infer exactly {@link AstryxIntegration}.
|
|
123
123
|
*
|
|
124
|
-
* @typedef {import('../_shared/contract').Expect<
|
|
125
|
-
* import('../_shared/contract').Equal<z.infer<typeof integrationSchema>, AstryxIntegration>
|
|
124
|
+
* @typedef {import('../_shared/contract.js').Expect<
|
|
125
|
+
* import('../_shared/contract.js').Equal<z.infer<typeof integrationSchema>, AstryxIntegration>
|
|
126
126
|
* >} _IntegrationDriftLock
|
|
127
127
|
*/
|
|
128
128
|
|
|
@@ -9,7 +9,14 @@ import {
|
|
|
9
9
|
buildAuthoringTopic,
|
|
10
10
|
discoverAuthoringSelfDocSources,
|
|
11
11
|
} from './authoring-self-docs.mjs';
|
|
12
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
GRAPH_BLOCK_TYPES,
|
|
14
|
+
GRAPH_ONLY_FIELDS,
|
|
15
|
+
problemsInTopic,
|
|
16
|
+
} from './docs-discovery.mjs';
|
|
17
|
+
import {doc as graphFieldsDoc} from '../../authoring/doctypes/base/graph-fields.doc.mjs';
|
|
18
|
+
import {doc as namespaceDoc} from '../../authoring/doctypes/namespace/namespace.doc.mjs';
|
|
19
|
+
import {doc as referenceDoc} from '../../authoring/doctypes/reference/reference.doc.mjs';
|
|
13
20
|
import {docs} from '../../api/docs/docs.mjs';
|
|
14
21
|
|
|
15
22
|
const SLOW = 60_000;
|
|
@@ -37,14 +44,58 @@ describe('authoring self-docs', () => {
|
|
|
37
44
|
expect(topic.sections).toHaveLength(AUTHORING_SELF_DOCS.length);
|
|
38
45
|
});
|
|
39
46
|
|
|
40
|
-
it(
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
it(
|
|
48
|
+
'is readable progressively through the docs API',
|
|
49
|
+
async () => {
|
|
50
|
+
const index = await docs('authoring', undefined, {index: true});
|
|
51
|
+
expect(index.type).toBe('docs.index');
|
|
52
|
+
expect(index.data.sections.map(s => s.id)).toContain('integration');
|
|
53
|
+
const section = await docs('authoring', 'integration');
|
|
54
|
+
expect(section.data.title).toBe('Astryx Integration');
|
|
55
|
+
expect(section.data.content.some(block => block.type === 'table')).toBe(
|
|
56
|
+
true,
|
|
57
|
+
);
|
|
58
|
+
},
|
|
59
|
+
SLOW,
|
|
60
|
+
);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
describe('what the authoring docs say about the unbuilt docs graph', () => {
|
|
64
|
+
it('marks exactly the fields topic loading rejects as not read yet', () => {
|
|
65
|
+
const notReadYet = graphFieldsDoc.fields
|
|
66
|
+
.filter(field => /Not read yet/.test(field.description))
|
|
67
|
+
.map(field => field.name);
|
|
68
|
+
expect(notReadYet.sort()).toEqual([...GRAPH_ONLY_FIELDS].sort());
|
|
69
|
+
for (const field of graphFieldsDoc.fields) {
|
|
70
|
+
if (notReadYet.includes(field.name)) {
|
|
71
|
+
expect(field.description).toMatch(/fails to load/);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
expect(graphFieldsDoc.description).toMatch(/not built yet/);
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
it('says a topic using a graph block fails to load', () => {
|
|
78
|
+
const content = referenceDoc.fields
|
|
79
|
+
.flatMap(field => [field, ...(field.fields ?? [])])
|
|
80
|
+
.find(field => field.name === 'sections[].content');
|
|
81
|
+
for (const type of GRAPH_BLOCK_TYPES) {
|
|
82
|
+
expect(content.description).toContain(type);
|
|
83
|
+
}
|
|
84
|
+
expect(content.description).toMatch(/fails to load/);
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
it('says namespace docs are not loaded yet', () => {
|
|
88
|
+
expect(namespaceDoc.description).toMatch(/Not loaded yet/);
|
|
89
|
+
expect(
|
|
90
|
+
problemsInTopic({
|
|
91
|
+
...namespaceDoc.examples?.[0],
|
|
92
|
+
type: 'namespace',
|
|
93
|
+
name: 'x',
|
|
94
|
+
}),
|
|
95
|
+
).toEqual([
|
|
96
|
+
'"x" is a namespace doc. Only the docs graph reads namespace docs, and it is not built yet; remove this file from the docs directory.',
|
|
97
|
+
]);
|
|
98
|
+
});
|
|
48
99
|
});
|
|
49
100
|
|
|
50
101
|
describe('auditAuthoringSelfDocs', () => {
|
|
@@ -68,17 +119,25 @@ describe('auditAuthoringSelfDocs', () => {
|
|
|
68
119
|
path.join(root, 'kept', 'forgotten.doc.mjs'),
|
|
69
120
|
"export const doc = {name: 'forgotten', description: 'Not listed.'};\n",
|
|
70
121
|
);
|
|
71
|
-
const audit = await auditAuthoringSelfDocs({
|
|
122
|
+
const audit = await auditAuthoringSelfDocs({
|
|
123
|
+
root,
|
|
124
|
+
sources: ['kept/kept.doc.mjs'],
|
|
125
|
+
});
|
|
72
126
|
expect(audit.unreachable).toEqual(['kept/forgotten.doc.mjs']);
|
|
73
127
|
});
|
|
74
128
|
|
|
75
129
|
it('reports a self-doc that fails to load instead of throwing', async () => {
|
|
76
|
-
fs.writeFileSync(
|
|
130
|
+
fs.writeFileSync(
|
|
131
|
+
path.join(root, 'kept', 'broken.doc.mjs'),
|
|
132
|
+
'export const doc = {;\n',
|
|
133
|
+
);
|
|
77
134
|
const audit = await auditAuthoringSelfDocs({
|
|
78
135
|
root,
|
|
79
136
|
sources: ['kept/kept.doc.mjs', 'kept/broken.doc.mjs'],
|
|
80
137
|
});
|
|
81
|
-
expect(audit.failed.map(entry => entry.source)).toEqual([
|
|
138
|
+
expect(audit.failed.map(entry => entry.source)).toEqual([
|
|
139
|
+
'kept/broken.doc.mjs',
|
|
140
|
+
]);
|
|
82
141
|
expect(audit.sections).toBe(1);
|
|
83
142
|
});
|
|
84
143
|
|
|
@@ -94,6 +94,10 @@ export { withSourceTitle };
|
|
|
94
94
|
* unlike component discovery, whose built-ins belong to core.
|
|
95
95
|
*/
|
|
96
96
|
export const BUILTIN_DOCS_PACKAGE: import("../../authoring/index.js").ProviderId;
|
|
97
|
+
/** Blocks that are valid authoring but require the compiled graph renderer. */
|
|
98
|
+
export const GRAPH_BLOCK_TYPES: Set<string>;
|
|
99
|
+
/** Doc fields only the docs graph reads; a topic that sets one fails to load. */
|
|
100
|
+
export const GRAPH_ONLY_FIELDS: string[];
|
|
97
101
|
/**
|
|
98
102
|
* Every topic a project can read, and the relationships between them.
|
|
99
103
|
*
|