nuxt-ai-ready 2.5.3 → 3.0.1

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 (287) 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/cache-key.js +4 -0
  42. package/dist/runtime/server/mcp/tools/get-page-markdown.js +3 -2
  43. package/dist/runtime/server/mcp/tools/list-pages.js +3 -2
  44. package/dist/runtime/server/mcp/tools/search-pages.js +3 -2
  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.js +47 -22
  83. package/dist/runtime/server/utils/prerender-html.d.ts +2 -1
  84. package/dist/runtime/server/utils/prerender-html.js +3 -1
  85. package/dist/runtime/types.d.ts +15 -7
  86. package/dist/shared/nuxt-ai-ready.B3hAuOLQ.mjs +29 -0
  87. package/dist/shared/{nuxt-ai-ready.CLSWou20.mjs → nuxt-ai-ready.C34F0LJo.mjs} +560 -219
  88. package/package.json +86 -20
  89. package/skills/nuxt-ai-ready/SKILL.md +26 -12
  90. package/skills/nuxt-ai-ready/references/runtime-indexing.md +7 -6
  91. package/dist/runtime/server/db/drizzle/providers/sqlite.d.ts +0 -8
  92. package/dist/runtime/server/db/drizzle/providers/sqlite.js +0 -15
  93. package/node_modules/@mdream/js/LICENSE.md +0 -9
  94. package/node_modules/@mdream/js/README.md +0 -792
  95. package/node_modules/@mdream/js/bin/mdream.mjs +0 -2
  96. package/node_modules/@mdream/js/dist/_chunks/const.mjs +0 -134
  97. package/node_modules/@mdream/js/dist/_chunks/index.d.mts +0 -9
  98. package/node_modules/@mdream/js/dist/_chunks/markdown-processor.mjs +0 -1968
  99. package/node_modules/@mdream/js/dist/_chunks/minimal.d.mts +0 -6
  100. package/node_modules/@mdream/js/dist/_chunks/parse.mjs +0 -2756
  101. package/node_modules/@mdream/js/dist/_chunks/plugins.mjs +0 -725
  102. package/node_modules/@mdream/js/dist/_chunks/resolve-plugins.mjs +0 -44
  103. package/node_modules/@mdream/js/dist/_chunks/stream.mjs +0 -37
  104. package/node_modules/@mdream/js/dist/_chunks/types.d.mts +0 -473
  105. package/node_modules/@mdream/js/dist/cli.d.mts +0 -1
  106. package/node_modules/@mdream/js/dist/cli.mjs +0 -32
  107. package/node_modules/@mdream/js/dist/core.d.mts +0 -15
  108. package/node_modules/@mdream/js/dist/core.mjs +0 -28
  109. package/node_modules/@mdream/js/dist/index.d.mts +0 -4
  110. package/node_modules/@mdream/js/dist/index.mjs +0 -58
  111. package/node_modules/@mdream/js/dist/llms-txt.d.mts +0 -86
  112. package/node_modules/@mdream/js/dist/llms-txt.mjs +0 -308
  113. package/node_modules/@mdream/js/dist/negotiate.d.mts +0 -35
  114. package/node_modules/@mdream/js/dist/negotiate.mjs +0 -121
  115. package/node_modules/@mdream/js/dist/parse.d.mts +0 -90
  116. package/node_modules/@mdream/js/dist/parse.mjs +0 -2
  117. package/node_modules/@mdream/js/dist/plugins.d.mts +0 -85
  118. package/node_modules/@mdream/js/dist/plugins.mjs +0 -2
  119. package/node_modules/@mdream/js/dist/preset/minimal.d.mts +0 -2
  120. package/node_modules/@mdream/js/dist/preset/minimal.mjs +0 -33
  121. package/node_modules/@mdream/js/dist/splitter.d.mts +0 -18
  122. package/node_modules/@mdream/js/dist/splitter.mjs +0 -194
  123. package/node_modules/@mdream/js/package.json +0 -103
  124. package/node_modules/cac/LICENSE +0 -21
  125. package/node_modules/cac/README.md +0 -492
  126. package/node_modules/cac/dist/index.d.ts +0 -196
  127. package/node_modules/cac/dist/index.js +0 -638
  128. package/node_modules/cac/package.json +0 -72
  129. package/node_modules/mdream/LICENSE.md +0 -9
  130. package/node_modules/mdream/README.md +0 -1091
  131. package/node_modules/mdream/bin/mdream.mjs +0 -46
  132. package/node_modules/mdream/dist/browser.d.mts +0 -105
  133. package/node_modules/mdream/dist/browser.mjs +0 -262
  134. package/node_modules/mdream/dist/edge.d.mts +0 -100
  135. package/node_modules/mdream/dist/edge.mjs +0 -250
  136. package/node_modules/mdream/dist/iife.js +0 -605
  137. package/node_modules/mdream/dist/index.d.mts +0 -89
  138. package/node_modules/mdream/dist/index.mjs +0 -184
  139. package/node_modules/mdream/dist/wasm.d.mts +0 -100
  140. package/node_modules/mdream/dist/wasm.mjs +0 -140
  141. package/node_modules/mdream/dist/worker.d.mts +0 -101
  142. package/node_modules/mdream/dist/worker.mjs +0 -217
  143. package/node_modules/mdream/napi/index.d.mts +0 -127
  144. package/node_modules/mdream/napi/index.d.ts +0 -127
  145. package/node_modules/mdream/napi/index.mjs +0 -725
  146. package/node_modules/mdream/napi/rust.android-arm-eabi.node +0 -0
  147. package/node_modules/mdream/napi/rust.android-arm64.node +0 -0
  148. package/node_modules/mdream/napi/rust.darwin-arm64.node +0 -0
  149. package/node_modules/mdream/napi/rust.darwin-x64.node +0 -0
  150. package/node_modules/mdream/napi/rust.freebsd-x64.node +0 -0
  151. package/node_modules/mdream/napi/rust.linux-arm-gnueabihf.node +0 -0
  152. package/node_modules/mdream/napi/rust.linux-arm64-gnu.node +0 -0
  153. package/node_modules/mdream/napi/rust.linux-arm64-musl.node +0 -0
  154. package/node_modules/mdream/napi/rust.linux-x64-gnu.node +0 -0
  155. package/node_modules/mdream/napi/rust.linux-x64-musl.node +0 -0
  156. package/node_modules/mdream/napi/rust.wasi.cjs +0 -2144
  157. package/node_modules/mdream/napi/rust.wasm32-wasi.wasm +0 -0
  158. package/node_modules/mdream/napi/rust.win32-arm64-msvc.node +0 -0
  159. package/node_modules/mdream/napi/rust.win32-x64-msvc.node +0 -0
  160. package/node_modules/mdream/node_modules/@emnapi/core/LICENSE +0 -21
  161. package/node_modules/mdream/node_modules/@emnapi/core/README.md +0 -1
  162. package/node_modules/mdream/node_modules/@emnapi/core/dist/emnapi-core.d.ts +0 -392
  163. package/node_modules/mdream/node_modules/@emnapi/core/dist/emnapi-core.full.d.ts +0 -392
  164. package/node_modules/mdream/node_modules/@emnapi/core/dist/emnapi-core.full.js +0 -8351
  165. package/node_modules/mdream/node_modules/@emnapi/core/dist/emnapi-core.js +0 -7268
  166. package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/async-work.d.ts +0 -5
  167. package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/async-work.js +0 -843
  168. package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/index.d.ts +0 -4
  169. package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/index.js +0 -3
  170. package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/threadsafe-function.d.ts +0 -5
  171. package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/threadsafe-function.js +0 -1010
  172. package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/v8.d.ts +0 -5
  173. package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/v8.js +0 -1446
  174. package/node_modules/mdream/node_modules/@emnapi/core/node_modules/@emnapi/wasi-threads/LICENSE +0 -21
  175. package/node_modules/mdream/node_modules/@emnapi/core/node_modules/@emnapi/wasi-threads/README.md +0 -203
  176. package/node_modules/mdream/node_modules/@emnapi/core/node_modules/@emnapi/wasi-threads/dist/wasi-threads.d.ts +0 -236
  177. package/node_modules/mdream/node_modules/@emnapi/core/node_modules/@emnapi/wasi-threads/dist/wasi-threads.js +0 -1086
  178. package/node_modules/mdream/node_modules/@emnapi/core/node_modules/@emnapi/wasi-threads/package.json +0 -35
  179. package/node_modules/mdream/node_modules/@emnapi/core/node_modules/@emnapi/wasi-threads/rollup.config.js +0 -6
  180. package/node_modules/mdream/node_modules/@emnapi/core/package.json +0 -39
  181. package/node_modules/mdream/node_modules/@emnapi/core/rollup.config.js +0 -60
  182. package/node_modules/mdream/node_modules/@emnapi/runtime/LICENSE +0 -21
  183. package/node_modules/mdream/node_modules/@emnapi/runtime/README.md +0 -1
  184. package/node_modules/mdream/node_modules/@emnapi/runtime/dist/emnapi.d.ts +0 -833
  185. package/node_modules/mdream/node_modules/@emnapi/runtime/dist/emnapi.js +0 -2306
  186. package/node_modules/mdream/node_modules/@emnapi/runtime/dist/emnapi.js.map +0 -1
  187. package/node_modules/mdream/node_modules/@emnapi/runtime/index.cjs +0 -63
  188. package/node_modules/mdream/node_modules/@emnapi/runtime/package.json +0 -39
  189. package/node_modules/mdream/node_modules/@emnapi/runtime/rollup.config.js +0 -25
  190. package/node_modules/mdream/node_modules/@emnapi/wasi-threads/LICENSE +0 -21
  191. package/node_modules/mdream/node_modules/@emnapi/wasi-threads/README.md +0 -203
  192. package/node_modules/mdream/node_modules/@emnapi/wasi-threads/dist/wasi-threads.d.ts +0 -240
  193. package/node_modules/mdream/node_modules/@emnapi/wasi-threads/dist/wasi-threads.js +0 -1118
  194. package/node_modules/mdream/node_modules/@emnapi/wasi-threads/package.json +0 -35
  195. package/node_modules/mdream/node_modules/@emnapi/wasi-threads/rollup.config.js +0 -6
  196. package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/dist/emnapi-plugins.cjs +0 -1472
  197. package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/dist/emnapi-plugins.js +0 -1470
  198. package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/dist/fs-proxy.cjs +0 -237
  199. package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/dist/fs.js +0 -17578
  200. package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/fs-proxy.js +0 -317
  201. package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/package.json +0 -67
  202. package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/runtime.cjs +0 -39
  203. package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/runtime.js +0 -36
  204. package/node_modules/mdream/node_modules/@tybys/wasm-util/LICENSE +0 -21
  205. package/node_modules/mdream/node_modules/@tybys/wasm-util/README.md +0 -193
  206. package/node_modules/mdream/node_modules/@tybys/wasm-util/dist/tsdoc-metadata.json +0 -11
  207. package/node_modules/mdream/node_modules/@tybys/wasm-util/dist/wasm-util.d.ts +0 -423
  208. package/node_modules/mdream/node_modules/@tybys/wasm-util/dist/wasm-util.esm-bundler.js +0 -2932
  209. package/node_modules/mdream/node_modules/@tybys/wasm-util/dist/wasm-util.esm.js +0 -2932
  210. package/node_modules/mdream/node_modules/@tybys/wasm-util/dist/wasm-util.esm.min.js +0 -1
  211. package/node_modules/mdream/node_modules/@tybys/wasm-util/dist/wasm-util.js +0 -2954
  212. package/node_modules/mdream/node_modules/@tybys/wasm-util/dist/wasm-util.min.js +0 -1
  213. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/asyncify.js +0 -158
  214. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/index.js +0 -13
  215. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/jspi.js +0 -46
  216. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/load.js +0 -97
  217. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/memory.js +0 -35
  218. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/error.js +0 -103
  219. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/fd.js +0 -268
  220. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/fs.js +0 -3
  221. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/index.js +0 -192
  222. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/path.js +0 -316
  223. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/preview1.js +0 -1599
  224. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/rights.js +0 -141
  225. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/types.js +0 -220
  226. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/util.js +0 -128
  227. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/webassembly.js +0 -13
  228. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/asyncify.mjs +0 -153
  229. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/index.mjs +0 -9
  230. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/jspi.mjs +0 -39
  231. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/load.mjs +0 -89
  232. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/memory.mjs +0 -28
  233. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/error.mjs +0 -97
  234. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/fd.mjs +0 -256
  235. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/fs.mjs +0 -1
  236. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/index.mjs +0 -186
  237. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/path.mjs +0 -310
  238. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/preview1.mjs +0 -1593
  239. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/rights.mjs +0 -135
  240. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/types.mjs +0 -216
  241. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/util.mjs +0 -113
  242. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/webassembly.mjs +0 -9
  243. package/node_modules/mdream/node_modules/@tybys/wasm-util/package.json +0 -58
  244. package/node_modules/mdream/node_modules/tslib/CopyrightNotice.txt +0 -15
  245. package/node_modules/mdream/node_modules/tslib/LICENSE.txt +0 -12
  246. package/node_modules/mdream/node_modules/tslib/README.md +0 -164
  247. package/node_modules/mdream/node_modules/tslib/SECURITY.md +0 -41
  248. package/node_modules/mdream/node_modules/tslib/modules/index.d.ts +0 -38
  249. package/node_modules/mdream/node_modules/tslib/modules/index.js +0 -70
  250. package/node_modules/mdream/node_modules/tslib/modules/package.json +0 -3
  251. package/node_modules/mdream/node_modules/tslib/package.json +0 -47
  252. package/node_modules/mdream/node_modules/tslib/tslib.d.ts +0 -460
  253. package/node_modules/mdream/node_modules/tslib/tslib.es6.html +0 -1
  254. package/node_modules/mdream/node_modules/tslib/tslib.es6.js +0 -402
  255. package/node_modules/mdream/node_modules/tslib/tslib.es6.mjs +0 -401
  256. package/node_modules/mdream/node_modules/tslib/tslib.html +0 -1
  257. package/node_modules/mdream/node_modules/tslib/tslib.js +0 -484
  258. package/node_modules/mdream/package.json +0 -110
  259. package/node_modules/mdream/skills/mdream/SKILL.md +0 -124
  260. package/node_modules/mdream/skills/mdream/references/runtimes.md +0 -49
  261. package/node_modules/mdream/wasm/mdream_edge.d.ts +0 -90
  262. package/node_modules/mdream/wasm/mdream_edge.js +0 -517
  263. package/node_modules/mdream/wasm/mdream_edge_bg.wasm +0 -0
  264. package/node_modules/mdream/wasm/mdream_edge_bg.wasm.d.ts +0 -20
  265. package/node_modules/mdream/wasm/package.json +0 -17
  266. package/node_modules/mdream/wasm-bundler/mdream_edge.d.ts +0 -45
  267. package/node_modules/mdream/wasm-bundler/mdream_edge.js +0 -13
  268. package/node_modules/mdream/wasm-bundler/mdream_edge_bg.js +0 -413
  269. package/node_modules/mdream/wasm-bundler/mdream_edge_bg.wasm +0 -0
  270. package/node_modules/mdream/wasm-bundler/mdream_edge_bg.wasm.d.ts +0 -20
  271. package/node_modules/mdream/wasm-bundler/package.json +0 -19
  272. package/node_modules/pathe/LICENSE +0 -70
  273. package/node_modules/pathe/README.md +0 -73
  274. package/node_modules/pathe/dist/index.cjs +0 -39
  275. package/node_modules/pathe/dist/index.d.cts +0 -47
  276. package/node_modules/pathe/dist/index.d.mts +0 -47
  277. package/node_modules/pathe/dist/index.d.ts +0 -47
  278. package/node_modules/pathe/dist/index.mjs +0 -19
  279. package/node_modules/pathe/dist/shared/pathe.BSlhyZSM.cjs +0 -266
  280. package/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs +0 -249
  281. package/node_modules/pathe/dist/utils.cjs +0 -82
  282. package/node_modules/pathe/dist/utils.d.cts +0 -32
  283. package/node_modules/pathe/dist/utils.d.mts +0 -32
  284. package/node_modules/pathe/dist/utils.d.ts +0 -32
  285. package/node_modules/pathe/dist/utils.mjs +0 -77
  286. package/node_modules/pathe/package.json +0 -61
  287. package/node_modules/pathe/utils.d.ts +0 -1
