@nielspeter/eess-crossvalidate 0.7.0 → 0.9.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 +2 -2
- package/dist/it-title.d.ts +4 -5
- package/dist/it-title.d.ts.map +1 -1
- package/dist/it-title.js +4 -5
- package/dist/it-title.js.map +1 -1
- package/dist/md-mermaid-er.d.ts.map +1 -1
- package/dist/md-mermaid-er.js +11 -5
- package/dist/md-mermaid-er.js.map +1 -1
- package/dist/md-mermaid.d.ts +3 -2
- package/dist/md-mermaid.d.ts.map +1 -1
- package/dist/md-mermaid.js +18 -47
- package/dist/md-mermaid.js.map +1 -1
- package/dist/md-ts.d.ts +5 -5
- package/dist/md-ts.js +5 -5
- package/dist/mermaid-tag.d.ts +10 -0
- package/dist/mermaid-tag.d.ts.map +1 -0
- package/dist/mermaid-tag.js +13 -0
- package/dist/mermaid-tag.js.map +1 -0
- package/dist/shared.d.ts +12 -0
- package/dist/shared.d.ts.map +1 -1
- package/dist/shared.js +25 -0
- package/dist/shared.js.map +1 -1
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -31,8 +31,8 @@ adrCitationsResolve(corpus({ roots: ['docs/**'] }), project('tsconfig.json'))
|
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
AST-grounded: cited titles are resolved against actual `it()` call expressions
|
|
34
|
-
(via eess-ts's public API — no ts-morph here, per ADR-007)
|
|
35
|
-
|
|
34
|
+
(via eess-ts's public API — no ts-morph here, per ADR-007). It is the family's only
|
|
35
|
+
title check: `eess-md`'s `adrEnforcement` checks cited file paths and leaves titles here.
|
|
36
36
|
|
|
37
37
|
## Markdown ↔ Gherkin
|
|
38
38
|
|
package/dist/it-title.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The `it('…')` title grammar for this package — one definition, because both of
|
|
3
|
-
* its presets read it.
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* behind eess-ts's engine boundary rather than here at all.
|
|
3
|
+
* its presets read it. `eess-md`'s `adr.ts` used to carry another copy, on the same
|
|
4
|
+
* ADR-citation contract; bug 0111 removed it, so this is the only reader of a cited
|
|
5
|
+
* title. See 0114 for why the grammar arguably belongs behind eess-ts's engine
|
|
6
|
+
* boundary rather than here at all.
|
|
8
7
|
*
|
|
9
8
|
* `md-ts` (ADR citations) and `gherkin-ts` (scenario citations) both have to
|
|
10
9
|
* recover the title a test declares from source text, and both got it wrong the
|
package/dist/it-title.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"it-title.d.ts","sourceRoot":"","sources":["../src/it-title.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"it-title.d.ts","sourceRoot":"","sources":["../src/it-title.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AAwCH;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAE9D;AAED,uFAAuF;AACvF,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEpE;AAED,wEAAwE;AACxE,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAOpD"}
|
package/dist/it-title.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The `it('…')` title grammar for this package — one definition, because both of
|
|
3
|
-
* its presets read it.
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* behind eess-ts's engine boundary rather than here at all.
|
|
3
|
+
* its presets read it. `eess-md`'s `adr.ts` used to carry another copy, on the same
|
|
4
|
+
* ADR-citation contract; bug 0111 removed it, so this is the only reader of a cited
|
|
5
|
+
* title. See 0114 for why the grammar arguably belongs behind eess-ts's engine
|
|
6
|
+
* boundary rather than here at all.
|
|
8
7
|
*
|
|
9
8
|
* `md-ts` (ADR citations) and `gherkin-ts` (scenario citations) both have to
|
|
10
9
|
* recover the title a test declares from source text, and both got it wrong the
|
package/dist/it-title.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"it-title.js","sourceRoot":"","sources":["../src/it-title.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"it-title.js","sourceRoot":"","sources":["../src/it-title.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AAEH,qFAAqF;AACrF,MAAM,OAAO,GAAG,6BAA6B,CAAA;AAE7C;;;;;;GAMG;AACH,MAAM,MAAM,GAAG,CAAC,IAAY,EAAU,EAAE,CAAC,iCAAiC,IAAI,WAAW,CAAA;AAEzF,kFAAkF;AAClF,MAAM,WAAW,GAAG,mBAAmB,CAAA;AAEvC;;;;;GAKG;AACH,MAAM,UAAU,GAAG,gBAAgB,OAAO,aAAa,CAAA;AAEvD;;;;GAIG;AACH,MAAM,IAAI,GAAG,CAAC,MAAc,EAAU,EAAE,CAAC,kBAAkB,MAAM,sBAAsB,CAAA;AAEvF,qEAAqE;AACrE,6DAA6D;AAC7D,MAAM,QAAQ,GAAG,IAAI,MAAM,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,CAAA;AACnE,MAAM,gBAAgB,GAAG,IAAI,MAAM,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,GAAG,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,CAAA;AAEhF,kFAAkF;AAClF,MAAM,WAAW,GAAG,IAAI,MAAM,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,UAAU,CAAC,EAAE,EAAE,GAAG,CAAC,CAAA;AAEzE;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAC,QAAgB;IACxC,OAAO,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,KAAK,CAAA;AAC/C,CAAC;AAED,uFAAuF;AACvF,MAAM,UAAU,eAAe,CAAC,QAAgB;IAC9C,OAAO,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,KAAK,CAAA;AACvD,CAAC;AAED,wEAAwE;AACxE,MAAM,UAAU,aAAa,CAAC,IAAY;IACxC,MAAM,GAAG,GAAa,EAAE,CAAA;IACxB,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;QAC3C,MAAM,KAAK,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,CAAA;QAC7B,IAAI,KAAK,KAAK,SAAS;YAAE,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IAC1C,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"md-mermaid-er.d.ts","sourceRoot":"","sources":["../src/md-mermaid-er.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,EAGL,KAAK,mBAAmB,EAEzB,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"md-mermaid-er.d.ts","sourceRoot":"","sources":["../src/md-mermaid-er.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,EAGL,KAAK,mBAAmB,EAEzB,MAAM,kBAAkB,CAAA;AAGzB,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAS7D,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAG9D,YAAY,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AACrD,YAAY,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AAE1E,MAAM,WAAW,mBAAoB,SAAQ,mBAAmB;IAC9D,2DAA2D;IAC3D,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;IACtB;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE;QACd,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;QACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;QACrB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KACvB,CAAA;IACD;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,UAAU,KAAK,MAAM,GAAG,SAAS,CAAA;CACzD;AAkCD;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,mBAAmB,GAAG,aAAa,CAqGxF;AAED,kFAAkF;AAClF,wBAAgB,YAAY,CAC1B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,mBAAmB,GAC3B;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAiBxD"}
|
package/dist/md-mermaid-er.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import picomatch from 'picomatch';
|
|
2
2
|
import { finishPreset, collectResult, } from '@nielspeter/eess';
|
|
3
|
-
import { violationsFor } from './shared.js';
|
|
4
|
-
import {
|
|
3
|
+
import { violationsFor, GRAMMAR_GAP, grammarGapRemedy, asClause } from './shared.js';
|
|
4
|
+
import { isMermaidTag } from './mermaid-tag.js';
|
|
5
|
+
import { parseErDiagram, collectEntities, diagramKind, } from '@nielspeter/eess-mermaid';
|
|
5
6
|
// Kernel re-exports (plan 0089 — standalone sufficiency): see mermaid-ts.ts.
|
|
6
7
|
export { finishPreset, collectResult } from '@nielspeter/eess';
|
|
7
8
|
const RULE = 'entity property tables and their erDiagram should agree';
|
|
@@ -9,7 +10,7 @@ const ER_HEADER = /^\s*erDiagram\b/;
|
|
|
9
10
|
const v = violationsFor(RULE, 'crossval/table-er-agree', ({ doc, line }) => ({ element: doc.relPath, file: doc.file, line }));
|
|
10
11
|
function erEntitiesOf(doc) {
|
|
11
12
|
return doc.codeBlocks
|
|
12
|
-
.filter((b) => (b.lang
|
|
13
|
+
.filter((b) => (isMermaidTag(b.lang) || b.lang === null) && ER_HEADER.test(diagramKind(b.value)))
|
|
13
14
|
.map((b) => {
|
|
14
15
|
try {
|
|
15
16
|
return { entities: collectEntities(parseErDiagram(b.value)), line: b.line };
|
|
@@ -46,12 +47,17 @@ export function tableErAgree(corpus, options) {
|
|
|
46
47
|
const blocks = erEntitiesOf(doc);
|
|
47
48
|
if (blocks.length === 0)
|
|
48
49
|
continue;
|
|
49
|
-
// A block
|
|
50
|
+
// A block eess-mermaid's ER grammar cannot read is itself a finding — flag
|
|
50
51
|
// it (never crash, never silently skip) and compare what did parse.
|
|
51
52
|
for (const b of blocks) {
|
|
52
53
|
examined++;
|
|
53
54
|
if (b.parseError !== undefined) {
|
|
54
|
-
|
|
55
|
+
// Bug 0409: say what eess knows, not what "standard Mermaid" accepts. `violationsFor`
|
|
56
|
+
// takes a reason, not a fix, so the remedy is set as the suggestion here.
|
|
57
|
+
violations.push({
|
|
58
|
+
...v({ doc, line: b.line }, `erDiagram does not parse with eess-mermaid's ER grammar: ${asClause(b.parseError)}. ${GRAMMAR_GAP}`, 'A diagram eess-mermaid cannot read cannot be compared with its property table.'),
|
|
59
|
+
suggestion: grammarGapRemedy("with tableErAgree's `docs` glob"),
|
|
60
|
+
});
|
|
55
61
|
}
|
|
56
62
|
}
|
|
57
63
|
if (blocks.every((b) => b.parseError !== undefined))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"md-mermaid-er.js","sourceRoot":"","sources":["../src/md-mermaid-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EAAE,EAAE,CAAC;QACrC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC;YAAE,SAAQ;QAClC,IAAI,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,SAAS;YAAE,SAAQ;QAC/C,MAAM,MAAM,GAAG,YAAY,CAAC,GAAG,CAAC,CAAA;QAChC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;YAAE,SAAQ;QACjC,IAAI,EAAE,CAAA;QACN,KAAK,MAAM,CAAC,IAAI,MAAM,EAAE,CAAC;YACvB,QAAQ,IAAI,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAA;YAC7B,UAAU,IAAI,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC,CAAA;QACvE,CAAC;IACH,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAA;AACvC,CAAC"}
|
package/dist/md-mermaid.d.ts
CHANGED
|
@@ -26,8 +26,9 @@ export interface EmbeddedDiagramsMatchCodeOptions extends PresetReportOptions {
|
|
|
26
26
|
* whose kind is unrecognised is still parsed, so an unknown diagram costs a loud
|
|
27
27
|
* finding rather than silent coverage loss.
|
|
28
28
|
*
|
|
29
|
-
* **
|
|
30
|
-
*
|
|
29
|
+
* **An empty selection.** A corpus with no class diagrams returns no
|
|
30
|
+
* violations from the comparison; the kernel's evidence check still reports a
|
|
31
|
+
* pass over nothing examined. Gate on {@link embeddedDiagramStats} if a
|
|
31
32
|
* non-empty run is what you mean to assert.
|
|
32
33
|
*/
|
|
33
34
|
export declare function embeddedDiagramsMatchCode(corpus: Corpus, project: ArchProject, options?: EmbeddedDiagramsMatchCodeOptions): CollectResult;
|
package/dist/md-mermaid.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"md-mermaid.d.ts","sourceRoot":"","sources":["../src/md-mermaid.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,SAAS,EACd,KAAK,mBAAmB,EAExB,KAAK,aAAa,EACnB,MAAM,kBAAkB,CAAA;AAEzB,OAAO,KAAK,EAAE,MAAM,EAAc,MAAM,qBAAqB,CAAA;AAE7D,OAAO,EAAwB,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"md-mermaid.d.ts","sourceRoot":"","sources":["../src/md-mermaid.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,SAAS,EACd,KAAK,mBAAmB,EAExB,KAAK,aAAa,EACnB,MAAM,kBAAkB,CAAA;AAEzB,OAAO,KAAK,EAAE,MAAM,EAAc,MAAM,qBAAqB,CAAA;AAE7D,OAAO,EAAwB,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAK5E,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAG9D,YAAY,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AAuBrF,MAAM,WAAW,gCAAiC,SAAQ,mBAAmB;IAC3E,2FAA2F;IAC3F,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;IACvB;;;;OAIG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,CAAA;CAClC;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,WAAW,EACpB,OAAO,GAAE,gCAAqC,GAC7C,aAAa,CAgEf;AA2BD,uEAAuE;AACvE,MAAM,WAAW,oBAAoB;IACnC,iEAAiE;IACjE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB;;;;OAIG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CACzB;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,oBAAoB,CAazE"}
|
package/dist/md-mermaid.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { finishPreset, collectResult, } from '@nielspeter/eess';
|
|
2
2
|
import { correspondence } from '@nielspeter/eess';
|
|
3
|
-
import { diagram, classes as mmdClasses } from '@nielspeter/eess-mermaid';
|
|
3
|
+
import { diagram, classes as mmdClasses, diagramKind } from '@nielspeter/eess-mermaid';
|
|
4
4
|
import { classes as tsClasses } from '@nielspeter/eess-ts';
|
|
5
|
-
import { identifyTsClass } from './shared.js';
|
|
5
|
+
import { identifyTsClass, GRAMMAR_GAP, grammarGapRemedy, asClause } from './shared.js';
|
|
6
|
+
import { isMermaidTag } from './mermaid-tag.js';
|
|
6
7
|
// Kernel re-exports (plan 0089 — standalone sufficiency): see mermaid-ts.ts.
|
|
7
8
|
export { finishPreset, collectResult } from '@nielspeter/eess';
|
|
8
9
|
export { correspondence } from '@nielspeter/eess';
|
|
@@ -24,41 +25,6 @@ export { correspondence } from '@nielspeter/eess';
|
|
|
24
25
|
// blaming the author's syntax for a grammar gap is the wrong attribution.
|
|
25
26
|
const KNOWN_UNMODELLED = /^(?:classDiagram-v2)\b/;
|
|
26
27
|
const FOREIGN_HEADER = /^(?:sequenceDiagram|flowchart|graph|stateDiagram(?:-v2)?|erDiagram|gantt|journey|pie|gitGraph|mindmap|timeline|quadrantChart|requirementDiagram|sankey(?:-beta)?|xychart(?:-beta)?|block(?:-beta)?|packet(?:-beta)?|kanban|architecture(?:-beta)?|radar(?:-beta)?|treemap(?:-beta)?|zenuml|info|C4(?:Context|Container|Component|Dynamic|Deployment))\b/;
|
|
27
|
-
// Mermaid's grammar treats `%%…` lines as hidden terminals and permits a
|
|
28
|
-
// `---` frontmatter block, so the diagram keyword is not necessarily the first
|
|
29
|
-
// thing in the fence. Find the first line that actually declares the kind.
|
|
30
|
-
function declaredKind(body) {
|
|
31
|
-
const lines = body.split(/\r?\n/);
|
|
32
|
-
let i = 0;
|
|
33
|
-
if (lines[0]?.trim() === '---') {
|
|
34
|
-
i = 1;
|
|
35
|
-
while (i < lines.length && lines[i]?.trim() !== '---')
|
|
36
|
-
i += 1;
|
|
37
|
-
i += 1;
|
|
38
|
-
}
|
|
39
|
-
let inDirective = false;
|
|
40
|
-
for (; i < lines.length; i += 1) {
|
|
41
|
-
const line = lines[i]?.trim() ?? '';
|
|
42
|
-
if (line === '')
|
|
43
|
-
continue;
|
|
44
|
-
// `%%{ … }%%` may span lines. Track it, or the continuation line gets read
|
|
45
|
-
// as the declared kind — measured: a multi-line init block ahead of a
|
|
46
|
-
// sequenceDiagram made it selected, and `skipped` reported 0 (review).
|
|
47
|
-
if (inDirective) {
|
|
48
|
-
if (line.endsWith('}%%'))
|
|
49
|
-
inDirective = false;
|
|
50
|
-
continue;
|
|
51
|
-
}
|
|
52
|
-
if (line.startsWith('%%{') && !line.endsWith('}%%')) {
|
|
53
|
-
inDirective = true;
|
|
54
|
-
continue;
|
|
55
|
-
}
|
|
56
|
-
if (line.startsWith('%%'))
|
|
57
|
-
continue;
|
|
58
|
-
return line;
|
|
59
|
-
}
|
|
60
|
-
return '';
|
|
61
|
-
}
|
|
62
28
|
/**
|
|
63
29
|
* Cross-validate Mermaid **class diagrams** embedded as fenced ```mermaid blocks
|
|
64
30
|
* in the markdown corpus against TypeScript code, with violations pointing at the
|
|
@@ -70,8 +36,9 @@ function declaredKind(body) {
|
|
|
70
36
|
* whose kind is unrecognised is still parsed, so an unknown diagram costs a loud
|
|
71
37
|
* finding rather than silent coverage loss.
|
|
72
38
|
*
|
|
73
|
-
* **
|
|
74
|
-
*
|
|
39
|
+
* **An empty selection.** A corpus with no class diagrams returns no
|
|
40
|
+
* violations from the comparison; the kernel's evidence check still reports a
|
|
41
|
+
* pass over nothing examined. Gate on {@link embeddedDiagramStats} if a
|
|
75
42
|
* non-empty run is what you mean to assert.
|
|
76
43
|
*/
|
|
77
44
|
export function embeddedDiagramsMatchCode(corpus, project, options = {}) {
|
|
@@ -102,17 +69,21 @@ export function embeddedDiagramsMatchCode(corpus, project, options = {}) {
|
|
|
102
69
|
element: doc.relPath,
|
|
103
70
|
file: doc.file,
|
|
104
71
|
line: block.line,
|
|
105
|
-
message: `embedded ${kindOf(block.value)} does not parse
|
|
72
|
+
message: `embedded ${kindOf(block.value)} does not parse with eess-mermaid's class-diagram grammar: ${asClause(detailOf(e))}. ` +
|
|
106
73
|
(KNOWN_UNMODELLED.test(kindOf(block.value))
|
|
107
|
-
? '
|
|
108
|
-
:
|
|
74
|
+
? 'This is legal Mermaid that eess-mermaid does not model yet, not a syntax error in your document.'
|
|
75
|
+
: GRAMMAR_GAP),
|
|
109
76
|
because: 'A diagram that cannot be parsed cannot be compared against code, so it silently stops constraining it.',
|
|
110
77
|
// Deliberately offers ONE remedy. The earlier text ended "or remove the
|
|
111
78
|
// fence if it is not a class diagram" — review measured that an agent
|
|
112
79
|
// taking that branch turns red into green over a document whose drift
|
|
113
80
|
// is still there. A remedy that remediates by deleting the evidence is
|
|
114
81
|
// not a remedy (ADR-009 rule 2).
|
|
115
|
-
|
|
82
|
+
// Bug 0409: one remedy that is right whichever the cause is, and removes no valid content.
|
|
83
|
+
// `classDiagram-v2` is a known gap with a concrete fix that keeps the diagram checked.
|
|
84
|
+
suggestion: KNOWN_UNMODELLED.test(kindOf(block.value))
|
|
85
|
+
? 'Change the header to `classDiagram`: it is the same language, and eess-mermaid reads it.'
|
|
86
|
+
: grammarGapRemedy('ignore it in the corpus you pass to embeddedDiagramsMatchCode'),
|
|
116
87
|
});
|
|
117
88
|
continue;
|
|
118
89
|
}
|
|
@@ -130,9 +101,9 @@ export function embeddedDiagramsMatchCode(corpus, project, options = {}) {
|
|
|
130
101
|
}
|
|
131
102
|
return finishPreset(collectResult(violations, { examined }), options);
|
|
132
103
|
}
|
|
133
|
-
/** The declared kind of a fence, for phrasing a finding. */
|
|
104
|
+
/** The declared kind of a fence, for phrasing a finding: "diagram" when it declares none. */
|
|
134
105
|
function kindOf(body) {
|
|
135
|
-
const kind =
|
|
106
|
+
const kind = diagramKind(body);
|
|
136
107
|
return kind === '' ? 'diagram' : kind;
|
|
137
108
|
}
|
|
138
109
|
/**
|
|
@@ -149,7 +120,7 @@ function detailOf(e) {
|
|
|
149
120
|
}
|
|
150
121
|
/** The class-diagram fences of one document — the blocks this binding models. */
|
|
151
122
|
function classDiagramBlocks(doc) {
|
|
152
|
-
return doc.codeBlocks.filter((b) => b.lang
|
|
123
|
+
return doc.codeBlocks.filter((b) => isMermaidTag(b.lang) && !FOREIGN_HEADER.test(diagramKind(b.value)));
|
|
153
124
|
}
|
|
154
125
|
/**
|
|
155
126
|
* Count what {@link embeddedDiagramsMatchCode} would compare, so a caller can
|
|
@@ -162,7 +133,7 @@ export function embeddedDiagramStats(corpus) {
|
|
|
162
133
|
let diagrams = 0;
|
|
163
134
|
let skipped = 0;
|
|
164
135
|
for (const doc of corpus.documents()) {
|
|
165
|
-
const mermaid = doc.codeBlocks.filter((b) => b.lang
|
|
136
|
+
const mermaid = doc.codeBlocks.filter((b) => isMermaidTag(b.lang));
|
|
166
137
|
const blocks = classDiagramBlocks(doc);
|
|
167
138
|
skipped += mermaid.length - blocks.length;
|
|
168
139
|
if (blocks.length === 0)
|
package/dist/md-mermaid.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"md-mermaid.js","sourceRoot":"","sources":["../src/md-mermaid.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAIZ,aAAa,GAEd,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEjD,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,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
|
|
24
24
|
* Cross-validate that every `it('…')` cited in an ADR's enforcement table
|
|
25
|
-
* actually exists as a test in the project.
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
25
|
+
* actually exists as a test in the project. It resolves titles against real test
|
|
26
|
+
* call expressions (via eess-ts's public API; no ts-morph here, per ADR-007). Since
|
|
27
|
+
* bug 0111 it is the only title check in the family: `eess-md`'s `adrEnforcement`
|
|
28
|
+
* checks cited paths and leaves titles here, because its text-level reading matched
|
|
29
|
+
* a title as a prefix and could not tell a commented-out test from a live one.
|
|
30
30
|
*/
|
|
31
31
|
export declare function adrCitationsResolve(corpus: Corpus, project: ArchProject, options?: AdrCitationsResolveOptions): void;
|
|
32
32
|
//# sourceMappingURL=md-ts.d.ts.map
|
package/dist/md-ts.js
CHANGED
|
@@ -86,11 +86,11 @@ function extractTestDefs(project) {
|
|
|
86
86
|
}
|
|
87
87
|
/**
|
|
88
88
|
* Cross-validate that every `it('…')` cited in an ADR's enforcement table
|
|
89
|
-
* actually exists as a test in the project.
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
89
|
+
* actually exists as a test in the project. It resolves titles against real test
|
|
90
|
+
* call expressions (via eess-ts's public API; no ts-morph here, per ADR-007). Since
|
|
91
|
+
* bug 0111 it is the only title check in the family: `eess-md`'s `adrEnforcement`
|
|
92
|
+
* checks cited paths and leaves titles here, because its text-level reading matched
|
|
93
|
+
* a title as a prefix and could not tell a commented-out test from a live one.
|
|
94
94
|
*/
|
|
95
95
|
export function adrCitationsResolve(corpus, project, options = {}) {
|
|
96
96
|
const dir = options.dir ?? 'docs/adr/**';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Is this fence tagged as Mermaid? In any letter case (bug 0423): a fence tagged `Mermaid` is plainly
|
|
3
|
+
* meant as a diagram, and comparing the tag exactly skipped it without a word. eess-md owns the
|
|
4
|
+
* comparison, for the whole family (ADR-019).
|
|
5
|
+
*
|
|
6
|
+
* A module of its own, not `shared.ts`: only the two bindings that read Markdown load it, so
|
|
7
|
+
* `./mermaid-ts` and `./gherkin-ts` still load without eess-md, an optional peer, installed.
|
|
8
|
+
*/
|
|
9
|
+
export declare function isMermaidTag(lang: string | null): boolean;
|
|
10
|
+
//# sourceMappingURL=mermaid-tag.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mermaid-tag.d.ts","sourceRoot":"","sources":["../src/mermaid-tag.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAEzD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { tagIsLanguage } from '@nielspeter/eess-md/internal';
|
|
2
|
+
/**
|
|
3
|
+
* Is this fence tagged as Mermaid? In any letter case (bug 0423): a fence tagged `Mermaid` is plainly
|
|
4
|
+
* meant as a diagram, and comparing the tag exactly skipped it without a word. eess-md owns the
|
|
5
|
+
* comparison, for the whole family (ADR-019).
|
|
6
|
+
*
|
|
7
|
+
* A module of its own, not `shared.ts`: only the two bindings that read Markdown load it, so
|
|
8
|
+
* `./mermaid-ts` and `./gherkin-ts` still load without eess-md, an optional peer, installed.
|
|
9
|
+
*/
|
|
10
|
+
export function isMermaidTag(lang) {
|
|
11
|
+
return tagIsLanguage(lang, 'mermaid');
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=mermaid-tag.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mermaid-tag.js","sourceRoot":"","sources":["../src/mermaid-tag.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA;AAE5D;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAAC,IAAmB;IAC9C,OAAO,aAAa,CAAC,IAAI,EAAE,SAAS,CAAC,CAAA;AACvC,CAAC"}
|
package/dist/shared.d.ts
CHANGED
|
@@ -58,4 +58,16 @@ export declare function violationsFor<Site>(rule: string, ruleId: string, locate
|
|
|
58
58
|
file: string;
|
|
59
59
|
line: number;
|
|
60
60
|
}): (site: Site, message: string, because: string) => ArchViolation;
|
|
61
|
+
export declare const GRAMMAR_GAP = "This is either a syntax error in the document or valid Mermaid that eess-mermaid does not model yet; eess cannot tell which without Mermaid's own parser.";
|
|
62
|
+
/**
|
|
63
|
+
* The remedy for a fence eess-mermaid's grammar cannot read, right whichever the cause is and removing
|
|
64
|
+
* no valid content (ADR-009 rule 2). `exclude` names the binding's own way to leave a document out.
|
|
65
|
+
*
|
|
66
|
+
* It does not say "waive it": an `eess-exclude` comment does not silence these findings (bug 0422).
|
|
67
|
+
* It does not tell the author to leave out the document the fence sits in: that also stops checking
|
|
68
|
+
* every other diagram in it (PR #213's review measured the false green). It says to isolate the fence.
|
|
69
|
+
*/
|
|
70
|
+
export declare function grammarGapRemedy(exclude: string): string;
|
|
71
|
+
/** A parser's detail as the end of a sentence: trailing `.`, `:` and spaces trimmed, so a join reads. */
|
|
72
|
+
export declare function asClause(detail: string): string;
|
|
61
73
|
//# sourceMappingURL=shared.d.ts.map
|
package/dist/shared.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../src/shared.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAChD,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAClE,OAAO,EAAmB,KAAK,eAAe,EAAE,MAAM,2BAA2B,CAAA;AACjF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAM1D,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,CAAA;AAE1C;;;;;;;;GAQG;AAEH;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE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MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACtE,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,aAAa,CAEjE;AAKD,eAAO,MAAM,WAAW,8JACqI,CAAA;AAC7J;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAUxD;AAED,yGAAyG;AACzG,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE/C"}
|
package/dist/shared.js
CHANGED
|
@@ -60,4 +60,29 @@ export function featurePaths(set) {
|
|
|
60
60
|
export function violationsFor(rule, ruleId, locate) {
|
|
61
61
|
return (site, message, because) => ({ rule, ruleId, ...locate(site), message, because });
|
|
62
62
|
}
|
|
63
|
+
// Bug 0409: eess-mermaid's grammars cover part of Mermaid. A fence they reject is a syntax error or
|
|
64
|
+
// valid Mermaid they do not model, and without Mermaid's own parser eess cannot tell which, so the
|
|
65
|
+
// finding says so instead of asserting the first. Shared with the ER binding.
|
|
66
|
+
export const GRAMMAR_GAP = "This is either a syntax error in the document or valid Mermaid that eess-mermaid does not model yet; eess cannot tell which without Mermaid's own parser.";
|
|
67
|
+
/**
|
|
68
|
+
* The remedy for a fence eess-mermaid's grammar cannot read, right whichever the cause is and removing
|
|
69
|
+
* no valid content (ADR-009 rule 2). `exclude` names the binding's own way to leave a document out.
|
|
70
|
+
*
|
|
71
|
+
* It does not say "waive it": an `eess-exclude` comment does not silence these findings (bug 0422).
|
|
72
|
+
* It does not tell the author to leave out the document the fence sits in: that also stops checking
|
|
73
|
+
* every other diagram in it (PR #213's review measured the false green). It says to isolate the fence.
|
|
74
|
+
*/
|
|
75
|
+
export function grammarGapRemedy(exclude) {
|
|
76
|
+
return ('Check this fence in the Mermaid Live Editor (https://mermaid.live); in Node, mermaid.parse ' +
|
|
77
|
+
'needs a DOM such as jsdom and fails without one. If Mermaid reports a parse error, fix the ' +
|
|
78
|
+
'syntax. If Mermaid accepts it, keep the fence and report the construct at ' +
|
|
79
|
+
'https://github.com/nielspeter/eess/issues; this finding stays until eess-mermaid models it, and ' +
|
|
80
|
+
'no eess-exclude comment silences it yet. To be green meanwhile, move only this fence into a ' +
|
|
81
|
+
`document of its own and leave that document out (${exclude}), so the document's other ` +
|
|
82
|
+
'diagrams are still checked; put it back once the construct is modelled.');
|
|
83
|
+
}
|
|
84
|
+
/** A parser's detail as the end of a sentence: trailing `.`, `:` and spaces trimmed, so a join reads. */
|
|
85
|
+
export function asClause(detail) {
|
|
86
|
+
return detail.replace(/[\s.:]+$/, '');
|
|
87
|
+
}
|
|
63
88
|
//# sourceMappingURL=shared.js.map
|
package/dist/shared.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../src/shared.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAwB,MAAM,2BAA2B,CAAA;AASjF;;;;;;;;GAQG;AAEH;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAAC,CAAmB;IACjD,OAAO;QACL,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE,IAAI,aAAa;QAClC,IAAI,EAAE,CAAC,CAAC,aAAa,EAAE,CAAC,WAAW,EAAE;QACrC,IAAI,EAAE,CAAC,CAAC,kBAAkB,EAAE;KAC7B,CAAA;AACH,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,YAAY,CAAC,GAAe;IAC1C,OAAO,eAAe,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAA;AAC9D,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,aAAa,CAC3B,IAAY,EACZ,MAAc,EACd,MAAuE;IAEvE,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAA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E,kGAAkG;QAClG,8FAA8F;QAC9F,oDAAoD,OAAO,6BAA6B;QACxF,yEAAyE,CAC1E,CAAA;AACH,CAAC;AAED,yGAAyG;AACzG,MAAM,UAAU,QAAQ,CAAC,MAAc;IACrC,OAAO,MAAM,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAA;AACvC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nielspeter/eess-crossvalidate",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Cross-validation presets for the eess family — bind two dialects' artifacts and fail when they drift.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -63,14 +63,14 @@
|
|
|
63
63
|
"markdown"
|
|
64
64
|
],
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@nielspeter/eess": "^0.
|
|
66
|
+
"@nielspeter/eess": "^0.7.1",
|
|
67
67
|
"picomatch": "^4.0.4"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
|
-
"@nielspeter/eess-ts": ">=0.
|
|
71
|
-
"@nielspeter/eess-mermaid": ">=0.
|
|
72
|
-
"@nielspeter/eess-md": ">=0.
|
|
73
|
-
"@nielspeter/eess-gherkin": ">=0.
|
|
70
|
+
"@nielspeter/eess-ts": ">=0.13.1",
|
|
71
|
+
"@nielspeter/eess-mermaid": ">=0.8.0",
|
|
72
|
+
"@nielspeter/eess-md": ">=0.11.0",
|
|
73
|
+
"@nielspeter/eess-gherkin": ">=0.6.0"
|
|
74
74
|
},
|
|
75
75
|
"peerDependenciesMeta": {
|
|
76
76
|
"@nielspeter/eess-ts": {
|