@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
@@ -10,6 +10,7 @@ exports.parseMarkdown = parseMarkdown;
10
10
  const mod_js_1 = require("../model/mod.js");
11
11
  const attributes_js_1 = require("./attributes.js");
12
12
  const body_tokens_js_1 = require("./body_tokens.js");
13
+ const directives_js_1 = require("./directives.js");
13
14
  const remark_js_1 = require("./remark.js");
14
15
  const build_js_1 = require("../ast/build.js");
15
16
  const translate_js_1 = require("./translate.js");
@@ -338,6 +339,14 @@ function extractEntry(item, markdownLines, file, definitions, isReferencesDoc, d
338
339
  const trimmed = bodyLines[i].trim();
339
340
  if (!trimmed)
340
341
  continue; // skip trailing blanks
342
+ // A `<!-- markspec:* -->` directive comment is legitimate body
343
+ // content (spec §2.4.1), not a trailer line — skip it so its
344
+ // `<!--markspec` colon-prefix is never mistaken for a malformed
345
+ // trailer key. `continue` (not `break`) keeps scanning earlier lines,
346
+ // so a genuine leaked-trailer typo sitting above a directive comment
347
+ // still fires MSL-P022 (#687, preserves #697).
348
+ if ((0, directives_js_1.isMarkspecDirectiveComment)(trimmed))
349
+ continue;
341
350
  const colonMatch = COLON_SPLIT_RE.exec(trimmed);
342
351
  if (!colonMatch)
343
352
  break; // stop at non-colon line
@@ -465,56 +474,12 @@ function extractEntry(item, markdownLines, file, definitions, isReferencesDoc, d
465
474
  line: bodyStartLine,
466
475
  column: 1,
467
476
  }, bodyIndent, mdastTree);
