@temelj/mdx 0.14.0 → 0.15.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 (373) hide show
  1. package/README.md +468 -82
  2. package/dist/character-entities.d.mts +4 -0
  3. package/dist/character-entities.d.mts.map +1 -0
  4. package/dist/character-entities.mjs +2132 -0
  5. package/dist/character-entities.mjs.map +1 -0
  6. package/dist/character-reference.d.mts +6 -0
  7. package/dist/character-reference.d.mts.map +1 -0
  8. package/dist/character-reference.mjs +18 -0
  9. package/dist/character-reference.mjs.map +1 -0
  10. package/dist/compile-analysis.d.mts +28 -0
  11. package/dist/compile-analysis.d.mts.map +1 -0
  12. package/dist/compile-analysis.mjs +74 -0
  13. package/dist/compile-analysis.mjs.map +1 -0
  14. package/dist/compile-emit.d.mts +9 -0
  15. package/dist/compile-emit.d.mts.map +1 -0
  16. package/dist/compile-emit.mjs +187 -0
  17. package/dist/compile-emit.mjs.map +1 -0
  18. package/dist/compile-esm.d.mts +34 -0
  19. package/dist/compile-esm.d.mts.map +1 -0
  20. package/dist/compile-esm.mjs +187 -0
  21. package/dist/compile-esm.mjs.map +1 -0
  22. package/dist/compile-names.d.mts +13 -0
  23. package/dist/compile-names.d.mts.map +1 -0
  24. package/dist/compile-names.mjs +32 -0
  25. package/dist/compile-names.mjs.map +1 -0
  26. package/dist/compiler.d.mts +69 -85
  27. package/dist/compiler.d.mts.map +1 -1
  28. package/dist/compiler.mjs +185 -418
  29. package/dist/compiler.mjs.map +1 -1
  30. package/dist/diagnostics.d.mts +37 -0
  31. package/dist/diagnostics.d.mts.map +1 -0
  32. package/dist/diagnostics.mjs +57 -0
  33. package/dist/diagnostics.mjs.map +1 -0
  34. package/dist/errors.d.mts +157 -0
  35. package/dist/errors.d.mts.map +1 -0
  36. package/dist/errors.mjs +263 -0
  37. package/dist/errors.mjs.map +1 -0
  38. package/dist/footnote-numbering.d.mts +27 -0
  39. package/dist/footnote-numbering.d.mts.map +1 -0
  40. package/dist/footnote-numbering.mjs +49 -0
  41. package/dist/footnote-numbering.mjs.map +1 -0
  42. package/dist/format-context.d.mts +46 -0
  43. package/dist/format-context.d.mts.map +1 -0
  44. package/dist/format-context.mjs +26 -0
  45. package/dist/format-context.mjs.map +1 -0
  46. package/dist/format-directive.d.mts +9 -0
  47. package/dist/format-directive.d.mts.map +1 -0
  48. package/dist/format-directive.mjs +99 -0
  49. package/dist/format-directive.mjs.map +1 -0
  50. package/dist/format-jsx.d.mts +8 -0
  51. package/dist/format-jsx.d.mts.map +1 -0
  52. package/dist/format-jsx.mjs +47 -0
  53. package/dist/format-jsx.mjs.map +1 -0
  54. package/dist/format-math.d.mts +9 -0
  55. package/dist/format-math.d.mts.map +1 -0
  56. package/dist/format-math.mjs +79 -0
  57. package/dist/format-math.mjs.map +1 -0
  58. package/dist/format-safe.d.mts +25 -0
  59. package/dist/format-safe.d.mts.map +1 -0
  60. package/dist/format-safe.mjs +366 -0
  61. package/dist/format-safe.mjs.map +1 -0
  62. package/dist/format-table.d.mts +8 -0
  63. package/dist/format-table.d.mts.map +1 -0
  64. package/dist/format-table.mjs +55 -0
  65. package/dist/format-table.mjs.map +1 -0
  66. package/dist/format-track.d.mts +18 -0
  67. package/dist/format-track.d.mts.map +1 -0
  68. package/dist/format-track.mjs +34 -0
  69. package/dist/format-track.mjs.map +1 -0
  70. package/dist/format.d.mts +7 -0
  71. package/dist/format.d.mts.map +1 -0
  72. package/dist/format.mjs +549 -0
  73. package/dist/format.mjs.map +1 -0
  74. package/dist/frontmatter.d.mts +15 -0
  75. package/dist/frontmatter.d.mts.map +1 -0
  76. package/dist/frontmatter.mjs +187 -0
  77. package/dist/frontmatter.mjs.map +1 -0
  78. package/dist/heading.d.mts +6 -0
  79. package/dist/heading.d.mts.map +1 -0
  80. package/dist/heading.mjs +19 -0
  81. package/dist/heading.mjs.map +1 -0
  82. package/dist/html-format.d.mts +32 -0
  83. package/dist/html-format.d.mts.map +1 -0
  84. package/dist/html-format.mjs +127 -0
  85. package/dist/html-format.mjs.map +1 -0
  86. package/dist/html-lower.d.mts +78 -0
  87. package/dist/html-lower.d.mts.map +1 -0
  88. package/dist/html-lower.mjs +583 -0
  89. package/dist/html-lower.mjs.map +1 -0
  90. package/dist/html-stream.d.mts +13 -0
  91. package/dist/html-stream.d.mts.map +1 -0
  92. package/dist/html-stream.mjs +32 -0
  93. package/dist/html-stream.mjs.map +1 -0
  94. package/dist/html.d.mts +120 -0
  95. package/dist/html.d.mts.map +1 -0
  96. package/dist/html.mjs +77 -0
  97. package/dist/html.mjs.map +1 -0
  98. package/dist/identifier.d.mts +4 -0
  99. package/dist/identifier.d.mts.map +1 -0
  100. package/dist/identifier.mjs +8 -0
  101. package/dist/identifier.mjs.map +1 -0
  102. package/dist/javascript-ast.d.mts +16 -0
  103. package/dist/javascript-ast.d.mts.map +1 -0
  104. package/dist/javascript-ast.mjs +39 -0
  105. package/dist/javascript-ast.mjs.map +1 -0
  106. package/dist/javascript-jsx.d.mts +24 -0
  107. package/dist/javascript-jsx.d.mts.map +1 -0
  108. package/dist/javascript-jsx.mjs +189 -0
  109. package/dist/javascript-jsx.mjs.map +1 -0
  110. package/dist/javascript.d.mts +9 -0
  111. package/dist/javascript.d.mts.map +1 -0
  112. package/dist/javascript.mjs +31 -0
  113. package/dist/javascript.mjs.map +1 -0
  114. package/dist/jsx-reference.d.mts +15 -0
  115. package/dist/jsx-reference.d.mts.map +1 -0
  116. package/dist/jsx-reference.mjs +31 -0
  117. package/dist/jsx-reference.mjs.map +1 -0
  118. package/dist/mod.d.mts +25 -9
  119. package/dist/mod.mjs +19 -8
  120. package/dist/model.d.mts +196 -0
  121. package/dist/model.d.mts.map +1 -0
  122. package/dist/model.mjs +113 -0
  123. package/dist/model.mjs.map +1 -0
  124. package/dist/parser/block-container-recognizers.d.mts +40 -0
  125. package/dist/parser/block-container-recognizers.d.mts.map +1 -0
  126. package/dist/parser/block-container-recognizers.mjs +90 -0
  127. package/dist/parser/block-container-recognizers.mjs.map +1 -0
  128. package/dist/parser/block-directive-recognizers.d.mts +22 -0
  129. package/dist/parser/block-directive-recognizers.d.mts.map +1 -0
  130. package/dist/parser/block-directive-recognizers.mjs +77 -0
  131. package/dist/parser/block-directive-recognizers.mjs.map +1 -0
  132. package/dist/parser/block-leaf-recognizers.d.mts +53 -0
  133. package/dist/parser/block-leaf-recognizers.d.mts.map +1 -0
  134. package/dist/parser/block-leaf-recognizers.mjs +386 -0
  135. package/dist/parser/block-leaf-recognizers.mjs.map +1 -0
  136. package/dist/parser/block-parser.d.mts +38 -0
  137. package/dist/parser/block-parser.d.mts.map +1 -0
  138. package/dist/parser/block-parser.mjs +895 -0
  139. package/dist/parser/block-parser.mjs.map +1 -0
  140. package/dist/parser/block-syntax.d.mts +240 -0
  141. package/dist/parser/block-syntax.d.mts.map +1 -0
  142. package/dist/parser/characters.d.mts +19 -0
  143. package/dist/parser/characters.d.mts.map +1 -0
  144. package/dist/parser/characters.mjs +52 -0
  145. package/dist/parser/characters.mjs.map +1 -0
  146. package/dist/parser/config.d.mts +16 -0
  147. package/dist/parser/config.d.mts.map +1 -0
  148. package/dist/parser/config.mjs +25 -0
  149. package/dist/parser/config.mjs.map +1 -0
  150. package/dist/parser/directive-attributes.d.mts +9 -0
  151. package/dist/parser/directive-attributes.d.mts.map +1 -0
  152. package/dist/parser/directive-attributes.mjs +24 -0
  153. package/dist/parser/directive-attributes.mjs.map +1 -0
  154. package/dist/parser/embedded-scanner.d.mts +18 -0
  155. package/dist/parser/embedded-scanner.d.mts.map +1 -0
  156. package/dist/parser/embedded-scanner.mjs +199 -0
  157. package/dist/parser/embedded-scanner.mjs.map +1 -0
  158. package/dist/parser/inline-autolink.d.mts +7 -0
  159. package/dist/parser/inline-autolink.d.mts.map +1 -0
  160. package/dist/parser/inline-autolink.mjs +42 -0
  161. package/dist/parser/inline-autolink.mjs.map +1 -0
  162. package/dist/parser/inline-character-reference.d.mts +7 -0
  163. package/dist/parser/inline-character-reference.d.mts.map +1 -0
  164. package/dist/parser/inline-character-reference.mjs +22 -0
  165. package/dist/parser/inline-character-reference.mjs.map +1 -0
  166. package/dist/parser/inline-code.d.mts +7 -0
  167. package/dist/parser/inline-code.d.mts.map +1 -0
  168. package/dist/parser/inline-code.mjs +29 -0
  169. package/dist/parser/inline-code.mjs.map +1 -0
  170. package/dist/parser/inline-directive.d.mts +9 -0
  171. package/dist/parser/inline-directive.d.mts.map +1 -0
  172. package/dist/parser/inline-directive.mjs +45 -0
  173. package/dist/parser/inline-directive.mjs.map +1 -0
  174. package/dist/parser/inline-embedded.d.mts +19 -0
  175. package/dist/parser/inline-embedded.d.mts.map +1 -0
  176. package/dist/parser/inline-embedded.mjs +92 -0
  177. package/dist/parser/inline-embedded.mjs.map +1 -0
  178. package/dist/parser/inline-emphasis.d.mts +11 -0
  179. package/dist/parser/inline-emphasis.d.mts.map +1 -0
  180. package/dist/parser/inline-emphasis.mjs +79 -0
  181. package/dist/parser/inline-emphasis.mjs.map +1 -0
  182. package/dist/parser/inline-input.d.mts +46 -0
  183. package/dist/parser/inline-input.d.mts.map +1 -0
  184. package/dist/parser/inline-input.mjs +137 -0
  185. package/dist/parser/inline-input.mjs.map +1 -0
  186. package/dist/parser/inline-link.d.mts +12 -0
  187. package/dist/parser/inline-link.d.mts.map +1 -0
  188. package/dist/parser/inline-link.mjs +187 -0
  189. package/dist/parser/inline-link.mjs.map +1 -0
  190. package/dist/parser/inline-math.d.mts +10 -0
  191. package/dist/parser/inline-math.d.mts.map +1 -0
  192. package/dist/parser/inline-math.mjs +46 -0
  193. package/dist/parser/inline-math.mjs.map +1 -0
  194. package/dist/parser/inline-output.d.mts +34 -0
  195. package/dist/parser/inline-output.d.mts.map +1 -0
  196. package/dist/parser/inline-output.mjs +62 -0
  197. package/dist/parser/inline-output.mjs.map +1 -0
  198. package/dist/parser/inline-parser.d.mts +14 -0
  199. package/dist/parser/inline-parser.d.mts.map +1 -0
  200. package/dist/parser/inline-parser.mjs +328 -0
  201. package/dist/parser/inline-parser.mjs.map +1 -0
  202. package/dist/parser/inline-pending.d.mts +23 -0
  203. package/dist/parser/inline-pending.d.mts.map +1 -0
  204. package/dist/parser/inline-pending.mjs +100 -0
  205. package/dist/parser/inline-pending.mjs.map +1 -0
  206. package/dist/parser/inline-syntax.d.mts +118 -0
  207. package/dist/parser/inline-syntax.d.mts.map +1 -0
  208. package/dist/parser/inline-syntax.mjs +1 -0
  209. package/dist/parser/javascript-boundary.d.mts +16 -0
  210. package/dist/parser/javascript-boundary.d.mts.map +1 -0
  211. package/dist/parser/javascript-boundary.mjs +42 -0
  212. package/dist/parser/javascript-boundary.mjs.map +1 -0
  213. package/dist/parser/javascript-scanner.d.mts +22 -0
  214. package/dist/parser/javascript-scanner.d.mts.map +1 -0
  215. package/dist/parser/javascript-scanner.mjs +122 -0
  216. package/dist/parser/javascript-scanner.mjs.map +1 -0
  217. package/dist/parser/materialize-cache.d.mts +34 -0
  218. package/dist/parser/materialize-cache.d.mts.map +1 -0
  219. package/dist/parser/materialize-cache.mjs +12 -0
  220. package/dist/parser/materialize-cache.mjs.map +1 -0
  221. package/dist/parser/materialize-jsx.d.mts +14 -0
  222. package/dist/parser/materialize-jsx.d.mts.map +1 -0
  223. package/dist/parser/materialize-jsx.mjs +76 -0
  224. package/dist/parser/materialize-jsx.mjs.map +1 -0
  225. package/dist/parser/materialize.d.mts +61 -0
  226. package/dist/parser/materialize.d.mts.map +1 -0
  227. package/dist/parser/materialize.mjs +736 -0
  228. package/dist/parser/materialize.mjs.map +1 -0
  229. package/dist/parser/recognizer.d.mts +20 -0
  230. package/dist/parser/recognizer.d.mts.map +1 -0
  231. package/dist/parser/recognizer.mjs +24 -0
  232. package/dist/parser/recognizer.mjs.map +1 -0
  233. package/dist/parser/session.d.mts +42 -0
  234. package/dist/parser/session.d.mts.map +1 -0
  235. package/dist/parser/session.mjs +89 -0
  236. package/dist/parser/session.mjs.map +1 -0
  237. package/dist/parser.d.mts +25 -0
  238. package/dist/parser.d.mts.map +1 -0
  239. package/dist/parser.mjs +37 -0
  240. package/dist/parser.mjs.map +1 -0
  241. package/dist/plugin-internal.d.mts +25 -0
  242. package/dist/plugin-internal.d.mts.map +1 -0
  243. package/dist/plugin-internal.mjs +99 -0
  244. package/dist/plugin-internal.mjs.map +1 -0
  245. package/dist/plugin.d.mts +37 -0
  246. package/dist/plugin.d.mts.map +1 -0
  247. package/dist/plugin.mjs +1 -0
  248. package/dist/plugins/code-block-metadata.d.mts +42 -0
  249. package/dist/plugins/code-block-metadata.d.mts.map +1 -0
  250. package/dist/plugins/code-block-metadata.mjs +133 -0
  251. package/dist/plugins/code-block-metadata.mjs.map +1 -0
  252. package/dist/plugins/heading-id.d.mts +15 -0
  253. package/dist/plugins/heading-id.d.mts.map +1 -0
  254. package/dist/plugins/heading-id.mjs +45 -0
  255. package/dist/plugins/heading-id.mjs.map +1 -0
  256. package/dist/plugins/lower-heading.d.mts +16 -0
  257. package/dist/plugins/lower-heading.d.mts.map +1 -0
  258. package/dist/plugins/lower-heading.mjs +28 -0
  259. package/dist/plugins/lower-heading.mjs.map +1 -0
  260. package/dist/plugins/math-render.d.mts +26 -0
  261. package/dist/plugins/math-render.d.mts.map +1 -0
  262. package/dist/plugins/math-render.mjs +51 -0
  263. package/dist/plugins/math-render.mjs.map +1 -0
  264. package/dist/plugins/mod.d.mts +9 -6
  265. package/dist/plugins/mod.mjs +8 -6
  266. package/dist/plugins/remove-esm.d.mts +10 -0
  267. package/dist/plugins/remove-esm.d.mts.map +1 -0
  268. package/dist/plugins/remove-esm.mjs +12 -0
  269. package/dist/plugins/remove-esm.mjs.map +1 -0
  270. package/dist/plugins/shiki.d.mts +21 -0
  271. package/dist/plugins/shiki.d.mts.map +1 -0
  272. package/dist/plugins/shiki.mjs +144 -0
  273. package/dist/plugins/shiki.mjs.map +1 -0
  274. package/dist/plugins/syntax-highlight.d.mts +38 -0
  275. package/dist/plugins/syntax-highlight.d.mts.map +1 -0
  276. package/dist/plugins/syntax-highlight.mjs +106 -0
  277. package/dist/plugins/syntax-highlight.mjs.map +1 -0
  278. package/dist/processor.d.mts +60 -0
  279. package/dist/processor.d.mts.map +1 -0
  280. package/dist/processor.mjs +106 -0
  281. package/dist/processor.mjs.map +1 -0
  282. package/dist/ranges.d.mts +10 -0
  283. package/dist/ranges.d.mts.map +1 -0
  284. package/dist/ranges.mjs +22 -0
  285. package/dist/ranges.mjs.map +1 -0
  286. package/dist/source-map.d.mts +28 -0
  287. package/dist/source-map.d.mts.map +1 -0
  288. package/dist/source-map.mjs +90 -0
  289. package/dist/source-map.mjs.map +1 -0
  290. package/dist/source-text.d.mts +35 -0
  291. package/dist/source-text.d.mts.map +1 -0
  292. package/dist/source-text.mjs +132 -0
  293. package/dist/source-text.mjs.map +1 -0
  294. package/dist/source.d.mts +86 -0
  295. package/dist/source.d.mts.map +1 -0
  296. package/dist/source.mjs +264 -0
  297. package/dist/source.mjs.map +1 -0
  298. package/dist/stream-events.d.mts +59 -0
  299. package/dist/stream-events.d.mts.map +1 -0
  300. package/dist/stream-events.mjs +115 -0
  301. package/dist/stream-events.mjs.map +1 -0
  302. package/dist/stream-session.d.mts +79 -0
  303. package/dist/stream-session.d.mts.map +1 -0
  304. package/dist/stream-session.mjs +904 -0
  305. package/dist/stream-session.mjs.map +1 -0
  306. package/dist/stream-tail.d.mts +84 -0
  307. package/dist/stream-tail.d.mts.map +1 -0
  308. package/dist/stream-tail.mjs +359 -0
  309. package/dist/stream-tail.mjs.map +1 -0
  310. package/dist/stream-types.d.mts +89 -0
  311. package/dist/stream-types.d.mts.map +1 -0
  312. package/dist/stream-types.mjs +1 -0
  313. package/dist/stream.d.mts +28 -0
  314. package/dist/stream.d.mts.map +1 -0
  315. package/dist/stream.mjs +68 -0
  316. package/dist/stream.mjs.map +1 -0
  317. package/dist/syntax-options.d.mts +21 -0
  318. package/dist/syntax-options.d.mts.map +1 -0
  319. package/dist/syntax-options.mjs +26 -0
  320. package/dist/syntax-options.mjs.map +1 -0
  321. package/dist/traversal.d.mts +25 -0
  322. package/dist/traversal.d.mts.map +1 -0
  323. package/dist/traversal.mjs +136 -0
  324. package/dist/traversal.mjs.map +1 -0
  325. package/dist/tree.d.mts +18 -0
  326. package/dist/tree.d.mts.map +1 -0
  327. package/dist/tree.mjs +43 -0
  328. package/dist/tree.mjs.map +1 -0
  329. package/dist/unified/adapter.d.mts +24 -0
  330. package/dist/unified/adapter.d.mts.map +1 -0
  331. package/dist/unified/adapter.mjs +44 -0
  332. package/dist/unified/adapter.mjs.map +1 -0
  333. package/dist/unified/mod.d.mts +2 -0
  334. package/dist/unified/mod.mjs +1 -0
  335. package/dist/unified/runtime.d.mts +10 -0
  336. package/dist/unified/runtime.d.mts.map +1 -0
  337. package/dist/unified/runtime.mjs +115 -0
  338. package/dist/unified/runtime.mjs.map +1 -0
  339. package/dist/unified/tree-bridge.d.mts +63 -0
  340. package/dist/unified/tree-bridge.d.mts.map +1 -0
  341. package/dist/unified/tree-bridge.mjs +876 -0
  342. package/dist/unified/tree-bridge.mjs.map +1 -0
  343. package/dist/uri.d.mts +5 -0
  344. package/dist/uri.d.mts.map +1 -0
  345. package/dist/uri.mjs +32 -0
  346. package/dist/uri.mjs.map +1 -0
  347. package/package.json +56 -30
  348. package/dist/plugins/heading-id/plugin.d.mts +0 -17
  349. package/dist/plugins/heading-id/plugin.d.mts.map +0 -1
  350. package/dist/plugins/heading-id/plugin.mjs +0 -23
  351. package/dist/plugins/heading-id/plugin.mjs.map +0 -1
  352. package/dist/plugins/katex/plugin.d.mts +0 -39
  353. package/dist/plugins/katex/plugin.d.mts.map +0 -1
  354. package/dist/plugins/katex/plugin.mjs +0 -107
  355. package/dist/plugins/katex/plugin.mjs.map +0 -1
  356. package/dist/plugins/remove-imports-exports.d.mts +0 -10
  357. package/dist/plugins/remove-imports-exports.d.mts.map +0 -1
  358. package/dist/plugins/remove-imports-exports.mjs +0 -15
  359. package/dist/plugins/remove-imports-exports.mjs.map +0 -1
  360. package/dist/plugins/syntax-highlight/code-meta.d.mts +0 -22
  361. package/dist/plugins/syntax-highlight/code-meta.d.mts.map +0 -1
  362. package/dist/plugins/syntax-highlight/code-meta.mjs +0 -38
  363. package/dist/plugins/syntax-highlight/code-meta.mjs.map +0 -1
  364. package/dist/plugins/syntax-highlight/plugin.d.mts +0 -57
  365. package/dist/plugins/syntax-highlight/plugin.d.mts.map +0 -1
  366. package/dist/plugins/syntax-highlight/plugin.mjs +0 -93
  367. package/dist/plugins/syntax-highlight/plugin.mjs.map +0 -1
  368. package/dist/plugins/tree-processor/plugin.d.mts +0 -19
  369. package/dist/plugins/tree-processor/plugin.d.mts.map +0 -1
  370. package/dist/plugins/tree-processor/plugin.mjs +0 -21
  371. package/dist/plugins/tree-processor/plugin.mjs.map +0 -1
  372. package/dist/types.d.mts +0 -2
  373. /package/dist/{types.mjs → parser/block-syntax.mjs} +0 -0
