@driftsys/markspec 0.11.0 → 0.12.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 +9 -0
- package/esm/ast/normalize.d.ts +4 -5
- package/esm/ast/normalize.d.ts.map +1 -1
- package/esm/ast/normalize.js +6 -37
- package/esm/collect/mod.d.ts +29 -9
- package/esm/collect/mod.d.ts.map +1 -1
- package/esm/collect/mod.js +36 -10
- package/esm/compiler/mod.d.ts.map +1 -1
- package/esm/compiler/mod.js +2 -6
- package/esm/config/markspec.d.ts +4 -2
- package/esm/config/markspec.d.ts.map +1 -1
- package/esm/discovery/mod.d.ts +24 -8
- package/esm/discovery/mod.d.ts.map +1 -1
- package/esm/discovery/mod.js +57 -21
- package/esm/discovery/projects.d.ts +109 -0
- package/esm/discovery/projects.d.ts.map +1 -0
- package/esm/discovery/projects.js +232 -0
- package/esm/formatter/entry_body.d.ts +86 -0
- package/esm/formatter/entry_body.d.ts.map +1 -0
- package/esm/formatter/entry_body.js +287 -0
- package/esm/formatter/mod.d.ts +13 -9
- package/esm/formatter/mod.d.ts.map +1 -1
- package/esm/formatter/mod.js +126 -50
- package/esm/gates/mod.d.ts.map +1 -1
- package/esm/gates/mod.js +5 -4
- package/esm/lint/runner.d.ts.map +1 -1
- package/esm/lint/runner.js +4 -4
- package/esm/lock/check.d.ts.map +1 -1
- package/esm/lock/check.js +2 -1
- package/esm/lock/edge_drift.d.ts +2 -0
- package/esm/lock/edge_drift.d.ts.map +1 -1
- package/esm/lock/edge_drift.js +4 -0
- package/esm/lock/mod.d.ts +1 -1
- package/esm/lock/mod.d.ts.map +1 -1
- package/esm/lock/mod.js +1 -1
- package/esm/mod.d.ts +10 -6
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +8 -6
- package/esm/model/mod.d.ts +21 -0
- package/esm/model/mod.d.ts.map +1 -1
- package/esm/model/mod.js +10 -0
- package/esm/parser/code_regions.d.ts +29 -0
- package/esm/parser/code_regions.d.ts.map +1 -0
- package/esm/parser/code_regions.js +38 -0
- package/esm/parser/markdown.d.ts.map +1 -1
- package/esm/parser/markdown.js +103 -40
- package/esm/parser/mod.d.ts.map +1 -1
- package/esm/parser/mod.js +7 -1
- package/esm/parser/translate.d.ts.map +1 -1
- package/esm/parser/translate.js +5 -0
- package/esm/refs/mod.d.ts.map +1 -1
- package/esm/refs/mod.js +8 -19
- package/esm/reporter/mod.d.ts.map +1 -1
- package/esm/reporter/mod.js +2 -2
- package/esm/util/fence.d.ts +20 -29
- package/esm/util/fence.d.ts.map +1 -1
- package/esm/util/fence.js +42 -50
- package/esm/util/modals.d.ts +6 -0
- package/esm/util/modals.d.ts.map +1 -1
- package/esm/util/modals.js +37 -0
- package/esm/validator/body_blocks.d.ts +2 -1
- package/esm/validator/body_blocks.d.ts.map +1 -1
- package/esm/validator/body_blocks.js +80 -2
- package/esm/validator/corpus.d.ts +6 -0
- package/esm/validator/corpus.d.ts.map +1 -1
- package/esm/validator/corpus.js +16 -4
- package/esm/validator/mod.d.ts +1 -1
- package/esm/validator/mod.d.ts.map +1 -1
- package/esm/validator/mod.js +1 -1
- package/esm/validator/pipeline.d.ts.map +1 -1
- package/esm/validator/pipeline.js +11 -8
- package/package.json +1 -1
- package/script/ast/normalize.d.ts +4 -5
- package/script/ast/normalize.d.ts.map +1 -1
- package/script/ast/normalize.js +5 -36
- package/script/collect/mod.d.ts +29 -9
- package/script/collect/mod.d.ts.map +1 -1
- package/script/collect/mod.js +38 -10
- package/script/compiler/mod.d.ts.map +1 -1
- package/script/compiler/mod.js +1 -5
- package/script/config/markspec.d.ts +4 -2
- package/script/config/markspec.d.ts.map +1 -1
- package/script/discovery/mod.d.ts +24 -8
- package/script/discovery/mod.d.ts.map +1 -1
- package/script/discovery/mod.js +56 -20
- package/script/discovery/projects.d.ts +109 -0
- package/script/discovery/projects.d.ts.map +1 -0
- package/script/discovery/projects.js +240 -0
- package/script/formatter/entry_body.d.ts +86 -0
- package/script/formatter/entry_body.d.ts.map +1 -0
- package/script/formatter/entry_body.js +292 -0
- package/script/formatter/mod.d.ts +13 -9
- package/script/formatter/mod.d.ts.map +1 -1
- package/script/formatter/mod.js +124 -48
- package/script/gates/mod.d.ts.map +1 -1
- package/script/gates/mod.js +15 -14
- package/script/lint/runner.d.ts.map +1 -1
- package/script/lint/runner.js +3 -3
- package/script/lock/check.d.ts.map +1 -1
- package/script/lock/check.js +2 -1
- package/script/lock/edge_drift.d.ts +2 -0
- package/script/lock/edge_drift.d.ts.map +1 -1
- package/script/lock/edge_drift.js +5 -0
- package/script/lock/mod.d.ts +1 -1
- package/script/lock/mod.d.ts.map +1 -1
- package/script/lock/mod.js +2 -1
- package/script/mod.d.ts +10 -6
- package/script/mod.d.ts.map +1 -1
- package/script/mod.js +20 -5
- package/script/model/mod.d.ts +21 -0
- package/script/model/mod.d.ts.map +1 -1
- package/script/model/mod.js +11 -0
- package/script/parser/code_regions.d.ts +29 -0
- package/script/parser/code_regions.d.ts.map +1 -0
- package/script/parser/code_regions.js +41 -0
- package/script/parser/markdown.d.ts.map +1 -1
- package/script/parser/markdown.js +102 -39
- package/script/parser/mod.d.ts.map +1 -1
- package/script/parser/mod.js +7 -1
- package/script/parser/translate.d.ts.map +1 -1
- package/script/parser/translate.js +5 -0
- package/script/refs/mod.d.ts.map +1 -1
- package/script/refs/mod.js +7 -18
- package/script/reporter/mod.d.ts.map +1 -1
- package/script/reporter/mod.js +1 -1
- package/script/util/fence.d.ts +20 -29
- package/script/util/fence.d.ts.map +1 -1
- package/script/util/fence.js +47 -54
- package/script/util/modals.d.ts +6 -0
- package/script/util/modals.d.ts.map +1 -1
- package/script/util/modals.js +38 -0
- package/script/validator/body_blocks.d.ts +2 -1
- package/script/validator/body_blocks.d.ts.map +1 -1
- package/script/validator/body_blocks.js +80 -2
- package/script/validator/corpus.d.ts +6 -0
- package/script/validator/corpus.d.ts.map +1 -1
- package/script/validator/corpus.js +16 -3
- package/script/validator/mod.d.ts +1 -1
- package/script/validator/mod.d.ts.map +1 -1
- package/script/validator/mod.js +2 -1
- package/script/validator/pipeline.d.ts.map +1 -1
- package/script/validator/pipeline.js +11 -8
|
@@ -40,6 +40,11 @@ function translateEntryLocations(entries, lineMap) {
|
|
|
40
40
|
return {
|
|
41
41
|
...entry,
|
|
42
42
|
location: translatedEntryLoc,
|
|
43
|
+
...(entry.endLine !== undefined
|
|
44
|
+
? {
|
|
45
|
+
endLine: lineMap.translate(entry.endLine, 1)?.line ?? entry.endLine,
|
|
46
|
+
}
|
|
47
|
+
: {}),
|
|
43
48
|
bodyAst: entry.bodyAst
|
|
44
49
|
? entry.bodyAst.map((block) => translateBlock(block, lineMap, fallbackPoint, warn))
|
|
45
50
|
: entry.bodyAst,
|
package/script/refs/mod.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/refs/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAO7C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAG/C;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,EAAE,WAAW,CAAC,MAAM,CAGnD,CAAC;AAEH,iFAAiF;AACjF,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,eAAe,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtD,QAAQ,CAAC,eAAe,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACvD;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,SAAS,KAAK,EAAE,GAAG,QAAQ,CAajE;AAcD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,SAAS,KAAK,EAAE,EACzB,KAAK,EAAE,QAAQ,EACf,MAAM,EAAE,SAAS,QAAQ,EAAE,GAC1B;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/refs/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAO7C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAG/C;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,EAAE,WAAW,CAAC,MAAM,CAGnD,CAAC;AAEH,iFAAiF;AACjF,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,eAAe,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtD,QAAQ,CAAC,eAAe,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACvD;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,SAAS,KAAK,EAAE,GAAG,QAAQ,CAajE;AAcD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,SAAS,KAAK,EAAE,EACzB,KAAK,EAAE,QAAQ,EACf,MAAM,EAAE,SAAS,QAAQ,EAAE,GAC1B;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAqGtC"}
|
package/script/refs/mod.js
CHANGED
|
@@ -90,25 +90,17 @@ function canonicalizeRefs(content, entries, index, ledger) {
|
|
|
90
90
|
};
|
|
91
91
|
const lines = content.split("\n");
|
|
92
92
|
let changed = false;
|
|
93
|
-
//
|
|
94
|
-
//
|
|
95
|
-
|
|
96
|
-
// every other fmt pass honors (§5.1; cf. `collapseBlankLines`). Without
|
|
97
|
-
// this, `markspec fmt` rewrites example IDs in spec/ADR docs on every run
|
|
98
|
-
// (#668). The parser/validator already treat fenced content as inert.
|
|
99
|
-
let inFence = false;
|
|
93
|
+
// Share CommonMark fence boundaries with other prose passes. Compute them
|
|
94
|
+
// once so both the main loop and continuation loop remain linear (#705).
|
|
95
|
+
const fencedLines = (0, fence_js_1.fencedCodeLines)(content);
|
|
100
96
|
for (let i = 0; i < lines.length; i++) {
|
|
97
|
+
if (fencedLines.has(i))
|
|
98
|
+
continue;
|
|
101
99
|
// Strip a trailing CR before matching so CRLF files are handled (the
|
|
102
100
|
// trailer regex ends in `$`, which `\r` would block) and re-append it on
|
|
103
101
|
// rewrite so line endings stay byte-for-byte lossless.
|
|
104
102
|
const cr = lines[i].endsWith("\r");
|
|
105
103
|
const bare = cr ? lines[i].slice(0, -1) : lines[i];
|
|
106
|
-
if (fence_js_1.FENCE_RE.test(bare)) {
|
|
107
|
-
inFence = !inFence;
|
|
108
|
-
continue;
|
|
109
|
-
}
|
|
110
|
-
if (inFence)
|
|
111
|
-
continue;
|
|
112
104
|
const m = TRACE_TRAILER_RE.exec(bare);
|
|
113
105
|
if (!m)
|
|
114
106
|
continue;
|
|
@@ -135,11 +127,8 @@ function canonicalizeRefs(content, entries, index, ledger) {
|
|
|
135
127
|
j++;
|
|
136
128
|
const crj = lines[j].endsWith("\r");
|
|
137
129
|
const barej = crj ? lines[j].slice(0, -1) : lines[j];
|
|
138
|
-
//
|
|
139
|
-
|
|
140
|
-
// swallowed here without toggling `inFence`, desyncing fence tracking
|
|
141
|
-
// for the rest of the file. Back out and let the outer loop toggle it.
|
|
142
|
-
if (fence_js_1.FENCE_RE.test(barej)) {
|
|
130
|
+
// Fence delimiters and fenced content cannot continue a trace value.
|
|
131
|
+
if (fencedLines.has(j)) {
|
|
143
132
|
j--;
|
|
144
133
|
break;
|
|
145
134
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/reporter/mod.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/reporter/mod.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAQxD,8BAA8B;AAC9B,MAAM,MAAM,UAAU,GAAG,cAAc,GAAG,UAAU,CAAC;AAErD,gCAAgC;AAChC,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,MAAM,GAAG,KAAK,CAAC;AAEjD,sCAAsC;AACtC,MAAM,WAAW,aAAa;IAC5B,mBAAmB;IACnB,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,qBAAqB;IACrB,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,2DAA2D;IAC3D,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,qCAAqC;IACrC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB;;;;;;;;;OASG;IACH,QAAQ,CAAC,qBAAqB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CACtD;AAED;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,aAAa,GAAG,MAAM,CAY5E"}
|
package/script/reporter/mod.js
CHANGED
|
@@ -53,7 +53,7 @@ function filterEntries(result, scope, label) {
|
|
|
53
53
|
* Markdown, and JSON rows all agree on the same value.
|
|
54
54
|
*/
|
|
55
55
|
function originCell(entry) {
|
|
56
|
-
return entry
|
|
56
|
+
return (0, mod_js_1.isCorpusEntry)(entry) ? (0, mod_js_1.formatEntryOrigin)(entry.origin) : "project";
|
|
57
57
|
}
|
|
58
58
|
function buildTraceRows(result, entries) {
|
|
59
59
|
return entries.map((entry) => {
|
package/script/util/fence.d.ts
CHANGED
|
@@ -1,38 +1,29 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* Prose-line walker that skips lines inside fenced code blocks.
|
|
5
|
-
* Several validator and formatter passes (body-block exclusions,
|
|
6
|
-
* caption adjacency, `$Identifier` extraction, modal-keyword
|
|
7
|
-
* normalisation) all needed to walk an entry body line-by-line while
|
|
8
|
-
* treating fenced code as verbatim. This helper centralises that
|
|
9
|
-
* pattern so the fence-toggle semantics stay consistent.
|
|
10
|
-
*
|
|
11
|
-
* Fence detection follows CommonMark §4.5 — a line whose first
|
|
12
|
-
* non-whitespace content is three or more backticks or tildes opens
|
|
13
|
-
* (or closes) a fenced block. The language tag that may follow the
|
|
14
|
-
* opening fence does not affect detection: we toggle on every fence
|
|
15
|
-
* marker regardless. (Mismatched marker types — ``` opener / ~~~
|
|
16
|
-
* closer — are accepted by the walker because real Markdown parsers
|
|
17
|
-
* already reject those upstream.)
|
|
2
|
+
* Legacy fence-prefix candidate used by the LSP source-file scanner.
|
|
3
|
+
* Markdown fence membership uses the AST-backed helpers below.
|
|
18
4
|
*/
|
|
19
|
-
/** Three or more backticks or tildes at the start of a line. */
|
|
20
5
|
export declare const FENCE_RE: RegExp;
|
|
21
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* Compute zero-based fenced-code lines, including opening and closing lines.
|
|
8
|
+
* Cache the sets for the 64 most recently queried exact document texts. Each
|
|
9
|
+
* call returns a new copy, so a caller that changes it cannot alter the cache.
|
|
10
|
+
* Callers making multiple membership queries should compute this set once and
|
|
11
|
+
* pass it to {@linkcode isLineFenced} or {@linkcode walkProseLines}.
|
|
12
|
+
*/
|
|
13
|
+
export declare function fencedCodeLines(body: string): ReadonlySet<number>;
|
|
14
|
+
/**
|
|
15
|
+
* Callback for {@linkcode walkProseLines}. Receives a line and its 0-based index.
|
|
16
|
+
* The LF delimiter is excluded; a CR from a CRLF delimiter is preserved.
|
|
17
|
+
*/
|
|
22
18
|
export type ProseLineCallback = (line: string, index: number) => void;
|
|
23
19
|
/**
|
|
24
|
-
* Walk
|
|
25
|
-
*
|
|
26
|
-
* the next closes it. The fence-marker lines themselves are also
|
|
27
|
-
* skipped (they're structural, not prose).
|
|
20
|
+
* Walk lines outside fenced code, using the cached CommonMark line set unless
|
|
21
|
+
* a precomputed set for this exact text is supplied. Indented code is yielded.
|
|
28
22
|
*/
|
|
29
|
-
export declare function walkProseLines(body: string, cb: ProseLineCallback): void;
|
|
23
|
+
export declare function walkProseLines(body: string, cb: ProseLineCallback, fencedLines?: ReadonlySet<number>): void;
|
|
30
24
|
/**
|
|
31
|
-
* Return whether
|
|
32
|
-
*
|
|
33
|
-
* fenced block. Single-line-membership counterpart to `walkProseLines`'s
|
|
34
|
-
* full-body callback walk, for callers that only need a yes/no answer for
|
|
35
|
-
* one position (e.g. an LSP request gating a cursor position, #680).
|
|
25
|
+
* Return whether a zero-based document line belongs to the fenced-line set.
|
|
26
|
+
* Supply the set for this exact text when querying multiple positions.
|
|
36
27
|
*/
|
|
37
|
-
export declare function isLineFenced(body: string, lineIndex: number): boolean;
|
|
28
|
+
export declare function isLineFenced(body: string, lineIndex: number, fencedLines?: ReadonlySet<number>): boolean;
|
|
38
29
|
//# sourceMappingURL=fence.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fence.d.ts","sourceRoot":"","sources":["../../src/util/fence.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fence.d.ts","sourceRoot":"","sources":["../../src/util/fence.ts"],"names":[],"mappings":"AAUA;;;GAGG;AACH,eAAO,MAAM,QAAQ,QAAkB,CAAC;AAKxC;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,CAajE;AAED;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;AAEtE;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,iBAAiB,EACrB,WAAW,GAAE,WAAW,CAAC,MAAM,CAAyB,GACvD,IAAI,CAIN;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,WAAW,GAAE,WAAW,CAAC,MAAM,CAAyB,GACvD,OAAO,CAET"}
|
package/script/util/fence.js
CHANGED
|
@@ -1,67 +1,60 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @module core/util/fence
|
|
4
|
-
*
|
|
5
|
-
* Prose-line walker that skips lines inside fenced code blocks.
|
|
6
|
-
* Several validator and formatter passes (body-block exclusions,
|
|
7
|
-
* caption adjacency, `$Identifier` extraction, modal-keyword
|
|
8
|
-
* normalisation) all needed to walk an entry body line-by-line while
|
|
9
|
-
* treating fenced code as verbatim. This helper centralises that
|
|
10
|
-
* pattern so the fence-toggle semantics stay consistent.
|
|
11
|
-
*
|
|
12
|
-
* Fence detection follows CommonMark §4.5 — a line whose first
|
|
13
|
-
* non-whitespace content is three or more backticks or tildes opens
|
|
14
|
-
* (or closes) a fenced block. The language tag that may follow the
|
|
15
|
-
* opening fence does not affect detection: we toggle on every fence
|
|
16
|
-
* marker regardless. (Mismatched marker types — ``` opener / ~~~
|
|
17
|
-
* closer — are accepted by the walker because real Markdown parsers
|
|
18
|
-
* already reject those upstream.)
|
|
19
|
-
*/
|
|
20
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
3
|
exports.FENCE_RE = void 0;
|
|
4
|
+
exports.fencedCodeLines = fencedCodeLines;
|
|
22
5
|
exports.walkProseLines = walkProseLines;
|
|
23
6
|
exports.isLineFenced = isLineFenced;
|
|
24
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* @module core/util/fence
|
|
9
|
+
*
|
|
10
|
+
* Prose-line helpers using fenced-code boundaries from the CommonMark AST.
|
|
11
|
+
* Containers, matching delimiters and implicit container endings are handled
|
|
12
|
+
* by remark. Indented code is not fenced code: MarkSpec trailers must remain
|
|
13
|
+
* available to reference and validation passes.
|
|
14
|
+
*/
|
|
15
|
+
const code_regions_js_1 = require("../parser/code_regions.js");
|
|
16
|
+
/**
|
|
17
|
+
* Legacy fence-prefix candidate used by the LSP source-file scanner.
|
|
18
|
+
* Markdown fence membership uses the AST-backed helpers below.
|
|
19
|
+
*/
|
|
25
20
|
exports.FENCE_RE = /^\s*(```|~~~)/;
|
|
21
|
+
const FENCE_CACHE_CAPACITY = 64;
|
|
22
|
+
const fencedLineCache = new Map();
|
|
26
23
|
/**
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
24
|
+
* Compute zero-based fenced-code lines, including opening and closing lines.
|
|
25
|
+
* Cache the sets for the 64 most recently queried exact document texts. Each
|
|
26
|
+
* call returns a new copy, so a caller that changes it cannot alter the cache.
|
|
27
|
+
* Callers making multiple membership queries should compute this set once and
|
|
28
|
+
* pass it to {@linkcode isLineFenced} or {@linkcode walkProseLines}.
|
|
31
29
|
*/
|
|
32
|
-
function
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
cb(line, i);
|
|
30
|
+
function fencedCodeLines(body) {
|
|
31
|
+
const cached = fencedLineCache.get(body);
|
|
32
|
+
if (cached !== undefined) {
|
|
33
|
+
fencedLineCache.delete(body);
|
|
34
|
+
fencedLineCache.set(body, cached);
|
|
35
|
+
return new Set(cached);
|
|
36
|
+
}
|
|
37
|
+
const lines = (0, code_regions_js_1.parseCodeRegions)(body).fencedLines;
|
|
38
|
+
fencedLineCache.set(body, lines);
|
|
39
|
+
if (fencedLineCache.size > FENCE_CACHE_CAPACITY) {
|
|
40
|
+
fencedLineCache.delete(fencedLineCache.keys().next().value);
|
|
44
41
|
}
|
|
42
|
+
return new Set(lines);
|
|
45
43
|
}
|
|
46
44
|
/**
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
* fenced block. Single-line-membership counterpart to `walkProseLines`'s
|
|
50
|
-
* full-body callback walk, for callers that only need a yes/no answer for
|
|
51
|
-
* one position (e.g. an LSP request gating a cursor position, #680).
|
|
45
|
+
* Walk lines outside fenced code, using the cached CommonMark line set unless
|
|
46
|
+
* a precomputed set for this exact text is supplied. Indented code is yielded.
|
|
52
47
|
*/
|
|
53
|
-
function
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
return false;
|
|
48
|
+
function walkProseLines(body, cb, fencedLines = fencedCodeLines(body)) {
|
|
49
|
+
body.split("\n").forEach((line, index) => {
|
|
50
|
+
if (!fencedLines.has(index))
|
|
51
|
+
cb(line, index);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Return whether a zero-based document line belongs to the fenced-line set.
|
|
56
|
+
* Supply the set for this exact text when querying multiple positions.
|
|
57
|
+
*/
|
|
58
|
+
function isLineFenced(body, lineIndex, fencedLines = fencedCodeLines(body)) {
|
|
59
|
+
return fencedLines.has(lineIndex);
|
|
67
60
|
}
|
package/script/util/modals.d.ts
CHANGED
|
@@ -26,4 +26,10 @@ export declare const EARS_KEYWORD_RE: RegExp;
|
|
|
26
26
|
* punctuation character (`.`, `!`, `?`).
|
|
27
27
|
*/
|
|
28
28
|
export declare function isSentenceInitial(line: string, offset: number): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Normalize modal keywords in prose while preserving CommonMark fenced and
|
|
31
|
+
* inline code. Four-space and tab-indented lines remain verbatim as before.
|
|
32
|
+
* The document is parsed once; both code exclusions use that same AST.
|
|
33
|
+
*/
|
|
34
|
+
export declare function normalizeProseModals(text: string): string;
|
|
29
35
|
//# sourceMappingURL=modals.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modals.d.ts","sourceRoot":"","sources":["../../src/util/modals.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"modals.d.ts","sourceRoot":"","sources":["../../src/util/modals.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,QAA0C,CAAC;AAExE;;;;;GAKG;AACH,eAAO,MAAM,eAAe,QAAmC,CAAC;AAEhE;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAOvE;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CA4CzD"}
|
package/script/util/modals.js
CHANGED
|
@@ -10,6 +10,9 @@
|
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
11
|
exports.EARS_KEYWORD_RE = exports.RFC2119_MODAL_RE = void 0;
|
|
12
12
|
exports.isSentenceInitial = isSentenceInitial;
|
|
13
|
+
exports.normalizeProseModals = normalizeProseModals;
|
|
14
|
+
const code_regions_js_1 = require("../parser/code_regions.js");
|
|
15
|
+
const fence_js_1 = require("./fence.js");
|
|
13
16
|
/**
|
|
14
17
|
* RFC 2119 modal keywords in uppercase form, with optional ` NOT` suffix.
|
|
15
18
|
* Captured for canonical-form normalisation per spec §3.4.1: uppercase
|
|
@@ -40,3 +43,38 @@ function isSentenceInitial(line, offset) {
|
|
|
40
43
|
const prev = line[i];
|
|
41
44
|
return prev === "." || prev === "!" || prev === "?";
|
|
42
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* Normalize modal keywords in prose while preserving CommonMark fenced and
|
|
48
|
+
* inline code. Four-space and tab-indented lines remain verbatim as before.
|
|
49
|
+
* The document is parsed once; both code exclusions use that same AST.
|
|
50
|
+
*/
|
|
51
|
+
function normalizeProseModals(text) {
|
|
52
|
+
const { fencedLines, inlineCode } = (0, code_regions_js_1.parseCodeRegions)(text);
|
|
53
|
+
const lines = text.split("\n");
|
|
54
|
+
let lineOffset = 0;
|
|
55
|
+
let rangeIndex = 0;
|
|
56
|
+
// Record offsets before walking: the callback skips fenced lines.
|
|
57
|
+
const offsets = lines.map((line) => {
|
|
58
|
+
const offset = lineOffset;
|
|
59
|
+
lineOffset += line.length + 1;
|
|
60
|
+
return offset;
|
|
61
|
+
});
|
|
62
|
+
(0, fence_js_1.walkProseLines)(text, (line, i) => {
|
|
63
|
+
if (/^( {4}|\t)/.test(line))
|
|
64
|
+
return;
|
|
65
|
+
const start = offsets[i];
|
|
66
|
+
while (rangeIndex < inlineCode.length && inlineCode[rangeIndex].end <= start)
|
|
67
|
+
rangeIndex++;
|
|
68
|
+
const protectedRanges = [];
|
|
69
|
+
for (let j = rangeIndex; j < inlineCode.length && inlineCode[j].start < start + line.length; j++) {
|
|
70
|
+
protectedRanges.push(inlineCode[j]);
|
|
71
|
+
}
|
|
72
|
+
const isCode = (offset, length) => protectedRanges.some((range) => range.start < start + offset + length && range.end > start + offset);
|
|
73
|
+
let normalized = line.replace(exports.RFC2119_MODAL_RE, (match, _keyword, _not, offset) => isCode(offset, match.length) ? match : match.toLowerCase());
|
|
74
|
+
normalized = normalized.replace(exports.EARS_KEYWORD_RE, (match, _keyword, offset) => isCode(offset, match.length) || isSentenceInitial(normalized, offset)
|
|
75
|
+
? match
|
|
76
|
+
: match.toLowerCase());
|
|
77
|
+
lines[i] = normalized;
|
|
78
|
+
}, fencedLines);
|
|
79
|
+
return lines.join("\n");
|
|
80
|
+
}
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
* - Inline HTML — remains inside `ParagraphNode.content.text` (remark
|
|
21
21
|
* does not extract inline HTML nodes into block-level nodes); each
|
|
22
22
|
* paragraph's text is scanned line-by-line using the same regex
|
|
23
|
-
* approach as the old walkProseLines path
|
|
23
|
+
* approach as the old walkProseLines path (with inline code spans
|
|
24
|
+
* masked out first — they are literal text, never HTML), bounded to prose-only
|
|
24
25
|
* nodes (code/feature/math blocks are automatically excluded because
|
|
25
26
|
* the builder does not emit prose-bearing nodes for verbatim content).
|
|
26
27
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"body_blocks.d.ts","sourceRoot":"","sources":["../../src/validator/body_blocks.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"body_blocks.d.ts","sourceRoot":"","sources":["../../src/validator/body_blocks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AA0QzD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,KAAK,GAAG,SAAS,UAAU,EAAE,CAsBtE"}
|
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
* - Inline HTML — remains inside `ParagraphNode.content.text` (remark
|
|
22
22
|
* does not extract inline HTML nodes into block-level nodes); each
|
|
23
23
|
* paragraph's text is scanned line-by-line using the same regex
|
|
24
|
-
* approach as the old walkProseLines path
|
|
24
|
+
* approach as the old walkProseLines path (with inline code spans
|
|
25
|
+
* masked out first — they are literal text, never HTML), bounded to prose-only
|
|
25
26
|
* nodes (code/feature/math blocks are automatically excluded because
|
|
26
27
|
* the builder does not emit prose-bearing nodes for verbatim content).
|
|
27
28
|
*
|
|
@@ -41,6 +42,15 @@ const directives_js_1 = require("../parser/directives.js");
|
|
|
41
42
|
const HTML_TAG_RE = /<\/?[A-Za-z][A-Za-z0-9]*(\s[^>]*)?\/?>/;
|
|
42
43
|
/** Any HTML comment, `<!--…-->`. */
|
|
43
44
|
const HTML_COMMENT_RE = /<!--[\s\S]*?-->/;
|
|
45
|
+
/**
|
|
46
|
+
* A CommonMark raw HTML open or closing tag (§6.6) anchored at the scan
|
|
47
|
+
* position. Stricter than {@linkcode HTML_TAG_RE} on purpose: it decides
|
|
48
|
+
* code-span precedence, so `` a<b and `c>` `` must not read as a tag
|
|
49
|
+
* (a backtick cannot start an attribute name) and hide the code span.
|
|
50
|
+
*/
|
|
51
|
+
const HTML_TAG_AT_RE = /^(?:<[A-Za-z][A-Za-z0-9-]*(?:\s+[A-Za-z_:][\w.:-]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*\/?>|<\/[A-Za-z][A-Za-z0-9-]*\s*>)/;
|
|
52
|
+
/** {@linkcode HTML_COMMENT_RE} anchored at the scan position. */
|
|
53
|
+
const HTML_COMMENT_AT_RE = new RegExp(`^${HTML_COMMENT_RE.source}`);
|
|
44
54
|
/**
|
|
45
55
|
* Return `true` when `line` contains raw HTML the body model forbids:
|
|
46
56
|
* any tag, or any comment that isn't a standalone markspec directive.
|
|
@@ -73,6 +83,74 @@ const RAW_HTML_DIAG = {
|
|
|
73
83
|
severity: "error",
|
|
74
84
|
summary: "raw HTML inside entry body — only `<!-- markspec:* -->` directive comments are permitted (spec §2.4.1)",
|
|
75
85
|
};
|
|
86
|
+
/**
|
|
87
|
+
* Blank out every CommonMark code span in `text` (delimiters included),
|
|
88
|
+
* keeping newlines so line offsets are preserved. A code span is literal
|
|
89
|
+
* text, never HTML (CommonMark §6.1), so `` `tool --root <ws>` `` must
|
|
90
|
+
* not reach the tag regex.
|
|
91
|
+
*
|
|
92
|
+
* Follows the CommonMark rules the regex scan would otherwise ignore:
|
|
93
|
+
* a backslash-escaped backtick does not open a span; an opening run of N
|
|
94
|
+
* backticks closes only at the next run of exactly N; an unmatched run
|
|
95
|
+
* is literal. Raw HTML and code spans bind left-to-right, so a tag that
|
|
96
|
+
* starts before a backtick run is skipped intact and still flagged.
|
|
97
|
+
*/
|
|
98
|
+
function maskCodeSpans(text) {
|
|
99
|
+
const blank = (s) => s.replace(/[^\n]/g, " ");
|
|
100
|
+
let out = "";
|
|
101
|
+
let i = 0;
|
|
102
|
+
while (i < text.length) {
|
|
103
|
+
const ch = text[i];
|
|
104
|
+
if (ch === "\\" && i + 1 < text.length) {
|
|
105
|
+
out += text.slice(i, i + 2);
|
|
106
|
+
i += 2;
|
|
107
|
+
continue;
|
|
108
|
+
}
|
|
109
|
+
if (ch === "<") {
|
|
110
|
+
const rest = text.slice(i);
|
|
111
|
+
const tag = HTML_TAG_AT_RE.exec(rest) ?? HTML_COMMENT_AT_RE.exec(rest);
|
|
112
|
+
if (tag) {
|
|
113
|
+
out += tag[0];
|
|
114
|
+
i += tag[0].length;
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
if (ch !== "`") {
|
|
119
|
+
out += ch;
|
|
120
|
+
i++;
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
let runEnd = i;
|
|
124
|
+
while (runEnd < text.length && text[runEnd] === "`")
|
|
125
|
+
runEnd++;
|
|
126
|
+
const runLength = runEnd - i;
|
|
127
|
+
let close = -1;
|
|
128
|
+
let j = runEnd;
|
|
129
|
+
while (j < text.length) {
|
|
130
|
+
if (text[j] !== "`") {
|
|
131
|
+
j++;
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
let k = j;
|
|
135
|
+
while (k < text.length && text[k] === "`")
|
|
136
|
+
k++;
|
|
137
|
+
if (k - j === runLength) {
|
|
138
|
+
close = k;
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
j = k;
|
|
142
|
+
}
|
|
143
|
+
if (close < 0) {
|
|
144
|
+
// Unmatched opener — the backticks are literal text.
|
|
145
|
+
out += text.slice(i, runEnd);
|
|
146
|
+
i = runEnd;
|
|
147
|
+
continue;
|
|
148
|
+
}
|
|
149
|
+
out += blank(text.slice(i, close));
|
|
150
|
+
i = close;
|
|
151
|
+
}
|
|
152
|
+
return out;
|
|
153
|
+
}
|
|
76
154
|
/**
|
|
77
155
|
* Scan `text` line-by-line for forbidden inline HTML, starting at
|
|
78
156
|
* `startLine` (1-based body-relative). Returns one `{ diag, bodyLine }`
|
|
@@ -86,7 +164,7 @@ const RAW_HTML_DIAG = {
|
|
|
86
164
|
*/
|
|
87
165
|
function htmlViolations(text, startLine) {
|
|
88
166
|
const out = [];
|
|
89
|
-
const lines = text.split("\n");
|
|
167
|
+
const lines = maskCodeSpans(text).split("\n");
|
|
90
168
|
for (let li = 0; li < lines.length; li++) {
|
|
91
169
|
const line = lines[li];
|
|
92
170
|
if (line.trim() === "")
|
|
@@ -14,6 +14,12 @@
|
|
|
14
14
|
* collided tokens (MSL-R014 replaces them).
|
|
15
15
|
*/
|
|
16
16
|
import type { Diagnostic, Entry } from "../model/mod.js";
|
|
17
|
+
/**
|
|
18
|
+
* Attribute corpus findings and replace generic duplicate diagnostics with
|
|
19
|
+
* corpus collisions. Append collisions after attribution so MSL-R014 remains
|
|
20
|
+
* an error even when its location belongs to a read-only corpus.
|
|
21
|
+
*/
|
|
22
|
+
export declare function applyCorpusPostPass(diagnostics: readonly Diagnostic[], allEntries: readonly Entry[]): Diagnostic[];
|
|
17
23
|
/** Result of {@linkcode detectCorpusCollisions}. */
|
|
18
24
|
export interface CorpusCollisionResult {
|
|
19
25
|
readonly diagnostics: readonly Diagnostic[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"corpus.d.ts","sourceRoot":"","sources":["../../src/validator/corpus.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAe,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"corpus.d.ts","sourceRoot":"","sources":["../../src/validator/corpus.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAe,MAAM,iBAAiB,CAAC;AAOtE;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,SAAS,UAAU,EAAE,EAClC,UAAU,EAAE,SAAS,KAAK,EAAE,GAC3B,UAAU,EAAE,CAUd;AA2BD,oDAAoD;AACpD,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;IAC5C,qEAAqE;IACrE,QAAQ,CAAC,cAAc,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC9C;AAED,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,SAAS,KAAK,EAAE,GAC3B,qBAAqB,CAsFvB;AAED,wBAAgB,0BAA0B,CACxC,WAAW,EAAE,SAAS,UAAU,EAAE,EAClC,UAAU,EAAE,SAAS,KAAK,EAAE,EAC5B,cAAc,EAAE,WAAW,CAAC,MAAM,CAAC,GAClC,UAAU,EAAE,CAyCd"}
|
|
@@ -15,9 +15,22 @@
|
|
|
15
15
|
* collided tokens (MSL-R014 replaces them).
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.applyCorpusPostPass = applyCorpusPostPass;
|
|
18
19
|
exports.detectCorpusCollisions = detectCorpusCollisions;
|
|
19
20
|
exports.attributeCorpusDiagnostics = attributeCorpusDiagnostics;
|
|
20
21
|
const mod_js_1 = require("../model/mod.js");
|
|
22
|
+
/**
|
|
23
|
+
* Attribute corpus findings and replace generic duplicate diagnostics with
|
|
24
|
+
* corpus collisions. Append collisions after attribution so MSL-R014 remains
|
|
25
|
+
* an error even when its location belongs to a read-only corpus.
|
|
26
|
+
*/
|
|
27
|
+
function applyCorpusPostPass(diagnostics, allEntries) {
|
|
28
|
+
const collisions = detectCorpusCollisions(allEntries);
|
|
29
|
+
return [
|
|
30
|
+
...attributeCorpusDiagnostics(diagnostics, allEntries, collisions.collidedTokens),
|
|
31
|
+
...collisions.diagnostics,
|
|
32
|
+
];
|
|
33
|
+
}
|
|
21
34
|
/**
|
|
22
35
|
* Remedy clause for an inter-tier MSL-R014 collision — both owners
|
|
23
36
|
* carry an origin (upstream and/or delivered profile), so the consumer
|
|
@@ -44,7 +57,7 @@ function detectCorpusCollisions(allEntries) {
|
|
|
44
57
|
const corpusByDisplayId = new Map();
|
|
45
58
|
const corpusById = new Map();
|
|
46
59
|
for (const e of allEntries) {
|
|
47
|
-
if (!
|
|
60
|
+
if (!(0, mod_js_1.isCorpusEntry)(e))
|
|
48
61
|
continue;
|
|
49
62
|
if (!corpusByDisplayId.has(e.displayId)) {
|
|
50
63
|
corpusByDisplayId.set(e.displayId, e);
|
|
@@ -58,7 +71,7 @@ function detectCorpusCollisions(allEntries) {
|
|
|
58
71
|
const diagnostics = [];
|
|
59
72
|
const collided = new Set();
|
|
60
73
|
for (const e of allEntries) {
|
|
61
|
-
if (!
|
|
74
|
+
if (!(0, mod_js_1.isCorpusEntry)(e)) {
|
|
62
75
|
const displayOwner = corpusByDisplayId.get(e.displayId);
|
|
63
76
|
if (displayOwner) {
|
|
64
77
|
collided.add(e.displayId);
|
|
@@ -128,7 +141,7 @@ function detectCorpusCollisions(allEntries) {
|
|
|
128
141
|
function attributeCorpusDiagnostics(diagnostics, allEntries, collidedTokens) {
|
|
129
142
|
const corpusFiles = new Map();
|
|
130
143
|
for (const e of allEntries) {
|
|
131
|
-
if (
|
|
144
|
+
if ((0, mod_js_1.isCorpusEntry)(e)) {
|
|
132
145
|
corpusFiles.set(e.location.file, e.origin);
|
|
133
146
|
}
|
|
134
147
|
}
|
|
@@ -43,6 +43,6 @@ export { validateValue } from "./value_types.js";
|
|
|
43
43
|
export type { ValueValidator } from "./value_types.js";
|
|
44
44
|
export { normalizeListValues } from "./normalize.js";
|
|
45
45
|
export { effectiveTraceRules, matchesAnyTarget, validateTraceabilityForEntry, } from "./traceability.js";
|
|
46
|
-
export { attributeCorpusDiagnostics, detectCorpusCollisions, } from "./corpus.js";
|
|
46
|
+
export { applyCorpusPostPass, attributeCorpusDiagnostics, detectCorpusCollisions, } from "./corpus.js";
|
|
47
47
|
export type { CorpusCollisionResult } from "./corpus.js";
|
|
48
48
|
//# sourceMappingURL=mod.d.ts.map
|
|
@@ -1 +1 @@
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,EAAE,MAAM,cAAc,CAAC;AAEpE,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AACjE,YAAY,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAEvD,OAAO,EAAE,cAAc,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAC7E,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAE1D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAErD,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,4BAA4B,GAC7B,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,mBAAmB,EACnB,0BAA0B,EAC1B,sBAAsB,GACvB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC"}
|
package/script/validator/mod.js
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* a profile-aware validator layer (not in the core).
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.detectCorpusCollisions = exports.attributeCorpusDiagnostics = exports.validateTraceabilityForEntry = exports.matchesAnyTarget = exports.effectiveTraceRules = exports.normalizeListValues = exports.validateValue = exports.validateAttributesForEntry = exports.effectiveScope = exports.compileDisplayIdPattern = exports.classifyEntry = exports.classifyEntriesStage = exports.validateListingDocuments = exports.suppressDeclaredAttrR010 = exports.runPipeline = void 0;
|
|
18
|
+
exports.detectCorpusCollisions = exports.attributeCorpusDiagnostics = exports.applyCorpusPostPass = exports.validateTraceabilityForEntry = exports.matchesAnyTarget = exports.effectiveTraceRules = exports.normalizeListValues = exports.validateValue = exports.validateAttributesForEntry = exports.effectiveScope = exports.compileDisplayIdPattern = exports.classifyEntry = exports.classifyEntriesStage = exports.validateListingDocuments = exports.suppressDeclaredAttrR010 = exports.runPipeline = void 0;
|
|
19
19
|
exports.validate = validate;
|
|
20
20
|
exports.indexByDisplayId = indexByDisplayId;
|
|
21
21
|
exports.findAttr = findAttr;
|
|
@@ -507,5 +507,6 @@ Object.defineProperty(exports, "effectiveTraceRules", { enumerable: true, get: f
|
|
|
507
507
|
Object.defineProperty(exports, "matchesAnyTarget", { enumerable: true, get: function () { return traceability_js_1.matchesAnyTarget; } });
|
|
508
508
|
Object.defineProperty(exports, "validateTraceabilityForEntry", { enumerable: true, get: function () { return traceability_js_1.validateTraceabilityForEntry; } });
|
|
509
509
|
var corpus_js_1 = require("./corpus.js");
|
|
510
|
+
Object.defineProperty(exports, "applyCorpusPostPass", { enumerable: true, get: function () { return corpus_js_1.applyCorpusPostPass; } });
|
|
510
511
|
Object.defineProperty(exports, "attributeCorpusDiagnostics", { enumerable: true, get: function () { return corpus_js_1.attributeCorpusDiagnostics; } });
|
|
511
512
|
Object.defineProperty(exports, "detectCorpusCollisions", { enumerable: true, get: function () { return corpus_js_1.detectCorpusCollisions; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../src/validator/pipeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACV,kBAAkB,EAClB,UAAU,EACV,gBAAgB,EAChB,KAAK,EACN,MAAM,iBAAiB,CAAC;AAqCzB,qDAAqD;AACrD,MAAM,WAAW,cAAc;IAC7B,0EAA0E;IAC1E,QAAQ,CAAC,OAAO,EAAE,SAAS,KAAK,EAAE,CAAC;IACnC,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;IAC5C,8DAA8D;IAC9D,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AAED,2CAA2C;AAC3C,MAAM,WAAW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tC,WAAW,EAAE,SAAS,UAAU,EAAE,EAClC,OAAO,EAAE,SAAS,KAAK,EAAE,EACzB,OAAO,EAAE,gBAAgB,GAAG,IAAI,GAC/B,SAAS,UAAU,EAAE,CASvB"}
|
|
@@ -80,7 +80,6 @@ function runPipeline(entries, profile, captionConventions = {}, opts = {}) {
|
|
|
80
80
|
diagnostics.push(...(0, caption_convention_js_1.validateCaptionConvention)(entry, captionConventions));
|
|
81
81
|
diagnostics.push(...(0, body_blocks_js_1.validateBodyBlocks)(entry));
|
|
82
82
|
diagnostics.push(...(0, feature_ac_js_1.validateFeatureAc)(entry));
|
|
83
|
-
diagnostics.push(...(0, per_type_attrs_js_1.validatePerTypeAttributes)(entry, profile ?? undefined));
|
|
84
83
|
diagnostics.push(...(0, modal_keywords_js_1.validateModalKeywords)(entry));
|
|
85
84
|
}
|
|
86
85
|
// Stage 1.6 — cross-file trace target-type compatibility (MSL-R083).
|
|
@@ -106,15 +105,19 @@ function runPipeline(entries, profile, captionConventions = {}, opts = {}) {
|
|
|
106
105
|
finalEntries = stage2.entries;
|
|
107
106
|
diagnostics.push(...stage2.diagnostics);
|
|
108
107
|
}
|
|
109
|
-
// Stage 2.4 — late-stage inference warnings (MSL-T021 for steps 5/6)
|
|
110
|
-
//
|
|
111
|
-
//
|
|
112
|
-
//
|
|
113
|
-
//
|
|
114
|
-
//
|
|
115
|
-
//
|
|
108
|
+
// Stage 2.4 — late-stage inference warnings (MSL-T021 for steps 5/6)
|
|
109
|
+
// and per-type attribute compatibility (MSL-T022 / MSL-T024). Both run
|
|
110
|
+
// after Stage 2 so that a profile-classified `entry.type` (display-ID
|
|
111
|
+
// pattern match, no explicit `Type:`) resolves to its `extends:` core
|
|
112
|
+
// type — run before classification, MSL-T024 fired on every
|
|
113
|
+
// pattern-classified entry carrying `Satisfies:`/`Derived-from:`. In
|
|
114
|
+
// core-only mode `finalEntries === entries` and `entry.type` is always
|
|
115
|
+
// undefined, so this stage produces the same diagnostics regardless of
|
|
116
|
+
// mode. Partitions inline: `finalEmittable` below is derived from the
|
|
117
|
+
// post-normalization generation, which does not exist yet at this point.
|
|
116
118
|
for (const entry of (0, mod_js_1.emittableEntries)(finalEntries)) {
|
|
117
119
|
diagnostics.push(...(0, types_js_1.inferTypeFromLateStageChain)(entry));
|
|
120
|
+
diagnostics.push(...(0, per_type_attrs_js_1.validatePerTypeAttributes)(entry, profile ?? undefined));
|
|
118
121
|
}
|
|
119
122
|
// Stage 2.5 — normalize profile-declared list-value attributes. Splits
|
|
120
123
|
// comma-separated values for `id-list`/`tag-list` attributes the core parser
|