@breadstone-infrastructure/nx-tasks 0.0.230 → 0.0.232
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/executors/doppler-config-sync/executor.task.d.ts.map +1 -1
- package/executors/doppler-config-sync/executor.task.js +37 -18
- package/executors/doppler-config-sync/executor.task.js.map +1 -1
- package/executors/doppler-vercel-sync/executor.d.ts +11 -0
- package/executors/doppler-vercel-sync/executor.d.ts.map +1 -0
- package/executors/doppler-vercel-sync/executor.js +71 -0
- package/executors/doppler-vercel-sync/executor.js.map +1 -0
- package/executors/doppler-vercel-sync/executor.options.d.ts +8 -0
- package/executors/doppler-vercel-sync/executor.options.d.ts.map +1 -0
- package/executors/doppler-vercel-sync/executor.options.js +4 -0
- package/executors/doppler-vercel-sync/executor.options.js.map +1 -0
- package/executors/doppler-vercel-sync/executor.task.d.ts +30 -0
- package/executors/doppler-vercel-sync/executor.task.d.ts.map +1 -0
- package/executors/doppler-vercel-sync/executor.task.js +522 -0
- package/executors/doppler-vercel-sync/executor.task.js.map +1 -0
- package/executors/doppler-vercel-sync/schema.json +95 -0
- package/executors/generate-package-docs/executor.d.ts +6 -0
- package/executors/generate-package-docs/executor.d.ts.map +1 -0
- package/executors/generate-package-docs/executor.js +72 -0
- package/executors/generate-package-docs/executor.js.map +1 -0
- package/executors/generate-package-docs/executor.options.d.ts +6 -0
- package/executors/generate-package-docs/executor.options.d.ts.map +1 -0
- package/executors/generate-package-docs/executor.options.js +4 -0
- package/executors/generate-package-docs/executor.options.js.map +1 -0
- package/executors/generate-package-docs/executor.task.d.ts +103 -0
- package/executors/generate-package-docs/executor.task.d.ts.map +1 -0
- package/executors/generate-package-docs/executor.task.js +259 -0
- package/executors/generate-package-docs/executor.task.js.map +1 -0
- package/executors/generate-package-docs/schema.json +258 -0
- package/executors/icon-collection-builder/executor.d.ts.map +1 -1
- package/executors/icon-collection-builder/executor.js +3 -2
- package/executors/icon-collection-builder/executor.js.map +1 -1
- package/executors/icon-collection-builder/executor.task.d.ts +1 -0
- package/executors/icon-collection-builder/executor.task.d.ts.map +1 -1
- package/executors/icon-collection-builder/executor.task.js +73 -11
- package/executors/icon-collection-builder/executor.task.js.map +1 -1
- package/executors/icon-collection-builder/svg.d.ts +19 -0
- package/executors/icon-collection-builder/svg.d.ts.map +1 -1
- package/executors/icon-collection-builder/svg.js +106 -0
- package/executors/icon-collection-builder/svg.js.map +1 -1
- package/executors/icon-collection-downloader/executor.d.ts.map +1 -1
- package/executors/icon-collection-downloader/executor.js +3 -2
- package/executors/icon-collection-downloader/executor.js.map +1 -1
- package/executors/icon-collection-downloader/executor.task.d.ts +2 -0
- package/executors/icon-collection-downloader/executor.task.d.ts.map +1 -1
- package/executors/icon-collection-downloader/executor.task.js +130 -15
- package/executors/icon-collection-downloader/executor.task.js.map +1 -1
- package/executors/lit-docs/ComponentDocFixer.d.ts +176 -0
- package/executors/lit-docs/ComponentDocFixer.d.ts.map +1 -0
- package/executors/lit-docs/ComponentDocFixer.js +424 -0
- package/executors/lit-docs/ComponentDocFixer.js.map +1 -0
- package/executors/lit-docs/JSDocFixer.d.ts +97 -0
- package/executors/lit-docs/JSDocFixer.d.ts.map +1 -0
- package/executors/lit-docs/JSDocFixer.js +200 -0
- package/executors/lit-docs/JSDocFixer.js.map +1 -0
- package/executors/lit-docs/executor.d.ts.map +1 -1
- package/executors/lit-docs/executor.js +2 -1
- package/executors/lit-docs/executor.js.map +1 -1
- package/executors/lit-docs/executor.task.d.ts +1 -0
- package/executors/lit-docs/executor.task.d.ts.map +1 -1
- package/executors/lit-docs/executor.task.js +71 -24
- package/executors/lit-docs/executor.task.js.map +1 -1
- package/executors/lit-style-transform/executor.js +1 -1
- package/executors/lit-style-transform/executor.js.map +1 -1
- package/executors/prisma-seeds/executor.d.ts +10 -0
- package/executors/prisma-seeds/executor.d.ts.map +1 -0
- package/executors/prisma-seeds/executor.js +68 -0
- package/executors/prisma-seeds/executor.js.map +1 -0
- package/executors/prisma-seeds/executor.options.d.ts +16 -0
- package/executors/prisma-seeds/executor.options.d.ts.map +1 -0
- package/executors/prisma-seeds/executor.options.js +3 -0
- package/executors/prisma-seeds/executor.options.js.map +1 -0
- package/executors/prisma-seeds/executor.task.d.ts +29 -0
- package/executors/prisma-seeds/executor.task.d.ts.map +1 -0
- package/executors/prisma-seeds/executor.task.js +54 -0
- package/executors/prisma-seeds/executor.task.js.map +1 -0
- package/executors/prisma-seeds/schema.json +35 -0
- package/executors/secrets-config-sync/executor.d.ts +11 -0
- package/executors/secrets-config-sync/executor.d.ts.map +1 -0
- package/executors/secrets-config-sync/executor.js +64 -0
- package/executors/secrets-config-sync/executor.js.map +1 -0
- package/executors/secrets-config-sync/executor.options.d.ts +6 -0
- package/executors/secrets-config-sync/executor.options.d.ts.map +1 -0
- package/executors/secrets-config-sync/executor.options.js +4 -0
- package/executors/secrets-config-sync/executor.options.js.map +1 -0
- package/executors/secrets-config-sync/executor.task.d.ts +14 -0
- package/executors/secrets-config-sync/executor.task.d.ts.map +1 -0
- package/executors/secrets-config-sync/executor.task.js +157 -0
- package/executors/secrets-config-sync/executor.task.js.map +1 -0
- package/executors/secrets-config-sync/providers/azure-keyvault.provider.d.ts +42 -0
- package/executors/secrets-config-sync/providers/azure-keyvault.provider.d.ts.map +1 -0
- package/executors/secrets-config-sync/providers/azure-keyvault.provider.js +120 -0
- package/executors/secrets-config-sync/providers/azure-keyvault.provider.js.map +1 -0
- package/executors/secrets-config-sync/providers/doppler.provider.d.ts +18 -0
- package/executors/secrets-config-sync/providers/doppler.provider.d.ts.map +1 -0
- package/executors/secrets-config-sync/providers/doppler.provider.js +53 -0
- package/executors/secrets-config-sync/providers/doppler.provider.js.map +1 -0
- package/executors/secrets-config-sync/providers/secrets-provider.factory.d.ts +17 -0
- package/executors/secrets-config-sync/providers/secrets-provider.factory.d.ts.map +1 -0
- package/executors/secrets-config-sync/providers/secrets-provider.factory.js +25 -0
- package/executors/secrets-config-sync/providers/secrets-provider.factory.js.map +1 -0
- package/executors/secrets-config-sync/providers/secrets-provider.interface.d.ts +28 -0
- package/executors/secrets-config-sync/providers/secrets-provider.interface.d.ts.map +1 -0
- package/executors/secrets-config-sync/providers/secrets-provider.interface.js +4 -0
- package/executors/secrets-config-sync/providers/secrets-provider.interface.js.map +1 -0
- package/executors/secrets-config-sync/schema.json +44 -0
- package/executors/secrets-vercel-sync/executor.d.ts +11 -0
- package/executors/secrets-vercel-sync/executor.d.ts.map +1 -0
- package/executors/secrets-vercel-sync/executor.js +74 -0
- package/executors/secrets-vercel-sync/executor.js.map +1 -0
- package/executors/secrets-vercel-sync/executor.options.d.ts +8 -0
- package/executors/secrets-vercel-sync/executor.options.d.ts.map +1 -0
- package/executors/secrets-vercel-sync/executor.options.js +4 -0
- package/executors/secrets-vercel-sync/executor.options.js.map +1 -0
- package/executors/secrets-vercel-sync/executor.task.d.ts +34 -0
- package/executors/secrets-vercel-sync/executor.task.d.ts.map +1 -0
- package/executors/secrets-vercel-sync/executor.task.js +492 -0
- package/executors/secrets-vercel-sync/executor.task.js.map +1 -0
- package/executors/secrets-vercel-sync/providers/azure-keyvault.provider.d.ts +42 -0
- package/executors/secrets-vercel-sync/providers/azure-keyvault.provider.d.ts.map +1 -0
- package/executors/secrets-vercel-sync/providers/azure-keyvault.provider.js +118 -0
- package/executors/secrets-vercel-sync/providers/azure-keyvault.provider.js.map +1 -0
- package/executors/secrets-vercel-sync/providers/doppler.provider.d.ts +18 -0
- package/executors/secrets-vercel-sync/providers/doppler.provider.d.ts.map +1 -0
- package/executors/secrets-vercel-sync/providers/doppler.provider.js +61 -0
- package/executors/secrets-vercel-sync/providers/doppler.provider.js.map +1 -0
- package/executors/secrets-vercel-sync/providers/secrets-provider.factory.d.ts +17 -0
- package/executors/secrets-vercel-sync/providers/secrets-provider.factory.d.ts.map +1 -0
- package/executors/secrets-vercel-sync/providers/secrets-provider.factory.js +25 -0
- package/executors/secrets-vercel-sync/providers/secrets-provider.factory.js.map +1 -0
- package/executors/secrets-vercel-sync/providers/secrets-provider.interface.d.ts +28 -0
- package/executors/secrets-vercel-sync/providers/secrets-provider.interface.d.ts.map +1 -0
- package/executors/secrets-vercel-sync/providers/secrets-provider.interface.js +4 -0
- package/executors/secrets-vercel-sync/providers/secrets-provider.interface.js.map +1 -0
- package/executors/secrets-vercel-sync/schema.json +112 -0
- package/executors/token-linter/executor.d.ts +10 -0
- package/executors/token-linter/executor.d.ts.map +1 -0
- package/executors/token-linter/executor.js +67 -0
- package/executors/token-linter/executor.js.map +1 -0
- package/executors/token-linter/executor.options.d.ts +19 -0
- package/executors/token-linter/executor.options.d.ts.map +1 -0
- package/executors/token-linter/executor.options.js +4 -0
- package/executors/token-linter/executor.options.js.map +1 -0
- package/executors/token-linter/executor.task.d.ts +33 -0
- package/executors/token-linter/executor.task.d.ts.map +1 -0
- package/executors/token-linter/executor.task.js +60 -0
- package/executors/token-linter/executor.task.js.map +1 -0
- package/executors/token-linter/schema.json +63 -0
- package/executors.json +48 -28
- package/index.d.ts +4 -3
- package/index.d.ts.map +1 -1
- package/index.js +41 -39
- package/index.js.map +1 -1
- package/package.json +21 -17
- package/utils/markdown-processing.d.ts +43 -0
- package/utils/markdown-processing.d.ts.map +1 -0
- package/utils/markdown-processing.js +186 -0
- package/utils/markdown-processing.js.map +1 -0
- package/utils/valid-html-tags.d.ts +6 -0
- package/utils/valid-html-tags.d.ts.map +1 -0
- package/utils/valid-html-tags.js +83 -0
- package/utils/valid-html-tags.js.map +1 -0
|
@@ -0,0 +1,424 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// #region Imports
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.ComponentDocFixer = void 0;
|
|
5
|
+
const utilities_1 = require("@breadstone-infrastructure/utilities");
|
|
6
|
+
/**
|
|
7
|
+
* Reconciles component documentation comment blocks with the actual code.
|
|
8
|
+
* Removes stale tags, adds missing tags, and reorders all tags according to
|
|
9
|
+
* the canonical tag order.
|
|
10
|
+
*
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
class ComponentDocFixer {
|
|
14
|
+
// #region Fields
|
|
15
|
+
/**
|
|
16
|
+
* The canonical order of custom element documentation tags.
|
|
17
|
+
*
|
|
18
|
+
* @private
|
|
19
|
+
*/
|
|
20
|
+
static _TAG_ORDER = [
|
|
21
|
+
'description', 'name', 'element', 'category',
|
|
22
|
+
'slot', 'csspart', 'cssprop', 'fires', 'dependency',
|
|
23
|
+
'example', 'public'
|
|
24
|
+
];
|
|
25
|
+
/**
|
|
26
|
+
* Defines which tags belong to the same visual group in the output.
|
|
27
|
+
* Tags within a group are consecutive; groups are separated by blank lines.
|
|
28
|
+
*
|
|
29
|
+
* @private
|
|
30
|
+
*/
|
|
31
|
+
static _TAG_GROUPS = [
|
|
32
|
+
['description'],
|
|
33
|
+
['name', 'element', 'category'],
|
|
34
|
+
['slot'],
|
|
35
|
+
['csspart'],
|
|
36
|
+
['cssprop'],
|
|
37
|
+
['fires'],
|
|
38
|
+
['dependency'],
|
|
39
|
+
['example'],
|
|
40
|
+
['public'],
|
|
41
|
+
];
|
|
42
|
+
/**
|
|
43
|
+
* Tags that can contain multiple continuation lines (free-form content).
|
|
44
|
+
*
|
|
45
|
+
* @private
|
|
46
|
+
*/
|
|
47
|
+
static _MULTILINE_TAGS = new Set(['description', 'example']);
|
|
48
|
+
// #endregion
|
|
49
|
+
// #region Methods
|
|
50
|
+
/**
|
|
51
|
+
* Reconciles component documentation tags in a file with the actual code.
|
|
52
|
+
* Removes stale tags, adds missing tags, and reorders all tags to match
|
|
53
|
+
* the canonical tag order.
|
|
54
|
+
*
|
|
55
|
+
* @param filePath - The absolute path to the component file to fix.
|
|
56
|
+
* @param result - The validation result containing the class name and missing details.
|
|
57
|
+
* @param slots - The full list of expected slot names from the template.
|
|
58
|
+
* @param parts - The full list of expected csspart names from the template.
|
|
59
|
+
* @param cssVars - The full list of expected CSS custom property names.
|
|
60
|
+
* @param dependencies - The full list of expected dependency class names.
|
|
61
|
+
* @param cssVarTypes - Optional map from CSS variable name to token type (e.g. `color`, `time`).
|
|
62
|
+
* @returns `true` if the file was modified, or a failure reason string.
|
|
63
|
+
* @public
|
|
64
|
+
*/
|
|
65
|
+
static fix(filePath, result, slots, parts, cssVars, dependencies, cssVarTypes = new Map()) {
|
|
66
|
+
const content = utilities_1.File.readAllText(filePath, 'utf8');
|
|
67
|
+
const docMatch = this.findClassDoc(content, result.className);
|
|
68
|
+
if (!docMatch) {
|
|
69
|
+
return `Could not locate a documentation comment block (/** ... */) before class '${result.className}'. ` +
|
|
70
|
+
`The file may use a complex @Component() decorator that the regex cannot parse.`;
|
|
71
|
+
}
|
|
72
|
+
const { start, end, docText } = docMatch;
|
|
73
|
+
const parsed = this.parseDocBlock(docText);
|
|
74
|
+
const reconciled = this.reconcile(parsed, slots, parts, cssVars, dependencies, cssVarTypes);
|
|
75
|
+
const rebuilt = this.rebuildDocBlock(parsed.preambleLines, reconciled);
|
|
76
|
+
if (rebuilt === docText) {
|
|
77
|
+
return `Documentation comment for class '${result.className}' is already correct after reconciliation.`;
|
|
78
|
+
}
|
|
79
|
+
const updatedContent = content.substring(0, start) + rebuilt + content.substring(end);
|
|
80
|
+
utilities_1.File.writeAllText(filePath, updatedContent, 'utf8');
|
|
81
|
+
return true;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Finds the documentation comment block immediately preceding a class declaration.
|
|
85
|
+
* Searches backwards from the class keyword to find the nearest doc block,
|
|
86
|
+
* ensuring it does not accidentally match a doc block for a different declaration.
|
|
87
|
+
*
|
|
88
|
+
* @param content - The full file content.
|
|
89
|
+
* @param className - The class name to find the documentation for.
|
|
90
|
+
* @returns The doc match or `null` if not found.
|
|
91
|
+
* @private
|
|
92
|
+
*/
|
|
93
|
+
static findClassDoc(content, className) {
|
|
94
|
+
// Find the class declaration position
|
|
95
|
+
const classPattern = new RegExp(`export\\s+(?:abstract\\s+)?class\\s+${className}\\b`);
|
|
96
|
+
const classMatch = classPattern.exec(content);
|
|
97
|
+
if (!classMatch) {
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
// Search backwards from the class declaration for the nearest /** ... */ block.
|
|
101
|
+
// Only consider the content before the class keyword.
|
|
102
|
+
const contentBeforeClass = content.substring(0, classMatch.index);
|
|
103
|
+
const docBlockPattern = /\/\*\*[\s\S]*?\*\//g;
|
|
104
|
+
let lastDocMatch = null;
|
|
105
|
+
let currentMatch;
|
|
106
|
+
while ((currentMatch = docBlockPattern.exec(contentBeforeClass)) !== null) {
|
|
107
|
+
lastDocMatch = currentMatch;
|
|
108
|
+
}
|
|
109
|
+
if (!lastDocMatch) {
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
// Verify there are no other declarations (interface, class, type, enum, function)
|
|
113
|
+
// between the doc block end and the class declaration.
|
|
114
|
+
const betweenContent = contentBeforeClass.substring(lastDocMatch.index + lastDocMatch[0].length);
|
|
115
|
+
const declarationPattern = /\b(?:export\s+)?(?:interface|class|type|enum|function)\s+\w+/;
|
|
116
|
+
if (declarationPattern.test(betweenContent)) {
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
const docText = lastDocMatch[0];
|
|
120
|
+
const start = lastDocMatch.index;
|
|
121
|
+
const end = start + docText.length;
|
|
122
|
+
return { start, end, docText };
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Parses a raw documentation comment block into structured preamble and tag sections.
|
|
126
|
+
*
|
|
127
|
+
* @param docText - The raw documentation comment text including opening and closing markers.
|
|
128
|
+
* @returns The parsed representation with preamble lines and tag sections.
|
|
129
|
+
* @private
|
|
130
|
+
*/
|
|
131
|
+
static parseDocBlock(docText) {
|
|
132
|
+
const lines = docText.split('\n');
|
|
133
|
+
const preambleLines = [];
|
|
134
|
+
const tagSections = [];
|
|
135
|
+
let currentTag = null;
|
|
136
|
+
let currentLines = [];
|
|
137
|
+
let inPreamble = true;
|
|
138
|
+
const tagPattern = /^\s*\*\s*@(\w+)/;
|
|
139
|
+
const saveCurrentTag = () => {
|
|
140
|
+
if (currentTag !== null && currentLines.length > 0) {
|
|
141
|
+
// Strip trailing blank comment lines
|
|
142
|
+
while (currentLines.length > 0 && currentLines[currentLines.length - 1].trim() === '*') {
|
|
143
|
+
currentLines.pop();
|
|
144
|
+
}
|
|
145
|
+
if (currentLines.length > 0) {
|
|
146
|
+
tagSections.push({ tag: currentTag, lines: [...currentLines] });
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
currentLines = [];
|
|
150
|
+
};
|
|
151
|
+
for (const line of lines) {
|
|
152
|
+
const trimmed = line.trim();
|
|
153
|
+
if (trimmed === '/**' || trimmed === '*/') {
|
|
154
|
+
continue;
|
|
155
|
+
}
|
|
156
|
+
const tagMatch = tagPattern.exec(line);
|
|
157
|
+
if (tagMatch) {
|
|
158
|
+
saveCurrentTag();
|
|
159
|
+
inPreamble = false;
|
|
160
|
+
currentTag = tagMatch[1];
|
|
161
|
+
currentLines = [line];
|
|
162
|
+
}
|
|
163
|
+
else if (inPreamble) {
|
|
164
|
+
preambleLines.push(line);
|
|
165
|
+
}
|
|
166
|
+
else if (currentTag !== null) {
|
|
167
|
+
const isBlank = trimmed === '*' || trimmed === '';
|
|
168
|
+
if (!isBlank || ComponentDocFixer._MULTILINE_TAGS.has(currentTag)) {
|
|
169
|
+
currentLines.push(line);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
saveCurrentTag();
|
|
174
|
+
// Strip trailing blank lines from preamble
|
|
175
|
+
while (preambleLines.length > 0 && preambleLines[preambleLines.length - 1].trim() === '*') {
|
|
176
|
+
preambleLines.pop();
|
|
177
|
+
}
|
|
178
|
+
return { preambleLines, tagSections };
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Reconciles parsed tag sections with the expected values from the actual code.
|
|
182
|
+
* Removes stale tags, adds missing tags, and orders everything canonically.
|
|
183
|
+
*
|
|
184
|
+
* @param parsed - The parsed documentation block.
|
|
185
|
+
* @param slots - The expected slot names.
|
|
186
|
+
* @param parts - The expected csspart names.
|
|
187
|
+
* @param cssVars - The expected CSS custom property names.
|
|
188
|
+
* @param dependencies - The expected dependency class names.
|
|
189
|
+
* @param cssVarTypes - Map from CSS variable name to token type.
|
|
190
|
+
* @returns The reconciled and ordered tag list.
|
|
191
|
+
* @private
|
|
192
|
+
*/
|
|
193
|
+
static reconcile(parsed, slots, parts, cssVars, dependencies, cssVarTypes = new Map()) {
|
|
194
|
+
// Group existing tags by type
|
|
195
|
+
const tagsByType = new Map();
|
|
196
|
+
for (const section of parsed.tagSections) {
|
|
197
|
+
const group = tagsByType.get(section.tag);
|
|
198
|
+
if (group) {
|
|
199
|
+
group.push(section);
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
tagsByType.set(section.tag, [section]);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
const result = [];
|
|
206
|
+
// Emit tags in canonical order
|
|
207
|
+
for (const tag of ComponentDocFixer._TAG_ORDER) {
|
|
208
|
+
const existing = tagsByType.get(tag) ?? [];
|
|
209
|
+
switch (tag) {
|
|
210
|
+
case 'slot':
|
|
211
|
+
result.push(...this.reconcileTagGroup('slot', existing, slots, (value) => ` * @slot ${value} - The ${value || 'default'} slot.`));
|
|
212
|
+
break;
|
|
213
|
+
case 'csspart':
|
|
214
|
+
result.push(...this.reconcileTagGroup('csspart', existing, parts, (value) => ` * @csspart ${value} - The ${value} part.`));
|
|
215
|
+
break;
|
|
216
|
+
case 'cssprop':
|
|
217
|
+
result.push(...this.reconcileTagGroup('cssprop', existing, cssVars, (value) => ` * @cssprop {${this.tokenTypeToCsspropType(cssVarTypes.get(value))}} ${value} - The ${this.cssVarToDescription(value)} CSS custom property.`));
|
|
218
|
+
break;
|
|
219
|
+
case 'dependency':
|
|
220
|
+
result.push(...this.reconcileTagGroup('dependency', existing, dependencies, (value) => ` * @dependency ${value} - The ${this.tagNameToDescription(value)} element.`));
|
|
221
|
+
break;
|
|
222
|
+
default:
|
|
223
|
+
// Non-reconcilable tags (description, name, element, category, fires, example, public): keep as-is
|
|
224
|
+
result.push(...existing);
|
|
225
|
+
break;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
// Preserve unknown tags not in _TAG_ORDER
|
|
229
|
+
for (const [tag, sections] of tagsByType.entries()) {
|
|
230
|
+
if (!ComponentDocFixer._TAG_ORDER.includes(tag)) {
|
|
231
|
+
result.push(...sections);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
return result;
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Reconciles a single tag group against the expected values.
|
|
238
|
+
* Keeps existing tags that match an expected value, removes stale ones,
|
|
239
|
+
* and adds new tags for uncovered values.
|
|
240
|
+
*
|
|
241
|
+
* @param tagName - The tag type being reconciled.
|
|
242
|
+
* @param existing - The existing tags of this type from the doc block.
|
|
243
|
+
* @param expectedValues - The expected values from the actual code.
|
|
244
|
+
* @param generateLine - A factory to produce new tag lines for missing values.
|
|
245
|
+
* @returns The reconciled tags: preserved originals first, then newly generated ones.
|
|
246
|
+
* @private
|
|
247
|
+
*/
|
|
248
|
+
static reconcileTagGroup(tagName, existing, expectedValues, generateLine) {
|
|
249
|
+
const result = [];
|
|
250
|
+
const covered = new Set();
|
|
251
|
+
const tagToValue = new Map();
|
|
252
|
+
// Keep existing tags that match an expected value
|
|
253
|
+
for (const tag of existing) {
|
|
254
|
+
const tagText = tag.lines.join(' ');
|
|
255
|
+
let matched = false;
|
|
256
|
+
for (const value of expectedValues) {
|
|
257
|
+
if (!covered.has(value) && this.tagContainsValue(tagText, value, tagName)) {
|
|
258
|
+
covered.add(value);
|
|
259
|
+
matched = true;
|
|
260
|
+
tagToValue.set(tag, value);
|
|
261
|
+
break;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
if (matched) {
|
|
265
|
+
result.push(tag);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
// Add new tags for uncovered expected values
|
|
269
|
+
for (const value of expectedValues) {
|
|
270
|
+
if (!covered.has(value)) {
|
|
271
|
+
const tag = { tag: tagName, lines: [generateLine(value)] };
|
|
272
|
+
tagToValue.set(tag, value);
|
|
273
|
+
result.push(tag);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
// Sort alphabetically; empty string (default slot) always first
|
|
277
|
+
result.sort((a, b) => {
|
|
278
|
+
const valueA = tagToValue.get(a) ?? '';
|
|
279
|
+
const valueB = tagToValue.get(b) ?? '';
|
|
280
|
+
if (valueA === '' && valueB !== '') {
|
|
281
|
+
return -1;
|
|
282
|
+
}
|
|
283
|
+
if (valueA !== '' && valueB === '') {
|
|
284
|
+
return 1;
|
|
285
|
+
}
|
|
286
|
+
return valueA.localeCompare(valueB);
|
|
287
|
+
});
|
|
288
|
+
return result;
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Checks whether a tag text contains a specific expected value using
|
|
292
|
+
* precise matching to avoid substring false positives.
|
|
293
|
+
*
|
|
294
|
+
* @param tagText - The concatenated text of the tag lines.
|
|
295
|
+
* @param value - The expected value to look for.
|
|
296
|
+
* @param tagName - The tag type for context-aware matching.
|
|
297
|
+
* @returns `true` if the tag documents the given value.
|
|
298
|
+
* @private
|
|
299
|
+
*/
|
|
300
|
+
static tagContainsValue(tagText, value, tagName) {
|
|
301
|
+
if (value === '') {
|
|
302
|
+
// Default/unnamed slot: matches @slot - description (no name before the dash)
|
|
303
|
+
if (tagName === 'slot') {
|
|
304
|
+
return /\*\s*@slot\s+-\s/.test(tagText) || /\*\s*@slot\s*$/.test(tagText);
|
|
305
|
+
}
|
|
306
|
+
return true;
|
|
307
|
+
}
|
|
308
|
+
const escaped = value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
309
|
+
// CSS variables: exact match with non-word-hyphen lookahead
|
|
310
|
+
if (value.startsWith('--')) {
|
|
311
|
+
return new RegExp(`${escaped}(?![\\w-])`).test(tagText);
|
|
312
|
+
}
|
|
313
|
+
// Identifiers: exact match with word-boundary-like checks
|
|
314
|
+
return new RegExp(`(?<![\\w-])${escaped}(?![\\w-])`).test(tagText);
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Rebuilds a documentation comment block from preamble and ordered tag sections.
|
|
318
|
+
* Groups tags visually according to the tag group definitions and separates
|
|
319
|
+
* groups with blank comment lines.
|
|
320
|
+
*
|
|
321
|
+
* @param preambleLines - The preamble text lines.
|
|
322
|
+
* @param tags - The ordered tag sections.
|
|
323
|
+
* @returns The complete documentation comment string.
|
|
324
|
+
* @private
|
|
325
|
+
*/
|
|
326
|
+
static rebuildDocBlock(preambleLines, tags) {
|
|
327
|
+
const sections = [];
|
|
328
|
+
// Section 0: preamble
|
|
329
|
+
if (preambleLines.length > 0) {
|
|
330
|
+
sections.push([...preambleLines]);
|
|
331
|
+
}
|
|
332
|
+
// Group tags by their visual group
|
|
333
|
+
let currentGroupIndex = -1;
|
|
334
|
+
let currentGroupLines = [];
|
|
335
|
+
let lastTag = null;
|
|
336
|
+
for (const tag of tags) {
|
|
337
|
+
const groupIndex = this.getTagGroupIndex(tag.tag);
|
|
338
|
+
if (groupIndex !== currentGroupIndex && currentGroupLines.length > 0) {
|
|
339
|
+
sections.push(currentGroupLines);
|
|
340
|
+
currentGroupLines = [];
|
|
341
|
+
}
|
|
342
|
+
// Separate consecutive multiline tags (e.g. @example) with a blank line
|
|
343
|
+
if (tag.tag === lastTag && ComponentDocFixer._MULTILINE_TAGS.has(tag.tag)) {
|
|
344
|
+
currentGroupLines.push(' *');
|
|
345
|
+
}
|
|
346
|
+
currentGroupLines.push(...tag.lines);
|
|
347
|
+
currentGroupIndex = groupIndex;
|
|
348
|
+
lastTag = tag.tag;
|
|
349
|
+
}
|
|
350
|
+
if (currentGroupLines.length > 0) {
|
|
351
|
+
sections.push(currentGroupLines);
|
|
352
|
+
}
|
|
353
|
+
// Join sections with ' *' separators
|
|
354
|
+
const output = ['/**'];
|
|
355
|
+
for (let i = 0; i < sections.length; i++) {
|
|
356
|
+
if (i > 0) {
|
|
357
|
+
output.push(' *');
|
|
358
|
+
}
|
|
359
|
+
output.push(...sections[i]);
|
|
360
|
+
}
|
|
361
|
+
output.push(' */');
|
|
362
|
+
return output.join('\n');
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* Gets the visual group index for a tag type.
|
|
366
|
+
*
|
|
367
|
+
* @param tag - The tag type.
|
|
368
|
+
* @returns The group index, or `-1` for unknown tags.
|
|
369
|
+
* @private
|
|
370
|
+
*/
|
|
371
|
+
static getTagGroupIndex(tag) {
|
|
372
|
+
return ComponentDocFixer._TAG_GROUPS.findIndex((group) => group.includes(tag));
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Generates a human-readable description from a CSS variable name.
|
|
376
|
+
*
|
|
377
|
+
* @param cssVar - The CSS variable name (e.g. `--button-font-family`).
|
|
378
|
+
* @returns A human-readable description.
|
|
379
|
+
* @private
|
|
380
|
+
*/
|
|
381
|
+
static cssVarToDescription(cssVar) {
|
|
382
|
+
const segments = cssVar.replace(/^--/, '').split('-');
|
|
383
|
+
if (segments.length <= 1) {
|
|
384
|
+
return cssVar;
|
|
385
|
+
}
|
|
386
|
+
return segments.slice(1).join(' ');
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Converts a `mosaik-*` tag name to a human-readable description.
|
|
390
|
+
*
|
|
391
|
+
* @param tagName - The tag name (e.g. `mosaik-fab`).
|
|
392
|
+
* @returns A human-readable description (e.g. `Fab`).
|
|
393
|
+
* @private
|
|
394
|
+
*/
|
|
395
|
+
static tagNameToDescription(tagName) {
|
|
396
|
+
return tagName
|
|
397
|
+
.replace(/^mosaik-/, '')
|
|
398
|
+
.split('-')
|
|
399
|
+
.map((segment) => segment.charAt(0).toUpperCase() + segment.slice(1))
|
|
400
|
+
.join(' ');
|
|
401
|
+
}
|
|
402
|
+
/**
|
|
403
|
+
* Maps a token type from the JSON definition to the PascalCase type
|
|
404
|
+
* used in `@cssprop` annotations.
|
|
405
|
+
*
|
|
406
|
+
* @param tokenType - The token type from the JSON (e.g. `color`, `time`).
|
|
407
|
+
* @returns The PascalCase type for the `@cssprop` tag (e.g. `Color`, `String`).
|
|
408
|
+
* @private
|
|
409
|
+
*/
|
|
410
|
+
static tokenTypeToCsspropType(tokenType) {
|
|
411
|
+
switch (tokenType) {
|
|
412
|
+
case 'color':
|
|
413
|
+
return 'Color';
|
|
414
|
+
case 'number':
|
|
415
|
+
return 'Number';
|
|
416
|
+
case 'array':
|
|
417
|
+
return 'Array';
|
|
418
|
+
default:
|
|
419
|
+
return 'String';
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
exports.ComponentDocFixer = ComponentDocFixer;
|
|
424
|
+
//# sourceMappingURL=ComponentDocFixer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ComponentDocFixer.js","sourceRoot":"","sources":["../../../src/executors/lit-docs/ComponentDocFixer.ts"],"names":[],"mappings":";AAAA,kBAAkB;;;AAElB,oEAA4D;AAqC5D;;;;;;GAMG;AACH,MAAa,iBAAiB;IAE1B,iBAAiB;IAEjB;;;;OAIG;IACK,MAAM,CAAU,UAAU,GAA0B;QACxD,aAAa,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU;QAC5C,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,YAAY;QACnD,SAAS,EAAE,QAAQ;KACtB,CAAC;IAEF;;;;;OAKG;IACK,MAAM,CAAU,WAAW,GAAyC;QACxE,CAAC,aAAa,CAAC;QACf,CAAC,MAAM,EAAE,SAAS,EAAE,UAAU,CAAC;QAC/B,CAAC,MAAM,CAAC;QACR,CAAC,SAAS,CAAC;QACX,CAAC,SAAS,CAAC;QACX,CAAC,OAAO,CAAC;QACT,CAAC,YAAY,CAAC;QACd,CAAC,SAAS,CAAC;QACX,CAAC,QAAQ,CAAC;KACb,CAAC;IAEF;;;;OAIG;IACK,MAA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
export interface IJSDocMatch {
|
|
8
|
+
readonly start: number;
|
|
9
|
+
readonly end: number;
|
|
10
|
+
readonly jsDocText: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Surgically fixes missing JSDoc tags in component files by inserting
|
|
14
|
+
* only the missing tags at their correct positions, preserving all existing content.
|
|
15
|
+
*
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
18
|
+
export declare class JSDocFixer {
|
|
19
|
+
/**
|
|
20
|
+
* The canonical order of JSDoc tags for component documentation.
|
|
21
|
+
*
|
|
22
|
+
* @private
|
|
23
|
+
*/
|
|
24
|
+
private static readonly _TAG_ORDER;
|
|
25
|
+
/**
|
|
26
|
+
* Fixes missing JSDoc tags in a component file based on validation results.
|
|
27
|
+
*
|
|
28
|
+
* @param filePath - The absolute path to the component file to fix.
|
|
29
|
+
* @param result - The validation result containing missing tags.
|
|
30
|
+
* @param slots - The full list of expected slots.
|
|
31
|
+
* @param parts - The full list of expected cssparts.
|
|
32
|
+
* @param cssVars - The full list of expected CSS custom properties.
|
|
33
|
+
* @param dependencies - The full list of expected dependencies.
|
|
34
|
+
* @returns `true` if the file was modified, `false` otherwise.
|
|
35
|
+
* @public
|
|
36
|
+
*/
|
|
37
|
+
static fix(filePath: string, result: IJSDocCheckerResult, slots: Array<string>, parts: Array<string>, cssVars: Array<string>, dependencies: Array<string>): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Finds the JSDoc comment block immediately preceding a class declaration.
|
|
40
|
+
*
|
|
41
|
+
* @param content - The full file content.
|
|
42
|
+
* @param className - The class name to find the JSDoc for.
|
|
43
|
+
* @returns The JSDoc match or `null` if not found.
|
|
44
|
+
* @private
|
|
45
|
+
*/
|
|
46
|
+
private static findClassJSDoc;
|
|
47
|
+
/**
|
|
48
|
+
* Inserts missing tag lines into the existing JSDoc at correct positions.
|
|
49
|
+
*
|
|
50
|
+
* @param lines - The existing JSDoc lines.
|
|
51
|
+
* @param missingSlots - Lines to insert for missing slots.
|
|
52
|
+
* @param missingParts - Lines to insert for missing cssparts.
|
|
53
|
+
* @param missingProps - Lines to insert for missing cssprops.
|
|
54
|
+
* @param missingEvents - Lines to insert for missing events.
|
|
55
|
+
* @param missingDeps - Lines to insert for missing dependencies.
|
|
56
|
+
* @returns The updated lines or `null` if nothing was missing.
|
|
57
|
+
* @private
|
|
58
|
+
*/
|
|
59
|
+
private static insertMissingTags;
|
|
60
|
+
/**
|
|
61
|
+
* Inserts a group of missing tag lines after existing tags of the same type,
|
|
62
|
+
* or at the correct position based on tag ordering rules.
|
|
63
|
+
*
|
|
64
|
+
* @param lines - The JSDoc lines to mutate.
|
|
65
|
+
* @param tagName - The tag type to insert (e.g. `slot`, `cssprop`).
|
|
66
|
+
* @param newLines - The new tag lines to insert.
|
|
67
|
+
* @private
|
|
68
|
+
*/
|
|
69
|
+
private static insertTagGroup;
|
|
70
|
+
/**
|
|
71
|
+
* Finds the last line index containing a specific JSDoc tag.
|
|
72
|
+
*
|
|
73
|
+
* @param lines - The JSDoc lines to search.
|
|
74
|
+
* @param tagName - The tag name to search for.
|
|
75
|
+
* @returns The line index or `-1` if not found.
|
|
76
|
+
* @private
|
|
77
|
+
*/
|
|
78
|
+
private static findLastTagIndex;
|
|
79
|
+
/**
|
|
80
|
+
* Finds the first line index containing a specific JSDoc tag.
|
|
81
|
+
*
|
|
82
|
+
* @param lines - The JSDoc lines to search.
|
|
83
|
+
* @param tagName - The tag name to search for.
|
|
84
|
+
* @returns The line index or `-1` if not found.
|
|
85
|
+
* @private
|
|
86
|
+
*/
|
|
87
|
+
private static findFirstTagIndex;
|
|
88
|
+
/**
|
|
89
|
+
* Generates a human-readable description from a CSS variable name.
|
|
90
|
+
*
|
|
91
|
+
* @param cssVar - The CSS variable name (e.g. `--button-font-family`).
|
|
92
|
+
* @returns A human-readable description.
|
|
93
|
+
* @private
|
|
94
|
+
*/
|
|
95
|
+
private static cssVarToDescription;
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=JSDocFixer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JSDocFixer.d.ts","sourceRoot":"","sources":["../../../src/executors/lit-docs/JSDocFixer.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAI1D;;;;GAIG;AACH,MAAM,WAAW,WAAW;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC9B;AAED;;;;;GAKG;AACH,qBAAa,UAAU;IAInB;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAIhC;IAMF;;;;;;;;;;;OAWG;WACW,GAAG,CACb,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,mBAAmB,EAC3B,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,EACpB,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,EACpB,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,EACtB,YAAY,EAAE,KAAK,CAAC,MAAM,CAAC,GAC5B,OAAO;IAmDV;;;;;;;OAOG;IACH,OAAO,CAAC,MAAM,CAAC,cAAc;IAiB7B;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,MAAM,CAAC,iBAAiB;IA8BhC;;;;;;;;OAQG;IACH,OAAO,CAAC,MAAM,CAAC,cAAc;IA4C7B;;;;;;;OAOG;IACH,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAY/B;;;;;;;OAOG;IACH,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAYhC;;;;;;OAMG;IACH,OAAO,CAAC,MAAM,CAAC,mBAAmB;CAYrC"}
|