@jasonbelmonti/markdown-engine 1.0.0 → 2.0.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.
Files changed (308) hide show
  1. package/CHANGELOG.md +24 -1
  2. package/README.md +75 -26
  3. package/SECURITY.md +5 -3
  4. package/dist/api/annotation-source-range.d.ts +7 -0
  5. package/dist/api/annotation-source-range.d.ts.map +1 -0
  6. package/dist/api/annotation-source-range.js +103 -0
  7. package/dist/api/annotation-source-range.js.map +1 -0
  8. package/dist/api/annotation-target-candidate.d.ts +10 -0
  9. package/dist/api/annotation-target-candidate.d.ts.map +1 -0
  10. package/dist/api/annotation-target-candidate.js +14 -0
  11. package/dist/api/annotation-target-candidate.js.map +1 -0
  12. package/dist/api/annotation-target-cloning.d.ts +5 -0
  13. package/dist/api/annotation-target-cloning.d.ts.map +1 -0
  14. package/dist/api/annotation-target-cloning.js +122 -0
  15. package/dist/api/annotation-target-cloning.js.map +1 -0
  16. package/dist/api/annotation-target-diagnostics.d.ts +8 -0
  17. package/dist/api/annotation-target-diagnostics.d.ts.map +1 -0
  18. package/dist/api/annotation-target-diagnostics.js +57 -0
  19. package/dist/api/annotation-target-diagnostics.js.map +1 -0
  20. package/dist/api/annotation-target-validation.d.ts +2 -2
  21. package/dist/api/annotation-target-validation.d.ts.map +1 -1
  22. package/dist/api/annotation-target-validation.js +5 -272
  23. package/dist/api/annotation-target-validation.js.map +1 -1
  24. package/dist/api/contracts.d.ts +2 -1
  25. package/dist/api/contracts.d.ts.map +1 -1
  26. package/dist/api/contracts.js +1 -0
  27. package/dist/api/contracts.js.map +1 -1
  28. package/dist/api/declarative-validation.d.ts +13 -0
  29. package/dist/api/declarative-validation.d.ts.map +1 -0
  30. package/dist/api/declarative-validation.js +63 -0
  31. package/dist/api/declarative-validation.js.map +1 -0
  32. package/dist/api/document-queries.d.ts.map +1 -1
  33. package/dist/api/document-queries.js +74 -3
  34. package/dist/api/document-queries.js.map +1 -1
  35. package/dist/api/document.d.ts +44 -0
  36. package/dist/api/document.d.ts.map +1 -1
  37. package/dist/api/engine-node-attributes.d.ts +15 -0
  38. package/dist/api/engine-node-attributes.d.ts.map +1 -0
  39. package/dist/api/engine-node-attributes.js +99 -0
  40. package/dist/api/engine-node-attributes.js.map +1 -0
  41. package/dist/api/normalize.d.ts.map +1 -1
  42. package/dist/api/normalize.js +22 -1
  43. package/dist/api/normalize.js.map +1 -1
  44. package/dist/api/serialize.js +2 -14
  45. package/dist/api/serialize.js.map +1 -1
  46. package/dist/cli/args.d.ts +6 -2
  47. package/dist/cli/args.d.ts.map +1 -1
  48. package/dist/cli/args.js +33 -25
  49. package/dist/cli/args.js.map +1 -1
  50. package/dist/cli/declarative-validation.d.ts +18 -0
  51. package/dist/cli/declarative-validation.d.ts.map +1 -0
  52. package/dist/cli/declarative-validation.js +131 -0
  53. package/dist/cli/declarative-validation.js.map +1 -0
  54. package/dist/cli/files.d.ts +1 -0
  55. package/dist/cli/files.d.ts.map +1 -1
  56. package/dist/cli/files.js +3 -0
  57. package/dist/cli/files.js.map +1 -1
  58. package/dist/cli/run.d.ts.map +1 -1
  59. package/dist/cli/run.js +18 -3
  60. package/dist/cli/run.js.map +1 -1
  61. package/dist/cli/validate-args.d.ts +18 -0
  62. package/dist/cli/validate-args.d.ts.map +1 -0
  63. package/dist/cli/validate-args.js +131 -0
  64. package/dist/cli/validate-args.js.map +1 -0
  65. package/dist/declarative-validation/assertions/context.d.ts +8 -0
  66. package/dist/declarative-validation/assertions/context.d.ts.map +1 -0
  67. package/dist/declarative-validation/assertions/context.js +2 -0
  68. package/dist/declarative-validation/assertions/context.js.map +1 -0
  69. package/dist/declarative-validation/assertions/diagnostics.d.ts +22 -0
  70. package/dist/declarative-validation/assertions/diagnostics.d.ts.map +1 -0
  71. package/dist/declarative-validation/assertions/diagnostics.js +71 -0
  72. package/dist/declarative-validation/assertions/diagnostics.js.map +1 -0
  73. package/dist/declarative-validation/assertions/document-text-offsets.d.ts +3 -0
  74. package/dist/declarative-validation/assertions/document-text-offsets.d.ts.map +1 -0
  75. package/dist/declarative-validation/assertions/document-text-offsets.js +32 -0
  76. package/dist/declarative-validation/assertions/document-text-offsets.js.map +1 -0
  77. package/dist/declarative-validation/assertions/evaluator.d.ts +5 -0
  78. package/dist/declarative-validation/assertions/evaluator.d.ts.map +1 -0
  79. package/dist/declarative-validation/assertions/evaluator.js +46 -0
  80. package/dist/declarative-validation/assertions/evaluator.js.map +1 -0
  81. package/dist/declarative-validation/assertions/exists.d.ts +4 -0
  82. package/dist/declarative-validation/assertions/exists.d.ts.map +1 -0
  83. package/dist/declarative-validation/assertions/exists.js +8 -0
  84. package/dist/declarative-validation/assertions/exists.js.map +1 -0
  85. package/dist/declarative-validation/assertions/frontmatter-required.d.ts +9 -0
  86. package/dist/declarative-validation/assertions/frontmatter-required.d.ts.map +1 -0
  87. package/dist/declarative-validation/assertions/frontmatter-required.js +15 -0
  88. package/dist/declarative-validation/assertions/frontmatter-required.js.map +1 -0
  89. package/dist/declarative-validation/assertions/id-targets.d.ts +29 -0
  90. package/dist/declarative-validation/assertions/id-targets.d.ts.map +1 -0
  91. package/dist/declarative-validation/assertions/id-targets.js +428 -0
  92. package/dist/declarative-validation/assertions/id-targets.js.map +1 -0
  93. package/dist/declarative-validation/assertions/id-tokens.d.ts +15 -0
  94. package/dist/declarative-validation/assertions/id-tokens.d.ts.map +1 -0
  95. package/dist/declarative-validation/assertions/id-tokens.js +27 -0
  96. package/dist/declarative-validation/assertions/id-tokens.js.map +1 -0
  97. package/dist/declarative-validation/assertions/ids.d.ts +9 -0
  98. package/dist/declarative-validation/assertions/ids.d.ts.map +1 -0
  99. package/dist/declarative-validation/assertions/ids.js +42 -0
  100. package/dist/declarative-validation/assertions/ids.js.map +1 -0
  101. package/dist/declarative-validation/assertions/index.d.ts +3 -0
  102. package/dist/declarative-validation/assertions/index.d.ts.map +1 -0
  103. package/dist/declarative-validation/assertions/index.js +3 -0
  104. package/dist/declarative-validation/assertions/index.js.map +1 -0
  105. package/dist/declarative-validation/assertions/literal-text.d.ts +2 -0
  106. package/dist/declarative-validation/assertions/literal-text.d.ts.map +1 -0
  107. package/dist/declarative-validation/assertions/literal-text.js +14 -0
  108. package/dist/declarative-validation/assertions/literal-text.js.map +1 -0
  109. package/dist/declarative-validation/assertions/normalized-source-ranges.d.ts +3 -0
  110. package/dist/declarative-validation/assertions/normalized-source-ranges.d.ts.map +1 -0
  111. package/dist/declarative-validation/assertions/normalized-source-ranges.js +105 -0
  112. package/dist/declarative-validation/assertions/normalized-source-ranges.js.map +1 -0
  113. package/dist/declarative-validation/assertions/ordering.d.ts +6 -0
  114. package/dist/declarative-validation/assertions/ordering.d.ts.map +1 -0
  115. package/dist/declarative-validation/assertions/ordering.js +71 -0
  116. package/dist/declarative-validation/assertions/ordering.js.map +1 -0
  117. package/dist/declarative-validation/assertions/references.d.ts +9 -0
  118. package/dist/declarative-validation/assertions/references.d.ts.map +1 -0
  119. package/dist/declarative-validation/assertions/references.js +354 -0
  120. package/dist/declarative-validation/assertions/references.js.map +1 -0
  121. package/dist/declarative-validation/assertions/sections-required.d.ts +9 -0
  122. package/dist/declarative-validation/assertions/sections-required.d.ts.map +1 -0
  123. package/dist/declarative-validation/assertions/sections-required.js +49 -0
  124. package/dist/declarative-validation/assertions/sections-required.js.map +1 -0
  125. package/dist/declarative-validation/assertions/table-columns-required.d.ts +9 -0
  126. package/dist/declarative-validation/assertions/table-columns-required.d.ts.map +1 -0
  127. package/dist/declarative-validation/assertions/table-columns-required.js +31 -0
  128. package/dist/declarative-validation/assertions/table-columns-required.js.map +1 -0
  129. package/dist/declarative-validation/assertions/text-length.d.ts +9 -0
  130. package/dist/declarative-validation/assertions/text-length.d.ts.map +1 -0
  131. package/dist/declarative-validation/assertions/text-length.js +40 -0
  132. package/dist/declarative-validation/assertions/text-length.js.map +1 -0
  133. package/dist/declarative-validation/assertions/text-occurrence-count.d.ts +9 -0
  134. package/dist/declarative-validation/assertions/text-occurrence-count.d.ts.map +1 -0
  135. package/dist/declarative-validation/assertions/text-occurrence-count.js +22 -0
  136. package/dist/declarative-validation/assertions/text-occurrence-count.js.map +1 -0
  137. package/dist/declarative-validation/assertions/text.d.ts +9 -0
  138. package/dist/declarative-validation/assertions/text.d.ts.map +1 -0
  139. package/dist/declarative-validation/assertions/text.js +32 -0
  140. package/dist/declarative-validation/assertions/text.js.map +1 -0
  141. package/dist/declarative-validation/compiler/assertion-builders.d.ts +6 -0
  142. package/dist/declarative-validation/compiler/assertion-builders.d.ts.map +1 -0
  143. package/dist/declarative-validation/compiler/assertion-builders.js +199 -0
  144. package/dist/declarative-validation/compiler/assertion-builders.js.map +1 -0
  145. package/dist/declarative-validation/compiler/assertion-shapes.d.ts +18 -0
  146. package/dist/declarative-validation/compiler/assertion-shapes.d.ts.map +1 -0
  147. package/dist/declarative-validation/compiler/assertion-shapes.js +129 -0
  148. package/dist/declarative-validation/compiler/assertion-shapes.js.map +1 -0
  149. package/dist/declarative-validation/compiler/assertions.d.ts +5 -0
  150. package/dist/declarative-validation/compiler/assertions.d.ts.map +1 -0
  151. package/dist/declarative-validation/compiler/assertions.js +25 -0
  152. package/dist/declarative-validation/compiler/assertions.js.map +1 -0
  153. package/dist/declarative-validation/compiler/compatibility.d.ts +4 -0
  154. package/dist/declarative-validation/compiler/compatibility.d.ts.map +1 -0
  155. package/dist/declarative-validation/compiler/compatibility.js +28 -0
  156. package/dist/declarative-validation/compiler/compatibility.js.map +1 -0
  157. package/dist/declarative-validation/compiler/diagnostics.d.ts +3 -0
  158. package/dist/declarative-validation/compiler/diagnostics.d.ts.map +1 -0
  159. package/dist/declarative-validation/compiler/diagnostics.js +9 -0
  160. package/dist/declarative-validation/compiler/diagnostics.js.map +1 -0
  161. package/dist/declarative-validation/compiler/index.d.ts +5 -0
  162. package/dist/declarative-validation/compiler/index.d.ts.map +1 -0
  163. package/dist/declarative-validation/compiler/index.js +164 -0
  164. package/dist/declarative-validation/compiler/index.js.map +1 -0
  165. package/dist/declarative-validation/compiler/plan.d.ts +58 -0
  166. package/dist/declarative-validation/compiler/plan.d.ts.map +1 -0
  167. package/dist/declarative-validation/compiler/plan.js +2 -0
  168. package/dist/declarative-validation/compiler/plan.js.map +1 -0
  169. package/dist/declarative-validation/diagnostics/index.d.ts +7 -0
  170. package/dist/declarative-validation/diagnostics/index.d.ts.map +1 -0
  171. package/dist/declarative-validation/diagnostics/index.js +2 -0
  172. package/dist/declarative-validation/diagnostics/index.js.map +1 -0
  173. package/dist/declarative-validation/diagnostics/profile-config-diagnostics.d.ts +11 -0
  174. package/dist/declarative-validation/diagnostics/profile-config-diagnostics.d.ts.map +1 -0
  175. package/dist/declarative-validation/diagnostics/profile-config-diagnostics.js +45 -0
  176. package/dist/declarative-validation/diagnostics/profile-config-diagnostics.js.map +1 -0
  177. package/dist/declarative-validation/evidence/index.d.ts +14 -0
  178. package/dist/declarative-validation/evidence/index.d.ts.map +1 -0
  179. package/dist/declarative-validation/evidence/index.js +38 -0
  180. package/dist/declarative-validation/evidence/index.js.map +1 -0
  181. package/dist/declarative-validation/profile/assertion-schema.d.ts +4 -0
  182. package/dist/declarative-validation/profile/assertion-schema.d.ts.map +1 -0
  183. package/dist/declarative-validation/profile/assertion-schema.js +285 -0
  184. package/dist/declarative-validation/profile/assertion-schema.js.map +1 -0
  185. package/dist/declarative-validation/profile/data-closure.d.ts +6 -0
  186. package/dist/declarative-validation/profile/data-closure.d.ts.map +1 -0
  187. package/dist/declarative-validation/profile/data-closure.js +167 -0
  188. package/dist/declarative-validation/profile/data-closure.js.map +1 -0
  189. package/dist/declarative-validation/profile/direct-profile-diagnostics.d.ts +5 -0
  190. package/dist/declarative-validation/profile/direct-profile-diagnostics.d.ts.map +1 -0
  191. package/dist/declarative-validation/profile/direct-profile-diagnostics.js +73 -0
  192. package/dist/declarative-validation/profile/direct-profile-diagnostics.js.map +1 -0
  193. package/dist/declarative-validation/profile/index.d.ts +113 -0
  194. package/dist/declarative-validation/profile/index.d.ts.map +1 -0
  195. package/dist/declarative-validation/profile/index.js +2 -0
  196. package/dist/declarative-validation/profile/index.js.map +1 -0
  197. package/dist/declarative-validation/profile/materialization.d.ts +9 -0
  198. package/dist/declarative-validation/profile/materialization.d.ts.map +1 -0
  199. package/dist/declarative-validation/profile/materialization.js +109 -0
  200. package/dist/declarative-validation/profile/materialization.js.map +1 -0
  201. package/dist/declarative-validation/profile/parse.d.ts +3 -0
  202. package/dist/declarative-validation/profile/parse.d.ts.map +1 -0
  203. package/dist/declarative-validation/profile/parse.js +89 -0
  204. package/dist/declarative-validation/profile/parse.js.map +1 -0
  205. package/dist/declarative-validation/profile/schema-values.d.ts +14 -0
  206. package/dist/declarative-validation/profile/schema-values.d.ts.map +1 -0
  207. package/dist/declarative-validation/profile/schema-values.js +81 -0
  208. package/dist/declarative-validation/profile/schema-values.js.map +1 -0
  209. package/dist/declarative-validation/profile/schema.d.ts +9 -0
  210. package/dist/declarative-validation/profile/schema.d.ts.map +1 -0
  211. package/dist/declarative-validation/profile/schema.js +98 -0
  212. package/dist/declarative-validation/profile/schema.js.map +1 -0
  213. package/dist/declarative-validation/profile/selector-schema.d.ts +4 -0
  214. package/dist/declarative-validation/profile/selector-schema.d.ts.map +1 -0
  215. package/dist/declarative-validation/profile/selector-schema.js +145 -0
  216. package/dist/declarative-validation/profile/selector-schema.js.map +1 -0
  217. package/dist/declarative-validation/results/index.d.ts +26 -0
  218. package/dist/declarative-validation/results/index.d.ts.map +1 -0
  219. package/dist/declarative-validation/results/index.js +2 -0
  220. package/dist/declarative-validation/results/index.js.map +1 -0
  221. package/dist/declarative-validation/selectors/index.d.ts +57 -0
  222. package/dist/declarative-validation/selectors/index.d.ts.map +1 -0
  223. package/dist/declarative-validation/selectors/index.js +149 -0
  224. package/dist/declarative-validation/selectors/index.js.map +1 -0
  225. package/dist/declarative-validation/selectors/source.d.ts +8 -0
  226. package/dist/declarative-validation/selectors/source.d.ts.map +1 -0
  227. package/dist/declarative-validation/selectors/source.js +57 -0
  228. package/dist/declarative-validation/selectors/source.js.map +1 -0
  229. package/dist/declarative-validation/selectors/table-targets.d.ts +13 -0
  230. package/dist/declarative-validation/selectors/table-targets.d.ts.map +1 -0
  231. package/dist/declarative-validation/selectors/table-targets.js +106 -0
  232. package/dist/declarative-validation/selectors/table-targets.js.map +1 -0
  233. package/dist/declarative-validation/selectors/table-text.d.ts +4 -0
  234. package/dist/declarative-validation/selectors/table-text.d.ts.map +1 -0
  235. package/dist/declarative-validation/selectors/table-text.js +16 -0
  236. package/dist/declarative-validation/selectors/table-text.js.map +1 -0
  237. package/dist/{ir → internal}/document-node-walk.d.ts +5 -0
  238. package/dist/internal/document-node-walk.d.ts.map +1 -0
  239. package/dist/internal/document-node-walk.js +36 -0
  240. package/dist/internal/document-node-walk.js.map +1 -0
  241. package/dist/internal/stable-json.d.ts +3 -0
  242. package/dist/internal/stable-json.d.ts.map +1 -0
  243. package/dist/internal/stable-json.js +17 -0
  244. package/dist/internal/stable-json.js.map +1 -0
  245. package/dist/ir/document-derived-views.d.ts.map +1 -1
  246. package/dist/ir/document-derived-views.js +2 -0
  247. package/dist/ir/document-derived-views.js.map +1 -1
  248. package/dist/ir/document-link-reference-views.d.ts +3 -0
  249. package/dist/ir/document-link-reference-views.d.ts.map +1 -0
  250. package/dist/ir/document-link-reference-views.js +150 -0
  251. package/dist/ir/document-link-reference-views.js.map +1 -0
  252. package/dist/ir/document-link-views.d.ts.map +1 -1
  253. package/dist/ir/document-link-views.js +7 -8
  254. package/dist/ir/document-link-views.js.map +1 -1
  255. package/dist/ir/document-list-views.d.ts.map +1 -1
  256. package/dist/ir/document-list-views.js +14 -13
  257. package/dist/ir/document-list-views.js.map +1 -1
  258. package/dist/ir/document-sections.d.ts.map +1 -1
  259. package/dist/ir/document-sections.js +2 -4
  260. package/dist/ir/document-sections.js.map +1 -1
  261. package/dist/ir/document-table-views.js +1 -1
  262. package/dist/ir/document-table-views.js.map +1 -1
  263. package/dist/ir/document-text-spans.js +1 -1
  264. package/dist/ir/document-text-spans.js.map +1 -1
  265. package/dist/ir/document.d.ts +2 -3
  266. package/dist/ir/document.d.ts.map +1 -1
  267. package/dist/ir/document.js +1 -1
  268. package/dist/ir/document.js.map +1 -1
  269. package/dist/ir/index.d.ts +1 -0
  270. package/dist/ir/index.d.ts.map +1 -1
  271. package/dist/ir/normalization-input.d.ts +12 -0
  272. package/dist/ir/normalization-input.d.ts.map +1 -0
  273. package/dist/ir/normalization-input.js +2 -0
  274. package/dist/ir/normalization-input.js.map +1 -0
  275. package/dist/rules/code-fence-languages.d.ts.map +1 -1
  276. package/dist/rules/code-fence-languages.js +4 -6
  277. package/dist/rules/code-fence-languages.js.map +1 -1
  278. package/dist/rules/document-query.d.ts +0 -2
  279. package/dist/rules/document-query.d.ts.map +1 -1
  280. package/dist/rules/document-query.js +1 -17
  281. package/dist/rules/document-query.js.map +1 -1
  282. package/dist/rules/index.d.ts +2 -6
  283. package/dist/rules/index.d.ts.map +1 -1
  284. package/dist/rules/index.js +3 -37
  285. package/dist/rules/index.js.map +1 -1
  286. package/dist/rules/links-allowed-schemes.d.ts.map +1 -1
  287. package/dist/rules/links-allowed-schemes.js +3 -2
  288. package/dist/rules/links-allowed-schemes.js.map +1 -1
  289. package/dist/rules/registry.d.ts +12 -0
  290. package/dist/rules/registry.d.ts.map +1 -0
  291. package/dist/rules/registry.js +61 -0
  292. package/dist/rules/registry.js.map +1 -0
  293. package/docs/contracts/api.md +661 -0
  294. package/docs/contracts/declarative-validation.md +559 -0
  295. package/docs/contracts/frontmatter.md +122 -0
  296. package/fixtures/declarative-validation/examples/operational-spec/fail.md +32 -0
  297. package/fixtures/declarative-validation/examples/operational-spec/pass.md +34 -0
  298. package/fixtures/declarative-validation/examples/operational-spec/profile.yaml +131 -0
  299. package/fixtures/declarative-validation/examples/release-checklist/fail.md +22 -0
  300. package/fixtures/declarative-validation/examples/release-checklist/pass.md +22 -0
  301. package/fixtures/declarative-validation/examples/release-checklist/profile.yaml +96 -0
  302. package/fixtures/declarative-validation/examples/requirements-traceability/fail.md +27 -0
  303. package/fixtures/declarative-validation/examples/requirements-traceability/pass.md +27 -0
  304. package/fixtures/declarative-validation/examples/requirements-traceability/profile.yaml +119 -0
  305. package/package.json +21 -6
  306. package/dist/ir/document-node-walk.d.ts.map +0 -1
  307. package/dist/ir/document-node-walk.js +0 -16
  308. package/dist/ir/document-node-walk.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -2,7 +2,30 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
