@openuji/speculator 0.3.2 → 0.4.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 (610) hide show
  1. package/README.md +111 -50
  2. package/dist/file-provider/__tests__/compliance.test.d.ts +5 -0
  3. package/dist/file-provider/__tests__/compliance.test.d.ts.map +1 -0
  4. package/dist/file-provider/__tests__/compliance.test.js +52 -0
  5. package/dist/file-provider/__tests__/compliance.test.js.map +1 -0
  6. package/dist/file-provider/index.d.ts +8 -0
  7. package/dist/file-provider/index.d.ts.map +1 -0
  8. package/dist/file-provider/index.js +10 -0
  9. package/dist/file-provider/index.js.map +1 -0
  10. package/dist/file-provider/memory.d.ts +46 -0
  11. package/dist/file-provider/memory.d.ts.map +1 -0
  12. package/dist/file-provider/memory.js +99 -0
  13. package/dist/file-provider/memory.js.map +1 -0
  14. package/dist/file-provider/node.d.ts +32 -0
  15. package/dist/file-provider/node.d.ts.map +1 -0
  16. package/dist/file-provider/node.js +65 -0
  17. package/dist/file-provider/node.js.map +1 -0
  18. package/dist/file-provider/types.d.ts +69 -0
  19. package/dist/file-provider/types.d.ts.map +1 -0
  20. package/dist/file-provider/types.js +47 -0
  21. package/dist/file-provider/types.js.map +1 -0
  22. package/dist/file-provider/web.d.ts +32 -0
  23. package/dist/file-provider/web.d.ts.map +1 -0
  24. package/dist/file-provider/web.js +77 -0
  25. package/dist/file-provider/web.js.map +1 -0
  26. package/dist/index.d.ts +15 -0
  27. package/dist/index.d.ts.map +1 -0
  28. package/dist/index.js +16 -0
  29. package/dist/index.js.map +1 -0
  30. package/dist/parse/AsideHtmlParser.d.ts +12 -0
  31. package/dist/parse/AsideHtmlParser.d.ts.map +1 -0
  32. package/dist/parse/AsideHtmlParser.js +74 -0
  33. package/dist/parse/AsideHtmlParser.js.map +1 -0
  34. package/dist/parse/BlockquoteHtmlParser.d.ts +11 -0
  35. package/dist/parse/BlockquoteHtmlParser.d.ts.map +1 -0
  36. package/dist/parse/BlockquoteHtmlParser.js +28 -0
  37. package/dist/parse/BlockquoteHtmlParser.js.map +1 -0
  38. package/dist/parse/BlockquoteMarkdownParser.d.ts +11 -0
  39. package/dist/parse/BlockquoteMarkdownParser.d.ts.map +1 -0
  40. package/dist/parse/BlockquoteMarkdownParser.js +26 -0
  41. package/dist/parse/BlockquoteMarkdownParser.js.map +1 -0
  42. package/dist/parse/CodeHtmlParser.d.ts +11 -0
  43. package/dist/parse/CodeHtmlParser.d.ts.map +1 -0
  44. package/dist/parse/CodeHtmlParser.js +38 -0
  45. package/dist/parse/CodeHtmlParser.js.map +1 -0
  46. package/dist/parse/CodeMarkdownParser.d.ts +11 -0
  47. package/dist/parse/CodeMarkdownParser.d.ts.map +1 -0
  48. package/dist/parse/CodeMarkdownParser.js +29 -0
  49. package/dist/parse/CodeMarkdownParser.js.map +1 -0
  50. package/dist/parse/DfnHtmlParser.d.ts +12 -0
  51. package/dist/parse/DfnHtmlParser.d.ts.map +1 -0
  52. package/dist/parse/DfnHtmlParser.js +53 -0
  53. package/dist/parse/DfnHtmlParser.js.map +1 -0
  54. package/dist/parse/HeadingsHtmlParser.d.ts +11 -0
  55. package/dist/parse/HeadingsHtmlParser.d.ts.map +1 -0
  56. package/dist/parse/HeadingsHtmlParser.js +30 -0
  57. package/dist/parse/HeadingsHtmlParser.js.map +1 -0
  58. package/dist/parse/HeadingsMarkdownParser.d.ts +11 -0
  59. package/dist/parse/HeadingsMarkdownParser.d.ts.map +1 -0
  60. package/dist/parse/HeadingsMarkdownParser.js +26 -0
  61. package/dist/parse/HeadingsMarkdownParser.js.map +1 -0
  62. package/dist/parse/InlinesHtmlParser.d.ts +12 -0
  63. package/dist/parse/InlinesHtmlParser.d.ts.map +1 -0
  64. package/dist/parse/InlinesHtmlParser.js +150 -0
  65. package/dist/parse/InlinesHtmlParser.js.map +1 -0
  66. package/dist/parse/InlinesMarkdownParser.d.ts +11 -0
  67. package/dist/parse/InlinesMarkdownParser.d.ts.map +1 -0
  68. package/dist/parse/InlinesMarkdownParser.js +91 -0
  69. package/dist/parse/InlinesMarkdownParser.js.map +1 -0
  70. package/dist/parse/ListsHtmlParser.d.ts +11 -0
  71. package/dist/parse/ListsHtmlParser.d.ts.map +1 -0
  72. package/dist/parse/ListsHtmlParser.js +71 -0
  73. package/dist/parse/ListsHtmlParser.js.map +1 -0
  74. package/dist/parse/ListsMarkdownParser.d.ts +11 -0
  75. package/dist/parse/ListsMarkdownParser.d.ts.map +1 -0
  76. package/dist/parse/ListsMarkdownParser.js +46 -0
  77. package/dist/parse/ListsMarkdownParser.js.map +1 -0
  78. package/dist/parse/MiscHtmlParser.d.ts +12 -0
  79. package/dist/parse/MiscHtmlParser.d.ts.map +1 -0
  80. package/dist/parse/MiscHtmlParser.js +85 -0
  81. package/dist/parse/MiscHtmlParser.js.map +1 -0
  82. package/dist/parse/MiscMarkdownParser.d.ts +11 -0
  83. package/dist/parse/MiscMarkdownParser.d.ts.map +1 -0
  84. package/dist/parse/MiscMarkdownParser.js +38 -0
  85. package/dist/parse/MiscMarkdownParser.js.map +1 -0
  86. package/dist/parse/ParagraphsHtmlParser.d.ts +11 -0
  87. package/dist/parse/ParagraphsHtmlParser.d.ts.map +1 -0
  88. package/dist/parse/ParagraphsHtmlParser.js +30 -0
  89. package/dist/parse/ParagraphsHtmlParser.js.map +1 -0
  90. package/dist/parse/ParagraphsMarkdownParser.d.ts +11 -0
  91. package/dist/parse/ParagraphsMarkdownParser.d.ts.map +1 -0
  92. package/dist/parse/ParagraphsMarkdownParser.js +25 -0
  93. package/dist/parse/ParagraphsMarkdownParser.js.map +1 -0
  94. package/dist/parse/SectionsHtmlParser.d.ts +12 -0
  95. package/dist/parse/SectionsHtmlParser.d.ts.map +1 -0
  96. package/dist/parse/SectionsHtmlParser.js +58 -0
  97. package/dist/parse/SectionsHtmlParser.js.map +1 -0
  98. package/dist/parse/TablesHtmlParser.d.ts +11 -0
  99. package/dist/parse/TablesHtmlParser.d.ts.map +1 -0
  100. package/dist/parse/TablesHtmlParser.js +81 -0
  101. package/dist/parse/TablesHtmlParser.js.map +1 -0
  102. package/dist/parse/TablesMarkdownParser.d.ts +11 -0
  103. package/dist/parse/TablesMarkdownParser.d.ts.map +1 -0
  104. package/dist/parse/TablesMarkdownParser.js +56 -0
  105. package/dist/parse/TablesMarkdownParser.js.map +1 -0
  106. package/dist/parse/XrefHtmlParser.d.ts +12 -0
  107. package/dist/parse/XrefHtmlParser.d.ts.map +1 -0
  108. package/dist/parse/XrefHtmlParser.js +124 -0
  109. package/dist/parse/XrefHtmlParser.js.map +1 -0
  110. package/dist/parse/__tests__/assembler.test.d.ts +5 -0
  111. package/dist/parse/__tests__/assembler.test.d.ts.map +1 -0
  112. package/dist/parse/__tests__/assembler.test.js +135 -0
  113. package/dist/parse/__tests__/assembler.test.js.map +1 -0
  114. package/dist/parse/__tests__/html.test.d.ts +5 -0
  115. package/dist/parse/__tests__/html.test.d.ts.map +1 -0
  116. package/dist/parse/__tests__/html.test.js +149 -0
  117. package/dist/parse/__tests__/html.test.js.map +1 -0
  118. package/dist/parse/__tests__/markdown.test.d.ts +5 -0
  119. package/dist/parse/__tests__/markdown.test.d.ts.map +1 -0
  120. package/dist/parse/__tests__/markdown.test.js +133 -0
  121. package/dist/parse/__tests__/markdown.test.js.map +1 -0
  122. package/dist/parse/__tests__/pipeline.test.d.ts +5 -0
  123. package/dist/parse/__tests__/pipeline.test.d.ts.map +1 -0
  124. package/dist/parse/__tests__/pipeline.test.js +215 -0
  125. package/dist/parse/__tests__/pipeline.test.js.map +1 -0
  126. package/dist/parse/__tests__/respec.test.d.ts +7 -0
  127. package/dist/parse/__tests__/respec.test.d.ts.map +1 -0
  128. package/dist/parse/__tests__/respec.test.js +151 -0
  129. package/dist/parse/__tests__/respec.test.js.map +1 -0
  130. package/dist/parse/assembler.d.ts +20 -0
  131. package/dist/parse/assembler.d.ts.map +1 -0
  132. package/dist/parse/assembler.js +175 -0
  133. package/dist/parse/assembler.js.map +1 -0
  134. package/dist/parse/html/AsideHtmlParser.d.ts +12 -0
  135. package/dist/parse/html/AsideHtmlParser.d.ts.map +1 -0
  136. package/dist/parse/html/AsideHtmlParser.js +74 -0
  137. package/dist/parse/html/AsideHtmlParser.js.map +1 -0
  138. package/dist/parse/html/BlockquoteHtmlParser.d.ts +11 -0
  139. package/dist/parse/html/BlockquoteHtmlParser.d.ts.map +1 -0
  140. package/dist/parse/html/BlockquoteHtmlParser.js +28 -0
  141. package/dist/parse/html/BlockquoteHtmlParser.js.map +1 -0
  142. package/dist/parse/html/CodeHtmlParser.d.ts +11 -0
  143. package/dist/parse/html/CodeHtmlParser.d.ts.map +1 -0
  144. package/dist/parse/html/CodeHtmlParser.js +38 -0
  145. package/dist/parse/html/CodeHtmlParser.js.map +1 -0
  146. package/dist/parse/html/DfnHtmlParser.d.ts +12 -0
  147. package/dist/parse/html/DfnHtmlParser.d.ts.map +1 -0
  148. package/dist/parse/html/DfnHtmlParser.js +53 -0
  149. package/dist/parse/html/DfnHtmlParser.js.map +1 -0
  150. package/dist/parse/html/HeadingsHtmlParser.d.ts +11 -0
  151. package/dist/parse/html/HeadingsHtmlParser.d.ts.map +1 -0
  152. package/dist/parse/html/HeadingsHtmlParser.js +30 -0
  153. package/dist/parse/html/HeadingsHtmlParser.js.map +1 -0
  154. package/dist/parse/html/InlinesHtmlParser.d.ts +12 -0
  155. package/dist/parse/html/InlinesHtmlParser.d.ts.map +1 -0
  156. package/dist/parse/html/InlinesHtmlParser.js +150 -0
  157. package/dist/parse/html/InlinesHtmlParser.js.map +1 -0
  158. package/dist/parse/html/ListsHtmlParser.d.ts +11 -0
  159. package/dist/parse/html/ListsHtmlParser.d.ts.map +1 -0
  160. package/dist/parse/html/ListsHtmlParser.js +71 -0
  161. package/dist/parse/html/ListsHtmlParser.js.map +1 -0
  162. package/dist/parse/html/MiscHtmlParser.d.ts +12 -0
  163. package/dist/parse/html/MiscHtmlParser.d.ts.map +1 -0
  164. package/dist/parse/html/MiscHtmlParser.js +85 -0
  165. package/dist/parse/html/MiscHtmlParser.js.map +1 -0
  166. package/dist/parse/html/ParagraphsHtmlParser.d.ts +11 -0
  167. package/dist/parse/html/ParagraphsHtmlParser.d.ts.map +1 -0
  168. package/dist/parse/html/ParagraphsHtmlParser.js +30 -0
  169. package/dist/parse/html/ParagraphsHtmlParser.js.map +1 -0
  170. package/dist/parse/html/SectionsHtmlParser.d.ts +12 -0
  171. package/dist/parse/html/SectionsHtmlParser.d.ts.map +1 -0
  172. package/dist/parse/html/SectionsHtmlParser.js +58 -0
  173. package/dist/parse/html/SectionsHtmlParser.js.map +1 -0
  174. package/dist/parse/html/TablesHtmlParser.d.ts +11 -0
  175. package/dist/parse/html/TablesHtmlParser.d.ts.map +1 -0
  176. package/dist/parse/html/TablesHtmlParser.js +81 -0
  177. package/dist/parse/html/TablesHtmlParser.js.map +1 -0
  178. package/dist/parse/html/XrefHtmlParser.d.ts +12 -0
  179. package/dist/parse/html/XrefHtmlParser.d.ts.map +1 -0
  180. package/dist/parse/html/XrefHtmlParser.js +125 -0
  181. package/dist/parse/html/XrefHtmlParser.js.map +1 -0
  182. package/dist/parse/html/handlers/blockquote.d.ts +9 -0
  183. package/dist/parse/html/handlers/blockquote.d.ts.map +1 -0
  184. package/dist/parse/html/handlers/blockquote.js +21 -0
  185. package/dist/parse/html/handlers/blockquote.js.map +1 -0
  186. package/dist/parse/html/handlers/code.d.ts +9 -0
  187. package/dist/parse/html/handlers/code.d.ts.map +1 -0
  188. package/dist/parse/html/handlers/code.js +31 -0
  189. package/dist/parse/html/handlers/code.js.map +1 -0
  190. package/dist/parse/html/handlers/containers.d.ts +16 -0
  191. package/dist/parse/html/handlers/containers.d.ts.map +1 -0
  192. package/dist/parse/html/handlers/containers.js +25 -0
  193. package/dist/parse/html/handlers/containers.js.map +1 -0
  194. package/dist/parse/html/handlers/heading.d.ts +9 -0
  195. package/dist/parse/html/handlers/heading.d.ts.map +1 -0
  196. package/dist/parse/html/handlers/heading.js +26 -0
  197. package/dist/parse/html/handlers/heading.js.map +1 -0
  198. package/dist/parse/html/handlers/index.d.ts +23 -0
  199. package/dist/parse/html/handlers/index.d.ts.map +1 -0
  200. package/dist/parse/html/handlers/index.js +47 -0
  201. package/dist/parse/html/handlers/index.js.map +1 -0
  202. package/dist/parse/html/handlers/inline.d.ts +35 -0
  203. package/dist/parse/html/handlers/inline.d.ts.map +1 -0
  204. package/dist/parse/html/handlers/inline.js +119 -0
  205. package/dist/parse/html/handlers/inline.js.map +1 -0
  206. package/dist/parse/html/handlers/list.d.ts +9 -0
  207. package/dist/parse/html/handlers/list.d.ts.map +1 -0
  208. package/dist/parse/html/handlers/list.js +63 -0
  209. package/dist/parse/html/handlers/list.js.map +1 -0
  210. package/dist/parse/html/handlers/paragraph.d.ts +9 -0
  211. package/dist/parse/html/handlers/paragraph.d.ts.map +1 -0
  212. package/dist/parse/html/handlers/paragraph.js +20 -0
  213. package/dist/parse/html/handlers/paragraph.js.map +1 -0
  214. package/dist/parse/html/handlers/section.d.ts +9 -0
  215. package/dist/parse/html/handlers/section.d.ts.map +1 -0
  216. package/dist/parse/html/handlers/section.js +53 -0
  217. package/dist/parse/html/handlers/section.js.map +1 -0
  218. package/dist/parse/html/index.d.ts +5 -0
  219. package/dist/parse/html/index.d.ts.map +1 -0
  220. package/dist/parse/html/index.js +12 -0
  221. package/dist/parse/html/index.js.map +1 -0
  222. package/dist/parse/html/parser.d.ts +51 -0
  223. package/dist/parse/html/parser.d.ts.map +1 -0
  224. package/dist/parse/html/parser.js +228 -0
  225. package/dist/parse/html/parser.js.map +1 -0
  226. package/dist/parse/index.d.ts +16 -0
  227. package/dist/parse/index.d.ts.map +1 -0
  228. package/dist/parse/index.js +19 -0
  229. package/dist/parse/index.js.map +1 -0
  230. package/dist/parse/markdown/BlockquoteMarkdownParser.d.ts +11 -0
  231. package/dist/parse/markdown/BlockquoteMarkdownParser.d.ts.map +1 -0
  232. package/dist/parse/markdown/BlockquoteMarkdownParser.js +26 -0
  233. package/dist/parse/markdown/BlockquoteMarkdownParser.js.map +1 -0
  234. package/dist/parse/markdown/CodeMarkdownParser.d.ts +11 -0
  235. package/dist/parse/markdown/CodeMarkdownParser.d.ts.map +1 -0
  236. package/dist/parse/markdown/CodeMarkdownParser.js +29 -0
  237. package/dist/parse/markdown/CodeMarkdownParser.js.map +1 -0
  238. package/dist/parse/markdown/HeadingsMarkdownParser.d.ts +11 -0
  239. package/dist/parse/markdown/HeadingsMarkdownParser.d.ts.map +1 -0
  240. package/dist/parse/markdown/HeadingsMarkdownParser.js +26 -0
  241. package/dist/parse/markdown/HeadingsMarkdownParser.js.map +1 -0
  242. package/dist/parse/markdown/InlinesMarkdownParser.d.ts +11 -0
  243. package/dist/parse/markdown/InlinesMarkdownParser.d.ts.map +1 -0
  244. package/dist/parse/markdown/InlinesMarkdownParser.js +91 -0
  245. package/dist/parse/markdown/InlinesMarkdownParser.js.map +1 -0
  246. package/dist/parse/markdown/ListsMarkdownParser.d.ts +11 -0
  247. package/dist/parse/markdown/ListsMarkdownParser.d.ts.map +1 -0
  248. package/dist/parse/markdown/ListsMarkdownParser.js +46 -0
  249. package/dist/parse/markdown/ListsMarkdownParser.js.map +1 -0
  250. package/dist/parse/markdown/MiscMarkdownParser.d.ts +11 -0
  251. package/dist/parse/markdown/MiscMarkdownParser.d.ts.map +1 -0
  252. package/dist/parse/markdown/MiscMarkdownParser.js +38 -0
  253. package/dist/parse/markdown/MiscMarkdownParser.js.map +1 -0
  254. package/dist/parse/markdown/ParagraphsMarkdownParser.d.ts +11 -0
  255. package/dist/parse/markdown/ParagraphsMarkdownParser.d.ts.map +1 -0
  256. package/dist/parse/markdown/ParagraphsMarkdownParser.js +25 -0
  257. package/dist/parse/markdown/ParagraphsMarkdownParser.js.map +1 -0
  258. package/dist/parse/markdown/TablesMarkdownParser.d.ts +11 -0
  259. package/dist/parse/markdown/TablesMarkdownParser.d.ts.map +1 -0
  260. package/dist/parse/markdown/TablesMarkdownParser.js +56 -0
  261. package/dist/parse/markdown/TablesMarkdownParser.js.map +1 -0
  262. package/dist/parse/markdown/handlers/blockquote.d.ts +9 -0
  263. package/dist/parse/markdown/handlers/blockquote.d.ts.map +1 -0
  264. package/dist/parse/markdown/handlers/blockquote.js +22 -0
  265. package/dist/parse/markdown/handlers/blockquote.js.map +1 -0
  266. package/dist/parse/markdown/handlers/code.d.ts +9 -0
  267. package/dist/parse/markdown/handlers/code.d.ts.map +1 -0
  268. package/dist/parse/markdown/handlers/code.js +25 -0
  269. package/dist/parse/markdown/handlers/code.js.map +1 -0
  270. package/dist/parse/markdown/handlers/heading.d.ts +9 -0
  271. package/dist/parse/markdown/handlers/heading.d.ts.map +1 -0
  272. package/dist/parse/markdown/handlers/heading.js +22 -0
  273. package/dist/parse/markdown/handlers/heading.js.map +1 -0
  274. package/dist/parse/markdown/handlers/index.d.ts +23 -0
  275. package/dist/parse/markdown/handlers/index.d.ts.map +1 -0
  276. package/dist/parse/markdown/handlers/index.js +47 -0
  277. package/dist/parse/markdown/handlers/index.js.map +1 -0
  278. package/dist/parse/markdown/handlers/inline.d.ts +35 -0
  279. package/dist/parse/markdown/handlers/inline.d.ts.map +1 -0
  280. package/dist/parse/markdown/handlers/inline.js +126 -0
  281. package/dist/parse/markdown/handlers/inline.js.map +1 -0
  282. package/dist/parse/markdown/handlers/list.d.ts +9 -0
  283. package/dist/parse/markdown/handlers/list.d.ts.map +1 -0
  284. package/dist/parse/markdown/handlers/list.js +42 -0
  285. package/dist/parse/markdown/handlers/list.js.map +1 -0
  286. package/dist/parse/markdown/handlers/misc.d.ts +15 -0
  287. package/dist/parse/markdown/handlers/misc.d.ts.map +1 -0
  288. package/dist/parse/markdown/handlers/misc.js +38 -0
  289. package/dist/parse/markdown/handlers/misc.js.map +1 -0
  290. package/dist/parse/markdown/handlers/paragraph.d.ts +9 -0
  291. package/dist/parse/markdown/handlers/paragraph.d.ts.map +1 -0
  292. package/dist/parse/markdown/handlers/paragraph.js +21 -0
  293. package/dist/parse/markdown/handlers/paragraph.js.map +1 -0
  294. package/dist/parse/markdown/handlers/table.d.ts +9 -0
  295. package/dist/parse/markdown/handlers/table.d.ts.map +1 -0
  296. package/dist/parse/markdown/handlers/table.js +52 -0
  297. package/dist/parse/markdown/handlers/table.js.map +1 -0
  298. package/dist/parse/markdown/index.d.ts +5 -0
  299. package/dist/parse/markdown/index.d.ts.map +1 -0
  300. package/dist/parse/markdown/index.js +12 -0
  301. package/dist/parse/markdown/index.js.map +1 -0
  302. package/dist/parse/markdown/parser.d.ts +51 -0
  303. package/dist/parse/markdown/parser.d.ts.map +1 -0
  304. package/dist/parse/markdown/parser.js +134 -0
  305. package/dist/parse/markdown/parser.js.map +1 -0
  306. package/dist/parse/normalize.d.ts +51 -0
  307. package/dist/parse/normalize.d.ts.map +1 -0
  308. package/dist/parse/normalize.js +78 -0
  309. package/dist/parse/normalize.js.map +1 -0
  310. package/dist/parse/parsers.d.ts +37 -0
  311. package/dist/parse/parsers.d.ts.map +1 -0
  312. package/dist/parse/parsers.js +86 -0
  313. package/dist/parse/parsers.js.map +1 -0
  314. package/dist/parse/pipeline.d.ts +41 -0
  315. package/dist/parse/pipeline.d.ts.map +1 -0
  316. package/dist/parse/pipeline.js +120 -0
  317. package/dist/parse/pipeline.js.map +1 -0
  318. package/dist/parse/registry.d.ts +156 -0
  319. package/dist/parse/registry.d.ts.map +1 -0
  320. package/dist/parse/registry.js +104 -0
  321. package/dist/parse/registry.js.map +1 -0
  322. package/dist/parse/types.d.ts +67 -0
  323. package/dist/parse/types.d.ts.map +1 -0
  324. package/dist/parse/types.js +19 -0
  325. package/dist/parse/types.js.map +1 -0
  326. package/dist/pipeline/__tests__/pipeline.test.d.ts +5 -0
  327. package/dist/pipeline/__tests__/pipeline.test.d.ts.map +1 -0
  328. package/dist/pipeline/__tests__/pipeline.test.js +69 -0
  329. package/dist/pipeline/__tests__/pipeline.test.js.map +1 -0
  330. package/dist/pipeline/__tests__/single-as-workspace.test.d.ts +2 -0
  331. package/dist/pipeline/__tests__/single-as-workspace.test.d.ts.map +1 -0
  332. package/dist/pipeline/__tests__/single-as-workspace.test.js +19 -0
  333. package/dist/pipeline/__tests__/single-as-workspace.test.js.map +1 -0
  334. package/dist/pipeline/__tests__/workspace-rules.test.d.ts +11 -0
  335. package/dist/pipeline/__tests__/workspace-rules.test.d.ts.map +1 -0
  336. package/dist/pipeline/__tests__/workspace-rules.test.js +54 -0
  337. package/dist/pipeline/__tests__/workspace-rules.test.js.map +1 -0
  338. package/dist/pipeline/__tests__/workspace.test.d.ts +2 -0
  339. package/dist/pipeline/__tests__/workspace.test.d.ts.map +1 -0
  340. package/dist/pipeline/__tests__/workspace.test.js +61 -0
  341. package/dist/pipeline/__tests__/workspace.test.js.map +1 -0
  342. package/dist/pipeline/index.d.ts +34 -0
  343. package/dist/pipeline/index.d.ts.map +1 -0
  344. package/dist/pipeline/index.js +45 -0
  345. package/dist/pipeline/index.js.map +1 -0
  346. package/dist/pipeline/runner.d.ts +38 -0
  347. package/dist/pipeline/runner.d.ts.map +1 -0
  348. package/dist/pipeline/runner.js +128 -0
  349. package/dist/pipeline/runner.js.map +1 -0
  350. package/dist/pipeline/types.d.ts +106 -0
  351. package/dist/pipeline/types.d.ts.map +1 -0
  352. package/dist/pipeline/types.js +9 -0
  353. package/dist/pipeline/types.js.map +1 -0
  354. package/dist/pipeline/workspace-index.d.ts +11 -0
  355. package/dist/pipeline/workspace-index.d.ts.map +1 -0
  356. package/dist/pipeline/workspace-index.js +57 -0
  357. package/dist/pipeline/workspace-index.js.map +1 -0
  358. package/dist/plugins/__tests__/citation-transform.test.d.ts +7 -0
  359. package/dist/plugins/__tests__/citation-transform.test.d.ts.map +1 -0
  360. package/dist/plugins/__tests__/citation-transform.test.js +89 -0
  361. package/dist/plugins/__tests__/citation-transform.test.js.map +1 -0
  362. package/dist/plugins/__tests__/dfn-parsing.test.d.ts +2 -0
  363. package/dist/plugins/__tests__/dfn-parsing.test.d.ts.map +1 -0
  364. package/dist/plugins/__tests__/dfn-parsing.test.js +65 -0
  365. package/dist/plugins/__tests__/dfn-parsing.test.js.map +1 -0
  366. package/dist/plugins/__tests__/dfn-resolve.test.d.ts +5 -0
  367. package/dist/plugins/__tests__/dfn-resolve.test.d.ts.map +1 -0
  368. package/dist/plugins/__tests__/dfn-resolve.test.js +152 -0
  369. package/dist/plugins/__tests__/dfn-resolve.test.js.map +1 -0
  370. package/dist/plugins/__tests__/xref-parsing.test.d.ts +2 -0
  371. package/dist/plugins/__tests__/xref-parsing.test.d.ts.map +1 -0
  372. package/dist/plugins/__tests__/xref-parsing.test.js +66 -0
  373. package/dist/plugins/__tests__/xref-parsing.test.js.map +1 -0
  374. package/dist/plugins/aside.d.ts +12 -0
  375. package/dist/plugins/aside.d.ts.map +1 -0
  376. package/dist/plugins/aside.js +78 -0
  377. package/dist/plugins/aside.js.map +1 -0
  378. package/dist/plugins/blockquote.d.ts +11 -0
  379. package/dist/plugins/blockquote.d.ts.map +1 -0
  380. package/dist/plugins/blockquote.js +47 -0
  381. package/dist/plugins/blockquote.js.map +1 -0
  382. package/dist/plugins/citation-transform.d.ts +19 -0
  383. package/dist/plugins/citation-transform.d.ts.map +1 -0
  384. package/dist/plugins/citation-transform.js +176 -0
  385. package/dist/plugins/citation-transform.js.map +1 -0
  386. package/dist/plugins/citation.d.ts +21 -0
  387. package/dist/plugins/citation.d.ts.map +1 -0
  388. package/dist/plugins/citation.js +131 -0
  389. package/dist/plugins/citation.js.map +1 -0
  390. package/dist/plugins/code.d.ts +11 -0
  391. package/dist/plugins/code.d.ts.map +1 -0
  392. package/dist/plugins/code.js +60 -0
  393. package/dist/plugins/code.js.map +1 -0
  394. package/dist/plugins/core-html.d.ts +27 -0
  395. package/dist/plugins/core-html.d.ts.map +1 -0
  396. package/dist/plugins/core-html.js +53 -0
  397. package/dist/plugins/core-html.js.map +1 -0
  398. package/dist/plugins/core-markdown.d.ts +26 -0
  399. package/dist/plugins/core-markdown.d.ts.map +1 -0
  400. package/dist/plugins/core-markdown.js +55 -0
  401. package/dist/plugins/core-markdown.js.map +1 -0
  402. package/dist/plugins/data-cite.d.ts +12 -0
  403. package/dist/plugins/data-cite.d.ts.map +1 -0
  404. package/dist/plugins/data-cite.js +50 -0
  405. package/dist/plugins/data-cite.js.map +1 -0
  406. package/dist/plugins/dfn-resolve.d.ts +15 -0
  407. package/dist/plugins/dfn-resolve.d.ts.map +1 -0
  408. package/dist/plugins/dfn-resolve.js +257 -0
  409. package/dist/plugins/dfn-resolve.js.map +1 -0
  410. package/dist/plugins/dfn.d.ts +12 -0
  411. package/dist/plugins/dfn.d.ts.map +1 -0
  412. package/dist/plugins/dfn.js +57 -0
  413. package/dist/plugins/dfn.js.map +1 -0
  414. package/dist/plugins/directives.d.ts +8 -0
  415. package/dist/plugins/directives.d.ts.map +1 -0
  416. package/dist/plugins/directives.js +34 -0
  417. package/dist/plugins/directives.js.map +1 -0
  418. package/dist/plugins/heading.d.ts +11 -0
  419. package/dist/plugins/heading.d.ts.map +1 -0
  420. package/dist/plugins/heading.js +49 -0
  421. package/dist/plugins/heading.js.map +1 -0
  422. package/dist/plugins/index.d.ts +12 -0
  423. package/dist/plugins/index.d.ts.map +1 -0
  424. package/dist/plugins/index.js +26 -0
  425. package/dist/plugins/index.js.map +1 -0
  426. package/dist/plugins/inline.d.ts +12 -0
  427. package/dist/plugins/inline.d.ts.map +1 -0
  428. package/dist/plugins/inline.js +234 -0
  429. package/dist/plugins/inline.js.map +1 -0
  430. package/dist/plugins/list.d.ts +11 -0
  431. package/dist/plugins/list.d.ts.map +1 -0
  432. package/dist/plugins/list.js +110 -0
  433. package/dist/plugins/list.js.map +1 -0
  434. package/dist/plugins/misc.d.ts +12 -0
  435. package/dist/plugins/misc.d.ts.map +1 -0
  436. package/dist/plugins/misc.js +116 -0
  437. package/dist/plugins/misc.js.map +1 -0
  438. package/dist/plugins/paragraph.d.ts +11 -0
  439. package/dist/plugins/paragraph.d.ts.map +1 -0
  440. package/dist/plugins/paragraph.js +48 -0
  441. package/dist/plugins/paragraph.js.map +1 -0
  442. package/dist/plugins/section.d.ts +12 -0
  443. package/dist/plugins/section.d.ts.map +1 -0
  444. package/dist/plugins/section.js +62 -0
  445. package/dist/plugins/section.js.map +1 -0
  446. package/dist/plugins/table.d.ts +11 -0
  447. package/dist/plugins/table.d.ts.map +1 -0
  448. package/dist/plugins/table.js +130 -0
  449. package/dist/plugins/table.js.map +1 -0
  450. package/dist/plugins/xref.d.ts +12 -0
  451. package/dist/plugins/xref.d.ts.map +1 -0
  452. package/dist/plugins/xref.js +92 -0
  453. package/dist/plugins/xref.js.map +1 -0
  454. package/dist/postprocess/__tests__/citation-transform.test.d.ts +7 -0
  455. package/dist/postprocess/__tests__/citation-transform.test.d.ts.map +1 -0
  456. package/dist/postprocess/__tests__/citation-transform.test.js +89 -0
  457. package/dist/postprocess/__tests__/citation-transform.test.js.map +1 -0
  458. package/dist/postprocess/__tests__/dfn-resolve.test.d.ts +5 -0
  459. package/dist/postprocess/__tests__/dfn-resolve.test.d.ts.map +1 -0
  460. package/dist/postprocess/__tests__/dfn-resolve.test.js +160 -0
  461. package/dist/postprocess/__tests__/dfn-resolve.test.js.map +1 -0
  462. package/dist/postprocess/__tests__/section-id.test.d.ts +5 -0
  463. package/dist/postprocess/__tests__/section-id.test.d.ts.map +1 -0
  464. package/dist/postprocess/__tests__/section-id.test.js +222 -0
  465. package/dist/postprocess/__tests__/section-id.test.js.map +1 -0
  466. package/dist/postprocess/citation-transform.d.ts +19 -0
  467. package/dist/postprocess/citation-transform.d.ts.map +1 -0
  468. package/dist/postprocess/citation-transform.js +176 -0
  469. package/dist/postprocess/citation-transform.js.map +1 -0
  470. package/dist/postprocess/dfn-index.d.ts +16 -0
  471. package/dist/postprocess/dfn-index.d.ts.map +1 -0
  472. package/dist/postprocess/dfn-index.js +72 -0
  473. package/dist/postprocess/dfn-index.js.map +1 -0
  474. package/dist/postprocess/dfn-resolve.d.ts +15 -0
  475. package/dist/postprocess/dfn-resolve.d.ts.map +1 -0
  476. package/dist/postprocess/dfn-resolve.js +257 -0
  477. package/dist/postprocess/dfn-resolve.js.map +1 -0
  478. package/dist/postprocess/index.d.ts +15 -0
  479. package/dist/postprocess/index.d.ts.map +1 -0
  480. package/dist/postprocess/index.js +36 -0
  481. package/dist/postprocess/index.js.map +1 -0
  482. package/dist/postprocess/plugins/citation-transform.d.ts +19 -0
  483. package/dist/postprocess/plugins/citation-transform.d.ts.map +1 -0
  484. package/dist/postprocess/plugins/citation-transform.js +179 -0
  485. package/dist/postprocess/plugins/citation-transform.js.map +1 -0
  486. package/dist/postprocess/plugins/dfn-index.d.ts +16 -0
  487. package/dist/postprocess/plugins/dfn-index.d.ts.map +1 -0
  488. package/dist/postprocess/plugins/dfn-index.js +76 -0
  489. package/dist/postprocess/plugins/dfn-index.js.map +1 -0
  490. package/dist/postprocess/plugins/reference-resolve.d.ts +19 -0
  491. package/dist/postprocess/plugins/reference-resolve.d.ts.map +1 -0
  492. package/dist/postprocess/plugins/reference-resolve.js +103 -0
  493. package/dist/postprocess/plugins/reference-resolve.js.map +1 -0
  494. package/dist/postprocess/plugins/section-id.d.ts +16 -0
  495. package/dist/postprocess/plugins/section-id.d.ts.map +1 -0
  496. package/dist/postprocess/plugins/section-id.js +116 -0
  497. package/dist/postprocess/plugins/section-id.js.map +1 -0
  498. package/dist/postprocess/plugins/walk-ast.d.ts +38 -0
  499. package/dist/postprocess/plugins/walk-ast.d.ts.map +1 -0
  500. package/dist/postprocess/plugins/walk-ast.js +92 -0
  501. package/dist/postprocess/plugins/walk-ast.js.map +1 -0
  502. package/dist/postprocess/reference-resolve.d.ts +19 -0
  503. package/dist/postprocess/reference-resolve.d.ts.map +1 -0
  504. package/dist/postprocess/reference-resolve.js +105 -0
  505. package/dist/postprocess/reference-resolve.js.map +1 -0
  506. package/dist/postprocess/walk-ast.d.ts +38 -0
  507. package/dist/postprocess/walk-ast.d.ts.map +1 -0
  508. package/dist/postprocess/walk-ast.js +94 -0
  509. package/dist/postprocess/walk-ast.js.map +1 -0
  510. package/dist/preprocess/__tests__/pipeline.test.d.ts +5 -0
  511. package/dist/preprocess/__tests__/pipeline.test.d.ts.map +1 -0
  512. package/dist/preprocess/__tests__/pipeline.test.js +188 -0
  513. package/dist/preprocess/__tests__/pipeline.test.js.map +1 -0
  514. package/dist/preprocess/__tests__/resolver.test.d.ts +5 -0
  515. package/dist/preprocess/__tests__/resolver.test.d.ts.map +1 -0
  516. package/dist/preprocess/__tests__/resolver.test.js +165 -0
  517. package/dist/preprocess/__tests__/resolver.test.js.map +1 -0
  518. package/dist/preprocess/__tests__/scan-html.test.d.ts +5 -0
  519. package/dist/preprocess/__tests__/scan-html.test.d.ts.map +1 -0
  520. package/dist/preprocess/__tests__/scan-html.test.js +99 -0
  521. package/dist/preprocess/__tests__/scan-html.test.js.map +1 -0
  522. package/dist/preprocess/__tests__/scan-markdown.test.d.ts +5 -0
  523. package/dist/preprocess/__tests__/scan-markdown.test.d.ts.map +1 -0
  524. package/dist/preprocess/__tests__/scan-markdown.test.js +92 -0
  525. package/dist/preprocess/__tests__/scan-markdown.test.js.map +1 -0
  526. package/dist/preprocess/config/doc-config.d.ts +30 -0
  527. package/dist/preprocess/config/doc-config.d.ts.map +1 -0
  528. package/dist/preprocess/config/doc-config.js +85 -0
  529. package/dist/preprocess/config/doc-config.js.map +1 -0
  530. package/dist/preprocess/config/index.d.ts +9 -0
  531. package/dist/preprocess/config/index.d.ts.map +1 -0
  532. package/dist/preprocess/config/index.js +7 -0
  533. package/dist/preprocess/config/index.js.map +1 -0
  534. package/dist/preprocess/config/loader.d.ts +61 -0
  535. package/dist/preprocess/config/loader.d.ts.map +1 -0
  536. package/dist/preprocess/config/loader.js +40 -0
  537. package/dist/preprocess/config/loader.js.map +1 -0
  538. package/dist/preprocess/config/normalize.d.ts +19 -0
  539. package/dist/preprocess/config/normalize.d.ts.map +1 -0
  540. package/dist/preprocess/config/normalize.js +106 -0
  541. package/dist/preprocess/config/normalize.js.map +1 -0
  542. package/dist/preprocess/config/types.d.ts +40 -0
  543. package/dist/preprocess/config/types.d.ts.map +1 -0
  544. package/dist/preprocess/config/types.js +8 -0
  545. package/dist/preprocess/config/types.js.map +1 -0
  546. package/dist/preprocess/include/index.d.ts +7 -0
  547. package/dist/preprocess/include/index.d.ts.map +1 -0
  548. package/dist/preprocess/include/index.js +7 -0
  549. package/dist/preprocess/include/index.js.map +1 -0
  550. package/dist/preprocess/include/resolver.d.ts +40 -0
  551. package/dist/preprocess/include/resolver.d.ts.map +1 -0
  552. package/dist/preprocess/include/resolver.js +187 -0
  553. package/dist/preprocess/include/resolver.js.map +1 -0
  554. package/dist/preprocess/include/scan-html.d.ts +31 -0
  555. package/dist/preprocess/include/scan-html.d.ts.map +1 -0
  556. package/dist/preprocess/include/scan-html.js +100 -0
  557. package/dist/preprocess/include/scan-html.js.map +1 -0
  558. package/dist/preprocess/include/scan-markdown.d.ts +31 -0
  559. package/dist/preprocess/include/scan-markdown.d.ts.map +1 -0
  560. package/dist/preprocess/include/scan-markdown.js +83 -0
  561. package/dist/preprocess/include/scan-markdown.js.map +1 -0
  562. package/dist/preprocess/index.d.ts +16 -0
  563. package/dist/preprocess/index.d.ts.map +1 -0
  564. package/dist/preprocess/index.js +16 -0
  565. package/dist/preprocess/index.js.map +1 -0
  566. package/dist/preprocess/pipeline.d.ts +57 -0
  567. package/dist/preprocess/pipeline.d.ts.map +1 -0
  568. package/dist/preprocess/pipeline.js +100 -0
  569. package/dist/preprocess/pipeline.js.map +1 -0
  570. package/dist/preprocess/types.d.ts +197 -0
  571. package/dist/preprocess/types.d.ts.map +1 -0
  572. package/dist/preprocess/types.js +22 -0
  573. package/dist/preprocess/types.js.map +1 -0
  574. package/dist/types/ast.generated.d.ts +517 -0
  575. package/dist/types/ast.generated.d.ts.map +1 -0
  576. package/dist/types/ast.generated.js +66 -0
  577. package/dist/types/ast.generated.js.map +1 -0
  578. package/dist/validation/validate.d.ts +86 -0
  579. package/dist/validation/validate.d.ts.map +1 -0
  580. package/dist/validation/validate.js +162 -0
  581. package/dist/validation/validate.js.map +1 -0
  582. package/dist/workspace/__tests__/sort.test.d.ts +2 -0
  583. package/dist/workspace/__tests__/sort.test.d.ts.map +1 -0
  584. package/dist/workspace/__tests__/sort.test.js +122 -0
  585. package/dist/workspace/__tests__/sort.test.js.map +1 -0
  586. package/dist/workspace/index.d.ts +8 -0
  587. package/dist/workspace/index.d.ts.map +1 -0
  588. package/dist/workspace/index.js +7 -0
  589. package/dist/workspace/index.js.map +1 -0
  590. package/dist/workspace/sort.d.ts +49 -0
  591. package/dist/workspace/sort.d.ts.map +1 -0
  592. package/dist/workspace/sort.js +114 -0
  593. package/dist/workspace/sort.js.map +1 -0
  594. package/package.json +46 -81
  595. package/schema/spec-ast.schema.json +1440 -0
  596. package/bin/speculator.mjs +0 -76
  597. package/dist/browser.cjs +0 -1693
  598. package/dist/browser.d.cts +0 -416
  599. package/dist/browser.d.ts +0 -416
  600. package/dist/browser.js +0 -36
  601. package/dist/chunk-KC3NVWHK.js +0 -28
  602. package/dist/chunk-ONLMOJIJ.js +0 -1649
  603. package/dist/cli/export-assertions.cjs +0 -1713
  604. package/dist/cli/export-assertions.d.cts +0 -25
  605. package/dist/cli/export-assertions.d.ts +0 -25
  606. package/dist/cli/export-assertions.js +0 -107
  607. package/dist/node.cjs +0 -1715
  608. package/dist/node.d.cts +0 -17
  609. package/dist/node.d.ts +0 -17
  610. package/dist/node.js +0 -40
