nuxt-ai-ready 2.5.2 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (282) hide show
  1. package/README.md +13 -12
  2. package/dist/chunks/agent-skills.mjs +35 -12
  3. package/dist/chunks/prerender.mjs +35 -24
  4. package/dist/cli.mjs +5 -2
  5. package/dist/module.d.mts +4 -0
  6. package/dist/module.json +2 -2
  7. package/dist/module.mjs +8 -4
  8. package/dist/runtime/app/index.d.ts +3 -0
  9. package/dist/runtime/app/index.js +2 -0
  10. package/dist/runtime/cache-control.d.ts +2 -0
  11. package/dist/runtime/cache-control.js +11 -0
  12. package/dist/runtime/llms-txt-utils.js +1 -1
  13. package/dist/runtime/server/db/context.d.ts +13 -0
  14. package/dist/runtime/server/db/drizzle/client.d.ts +6 -7
  15. package/dist/runtime/server/db/drizzle/client.js +13 -2
  16. package/dist/runtime/server/db/drizzle/providers/bun.d.ts +2 -2
  17. package/dist/runtime/server/db/drizzle/providers/bun.js +2 -2
  18. package/dist/runtime/server/db/drizzle/providers/d1.d.ts +2 -2
  19. package/dist/runtime/server/db/drizzle/providers/d1.js +3 -2
  20. package/dist/runtime/server/db/drizzle/providers/libsql.d.ts +2 -2
  21. package/dist/runtime/server/db/drizzle/providers/libsql.js +2 -2
  22. package/dist/runtime/server/db/drizzle/providers/neon.d.ts +2 -2
  23. package/dist/runtime/server/db/drizzle/providers/neon.js +2 -2
  24. package/dist/runtime/server/db/drizzle/providers/node-sqlite.d.ts +2 -2
  25. package/dist/runtime/server/db/drizzle/providers/node-sqlite.js +2 -2
  26. package/dist/runtime/server/db/drizzle/providers/postgres.d.ts +2 -2
  27. package/dist/runtime/server/db/drizzle/providers/postgres.js +2 -2
  28. package/dist/runtime/server/db/drizzle/queries.d.ts +27 -27
  29. package/dist/runtime/server/db/drizzle/queries.js +6 -5
  30. package/dist/runtime/server/db/drizzle/raw.d.ts +2 -6
  31. package/dist/runtime/server/db/index.d.ts +1 -1
  32. package/dist/runtime/server/db/index.js +1 -1
  33. package/dist/runtime/server/db/queries.d.ts +36 -36
  34. package/dist/runtime/server/db/queries.js +8 -9
  35. package/dist/runtime/server/db/seed.d.ts +2 -2
  36. package/dist/runtime/server/db/seed.js +4 -3
  37. package/dist/runtime/server/db/shared.d.ts +8 -0
  38. package/dist/runtime/server/db/shared.js +8 -2
  39. package/dist/runtime/server/index.d.ts +2 -0
  40. package/dist/runtime/server/index.js +17 -0
  41. package/dist/runtime/server/mcp/tools/get-page-markdown.js +1 -1
  42. package/dist/runtime/server/mcp/tools/list-pages.js +1 -1
  43. package/dist/runtime/server/mcp/tools/search-pages.js +1 -1
  44. package/dist/runtime/server/middleware/markdown.js +3 -3
  45. package/dist/runtime/server/middleware/markdown.prerender.js +1 -1
  46. package/dist/runtime/server/plugins/db-lifecycle-nitro3.d.ts +2 -0
  47. package/dist/runtime/server/plugins/db-lifecycle-nitro3.js +16 -0
  48. package/dist/runtime/server/plugins/html-capture.prerender.js +6 -4
  49. package/dist/runtime/server/plugins/link-header-nitro3.d.ts +2 -0
  50. package/dist/runtime/server/plugins/link-header-nitro3.js +20 -0
  51. package/dist/runtime/server/plugins/link-header.d.ts +6 -0
  52. package/dist/runtime/server/plugins/link-header.js +7 -11
  53. package/dist/runtime/server/plugins/markdown-negotiation.js +8 -1
  54. package/dist/runtime/server/plugins/sitemap-seeder.js +3 -3
  55. package/dist/runtime/server/routes/agent-skills-artifact.d.ts +1 -1
  56. package/dist/runtime/server/routes/agent-skills-artifact.js +10 -10
  57. package/dist/runtime/server/routes/agent-skills-index.d.ts +1 -1
  58. package/dist/runtime/server/routes/agent-skills-index.js +7 -6
  59. package/dist/runtime/server/routes/ai-catalog.d.ts +2 -1
  60. package/dist/runtime/server/routes/ai-catalog.js +7 -8
  61. package/dist/runtime/server/routes/api-catalog.d.ts +3 -1
  62. package/dist/runtime/server/routes/api-catalog.js +12 -12
  63. package/dist/runtime/server/routes/llms-full.txt.get.js +1 -1
  64. package/dist/runtime/server/routes/mcp-server-card.d.ts +1 -1
  65. package/dist/runtime/server/routes/mcp-server-card.js +7 -8
  66. package/dist/runtime/server/utils/checkStale.d.ts +2 -2
  67. package/dist/runtime/server/utils/cloudflare-prerendered.d.ts +3 -0
  68. package/dist/runtime/server/utils/cloudflare-prerendered.js +23 -0
  69. package/dist/runtime/server/utils/cloudflare.d.ts +5 -5
  70. package/dist/runtime/server/utils/cloudflare.js +31 -7
  71. package/dist/runtime/server/utils/content-negotiation.d.ts +5 -3
  72. package/dist/runtime/server/utils/content-negotiation.js +8 -7
  73. package/dist/runtime/server/utils/context.d.ts +3 -3
  74. package/dist/runtime/server/utils/context.js +1 -1
  75. package/dist/runtime/server/utils/discovery-response.d.ts +2 -0
  76. package/dist/runtime/server/utils/link-header.d.ts +5 -3
  77. package/dist/runtime/server/utils/link-header.js +26 -2
  78. package/dist/runtime/server/utils/markdown-request.d.ts +4 -3
  79. package/dist/runtime/server/utils/markdown-request.js +15 -13
  80. package/dist/runtime/server/utils/negotiation-decision.d.ts +4 -0
  81. package/dist/runtime/server/utils/negotiation-decision.js +6 -5
  82. package/dist/runtime/server/utils/negotiation-response.d.ts +1 -1
  83. package/dist/runtime/server/utils/negotiation-response.js +63 -23
  84. package/dist/runtime/server/utils/prerender-html.d.ts +2 -1
  85. package/dist/runtime/server/utils/prerender-html.js +3 -1
  86. package/dist/runtime/types.d.ts +15 -7
  87. package/dist/shared/nuxt-ai-ready.B3hAuOLQ.mjs +29 -0
  88. package/dist/shared/{nuxt-ai-ready.CLSWou20.mjs → nuxt-ai-ready.C34F0LJo.mjs} +560 -219
  89. package/package.json +85 -20
  90. package/skills/nuxt-ai-ready/SKILL.md +26 -12
  91. package/skills/nuxt-ai-ready/references/runtime-indexing.md +7 -6
  92. package/dist/runtime/server/db/drizzle/providers/sqlite.d.ts +0 -8
  93. package/dist/runtime/server/db/drizzle/providers/sqlite.js +0 -15
  94. package/node_modules/@mdream/js/LICENSE.md +0 -9
  95. package/node_modules/@mdream/js/README.md +0 -792
  96. package/node_modules/@mdream/js/bin/mdream.mjs +0 -2
  97. package/node_modules/@mdream/js/dist/_chunks/const.mjs +0 -134
  98. package/node_modules/@mdream/js/dist/_chunks/index.d.mts +0 -9
  99. package/node_modules/@mdream/js/dist/_chunks/markdown-processor.mjs +0 -1968
  100. package/node_modules/@mdream/js/dist/_chunks/minimal.d.mts +0 -6
  101. package/node_modules/@mdream/js/dist/_chunks/parse.mjs +0 -2756
  102. package/node_modules/@mdream/js/dist/_chunks/plugins.mjs +0 -725
  103. package/node_modules/@mdream/js/dist/_chunks/resolve-plugins.mjs +0 -44
  104. package/node_modules/@mdream/js/dist/_chunks/stream.mjs +0 -37
  105. package/node_modules/@mdream/js/dist/_chunks/types.d.mts +0 -473
  106. package/node_modules/@mdream/js/dist/cli.d.mts +0 -1
  107. package/node_modules/@mdream/js/dist/cli.mjs +0 -32
  108. package/node_modules/@mdream/js/dist/core.d.mts +0 -15
  109. package/node_modules/@mdream/js/dist/core.mjs +0 -28
  110. package/node_modules/@mdream/js/dist/index.d.mts +0 -4
  111. package/node_modules/@mdream/js/dist/index.mjs +0 -58
  112. package/node_modules/@mdream/js/dist/llms-txt.d.mts +0 -86
  113. package/node_modules/@mdream/js/dist/llms-txt.mjs +0 -308
  114. package/node_modules/@mdream/js/dist/negotiate.d.mts +0 -35
  115. package/node_modules/@mdream/js/dist/negotiate.mjs +0 -121
  116. package/node_modules/@mdream/js/dist/parse.d.mts +0 -90
  117. package/node_modules/@mdream/js/dist/parse.mjs +0 -2
  118. package/node_modules/@mdream/js/dist/plugins.d.mts +0 -85
  119. package/node_modules/@mdream/js/dist/plugins.mjs +0 -2
  120. package/node_modules/@mdream/js/dist/preset/minimal.d.mts +0 -2
  121. package/node_modules/@mdream/js/dist/preset/minimal.mjs +0 -33
  122. package/node_modules/@mdream/js/dist/splitter.d.mts +0 -18
  123. package/node_modules/@mdream/js/dist/splitter.mjs +0 -194
  124. package/node_modules/@mdream/js/package.json +0 -103
  125. package/node_modules/cac/LICENSE +0 -21
  126. package/node_modules/cac/README.md +0 -492
  127. package/node_modules/cac/dist/index.d.ts +0 -196
  128. package/node_modules/cac/dist/index.js +0 -638
  129. package/node_modules/cac/package.json +0 -72
  130. package/node_modules/mdream/LICENSE.md +0 -9
  131. package/node_modules/mdream/README.md +0 -1091
  132. package/node_modules/mdream/bin/mdream.mjs +0 -46
  133. package/node_modules/mdream/dist/browser.d.mts +0 -105
  134. package/node_modules/mdream/dist/browser.mjs +0 -262
  135. package/node_modules/mdream/dist/edge.d.mts +0 -100
  136. package/node_modules/mdream/dist/edge.mjs +0 -250
  137. package/node_modules/mdream/dist/iife.js +0 -605
  138. package/node_modules/mdream/dist/index.d.mts +0 -89
  139. package/node_modules/mdream/dist/index.mjs +0 -184
  140. package/node_modules/mdream/dist/wasm.d.mts +0 -100
  141. package/node_modules/mdream/dist/wasm.mjs +0 -140
  142. package/node_modules/mdream/dist/worker.d.mts +0 -101
  143. package/node_modules/mdream/dist/worker.mjs +0 -217
  144. package/node_modules/mdream/napi/index.d.mts +0 -127
  145. package/node_modules/mdream/napi/index.d.ts +0 -127
  146. package/node_modules/mdream/napi/index.mjs +0 -725
  147. package/node_modules/mdream/napi/rust.android-arm-eabi.node +0 -0
  148. package/node_modules/mdream/napi/rust.android-arm64.node +0 -0
  149. package/node_modules/mdream/napi/rust.darwin-arm64.node +0 -0
  150. package/node_modules/mdream/napi/rust.darwin-x64.node +0 -0
  151. package/node_modules/mdream/napi/rust.freebsd-x64.node +0 -0
  152. package/node_modules/mdream/napi/rust.linux-arm-gnueabihf.node +0 -0
  153. package/node_modules/mdream/napi/rust.linux-arm64-gnu.node +0 -0
  154. package/node_modules/mdream/napi/rust.linux-arm64-musl.node +0 -0
  155. package/node_modules/mdream/napi/rust.linux-x64-gnu.node +0 -0
  156. package/node_modules/mdream/napi/rust.linux-x64-musl.node +0 -0
  157. package/node_modules/mdream/napi/rust.wasi.cjs +0 -2144
  158. package/node_modules/mdream/napi/rust.wasm32-wasi.wasm +0 -0
  159. package/node_modules/mdream/napi/rust.win32-arm64-msvc.node +0 -0
  160. package/node_modules/mdream/napi/rust.win32-x64-msvc.node +0 -0
  161. package/node_modules/mdream/node_modules/@emnapi/core/LICENSE +0 -21
  162. package/node_modules/mdream/node_modules/@emnapi/core/README.md +0 -1
  163. package/node_modules/mdream/node_modules/@emnapi/core/dist/emnapi-core.d.ts +0 -392
  164. package/node_modules/mdream/node_modules/@emnapi/core/dist/emnapi-core.full.d.ts +0 -392
  165. package/node_modules/mdream/node_modules/@emnapi/core/dist/emnapi-core.full.js +0 -8351
  166. package/node_modules/mdream/node_modules/@emnapi/core/dist/emnapi-core.js +0 -7268
  167. package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/async-work.d.ts +0 -5
  168. package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/async-work.js +0 -843
  169. package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/index.d.ts +0 -4
  170. package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/index.js +0 -3
  171. package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/threadsafe-function.d.ts +0 -5
  172. package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/threadsafe-function.js +0 -1010
  173. package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/v8.d.ts +0 -5
  174. package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/v8.js +0 -1446
  175. package/node_modules/mdream/node_modules/@emnapi/core/package.json +0 -39
  176. package/node_modules/mdream/node_modules/@emnapi/core/rollup.config.js +0 -60
  177. package/node_modules/mdream/node_modules/@emnapi/runtime/LICENSE +0 -21
  178. package/node_modules/mdream/node_modules/@emnapi/runtime/README.md +0 -1
  179. package/node_modules/mdream/node_modules/@emnapi/runtime/dist/emnapi.d.ts +0 -833
  180. package/node_modules/mdream/node_modules/@emnapi/runtime/dist/emnapi.js +0 -2306
  181. package/node_modules/mdream/node_modules/@emnapi/runtime/dist/emnapi.js.map +0 -1
  182. package/node_modules/mdream/node_modules/@emnapi/runtime/index.cjs +0 -63
  183. package/node_modules/mdream/node_modules/@emnapi/runtime/package.json +0 -39
  184. package/node_modules/mdream/node_modules/@emnapi/runtime/rollup.config.js +0 -25
  185. package/node_modules/mdream/node_modules/@emnapi/wasi-threads/LICENSE +0 -21
  186. package/node_modules/mdream/node_modules/@emnapi/wasi-threads/README.md +0 -203
  187. package/node_modules/mdream/node_modules/@emnapi/wasi-threads/dist/wasi-threads.d.ts +0 -236
  188. package/node_modules/mdream/node_modules/@emnapi/wasi-threads/dist/wasi-threads.js +0 -1086
  189. package/node_modules/mdream/node_modules/@emnapi/wasi-threads/package.json +0 -35
  190. package/node_modules/mdream/node_modules/@emnapi/wasi-threads/rollup.config.js +0 -6
  191. package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/dist/emnapi-plugins.cjs +0 -1472
  192. package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/dist/emnapi-plugins.js +0 -1470
  193. package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/dist/fs-proxy.cjs +0 -237
  194. package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/dist/fs.js +0 -18260
  195. package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/fs-proxy.js +0 -317
  196. package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/package.json +0 -67
  197. package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/runtime.cjs +0 -39
  198. package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/runtime.js +0 -36
  199. package/node_modules/mdream/node_modules/@tybys/wasm-util/LICENSE +0 -21
  200. package/node_modules/mdream/node_modules/@tybys/wasm-util/README.md +0 -193
  201. package/node_modules/mdream/node_modules/@tybys/wasm-util/dist/tsdoc-metadata.json +0 -11
  202. package/node_modules/mdream/node_modules/@tybys/wasm-util/dist/wasm-util.d.ts +0 -423
  203. package/node_modules/mdream/node_modules/@tybys/wasm-util/dist/wasm-util.esm-bundler.js +0 -2932
  204. package/node_modules/mdream/node_modules/@tybys/wasm-util/dist/wasm-util.esm.js +0 -2932
  205. package/node_modules/mdream/node_modules/@tybys/wasm-util/dist/wasm-util.esm.min.js +0 -1
  206. package/node_modules/mdream/node_modules/@tybys/wasm-util/dist/wasm-util.js +0 -2954
  207. package/node_modules/mdream/node_modules/@tybys/wasm-util/dist/wasm-util.min.js +0 -1
  208. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/asyncify.js +0 -158
  209. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/index.js +0 -13
  210. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/jspi.js +0 -46
  211. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/load.js +0 -97
  212. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/memory.js +0 -35
  213. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/error.js +0 -103
  214. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/fd.js +0 -268
  215. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/fs.js +0 -3
  216. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/index.js +0 -192
  217. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/path.js +0 -316
  218. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/preview1.js +0 -1599
  219. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/rights.js +0 -141
  220. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/types.js +0 -220
  221. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/util.js +0 -128
  222. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/webassembly.js +0 -13
  223. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/asyncify.mjs +0 -153
  224. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/index.mjs +0 -9
  225. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/jspi.mjs +0 -39
  226. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/load.mjs +0 -89
  227. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/memory.mjs +0 -28
  228. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/error.mjs +0 -97
  229. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/fd.mjs +0 -256
  230. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/fs.mjs +0 -1
  231. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/index.mjs +0 -186
  232. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/path.mjs +0 -310
  233. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/preview1.mjs +0 -1593
  234. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/rights.mjs +0 -135
  235. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/types.mjs +0 -216
  236. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/util.mjs +0 -113
  237. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/webassembly.mjs +0 -9
  238. package/node_modules/mdream/node_modules/@tybys/wasm-util/package.json +0 -58
  239. package/node_modules/mdream/node_modules/tslib/CopyrightNotice.txt +0 -15
  240. package/node_modules/mdream/node_modules/tslib/LICENSE.txt +0 -12
  241. package/node_modules/mdream/node_modules/tslib/README.md +0 -164
  242. package/node_modules/mdream/node_modules/tslib/SECURITY.md +0 -41
  243. package/node_modules/mdream/node_modules/tslib/modules/index.d.ts +0 -38
  244. package/node_modules/mdream/node_modules/tslib/modules/index.js +0 -70
  245. package/node_modules/mdream/node_modules/tslib/modules/package.json +0 -3
  246. package/node_modules/mdream/node_modules/tslib/package.json +0 -47
  247. package/node_modules/mdream/node_modules/tslib/tslib.d.ts +0 -460
  248. package/node_modules/mdream/node_modules/tslib/tslib.es6.html +0 -1
  249. package/node_modules/mdream/node_modules/tslib/tslib.es6.js +0 -402
  250. package/node_modules/mdream/node_modules/tslib/tslib.es6.mjs +0 -401
  251. package/node_modules/mdream/node_modules/tslib/tslib.html +0 -1
  252. package/node_modules/mdream/node_modules/tslib/tslib.js +0 -484
  253. package/node_modules/mdream/package.json +0 -110
  254. package/node_modules/mdream/skills/mdream/SKILL.md +0 -124
  255. package/node_modules/mdream/skills/mdream/references/runtimes.md +0 -49
  256. package/node_modules/mdream/wasm/mdream_edge.d.ts +0 -90
  257. package/node_modules/mdream/wasm/mdream_edge.js +0 -517
  258. package/node_modules/mdream/wasm/mdream_edge_bg.wasm +0 -0
  259. package/node_modules/mdream/wasm/mdream_edge_bg.wasm.d.ts +0 -20
  260. package/node_modules/mdream/wasm/package.json +0 -17
  261. package/node_modules/mdream/wasm-bundler/mdream_edge.d.ts +0 -45
  262. package/node_modules/mdream/wasm-bundler/mdream_edge.js +0 -13
  263. package/node_modules/mdream/wasm-bundler/mdream_edge_bg.js +0 -413
  264. package/node_modules/mdream/wasm-bundler/mdream_edge_bg.wasm +0 -0
  265. package/node_modules/mdream/wasm-bundler/mdream_edge_bg.wasm.d.ts +0 -20
  266. package/node_modules/mdream/wasm-bundler/package.json +0 -19
  267. package/node_modules/pathe/LICENSE +0 -70
  268. package/node_modules/pathe/README.md +0 -73
  269. package/node_modules/pathe/dist/index.cjs +0 -39
  270. package/node_modules/pathe/dist/index.d.cts +0 -47
  271. package/node_modules/pathe/dist/index.d.mts +0 -47
  272. package/node_modules/pathe/dist/index.d.ts +0 -47
  273. package/node_modules/pathe/dist/index.mjs +0 -19
  274. package/node_modules/pathe/dist/shared/pathe.BSlhyZSM.cjs +0 -266
  275. package/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs +0 -249
  276. package/node_modules/pathe/dist/utils.cjs +0 -82
  277. package/node_modules/pathe/dist/utils.d.cts +0 -32
  278. package/node_modules/pathe/dist/utils.d.mts +0 -32
  279. package/node_modules/pathe/dist/utils.d.ts +0 -32
  280. package/node_modules/pathe/dist/utils.mjs +0 -77
  281. package/node_modules/pathe/package.json +0 -61
  282. package/node_modules/pathe/utils.d.ts +0 -1