@@ -0,0 +1,189 @@
1
+ import { CompileError } from "./errors.mjs";
2
+ import { childNode, collectPatternNames, javascriptChildren, javascriptPropertyName, nodeArray, nodeValue } from "./javascript-ast.mjs";
3
+ import { parseJavaScriptExpression } from "./javascript.mjs";
4
+ import { recordJsxReference, resolveJsxName } from "./jsx-reference.mjs";
5
+ import { isString } from "@temelj/value";
6
+ //#region src/javascript-jsx.ts
7
+ function analyzeJavaScriptExpression(source, context) {
8
+ const expression = parseJavaScriptExpression(source);
9
+ context.names.reserveJavaScript(expression);
10
+ analyzeJsxReferences(expression, context);
11
+ }
12
+ function transformJavaScriptExpression(source, context, origin) {
13
+ const root = parseJavaScriptExpression(source);
14
+ return transformNodeSource(source, root, {
15
+ ...withLocalBindings(root, context),
16
+ origin
17
+ });
18
+ }
19
+ /**
20
+ * Transforms JSX inside the nodes of one parsed program. Each call returns a
21
+ * node's source with its JSX replaced by runtime calls.
22
+ */
23
+ function programTransformer(source, program, context, origin) {
24
+ const transformContext = {
25
+ ...withLocalBindings(program, context),
26
+ origin
27
+ };
28
+ return (node) => transformNodeSource(source, node, transformContext);
29
+ }
30
+ function javascriptExpressionUsesAwait(source) {
31
+ return containsAwait(parseJavaScriptExpression(source));
32
+ }
33
+ function transformNodeSource(source, root, context) {
34
+ if (root.type === "JSXElement" || root.type === "JSXFragment") return emitJsx(root, source, context);
35
+ const jsx = outerJsxNodes(root);
36
+ if (jsx.length === 0) return source.slice(root.start, root.end);
37
+ let cursor = root.start;
38
+ const chunks = [];
39
+ for (const node of jsx.sort((left, right) => left.start - right.start)) {
40
+ chunks.push(source.slice(cursor, node.start), emitJsx(node, source, context));
41
+ cursor = node.end;
42
+ }
43
+ chunks.push(source.slice(cursor, root.end));
44
+ return chunks.join("");
45
+ }
46
+ function emitJsx(node, source, context) {
47
+ if (node.type === "JSXFragment") return emitCall(context.names.get("_Fragment"), jsxChildren(nodeArray(node, "children"), source, context), [], node, context);
48
+ const opening = childNode(nodeValue(node, "openingElement"));
49
+ if (opening === void 0) throw CompileError.jsxElementOpeningMissing();
50
+ const name = childNode(nodeValue(opening, "name"));
51
+ if (name === void 0) throw CompileError.jsxElementNameMissing();
52
+ const tag = jsxTag(name);
53
+ const properties = jsxAttributes(nodeArray(opening, "attributes"), source, context);
54
+ return emitCall(tag, jsxChildren(nodeArray(node, "children"), source, context), properties, node, context);
55
+ }
56
+ function emitCall(tag, children, properties, node, context) {
57
+ const entries = [...properties];
58
+ if (children.length === 1) entries.push(`children:${children[0]}`);
59
+ else if (children.length > 1) entries.push(`children:[${children.join(", ")}]`);
60
+ const propertiesCode = `{${entries.join(", ")}}`;
61
+ return context.development ? `${context.names.get("_jsxDEV")}(${tag}, ${propertiesCode}, undefined, ${children.length > 1}, ${javascriptSource(node, context)}, undefined)` : `${context.names.get(children.length > 1 ? "_jsxs" : "_jsx")}(${tag}, ${propertiesCode})`;
62
+ }
63
+ function jsxAttributes(attributes, source, context) {
64
+ return attributes.map((attribute) => {
65
+ if (attribute.type === "JSXSpreadAttribute") {
66
+ const argument = childNode(nodeValue(attribute, "argument"));
67
+ if (argument === void 0) throw CompileError.jsxSpreadArgumentMissing();
68
+ return `...(${transformNodeSource(source, argument, context)})`;
69
+ }
70
+ const nameNode = childNode(nodeValue(attribute, "name"));
71
+ if (nameNode === void 0) throw CompileError.jsxAttributeNameMissing();
72
+ const name = jsxName(nameNode);
73
+ const value = childNode(nodeValue(attribute, "value"));
74
+ if (value === void 0) return `${javascriptPropertyName(name)}:true`;
75
+ if (value.type === "Literal") return `${javascriptPropertyName(name)}:${JSON.stringify(nodeValue(value, "value"))}`;
76
+ if (value.type === "JSXExpressionContainer") {
77
+ const expression = childNode(nodeValue(value, "expression"));
78
+ if (expression === void 0 || expression.type === "JSXEmptyExpression") throw CompileError.jsxAttributeExpressionEmpty();
79
+ return `${javascriptPropertyName(name)}:${transformNodeSource(source, expression, context)}`;
80
+ }
81
+ return `${javascriptPropertyName(name)}:${emitJsx(value, source, context)}`;
82
+ });
83
+ }
84
+ function jsxChildren(children, source, context) {
85
+ const result = [];
86
+ for (const child of children) if (child.type === "JSXText") {
87
+ const value = nodeValue(child, "value");
88
+ const text = normalizeJsxText(isString(value) ? value : "");
89
+ if (text !== "") result.push(JSON.stringify(text));
90
+ } else if (child.type === "JSXExpressionContainer") {
91
+ const expression = childNode(nodeValue(child, "expression"));
92
+ if (expression !== void 0 && expression.type !== "JSXEmptyExpression") result.push(transformNodeSource(source, expression, context));
93
+ } else if (child.type === "JSXSpreadChild") {
94
+ const expression = childNode(nodeValue(child, "expression"));
95
+ if (expression !== void 0) result.push(`...(${transformNodeSource(source, expression, context)})`);
96
+ } else result.push(emitJsx(child, source, context));
97
+ return result;
98
+ }
99
+ function jsxTag(node) {
100
+ return resolveJsxName(jsxName(node)).expression;
101
+ }
102
+ function javascriptSource(node, context) {
103
+ if (context.origin === void 0) return "undefined";
104
+ const location = context.origin.file.location(context.origin.offset + node.start);
105
+ return `{fileName:${JSON.stringify(context.sourceName)},lineNumber:${location.line},columnNumber:${location.column}}`;
106
+ }
107
+ function jsxName(node) {
108
+ if (node.type === "JSXIdentifier") {
109
+ const name = nodeValue(node, "name");
110
+ if (!isString(name)) throw CompileError.jsxIdentifierNameMissing();
111
+ return name;
112
+ }
113
+ if (node.type === "JSXMemberExpression") {
114
+ const object = childNode(nodeValue(node, "object"));
115
+ const property = childNode(nodeValue(node, "property"));
116
+ if (object === void 0 || property === void 0) throw CompileError.jsxMemberExpressionIncomplete();
117
+ return `${jsxName(object)}.${jsxName(property)}`;
118
+ }
119
+ if (node.type === "JSXNamespacedName") {
120
+ const namespace = childNode(nodeValue(node, "namespace"));
121
+ const name = childNode(nodeValue(node, "name"));
122
+ if (namespace === void 0 || name === void 0) throw CompileError.jsxNamespaceIncomplete();
123
+ return `${jsxName(namespace)}:${jsxName(name)}`;
124
+ }
125
+ throw CompileError.unsupportedJsxName(node.type);
126
+ }
127
+ function normalizeJsxText(value) {
128
+ const lines = value.replaceAll(" ", " ").split(/\r\n?|\n/u);
129
+ let lastNonEmptyLine = 0;
130
+ for (let index = 0; index < lines.length; index++) if (/[^ ]/u.test(lines[index])) lastNonEmptyLine = index;
131
+ let result = "";
132
+ for (let index = 0; index < lines.length; index++) {
133
+ let line = lines[index];
134
+ if (index > 0) line = line.replace(/^ +/u, "");
135
+ if (index < lines.length - 1) line = line.replace(/ +$/u, "");
136
+ if (line === "") continue;
137
+ result += line;
138
+ if (index !== lastNonEmptyLine) result += " ";
139
+ }
140
+ return result;
141
+ }
142
+ function outerJsxNodes(root) {
143
+ const result = [];
144
+ for (const value of javascriptChildren(root)) collectOuterJsx(value, result);
145
+ return result;
146
+ }
147
+ function analyzeJsxReferences(root, context) {
148
+ collectJsxReferences(root, withLocalBindings(root, context));
149
+ }
150
+ function collectJsxReferences(node, context) {
151
+ if (node.type === "JSXElement") {
152
+ const opening = childNode(nodeValue(node, "openingElement"));
153
+ const name = opening === void 0 ? void 0 : childNode(nodeValue(opening, "name"));
154
+ if (name === void 0) throw CompileError.jsxElementNameMissing();
155
+ recordJsxReference(resolveJsxName(jsxName(name)), context);
156
+ }
157
+ for (const child of javascriptChildren(node)) collectJsxReferences(child, context);
158
+ }
159
+ function collectOuterJsx(node, result) {
160
+ if (node.type === "JSXElement" || node.type === "JSXFragment") {
161
+ result.push(node);
162
+ return;
163
+ }
164
+ for (const child of javascriptChildren(node)) collectOuterJsx(child, result);
165
+ }
166
+ function withLocalBindings(root, context) {
167
+ const names = new Set(context.inScope);
168
+ collectBindings(root, names);
169
+ return {
170
+ ...context,
171
+ inScope: names
172
+ };
173
+ }
174
+ function collectBindings(node, names) {
175
+ if (node.type === "VariableDeclarator") collectPatternNames(childNode(nodeValue(node, "id")), names);
176
+ else if (node.type === "FunctionDeclaration" || node.type === "FunctionExpression" || node.type === "ClassDeclaration" || node.type === "ClassExpression") collectPatternNames(childNode(nodeValue(node, "id")), names);
177
+ if (node.type === "FunctionDeclaration" || node.type === "FunctionExpression" || node.type === "ArrowFunctionExpression") for (const parameter of nodeArray(node, "params")) collectPatternNames(parameter, names);
178
+ if (node.type === "ImportDeclaration") for (const specifier of nodeArray(node, "specifiers")) collectPatternNames(childNode(nodeValue(specifier, "local")), names);
179
+ for (const child of javascriptChildren(node)) collectBindings(child, names);
180
+ }
181
+ function containsAwait(node) {
182
+ if (node.type === "AwaitExpression") return true;
183
+ if (node.type === "FunctionDeclaration" || node.type === "FunctionExpression" || node.type === "ArrowFunctionExpression") return false;
184
+ return javascriptChildren(node).some((child) => containsAwait(child));
185
+ }
186
+ //#endregion
187
+ export { analyzeJavaScriptExpression, javascriptExpressionUsesAwait, programTransformer, transformJavaScriptExpression };
188
+
189
+ //# sourceMappingURL=javascript-jsx.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"javascript-jsx.mjs","names":[],"sources":["../src/javascript-jsx.ts"],"sourcesContent":["import { isString } from \"@temelj/value\";\n\nimport type { CompileNames } from \"./compile-names.ts\";\nimport type { SourceFile } from \"./source.ts\";\n\nimport { CompileError } from \"./errors.ts\";\nimport {\n childNode,\n collectPatternNames,\n javascriptPropertyName,\n nodeArray,\n javascriptChildren,\n nodeValue,\n type JavaScriptNode,\n} from \"./javascript-ast.ts\";\nimport { parseJavaScriptExpression } from \"./javascript.ts\";\nimport { recordJsxReference, resolveJsxName, type JsxReferenceContext } from \"./jsx-reference.ts\";\n\nexport interface JavaScriptJsxContext extends JsxReferenceContext {\n readonly development: boolean;\n readonly names: CompileNames;\n readonly sourceName: string;\n}\n\nexport function analyzeJavaScriptExpression(source: string, context: JavaScriptJsxContext): void {\n const expression = parseJavaScriptExpression(source);\n context.names.reserveJavaScript(expression);\n analyzeJsxReferences(expression, context);\n}\n\nexport interface JavaScriptSourceOrigin {\n readonly file: SourceFile;\n readonly offset: number;\n}\n\nexport function transformJavaScriptExpression(\n source: string,\n context: JavaScriptJsxContext,\n origin?: JavaScriptSourceOrigin,\n): string {\n const root = parseJavaScriptExpression(source);\n\n return transformNodeSource(source, root, { ...withLocalBindings(root, context), origin });\n}\n\n/**\n * Transforms JSX inside the nodes of one parsed program. Each call returns a\n * node's source with its JSX replaced by runtime calls.\n */\nexport function programTransformer(\n source: string,\n program: JavaScriptNode,\n context: JavaScriptJsxContext,\n origin?: JavaScriptSourceOrigin,\n): (node: JavaScriptNode) => string {\n const transformContext = { ...withLocalBindings(program, context), origin };\n\n return (node) => transformNodeSource(source, node, transformContext);\n}\n\nexport function javascriptExpressionUsesAwait(source: string): boolean {\n return containsAwait(parseJavaScriptExpression(source));\n}\n\ninterface JavaScriptTransformContext extends JavaScriptJsxContext {\n readonly origin?: JavaScriptSourceOrigin;\n}\n\nfunction transformNodeSource(\n source: string,\n root: JavaScriptNode,\n context: JavaScriptTransformContext,\n): string {\n if (root.type === \"JSXElement\" || root.type === \"JSXFragment\") {\n return emitJsx(root, source, context);\n }\n\n const jsx = outerJsxNodes(root);\n\n if (jsx.length === 0) {\n return source.slice(root.start, root.end);\n }\n\n let cursor = root.start;\n const chunks: string[] = [];\n\n for (const node of jsx.sort((left, right) => left.start - right.start)) {\n chunks.push(source.slice(cursor, node.start), emitJsx(node, source, context));\n cursor = node.end;\n }\n\n chunks.push(source.slice(cursor, root.end));\n\n return chunks.join(\"\");\n}\n\nfunction emitJsx(\n node: JavaScriptNode,\n source: string,\n context: JavaScriptTransformContext,\n): string {\n if (node.type === \"JSXFragment\") {\n return emitCall(\n context.names.get(\"_Fragment\"),\n jsxChildren(nodeArray(node, \"children\"), source, context),\n [],\n node,\n context,\n );\n }\n\n const opening = childNode(nodeValue(node, \"openingElement\"));\n\n if (opening === undefined) {\n throw CompileError.jsxElementOpeningMissing();\n }\n\n const name = childNode(nodeValue(opening, \"name\"));\n\n if (name === undefined) {\n throw CompileError.jsxElementNameMissing();\n }\n\n const tag = jsxTag(name);\n const properties = jsxAttributes(nodeArray(opening, \"attributes\"), source, context);\n const children = jsxChildren(nodeArray(node, \"children\"), source, context);\n\n return emitCall(tag, children, properties, node, context);\n}\n\nfunction emitCall(\n tag: string,\n children: readonly string[],\n properties: readonly string[],\n node: JavaScriptNode,\n context: JavaScriptTransformContext,\n): string {\n const entries = [...properties];\n\n if (children.length === 1) {\n entries.push(`children:${children[0]}`);\n } else if (children.length > 1) {\n entries.push(`children:[${children.join(\", \")}]`);\n }\n\n const propertiesCode = `{${entries.join(\", \")}}`;\n\n return context.development\n ? `${context.names.get(\"_jsxDEV\")}(${tag}, ${propertiesCode}, undefined, ${children.length > 1}, ${javascriptSource(node, context)}, undefined)`\n : `${context.names.get(children.length > 1 ? \"_jsxs\" : \"_jsx\")}(${tag}, ${propertiesCode})`;\n}\n\nfunction jsxAttributes(\n attributes: readonly JavaScriptNode[],\n source: string,\n context: JavaScriptTransformContext,\n): string[] {\n return attributes.map((attribute) => {\n if (attribute.type === \"JSXSpreadAttribute\") {\n const argument = childNode(nodeValue(attribute, \"argument\"));\n\n if (argument === undefined) {\n throw CompileError.jsxSpreadArgumentMissing();\n }\n\n return `...(${transformNodeSource(source, argument, context)})`;\n }\n\n const nameNode = childNode(nodeValue(attribute, \"name\"));\n\n if (nameNode === undefined) {\n throw CompileError.jsxAttributeNameMissing();\n }\n\n const name = jsxName(nameNode);\n const value = childNode(nodeValue(attribute, \"value\"));\n\n if (value === undefined) {\n return `${javascriptPropertyName(name)}:true`;\n }\n\n if (value.type === \"Literal\") {\n return `${javascriptPropertyName(name)}:${JSON.stringify(nodeValue(value, \"value\"))}`;\n }\n\n if (value.type === \"JSXExpressionContainer\") {\n const expression = childNode(nodeValue(value, \"expression\"));\n\n if (expression === undefined || expression.type === \"JSXEmptyExpression\") {\n throw CompileError.jsxAttributeExpressionEmpty();\n }\n\n return `${javascriptPropertyName(name)}:${transformNodeSource(source, expression, context)}`;\n }\n\n return `${javascriptPropertyName(name)}:${emitJsx(value, source, context)}`;\n });\n}\n\nfunction jsxChildren(\n children: readonly JavaScriptNode[],\n source: string,\n context: JavaScriptTransformContext,\n): string[] {\n const result: string[] = [];\n\n for (const child of children) {\n if (child.type === \"JSXText\") {\n const value = nodeValue(child, \"value\");\n const text = normalizeJsxText(isString(value) ? value : \"\");\n\n if (text !== \"\") {\n result.push(JSON.stringify(text));\n }\n } else if (child.type === \"JSXExpressionContainer\") {\n const expression = childNode(nodeValue(child, \"expression\"));\n\n if (expression !== undefined && expression.type !== \"JSXEmptyExpression\") {\n result.push(transformNodeSource(source, expression, context));\n }\n } else if (child.type === \"JSXSpreadChild\") {\n const expression = childNode(nodeValue(child, \"expression\"));\n\n if (expression !== undefined) {\n result.push(`...(${transformNodeSource(source, expression, context)})`);\n }\n } else {\n result.push(emitJsx(child, source, context));\n }\n }\n\n return result;\n}\n\nfunction jsxTag(node: JavaScriptNode): string {\n return resolveJsxName(jsxName(node)).expression;\n}\n\nfunction javascriptSource(node: JavaScriptNode, context: JavaScriptTransformContext): string {\n if (context.origin === undefined) {\n return \"undefined\";\n }\n\n const location = context.origin.file.location(context.origin.offset + node.start);\n\n return `{fileName:${JSON.stringify(context.sourceName)},lineNumber:${location.line},columnNumber:${location.column}}`;\n}\n\nfunction jsxName(node: JavaScriptNode): string {\n if (node.type === \"JSXIdentifier\") {\n const name = nodeValue(node, \"name\");\n\n if (!isString(name)) {\n throw CompileError.jsxIdentifierNameMissing();\n }\n\n return name;\n }\n\n if (node.type === \"JSXMemberExpression\") {\n const object = childNode(nodeValue(node, \"object\"));\n const property = childNode(nodeValue(node, \"property\"));\n\n if (object === undefined || property === undefined) {\n throw CompileError.jsxMemberExpressionIncomplete();\n }\n\n return `${jsxName(object)}.${jsxName(property)}`;\n }\n\n if (node.type === \"JSXNamespacedName\") {\n const namespace = childNode(nodeValue(node, \"namespace\"));\n const name = childNode(nodeValue(node, \"name\"));\n\n if (namespace === undefined || name === undefined) {\n throw CompileError.jsxNamespaceIncomplete();\n }\n\n return `${jsxName(namespace)}:${jsxName(name)}`;\n }\n\n throw CompileError.unsupportedJsxName(node.type);\n}\n\nfunction normalizeJsxText(value: string): string {\n const lines = value.replaceAll(\"\\t\", \" \").split(/\\r\\n?|\\n/u);\n let lastNonEmptyLine = 0;\n\n for (let index = 0; index < lines.length; index++) {\n if (/[^ ]/u.test(lines[index])) {\n lastNonEmptyLine = index;\n }\n }\n\n let result = \"\";\n\n for (let index = 0; index < lines.length; index++) {\n let line = lines[index];\n\n if (index > 0) {\n line = line.replace(/^ +/u, \"\");\n }\n\n if (index < lines.length - 1) {\n line = line.replace(/ +$/u, \"\");\n }\n\n if (line === \"\") {\n continue;\n }\n\n result += line;\n\n if (index !== lastNonEmptyLine) {\n result += \" \";\n }\n }\n\n return result;\n}\n\nfunction outerJsxNodes(root: JavaScriptNode): JavaScriptNode[] {\n const result: JavaScriptNode[] = [];\n\n for (const value of javascriptChildren(root)) {\n collectOuterJsx(value, result);\n }\n\n return result;\n}\n\nfunction analyzeJsxReferences(root: JavaScriptNode, context: JavaScriptJsxContext): void {\n collectJsxReferences(root, withLocalBindings(root, context));\n}\n\nfunction collectJsxReferences(node: JavaScriptNode, context: JavaScriptJsxContext): void {\n if (node.type === \"JSXElement\") {\n const opening = childNode(nodeValue(node, \"openingElement\"));\n const name = opening === undefined ? undefined : childNode(nodeValue(opening, \"name\"));\n\n if (name === undefined) {\n throw CompileError.jsxElementNameMissing();\n }\n\n recordJsxReference(resolveJsxName(jsxName(name)), context);\n }\n\n for (const child of javascriptChildren(node)) {\n collectJsxReferences(child, context);\n }\n}\n\nfunction collectOuterJsx(node: JavaScriptNode, result: JavaScriptNode[]): void {\n if (node.type === \"JSXElement\" || node.type === \"JSXFragment\") {\n result.push(node);\n\n return;\n }\n\n for (const child of javascriptChildren(node)) {\n collectOuterJsx(child, result);\n }\n}\n\nfunction withLocalBindings(\n root: JavaScriptNode,\n context: JavaScriptJsxContext,\n): JavaScriptJsxContext {\n const names = new Set(context.inScope);\n collectBindings(root, names);\n\n return { ...context, inScope: names };\n}\n\nfunction collectBindings(node: JavaScriptNode, names: Set<string>): void {\n if (node.type === \"VariableDeclarator\") {\n collectPatternNames(childNode(nodeValue(node, \"id\")), names);\n } else if (\n node.type === \"FunctionDeclaration\" ||\n node.type === \"FunctionExpression\" ||\n node.type === \"ClassDeclaration\" ||\n node.type === \"ClassExpression\"\n ) {\n collectPatternNames(childNode(nodeValue(node, \"id\")), names);\n }\n\n if (\n node.type === \"FunctionDeclaration\" ||\n node.type === \"FunctionExpression\" ||\n node.type === \"ArrowFunctionExpression\"\n ) {\n for (const parameter of nodeArray(node, \"params\")) {\n collectPatternNames(parameter, names);\n }\n }\n\n if (node.type === \"ImportDeclaration\") {\n for (const specifier of nodeArray(node, \"specifiers\")) {\n collectPatternNames(childNode(nodeValue(specifier, \"local\")), names);\n }\n }\n\n for (const child of javascriptChildren(node)) {\n collectBindings(child, names);\n }\n}\n\nfunction containsAwait(node: JavaScriptNode): boolean {\n if (node.type === \"AwaitExpression\") {\n return true;\n }\n\n if (\n node.type === \"FunctionDeclaration\" ||\n node.type === \"FunctionExpression\" ||\n node.type === \"ArrowFunctionExpression\"\n ) {\n return false;\n }\n\n return javascriptChildren(node).some((child) => containsAwait(child));\n}\n"],"mappings":";;;;;;AAwBA,SAAgB,4BAA4B,QAAgB,SAAqC;CAC/F,MAAM,aAAa,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O,MAAM;AAEjC;AAEA,SAAS,kBACP,MACA,SACsB;CACtB,MAAM,QAAQ,IAAI,IAAI,QAAQ,OAAO;CACrC,gBAAgB,MAAM,KAAK;CAE3B,OAAO;EAAE,GAAG;EAAS,SAAS;CAAM;AACtC;AAEA,SAAS,gBAAgB,MAAsB,OAA0B;CACvE,IAAI,KAAK,SAAS,sBAChB,oBAAoB,UAAU,UAAU,MAAM,IAAI,CAAC,GAAG,KAAK;MACtD,IACL,KAAK,SAAS,yBACd,KAAK,SAAS,wBACd,KAAK,SAAS,sBACd,KAAK,SAAS,mBAEd,oBAAoB,UAAU,UAAU,MAAM,IAAI,CAAC,GAAG,KAAK;CAG7D,IACE,KAAK,SAAS,yBACd,KAAK,SAAS,wBACd,KAAK,SAAS,2BAEd,KAAK,MAAM,aAAa,UAAU,MAAM,QAAQ,GAC9C,oBAAoB,WAAW,KAAK;CAIxC,IAAI,KAAK,SAAS,qBAChB,KAAK,MAAM,aAAa,UAAU,MAAM,YAAY,GAClD,oBAAoB,UAAU,UAAU,WAAW,OAAO,CAAC,GAAG,KAAK;CAIvE,KAAK,MAAM,SAAS,mBAAmB,IAAI,GACzC,gBAAgB,OAAO,KAAK;AAEhC;AAEA,SAAS,cAAc,MAA+B;CACpD,IAAI,KAAK,SAAS,mBAChB,OAAO;CAGT,IACE,KAAK,SAAS,yBACd,KAAK,SAAS,wBACd,KAAK,SAAS,2BAEd,OAAO;CAGT,OAAO,mBAAmB,IAAI,CAAC,CAAC,MAAM,UAAU,cAAc,KAAK,CAAC;AACtE"}
@@ -0,0 +1,9 @@
1
+ import { Node, Program } from "acorn";
2
+ //#region src/javascript.d.ts
3
+ export declare function parseJavaScriptExpression(source: string): Node;
4
+ export declare function parseJavaScriptProgram(source: string): Program;
5
+ export declare function hasJavaScriptToken(source: string): boolean;
6
+ /** Lets Acorn distinguish a regex literal from division using the preceding tokens. */
7
+ export declare function startsRegularExpression(prefix: string): boolean;
8
+ //#endregion
9
+ //# sourceMappingURL=javascript.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"javascript.d.mts","names":[],"sources":["../src/javascript.ts"],"mappings":";;wBAWgB,0BAA0B,iBAAiB;wBAI3C,uBAAuB,iBAAiB;wBAIxC,mBAAmB;;wBAKnB,wBAAwB"}
@@ -0,0 +1,31 @@
1
+ import { Parser } from "acorn";
2
+ import acornJsx from "acorn-jsx";
3
+ //#region src/javascript.ts
4
+ const JavaScriptParser = Parser.extend(acornJsx());
5
+ const options = {
6
+ ecmaVersion: "latest",
7
+ sourceType: "module"
8
+ };
9
+ function parseJavaScriptExpression(source) {
10
+ return JavaScriptParser.parseExpressionAt(source, 0, options);
11
+ }
12
+ function parseJavaScriptProgram(source) {
13
+ return JavaScriptParser.parse(source, options);
14
+ }
15
+ function hasJavaScriptToken(source) {
16
+ return JavaScriptParser.tokenizer(source, options).getToken().type.label !== "eof";
17
+ }
18
+ /** Lets Acorn distinguish a regex literal from division using the preceding tokens. */
19
+ function startsRegularExpression(prefix) {
20
+ const tokens = JavaScriptParser.tokenizer(`${prefix}/temelj/`, options);
21
+ try {
22
+ for (let token = tokens.getToken(); token.type.label !== "eof"; token = tokens.getToken()) if (token.start === prefix.length) return token.type.label === "regexp";
23
+ } catch (cause) {
24
+ if (!(cause instanceof SyntaxError)) throw cause;
25
+ }
26
+ return false;
27
+ }
28
+ //#endregion
29
+ export { hasJavaScriptToken, parseJavaScriptExpression, parseJavaScriptProgram, startsRegularExpression };
30
+
31
+ //# sourceMappingURL=javascript.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"javascript.mjs","names":[],"sources":["../src/javascript.ts"],"sourcesContent":["import { Parser, type Options, type Node, type Program } from \"acorn\";\nimport acornJsx from \"acorn-jsx\";\n\nconst JavaScriptParser = Parser.extend(acornJsx());\n\nconst options: Options = {\n ecmaVersion: \"latest\",\n sourceType: \"module\",\n};\n\n// acorn-jsx adds expression kinds beyond Acorn's built-in Expression union.\nexport function parseJavaScriptExpression(source: string): Node {\n return JavaScriptParser.parseExpressionAt(source, 0, options);\n}\n\nexport function parseJavaScriptProgram(source: string): Program {\n return JavaScriptParser.parse(source, options);\n}\n\nexport function hasJavaScriptToken(source: string): boolean {\n return JavaScriptParser.tokenizer(source, options).getToken().type.label !== \"eof\";\n}\n\n/** Lets Acorn distinguish a regex literal from division using the preceding tokens. */\nexport function startsRegularExpression(prefix: string): boolean {\n const tokens = JavaScriptParser.tokenizer(`${prefix}/temelj/`, options);\n\n try {\n for (let token = tokens.getToken(); token.type.label !== \"eof\"; token = tokens.getToken()) {\n if (token.start === prefix.length) {\n return token.type.label === \"regexp\";\n }\n }\n } catch (cause) {\n if (!(cause instanceof SyntaxError)) {\n throw cause;\n }\n\n // Invalid prefixes are rejected by the strict parser after the boundary closes.\n }\n\n return false;\n}\n"],"mappings":";;;AAGA,MAAM,mBAAmB,OAAO,OAAO,SAAS,CAAC;AAEjD,MAAM,UAAmB;CACvB,aAAa;CACb,YAAY;AACd;AAGA,SAAgB,0BAA0B,QAAsB;CAC9D,OAAO,iBAAiB,kBAAkB,QAAQ,GAAG,OAAO;AAC9D;AAEA,SAAgB,uBAAuB,QAAyB;CAC9D,OAAO,iBAAiB,MAAM,QAAQ,OAAO;AAC/C;AAEA,SAAgB,mBAAmB,QAAyB;CAC1D,OAAO,iBAAiB,UAAU,QAAQ,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,UAAU;AAC/E;;AAGA,SAAgB,wBAAwB,QAAyB;CAC/D,MAAM,SAAS,iBAAiB,UAAU,GAAG,OAAO,WAAW,OAAO;CAEtE,IAAI;EACF,KAAK,IAAI,QAAQ,OAAO,SAAS,GAAG,MAAM,KAAK,UAAU,OAAO,QAAQ,OAAO,SAAS,GACtF,IAAI,MAAM,UAAU,OAAO,QACzB,OAAO,MAAM,KAAK,UAAU;CAGlC,SAAS,OAAO;EACd,IAAI,EAAE,iBAAiB,cACrB,MAAM;CAIV;CAEA,OAAO;AACT"}
@@ -0,0 +1,15 @@
1
+ //#region src/jsx-reference.d.ts
2
+ export interface JsxReferenceContext {
3
+ readonly inScope: ReadonlySet<string>;
4
+ readonly missingReferences: Map<string, boolean>;
5
+ readonly referencedComponents: Set<string>;
6
+ }
7
+ export interface ResolvedJsxName {
8
+ readonly base: string | undefined;
9
+ readonly expression: string;
10
+ readonly name: string;
11
+ }
12
+ export declare function resolveJsxName(name: string): ResolvedJsxName;
13
+ export declare function recordJsxReference(resolved: ResolvedJsxName, context: JsxReferenceContext): void;
14
+ //#endregion
15
+ //# sourceMappingURL=jsx-reference.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsx-reference.d.mts","names":[],"sources":["../src/jsx-reference.ts"],"mappings":";iBAAiB;WACN,SAAS;WACT,mBAAmB;WACnB,sBAAsB;;iBAGhB;WACN;WACA;WACA;;wBAGK,eAAe,eAAe;wBAY9B,mBAAmB,UAAU,iBAAiB,SAAS"}
@@ -0,0 +1,31 @@
1
+ //#region src/jsx-reference.ts
2
+ function resolveJsxName(name) {
3
+ if (name.includes(":")) return {
4
+ base: void 0,
5
+ expression: JSON.stringify(name),
6
+ name
7
+ };
8
+ if (/^[a-z]/u.test(name) || name.includes("-")) return {
9
+ base: void 0,
10
+ expression: JSON.stringify(name),
11
+ name
12
+ };
13
+ return {
14
+ base: name.split(".", 1)[0],
15
+ expression: name,
16
+ name
17
+ };
18
+ }
19
+ function recordJsxReference(resolved, context) {
20
+ const { base, name } = resolved;
21
+ if (base === void 0) return;
22
+ if (!context.inScope.has(base)) {
23
+ context.referencedComponents.add(base);
24
+ if (!context.missingReferences.has(base)) context.missingReferences.set(base, name === base);
25
+ }
26
+ if (name !== base) context.missingReferences.set(name, true);
27
+ }
28
+ //#endregion
29
+ export { recordJsxReference, resolveJsxName };
30
+
31
+ //# sourceMappingURL=jsx-reference.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsx-reference.mjs","names":[],"sources":["../src/jsx-reference.ts"],"sourcesContent":["export interface JsxReferenceContext {\n readonly inScope: ReadonlySet<string>;\n readonly missingReferences: Map<string, boolean>;\n readonly referencedComponents: Set<string>;\n}\n\nexport interface ResolvedJsxName {\n readonly base: string | undefined;\n readonly expression: string;\n readonly name: string;\n}\n\nexport function resolveJsxName(name: string): ResolvedJsxName {\n if (name.includes(\":\")) {\n return { base: undefined, expression: JSON.stringify(name), name };\n }\n\n if (/^[a-z]/u.test(name) || name.includes(\"-\")) {\n return { base: undefined, expression: JSON.stringify(name), name };\n }\n\n return { base: name.split(\".\", 1)[0], expression: name, name };\n}\n\nexport function recordJsxReference(resolved: ResolvedJsxName, context: JsxReferenceContext): void {\n const { base, name } = resolved;\n\n if (base === undefined) {\n return;\n }\n\n if (!context.inScope.has(base)) {\n context.referencedComponents.add(base);\n\n if (!context.missingReferences.has(base)) {\n context.missingReferences.set(base, name === base);\n }\n }\n\n if (name !== base) {\n context.missingReferences.set(name, true);\n }\n}\n"],"mappings":";AAYA,SAAgB,eAAe,MAA+B;CAC5D,IAAI,KAAK,SAAS,GAAG,GACnB,OAAO;EAAE,MAAM,KAAA;EAAW,YAAY,KAAK,UAAU,IAAI;EAAG;CAAK;CAGnE,IAAI,UAAU,KAAK,IAAI,KAAK,KAAK,SAAS,GAAG,GAC3C,OAAO;EAAE,MAAM,KAAA;EAAW,YAAY,KAAK,UAAU,IAAI;EAAG;CAAK;CAGnE,OAAO;EAAE,MAAM,KAAK,MAAM,KAAK,CAAC,CAAC,CAAC;EAAI,YAAY;EAAM;CAAK;AAC/D;AAEA,SAAgB,mBAAmB,UAA2B,SAAoC;CAChG,MAAM,EAAE,MAAM,SAAS;CAEvB,IAAI,SAAS,KAAA,GACX;CAGF,IAAI,CAAC,QAAQ,QAAQ,IAAI,IAAI,GAAG;EAC9B,QAAQ,qBAAqB,IAAI,IAAI;EAErC,IAAI,CAAC,QAAQ,kBAAkB,IAAI,IAAI,GACrC,QAAQ,kBAAkB,IAAI,MAAM,SAAS,IAAI;CAErD;CAEA,IAAI,SAAS,MACX,QAAQ,kBAAkB,IAAI,MAAM,IAAI;AAE5C"}
package/dist/mod.d.mts CHANGED
@@ -1,9 +1,25 @@
1
- import { HastElement as Element, HastNode as Node } from "./types.mjs";
2
- import { MdxArtifact, MdxCompileError, MdxCompileOptions, MdxCompiler, MdxMessage, MdxMessagePlace, MdxMessagePoint, MdxSource, remarkFrontmatterPlugin, remarkGfmPlugin } from "./compiler.mjs";
3
- import { HeadingIdPluginOptions, headingIdPlugin } from "./plugins/heading-id/plugin.mjs";
4
- import { InlineMathStyle, KatexPluginOptions, katexPlugin } from "./plugins/katex/plugin.mjs";
5
- import { removeImportsExportsPlugin } from "./plugins/remove-imports-exports.mjs";
6
- import { SyntaxHighlightPluginOptions, syntaxHighlightPlugin } from "./plugins/syntax-highlight/plugin.mjs";
7
- import { MdxTreeProcessor, treeProcessorPlugin } from "./plugins/tree-processor/plugin.mjs";
8
- import "./plugins/mod.mjs";
9
- export { type Element as HastElement, type Node as HastNode, HeadingIdPluginOptions, InlineMathStyle, KatexPluginOptions, MdxArtifact, MdxCompileError, MdxCompileOptions, MdxCompiler, MdxMessage, MdxMessagePlace, MdxMessagePoint, MdxSource, MdxTreeProcessor, SyntaxHighlightPluginOptions, headingIdPlugin, katexPlugin, remarkFrontmatterPlugin, remarkGfmPlugin, removeImportsExportsPlugin, syntaxHighlightPlugin, treeProcessorPlugin };
1
+ import { HeadingDepth } from "./heading.mjs";
2
+ import { SourceRange } from "./ranges.mjs";
3
+ import { FrontmatterFormat, FrontmatterMode, MathFormat, MathMode, SyntaxOptions } from "./syntax-options.mjs";
4
+ import { BlockExpressionNode, BlockQuoteNode, CodeBlockNode, ContainerDirectiveNode, DefinitionNode, DeleteNode, DirectiveAttribute, DirectiveLabelNode, DisplayMathNode, DocumentIndex, DocumentNode, EmphasisNode, EsmNode, FlowContent, FootnoteDefinitionNode, FootnoteReferenceNode, FrontmatterNode, FrontmatterObject, FrontmatterTemporal, FrontmatterTemporalType, FrontmatterValue, HardBreakNode, HeadingNode, ImageNode, ImageReferenceNode, InlineCodeNode, InlineExpressionNode, InlineMathNode, JsxAttribute, JsxAttributeLike, JsxAttributeValue, JsxAttributeValueExpression, JsxFlowElementNode, JsxSpreadAttribute, JsxTextElementNode, LeafDirectiveNode, LinkNode, LinkReferenceNode, ListItemNode, ListNode, MdxKind, MdxNode, MdxNodeForKind, ParagraphNode, PhrasingContent, RawHtmlBlockNode, RawHtmlInlineNode, ReferenceKind, StrongNode, TableAlignment, TableCellNode, TableNode, TableRowNode, TextDirectiveNode, TextNode, ThematicBreakNode, documentFrontmatter, indexDocument, isFlowContent, isPhrasingContent, mdxChildren, nodeText } from "./model.mjs";
5
+ import { HtmlAttributeList, HtmlAttributeValue, HtmlAttributes, HtmlCodeBlockNode, HtmlCommentNode, HtmlDoctypeNode, HtmlElementNode, HtmlExpressionNode, HtmlFootnoteReferenceNode, HtmlFootnoteSectionNode, HtmlJsxNode, HtmlKind, HtmlMathNode, HtmlNode, HtmlNodeForKind, HtmlPendingConstruct, HtmlPendingNode, HtmlRawNode, HtmlRootNode, HtmlSemanticNode, HtmlTextNode, HtmlUnresolvedReferenceNode, MathRenderStyle, htmlChildren, htmlClassNames, htmlFallback, htmlText, isHtmlAttributeList, pendingFallback } from "./html.mjs";
6
+ import { SourceBuffer, SourceFile, SourceFileInput, SourceLocation, SourceSpan } from "./source.mjs";
7
+ import { HtmlRenderOptions, lowerHtml } from "./html-lower.mjs";
8
+ import { Diagnostic, DiagnosticFormatOptions, DiagnosticReporter, DiagnosticSeverity, RelatedInformation, formatDiagnostic, hasErrorDiagnostics } from "./diagnostics.mjs";
9
+ import { ParserLimit, ParserLimits, defaultParserLimits } from "./parser/config.mjs";
10
+ import { ParseOptions, ParseResult, parse } from "./parser.mjs";
11
+ import { SourceMap } from "./source-map.mjs";
12
+ import { CompileArtifact, CompileOptions, CompileOutputFormat, CompileResult, CompileSchemaOptions, CompiledComponents, FunctionBodyCompileArtifact, MdxTransportValue, ProgramCompileArtifact, compile } from "./compiler.mjs";
13
+ import { CompilationInvariant, CompilationIssue, CompileError, CompileLimit, ConfigurationError, ConfigurationIssue, FrontmatterError, FrontmatterIssue, InputError, InputIssue, LimitError, MdxError, ParseError, TransformError, TransformIssue, TransformTarget } from "./errors.mjs";
14
+ import { FormatOptions } from "./format-context.mjs";
15
+ import { formatMdx } from "./format.mjs";
16
+ import { HtmlFormatOptions, formatHtml } from "./html-format.mjs";
17
+ import { BlockId, CompletedBlock, MdxEdit, MdxPreview, MdxStreamChange, MdxStreamCompletion, MdxStreamLimits, MdxStreamOptions, MdxStreamSnapshot, PreviewBlock, StreamBlock, StreamDependencies } from "./stream-types.mjs";
18
+ import { MdxStream } from "./stream.mjs";
19
+ import { HtmlStreamRenderer } from "./html-stream.mjs";
20
+ import { normalizeIdentifier } from "./identifier.mjs";
21
+ import { TreeCursor } from "./tree.mjs";
22
+ import { HtmlRewriteHandlers, MdxRewriteHandlers, rewriteHtml, rewriteMdx, selectHtml, selectMdx, walkHtml, walkMdx } from "./traversal.mjs";
23
+ import { ProcessInput, ProcessOptions, ProcessResult, Processor, ProcessorOptions } from "./processor.mjs";
24
+ import { MdxBlockEvent, MdxEventDiagnostic, StreamBlockEventsOptions, applyBlockEvent, blockEvent, completionEvent, previewDocument, streamBlockEvents } from "./stream-events.mjs";
25
+ export { type BlockExpressionNode, type BlockId, type BlockQuoteNode, type CodeBlockNode, type CompilationInvariant, type CompilationIssue, type CompileArtifact, CompileError, type CompileLimit, type CompileOptions, type CompileOutputFormat, type CompileResult, type CompileSchemaOptions, type CompiledComponents, type CompletedBlock, ConfigurationError, type ConfigurationIssue, type ContainerDirectiveNode, type DefinitionNode, type DeleteNode, type Diagnostic, type DiagnosticFormatOptions, type DiagnosticReporter, type DiagnosticSeverity, type DirectiveAttribute, type DirectiveLabelNode, type DisplayMathNode, type DocumentIndex, type DocumentNode, type EmphasisNode, type EsmNode, type FlowContent, type FootnoteDefinitionNode, type FootnoteReferenceNode, type FormatOptions, FrontmatterError, type FrontmatterFormat, type FrontmatterIssue, type FrontmatterMode, type FrontmatterNode, type FrontmatterObject, type FrontmatterTemporal, type FrontmatterTemporalType, type FrontmatterValue, type FunctionBodyCompileArtifact, type HardBreakNode, type HeadingDepth, type HeadingNode, type HtmlAttributeList, type HtmlAttributeValue, type HtmlAttributes, type HtmlCodeBlockNode, type HtmlCommentNode, type HtmlDoctypeNode, type HtmlElementNode, type HtmlExpressionNode, type HtmlFootnoteReferenceNode, type HtmlFootnoteSectionNode, type HtmlFormatOptions, type HtmlJsxNode, type HtmlKind, type HtmlMathNode, type HtmlNode, type HtmlNodeForKind, type HtmlPendingConstruct, type HtmlPendingNode, type HtmlRawNode, type HtmlRenderOptions, type HtmlRewriteHandlers, type HtmlRootNode, type HtmlSemanticNode, HtmlStreamRenderer, type HtmlTextNode, type HtmlUnresolvedReferenceNode, type ImageNode, type ImageReferenceNode, type InlineCodeNode, type InlineExpressionNode, type InlineMathNode, InputError, type InputIssue, type JsxAttribute, type JsxAttributeLike, type JsxAttributeValue, type JsxAttributeValueExpression, type JsxFlowElementNode, type JsxSpreadAttribute, type JsxTextElementNode, type LeafDirectiveNode, LimitError, type LinkNode, type LinkReferenceNode, type ListItemNode, type ListNode, type MathFormat, type MathMode, type MathRenderStyle, type MdxBlockEvent, type MdxEdit, MdxError, type MdxEventDiagnostic, type MdxKind, type MdxNode, type MdxNodeForKind, type MdxPreview, type MdxRewriteHandlers, MdxStream, type MdxStreamChange, type MdxStreamCompletion, type MdxStreamLimits, type MdxStreamOptions, type MdxStreamSnapshot, type MdxTransportValue, type ParagraphNode, ParseError, type ParseOptions, type ParseResult, type ParserLimit, type ParserLimits, type PhrasingContent, type PreviewBlock, type ProcessInput, type ProcessOptions, type ProcessResult, Processor, type ProcessorOptions, type ProgramCompileArtifact, type RawHtmlBlockNode, type RawHtmlInlineNode, type ReferenceKind, type RelatedInformation, SourceBuffer, SourceFile, type SourceFileInput, type SourceLocation, type SourceMap, type SourceRange, type SourceSpan, type StreamBlock, type StreamBlockEventsOptions, type StreamDependencies, type StrongNode, type SyntaxOptions, type TableAlignment, type TableCellNode, type TableNode, type TableRowNode, type TextDirectiveNode, type TextNode, type ThematicBreakNode, TransformError, type TransformIssue, type TransformTarget, TreeCursor, applyBlockEvent, blockEvent, compile, completionEvent, defaultParserLimits, documentFrontmatter, formatDiagnostic, formatHtml, formatMdx, hasErrorDiagnostics, htmlChildren, htmlClassNames, htmlFallback, htmlText, indexDocument, isFlowContent, isHtmlAttributeList, isPhrasingContent, lowerHtml, mdxChildren, nodeText, normalizeIdentifier, parse, pendingFallback, previewDocument, rewriteHtml, rewriteMdx, selectHtml, selectMdx, streamBlockEvents, walkHtml, walkMdx };
package/dist/mod.mjs CHANGED
@@ -1,8 +1,19 @@
1
- import { MdxCompileError, MdxCompiler, remarkFrontmatterPlugin, remarkGfmPlugin } from "./compiler.mjs";
2
- import { headingIdPlugin } from "./plugins/heading-id/plugin.mjs";
3
- import { katexPlugin } from "./plugins/katex/plugin.mjs";
4
- import { removeImportsExportsPlugin } from "./plugins/remove-imports-exports.mjs";
5
- import { syntaxHighlightPlugin } from "./plugins/syntax-highlight/plugin.mjs";
6
- import { treeProcessorPlugin } from "./plugins/tree-processor/plugin.mjs";
7
- import "./plugins/mod.mjs";
8
- export { MdxCompileError, MdxCompiler, headingIdPlugin, katexPlugin, remarkFrontmatterPlugin, remarkGfmPlugin, removeImportsExportsPlugin, syntaxHighlightPlugin, treeProcessorPlugin };
1
+ import { formatDiagnostic, hasErrorDiagnostics } from "./diagnostics.mjs";
2
+ import { CompileError, ConfigurationError, FrontmatterError, InputError, LimitError, MdxError, ParseError, TransformError } from "./errors.mjs";
3
+ import { htmlChildren, htmlClassNames, htmlFallback, htmlText, isHtmlAttributeList, pendingFallback } from "./html.mjs";
4
+ import { normalizeIdentifier } from "./identifier.mjs";
5
+ import { documentFrontmatter, indexDocument, isFlowContent, isPhrasingContent, mdxChildren, nodeText } from "./model.mjs";
6
+ import { formatMdx } from "./format.mjs";
7
+ import { SourceBuffer, SourceFile } from "./source.mjs";
8
+ import { lowerHtml } from "./html-lower.mjs";
9
+ import { compile } from "./compiler.mjs";
10
+ import { formatHtml } from "./html-format.mjs";
11
+ import { defaultParserLimits } from "./parser/config.mjs";
12
+ import { TreeCursor } from "./tree.mjs";
13
+ import { rewriteHtml, rewriteMdx, selectHtml, selectMdx, walkHtml, walkMdx } from "./traversal.mjs";
14
+ import { MdxStream } from "./stream.mjs";
15
+ import { applyBlockEvent, blockEvent, completionEvent, previewDocument, streamBlockEvents } from "./stream-events.mjs";
16
+ import { HtmlStreamRenderer } from "./html-stream.mjs";
17
+ import { parse } from "./parser.mjs";
18
+ import { Processor } from "./processor.mjs";
19
+ export { CompileError, ConfigurationError, FrontmatterError, HtmlStreamRenderer, InputError, LimitError, MdxError, MdxStream, ParseError, Processor, SourceBuffer, SourceFile, TransformError, TreeCursor, applyBlockEvent, blockEvent, compile, completionEvent, defaultParserLimits, documentFrontmatter, formatDiagnostic, formatHtml, formatMdx, hasErrorDiagnostics, htmlChildren, htmlClassNames, htmlFallback, htmlText, indexDocument, isFlowContent, isHtmlAttributeList, isPhrasingContent, lowerHtml, mdxChildren, nodeText, normalizeIdentifier, parse, pendingFallback, previewDocument, rewriteHtml, rewriteMdx, selectHtml, selectMdx, streamBlockEvents, walkHtml, walkMdx };
@@ -0,0 +1,196 @@
1
+ import { HeadingDepth } from "./heading.mjs";
2
+ import { SourceRange } from "./ranges.mjs";
3
+ import { FrontmatterFormat, MathFormat } from "./syntax-options.mjs";
4
+ //#region src/model.d.ts
5
+ /**
6
+ * Semantic MDX nodes are plain, readonly data. `origin` is a UTF-16 range in the
7
+ * `SourceFile` owned by the outcome that produced the tree.
8
+ */
9
+ interface NodeBase<TKind extends string> {
10
+ readonly kind: TKind;
11
+ readonly origin?: SourceRange;
12
+ }
13
+ interface ParentBase<TKind extends string, TChild> extends NodeBase<TKind> {
14
+ readonly children: readonly TChild[];
15
+ }
16
+ export interface TextNode extends NodeBase<"text"> {
17
+ readonly value: string;
18
+ }
19
+ export type EmphasisNode = ParentBase<"emphasis", PhrasingContent>;
20
+ export type StrongNode = ParentBase<"strong", PhrasingContent>;
21
+ export type DeleteNode = ParentBase<"delete", PhrasingContent>;
22
+ export interface InlineCodeNode extends NodeBase<"inlineCode"> {
23
+ readonly value: string;
24
+ }
25
+ export type HardBreakNode = NodeBase<"hardBreak">;
26
+ export interface LinkNode extends ParentBase<"link", PhrasingContent> {
27
+ readonly url: string;
28
+ readonly title?: string;
29
+ }
30
+ export interface ImageNode extends NodeBase<"image"> {
31
+ readonly url: string;
32
+ readonly alt: string;
33
+ readonly title?: string;
34
+ }
35
+ export type ReferenceKind = "full" | "collapsed" | "shortcut";
36
+ export interface LinkReferenceNode extends ParentBase<"linkReference", PhrasingContent> {
37
+ /** Normalized with `normalizeIdentifier`. */
38
+ readonly identifier: string;
39
+ readonly referenceKind: ReferenceKind;
40
+ }
41
+ export interface ImageReferenceNode extends NodeBase<"imageReference"> {
42
+ /** Normalized with `normalizeIdentifier`. */
43
+ readonly identifier: string;
44
+ readonly alt: string;
45
+ readonly referenceKind: ReferenceKind;
46
+ }
47
+ export interface RawHtmlInlineNode extends NodeBase<"rawHtmlInline"> {
48
+ readonly value: string;
49
+ }
50
+ export interface FootnoteReferenceNode extends NodeBase<"footnoteReference"> {
51
+ /** Normalized with `normalizeIdentifier`. */
52
+ readonly identifier: string;
53
+ readonly label: string;
54
+ }
55
+ export interface DirectiveAttribute {
56
+ readonly name: string;
57
+ readonly value: string;
58
+ }
59
+ export type DirectiveLabelNode = ParentBase<"directiveLabel", PhrasingContent>;
60
+ interface DirectiveBase<TKind extends string> extends NodeBase<TKind> {
61
+ readonly name: string;
62
+ /** Attribute names are unique. */
63
+ readonly attributes: readonly DirectiveAttribute[];
64
+ readonly label?: DirectiveLabelNode;
65
+ }
66
+ export type TextDirectiveNode = DirectiveBase<"textDirective">;
67
+ export type LeafDirectiveNode = DirectiveBase<"leafDirective">;
68
+ export interface ContainerDirectiveNode extends DirectiveBase<"containerDirective"> {
69
+ readonly children: readonly FlowContent[];
70
+ }
71
+ export interface InlineMathNode extends NodeBase<"inlineMath"> {
72
+ readonly value: string;
73
+ readonly format: MathFormat;
74
+ }
75
+ export interface DisplayMathNode extends NodeBase<"displayMath"> {
76
+ readonly value: string;
77
+ readonly format: MathFormat;
78
+ /** Only dollar math can carry metadata. */
79
+ readonly meta?: string;
80
+ }
81
+ export interface InlineExpressionNode extends NodeBase<"inlineExpression"> {
82
+ readonly code: string;
83
+ }
84
+ export interface BlockExpressionNode extends NodeBase<"blockExpression"> {
85
+ readonly code: string;
86
+ }
87
+ export interface EsmNode extends NodeBase<"esm"> {
88
+ readonly code: string;
89
+ }
90
+ export interface JsxAttributeValueExpression extends NodeBase<"jsxAttributeValueExpression"> {
91
+ readonly code: string;
92
+ }
93
+ export type JsxAttributeValue = string | JsxAttributeValueExpression;
94
+ export interface JsxAttribute extends NodeBase<"jsxAttribute"> {
95
+ readonly name: string;
96
+ /** An omitted value is the boolean shorthand `<A enabled />`. */
97
+ readonly value?: JsxAttributeValue;
98
+ }
99
+ export interface JsxSpreadAttribute extends NodeBase<"jsxSpreadAttribute"> {
100
+ /** The spread argument, without the `...` operator. */
101
+ readonly code: string;
102
+ }
103
+ export type JsxAttributeLike = JsxAttribute | JsxSpreadAttribute;
104
+ interface JsxElementBase<TKind extends string, TChild> extends ParentBase<TKind, TChild> {
105
+ /** `undefined` for fragments. */
106
+ readonly name?: string;
107
+ readonly attributes: readonly JsxAttributeLike[];
108
+ }
109
+ export type JsxTextElementNode = JsxElementBase<"jsxTextElement", PhrasingContent>;
110
+ export type JsxFlowElementNode = JsxElementBase<"jsxFlowElement", FlowContent>;
111
+ export type ParagraphNode = ParentBase<"paragraph", PhrasingContent>;
112
+ export interface HeadingNode extends ParentBase<"heading", PhrasingContent> {
113
+ readonly depth: HeadingDepth;
114
+ }
115
+ export interface CodeBlockNode extends NodeBase<"codeBlock"> {
116
+ readonly value: string;
117
+ readonly language?: string;
118
+ readonly meta?: string;
119
+ }
120
+ export type ThematicBreakNode = NodeBase<"thematicBreak">;
121
+ export type BlockQuoteNode = ParentBase<"blockquote", FlowContent>;
122
+ export interface ListItemNode extends ParentBase<"listItem", FlowContent> {
123
+ /** `undefined` for an ordinary item, a boolean for a task item. */
124
+ readonly checked?: boolean;
125
+ readonly spread: boolean;
126
+ }
127
+ export interface ListNode extends ParentBase<"list", ListItemNode> {
128
+ readonly ordered: boolean;
129
+ readonly spread: boolean;
130
+ readonly start: number;
131
+ }
132
+ export interface DefinitionNode extends NodeBase<"definition"> {
133
+ /** Normalized with `normalizeIdentifier`. */
134
+ readonly identifier: string;
135
+ readonly url: string;
136
+ readonly title?: string;
137
+ }
138
+ export interface FootnoteDefinitionNode extends ParentBase<"footnoteDefinition", FlowContent> {
139
+ /** Normalized with `normalizeIdentifier`. */
140
+ readonly identifier: string;
141
+ readonly label: string;
142
+ }
143
+ export interface RawHtmlBlockNode extends NodeBase<"rawHtmlBlock"> {
144
+ readonly value: string;
145
+ }
146
+ export type FrontmatterValue = null | boolean | number | bigint | string | FrontmatterTemporal | readonly FrontmatterValue[] | FrontmatterObject;
147
+ export interface FrontmatterObject {
148
+ readonly [key: string]: FrontmatterValue;
149
+ }
150
+ export type FrontmatterTemporalType = "offset-date-time" | "local-date-time" | "local-date" | "local-time";
151
+ /** A TOML date or time as an ISO 8601 string. */
152
+ export interface FrontmatterTemporal {
153
+ readonly kind: "temporal";
154
+ readonly type: FrontmatterTemporalType;
155
+ readonly value: string;
156
+ }
157
+ export interface FrontmatterNode extends NodeBase<"frontmatter"> {
158
+ readonly format: FrontmatterFormat;
159
+ readonly value: string;
160
+ /** Decoded data. Present when the parser decoded the authored value. */
161
+ readonly data?: FrontmatterObject;
162
+ /** The authored value range, excluding fences. */
163
+ readonly valueOrigin?: SourceRange;
164
+ }
165
+ export type TableAlignment = "center" | "left" | "none" | "right";
166
+ export type TableCellNode = ParentBase<"tableCell", PhrasingContent>;
167
+ export type TableRowNode = ParentBase<"tableRow", TableCellNode>;
168
+ export interface TableNode extends ParentBase<"table", TableRowNode> {
169
+ readonly alignments: readonly TableAlignment[];
170
+ }
171
+ export type DocumentNode = ParentBase<"document", FlowContent>;
172
+ export type PhrasingContent = TextNode | EmphasisNode | StrongNode | DeleteNode | InlineCodeNode | HardBreakNode | LinkNode | ImageNode | LinkReferenceNode | ImageReferenceNode | RawHtmlInlineNode | FootnoteReferenceNode | TextDirectiveNode | InlineMathNode | JsxTextElementNode | InlineExpressionNode;
173
+ export type FlowContent = ParagraphNode | HeadingNode | CodeBlockNode | ThematicBreakNode | BlockQuoteNode | ListNode | DefinitionNode | RawHtmlBlockNode | FootnoteDefinitionNode | FrontmatterNode | LeafDirectiveNode | ContainerDirectiveNode | DisplayMathNode | TableNode | BlockExpressionNode | EsmNode | JsxFlowElementNode;
174
+ export type MdxNode = DocumentNode | FlowContent | ListItemNode | TableRowNode | TableCellNode | DirectiveLabelNode | PhrasingContent;
175
+ export type MdxKind = MdxNode["kind"];
176
+ export type MdxNodeForKind<TKind extends MdxKind> = Extract<MdxNode, {
177
+ readonly kind: TKind;
178
+ }>;
179
+ /** Whether a node can appear where phrasing (inline) content is expected. */
180
+ export declare function isPhrasingContent(node: MdxNode): node is PhrasingContent;
181
+ /** Whether a node can appear where flow (block) content is expected. */
182
+ export declare function isFlowContent(node: MdxNode): node is FlowContent;
183
+ /** Child nodes in document order, including a directive label before its body. */
184
+ export declare function mdxChildren(node: MdxNode): readonly MdxNode[];
185
+ /** Semantic text content: what a reader sees, without markup. */
186
+ export declare function nodeText(node: MdxNode): string;
187
+ export interface DocumentIndex {
188
+ readonly definitions: ReadonlyMap<string, DefinitionNode>;
189
+ readonly footnotes: ReadonlyMap<string, FootnoteDefinitionNode>;
190
+ }
191
+ /** Indexes the first definition and footnote for each normalized identifier. */
192
+ export declare function indexDocument(document: DocumentNode): DocumentIndex;
193
+ export declare function documentFrontmatter(document: DocumentNode): FrontmatterNode | undefined;
194
+ //#endregion
195
+ export {};
196
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