@@ -0,0 +1,187 @@
1
+ /**
2
+ * Include Resolver
3
+ *
4
+ * Recursively resolves includes from an entry file, building the IncludeGraph
5
+ * and producing ordered SourceUnits for the composite document.
6
+ *
7
+ * Key behaviors:
8
+ * - Deterministic order: includes are processed in encounter order
9
+ * - Cycle detection: prevents infinite loops with clear diagnostics
10
+ * - Content splitting: preserves sourcePos.file for each fragment
11
+ */
12
+ import { isFileNotFoundError } from '#src/file-provider/types';
13
+ import { inferFormat, createDiagnostic } from '#src/preprocess/types';
14
+ import { scanMarkdownIncludes } from '#src/preprocess/include/scan-markdown';
15
+ import { scanHtmlIncludes } from '#src/preprocess/include/scan-html';
16
+ /**
17
+ * Count lines up to an offset
18
+ */
19
+ function countLinesUpTo(content, offset) {
20
+ let lines = 1;
21
+ for (let i = 0; i < offset && i < content.length; i++) {
22
+ if (content[i] === '\n') {
23
+ lines++;
24
+ }
25
+ }
26
+ return lines;
27
+ }
28
+ /**
29
+ * Scan content for includes based on format
30
+ */
31
+ function scanIncludes(content, file, format) {
32
+ return format === 'markdown'
33
+ ? scanMarkdownIncludes(content, file)
34
+ : scanHtmlIncludes(content, file);
35
+ }
36
+ /**
37
+ * Split content at include points and recursively resolve
38
+ *
39
+ * Returns SourceUnits in document order (includes expanded in-place)
40
+ */
41
+ async function resolveFile(file, format, ctx) {
42
+ const { fileProvider, includeGraph, diagnostics, activePath, visited } = ctx;
43
+ // Cycle detection
44
+ if (activePath.has(file)) {
45
+ const cycle = [...activePath, file];
46
+ diagnostics.push(createDiagnostic('error', 'include-cycle', `Include cycle detected: ${cycle.join(' → ')}`, file));
47
+ return [];
48
+ }
49
+ // Check if already processed (for diamond includes - A includes B and C, both include D)
50
+ const cached = visited.get(file);
51
+ if (cached) {
52
+ // Return a single unit for previously visited file
53
+ return [{
54
+ file,
55
+ format: cached.format,
56
+ content: cached.content,
57
+ startLine: 1,
58
+ }];
59
+ }
60
+ // Read file
61
+ let content;
62
+ try {
63
+ content = await fileProvider.readText(file);
64
+ }
65
+ catch (error) {
66
+ if (isFileNotFoundError(error)) {
67
+ diagnostics.push(createDiagnostic('error', 'include-not-found', `Included file not found: ${file}`, file));
68
+ }
69
+ else {
70
+ diagnostics.push(createDiagnostic('error', 'include-not-found', `Failed to read included file: ${file} - ${error instanceof Error ? error.message : String(error)}`, file));
71
+ }
72
+ return [];
73
+ }
74
+ // Cache for diamond include handling
75
+ visited.set(file, { content, format });
76
+ // Mark as active for cycle detection
77
+ activePath.add(file);
78
+ try {
79
+ // Scan for includes
80
+ const includes = scanIncludes(content, file, format);
81
+ // Record in include graph
82
+ if (includes.length > 0) {
83
+ const edges = includes.map(inc => ({
84
+ target: fileProvider.resolve(file, inc.relativePath),
85
+ sourcePos: inc.sourcePos,
86
+ }));
87
+ includeGraph.set(file, edges);
88
+ }
89
+ // If no includes, return single unit
90
+ if (includes.length === 0) {
91
+ return [{
92
+ file,
93
+ format,
94
+ content,
95
+ startLine: 1,
96
+ }];
97
+ }
98
+ // Split content at include points and recursively resolve
99
+ const units = [];
100
+ let lastEnd = 0;
101
+ for (const include of includes) {
102
+ // Add content before this include
103
+ if (include.startOffset > lastEnd) {
104
+ const beforeContent = content.slice(lastEnd, include.startOffset);
105
+ if (beforeContent.trim()) {
106
+ units.push({
107
+ file,
108
+ format,
109
+ content: beforeContent,
110
+ startLine: countLinesUpTo(content, lastEnd),
111
+ });
112
+ }
113
+ }
114
+ // Resolve the included file
115
+ const includedPath = fileProvider.resolve(file, include.relativePath);
116
+ const includedFormat = include.format ?? inferFormat(include.relativePath);
117
+ const includedUnits = await resolveFile(includedPath, includedFormat, ctx);
118
+ units.push(...includedUnits);
119
+ lastEnd = include.endOffset;
120
+ // Skip trailing newline after directive if present
121
+ if (content[lastEnd] === '\n') {
122
+ lastEnd++;
123
+ }
124
+ }
125
+ // Add remaining content after last include
126
+ if (lastEnd < content.length) {
127
+ const afterContent = content.slice(lastEnd);
128
+ if (afterContent.trim()) {
129
+ units.push({
130
+ file,
131
+ format,
132
+ content: afterContent,
133
+ startLine: countLinesUpTo(content, lastEnd),
134
+ });
135
+ }
136
+ }
137
+ return units;
138
+ }
139
+ finally {
140
+ // Remove from active path when done
141
+ activePath.delete(file);
142
+ }
143
+ }
144
+ /**
145
+ * Resolve all includes from an entry file
146
+ *
147
+ * @param entry - Canonical path to entry file
148
+ * @param entryFormat - Format of entry file (inferred if not provided)
149
+ * @param fileProvider - File provider for reading files
150
+ * @returns CompositeSource with resolved includes and diagnostics
151
+ *
152
+ * @example
153
+ * ```typescript
154
+ * const { source, diagnostics } = await resolveIncludes(
155
+ * '/spec/format.md',
156
+ * 'markdown',
157
+ * fileProvider
158
+ * );
159
+ *
160
+ * // source.units is ordered by document flow
161
+ * for (const unit of source.units) {
162
+ * console.log(`${unit.file}:${unit.startLine}`);
163
+ * }
164
+ * ```
165
+ */
166
+ export async function resolveIncludes(entry, entryFormat, fileProvider) {
167
+ const canonicalEntry = fileProvider.canonicalize(entry);
168
+ const format = entryFormat ?? inferFormat(canonicalEntry);
169
+ const ctx = {
170
+ fileProvider,
171
+ includeGraph: new Map(),
172
+ diagnostics: [],
173
+ activePath: new Set(),
174
+ visited: new Map(),
175
+ };
176
+ const units = await resolveFile(canonicalEntry, format, ctx);
177
+ return {
178
+ source: {
179
+ entryFile: canonicalEntry,
180
+ entryFormat: format,
181
+ units,
182
+ includeGraph: ctx.includeGraph,
183
+ },
184
+ diagnostics: ctx.diagnostics,
185
+ };
186
+ }
187
+ //# sourceMappingURL=resolver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolver.js","sourceRoot":"","sources":["../../../src/preprocess/include/resolver.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * HTML Include Scanner
3
+ *
4
+ * Scans HTML content for data-include sections.
5
+ *
6
+ * Format: <section data-include="./path.md" data-include-format="markdown"></section>
7
+ *
8
+ * The scanner uses a simple regex-based approach that handles the common cases
9
+ * without requiring a full HTML parser dependency.
10
+ */
11
+ import type { IncludeDirective } from '#src/preprocess/types';
12
+ /**
13
+ * Scan HTML content for include directives
14
+ *
15
+ * @param content - HTML file content
16
+ * @param file - Canonical path of the file being scanned
17
+ * @returns Array of include directives in encounter order
18
+ *
19
+ * @example
20
+ * ```typescript
21
+ * const content = `
22
+ * <body>
23
+ * <section data-include="./intro.md" data-include-format="markdown"></section>
24
+ * </body>
25
+ * `;
26
+ * const includes = scanHtmlIncludes(content, '/spec/format.html');
27
+ * // Returns: [{ relativePath: './intro.md', format: 'markdown', ... }]
28
+ * ```
29
+ */
30
+ export declare function scanHtmlIncludes(content: string, file: string): IncludeDirective[];
31
+ //# sourceMappingURL=scan-html.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scan-html.d.ts","sourceRoot":"","sources":["../../../src/preprocess/include/scan-html.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAgB,MAAM,uBAAuB,CAAC;AAiD5E;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAkClF"}
@@ -0,0 +1,100 @@
1
+ /**
2
+ * HTML Include Scanner
3
+ *
4
+ * Scans HTML content for data-include sections.
5
+ *
6
+ * Format: <section data-include="./path.md" data-include-format="markdown"></section>
7
+ *
8
+ * The scanner uses a simple regex-based approach that handles the common cases
9
+ * without requiring a full HTML parser dependency.
10
+ */
11
+ import { inferFormat } from '#src/preprocess/types';
12
+ /**
13
+ * Regular expression to match HTML include sections
14
+ *
15
+ * Matches elements with data-include attribute.
16
+ * Captures the full opening tag to extract both path and optional format.
17
+ *
18
+ * This is intentionally simple and doesn't handle all edge cases
19
+ * (e.g., attributes split across lines, attribute values with escaped quotes).
20
+ * For complex HTML, a proper parser would be needed.
21
+ */
22
+ const DATA_INCLUDE_REGEX = /<([a-z][a-z0-9]*)\s+[^>]*data-include\s*=\s*["']([^"']+)["'][^>]*>/gi;
23
+ /**
24
+ * Extract data-include-format from a tag string
25
+ */
26
+ function extractFormat(tagString) {
27
+ const formatMatch = tagString.match(/data-include-format\s*=\s*["']([^"']+)["']/i);
28
+ if (formatMatch) {
29
+ const format = formatMatch[1].toLowerCase();
30
+ if (format === 'markdown' || format === 'html') {
31
+ return format;
32
+ }
33
+ }
34
+ return undefined;
35
+ }
36
+ /**
37
+ * Calculate line and column from content offset
38
+ */
39
+ function getLineColumn(content, offset) {
40
+ let line = 1;
41
+ let lastNewline = -1;
42
+ for (let i = 0; i < offset && i < content.length; i++) {
43
+ if (content[i] === '\n') {
44
+ line++;
45
+ lastNewline = i;
46
+ }
47
+ }
48
+ return {
49
+ line,
50
+ column: offset - lastNewline,
51
+ };
52
+ }
53
+ /**
54
+ * Scan HTML content for include directives
55
+ *
56
+ * @param content - HTML file content
57
+ * @param file - Canonical path of the file being scanned
58
+ * @returns Array of include directives in encounter order
59
+ *
60
+ * @example
61
+ * ```typescript
62
+ * const content = `
63
+ * <body>
64
+ * <section data-include="./intro.md" data-include-format="markdown"></section>
65
+ * </body>
66
+ * `;
67
+ * const includes = scanHtmlIncludes(content, '/spec/format.html');
68
+ * // Returns: [{ relativePath: './intro.md', format: 'markdown', ... }]
69
+ * ```
70
+ */
71
+ export function scanHtmlIncludes(content, file) {
72
+ const directives = [];
73
+ // Reset regex state
74
+ DATA_INCLUDE_REGEX.lastIndex = 0;
75
+ let match;
76
+ while ((match = DATA_INCLUDE_REGEX.exec(content)) !== null) {
77
+ const fullMatch = match[0];
78
+ const relativePath = match[2];
79
+ const startOffset = match.index;
80
+ const endOffset = match.index + fullMatch.length;
81
+ const { line, column } = getLineColumn(content, startOffset);
82
+ // Try to get explicit format, fall back to inference
83
+ const explicitFormat = extractFormat(fullMatch);
84
+ const format = explicitFormat ?? inferFormat(relativePath);
85
+ directives.push({
86
+ relativePath,
87
+ format,
88
+ sourcePos: {
89
+ file,
90
+ line,
91
+ column,
92
+ offset: startOffset,
93
+ },
94
+ startOffset,
95
+ endOffset,
96
+ });
97
+ }
98
+ return directives;
99
+ }
100
+ //# sourceMappingURL=scan-html.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scan-html.js","sourceRoot":"","sources":["../../../src/preprocess/include/scan-html.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD;;;;;;;;;GASG;AACH,MAAM,kBAAkB,GAAG,sEAAsE,CAAC;AAElG;;GAEG;AACH,SAAS,aAAa,CAAC,SAAiB;IACpC,MAAM,WAAW,GAAG,SAAS,CAAC,KAAK,CAAC,6CAA6C,CAAC,CAAC;IACnF,IAAI,WAAW,EAAE,CAAC;QACd,MAAM,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;QAC5C,IAAI,MAAM,KAAK,UAAU,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;YAC7C,OAAO,MAAM,CAAC;QAClB,CAAC;IACL,CAAC;IACD,OAAO,SAAS,CAAC;AACrB,CAAC;AAED;;GAEG;AACH,SAAS,aAAa,CAAC,OAAe,EAAE,MAAc;IAClD,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,IAAI,WAAW,GAAG,CAAC,CAAC,CAAC;IAErB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,IAAI,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACpD,IAAI,OAAO,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;YACtB,IAAI,EAAE,CAAC;YACP,WAAW,GAAG,CAAC,CAAC;QACpB,CAAC;IACL,CAAC;IAED,OAAO;QACH,IAAI;QACJ,MAAM,EAAE,MAAM,GAAG,WAAW;KAC/B,CAAC;AACN,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAe,EAAE,IAAY;IAC1D,MAAM,UAAU,GAAuB,EAAE,CAAC;IAE1C,oBAAoB;IACpB,kBAAkB,CAAC,SAAS,GAAG,CAAC,CAAC;IAEjC,IAAI,KAA6B,CAAC;IAClC,OAAO,CAAC,KAAK,GAAG,kBAAkB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QACzD,MAAM,SAAS,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QAC3B,MAAM,YAAY,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QAC9B,MAAM,WAAW,GAAG,KAAK,CAAC,KAAK,CAAC;QAChC,MAAM,SAAS,GAAG,KAAK,CAAC,KAAK,GAAG,SAAS,CAAC,MAAM,CAAC;QAEjD,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,aAAa,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;QAE7D,qDAAqD;QACrD,MAAM,cAAc,GAAG,aAAa,CAAC,SAAS,CAAC,CAAC;QAChD,MAAM,MAAM,GAAG,cAAc,IAAI,WAAW,CAAC,YAAY,CAAC,CAAC;QAE3D,UAAU,CAAC,IAAI,CAAC;YACZ,YAAY;YACZ,MAAM;YACN,SAAS,EAAE;gBACP,IAAI;gBACJ,IAAI;gBACJ,MAAM;gBACN,MAAM,EAAE,WAAW;aACtB;YACD,WAAW;YACX,SAAS;SACZ,CAAC,CAAC;IACP,CAAC;IAED,OAAO,UAAU,CAAC;AACtB,CAAC"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Markdown Include Scanner
3
+ *
4
+ * Scans markdown content for :::include directives.
5
+ *
6
+ * Format: :::include ./path/to/file.md :::
7
+ *
8
+ * The scanner preserves exact position information for each directive
9
+ * to enable accurate source mapping after include resolution.
10
+ */
11
+ import type { IncludeDirective } from '#src/preprocess/types';
12
+ /**
13
+ * Scan markdown content for include directives
14
+ *
15
+ * @param content - Markdown file content
16
+ * @param file - Canonical path of the file being scanned
17
+ * @returns Array of include directives in encounter order
18
+ *
19
+ * @example
20
+ * ```typescript
21
+ * const content = `
22
+ * # Title
23
+ * :::include ./intro.md :::
24
+ * ## Next Section
25
+ * `;
26
+ * const includes = scanMarkdownIncludes(content, '/spec/format.md');
27
+ * // Returns: [{ relativePath: './intro.md', ... }]
28
+ * ```
29
+ */
30
+ export declare function scanMarkdownIncludes(content: string, file: string): IncludeDirective[];
31
+ //# sourceMappingURL=scan-markdown.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scan-markdown.d.ts","sourceRoot":"","sources":["../../../src/preprocess/include/scan-markdown.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAmC9D;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,gBAAgB,EAAE,CA6BtF"}
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Markdown Include Scanner
3
+ *
4
+ * Scans markdown content for :::include directives.
5
+ *
6
+ * Format: :::include ./path/to/file.md :::
7
+ *
8
+ * The scanner preserves exact position information for each directive
9
+ * to enable accurate source mapping after include resolution.
10
+ */
11
+ import { inferFormat } from '#src/preprocess/types';
12
+ /**
13
+ * Regular expression to match markdown include directives
14
+ *
15
+ * Matches: :::include ./path/to/file.md :::
16
+ *
17
+ * Captures:
18
+ * - Group 1: file path (required)
19
+ *
20
+ * The directive must be on its own line.
21
+ */
22
+ const INCLUDE_REGEX = /^[ \t]*:::include\s+(\S+)\s*:::\s*$/gm;
23
+ /**
24
+ * Calculate line and column from content offset
25
+ */
26
+ function getLineColumn(content, offset) {
27
+ let line = 1;
28
+ let lastNewline = -1;
29
+ for (let i = 0; i < offset && i < content.length; i++) {
30
+ if (content[i] === '\n') {
31
+ line++;
32
+ lastNewline = i;
33
+ }
34
+ }
35
+ return {
36
+ line,
37
+ column: offset - lastNewline,
38
+ };
39
+ }
40
+ /**
41
+ * Scan markdown content for include directives
42
+ *
43
+ * @param content - Markdown file content
44
+ * @param file - Canonical path of the file being scanned
45
+ * @returns Array of include directives in encounter order
46
+ *
47
+ * @example
48
+ * ```typescript
49
+ * const content = `
50
+ * # Title
51
+ * :::include ./intro.md :::
52
+ * ## Next Section
53
+ * `;
54
+ * const includes = scanMarkdownIncludes(content, '/spec/format.md');
55
+ * // Returns: [{ relativePath: './intro.md', ... }]
56
+ * ```
57
+ */
58
+ export function scanMarkdownIncludes(content, file) {
59
+ const directives = [];
60
+ // Reset regex state for each call
61
+ INCLUDE_REGEX.lastIndex = 0;
62
+ let match;
63
+ while ((match = INCLUDE_REGEX.exec(content)) !== null) {
64
+ const relativePath = match[1];
65
+ const startOffset = match.index;
66
+ const endOffset = match.index + match[0].length;
67
+ const { line, column } = getLineColumn(content, startOffset);
68
+ directives.push({
69
+ relativePath,
70
+ format: inferFormat(relativePath),
71
+ sourcePos: {
72
+ file,
73
+ line,
74
+ column,
75
+ offset: startOffset,
76
+ },
77
+ startOffset,
78
+ endOffset,
79
+ });
80
+ }
81
+ return directives;
82
+ }
83
+ //# sourceMappingURL=scan-markdown.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scan-markdown.js","sourceRoot":"","sources":["../../../src/preprocess/include/scan-markdown.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD;;;;;;;;;GASG;AACH,MAAM,aAAa,GAAG,uCAAuC,CAAC;AAE9D;;GAEG;AACH,SAAS,aAAa,CAAC,OAAe,EAAE,MAAc;IAClD,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,IAAI,WAAW,GAAG,CAAC,CAAC,CAAC;IAErB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,IAAI,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACpD,IAAI,OAAO,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;YACtB,IAAI,EAAE,CAAC;YACP,WAAW,GAAG,CAAC,CAAC;QACpB,CAAC;IACL,CAAC;IAED,OAAO;QACH,IAAI;QACJ,MAAM,EAAE,MAAM,GAAG,WAAW;KAC/B,CAAC;AACN,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAAe,EAAE,IAAY;IAC9D,MAAM,UAAU,GAAuB,EAAE,CAAC;IAE1C,kCAAkC;IAClC,aAAa,CAAC,SAAS,GAAG,CAAC,CAAC;IAE5B,IAAI,KAA6B,CAAC;IAClC,OAAO,CAAC,KAAK,GAAG,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QACpD,MAAM,YAAY,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QAC9B,MAAM,WAAW,GAAG,KAAK,CAAC,KAAK,CAAC;QAChC,MAAM,SAAS,GAAG,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;QAEhD,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,aAAa,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;QAE7D,UAAU,CAAC,IAAI,CAAC;YACZ,YAAY;YACZ,MAAM,EAAE,WAAW,CAAC,YAAY,CAAC;YACjC,SAAS,EAAE;gBACP,IAAI;gBACJ,IAAI;gBACJ,MAAM;gBACN,MAAM,EAAE,WAAW;aACtB;YACD,WAAW;YACX,SAAS;SACZ,CAAC,CAAC;IACP,CAAC;IAED,OAAO,UAAU,CAAC;AACtB,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Preprocess Module - Public API
3
+ *
4
+ * The preprocess stage handles:
5
+ * - Loading and normalizing spec configuration
6
+ * - Resolving includes to produce ordered SourceUnits
7
+ * - Preserving source file information for accurate error reporting
8
+ */
9
+ export { preprocess, validateEntry } from '#src/preprocess/pipeline';
10
+ export type { PreprocessOptions } from '#src/preprocess/pipeline';
11
+ export type { SourceFormat, IncludeDirective, SourceUnit, IncludeGraph, IncludeEdge, CompositeSource, PersonEntry, SpecConfig, PreprocessedSpec, DiagnosticSeverity, PreprocessDiagnosticCode, Diagnostic, PreprocessResult, } from '#src/preprocess/types';
12
+ export { inferFormat, createDiagnostic } from '#src/preprocess/types';
13
+ export { loadRespecConfig, normalizeRespecConfig, createDefaultConfig, } from '#src/preprocess/config/index';
14
+ export type { RawRespecConfig, RawPersonEntry } from '#src/preprocess/config/index';
15
+ export { scanMarkdownIncludes, scanHtmlIncludes, resolveIncludes, } from '#src/preprocess/include/index';
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/preprocess/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACrE,YAAY,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAGlE,YAAY,EACR,YAAY,EACZ,gBAAgB,EAChB,UAAU,EACV,YAAY,EACZ,WAAW,EACX,eAAe,EACf,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,kBAAkB,EAClB,wBAAwB,EACxB,UAAU,EACV,gBAAgB,GACnB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAGtE,OAAO,EACH,gBAAgB,EAChB,qBAAqB,EACrB,mBAAmB,GACtB,MAAM,8BAA8B,CAAC;AACtC,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAGpF,OAAO,EACH,oBAAoB,EACpB,gBAAgB,EAChB,eAAe,GAClB,MAAM,+BAA+B,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Preprocess Module - Public API
3
+ *
4
+ * The preprocess stage handles:
5
+ * - Loading and normalizing spec configuration
6
+ * - Resolving includes to produce ordered SourceUnits
7
+ * - Preserving source file information for accurate error reporting
8
+ */
9
+ // Main orchestrator
10
+ export { preprocess, validateEntry } from '#src/preprocess/pipeline';
11
+ export { inferFormat, createDiagnostic } from '#src/preprocess/types';
12
+ // Config submodule (for advanced use)
13
+ export { loadRespecConfig, normalizeRespecConfig, createDefaultConfig, } from '#src/preprocess/config/index';
14
+ // Include submodule (for advanced use)
15
+ export { scanMarkdownIncludes, scanHtmlIncludes, resolveIncludes, } from '#src/preprocess/include/index';
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/preprocess/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,oBAAoB;AACpB,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAoBrE,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEtE,sCAAsC;AACtC,OAAO,EACH,gBAAgB,EAChB,qBAAqB,EACrB,mBAAmB,GACtB,MAAM,8BAA8B,CAAC;AAGtC,uCAAuC;AACvC,OAAO,EACH,oBAAoB,EACpB,gBAAgB,EAChB,eAAe,GAClB,MAAM,+BAA+B,CAAC"}
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Preprocess Pipeline
3
+ *
4
+ * Orchestrates configuration loading and include resolution.
5
+ * This is the main entry point for the preprocess stage.
6
+ */
7
+ import type { FileProvider } from '#src/file-provider/types';
8
+ import type { SourceFormat, PreprocessResult, Diagnostic } from '#src/preprocess/types';
9
+ /**
10
+ * Options for preprocessing a specification
11
+ */
12
+ export interface PreprocessOptions {
13
+ /** Path to entry file (format.md or format.html) */
14
+ entry: string;
15
+ /** Optional explicit format (inferred from extension if not provided) */
16
+ entryFormat?: SourceFormat;
17
+ /** Path to config file (optional) */
18
+ configPath?: string;
19
+ /** File provider for reading files */
20
+ fileProvider: FileProvider;
21
+ }
22
+ /**
23
+ * Preprocess a specification document
24
+ *
25
+ * Loads configuration (if provided) and resolves all includes
26
+ * to produce a PreprocessedSpec ready for parsing.
27
+ *
28
+ * @param options - Preprocess options
29
+ * @returns PreprocessResult with spec and diagnostics
30
+ *
31
+ * @example
32
+ * ```typescript
33
+ * const result = await preprocess({
34
+ * entry: '/specs/my-spec/format.md',
35
+ * configPath: '/specs/my-spec/config.respec.json',
36
+ * fileProvider: new NodeFileProvider(),
37
+ * });
38
+ *
39
+ * if (result.hasErrors) {
40
+ * console.error('Preprocess errors:', result.diagnostics);
41
+ * } else {
42
+ * // result.result contains PreprocessedSpec
43
+ * for (const unit of result.result.source.units) {
44
+ * console.log(`Processing: ${unit.file}`);
45
+ * }
46
+ * }
47
+ * ```
48
+ */
49
+ export declare function preprocess(options: PreprocessOptions): Promise<PreprocessResult>;
50
+ /**
51
+ * Quick check if an entry file exists and is readable
52
+ */
53
+ export declare function validateEntry(entry: string, fileProvider: FileProvider): Promise<{
54
+ valid: boolean;
55
+ diagnostics: Diagnostic[];
56
+ }>;
57
+ //# sourceMappingURL=pipeline.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../src/preprocess/pipeline.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,KAAK,EACR,YAAY,EAEZ,gBAAgB,EAChB,UAAU,EACb,MAAM,uBAAuB,CAAC;AAK/B;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAC9B,oDAAoD;IACpD,KAAK,EAAE,MAAM,CAAC;IAEd,yEAAyE;IACzE,WAAW,CAAC,EAAE,YAAY,CAAC;IAE3B,qCAAqC;IACrC,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,sCAAsC;IACtC,YAAY,EAAE,YAAY,CAAC;CAC9B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAsB,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CA+CtF;AAED;;GAEG;AACH,wBAAsB,aAAa,CAC/B,KAAK,EAAE,MAAM,EACb,YAAY,EAAE,YAAY,GAC3B,OAAO,CAAC;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,WAAW,EAAE,UAAU,EAAE,CAAA;CAAE,CAAC,CAgBxD"}
@@ -0,0 +1,100 @@
1
+ /**
2
+ * Preprocess Pipeline
3
+ *
4
+ * Orchestrates configuration loading and include resolution.
5
+ * This is the main entry point for the preprocess stage.
6
+ */
7
+ import { inferFormat } from '#src/preprocess/types';
8
+ import { loadRespecConfig, normalizeRespecConfig, createDefaultConfig } from '#src/preprocess/config/index';
9
+ import { resolveIncludes } from '#src/preprocess/include/index';
10
+ /**
11
+ * Preprocess a specification document
12
+ *
13
+ * Loads configuration (if provided) and resolves all includes
14
+ * to produce a PreprocessedSpec ready for parsing.
15
+ *
16
+ * @param options - Preprocess options
17
+ * @returns PreprocessResult with spec and diagnostics
18
+ *
19
+ * @example
20
+ * ```typescript
21
+ * const result = await preprocess({
22
+ * entry: '/specs/my-spec/format.md',
23
+ * configPath: '/specs/my-spec/config.respec.json',
24
+ * fileProvider: new NodeFileProvider(),
25
+ * });
26
+ *
27
+ * if (result.hasErrors) {
28
+ * console.error('Preprocess errors:', result.diagnostics);
29
+ * } else {
30
+ * // result.result contains PreprocessedSpec
31
+ * for (const unit of result.result.source.units) {
32
+ * console.log(`Processing: ${unit.file}`);
33
+ * }
34
+ * }
35
+ * ```
36
+ */
37
+ export async function preprocess(options) {
38
+ const { entry, entryFormat, configPath, fileProvider } = options;
39
+ const diagnostics = [];
40
+ // Canonicalize entry path
41
+ const canonicalEntry = fileProvider.canonicalize(entry);
42
+ const format = entryFormat ?? inferFormat(canonicalEntry);
43
+ // Load config if provided
44
+ let config;
45
+ if (configPath) {
46
+ const configResult = await loadRespecConfig(fileProvider, configPath);
47
+ diagnostics.push(...configResult.diagnostics);
48
+ if (configResult.config) {
49
+ config = normalizeRespecConfig(configResult.config);
50
+ }
51
+ else {
52
+ // Config load failed, use defaults but continue
53
+ config = createDefaultConfig();
54
+ }
55
+ }
56
+ else {
57
+ config = createDefaultConfig();
58
+ }
59
+ // Resolve includes
60
+ const includeResult = await resolveIncludes(canonicalEntry, format, fileProvider);
61
+ diagnostics.push(...includeResult.diagnostics);
62
+ // Check for errors
63
+ const hasErrors = diagnostics.some(d => d.severity === 'error');
64
+ // Even with errors, return partial result if we have units
65
+ if (includeResult.source.units.length === 0 && hasErrors) {
66
+ return {
67
+ diagnostics,
68
+ hasErrors,
69
+ };
70
+ }
71
+ return {
72
+ result: {
73
+ config,
74
+ source: includeResult.source,
75
+ },
76
+ diagnostics,
77
+ hasErrors,
78
+ };
79
+ }
80
+ /**
81
+ * Quick check if an entry file exists and is readable
82
+ */
83
+ export async function validateEntry(entry, fileProvider) {
84
+ const diagnostics = [];
85
+ const canonicalEntry = fileProvider.canonicalize(entry);
86
+ try {
87
+ await fileProvider.readText(canonicalEntry);
88
+ return { valid: true, diagnostics };
89
+ }
90
+ catch {
91
+ diagnostics.push({
92
+ severity: 'error',
93
+ code: 'include-not-found',
94
+ message: `Entry file not found: ${canonicalEntry}`,
95
+ file: canonicalEntry,
96
+ });
97
+ return { valid: false, diagnostics };
98
+ }
99
+ }
100
+ //# sourceMappingURL=pipeline.js.map