@driftsys/markspec 0.10.2 → 0.11.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 (414) hide show
  1. package/README.md +2 -2
  2. package/esm/compiler/deserialize.d.ts +49 -0
  3. package/esm/compiler/deserialize.d.ts.map +1 -0
  4. package/esm/compiler/deserialize.js +139 -0
  5. package/esm/compiler/manifest.d.ts +3 -0
  6. package/esm/compiler/manifest.d.ts.map +1 -1
  7. package/esm/compiler/manifest.js +9 -3
  8. package/esm/compiler/mod.d.ts.map +1 -1
  9. package/esm/compiler/mod.js +16 -7
  10. package/esm/config/markspec.d.ts +38 -1
  11. package/esm/config/markspec.d.ts.map +1 -1
  12. package/esm/config/markspec.js +127 -2
  13. package/esm/config/mod.d.ts.map +1 -1
  14. package/esm/config/mod.js +143 -147
  15. package/esm/decl/duplicates.d.ts +29 -0
  16. package/esm/decl/duplicates.d.ts.map +1 -0
  17. package/esm/decl/duplicates.js +28 -0
  18. package/esm/decl/mod.d.ts +20 -0
  19. package/esm/decl/mod.d.ts.map +1 -0
  20. package/esm/decl/mod.js +15 -0
  21. package/esm/decl/resolve.d.ts +104 -0
  22. package/esm/decl/resolve.d.ts.map +1 -0
  23. package/esm/decl/resolve.js +66 -0
  24. package/esm/decl/surfaces.d.ts +118 -0
  25. package/esm/decl/surfaces.d.ts.map +1 -0
  26. package/esm/decl/surfaces.js +135 -0
  27. package/esm/decl/table.d.ts +50 -0
  28. package/esm/decl/table.d.ts.map +1 -0
  29. package/esm/decl/table.js +124 -0
  30. package/esm/gates/mod.d.ts +13 -2
  31. package/esm/gates/mod.d.ts.map +1 -1
  32. package/esm/gates/mod.js +38 -11
  33. package/esm/lint/runner.d.ts.map +1 -1
  34. package/esm/lint/runner.js +3 -1
  35. package/esm/lock/acquire_compile.d.ts +31 -0
  36. package/esm/lock/acquire_compile.d.ts.map +1 -0
  37. package/esm/lock/acquire_compile.js +83 -0
  38. package/esm/lock/cache_check.d.ts +28 -0
  39. package/esm/lock/cache_check.d.ts.map +1 -0
  40. package/esm/lock/cache_check.js +51 -0
  41. package/esm/lock/check.d.ts +14 -3
  42. package/esm/lock/check.d.ts.map +1 -1
  43. package/esm/lock/check.js +41 -3
  44. package/esm/lock/git_intent.d.ts +46 -0
  45. package/esm/lock/git_intent.d.ts.map +1 -0
  46. package/esm/lock/git_intent.js +111 -0
  47. package/esm/lock/mod.d.ts +10 -3
  48. package/esm/lock/mod.d.ts.map +1 -1
  49. package/esm/lock/mod.js +7 -1
  50. package/esm/lock/model.d.ts +24 -1
  51. package/esm/lock/model.d.ts.map +1 -1
  52. package/esm/lock/parser.d.ts.map +1 -1
  53. package/esm/lock/parser.js +32 -0
  54. package/esm/lock/pin_assurance.d.ts +20 -0
  55. package/esm/lock/pin_assurance.d.ts.map +1 -0
  56. package/esm/lock/pin_assurance.js +34 -0
  57. package/esm/lock/resolve.d.ts +8 -17
  58. package/esm/lock/resolve.d.ts.map +1 -1
  59. package/esm/lock/resolve.js +7 -67
  60. package/esm/lock/serializer.d.ts.map +1 -1
  61. package/esm/lock/serializer.js +23 -0
  62. package/esm/lock/upstream_common.d.ts +29 -0
  63. package/esm/lock/upstream_common.d.ts.map +1 -0
  64. package/esm/lock/upstream_common.js +38 -0
  65. package/esm/lock/upstream_deps.d.ts +63 -0
  66. package/esm/lock/upstream_deps.d.ts.map +1 -0
  67. package/esm/lock/upstream_deps.js +172 -0
  68. package/esm/lock/upstream_refs.d.ts +69 -0
  69. package/esm/lock/upstream_refs.d.ts.map +1 -0
  70. package/esm/lock/upstream_refs.js +238 -0
  71. package/esm/mod.d.ts +16 -8
  72. package/esm/mod.d.ts.map +1 -1
  73. package/esm/mod.js +15 -5
  74. package/esm/model/mod.d.ts +93 -28
  75. package/esm/model/mod.d.ts.map +1 -1
  76. package/esm/model/mod.js +66 -13
  77. package/esm/model/profile.d.ts +13 -0
  78. package/esm/model/profile.d.ts.map +1 -1
  79. package/esm/parser/directives.d.ts +6 -0
  80. package/esm/parser/directives.d.ts.map +1 -1
  81. package/esm/parser/directives.js +17 -0
  82. package/esm/parser/markdown.d.ts.map +1 -1
  83. package/esm/parser/markdown.js +16 -51
  84. package/esm/profile/manifest.d.ts.map +1 -1
  85. package/esm/profile/manifest.js +20 -3
  86. package/esm/profile/merge.js +7 -0
  87. package/esm/reporter/mod.d.ts +11 -0
  88. package/esm/reporter/mod.d.ts.map +1 -1
  89. package/esm/reporter/mod.js +19 -8
  90. package/esm/typl/assemble.d.ts +53 -0
  91. package/esm/typl/assemble.d.ts.map +1 -0
  92. package/esm/typl/assemble.js +238 -0
  93. package/esm/typl/ast.d.ts +7 -1
  94. package/esm/typl/ast.d.ts.map +1 -1
  95. package/esm/typl/ast.js +3 -0
  96. package/esm/typl/bullet.d.ts +16 -24
  97. package/esm/typl/bullet.d.ts.map +1 -1
  98. package/esm/typl/bullet.js +9 -41
  99. package/esm/typl/citations.d.ts +27 -0
  100. package/esm/typl/citations.d.ts.map +1 -0
  101. package/esm/typl/citations.js +16 -0
  102. package/esm/typl/diagnostics.d.ts +2 -2
  103. package/esm/typl/diagnostics.d.ts.map +1 -1
  104. package/esm/typl/diagnostics.js +18 -0
  105. package/esm/typl/fence.d.ts +12 -21
  106. package/esm/typl/fence.d.ts.map +1 -1
  107. package/esm/typl/fence.js +5 -20
  108. package/esm/typl/grammar.d.ts.map +1 -1
  109. package/esm/typl/grammar.js +6 -0
  110. package/esm/typl/inline.d.ts +15 -24
  111. package/esm/typl/inline.d.ts.map +1 -1
  112. package/esm/typl/inline.js +6 -44
  113. package/esm/typl/lexer.d.ts.map +1 -1
  114. package/esm/typl/lexer.js +25 -4
  115. package/esm/typl/mod.d.ts +8 -2
  116. package/esm/typl/mod.d.ts.map +1 -1
  117. package/esm/typl/mod.js +5 -1
  118. package/esm/typl/recognize.d.ts +14 -0
  119. package/esm/typl/recognize.d.ts.map +1 -0
  120. package/esm/typl/recognize.js +19 -0
  121. package/esm/typl/registry.d.ts +1 -1
  122. package/esm/typl/resolve.d.ts +31 -0
  123. package/esm/typl/resolve.d.ts.map +1 -0
  124. package/esm/typl/resolve.js +27 -0
  125. package/esm/typl/table.d.ts +52 -0
  126. package/esm/typl/table.d.ts.map +1 -0
  127. package/esm/typl/table.js +69 -0
  128. package/esm/typl/validator.d.ts +24 -5
  129. package/esm/typl/validator.d.ts.map +1 -1
  130. package/esm/typl/validator.js +55 -75
  131. package/esm/upstream/mod.d.ts +45 -0
  132. package/esm/upstream/mod.d.ts.map +1 -0
  133. package/esm/upstream/mod.js +98 -0
  134. package/esm/upstream/project.d.ts +33 -0
  135. package/esm/upstream/project.d.ts.map +1 -0
  136. package/esm/upstream/project.js +38 -0
  137. package/esm/upstream/refs.d.ts +23 -0
  138. package/esm/upstream/refs.d.ts.map +1 -0
  139. package/esm/upstream/refs.js +71 -0
  140. package/esm/util/paths.d.ts +14 -0
  141. package/esm/util/paths.d.ts.map +1 -0
  142. package/esm/util/paths.js +22 -0
  143. package/esm/uxil/assemble.d.ts +38 -0
  144. package/esm/uxil/assemble.d.ts.map +1 -0
  145. package/esm/uxil/assemble.js +268 -0
  146. package/esm/uxil/ast.d.ts +63 -0
  147. package/esm/uxil/ast.d.ts.map +1 -0
  148. package/esm/uxil/ast.js +9 -0
  149. package/esm/uxil/citations.d.ts +27 -0
  150. package/esm/uxil/citations.d.ts.map +1 -0
  151. package/esm/uxil/citations.js +25 -0
  152. package/esm/uxil/diagnostics.d.ts +39 -0
  153. package/esm/uxil/diagnostics.d.ts.map +1 -0
  154. package/esm/uxil/diagnostics.js +135 -0
  155. package/esm/uxil/grammar.d.ts +72 -0
  156. package/esm/uxil/grammar.d.ts.map +1 -0
  157. package/esm/uxil/grammar.js +505 -0
  158. package/esm/uxil/lexer.d.ts +23 -0
  159. package/esm/uxil/lexer.d.ts.map +1 -0
  160. package/esm/uxil/lexer.js +58 -0
  161. package/esm/uxil/mod.d.ts +32 -0
  162. package/esm/uxil/mod.d.ts.map +1 -0
  163. package/esm/uxil/mod.js +11 -0
  164. package/esm/uxil/projection.d.ts +40 -0
  165. package/esm/uxil/projection.d.ts.map +1 -0
  166. package/esm/uxil/projection.js +41 -0
  167. package/esm/uxil/recognize.d.ts +16 -0
  168. package/esm/uxil/recognize.d.ts.map +1 -0
  169. package/esm/uxil/recognize.js +28 -0
  170. package/esm/uxil/registry.d.ts +37 -0
  171. package/esm/uxil/registry.d.ts.map +1 -0
  172. package/esm/uxil/registry.js +29 -0
  173. package/esm/uxil/surfaces.d.ts +36 -0
  174. package/esm/uxil/surfaces.d.ts.map +1 -0
  175. package/esm/uxil/surfaces.js +34 -0
  176. package/esm/uxil/validator.d.ts +36 -0
  177. package/esm/uxil/validator.d.ts.map +1 -0
  178. package/esm/uxil/validator.js +139 -0
  179. package/esm/uxil/vocab.d.ts +33 -0
  180. package/esm/uxil/vocab.d.ts.map +1 -0
  181. package/esm/uxil/vocab.js +36 -0
  182. package/esm/validator/body_blocks.d.ts.map +1 -1
  183. package/esm/validator/body_blocks.js +3 -9
  184. package/esm/validator/caption_convention.d.ts +2 -1
  185. package/esm/validator/caption_convention.d.ts.map +1 -1
  186. package/esm/validator/caption_convention.js +2 -1
  187. package/esm/validator/corpus.d.ts.map +1 -1
  188. package/esm/validator/corpus.js +40 -17
  189. package/esm/validator/discipline.d.ts +6 -4
  190. package/esm/validator/discipline.d.ts.map +1 -1
  191. package/esm/validator/discipline.js +6 -4
  192. package/esm/validator/mod.d.ts.map +1 -1
  193. package/esm/validator/mod.js +28 -15
  194. package/esm/validator/pipeline.d.ts +11 -1
  195. package/esm/validator/pipeline.d.ts.map +1 -1
  196. package/esm/validator/pipeline.js +68 -18
  197. package/esm/validator/trace_types.d.ts +9 -2
  198. package/esm/validator/trace_types.d.ts.map +1 -1
  199. package/esm/validator/trace_types.js +21 -5
  200. package/esm/validator/traceability.d.ts +15 -3
  201. package/esm/validator/traceability.d.ts.map +1 -1
  202. package/esm/validator/traceability.js +39 -4
  203. package/esm/validator/types.d.ts.map +1 -1
  204. package/esm/validator/types.js +11 -1
  205. package/esm/validator/uxil_family.d.ts +43 -0
  206. package/esm/validator/uxil_family.d.ts.map +1 -0
  207. package/esm/validator/uxil_family.js +52 -0
  208. package/package.json +1 -1
  209. package/script/compiler/deserialize.d.ts +49 -0
  210. package/script/compiler/deserialize.d.ts.map +1 -0
  211. package/script/compiler/deserialize.js +144 -0
  212. package/script/compiler/manifest.d.ts +3 -0
  213. package/script/compiler/manifest.d.ts.map +1 -1
  214. package/script/compiler/manifest.js +10 -3
  215. package/script/compiler/mod.d.ts.map +1 -1
  216. package/script/compiler/mod.js +15 -6
  217. package/script/config/markspec.d.ts +38 -1
  218. package/script/config/markspec.d.ts.map +1 -1
  219. package/script/config/markspec.js +129 -3
  220. package/script/config/mod.d.ts.map +1 -1
  221. package/script/config/mod.js +143 -147
  222. package/script/decl/duplicates.d.ts +29 -0
  223. package/script/decl/duplicates.d.ts.map +1 -0
  224. package/script/decl/duplicates.js +31 -0
  225. package/script/decl/mod.d.ts +20 -0
  226. package/script/decl/mod.d.ts.map +1 -0
  227. package/script/decl/mod.js +26 -0
  228. package/script/decl/resolve.d.ts +104 -0
  229. package/script/decl/resolve.d.ts.map +1 -0
  230. package/script/decl/resolve.js +70 -0
  231. package/script/decl/surfaces.d.ts +118 -0
  232. package/script/decl/surfaces.d.ts.map +1 -0
  233. package/script/decl/surfaces.js +141 -0
  234. package/script/decl/table.d.ts +50 -0
  235. package/script/decl/table.d.ts.map +1 -0
  236. package/script/decl/table.js +127 -0
  237. package/script/gates/mod.d.ts +13 -2
  238. package/script/gates/mod.d.ts.map +1 -1
  239. package/script/gates/mod.js +37 -10
  240. package/script/lint/runner.d.ts.map +1 -1
  241. package/script/lint/runner.js +3 -1
  242. package/script/lock/acquire_compile.d.ts +31 -0
  243. package/script/lock/acquire_compile.d.ts.map +1 -0
  244. package/script/lock/acquire_compile.js +86 -0
  245. package/script/lock/cache_check.d.ts +28 -0
  246. package/script/lock/cache_check.d.ts.map +1 -0
  247. package/script/lock/cache_check.js +54 -0
  248. package/script/lock/check.d.ts +14 -3
  249. package/script/lock/check.d.ts.map +1 -1
  250. package/script/lock/check.js +41 -3
  251. package/script/lock/git_intent.d.ts +46 -0
  252. package/script/lock/git_intent.d.ts.map +1 -0
  253. package/script/lock/git_intent.js +115 -0
  254. package/script/lock/mod.d.ts +10 -3
  255. package/script/lock/mod.d.ts.map +1 -1
  256. package/script/lock/mod.js +16 -2
  257. package/script/lock/model.d.ts +24 -1
  258. package/script/lock/model.d.ts.map +1 -1
  259. package/script/lock/parser.d.ts.map +1 -1
  260. package/script/lock/parser.js +32 -0
  261. package/script/lock/pin_assurance.d.ts +20 -0
  262. package/script/lock/pin_assurance.d.ts.map +1 -0
  263. package/script/lock/pin_assurance.js +37 -0
  264. package/script/lock/resolve.d.ts +8 -17
  265. package/script/lock/resolve.d.ts.map +1 -1
  266. package/script/lock/resolve.js +7 -68
  267. package/script/lock/serializer.d.ts.map +1 -1
  268. package/script/lock/serializer.js +23 -0
  269. package/script/lock/upstream_common.d.ts +29 -0
  270. package/script/lock/upstream_common.d.ts.map +1 -0
  271. package/script/lock/upstream_common.js +42 -0
  272. package/script/lock/upstream_deps.d.ts +63 -0
  273. package/script/lock/upstream_deps.d.ts.map +1 -0
  274. package/script/lock/upstream_deps.js +175 -0
  275. package/script/lock/upstream_refs.d.ts +69 -0
  276. package/script/lock/upstream_refs.d.ts.map +1 -0
  277. package/script/lock/upstream_refs.js +244 -0
  278. package/script/mod.d.ts +16 -8
  279. package/script/mod.d.ts.map +1 -1
  280. package/script/mod.js +40 -7
  281. package/script/model/mod.d.ts +93 -28
  282. package/script/model/mod.d.ts.map +1 -1
  283. package/script/model/mod.js +70 -14
  284. package/script/model/profile.d.ts +13 -0
  285. package/script/model/profile.d.ts.map +1 -1
  286. package/script/parser/directives.d.ts +6 -0
  287. package/script/parser/directives.d.ts.map +1 -1
  288. package/script/parser/directives.js +18 -0
  289. package/script/parser/markdown.d.ts.map +1 -1
  290. package/script/parser/markdown.js +15 -50
  291. package/script/profile/manifest.d.ts.map +1 -1
  292. package/script/profile/manifest.js +20 -3
  293. package/script/profile/merge.js +7 -0
  294. package/script/reporter/mod.d.ts +11 -0
  295. package/script/reporter/mod.d.ts.map +1 -1
  296. package/script/reporter/mod.js +18 -7
  297. package/script/typl/assemble.d.ts +53 -0
  298. package/script/typl/assemble.d.ts.map +1 -0
  299. package/script/typl/assemble.js +241 -0
  300. package/script/typl/ast.d.ts +7 -1
  301. package/script/typl/ast.d.ts.map +1 -1
  302. package/script/typl/ast.js +3 -0
  303. package/script/typl/bullet.d.ts +16 -24
  304. package/script/typl/bullet.d.ts.map +1 -1
  305. package/script/typl/bullet.js +10 -42
  306. package/script/typl/citations.d.ts +27 -0
  307. package/script/typl/citations.d.ts.map +1 -0
  308. package/script/typl/citations.js +20 -0
  309. package/script/typl/diagnostics.d.ts +2 -2
  310. package/script/typl/diagnostics.d.ts.map +1 -1
  311. package/script/typl/diagnostics.js +18 -0
  312. package/script/typl/fence.d.ts +12 -21
  313. package/script/typl/fence.d.ts.map +1 -1
  314. package/script/typl/fence.js +5 -20
  315. package/script/typl/grammar.d.ts.map +1 -1
  316. package/script/typl/grammar.js +6 -0
  317. package/script/typl/inline.d.ts +15 -24
  318. package/script/typl/inline.d.ts.map +1 -1
  319. package/script/typl/inline.js +6 -44
  320. package/script/typl/lexer.d.ts.map +1 -1
  321. package/script/typl/lexer.js +25 -4
  322. package/script/typl/mod.d.ts +8 -2
  323. package/script/typl/mod.d.ts.map +1 -1
  324. package/script/typl/mod.js +14 -2
  325. package/script/typl/recognize.d.ts +14 -0
  326. package/script/typl/recognize.d.ts.map +1 -0
  327. package/script/typl/recognize.js +22 -0
  328. package/script/typl/registry.d.ts +1 -1
  329. package/script/typl/resolve.d.ts +31 -0
  330. package/script/typl/resolve.d.ts.map +1 -0
  331. package/script/typl/resolve.js +33 -0
  332. package/script/typl/table.d.ts +52 -0
  333. package/script/typl/table.d.ts.map +1 -0
  334. package/script/typl/table.js +75 -0
  335. package/script/typl/validator.d.ts +24 -5
  336. package/script/typl/validator.d.ts.map +1 -1
  337. package/script/typl/validator.js +55 -75
  338. package/script/upstream/mod.d.ts +45 -0
  339. package/script/upstream/mod.d.ts.map +1 -0
  340. package/script/upstream/mod.js +101 -0
  341. package/script/upstream/project.d.ts +33 -0
  342. package/script/upstream/project.d.ts.map +1 -0
  343. package/script/upstream/project.js +41 -0
  344. package/script/upstream/refs.d.ts +23 -0
  345. package/script/upstream/refs.d.ts.map +1 -0
  346. package/script/upstream/refs.js +74 -0
  347. package/script/util/paths.d.ts +14 -0
  348. package/script/util/paths.d.ts.map +1 -0
  349. package/script/util/paths.js +25 -0
  350. package/script/uxil/assemble.d.ts +38 -0
  351. package/script/uxil/assemble.d.ts.map +1 -0
  352. package/script/uxil/assemble.js +272 -0
  353. package/script/uxil/ast.d.ts +63 -0
  354. package/script/uxil/ast.d.ts.map +1 -0
  355. package/script/uxil/ast.js +10 -0
  356. package/script/uxil/citations.d.ts +27 -0
  357. package/script/uxil/citations.d.ts.map +1 -0
  358. package/script/uxil/citations.js +29 -0
  359. package/script/uxil/diagnostics.d.ts +39 -0
  360. package/script/uxil/diagnostics.d.ts.map +1 -0
  361. package/script/uxil/diagnostics.js +140 -0
  362. package/script/uxil/grammar.d.ts +72 -0
  363. package/script/uxil/grammar.d.ts.map +1 -0
  364. package/script/uxil/grammar.js +511 -0
  365. package/script/uxil/lexer.d.ts +23 -0
  366. package/script/uxil/lexer.d.ts.map +1 -0
  367. package/script/uxil/lexer.js +61 -0
  368. package/script/uxil/mod.d.ts +32 -0
  369. package/script/uxil/mod.d.ts.map +1 -0
  370. package/script/uxil/mod.js +37 -0
  371. package/script/uxil/projection.d.ts +40 -0
  372. package/script/uxil/projection.d.ts.map +1 -0
  373. package/script/uxil/projection.js +44 -0
  374. package/script/uxil/recognize.d.ts +16 -0
  375. package/script/uxil/recognize.d.ts.map +1 -0
  376. package/script/uxil/recognize.js +31 -0
  377. package/script/uxil/registry.d.ts +37 -0
  378. package/script/uxil/registry.d.ts.map +1 -0
  379. package/script/uxil/registry.js +32 -0
  380. package/script/uxil/surfaces.d.ts +36 -0
  381. package/script/uxil/surfaces.d.ts.map +1 -0
  382. package/script/uxil/surfaces.js +39 -0
  383. package/script/uxil/validator.d.ts +36 -0
  384. package/script/uxil/validator.d.ts.map +1 -0
  385. package/script/uxil/validator.js +142 -0
  386. package/script/uxil/vocab.d.ts +33 -0
  387. package/script/uxil/vocab.d.ts.map +1 -0
  388. package/script/uxil/vocab.js +41 -0
  389. package/script/validator/body_blocks.d.ts.map +1 -1
  390. package/script/validator/body_blocks.js +3 -9
  391. package/script/validator/caption_convention.d.ts +2 -1
  392. package/script/validator/caption_convention.d.ts.map +1 -1
  393. package/script/validator/caption_convention.js +2 -1
  394. package/script/validator/corpus.d.ts.map +1 -1
  395. package/script/validator/corpus.js +39 -16
  396. package/script/validator/discipline.d.ts +6 -4
  397. package/script/validator/discipline.d.ts.map +1 -1
  398. package/script/validator/discipline.js +6 -4
  399. package/script/validator/mod.d.ts.map +1 -1
  400. package/script/validator/mod.js +27 -14
  401. package/script/validator/pipeline.d.ts +11 -1
  402. package/script/validator/pipeline.d.ts.map +1 -1
  403. package/script/validator/pipeline.js +67 -17
  404. package/script/validator/trace_types.d.ts +9 -2
  405. package/script/validator/trace_types.d.ts.map +1 -1
  406. package/script/validator/trace_types.js +20 -4
  407. package/script/validator/traceability.d.ts +15 -3
  408. package/script/validator/traceability.d.ts.map +1 -1
  409. package/script/validator/traceability.js +38 -3
  410. package/script/validator/types.d.ts.map +1 -1
  411. package/script/validator/types.js +10 -0
  412. package/script/validator/uxil_family.d.ts +43 -0
  413. package/script/validator/uxil_family.d.ts.map +1 -0
  414. package/script/validator/uxil_family.js +56 -0
