@cagov/ca-ds 1.0.0 → 1.2.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/README.md +43 -26
- package/THIRD-PARTY-LICENSES.txt +690 -0
- package/ca-ds.js +48390 -0
- package/package.json +5 -31
- package/bin/ca-ds.js +0 -5
- package/src/cli/add.js +0 -134
- package/src/cli/build.js +0 -15
- package/src/cli/diff.js +0 -39
- package/src/cli/eject.js +0 -112
- package/src/cli/exit.js +0 -22
- package/src/cli/format.js +0 -52
- package/src/cli/init.js +0 -148
- package/src/cli/install.js +0 -178
- package/src/cli/items.js +0 -10
- package/src/cli/login.js +0 -331
- package/src/cli/main.js +0 -108
- package/src/cli/new.js +0 -230
- package/src/cli/outdated.js +0 -74
- package/src/cli/pack.js +0 -75
- package/src/cli/preview.js +0 -31
- package/src/cli/publish.js +0 -295
- package/src/cli/pull.js +0 -208
- package/src/cli/remote.js +0 -52
- package/src/cli/remove.js +0 -69
- package/src/cli/update.js +0 -223
- package/src/cli/validate.js +0 -131
- package/src/lib/browser.js +0 -12
- package/src/lib/build.js +0 -249
- package/src/lib/bundle.js +0 -148
- package/src/lib/catalog.js +0 -44
- package/src/lib/checks.js +0 -31
- package/src/lib/collection.js +0 -65
- package/src/lib/emblem.js +0 -29
- package/src/lib/fixtures.js +0 -59
- package/src/lib/floor.js +0 -79
- package/src/lib/glyph.js +0 -148
- package/src/lib/image.js +0 -138
- package/src/lib/json-text.js +0 -213
- package/src/lib/keys.js +0 -322
- package/src/lib/links.js +0 -321
- package/src/lib/markdown.js +0 -408
- package/src/lib/merge.js +0 -93
- package/src/lib/pack.js +0 -30
- package/src/lib/page-schema.js +0 -368
- package/src/lib/page.js +0 -372
- package/src/lib/patch.js +0 -9
- package/src/lib/regions.js +0 -173
- package/src/lib/registry.js +0 -371
- package/src/lib/release.js +0 -119
- package/src/lib/repoints.js +0 -120
- package/src/lib/resolve.js +0 -32
- package/src/lib/schema.js +0 -28
- package/src/lib/serial.js +0 -4
- package/src/lib/serialize.js +0 -444
- package/src/lib/structured.js +0 -72
- package/src/lib/system.js +0 -13
- package/src/lib/targets.js +0 -85
- package/src/lib/terms.js +0 -11
- package/src/lib/token-view.js +0 -289
- package/src/lib/tokens.js +0 -247
- package/src/lib/version.js +0 -34
- package/src/preview/frame.js +0 -75
- package/src/preview/pages.js +0 -128
- package/src/preview/screenshots.js +0 -72
- package/src/preview/server.js +0 -378
- package/src/preview/shell.js +0 -153
- package/src/schema/a11y.schema.json +0 -56
- package/src/schema/collection.lock.schema.json +0 -58
- package/src/schema/collection.schema.json +0 -65
- package/src/schema/composition.schema.json +0 -98
- package/src/schema/contract.schema.json +0 -116
- package/src/schema/interface.schema.json +0 -257
- package/src/schema/item.schema.json +0 -362
- package/src/schema/release.schema.json +0 -39
- package/src/schema/system.schema.json +0 -75
- package/src/schema/variants.schema.json +0 -60
- package/src/validate/collection.js +0 -19
- package/src/validate/collisions.js +0 -124
- package/src/validate/context.js +0 -357
- package/src/validate/facts.js +0 -253
- package/src/validate/files.js +0 -103
- package/src/validate/findings.js +0 -19
- package/src/validate/glyphs.js +0 -126
- package/src/validate/html.js +0 -215
- package/src/validate/imports.js +0 -29
- package/src/validate/index.js +0 -75
- package/src/validate/item.js +0 -47
- package/src/validate/links.js +0 -113
- package/src/validate/manifest.js +0 -147
- package/src/validate/media.js +0 -65
- package/src/validate/page.js +0 -74
- package/src/validate/prefixes.js +0 -58
- package/src/validate/relations.js +0 -310
- package/src/validate/release.js +0 -109
- package/src/validate/skill.js +0 -122
- package/src/validate/structured.js +0 -335
- package/src/validate/tasc.js +0 -80
- package/src/validate/template.js +0 -129
- package/src/validate/tokens.js +0 -154
- package/src/validate/zip.js +0 -40
- /package/{src/preview/preview.css → preview.css} +0 -0
package/src/validate/skill.js
DELETED
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import { readFileSync, statSync } from 'node:fs';
|
|
2
|
-
import { join } from 'node:path';
|
|
3
|
-
import { parse } from 'yaml';
|
|
4
|
-
import { declaredFiles } from './item.js';
|
|
5
|
-
import { splitFrontmatter } from '../lib/markdown.js';
|
|
6
|
-
|
|
7
|
-
export const check = 'skill';
|
|
8
|
-
|
|
9
|
-
export const FRONTMATTER_KEYS = ['name', 'description', 'license', 'compatibility', 'metadata', 'allowed-tools'];
|
|
10
|
-
export const MAX_BYTES = 30 * 1024 * 1024;
|
|
11
|
-
|
|
12
|
-
const NAME = /^[a-z0-9]+(-[a-z0-9]+)*$/;
|
|
13
|
-
const RESERVED = ['anthropic', 'claude'];
|
|
14
|
-
const XML_TAG = /<\/?[A-Za-z][^<>]*>/;
|
|
15
|
-
|
|
16
|
-
const isMap = (v) => v !== null && typeof v === 'object' && !Array.isArray(v);
|
|
17
|
-
|
|
18
|
-
export const SKILL_ROLES = ['script', 'reference', 'asset'];
|
|
19
|
-
|
|
20
|
-
export function frontmatterOf(text) {
|
|
21
|
-
const { frontmatter } = splitFrontmatter(text);
|
|
22
|
-
if (frontmatter === null) return { error: 'opens on no YAML frontmatter block, which holds the skill\'s `name` and `description`' };
|
|
23
|
-
try {
|
|
24
|
-
const data = parse(frontmatter);
|
|
25
|
-
return isMap(data) ? { data } : { error: 'holds frontmatter that is no YAML mapping' };
|
|
26
|
-
} catch (err) {
|
|
27
|
-
return { error: `holds frontmatter that doesn't parse as YAML: ${err.message.split('\n')[0]}` };
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export const isSkillName = (name) => typeof name === 'string' && name.length <= 64 && NAME.test(name);
|
|
32
|
-
|
|
33
|
-
// The folder a skill installs and unzips to, or null when its frontmatter names none a folder may take.
|
|
34
|
-
export function skillNameOf(text) {
|
|
35
|
-
const { data } = frontmatterOf(text);
|
|
36
|
-
return isSkillName(data?.name) ? data.name : null;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export function frontmatterFindings(data) {
|
|
40
|
-
const found = [];
|
|
41
|
-
const add = (rule, message) => found.push({ rule, message });
|
|
42
|
-
for (const key of Object.keys(data)) {
|
|
43
|
-
if (!FRONTMATTER_KEYS.includes(key)) add('frontmatter-key', `The frontmatter key \`${key}\` is none a skill takes: ${FRONTMATTER_KEYS.map((k) => `\`${k}\``).join(', ')}.`);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const { name, description, compatibility, metadata, license } = data;
|
|
47
|
-
if (typeof name !== 'string' || name.length === 0) {
|
|
48
|
-
add('name', 'The frontmatter names no skill: `name` is a required string.');
|
|
49
|
-
} else if (!isSkillName(name)) {
|
|
50
|
-
add('name', `The skill name \`${name}\` is not 1 to 64 lowercase letters, digits, and hyphens, with no hyphen leading, trailing, or doubled.`);
|
|
51
|
-
} else if (RESERVED.some((word) => name.includes(word))) {
|
|
52
|
-
add('name', `The skill name \`${name}\` holds a reserved word: ${RESERVED.map((w) => `\`${w}\``).join(' or ')}.`);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
if (typeof description !== 'string' || description.length === 0) {
|
|
56
|
-
add('description', 'The frontmatter carries no `description`, a required string that says what the skill does and when to use it.');
|
|
57
|
-
} else if (description.length > 1024) {
|
|
58
|
-
add('description', `The description is ${description.length} characters, past the 1024 a skill takes.`);
|
|
59
|
-
} else if (XML_TAG.test(description)) {
|
|
60
|
-
add('description', 'The description holds an XML tag, which a skill\'s description may not.');
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
if (compatibility !== undefined && (typeof compatibility !== 'string' || compatibility.length === 0 || compatibility.length > 500)) {
|
|
64
|
-
add('compatibility', '`compatibility` is a string of 1 to 500 characters.');
|
|
65
|
-
}
|
|
66
|
-
if (license !== undefined && (typeof license !== 'string' || license.length === 0)) {
|
|
67
|
-
add('license', '`license` is a string.');
|
|
68
|
-
}
|
|
69
|
-
if (metadata !== undefined && !(isMap(metadata) && Object.values(metadata).every((v) => typeof v === 'string'))) {
|
|
70
|
-
add('metadata', '`metadata` is a map of string keys to string values.');
|
|
71
|
-
}
|
|
72
|
-
const tools = data['allowed-tools'];
|
|
73
|
-
if (tools !== undefined && typeof tools !== 'string') {
|
|
74
|
-
add('allowed-tools', '`allowed-tools` is a string of tool names, separated by spaces.');
|
|
75
|
-
}
|
|
76
|
-
return found;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
const ROLE_FOLDERS = { script: 'scripts/', reference: 'references/', asset: 'assets/' };
|
|
80
|
-
|
|
81
|
-
export async function run(item, ctx, { reject }) {
|
|
82
|
-
const m = item.manifest;
|
|
83
|
-
if (m.kind !== 'skill') {
|
|
84
|
-
for (const f of declaredFiles(m)) {
|
|
85
|
-
if (SKILL_ROLES.includes(f.role)) reject('role', `\`${f.path}\` is declared with role \`${f.role}\`, which a skill's files take alone.`, { file: 'item.json' });
|
|
86
|
-
}
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
if (typeof m.doc === 'string' && item.present.has(m.doc)) {
|
|
91
|
-
const { data, error } = frontmatterOf(readFileSync(join(item.dir, m.doc), 'utf8'));
|
|
92
|
-
if (error) reject('frontmatter', `\`${m.doc}\` ${error}.`, { file: m.doc });
|
|
93
|
-
else for (const { rule, message } of frontmatterFindings(data)) reject(rule, message, { file: m.doc });
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
const declared = declaredFiles(m);
|
|
97
|
-
const roles = new Map(declared.map((f) => [f.path, f.role]));
|
|
98
|
-
for (const [path, role] of roles) {
|
|
99
|
-
if (path.startsWith('scripts/') && role !== 'script') {
|
|
100
|
-
reject('script-role', `\`${path}\` sits under \`scripts/\` and is declared with role \`${role ?? 'none'}\`, not \`script\`.`, { file: 'item.json' });
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
for (const [path, role] of roles) {
|
|
105
|
-
const folder = ROLE_FOLDERS[role];
|
|
106
|
-
if (folder && !path.startsWith(folder)) {
|
|
107
|
-
reject('role-folder', `\`${path}\` is declared with role \`${role}\`, which a file under \`${folder}\` takes alone.`, { file: 'item.json' });
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
for (const path of [...item.present].sort()) {
|
|
112
|
-
if (path.startsWith('scripts/') && !roles.has(path)) {
|
|
113
|
-
reject('script-role', `\`${path}\` sits under \`scripts/\` and isn't in the manifest's \`files\`. Declare it with role \`script\`.`, { file: path });
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
let bytes = statSync(join(item.dir, 'item.json')).size;
|
|
118
|
-
for (const path of item.present) bytes += statSync(join(item.dir, path)).size;
|
|
119
|
-
if (bytes > MAX_BYTES) {
|
|
120
|
-
reject('size', `The skill's files come to ${(bytes / 1024 / 1024).toFixed(1)} MB, past the 30 MB a skill takes.`, { file: 'item.json' });
|
|
121
|
-
}
|
|
122
|
-
}
|
|
@@ -1,335 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from 'node:fs';
|
|
2
|
-
import { join } from 'node:path';
|
|
3
|
-
import { compile } from 'css-select';
|
|
4
|
-
import { STRUCTURED } from '../lib/schema.js';
|
|
5
|
-
import { runRules } from '../lib/checks.js';
|
|
6
|
-
import { elideValues } from './findings.js';
|
|
7
|
-
import { SUFFIX, folderOf } from '../lib/structured.js';
|
|
8
|
-
import { declaredFiles, NOTES, CHECKS } from './item.js';
|
|
9
|
-
import { customValues } from './facts.js';
|
|
10
|
-
import { systemItem } from '../lib/system.js';
|
|
11
|
-
import { stateItem } from './context.js';
|
|
12
|
-
|
|
13
|
-
export const check = 'structured';
|
|
14
|
-
|
|
15
|
-
export const CHECKLIST = systemItem('page-checklist');
|
|
16
|
-
|
|
17
|
-
// A check page may break a rule on purpose, so it takes the contract checks only by opting in.
|
|
18
|
-
export const OPT_IN = /<!--\s*ca-docs:\s*contract\/check\b/;
|
|
19
|
-
|
|
20
|
-
export const OVERVIEW_LINES = 25;
|
|
21
|
-
|
|
22
|
-
const OVERVIEW_KINDS = new Set(['component', 'template']);
|
|
23
|
-
|
|
24
|
-
const VERIFY = /^## Verify output\s*$/m;
|
|
25
|
-
|
|
26
|
-
const FENCE = /^ {0,3}(```|~~~)/m;
|
|
27
|
-
|
|
28
|
-
const SHOWN = 3;
|
|
29
|
-
|
|
30
|
-
const nameOf = (attribute) => attribute.split('=')[0];
|
|
31
|
-
|
|
32
|
-
const readText = (item, path) => readFileSync(join(item.dir, path), 'utf8');
|
|
33
|
-
|
|
34
|
-
export const spelling = (value) =>
|
|
35
|
-
String(value)
|
|
36
|
-
.replace(/\/\*[\s\S]*?\*\//g, ' ')
|
|
37
|
-
.replace(/\s+/g, ' ')
|
|
38
|
-
.trim()
|
|
39
|
-
.replace(/\(\s+/g, '(')
|
|
40
|
-
.replace(/\s+\)/g, ')')
|
|
41
|
-
.replace(/\s*,\s*/g, ', ');
|
|
42
|
-
|
|
43
|
-
const code = (s) => (s.includes('`') ? `\`\` ${s} \`\`` : `\`${s}\``);
|
|
44
|
-
|
|
45
|
-
const lineCount = (text) => text.replace(/\n$/, '').split('\n').length;
|
|
46
|
-
|
|
47
|
-
// Every attribute value elided but the class list's, which names the element.
|
|
48
|
-
const elideOffender = (markup) => markup.replace(/ ([a-z][\w:.-]*)="([^"]*)"/gi, (m, name) => (name === 'class' ? m : ` ${name}="…"`));
|
|
49
|
-
|
|
50
|
-
export function failure(name, { rule, offenders }) {
|
|
51
|
-
const shown = offenders.slice(0, SHOWN).map((o) => `\`${elideOffender(o)}\``).join(', ');
|
|
52
|
-
const more = offenders.length > SHOWN ? `, and ${offenders.length - SHOWN} more` : '';
|
|
53
|
-
return `The page fails \`${name}/${rule.id}\` (${rule.severity}): ${rule.rule} Offenders: ${shown}${more}.`;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function schemaErrors(errors) {
|
|
57
|
-
const messages = errors.map((e) => `${e.instancePath || '(root)'} ${e.message}${e.params?.additionalProperty ? `: ${e.params.additionalProperty}` : ''}.`);
|
|
58
|
-
return [...new Set(messages)];
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const selectorsOf = (check) => Object.entries(check ?? {}).filter(([, s]) => typeof s === 'string');
|
|
62
|
-
|
|
63
|
-
// A rule whose selector doesn't compile is the selector rejection, so the checks skip it.
|
|
64
|
-
export const runnable = (rules) =>
|
|
65
|
-
rules.filter((r) =>
|
|
66
|
-
selectorsOf(r.check).every(([, s]) => {
|
|
67
|
-
try {
|
|
68
|
-
compile(s);
|
|
69
|
-
return true;
|
|
70
|
-
} catch {
|
|
71
|
-
return false;
|
|
72
|
-
}
|
|
73
|
-
}),
|
|
74
|
-
);
|
|
75
|
-
|
|
76
|
-
export function contractsOf(item) {
|
|
77
|
-
const out = [];
|
|
78
|
-
for (const f of declaredFiles(item.manifest)) {
|
|
79
|
-
if (f.role !== 'contract' || !item.present.has(f.path)) continue;
|
|
80
|
-
try {
|
|
81
|
-
const data = JSON.parse(readText(item, f.path));
|
|
82
|
-
if (STRUCTURED.contract(data)) out.push(data);
|
|
83
|
-
} catch {
|
|
84
|
-
// The item's own validation reports it.
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
return out;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
// null when the state lacks the checklist, so a template's pages go unchecked.
|
|
91
|
-
const checklists = new WeakMap();
|
|
92
|
-
function checklistRules(ctx) {
|
|
93
|
-
if (!checklists.has(ctx.catalog)) {
|
|
94
|
-
const item = stateItem(ctx, CHECKLIST);
|
|
95
|
-
if (!item) {
|
|
96
|
-
checklists.set(ctx.catalog, null);
|
|
97
|
-
return null;
|
|
98
|
-
}
|
|
99
|
-
checklists.set(ctx.catalog, runnable(contractsOf(item).flatMap((c) => c.rules)));
|
|
100
|
-
}
|
|
101
|
-
return checklists.get(ctx.catalog);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
export async function run(item, ctx, { reject, warn }) {
|
|
105
|
-
const m = item.manifest;
|
|
106
|
-
const name = m.name ?? 'the item';
|
|
107
|
-
const files = declaredFiles(m);
|
|
108
|
-
const roles = new Map(files.map((f) => [f.path, f.role]));
|
|
109
|
-
|
|
110
|
-
const entry = { files: {}, data: {} };
|
|
111
|
-
|
|
112
|
-
for (const f of files) {
|
|
113
|
-
if (f.path === NOTES) reject('notes', `\`${f.path}\` is the item's notes, which never ship. Remove it from \`files\`.`, { file: 'item.json' });
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
for (const f of files) {
|
|
117
|
-
const structured = Object.hasOwn(SUFFIX, f.role);
|
|
118
|
-
const suffixed = Object.entries(SUFFIX).find(([, s]) => f.path.endsWith(s));
|
|
119
|
-
if (structured && !f.path.endsWith(SUFFIX[f.role])) {
|
|
120
|
-
reject('role-name', `\`${f.path}\` is declared with role \`${f.role}\`, whose file name ends \`${SUFFIX[f.role]}\`.`, { file: 'item.json' });
|
|
121
|
-
continue;
|
|
122
|
-
}
|
|
123
|
-
if (!structured && suffixed) {
|
|
124
|
-
reject('role-name', `\`${f.path}\` ends \`${suffixed[1]}\` and is declared with role \`${f.role ?? 'none'}\`, not \`${suffixed[0]}\`.`, { file: 'item.json' });
|
|
125
|
-
}
|
|
126
|
-
if (!structured) continue;
|
|
127
|
-
if (folderOf(f.path) !== '') {
|
|
128
|
-
reject('folder', `\`${f.path}\` sits in a subfolder. A structured file sits at the item's root, beside its doc.`, { file: 'item.json' });
|
|
129
|
-
continue;
|
|
130
|
-
}
|
|
131
|
-
if (entry.files[f.role]) {
|
|
132
|
-
reject('duplicate-role', `\`${f.path}\` and \`${entry.files[f.role]}\` both take role \`${f.role}\`.`, { file: 'item.json' });
|
|
133
|
-
continue;
|
|
134
|
-
}
|
|
135
|
-
entry.files[f.role] = f.path;
|
|
136
|
-
if (!item.present.has(f.path)) continue;
|
|
137
|
-
let data;
|
|
138
|
-
try {
|
|
139
|
-
data = JSON.parse(readText(item, f.path));
|
|
140
|
-
} catch {
|
|
141
|
-
// The files check reports it.
|
|
142
|
-
continue;
|
|
143
|
-
}
|
|
144
|
-
const valid = STRUCTURED[f.role];
|
|
145
|
-
if (!valid(data)) {
|
|
146
|
-
for (const message of schemaErrors(valid.errors)) reject('schema', `The ${f.role} fails its schema: ${message}`, { file: f.path });
|
|
147
|
-
continue;
|
|
148
|
-
}
|
|
149
|
-
entry.data[f.role] = data;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
// Contract
|
|
153
|
-
const rules = [];
|
|
154
|
-
const contract = entry.data.contract;
|
|
155
|
-
if (contract) {
|
|
156
|
-
const file = entry.files.contract;
|
|
157
|
-
const seen = new Set();
|
|
158
|
-
for (const r of contract.rules) {
|
|
159
|
-
if (seen.has(r.id)) reject('duplicate-id', `The rule id \`${r.id}\` repeats.`, { file });
|
|
160
|
-
seen.add(r.id);
|
|
161
|
-
for (const [key, selector] of selectorsOf(r.check)) {
|
|
162
|
-
try {
|
|
163
|
-
compile(selector);
|
|
164
|
-
} catch (err) {
|
|
165
|
-
reject('selector', `The rule \`${r.id}\`'s \`${key}\` selector fails to parse: ${elideValues(err.message)}`, { file });
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
rules.push(...runnable(contract.rules));
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
// Composition
|
|
173
|
-
const composition = entry.data.composition;
|
|
174
|
-
if (composition) {
|
|
175
|
-
for (const [what, records] of [['region', composition.regions], ['variation', composition.variations ?? []]]) {
|
|
176
|
-
const seen = new Set();
|
|
177
|
-
for (const r of records) {
|
|
178
|
-
if (seen.has(r.id)) reject('duplicate-id', `The ${what} id \`${r.id}\` repeats.`, { file: entry.files.composition });
|
|
179
|
-
seen.add(r.id);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
// Contract rules over the examples and opted-in check pages
|
|
185
|
-
const examples = files.filter((f) => f.role === 'reference-html' && item.present.has(f.path));
|
|
186
|
-
const pages = [
|
|
187
|
-
...examples.map((f) => ({ path: f.path, text: readText(item, f.path) })),
|
|
188
|
-
...[...(item.checks ?? [])].filter((p) => p.endsWith('.html')).map((p) => ({ path: p, text: readText(item, p) })).filter((p) => OPT_IN.test(p.text)),
|
|
189
|
-
];
|
|
190
|
-
if (rules.length) {
|
|
191
|
-
for (const page of pages) {
|
|
192
|
-
for (const failed of runRules(rules, page.text).failed) {
|
|
193
|
-
(failed.rule.severity === 'must' ? reject : warn)('contract', failure(name, failed), { file: page.path });
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
// Page checklist
|
|
199
|
-
if (m.kind === 'template') {
|
|
200
|
-
const checklist = checklistRules(ctx);
|
|
201
|
-
const shipped = pages.filter((p) => !p.path.startsWith(`${CHECKS}/`));
|
|
202
|
-
if (checklist === null && shipped.length) {
|
|
203
|
-
warn('page-checklist-unchecked', `\`${CHECKLIST}\`, which owns the rules every page passes, is in neither the collection nor the registry, so the template's pages go unchecked against it.`, { file: shipped[0].path });
|
|
204
|
-
}
|
|
205
|
-
if (checklist?.length) {
|
|
206
|
-
for (const page of shipped) {
|
|
207
|
-
for (const failed of runRules(checklist, page.text).failed) {
|
|
208
|
-
(failed.rule.severity === 'must' ? reject : warn)('page-checklist', failure(CHECKLIST, failed), { file: page.path });
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
// Interface
|
|
215
|
-
const facts = await ctx.facts(item);
|
|
216
|
-
const cssClasses = new Set();
|
|
217
|
-
const knobs = new Set();
|
|
218
|
-
const firstValue = new Map();
|
|
219
|
-
for (const [path, css] of facts.css) {
|
|
220
|
-
for (const c of css.classes) cssClasses.add(c);
|
|
221
|
-
for (const d of css.customDecls) knobs.add(d.name);
|
|
222
|
-
// A var() with a fallback declares its knob.
|
|
223
|
-
for (const r of css.varRefs) if (r.fallback) knobs.add(r.name);
|
|
224
|
-
for (const v of customValues(css)) if (!firstValue.has(v.name)) firstValue.set(v.name, { ...v, path });
|
|
225
|
-
}
|
|
226
|
-
const ownedElements = new Map();
|
|
227
|
-
const ownedClasses = new Map();
|
|
228
|
-
const iface = entry.data.interface;
|
|
229
|
-
if (iface) {
|
|
230
|
-
const file = entry.files.interface;
|
|
231
|
-
const topMarkers = new Set((iface.markers ?? []).map((k) => nameOf(k.attribute)));
|
|
232
|
-
|
|
233
|
-
for (const c of iface.classes ?? []) {
|
|
234
|
-
if (!cssClasses.has(c.name.slice(1))) reject('interface-css', `The class \`${c.name}\` appears in no stylesheet of the item.`, { file });
|
|
235
|
-
if (!ownedClasses.has(c.name)) ownedClasses.set(c.name, new Set());
|
|
236
|
-
for (const a of topMarkers) ownedClasses.get(c.name).add(a);
|
|
237
|
-
}
|
|
238
|
-
const knobsOf = (properties, attributes, owner) => {
|
|
239
|
-
for (const p of properties ?? []) {
|
|
240
|
-
if (!knobs.has(p.name)) reject('interface-css', `The knob \`${p.name}\` on ${owner} is declared by no stylesheet of the item.`, { file });
|
|
241
|
-
const css = firstValue.get(p.name);
|
|
242
|
-
if (typeof p.default === 'string' && css && spelling(p.default) !== spelling(css.value)) {
|
|
243
|
-
const at = `${css.path}:${css.line}`;
|
|
244
|
-
reject('interface-default', `The knob \`${p.name}\` on ${owner} defaults to ${code(spelling(p.default))} in the interface, and its first value in the item's CSS is ${code(spelling(css.value))}, at \`${at}\`.`, { file });
|
|
245
|
-
}
|
|
246
|
-
for (const pair of p.pairs ?? []) {
|
|
247
|
-
if (!attributes.has(nameOf(pair))) reject('interface-pairs', `The knob \`${p.name}\` pairs with \`${nameOf(pair)}\`, which is no attribute or marker of ${owner}.`, { file });
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
};
|
|
251
|
-
knobsOf(iface.properties, topMarkers, 'the class collection');
|
|
252
|
-
|
|
253
|
-
for (const [tag, el] of Object.entries(iface.elements ?? {})) {
|
|
254
|
-
const attributes = new Set([...(el.attributes ?? []).map((a) => a.name), ...(el.markers ?? []).map((k) => nameOf(k.attribute))]);
|
|
255
|
-
if (!ownedElements.has(tag)) ownedElements.set(tag, new Set());
|
|
256
|
-
for (const a of attributes) ownedElements.get(tag).add(a);
|
|
257
|
-
knobsOf(el.properties, attributes, `\`<${tag}>\``);
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
for (const f of examples) {
|
|
261
|
-
if (typeof f.shows !== 'object' || f.shows === null) continue;
|
|
262
|
-
for (const [key, want] of Object.entries(f.shows)) {
|
|
263
|
-
const owned = ownedElements.get(key) ?? ownedClasses.get(key);
|
|
264
|
-
if (!owned || typeof want !== 'object' || want === null) continue;
|
|
265
|
-
const what = key.startsWith('.') ? `the class \`${key}\`` : `\`<${key}>\``;
|
|
266
|
-
for (const attr of Object.keys(want)) {
|
|
267
|
-
if (!owned.has(attr)) reject('interface-shows', `The example \`${f.path}\` shows \`${attr}\` on ${what}, which the interface names no attribute or marker for.`, { file: 'item.json' });
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
// Variants
|
|
273
|
-
const exampleEntries = new Map(files.filter((f) => f.role === 'reference-html').map((f) => [f.path, f]));
|
|
274
|
-
const variants = entry.data.variants;
|
|
275
|
-
if (variants) {
|
|
276
|
-
const file = entry.files.variants;
|
|
277
|
-
const seen = new Set();
|
|
278
|
-
for (const v of variants.variants) {
|
|
279
|
-
if (seen.has(v.id)) reject('duplicate-id', `The variant id \`${v.id}\` repeats.`, { file });
|
|
280
|
-
seen.add(v.id);
|
|
281
|
-
for (const path of v.examples) {
|
|
282
|
-
const example = exampleEntries.get(path);
|
|
283
|
-
if (!example) {
|
|
284
|
-
const role = roles.get(path);
|
|
285
|
-
const why = role === undefined ? 'which the item does not declare' : `which is declared with role \`${role}\`, not \`reference-html\``;
|
|
286
|
-
reject('variant-example', `The variant \`${v.id}\` lists \`${path}\`, ${why}.`, { file });
|
|
287
|
-
continue;
|
|
288
|
-
}
|
|
289
|
-
for (const problem of recipeGaps(v.recipe, example.shows)) {
|
|
290
|
-
reject('variant-recipe', `The variant \`${v.id}\`'s recipe is not in the shows of \`${path}\`: ${problem}`, { file });
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
if (m.kind === 'template' && !entry.files.composition) {
|
|
297
|
-
reject('missing-composition', 'The template has no composition. Its regions, variations, and gaps belong in `<page-type>.composition.json`, declared with role `composition`.', { file: 'item.json' });
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
// Overview
|
|
301
|
-
if (!OVERVIEW_KINDS.has(m.kind) || typeof m.doc !== 'string' || !item.present.has(m.doc)) return;
|
|
302
|
-
const text = readText(item, m.doc);
|
|
303
|
-
const capped = m.kind === 'template' || entry.files.contract;
|
|
304
|
-
if (capped && lineCount(text) > OVERVIEW_LINES) {
|
|
305
|
-
warn('overview-length', `The item's overview is ${lineCount(text)} lines, past the ${OVERVIEW_LINES}-line cap. The rest belongs in the structured files or \`notes.md\`.`, { file: m.doc });
|
|
306
|
-
}
|
|
307
|
-
if (capped && FENCE.test(text)) {
|
|
308
|
-
const held = m.kind === 'template' ? 'the page checklist' : 'the contract';
|
|
309
|
-
warn('overview-snippet', `The item's overview carries a fenced block. Its markup belongs in an example, which the validator holds to ${held}.`, { file: m.doc });
|
|
310
|
-
}
|
|
311
|
-
if (m.kind !== 'component') return;
|
|
312
|
-
if (VERIFY.test(text)) {
|
|
313
|
-
reject('verify-output', `The item's doc still carries \`## Verify output\`, whose rows belong in the contract.`, { file: m.doc });
|
|
314
|
-
}
|
|
315
|
-
if (!entry.files.contract) {
|
|
316
|
-
reject('missing-contract', 'The item has no contract. Its rules belong in `<name>.contract.json`, declared with role `contract`.', { file: 'item.json' });
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
export function recipeGaps(recipe, shows) {
|
|
321
|
-
if (typeof shows !== 'object' || shows === null) return ['the example declares no shows.'];
|
|
322
|
-
const gaps = [];
|
|
323
|
-
for (const [key, want] of Object.entries(recipe)) {
|
|
324
|
-
const got = shows[key];
|
|
325
|
-
if (typeof got !== 'object' || got === null) {
|
|
326
|
-
gaps.push(`the shows has no \`${key}\`.`);
|
|
327
|
-
continue;
|
|
328
|
-
}
|
|
329
|
-
for (const [attr, value] of Object.entries(want)) {
|
|
330
|
-
if (!Object.hasOwn(got, attr)) gaps.push(`\`${key}\` has no \`${attr}\`.`);
|
|
331
|
-
else if (value !== true && got[attr] !== value) gaps.push(`\`${key}\`'s \`${attr}\` takes another value.`);
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
return gaps;
|
|
335
|
-
}
|
package/src/validate/tasc.js
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { walkHtml, components } from './facts.js';
|
|
2
|
-
import { elideValues } from './findings.js';
|
|
3
|
-
|
|
4
|
-
export const check = 'tasc';
|
|
5
|
-
|
|
6
|
-
// A pseudo-element counts zero too, since :where() can't hold one.
|
|
7
|
-
export function specificity(selector) {
|
|
8
|
-
const s = [0, 0, 0];
|
|
9
|
-
for (const c of selector) {
|
|
10
|
-
if (c.type === 'id') s[0]++;
|
|
11
|
-
else if (c.type === 'class' || c.type === 'attribute') s[1]++;
|
|
12
|
-
else if (c.type === 'type') s[2]++;
|
|
13
|
-
else if (c.type === 'pseudo-class') {
|
|
14
|
-
if (c.kind === 'where') continue;
|
|
15
|
-
if (Array.isArray(c.selectors)) {
|
|
16
|
-
const max = c.selectors.map(specificity).sort((x, y) => y[0] - x[0] || y[1] - x[1] || y[2] - x[2])[0] ?? [0, 0, 0];
|
|
17
|
-
for (let k = 0; k < 3; k++) s[k] += max[k];
|
|
18
|
-
if (!['is', 'not', 'has', 'any', 'matches'].includes(c.kind)) s[1]++;
|
|
19
|
-
} else {
|
|
20
|
-
s[1]++;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
return s;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// A lone class, as a utility is, sits at 0,1,0 on purpose.
|
|
28
|
-
function isEscapeHatch(selector) {
|
|
29
|
-
const kept = selector.filter((c) => c.type !== 'pseudo-element');
|
|
30
|
-
return kept.length === 1 && kept[0].type === 'class';
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export async function run(item, ctx, { warn }) {
|
|
34
|
-
if (!item.manifest) return;
|
|
35
|
-
const facts = await ctx.facts(item);
|
|
36
|
-
|
|
37
|
-
for (const [path, css] of facts.css) {
|
|
38
|
-
for (const rule of css.rules) {
|
|
39
|
-
for (const s of rule.selectors) {
|
|
40
|
-
if (isEscapeHatch(s)) continue;
|
|
41
|
-
const spec = specificity(s);
|
|
42
|
-
if (spec.some((n) => n > 0)) {
|
|
43
|
-
warn('where', `The selector \`${elideValues(rule.prelude)}\` has specificity ${spec.join(',')}. A system selector wraps in \`:where()\` at 0,0,0.`, { file: path, line: rule.line });
|
|
44
|
-
break;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
for (const s of rule.selectors) {
|
|
48
|
-
const all = [...components(s)];
|
|
49
|
-
const slotted = all.some((c) => c.type === 'attribute' && c.name === 'slot');
|
|
50
|
-
const scoped = all.some((c) => c.type === 'nesting' || (c.type === 'type' && c.name.startsWith('ca-')) || (c.type === 'class' && c.name.startsWith('ca-')));
|
|
51
|
-
if (slotted && !scoped) {
|
|
52
|
-
warn('slot-scope', `The selector \`${elideValues(rule.prelude)}\` styles a slot outside any component. A slot selector is scoped to its component.`, { file: path, line: rule.line });
|
|
53
|
-
break;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
for (const property of rule.important) {
|
|
57
|
-
warn('important', `\`${property}\` is \`!important\`. TASC reserves \`!important\` for a semantic invariant, where an override would be a bug.`, { file: path, line: rule.line });
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// A framed example renders inside the stock page's <ca-layout>.
|
|
63
|
-
const framed = new Set((item.manifest.files ?? []).filter((f) => f?.frame).map((f) => f.path));
|
|
64
|
-
for (const [path, html] of facts.html) {
|
|
65
|
-
const page = framed.has(path) ? [{ tagName: 'ca-layout' }] : [];
|
|
66
|
-
for (const { node, ancestors } of walkHtml(html.tree)) {
|
|
67
|
-
const slot = node.attrs?.find((a) => a.name === 'slot')?.value;
|
|
68
|
-
if (!slot) continue;
|
|
69
|
-
const line = node.sourceCodeLocation?.startLine ?? null;
|
|
70
|
-
// A slot may sit below a helper such as <ca-container>, so any <ca-*> ancestor counts.
|
|
71
|
-
const hosts = [...page, ...ancestors].filter((a) => a.tagName.startsWith('ca-'));
|
|
72
|
-
if (hosts.length === 0) {
|
|
73
|
-
warn('slot-name', `The slot \`${slot}\` sits outside any \`<ca-*>\` element.`, { file: path, line });
|
|
74
|
-
} else if (!hosts.some((h) => slot.startsWith(`${h.tagName.slice(3)}-`))) {
|
|
75
|
-
const nearest = hosts.at(-1).tagName;
|
|
76
|
-
warn('slot-name', `The slot \`${slot}\` names no \`<ca-*>\` element that holds it. The nearest is \`<${nearest}>\`, whose slots start \`${nearest.slice(3)}-\`.`, { file: path, line });
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
package/src/validate/template.js
DELETED
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from 'node:fs';
|
|
2
|
-
import { join } from 'node:path';
|
|
3
|
-
import { STRUCTURED } from '../lib/schema.js';
|
|
4
|
-
import { recordIds } from '../lib/structured.js';
|
|
5
|
-
import { deriveRegions } from '../lib/regions.js';
|
|
6
|
-
import { itemPage, resolveTarget, seeTarget, parseTarget, isPointer } from '../lib/links.js';
|
|
7
|
-
import { SYSTEM_NAMESPACE } from '../lib/system.js';
|
|
8
|
-
import { interfaceOwners, stateItem, holderOf, repoPathTarget } from './context.js';
|
|
9
|
-
import { declaredFiles } from './item.js';
|
|
10
|
-
|
|
11
|
-
export const check = 'template';
|
|
12
|
-
|
|
13
|
-
const POINTED = new Set(['variants', 'interface']);
|
|
14
|
-
|
|
15
|
-
const readJson = (item, path) => JSON.parse(readFileSync(join(item.dir, path), 'utf8'));
|
|
16
|
-
|
|
17
|
-
const readText = (member) => (path) => {
|
|
18
|
-
if (!member.present.has(path)) return null;
|
|
19
|
-
try {
|
|
20
|
-
return readFileSync(join(member.dir, path), 'utf8');
|
|
21
|
-
} catch {
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
function resolveSee(ctx, item, target) {
|
|
27
|
-
return resolveTarget(target, (name) => {
|
|
28
|
-
const member = name === item.manifest.name ? item : stateItem(ctx, name);
|
|
29
|
-
return member?.manifest ? itemPage(member.manifest, readText(member)) : null;
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// records: the roles the anchor's record must sit in, or null for any anchor.
|
|
34
|
-
function targetGap(ctx, item, target, records) {
|
|
35
|
-
const r = resolveSee(ctx, item, target);
|
|
36
|
-
if (r.missing === 'item') return `\`${target.name}\` is no item the state holds.`;
|
|
37
|
-
if (r.missing) return `\`${target.name}\`'s page carries no such anchor.`;
|
|
38
|
-
if (records && !(r.kind === 'record' && records.has(r.role))) return `The anchor is no variant or interface record of \`${target.name}\`.`;
|
|
39
|
-
return null;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// 'legacy' marks a see in the earlier repo-path form.
|
|
43
|
-
function gapGap(ctx, item, see) {
|
|
44
|
-
const target = parseTarget(see);
|
|
45
|
-
if (target) {
|
|
46
|
-
const r = resolveSee(ctx, item, target);
|
|
47
|
-
if (!r.missing) return null;
|
|
48
|
-
if (r.missing !== 'anchor' && repoPathTarget(ctx, target)) return 'legacy';
|
|
49
|
-
if (r.missing !== 'item' || !isPointer(see.split('#')[0])) return targetGap(ctx, item, target, null);
|
|
50
|
-
}
|
|
51
|
-
return isPointer(see.split('#')[0]) ? 'legacy' : 'It is neither a link target nor a repo path.';
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function seeGap(ctx, item, see) {
|
|
55
|
-
const target = seeTarget(see);
|
|
56
|
-
if (target) return targetGap(ctx, item, target, POINTED);
|
|
57
|
-
const at = see.indexOf('#');
|
|
58
|
-
const path = see.slice(0, at);
|
|
59
|
-
const id = see.slice(at + 1);
|
|
60
|
-
const holder = holderOf(ctx, path);
|
|
61
|
-
if (!holder) return `\`${path}\` sits in no item the state holds.`;
|
|
62
|
-
const declared = declaredFiles(holder.member.manifest).find((f) => f.path === holder.file);
|
|
63
|
-
if (!declared || !POINTED.has(declared.role) || !holder.member.present.has(holder.file)) {
|
|
64
|
-
return `\`${path}\` is no variants or interface file of \`${holder.member.manifest.name}\`.`;
|
|
65
|
-
}
|
|
66
|
-
let data;
|
|
67
|
-
try {
|
|
68
|
-
data = readJson(holder.member, holder.file);
|
|
69
|
-
} catch {
|
|
70
|
-
return `\`${path}\` doesn't parse.`;
|
|
71
|
-
}
|
|
72
|
-
if (!STRUCTURED[declared.role](data)) return `\`${path}\` fails its schema.`;
|
|
73
|
-
return recordIds(declared.role, data).has(id) ? null : `\`${path}\` holds no record of that id.`;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export async function run(item, ctx, { reject, warn }) {
|
|
77
|
-
const m = item.manifest;
|
|
78
|
-
if (m.kind !== 'template') return;
|
|
79
|
-
const files = declaredFiles(m);
|
|
80
|
-
const examples = files.filter((f) => f.role === 'reference-html' && item.present.has(f.path));
|
|
81
|
-
const owners = interfaceOwners(ctx, typeof m.name === 'string' ? m.name.slice(0, m.name.indexOf('/')) : null);
|
|
82
|
-
const declared = new Set(Object.keys(m.dependencies ?? {}));
|
|
83
|
-
const derived = new Map(examples.map((f) => [f.path, deriveRegions(readFileSync(join(item.dir, f.path), 'utf8'), { owners, foundation: ctx.foundation })]));
|
|
84
|
-
|
|
85
|
-
for (const [path, page] of derived) {
|
|
86
|
-
for (const name of page.items) {
|
|
87
|
-
if (!declared.has(name)) reject('undeclared-dependency', `The page uses \`${name}\`'s surface, and \`dependencies\` leaves it out.`, { file: path });
|
|
88
|
-
}
|
|
89
|
-
if (page.unmapped.length > 0) {
|
|
90
|
-
const names = page.unmapped.map((n) => `\`${n}\``).join(', ');
|
|
91
|
-
warn('unmapped-surface', `The page uses surface no interface holds, so no dependency covers it: ${names}.`, { file: path });
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
const entry = files.find((f) => f.role === 'composition' && item.present.has(f.path));
|
|
96
|
-
if (!entry || examples.length === 0) return;
|
|
97
|
-
let composition;
|
|
98
|
-
try {
|
|
99
|
-
composition = readJson(item, entry.path);
|
|
100
|
-
} catch {
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
if (!STRUCTURED.composition(composition)) return;
|
|
104
|
-
const page = examples[0].path;
|
|
105
|
-
const { regions, problems } = derived.get(page);
|
|
106
|
-
for (const problem of problems) reject('region-rule', problem, { file: page });
|
|
107
|
-
if (problems.length === 0 && composition.regions.length !== regions.length) {
|
|
108
|
-
reject('region-count', `The composition records ${composition.regions.length} regions, and \`${page}\` holds ${regions.length}. It records one per region, in document order.`, { file: entry.path });
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
const ids = new Set(composition.regions.map((r) => r.id));
|
|
112
|
-
const legacy = typeof m.name === 'string' && m.name.startsWith(`${SYSTEM_NAMESPACE}/`) ? reject : warn;
|
|
113
|
-
const old = [];
|
|
114
|
-
for (const v of composition.variations ?? []) {
|
|
115
|
-
if (!ids.has(v.region)) reject('variation-region', `The variation \`${v.id}\` names the region \`${v.region}\`, which the composition doesn't record.`, { file: entry.path });
|
|
116
|
-
if (!seeTarget(v.see)) old.push(`the variation \`${v.id}\``);
|
|
117
|
-
const gap = seeGap(ctx, item, v.see);
|
|
118
|
-
if (gap) reject('variation-see', `The variation \`${v.id}\`'s \`see\` names no record: ${gap}`, { file: entry.path });
|
|
119
|
-
}
|
|
120
|
-
(composition.gaps ?? []).forEach((g, i) => {
|
|
121
|
-
if (typeof g.see !== 'string') return;
|
|
122
|
-
const gap = gapGap(ctx, item, g.see);
|
|
123
|
-
if (gap === 'legacy') old.push(`the gap at index ${i}`);
|
|
124
|
-
else if (gap) reject('gap-see', `The gap at index ${i}'s \`see\` names nothing: ${gap}`, { file: entry.path });
|
|
125
|
-
});
|
|
126
|
-
if (old.length > 0) {
|
|
127
|
-
legacy('legacy-see', `The \`see\` of ${old.length < 3 ? old.join(' and ') : `${old.slice(0, -1).join(', ')}, and ${old.at(-1)}`} is a repo path, the earlier form. Write each as a link target, the item's scoped name, a #, and the anchor.`, { file: entry.path });
|
|
128
|
-
}
|
|
129
|
-
}
|