@driftsys/markspec 0.11.0 → 0.12.1

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.
Files changed (176) hide show
  1. package/README.md +9 -0
  2. package/esm/ast/normalize.d.ts +4 -5
  3. package/esm/ast/normalize.d.ts.map +1 -1
  4. package/esm/ast/normalize.js +6 -37
  5. package/esm/collect/mod.d.ts +29 -9
  6. package/esm/collect/mod.d.ts.map +1 -1
  7. package/esm/collect/mod.js +36 -10
  8. package/esm/compiler/mod.d.ts.map +1 -1
  9. package/esm/compiler/mod.js +2 -6
  10. package/esm/config/markspec.d.ts +5 -3
  11. package/esm/config/markspec.d.ts.map +1 -1
  12. package/esm/config/mod.d.ts.map +1 -1
  13. package/esm/config/mod.js +47 -5
  14. package/esm/discovery/mod.d.ts +24 -8
  15. package/esm/discovery/mod.d.ts.map +1 -1
  16. package/esm/discovery/mod.js +57 -21
  17. package/esm/discovery/projects.d.ts +111 -0
  18. package/esm/discovery/projects.d.ts.map +1 -0
  19. package/esm/discovery/projects.js +242 -0
  20. package/esm/formatter/entry_body.d.ts +84 -0
  21. package/esm/formatter/entry_body.d.ts.map +1 -0
  22. package/esm/formatter/entry_body.js +291 -0
  23. package/esm/formatter/md_equiv.d.ts +6 -5
  24. package/esm/formatter/md_equiv.d.ts.map +1 -1
  25. package/esm/formatter/md_equiv.js +6 -5
  26. package/esm/formatter/mod.d.ts +16 -9
  27. package/esm/formatter/mod.d.ts.map +1 -1
  28. package/esm/formatter/mod.js +327 -53
  29. package/esm/formatter/tab_markers.d.ts +15 -0
  30. package/esm/formatter/tab_markers.d.ts.map +1 -0
  31. package/esm/formatter/tab_markers.js +133 -0
  32. package/esm/gates/mod.d.ts.map +1 -1
  33. package/esm/gates/mod.js +6 -5
  34. package/esm/lint/runner.d.ts.map +1 -1
  35. package/esm/lint/runner.js +4 -4
  36. package/esm/lock/check.d.ts.map +1 -1
  37. package/esm/lock/check.js +2 -1
  38. package/esm/lock/edge_drift.d.ts +2 -0
  39. package/esm/lock/edge_drift.d.ts.map +1 -1
  40. package/esm/lock/edge_drift.js +4 -0
  41. package/esm/lock/mod.d.ts +1 -1
  42. package/esm/lock/mod.d.ts.map +1 -1
  43. package/esm/lock/mod.js +1 -1
  44. package/esm/lock/upstream_deps.js +1 -1
  45. package/esm/mod.d.ts +11 -6
  46. package/esm/mod.d.ts.map +1 -1
  47. package/esm/mod.js +9 -6
  48. package/esm/model/mod.d.ts +22 -1
  49. package/esm/model/mod.d.ts.map +1 -1
  50. package/esm/model/mod.js +10 -0
  51. package/esm/parser/code_regions.d.ts +29 -0
  52. package/esm/parser/code_regions.d.ts.map +1 -0
  53. package/esm/parser/code_regions.js +38 -0
  54. package/esm/parser/markdown.d.ts.map +1 -1
  55. package/esm/parser/markdown.js +103 -40
  56. package/esm/parser/mod.d.ts.map +1 -1
  57. package/esm/parser/mod.js +7 -1
  58. package/esm/parser/translate.d.ts.map +1 -1
  59. package/esm/parser/translate.js +5 -0
  60. package/esm/refs/mod.d.ts +6 -2
  61. package/esm/refs/mod.d.ts.map +1 -1
  62. package/esm/refs/mod.js +15 -21
  63. package/esm/reporter/mod.d.ts.map +1 -1
  64. package/esm/reporter/mod.js +2 -2
  65. package/esm/sync/mapping.d.ts +4 -3
  66. package/esm/sync/mapping.d.ts.map +1 -1
  67. package/esm/sync/mapping.js +52 -9
  68. package/esm/util/display_id.d.ts +20 -0
  69. package/esm/util/display_id.d.ts.map +1 -0
  70. package/esm/util/display_id.js +19 -0
  71. package/esm/util/fence.d.ts +20 -29
  72. package/esm/util/fence.d.ts.map +1 -1
  73. package/esm/util/fence.js +42 -50
  74. package/esm/util/modals.d.ts +6 -0
  75. package/esm/util/modals.d.ts.map +1 -1
  76. package/esm/util/modals.js +37 -0
  77. package/esm/validator/body_blocks.d.ts +2 -1
  78. package/esm/validator/body_blocks.d.ts.map +1 -1
  79. package/esm/validator/body_blocks.js +80 -2
  80. package/esm/validator/corpus.d.ts +6 -0
  81. package/esm/validator/corpus.d.ts.map +1 -1
  82. package/esm/validator/corpus.js +16 -4
  83. package/esm/validator/mod.d.ts +1 -1
  84. package/esm/validator/mod.d.ts.map +1 -1
  85. package/esm/validator/mod.js +1 -1
  86. package/esm/validator/pipeline.d.ts +6 -4
  87. package/esm/validator/pipeline.d.ts.map +1 -1
  88. package/esm/validator/pipeline.js +24 -19
  89. package/package.json +1 -1
  90. package/script/ast/normalize.d.ts +4 -5
  91. package/script/ast/normalize.d.ts.map +1 -1
  92. package/script/ast/normalize.js +5 -36
  93. package/script/collect/mod.d.ts +29 -9
  94. package/script/collect/mod.d.ts.map +1 -1
  95. package/script/collect/mod.js +38 -10
  96. package/script/compiler/mod.d.ts.map +1 -1
  97. package/script/compiler/mod.js +1 -5
  98. package/script/config/markspec.d.ts +5 -3
  99. package/script/config/markspec.d.ts.map +1 -1
  100. package/script/config/mod.d.ts.map +1 -1
  101. package/script/config/mod.js +47 -5
  102. package/script/discovery/mod.d.ts +24 -8
  103. package/script/discovery/mod.d.ts.map +1 -1
  104. package/script/discovery/mod.js +56 -20
  105. package/script/discovery/projects.d.ts +111 -0
  106. package/script/discovery/projects.d.ts.map +1 -0
  107. package/script/discovery/projects.js +250 -0
  108. package/script/formatter/entry_body.d.ts +84 -0
  109. package/script/formatter/entry_body.d.ts.map +1 -0
  110. package/script/formatter/entry_body.js +296 -0
  111. package/script/formatter/md_equiv.d.ts +6 -5
  112. package/script/formatter/md_equiv.d.ts.map +1 -1
  113. package/script/formatter/md_equiv.js +6 -5
  114. package/script/formatter/mod.d.ts +16 -9
  115. package/script/formatter/mod.d.ts.map +1 -1
  116. package/script/formatter/mod.js +324 -50
  117. package/script/formatter/tab_markers.d.ts +15 -0
  118. package/script/formatter/tab_markers.d.ts.map +1 -0
  119. package/script/formatter/tab_markers.js +141 -0
  120. package/script/gates/mod.d.ts.map +1 -1
  121. package/script/gates/mod.js +15 -14
  122. package/script/lint/runner.d.ts.map +1 -1
  123. package/script/lint/runner.js +3 -3
  124. package/script/lock/check.d.ts.map +1 -1
  125. package/script/lock/check.js +2 -1
  126. package/script/lock/edge_drift.d.ts +2 -0
  127. package/script/lock/edge_drift.d.ts.map +1 -1
  128. package/script/lock/edge_drift.js +5 -0
  129. package/script/lock/mod.d.ts +1 -1
  130. package/script/lock/mod.d.ts.map +1 -1
  131. package/script/lock/mod.js +2 -1
  132. package/script/lock/upstream_deps.js +1 -1
  133. package/script/mod.d.ts +11 -6
  134. package/script/mod.d.ts.map +1 -1
  135. package/script/mod.js +23 -5
  136. package/script/model/mod.d.ts +22 -1
  137. package/script/model/mod.d.ts.map +1 -1
  138. package/script/model/mod.js +11 -0
  139. package/script/parser/code_regions.d.ts +29 -0
  140. package/script/parser/code_regions.d.ts.map +1 -0
  141. package/script/parser/code_regions.js +41 -0
  142. package/script/parser/markdown.d.ts.map +1 -1
  143. package/script/parser/markdown.js +102 -39
  144. package/script/parser/mod.d.ts.map +1 -1
  145. package/script/parser/mod.js +7 -1
  146. package/script/parser/translate.d.ts.map +1 -1
  147. package/script/parser/translate.js +5 -0
  148. package/script/refs/mod.d.ts +6 -2
  149. package/script/refs/mod.d.ts.map +1 -1
  150. package/script/refs/mod.js +14 -20
  151. package/script/reporter/mod.d.ts.map +1 -1
  152. package/script/reporter/mod.js +1 -1
  153. package/script/sync/mapping.d.ts +4 -3
  154. package/script/sync/mapping.d.ts.map +1 -1
  155. package/script/sync/mapping.js +52 -9
  156. package/script/util/display_id.d.ts +20 -0
  157. package/script/util/display_id.d.ts.map +1 -0
  158. package/script/util/display_id.js +22 -0
  159. package/script/util/fence.d.ts +20 -29
  160. package/script/util/fence.d.ts.map +1 -1
  161. package/script/util/fence.js +47 -54
  162. package/script/util/modals.d.ts +6 -0
  163. package/script/util/modals.d.ts.map +1 -1
  164. package/script/util/modals.js +38 -0
  165. package/script/validator/body_blocks.d.ts +2 -1
  166. package/script/validator/body_blocks.d.ts.map +1 -1
  167. package/script/validator/body_blocks.js +80 -2
  168. package/script/validator/corpus.d.ts +6 -0
  169. package/script/validator/corpus.d.ts.map +1 -1
  170. package/script/validator/corpus.js +16 -3
  171. package/script/validator/mod.d.ts +1 -1
  172. package/script/validator/mod.d.ts.map +1 -1
  173. package/script/validator/mod.js +2 -1
  174. package/script/validator/pipeline.d.ts +6 -4
  175. package/script/validator/pipeline.d.ts.map +1 -1
  176. package/script/validator/pipeline.js +24 -19