- No unreleased changes.
5
+ ### Added
6
+
7
+ - Added a GitHub Pages consumer site under `docs/` with value proposition,
8
+ workflow examples, and quickstart material for package 2.0 users.
9
+
10
+ ## 2.0.0 - 2026-05-13
11
+
12
+ ### Changed
13
+
14
+ - Promoted package metadata to `@jasonbelmonti/markdown-engine@2.0.0` while
15
+ retaining the serialized rich IR document contract at
16
+ `documentVersion: "1.0.0"`.
17
+ - Changed `normalize(parsed)` to default to the rich IR `1.0.0` document shape.
18
+ Callers that still need the retained `0.1.0`-compatible shape must pass
19
+ `documentVersion: "0.0.0"` explicitly.
20
+ - Added `docs/contracts/**` to the npm package artifact and included the rich
21
+ IR contract documentation gate in `release:verify`.
22
+
23
+ ### Fixed
24
+
25
+ - Closed the direct-object `parseValidationProfile(...)` ingestion path before
26
+ schema traversal so unsafe accessors, proxies, cyclic values, sparse arrays,
27
+ functions, non-finite numbers, explicit `undefined`, and `__proto__` payloads
28
+ are rejected as inert profile data instead of being read by schema logic.
6
29
 
7
30
  ## 1.0.0 - 2026-05-07
