nuxt-ai-ready 2.5.3 → 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 (286) 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.prerender.js +1 -1
  45. package/dist/runtime/server/plugins/db-lifecycle-nitro3.d.ts +2 -0
  46. package/dist/runtime/server/plugins/db-lifecycle-nitro3.js +16 -0
  47. package/dist/runtime/server/plugins/html-capture.prerender.js +6 -4
  48. package/dist/runtime/server/plugins/link-header-nitro3.d.ts +2 -0
  49. package/dist/runtime/server/plugins/link-header-nitro3.js +20 -0
  50. package/dist/runtime/server/plugins/link-header.d.ts +6 -0
  51. package/dist/runtime/server/plugins/link-header.js +7 -11
  52. package/dist/runtime/server/plugins/markdown-negotiation.js +8 -1
  53. package/dist/runtime/server/plugins/sitemap-seeder.js +3 -3
  54. package/dist/runtime/server/routes/agent-skills-artifact.d.ts +1 -1
  55. package/dist/runtime/server/routes/agent-skills-artifact.js +10 -10
  56. package/dist/runtime/server/routes/agent-skills-index.d.ts +1 -1
  57. package/dist/runtime/server/routes/agent-skills-index.js +7 -6
  58. package/dist/runtime/server/routes/ai-catalog.d.ts +2 -1
  59. package/dist/runtime/server/routes/ai-catalog.js +7 -8
  60. package/dist/runtime/server/routes/api-catalog.d.ts +3 -1
  61. package/dist/runtime/server/routes/api-catalog.js +12 -12
  62. package/dist/runtime/server/routes/llms-full.txt.get.js +1 -1
  63. package/dist/runtime/server/routes/mcp-server-card.d.ts +1 -1
  64. package/dist/runtime/server/routes/mcp-server-card.js +7 -8
  65. package/dist/runtime/server/utils/checkStale.d.ts +2 -2
  66. package/dist/runtime/server/utils/cloudflare-prerendered.d.ts +3 -0
  67. package/dist/runtime/server/utils/cloudflare-prerendered.js +23 -0
  68. package/dist/runtime/server/utils/cloudflare.d.ts +5 -5
  69. package/dist/runtime/server/utils/cloudflare.js +31 -7
  70. package/dist/runtime/server/utils/content-negotiation.d.ts +5 -3
  71. package/dist/runtime/server/utils/content-negotiation.js +8 -7
  72. package/dist/runtime/server/utils/context.d.ts +3 -3
  73. package/dist/runtime/server/utils/context.js +1 -1
  74. package/dist/runtime/server/utils/discovery-response.d.ts +2 -0
  75. package/dist/runtime/server/utils/link-header.d.ts +5 -3
  76. package/dist/runtime/server/utils/link-header.js +26 -2
  77. package/dist/runtime/server/utils/markdown-request.d.ts +4 -3
  78. package/dist/runtime/server/utils/markdown-request.js +15 -13
  79. package/dist/runtime/server/utils/negotiation-decision.d.ts +4 -0
  80. package/dist/runtime/server/utils/negotiation-decision.js +6 -5
  81. package/dist/runtime/server/utils/negotiation-response.js +47 -22
  82. package/dist/runtime/server/utils/prerender-html.d.ts +2 -1
  83. package/dist/runtime/server/utils/prerender-html.js +3 -1
  84. package/dist/runtime/types.d.ts +15 -7
  85. package/dist/shared/nuxt-ai-ready.B3hAuOLQ.mjs +29 -0
  86. package/dist/shared/{nuxt-ai-ready.CLSWou20.mjs → nuxt-ai-ready.C34F0LJo.mjs} +560 -219
  87. package/package.json +85 -20
  88. package/skills/nuxt-ai-ready/SKILL.md +26 -12
  89. package/skills/nuxt-ai-ready/references/runtime-indexing.md +7 -6
  90. package/dist/runtime/server/db/drizzle/providers/sqlite.d.ts +0 -8
  91. package/dist/runtime/server/db/drizzle/providers/sqlite.js +0 -15
  92. package/node_modules/@mdream/js/LICENSE.md +0 -9
  93. package/node_modules/@mdream/js/README.md +0 -792
  94. package/node_modules/@mdream/js/bin/mdream.mjs +0 -2
  95. package/node_modules/@mdream/js/dist/_chunks/const.mjs +0 -134
  96. package/node_modules/@mdream/js/dist/_chunks/index.d.mts +0 -9
  97. package/node_modules/@mdream/js/dist/_chunks/markdown-processor.mjs +0 -1968
  98. package/node_modules/@mdream/js/dist/_chunks/minimal.d.mts +0 -6
  99. package/node_modules/@mdream/js/dist/_chunks/parse.mjs +0 -2756
  100. package/node_modules/@mdream/js/dist/_chunks/plugins.mjs +0 -725
  101. package/node_modules/@mdream/js/dist/_chunks/resolve-plugins.mjs +0 -44
  102. package/node_modules/@mdream/js/dist/_chunks/stream.mjs +0 -37
  103. package/node_modules/@mdream/js/dist/_chunks/types.d.mts +0 -473
  104. package/node_modules/@mdream/js/dist/cli.d.mts +0 -1
  105. package/node_modules/@mdream/js/dist/cli.mjs +0 -32
  106. package/node_modules/@mdream/js/dist/core.d.mts +0 -15
  107. package/node_modules/@mdream/js/dist/core.mjs +0 -28
  108. package/node_modules/@mdream/js/dist/index.d.mts +0 -4
  109. package/node_modules/@mdream/js/dist/index.mjs +0 -58
  110. package/node_modules/@mdream/js/dist/llms-txt.d.mts +0 -86
  111. package/node_modules/@mdream/js/dist/llms-txt.mjs +0 -308
  112. package/node_modules/@mdream/js/dist/negotiate.d.mts +0 -35
  113. package/node_modules/@mdream/js/dist/negotiate.mjs +0 -121
  114. package/node_modules/@mdream/js/dist/parse.d.mts +0 -90
  115. package/node_modules/@mdream/js/dist/parse.mjs +0 -2
  116. package/node_modules/@mdream/js/dist/plugins.d.mts +0 -85
  117. package/node_modules/@mdream/js/dist/plugins.mjs +0 -2
  118. package/node_modules/@mdream/js/dist/preset/minimal.d.mts +0 -2
  119. package/node_modules/@mdream/js/dist/preset/minimal.mjs +0 -33
  120. package/node_modules/@mdream/js/dist/splitter.d.mts +0 -18
  121. package/node_modules/@mdream/js/dist/splitter.mjs +0 -194
  122. package/node_modules/@mdream/js/package.json +0 -103
  123. package/node_modules/cac/LICENSE +0 -21
  124. package/node_modules/cac/README.md +0 -492
  125. package/node_modules/cac/dist/index.d.ts +0 -196
  126. package/node_modules/cac/dist/index.js +0 -638
  127. package/node_modules/cac/package.json +0 -72
  128. package/node_modules/mdream/LICENSE.md +0 -9
  129. package/node_modules/mdream/README.md +0 -1091
  130. package/node_modules/mdream/bin/mdream.mjs +0 -46
  131. package/node_modules/mdream/dist/browser.d.mts +0 -105
  132. package/node_modules/mdream/dist/browser.mjs +0 -262
  133. package/node_modules/mdream/dist/edge.d.mts +0 -100
  134. package/node_modules/mdream/dist/edge.mjs +0 -250
  135. package/node_modules/mdream/dist/iife.js +0 -605
  136. package/node_modules/mdream/dist/index.d.mts +0 -89
  137. package/node_modules/mdream/dist/index.mjs +0 -184
  138. package/node_modules/mdream/dist/wasm.d.mts +0 -100
  139. package/node_modules/mdream/dist/wasm.mjs +0 -140
  140. package/node_modules/mdream/dist/worker.d.mts +0 -101
  141. package/node_modules/mdream/dist/worker.mjs +0 -217
  142. package/node_modules/mdream/napi/index.d.mts +0 -127
  143. package/node_modules/mdream/napi/index.d.ts +0 -127
  144. package/node_modules/mdream/napi/index.mjs +0 -725
  145. package/node_modules/mdream/napi/rust.android-arm-eabi.node +0 -0
  146. package/node_modules/mdream/napi/rust.android-arm64.node +0 -0
  147. package/node_modules/mdream/napi/rust.darwin-arm64.node +0 -0
  148. package/node_modules/mdream/napi/rust.darwin-x64.node +0 -0
  149. package/node_modules/mdream/napi/rust.freebsd-x64.node +0 -0
  150. package/node_modules/mdream/napi/rust.linux-arm-gnueabihf.node +0 -0
  151. package/node_modules/mdream/napi/rust.linux-arm64-gnu.node +0 -0
  152. package/node_modules/mdream/napi/rust.linux-arm64-musl.node +0 -0
  153. package/node_modules/mdream/napi/rust.linux-x64-gnu.node +0 -0
  154. package/node_modules/mdream/napi/rust.linux-x64-musl.node +0 -0
  155. package/node_modules/mdream/napi/rust.wasi.cjs +0 -2144
  156. package/node_modules/mdream/napi/rust.wasm32-wasi.wasm +0 -0
  157. package/node_modules/mdream/napi/rust.win32-arm64-msvc.node +0 -0
  158. package/node_modules/mdream/napi/rust.win32-x64-msvc.node +0 -0
  159. package/node_modules/mdream/node_modules/@emnapi/core/LICENSE +0 -21
  160. package/node_modules/mdream/node_modules/@emnapi/core/README.md +0 -1
  161. package/node_modules/mdream/node_modules/@emnapi/core/dist/emnapi-core.d.ts +0 -392
  162. package/node_modules/mdream/node_modules/@emnapi/core/dist/emnapi-core.full.d.ts +0 -392
  163. package/node_modules/mdream/node_modules/@emnapi/core/dist/emnapi-core.full.js +0 -8351
  164. package/node_modules/mdream/node_modules/@emnapi/core/dist/emnapi-core.js +0 -7268
  165. package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/async-work.d.ts +0 -5
  166. package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/async-work.js +0 -843
  167. package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/index.d.ts +0 -4
  168. package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/index.js +0 -3
  169. package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/threadsafe-function.d.ts +0 -5
  170. package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/threadsafe-function.js +0 -1010
  171. package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/v8.d.ts +0 -5
  172. package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/v8.js +0 -1446
  173. package/node_modules/mdream/node_modules/@emnapi/core/node_modules/@emnapi/wasi-threads/LICENSE +0 -21
  174. package/node_modules/mdream/node_modules/@emnapi/core/node_modules/@emnapi/wasi-threads/README.md +0 -203
  175. package/node_modules/mdream/node_modules/@emnapi/core/node_modules/@emnapi/wasi-threads/dist/wasi-threads.d.ts +0 -236
  176. package/node_modules/mdream/node_modules/@emnapi/core/node_modules/@emnapi/wasi-threads/dist/wasi-threads.js +0 -1086
  177. package/node_modules/mdream/node_modules/@emnapi/core/node_modules/@emnapi/wasi-threads/package.json +0 -35
  178. package/node_modules/mdream/node_modules/@emnapi/core/node_modules/@emnapi/wasi-threads/rollup.config.js +0 -6
  179. package/node_modules/mdream/node_modules/@emnapi/core/package.json +0 -39
  180. package/node_modules/mdream/node_modules/@emnapi/core/rollup.config.js +0 -60
  181. package/node_modules/mdream/node_modules/@emnapi/runtime/LICENSE +0 -21
  182. package/node_modules/mdream/node_modules/@emnapi/runtime/README.md +0 -1
  183. package/node_modules/mdream/node_modules/@emnapi/runtime/dist/emnapi.d.ts +0 -833
  184. package/node_modules/mdream/node_modules/@emnapi/runtime/dist/emnapi.js +0 -2306
  185. package/node_modules/mdream/node_modules/@emnapi/runtime/dist/emnapi.js.map +0 -1
  186. package/node_modules/mdream/node_modules/@emnapi/runtime/index.cjs +0 -63
  187. package/node_modules/mdream/node_modules/@emnapi/runtime/package.json +0 -39
  188. package/node_modules/mdream/node_modules/@emnapi/runtime/rollup.config.js +0 -25
  189. package/node_modules/mdream/node_modules/@emnapi/wasi-threads/LICENSE +0 -21
  190. package/node_modules/mdream/node_modules/@emnapi/wasi-threads/README.md +0 -203
  191. package/node_modules/mdream/node_modules/@emnapi/wasi-threads/dist/wasi-threads.d.ts +0 -240
  192. package/node_modules/mdream/node_modules/@emnapi/wasi-threads/dist/wasi-threads.js +0 -1118
  193. package/node_modules/mdream/node_modules/@emnapi/wasi-threads/package.json +0 -35
  194. package/node_modules/mdream/node_modules/@emnapi/wasi-threads/rollup.config.js +0 -6
  195. package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/dist/emnapi-plugins.cjs +0 -1472
  196. package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/dist/emnapi-plugins.js +0 -1470
  197. package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/dist/fs-proxy.cjs +0 -237
  198. package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/dist/fs.js +0 -17578
  199. package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/fs-proxy.js +0 -317
  200. package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/package.json +0 -67
  201. package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/runtime.cjs +0 -39
  202. package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/runtime.js +0 -36
  203. package/node_modules/mdream/node_modules/@tybys/wasm-util/LICENSE +0 -21
  204. package/node_modules/mdream/node_modules/@tybys/wasm-util/README.md +0 -193
  205. package/node_modules/mdream/node_modules/@tybys/wasm-util/dist/tsdoc-metadata.json +0 -11
  206. package/node_modules/mdream/node_modules/@tybys/wasm-util/dist/wasm-util.d.ts +0 -423
  207. package/node_modules/mdream/node_modules/@tybys/wasm-util/dist/wasm-util.esm-bundler.js +0 -2932
  208. package/node_modules/mdream/node_modules/@tybys/wasm-util/dist/wasm-util.esm.js +0 -2932
  209. package/node_modules/mdream/node_modules/@tybys/wasm-util/dist/wasm-util.esm.min.js +0 -1
  210. package/node_modules/mdream/node_modules/@tybys/wasm-util/dist/wasm-util.js +0 -2954
  211. package/node_modules/mdream/node_modules/@tybys/wasm-util/dist/wasm-util.min.js +0 -1
  212. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/asyncify.js +0 -158
  213. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/index.js +0 -13
  214. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/jspi.js +0 -46
  215. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/load.js +0 -97
  216. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/memory.js +0 -35
  217. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/error.js +0 -103
  218. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/fd.js +0 -268
  219. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/fs.js +0 -3
  220. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/index.js +0 -192
  221. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/path.js +0 -316
  222. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/preview1.js +0 -1599
  223. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/rights.js +0 -141
  224. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/types.js +0 -220
  225. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/util.js +0 -128
  226. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/webassembly.js +0 -13
  227. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/asyncify.mjs +0 -153
  228. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/index.mjs +0 -9
  229. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/jspi.mjs +0 -39
  230. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/load.mjs +0 -89
  231. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/memory.mjs +0 -28
  232. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/error.mjs +0 -97
  233. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/fd.mjs +0 -256
  234. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/fs.mjs +0 -1
  235. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/index.mjs +0 -186
  236. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/path.mjs +0 -310
  237. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/preview1.mjs +0 -1593
  238. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/rights.mjs +0 -135
  239. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/types.mjs +0 -216
  240. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/util.mjs +0 -113
  241. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/webassembly.mjs +0 -9
  242. package/node_modules/mdream/node_modules/@tybys/wasm-util/package.json +0 -58
  243. package/node_modules/mdream/node_modules/tslib/CopyrightNotice.txt +0 -15
  244. package/node_modules/mdream/node_modules/tslib/LICENSE.txt +0 -12
  245. package/node_modules/mdream/node_modules/tslib/README.md +0 -164
  246. package/node_modules/mdream/node_modules/tslib/SECURITY.md +0 -41
  247. package/node_modules/mdream/node_modules/tslib/modules/index.d.ts +0 -38
  248. package/node_modules/mdream/node_modules/tslib/modules/index.js +0 -70
  249. package/node_modules/mdream/node_modules/tslib/modules/package.json +0 -3
  250. package/node_modules/mdream/node_modules/tslib/package.json +0 -47
  251. package/node_modules/mdream/node_modules/tslib/tslib.d.ts +0 -460
  252. package/node_modules/mdream/node_modules/tslib/tslib.es6.html +0 -1
  253. package/node_modules/mdream/node_modules/tslib/tslib.es6.js +0 -402
  254. package/node_modules/mdream/node_modules/tslib/tslib.es6.mjs +0 -401
  255. package/node_modules/mdream/node_modules/tslib/tslib.html +0 -1
  256. package/node_modules/mdream/node_modules/tslib/tslib.js +0 -484
  257. package/node_modules/mdream/package.json +0 -110
  258. package/node_modules/mdream/skills/mdream/SKILL.md +0 -124
  259. package/node_modules/mdream/skills/mdream/references/runtimes.md +0 -49
  260. package/node_modules/mdream/wasm/mdream_edge.d.ts +0 -90
  261. package/node_modules/mdream/wasm/mdream_edge.js +0 -517
  262. package/node_modules/mdream/wasm/mdream_edge_bg.wasm +0 -0
  263. package/node_modules/mdream/wasm/mdream_edge_bg.wasm.d.ts +0 -20
  264. package/node_modules/mdream/wasm/package.json +0 -17
  265. package/node_modules/mdream/wasm-bundler/mdream_edge.d.ts +0 -45
  266. package/node_modules/mdream/wasm-bundler/mdream_edge.js +0 -13
  267. package/node_modules/mdream/wasm-bundler/mdream_edge_bg.js +0 -413
  268. package/node_modules/mdream/wasm-bundler/mdream_edge_bg.wasm +0 -0
  269. package/node_modules/mdream/wasm-bundler/mdream_edge_bg.wasm.d.ts +0 -20
  270. package/node_modules/mdream/wasm-bundler/package.json +0 -19
  271. package/node_modules/pathe/LICENSE +0 -70
  272. package/node_modules/pathe/README.md +0 -73
  273. package/node_modules/pathe/dist/index.cjs +0 -39
  274. package/node_modules/pathe/dist/index.d.cts +0 -47
  275. package/node_modules/pathe/dist/index.d.mts +0 -47
  276. package/node_modules/pathe/dist/index.d.ts +0 -47
  277. package/node_modules/pathe/dist/index.mjs +0 -19
  278. package/node_modules/pathe/dist/shared/pathe.BSlhyZSM.cjs +0 -266
  279. package/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs +0 -249
  280. package/node_modules/pathe/dist/utils.cjs +0 -82
  281. package/node_modules/pathe/dist/utils.d.cts +0 -32
  282. package/node_modules/pathe/dist/utils.d.mts +0 -32
  283. package/node_modules/pathe/dist/utils.d.ts +0 -32
  284. package/node_modules/pathe/dist/utils.mjs +0 -77
  285. package/node_modules/pathe/package.json +0 -61
  286. package/node_modules/pathe/utils.d.ts +0 -1