@@ -1,44 +0,0 @@
1
- import { extractionCollectorPlugin, filterPlugin, frontmatterPlugin, isolateMainPlugin, tailwindPlugin } from "./plugins.mjs";
2
- function resolveFrontmatterOpt(opt) {
3
- if (typeof opt === "function") return {
4
- config: {},
5
- callback: opt
6
- };
7
- if (typeof opt === "object") return {
8
- config: opt,
9
- callback: opt.onExtract
10
- };
11
- return { config: {} };
12
- }
13
- function resolvePlugins(options, hooks) {
14
- const plugins = [];
15
- let callExtractionHandlers;
16
- let getFrontmatter;
17
- let frontmatterCallback;
18
- const config = options.plugins;
19
- if (config) {
20
- if (config.frontmatter) {
21
- const fm = resolveFrontmatterOpt(config.frontmatter);
22
- const fmPlugin = frontmatterPlugin(fm.config);
23
- plugins.push(fmPlugin);
24
- getFrontmatter = fmPlugin.getFrontmatter;
25
- frontmatterCallback = fm.callback;
26
- }
27
- if (config.isolateMain) plugins.push(isolateMainPlugin());
28
- if (config.tailwind) plugins.push(tailwindPlugin());
29
- if (config.filter) plugins.push(filterPlugin(config.filter));
30
- if (config.extraction) {
31
- const collector = extractionCollectorPlugin(config.extraction);
32
- plugins.push(collector.plugin);
33
- callExtractionHandlers = collector.callHandlers;
34
- }
35
- }
36
- if (hooks) plugins.push(...hooks);
37
- return {
38
- plugins,
39
- callExtractionHandlers,
40
- getFrontmatter,
41
- frontmatterCallback
42
- };
43
- }
44
- export { resolvePlugins };
@@ -1,37 +0,0 @@
1
- import { finalizeParse, parseHtmlStream } from "./parse.mjs";
2
- import { createMarkdownProcessor, processPluginsForEvent } from "./markdown-processor.mjs";
3
- async function* streamHtmlToMarkdown(htmlStream, options = {}, resolvedPlugins = [], tagOverrideHandlers) {
4
- if (!htmlStream) throw new Error("Invalid HTML stream provided");
5
- const decoder = new TextDecoder();
6
- const reader = htmlStream.getReader();
7
- const processor = createMarkdownProcessor(options, resolvedPlugins, tagOverrideHandlers);
8
- const parseState = {
9
- depthMap: processor.state.depthMap,
10
- depth: 0,
11
- resolvedPlugins,
12
- tagOverrideHandlers,
13
- plainText: options.format === "text" || options.format === "html"
14
- };
15
- const handleEvent = resolvedPlugins.length ? (event) => processPluginsForEvent(event, resolvedPlugins, processor.state, processor.processEvent) : processor.processEvent;
16
- let remainingHtml = "";
17
- try {
18
- while (true) {
19
- const { done, value } = await reader.read();
20
- if (done) break;
21
- const decoded = typeof value === "string" ? decoder.decode() + value : decoder.decode(value, { stream: true });
22
- const htmlContent = `${remainingHtml}${decoded}`;
23
- remainingHtml = parseHtmlStream(htmlContent, parseState, handleEvent);
24
- const chunk = processor.getMarkdownChunk();
25
- if (chunk) yield chunk;
26
- }
27
- const decoderTail = decoder.decode();
28
- const finalHtml = remainingHtml + decoderTail;
29
- const leftover = finalHtml ? parseHtmlStream(finalHtml, parseState, handleEvent) : "";
30
- finalizeParse(leftover, parseState, handleEvent);
31
- const finalChunk = processor.getMarkdownChunk();
32
- if (finalChunk) yield finalChunk;
33
- } finally {
34
- reader.releaseLock();
35
- }
36
- }
37
- export { streamHtmlToMarkdown };
@@ -1,473 +0,0 @@
1
- export declare const TAG_H1 = 7;
2
- export declare const TAG_H2 = 8;
3
- export declare const TAG_H3 = 9;
4
- export declare const TAG_H4 = 10;
5
- export declare const TAG_H5 = 11;
6
- export declare const TAG_H6 = 12;
7
- export declare const ELEMENT_NODE = 1;
8
- export declare const TEXT_NODE = 2;
9
- declare const NodeEventEnter$1 = 0;
10
- declare const NodeEventExit$1 = 1;
11
- /**
12
- * Imperative hook-based transform plugins. **JavaScript engine only.**
13
- * When transforms are provided, the JS engine is used regardless of engine selection.
14
- * For declarative config that works with both engines, use `BuiltinPlugins`.
15
- */
16
- export interface TransformPlugin {
17
- /**
18
- * Whether a flattened element starts an output-excluded subtree.
19
- * @internal
20
- */
21
- excludesOverflowSubtree?: (node: ElementNode) => boolean;
22
- /**
23
- * Process a node before it's handled by the parser
24
- */
25
- beforeNodeProcess?: (event: NodeEvent, state: MdreamRuntimeState) => undefined | void | {
26
- skip: boolean;
27
- };
28
- /**
29
- * Hook that runs when entering a node
30
- * @returns String to add to the output, or PluginHookResult with content
31
- */
32
- onNodeEnter?: (node: ElementNode, state: MdreamRuntimeState) => string | undefined | void;
33
- /**
34
- * Hook that runs when exiting a node
35
- */
36
- onNodeExit?: (node: ElementNode, state: MdreamRuntimeState) => string | undefined | void;
37
- /**
38
- * Process attributes for a node
39
- */
40
- processAttributes?: (node: ElementNode, state: MdreamRuntimeState) => void;
41
- /**
42
- * Process a text node before it's added to the output
43
- * @returns Result with content and skip flag, or undefined for no transformation
44
- */
45
- processTextNode?: (node: TextNode, state: MdreamRuntimeState) => {
46
- content: string;
47
- skip: boolean;
48
- } | undefined;
49
- }
50
- /**
51
- * Declarative tag override configuration.
52
- * When a string value is provided, it acts as an alias (e.g. `{ "x-heading": "h2" }`).
53
- */
54
- export interface TagOverride {
55
- enter?: string;
56
- exit?: string;
57
- spacing?: [number, number];
58
- isInline?: boolean;
59
- isSelfClosing?: boolean;
60
- collapsesInnerWhiteSpace?: boolean;
61
- }
62
- /**
63
- * Frontmatter configuration options.
64
- */
65
- export interface FrontmatterConfig {
66
- additionalFields?: Record<string, string>;
67
- metaFields?: string[];
68
- /**
69
- * Callback to receive structured frontmatter data.
70
- * Called after conversion with the extracted key-value pairs.
71
- */
72
- onExtract?: (frontmatter: Record<string, string>) => void;
73
- }
74
- /**
75
- * Declarative configuration for built-in plugins.
76
- * Works with both the JavaScript and Rust engines.
77
- */
78
- export interface BuiltinPlugins {
79
- /**
80
- * Filter elements by CSS selectors, tag names, or TAG_* constants. With
81
- * `withMinimalPreset()`, a filter adds to the preset's excludes; `false`
82
- * turns filtering off.
83
- */
84
- filter?: false | {
85
- include?: (string | number)[];
86
- exclude?: (string | number)[];
87
- processChildren?: boolean;
88
- };
89
- /**
90
- * Extract frontmatter from HTML head.
91
- * - `true`: enable with defaults
92
- * - `(fm) => void`: enable and receive structured data via callback
93
- * - `FrontmatterConfig`: enable with config options and optional callback
94
- */
95
- frontmatter?: boolean | ((frontmatter: Record<string, string>) => void) | FrontmatterConfig;
96
- /** Isolate main content area */
97
- isolateMain?: boolean;
98
- /** Convert Tailwind utility classes to markdown formatting */
99
- tailwind?: boolean;
100
- /**
101
- * Extract elements matching CSS selectors during conversion.
102
- * Each key is a CSS selector; the handler is called for every match.
103
- */
104
- extraction?: Record<string, (element: ExtractedElement) => void>;
105
- /**
106
- * Declarative tag overrides for customizing tag behavior.
107
- * String values act as aliases (e.g. `{ "x-heading": "h2" }` makes `<x-heading>` behave like `<h2>`).
108
- * Object values override specific handler properties.
109
- */
110
- tagOverrides?: Record<string, TagOverride | string>;
111
- }
112
- /**
113
- * Shared engine options that work with both JS and Rust engines.
114
- * This is the contract that `MarkdownEngine` methods accept.
115
- */
116
- export interface CleanOptions {
117
- /** Strip tracking query parameters (utm_*, fbclid, gclid, etc.) from URLs */
118
- urls?: boolean;
119
- /** Strip fragment-only links that don't match any heading in the output */
120
- fragments?: boolean;
121
- /** Strip links with meaningless hrefs (#, javascript:void(0)) → plain text */
122
- emptyLinks?: boolean;
123
- /** Collapse 3+ consecutive blank lines to 2 */
124
- blankLines?: boolean;
125
- /** Strip links where text equals URL: [https://x.com](https://x.com) → https://x.com */
126
- redundantLinks?: boolean;
127
- /** Strip self-referencing heading anchors: ## [Title](#title) → ## Title */
128
- selfLinkHeadings?: boolean;
129
- /** Strip images with no alt text (decorative/tracking pixels) */
130
- emptyImages?: boolean;
131
- /** Drop links that produce no visible text: [](url) → nothing */
132
- emptyLinkText?: boolean;
133
- }
134
- export interface EngineOptions {
135
- /**
136
- * Origin URL for resolving relative image paths and internal links.
137
- */
138
- origin?: string;
139
- /**
140
- * Declarative built-in plugin config. Works with both JS and Rust engines.
141
- */
142
- plugins?: BuiltinPlugins;
143
- /**
144
- * Clean up the markdown output. Pass `true` for all cleanup or an object
145
- * to enable specific features. Operates as a post-processing step on the
146
- * final markdown (sync API only for `fragments`).
147
- */
148
- clean?: boolean | CleanOptions;
149
- /**
150
- * Hard-wrap prose at this many characters, breaking on word boundaries.
151
- * Applied inline during conversion (zero-cost when unset). Code blocks
152
- * (`<pre>`/`<code>`), tables, and headings are never wrapped. `0` disables
153
- * wrapping.
154
- */
155
- wrapWidth?: number;
156
- /**
157
- * Output format. Defaults to `markdown`; use `text` for readable plain text,
158
- * or `html` for allowlisted semantic HTML.
159
- */
160
- format?: 'markdown' | 'text' | 'html';
161
- }
162
- export interface ElementNode extends Node {
163
- /** Element tag name (for ELEMENT_NODE) */
164
- name: string;
165
- /** HTML attributes (for ELEMENT_NODE) */
166
- attributes: Record<string, string>;
167
- /** Custom data added by plugins */
168
- context?: PluginContext;
169
- /** ID of the tag for fast handler lookup */
170
- tagId?: number;
171
- /** Map of tag names to their nesting count */
172
- depthMap: Uint16Array;
173
- /** Plugin outputs collected during processing */
174
- pluginOutput?: string[];
175
- }
176
- export interface TextNode extends Node {
177
- /** Text content (for TEXT_NODE) */
178
- value: string;
179
- /** Markdown delimiters generated by a plugin around this literal text. */
180
- generatedMarkdown?: {
181
- prefix: string;
182
- suffix: string;
183
- };
184
- /** Custom data added by plugins */
185
- context?: PluginContext;
186
- }
187
- /**
188
- * Base DOM node interface
189
- * Optimized for streaming HTML parsing with minimal memory footprint
190
- */
191
- export interface Node {
192
- /** Node type (ELEMENT_NODE or TEXT_NODE) */
193
- type: number;
194
- /** Current nesting depth in the DOM tree */
195
- depth: number;
196
- /** Node exclusion and filtering now handled by plugins */
197
- /** Index of this node within its parent's children */
198
- index: number;
199
- /** Current walk index for child traversal during streaming */
200
- currentWalkIndex?: number;
201
- /** Child-content counter used by whitespace and empty-link handling */
202
- childTextNodeIndex?: number;
203
- /** Whether node contains whitespace - used for whitespace optimization */
204
- containsWhitespace?: boolean;
205
- /** Whether this node belongs to an inert subtree and should not render */
206
- excludedFromMarkdown?: boolean;
207
- /** Cached reference to tag handler for performance */
208
- tagHandler?: TagHandler;
209
- /** Parent node */
210
- parent?: ElementNode | null;
211
- /** Custom data added by plugins */
212
- context?: PluginContext;
213
- }
214
- /**
215
- * State interface for HTML parsing and processing
216
- * Contains parsing state that's maintained during HTML traversal
217
- */
218
- interface MdreamProcessingState {
219
- /** Map of tag names to their current nesting depth - uses TypedArray for performance */
220
- depthMap: Uint16Array;
221
- /** Current overall nesting depth */
222
- depth: number;
223
- /** Currently processing element node */
224
- currentNode?: ElementNode | null;
225
- /** Node filtering and exclusion is now handled by plugins */
226
- /** Whether current content contains HTML entities that need decoding */
227
- hasEncodedHtmlEntity?: boolean;
228
- /** Whether the last processed character was whitespace - for collapsing whitespace */
229
- lastCharWasWhitespace?: boolean;
230
- /** Whether the last processed buffer has whitespace - optimization flag */
231
- textBufferContainsWhitespace?: boolean;
232
- /** Whether the last processed buffer contains non-whitespace characters */
233
- textBufferContainsNonWhitespace?: boolean;
234
- /** Whether a tag was just closed - affects whitespace handling */
235
- justClosedTag?: boolean;
236
- /** Whether the next text node is the first in its element - for whitespace trimming */
237
- isFirstTextInElement?: boolean;
238
- /** Reference to the last processed text node - for context tracking */
239
- lastTextNode?: Node;
240
- /** @deprecated No longer read or written. Retained for source compatibility. */
241
- inSingleQuote?: boolean;
242
- /** @deprecated No longer read or written. Retained for source compatibility. */
243
- inDoubleQuote?: boolean;
244
- /** @deprecated No longer read or written. Retained for source compatibility. */
245
- inBacktick?: boolean;
246
- /** @deprecated No longer read or written. Retained for source compatibility. */
247
- lastCharWasBackslash?: boolean;
248
- /** Resolved plugin instances for efficient iteration */
249
- resolvedPlugins?: TransformPlugin[];
250
- /** Configuration options for conversion */
251
- options?: EngineOptions;
252
- }
253
- /**
254
- * Runtime state for markdown generation
255
- * Extended state that includes output tracking and options
256
- */
257
- export interface MdreamRuntimeState extends Partial<MdreamProcessingState> {
258
- /** Number of newlines at end of most recent output */
259
- lastNewLines?: number;
260
- /** Configuration options for conversion */
261
- options?: EngineOptions;
262
- /** Table processing state - specialized for Markdown tables */
263
- tableRenderedTable?: boolean;
264
- tableCurrentRowCells?: number;
265
- tableColumnAlignments?: string[];
266
- /** See MarkdownState for semantics. */
267
- tableHeaderCells?: number;
268
- /** Resolved plugin instances for efficient iteration */
269
- resolvedPlugins?: TransformPlugin[];
270
- /** Content buffer for markdown output */
271
- buffer: string[];
272
- /** Performance cache for last content to avoid iteration */
273
- lastContentCache?: string;
274
- /** Reference to the last processed node */
275
- lastNode?: Node;
276
- context?: PluginContext;
277
- /**
278
- * Cumulative indent for list-item continuation. Grows by each ancestor
279
- * `<li>`'s marker width (`"- "` = 2, `"N. "` = digits(N) + 2) so continuation
280
- * content lands in the CommonMark content column. Managed by the processor.
281
- */
282
- listIndent?: string;
283
- listIndentWidths?: number[];
284
- /**
285
- * <pre> fenced-code deferral (issue #97). See MarkdownState for semantics.
286
- */
287
- preFencePending?: boolean;
288
- preFenceLang?: string;
289
- preFenceOpen?: boolean;
290
- /** Number of default blockquotes currently buffered for line prefixing. */
291
- bufferedBlockquoteDepth?: number;
292
- /** Content-column prefix deferred after a list item rule. */
293
- listRulePending?: string;
294
- /** Whether output should omit Markdown/HTML markup */
295
- plainText?: boolean;
296
- }
297
- type NodeEventEnter = 0;
298
- type NodeEventExit = 1;
299
- /**
300
- * Node event for DOM traversal
301
- * Used in the event-based traversal system for streaming processing
302
- */
303
- export interface NodeEvent {
304
- /** Event type - enter (start tag) or exit (end tag) */
305
- type: NodeEventEnter | NodeEventExit;
306
- /** The node being processed */
307
- node: Node;
308
- }
309
- /**
310
- * Handler context for markdown conversion
311
- * Passed to tag handler functions for converting specific elements
312
- */
313
- interface HandlerContext {
314
- /** Current node being processed */
315
- node: ElementNode;
316
- /** Parent node (if any) */
317
- parent?: ElementNode;
318
- /** Runtime state */
319
- state: MdreamRuntimeState;
320
- }
321
- /** Internal serializer lifecycle emitted only by built-in GFM handlers. */
322
- type GfmAction = {
323
- _tag: 'BlockquoteEnter';
324
- output?: string;
325
- } | {
326
- _tag: 'BlockquoteExit';
327
- } | {
328
- _tag: 'PreEnter';
329
- language: string;
330
- } | {
331
- _tag: 'PreExit';
332
- } | {
333
- _tag: 'CodeSpanEnter';
334
- output: string;
335
- } | {
336
- _tag: 'CodeSpanExit';
337
- } | {
338
- _tag: 'CodeFenceEnter';
339
- language: string;
340
- output: string;
341
- };
342
- type TagHandlerResult = string | GfmAction | undefined | void;
343
- /**
344
- * Tag handler interface for HTML elements
345
- * Used by plugins to extend or customize tag handling
346
- */
347
- export interface TagHandler {
348
- enter?: (context: HandlerContext) => TagHandlerResult;
349
- exit?: (context: HandlerContext) => TagHandlerResult;
350
- isSelfClosing?: boolean;
351
- isNonNesting?: boolean;
352
- collapsesInnerWhiteSpace?: boolean;
353
- isInline?: boolean;
354
- spacing?: readonly [number, number];
355
- excludesTextNodes?: boolean;
356
- /**
357
- * When true, the `enter` string is emitted verbatim without synthesizing a
358
- * separating space before it. Set for user-supplied tagOverride enter
359
- * strings so markers like `^`/`~` attach to adjacent content (issue #93).
360
- */
361
- literalEnter?: boolean;
362
- /** When true, the `exit` string is a user-supplied tagOverride, exempt from empty-pair cleanup. */
363
- literalExit?: boolean;
364
- /**
365
- * Built-in tag id used by declarative string aliases.
366
- * @internal
367
- */
368
- aliasTagId?: number;
369
- }
370
- interface TailwindContext {
371
- hidden?: boolean;
372
- prefix?: string;
373
- suffix?: string;
374
- }
375
- export interface PluginContext {
376
- score?: number;
377
- tagCount?: number;
378
- linkTextLength?: number;
379
- textLength?: number;
380
- isHighLinkDensity?: boolean;
381
- tailwind?: TailwindContext;
382
- [key: string]: unknown;
383
- }
384
- /**
385
- * Element extracted during conversion by the extraction plugin.
386
- */
387
- export interface ExtractedElement {
388
- /** The CSS selector that matched this element */
389
- selector: string;
390
- /** The HTML tag name */
391
- tagName: string;
392
- /** Accumulated text content of the element */
393
- textContent: string;
394
- /** HTML attributes of the element */
395
- attributes: Record<string, string>;
396
- }
397
- /**
398
- * Top-level options for the mdream JS engine.
399
- * Extends the shared `EngineOptions` with JS-specific concerns.
400
- */
401
- export interface MdreamOptions extends EngineOptions {
402
- /**
403
- * Imperative hook-based transform plugins.
404
- * When provided, a new JS engine is created with these hooks.
405
- */
406
- hooks?: TransformPlugin[];
407
- }
408
- /**
409
- * Markdown chunk with content and metadata
410
- * Compatible with LangChain Document structure
411
- */
412
- export interface MarkdownChunk {
413
- /** The markdown content of the chunk */
414
- content: string;
415
- /** Metadata extracted during chunking */
416
- metadata: {
417
- /** Header hierarchy at this chunk position */
418
- headers?: Record<string, string>;
419
- /** Code block language if chunk is/contains code */
420
- code?: string;
421
- /** Line number range in original document */
422
- loc?: {
423
- lines: {
424
- from: number;
425
- to: number;
426
- };
427
- };
428
- };
429
- }
430
- /**
431
- * Options for HTML to Markdown chunking
432
- * Extends EngineOptions with chunking-specific settings
433
- */
434
- export interface SplitterOptions extends EngineOptions {
435
- /**
436
- * Header tag IDs to split on (TAG_H1, TAG_H2, etc.)
437
- * @example [TAG_H1, TAG_H2]
438
- * @default [TAG_H2, TAG_H3, TAG_H4, TAG_H5, TAG_H6]
439
- */
440
- headersToSplitOn?: number[];
441
- /**
442
- * Return each line as individual chunk
443
- * @default false
444
- */
445
- returnEachLine?: boolean;
446
- /**
447
- * Strip headers from chunk content
448
- * @default true
449
- */
450
- stripHeaders?: boolean;
451
- /**
452
- * Maximum chunk size
453
- * @default 1000
454
- */
455
- chunkSize?: number;
456
- /**
457
- * Overlap between chunks for context preservation
458
- * @default 200
459
- */
460
- chunkOverlap?: number;
461
- /**
462
- * Function to measure chunk length (default: character count)
463
- * Can be replaced with token counter for LLM applications
464
- * @default (text) => text.length
465
- */
466
- lengthFunction?: (text: string) => number;
467
- /**
468
- * Keep separators in the split chunks
469
- * @default false
470
- */
471
- keepSeparator?: boolean;
472
- }
473
- export { NodeEventEnter$1 as NodeEventEnter, NodeEventExit$1 as NodeEventExit };
@@ -1 +0,0 @@
1
- export {}
@@ -1,32 +0,0 @@
1
- import { withMinimalPreset } from "./preset/minimal.mjs";
2
- import { streamHtmlToMarkdown } from "./index.mjs";
3
- import { readFileSync } from "node:fs";
4
- import { Readable } from "node:stream";
5
- import { fileURLToPath } from "node:url";
6
- import { cac } from "cac";
7
- import { dirname, join } from "pathe";
8
- async function streamingConvert(options = {}) {
9
- const format = options.text ? "text" : options.format;
10
- if (format && format !== "markdown" && format !== "text" && format !== "html") {
11
- process.stderr.write(`Unknown format: ${format}\n`);
12
- process.exitCode = 1;
13
- return;
14
- }
15
- let conversionOptions = {
16
- origin: options.origin,
17
- wrapWidth: options.wrapWidth ? Number(options.wrapWidth) || void 0 : void 0,
18
- format
19
- };
20
- if (options.preset === "minimal") conversionOptions = withMinimalPreset(conversionOptions);
21
- const markdownGenerator = streamHtmlToMarkdown(Readable.toWeb(process.stdin), conversionOptions);
22
- for await (const markdownChunk of markdownGenerator) if (markdownChunk && markdownChunk.length > 0) process.stdout.write(markdownChunk);
23
- }
24
- const __dirname = dirname(fileURLToPath(import.meta.url));
25
- const packageJsonPath = join(__dirname, "..", "package.json");
26
- const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
27
- const cli = cac();
28
- cli.command("[options]", "Convert HTML from stdin to Markdown on stdout (JS engine)").option("--origin <url>", "Origin URL for resolving relative image paths").option("--preset <preset>", "Conversion presets: minimal").option("--wrap-width <n>", "Hard-wrap prose at <n> characters on word boundaries").option("--format <format>", "Output format: markdown, text, html").option("--text", "Alias for --format text").action(async (_, opts) => {
29
- await streamingConvert(opts);
30
- });
31
- cli.help().version(packageJson.version).parse();
32
- export {};
@@ -1,15 +0,0 @@
1
- import { BuiltinPlugins, MdreamOptions, TransformPlugin } from "./_chunks/types.mjs";
2
- /** Imperative plugin used by the tree-shakable converter. */
3
- export type Plugin = TransformPlugin;
4
- /**
5
- * Options for the tree-shakable conversion entry. Import plugin factories
6
- * explicitly and pass their results as an array, matching the pre-v1 JS API.
7
- * Declarative built-in plugin config and cleanup live on the package root.
8
- */
9
- export type CoreOptions = Omit<MdreamOptions, 'plugins' | 'clean'> & {
10
- plugins?: Plugin[] | Pick<BuiltinPlugins, 'tagOverrides'>;
11
- };
12
- /** Convert HTML without bundling the optional declarative built-in plugins. */
13
- export declare function htmlToMarkdown(html: string, options?: CoreOptions): string;
14
- /** Stream HTML conversion without bundling declarative built-in plugins. */
15
- export declare function streamHtmlToMarkdown(htmlStream: ReadableStream<Uint8Array | string> | null, options?: CoreOptions): AsyncIterable<string>;
@@ -1,28 +0,0 @@
1
- import { buildTagOverrideHandlers } from "./_chunks/parse.mjs";
2
- import { createMarkdownProcessor } from "./_chunks/markdown-processor.mjs";
3
- import { streamHtmlToMarkdown as streamHtmlToMarkdown$1 } from "./_chunks/stream.mjs";
4
- function resolveHooks(options) {
5
- const plugins = Array.isArray(options.plugins) ? options.plugins : void 0;
6
- const hooks = options.hooks?.length ? options.hooks : void 0;
7
- if (!plugins?.length) return hooks || [];
8
- if (!hooks) return plugins;
9
- return [...plugins, ...hooks];
10
- }
11
- function resolveTagOverrides(options) {
12
- return !Array.isArray(options.plugins) ? options.plugins?.tagOverrides : void 0;
13
- }
14
- function htmlToMarkdown(html, options = {}) {
15
- const plugins = resolveHooks(options);
16
- const tagOverrides = resolveTagOverrides(options);
17
- const tagOverrideHandlers = tagOverrides ? buildTagOverrideHandlers(tagOverrides) : void 0;
18
- const processor = createMarkdownProcessor(options, plugins, tagOverrideHandlers);
19
- processor.processHtml(html);
20
- return processor.getMarkdown();
21
- }
22
- function streamHtmlToMarkdown(htmlStream, options = {}) {
23
- const plugins = resolveHooks(options);
24
- const tagOverrides = resolveTagOverrides(options);
25
- const tagOverrideHandlers = tagOverrides ? buildTagOverrideHandlers(tagOverrides) : void 0;
26
- return streamHtmlToMarkdown$1(htmlStream, options, plugins, tagOverrideHandlers);
27
- }
28
- export { htmlToMarkdown, streamHtmlToMarkdown };
@@ -1,4 +0,0 @@
1
- import { BuiltinPlugins, CleanOptions, ELEMENT_NODE, ElementNode, EngineOptions, ExtractedElement, FrontmatterConfig, MarkdownChunk, MdreamOptions, Node, NodeEvent, NodeEventEnter, NodeEventExit, PluginContext, SplitterOptions, TAG_H1, TAG_H2, TAG_H3, TAG_H4, TAG_H5, TAG_H6, TEXT_NODE, TagOverride, TextNode, TransformPlugin } from "./_chunks/types.mjs";
2
- import { createPlugin, htmlToMarkdown, streamHtmlToMarkdown } from "./_chunks/index.mjs";
3
- import { withMinimalPreset } from "./_chunks/minimal.mjs";
4
- export { type BuiltinPlugins, type CleanOptions, ELEMENT_NODE, type ElementNode, type EngineOptions, type ExtractedElement, type FrontmatterConfig, type MarkdownChunk, type MdreamOptions, type Node, type NodeEvent, NodeEventEnter, NodeEventExit, type PluginContext, type SplitterOptions, TAG_H1, TAG_H2, TAG_H3, TAG_H4, TAG_H5, TAG_H6, TEXT_NODE, type TagOverride, type TextNode, type TransformPlugin, createPlugin, htmlToMarkdown, streamHtmlToMarkdown, withMinimalPreset };