8
31
 
package/README.md CHANGED
@@ -6,9 +6,11 @@ profile and runtime work.
6
6
  Current package release:
7
7
 
8
8
  - package name: `@jasonbelmonti/markdown-engine`
9
- - version: `1.0.0`
10
- - release focus: feature-complete rich IR, structural query helpers, source
11
- targeting, table/list models, annotations, and deterministic serialization
9
+ - version: `2.0.0`
10
+ - website: <https://jasonbelmonti.github.io/markdown-engine/>
11
+ - release focus: package-level 2.0 hardening with the existing
12
+ `documentVersion: "1.0.0"` rich IR contract as the default API and CLI
13
+ document shape
12
14
  - design reference:
13
15
  [Markdown Engine 1.0 Rich IR design](docs/design/markdown-engine-1.0-rich-ir-operational-design-spec.md)
14
16
 
@@ -36,6 +38,8 @@ The package root exports:
36
38
  - `serialize(result, options?)`
37
39
  - `documentQueries`
38
40
  - `validateAnnotations(document, annotations)`
41
+ - `parseValidationProfile(input, options?)`
42
+ - `validateWithProfile(document, profile, options?)`
39
43
 
40
44
  Example:
41
45
 
@@ -76,8 +80,10 @@ console.log(validationResult.valid);
76
80
  console.log(serialize(validationResult, { pretty: true }));
