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,725 +0,0 @@
1
- /* eslint-disable */
2
- // @ts-nocheck
3
- /* auto-generated by NAPI-RS */
4
-
5
- import { createRequire } from 'module'
6
- const require = createRequire(import.meta.url)
7
-
8
- const { readFileSync } = require('fs')
9
- let nativeBinding = null
10
- // Which artifact actually loaded. The WASI fallback chain overwrites it with
11
- // the flavor it resolved; the late native retry below leaves it alone because
12
- // it only runs while no WASI candidate has been loaded.
13
- let __napiLoadedBindingTarget = 'native'
14
- const loadErrors = []
15
-
16
- const isMusl = () => {
17
- let musl = false
18
- if (process.platform === 'linux') {
19
- musl = isMuslFromFilesystem()
20
- if (musl === null) {
21
- musl = isMuslFromReport()
22
- }
23
- if (musl === null) {
24
- musl = isMuslFromChildProcess()
25
- }
26
- }
27
- return musl
28
- }
29
-
30
- const isFileMusl = (f) => f.includes('libc.musl-') || f.includes('ld-musl-')
31
-
32
- const isMuslFromFilesystem = () => {
33
- try {
34
- return readFileSync('/usr/bin/ldd', 'utf-8').includes('musl')
35
- } catch {
36
- return null
37
- }
38
- }
39
-
40
- const isMuslFromReport = () => {
41
- let report = null
42
- if (process.report && typeof process.report.getReport === 'function') {
43
- process.report.excludeNetwork = true
44
- report = process.report.getReport()
45
- }
46
- if (!report) {
47
- return null
48
- }
49
- if (report.header && report.header.glibcVersionRuntime) {
50
- return false
51
- }
52
- if (Array.isArray(report.sharedObjects)) {
53
- if (report.sharedObjects.some(isFileMusl)) {
54
- return true
55
- }
56
- }
57
- return false
58
- }
59
-
60
- const isMuslFromChildProcess = () => {
61
- try {
62
- return require('child_process').execSync('ldd --version', { encoding: 'utf8' }).includes('musl')
63
- } catch (e) {
64
- // If we reach this case, we don't know if the system is musl or not, so is better to just fallback to false
65
- return false
66
- }
67
- }
68
-
69
- function requireNative() {
70
- if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
71
- try {
72
- const overrideBinding = require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH)
73
- // The override may be a generated WASI loader, which already reports its
74
- // own flavor. Adopt it: `module.exports` aliases this object, so claiming
75
- // 'native' would both misreport the artifact and overwrite the loader's
76
- // marker through the alias.
77
- __napiLoadedBindingTarget =
78
- overrideBinding && typeof overrideBinding.__napiBindingTarget === 'string'
79
- ? overrideBinding.__napiBindingTarget
80
- : 'native'
81
- return overrideBinding
82
- } catch (err) {
83
- loadErrors.push(err)
84
- }
85
- } else if (process.platform === 'android') {
86
- if (process.arch === 'arm64') {
87
- try {
88
- return require('./rust.android-arm64.node')
89
- } catch (e) {
90
- loadErrors.push(e)
91
- }
92
- try {
93
- const binding = require('@mdream/rust-android-arm64')
94
- const bindingPackageVersion = require('@mdream/rust-android-arm64/package.json').version
95
- if (bindingPackageVersion !== '0.17.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
96
- throw new Error(`Native binding package version mismatch, expected 0.17.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
97
- }
98
- return binding
99
- } catch (e) {
100
- loadErrors.push(e)
101
- }
102
- } else if (process.arch === 'arm') {
103
- try {
104
- return require('./rust.android-arm-eabi.node')
105
- } catch (e) {
106
- loadErrors.push(e)
107
- }
108
- try {
109
- const binding = require('@mdream/rust-android-arm-eabi')
110
- const bindingPackageVersion = require('@mdream/rust-android-arm-eabi/package.json').version
111
- if (bindingPackageVersion !== '0.17.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
112
- throw new Error(`Native binding package version mismatch, expected 0.17.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
113
- }
114
- return binding
115
- } catch (e) {
116
- loadErrors.push(e)
117
- }
118
- } else {
119
- loadErrors.push(new Error(`Unsupported architecture on Android ${process.arch}`))
120
- }
121
- } else if (process.platform === 'win32') {
122
- if (process.arch === 'x64') {
123
- if ((process.config && process.config.variables && process.config.variables.shlib_suffix === 'dll.a') || (process.config && process.config.variables && process.config.variables.node_target_type === 'shared_library')) {
124
- try {
125
- return require('./rust.win32-x64-gnu.node')
126
- } catch (e) {
127
- loadErrors.push(e)
128
- }
129
- try {
130
- const binding = require('@mdream/rust-win32-x64-gnu')
131
- const bindingPackageVersion = require('@mdream/rust-win32-x64-gnu/package.json').version
132
- if (bindingPackageVersion !== '0.17.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
133
- throw new Error(`Native binding package version mismatch, expected 0.17.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
134
- }
135
- return binding
136
- } catch (e) {
137
- loadErrors.push(e)
138
- }
139
- } else {
140
- try {
141
- return require('./rust.win32-x64-msvc.node')
142
- } catch (e) {
143
- loadErrors.push(e)
144
- }
145
- try {
146
- const binding = require('@mdream/rust-win32-x64-msvc')
147
- const bindingPackageVersion = require('@mdream/rust-win32-x64-msvc/package.json').version
148
- if (bindingPackageVersion !== '0.17.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
149
- throw new Error(`Native binding package version mismatch, expected 0.17.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
150
- }
151
- return binding
152
- } catch (e) {
153
- loadErrors.push(e)
154
- }
155
- }
156
- } else if (process.arch === 'ia32') {
157
- try {
158
- return require('./rust.win32-ia32-msvc.node')
159
- } catch (e) {
160
- loadErrors.push(e)
161
- }
162
- try {
163
- const binding = require('@mdream/rust-win32-ia32-msvc')
164
- const bindingPackageVersion = require('@mdream/rust-win32-ia32-msvc/package.json').version
165
- if (bindingPackageVersion !== '0.17.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
166
- throw new Error(`Native binding package version mismatch, expected 0.17.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
167
- }
168
- return binding
169
- } catch (e) {
170
- loadErrors.push(e)
171
- }
172
- } else if (process.arch === 'arm64') {
173
- try {
174
- return require('./rust.win32-arm64-msvc.node')
175
- } catch (e) {
176
- loadErrors.push(e)
177
- }
178
- try {
179
- const binding = require('@mdream/rust-win32-arm64-msvc')
180
- const bindingPackageVersion = require('@mdream/rust-win32-arm64-msvc/package.json').version
181
- if (bindingPackageVersion !== '0.17.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
182
- throw new Error(`Native binding package version mismatch, expected 0.17.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
183
- }
184
- return binding
185
- } catch (e) {
186
- loadErrors.push(e)
187
- }
188
- } else {
189
- loadErrors.push(new Error(`Unsupported architecture on Windows: ${process.arch}`))
190
- }
191
- } else if (process.platform === 'darwin') {
192
- try {
193
- return require('./rust.darwin-universal.node')
194
- } catch (e) {
195
- loadErrors.push(e)
196
- }
197
- try {
198
- const binding = require('@mdream/rust-darwin-universal')
199
- const bindingPackageVersion = require('@mdream/rust-darwin-universal/package.json').version
200
- if (bindingPackageVersion !== '0.17.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
201
- throw new Error(`Native binding package version mismatch, expected 0.17.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
202
- }
203
- return binding
204
- } catch (e) {
205
- loadErrors.push(e)
206
- }
207
- if (process.arch === 'x64') {
208
- try {
209
- return require('./rust.darwin-x64.node')
210
- } catch (e) {
211
- loadErrors.push(e)
212
- }
213
- try {
214
- const binding = require('@mdream/rust-darwin-x64')
215
- const bindingPackageVersion = require('@mdream/rust-darwin-x64/package.json').version
216
- if (bindingPackageVersion !== '0.17.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
217
- throw new Error(`Native binding package version mismatch, expected 0.17.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
218
- }
219
- return binding
220
- } catch (e) {
221
- loadErrors.push(e)
222
- }
223
- } else if (process.arch === 'arm64') {
224
- try {
225
- return require('./rust.darwin-arm64.node')
226
- } catch (e) {
227
- loadErrors.push(e)
228
- }
229
- try {
230
- const binding = require('@mdream/rust-darwin-arm64')
231
- const bindingPackageVersion = require('@mdream/rust-darwin-arm64/package.json').version
232
- if (bindingPackageVersion !== '0.17.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
233
- throw new Error(`Native binding package version mismatch, expected 0.17.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
234
- }
235
- return binding
236
- } catch (e) {
237
- loadErrors.push(e)
238
- }
239
- } else {
240
- loadErrors.push(new Error(`Unsupported architecture on macOS: ${process.arch}`))
241
- }
242
- } else if (process.platform === 'freebsd') {
243
- if (process.arch === 'x64') {
244
- try {
245
- return require('./rust.freebsd-x64.node')
246
- } catch (e) {
247
- loadErrors.push(e)
248
- }
249
- try {
250
- const binding = require('@mdream/rust-freebsd-x64')
251
- const bindingPackageVersion = require('@mdream/rust-freebsd-x64/package.json').version
252
- if (bindingPackageVersion !== '0.17.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
253
- throw new Error(`Native binding package version mismatch, expected 0.17.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
254
- }
255
- return binding
256
- } catch (e) {
257
- loadErrors.push(e)
258
- }
259
- } else if (process.arch === 'arm64') {
260
- try {
261
- return require('./rust.freebsd-arm64.node')
262
- } catch (e) {
263
- loadErrors.push(e)
264
- }
265
- try {
266
- const binding = require('@mdream/rust-freebsd-arm64')
267
- const bindingPackageVersion = require('@mdream/rust-freebsd-arm64/package.json').version
268
- if (bindingPackageVersion !== '0.17.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
269
- throw new Error(`Native binding package version mismatch, expected 0.17.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
270
- }
271
- return binding
272
- } catch (e) {
273
- loadErrors.push(e)
274
- }
275
- } else {
276
- loadErrors.push(new Error(`Unsupported architecture on FreeBSD: ${process.arch}`))
277
- }
278
- } else if (process.platform === 'linux') {
279
- if (process.arch === 'x64') {
280
- if (isMusl()) {
281
- try {
282
- return require('./rust.linux-x64-musl.node')
283
- } catch (e) {
284
- loadErrors.push(e)
285
- }
286
- try {
287
- const binding = require('@mdream/rust-linux-x64-musl')
288
- const bindingPackageVersion = require('@mdream/rust-linux-x64-musl/package.json').version
289
- if (bindingPackageVersion !== '0.17.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
290
- throw new Error(`Native binding package version mismatch, expected 0.17.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
291
- }
292
- return binding
293
- } catch (e) {
294
- loadErrors.push(e)
295
- }
296
- } else {
297
- try {
298
- return require('./rust.linux-x64-gnu.node')
299
- } catch (e) {
300
- loadErrors.push(e)
301
- }
302
- try {
303
- const binding = require('@mdream/rust-linux-x64-gnu')
304
- const bindingPackageVersion = require('@mdream/rust-linux-x64-gnu/package.json').version
305
- if (bindingPackageVersion !== '0.17.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
306
- throw new Error(`Native binding package version mismatch, expected 0.17.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
307
- }
308
- return binding
309
- } catch (e) {
310
- loadErrors.push(e)
311
- }
312
- }
313
- } else if (process.arch === 'arm64') {
314
- if (isMusl()) {
315
- try {
316
- return require('./rust.linux-arm64-musl.node')
317
- } catch (e) {
318
- loadErrors.push(e)
319
- }
320
- try {
321
- const binding = require('@mdream/rust-linux-arm64-musl')
322
- const bindingPackageVersion = require('@mdream/rust-linux-arm64-musl/package.json').version
323
- if (bindingPackageVersion !== '0.17.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
324
- throw new Error(`Native binding package version mismatch, expected 0.17.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
325
- }
326
- return binding
327
- } catch (e) {
328
- loadErrors.push(e)
329
- }
330
- } else {
331
- try {
332
- return require('./rust.linux-arm64-gnu.node')
333
- } catch (e) {
334
- loadErrors.push(e)
335
- }
336
- try {
337
- const binding = require('@mdream/rust-linux-arm64-gnu')
338
- const bindingPackageVersion = require('@mdream/rust-linux-arm64-gnu/package.json').version
339
- if (bindingPackageVersion !== '0.17.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
340
- throw new Error(`Native binding package version mismatch, expected 0.17.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
341
- }
342
- return binding
343
- } catch (e) {
344
- loadErrors.push(e)
345
- }
346
- }
347
- } else if (process.arch === 'arm') {
348
- if (isMusl()) {
349
- try {
350
- return require('./rust.linux-arm-musleabihf.node')
351
- } catch (e) {
352
- loadErrors.push(e)
353
- }
354
- try {
355
- const binding = require('@mdream/rust-linux-arm-musleabihf')
356
- const bindingPackageVersion = require('@mdream/rust-linux-arm-musleabihf/package.json').version
357
- if (bindingPackageVersion !== '0.17.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
358
- throw new Error(`Native binding package version mismatch, expected 0.17.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
359
- }
360
- return binding
361
- } catch (e) {
362
- loadErrors.push(e)
363
- }
364
- } else {
365
- try {
366
- return require('./rust.linux-arm-gnueabihf.node')
367
- } catch (e) {
368
- loadErrors.push(e)
369
- }
370
- try {
371
- const binding = require('@mdream/rust-linux-arm-gnueabihf')
372
- const bindingPackageVersion = require('@mdream/rust-linux-arm-gnueabihf/package.json').version
373
- if (bindingPackageVersion !== '0.17.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
374
- throw new Error(`Native binding package version mismatch, expected 0.17.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
375
- }
376
- return binding
377
- } catch (e) {
378
- loadErrors.push(e)
379
- }
380
- }
381
- } else if (process.arch === 'loong64') {
382
- if (isMusl()) {
383
- try {
384
- return require('./rust.linux-loong64-musl.node')
385
- } catch (e) {
386
- loadErrors.push(e)
387
- }
388
- try {
389
- const binding = require('@mdream/rust-linux-loong64-musl')
390
- const bindingPackageVersion = require('@mdream/rust-linux-loong64-musl/package.json').version
391
- if (bindingPackageVersion !== '0.17.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
392
- throw new Error(`Native binding package version mismatch, expected 0.17.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
393
- }
394
- return binding
395
- } catch (e) {
396
- loadErrors.push(e)
397
- }
398
- } else {
399
- try {
400
- return require('./rust.linux-loong64-gnu.node')
401
- } catch (e) {
402
- loadErrors.push(e)
403
- }
404
- try {
405
- const binding = require('@mdream/rust-linux-loong64-gnu')
406
- const bindingPackageVersion = require('@mdream/rust-linux-loong64-gnu/package.json').version
407
- if (bindingPackageVersion !== '0.17.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
408
- throw new Error(`Native binding package version mismatch, expected 0.17.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
409
- }
410
- return binding
411
- } catch (e) {
412
- loadErrors.push(e)
413
- }
414
- }
415
- } else if (process.arch === 'riscv64') {
416
- if (isMusl()) {
417
- try {
418
- return require('./rust.linux-riscv64-musl.node')
419
- } catch (e) {
420
- loadErrors.push(e)
421
- }
422
- try {
423
- const binding = require('@mdream/rust-linux-riscv64-musl')
424
- const bindingPackageVersion = require('@mdream/rust-linux-riscv64-musl/package.json').version
425
- if (bindingPackageVersion !== '0.17.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
426
- throw new Error(`Native binding package version mismatch, expected 0.17.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
427
- }
428
- return binding
429
- } catch (e) {
430
- loadErrors.push(e)
431
- }
432
- } else {
433
- try {
434
- return require('./rust.linux-riscv64-gnu.node')
435
- } catch (e) {
436
- loadErrors.push(e)
437
- }
438
- try {
439
- const binding = require('@mdream/rust-linux-riscv64-gnu')
440
- const bindingPackageVersion = require('@mdream/rust-linux-riscv64-gnu/package.json').version
441
- if (bindingPackageVersion !== '0.17.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
442
- throw new Error(`Native binding package version mismatch, expected 0.17.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
443
- }
444
- return binding
445
- } catch (e) {
446
- loadErrors.push(e)
447
- }
448
- }
449
- } else if (process.arch === 'ppc64') {
450
- try {
451
- return require('./rust.linux-ppc64-gnu.node')
452
- } catch (e) {
453
- loadErrors.push(e)
454
- }
455
- try {
456
- const binding = require('@mdream/rust-linux-ppc64-gnu')
457
- const bindingPackageVersion = require('@mdream/rust-linux-ppc64-gnu/package.json').version
458
- if (bindingPackageVersion !== '0.17.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
459
- throw new Error(`Native binding package version mismatch, expected 0.17.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
460
- }
461
- return binding
462
- } catch (e) {
463
- loadErrors.push(e)
464
- }
465
- } else if (process.arch === 's390x') {
466
- try {
467
- return require('./rust.linux-s390x-gnu.node')
468
- } catch (e) {
469
- loadErrors.push(e)
470
- }
471
- try {
472
- const binding = require('@mdream/rust-linux-s390x-gnu')
473
- const bindingPackageVersion = require('@mdream/rust-linux-s390x-gnu/package.json').version
474
- if (bindingPackageVersion !== '0.17.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
475
- throw new Error(`Native binding package version mismatch, expected 0.17.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
476
- }
477
- return binding
478
- } catch (e) {
479
- loadErrors.push(e)
480
- }
481
- } else {
482
- loadErrors.push(new Error(`Unsupported architecture on Linux: ${process.arch}`))
483
- }
484
- } else if (process.platform === 'openharmony') {
485
- if (process.arch === 'arm64') {
486
- try {
487
- return require('./rust.openharmony-arm64.node')
488
- } catch (e) {
489
- loadErrors.push(e)
490
- }
491
- try {
492
- const binding = require('@mdream/rust-openharmony-arm64')
493
- const bindingPackageVersion = require('@mdream/rust-openharmony-arm64/package.json').version
494
- if (bindingPackageVersion !== '0.17.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
495
- throw new Error(`Native binding package version mismatch, expected 0.17.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
496
- }
497
- return binding
498
- } catch (e) {
499
- loadErrors.push(e)
500
- }
501
- } else if (process.arch === 'x64') {
502
- try {
503
- return require('./rust.openharmony-x64.node')
504
- } catch (e) {
505
- loadErrors.push(e)
506
- }
507
- try {
508
- const binding = require('@mdream/rust-openharmony-x64')
509
- const bindingPackageVersion = require('@mdream/rust-openharmony-x64/package.json').version
510
- if (bindingPackageVersion !== '0.17.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
511
- throw new Error(`Native binding package version mismatch, expected 0.17.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
512
- }
513
- return binding
514
- } catch (e) {
515
- loadErrors.push(e)
516
- }
517
- } else if (process.arch === 'arm') {
518
- try {
519
- return require('./rust.openharmony-arm.node')
520
- } catch (e) {
521
- loadErrors.push(e)
522
- }
523
- try {
524
- const binding = require('@mdream/rust-openharmony-arm')
525
- const bindingPackageVersion = require('@mdream/rust-openharmony-arm/package.json').version
526
- if (bindingPackageVersion !== '0.17.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
527
- throw new Error(`Native binding package version mismatch, expected 0.17.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
528
- }
529
- return binding
530
- } catch (e) {
531
- loadErrors.push(e)
532
- }
533
- } else {
534
- loadErrors.push(new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`))
535
- }
536
- } else {
537
- loadErrors.push(new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`))
538
- }
539
- }
540
-
541
- function createLoadErrorChain(errors) {
542
- return errors.reduce((previous, current) => {
543
- let message
544
- try {
545
- message =
546
- current && typeof current.message === 'string'
547
- ? current.message
548
- : String(current)
549
- } catch {
550
- message = 'Unknown error'
551
- }
552
- const error = new Error(message)
553
- error.cause = previous
554
- return error
555
- }, null)
556
- }
557
-
558
- // NAPI_RS_FORCE_WASI is a tri-state flag:
559
- // unset / any other value → native binding preferred, WASI is only a fallback
560
- // 'true' → prefer WASI, but retain native as a lazy fallback
561
- // 'error' → require WASI without initializing a native fallback
562
- // Treating any non-empty string as truthy (the historical behavior) meant
563
- // NAPI_RS_FORCE_WASI=false, NAPI_RS_FORCE_WASI=0, etc. inadvertently triggered
564
- // the WASI path, causing ENOENT for packages shipped without a .wasi.cjs file.
565
- //
566
- // NAPI_RS_WASI_FLAVOR selects one exact generated flavor and implies strict
567
- // WASI loading. It never crosses into another flavor or falls back to native.
568
- const __napiWasiFlavors = ['wasm32-wasi']
569
- const __napiWasiFlavor = process.env.NAPI_RS_WASI_FLAVOR
570
- const __napiWasiFlavorRequested =
571
- typeof __napiWasiFlavor === 'string' && __napiWasiFlavor.length > 0
572
- if (
573
- __napiWasiFlavorRequested &&
574
- __napiWasiFlavors.indexOf(__napiWasiFlavor) === -1
575
- ) {
576
- throw new Error(
577
- 'Unsupported WASI flavor "' +
578
- __napiWasiFlavor +
579
- '". Available flavors: ' +
580
- __napiWasiFlavors.join(', '),
581
- )
582
- }
583
- const forceWasiError = process.env.NAPI_RS_FORCE_WASI === 'error'
584
- const forceWasi =
585
- process.env.NAPI_RS_FORCE_WASI === 'true' ||
586
- forceWasiError ||
587
- __napiWasiFlavorRequested
588
-
589
- if (!forceWasi) {
590
- nativeBinding = requireNative()
591
- }
592
-
593
- if (!nativeBinding || forceWasi) {
594
- let wasiBinding = null
595
- let wasiBindingLoaded = false
596
- const wasiBindingErrors = []
597
- const __napiWasiResolveCandidate = (specifier, isPackage, localArtifacts) => {
598
- try {
599
- require.resolve(specifier)
600
- } catch (resolveError) {
601
- if (!resolveError || resolveError.code !== 'MODULE_NOT_FOUND') {
602
- throw resolveError
603
- }
604
- if (isPackage) {
605
- try {
606
- require.resolve(specifier + '/package.json')
607
- } catch (packageError) {
608
- if (packageError && packageError.code === 'MODULE_NOT_FOUND') {
609
- return resolveError
610
- }
611
- // An exports restriction proves the package exists even when its
612
- // package.json is not public. Preserve the root resolution failure.
613
- throw resolveError
614
- }
615
- // The package exists but its main/export target is broken.
616
- throw resolveError
617
- }
618
- return resolveError
619
- }
620
- if (localArtifacts) {
621
- let artifactError = null
622
- for (let i = 0; i < localArtifacts.length; i++) {
623
- try {
624
- require.resolve(localArtifacts[i])
625
- return null
626
- } catch (resolveError) {
627
- if (!resolveError || resolveError.code !== 'MODULE_NOT_FOUND') {
628
- throw resolveError
629
- }
630
- artifactError = resolveError
631
- }
632
- }
633
- return artifactError
634
- }
635
- return null
636
- }
637
- if (!wasiBindingLoaded && (!__napiWasiFlavorRequested || __napiWasiFlavor === 'wasm32-wasi')) {
638
- let candidateError = null
639
- let candidateFailed = false
640
- try {
641
- candidateError = __napiWasiResolveCandidate('./rust.wasi.cjs', false, ['./rust.wasm32-wasi.debug.wasm', './rust.wasm32-wasi.wasm'])
642
- candidateFailed = candidateError !== null
643
- if (!candidateFailed) {
644
- wasiBinding = require('./rust.wasi.cjs')
645
- nativeBinding = wasiBinding
646
- __napiLoadedBindingTarget = 'wasm32-wasi'
647
- wasiBindingLoaded = true
648
- }
649
- } catch (err) {
650
- candidateError = err
651
- candidateFailed = true
652
- }
653
- if (candidateFailed) {
654
- wasiBindingErrors.push(candidateError)
655
- loadErrors.push(candidateError)
656
- }
657
- }
658
- if (!wasiBindingLoaded && (!__napiWasiFlavorRequested || __napiWasiFlavor === 'wasm32-wasi')) {
659
- let candidateError = null
660
- let candidateFailed = false
661
- try {
662
- candidateError = __napiWasiResolveCandidate('@mdream/rust-wasm32-wasi', true, undefined)
663
- candidateFailed = candidateError !== null
664
- if (!candidateFailed) {
665
- if (process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
666
- const bindingPackageVersion = require('@mdream/rust-wasm32-wasi/package.json').version
667
- if (bindingPackageVersion !== '0.17.0') {
668
- throw new Error(`WASI binding package version mismatch, expected 0.17.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
669
- }
670
- }
671
- wasiBinding = require('@mdream/rust-wasm32-wasi')
672
- nativeBinding = wasiBinding
673
- __napiLoadedBindingTarget = 'wasm32-wasi'
674
- wasiBindingLoaded = true
675
- }
676
- } catch (err) {
677
- candidateError = err
678
- candidateFailed = true
679
- }
680
- if (candidateFailed) {
681
- wasiBindingErrors.push(candidateError)
682
- loadErrors.push(candidateError)
683
- }
684
- }
685
- if (
686
- !wasiBindingLoaded &&
687
- forceWasi &&
688
- !forceWasiError &&
689
- !__napiWasiFlavorRequested
690
- ) {
691
- nativeBinding = requireNative()
692
- }
693
- if ((forceWasiError || __napiWasiFlavorRequested) && !wasiBindingLoaded) {
694
- const error = new Error(
695
- __napiWasiFlavorRequested
696
- ? 'WASI binding for flavor "' + __napiWasiFlavor + '" not found'
697
- : 'WASI binding not found and NAPI_RS_FORCE_WASI is set to error',
698
- )
699
- error.cause = createLoadErrorChain(wasiBindingErrors)
700
- throw error
701
- }
702
- }
703
-
704
- if (!nativeBinding) {
705
- if (loadErrors.length > 0) {
706
- const error = new Error(
707
- `Cannot find native binding. ` +
708
- `npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). ` +
709
- 'Please try `npm i` again after removing both package-lock.json and node_modules directory.',
710
- )
711
- // assign instead of the `new Error(message, { cause })` options form,
712
- // which Node < 16.9 silently ignores
713
- error.cause = createLoadErrorChain(loadErrors)
714
- throw error
715
- }
716
- throw new Error(`Failed to load native binding`)
717
- }
718
-
719
- const { MarkdownStream, htmlToMarkdown, htmlToMarkdownBytes, htmlToMarkdownChunks, splitMarkdown } = nativeBinding
720
- export { MarkdownStream }
721
- export { htmlToMarkdown }
722
- export { htmlToMarkdownBytes }
723
- export { htmlToMarkdownChunks }
724
- export { splitMarkdown }
725
- export const __napiBindingTarget = __napiLoadedBindingTarget