@intentius/chant 0.37.0 → 0.37.2
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/dist/codegen/docs-rule-scanning.d.ts.map +1 -1
- package/dist/codegen/docs-sections.d.ts.map +1 -1
- package/dist/codegen/docs-sidebar.d.ts.map +1 -1
- package/dist/codegen/docs.d.ts +11 -0
- package/dist/codegen/docs.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/codegen/docs-rule-scanning.ts +12 -3
- package/src/codegen/docs-sections.ts +5 -3
- package/src/codegen/docs-sidebar.ts +8 -2
- package/src/codegen/docs.ts +19 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs-rule-scanning.d.ts","sourceRoot":"","sources":["../../src/codegen/docs-rule-scanning.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAEzD;;;GAGG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,EAAE,CAUpD;
|
|
1
|
+
{"version":3,"file":"docs-rule-scanning.d.ts","sourceRoot":"","sources":["../../src/codegen/docs-rule-scanning.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAEzD;;;GAGG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,EAAE,CAUpD;AAwFD,wBAAgB,aAAa,CAAC,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,MAAM,CAoD3E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs-sections.d.ts","sourceRoot":"","sources":["../../src/codegen/docs-sections.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAElF,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,UAAU,EAClB,QAAQ,EAAE,YAAY,EACtB,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,EACjC,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,EAClC,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,EAClD,KAAK,EAAE,QAAQ,EAAE,GAChB,MAAM,
|
|
1
|
+
{"version":3,"file":"docs-sections.d.ts","sourceRoot":"","sources":["../../src/codegen/docs-sections.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAElF,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,UAAU,EAClB,QAAQ,EAAE,YAAY,EACtB,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,EACjC,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,EAClC,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,EAClD,KAAK,EAAE,QAAQ,EAAE,GAChB,MAAM,CAmER;AAED,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,UAAU,EAClB,QAAQ,EAAE,YAAY,GACrB,MAAM,CA0BR;AAED,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,UAAU,EAClB,QAAQ,EAAE,YAAY,GACrB,MAAM,CAqBR;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAqBhE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs-sidebar.d.ts","sourceRoot":"","sources":["../../src/codegen/docs-sidebar.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE3D,wBAAgB,YAAY,CAC1B,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,UAAU,GACjB,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"docs-sidebar.d.ts","sourceRoot":"","sources":["../../src/codegen/docs-sidebar.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE3D,wBAAgB,YAAY,CAC1B,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,UAAU,GACjB,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAoDhC"}
|
package/dist/codegen/docs.d.ts
CHANGED
|
@@ -13,6 +13,17 @@ export type { DocsConfig, DocsResult } from "./docs-types.js";
|
|
|
13
13
|
* Run the documentation pipeline with the supplied config.
|
|
14
14
|
*/
|
|
15
15
|
export declare function docsPipeline(config: DocsConfig): DocsResult;
|
|
16
|
+
/**
|
|
17
|
+
* Render the complete rules table for a lexicon that has no {@link docsPipeline}
|
|
18
|
+
* site of its own.
|
|
19
|
+
*
|
|
20
|
+
* The docker lexicon hand-authors its docs, which left its rule table the only
|
|
21
|
+
* one in the repo that could drift from source without anything noticing
|
|
22
|
+
* (#1312). This is the one page worth generating even when the rest of a site
|
|
23
|
+
* is hand-written; the caller writes the result to `rules.mdx` and links it.
|
|
24
|
+
* Returns null when the lexicon declares no rules.
|
|
25
|
+
*/
|
|
26
|
+
export declare function generateRulesPage(config: DocsConfig, srcDir: string): string | null;
|
|
16
27
|
/**
|
|
17
28
|
* Marks a page as pipeline output. Used both to warn readers off editing the
|
|
18
29
|
* file and, in {@link writeDocsSite}, to tell a page this pipeline owns from a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../src/codegen/docs.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAUH,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAA2B,MAAM,cAAc,CAAC;AAGpF,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAI3D;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,UAAU,GAAG,UAAU,CAiI3D;AAsBD;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,4BAA4B,CAAC;AAE9D;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,CAUtF;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GACtC,MAAM,EAAE,CAQV;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAQvE;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,GAAG,IAAI,CAmI1E"}
|
|
1
|
+
{"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../src/codegen/docs.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAUH,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAA2B,MAAM,cAAc,CAAC;AAGpF,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAI3D;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,UAAU,GAAG,UAAU,CAiI3D;AAsBD;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,MAAM,GACb,MAAM,GAAG,IAAI,CAIf;AAED;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,4BAA4B,CAAC;AAE9D;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,CAUtF;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GACtC,MAAM,EAAE,CAQV;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAQvE;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,GAAG,IAAI,CAmI1E"}
|
package/package.json
CHANGED
|
@@ -109,17 +109,26 @@ function extractDescriptionFromComment(
|
|
|
109
109
|
return ruleId;
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
+
function plural(n: number, noun: string): string {
|
|
113
|
+
return `${n} ${noun}${n === 1 ? "" : "s"}`;
|
|
114
|
+
}
|
|
115
|
+
|
|
112
116
|
export function generateRules(config: DocsConfig, rules: RuleMeta[]): string {
|
|
113
117
|
const lintRules = rules.filter((r) => r.type === "lint");
|
|
114
118
|
const postSynthRules = rules.filter((r) => r.type === "post-synth");
|
|
115
119
|
|
|
116
120
|
const lines: string[] = [
|
|
117
121
|
"---",
|
|
118
|
-
|
|
119
|
-
|
|
122
|
+
// "All Rules", not "Lint Rules": most lexicons also ship a hand-written
|
|
123
|
+
// page under the latter title that covers a selected subset, and two pages
|
|
124
|
+
// with the same title reads as a duplicate rather than a complete table.
|
|
125
|
+
`title: "All Rules"`,
|
|
126
|
+
`description: "Every lint rule and post-synth check provided by the ${config.displayName} lexicon"`,
|
|
120
127
|
"---",
|
|
121
128
|
"",
|
|
122
|
-
`The ${config.displayName} lexicon provides **${rules.length}** rules:
|
|
129
|
+
`The ${config.displayName} lexicon provides **${rules.length}** rules: ` +
|
|
130
|
+
`${plural(lintRules.length, "lint rule")} and ` +
|
|
131
|
+
`${plural(postSynthRules.length, "post-synth check")}.`,
|
|
123
132
|
"",
|
|
124
133
|
];
|
|
125
134
|
|
|
@@ -64,9 +64,11 @@ export function generateOverview(
|
|
|
64
64
|
`- [Pseudo-Parameters](./pseudo-parameters) — ${Object.keys(manifest.pseudoParameters).length} pseudo-parameters`,
|
|
65
65
|
);
|
|
66
66
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
// Same reasoning as the sidebar's rules entry: link the complete table on
|
|
68
|
+
// every lexicon, under the label the sidebar uses, whether or not a prose
|
|
69
|
+
// `lint-rules` page also exists.
|
|
70
|
+
if (!suppress.has("rules") && rules.length > 0) {
|
|
71
|
+
lines.push(`- [All Rules](./rules) — ${rules.length} rules`);
|
|
70
72
|
}
|
|
71
73
|
if (!suppress.has("serialization")) {
|
|
72
74
|
lines.push(`- [Serialization](./serialization) — output format details`);
|
|
@@ -39,8 +39,14 @@ export function buildSidebar(
|
|
|
39
39
|
items.push({ label: "Pseudo-Parameters", slug: "pseudo-parameters" });
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
// Every lexicon links its generated rules table, whether or not it also
|
|
43
|
+
// ships a prose `lint-rules` page. Skipping it when one existed was how gcp
|
|
44
|
+
// ended up emitting a page nothing pointed at (#1312), and it left readers
|
|
45
|
+
// with no complete list on the lexicons whose prose covers only part of the
|
|
46
|
+
// set — aws documented 26 of 50 that way. The label distinguishes the
|
|
47
|
+
// generated table from a prose page rather than competing with it.
|
|
48
|
+
if (!suppress.has("rules") && !extraSlugs.has("rules") && result.pages.has("rules.mdx")) {
|
|
49
|
+
items.push({ label: "All Rules", slug: "rules" });
|
|
44
50
|
}
|
|
45
51
|
|
|
46
52
|
if (!suppress.has("serialization") && !extraSlugs.has("serialization") && result.pages.has("serialization.mdx")) {
|
package/src/codegen/docs.ts
CHANGED
|
@@ -177,6 +177,25 @@ function withGeneratedMarker(config: DocsConfig, content: string): string {
|
|
|
177
177
|
return `${marker}\n\n${content}`;
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
+
/**
|
|
181
|
+
* Render the complete rules table for a lexicon that has no {@link docsPipeline}
|
|
182
|
+
* site of its own.
|
|
183
|
+
*
|
|
184
|
+
* The docker lexicon hand-authors its docs, which left its rule table the only
|
|
185
|
+
* one in the repo that could drift from source without anything noticing
|
|
186
|
+
* (#1312). This is the one page worth generating even when the rest of a site
|
|
187
|
+
* is hand-written; the caller writes the result to `rules.mdx` and links it.
|
|
188
|
+
* Returns null when the lexicon declares no rules.
|
|
189
|
+
*/
|
|
190
|
+
export function generateRulesPage(
|
|
191
|
+
config: DocsConfig,
|
|
192
|
+
srcDir: string,
|
|
193
|
+
): string | null {
|
|
194
|
+
const rules = scanRules(srcDir);
|
|
195
|
+
if (rules.length === 0) return null;
|
|
196
|
+
return withGeneratedMarker(config, generateRules(config, rules));
|
|
197
|
+
}
|
|
198
|
+
|
|
180
199
|
/**
|
|
181
200
|
* Marks a page as pipeline output. Used both to warn readers off editing the
|
|
182
201
|
* file and, in {@link writeDocsSite}, to tell a page this pipeline owns from a
|