@@ -0,0 +1,118 @@
1
+ /**
2
+ * @module core/decl/surfaces
3
+ *
4
+ * DSL-agnostic declaration-surface machinery. Walks a MarkSpec entry body
5
+ * and extracts every *declaration site* on each of the three embedding
6
+ * surfaces, returning a common declaration node:
7
+ *
8
+ * - **fence** — a fenced code block whose info-string a DSL claims
9
+ * (e.g. ```typl). {@linkcode extractFenceDeclarations}
10
+ * - **bullet** — a list item whose first paragraph is a declaration.
11
+ * {@linkcode extractNestedBulletDeclarations}
12
+ * - **inline** — a CommonMark code span whose text is a declaration.
13
+ * {@linkcode extractInlineDeclarations}
14
+ *
15
+ * Each walker is parameterized by a *recognizer* — the only DSL-specific
16
+ * input — and knows nothing about typl, uxil, or any concrete vocabulary.
17
+ * A DSL host (typl today; uxil and the table surface later) supplies the
18
+ * recognizer and consumes the returned {@linkcode BlockDeclaration} /
19
+ * {@linkcode InlineDeclaration} nodes.
20
+ *
21
+ * Extracted from the typl surface adapters (ADR-019) so §A of the uxil
22
+ * epic (#717) can share one substrate. typl's fence / bullet / inline
23
+ * modules are thin adapters over these functions and their observable
24
+ * output is unchanged.
25
+ */
26
+ import type { BodyBlock, SourceRange } from "../ast/nodes.js";
27
+ import type { BodyToken, SourceLocation } from "../model/mod.js";
28
+ /**
29
+ * A declaration found on a block surface (fenced code block or bullet
30
+ * paragraph). Carries the raw DSL `source` and the node's body-relative
31
+ * {@linkcode SourceRange} — the anchor a DSL host uses to bridge parse
32
+ * diagnostics back to file positions.
33
+ */
34
+ export interface BlockDeclaration {
35
+ /** Raw DSL source: the fence body, or the bullet's paragraph text. */
36
+ readonly source: string;
37
+ /** Source range of the fence, or of the bullet's first paragraph. */
38
+ readonly range: SourceRange;
39
+ }
40
+ /**
41
+ * A declaration found in an inline code span. Carries the raw DSL
42
+ * `source` (backtick delimiters stripped) and the span's file-relative
43
+ * {@linkcode SourceLocation} (the position `Entry.bodyTokens` records).
44
+ */
45
+ export interface InlineDeclaration {
46
+ /** Raw DSL source: the code span's inner text, backticks stripped. */
47
+ readonly source: string;
48
+ /** File-relative location of the code span. */
49
+ readonly location: SourceLocation;
50
+ /**
51
+ * Column of the span's inner text: `location.column` plus the opening
52
+ * delimiter width. A DSL host composes span-relative parse-diagnostic
53
+ * columns against this, not `location.column` (#727). Note the token
54
+ * model canonicalises `text` to single-backtick delimiters, so the
55
+ * width is 1 in practice — a double-backtick original anchors one
56
+ * column left (accepted wart, same class as the typl indent wart).
57
+ */
58
+ readonly innerColumn: number;
59
+ }
60
+ /** Recognizer for the fence surface: does this info-string host the DSL? */
61
+ export type FenceRecognizer = (lang: string | undefined) => boolean;
62
+ /** Recognizer for the bullet / inline surfaces: is this text a declaration? */
63
+ export type TextRecognizer = (text: string) => boolean;
64
+ /**
65
+ * Walk a body AST and return every fenced code block whose info-string
66
+ * satisfies `matchLang`. Recurses into container nodes (ListNode via
67
+ * ListItemNode.blocks) so fences nested inside list items are found.
68
+ *
69
+ * BlockquoteNode and NoteNode carry only InlineContent (not nested
70
+ * BodyBlock[]), so they are not recursed into. Returns declarations in
71
+ * source order (depth-first traversal).
72
+ */
73
+ export declare function extractFenceDeclarations(blocks: readonly BodyBlock[], matchLang: FenceRecognizer): readonly BlockDeclaration[];
74
+ /**
75
+ * A bullet declaration with its structural parent: the index (into the
76
+ * returned array) of the nearest enclosing extracted declaration, or
77
+ * `undefined` at top level. Parents always precede children in the
78
+ * depth-first output order, so `parent < index` holds for every link.
79
+ * The base-resolution engine (resolve.ts) consumes these links to build
80
+ * its innermost-wins scope chains (#723).
81
+ */
82
+ export interface NestedBlockDeclaration extends BlockDeclaration {
83
+ readonly parent?: number;
84
+ }
85
+ /**
86
+ * Walk a body AST and return every bullet-list item whose first paragraph
87
+ * satisfies `matchText`, in depth-first source order, each with a `parent`
88
+ * link to its nearest enclosing extracted declaration (or `undefined` at
89
+ * top level). Recurses through ListNode → ListItemNode.blocks for nested
90
+ * lists. Mixed lists are supported: items whose first paragraph matches
91
+ * are extracted; non-matching bullets are left alone. A DSL host walks
92
+ * the `parent` links to build the {@linkcode BaseScope} chain a nested
93
+ * declaration resolves against.
94
+ */
95
+ export declare function extractNestedBulletDeclarations(blocks: readonly BodyBlock[], matchText: TextRecognizer): readonly NestedBlockDeclaration[];
96
+ /**
97
+ * Strip the surrounding backtick delimiter(s) from an inline-code token's
98
+ * `text` field. `body_tokens.ts` stores inline-code text as `` `value` ``
99
+ * (with backtick delimiters); a DSL recognizer and parser need the inner
100
+ * value only.
101
+ *
102
+ * Handles both single-backtick (`` `…` ``) and double-backtick (` ``…`` `)
103
+ * delimiters. Returns the original string unchanged when it does not start
104
+ * and end with a matching backtick fence.
105
+ */
106
+ export declare function stripCodeSpanDelimiters(text: string): string;
107
+ /**
108
+ * Filter `bodyTokens` to inline-code spans whose contents (backticks
109
+ * stripped) satisfy `matchText`. Returns declarations in source order
110
+ * (the bodyTokens contract guarantees source order).
111
+ *
112
+ * `inline-code` tokens store their `text` field with surrounding backtick
113
+ * delimiters (e.g. `` `$X : signal` ``). This function strips those
114
+ * delimiters via {@linkcode stripCodeSpanDelimiters} before recognizing
115
+ * and before setting `source`, so the DSL parser receives the raw source.
116
+ */
117
+ export declare function extractInlineDeclarations(bodyTokens: readonly BodyToken[], matchText: TextRecognizer): readonly InlineDeclaration[];
118
+ //# sourceMappingURL=surfaces.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"surfaces.d.ts","sourceRoot":"","sources":["../../src/decl/surfaces.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjE;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B,sEAAsE;IACtE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,qEAAqE;IACrE,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;CAC7B;AAED;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,sEAAsE;IACtE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,+CAA+C;IAC/C,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC;;;;;;;OAOG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED,4EAA4E;AAC5E,MAAM,MAAM,eAAe,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,KAAK,OAAO,CAAC;AAEpE,+EAA+E;AAC/E,MAAM,MAAM,cAAc,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;AAEvD;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,SAAS,SAAS,EAAE,EAC5B,SAAS,EAAE,eAAe,GACzB,SAAS,gBAAgB,EAAE,CAY7B;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,sBAAuB,SAAQ,gBAAgB;IAC9D,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;;;;GASG;AACH,wBAAgB,+BAA+B,CAC7C,MAAM,EAAE,SAAS,SAAS,EAAE,EAC5B,SAAS,EAAE,cAAc,GACxB,SAAS,sBAAsB,EAAE,CA8BnC;AAED;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAQ5D;AAED;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CACvC,UAAU,EAAE,SAAS,SAAS,EAAE,EAChC,SAAS,EAAE,cAAc,GACxB,SAAS,iBAAiB,EAAE,CAc9B"}
@@ -0,0 +1,135 @@
1
+ /**
2
+ * @module core/decl/surfaces
3
+ *
4
+ * DSL-agnostic declaration-surface machinery. Walks a MarkSpec entry body
5
+ * and extracts every *declaration site* on each of the three embedding
6
+ * surfaces, returning a common declaration node:
7
+ *
8
+ * - **fence** — a fenced code block whose info-string a DSL claims
9
+ * (e.g. ```typl). {@linkcode extractFenceDeclarations}
10
+ * - **bullet** — a list item whose first paragraph is a declaration.
11
+ * {@linkcode extractNestedBulletDeclarations}
12
+ * - **inline** — a CommonMark code span whose text is a declaration.
13
+ * {@linkcode extractInlineDeclarations}
14
+ *
15
+ * Each walker is parameterized by a *recognizer* — the only DSL-specific
16
+ * input — and knows nothing about typl, uxil, or any concrete vocabulary.
17
+ * A DSL host (typl today; uxil and the table surface later) supplies the
18
+ * recognizer and consumes the returned {@linkcode BlockDeclaration} /
19
+ * {@linkcode InlineDeclaration} nodes.
20
+ *
21
+ * Extracted from the typl surface adapters (ADR-019) so §A of the uxil
22
+ * epic (#717) can share one substrate. typl's fence / bullet / inline
23
+ * modules are thin adapters over these functions and their observable
24
+ * output is unchanged.
25
+ */
26
+ /**
27
+ * Walk a body AST and return every fenced code block whose info-string
28
+ * satisfies `matchLang`. Recurses into container nodes (ListNode via
29
+ * ListItemNode.blocks) so fences nested inside list items are found.
30
+ *
31
+ * BlockquoteNode and NoteNode carry only InlineContent (not nested
32
+ * BodyBlock[]), so they are not recursed into. Returns declarations in
33
+ * source order (depth-first traversal).
34
+ */
35
+ export function extractFenceDeclarations(blocks, matchLang) {
36
+ const results = [];
37
+ for (const block of blocks) {
38
+ if (block.kind === "code" && matchLang(block.lang)) {
39
+ results.push({ source: block.text, range: block.range });
40
+ }
41
+ else if (block.kind === "list") {
42
+ for (const item of block.items) {
43
+ results.push(...extractFenceDeclarations(item.blocks, matchLang));
44
+ }
45
+ }
46
+ }
47
+ return results;
48
+ }
49
+ /**
50
+ * Walk a body AST and return every bullet-list item whose first paragraph
51
+ * satisfies `matchText`, in depth-first source order, each with a `parent`
52
+ * link to its nearest enclosing extracted declaration (or `undefined` at
53
+ * top level). Recurses through ListNode → ListItemNode.blocks for nested
54
+ * lists. Mixed lists are supported: items whose first paragraph matches
55
+ * are extracted; non-matching bullets are left alone. A DSL host walks
56
+ * the `parent` links to build the {@linkcode BaseScope} chain a nested
57
+ * declaration resolves against.
58
+ */
59
+ export function extractNestedBulletDeclarations(blocks, matchText) {
60
+ const results = [];
61
+ const walk = (blocks, parent) => {
62
+ for (const block of blocks) {
63
+ if (block.kind !== "list")
64
+ continue;
65
+ for (const item of block.items) {
66
+ if (item.blocks.length === 0)
67
+ continue;
68
+ const first = item.blocks[0];
69
+ let itemParent = parent;
70
+ if (first.kind === "paragraph" && matchText(first.content.text)) {
71
+ results.push({
72
+ source: first.content.text,
73
+ range: first.range,
74
+ parent,
75
+ });
76
+ itemParent = results.length - 1;
77
+ }
78
+ if (item.blocks.length > 1) {
79
+ walk(item.blocks.slice(1), itemParent);
80
+ }
81
+ else if (first.kind === "list") {
82
+ walk([first], itemParent);
83
+ }
84
+ }
85
+ }
86
+ };
87
+ walk(blocks, undefined);
88
+ return results;
89
+ }
90
+ /**
91
+ * Strip the surrounding backtick delimiter(s) from an inline-code token's
92
+ * `text` field. `body_tokens.ts` stores inline-code text as `` `value` ``
93
+ * (with backtick delimiters); a DSL recognizer and parser need the inner
94
+ * value only.
95
+ *
96
+ * Handles both single-backtick (`` `…` ``) and double-backtick (` ``…`` `)
97
+ * delimiters. Returns the original string unchanged when it does not start
98
+ * and end with a matching backtick fence.
99
+ */
100
+ export function stripCodeSpanDelimiters(text) {
101
+ if (text.startsWith("``") && text.endsWith("``") && text.length > 4) {
102
+ return text.slice(2, -2);
103
+ }
104
+ if (text.startsWith("`") && text.endsWith("`") && text.length > 2) {
105
+ return text.slice(1, -1);
106
+ }
107
+ return text;
108
+ }
109
+ /**
110
+ * Filter `bodyTokens` to inline-code spans whose contents (backticks
111
+ * stripped) satisfy `matchText`. Returns declarations in source order
112
+ * (the bodyTokens contract guarantees source order).
113
+ *
114
+ * `inline-code` tokens store their `text` field with surrounding backtick
115
+ * delimiters (e.g. `` `$X : signal` ``). This function strips those
116
+ * delimiters via {@linkcode stripCodeSpanDelimiters} before recognizing
117
+ * and before setting `source`, so the DSL parser receives the raw source.
118
+ */
119
+ export function extractInlineDeclarations(bodyTokens, matchText) {
120
+ const results = [];
121
+ for (const token of bodyTokens) {
122
+ if (token.kind !== "inline-code")
123
+ continue;
124
+ const inner = stripCodeSpanDelimiters(token.text);
125
+ if (!matchText(inner))
126
+ continue;
127
+ const delim = token.text.startsWith("``") ? 2 : 1;
128
+ results.push({
129
+ source: inner,
130
+ location: token.location,
131
+ innerColumn: token.location.column + delim,
132
+ });
133
+ }
134
+ return results;
135
+ }
@@ -0,0 +1,50 @@
1
+ /**
2
+ * @module core/decl/table
3
+ *
4
+ * Table declaration surface (uxil epic #717 §A / S3). A fourth embedding
5
+ * surface on the shared declaration machinery (alongside fence, bullet, and
6
+ * inline): each **data row** of a GFM table is one declaration, and the
7
+ * table's `Table:` caption may carry a base that the entry-local resolver
8
+ * (S4) consumes.
9
+ *
10
+ * DSL-agnostic, like its siblings: the caller supplies a `rowToSource`
11
+ * recognizer that maps a row's cell texts to a declaration source (or
12
+ * `undefined` to skip a non-declaration / malformed row), and parses the
13
+ * actual base ref out of the surfaced {@linkcode TableRowDeclaration.captionText}
14
+ * itself — the caption's ref grammar is DSL-specific.
15
+ *
16
+ * Row positions: a {@linkcode TableNode} carries one range for the whole
17
+ * table and its verbatim `raw` source, but rows have no individual range
18
+ * (cells are stored as text only). Per-row ranges are therefore derived
19
+ * from the table's start line plus the row's index, past the GFM header and
20
+ * delimiter lines.
21
+ */
22
+ import type { BodyBlock } from "../ast/nodes.js";
23
+ import type { BlockDeclaration } from "./surfaces.js";
24
+ /**
25
+ * A declaration found on one data row of a table. Extends the shared
26
+ * {@linkcode BlockDeclaration} (`source` = the row reduced to a declaration
27
+ * by the DSL's recognizer; `range` = the row's line-precise span) with
28
+ * `captionText`: the enclosing table's `Table:` caption text, when the table
29
+ * has an adjacent one — the DSL parses a base ref out of it and hands that
30
+ * to the resolver (S4).
31
+ */
32
+ export interface TableRowDeclaration extends BlockDeclaration {
33
+ /** The enclosing table's `Table:` caption text, if any. */
34
+ readonly captionText?: string;
35
+ }
36
+ /**
37
+ * Maps a data row's cell texts to a declaration source, or returns
38
+ * `undefined` to skip the row (not a declaration, or malformed). The only
39
+ * DSL-specific input to {@linkcode extractTableDeclarations}.
40
+ */
41
+ export type RowRecognizer = (cells: readonly string[]) => string | undefined;
42
+ /**
43
+ * Walk a body AST and return a declaration for every table data row the
44
+ * `rowToSource` recognizer accepts, in source order. Recurses into
45
+ * container nodes (ListNode via ListItemNode.blocks) so tables nested
46
+ * inside list items are found. Rows the recognizer skips (`undefined`)
47
+ * contribute nothing — the malformed-row case.
48
+ */
49
+ export declare function extractTableDeclarations(blocks: readonly BodyBlock[], rowToSource: RowRecognizer): readonly TableRowDeclaration[];
50
+ //# sourceMappingURL=table.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../src/decl/table.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EACV,SAAS,EAIV,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEtD;;;;;;;GAOG;AACH,MAAM,WAAW,mBAAoB,SAAQ,gBAAgB;IAC3D,2DAA2D;IAC3D,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,KAAK,MAAM,GAAG,SAAS,CAAC;AAM7E;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,SAAS,SAAS,EAAE,EAC5B,WAAW,EAAE,aAAa,GACzB,SAAS,mBAAmB,EAAE,CAIhC"}
@@ -0,0 +1,124 @@
1
+ /**
2
+ * @module core/decl/table
3
+ *
4
+ * Table declaration surface (uxil epic #717 §A / S3). A fourth embedding
5
+ * surface on the shared declaration machinery (alongside fence, bullet, and
6
+ * inline): each **data row** of a GFM table is one declaration, and the
7
+ * table's `Table:` caption may carry a base that the entry-local resolver
8
+ * (S4) consumes.
9
+ *
10
+ * DSL-agnostic, like its siblings: the caller supplies a `rowToSource`
11
+ * recognizer that maps a row's cell texts to a declaration source (or
12
+ * `undefined` to skip a non-declaration / malformed row), and parses the
13
+ * actual base ref out of the surfaced {@linkcode TableRowDeclaration.captionText}
14
+ * itself — the caption's ref grammar is DSL-specific.
15
+ *
16
+ * Row positions: a {@linkcode TableNode} carries one range for the whole
17
+ * table and its verbatim `raw` source, but rows have no individual range
18
+ * (cells are stored as text only). Per-row ranges are therefore derived
19
+ * from the table's start line plus the row's index, past the GFM header and
20
+ * delimiter lines.
21
+ */
22
+ /** GFM layout offset: a data row at `rows[i]` sits `i` lines past the
23
+ * header (line 0) and delimiter (line 1) rows in the table's raw source. */
24
+ const HEADER_AND_DELIMITER_LINES = 2;
25
+ /**
26
+ * Walk a body AST and return a declaration for every table data row the
27
+ * `rowToSource` recognizer accepts, in source order. Recurses into
28
+ * container nodes (ListNode via ListItemNode.blocks) so tables nested
29
+ * inside list items are found. Rows the recognizer skips (`undefined`)
30
+ * contribute nothing — the malformed-row case.
31
+ */
32
+ export function extractTableDeclarations(blocks, rowToSource) {
33
+ const results = [];
34
+ walk(blocks, rowToSource, results);
35
+ return results;
36
+ }
37
+ function walk(blocks, rowToSource, out) {
38
+ for (let i = 0; i < blocks.length; i++) {
39
+ const block = blocks[i];
40
+ if (block.kind === "table") {
41
+ const captionText = adjacentTableCaption(blocks, i);
42
+ const rawLines = block.raw.split("\n");
43
+ for (let r = 0; r < block.rows.length; r++) {
44
+ const cells = block.rows[r].map((cell) => cell.text);
45
+ const source = rowToSource(cells);
46
+ if (source === undefined)
47
+ continue;
48
+ out.push({
49
+ source,
50
+ range: rowRange(block, rawLines, r),
51
+ ...(captionText !== undefined ? { captionText } : {}),
52
+ });
53
+ }
54
+ }
55
+ else if (block.kind === "list") {
56
+ for (const item of block.items)
57
+ walk(item.blocks, rowToSource, out);
58
+ }
59
+ }
60
+ }
61
+ /**
62
+ * Return the text of the `Table:` caption that captions the table at
63
+ * `blocks[index]`, or `undefined` when there is none.
64
+ *
65
+ * Pairing is by local adjacency, re-deriving the above/below rule from the
66
+ * neighbours rather than trusting `CaptionNode.position`: the builder assigns
67
+ * `position` only for top-level blocks (`assignCaptionPositions` in
68
+ * core/ast/build.ts), so a caption inside a list item keeps the default
69
+ * `"below"` and cannot be trusted. A `Table:` caption immediately before the
70
+ * table captions it (the table is the caption's next captionable block); one
71
+ * immediately after captions it only when no captionable block follows the
72
+ * caption — otherwise that caption belongs to the following block.
73
+ */
74
+ function adjacentTableCaption(blocks, index) {
75
+ const prev = blocks[index - 1];
76
+ if (isTableCaption(prev))
77
+ return prev.text;
78
+ const next = blocks[index + 1];
79
+ if (isTableCaption(next) && !isCaptionable(blocks[index + 2])) {
80
+ return next.text;
81
+ }
82
+ return undefined;
83
+ }
84
+ function isTableCaption(block) {
85
+ return block?.kind === "caption" && block.keyword === "Table";
86
+ }
87
+ /**
88
+ * Block kinds a caption can caption (mirrors the captionable set in
89
+ * `assignCaptionPositions`, core/ast/build.ts). Used to decide whether a
90
+ * caption that follows a table belongs to that table or to a later
91
+ * captionable block.
92
+ */
93
+ function isCaptionable(block) {
94
+ if (block === undefined)
95
+ return false;
96
+ switch (block.kind) {
97
+ case "figure":
98
+ case "table":
99
+ case "code":
100
+ case "feature":
101
+ case "math":
102
+ case "list":
103
+ return true;
104
+ default:
105
+ return false;
106
+ }
107
+ }
108
+ /**
109
+ * The line-precise range of data row `rowIndex`. The table's `range.start`
110
+ * is the header line; the data row sits `HEADER_AND_DELIMITER_LINES +
111
+ * rowIndex` lines below it, at the table's start column. `raw` is de-indented
112
+ * by `verbatimSlice`, so adding the de-indented row length to the table's
113
+ * column yields the true source span — correct for both top-level (column 1)
114
+ * and list-nested (indented) tables.
115
+ */
116
+ function rowRange(table, rawLines, rowIndex) {
117
+ const line = table.range.start.line + HEADER_AND_DELIMITER_LINES + rowIndex;
118
+ const column = table.range.start.column;
119
+ const rawLine = rawLines[HEADER_AND_DELIMITER_LINES + rowIndex] ?? "";
120
+ return {
121
+ start: { line, column },
122
+ end: { line, column: column + rawLine.length },
123
+ };
124
+ }
@@ -19,7 +19,7 @@
19
19
  */