468
- // Extract typl declarations from all three surfaces in the body:
469
- // (1) ```typl fences, (2) bullet-glossary items, (3) inline code spans.
470
- // Per-surface diagnostics are bridged to file-relative positions and
471
- // pushed into the parser's diagnostic stream. Cross-entry collision
472
- // detection lands in a later PR; this PR aggregates all intra-entry
473
- // bindings + typedefs from every surface.
474
- let types;
475
- const allBindings = [];
476
- const allTypedefs = [];
477
- for (const fence of (0, mod_js_2.extractTyplFences)(bodyAst)) {
478
- const result = (0, mod_js_2.parseTyplBlock)(fence.source);
479
- allBindings.push(...result.ast.bindings);
480
- allTypedefs.push(...result.ast.typedefs);
481
- // Fence content starts on the line AFTER the opening ```, so the
482
- // bridge offset is the file line of the opening fence.
483
- const fenceFileStartLine = bodyStartLine + fence.range.start.line - 1;
484
- for (const td of result.diagnostics) {
485
- diagnostics.push((0, mod_js_2.bridgeTyplDiagnostic)(td, file, fenceFileStartLine));
486
- }
487
- }
488
- for (const bullet of (0, mod_js_2.extractTyplBullets)(bodyAst)) {
489
- const result = (0, mod_js_2.parseTyplBlock)(bullet.source);
490
- allBindings.push(...result.ast.bindings);
491
- allTypedefs.push(...result.ast.typedefs);
492
- // A bullet item IS the typl content (single line). The bridge
493
- // computes line as `offset + diag.position.line`; we want diag
494
- // position.line 1 to map to the item's file line, so offset is
495
- // `itemFileLine - 1` = `bodyStartLine + bullet.range.start.line - 2`.
496
- const bulletFileOffset = bodyStartLine + bullet.range.start.line - 2;
497
- for (const td of result.diagnostics) {
498
- diagnostics.push((0, mod_js_2.bridgeTyplDiagnostic)(td, file, bulletFileOffset));
499
- }
500
- }
501
- for (const inline of (0, mod_js_2.extractTyplInlines)(bodyTokens)) {
502
- const result = (0, mod_js_2.parseTyplBlock)(inline.source);
503
- allBindings.push(...result.ast.bindings);
504
- allTypedefs.push(...result.ast.typedefs);
505
- // inline.location is already file-relative (translated by the
506
- // bodyTokens extractor). The bridge computes file line as
507
- // `offset + diag.position.line`; for inline content where
508
- // diag.position.line is 1 (single-line span), offset is
509
- // `inline.location.line - 1`.
510
- const inlineFileOffset = inline.location.line - 1;
511
- for (const td of result.diagnostics) {
512
- diagnostics.push((0, mod_js_2.bridgeTyplDiagnostic)(td, inline.location.file, inlineFileOffset));
513
- }
514
- }
515
- if (allBindings.length > 0 || allTypedefs.length > 0) {
516
- types = { bindings: allBindings, typedefs: allTypedefs };
517
- }
477
+ // Extract + resolve typl declarations from all three surfaces (#723):
478
+ // published names resolve to absolute dotted form at parse time, so
479
+ // Entry.types carries absolute names only. See typl/assemble.ts.
480
+ const typl = (0, mod_js_2.assembleTyplTypes)(bodyAst, bodyTokens, file, bodyStartLine);
481
+ diagnostics.push(...typl.diagnostics);
482
+ const types = typl.types;
518
483
  return {
519
484
  displayId: (0, mod_js_1.makeDisplayId)(displayId),
520
485
  title: title ?? "",
@@ -1 +1 @@
1
- {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/profile/manifest.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AA8BnE,eAAO,MAAM,iBAAiB,aAS5B,CAAC;AAEH,eAAO,MAAM,oBAAoB,aAW/B,CAAC;AAEH,eAAO,MAAM,iBAAiB,aAU5B,CAAC;AAEH,eAAO,MAAM,qBAAqB,aAA6C,CAAC;AAChF,eAAO,MAAM,sBAAsB,aAAoC,CAAC;AACxE,eAAO,MAAM,qBAAqB,aAA6C,CAAC;AAEhF,eAAO,MAAM,iBAAiB,aAQ5B,CAAC;AAEH,eAAO,MAAM,oBAAoB,aAAgC,CAAC;AAElE,eAAO,MAAM,uBAAuB,aAKlC,CAAC;AAEH,4CAA4C;AAC5C,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI,CAAC;IAC1C,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;CAC7C;AAq0CD;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,EACf,UAAU,SAAoB,GAC7B,mBAAmB,CAyMrB"}
1
+ {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/profile/manifest.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AA+BnE,eAAO,MAAM,iBAAiB,aAS5B,CAAC;AAEH,eAAO,MAAM,oBAAoB,aAW/B,CAAC;AAEH,eAAO,MAAM,iBAAiB,aAW5B,CAAC;AAEH,eAAO,MAAM,qBAAqB,aAA6C,CAAC;AAChF,eAAO,MAAM,sBAAsB,aAAoC,CAAC;AACxE,eAAO,MAAM,qBAAqB,aAA6C,CAAC;AAEhF,eAAO,MAAM,iBAAiB,aAQ5B,CAAC;AAEH,eAAO,MAAM,oBAAoB,aAAgC,CAAC;AAElE,eAAO,MAAM,uBAAuB,aAKlC,CAAC;AAEH,4CAA4C;AAC5C,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI,CAAC;IAC1C,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;CAC7C;AAo1CD;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,EACf,UAAU,SAAoB,GAC7B,mBAAmB,CAyMrB"}
@@ -12,6 +12,7 @@ exports.parseManifest = parseManifest;
12
12
  const yaml_1 = require("@std/yaml");
13
13
  const mod_js_1 = require("../model/mod.js");
14
14
  const display_id_js_1 = require("./display_id.js");
15
+ const paths_js_1 = require("../util/paths.js");
15
16
  const VALUE_TYPE_SET = new Set(mod_js_1.VALUE_TYPES);
16
17
  exports.ALLOWED_ROOT_KEYS = new Set([
17
18
  "$schema",
@@ -45,6 +46,7 @@ exports.ALLOWED_TYPE_KEYS = new Set([
45
46
  "traceability",
46
47
  "color",
47
48
  "discipline",
49
+ "declares",
48
50
  ]);
49
51
  exports.ALLOWED_DOC_TYPE_KEYS = new Set(["id", "contains", "description"]);
50
52
  exports.ALLOWED_DOCUMENTS_KEYS = new Set(["types", "frontMatter"]);
@@ -981,6 +983,21 @@ function parseTypeDef(name, raw, sourcePath, diagnostics) {
981
983
  }
982
984
  discipline = r.discipline;
983
985
  }
986
+ // uxil S9 (#727): `declares: ux-surface` designates a uxil declaring
987
+ // entry type. Closed vocabulary — reject anything else at load time.
988
+ let declares;
989
+ if (r.declares !== undefined) {
990
+ if (r.declares !== "ux-surface") {
991
+ diagnostics.push({
992
+ code: "PROFILE-TYPE-009",
993
+ severity: "error",
994
+ message: `${ctx}: 'declares' value '${r.declares}' is not recognised (expected 'ux-surface')`,
995
+ location: { file: sourcePath, line: 1, column: 1 },
996
+ });
997
+ return undefined;
998
+ }
999
+ declares = r.declares;
1000
+ }
984
1001
  const description = typeof r.description === "string"
985
1002
  ? r.description
986
1003
  : undefined;
@@ -998,6 +1015,7 @@ function parseTypeDef(name, raw, sourcePath, diagnostics) {
998
1015
  color,
999
1016
  description,
1000
1017
  discipline,
1018
+ declares,
1001
1019
  };
1002
1020
  }
1003
1021
  function parseTypesMap(raw, sourcePath, diagnostics) {
@@ -1146,11 +1164,10 @@ function parseDeliversSection(raw, sourcePath, diagnostics) {
1146
1164
  });
1147
1165
  continue;
1148
1166
  }
1167
+ const normalized = path.replaceAll("\\", "/");
1149
1168
  // PROFILE-DELIVERS-003 — the path must stay inside the profile
1150
1169
  // directory: no absolute paths (POSIX or drive-letter), no `..`.
1151
- const normalized = path.replaceAll("\\", "/");
1152
- if (normalized.startsWith("/") || /^[A-Za-z]:/.test(normalized) ||
1153
- normalized.split("/").includes("..")) {
1170
+ if ((0, paths_js_1.isUnsafeRelPath)(path)) {
1154
1171
  diagnostics.push({
1155
1172
  code: "PROFILE-DELIVERS-003",
1156
1173
  severity: "error",
@@ -124,6 +124,7 @@ function foldTier(base, tier, diagnostics) {
124
124
  attrDescriptions: mapFromAttrDescriptions(td.attributes, origin),
125
125
  relationDescriptions: mapFromTraceDescriptions(td.traceability, origin),
126
126
  discipline: { value: td.discipline, origin },
127
+ declares: { value: td.declares, origin },
127
128
  };
128
129
  types.set(name, { value: eff, origin });
129
130
  }
@@ -402,6 +403,10 @@ function tightenType(existing, child, childOrigin, diagnostics) {
402
403
  const discipline = child.discipline !== undefined
403
404
  ? { value: child.discipline, origin: childOrigin }
404
405
  : effExisting.discipline;
406
+ // Declares (uxil S9 #727): child wins when set; otherwise parent stays.
407
+ const declares = child.declares !== undefined
408
+ ? { value: child.declares, origin: childOrigin }
409
+ : effExisting.declares ?? { value: undefined, origin: existing.origin };
405
410
  const attrDescriptions = mergeDescriptionMap(effExisting.attrDescriptions, child.attributes.map((a) => ({ name: a.name, desc: a.description })), childOrigin);
406
411
  const relationDescriptions = mergeDescriptionMap(effExisting.relationDescriptions, [...child.traceability.entries()].map(([name, r]) => ({
407
412
  name,
@@ -420,6 +425,7 @@ function tightenType(existing, child, childOrigin, diagnostics) {
420
425
  attrDescriptions,
421
426
  relationDescriptions,
422
427
  discipline,
428
+ declares,
423
429
  };
424
430
  const overrides = [
425
431
  ...(existing.overrides ?? []),
@@ -741,6 +747,7 @@ function mapFromTypes(types, origin) {
741
747
  attrDescriptions: mapFromAttrDescriptions(td.attributes, origin),
742
748
  relationDescriptions: mapFromTraceDescriptions(td.traceability, origin),
743
749
  discipline: { value: td.discipline, origin },
750
+ declares: { value: td.declares, origin },
744
751
  };
745
752
  out.set(name, { value: eff, origin });
746
753
  }
@@ -19,6 +19,17 @@ export interface ReportOptions {
19
19
  readonly scope?: string;
20
20
  /** Filter entries by label value. */
21
21
  readonly label?: string;
22
+ /**
23
+ * Declared upstream ids from `project.yaml`'s `dependencies:` (federated
24
+ * upstream, slice 4), derived via `deriveUpstreamId`. Used by the
25
+ * `coverage` report to classify an upstream-origin entry: an id in this
26
+ * set participates in coverage like a project entry (a `dependencies:`
27
+ * upstream); an upstream-origin entry whose id is NOT in this set is a
28
+ * `references:` leaf, excluded from the orphan/unsatisfied gap lists.
29
+ * Defaults to empty — every upstream-origin entry is treated as a
30
+ * reference leaf.
31
+ */
32
+ readonly dependencyUpstreamIds?: ReadonlySet<string>;
22
33
  }
23
34
  /**
24
35
  * Generate a report from compiled traceability graph.
@@ -1 +1 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/reporter/mod.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAIxD,8BAA8B;AAC9B,MAAM,MAAM,UAAU,GAAG,cAAc,GAAG,UAAU,CAAC;AAErD,gCAAgC;AAChC,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,MAAM,GAAG,KAAK,CAAC;AAEjD,sCAAsC;AACtC,MAAM,WAAW,aAAa;IAC5B,mBAAmB;IACnB,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,qBAAqB;IACrB,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,2DAA2D;IAC3D,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,qCAAqC;IACrC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,aAAa,GAAG,MAAM,CAO5E"}
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/reporter/mod.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAIxD,8BAA8B;AAC9B,MAAM,MAAM,UAAU,GAAG,cAAc,GAAG,UAAU,CAAC;AAErD,gCAAgC;AAChC,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,MAAM,GAAG,KAAK,CAAC;AAEjD,sCAAsC;AACtC,MAAM,WAAW,aAAa;IAC5B,mBAAmB;IACnB,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,qBAAqB;IACrB,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,2DAA2D;IAC3D,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,qCAAqC;IACrC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB;;;;;;;;;OASG;IACH,QAAQ,CAAC,qBAAqB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CACtD;AAED;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,aAAa,GAAG,MAAM,CAY5E"}
@@ -20,7 +20,7 @@ function report(result, options) {
20
20
  if (options.kind === "traceability") {
21
21
  return formatTraceability(result, entries, options.format);
22
22
  }
23
- return formatCoverage(result, entries, options.format);
23
+ return formatCoverage(result, entries, options.format, options.dependencyUpstreamIds);
24
24
  }
25
25
  // ---------------------------------------------------------------------------
26
26
  // Filtering
@@ -98,7 +98,8 @@ function formatTraceability(result, entries, format) {
98
98
  const lines = rows.map((r) => `| ${r.id} | ${r.title} | ${r.entryType} | ${r.origin} | ${r.satisfies || "\u2014"} | ${r.satisfiedBy || "\u2014"} |`);
99
99
  return [header, sep, ...lines].join("\n");
100
100
  }
101
- function computeCoverage(result, entries) {
101
+ function computeCoverage(result, entries, opts = {}) {
102
+ const { dependencyUpstreamIds } = opts;
102
103
  const byType = {};
103
104
  const orphans = [];
104
105
  const unsatisfied = [];
@@ -108,13 +109,22 @@ function computeCoverage(result, entries) {
108
109
  // Bucket by profile-declared type when available, fall back to shape.
109
110
  const t = entry.type ?? (entry.shape === "Reference" ? "ref" : "untyped");
110
111
  byType[t] = (byType[t] ?? 0) + 1;
112
+ // Federated upstream (slice 4): a `references:` upstream entry is a
113
+ // traceability leaf — no coverage expectation points at or from it, so
114
+ // it is excluded from both gap lists below. A `dependencies:` upstream
115
+ // entry (its upstreamId present in `dependencyUpstreamIds`) participates
116
+ // like a project entry — this branch is inert until slice 3 loads
117
+ // dependency entries, but the classification is exercised here so it's
118
+ // ready when they do.
119
+ const isReferenceLeaf = (0, mod_js_1.isUpstreamEntry)(entry) &&
120
+ !(dependencyUpstreamIds?.has(entry.origin.upstreamId) ?? false);
111
121
  const fwd = result.forward.get(entry.displayId) ?? [];
112
122
  const rev = result.reverse.get(entry.displayId) ?? [];
113
123
  const hasSatisfies = fwd.some((l) => l.kind === "satisfies");
114
- if (hasSatisfies) {
124
+ if (hasSatisfies && !isReferenceLeaf) {
115
125
  withSatisfies++;
116
126
  }
117
- else if (entry.shape === "Authored") {
127
+ else if (entry.shape === "Authored" && !isReferenceLeaf) {
118
128
  withoutSatisfies++;
119
129
  orphans.push(entry.displayId);
120
130
  }
@@ -123,7 +133,8 @@ function computeCoverage(result, entries) {
123
133
  // profile-specific; a profile-aware reporter layer refines this.
124
134
  const hasSatisfiedBy = rev.some((l) => l.kind === "satisfies");
125
135
  if (entry.type &&
126
- !hasSatisfiedBy) {
136
+ !hasSatisfiedBy &&
137
+ !isReferenceLeaf) {
127
138
  unsatisfied.push(entry.displayId);
128
139
  }
129
140
  }
@@ -135,8 +146,8 @@ function computeCoverage(result, entries) {
135
146
  gaps: { orphans, unsatisfied },
136
147
  };
137
148
  }
138
- function formatCoverage(result, entries, format) {
139
- const stats = computeCoverage(result, entries);
149
+ function formatCoverage(result, entries, format, dependencyUpstreamIds) {
150
+ const stats = computeCoverage(result, entries, { dependencyUpstreamIds });
140
151
  if (format === "json") {
141
152
  return JSON.stringify(stats, null, 2);
142
153
  }
@@ -0,0 +1,53 @@
1
+ /**
2
+ * @module typl/assemble
3
+ *
4
+ * Entry-level typl assembly (#723, #724): extracts declarations from the four
5
+ * surfaces (fence / bullet / inline / table), resolves published names through
6
+ * the base-resolution engine (core/decl/resolve), and aggregates the
7
+ * result into the `Entry.types` TyplBlock. Moved out of parser/markdown.ts
8
+ * so the parser calls one function.
9
+ *
10
+ * Resolution rules (design spec D5):
11
+ * - a `: namespace` binding establishes a base; nested-bullet namespaces
12
+ * scope their subtree (innermost wins); the root namespace (no
13
+ * namespace ancestor) scopes the whole entry body, order-independent;
14
+ * - a table's `Table:` caption may carry a base (#724); a table row
15
+ * resolves against that caption base first (innermost, #722 rule 3),
16
+ * then the root — the caption base is not itself a root and never sets
17
+ * `rootNamespace`;
18
+ * - relative names (`$.x`) resolve to absolute dotted names before
19
+ * aggregation — Entry.types carries absolute names only;
20
+ * - namespace bindings are scaffolding: excluded from bindings;
21
+ * - a relative name with no base is TYPL-010 (binding dropped);
22
+ * - a second root is TYPL-012 (first root wins);
23
+ * - inline/fence relative refs resolve against the root base only.
24
+ */
25
+ import type { BodyBlock } from "../ast/nodes.js";
26
+ import type { BodyToken, Diagnostic } from "../model/mod.js";
27
+ import type { TyplBlock } from "./ast.js";
28
+ /**
29
+ * Assemble one entry's typl declarations into its `Entry.types` block.
30
+ *
31
+ * Extracts declarations from the four embedding surfaces (fenced code,
32
+ * bullet glossary, inline code spans, table rows), resolves every relative
33
+ * `$.x` name against the caption/root/nested-namespace bases in scope (see
34
+ * the module doc's resolution rules), and aggregates the result.
35
+ *
36
+ * @param bodyAst - The entry body's parsed block AST (fence + bullet + table
37
+ * surfaces walk this).
38
+ * @param bodyTokens - The entry body's flat token stream (the inline
39
+ * surface walks this).
40
+ * @param file - Source file path, for bridging diagnostics back to
41
+ * file-relative positions.
42
+ * @param bodyStartLine - 1-based line the entry body starts on, added to
43
+ * each surface's body-relative range to get a file-relative line.
44
+ * @returns `types` — the assembled `TyplBlock`, omitted when the entry
45
+ * declares nothing (no bindings, no typedefs, no root namespace) — plus
46
+ * any diagnostics raised during extraction or resolution (TYPL-010,
47
+ * TYPL-012, and bridged parse diagnostics).
48
+ */
49
+ export declare function assembleTyplTypes(bodyAst: readonly BodyBlock[], bodyTokens: readonly BodyToken[], file: string, bodyStartLine: number): {
50
+ types?: TyplBlock;
51
+ diagnostics: Diagnostic[];
52
+ };
53
+ //# sourceMappingURL=assemble.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assemble.d.ts","sourceRoot":"","sources":["../../src/typl/assemble.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,KAAK,EAAoB,SAAS,EAAE,MAAM,UAAU,CAAC;AAkC5D;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,SAAS,SAAS,EAAE,EAC7B,UAAU,EAAE,SAAS,SAAS,EAAE,EAChC,IAAI,EAAE,MAAM,EACZ,aAAa,EAAE,MAAM,GACpB;IAAE,KAAK,CAAC,EAAE,SAAS,CAAC;IAAC,WAAW,EAAE,UAAU,EAAE,CAAA;CAAE,CAqOlD"}
@@ -0,0 +1,241 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.assembleTyplTypes = assembleTyplTypes;
4
+ const mod_js_1 = require("../decl/mod.js");
5
+ const bridge_js_1 = require("./bridge.js");
6
+ const diagnostics_js_1 = require("./diagnostics.js");
7
+ const fence_js_1 = require("./fence.js");
8
+ const bullet_js_1 = require("./bullet.js");
9
+ const inline_js_1 = require("./inline.js");
10
+ const table_js_1 = require("./table.js");
11
+ const grammar_js_1 = require("./grammar.js");
12
+ const resolve_js_1 = require("./resolve.js");
13
+ /**
14
+ * Assemble one entry's typl declarations into its `Entry.types` block.
15
+ *
16
+ * Extracts declarations from the four embedding surfaces (fenced code,
17
+ * bullet glossary, inline code spans, table rows), resolves every relative
18
+ * `$.x` name against the caption/root/nested-namespace bases in scope (see
19
+ * the module doc's resolution rules), and aggregates the result.
20
+ *
21
+ * @param bodyAst - The entry body's parsed block AST (fence + bullet + table
22
+ * surfaces walk this).
23
+ * @param bodyTokens - The entry body's flat token stream (the inline
24
+ * surface walks this).
25
+ * @param file - Source file path, for bridging diagnostics back to
26
+ * file-relative positions.
27
+ * @param bodyStartLine - 1-based line the entry body starts on, added to
28
+ * each surface's body-relative range to get a file-relative line.
29
+ * @returns `types` — the assembled `TyplBlock`, omitted when the entry
30
+ * declares nothing (no bindings, no typedefs, no root namespace) — plus
31
+ * any diagnostics raised during extraction or resolution (TYPL-010,
32
+ * TYPL-012, and bridged parse diagnostics).
33
+ */
34
+ function assembleTyplTypes(bodyAst, bodyTokens, file, bodyStartLine) {
35
+ const diagnostics = [];
36
+ const blocks = [];
37
+ // Map bullet-extraction index → blocks[] index, for parent lookups.
38
+ const bulletBlockIndex = [];
39
+ for (const fence of (0, fence_js_1.extractTyplFences)(bodyAst)) {
40
+ const result = (0, grammar_js_1.parseTyplBlock)(fence.source);
41
+ const lineOffset = bodyStartLine + fence.range.start.line - 1;
42
+ for (const td of result.diagnostics) {
43
+ diagnostics.push((0, bridge_js_1.bridgeTyplDiagnostic)(td, file, lineOffset));
44
+ }
45
+ blocks.push({ ...result.ast, file, lineOffset });
46
+ }
47
+ const bullets = (0, bullet_js_1.extractTyplBulletsNested)(bodyAst);
48
+ for (const bullet of bullets) {
49
+ const result = (0, grammar_js_1.parseTyplBlock)(bullet.source);
50
+ const lineOffset = bodyStartLine + bullet.range.start.line - 2;
51
+ for (const td of result.diagnostics) {
52
+ diagnostics.push((0, bridge_js_1.bridgeTyplDiagnostic)(td, file, lineOffset));
53
+ }
54
+ bulletBlockIndex.push(blocks.length);
55
+ blocks.push({
56
+ ...result.ast,
57
+ file,
58
+ lineOffset,
59
+ bulletParent: bullet.parent,
60
+ });
61
+ }
62
+ for (const inline of (0, inline_js_1.extractTyplInlines)(bodyTokens)) {
63
+ const result = (0, grammar_js_1.parseTyplBlock)(inline.source);
64
+ const lineOffset = inline.location.line - 1;
65
+ for (const td of result.diagnostics) {
66
+ diagnostics.push((0, bridge_js_1.bridgeTyplDiagnostic)(td, inline.location.file, lineOffset));
67
+ }
68
+ blocks.push({ ...result.ast, file: inline.location.file, lineOffset });
69
+ }
70
+ // Table rows (#724): each recognized data row is one binding. Its range
71
+ // points AT the row's own line (like the bullet surface, not the fence
72
+ // whose range points at the opening ``` a line above its content), so the
73
+ // diagnostic offset subtracts 2, matching the bullet path. The `Table:`
74
+ // caption base — when the caption text is an absolute typl name — scopes
75
+ // the row's relative refs (see `scopeFor`); the caption base is not a
76
+ // namespace binding, so it takes no part in Pass A root detection or Pass B.
77
+ for (const row of (0, table_js_1.extractTyplTable)(bodyAst)) {
78
+ const result = (0, grammar_js_1.parseTyplBlock)(row.source);
79
+ const lineOffset = bodyStartLine + row.range.start.line - 2;
80
+ for (const td of result.diagnostics) {
81
+ diagnostics.push((0, bridge_js_1.bridgeTyplDiagnostic)(td, file, lineOffset));
82
+ }
83
+ const captionBase = row.captionText !== undefined
84
+ ? (0, table_js_1.typlTableCaptionBase)(row.captionText)
85
+ : undefined;
86
+ blocks.push({
87
+ ...result.ast,
88
+ file,
89
+ lineOffset,
90
+ ...(captionBase !== undefined ? { captionBase } : {}),
91
+ });
92
+ }
93
+ // Emit a bridged typl diagnostic for a binding in blocks[i].
94
+ const emit = (code, params, i, position) => {
95
+ const td = (0, diagnostics_js_1.typlDiagnostic)(code, params, position);
96
+ diagnostics.push((0, bridge_js_1.bridgeTyplDiagnostic)(td, blocks[i].file, blocks[i].lineOffset));
97
+ };
98
+ // blockHasNamespace / hasNamespaceAncestor are static structure checks
99
+ // (independent of resolution), so Pass A is order-independent.
100
+ const blockHasNamespace = blocks.map((b) => b.bindings.some((x) => x.kind === "namespace"));
101
+ const hasNamespaceAncestor = (i) => {
102
+ let p = blocks[i].bulletParent;
103
+ while (p !== undefined) {
104
+ const idx = bulletBlockIndex[p];
105
+ if (blockHasNamespace[idx])
106
+ return true;
107
+ p = blocks[idx].bulletParent;
108
+ }
109
+ return false;
110
+ };
111
+ // ── Pass A: find the root ────────────────────────────────────────────
112
+ // Root candidate = an ABSOLUTE namespace binding with no namespace
113
+ // ancestor in its bullet chain (a relative namespace can never be a
114
+ // root — it needs a base itself). checkSingleRoot (core/decl) enforces
115
+ // the one-root invariant; its bare contract also flags zero candidates
116
+ // as a failure ("no-root"), but an entry with no namespace binding at
117
+ // all is a normal, error-free shape here — only "multiple-roots"
118
+ // produces diagnostics, first candidate in source order wins (order-
119
+ // independent for authors: the root scopes the whole body).
120
+ const rootCandidates = [];
121
+ for (let i = 0; i < blocks.length; i++) {
122
+ for (const binding of blocks[i].bindings) {
123
+ if (binding.kind !== "namespace")
124
+ continue;
125
+ if (!resolve_js_1.TYPL_REF_OPS.isAbsolute(binding.name))
126
+ continue;
127
+ if (hasNamespaceAncestor(i))
128
+ continue;
129
+ rootCandidates.push({
130
+ path: (0, resolve_js_1.typlPathOf)(binding.name),
131
+ blockIndex: i,
132
+ position: binding.position,
133
+ });
134
+ }
135
+ }
136
+ const rootCheck = (0, mod_js_1.checkSingleRoot)(rootCandidates);
137
+ let rootPath;
138
+ if (rootCheck.ok) {
139
+ rootPath = rootCheck.root.path;
140
+ }
141
+ else if (rootCheck.reason === "multiple-roots") {
142
+ rootPath = rootCheck.roots[0].path;
143
+ for (let k = 1; k < rootCheck.roots.length; k++) {
144
+ const extra = rootCheck.roots[k];
145
+ emit("TYPL-012", { first: `$${rootPath}` }, extra.blockIndex, extra.position);
146
+ }
147
+ }
148
+ // "no-root" → rootPath stays undefined; not an error.
149
+ // basePathOfBlock[i] = the base path blocks[i] provides to its bullet
150
+ // subtree, or undefined. One base slot per block: a block with several
151
+ // namespace bindings keeps the last (bullet blocks hold a single
152
+ // declaration in practice).
153
+ const basePathOfBlock = blocks.map(() => undefined);
154
+ /**
155
+ * Scope chain for blocks[i], innermost-first, terminated by the root base.
156
+ * Which frames a block sees depends on its surface: a bullet block walks
157
+ * its bullet-ancestor bases; a table-row block contributes its `Table:`
158
+ * caption base (#724); fence/inline blocks have neither and see the root
159
+ * only. The frame kinds don't combine in practice — a table row carries no
160
+ * `bulletParent`, so a table nested inside a bullet-namespace subtree sees
161
+ * only its caption base + the root, not the enclosing bullet base (known
162
+ * limitation, #724). Built immutably per call.
163
+ */
164
+ const scopeFor = (i) => {
165
+ const chain = []; // innermost first
166
+ let p = blocks[i].bulletParent;
167
+ while (p !== undefined) {
168
+ const idx = bulletBlockIndex[p];
169
+ const base = basePathOfBlock[idx];
170
+ if (base !== undefined)
171
+ chain.push(base);
172
+ p = blocks[idx].bulletParent;
173
+ }
174
+ let scope = rootPath !== undefined
175
+ ? { base: rootPath }
176
+ : undefined;
177
+ for (let k = chain.length - 1; k >= 0; k--) {
178
+ scope = { base: chain[k], parent: scope };
179
+ }
180
+ // A table row resolves against its caption base first (#722 rule 3):
181
+ // innermost, above the bullet chain and the root.
182
+ const captionBase = blocks[i].captionBase;
183
+ if (captionBase !== undefined)
184
+ scope = { base: captionBase, parent: scope };
185
+ return scope;
186
+ };
187
+ // ── Pass B: establish bases ──────────────────────────────────────────
188
+ // Source order is parents-before-children (bullet extraction is
189
+ // depth-first), so an ancestor's base is always resolved before its
190
+ // descendants need it. A relative namespace resolves against its own
191
+ // chain (TYPL-010 when there is none). Extra roots (TYPL-012 in Pass A)
192
+ // establish no base.
193
+ for (let i = 0; i < blocks.length; i++) {
194
+ for (const binding of blocks[i].bindings) {
195
+ if (binding.kind !== "namespace")
196
+ continue;
197
+ if (resolve_js_1.TYPL_REF_OPS.isAbsolute(binding.name)) {
198
+ const path = (0, resolve_js_1.typlPathOf)(binding.name);
199
+ const isExtraRoot = !hasNamespaceAncestor(i) && path !== rootPath;
200
+ if (!isExtraRoot)
201
+ basePathOfBlock[i] = path;
202
+ continue;
203
+ }
204
+ const res = (0, mod_js_1.resolveRef)(binding.name, scopeFor(i), resolve_js_1.TYPL_REF_OPS);
205
+ if (!res.ok) {
206
+ emit("TYPL-010", { name: binding.name }, i, binding.position);
207
+ continue;
208
+ }
209
+ basePathOfBlock[i] = (0, resolve_js_1.typlPathOf)(res.ref);
210
+ }
211
+ }
212
+ // ── Pass C: resolve every non-namespace binding to an absolute name ──
213
+ const allBindings = [];
214
+ const allTypedefs = [];
215
+ for (let i = 0; i < blocks.length; i++) {
216
+ const block = blocks[i];
217
+ for (const binding of block.bindings) {
218
+ if (binding.kind === "namespace")
219
+ continue; // scaffolding (D8)
220
+ const res = (0, mod_js_1.resolveRef)(binding.name, scopeFor(i), resolve_js_1.TYPL_REF_OPS);
221
+ if (!res.ok) {
222
+ emit("TYPL-010", { name: binding.name }, i, binding.position);
223
+ continue;
224
+ }
225
+ allBindings.push(res.ref === binding.name ? binding : { ...binding, name: res.ref });
226
+ }
227
+ allTypedefs.push(...block.typedefs);
228
+ }
229
+ if (allBindings.length === 0 && allTypedefs.length === 0 &&
230
+ rootPath === undefined) {
231
+ return { diagnostics };
232
+ }
233
+ return {
234
+ types: {
235
+ bindings: allBindings,
236
+ typedefs: allTypedefs,
237
+ ...(rootPath !== undefined ? { rootNamespace: rootPath } : {}),
238
+ },
239
+ diagnostics,
240
+ };
241
+ }
@@ -8,7 +8,7 @@
8
8
  * Closed kind vocabulary. `value` is the default kind when an author omits
9
9
  * it from a binding.
10
10
  */
11
- export declare const KINDS: readonly ["value", "event", "signal", "command", "state", "const", "config", "document", "stream"];
11
+ export declare const KINDS: readonly ["value", "event", "signal", "command", "state", "const", "config", "document", "stream", "namespace"];
12
12
  export type Kind = typeof KINDS[number];
13
13
  /** Schema AST — one discriminated union covering all shape variants. */
14
14
  export type Shape = {
@@ -83,5 +83,11 @@ export type Statement = Binding | Typedef;
83
83
  export interface TyplBlock {
84
84
  readonly bindings: readonly Binding[];
85
85
  readonly typedefs: readonly Typedef[];
86
+ /**
87
+ * The entry's root namespace path (no `$`, e.g. `"powertrain.brake"`),
88
+ * when the entry declares one (#723). The validator resolves relative
89
+ * citations against it.
90
+ */
91
+ readonly rootNamespace?: string;
86
92
  }
87
93
  //# sourceMappingURL=ast.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ast.d.ts","sourceRoot":"","sources":["../../src/typl/ast.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,eAAO,MAAM,KAAK,oGAUR,CAAC;AACX,MAAM,MAAM,IAAI,GAAG,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC;AAExC,wEAAwE;AACxE,MAAM,MAAM,KAAK,GACb;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,IAAI,EAAE,KAAK,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAA;CAAE,GAC1E;IACA,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,KAAK,GAAG,OAAO,CAAC;IACtB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,GACC;IACA,IAAI,EAAE,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,KAAK,CAAC,EAAE,KAAK,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;CAC7B;AAED,sCAAsC;AACtC,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,aAAa,EAAE,SAAS,CAAC;IAClC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;CAC7B;AAED,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,OAAO,CAAC;AAE1C,iCAAiC;AACjC,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,QAAQ,EAAE,SAAS,OAAO,EAAE,CAAC;IACtC,QAAQ,CAAC,QAAQ,EAAE,SAAS,OAAO,EAAE,CAAC;IACtC;;;;OAIG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;CACjC"}
@@ -21,4 +21,7 @@ exports.KINDS = [
21
21
  "config",
22
22
  "document",
23
23
  "stream",
24
+ // Published-tier scaffolding (#723): a namespace declaration creates a
25
+ // base for relative refs; it is not a symbol and carries no shape.
26
+ "namespace",
24
27
  ];