@hawkeyexl/manni 2.3.8 → 2.3.10
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 +1 -1
- package/dist/{chunk-TIZE6GXU.js → chunk-LORLZO3J.js} +93 -11
- package/dist/chunk-LORLZO3J.js.map +1 -0
- package/dist/{chunk-EYD2RYKV.js → chunk-TNT3ZROC.js} +11 -12
- package/dist/chunk-TNT3ZROC.js.map +1 -0
- package/dist/{chunk-L73SKPCW.js → chunk-WXBLVCOZ.js} +2 -2
- package/dist/cli.js +109 -39
- package/dist/cli.js.map +1 -1
- package/dist/docmeta.js +2 -2
- package/dist/index.d.ts +32 -7
- package/dist/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-EYD2RYKV.js.map +0 -1
- package/dist/chunk-TIZE6GXU.js.map +0 -1
- /package/dist/{chunk-L73SKPCW.js.map → chunk-WXBLVCOZ.js.map} +0 -0
|
@@ -61,7 +61,7 @@ import {
|
|
|
61
61
|
supportedExtensions,
|
|
62
62
|
terminalConfirm,
|
|
63
63
|
toJsonText
|
|
64
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-TNT3ZROC.js";
|
|
65
65
|
|
|
66
66
|
// src/meta/cli.ts
|
|
67
67
|
import { existsSync } from "node:fs";
|
|
@@ -1517,4 +1517,4 @@ export {
|
|
|
1517
1517
|
reportConfig,
|
|
1518
1518
|
buildProgram
|
|
1519
1519
|
};
|
|
1520
|
-
//# sourceMappingURL=chunk-
|
|
1520
|
+
//# sourceMappingURL=chunk-WXBLVCOZ.js.map
|
package/dist/cli.js
CHANGED
|
@@ -7,15 +7,19 @@ import {
|
|
|
7
7
|
readStdin,
|
|
8
8
|
reportConfig,
|
|
9
9
|
splitList
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-WXBLVCOZ.js";
|
|
11
11
|
import {
|
|
12
12
|
CiteError,
|
|
13
13
|
KeyError,
|
|
14
|
+
RULE_ID_PREFIX,
|
|
14
15
|
SEVERITIES,
|
|
15
16
|
SEVERITY_LIST,
|
|
16
17
|
asCiteError,
|
|
17
18
|
codeEndAt,
|
|
18
19
|
codeRegions,
|
|
20
|
+
errorSite,
|
|
21
|
+
findingMessage,
|
|
22
|
+
isCiteRule,
|
|
19
23
|
isSeverity,
|
|
20
24
|
meetsSeverity,
|
|
21
25
|
renderCheckGithub,
|
|
@@ -29,10 +33,11 @@ import {
|
|
|
29
33
|
runKeySet,
|
|
30
34
|
runUpdate,
|
|
31
35
|
shortCommit,
|
|
36
|
+
shortLine,
|
|
32
37
|
shortPin,
|
|
33
38
|
shortSrc,
|
|
34
39
|
spellSource
|
|
35
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-LORLZO3J.js";
|
|
36
41
|
import {
|
|
37
42
|
COMMON_FORMAT_LIST,
|
|
38
43
|
OMITTED_WHEN_CLEAN,
|
|
@@ -59,7 +64,6 @@ import {
|
|
|
59
64
|
palette,
|
|
60
65
|
programName,
|
|
61
66
|
readConfigFile,
|
|
62
|
-
render,
|
|
63
67
|
renderJunit,
|
|
64
68
|
renderSarif,
|
|
65
69
|
resolveBaselineRequest,
|
|
@@ -71,7 +75,7 @@ import {
|
|
|
71
75
|
splitPageArgument,
|
|
72
76
|
terminalConfirm,
|
|
73
77
|
valeConfigPath
|
|
74
|
-
} from "./chunk-
|
|
78
|
+
} from "./chunk-TNT3ZROC.js";
|
|
75
79
|
|
|
76
80
|
// src/cli.ts
|
|
77
81
|
import { Command as Command5 } from "commander";
|
|
@@ -762,7 +766,7 @@ var A11Y_FORMAT_LIST = A11Y_FORMATS.join(" | ");
|
|
|
762
766
|
function isA11yFormat(value) {
|
|
763
767
|
return A11Y_FORMATS.includes(value);
|
|
764
768
|
}
|
|
765
|
-
function
|
|
769
|
+
function render(format, run, opts) {
|
|
766
770
|
switch (format) {
|
|
767
771
|
case "pretty":
|
|
768
772
|
return renderPretty(run, opts);
|
|
@@ -971,7 +975,7 @@ function buildProgram2() {
|
|
|
971
975
|
{ analyzer: createPlaywrightAnalyzer(), onProgress: progress.listener }
|
|
972
976
|
);
|
|
973
977
|
const color = resolveColor(parent, process.stdout);
|
|
974
|
-
const text2 =
|
|
978
|
+
const text2 = render(format, run, { color, quiet: Boolean(options.quiet) });
|
|
975
979
|
if (text2.length > 0 || format !== "github") {
|
|
976
980
|
process.stdout.write(`${text2}
|
|
977
981
|
`);
|
|
@@ -987,7 +991,71 @@ function buildProgram2() {
|
|
|
987
991
|
|
|
988
992
|
// src/cite/cli.ts
|
|
989
993
|
import { Command as Command2, Option } from "commander";
|
|
994
|
+
|
|
995
|
+
// src/cite/reporters/sarif.ts
|
|
996
|
+
var INFORMATION_URI = "https://hawkeyexl.github.io/manni/cite/";
|
|
997
|
+
var RULES_URI = "https://hawkeyexl.github.io/manni/cite/reference/citations/";
|
|
998
|
+
var RULE_DESCRIPTIONS = {
|
|
999
|
+
"source-moved": "The cited source lines moved to one other place in the file.",
|
|
1000
|
+
"source-moved-ambiguous": "The cited source lines now match at several places in the file.",
|
|
1001
|
+
"source-changed": "The cited source lines changed since the citation pinned them.",
|
|
1002
|
+
"source-never-true": "The pin never matched the source at the recorded commit.",
|
|
1003
|
+
"source-missing": "The cited source file is not tracked under the root, or cannot be decrypted.",
|
|
1004
|
+
"claim-moved": "The cited sentence moved to other lines of the page.",
|
|
1005
|
+
"claim-moved-ambiguous": "The cited sentence now appears at several places on the page.",
|
|
1006
|
+
"claim-changed": "The cited sentence was edited since the citation pinned it.",
|
|
1007
|
+
"marker-orphan": "A marker names an id no citation has.",
|
|
1008
|
+
"marker-invalid": "A marker is malformed, or the page has too many markers.",
|
|
1009
|
+
"marker-repeated": "Two markers name the same citation id.",
|
|
1010
|
+
"anchor-invalid": "A citation's anchor cannot work.",
|
|
1011
|
+
"entry-invalid": "A citation entry is malformed.",
|
|
1012
|
+
"quote-drift": "A quoted block no longer reproduces its source."
|
|
1013
|
+
};
|
|
1014
|
+
var ENTRY_LABEL = /^(?:\(root\)|\/citations\/\d+) /;
|
|
1015
|
+
function withFindingMessages(run) {
|
|
1016
|
+
return run.results.map((result) => {
|
|
1017
|
+
const page = run.pages.find((p) => p.file === result.file);
|
|
1018
|
+
if (page === void 0) return result;
|
|
1019
|
+
const errors = result.errors.map((error) => {
|
|
1020
|
+
const finding = page.findings.find(
|
|
1021
|
+
(f) => f.rule === error.keyword && (f.index === void 0 ? "" : `/citations/${String(f.index)}`) === error.instancePath && f.message === error.message && (errorSite(f).line ?? null) === (error.line ?? null)
|
|
1022
|
+
);
|
|
1023
|
+
return finding === void 0 ? error : { ...error, message: findingMessage(finding) };
|
|
1024
|
+
});
|
|
1025
|
+
return { ...result, errors };
|
|
1026
|
+
});
|
|
1027
|
+
}
|
|
1028
|
+
function describe(rule) {
|
|
1029
|
+
const name = rule.id.slice(RULE_ID_PREFIX.length + 1);
|
|
1030
|
+
if (!isCiteRule(name)) return rule;
|
|
1031
|
+
return { id: rule.id, shortDescription: { text: RULE_DESCRIPTIONS[name] }, helpUri: `${RULES_URI}#${name}` };
|
|
1032
|
+
}
|
|
1033
|
+
function renderCheckSarif(run, opts = {}) {
|
|
1034
|
+
const log = JSON.parse(
|
|
1035
|
+
renderSarif(withFindingMessages(run), {
|
|
1036
|
+
frame: run.frame,
|
|
1037
|
+
...opts.onNotice === void 0 ? {} : { onNotice: opts.onNotice }
|
|
1038
|
+
})
|
|
1039
|
+
);
|
|
1040
|
+
for (const sarifRun of log.runs) {
|
|
1041
|
+
sarifRun.tool.driver.informationUri = INFORMATION_URI;
|
|
1042
|
+
sarifRun.tool.driver.rules = sarifRun.tool.driver.rules.map(describe);
|
|
1043
|
+
for (const result of sarifRun.results) result.message.text = result.message.text.replace(ENTRY_LABEL, "");
|
|
1044
|
+
}
|
|
1045
|
+
return JSON.stringify(log, null, 2);
|
|
1046
|
+
}
|
|
1047
|
+
|
|
1048
|
+
// src/cite/reporters/junit.ts
|
|
990
1049
|
var JUNIT_CLASSNAME = "manni.cite";
|
|
1050
|
+
var MESSAGE_LABEL = new RegExp(`message="${ENTRY_LABEL.source.replace(/^\^/, "")}`, "g");
|
|
1051
|
+
function renderCheckJunit(run) {
|
|
1052
|
+
return renderJunit(withFindingMessages(run), { frame: run.frame, classname: JUNIT_CLASSNAME }).replace(
|
|
1053
|
+
MESSAGE_LABEL,
|
|
1054
|
+
'message="'
|
|
1055
|
+
);
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
// src/cite/cli.ts
|
|
991
1059
|
var UPDATE_FORMATS = ["pretty", "json"];
|
|
992
1060
|
function colorFor(command, isTTY, env) {
|
|
993
1061
|
const noColor = colorOwner(command).opts().color === false;
|
|
@@ -1014,7 +1082,9 @@ function addMessage(result) {
|
|
|
1014
1082
|
const name = citation.id ?? (claim === void 0 ? "a bare pin" : "an entry");
|
|
1015
1083
|
const src = shortSrc(spellSource(citation.source));
|
|
1016
1084
|
const commit = citation.source["commit-sha"];
|
|
1017
|
-
const
|
|
1085
|
+
const quoted = result.sourceLine === void 0 ? "" : shortLine(result.sourceLine);
|
|
1086
|
+
const line = quoted === "" ? "" : ` "${quoted}"`;
|
|
1087
|
+
const pin = `${src}${line}, ${shortPin(citation.source.integrity)}, ${commit === void 0 ? "no commit" : shortCommit(commit)}`;
|
|
1018
1088
|
const where2 = result.manifest === void 0 ? "frontmatter" : `${result.manifest.file}:${String(result.manifest.line)}`;
|
|
1019
1089
|
const head = `${result.file}: added ${name} to ${where2}`;
|
|
1020
1090
|
if (result.markerLine !== void 0) {
|
|
@@ -1122,12 +1192,12 @@ function buildProgram3() {
|
|
|
1122
1192
|
case "github":
|
|
1123
1193
|
text2 = renderCheckGithub(run);
|
|
1124
1194
|
break;
|
|
1125
|
-
|
|
1126
|
-
text2 =
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1195
|
+
case "sarif":
|
|
1196
|
+
text2 = renderCheckSarif(run, { onNotice: notice });
|
|
1197
|
+
break;
|
|
1198
|
+
case "junit":
|
|
1199
|
+
text2 = renderCheckJunit(run);
|
|
1200
|
+
break;
|
|
1131
1201
|
}
|
|
1132
1202
|
if (text2.length > 0 || !OMITTED_WHEN_CLEAN.has(format)) {
|
|
1133
1203
|
process.stdout.write(`${text2}
|
|
@@ -1694,7 +1764,7 @@ async function resolveTermRun(opts) {
|
|
|
1694
1764
|
}
|
|
1695
1765
|
|
|
1696
1766
|
// src/term/core/severity.ts
|
|
1697
|
-
var
|
|
1767
|
+
var RULE_ID_PREFIX2 = "manni:term";
|
|
1698
1768
|
var DEFAULT_SEVERITY = {
|
|
1699
1769
|
"undefined-term": "error",
|
|
1700
1770
|
"duplicate-id": "error",
|
|
@@ -1708,10 +1778,10 @@ var DEFAULT_SEVERITY = {
|
|
|
1708
1778
|
"unused-term": "notice"
|
|
1709
1779
|
};
|
|
1710
1780
|
function ruleId(rule) {
|
|
1711
|
-
return `${
|
|
1781
|
+
return `${RULE_ID_PREFIX2}/${rule}`;
|
|
1712
1782
|
}
|
|
1713
1783
|
function proseRuleId(check) {
|
|
1714
|
-
return `${
|
|
1784
|
+
return `${RULE_ID_PREFIX2}/prose/${check}`;
|
|
1715
1785
|
}
|
|
1716
1786
|
function isTermRule2(value) {
|
|
1717
1787
|
return TERM_RULES.includes(value);
|
|
@@ -1928,11 +1998,11 @@ var FINDING_FORMATS = ["pretty", "json", "github", "sarif", "junit"];
|
|
|
1928
1998
|
var JUNIT_CLASSNAME2 = "manni.term";
|
|
1929
1999
|
var LINE_REFERENCE = /:\d+\b/g;
|
|
1930
2000
|
function toFieldError(finding) {
|
|
1931
|
-
const keyword = finding.ruleId.startsWith(`${
|
|
2001
|
+
const keyword = finding.ruleId.startsWith(`${RULE_ID_PREFIX2}/`) ? finding.ruleId.slice(RULE_ID_PREFIX2.length + 1) : finding.ruleId;
|
|
1932
2002
|
const { field } = finding;
|
|
1933
2003
|
const subject = [finding.id ?? "", field ?? "", finding.message.replace(LINE_REFERENCE, "")].join("\0");
|
|
1934
2004
|
const error = {
|
|
1935
|
-
schema:
|
|
2005
|
+
schema: RULE_ID_PREFIX2,
|
|
1936
2006
|
instancePath: field === void 0 ? "" : `/${field}`,
|
|
1937
2007
|
message: finding.message,
|
|
1938
2008
|
keyword,
|
|
@@ -1957,7 +2027,7 @@ function toResults(set, findings) {
|
|
|
1957
2027
|
}
|
|
1958
2028
|
const results = [...byFile.keys()].sort().map((file) => {
|
|
1959
2029
|
const errors = byFile.get(file) ?? [];
|
|
1960
|
-
return { file, format: "term", ok: !errors.some(isErrorSeverity), schemas: [
|
|
2030
|
+
return { file, format: "term", ok: !errors.some(isErrorSeverity), schemas: [RULE_ID_PREFIX2], errors };
|
|
1961
2031
|
});
|
|
1962
2032
|
return { results, origin };
|
|
1963
2033
|
}
|
|
@@ -4429,9 +4499,9 @@ var INTERCHANGE_LABELS = {
|
|
|
4429
4499
|
};
|
|
4430
4500
|
function rendered(writers, format, construct) {
|
|
4431
4501
|
return writers.some((writer) => {
|
|
4432
|
-
const
|
|
4433
|
-
if (
|
|
4434
|
-
return writer.shapes.some((shape) =>
|
|
4502
|
+
const render2 = DOCUMENT_RENDERS[writer.format];
|
|
4503
|
+
if (render2?.input !== format) return false;
|
|
4504
|
+
return writer.shapes.some((shape) => render2.shapes[shape] === construct);
|
|
4435
4505
|
});
|
|
4436
4506
|
}
|
|
4437
4507
|
function listFormats(opts = {}) {
|
|
@@ -4868,14 +4938,14 @@ async function runWrite(opts) {
|
|
|
4868
4938
|
const shape = format === "vale" || /[\\/]$/.test(opts.out ?? "") || isDirectory(targetPath) ? "directory" : "file";
|
|
4869
4939
|
const target = { path: targetPath, shape };
|
|
4870
4940
|
const existing = await existingFor(target);
|
|
4871
|
-
let
|
|
4941
|
+
let render2;
|
|
4872
4942
|
try {
|
|
4873
|
-
|
|
4943
|
+
render2 = writer.render(set.terms, target, { existing });
|
|
4874
4944
|
} catch (error) {
|
|
4875
4945
|
if (error instanceof TermError) throw relativized(error, [...existing.keys(), targetPath], cwd);
|
|
4876
4946
|
throw error;
|
|
4877
4947
|
}
|
|
4878
|
-
const changes = await applyChanges(
|
|
4948
|
+
const changes = await applyChanges(render2.files, render2.removals, existing, cwd, !check && !dryRun);
|
|
4879
4949
|
const shown = format === "vale" ? displayPath(join4(targetPath, STYLE2), cwd) : opts.out ?? displayPath(targetPath, cwd);
|
|
4880
4950
|
return {
|
|
4881
4951
|
mode: "render",
|
|
@@ -4884,11 +4954,11 @@ async function runWrite(opts) {
|
|
|
4884
4954
|
target: shown,
|
|
4885
4955
|
terms: set.terms.length,
|
|
4886
4956
|
changes,
|
|
4887
|
-
files:
|
|
4957
|
+
files: render2.files.map((file) => ({ path: displayPath(file.path, cwd), content: file.content })),
|
|
4888
4958
|
// A Vale style holds designations only, by design; its dropped definitions are not news.
|
|
4889
|
-
dropped: format === "vale" ? [] :
|
|
4959
|
+
dropped: format === "vale" ? [] : render2.dropped,
|
|
4890
4960
|
droppedFrom: droppedFrom(format, shape, readers),
|
|
4891
|
-
skipped:
|
|
4961
|
+
skipped: render2.skipped,
|
|
4892
4962
|
check,
|
|
4893
4963
|
dryRun,
|
|
4894
4964
|
...wiring === void 0 ? {} : { wiring }
|
|
@@ -5034,9 +5104,9 @@ function renderFormatsJson(rows) {
|
|
|
5034
5104
|
}
|
|
5035
5105
|
|
|
5036
5106
|
// src/term/reporters/sarif.ts
|
|
5037
|
-
var
|
|
5038
|
-
var
|
|
5039
|
-
var
|
|
5107
|
+
var INFORMATION_URI2 = "https://hawkeyexl.github.io/manni/term/";
|
|
5108
|
+
var RULES_URI2 = "https://hawkeyexl.github.io/manni/term/reference/rules/";
|
|
5109
|
+
var RULE_DESCRIPTIONS2 = {
|
|
5040
5110
|
"undefined-term": "A page's concepts: names a label no entry claims as its preferred label.",
|
|
5041
5111
|
"duplicate-id": "Two entries share an id.",
|
|
5042
5112
|
"label-collision": "Two entries claim the same preferred label, ignoring case.",
|
|
@@ -5048,16 +5118,16 @@ var RULE_DESCRIPTIONS = {
|
|
|
5048
5118
|
"abstract-too-long": "An abstract is longer than term.abstractMaxLength.",
|
|
5049
5119
|
"unused-term": "No page's concepts: names the entry's preferred label."
|
|
5050
5120
|
};
|
|
5051
|
-
var PROSE_PREFIX = `${
|
|
5121
|
+
var PROSE_PREFIX = `${RULE_ID_PREFIX2}/prose/`;
|
|
5052
5122
|
var FIELD_LABEL = new RegExp(`^(?:\\(root\\)|/(?:${TERM_FIELDS.join("|")})) `);
|
|
5053
|
-
function
|
|
5123
|
+
function describe2(rule) {
|
|
5054
5124
|
if (rule.id.startsWith(PROSE_PREFIX)) {
|
|
5055
5125
|
const check = rule.id.slice(PROSE_PREFIX.length);
|
|
5056
5126
|
return { id: rule.id, shortDescription: { text: `Vale's ${check} rule flagged the prose of an entry's field.` } };
|
|
5057
5127
|
}
|
|
5058
|
-
const name = rule.id.slice(
|
|
5128
|
+
const name = rule.id.slice(RULE_ID_PREFIX2.length + 1);
|
|
5059
5129
|
if (!isTermRule2(name)) return rule;
|
|
5060
|
-
return { id: rule.id, shortDescription: { text:
|
|
5130
|
+
return { id: rule.id, shortDescription: { text: RULE_DESCRIPTIONS2[name] }, helpUri: `${RULES_URI2}#${name}` };
|
|
5061
5131
|
}
|
|
5062
5132
|
function renderFindingsSarif(report, opts = {}) {
|
|
5063
5133
|
const log = JSON.parse(
|
|
@@ -5067,18 +5137,18 @@ function renderFindingsSarif(report, opts = {}) {
|
|
|
5067
5137
|
})
|
|
5068
5138
|
);
|
|
5069
5139
|
for (const run of log.runs) {
|
|
5070
|
-
run.tool.driver.informationUri =
|
|
5071
|
-
run.tool.driver.rules = run.tool.driver.rules.map(
|
|
5140
|
+
run.tool.driver.informationUri = INFORMATION_URI2;
|
|
5141
|
+
run.tool.driver.rules = run.tool.driver.rules.map(describe2);
|
|
5072
5142
|
for (const result of run.results) result.message.text = result.message.text.replace(FIELD_LABEL, "");
|
|
5073
5143
|
}
|
|
5074
5144
|
return JSON.stringify(log, null, 2);
|
|
5075
5145
|
}
|
|
5076
5146
|
|
|
5077
5147
|
// src/term/reporters/junit.ts
|
|
5078
|
-
var
|
|
5148
|
+
var MESSAGE_LABEL2 = new RegExp(`message="${FIELD_LABEL.source.slice(1)}`, "g");
|
|
5079
5149
|
function renderFindingsJunit(report) {
|
|
5080
5150
|
return renderJunit(report.results, { frame: report.frame, classname: JUNIT_CLASSNAME2 }).replace(
|
|
5081
|
-
|
|
5151
|
+
MESSAGE_LABEL2,
|
|
5082
5152
|
'message="'
|
|
5083
5153
|
);
|
|
5084
5154
|
}
|