20
20
  import type { Diagnostic, EffectiveProfile, Entry } from "../model/mod.js";
21
21
  import type { ProseFormatter } from "../formatter/dprint.js";
22
- import { type LockEdge, type ParseLockfileResult } from "../lock/mod.js";
22
+ import { type LockEdge, type ParseLockfileResult, type ReadFile as LockReadFile } from "../lock/mod.js";
23
23
  /**
24
24
  * Format-drift gate — the `MSL-F010` (formatter drift) and `MSL-F011`
25
25
  * (reference-canonicalization drift) findings.
@@ -57,12 +57,23 @@ export declare function fmtDriftGate(mdContents: ReadonlyMap<string, string>, en
57
57
  * re-lock. The gate therefore filters to project-owned entries (`!e.origin`),
58
58
  * mirroring `markspec lock`.
59
59
  *
60
+ * Also carries the MSL-L212 offline cache-drift case (Task 9): when `cache`
61
+ * is supplied and the lockfile parsed, every snapshot-carrying upstream row
62
+ * is verified against its on-disk cache under `cache.cacheRoot` and any
63
+ * cache-drift diagnostics are appended to the edge-drift result. Offline by
64
+ * design, like the edge-drift check — no network fetch.
65
+ *
60
66
  * @param lockParse The parsed `markspec.lock` (already read from disk).
61
67
  * @param lockPath Absolute path to `markspec.lock`, used as the diagnostic
62
68
  * location so JSON consumers that group by `location.file` keep the finding.
63
69
  * @param entries The full parsed entry set; corpus entries are filtered out.
70
+ * @param cache Optional upstream cache-verification inputs. Omitted →
71
+ * backward-compatible with callers that only want the edge-drift case.
64
72
  */