@@ -1,725 +0,0 @@
1
- import { TagIdMap } from "./const.mjs";
2
- function createPlugin(plugin) {
3
- return plugin;
4
- }
5
- function createTagSelector(tagName) {
6
- return {
7
- matches: (element) => element.name === tagName,
8
- toString: () => tagName
9
- };
10
- }
11
- function createIdSelector(selector) {
12
- const id = selector.slice(1);
13
- return {
14
- matches: (element) => element.attributes?.id === id,
15
- toString: () => `#${id}`
16
- };
17
- }
18
- function createClassSelector(selector) {
19
- const className = selector.slice(1);
20
- return {
21
- matches: (element) => {
22
- if (!element.attributes?.class) return false;
23
- return element.attributes.class.trim().split(" ").filter(Boolean).includes(className);
24
- },
25
- toString: () => `.${className}`
26
- };
27
- }
28
- function parseAttributeSelector(selector) {
29
- if (selector.charCodeAt(0) !== 91) return null;
30
- const end = selector.indexOf("]", 1);
31
- if (end === -1) return null;
32
- const inner = selector.slice(1, end);
33
- let opIdx = -1;
34
- for (let i = 0; i < inner.length; i++) {
35
- const c = inner.charCodeAt(i);
36
- if (c === 61 || c === 126 || c === 124 || c === 94 || c === 36 || c === 42) {
37
- opIdx = i;
38
- break;
39
- }
40
- }
41
- if (opIdx === -1) return { attr: inner };
42
- const attr = inner.slice(0, opIdx);
43
- let opEnd = opIdx + 1;
44
- if (opEnd < inner.length && inner.charCodeAt(opEnd) === 61) opEnd++;
45
- const op = inner.slice(opIdx, opEnd);
46
- let value = inner.slice(opEnd);
47
- if ((value.charCodeAt(0) === 34 || value.charCodeAt(0) === 39) && value.charCodeAt(value.length - 1) === value.charCodeAt(0)) value = value.slice(1, -1);
48
- return {
49
- attr,
50
- op,
51
- value
52
- };
53
- }
54
- function createAttributeSelector(selector) {
55
- const parsed = parseAttributeSelector(selector);
56
- const attrName = parsed ? parsed.attr : selector.slice(1, -1);
57
- const operator = parsed?.op;
58
- const attrValue = parsed?.value;
59
- return {
60
- matches: (element) => {
61
- if (!(attrName in (element.attributes || {}))) return false;
62
- if (!operator || !attrValue) return true;
63
- const value = element.attributes[attrName];
64
- if (value === void 0) return false;
65
- switch (operator) {
66
- case "=": return value === attrValue;
67
- case "^=": return value.startsWith(attrValue);
68
- case "$=": return value.endsWith(attrValue);
69
- case "*=": return value.includes(attrValue);
70
- case "~=": return value.trim().split(" ").filter(Boolean).includes(attrValue);
71
- case "|=": return value === attrValue || value.startsWith(`${attrValue}-`);
72
- default: return false;
73
- }
74
- },
75
- toString: () => {
76
- if (!operator || !attrValue) return `[${attrName}]`;
77
- return `[${attrName}${operator}${attrValue}]`;
78
- }
79
- };
80
- }
81
- function createCompoundSelector(selectors) {
82
- return {
83
- matches: (element) => selectors.every((selector) => selector.matches(element)),
84
- toString: () => selectors.map((s) => s.toString()).join("")
85
- };
86
- }
87
- function createSelectorList(selectors) {
88
- return {
89
- matches(element) {
90
- for (let i = 0; i < selectors.length; i++) if (selectors[i].matches(element)) return true;
91
- return false;
92
- },
93
- toString: () => selectors.map((s) => s.toString()).join(", ")
94
- };
95
- }
96
- function parseCompoundSelector(selector) {
97
- const selectorParts = [];
98
- let current = "";
99
- let inAttribute = false;
100
- for (let i = 0; i < selector.length; i++) {
101
- const char = selector[i];
102
- if ((char === "." || char === "#" || char === "[") && current) {
103
- if (current[0] === ".") selectorParts.push(createClassSelector(current));
104
- else if (current[0] === "#") selectorParts.push(createIdSelector(current));
105
- else if (current[0] === "[") selectorParts.push(createAttributeSelector(current));
106
- else if (current) selectorParts.push(createTagSelector(current));
107
- current = char;
108
- } else current += char;
109
- if (char === "[") inAttribute = true;
110
- if (char === "]") inAttribute = false;
111
- if (inAttribute && char !== "[") {}
112
- }
113
- if (current) {
114
- if (current[0] === ".") selectorParts.push(createClassSelector(current));
115
- else if (current[0] === "#") selectorParts.push(createIdSelector(current));
116
- else if (current[0] === "[") selectorParts.push(createAttributeSelector(current));
117
- else if (current) selectorParts.push(createTagSelector(current));
118
- }
119
- if (selectorParts.length === 1) return selectorParts[0];
120
- return createCompoundSelector(selectorParts);
121
- }
122
- function parseSelector(selector) {
123
- selector = selector.trim();
124
- if (!selector) throw new Error("Empty selector");
125
- const selectors = [];
126
- let start = 0;
127
- let inAttribute = false;
128
- let quote = 0;
129
- let escaped = false;
130
- for (let i = 0; i < selector.length; i++) {
131
- const char = selector.charCodeAt(i);
132
- if (quote) {
133
- if (escaped) escaped = false;
134
- else if (char === 92) escaped = true;
135
- else if (char === quote) quote = 0;
136
- continue;
137
- }
138
- if (inAttribute) {
139
- if (char === 34 || char === 39) quote = char;
140
- else if (char === 93) inAttribute = false;
141
- continue;
142
- }
143
- if (char === 91) inAttribute = true;
144
- else if (char === 44) {
145
- const part = selector.slice(start, i).trim();
146
- if (!part) return createTagSelector(selector);
147
- selectors.push(parseCompoundSelector(part));
148
- start = i + 1;
149
- }
150
- }
151
- if (!selectors.length) return parseCompoundSelector(selector);
152
- const last = selector.slice(start).trim();
153
- if (!last) return createTagSelector(selector);
154
- selectors.push(parseCompoundSelector(last));
155
- return createSelectorList(selectors);
156
- }
157
- function extractionPlugin(selectors) {
158
- const matcherCallbacks = Object.entries(selectors).map(([selector, callback]) => ({
159
- matcher: parseSelector(selector),
160
- callback
161
- }));
162
- const trackedElements = /* @__PURE__ */ new Map();
163
- return createPlugin({
164
- onNodeEnter(element) {
165
- let callbacks;
166
- for (let i = 0; i < matcherCallbacks.length; i++) {
167
- const { matcher, callback } = matcherCallbacks[i];
168
- if (matcher.matches(element)) {
169
- callbacks ||= [];
170
- callbacks.push(callback);
171
- }
172
- }
173
- if (callbacks) trackedElements.set(element, {
174
- textContent: "",
175
- callbacks
176
- });
177
- },
178
- processTextNode(textNode) {
179
- let currentParent = textNode.parent;
180
- while (currentParent) {
181
- const tracked = trackedElements.get(currentParent);
182
- if (tracked) tracked.textContent += textNode.value;
183
- currentParent = currentParent.parent;
184
- }
185
- },
186
- onNodeExit(element, state) {
187
- const tracked = trackedElements.get(element);
188
- if (tracked) {
189
- for (let i = 0; i < tracked.callbacks.length; i++) {
190
- const extractedElement = {
191
- ...element,
192
- attributes: { ...element.attributes },
193
- textContent: tracked.textContent.trim()
194
- };
195
- tracked.callbacks[i](extractedElement, state);
196
- }
197
- trackedElements.delete(element);
198
- }
199
- }
200
- });
201
- }
202
- function extractionCollectorPlugin(config) {
203
- const matchers = Object.entries(config).map(([selector, callback]) => ({
204
- selector,
205
- matcher: parseSelector(selector),
206
- callback
207
- }));
208
- const results = [];
209
- const trackedElements = /* @__PURE__ */ new Map();
210
- const plugin = createPlugin({
211
- onNodeEnter(element) {
212
- let selectors;
213
- for (let i = 0; i < matchers.length; i++) {
214
- const m = matchers[i];
215
- if (m.matcher.matches(element)) {
216
- selectors ||= [];
217
- selectors.push(m.selector);
218
- }
219
- }
220
- if (selectors) trackedElements.set(element, {
221
- textContent: "",
222
- selectors
223
- });
224
- },
225
- processTextNode(textNode) {
226
- let currentParent = textNode.parent;
227
- while (currentParent) {
228
- const tracked = trackedElements.get(currentParent);
229
- if (tracked) tracked.textContent += textNode.value;
230
- currentParent = currentParent.parent;
231
- }
232
- },
233
- onNodeExit(element) {
234
- const tracked = trackedElements.get(element);
235
- if (tracked) {
236
- for (let i = 0; i < tracked.selectors.length; i++) {
237
- const extracted = {
238
- selector: tracked.selectors[i],
239
- tagName: element.name,
240
- textContent: tracked.textContent.trim(),
241
- attributes: { ...element.attributes }
242
- };
243
- results.push(extracted);
244
- }
245
- trackedElements.delete(element);
246
- }
247
- }
248
- });
249
- function callHandlers() {
250
- for (let i = 0; i < results.length; i++) {
251
- const el = results[i];
252
- for (let j = 0; j < matchers.length; j++) if (matchers[j].selector === el.selector) {
253
- matchers[j].callback(el);
254
- break;
255
- }
256
- }
257
- }
258
- return {
259
- plugin,
260
- getResults: () => results,
261
- callHandlers
262
- };
263
- }
264
- function compileSelector(selector) {
265
- if (typeof selector === "number") return {
266
- matches: (element) => element.tagId === selector,
267
- toString: () => String(selector)
268
- };
269
- const tagId = TagIdMap[selector];
270
- if (tagId !== void 0) return {
271
- matches: (element) => element.tagId === tagId,
272
- toString: () => selector
273
- };
274
- return parseSelector(selector);
275
- }
276
- function isHidden(element) {
277
- const style = element.attributes?.style;
278
- if (style && (style.includes("display:none") || style.includes("display: none") || style.includes("visibility:hidden") || style.includes("visibility: hidden") || style.includes("position:absolute") || style.includes("position: absolute") || style.includes("position:fixed") || style.includes("position: fixed"))) return true;
279
- const hidden = element.attributes?.hidden;
280
- return hidden !== void 0 && hidden.toLowerCase() !== "until-found";
281
- }
282
- function filterPlugin(options = {}) {
283
- const includeSelectors = options.include?.map((selector) => compileSelector(selector)) || [];
284
- const excludeSelectors = options.exclude?.map((selector) => compileSelector(selector)) || [];
285
- const processChildren = options.processChildren !== false;
286
- const skippedSubtrees = /* @__PURE__ */ new WeakSet();
287
- const skippedByInclude = /* @__PURE__ */ new WeakSet();
288
- function excludesSubtree(element) {
289
- if (skippedSubtrees.has(element)) return true;
290
- if ((element.parent ? skippedSubtrees.has(element.parent) : false) || isHidden(element) || excludeSelectors.some((selector) => selector.matches(element))) {
291
- skippedSubtrees.add(element);
292
- return true;
293
- }
294
- return false;
295
- }
296
- return createPlugin({
297
- excludesOverflowSubtree: excludesSubtree,
298
- beforeNodeProcess(event) {
299
- const { node } = event;
300
- if (node.type === 2) {
301
- const textNode = node;
302
- const parent = textNode.parent;
303
- if (parent && skippedSubtrees.has(parent)) return { skip: true };
304
- if (parent && skippedByInclude.has(parent)) textNode.excludedFromMarkdown = true;
305
- return;
306
- }
307
- if (node.type !== 1) return;
308
- const element = node;
309
- if (excludesSubtree(element)) return { skip: true };
310
- if (includeSelectors.length) {
311
- let currentElement = element;
312
- while (currentElement) {
313
- if (includeSelectors.some((selector) => selector.matches(currentElement))) return;
314
- if (!processChildren) break;
315
- currentElement = currentElement.parent;
316
- }
317
- skippedByInclude.add(element);
318
- return { skip: true };
319
- }
320
- }
321
- });
322
- }
323
- const BACKSLASH_RE = /\\/g;
324
- const DOUBLE_QUOTE_RE = /"/g;
325
- const ESCAPED_DOUBLE_QUOTE_RE = /\\"/g;
326
- function frontmatterPlugin(options = {}) {
327
- const additionalFields = options.additionalFields || {};
328
- const metaFields = /* @__PURE__ */ new Set([
329
- "description",
330
- "keywords",
331
- "author",
332
- "date",
333
- "og:title",
334
- "og:description",
335
- "twitter:title",
336
- "twitter:description",
337
- ...options.metaFields || []
338
- ]);
339
- const frontmatter = {
340
- ...additionalFields,
341
- meta: {}
342
- };
343
- let inHead = false;
344
- function formatValue(_name, value) {
345
- value = value.replace(BACKSLASH_RE, "\\\\").replace(DOUBLE_QUOTE_RE, "\\\"");
346
- if (value.includes("\n") || value.includes(":") || value.includes("#") || value.includes(" ")) return `"${value}"`;
347
- return value;
348
- }
349
- function getStructuredData() {
350
- const result = {};
351
- if (frontmatter.title) {
352
- const raw = frontmatter.title;
353
- result.title = raw.startsWith("\"") && raw.endsWith("\"") ? raw.slice(1, -1).replace(ESCAPED_DOUBLE_QUOTE_RE, "\"") : raw;
354
- }
355
- for (const [k, v] of Object.entries(frontmatter.meta)) {
356
- const cleanKey = k.startsWith("\"") && k.endsWith("\"") ? k.slice(1, -1) : k;
357
- result[cleanKey] = typeof v === "string" && v.startsWith("\"") && v.endsWith("\"") ? v.slice(1, -1).replace(ESCAPED_DOUBLE_QUOTE_RE, "\"") : String(v);
358
- }
359
- if (additionalFields) {
360
- for (const [k, v] of Object.entries(additionalFields)) if (typeof v === "string") result[k] = v;
361
- }
362
- return Object.keys(result).length > 0 ? result : void 0;
363
- }
364
- const plugin = createPlugin({
365
- onNodeEnter(node) {
366
- if (node.excludedFromMarkdown) return;
367
- if (node.tagId === 1) {
368
- inHead = true;
369
- return;
370
- }
371
- if (inHead && node.type === 1 && node.tagId === 4) return;
372
- if (inHead && node.type === 1 && node.tagId === 5) {
373
- const { name, property, content } = node.attributes || {};
374
- const metaName = property || name;
375
- if (metaName && content && metaFields.has(metaName)) frontmatter.meta[metaName.includes(":") ? `"${metaName}"` : metaName] = formatValue(metaName, content);
376
- return;
377
- }
378
- },
379
- onNodeExit(node, state) {
380
- if (node.excludedFromMarkdown) return void 0;
381
- if (node.type === 1 && node.tagId === 1) {
382
- inHead = false;
383
- if (state.options?.format === "text") return void 0;
384
- if (Object.keys(frontmatter).length > 0) {
385
- const frontmatterContent = generateFrontmatter();
386
- if (frontmatterContent) {
387
- state.buffer.push(frontmatterContent);
388
- state.lastContentCache = frontmatterContent;
389
- }
390
- }
391
- }
392
- },
393
- processTextNode(node) {
394
- if (node.parent?.excludedFromMarkdown) return;
395
- if (!inHead) return;
396
- const parent = node.parent;
397
- if (parent && parent.tagId === 4 && node.value) {
398
- frontmatter.title = formatValue("title", node.value.trim());
399
- return {
400
- content: "",
401
- skip: true
402
- };
403
- }
404
- }
405
- });
406
- plugin.getFrontmatter = getStructuredData;
407
- return plugin;
408
- function generateFrontmatter() {
409
- if (Object.keys(frontmatter).length === 0) return "";
410
- let yamlLines = [];
411
- const entries = Object.entries(frontmatter).sort(([a], [b]) => {
412
- if (a === "title") return -1;
413
- if (b === "title") return 1;
414
- if (a === "description") return -1;
415
- if (b === "description") return 1;
416
- return a.localeCompare(b);
417
- });
418
- for (const [key, value] of entries) if (key === "meta" && typeof value === "object" && value && Object.keys(value).length > 0) {
419
- yamlLines.push("meta:");
420
- const metaEntries = Object.entries(value).sort(([a], [b]) => a.localeCompare(b)).map(([metaKey, metaValue]) => ` ${metaKey}: ${metaValue}`);
421
- yamlLines.push(...metaEntries);
422
- } else if (key !== "meta" && typeof value === "string") yamlLines.push(`${key}: ${value}`);
423
- if (Object.keys(frontmatter.meta).length === 0) yamlLines = yamlLines.filter((line) => !line.startsWith("meta:"));
424
- return `---\n${yamlLines.join("\n")}\n---\n\n`;
425
- }
426
- }
427
- function isolateMainPlugin() {
428
- let mainElement = null;
429
- let firstHeaderElement = null;
430
- let afterFooter = false;
431
- const headerTagIds = /* @__PURE__ */ new Set([
432
- 7,
433
- 8,
434
- 9,
435
- 10,
436
- 11,
437
- 12
438
- ]);
439
- return createPlugin({ beforeNodeProcess(event) {
440
- const { node } = event;
441
- if (node.excludedFromMarkdown || node.parent?.excludedFromMarkdown) return;
442
- if (node.type === 1) {
443
- const element = node;
444
- if (!mainElement && element.tagId === 104 && element.depth <= 5) {
445
- mainElement = element;
446
- return;
447
- }
448
- if (mainElement) {
449
- let current = element.parent;
450
- let isInsideMain = element === mainElement;
451
- while (current && !isInsideMain) {
452
- if (current === mainElement) {
453
- isInsideMain = true;
454
- break;
455
- }
456
- current = current.parent;
457
- }
458
- if (!isInsideMain) return { skip: true };
459
- return;
460
- }
461
- if (!firstHeaderElement && element.tagId !== void 0 && headerTagIds.has(element.tagId)) {
462
- let current = element.parent;
463
- let isInHeaderTag = false;
464
- while (current) {
465
- if (current.tagId === 105) {
466
- isInHeaderTag = true;
467
- break;
468
- }
469
- current = current.parent;
470
- }
471
- if (!isInHeaderTag) {
472
- firstHeaderElement = element;
473
- return;
474
- }
475
- }
476
- if (firstHeaderElement && !afterFooter && element.tagId === 47) {
477
- if (element.depth - firstHeaderElement.depth <= 5) {
478
- afterFooter = true;
479
- return { skip: true };
480
- }
481
- }
482
- if (!firstHeaderElement) {
483
- if (element.tagId === 1) return;
484
- let current = element.parent;
485
- while (current) {
486
- if (current.tagId === 1) return;
487
- current = current.parent;
488
- }
489
- return { skip: true };
490
- }
491
- if (afterFooter) return { skip: true };
492
- }
493
- if (node.type === 2) {
494
- if (mainElement) {
495
- let current = node.parent;
496
- let isInsideMain = false;
497
- while (current) {
498
- if (current === mainElement) {
499
- isInsideMain = true;
500
- break;
501
- }
502
- current = current.parent;
503
- }
504
- if (!isInsideMain) return { skip: true };
505
- return;
506
- }
507
- if (!firstHeaderElement || afterFooter) {
508
- let current = node.parent;
509
- while (current) {
510
- if (current.tagId === 1) return;
511
- current = current.parent;
512
- }
513
- return { skip: true };
514
- }
515
- }
516
- } });
517
- }
518
- const TAILWIND_TO_MARKDOWN_MAP = {
519
- "font-bold": {
520
- prefix: "**",
521
- suffix: "**"
522
- },
523
- "font-semibold": {
524
- prefix: "**",
525
- suffix: "**"
526
- },
527
- "font-black": {
528
- prefix: "**",
529
- suffix: "**"
530
- },
531
- "font-extrabold": {
532
- prefix: "**",
533
- suffix: "**"
534
- },
535
- "font-medium": {
536
- prefix: "**",
537
- suffix: "**"
538
- },
539
- "font-italic": {
540
- prefix: "*",
541
- suffix: "*"
542
- },
543
- "italic": {
544
- prefix: "*",
545
- suffix: "*"
546
- },
547
- "line-through": {
548
- prefix: "~~",
549
- suffix: "~~"
550
- },
551
- "hidden": { hidden: true },
552
- "invisible": { hidden: true },
553
- "absolute": { hidden: true },
554
- "fixed": { hidden: true },
555
- "sticky": { hidden: true }
556
- };
557
- function extractBaseClass(className) {
558
- for (const bp of [
559
- "sm:",
560
- "md:",
561
- "lg:",
562
- "xl:",
563
- "2xl:"
564
- ]) if (className.startsWith(bp)) return {
565
- baseClass: className.substring(bp.length),
566
- breakpoint: bp
567
- };
568
- return {
569
- baseClass: className,
570
- breakpoint: ""
571
- };
572
- }
573
- function sortByBreakpoint(classes) {
574
- const breakpointOrder = {
575
- "": 0,
576
- "sm:": 1,
577
- "md:": 2,
578
- "lg:": 3,
579
- "xl:": 4,
580
- "2xl:": 5
581
- };
582
- return classes.toSorted((a, b) => {
583
- const aBreakpoint = extractBaseClass(a).breakpoint;
584
- const bBreakpoint = extractBaseClass(b).breakpoint;
585
- return (breakpointOrder[aBreakpoint] || 0) - (breakpointOrder[bBreakpoint] || 0);
586
- });
587
- }
588
- function groupByFormattingType(classes) {
589
- const sorted = sortByBreakpoint(classes);
590
- const groups = {
591
- emphasis: [],
592
- weight: [],
593
- decoration: [],
594
- display: [],
595
- position: [],
596
- other: []
597
- };
598
- for (const cls of sorted) {
599
- const { baseClass } = extractBaseClass(cls);
600
- if (baseClass.includes("italic")) groups.emphasis?.push(cls);
601
- else if (baseClass.includes("font-") || baseClass === "bold") groups.weight?.push(cls);
602
- else if (baseClass.includes("line-through") || baseClass.includes("underline")) groups.decoration?.push(cls);
603
- else if (baseClass === "hidden" || baseClass.includes("invisible")) groups.display?.push(cls);
604
- else if ([
605
- "absolute",
606
- "fixed",
607
- "sticky"
608
- ].includes(baseClass)) groups.position?.push(cls);
609
- else groups.other?.push(cls);
610
- }
611
- return groups;
612
- }
613
- function normalizeClasses(classes) {
614
- const result = [];
615
- const mobileClasses = classes.filter((cls) => !hasBreakpoint(cls));
616
- const breakpointClasses = classes.filter((cls) => hasBreakpoint(cls));
617
- result.push(...mobileClasses);
618
- result.push(...breakpointClasses);
619
- return result;
620
- }
621
- function hasBreakpoint(className) {
622
- const { breakpoint } = extractBaseClass(className);
623
- return breakpoint !== "";
624
- }
625
- function processTailwindClasses(classes) {
626
- let prefix = "";
627
- let suffix = "";
628
- let hidden = false;
629
- const grouped = groupByFormattingType(normalizeClasses(classes));
630
- if (grouped.weight && grouped.weight.length > 0) {
631
- const { baseClass } = extractBaseClass(grouped.weight[0]);
632
- const mapping = TAILWIND_TO_MARKDOWN_MAP[baseClass];
633
- if (mapping) {
634
- if (mapping.prefix) prefix += mapping.prefix;
635
- if (mapping.suffix) suffix = mapping.suffix + suffix;
636
- }
637
- }
638
- if (grouped.emphasis && grouped.emphasis.length > 0) {
639
- const { baseClass } = extractBaseClass(grouped.emphasis[0]);
640
- const mapping = TAILWIND_TO_MARKDOWN_MAP[baseClass];
641
- if (mapping) {
642
- if (mapping.prefix) prefix += mapping.prefix;
643
- if (mapping.suffix) suffix = mapping.suffix + suffix;
644
- }
645
- }
646
- if (grouped.decoration && grouped.decoration.length > 0) {
647
- const { baseClass } = extractBaseClass(grouped.decoration[0]);
648
- const mapping = TAILWIND_TO_MARKDOWN_MAP[baseClass];
649
- if (mapping) {
650
- if (mapping.prefix) prefix += mapping.prefix;
651
- if (mapping.suffix) suffix = mapping.suffix + suffix;
652
- }
653
- }
654
- if (grouped.display) for (const cls of grouped.display) {
655
- const { baseClass } = extractBaseClass(cls);
656
- const mapping = TAILWIND_TO_MARKDOWN_MAP[baseClass];
657
- if (mapping && mapping.hidden) {
658
- hidden = true;
659
- break;
660
- }
661
- }
662
- if (grouped.position) for (const cls of grouped.position) {
663
- const { baseClass } = extractBaseClass(cls);
664
- const mapping = TAILWIND_TO_MARKDOWN_MAP[baseClass];
665
- if (mapping && mapping.hidden) {
666
- hidden = true;
667
- break;
668
- }
669
- }
670
- return {
671
- prefix,
672
- suffix,
673
- hidden
674
- };
675
- }
676
- function tailwindPlugin() {
677
- return createPlugin({
678
- excludesOverflowSubtree(node) {
679
- if (node.parent?.context?.tailwind?.hidden) return true;
680
- const classes = node.attributes?.class?.trim().split(" ").filter(Boolean);
681
- return classes ? processTailwindClasses(classes).hidden : false;
682
- },
683
- processAttributes(node) {
684
- const parentHidden = node.parent?.context?.tailwind?.hidden;
685
- const classAttr = node.attributes?.class;
686
- if (!classAttr && !parentHidden) return;
687
- let prefix = "";
688
- let suffix = "";
689
- let hidden = false;
690
- if (classAttr) {
691
- const result = processTailwindClasses(classAttr.trim().split(" ").filter(Boolean));
692
- prefix = result.prefix;
693
- suffix = result.suffix;
694
- hidden = result.hidden;
695
- }
696
- node.context = node.context || {};
697
- node.context.tailwind = {
698
- prefix,
699
- suffix,
700
- hidden: hidden || !!parentHidden
701
- };
702
- },
703
- processTextNode(node, state) {
704
- const parentNode = node.parent;
705
- if (!parentNode || parentNode.type !== 1) return;
706
- const tailwindData = parentNode.context?.tailwind;
707
- if (tailwindData?.hidden) return {
708
- content: "",
709
- skip: true
710
- };
711
- const prefix = state.options?.format === "text" ? "" : tailwindData?.prefix || "";
712
- const suffix = state.options?.format === "text" ? "" : tailwindData?.suffix || "";
713
- if (prefix || suffix) node.generatedMarkdown = {
714
- prefix,
715
- suffix
716
- };
717
- },
718
- beforeNodeProcess({ node }) {
719
- if (node.type === 1) {
720
- if (node.context?.tailwind?.hidden) return { skip: true };
721
- }
722
- }
723
- });
724
- }
725
- export { createPlugin, extractionCollectorPlugin, extractionPlugin, filterPlugin, frontmatterPlugin, isolateMainPlugin, tailwindPlugin };