@@ -1,89 +0,0 @@
1
- export interface CleanOptions {
2
- /** Strip tracking query parameters (utm_*, fbclid, gclid, etc.) from URLs */
3
- urls?: boolean;
4
- /** Strip fragment-only links that don't match any heading in the output */
5
- fragments?: boolean;
6
- /** Strip links with meaningless hrefs (#, javascript:void(0)) → plain text */
7
- emptyLinks?: boolean;
8
- /** Collapse 3+ consecutive blank lines to 2 */
9
- blankLines?: boolean;
10
- /** Strip links where text equals URL: [https://x.com](https://x.com) → https://x.com */
11
- redundantLinks?: boolean;
12
- /** Strip self-referencing heading anchors: ## [Title](#title) → ## Title */
13
- selfLinkHeadings?: boolean;
14
- /** Strip images with no alt text (decorative/tracking pixels) */
15
- emptyImages?: boolean;
16
- /** Drop links that produce no visible text: [](url) → nothing */
17
- emptyLinkText?: boolean;
18
- }
19
- export interface ExtractedElement {
20
- selector: string;
21
- tagName: string;
22
- textContent: string;
23
- attributes: Record<string, string>;
24
- }
25
- export interface FrontmatterConfig {
26
- additionalFields?: Record<string, string>;
27
- metaFields?: string[];
28
- /** Callback to receive structured frontmatter data after conversion */
29
- onExtract?: (frontmatter: Record<string, string>) => void;
30
- }
31
- export interface TagOverride {
32
- enter?: string;
33
- exit?: string;
34
- spacing?: number[];
35
- isInline?: boolean;
36
- isSelfClosing?: boolean;
37
- collapsesInnerWhiteSpace?: boolean;
38
- alias?: string;
39
- }
40
- export interface MdreamOptions {
41
- /** Origin URL for resolving relative image paths and internal links. */
42
- origin?: string;
43
- /**
44
- * Clean up the markdown output. Pass `true` for all cleanup or an object
45
- * to enable specific features. Both `htmlToMarkdown` and
46
- * `streamHtmlToMarkdown` apply it.
47
- */
48
- clean?: boolean | CleanOptions;
49
- /** Enable minimal preset (frontmatter, isolateMain, tailwind, filter). Default: false */
50
- minimal?: boolean;
51
- /**
52
- * Extract frontmatter from HTML head.
53
- * - `true`: enable with defaults
54
- * - `(fm) => void`: enable and receive structured data via callback
55
- * - `FrontmatterConfig`: enable with config options and optional callback
56
- */
57
- frontmatter?: boolean | ((frontmatter: Record<string, string>) => void) | FrontmatterConfig;
58
- /** Isolate main content area. Default when minimal: true */
59
- isolateMain?: boolean;
60
- /** Convert Tailwind utility classes. Default when minimal: true */
61
- tailwind?: boolean;
62
- /**
63
- * Filter elements by CSS selector. `minimal` excludes form, nav, footer, and
64
- * similar; a filter passed with `minimal` adds to those excludes. `false`
65
- * turns filtering off, including the `minimal` one.
66
- */
67
- filter?: false | {
68
- include?: string[];
69
- exclude?: string[];
70
- processChildren?: boolean;
71
- };
72
- /** Extract elements matching CSS selectors */
73
- extraction?: Record<string, (element: ExtractedElement) => void>;
74
- /** Tag overrides. String values act as aliases */
75
- tagOverrides?: Record<string, TagOverride | string>;
76
- /**
77
- * Hard-wrap prose at this many characters, breaking on word boundaries.
78
- * Applied inline during conversion (zero-cost when unset). Code blocks,
79
- * tables, and headings are never wrapped. `0` disables wrapping.
80
- */
81
- wrapWidth?: number;
82
- /**
83
- * Output format. Defaults to `markdown`; use `text` for readable plain text,
84
- * or `html` for allowlisted semantic HTML.
85
- */
86
- format?: 'markdown' | 'text' | 'html';
87
- }
88
- export declare function htmlToMarkdown(html: string, options?: Partial<MdreamOptions>): string;
89
- export declare function streamHtmlToMarkdown(htmlStream: ReadableStream<Uint8Array | string> | null, options?: Partial<MdreamOptions>): AsyncIterable<string>;
@@ -1,184 +0,0 @@
1
- import { MarkdownStream, htmlToMarkdown as htmlToMarkdown$1 } from "../napi/index.mjs";
2
- const MINIMAL_FILTER_EXCLUDE = [
3
- "form",
4
- "fieldset",
5
- "object",
6
- "embed",
7
- "footer",
8
- "aside",
9
- "iframe",
10
- "input",
11
- "textarea",
12
- "select",
13
- "button",
14
- "nav"
15
- ];
16
- const CLEAN_ALL = {
17
- urls: true,
18
- fragments: true,
19
- emptyLinks: true,
20
- redundantLinks: true,
21
- selfLinkHeadings: true,
22
- emptyImages: true,
23
- emptyLinkText: true
24
- };
25
- function resolveCleanConfig(options, minimal) {
26
- const cleanUrls = options.cleanUrls === true;
27
- let cleanOpt = options.clean;
28
- if (cleanOpt === void 0) {
29
- if (!minimal) return { cleanUrls };
30
- cleanOpt = true;
31
- }
32
- if (!cleanOpt) return { cleanUrls };
33
- const resolved = cleanOpt === true ? CLEAN_ALL : cleanOpt;
34
- return {
35
- cleanUrls: cleanUrls || resolved.urls === true,
36
- clean: resolved
37
- };
38
- }
39
- function resolveFrontmatter(opt) {
40
- if (typeof opt === "function") return {
41
- config: {},
42
- callback: opt
43
- };
44
- if (opt && typeof opt === "object") {
45
- const { onExtract, ...config } = opt;
46
- return {
47
- config,
48
- callback: onExtract
49
- };
50
- }
51
- return { config: {} };
52
- }
53
- function resolveOptions(options) {
54
- if (Array.isArray(options.plugins)) throw new TypeError("Custom hook plugins require @mdream/js. Pass declarative config (e.g. { frontmatter: true }) to the Rust engine, or import { htmlToMarkdown } from '@mdream/js' for hook-based plugins. See https://mdream.dev/v1-migration#custom-plugins");
55
- const minimal = options.minimal === true;
56
- const plugins = options.plugins ? { ...options.plugins } : {};
57
- let frontmatterCallback;
58
- const frontmatterDisabled = options.frontmatter === false;
59
- if (minimal ? !frontmatterDisabled : !!options.frontmatter) {
60
- const fm = resolveFrontmatter(options.frontmatter);
61
- plugins.frontmatter = fm.config;
62
- frontmatterCallback = fm.callback;
63
- } else if (frontmatterDisabled) delete plugins.frontmatter;
64
- const isolateMainDisabled = options.isolateMain === false;
65
- if (minimal ? !isolateMainDisabled : options.isolateMain) plugins.isolateMain = true;
66
- else if (isolateMainDisabled) delete plugins.isolateMain;
67
- const tailwindDisabled = options.tailwind === false;
68
- if (minimal ? !tailwindDisabled : options.tailwind) plugins.tailwind = true;
69
- else if (tailwindDisabled) delete plugins.tailwind;
70
- if (options.filter === false) delete plugins.filter;
71
- else if (minimal) plugins.filter = {
72
- ...options.filter,
73
- exclude: [...MINIMAL_FILTER_EXCLUDE, ...options.filter?.exclude ?? []]
74
- };
75
- else if (options.filter) plugins.filter = options.filter;
76
- const extraction = options.extraction;
77
- let extractionHandlers;
78
- if (extraction) {
79
- plugins.extraction = { selectors: Object.keys(extraction) };
80
- extractionHandlers = extraction;
81
- }
82
- const tagOverrides = options.tagOverrides;
83
- if (tagOverrides) {
84
- const overrides = {};
85
- for (const tag in tagOverrides) {
86
- const value = tagOverrides[tag];
87
- if (value) overrides[tag] = typeof value === "string" ? { alias: value } : value;
88
- }
89
- plugins.tagOverrides = overrides;
90
- }
91
- const { cleanUrls, clean } = resolveCleanConfig(options, minimal);
92
- return {
93
- napiOpts: {
94
- origin: options.origin,
95
- cleanUrls,
96
- clean,
97
- plugins,
98
- wrapWidth: options.wrapWidth,
99
- format: options.format
100
- },
101
- extractionHandlers,
102
- frontmatterCallback
103
- };
104
- }
105
- function deliverPluginData(data, { frontmatterCallback, extractionHandlers }) {
106
- if (data.frontmatter && frontmatterCallback) frontmatterCallback(data.frontmatter);
107
- if (data.extracted?.length && extractionHandlers) for (const element of data.extracted) extractionHandlers[element.selector]?.(element);
108
- }
109
- function hasCallbacks({ frontmatterCallback, extractionHandlers }) {
110
- return !!frontmatterCallback || !!extractionHandlers;
111
- }
112
- function convertResult(convert, html, options = {}) {
113
- const resolved = resolveOptions(options);
114
- const result = convert(html, resolved.napiOpts);
115
- deliverPluginData(result, resolved);
116
- return result;
117
- }
118
- async function* pumpStream(stream, htmlStream, callbacks, { decodeInJs = false, mapError = (error) => error } = {}) {
119
- const reader = htmlStream.getReader();
120
- const decoder = decodeInJs ? new TextDecoder() : void 0;
121
- try {
122
- while (true) {
123
- const { done, value } = await reader.read();
124
- if (done) break;
125
- let processed;
126
- if (typeof value === "string") processed = stream.processChunk(decoder ? decoder.decode() + value : value);
127
- else processed = decoder ? stream.processChunk(decoder.decode(value, { stream: true })) : stream.processChunkBytes(value);
128
- if (processed) yield processed;
129
- }
130
- const decoderTail = decoder?.decode();
131
- if (decoderTail) {
132
- const processed = stream.processChunk(decoderTail);
133
- if (processed) yield processed;
134
- }
135
- const final_ = stream.finish();
136
- if (hasCallbacks(callbacks)) deliverPluginData(stream.takeData(), callbacks);
137
- if (final_) yield final_;
138
- } catch (error) {
139
- throw mapError(error);
140
- } finally {
141
- reader.releaseLock();
142
- }
143
- }
144
- function createSurrogateCarry() {
145
- let held = "";
146
- return {
147
- take(chunk) {
148
- if (held) {
149
- chunk = held + chunk;
150
- held = "";
151
- }
152
- const last = chunk.charCodeAt(chunk.length - 1);
153
- if (last >= 55296 && last <= 56319) {
154
- held = chunk.slice(-1);
155
- return chunk.slice(0, -1);
156
- }
157
- return chunk;
158
- },
159
- flush() {
160
- const value = held;
161
- held = "";
162
- return value;
163
- }
164
- };
165
- }
166
- function htmlToMarkdown(html, options = {}) {
167
- return convertResult(htmlToMarkdown$1, html, options).markdown;
168
- }
169
- async function* streamHtmlToMarkdown(htmlStream, options = {}) {
170
- if (!htmlStream) throw new Error("Invalid HTML stream provided");
171
- const resolved = resolveOptions(options);
172
- const carry = createSurrogateCarry();
173
- const stream = new MarkdownStream(resolved.napiOpts);
174
- yield* pumpStream({
175
- processChunk: (chunk) => stream.processChunk(carry.take(chunk)),
176
- processChunkBytes: (chunk) => stream.processChunkBytes(chunk),
177
- finish: () => {
178
- const held = carry.flush();
179
- return held ? stream.processChunk(held) + stream.finish() : stream.finish();
180
- },
181
- takeData: () => stream.takeData()
182
- }, htmlStream, resolved, { decodeInJs: true });
183
- }
184
- export { htmlToMarkdown, streamHtmlToMarkdown };
@@ -1,100 +0,0 @@
1
- import mdream_edge_default, { MarkdownStream as MarkdownStream$1 } from "../wasm/mdream_edge.js";
2
- import { MdreamNapiResult } from "../napi/index.js";
3
- export * from "../wasm/mdream_edge.js";
4
- interface CleanOptions {
5
- /** Strip tracking query parameters (utm_*, fbclid, gclid, etc.) from URLs */
6
- urls?: boolean;
7
- /** Strip fragment-only links that don't match any heading in the output */
8
- fragments?: boolean;
9
- /** Strip links with meaningless hrefs (#, javascript:void(0)) → plain text */
10
- emptyLinks?: boolean;
11
- /** Collapse 3+ consecutive blank lines to 2 */
12
- blankLines?: boolean;
13
- /** Strip links where text equals URL: [https://x.com](https://x.com) → https://x.com */
14
- redundantLinks?: boolean;
15
- /** Strip self-referencing heading anchors: ## [Title](#title) → ## Title */
16
- selfLinkHeadings?: boolean;
17
- /** Strip images with no alt text (decorative/tracking pixels) */
18
- emptyImages?: boolean;
19
- /** Drop links that produce no visible text: [](url) → nothing */
20
- emptyLinkText?: boolean;
21
- }
22
- interface ExtractedElement {
23
- selector: string;
24
- tagName: string;
25
- textContent: string;
26
- attributes: Record<string, string>;
27
- }
28
- interface FrontmatterConfig {
29
- additionalFields?: Record<string, string>;
30
- metaFields?: string[];
31
- /** Callback to receive structured frontmatter data after conversion */
32
- onExtract?: (frontmatter: Record<string, string>) => void;
33
- }
34
- interface TagOverride {
35
- enter?: string;
36
- exit?: string;
37
- spacing?: number[];
38
- isInline?: boolean;
39
- isSelfClosing?: boolean;
40
- collapsesInnerWhiteSpace?: boolean;
41
- alias?: string;
42
- }
43
- interface MdreamOptions {
44
- /** Origin URL for resolving relative image paths and internal links. */
45
- origin?: string;
46
- /**
47
- * Clean up the markdown output. Pass `true` for all cleanup or an object
48
- * to enable specific features. Both `htmlToMarkdown` and
49
- * `streamHtmlToMarkdown` apply it.
50
- */
51
- clean?: boolean | CleanOptions;
52
- /** Enable minimal preset (frontmatter, isolateMain, tailwind, filter). Default: false */
53
- minimal?: boolean;
54
- /**
55
- * Extract frontmatter from HTML head.
56
- * - `true`: enable with defaults
57
- * - `(fm) => void`: enable and receive structured data via callback
58
- * - `FrontmatterConfig`: enable with config options and optional callback
59
- */
60
- frontmatter?: boolean | ((frontmatter: Record<string, string>) => void) | FrontmatterConfig;
61
- /** Isolate main content area. Default when minimal: true */
62
- isolateMain?: boolean;
63
- /** Convert Tailwind utility classes. Default when minimal: true */
64
- tailwind?: boolean;
65
- /**
66
- * Filter elements by CSS selector. `minimal` excludes form, nav, footer, and
67
- * similar; a filter passed with `minimal` adds to those excludes. `false`
68
- * turns filtering off, including the `minimal` one.
69
- */
70
- filter?: false | {
71
- include?: string[];
72
- exclude?: string[];
73
- processChildren?: boolean;
74
- };
75
- /** Extract elements matching CSS selectors */
76
- extraction?: Record<string, (element: ExtractedElement) => void>;
77
- /** Tag overrides. String values act as aliases */
78
- tagOverrides?: Record<string, TagOverride | string>;
79
- /**
80
- * Hard-wrap prose at this many characters, breaking on word boundaries.
81
- * Applied inline during conversion (zero-cost when unset). Code blocks,
82
- * tables, and headings are never wrapped. `0` disables wrapping.
83
- */
84
- wrapWidth?: number;
85
- /**
86
- * Output format. Defaults to `markdown`; use `text` for readable plain text,
87
- * or `html` for allowlisted semantic HTML.
88
- */
89
- format?: 'markdown' | 'text' | 'html';
90
- }
91
- export declare function htmlToMarkdownResult(html: string, options?: Partial<MdreamOptions>): MdreamNapiResult;
92
- export declare function htmlToMarkdown(html: string, options?: Partial<MdreamOptions>): string;
93
- export declare function htmlToMarkdownBytes(html: Uint8Array, options?: Partial<MdreamOptions>): string;
94
- /** Streaming converter. Runs the frontmatter and extraction callbacks in `finish()`. */
95
- export declare class MarkdownStream extends MarkdownStream$1 {
96
- private _callbacks;
97
- constructor(options?: Partial<MdreamOptions>);
98
- finish(): string;
99
- }
100
- export { mdream_edge_default as default };
@@ -1,140 +0,0 @@
1
- import mdream_edge_default, { MarkdownStream as MarkdownStream$1, htmlToMarkdownBytes as htmlToMarkdownBytes$1, htmlToMarkdownResult as htmlToMarkdownResult$1 } from "../wasm/mdream_edge.js";
2
- export * from "../wasm/mdream_edge.js";
3
- const MINIMAL_FILTER_EXCLUDE = [
4
- "form",
5
- "fieldset",
6
- "object",
7
- "embed",
8
- "footer",
9
- "aside",
10
- "iframe",
11
- "input",
12
- "textarea",
13
- "select",
14
- "button",
15
- "nav"
16
- ];
17
- const CLEAN_ALL = {
18
- urls: true,
19
- fragments: true,
20
- emptyLinks: true,
21
- redundantLinks: true,
22
- selfLinkHeadings: true,
23
- emptyImages: true,
24
- emptyLinkText: true
25
- };
26
- function resolveCleanConfig(options, minimal) {
27
- const cleanUrls = options.cleanUrls === true;
28
- let cleanOpt = options.clean;
29
- if (cleanOpt === void 0) {
30
- if (!minimal) return { cleanUrls };
31
- cleanOpt = true;
32
- }
33
- if (!cleanOpt) return { cleanUrls };
34
- const resolved = cleanOpt === true ? CLEAN_ALL : cleanOpt;
35
- return {
36
- cleanUrls: cleanUrls || resolved.urls === true,
37
- clean: resolved
38
- };
39
- }
40
- function resolveFrontmatter(opt) {
41
- if (typeof opt === "function") return {
42
- config: {},
43
- callback: opt
44
- };
45
- if (opt && typeof opt === "object") {
46
- const { onExtract, ...config } = opt;
47
- return {
48
- config,
49
- callback: onExtract
50
- };
51
- }
52
- return { config: {} };
53
- }
54
- function resolveOptions(options) {
55
- if (Array.isArray(options.plugins)) throw new TypeError("Custom hook plugins require @mdream/js. Pass declarative config (e.g. { frontmatter: true }) to the Rust engine, or import { htmlToMarkdown } from '@mdream/js' for hook-based plugins. See https://mdream.dev/v1-migration#custom-plugins");
56
- const minimal = options.minimal === true;
57
- const plugins = options.plugins ? { ...options.plugins } : {};
58
- let frontmatterCallback;
59
- const frontmatterDisabled = options.frontmatter === false;
60
- if (minimal ? !frontmatterDisabled : !!options.frontmatter) {
61
- const fm = resolveFrontmatter(options.frontmatter);
62
- plugins.frontmatter = fm.config;
63
- frontmatterCallback = fm.callback;
64
- } else if (frontmatterDisabled) delete plugins.frontmatter;
65
- const isolateMainDisabled = options.isolateMain === false;
66
- if (minimal ? !isolateMainDisabled : options.isolateMain) plugins.isolateMain = true;
67
- else if (isolateMainDisabled) delete plugins.isolateMain;
68
- const tailwindDisabled = options.tailwind === false;
69
- if (minimal ? !tailwindDisabled : options.tailwind) plugins.tailwind = true;
70
- else if (tailwindDisabled) delete plugins.tailwind;
71
- if (options.filter === false) delete plugins.filter;
72
- else if (minimal) plugins.filter = {
73
- ...options.filter,
74
- exclude: [...MINIMAL_FILTER_EXCLUDE, ...options.filter?.exclude ?? []]
75
- };
76
- else if (options.filter) plugins.filter = options.filter;
77
- const extraction = options.extraction;
78
- let extractionHandlers;
79
- if (extraction) {
80
- plugins.extraction = { selectors: Object.keys(extraction) };
81
- extractionHandlers = extraction;
82
- }
83
- const tagOverrides = options.tagOverrides;
84
- if (tagOverrides) {
85
- const overrides = {};
86
- for (const tag in tagOverrides) {
87
- const value = tagOverrides[tag];
88
- if (value) overrides[tag] = typeof value === "string" ? { alias: value } : value;
89
- }
90
- plugins.tagOverrides = overrides;
91
- }
92
- const { cleanUrls, clean } = resolveCleanConfig(options, minimal);
93
- return {
94
- napiOpts: {
95
- origin: options.origin,
96
- cleanUrls,
97
- clean,
98
- plugins,
99
- wrapWidth: options.wrapWidth,
100
- format: options.format
101
- },
102
- extractionHandlers,
103
- frontmatterCallback
104
- };
105
- }
106
- function deliverPluginData(data, { frontmatterCallback, extractionHandlers }) {
107
- if (data.frontmatter && frontmatterCallback) frontmatterCallback(data.frontmatter);
108
- if (data.extracted?.length && extractionHandlers) for (const element of data.extracted) extractionHandlers[element.selector]?.(element);
109
- }
110
- function convertResult(convert, html, options = {}) {
111
- const resolved = resolveOptions(options);
112
- const result = convert(html, resolved.napiOpts);
113
- deliverPluginData(result, resolved);
114
- return result;
115
- }
116
- function htmlToMarkdownResult(html, options = {}) {
117
- return convertResult(htmlToMarkdownResult$1, html, options);
118
- }
119
- function htmlToMarkdown(html, options = {}) {
120
- return htmlToMarkdownResult(html, options).markdown || "";
121
- }
122
- function htmlToMarkdownBytes(html, options = {}) {
123
- const resolved = resolveOptions(options);
124
- if (resolved.frontmatterCallback || resolved.extractionHandlers) return htmlToMarkdown(new TextDecoder().decode(html), options);
125
- return htmlToMarkdownBytes$1(html, resolved.napiOpts);
126
- }
127
- var MarkdownStream = class extends MarkdownStream$1 {
128
- _callbacks;
129
- constructor(options = {}) {
130
- const resolved = resolveOptions(options);
131
- super(resolved.napiOpts);
132
- this._callbacks = resolved;
133
- }
134
- finish() {
135
- const markdown = super.finish();
136
- deliverPluginData(this.takeData(), this._callbacks);
137
- return markdown;
138
- }
139
- };
140
- export { MarkdownStream, mdream_edge_default as default, htmlToMarkdown, htmlToMarkdownBytes, htmlToMarkdownResult };
@@ -1,101 +0,0 @@
1
- interface CleanOptions {
2
- /** Strip tracking query parameters (utm_*, fbclid, gclid, etc.) from URLs */
3
- urls?: boolean;
4
- /** Strip fragment-only links that don't match any heading in the output */
5
- fragments?: boolean;
6
- /** Strip links with meaningless hrefs (#, javascript:void(0)) → plain text */
7
- emptyLinks?: boolean;
8
- /** Collapse 3+ consecutive blank lines to 2 */
9
- blankLines?: boolean;
10
- /** Strip links where text equals URL: [https://x.com](https://x.com) → https://x.com */
11
- redundantLinks?: boolean;
12
- /** Strip self-referencing heading anchors: ## [Title](#title) → ## Title */
13
- selfLinkHeadings?: boolean;
14
- /** Strip images with no alt text (decorative/tracking pixels) */
15
- emptyImages?: boolean;
16
- /** Drop links that produce no visible text: [](url) → nothing */
17
- emptyLinkText?: boolean;
18
- }
19
- interface ExtractedElement {
20
- selector: string;
21
- tagName: string;
22
- textContent: string;
23
- attributes: Record<string, string>;
24
- }
25
- interface FrontmatterConfig {
26
- additionalFields?: Record<string, string>;
27
- metaFields?: string[];
28
- /** Callback to receive structured frontmatter data after conversion */
29
- onExtract?: (frontmatter: Record<string, string>) => void;
30
- }
31
- interface TagOverride {
32
- enter?: string;
33
- exit?: string;
34
- spacing?: number[];
35
- isInline?: boolean;
36
- isSelfClosing?: boolean;
37
- collapsesInnerWhiteSpace?: boolean;
38
- alias?: string;
39
- }
40
- interface MdreamOptions {
41
- /** Origin URL for resolving relative image paths and internal links. */
42
- origin?: string;
43
- /**
44
- * Clean up the markdown output. Pass `true` for all cleanup or an object
45
- * to enable specific features. Both `htmlToMarkdown` and
46
- * `streamHtmlToMarkdown` apply it.
47
- */
48
- clean?: boolean | CleanOptions;
49
- /** Enable minimal preset (frontmatter, isolateMain, tailwind, filter). Default: false */
50
- minimal?: boolean;
51
- /**
52
- * Extract frontmatter from HTML head.
53
- * - `true`: enable with defaults
54
- * - `(fm) => void`: enable and receive structured data via callback
55
- * - `FrontmatterConfig`: enable with config options and optional callback
56
- */
57
- frontmatter?: boolean | ((frontmatter: Record<string, string>) => void) | FrontmatterConfig;
58
- /** Isolate main content area. Default when minimal: true */
59
- isolateMain?: boolean;
60
- /** Convert Tailwind utility classes. Default when minimal: true */
61
- tailwind?: boolean;
62
- /**
63
- * Filter elements by CSS selector. `minimal` excludes form, nav, footer, and
64
- * similar; a filter passed with `minimal` adds to those excludes. `false`
65
- * turns filtering off, including the `minimal` one.
66
- */
67
- filter?: false | {
68
- include?: string[];
69
- exclude?: string[];
70
- processChildren?: boolean;
71
- };
72
- /** Extract elements matching CSS selectors */
73
- extraction?: Record<string, (element: ExtractedElement) => void>;
74
- /** Tag overrides. String values act as aliases */
75
- tagOverrides?: Record<string, TagOverride | string>;
76
- /**
77
- * Hard-wrap prose at this many characters, breaking on word boundaries.
78
- * Applied inline during conversion (zero-cost when unset). Code blocks,
79
- * tables, and headings are never wrapped. `0` disables wrapping.
80
- */
81
- wrapWidth?: number;
82
- /**
83
- * Output format. Defaults to `markdown`; use `text` for readable plain text,
84
- * or `html` for allowlisted semantic HTML.
85
- */
86
- format?: 'markdown' | 'text' | 'html';
87
- }
88
- /**
89
- * Initialize the mdream web worker. Must be called before htmlToMarkdown.
90
- * @param wasmUrl - URL to the mdream_edge_bg.wasm file
91
- */
92
- export declare function initWorker(wasmUrl: string): Promise<void>;
93
- /**
94
- * Convert HTML to markdown using the web worker.
95
- * Call initWorker() first.
96
- */
97
- export declare function htmlToMarkdown(html: string, options?: Partial<MdreamOptions>): Promise<string>;
98
- /**
99
- * Terminate the web worker and free resources.
100
- */
101
- export declare function terminateWorker(): void;