65
- export declare function lockfileDriftGate(lockParse: ParseLockfileResult, lockPath: string, entries: readonly Entry[]): Promise<Diagnostic[]>;
73
+ export declare function lockfileDriftGate(lockParse: ParseLockfileResult, lockPath: string, entries: readonly Entry[], cache?: {
74
+ readonly cacheRoot: string;
75
+ readonly readFile: LockReadFile;
76
+ }): Promise<Diagnostic[]>;
66
77
  /**
67
78
  * Prose-lint gate — the advisory `MSL-Q` prose-analysis findings, projected to
68
79
  * plain {@linkcode Diagnostic}s.
@@ -1 +1 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/gates/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAE3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAG7D,OAAO,EAEL,KAAK,QAAQ,EACb,KAAK,mBAAmB,EACzB,MAAM,gBAAgB,CAAC;AAGxB;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,YAAY,CAChC,UAAU,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,EACvC,OAAO,EAAE,SAAS,KAAK,EAAE,EACzB,MAAM,EAAE,SAAS,QAAQ,EAAE,EAC3B,mBAAmB,EAAE,cAAc,GAAG,SAAS,GAC9C,OAAO,CAAC,UAAU,EAAE,CAAC,CAuCvB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,iBAAiB,CACrC,SAAS,EAAE,mBAAmB,EAC9B,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,SAAS,KAAK,EAAE,GACxB,OAAO,CAAC,UAAU,EAAE,CAAC,CAiBvB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,SAAS,KAAK,EAAE,EACzB,OAAO,EAAE,gBAAgB,GAAG,SAAS,GACpC,OAAO,CAAC,UAAU,EAAE,CAAC,CAQvB"}
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/gates/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAE3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAG7D,OAAO,EAEL,KAAK,QAAQ,EACb,KAAK,mBAAmB,EACxB,KAAK,QAAQ,IAAI,YAAY,EAE9B,MAAM,gBAAgB,CAAC;AAGxB;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,YAAY,CAChC,UAAU,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,EACvC,OAAO,EAAE,SAAS,KAAK,EAAE,EACzB,MAAM,EAAE,SAAS,QAAQ,EAAE,EAC3B,mBAAmB,EAAE,cAAc,GAAG,SAAS,GAC9C,OAAO,CAAC,UAAU,EAAE,CAAC,CAwCvB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAsB,iBAAiB,CACrC,SAAS,EAAE,mBAAmB,EAC9B,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,SAAS,KAAK,EAAE,EACzB,KAAK,CAAC,EAAE;IAAE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAA;CAAE,GACtE,OAAO,CAAC,UAAU,EAAE,CAAC,CAwCvB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,SAAS,KAAK,EAAE,EACzB,OAAO,EAAE,gBAAgB,GAAG,SAAS,GACpC,OAAO,CAAC,UAAU,EAAE,CAAC,CAQvB"}
package/esm/gates/mod.js CHANGED
@@ -20,7 +20,7 @@
20
20
  import { format } from "../formatter/mod.js";
21
21
  import { parseFile } from "../parser/mod.js";
22
22
  import { buildRefIndex, canonicalizeRefs } from "../refs/mod.js";
23
- import { detectOfflineEdgeDrift, } from "../lock/mod.js";
23
+ import { detectOfflineEdgeDrift, verifyUpstreamCache, } from "../lock/mod.js";
24
24
  import { runLint } from "../lint/mod.js";
25
25
  /**
26
26
  * Format-drift gate — the `MSL-F010` (formatter drift) and `MSL-F011`
@@ -50,7 +50,8 @@ export async function fmtDriftGate(mdContents, entries, ledger, formatMarkdownPr
50
50
  // Building the heal index over the full set (including corpus) would flag an
51
51
  // MSL-F011 drift that `fmt` can never fix — a permanently red gate for any
52
52
  // consumer using a delivered corpus. Filter to `!e.origin`, mirroring
53
- // lockfileDriftGate.
53
+ // lockfileDriftGate — deliberately BROADER than the validators'
54
+ // `emittableEntries` (upstream-only, #771); do not "unify" it.
54
55
  const refIndex = buildRefIndex(entries.filter((e) => !e.origin));
55
56
  for (const [filePath, content] of mdContents) {
56
57
  const formatted = format(content, {
@@ -93,25 +94,51 @@ export async function fmtDriftGate(mdContents, entries, ledger, formatMarkdownPr
93
94
  * re-lock. The gate therefore filters to project-owned entries (`!e.origin`),
94
95
  * mirroring `markspec lock`.
95
96
  *
97
+ * Also carries the MSL-L212 offline cache-drift case (Task 9): when `cache`
98
+ * is supplied and the lockfile parsed, every snapshot-carrying upstream row
99
+ * is verified against its on-disk cache under `cache.cacheRoot` and any
100
+ * cache-drift diagnostics are appended to the edge-drift result. Offline by
101
+ * design, like the edge-drift check — no network fetch.
102
+ *
96
103
  * @param lockParse The parsed `markspec.lock` (already read from disk).
97
104
  * @param lockPath Absolute path to `markspec.lock`, used as the diagnostic
98
105
  * location so JSON consumers that group by `location.file` keep the finding.
99
106
  * @param entries The full parsed entry set; corpus entries are filtered out.
107
+ * @param cache Optional upstream cache-verification inputs. Omitted →
108
+ * backward-compatible with callers that only want the edge-drift case.
100
109
  */