@@ -8,7 +8,7 @@
8
8
  * cache TTL.
9
9
  *
10
10
  * Diagnostic family is `MSL-S###`:
11
- * - MSL-S001 — malformed YAML / unsupported schema
11
+ * - MSL-S001 — malformed YAML / invalid structure / unsupported schema
12
12
  * - MSL-S002 — locked + outbound contradiction
13
13
  * - MSL-S003 — unknown conflict policy (newest-wins removed pre-1.0)
14
14
  * - MSL-S004 — system ≠ identity.external-id-scheme
@@ -27,8 +27,9 @@ const ALLOWED_POLICIES = new Set([
27
27
  ]);
28
28
  /**
29
29
  * Parse and validate one mapping.yaml. Returns the model when valid, or
30
- * an MSL-S### diagnostic when not. Single-shot — stops at the first
31
- * integrity failure to keep the repair signal clear.
30
+ * an MSL-S### diagnostic when not. Never throws on invalid YAML or invalid
31
+ * field shapes. Single-shot — stops at the first integrity failure to keep
32
+ * the repair signal clear.
32
33
  */
33
34
  function parseMapping(yaml, sourcePath) {
34
35
  let raw;
@@ -38,7 +39,16 @@ function parseMapping(yaml, sourcePath) {
38
39
  catch (e) {
39
40
  return fail("MSL-S001", `Malformed mapping.yaml: ${e.message}`, sourcePath);
40
41
  }
42
+ if (raw === null || raw === undefined) {
43
+ return fail("MSL-S001", "Mapping YAML is empty or null", sourcePath);
44
+ }
45
+ if (!isRecord(raw)) {
46
+ return fail("MSL-S001", "Mapping YAML must be an object", sourcePath);
47
+ }
41
48
  const schema = raw.schema;
49
+ if (typeof schema !== "number") {
50
+ return fail("MSL-S001", "Missing or non-number `schema` field", sourcePath);
51
+ }
42
52
  if (schema !== SUPPORTED_SCHEMA) {
43
53
  return fail("MSL-S001", `Unsupported mapping schema: ${schema} (expected ${SUPPORTED_SCHEMA})`, sourcePath);
44
54
  }
@@ -47,12 +57,18 @@ function parseMapping(yaml, sourcePath) {
47
57
  return fail("MSL-S001", "Missing or non-string `system` field", sourcePath);
48
58
  }
49
59
  const direction = raw.direction;
60
+ if (typeof direction !== "string") {
61
+ return fail("MSL-S001", "Missing or non-string `direction` field", sourcePath);
62
+ }
50
63
  if (direction !== "outbound" && direction !== "inbound" &&
51
64
  direction !== "bidirectional") {
52
65
  return fail("MSL-S001", `Invalid top-level direction '${direction}' (expected outbound/inbound/bidirectional)`, sourcePath);
53
66
  }
54
67
  const identity = raw.identity;
55
- const scheme = identity?.["external-id-scheme"];
68
+ if (!isRecord(identity)) {
69
+ return fail("MSL-S001", "Missing or non-object `identity` field", sourcePath);
70
+ }
71
+ const scheme = identity["external-id-scheme"];
56
72
  if (typeof scheme !== "string") {
57
73
  return fail("MSL-S001", "Missing identity.external-id-scheme", sourcePath);
58
74
  }
@@ -60,19 +76,42 @@ function parseMapping(yaml, sourcePath) {
60
76
  return fail("MSL-S004", `system '${system}' does not match identity.external-id-scheme '${scheme}'`, sourcePath);
61
77
  }
62
78
  const conflict = raw.conflict;
79
+ if (conflict !== undefined && !isRecord(conflict)) {
80
+ return fail("MSL-S001", "Non-object `conflict` field", sourcePath);
81
+ }
63
82
  const policy = conflict?.default;
83
+ if (policy !== undefined && typeof policy !== "string") {
84
+ return fail("MSL-S001", "Non-string conflict.default", sourcePath);
85
+ }
64
86
  if (policy !== undefined && !ALLOWED_POLICIES.has(policy)) {
65
87
  return fail("MSL-S003", `Unknown conflict policy '${policy}' (allowed: manual, local-wins, remote-wins; newest-wins removed pre-1.0)`, sourcePath);
66
88
  }
67
89
  const cacheRaw = raw.cache;
68
- const ttlStr = cacheRaw?.ttl ?? "15m";
90
+ if (cacheRaw !== undefined && !isRecord(cacheRaw)) {
91
+ return fail("MSL-S001", "Non-object `cache` field", sourcePath);
92
+ }
93
+ const ttlStr = cacheRaw?.ttl === undefined ? "15m" : cacheRaw.ttl;
94
+ if (typeof ttlStr !== "string") {
95
+ return fail("MSL-S001", "Non-string cache.ttl", sourcePath);
96
+ }
69
97
  const ttlMs = parseDurationMs(ttlStr);
70
98
  if (ttlMs === null) {
71
99
  return fail("MSL-S005", `Unparseable cache.ttl '${ttlStr}' (expected: 15m, 1h, 7d etc.)`, sourcePath);
72
100
  }
73
- const attrsRaw = raw.attributes ?? [];
101
+ const attrsRaw = raw.attributes === undefined ? [] : raw.attributes;
102
+ if (!Array.isArray(attrsRaw)) {
103
+ return fail("MSL-S001", "Non-array `attributes` field", sourcePath);
104
+ }
74
105
  const attributes = [];
75
106
  for (const a of attrsRaw) {
107
+ if (!isRecord(a) || typeof a.markspec !== "string" ||
108
+ typeof a.external !== "string") {
109
+ return fail("MSL-S001", "Each attribute mapping requires an object with string 'markspec' and 'external' fields", sourcePath);
110
+ }
111
+ if ((a.direction !== undefined && typeof a.direction !== "string") ||
112
+ (a.locked !== undefined && typeof a.locked !== "boolean")) {
113
+ return fail("MSL-S001", "Attribute mapping requires a string 'direction' and boolean 'locked' when present", sourcePath);
114
+ }
76
115
  const attrDir = (a.direction === "outbound" || a.direction === "inbound" ||
77
116
  a.direction === "bidirectional")
78
117
  ? a.direction
@@ -81,9 +120,6 @@ function parseMapping(yaml, sourcePath) {
81
120
  if (locked && attrDir === "outbound") {
82
121
  return fail("MSL-S002", `Attribute '${a.markspec}': locked: true contradicts direction: outbound`, sourcePath);
83
122
  }
84
- if (typeof a.markspec !== "string" || typeof a.external !== "string") {
85
- return fail("MSL-S001", "Each attribute mapping requires string 'markspec' and 'external' fields", sourcePath);
86
- }
87
123
  attributes.push({
88
124
  markspec: a.markspec,
89
125
  external: a.external,
@@ -103,6 +139,13 @@ function parseMapping(yaml, sourcePath) {
103
139
  };
104
140
  return { mapping, diagnostics: [] };
105
141
  }
142
+ /** Whether a YAML value is a plain mapping rather than a scalar or sequence. */
143
+ function isRecord(value) {
144
+ if (typeof value !== "object" || value === null)
145
+ return false;
146
+ const prototype = Object.getPrototypeOf(value);
147
+ return prototype === Object.prototype || prototype === null;
148
+ }
106
149
  /**
107
150
  * Cross-system validation: at most one system writes locally per attribute.
108
151
  * "Writes locally" = direction is `inbound` or `bidirectional`. Multiple
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Display-ID token characters are ASCII letters, digits, dots, slashes,
3
+ * underscores and hyphens. The LSP reads the whole token under the cursor,
4
+ * including trailing characters in this set, then applies DISPLAY_ID_TOKEN_RE.
5
+ * The renderer scans whole runs of the same characters and resolves each
6
+ * against the known IDs: exact match first, then split on slashes only if
7
+ * every segment is nonempty and a known ID. If neither resolves, remove one
8
+ * trailing period and repeat, leaving the removed period outside the link.
9
+ * A token with a trailing hyphen, such as SYS_A-, does not link SYS_A.
10
+ * With only A/B and C known, A/B/C links nothing: slash segments are not
11
+ * recursively grouped. A known short ID links wherever it stands alone.
12
+ * These recognition rules do not constrain the parser's entry IDs.
13
+ */
14
+ export declare const DISPLAY_ID_CHAR_RE: RegExp;
15
+ /**
16
+ * An LSP display-ID token starts with an ASCII letter or digit and contains
17
+ * at least three characters. Any display-ID character may end the token.
18
+ */
19
+ export declare const DISPLAY_ID_TOKEN_RE: RegExp;
20
+ //# sourceMappingURL=display_id.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"display_id.d.ts","sourceRoot":"","sources":["../../src/util/display_id.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,kBAAkB,QAAoB,CAAC;AAEpD;;;GAGG;AACH,eAAO,MAAM,mBAAmB,EAAE,MAEjC,CAAC"}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DISPLAY_ID_TOKEN_RE = exports.DISPLAY_ID_CHAR_RE = void 0;
4
+ /**
5
+ * Display-ID token characters are ASCII letters, digits, dots, slashes,
6
+ * underscores and hyphens. The LSP reads the whole token under the cursor,
7
+ * including trailing characters in this set, then applies DISPLAY_ID_TOKEN_RE.
8
+ * The renderer scans whole runs of the same characters and resolves each
9
+ * against the known IDs: exact match first, then split on slashes only if
10
+ * every segment is nonempty and a known ID. If neither resolves, remove one
11
+ * trailing period and repeat, leaving the removed period outside the link.
12
+ * A token with a trailing hyphen, such as SYS_A-, does not link SYS_A.
13
+ * With only A/B and C known, A/B/C links nothing: slash segments are not
14
+ * recursively grouped. A known short ID links wherever it stands alone.
15
+ * These recognition rules do not constrain the parser's entry IDs.
16
+ */
17
+ exports.DISPLAY_ID_CHAR_RE = /[A-Za-z0-9._/-]/;
18
+ /**
19
+ * An LSP display-ID token starts with an ASCII letter or digit and contains
20
+ * at least three characters. Any display-ID character may end the token.
21
+ */
22
+ exports.DISPLAY_ID_TOKEN_RE = new RegExp(`^[A-Za-z0-9]${exports.DISPLAY_ID_CHAR_RE.source}{2,}$`);
@@ -1,38 +1,29 @@
1
1
  /**
2
- * @module core/util/fence
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
- /** Callback for {@linkcode walkProseLines}. Receives one line + its 0-based index. */
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 `body` line by line, invoking `cb` for every line that's NOT
25
- * inside a fenced code block. The first fence marker opens the block;
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 `lineIndex` (0-based) is a line {@linkcode walkProseLines}
32
- * would skip — either a fence-marker line itself, or content inside a
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":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,gEAAgE;AAChE,eAAO,MAAM,QAAQ,QAAkB,CAAC;AAExC,sFAAsF;AACtF,MAAM,MAAM,iBAAiB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;AAEtE;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,iBAAiB,GAAG,IAAI,CAYxE;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAYrE"}
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"}
@@ -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
- /** Three or more backticks or tildes at the start of a line. */
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
- * Walk `body` line by line, invoking `cb` for every line that's NOT
28
- * inside a fenced code block. The first fence marker opens the block;
29
- * the next closes it. The fence-marker lines themselves are also
30
- * skipped (they're structural, not prose).
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 walkProseLines(body, cb) {
33
- const lines = body.split("\n");
34
- let inFence = false;
35
- for (let i = 0; i < lines.length; i++) {
36
- const line = lines[i];
37
- if (exports.FENCE_RE.test(line)) {
38
- inFence = !inFence;
39
- continue;
40
- }
41
- if (inFence)
42
- continue;
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
- * Return whether `lineIndex` (0-based) is a line {@linkcode walkProseLines}
48
- * would skip — either a fence-marker line itself, or content inside a
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 isLineFenced(body, lineIndex) {
54
- const lines = body.split("\n");
55
- let inFence = false;
56
- for (let i = 0; i <= lineIndex && i < lines.length; i++) {
57
- if (exports.FENCE_RE.test(lines[i])) {
58
- inFence = !inFence;
59
- if (i === lineIndex)
60
- return true;
61
- continue;
62
- }
63
- if (i === lineIndex)
64
- return inFence;
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
  }
@@ -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;AAEH;;;;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"}
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"}
@@ -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, but bounded to prose-only
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AA2LzD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,KAAK,GAAG,SAAS,UAAU,EAAE,CAsBtE"}
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, but bounded to prose-only
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;AA4BtE,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"}
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 (!e.origin)
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 (!e.origin) {
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 (e.origin) {
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 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/validator/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAsCpE,mCAAmC;AACnC,MAAM,WAAW,cAAc;IAC7B,2CAA2C;IAC3C,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;IAC5C,gDAAgD;IAChD,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,SAAS,KAAK,EAAE,GAAG,cAAc,CAuBlE;AAibD,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,SAAS,KAAK,EAAE,GACxB,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,CAM5B;AAGD,wBAAgB,QAAQ,CACtB,KAAK,EAAE,SAAS,SAAS,EAAE,EAC3B,GAAG,EAAE,MAAM,GACV,SAAS,GAAG,SAAS,CAEvB;AAED,OAAO,EAAE,WAAW,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AACtE,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAErE,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AACxD,YAAY,EAAE,kBAAkB,EAAE,WAAW,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,0BAA0B,EAC1B,sBAAsB,GACvB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/validator/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAsCpE,mCAAmC;AACnC,MAAM,WAAW,cAAc;IAC7B,2CAA2C;IAC3C,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;IAC5C,gDAAgD;IAChD,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,SAAS,KAAK,EAAE,GAAG,cAAc,CAuBlE;AAibD,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,SAAS,KAAK,EAAE,GACxB,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,CAM5B;AAGD,wBAAgB,QAAQ,CACtB,KAAK,EAAE,SAAS,SAAS,EAAE,EAC3B,GAAG,EAAE,MAAM,GACV,SAAS,GAAG,SAAS,CAEvB;AAED,OAAO,EAAE,WAAW,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AACtE,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAErE,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AACxD,YAAY,EAAE,kBAAkB,EAAE,WAAW,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"}