@textmode/docs 0.4.2 → 0.5.0
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/LICENSE +21 -121
- package/README.md +24 -25
- package/dist/cli/textmode-docs.d.ts +3 -0
- package/dist/cli/textmode-docs.d.ts.map +1 -0
- package/dist/cli/textmode-docs.js +227 -0
- package/dist/cli/textmode-docs.js.map +1 -0
- package/dist/example-quality.d.ts +59 -0
- package/dist/example-quality.d.ts.map +1 -0
- package/dist/example-quality.js +256 -0
- package/dist/example-quality.js.map +1 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +43 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/check-api-documentation.d.ts +5 -0
- package/dist/internal/check-api-documentation.d.ts.map +1 -0
- package/dist/internal/check-api-documentation.js +74 -0
- package/dist/internal/check-api-documentation.js.map +1 -0
- package/dist/internal/check-example-sketches.d.ts +3 -0
- package/dist/internal/check-example-sketches.d.ts.map +1 -0
- package/dist/internal/check-example-sketches.js +76 -0
- package/dist/internal/check-example-sketches.js.map +1 -0
- package/dist/internal/config.d.ts +104 -0
- package/dist/internal/config.d.ts.map +1 -0
- package/dist/internal/config.js +324 -0
- package/dist/internal/config.js.map +1 -0
- package/dist/internal/documentation-commands.d.ts +24 -0
- package/dist/internal/documentation-commands.d.ts.map +1 -0
- package/dist/internal/documentation-commands.js +43 -0
- package/dist/internal/documentation-commands.js.map +1 -0
- package/dist/internal/lib/api-doc-checks.d.ts +46 -0
- package/dist/internal/lib/api-doc-checks.d.ts.map +1 -0
- package/dist/internal/lib/api-doc-checks.js +111 -0
- package/dist/internal/lib/api-doc-checks.js.map +1 -0
- package/dist/internal/lib/api-doc-routes.d.ts +7 -0
- package/dist/internal/lib/api-doc-routes.d.ts.map +1 -0
- package/dist/internal/lib/api-doc-routes.js +74 -0
- package/dist/internal/lib/api-doc-routes.js.map +1 -0
- package/dist/internal/lib/example-checks.d.ts +58 -0
- package/dist/internal/lib/example-checks.d.ts.map +1 -0
- package/dist/internal/lib/example-checks.js +230 -0
- package/dist/internal/lib/example-checks.js.map +1 -0
- package/dist/internal/lib/jsdoc-comments.d.ts +8 -0
- package/dist/internal/lib/jsdoc-comments.d.ts.map +1 -0
- package/dist/internal/lib/jsdoc-comments.js +67 -0
- package/dist/internal/lib/jsdoc-comments.js.map +1 -0
- package/dist/internal/lib/label-schema.d.ts +18 -0
- package/dist/internal/lib/label-schema.d.ts.map +1 -0
- package/dist/internal/lib/label-schema.js +17 -0
- package/dist/internal/lib/label-schema.js.map +1 -0
- package/dist/internal/lib/reflection-policy.d.ts +21 -0
- package/dist/internal/lib/reflection-policy.d.ts.map +1 -0
- package/dist/internal/lib/reflection-policy.js +96 -0
- package/dist/internal/lib/reflection-policy.js.map +1 -0
- package/dist/internal/lib/reporting.d.ts +8 -0
- package/dist/internal/lib/reporting.d.ts.map +1 -0
- package/dist/internal/lib/reporting.js +21 -0
- package/dist/internal/lib/reporting.js.map +1 -0
- package/dist/internal/lib/sketch-title.d.ts +14 -0
- package/dist/internal/lib/sketch-title.d.ts.map +1 -0
- package/dist/internal/lib/sketch-title.js +13 -0
- package/dist/internal/lib/sketch-title.js.map +1 -0
- package/dist/internal/reconcile-dates.d.ts +19 -0
- package/dist/internal/reconcile-dates.d.ts.map +1 -0
- package/dist/internal/reconcile-dates.js +77 -0
- package/dist/internal/reconcile-dates.js.map +1 -0
- package/dist/internal/reflection-kinds.d.ts +12 -0
- package/dist/internal/reflection-kinds.d.ts.map +1 -0
- package/dist/internal/reflection-kinds.js +19 -0
- package/dist/internal/reflection-kinds.js.map +1 -0
- package/dist/internal/typedoc-plugins/accessor-docs-normalizer/accessor-comments.d.ts +10 -0
- package/dist/internal/typedoc-plugins/accessor-docs-normalizer/accessor-comments.d.ts.map +1 -0
- package/dist/internal/typedoc-plugins/accessor-docs-normalizer/accessor-comments.js +31 -0
- package/dist/internal/typedoc-plugins/accessor-docs-normalizer/accessor-comments.js.map +1 -0
- package/dist/internal/typedoc-plugins/accessor-docs-normalizer/index.d.ts +3 -0
- package/dist/internal/typedoc-plugins/accessor-docs-normalizer/index.d.ts.map +1 -0
- package/dist/internal/typedoc-plugins/accessor-docs-normalizer/index.js +16 -0
- package/dist/internal/typedoc-plugins/accessor-docs-normalizer/index.js.map +1 -0
- package/dist/internal/typedoc-plugins/accessor-docs-normalizer/render-accessor.d.ts +9 -0
- package/dist/internal/typedoc-plugins/accessor-docs-normalizer/render-accessor.d.ts.map +1 -0
- package/dist/internal/typedoc-plugins/accessor-docs-normalizer/render-accessor.js +85 -0
- package/dist/internal/typedoc-plugins/accessor-docs-normalizer/render-accessor.js.map +1 -0
- package/dist/internal/typedoc-plugins/accessor-docs-normalizer/theme-patch.d.ts +7 -0
- package/dist/internal/typedoc-plugins/accessor-docs-normalizer/theme-patch.d.ts.map +1 -0
- package/dist/internal/typedoc-plugins/accessor-docs-normalizer/theme-patch.js +16 -0
- package/dist/internal/typedoc-plugins/accessor-docs-normalizer/theme-patch.js.map +1 -0
- package/dist/internal/typedoc-plugins/all-member-pages-router/child-pages.d.ts +16 -0
- package/dist/internal/typedoc-plugins/all-member-pages-router/child-pages.d.ts.map +1 -0
- package/dist/internal/typedoc-plugins/all-member-pages-router/child-pages.js +33 -0
- package/dist/internal/typedoc-plugins/all-member-pages-router/child-pages.js.map +1 -0
- package/dist/internal/typedoc-plugins/all-member-pages-router/constants.d.ts +9 -0
- package/dist/internal/typedoc-plugins/all-member-pages-router/constants.d.ts.map +1 -0
- package/dist/internal/typedoc-plugins/all-member-pages-router/constants.js +44 -0
- package/dist/internal/typedoc-plugins/all-member-pages-router/constants.js.map +1 -0
- package/dist/internal/typedoc-plugins/all-member-pages-router/index.d.ts +2 -0
- package/dist/internal/typedoc-plugins/all-member-pages-router/index.d.ts.map +1 -0
- package/dist/internal/typedoc-plugins/all-member-pages-router/index.js +2 -0
- package/dist/internal/typedoc-plugins/all-member-pages-router/index.js.map +1 -0
- package/dist/internal/typedoc-plugins/all-member-pages-router/member-paths.d.ts +11 -0
- package/dist/internal/typedoc-plugins/all-member-pages-router/member-paths.d.ts.map +1 -0
- package/dist/internal/typedoc-plugins/all-member-pages-router/member-paths.js +12 -0
- package/dist/internal/typedoc-plugins/all-member-pages-router/member-paths.js.map +1 -0
- package/dist/internal/typedoc-plugins/all-member-pages-router/member-reflections.d.ts +8 -0
- package/dist/internal/typedoc-plugins/all-member-pages-router/member-reflections.d.ts.map +1 -0
- package/dist/internal/typedoc-plugins/all-member-pages-router/member-reflections.js +78 -0
- package/dist/internal/typedoc-plugins/all-member-pages-router/member-reflections.js.map +1 -0
- package/dist/internal/typedoc-plugins/all-member-pages-router/namespace-paths.d.ts +8 -0
- package/dist/internal/typedoc-plugins/all-member-pages-router/namespace-paths.d.ts.map +1 -0
- package/dist/internal/typedoc-plugins/all-member-pages-router/namespace-paths.js +22 -0
- package/dist/internal/typedoc-plugins/all-member-pages-router/namespace-paths.js.map +1 -0
- package/dist/internal/typedoc-plugins/all-member-pages-router/router.d.ts +22 -0
- package/dist/internal/typedoc-plugins/all-member-pages-router/router.d.ts.map +1 -0
- package/dist/internal/typedoc-plugins/all-member-pages-router/router.js +44 -0
- package/dist/internal/typedoc-plugins/all-member-pages-router/router.js.map +1 -0
- package/dist/internal/typedoc-plugins/api-frontmatter/constants.d.ts +11 -0
- package/dist/internal/typedoc-plugins/api-frontmatter/constants.d.ts.map +1 -0
- package/dist/internal/typedoc-plugins/api-frontmatter/constants.js +38 -0
- package/dist/internal/typedoc-plugins/api-frontmatter/constants.js.map +1 -0
- package/dist/internal/typedoc-plugins/api-frontmatter/descriptions.d.ts +18 -0
- package/dist/internal/typedoc-plugins/api-frontmatter/descriptions.d.ts.map +1 -0
- package/dist/internal/typedoc-plugins/api-frontmatter/descriptions.js +43 -0
- package/dist/internal/typedoc-plugins/api-frontmatter/descriptions.js.map +1 -0
- package/dist/internal/typedoc-plugins/api-frontmatter/frontmatter.d.ts +5 -0
- package/dist/internal/typedoc-plugins/api-frontmatter/frontmatter.d.ts.map +1 -0
- package/dist/internal/typedoc-plugins/api-frontmatter/frontmatter.js +29 -0
- package/dist/internal/typedoc-plugins/api-frontmatter/frontmatter.js.map +1 -0
- package/dist/internal/typedoc-plugins/api-frontmatter/index.d.ts +6 -0
- package/dist/internal/typedoc-plugins/api-frontmatter/index.d.ts.map +1 -0
- package/dist/internal/typedoc-plugins/api-frontmatter/index.js +19 -0
- package/dist/internal/typedoc-plugins/api-frontmatter/index.js.map +1 -0
- package/dist/internal/typedoc-plugins/api-frontmatter/library-context.d.ts +9 -0
- package/dist/internal/typedoc-plugins/api-frontmatter/library-context.d.ts.map +1 -0
- package/dist/internal/typedoc-plugins/api-frontmatter/library-context.js +11 -0
- package/dist/internal/typedoc-plugins/api-frontmatter/library-context.js.map +1 -0
- package/dist/internal/typedoc-plugins/api-frontmatter/reflection-metadata.d.ts +15 -0
- package/dist/internal/typedoc-plugins/api-frontmatter/reflection-metadata.d.ts.map +1 -0
- package/dist/internal/typedoc-plugins/api-frontmatter/reflection-metadata.js +46 -0
- package/dist/internal/typedoc-plugins/api-frontmatter/reflection-metadata.js.map +1 -0
- package/dist/internal/typedoc-plugins/include-code-examples/code-fences.d.ts +7 -0
- package/dist/internal/typedoc-plugins/include-code-examples/code-fences.d.ts.map +1 -0
- package/dist/internal/typedoc-plugins/include-code-examples/code-fences.js +23 -0
- package/dist/internal/typedoc-plugins/include-code-examples/code-fences.js.map +1 -0
- package/dist/internal/typedoc-plugins/include-code-examples/example-metadata.d.ts +7 -0
- package/dist/internal/typedoc-plugins/include-code-examples/example-metadata.d.ts.map +1 -0
- package/dist/internal/typedoc-plugins/include-code-examples/example-metadata.js +18 -0
- package/dist/internal/typedoc-plugins/include-code-examples/example-metadata.js.map +1 -0
- package/dist/internal/typedoc-plugins/include-code-examples/index.d.ts +4 -0
- package/dist/internal/typedoc-plugins/include-code-examples/index.d.ts.map +1 -0
- package/dist/internal/typedoc-plugins/include-code-examples/index.js +12 -0
- package/dist/internal/typedoc-plugins/include-code-examples/index.js.map +1 -0
- package/dist/internal/typedoc-plugins/include-code-examples/transform-markdown.d.ts +2 -0
- package/dist/internal/typedoc-plugins/include-code-examples/transform-markdown.d.ts.map +1 -0
- package/dist/internal/typedoc-plugins/include-code-examples/transform-markdown.js +17 -0
- package/dist/internal/typedoc-plugins/include-code-examples/transform-markdown.js.map +1 -0
- package/dist/internal/typedoc-plugins/strip-api-self-links/index.d.ts +8 -0
- package/dist/internal/typedoc-plugins/strip-api-self-links/index.d.ts.map +1 -0
- package/dist/internal/typedoc-plugins/strip-api-self-links/index.js +62 -0
- package/dist/internal/typedoc-plugins/strip-api-self-links/index.js.map +1 -0
- package/dist/internal/typedoc-runner.d.ts +31 -0
- package/dist/internal/typedoc-runner.d.ts.map +1 -0
- package/dist/internal/typedoc-runner.js +179 -0
- package/dist/internal/typedoc-runner.js.map +1 -0
- package/dist/internal/update-api-links.d.ts +7 -0
- package/dist/internal/update-api-links.d.ts.map +1 -0
- package/dist/internal/update-api-links.js +65 -0
- package/dist/internal/update-api-links.js.map +1 -0
- package/package.json +57 -59
- package/index.d.ts +0 -37
- package/src/cli/textmode-docs.mjs +0 -219
- package/src/index.js +0 -23
- package/src/internal/config.js +0 -387
- package/src/internal/lib/api-doc-checks.mjs +0 -147
- package/src/internal/lib/api-doc-routes.mjs +0 -93
- package/src/internal/lib/example-checks.mjs +0 -405
- package/src/internal/lib/jsdoc-comments.mjs +0 -78
- package/src/internal/lib/reflection-policy.mjs +0 -113
- package/src/internal/lib/reporting.mjs +0 -23
- package/src/internal/operations.js +0 -275
- package/src/internal/reconcile-dates.js +0 -72
- package/src/internal/reflection-kinds.js +0 -21
- package/src/internal/typedoc-plugins/accessor-docs-normalizer/README.md +0 -45
- package/src/internal/typedoc-plugins/accessor-docs-normalizer/accessor-comments.js +0 -53
- package/src/internal/typedoc-plugins/accessor-docs-normalizer/index.js +0 -32
- package/src/internal/typedoc-plugins/accessor-docs-normalizer/render-accessor.js +0 -144
- package/src/internal/typedoc-plugins/accessor-docs-normalizer/theme-patch.js +0 -28
- package/src/internal/typedoc-plugins/all-member-pages-router/README.md +0 -57
- package/src/internal/typedoc-plugins/all-member-pages-router/child-pages.js +0 -65
- package/src/internal/typedoc-plugins/all-member-pages-router/constants.js +0 -58
- package/src/internal/typedoc-plugins/all-member-pages-router/index.js +0 -18
- package/src/internal/typedoc-plugins/all-member-pages-router/member-paths.js +0 -48
- package/src/internal/typedoc-plugins/all-member-pages-router/member-reflections.js +0 -164
- package/src/internal/typedoc-plugins/all-member-pages-router/namespace-paths.js +0 -44
- package/src/internal/typedoc-plugins/all-member-pages-router/router.js +0 -58
- package/src/internal/typedoc-plugins/api-frontmatter/README.md +0 -66
- package/src/internal/typedoc-plugins/api-frontmatter/constants.js +0 -52
- package/src/internal/typedoc-plugins/api-frontmatter/descriptions.js +0 -87
- package/src/internal/typedoc-plugins/api-frontmatter/frontmatter.js +0 -57
- package/src/internal/typedoc-plugins/api-frontmatter/index.js +0 -39
- package/src/internal/typedoc-plugins/api-frontmatter/library-context.js +0 -38
- package/src/internal/typedoc-plugins/api-frontmatter/reflection-metadata.js +0 -95
- package/src/internal/typedoc-plugins/include-code-examples/README.md +0 -40
- package/src/internal/typedoc-plugins/include-code-examples/code-fences.js +0 -55
- package/src/internal/typedoc-plugins/include-code-examples/example-metadata.js +0 -41
- package/src/internal/typedoc-plugins/include-code-examples/index.js +0 -23
- package/src/internal/typedoc-plugins/include-code-examples/transform-markdown.js +0 -33
- package/src/internal/typedoc-plugins/strip-api-self-links/index.js +0 -117
- package/src/internal/typedoc-runner.js +0 -200
|
@@ -1,405 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
|
|
4
|
-
const INCLUDE_CODE_PATTERN = /\{@includeCode\s+([^}\s]+)[^}]*\}/g;
|
|
5
|
-
const MANIFEST_KEYS = new Set(['version', 'description', 'groups']);
|
|
6
|
-
const GROUP_KEYS = new Set(['name', 'description', 'examples', 'subgroups']);
|
|
7
|
-
const SUBGROUP_KEYS = new Set(['name', 'description', 'examples']);
|
|
8
|
-
const EXAMPLE_KEYS = new Set(['title', 'description', 'sourceFile', 'status']);
|
|
9
|
-
|
|
10
|
-
export const EXAMPLES_DIR = 'examples';
|
|
11
|
-
export const EXAMPLES_INDEX = path.join(EXAMPLES_DIR, 'index.html');
|
|
12
|
-
export const EXAMPLES_MANIFEST = path.join(EXAMPLES_DIR, 'manifest.json');
|
|
13
|
-
export const SOURCE_DIR = 'src';
|
|
14
|
-
|
|
15
|
-
export function isRecord(value) {
|
|
16
|
-
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export function getUnknownKeys(value, allowedKeys) {
|
|
20
|
-
return Object.keys(value).filter((key) => !allowedKeys.has(key));
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export function toRepositoryPath(filePath, projectRoot) {
|
|
24
|
-
return path.relative(projectRoot, filePath).split(path.sep).join('/');
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export function getTypeScriptFiles(directory) {
|
|
28
|
-
const files = [];
|
|
29
|
-
|
|
30
|
-
for (const entry of fs.readdirSync(directory, { withFileTypes: true })) {
|
|
31
|
-
const entryPath = path.join(directory, entry.name);
|
|
32
|
-
|
|
33
|
-
if (entry.isDirectory()) {
|
|
34
|
-
files.push(...getTypeScriptFiles(entryPath));
|
|
35
|
-
} else if (entry.isFile() && entry.name.endsWith('.ts')) {
|
|
36
|
-
files.push(entryPath);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return files;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export function readExamplesManifest(manifestPath = EXAMPLES_MANIFEST) {
|
|
44
|
-
return JSON.parse(fs.readFileSync(manifestPath, 'utf8'));
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export function readExamplesIndex(indexPath = EXAMPLES_INDEX) {
|
|
48
|
-
return fs.readFileSync(indexPath, 'utf8');
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export function getSketchTitle(filePath) {
|
|
52
|
-
const content = fs.readFileSync(filePath, 'utf8');
|
|
53
|
-
const docstringMatch = content.match(/^\s*\/\*\*([\s\S]*?)\*\//);
|
|
54
|
-
const titleMatch = docstringMatch?.[1].match(/@title\s+([^\r\n]+)/);
|
|
55
|
-
|
|
56
|
-
return titleMatch?.[1].trim() ?? null;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export function getManifestExamples(manifest) {
|
|
60
|
-
return manifest.groups.flatMap((group) => {
|
|
61
|
-
if (Array.isArray(group.subgroups)) {
|
|
62
|
-
return group.subgroups.flatMap((sg) =>
|
|
63
|
-
Array.isArray(sg.examples)
|
|
64
|
-
? sg.examples.filter(isRecord).map((example) => ({
|
|
65
|
-
...example,
|
|
66
|
-
groupName: group.name,
|
|
67
|
-
groupDescription: group.description,
|
|
68
|
-
subgroupName: sg.name,
|
|
69
|
-
}))
|
|
70
|
-
: []
|
|
71
|
-
);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
return Array.isArray(group.examples)
|
|
75
|
-
? group.examples.filter(isRecord).map((example) => ({
|
|
76
|
-
...example,
|
|
77
|
-
groupName: group.name,
|
|
78
|
-
groupDescription: group.description,
|
|
79
|
-
}))
|
|
80
|
-
: [];
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export function getTypeDocExampleIncludes(
|
|
85
|
-
sourceDir,
|
|
86
|
-
examplesDir = EXAMPLES_DIR,
|
|
87
|
-
projectRoot = path.dirname(sourceDir)
|
|
88
|
-
) {
|
|
89
|
-
const includes = [];
|
|
90
|
-
|
|
91
|
-
for (const file of getTypeScriptFiles(sourceDir)) {
|
|
92
|
-
const content = fs.readFileSync(file, 'utf8');
|
|
93
|
-
let match;
|
|
94
|
-
|
|
95
|
-
INCLUDE_CODE_PATTERN.lastIndex = 0;
|
|
96
|
-
while ((match = INCLUDE_CODE_PATTERN.exec(content)) !== null) {
|
|
97
|
-
const includeTarget = match[1];
|
|
98
|
-
const resolvedPath = path.resolve(path.dirname(file), includeTarget);
|
|
99
|
-
const sourceFile = toRepositoryPath(resolvedPath, projectRoot);
|
|
100
|
-
|
|
101
|
-
if (sourceFile.startsWith(`${examplesDir}/`)) {
|
|
102
|
-
includes.push({
|
|
103
|
-
file: toRepositoryPath(file, projectRoot),
|
|
104
|
-
includeTarget,
|
|
105
|
-
sourceFile,
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
return includes;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
export function validateExamplesGallery(
|
|
115
|
-
indexContent,
|
|
116
|
-
{ examplesIndex = EXAMPLES_INDEX, examplesManifest = EXAMPLES_MANIFEST, forbidGallerySourceBase = true } = {}
|
|
117
|
-
) {
|
|
118
|
-
const issues = [];
|
|
119
|
-
|
|
120
|
-
if (/const\s+GROUPS\s*=/.test(indexContent)) {
|
|
121
|
-
issues.push(`${examplesIndex} must not declare \`const GROUPS\`; ${examplesManifest} is authoritative.`);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
if (!indexContent.includes('manifest.json')) {
|
|
125
|
-
issues.push(`${examplesIndex} must load ${examplesManifest}.`);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
if (forbidGallerySourceBase && /data-source-base\s*=/.test(indexContent)) {
|
|
129
|
-
issues.push(
|
|
130
|
-
`${examplesIndex} must not hardcode a source base; preview links should resolve from example paths.`
|
|
131
|
-
);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
return issues;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
export function validateExamplesManifest(manifest, options = {}) {
|
|
138
|
-
if (typeof options.projectRoot !== 'string' || options.projectRoot.length === 0) {
|
|
139
|
-
throw new Error('validateExamplesManifest requires projectRoot.');
|
|
140
|
-
}
|
|
141
|
-
const projectRoot = options.projectRoot;
|
|
142
|
-
const examplesDir = options.examplesDir ?? EXAMPLES_DIR;
|
|
143
|
-
const examplesManifest = options.examplesManifest ?? EXAMPLES_MANIFEST;
|
|
144
|
-
const sourceDir = options.sourceDir ?? path.resolve(projectRoot, SOURCE_DIR);
|
|
145
|
-
const issues = [];
|
|
146
|
-
|
|
147
|
-
if (!isRecord(manifest)) {
|
|
148
|
-
return ['Manifest root must be an object.'];
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
for (const key of getUnknownKeys(manifest, MANIFEST_KEYS)) {
|
|
152
|
-
issues.push(`Manifest contains unknown top-level key: ${key}`);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
if (manifest.version !== 1) {
|
|
156
|
-
issues.push('Manifest `version` must be `1`.');
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
if (typeof manifest.description !== 'string' || manifest.description.length === 0) {
|
|
160
|
-
issues.push('Manifest `description` must be a non-empty string.');
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
if (!Array.isArray(manifest.groups)) {
|
|
164
|
-
return ['Manifest `groups` must be an array.'];
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
for (const [groupIndex, group] of manifest.groups.entries()) {
|
|
168
|
-
if (!isRecord(group)) {
|
|
169
|
-
issues.push(`Manifest group ${groupIndex + 1} must be an object.`);
|
|
170
|
-
continue;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
for (const key of getUnknownKeys(group, GROUP_KEYS)) {
|
|
174
|
-
issues.push(`Manifest group "${group.name ?? groupIndex + 1}" contains unknown key: ${key}`);
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
if (typeof group.name !== 'string' || group.name.length === 0) {
|
|
178
|
-
issues.push(`Manifest group ${groupIndex + 1} is missing a name.`);
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
if (typeof group.description !== 'string' || group.description.length === 0) {
|
|
182
|
-
issues.push(`Manifest group "${group.name ?? groupIndex + 1}" is missing a description.`);
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
const hasExamples = Array.isArray(group.examples);
|
|
186
|
-
const hasSubgroups = Array.isArray(group.subgroups);
|
|
187
|
-
|
|
188
|
-
if (hasExamples && hasSubgroups) {
|
|
189
|
-
issues.push(
|
|
190
|
-
`Manifest group "${group.name}" must not have both \`examples\` and \`subgroups\`. Use one or the other.`
|
|
191
|
-
);
|
|
192
|
-
continue;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
if (!hasExamples && !hasSubgroups) {
|
|
196
|
-
issues.push(
|
|
197
|
-
`Manifest group "${group.name}" must have either an \`examples\` array or a \`subgroups\` array.`
|
|
198
|
-
);
|
|
199
|
-
continue;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
if (hasSubgroups) {
|
|
203
|
-
for (const [sgIndex, sg] of group.subgroups.entries()) {
|
|
204
|
-
if (!isRecord(sg)) {
|
|
205
|
-
issues.push(`Manifest subgroup ${sgIndex + 1} in group "${group.name}" must be an object.`);
|
|
206
|
-
continue;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
for (const key of getUnknownKeys(sg, SUBGROUP_KEYS)) {
|
|
210
|
-
issues.push(
|
|
211
|
-
`Manifest subgroup "${sg.name ?? sgIndex + 1}" in group "${group.name}" contains unknown key: ${key}`
|
|
212
|
-
);
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
if (typeof sg.name !== 'string' || sg.name.length === 0) {
|
|
216
|
-
issues.push(`Manifest subgroup ${sgIndex + 1} in group "${group.name}" is missing a name.`);
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
if (!Array.isArray(sg.examples)) {
|
|
220
|
-
issues.push(
|
|
221
|
-
`Manifest subgroup "${sg.name ?? sgIndex + 1}" in group "${group.name}" examples must be an array.`
|
|
222
|
-
);
|
|
223
|
-
continue;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
for (const [exampleIndex, example] of sg.examples.entries()) {
|
|
227
|
-
if (!isRecord(example)) {
|
|
228
|
-
issues.push(
|
|
229
|
-
`Manifest example ${exampleIndex + 1} in subgroup "${sg.name}" of group "${group.name}" must be an object.`
|
|
230
|
-
);
|
|
231
|
-
continue;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
for (const key of getUnknownKeys(example, EXAMPLE_KEYS)) {
|
|
235
|
-
issues.push(
|
|
236
|
-
`Manifest example "${example.sourceFile ?? `${group.name}.${sg.name}.${exampleIndex + 1}`}" contains unknown key: ${key}`
|
|
237
|
-
);
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
} else {
|
|
242
|
-
for (const [exampleIndex, example] of group.examples.entries()) {
|
|
243
|
-
if (!isRecord(example)) {
|
|
244
|
-
issues.push(`Manifest example ${exampleIndex + 1} in group "${group.name}" must be an object.`);
|
|
245
|
-
continue;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
for (const key of getUnknownKeys(example, EXAMPLE_KEYS)) {
|
|
249
|
-
issues.push(
|
|
250
|
-
`Manifest example "${example.sourceFile ?? `${group.name}.${exampleIndex + 1}`}" contains unknown key: ${key}`
|
|
251
|
-
);
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
const manifestExamples = getManifestExamples(manifest);
|
|
258
|
-
const manifestFiles = manifestExamples.map((example) => example.sourceFile);
|
|
259
|
-
|
|
260
|
-
if (manifestFiles.length === 0) {
|
|
261
|
-
issues.push('Manifest must include at least one example.');
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
const seen = new Set();
|
|
265
|
-
for (const example of manifestExamples) {
|
|
266
|
-
if (typeof example.sourceFile !== 'string') {
|
|
267
|
-
issues.push('Manifest examples must include a string sourceFile.');
|
|
268
|
-
continue;
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
if (seen.has(example.sourceFile)) {
|
|
272
|
-
issues.push(`Manifest contains duplicate source file: ${example.sourceFile}`);
|
|
273
|
-
}
|
|
274
|
-
seen.add(example.sourceFile);
|
|
275
|
-
|
|
276
|
-
if (typeof example.title !== 'string' || example.title.length === 0) {
|
|
277
|
-
issues.push(`Manifest example "${example.sourceFile}" is missing a title.`);
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
if (
|
|
281
|
-
example.status !== undefined &&
|
|
282
|
-
example.status !== 'good' &&
|
|
283
|
-
example.status !== 'bad' &&
|
|
284
|
-
example.status !== 'unrated'
|
|
285
|
-
) {
|
|
286
|
-
issues.push(
|
|
287
|
-
`Manifest example "${example.sourceFile}" status must be "good", "bad", or "unrated", but found "${example.status}".`
|
|
288
|
-
);
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
if (!example.sourceFile.startsWith(`${examplesDir}/`) || !example.sourceFile.endsWith('/sketch.js')) {
|
|
292
|
-
issues.push(`Manifest example "${example.sourceFile}" sourceFile must be an examples/**/sketch.js path.`);
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
const sketchPath = path.resolve(projectRoot, example.sourceFile);
|
|
296
|
-
if (!fs.existsSync(sketchPath)) {
|
|
297
|
-
issues.push(`Manifest example is missing its sketch file: ${example.sourceFile}`);
|
|
298
|
-
continue;
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
const sketchTitle = getSketchTitle(sketchPath);
|
|
302
|
-
|
|
303
|
-
if (!sketchTitle) {
|
|
304
|
-
issues.push(`Manifest example "${example.sourceFile}" sketch is missing an @title tag.`);
|
|
305
|
-
} else if (sketchTitle !== example.title) {
|
|
306
|
-
issues.push(
|
|
307
|
-
`Manifest example "${example.sourceFile}" title "${example.title}" must match sketch @title "${sketchTitle}".`
|
|
308
|
-
);
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
const manifestFileSet = new Set(manifestFiles);
|
|
313
|
-
for (const include of getTypeDocExampleIncludes(sourceDir, examplesDir, projectRoot)) {
|
|
314
|
-
if (!manifestFileSet.has(include.sourceFile)) {
|
|
315
|
-
issues.push(
|
|
316
|
-
`TypeDoc includeCode in "${include.file}" references "${include.includeTarget}" (${include.sourceFile}), but that sketch is not in ${examplesManifest}.`
|
|
317
|
-
);
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
return issues;
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
export function checkSketch(filePath) {
|
|
325
|
-
const content = fs.readFileSync(filePath, 'utf8');
|
|
326
|
-
const issues = [];
|
|
327
|
-
|
|
328
|
-
if (content.includes('import ') || content.includes('export ')) {
|
|
329
|
-
return { skipped: true, issues };
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
const docstringMatch = content.match(/^\s*\/\*\*([\s\S]*?)\*\//);
|
|
333
|
-
if (!docstringMatch) {
|
|
334
|
-
issues.push('Missing JSDoc-style block comment header at the top of the file.');
|
|
335
|
-
} else {
|
|
336
|
-
const docstring = docstringMatch[1];
|
|
337
|
-
if (!docstring.includes('@title')) {
|
|
338
|
-
issues.push('Docstring header is missing `@title` tag.');
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
const createMatch = content.match(/textmode\.create\s*\(\s*\{([\s\S]*?)\}\s*\)/);
|
|
343
|
-
if (!createMatch) {
|
|
344
|
-
issues.push('Could not find `textmode.create({ ... })` call.');
|
|
345
|
-
} else {
|
|
346
|
-
const options = createMatch[1];
|
|
347
|
-
|
|
348
|
-
if (!options.match(/width:\s*window\.innerWidth/)) {
|
|
349
|
-
issues.push('`width` must be set to `window.innerWidth` in create options.');
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
if (!options.match(/height:\s*window\.innerHeight/)) {
|
|
353
|
-
issues.push('`height` must be set to `window.innerHeight` in create options.');
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
const fontSizeMatch = options.match(/fontSize:\s*(\d+)/);
|
|
357
|
-
if (fontSizeMatch) {
|
|
358
|
-
const size = parseInt(fontSizeMatch[1], 10);
|
|
359
|
-
if (size !== 8 && size !== 16 && size !== 32) {
|
|
360
|
-
issues.push(`\`fontSize\` is set to \`${size}\`, but must be exactly \`8\`, \`16\`, or \`32\`.`);
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
if (!content.includes('windowResized')) {
|
|
366
|
-
issues.push('Missing `windowResized` callback registration.');
|
|
367
|
-
}
|
|
368
|
-
if (!content.match(/resizeCanvas\(\s*window\.innerWidth\s*,\s*window\.innerHeight\s*\)/)) {
|
|
369
|
-
issues.push(
|
|
370
|
-
'`resizeCanvas` must be called with `window.innerWidth` and `window.innerHeight` inside the sketch.'
|
|
371
|
-
);
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
if (/\bvar\b/.test(content)) {
|
|
375
|
-
issues.push('Do not use `var`; prefer `const` or `let`.');
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
const lines = content.split('\n');
|
|
379
|
-
if (lines.length > 100) {
|
|
380
|
-
issues.push(`Sketch file has ${lines.length} lines, but must not exceed 100 lines.`);
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
if (!content.includes('layers.add(')) {
|
|
384
|
-
issues.push('Missing dedicated label layer registration (`t.layers.add()`).');
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
const leftMatch = content.includes('grid.cols / 2') || content.includes('grid.cols/2');
|
|
388
|
-
const topMatch = content.includes('grid.rows / 2') || content.includes('grid.rows/2');
|
|
389
|
-
if (!leftMatch || !topMatch) {
|
|
390
|
-
issues.push(
|
|
391
|
-
'Missing top-left labeling alignment coordinates calculation using grid center offset (`-Math.floor(t.grid.cols / 2)` and `-Math.floor(t.grid.rows / 2)`).'
|
|
392
|
-
);
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
const textDrawingRegex = /(?:drawText|drawCenteredText|t\.char)\s*\(\s*(['"`])(.*?)\1/g;
|
|
396
|
-
let match;
|
|
397
|
-
while ((match = textDrawingRegex.exec(content)) !== null) {
|
|
398
|
-
const text = match[2];
|
|
399
|
-
if (text.length > 40) {
|
|
400
|
-
issues.push(`Row of text exceeds 40 characters limit: "${text}" (${text.length} chars).`);
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
return { skipped: false, issues };
|
|
405
|
-
}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
export function getLineStartOffsets(text) {
|
|
2
|
-
const offsets = [0];
|
|
3
|
-
for (let index = 0; index < text.length; index += 1) {
|
|
4
|
-
if (text[index] === '\n') {
|
|
5
|
-
offsets.push(index + 1);
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
return offsets;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export function findJsdocBeforeLine(text, lineStarts, line) {
|
|
12
|
-
const declarationOffset = lineStarts[line - 1] ?? text.length;
|
|
13
|
-
const searchText = text.slice(0, declarationOffset);
|
|
14
|
-
const start = searchText.lastIndexOf('/**');
|
|
15
|
-
const end = searchText.lastIndexOf('*/');
|
|
16
|
-
|
|
17
|
-
if (start === -1 || end === -1 || start > end) {
|
|
18
|
-
return undefined;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
return { start, end };
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function replaceHostedApiSeeLines(commentText, seeLine, apiBaseUrl) {
|
|
25
|
-
const lines = commentText.split('\n');
|
|
26
|
-
let replaced = false;
|
|
27
|
-
const nextLines = [];
|
|
28
|
-
|
|
29
|
-
for (const line of lines) {
|
|
30
|
-
if (line.includes('@see') && line.includes(apiBaseUrl)) {
|
|
31
|
-
if (!replaced) {
|
|
32
|
-
nextLines.push(line.replace(/^(\s*\*\s*).*$/, `$1${seeLine}`));
|
|
33
|
-
replaced = true;
|
|
34
|
-
}
|
|
35
|
-
continue;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
nextLines.push(line);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return replaced ? nextLines.join('\n') : undefined;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export function upsertSeeLine(text, comment, seeLine, apiBaseUrl) {
|
|
45
|
-
const commentText = text.slice(comment.start, comment.end + 2);
|
|
46
|
-
const replacedComment = replaceHostedApiSeeLines(commentText, seeLine, apiBaseUrl);
|
|
47
|
-
if (replacedComment !== undefined) {
|
|
48
|
-
return `${text.slice(0, comment.start)}${replacedComment}${text.slice(comment.end + 2)}`;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
if (!commentText.includes('\n')) {
|
|
52
|
-
const lineStart = text.lastIndexOf('\n', comment.start) + 1;
|
|
53
|
-
const indent = text.slice(lineStart, comment.start);
|
|
54
|
-
const summary = commentText
|
|
55
|
-
.replace(/^\/\*\*\s?/, '')
|
|
56
|
-
.replace(/\s?\*\/$/, '')
|
|
57
|
-
.trim();
|
|
58
|
-
const replacement = [
|
|
59
|
-
`${indent}/**`,
|
|
60
|
-
summary ? `${indent} * ${summary}` : undefined,
|
|
61
|
-
`${indent} *`,
|
|
62
|
-
`${indent} * ${seeLine}`,
|
|
63
|
-
`${indent} */`,
|
|
64
|
-
]
|
|
65
|
-
.filter(Boolean)
|
|
66
|
-
.join('\n');
|
|
67
|
-
|
|
68
|
-
return `${text.slice(0, lineStart)}${replacement}${text.slice(comment.end + 2)}`;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
const lineStart = text.lastIndexOf('\n', comment.end) + 1;
|
|
72
|
-
const closingLine = text.slice(lineStart, comment.end + 2);
|
|
73
|
-
const prefixMatch = closingLine.match(/^(\s*)\*\//);
|
|
74
|
-
const indent = prefixMatch?.[1] ?? '';
|
|
75
|
-
const insertion = `${indent}*\n${indent}* ${seeLine}\n`;
|
|
76
|
-
|
|
77
|
-
return `${text.slice(0, lineStart)}${insertion}${text.slice(lineStart)}`;
|
|
78
|
-
}
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
2
|
-
|
|
3
|
-
import { ReflectionKind } from 'typedoc';
|
|
4
|
-
|
|
5
|
-
export function isIncludedReflection(reflection, targetKinds) {
|
|
6
|
-
if (!reflection.kindOf(targetKinds)) {
|
|
7
|
-
return false;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
if (reflection.flags.isPrivate || reflection.flags.isProtected || reflection.flags.isInherited) {
|
|
11
|
-
return false;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
for (let current = reflection; current && !current.isProject(); current = current.parent) {
|
|
15
|
-
if (current.name.startsWith('_')) {
|
|
16
|
-
return false;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
return true;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export function getIncludedReflections(project, targetKinds) {
|
|
24
|
-
return project
|
|
25
|
-
.getReflectionsByKind(targetKinds)
|
|
26
|
-
.filter((reflection) => isIncludedReflection(reflection, targetKinds));
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export function shouldProcessEntryPointReflection(entryPoint, reflection) {
|
|
30
|
-
return !entryPoint.namespaceExportsOnly || reflection.kind === ReflectionKind.Namespace;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export function getRelevantComments(reflection) {
|
|
34
|
-
const comments = [];
|
|
35
|
-
|
|
36
|
-
if (reflection.comment) {
|
|
37
|
-
comments.push({ comment: reflection.comment, source: reflection.sources?.[0] });
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
if (!reflection.isDeclaration()) {
|
|
41
|
-
return comments;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
for (const signature of reflection.signatures ?? []) {
|
|
45
|
-
if (signature.comment) {
|
|
46
|
-
comments.push({ comment: signature.comment, source: signature.sources?.[0] ?? reflection.sources?.[0] });
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
if (reflection.getSignature?.comment) {
|
|
51
|
-
comments.push({
|
|
52
|
-
comment: reflection.getSignature.comment,
|
|
53
|
-
source: reflection.getSignature.sources?.[0] ?? reflection.sources?.[0],
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
if (reflection.setSignature?.comment) {
|
|
58
|
-
comments.push({
|
|
59
|
-
comment: reflection.setSignature.comment,
|
|
60
|
-
source: reflection.setSignature.sources?.[0] ?? reflection.sources?.[0],
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
return comments;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export function getSourceCandidates(reflection) {
|
|
68
|
-
if (!reflection.isDeclaration()) {
|
|
69
|
-
return [];
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
return [
|
|
73
|
-
...(reflection.sources ?? []),
|
|
74
|
-
...(reflection.signatures ?? []).flatMap((signature) => signature.sources ?? []),
|
|
75
|
-
...(reflection.getSignature?.sources ?? []),
|
|
76
|
-
...(reflection.setSignature?.sources ?? []),
|
|
77
|
-
];
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export function getPrimaryLocation(reflection) {
|
|
81
|
-
const [source] = getSourceCandidates(reflection);
|
|
82
|
-
|
|
83
|
-
if (!source) {
|
|
84
|
-
return {
|
|
85
|
-
file: path.resolve('<unknown>'),
|
|
86
|
-
line: 1,
|
|
87
|
-
column: 1,
|
|
88
|
-
printable: '<unknown>:1:1',
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
const file = source.fullFileName || path.resolve(source.fileName);
|
|
93
|
-
const line = source.line || 1;
|
|
94
|
-
const column = (source.character ?? 0) + 1;
|
|
95
|
-
|
|
96
|
-
return {
|
|
97
|
-
file,
|
|
98
|
-
line,
|
|
99
|
-
column,
|
|
100
|
-
printable: `${file}:${line}:${column}`,
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
export function sourceIsInRoots(source, sourceRoots) {
|
|
105
|
-
if (!source?.fullFileName) {
|
|
106
|
-
return false;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
return sourceRoots.some((root) => {
|
|
110
|
-
const relative = path.relative(root, source.fullFileName);
|
|
111
|
-
return relative === '' || (!relative.startsWith('..') && !path.isAbsolute(relative));
|
|
112
|
-
});
|
|
113
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export function renderIssueSection(title, issues, stream = console.log) {
|
|
2
|
-
if (issues.length === 0) {
|
|
3
|
-
return;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
stream('');
|
|
7
|
-
stream(`${title}: ${issues.length}`);
|
|
8
|
-
|
|
9
|
-
for (const issue of issues) {
|
|
10
|
-
stream(`- ${issue.name}`);
|
|
11
|
-
stream(` ${issue.location}`);
|
|
12
|
-
if (issue.detail) {
|
|
13
|
-
stream(` ${issue.detail}`);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export function renderList(title, items, stream = console.error) {
|
|
19
|
-
stream(title);
|
|
20
|
-
for (const item of items) {
|
|
21
|
-
stream(` * ${item}`);
|
|
22
|
-
}
|
|
23
|
-
}
|