101
- export async function lockfileDriftGate(lockParse, lockPath, entries) {
110
+ export async function lockfileDriftGate(lockParse, lockPath, entries, cache) {
102
111
  if (!lockParse.lockfile) {
103
112
  return [...lockParse.diagnostics];
104
113
  }
114
+ // `!e.origin` (project-owned only) — deliberately BROADER than the
115
+ // validators' `emittableEntries` partition (upstream-only, #771): the
116
+ // edge ledger records only edges the project authors.
105
117
  const projectEntries = entries.filter((e) => !e.origin);
106
118
  const drift = await detectOfflineEdgeDrift(projectEntries, lockParse.lockfile.generatedCache);
107
- if (!drift.drifted)
108
- return [];
109
- return [{
110
- code: "MSL-L212",
111
- severity: "error",
112
- message: `traceability edges drifted from markspec.lock: locked ${drift.lockedCount} edge(s), current ${drift.currentCount} — run \`markspec lock\` to refresh. (After upgrading MarkSpec this can also fire once because traceability inputs now include source-file doc comments; re-running \`markspec lock\` clears it.)`,
113
- location: { file: lockPath, line: 1, column: 1 },
114
- }];
119
+ const diagnostics = drift.drifted
120
+ ? [{
121
+ code: "MSL-L212",
122
+ severity: "error",
123
+ message: `traceability edges drifted from markspec.lock: locked ${drift.lockedCount} edge(s), current ${drift.currentCount} — run \`markspec lock\` to refresh. (After upgrading MarkSpec this can also fire once because traceability inputs now include source-file doc comments; re-running \`markspec lock\` clears it.)`,
124
+ location: { file: lockPath, line: 1, column: 1 },
125
+ }]
126
+ : [];
127
+ if (cache !== undefined) {
128
+ const cacheDiags = await verifyUpstreamCache(lockParse.lockfile.upstreams, cache.cacheRoot, cache.readFile);
129
+ // verifyUpstreamCache is a reusable, lockfile-path-agnostic probe and
130
+ // emits `location: undefined` (see cache_check.ts). Stamp the same
131
+ // lockfile location the sibling edge-drift MSL-L212 above uses, so both
132
+ // findings from the same `markspec.lock` group under one file for a
133
+ // JSON consumer keyed on `location.file`.
134
+ for (const d of cacheDiags) {
135
+ diagnostics.push({
136
+ ...d,
137
+ location: { file: lockPath, line: 1, column: 1 },
138
+ });
139
+ }
140
+ }
141
+ return diagnostics;
115
142
  }
116
143
  /**
117
144
  * Prose-lint gate — the advisory `MSL-Q` prose-analysis findings, projected to
@@ -1 +1 @@
1
- {"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/lint/runner.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAG/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAUjD,OAAO,KAAK,EAAE,UAAU,EAAiB,MAAM,eAAe,CAAC;AAY/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAgB9C;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,KAAK,EACZ,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAKT;AAMD,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,OAAO,EAAE,SAAS,KAAK,EAAE,CAAC;IACnC;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,gBAAgB,CAAC;IACpC,6EAA6E;IAC7E,QAAQ,CAAC,gBAAgB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAChD,yEAAyE;IACzE,QAAQ,CAAC,iBAAiB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/C,mDAAmD;IACnD,QAAQ,CAAC,QAAQ,CAAC,EAAE,UAAU,CAAC;CAChC;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,WAAW,EAAE,SAAS,cAAc,EAAE,CAAC;IAChD,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;CAC7B;AAoBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAsB,OAAO,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,CA0FvE"}
1
+ {"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/lint/runner.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAG/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAUjD,OAAO,KAAK,EAAE,UAAU,EAAiB,MAAM,eAAe,CAAC;AAY/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAgB9C;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,KAAK,EACZ,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAKT;AAMD,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,OAAO,EAAE,SAAS,KAAK,EAAE,CAAC;IACnC;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,gBAAgB,CAAC;IACpC,6EAA6E;IAC7E,QAAQ,CAAC,gBAAgB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAChD,yEAAyE;IACzE,QAAQ,CAAC,iBAAiB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/C,mDAAmD;IACnD,QAAQ,CAAC,QAAQ,CAAC,EAAE,UAAU,CAAC;CAChC;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,WAAW,EAAE,SAAS,cAAc,EAAE,CAAC;IAChD,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;CAC7B;AAoBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAsB,OAAO,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,CA4FvE"}
@@ -116,7 +116,9 @@ export async function runLint(options) {
116
116
  // Steps 1–9: collect diagnostics keyed by entry. Delivered-corpus entries
117
117
  // (`entry.origin`) are excluded from rule execution — a consumer cannot fix
118
118
  // upstream prose (ADR-030 §D4) — even though they contribute to the indexes
119
- // above.
119
+ // above. Deliberately BROADER than the validators' `emittableEntries`
120
+ // partition (upstream-only, #771): profile corpus stays structurally
121
+ // validated but is never prose-linted — do not "unify" this filter.
120
122
  const inScopeDiags = new Map();
121
123
  for (const entry of entries) {
122
124
  if (entry.origin)
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @module core/lock/acquire_compile
3
+ *
4
+ * Deterministic in-process compile of an acquired dependency tree
5
+ * (design §4.3). Produces the same `manifest.json` + `compiled.json` layout
6
+ * a published `references:` site serves, so `loadUpstreamCorpus` /
7
+ * `probeCacheSnapshot` read a dependency snapshot identically to a reference
8
+ * snapshot. The output is byte-reproducible from (tree, markspec version):
9
+ * files are compiled in sorted, tree-relative order with no stat/git IO, so
10
+ * `entry.location.file`, `properties.file.path`, and entry ordering are all
11
+ * stable. Pure — every file touch flows through {@linkcode AcquireCompileIO}.
12
+ */
13
+ import { type ManifestJson } from "../compiler/manifest.js";
14
+ import { type DiscoveryIO } from "../discovery/mod.js";
15
+ export interface AcquireCompileIO {
16
+ /** Config/profile reader — returns text or undefined (core `ReadFile`). */
17
+ readonly readFile: (path: string) => Promise<string | undefined>;
18
+ /** Throwing reader compile() consumes (`(path) => Promise<string>`). */
19
+ readonly readText: (path: string) => Promise<string>;
20
+ /** Discovery seam (`{ readDir, readFile }`) — same as `denoDiscoveryIO()`. */
21
+ readonly discovery: DiscoveryIO;
22
+ }
23
+ export interface CompiledSnapshot {
24
+ readonly manifestJson: ManifestJson;
25
+ readonly compiledBytes: Uint8Array;
26
+ readonly snapshot: string;
27
+ }
28
+ export declare function compileAcquiredTree(treeRoot: string, io: AcquireCompileIO, release: string): Promise<CompiledSnapshot | {
29
+ error: string;
30
+ }>;
31
+ //# sourceMappingURL=acquire_compile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acquire_compile.d.ts","sourceRoot":"","sources":["../../src/lock/acquire_compile.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,OAAO,EAAiB,KAAK,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAK3E,OAAO,EAAiB,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGtE,MAAM,WAAW,gBAAgB;IAC/B,2EAA2E;IAC3E,QAAQ,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IACjE,wEAAwE;IACxE,QAAQ,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACrD,8EAA8E;IAC9E,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC;CACjC;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IACpC,QAAQ,CAAC,aAAa,EAAE,UAAU,CAAC;IACnC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED,wBAAsB,mBAAmB,CACvC,QAAQ,EAAE,MAAM,EAChB,EAAE,EAAE,gBAAgB,EACpB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,gBAAgB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CA0E/C"}