77
81
  ```
78
82
 
79
- The 1.0 release exposes the rich IR contract through
80
- `normalize(parsed, { documentVersion: "1.0.0" })`. That path adds
83
+ Package 2.0 keeps the serialized document contract at
84
+ `documentVersion: "1.0.0"` and makes that rich IR path the default for
85
+ `normalize(parsed)`. Callers may still pass
86
+ `normalize(parsed, { documentVersion: "1.0.0" })` explicitly. That path adds
81
87
  deterministic targets, structural views, source slices, query helpers, and
82
88
  caller-owned annotation target validation. The retained `0.1.0`-compatible
83
89
  document path remains selectable as `documentVersion: "0.0.0"` and
@@ -86,20 +92,23 @@ serialization gates can require it with `compatibilityMode: "legacy-0.1"`.
86
92
  ## CLI
87
93
 
88
94
  The package includes a minimal local CLI for experimenting with one Markdown
89
- file at a time. It runs parse and normalization, then writes the normalized
90
- result as pretty JSON.
95
+ file at a time. The default command runs parse and normalization, then writes
96
+ the normalized result as pretty JSON. The `validate` subcommand runs one
97
+ declarative validation profile against one Markdown file and writes pretty JSON.
91
98
 
92
- After building, run:
99
+ From the repository or package root after building, run:
93
100
 
94
101
  ```sh
95
102
  npm run build
96
- node dist/cli/index.js --file fixtures/representative.md
103
+ node dist/cli/index.js --file fixtures/declarative-validation/examples/operational-spec/pass.md
97
104
  ```
98
105
 
99
- The package binary accepts `--file` or `--path` as aliases for a single file:
106
+ The package binary accepts `--file` or `--path` as aliases for a single file.
107
+ For an npm install in the current project, point at the bundled examples through
108
+ `node_modules/@jasonbelmonti/markdown-engine`:
100
109
 
101
110
  ```sh
102
- markdown-engine --path fixtures/representative.md
111
+ markdown-engine --path node_modules/@jasonbelmonti/markdown-engine/fixtures/declarative-validation/examples/operational-spec/pass.md
103
112
  ```
104
113
 
105
114
  By default, CLI output uses the 1.0 rich IR contract:
@@ -118,7 +127,7 @@ Use `--document-version 0.0.0` when a caller still needs the legacy
118
127
  `0.1.0`-compatible document shape without rich derived views:
119
128
 
120
129
  ```sh
121
- markdown-engine --document-version 0.0.0 --file fixtures/representative.md
130
+ markdown-engine --document-version 0.0.0 --file node_modules/@jasonbelmonti/markdown-engine/fixtures/declarative-validation/examples/operational-spec/pass.md
122
131
  ```
123
132
 
124
133
  The selector accepts spaced or assignment-form syntax, such as
@@ -128,16 +137,47 @@ values are `1.0.0` and `0.0.0`. Missing, invalid, or repeated
128
137
  assignment-form selector is treated as missing. Directory traversal is not
129
138
  supported by this CLI slice.
130
139
 
131
- BEL-952 classifies the default CLI output change as breaking for consumers that
132
- parse CLI JSON without selecting `--document-version 0.0.0`. Migration is to
133
- either consume the rich IR fields (`target`, `sections`, `textSpans`, `tables`,
134
- `lists`, and `links`) or pin the explicit legacy selector until the downstream
135
- consumer is ready. This default-output cutover belongs to the 1.0 release lane,
136
- not a `0.1.x` patch.
140
+ Declarative validation uses the 1.0 document contract and does not accept
141
+ `--document-version`:
142
+
143
+ ```sh
144
+ markdown-engine validate --file node_modules/@jasonbelmonti/markdown-engine/fixtures/declarative-validation/examples/operational-spec/pass.md --profile node_modules/@jasonbelmonti/markdown-engine/fixtures/declarative-validation/examples/operational-spec/profile.yaml
145
+ ```
146
+
147
+ `--format json` is accepted for validation, is the default, and is the only
148
+ supported format. The validation command reads and checks the profile before
149
+ reading the Markdown file. Profile parse/config/compile failures exit with code
150
+ `1` and emit JSON with `stage: "profile"`, empty `ruleResults`, no `profile`,
151
+ and no `evidence`. Markdown read errors and usage errors exit with code `2`.
152
+ Successful validation exits with code `0`; validation or normalization error
153
+ diagnostics exit with code `1`. Validation JSON includes `profile`,
154
+ `ruleResults`, `diagnostics`, and `evidence`.
155
+
156
+ Reader-facing declarative validation examples live under
157
+ `fixtures/declarative-validation/examples/**`. From the repository or package
158
+ root after building, run one passing and one intentionally failing example with:
159
+
160
+ ```sh
161
+ node dist/cli/index.js validate --file fixtures/declarative-validation/examples/operational-spec/pass.md --profile fixtures/declarative-validation/examples/operational-spec/profile.yaml
162
+ node dist/cli/index.js validate --file fixtures/declarative-validation/examples/operational-spec/fail.md --profile fixtures/declarative-validation/examples/operational-spec/profile.yaml
163
+ ```
164
+
165
+ The passing example exits `0`; the failing example exits `1` and prints JSON
166
+ diagnostics for review.
167
+
168
+ Package 2.0 classifies the API normalization default as breaking for consumers
169
+ that call `normalize(parsed)` and expect the legacy `0.0.0` shape. Migration is
170
+ to either consume the rich IR fields (`target`, `sections`, `textSpans`,
171
+ `tables`, `lists`, and `links`) or pin
172
+ `normalize(parsed, { documentVersion: "0.0.0" })` until the downstream consumer
173
+ is ready. The CLI already defaults to the rich IR document contract and keeps
174
+ `--document-version 0.0.0` for explicit legacy output.
137
175
 
138
176
  Contract references:
139
177
 
178
+ - [Consumer website](https://jasonbelmonti.github.io/markdown-engine/)
140
179
  - [Public API contract](docs/contracts/api.md)
180
+ - [Declarative validation contract](docs/contracts/declarative-validation.md)
141
181
  - [Frontmatter contract](docs/contracts/frontmatter.md)
142
182
  - [Markdown Engine 1.0 Rich IR design](docs/design/markdown-engine-1.0-rich-ir-operational-design-spec.md)
143
183
  - [Testing and snapshot operations](docs/testing.md)
@@ -150,6 +190,8 @@ Run the release-readiness gates from the repository root:
150
190
 
151
191
  ```sh
152
192
  npm run docs:rich-ir-contract
193
+ npm run docs:declarative-validation-contract
194
+ npm run audit:declarative-validation-boundary
153
195
  npm run release:verify
154
196
  npm pack --dry-run
155
197
  npm publish --dry-run --access public
@@ -158,34 +200,41 @@ npm publish --dry-run --access public
158
200
  Validation records include:
159
201
 
160
202
  - [EVD-6 rich IR contract docs](docs/evidence/wp-5-evd-6-rich-ir-contract.md)
203
+ - [EVD-6 declarative validation repeatability](docs/evidence/wp-5-evd-6-declarative-validation-repeatability.md)
204
+ - [EVD-7 declarative validation contract review](docs/evidence/wp-5-evd-7-declarative-validation-contract-review.md)
205
+ - [EVD-8 declarative validation boundary audit](docs/evidence/wp-5-evd-8-declarative-validation-boundary-audit.md)
206
+ - [BEL-986 declarative validation MS-2 approval](docs/evidence/bel-986-ms-2-approval.md)
161
207
  - [EVD-8 compatibility and CLI impact](docs/evidence/wp-5-evd-8-compatibility-cli-impact.md)
162
208
  - [EVD-9 1.0 downstream exercise](docs/evidence/wp-6-evd-9-downstream-exercise.md)
209
+ - [EVD-10 declarative validation release-readiness handoff](docs/evidence/wp-6-evd-10-declarative-validation-release-readiness.md)
163
210
  - [EVD-10 1.0 release readiness](docs/evidence/wp-6-evd-10-release-readiness.md)
164
211
  - [EVD-7 release readiness](docs/evidence/wp-6-evd-7-release-readiness.md)
165
212
  - [EVD-9 merge readiness](docs/evidence/wp-6-evd-9-merge-readiness.md)
166
213
  - [EVD-10 rollback containment](docs/evidence/wp-6-evd-10-rollback-containment.md)
167
214
  - [EVD-11 downstream handoff](docs/evidence/wp-6-evd-11-downstream-handoff.md)
215
+ - [BEL-1025 declarative validation example suite](docs/evidence/bel-1025-declarative-validation-example-suite.md)
168
216
 
169
217
  Snapshot baseline updates are operational changes, not routine test-output
170
218
  cleanup. Use the [testing and snapshot operations](docs/testing.md) guide before
171
219
  updating files under `snapshots/**`.
172
220
 
173
- ## 1.0 Release Gate
221
+ ## 2.0 Release Gate
174
222
 
175
- Do not tag or publish the 1.0 release until approval is recorded with:
223
+ Do not tag or publish the 2.0 release until approval is recorded with:
176
224
 
177
- - semver classification and package version decision
225
+ - semver classification distinguishing package version `2.0.0` from document
226
+ contract version `1.0.0`
178
227
  - release/tag decision
179
228
  - rollback and containment notes
180
229
  - downstream profile/runtime consumer confirmation
181
230
  - complete evidence links from EVD-1 through EVD-11
182
231
 
183
- Current release decision: BEL-965 promotes the package metadata and public rich
184
- IR document contract to `1.0.0` after BEL-956 child audit tracks completed and
185
- the release gates passed. The `v1.0.0` git tag must point only at a commit that
186
- passes the validation commands above.
232
+ Current release decision: package `2.0.0` retains the public rich IR document
233
+ contract at `documentVersion: "1.0.0"`, makes that contract the default API
234
+ normalization output, and hardens declarative profile ingestion. The `v2.0.0`
235
+ git tag must point only at a commit that passes the validation commands above.
187
236
 
188
- When 1.0 is approved, publish the package as:
237
+ When 2.0 is approved, publish the package as:
189
238
 
190
239
  ```sh
191
240
  npm publish --access public
package/SECURITY.md CHANGED
@@ -2,9 +2,11 @@
2
2
 
3
3
  ## Supported Versions
4
4
 
5
- `@jasonbelmonti/markdown-engine` is pre-1.0 software. Security fixes are
6
- expected to target the latest published minor version unless a release note
7
- states otherwise.
5
+ Security fixes target the latest published major version of
6
+ `@jasonbelmonti/markdown-engine`. As of the 2.0 release line, fixes are expected
7
+ to land on the latest `2.x` package unless a release note states otherwise.
8
+ Older `0.x` and `1.x` lines are not maintained unless an explicit backport is
9
+ announced.
8
10
 
9
11
  ## Reporting A Vulnerability
10
12
 
@@ -0,0 +1,7 @@
1
+ import type { SourcePosition, SourceRange } from "./diagnostics.js";
2
+ export declare function cloneSourceRangeCandidate(range: unknown): SourceRange | undefined;
3
+ export declare function cloneSourceRange(sourceRange: SourceRange): SourceRange;
4
+ export declare function sourceRangeIsInvalid(range: SourceRange): boolean;
5
+ export declare function sourceRangeContains(container: SourceRange, target: SourceRange): boolean;
6
+ export declare function compareSourcePositions(left: SourcePosition, right: SourcePosition): number;
7
+ //# sourceMappingURL=annotation-source-range.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"annotation-source-range.d.ts","sourceRoot":"","sources":["../../src/api/annotation-source-range.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAQpE,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,OAAO,GACb,WAAW,GAAG,SAAS,CAazB;AAED,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,WAAW,GAAG,WAAW,CAKtE;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAKhE;AAED,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,WAAW,EACtB,MAAM,EAAE,WAAW,GAClB,OAAO,CAMT;AAED,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,cAAc,EACpB,KAAK,EAAE,cAAc,GACpB,MAAM,CAMR"}
@@ -0,0 +1,103 @@
1
+ import { isPlainObject, ownDataProperty, ownRuntimeProperty, } from "./annotation-target-runtime.js";
2
+ export function cloneSourceRangeCandidate(range) {
3
+ if (!isPlainObject(range)) {
4
+ return undefined;
5
+ }
6
+ const start = cloneSourcePositionCandidate(ownDataProperty(range, "start"));
7
+ const end = cloneSourcePositionCandidate(ownDataProperty(range, "end"));
8
+ if (start === undefined || end === undefined) {
9
+ return undefined;
10
+ }
11
+ return { start, end };
12
+ }
13
+ export function cloneSourceRange(sourceRange) {
14
+ return {
15
+ start: cloneSourcePosition(sourceRange.start),
16
+ end: cloneSourcePosition(sourceRange.end),
17
+ };
18
+ }
19
+ export function sourceRangeIsInvalid(range) {
20
+ return (compareLineAndColumn(range.end, range.start) < 0 ||
21
+ sourceOffsetsAreInvalid(range));
22
+ }
23
+ export function sourceRangeContains(container, target) {
24
+ return (compareLineAndColumn(container.start, target.start) <= 0 &&
25
+ compareLineAndColumn(target.end, container.end) <= 0 &&
26
+ sourceOffsetsAreContained(container, target));
27
+ }
28
+ export function compareSourcePositions(left, right) {
29
+ return (left.line - right.line ||
30
+ left.column - right.column ||
31
+ compareOptionalOffsets(left.offset, right.offset));
32
+ }
33
+ function cloneSourcePosition(position) {
34
+ return {
35
+ line: position.line,
36
+ column: position.column,
37
+ ...(position.offset !== undefined ? { offset: position.offset } : {}),
38
+ };
39
+ }
40
+ function cloneSourcePositionCandidate(position) {
41
+ if (!isPlainObject(position)) {
42
+ return undefined;
43
+ }
44
+ const line = ownDataProperty(position, "line");
45
+ const column = ownDataProperty(position, "column");
46
+ const offsetProperty = ownRuntimeProperty(position, "offset");
47
+ const offset = optionalDataPropertyValue(offsetProperty);
48
+ if (!isPositiveInteger(line) ||
49
+ !isPositiveInteger(column) ||
50
+ optionalDataPropertyIsInvalid(offsetProperty) ||
51
+ (offset !== undefined && !isNonNegativeInteger(offset))) {
52
+ return undefined;
53
+ }
54
+ return {
55
+ line,
56
+ column,
57
+ ...(offset !== undefined ? { offset } : {}),
58
+ };
59
+ }
60
+ function optionalDataPropertyValue(property) {
61
+ return property.kind === "data" ? property.value : undefined;
62
+ }
63
+ function optionalDataPropertyIsInvalid(property) {
64
+ return property.kind === "accessor" || property.kind === "unavailable";
65
+ }
66
+ function isPositiveInteger(value) {
67
+ return typeof value === "number" && Number.isInteger(value) && value >= 1;
68
+ }
69
+ function isNonNegativeInteger(value) {
70
+ return typeof value === "number" && Number.isInteger(value) && value >= 0;
71
+ }
72
+ function compareLineAndColumn(left, right) {
73
+ return left.line - right.line || left.column - right.column;
74
+ }
75
+ function compareOptionalOffsets(left, right) {
76
+ if (left === undefined && right === undefined) {
77
+ return 0;
78
+ }
79
+ if (left === undefined) {
80
+ return 1;
81
+ }
82
+ if (right === undefined) {
83
+ return -1;
84
+ }
85
+ return left - right;
86
+ }
87
+ function sourceOffsetsAreInvalid(range) {
88
+ return (range.start.offset !== undefined &&
89
+ range.end.offset !== undefined &&
90
+ range.end.offset < range.start.offset);
91
+ }
92
+ function sourceOffsetsAreContained(container, target) {
93
+ return (sourceOffsetIsContained(container, target.start.offset) &&
94
+ sourceOffsetIsContained(container, target.end.offset));
95
+ }
96
+ function sourceOffsetIsContained(container, offset) {
97
+ if (offset === undefined) {
98
+ return true;
99
+ }
100
+ return ((container.start.offset === undefined || container.start.offset <= offset) &&
101
+ (container.end.offset === undefined || offset <= container.end.offset));
102
+ }
103
+ //# sourceMappingURL=annotation-source-range.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"annotation-source-range.js","sourceRoot":"","sources":["../../src/api/annotation-source-range.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,aAAa,EACb,eAAe,EACf,kBAAkB,GACnB,MAAM,gCAAgC,CAAC;AAExC,MAAM,UAAU,yBAAyB,CACvC,KAAc;IAEd,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,KAAK,GAAG,4BAA4B,CAAC,eAAe,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;IAC5E,MAAM,GAAG,GAAG,4BAA4B,CAAC,eAAe,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;IAExE,IAAI,KAAK,KAAK,SAAS,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;QAC7C,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC;AACxB,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,WAAwB;IACvD,OAAO;QACL,KAAK,EAAE,mBAAmB,CAAC,WAAW,CAAC,KAAK,CAAC;QAC7C,GAAG,EAAE,mBAAmB,CAAC,WAAW,CAAC,GAAG,CAAC;KAC1C,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,KAAkB;IACrD,OAAO,CACL,oBAAoB,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;QAChD,uBAAuB,CAAC,KAAK,CAAC,CAC/B,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,mBAAmB,CACjC,SAAsB,EACtB,MAAmB;IAEnB,OAAO,CACL,oBAAoB,CAAC,SAAS,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC;QACxD,oBAAoB,CAAC,MAAM,CAAC,GAAG,EAAE,SAAS,CAAC,GAAG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C,CAAC,CAAC;IACZ,CAAC;IAED,OAAO,IAAI,GAAG,KAAK,CAAC;AACtB,CAAC;AAED,SAAS,uBAAuB,CAAC,KAAkB;IACjD,OAAO,CACL,KAAK,CAAC,KAAK,CAAC,MAAM,KAAK,SAAS;QAChC,KAAK,CAAC,GAAG,CAAC,MAAM,KAAK,SAAS;QAC9B,KAAK,CAAC,GAAG,CAAC,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,CACtC,CAAC;AACJ,CAAC;AAED,SAAS,yBAAyB,CAChC,SAAsB,EACtB,MAAmB;IAEnB,OAAO,CACL,uBAAuB,CAAC,SAAS,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC;QACvD,uBAAuB,CAAC,SAAS,EAAE,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CACtD,CAAC;AACJ,CAAC;AAED,SAAS,uBAAuB,CAC9B,SAAsB,EACtB,MAA0B;IAE1B,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,CACL,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,KAAK,SAAS,IAAI,SAAS,CAAC,KAAK,CAAC,MAAM,IAAI,MAAM,CAAC;QAC1E,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,KAAK,SAAS,IAAI,MAAM,IAAI,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,CACvE,CAAC;AACJ,CAAC"}
@@ -0,0 +1,10 @@
1
+ export type AnnotationTargetCandidate = {
2
+ kind?: unknown;
3
+ nodeTarget?: unknown;
4
+ sourceRange?: unknown;
5
+ };
6
+ export declare function isAnnotationTargetCandidate(target: unknown): target is AnnotationTargetCandidate;
7
+ export declare function annotationTargetKind(target: AnnotationTargetCandidate): unknown;
8
+ export declare function annotationNodeTarget(target: AnnotationTargetCandidate): unknown;
9
+ export declare function annotationSourceRange(target: AnnotationTargetCandidate): unknown;
10
+ //# sourceMappingURL=annotation-target-candidate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"annotation-target-candidate.d.ts","sourceRoot":"","sources":["../../src/api/annotation-target-candidate.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,yBAAyB,GAAG;IACtC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,OAAO,GACd,MAAM,IAAI,yBAAyB,CAErC;AAED,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,yBAAyB,GAChC,OAAO,CAET;AAED,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,yBAAyB,GAChC,OAAO,CAET;AAED,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,yBAAyB,GAChC,OAAO,CAET"}
@@ -0,0 +1,14 @@
1
+ import { isArray, ownDataProperty } from "./annotation-target-runtime.js";
2
+ export function isAnnotationTargetCandidate(target) {
3
+ return typeof target === "object" && target !== null && !isArray(target);
4
+ }
5
+ export function annotationTargetKind(target) {
6
+ return ownDataProperty(target, "kind");
7
+ }
8
+ export function annotationNodeTarget(target) {
9
+ return ownDataProperty(target, "nodeTarget");
10
+ }
11
+ export function annotationSourceRange(target) {
12
+ return ownDataProperty(target, "sourceRange");
13
+ }
14
+ //# sourceMappingURL=annotation-target-candidate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"annotation-target-candidate.js","sourceRoot":"","sources":["../../src/api/annotation-target-candidate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAQ1E,MAAM,UAAU,2BAA2B,CACzC,MAAe;IAEf,OAAO,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AAC3E,CAAC;AAED,MAAM,UAAU,oBAAoB,CAClC,MAAiC;IAEjC,OAAO,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AACzC,CAAC;AAED,MAAM,UAAU,oBAAoB,CAClC,MAAiC;IAEjC,OAAO,eAAe,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;AAC/C,CAAC;AAED,MAAM,UAAU,qBAAqB,CACnC,MAAiC;IAEjC,OAAO,eAAe,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;AAChD,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { EngineAnnotationTarget, EngineNodeTarget } from "./document.js";
2
+ export declare function cloneAnnotationTarget(target: EngineAnnotationTarget): EngineAnnotationTarget;
3
+ export declare function cloneDiagnosticTarget(target: unknown): unknown;
4
+ export declare function cloneEngineTargetCandidate(target: unknown): EngineNodeTarget | undefined;
5
+ //# sourceMappingURL=annotation-target-cloning.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"annotation-target-cloning.d.ts","sourceRoot":"","sources":["../../src/api/annotation-target-cloning.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,sBAAsB,EACtB,gBAAgB,EACjB,MAAM,eAAe,CAAC;AAwBvB,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,sBAAsB,GAC7B,sBAAsB,CAUxB;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAU9D;AAED,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,OAAO,GACd,gBAAgB,GAAG,SAAS,CAwC9B"}
@@ -0,0 +1,122 @@
1
+ import { arrayLength, isArray, isPlainObject, MAX_NORMALIZED_ARRAY_LENGTH, normalizeRuntimeValue, ownRuntimeProperty, } from "./annotation-target-runtime.js";
2
+ import { annotationNodeTarget, annotationSourceRange, annotationTargetKind, isAnnotationTargetCandidate, } from "./annotation-target-candidate.js";
3
+ import { cloneSourceRangeCandidate } from "./annotation-source-range.js";
4
+ export function cloneAnnotationTarget(target) {
5
+ if (isAnnotationTargetCandidate(target)) {
6
+ const clonedTarget = cloneKnownAnnotationTarget(target);
7
+ if (clonedTarget !== undefined) {
8
+ return clonedTarget;
9
+ }
10
+ }
11
+ return serializableTarget(target);
12
+ }
13
+ export function cloneDiagnosticTarget(target) {
14
+ if (isAnnotationTargetCandidate(target)) {
15
+ const clonedTarget = cloneKnownAnnotationTarget(target);
16
+ if (clonedTarget !== undefined) {
17
+ return clonedTarget;
18
+ }
19
+ }
20
+ return serializableTarget(target);
21
+ }
22
+ export function cloneEngineTargetCandidate(target) {
23
+ if (!isPlainObject(target)) {
24
+ return undefined;
25
+ }
26
+ const kind = ownDataProperty(target, "kind");
27
+ const id = ownDataProperty(target, "id");
28
+ const pathProperty = ownRuntimeProperty(target, "path");
29
+ const nodeTypeProperty = ownRuntimeProperty(target, "nodeType");
30
+ const sourceRangeProperty = ownRuntimeProperty(target, "sourceRange");
31
+ const path = optionalDataPropertyValue(pathProperty);
32
+ const nodeType = optionalDataPropertyValue(nodeTypeProperty);
33
+ const sourceRange = optionalDataPropertyValue(sourceRangeProperty);
34
+ if (kind !== "node" || typeof id !== "string") {
35
+ return undefined;
36
+ }
37
+ const pathClone = path !== undefined ? cloneTargetPathCandidate(path) : undefined;
38
+ const clonedSourceRange = sourceRange !== undefined ? cloneSourceRangeCandidate(sourceRange) : undefined;
39
+ if (pathProperty.kind === "accessor" ||
40
+ optionalDataPropertyIsInvalid(nodeTypeProperty) ||
41
+ optionalDataPropertyIsInvalid(sourceRangeProperty) ||
42
+ pathClone?.kind === "invalid" ||
43
+ (nodeType !== undefined && typeof nodeType !== "string") ||
44
+ (sourceRange !== undefined && clonedSourceRange === undefined)) {
45
+ return undefined;
46
+ }
47
+ return {
48
+ kind,
49
+ id,
50
+ ...(pathClone?.kind === "cloned" ? { path: pathClone.path } : {}),
51
+ ...(typeof nodeType === "string" ? { nodeType } : {}),
52
+ ...(clonedSourceRange !== undefined ? { sourceRange: clonedSourceRange } : {}),
53
+ };
54
+ }
55
+ function serializableTarget(target) {
56
+ return normalizeRuntimeValue(target);
57
+ }
58
+ function cloneKnownAnnotationTarget(target) {
59
+ const kind = annotationTargetKind(target);
60
+ if (kind === "node") {
61
+ const nodeTarget = cloneEngineTargetCandidate(annotationNodeTarget(target));
62
+ if (nodeTarget === undefined) {
63
+ return undefined;
64
+ }
65
+ return {
66
+ kind: "node",
67
+ nodeTarget,
68
+ };
69
+ }
70
+ if (kind === "source") {
71
+ const sourceRange = cloneSourceRangeCandidate(annotationSourceRange(target));
72
+ if (sourceRange === undefined) {
73
+ return undefined;
74
+ }
75
+ return {
76
+ kind: "source",
77
+ sourceRange,
78
+ };
79
+ }
80
+ return undefined;
81
+ }
82
+ function cloneTargetPathCandidate(path) {
83
+ if (!isArray(path)) {
84
+ return { kind: "invalid" };
85
+ }
86
+ const length = arrayLength(path);
87
+ if (length === undefined) {
88
+ return { kind: "unavailable" };
89
+ }
90
+ if (length > MAX_NORMALIZED_ARRAY_LENGTH) {
91
+ return { kind: "unavailable" };
92
+ }
93
+ const clonedPath = [];
94
+ for (let index = 0; index < length; index += 1) {
95
+ const segmentProperty = ownRuntimeProperty(path, String(index));
96
+ if (segmentProperty.kind === "unavailable") {
97
+ return { kind: "unavailable" };
98
+ }
99
+ if (segmentProperty.kind !== "data") {
100
+ return { kind: "invalid" };
101
+ }
102
+ if (!isNonNegativeInteger(segmentProperty.value)) {
103
+ return { kind: "invalid" };
104
+ }
105
+ clonedPath.push(segmentProperty.value);
106
+ }
107
+ return { kind: "cloned", path: clonedPath };
108
+ }
109
+ function ownDataProperty(value, key) {
110
+ const property = ownRuntimeProperty(value, key);
111
+ return property.kind === "data" ? property.value : undefined;
112
+ }
113
+ function optionalDataPropertyValue(property) {
114
+ return property.kind === "data" ? property.value : undefined;
115
+ }
116
+ function optionalDataPropertyIsInvalid(property) {
117
+ return property.kind === "accessor" || property.kind === "unavailable";
118
+ }
119
+ function isNonNegativeInteger(value) {
120
+ return typeof value === "number" && Number.isInteger(value) && value >= 0;
121
+ }
122
+ //# sourceMappingURL=annotation-target-cloning.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"annotation-target-cloning.js","sourceRoot":"","sources":["../../src/api/annotation-target-cloning.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,WAAW,EACX,OAAO,EACP,aAAa,EACb,2BAA2B,EAC3B,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACpB,2BAA2B,GAE5B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AAOzE,MAAM,UAAU,qBAAqB,CACnC,MAA8B;IAE9B,IAAI,2BAA2B,CAAC,MAAM,CAAC,EAAE,CAAC;QACxC,MAAM,YAAY,GAAG,0BAA0B,CAAC,MAAM,CAAC,CAAC;QAExD,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;YAC/B,OAAO,YAAY,CAAC;QACtB,CAAC;IACH,CAAC;IAED,OAAO,kBAAkB,CAAC,MAAM,CAA2B,CAAC;AAC9D,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,MAAe;IACnD,IAAI,2BAA2B,CAAC,MAAM,CAAC,EAAE,CAAC;QACxC,MAAM,YAAY,GAAG,0BAA0B,CAAC,MAAM,CAAC,CAAC;QAExD,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;YAC/B,OAAO,YAAY,CAAC;QACtB,CAAC;IACH,CAAC;IAED,OAAO,kBAAkB,CAAC,MAAM,CAAC,CAAC;AACpC,CAAC;AAED,MAAM,UAAU,0BAA0B,CACxC,MAAe;IAEf,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,CAAC;QAC3B,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,IAAI,GAAG,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7C,MAAM,EAAE,GAAG,eAAe,CAAC,MAAM,EAAE,IAAI,CAAC,CAA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AK,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AAC/D,CAAC;AAED,SAAS,6BAA6B,CAAC,QAA4B;IACjE,OAAO,QAAQ,CAAC,IAAI,KAAK,UAAU,IAAI,QAAQ,CAAC,IAAI,KAAK,aAAa,CAAC;AACzE,CAAC;AAED,SAAS,oBAAoB,CAAC,KAAc;IAC1C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AAC5E,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { EngineTargetDiagnostic } from "./document.js";
2
+ export interface SortableTargetDiagnostic {
3
+ diagnostic: EngineTargetDiagnostic;
4
+ order: number;
5
+ }
6
+ export declare function sortableDiagnostic(diagnostic: EngineTargetDiagnostic, order: number): SortableTargetDiagnostic;
7
+ export declare function compareSortableDiagnostics(left: SortableTargetDiagnostic, right: SortableTargetDiagnostic): number;
8
+ //# sourceMappingURL=annotation-target-diagnostics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"annotation-target-diagnostics.d.ts","sourceRoot":"","sources":["../../src/api/annotation-target-diagnostics.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAS5D,MAAM,WAAW,wBAAwB;IACvC,UAAU,EAAE,sBAAsB,CAAC;IACnC,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,sBAAsB,EAClC,KAAK,EAAE,MAAM,GACZ,wBAAwB,CAQ1B;AAED,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,wBAAwB,EAC9B,KAAK,EAAE,wBAAwB,GAC9B,MAAM,CAcR"}
@@ -0,0 +1,57 @@
1
+ import { FUNCTION_PLACEHOLDER, normalizeRuntimeValue, UNAVAILABLE_PLACEHOLDER, } from "./annotation-target-runtime.js";
2
+ import { cloneDiagnosticTarget } from "./annotation-target-cloning.js";
3
+ import { compareSourcePositions } from "./annotation-source-range.js";
4
+ export function sortableDiagnostic(diagnostic, order) {
5
+ return {
6
+ diagnostic: {
7
+ ...diagnostic,
8
+ target: cloneDiagnosticTarget(diagnostic.target),
9
+ },
10
+ order,
11
+ };
12
+ }
13
+ export function compareSortableDiagnostics(left, right) {
14
+ return (compareOptionalSourceRange(left.diagnostic.sourceRange, right.diagnostic.sourceRange) ||
15
+ compareStrings(left.diagnostic.code, right.diagnostic.code) ||
16
+ compareStrings(left.diagnostic.message, right.diagnostic.message) ||
17
+ compareStrings(targetSortKey(left.diagnostic.target), targetSortKey(right.diagnostic.target)) ||
18
+ left.order - right.order);
19
+ }
20
+ function compareOptionalSourceRange(left, right) {
21
+ if (left === undefined && right === undefined) {
22
+ return 0;
23
+ }
24
+ if (left === undefined) {
25
+ return 1;
26
+ }
27
+ if (right === undefined) {
28
+ return -1;
29
+ }
30
+ return (compareSourcePositions(left.start, right.start) ||
31
+ compareSourcePositions(left.end, right.end));
32
+ }
33
+ function compareStrings(left, right) {
34
+ if (left < right) {
35
+ return -1;
36
+ }
37
+ if (left > right) {
38
+ return 1;
39
+ }
40
+ return 0;
41
+ }
42
+ function targetSortKey(target) {
43
+ try {
44
+ const serialized = JSON.stringify(normalizeRuntimeValue(target));
45
+ return serialized ?? String(target);
46
+ }
47
+ catch {
48
+ if (typeof target === "function") {
49
+ return FUNCTION_PLACEHOLDER;
50
+ }
51
+ if (typeof target === "object" && target !== null) {
52
+ return UNAVAILABLE_PLACEHOLDER;
53
+ }
54
+ return String(target);
55
+ }
56
+ }
57
+ //# sourceMappingURL=annotation-target-diagnostics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"annotation-target-diagnostics.js","sourceRoot":"","sources":["../../src/api/annotation-target-diagnostics.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,uBAAuB,GACxB,MAAM,gCAAgC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QAC/C,sBAAsB,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,CAC5C,CAAC;AACJ,CAAC;AAED,SAAS,cAAc,CAAC,IAAY,EAAE,KAAa;IACjD,IAAI,IAAI,GAAG,KAAK,EAAE,CAAC;QACjB,OAAO,CAAC,CAAC,CAAC;IACZ,CAAC;IAED,IAAI,IAAI,GAAG,KAAK,EAAE,CAAC;QACjB,OAAO,CAAC,CAAC;IACX,CAAC;IAED,OAAO,CAAC,CAAC;AACX,CAAC;AAED,SAAS,aAAa,CAAC,MAAe;IACpC,IAAI,CAAC;QACH,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC,CAAC;QAEjE,OAAO,UAAU,IAAI,MAAM,CAAC,MAAM,CAAC,CAAC;IACtC,CAAC;IAAC,MAAM,CAAC;QACP,IAAI,OAAO,MAAM,KAAK,UAAU,EAAE,CAAC;YACjC,OAAO,oBAAoB,CAAC;QAC9B,CAAC;QAED,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;YAClD,OAAO,uBAAuB,CAAC;QACjC,CAAC;QAED,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC;IACxB,CAAC;AACH,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { EngineAnnotation, EngineAnnotationTarget, EngineDocument, EngineTargetDiagnostic } from "./document.js";
1
+ import type { EngineAnnotation, EngineDocument, EngineTargetDiagnostic } from "./document.js";
2
+ export { cloneAnnotationTarget } from "./annotation-target-cloning.js";
2
3
  export declare function annotationTargetDiagnostics(document: EngineDocument, annotations: readonly EngineAnnotation[]): EngineTargetDiagnostic[];
3
- export declare function cloneAnnotationTarget(target: EngineAnnotationTarget): EngineAnnotationTarget;
4
4
  //# sourceMappingURL=annotation-target-validation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"annotation-target-validation.d.ts","sourceRoot":"","sources":["../../src/api/annotation-target-validation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,gBAAgB,EAChB,sBAAsB,EACtB,cAAc,EAEd,sBAAsB,EACvB,MAAM,eAAe,CAAC;AA8BvB,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,cAAc,EACxB,WAAW,EAAE,SAAS,gBAAgB,EAAE,GACvC,sBAAsB,EAAE,CAkB1B;AAoVD,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,sBAAsB,GAC7B,sBAAsB,CAUxB"}
1
+ {"version":3,"file":"annotation-target-validation.d.ts","sourceRoot":"","sources":["../../src/api/annotation-target-validation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,gBAAgB,EAEhB,cAAc,EAEd,sBAAsB,EACvB,MAAM,eAAe,CAAC;AAsBvB,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAEvE,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,cAAc,EACxB,WAAW,EAAE,SAAS,gBAAgB,EAAE,GACvC,sBAAsB,EAAE,CAkB1B"}