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,1446 +0,0 @@
1
- //#region src/emnapi/v8.js
2
- function v8 (emnapiPluginCtx) {
3
- const { emnapiCtx, emnapiString } = emnapiPluginCtx;
4
- var mod = (function (exports, emscripten_runtime) {
5
-
6
- //#region src/v8/array.ts
7
- /**
8
- * @__deps $emnapiCtx
9
- * @__sig ppi
10
- */
11
- function _v8_array_new(context, value) {
12
- return emnapiCtx.napiValueFromJsValue(Array(value));
13
- }
14
- /**
15
- * @__deps $emnapiCtx
16
- * @__sig ip
17
- */
18
- function _v8_array_length(array) {
19
- const arr = emnapiCtx.jsValueFromNapiValue(array);
20
- return arr.length;
21
- }
22
-
23
- //#endregion src/v8/array.ts
24
-
25
- //#region src/v8/boolean.ts
26
- /**
27
- * @__deps $emnapiCtx
28
- * @__sig ip
29
- */
30
- function _v8_boolean_value(value) {
31
- const jsValue = emnapiCtx.jsValueFromNapiValue(value);
32
- return jsValue ? 1 : 0;
33
- }
34
- /**
35
- * @__deps $emnapiCtx
36
- * @__sig ppi
37
- */
38
- function _v8_boolean_object_new(isolate, value) {
39
- // eslint-disable-next-line no-new-wrappers
40
- return emnapiCtx.napiValueFromJsValue(new Boolean(value));
41
- }
42
- /**
43
- * @__deps $emnapiCtx
44
- * @__sig ip
45
- */
46
- function _v8_boolean_object_value_of(self) {
47
- const boolObj = emnapiCtx.jsValueFromNapiValue(self);
48
- return boolObj.valueOf() ? 1 : 0;
49
- }
50
-
51
- //#endregion src/v8/boolean.ts
52
-
53
- //#region src/v8/date.ts
54
- /**
55
- * @__deps $emnapiCtx
56
- * @__sig ppd
57
- */
58
- function _v8_date_new(context, value) {
59
- return emnapiCtx.napiValueFromJsValue(new Date(value));
60
- }
61
-
62
- //#endregion src/v8/date.ts
63
-
64
- //#region src/v8/exception.ts
65
- /**
66
- * @__deps $emnapiCtx
67
- * @__sig ppp
68
- */
69
- function _v8_exception_error(message, options) {
70
- return emnapiCtx.napiValueFromJsValue(new Error(emnapiCtx.jsValueFromNapiValue(message),
71
- // @ts-ignore
72
- emnapiCtx.jsValueFromNapiValue(options)));
73
- }
74
- /**
75
- * @__deps $emnapiCtx
76
- * @__sig ppp
77
- */
78
- function _v8_exception_type_error(message, options) {
79
- return emnapiCtx.napiValueFromJsValue(new TypeError(emnapiCtx.jsValueFromNapiValue(message),
80
- // @ts-ignore
81
- emnapiCtx.jsValueFromNapiValue(options)));
82
- }
83
- /**
84
- * @__deps $emnapiCtx
85
- * @__sig ppp
86
- */
87
- function _v8_exception_range_error(message, options) {
88
- return emnapiCtx.napiValueFromJsValue(new RangeError(emnapiCtx.jsValueFromNapiValue(message),
89
- // @ts-ignore
90
- emnapiCtx.jsValueFromNapiValue(options)));
91
- }
92
- /**
93
- * @__deps $emnapiCtx
94
- * @__sig ppp
95
- */
96
- function _v8_exception_reference_error(message, options) {
97
- return emnapiCtx.napiValueFromJsValue(new ReferenceError(emnapiCtx.jsValueFromNapiValue(message),
98
- // @ts-ignore
99
- emnapiCtx.jsValueFromNapiValue(options)));
100
- }
101
- /**
102
- * @__deps $emnapiCtx
103
- * @__sig ppp
104
- */
105
- function _v8_exception_syntax_error(message, options) {
106
- return emnapiCtx.napiValueFromJsValue(new SyntaxError(emnapiCtx.jsValueFromNapiValue(message),
107
- // @ts-ignore
108
- emnapiCtx.jsValueFromNapiValue(options)));
109
- }
110
-
111
- //#endregion src/v8/exception.ts
112
-
113
- //#region src/v8/external.ts
114
- /**
115
- * @__deps $emnapiCtx
116
- * @__sig ppp
117
- */
118
- function _v8_external_new(isolate, data) {
119
- const external = emnapiCtx.isolate.createExternal(data);
120
- return emnapiCtx.napiValueFromJsValue(external);
121
- }
122
- /**
123
- * @__deps $emnapiCtx
124
- * @__sig pp
125
- */
126
- function _v8_external_value(external) {
127
- const obj = emnapiCtx.jsValueFromNapiValue(external);
128
- return emnapiCtx.isolate.getExternalValue(obj);
129
- }
130
-
131
- //#endregion src/v8/external.ts
132
-
133
- //#region src/v8/function.ts
134
- /**
135
- * @__deps $emnapiCtx
136
- * @__sig vpp
137
- */
138
- function _v8_function_set_name(fn, name) {
139
- if (!emnapiCtx.features.setFunctionName) {
140
- return;
141
- }
142
- const str = emnapiCtx.jsValueFromNapiValue(name);
143
- const func = emnapiCtx.jsValueFromNapiValue(fn);
144
- emnapiCtx.features.setFunctionName(func, str);
145
- }
146
- /**
147
- * @__deps $emnapiCtx
148
- * @__sig ppppp
149
- */
150
- function _v8_function_new_instance(fn, ctx, argc, argv) {
151
- if (emnapiCtx.isolate.hasPendingException())
152
- return 1;
153
- const Ctor = emnapiCtx.jsValueFromNapiValue(fn);
154
- argv >>>= 0;
155
- let i;
156
- let ret;
157
- try {
158
- var HEAP_DATA_VIEW = new DataView(emnapiPluginCtx.wasmMemory.buffer), GET_HEAP_DATA_VIEW = () => HEAP_DATA_VIEW.buffer === emnapiPluginCtx.wasmMemory.buffer ? HEAP_DATA_VIEW : (HEAP_DATA_VIEW = new DataView(emnapiPluginCtx.wasmMemory.buffer));
159
- if (emnapiCtx.features.Reflect) {
160
- const argList = Array(argc);
161
- for (i = 0; i < argc; i++) {
162
- const argVal = GET_HEAP_DATA_VIEW().getUint32(argv + i * 4, true);
163
- argList[i] = emnapiCtx.jsValueFromNapiValue(argVal);
164
- }
165
- ret = emnapiCtx.features.Reflect.construct(Ctor, argList, Ctor);
166
- }
167
- else {
168
- const args = Array(argc + 1);
169
- args[0] = undefined;
170
- for (i = 0; i < argc; i++) {
171
- const argVal = GET_HEAP_DATA_VIEW().getUint32(argv + i * 4, true);
172
- args[i + 1] = emnapiCtx.jsValueFromNapiValue(argVal);
173
- }
174
- const BoundCtor = Ctor.bind.apply(Ctor, args);
175
- ret = new BoundCtor();
176
- }
177
- }
178
- catch (err) {
179
- emnapiCtx.isolate.throwException(err);
180
- return 1;
181
- }
182
- return emnapiCtx.napiValueFromJsValue(ret);
183
- }
184
- /**
185
- * @__deps $emnapiCtx
186
- * @__sig ppppip
187
- */
188
- function _v8_function_call(fn, ctx, recv, argc, argv) {
189
- if (emnapiCtx.isolate.hasPendingException())
190
- return 1;
191
- const func = emnapiCtx.jsValueFromNapiValue(fn);
192
- const thisArg = emnapiCtx.jsValueFromNapiValue(recv);
193
- argv >>>= 0;
194
- let i;
195
- let ret;
196
- try {
197
- const argList = Array(argc);
198
- var HEAP_DATA_VIEW = new DataView(emnapiPluginCtx.wasmMemory.buffer), GET_HEAP_DATA_VIEW = () => HEAP_DATA_VIEW.buffer === emnapiPluginCtx.wasmMemory.buffer ? HEAP_DATA_VIEW : (HEAP_DATA_VIEW = new DataView(emnapiPluginCtx.wasmMemory.buffer));
199
- for (i = 0; i < argc; i++) {
200
- const argVal = GET_HEAP_DATA_VIEW().getUint32(argv + i * 4, true);
201
- argList[i] = emnapiCtx.jsValueFromNapiValue(argVal);
202
- }
203
- ret = func.apply(thisArg, argList);
204
- }
205
- catch (err) {
206
- emnapiCtx.isolate.throwException(err);
207
- return 1;
208
- }
209
- return emnapiCtx.napiValueFromJsValue(ret);
210
- }
211
-
212
- //#endregion src/v8/function.ts
213
-
214
- //#region src/v8/handle_scope.ts
215
- /**
216
- * @__deps $emnapiCtx
217
- * @__sig pp
218
- */
219
- function _v8_open_handle_scope(_isolate) {
220
- return emnapiCtx.isolate.openScope().id;
221
- }
222
- /**
223
- * @__deps $emnapiCtx
224
- * @__sig v
225
- */
226
- function _v8_close_handle_scope() {
227
- return emnapiCtx.isolate.closeScope();
228
- }
229
- /**
230
- * @__deps $emnapiCtx
231
- * @__sig ppp
232
- */
233
- function _v8_handle_scope_escape(scope, value) {
234
- const scopeValue = emnapiCtx.getHandleScope(scope);
235
- value >>>= 0;
236
- return scopeValue.escape(value);
237
- }
238
-
239
- //#endregion src/v8/handle_scope.ts
240
-
241
- //#region src/v8/internal.ts
242
- /**
243
- * @__deps $emnapiCtx
244
- * @__sig pp
245
- */
246
- function _v8_local_from_global_reference(ref) {
247
- const reference = emnapiCtx.isolate.getRef(ref);
248
- if (reference === undefined)
249
- return 1;
250
- const id = reference.slot();
251
- return id || 1;
252
- }
253
- /**
254
- * @__deps $emnapiCtx
255
- * @__sig ppp
256
- */
257
- function _v8_globalize_reference(isolate, value) {
258
- const jsValue = emnapiCtx.jsValueFromNapiValue(value);
259
- if (jsValue === undefined)
260
- return 0;
261
- return emnapiCtx.isolate.createReference(jsValue).id;
262
- }
263
- /**
264
- * @__deps $emnapiCtx
265
- * @__sig pp
266
- */
267
- function _v8_copy_global_reference(from) {
268
- const ref = emnapiCtx.isolate.getRef(from);
269
- if (ref === undefined)
270
- return 0;
271
- return ref.copy().id;
272
- }
273
- /**
274
- * @__deps $emnapiCtx
275
- * @__sig vpp
276
- */
277
- function _v8_move_global_reference(from, to) {
278
- const refFrom = emnapiCtx.isolate.getRef(from);
279
- const refTo = emnapiCtx.isolate.getRef(to);
280
- if (refFrom === undefined || refTo === undefined)
281
- return;
282
- refFrom.move(refTo);
283
- }
284
- /**
285
- * @__deps $emnapiCtx
286
- * @__sig vp
287
- */
288
- function _v8_dispose_global(ref) {
289
- emnapiCtx.isolate.removeRef(ref);
290
- }
291
- /**
292
- * @__deps $emnapiCtx
293
- * @__sig vppppi
294
- */
295
- function _v8_make_weak(ref, data, callback, weak_callback, type) {
296
- const refValue = emnapiCtx.isolate.getRef(ref);
297
- if (!refValue)
298
- return;
299
- callback >>>= 0;
300
- refValue.setWeak(data, (data) => {
301
- let field0 = 0;
302
- let field1 = 0;
303
- if (type === 1) {
304
- const id = refValue.slot();
305
- if (id) {
306
- const value = emnapiCtx.jsValueFromNapiValue(id);
307
- field0 = emnapiCtx.isolate.getInternalField(value, 0);
308
- field1 = emnapiCtx.isolate.getInternalField(value, 1);
309
- if ((typeof field0 !== 'number' && typeof field0 !== 'bigint') ||
310
- (typeof field1 !== 'number' && typeof field1 !== 'bigint')) {
311
- throw new Error('Internal field is not a number');
312
- }
313
- }
314
- }
315
- (emnapiPluginCtx.wasmTable.get(callback))(weak_callback, data, type, field0, field1);
316
- });
317
- }
318
- /**
319
- * @__deps $emnapiCtx
320
- * @__sig pp
321
- */
322
- function _v8_clear_weak(ref) {
323
- const refValue = emnapiCtx.isolate.getRef(ref);
324
- if (!refValue)
325
- return 0;
326
- refValue.clearWeak();
327
- return 0;
328
- }
329
-
330
- //#endregion src/v8/internal.ts
331
-
332
- //#region src/v8/isolate.ts
333
- /**
334
- * @__sig p
335
- */
336
- function _v8_isolate_get_current_context() {
337
- return 6 /* Constant.GLOBAL */;
338
- }
339
- /**
340
- * @__deps $emnapiCtx
341
- * @__sig pp
342
- */
343
- function _v8_isolate_throw_exception(error) {
344
- emnapiCtx.isolate.throwException(emnapiCtx.jsValueFromNapiValue(error));
345
- return error;
346
- }
347
-
348
- //#endregion src/v8/isolate.ts
349
-
350
- //#region src/v8/json.ts
351
- /**
352
- * @__deps $emnapiCtx
353
- * @__sig ppp
354
- */
355
- function _v8_json_parse(context, json_string) {
356
- const jsonStringValue = emnapiCtx.jsValueFromNapiValue(json_string);
357
- try {
358
- const parsedValue = JSON.parse(jsonStringValue);
359
- return emnapiCtx.napiValueFromJsValue(parsedValue);
360
- }
361
- catch (e) {
362
- emnapiCtx.isolate.throwException(e);
363
- return 0;
364
- }
365
- }
366
- /**
367
- * @__deps $emnapiCtx
368
- * @__sig pppp
369
- */
370
- function _v8_json_stringify(context, json_object, gap) {
371
- const jsonStringValue = emnapiCtx.jsValueFromNapiValue(json_object);
372
- try {
373
- const str = JSON.stringify(jsonStringValue, null, emnapiCtx.jsValueFromNapiValue(gap));
374
- return emnapiCtx.napiValueFromJsValue(str);
375
- }
376
- catch (e) {
377
- emnapiCtx.isolate.throwException(e);
378
- return 0;
379
- }
380
- }
381
-
382
- //#endregion src/v8/json.ts
383
-
384
- //#region src/v8/number.ts
385
- /**
386
- * @__deps $emnapiCtx
387
- * @__sig dp
388
- */
389
- function _v8_number_value(value) {
390
- const jsValue = emnapiCtx.jsValueFromNapiValue(value);
391
- return Number(jsValue);
392
- }
393
- /**
394
- * @__deps $emnapiCtx
395
- * @__sig vpp
396
- */
397
- function _v8_integer_value(value, out) {
398
- const jsValue = emnapiCtx.jsValueFromNapiValue(value);
399
- // Use BigInt if available, else fallback to Number
400
- let v;
401
- if (typeof jsValue === 'bigint') {
402
- v = jsValue;
403
- }
404
- else {
405
- v = Math.trunc(Number(jsValue));
406
- }
407
- out >>>= 0;
408
- var HEAP_DATA_VIEW = new DataView(emnapiPluginCtx.wasmMemory.buffer), GET_HEAP_DATA_VIEW = () => HEAP_DATA_VIEW.buffer === emnapiPluginCtx.wasmMemory.buffer ? HEAP_DATA_VIEW : (HEAP_DATA_VIEW = new DataView(emnapiPluginCtx.wasmMemory.buffer));
409
- GET_HEAP_DATA_VIEW().setBigInt64(out, BigInt(v), true);
410
- }
411
- /**
412
- * @__deps $emnapiCtx
413
- * @__sig ip
414
- */
415
- function _v8_uint32_value(value) {
416
- const jsValue = emnapiCtx.jsValueFromNapiValue(value);
417
- return Number(jsValue) >>> 0;
418
- }
419
- /**
420
- * @__deps $emnapiCtx
421
- * @__sig ip
422
- */
423
- function _v8_int32_value(value) {
424
- const jsValue = emnapiCtx.jsValueFromNapiValue(value);
425
- return Number(jsValue) | 0;
426
- }
427
- /**
428
- * @__deps $emnapiCtx
429
- * @__sig ppd
430
- */
431
- function _v8_number_new(isolate, value) {
432
- return emnapiCtx.napiValueFromJsValue(value);
433
- }
434
- /**
435
- * @__deps $emnapiCtx
436
- * @__sig ppi
437
- */
438
- function _v8_integer_new(isolate, value) {
439
- return emnapiCtx.napiValueFromJsValue(value | 0);
440
- }
441
- /**
442
- * @__deps $emnapiCtx
443
- * @__sig ppi
444
- */
445
- function _v8_integer_new_from_unsigned(isolate, value) {
446
- return emnapiCtx.napiValueFromJsValue(value >>> 0);
447
- }
448
- /**
449
- * @__deps $emnapiCtx
450
- * @__sig ppd
451
- */
452
- function _v8_number_object_new(isolate, value) {
453
- // eslint-disable-next-line no-new-wrappers
454
- return emnapiCtx.napiValueFromJsValue(new Number(value));
455
- }
456
-
457
- //#endregion src/v8/number.ts
458
-
459
- //#region src/v8/object.ts
460
- /**
461
- * @__deps $emnapiCtx
462
- * @__sig ippppp
463
- */
464
- function _v8_object_set(obj, context, key, value, success) {
465
- let r = false;
466
- try {
467
- r = Reflect.set(emnapiCtx.jsValueFromNapiValue(obj), emnapiCtx.jsValueFromNapiValue(key), emnapiCtx.jsValueFromNapiValue(value));
468
- }
469
- catch (_) {
470
- return 10;
471
- }
472
- success >>>= 0;
473
- if (success) {
474
- const v = r ? 1 : 0;
475
- var HEAP_DATA_VIEW = new DataView(emnapiPluginCtx.wasmMemory.buffer), GET_HEAP_DATA_VIEW = () => HEAP_DATA_VIEW.buffer === emnapiPluginCtx.wasmMemory.buffer ? HEAP_DATA_VIEW : (HEAP_DATA_VIEW = new DataView(emnapiPluginCtx.wasmMemory.buffer));
476
- GET_HEAP_DATA_VIEW().setInt32(success, v, true);
477
- }
478
- return 0;
479
- }
480
- /**
481
- * @__deps $emnapiCtx
482
- * @__sig ip
483
- */
484
- function _v8_object_internal_field_count(obj) {
485
- const objValue = emnapiCtx.jsValueFromNapiValue(obj);
486
- return emnapiCtx.isolate.getInternalFieldCount(objValue);
487
- }
488
- /**
489
- * @__deps $emnapiCtx
490
- * @__sig vpip
491
- */
492
- function _v8_object_set_internal_field(obj, index, data) {
493
- const objValue = emnapiCtx.jsValueFromNapiValue(obj);
494
- const dataValue = emnapiCtx.jsValueFromNapiValue(data);
495
- emnapiCtx.isolate.setInternalField(objValue, index, dataValue);
496
- }
497
- /**
498
- * @__deps $emnapiCtx
499
- * @__sig vpip
500
- */
501
- function _v8_object_set_aligned_pointer_in_internal_field(obj, index, data) {
502
- const objValue = emnapiCtx.jsValueFromNapiValue(obj);
503
- emnapiCtx.isolate.setInternalField(objValue, index, data);
504
- }
505
- /**
506
- * @__deps $emnapiCtx
507
- * @__sig pip
508
- */
509
- function _v8_object_get_internal_field(obj, index) {
510
- const objValue = emnapiCtx.jsValueFromNapiValue(obj);
511
- return emnapiCtx.isolate.napiValueFromJsValue(emnapiCtx.isolate.getInternalField(objValue, index));
512
- }
513
- /**
514
- * @__deps $emnapiCtx
515
- * @__sig pip
516
- */
517
- function _v8_object_get_aligned_pointer_in_internal_field(obj, index) {
518
- const objValue = emnapiCtx.jsValueFromNapiValue(obj);
519
- return emnapiCtx.isolate.getInternalField(objValue, index);
520
- }
521
- /**
522
- * @__deps $emnapiCtx
523
- * @__sig pppp
524
- */
525
- function _v8_object_get_key(obj, context, key) {
526
- const objValue = emnapiCtx.jsValueFromNapiValue(obj);
527
- if (!objValue)
528
- return 1;
529
- return emnapiCtx.napiValueFromJsValue(objValue[emnapiCtx.jsValueFromNapiValue(key)]);
530
- }
531
- /**
532
- * @__deps $emnapiCtx
533
- * @__sig pppi
534
- */
535
- function _v8_object_get_index(obj, context, index) {
536
- const objValue = emnapiCtx.jsValueFromNapiValue(obj);
537
- if (!objValue)
538
- return 1;
539
- return emnapiCtx.napiValueFromJsValue(objValue[index >>> 0]);
540
- }
541
- /**
542
- * @__deps $emnapiCtx
543
- * @__sig ppp
544
- */
545
- function _v8_private_for_api(isolate, name) {
546
- const n = emnapiCtx.isolate.getOrCreateGlobalPrivate(emnapiCtx.jsValueFromNapiValue(name));
547
- return emnapiCtx.napiValueFromJsValue(n);
548
- }
549
- /**
550
- * @__deps $emnapiCtx
551
- * @__sig ippppp
552
- */
553
- function _v8_object_set_private(obj, context, key, value, success) {
554
- if (emnapiCtx.isolate.hasPendingException())
555
- return 1;
556
- const o = emnapiCtx.jsValueFromNapiValue(obj);
557
- const k = emnapiCtx.jsValueFromNapiValue(key);
558
- const v = emnapiCtx.jsValueFromNapiValue(value);
559
- try {
560
- emnapiCtx.isolate.setPrivate(o, k, v);
561
- }
562
- catch (err) {
563
- emnapiCtx.isolate.throwException(err);
564
- return 1;
565
- }
566
- success >>>= 0;
567
- if (success) {
568
- const vv = 1;
569
- var HEAP_DATA_VIEW = new DataView(emnapiPluginCtx.wasmMemory.buffer), GET_HEAP_DATA_VIEW = () => HEAP_DATA_VIEW.buffer === emnapiPluginCtx.wasmMemory.buffer ? HEAP_DATA_VIEW : (HEAP_DATA_VIEW = new DataView(emnapiPluginCtx.wasmMemory.buffer));
570
- GET_HEAP_DATA_VIEW().setInt32(success, vv, true);
571
- }
572
- return 0;
573
- }
574
- /**
575
- * @__deps $emnapiCtx
576
- * @__sig ipppp
577
- */
578
- function _v8_object_has_private(obj, context, key, has) {
579
- if (emnapiCtx.isolate.hasPendingException())
580
- return 1;
581
- const o = emnapiCtx.jsValueFromNapiValue(obj);
582
- const k = emnapiCtx.jsValueFromNapiValue(key);
583
- let v;
584
- try {
585
- v = emnapiCtx.isolate.hasPrivate(o, k) ? 1 : 0;
586
- }
587
- catch (err) {
588
- emnapiCtx.isolate.throwException(err);
589
- return 1;
590
- }
591
- has >>>= 0;
592
- if (has) {
593
- var HEAP_DATA_VIEW = new DataView(emnapiPluginCtx.wasmMemory.buffer), GET_HEAP_DATA_VIEW = () => HEAP_DATA_VIEW.buffer === emnapiPluginCtx.wasmMemory.buffer ? HEAP_DATA_VIEW : (HEAP_DATA_VIEW = new DataView(emnapiPluginCtx.wasmMemory.buffer));
594
- GET_HEAP_DATA_VIEW().setInt32(has, v, true);
595
- }
596
- return 0;
597
- }
598
- /**
599
- * @__deps $emnapiCtx
600
- * @__sig pppp
601
- */
602
- function _v8_object_get_private(obj, context, key) {
603
- if (emnapiCtx.isolate.hasPendingException())
604
- return 1;
605
- const o = emnapiCtx.jsValueFromNapiValue(obj);
606
- const k = emnapiCtx.jsValueFromNapiValue(key);
607
- try {
608
- const v = emnapiCtx.isolate.getPrivate(o, k);
609
- return emnapiCtx.napiValueFromJsValue(v);
610
- }
611
- catch (err) {
612
- emnapiCtx.isolate.throwException(err);
613
- return 1;
614
- }
615
- }
616
- /**
617
- * @__deps $emnapiCtx
618
- * @__sig ipppp
619
- */
620
- function _v8_object_delete_private(obj, context, key, success) {
621
- if (emnapiCtx.isolate.hasPendingException())
622
- return 1;
623
- const o = emnapiCtx.jsValueFromNapiValue(obj);
624
- const k = emnapiCtx.jsValueFromNapiValue(key);
625
- let r;
626
- try {
627
- r = emnapiCtx.isolate.deletePrivate(o, k);
628
- }
629
- catch (err) {
630
- emnapiCtx.isolate.throwException(err);
631
- return 1;
632
- }
633
- success >>>= 0;
634
- if (success) {
635
- const vv = r ? 1 : 0;
636
- var HEAP_DATA_VIEW = new DataView(emnapiPluginCtx.wasmMemory.buffer), GET_HEAP_DATA_VIEW = () => HEAP_DATA_VIEW.buffer === emnapiPluginCtx.wasmMemory.buffer ? HEAP_DATA_VIEW : (HEAP_DATA_VIEW = new DataView(emnapiPluginCtx.wasmMemory.buffer));
637
- GET_HEAP_DATA_VIEW().setInt32(success, vv, true);
638
- }
639
- return 0;
640
- }
641
- /**
642
- * @__deps $emnapiCtx
643
- * @__sig pp
644
- */
645
- function _v8_object_new(isolate) {
646
- return emnapiCtx.napiValueFromJsValue({});
647
- }
648
-
649
- //#endregion src/v8/object.ts
650
-
651
- //#region src/v8/script.ts
652
- /**
653
- * @__deps $emnapiCtx
654
- * @__sig pppii
655
- */
656
- function _v8_script_compiler_compile_unbound_script(isolate, sourceString, options, reason) {
657
- const str = emnapiCtx.jsValueFromNapiValue(sourceString);
658
- if (!str)
659
- return 1;
660
- return emnapiCtx.napiValueFromJsValue(str);
661
- }
662
- /**
663
- * @__deps $emnapiCtx
664
- * @__sig pp
665
- */
666
- function _v8_unbound_script_bind_to_current_context(unboundScript) {
667
- const str = emnapiCtx.jsValueFromNapiValue(unboundScript);
668
- if (!str)
669
- return 1;
670
- return emnapiCtx.napiValueFromJsValue(str);
671
- }
672
- /**
673
- * @__deps $emnapiCtx
674
- * @__sig ppp
675
- */
676
- function _v8_script_run(script, context) {
677
- if (emnapiCtx.isolate.hasPendingException())
678
- return 1;
679
- const str = emnapiCtx.jsValueFromNapiValue(script);
680
- const g = emnapiCtx.jsValueFromNapiValue(context);
681
- let ret;
682
- try {
683
- ret = g.eval(str);
684
- }
685
- catch (err) {
686
- emnapiCtx.isolate.throwException(err);
687
- return 1;
688
- }
689
- return emnapiCtx.napiValueFromJsValue(ret);
690
- }
691
-
692
- //#endregion src/v8/script.ts
693
-
694
- //#region src/v8/string.ts
695
- /**
696
- * @__deps $emnapiCtx
697
- * @__deps $emnapiString
698
- * @__sig pppii
699
- */
700
- function _v8_string_new_from_utf8(isolate, data, type, length) {
701
- data >>>= 0;
702
- length >>>= 0;
703
- const str = emnapiString.UTF8ToString(data, length);
704
- return emnapiCtx.napiValueFromJsValue(str);
705
- }
706
- /**
707
- * @__deps $emnapiCtx
708
- * @__sig ppp
709
- */
710
- function _v8_string_object_new(isolate, value) {
711
- // eslint-disable-next-line no-new-wrappers
712
- return emnapiCtx.napiValueFromJsValue(new String(emnapiCtx.jsValueFromNapiValue(value)));
713
- }
714
- /**
715
- * @__deps $emnapiCtx
716
- * @__sig pp
717
- */
718
- function _v8_string_object_value_of(self) {
719
- const strObj = emnapiCtx.jsValueFromNapiValue(self);
720
- return emnapiCtx.napiValueFromJsValue(strObj.valueOf());
721
- }
722
- /**
723
- * @__deps $emnapiCtx
724
- * @__deps $emnapiString
725
- * @__sig pppii
726
- */
727
- function _v8_string_new_from_one_byte(isolate, data, type, length) {
728
- data >>>= 0;
729
- length >>>= 0;
730
- const str = emnapiString.encode(data, length === -1 || length === 4294967295, length >>> 0, (c) => String.fromCharCode(c));
731
- return emnapiCtx.napiValueFromJsValue(str);
732
- }
733
- /**
734
- * @__deps $emnapiCtx
735
- * @__deps $emnapiString
736
- * @__sig pppii
737
- */
738
- function _v8_string_new_from_two_byte(isolate, data, type, length) {
739
- data >>>= 0;
740
- length >>>= 0;
741
- const str = emnapiString.UTF16ToString(data, length);
742
- return emnapiCtx.napiValueFromJsValue(str);
743
- }
744
- /**
745
- * @__deps $emnapiCtx
746
- * @__deps $emnapiString
747
- * @__sig pppi
748
- */
749
- function _v8_string_new_external_one_byte(isolate, data, length) {
750
- data >>>= 0;
751
- length >>>= 0;
752
- const str = emnapiString.encode(data, length === -1 || length === 4294967295, length >>> 0, (c) => String.fromCharCode(c));
753
- return emnapiCtx.napiValueFromJsValue(str);
754
- }
755
- /**
756
- * @__deps $emnapiCtx
757
- * @__deps $emnapiString
758
- * @__sig pppi
759
- */
760
- function _v8_string_new_external_two_byte(isolate, data, length) {
761
- data >>>= 0;
762
- length >>>= 0;
763
- const str = emnapiString.UTF16ToString(data, length);
764
- return emnapiCtx.napiValueFromJsValue(str);
765
- }
766
- /**
767
- * @__deps $emnapiCtx
768
- * @__sig pppi
769
- */
770
- function _v8_regex_new(context, pattern, flags) {
771
- pattern >>>= 0;
772
- const str = emnapiCtx.jsValueFromNapiValue(pattern);
773
- let f = '';
774
- if (flags & 1)
775
- f += 'g';
776
- if (flags & 2)
777
- f += 'i';
778
- if (flags & 4)
779
- f += 'm';
780
- if (flags & 8)
781
- f += 'y';
782
- if (flags & 16)
783
- f += 'u';
784
- if (flags & 32)
785
- f += 's';
786
- return emnapiCtx.napiValueFromJsValue(f ? new RegExp(str, f) : new RegExp(str));
787
- }
788
- /**
789
- * @__deps $emnapiCtx
790
- * @__deps $emnapiString
791
- * @__sig ipp
792
- */
793
- function _v8_string_utf8_length(str, isolate) {
794
- const jsValue = emnapiCtx.jsValueFromNapiValue(str);
795
- if (jsValue === undefined)
796
- return 0;
797
- if (typeof jsValue !== 'string')
798
- return 0;
799
- return emnapiString.lengthBytesUTF8(jsValue);
800
- }
801
- /**
802
- * @__deps $emnapiCtx
803
- * @__sig ip
804
- */
805
- function _v8_string_length(str) {
806
- const jsValue = emnapiCtx.jsValueFromNapiValue(str);
807
- if (jsValue === undefined)
808
- return 0;
809
- if (typeof jsValue !== 'string')
810
- return 0;
811
- return jsValue.length;
812
- }
813
- /**
814
- * @__deps $emnapiCtx
815
- * @__deps $emnapiString
816
- * @__sig ipppipi
817
- */
818
- function _v8_string_write_utf8(str, isolate, buffer, length, nchars_ref, options) {
819
- buffer >>>= 0;
820
- nchars_ref >>>= 0;
821
- const jsValue = emnapiCtx.jsValueFromNapiValue(str);
822
- var HEAP_DATA_VIEW = new DataView(emnapiPluginCtx.wasmMemory.buffer), GET_HEAP_DATA_VIEW = () => HEAP_DATA_VIEW.buffer === emnapiPluginCtx.wasmMemory.buffer ? HEAP_DATA_VIEW : (HEAP_DATA_VIEW = new DataView(emnapiPluginCtx.wasmMemory.buffer));
823
- if (jsValue === undefined || typeof jsValue !== 'string') {
824
- if (nchars_ref) {
825
- GET_HEAP_DATA_VIEW().setInt32(nchars_ref, 0, true);
826
- }
827
- return 0;
828
- }
829
- const written = emnapiString.stringToUTF8(jsValue, buffer, length);
830
- if (nchars_ref) {
831
- GET_HEAP_DATA_VIEW().setInt32(nchars_ref, written, true);
832
- }
833
- return written;
834
- }
835
-
836
- //#endregion src/v8/string.ts
837
-
838
- //#region src/v8/template.ts
839
- /**
840
- * @__deps $emnapiCtx
841
- * @__sig ippppp
842
- */
843
- function _v8_get_cb_info(cbinfo, argc, argv, this_arg, data) {
844
- if (!cbinfo)
845
- return 1;
846
- const cbinfoValue = emnapiCtx.getCallbackInfo(cbinfo);
847
- argc >>>= 0;
848
- argv >>>= 0;
849
- var HEAP_DATA_VIEW = new DataView(emnapiPluginCtx.wasmMemory.buffer), GET_HEAP_DATA_VIEW = () => HEAP_DATA_VIEW.buffer === emnapiPluginCtx.wasmMemory.buffer ? HEAP_DATA_VIEW : (HEAP_DATA_VIEW = new DataView(emnapiPluginCtx.wasmMemory.buffer));
850
- if (argv) {
851
- if (!argc)
852
- return 1;
853
- let argcValue = GET_HEAP_DATA_VIEW().getUint32(argc, true);
854
- argcValue >>>= 0;
855
- const len = cbinfoValue.args.length;
856
- const arrlen = argcValue < len ? argcValue : len;
857
- let i = 0;
858
- for (; i < arrlen; i++) {
859
- const argVal = emnapiCtx.napiValueFromJsValue(cbinfoValue.args[i]);
860
- GET_HEAP_DATA_VIEW().setUint32(argv + i * 4, argVal, true);
861
- }
862
- if (i < argcValue) {
863
- for (; i < argcValue; i++) {
864
- GET_HEAP_DATA_VIEW().setUint32(argv + i * 4, 1, true);
865
- }
866
- }
867
- }
868
- if (argc) {
869
- GET_HEAP_DATA_VIEW().setUint32(argc, cbinfoValue.args.length, true);
870
- }
871
- if (this_arg) {
872
- this_arg >>>= 0;
873
- const v = emnapiCtx.napiValueFromJsValue(cbinfoValue.thiz);
874
- GET_HEAP_DATA_VIEW().setUint32(this_arg, v, true);
875
- }
876
- if (data) {
877
- data >>>= 0;
878
- const localData = emnapiCtx.napiValueFromJsValue(cbinfoValue.data);
879
- GET_HEAP_DATA_VIEW().setUint32(data, localData, true);
880
- }
881
- return 0;
882
- }
883
- /**
884
- * @__deps $emnapiCtx
885
- * @__sig ppppppiiipiii
886
- */
887
- function _v8_function_template_new(isolate, callback, cb, data, signature, length, behavior, side_effect_type, c_function, instance_type, allowed_receiver_instance_type_range_start, allowed_receiver_instance_type_range_end) {
888
- const jsCb = (emnapiPluginCtx.wasmTable.get(callback));
889
- const tpl = emnapiCtx.isolate.createFunctionTemplate(jsCb, cb, emnapiCtx.jsValueFromNapiValue(data), emnapiCtx.jsValueFromNapiValue(signature));
890
- return emnapiCtx.napiValueFromJsValue(tpl);
891
- }
892
- /**
893
- * @__deps $emnapiCtx
894
- * @__sig pppppiii
895
- */
896
- function _v8_function_new(context, callback, cb, data, length, behavior, side_effect_type) {
897
- const jsCb = (emnapiPluginCtx.wasmTable.get(callback));
898
- const tpl = emnapiCtx.isolate.createFunctionTemplate(jsCb, cb, emnapiCtx.jsValueFromNapiValue(data), undefined);
899
- const func = tpl.getFunction();
900
- return emnapiCtx.napiValueFromJsValue(func);
901
- }
902
- /**
903
- * @__deps $emnapiCtx
904
- * @__sig pp
905
- */
906
- function _v8_cbinfo_holder(info) {
907
- const cbinfoValue = emnapiCtx.getCallbackInfo(info);
908
- const { holder } = cbinfoValue;
909
- return emnapiCtx.napiValueFromJsValue(holder);
910
- }
911
- /**
912
- * @__deps $emnapiCtx
913
- * @__sig pp
914
- */
915
- function _v8_cbinfo_new_target(info) {
916
- const cbinfoValue = emnapiCtx.getCallbackInfo(info);
917
- const { thiz, fn } = cbinfoValue;
918
- const value = thiz == null || thiz.constructor == null
919
- ? 0
920
- : thiz instanceof fn
921
- ? emnapiCtx.napiValueFromJsValue(thiz.constructor)
922
- : 0;
923
- return value;
924
- }
925
- /**
926
- * @__deps $emnapiCtx
927
- * @__sig ppp
928
- */
929
- function _v8_function_template_get_function(template, context) {
930
- const tpl = emnapiCtx.jsValueFromNapiValue(template);
931
- if (!tpl)
932
- return 0;
933
- return emnapiCtx.napiValueFromJsValue(tpl.getFunction());
934
- }
935
- function _v8_function_template_set_class_name(template, name) {
936
- const tpl = emnapiCtx.jsValueFromNapiValue(template);
937
- const nameValue = emnapiCtx.jsValueFromNapiValue(name);
938
- if (!tpl || nameValue == null)
939
- return;
940
- tpl.setClassName(nameValue);
941
- }
942
- /**
943
- * @__deps $emnapiCtx
944
- * @__sig ppp
945
- */
946
- function _v8_object_template_new(isolate, constructor) {
947
- const tpl = emnapiCtx.isolate.createObjectTemplate(emnapiCtx.jsValueFromNapiValue(constructor));
948
- return emnapiCtx.napiValueFromJsValue(tpl);
949
- }
950
- /**
951
- * @__deps $emnapiCtx
952
- * @__sig vpi
953
- */
954
- function _v8_object_template_set_internal_field_count(tpl, value) {
955
- const templateObject = emnapiCtx.jsValueFromNapiValue(tpl);
956
- templateObject.setInternalFieldCount(value);
957
- }
958
- /**
959
- * @__deps $emnapiCtx
960
- * @__sig ppp
961
- */
962
- function _v8_object_template_new_instance(obj_tpl, context) {
963
- if (emnapiCtx.isolate.hasPendingException())
964
- return 1;
965
- const objTemplate = emnapiCtx.jsValueFromNapiValue(obj_tpl);
966
- return emnapiCtx.napiValueFromJsValue(objTemplate.newInstance(context));
967
- }
968
- /**
969
- * @__deps $emnapiCtx
970
- * @__sig ppp
971
- */
972
- function _v8_signature_new(isolate, receiver) {
973
- const rcv = emnapiCtx.jsValueFromNapiValue(receiver);
974
- const sig = emnapiCtx.isolate.createSignature(rcv);
975
- return emnapiCtx.napiValueFromJsValue(sig);
976
- }
977
- /**
978
- * @__deps $emnapiCtx
979
- * @__sig vpppi
980
- */
981
- function _v8_template_set(tpl, name, value, attr) {
982
- const templateObject = emnapiCtx.jsValueFromNapiValue(tpl);
983
- if (!templateObject)
984
- return;
985
- const nameValue = emnapiCtx.jsValueFromNapiValue(name);
986
- const valueValue = emnapiCtx.jsValueFromNapiValue(value);
987
- if (nameValue == null)
988
- return;
989
- templateObject.set(nameValue, valueValue, attr);
990
- }
991
- /**
992
- * @__deps $emnapiCtx
993
- * @__sig pp
994
- */
995
- function _v8_function_template_instance_template(tpl) {
996
- const templateObject = emnapiCtx.jsValueFromNapiValue(tpl);
997
- if (!templateObject)
998
- return 1;
999
- return emnapiCtx.napiValueFromJsValue(templateObject.instanceTemplate());
1000
- }
1001
- /**
1002
- * @__deps $emnapiCtx
1003
- * @__sig pp
1004
- */
1005
- function _v8_function_template_prototype_template(tpl) {
1006
- const templateObject = emnapiCtx.jsValueFromNapiValue(tpl);
1007
- if (!templateObject)
1008
- return 1;
1009
- return emnapiCtx.napiValueFromJsValue(templateObject.prototypeTemplate());
1010
- }
1011
- /**
1012
- * @__deps $emnapiCtx
1013
- * @__sig vpp
1014
- */
1015
- function _v8_get_property_cb_info(cbinfo, args) {
1016
- if (!cbinfo)
1017
- return;
1018
- const cbinfoValue = emnapiCtx.getCallbackInfo(cbinfo);
1019
- args >>>= 0;
1020
- const thiz = emnapiCtx.napiValueFromJsValue(cbinfoValue.thiz);
1021
- const holder = emnapiCtx.napiValueFromJsValue(cbinfoValue.holder);
1022
- var HEAP_DATA_VIEW = new DataView(emnapiPluginCtx.wasmMemory.buffer), GET_HEAP_DATA_VIEW = () => HEAP_DATA_VIEW.buffer === emnapiPluginCtx.wasmMemory.buffer ? HEAP_DATA_VIEW : (HEAP_DATA_VIEW = new DataView(emnapiPluginCtx.wasmMemory.buffer));
1023
- GET_HEAP_DATA_VIEW().setUint32(args + 1 * 4, holder, true);
1024
- GET_HEAP_DATA_VIEW().setUint32(args + 6 * 4, thiz, true);
1025
- const localData = emnapiCtx.napiValueFromJsValue(cbinfoValue.data);
1026
- GET_HEAP_DATA_VIEW().setUint32(args + 5 * 4, localData, true);
1027
- }
1028
- /**
1029
- * @__deps $emnapiCtx
1030
- * @__sig vpppppppiii
1031
- */
1032
- function _v8_object_template_set_accessor(tpl, name, getter_wrap, setter_wrap, getter, setter, data, attribute, getter_side_effect_type, setter_side_effect_type) {
1033
- const templateObject = emnapiCtx.jsValueFromNapiValue(tpl);
1034
- if (!templateObject)
1035
- return;
1036
- const nameValue = emnapiCtx.jsValueFromNapiValue(name);
1037
- getter_wrap >>>= 0;
1038
- setter_wrap >>>= 0;
1039
- const getterWrap = (emnapiPluginCtx.wasmTable.get(getter_wrap));
1040
- const setterWrap = (emnapiPluginCtx.wasmTable.get(setter_wrap));
1041
- templateObject.setAccessor(nameValue, getterWrap, setterWrap, getter, setter, emnapiCtx.jsValueFromNapiValue(data), attribute, getter_side_effect_type, setter_side_effect_type);
1042
- }
1043
-
1044
- //#endregion src/v8/template.ts
1045
-
1046
- //#region src/v8/try_catch.ts
1047
- /**
1048
- * @__deps $emnapiCtx
1049
- * @__sig vp
1050
- */
1051
- function _v8_trycatch_construct(tc) {
1052
- emnapiCtx.isolate.pushTryCatch(tc);
1053
- }
1054
- /**
1055
- * @__deps $emnapiCtx
1056
- * @__sig vp
1057
- */
1058
- function _v8_trycatch_destruct(tc) {
1059
- emnapiCtx.isolate.popTryCatch(tc);
1060
- }
1061
- /**
1062
- * @__deps $emnapiCtx
1063
- * @__sig ip
1064
- */
1065
- function _v8_trycatch_has_caught(tc) {
1066
- const tryCatch = emnapiCtx.isolate.getTryCatch(tc);
1067
- if (!tryCatch)
1068
- return 0;
1069
- return Number(tryCatch.hasCaught());
1070
- }
1071
- /**
1072
- * @__deps $emnapiCtx
1073
- * @__sig pp
1074
- */
1075
- function _v8_trycatch_rethrow(tc) {
1076
- const tryCatch = emnapiCtx.isolate.getTryCatch(tc);
1077
- if (!tryCatch)
1078
- return 1;
1079
- const e = tryCatch.rethrow(emnapiCtx.isolate);
1080
- if (e === undefined)
1081
- return 1;
1082
- return emnapiCtx.napiValueFromJsValue(e);
1083
- }
1084
- /**
1085
- * @__deps $emnapiCtx
1086
- * @__sig pp
1087
- */
1088
- function _v8_trycatch_exception(tc) {
1089
- const tryCatch = emnapiCtx.isolate.getTryCatch(tc);
1090
- if (!tryCatch || !tryCatch.hasCaught())
1091
- return 1;
1092
- return emnapiCtx.napiValueFromJsValue(tryCatch.exception());
1093
- }
1094
- /**
1095
- * @__deps $emnapiCtx
1096
- * @__sig vp
1097
- */
1098
- function _v8_trycatch_reset(tc) {
1099
- const tryCatch = emnapiCtx.isolate.getTryCatch(tc);
1100
- if (!tryCatch)
1101
- return;
1102
- tryCatch.reset();
1103
- }
1104
-
1105
- //#endregion src/v8/try_catch.ts
1106
-
1107
- //#region src/v8/value.ts
1108
- /**
1109
- * @__deps $emnapiCtx
1110
- * @__sig ipp
1111
- */
1112
- function _v8_value_strict_equals(value, that) {
1113
- const jsValue = emnapiCtx.jsValueFromNapiValue(value);
1114
- const jsThat = emnapiCtx.jsValueFromNapiValue(that);
1115
- return Object.is(jsValue, jsThat) ? 1 : 0;
1116
- }
1117
- /**
1118
- * @__deps $emnapiCtx
1119
- * @__sig ppp
1120
- */
1121
- function _v8_value_to_boolean(value, isolate) {
1122
- const jsValue = emnapiCtx.jsValueFromNapiValue(value);
1123
- const boolValue = Boolean(jsValue);
1124
- return emnapiCtx.napiValueFromJsValue(boolValue);
1125
- }
1126
- /**
1127
- * @__deps $emnapiCtx
1128
- * @__sig ppp
1129
- */
1130
- function _v8_value_to_number(value, context) {
1131
- const jsValue = emnapiCtx.jsValueFromNapiValue(value);
1132
- const numValue = Number(jsValue);
1133
- return emnapiCtx.napiValueFromJsValue(numValue);
1134
- }
1135
- /**
1136
- * @__deps $emnapiCtx
1137
- * @__sig ppp
1138
- */
1139
- function _v8_value_to_string(value, context) {
1140
- const jsValue = emnapiCtx.jsValueFromNapiValue(value);
1141
- const strValue = String(jsValue);
1142
- return emnapiCtx.napiValueFromJsValue(strValue);
1143
- }
1144
- /**
1145
- * @__deps $emnapiCtx
1146
- * @__sig ppp
1147
- */
1148
- function _v8_value_to_object(value, context) {
1149
- const jsValue = emnapiCtx.jsValueFromNapiValue(value);
1150
- if (jsValue === null || jsValue === undefined)
1151
- return 0;
1152
- const objValue = Object(jsValue);
1153
- return emnapiCtx.napiValueFromJsValue(objValue);
1154
- }
1155
- /**
1156
- * @__deps $emnapiCtx
1157
- * @__sig ppp
1158
- */
1159
- function _v8_value_to_integer(value, context) {
1160
- const jsValue = emnapiCtx.jsValueFromNapiValue(value);
1161
- const intValue = Math.trunc(Number(jsValue));
1162
- return emnapiCtx.napiValueFromJsValue(intValue);
1163
- }
1164
- /**
1165
- * @__deps $emnapiCtx
1166
- * @__sig ppp
1167
- */
1168
- function _v8_value_to_uint32(value, context) {
1169
- const jsValue = emnapiCtx.jsValueFromNapiValue(value);
1170
- const uint32Value = Number(jsValue) >>> 0;
1171
- return emnapiCtx.napiValueFromJsValue(uint32Value);
1172
- }
1173
- /**
1174
- * @__deps $emnapiCtx
1175
- * @__sig ppp
1176
- */
1177
- function _v8_value_to_int32(value, context) {
1178
- const jsValue = emnapiCtx.jsValueFromNapiValue(value);
1179
- const int32Value = Number(jsValue) | 0;
1180
- return emnapiCtx.napiValueFromJsValue(int32Value);
1181
- }
1182
- /**
1183
- * @__deps $emnapiCtx
1184
- * @__sig ppp
1185
- */
1186
- function _v8_value_to_array_index(value, context) {
1187
- const jsValue = emnapiCtx.jsValueFromNapiValue(value);
1188
- // V8: ToArrayIndex returns uint32 if possible, else undefined
1189
- const n = Number(jsValue);
1190
- if (typeof n === 'number' &&
1191
- isFinite(n) &&
1192
- n >= 0 &&
1193
- n <= 0xffffffff &&
1194
- Math.floor(n) === n) {
1195
- return emnapiCtx.napiValueFromJsValue(n >>> 0);
1196
- }
1197
- return 0;
1198
- }
1199
- /**
1200
- * @__deps $emnapiCtx
1201
- * @__sig ip
1202
- */
1203
- function _v8_value_is_function(value) {
1204
- const jsValue = emnapiCtx.jsValueFromNapiValue(value);
1205
- if (jsValue == null)
1206
- return 0;
1207
- const isFunction = typeof jsValue === 'function';
1208
- return isFunction ? 1 : 0;
1209
- }
1210
- /**
1211
- * @__deps $emnapiCtx
1212
- * @__sig ip
1213
- */
1214
- function _v8_value_is_number(value) {
1215
- const jsValue = emnapiCtx.jsValueFromNapiValue(value);
1216
- if (jsValue == null)
1217
- return 0;
1218
- const isFunction = typeof jsValue === 'number';
1219
- return isFunction ? 1 : 0;
1220
- }
1221
- /**
1222
- * @__deps $emnapiCtx
1223
- * @__sig ip
1224
- */
1225
- function _v8_value_is_undefined(value) {
1226
- const jsValue = emnapiCtx.jsValueFromNapiValue(value);
1227
- const isUndefined = jsValue === undefined;
1228
- return isUndefined ? 1 : 0;
1229
- }
1230
- /**
1231
- * @__deps $emnapiCtx
1232
- * @__sig ip
1233
- */
1234
- function _v8_value_is_null(value) {
1235
- const jsValue = emnapiCtx.jsValueFromNapiValue(value);
1236
- const isUndefined = jsValue === null;
1237
- return isUndefined ? 1 : 0;
1238
- }
1239
- /**
1240
- * @__deps $emnapiCtx
1241
- * @__sig ip
1242
- */
1243
- function _v8_value_is_true(value) {
1244
- const jsValue = emnapiCtx.jsValueFromNapiValue(value);
1245
- if (jsValue == null)
1246
- return 0;
1247
- const isUndefined = jsValue === true;
1248
- return isUndefined ? 1 : 0;
1249
- }
1250
- /**
1251
- * @__deps $emnapiCtx
1252
- * @__sig ip
1253
- */
1254
- function _v8_value_is_false(value) {
1255
- const jsValue = emnapiCtx.jsValueFromNapiValue(value);
1256
- if (jsValue == null)
1257
- return 0;
1258
- const isUndefined = jsValue === false;
1259
- return isUndefined ? 1 : 0;
1260
- }
1261
- /**
1262
- * @__deps $emnapiCtx
1263
- * @__sig ip
1264
- */
1265
- function _v8_value_is_string(value) {
1266
- const jsValue = emnapiCtx.jsValueFromNapiValue(value);
1267
- if (jsValue == null)
1268
- return 0;
1269
- const isFunction = typeof jsValue === 'string';
1270
- return isFunction ? 1 : 0;
1271
- }
1272
-
1273
- //#endregion src/v8/value.ts
1274
-
1275
- //#region src/v8/node.ts
1276
- /**
1277
- * @__deps $emnapiCtx
1278
- * @__deps $emnapiString
1279
- * @__sig ppppi
1280
- */
1281
- function _node_encode(isolate, buf, len, encoding) {
1282
- const autoLength = len === -1 || len === 4294967295;
1283
- buf >>>= 0;
1284
- len >>>= 0;
1285
- if (encoding === 1) {
1286
- return emnapiCtx.napiValueFromJsValue(emnapiString.UTF8ToString(buf, len));
1287
- }
1288
- if (encoding === -1) {
1289
- return emnapiCtx.napiValueFromJsValue(emnapiString.UTF16ToString(buf, len));
1290
- }
1291
- if (encoding === 2) {
1292
- const Buffer = emnapiCtx.features.Buffer;
1293
- if (typeof Buffer !== 'function') {
1294
- emnapiCtx.isolate.throwException(new Error('Buffer is not supported'));
1295
- return 1;
1296
- }
1297
- const buffer = Buffer.from(emscripten_runtime.wasmMemory.buffer, buf, len >>> 0);
1298
- return emnapiCtx.napiValueFromJsValue(buffer.toString('base64'));
1299
- }
1300
- if (encoding === 3) {
1301
- return emnapiCtx.napiValueFromJsValue(emnapiString.UTF16ToString(buf, len / 2));
1302
- }
1303
- if (encoding === 4 || encoding === 0) {
1304
- return emnapiCtx.napiValueFromJsValue(emnapiString.encode(buf, autoLength, len >>> 0, (c) => String.fromCharCode(c)));
1305
- }
1306
- if (encoding === 5) {
1307
- return emnapiCtx.napiValueFromJsValue(emnapiString.encode(buf, autoLength, len >>> 0, (c) => c.toString(16).padStart(2, '0')));
1308
- }
1309
- if (encoding === 6) {
1310
- const Buffer = emnapiCtx.features.Buffer;
1311
- if (typeof Buffer !== 'function') {
1312
- emnapiCtx.isolate.throwException(new Error('Buffer is not supported'));
1313
- return 1;
1314
- }
1315
- const buffer = Buffer.from(emscripten_runtime.wasmMemory.buffer, buf, len >>> 0);
1316
- return emnapiCtx.napiValueFromJsValue(buffer);
1317
- }
1318
- emnapiCtx.isolate.throwException(new Error(`Unsupported encoding: ${encoding}`));
1319
- return 1;
1320
- }
1321
-
1322
- //#endregion src/v8/node.ts
1323
-
1324
- //#region src/v8/index.ts
1325
-
1326
- //#endregion src/v8/index.ts
1327
-
1328
- exports._node_encode = _node_encode;
1329
- exports._v8_array_length = _v8_array_length;
1330
- exports._v8_array_new = _v8_array_new;
1331
- exports._v8_boolean_object_new = _v8_boolean_object_new;
1332
- exports._v8_boolean_object_value_of = _v8_boolean_object_value_of;
1333
- exports._v8_boolean_value = _v8_boolean_value;
1334
- exports._v8_cbinfo_holder = _v8_cbinfo_holder;
1335
- exports._v8_cbinfo_new_target = _v8_cbinfo_new_target;
1336
- exports._v8_clear_weak = _v8_clear_weak;
1337
- exports._v8_close_handle_scope = _v8_close_handle_scope;
1338
- exports._v8_copy_global_reference = _v8_copy_global_reference;
1339
- exports._v8_date_new = _v8_date_new;
1340
- exports._v8_dispose_global = _v8_dispose_global;
1341
- exports._v8_exception_error = _v8_exception_error;
1342
- exports._v8_exception_range_error = _v8_exception_range_error;
1343
- exports._v8_exception_reference_error = _v8_exception_reference_error;
1344
- exports._v8_exception_syntax_error = _v8_exception_syntax_error;
1345
- exports._v8_exception_type_error = _v8_exception_type_error;
1346
- exports._v8_external_new = _v8_external_new;
1347
- exports._v8_external_value = _v8_external_value;
1348
- exports._v8_function_call = _v8_function_call;
1349
- exports._v8_function_new = _v8_function_new;
1350
- exports._v8_function_new_instance = _v8_function_new_instance;
1351
- exports._v8_function_set_name = _v8_function_set_name;
1352
- exports._v8_function_template_get_function = _v8_function_template_get_function;
1353
- exports._v8_function_template_instance_template = _v8_function_template_instance_template;
1354
- exports._v8_function_template_new = _v8_function_template_new;
1355
- exports._v8_function_template_prototype_template = _v8_function_template_prototype_template;
1356
- exports._v8_function_template_set_class_name = _v8_function_template_set_class_name;
1357
- exports._v8_get_cb_info = _v8_get_cb_info;
1358
- exports._v8_get_property_cb_info = _v8_get_property_cb_info;
1359
- exports._v8_globalize_reference = _v8_globalize_reference;
1360
- exports._v8_handle_scope_escape = _v8_handle_scope_escape;
1361
- exports._v8_int32_value = _v8_int32_value;
1362
- exports._v8_integer_new = _v8_integer_new;
1363
- exports._v8_integer_new_from_unsigned = _v8_integer_new_from_unsigned;
1364
- exports._v8_integer_value = _v8_integer_value;
1365
- exports._v8_isolate_get_current_context = _v8_isolate_get_current_context;
1366
- exports._v8_isolate_throw_exception = _v8_isolate_throw_exception;
1367
- exports._v8_json_parse = _v8_json_parse;
1368
- exports._v8_json_stringify = _v8_json_stringify;
1369
- exports._v8_local_from_global_reference = _v8_local_from_global_reference;
1370
- exports._v8_make_weak = _v8_make_weak;
1371
- exports._v8_move_global_reference = _v8_move_global_reference;
1372
- exports._v8_number_new = _v8_number_new;
1373
- exports._v8_number_object_new = _v8_number_object_new;
1374
- exports._v8_number_value = _v8_number_value;
1375
- exports._v8_object_delete_private = _v8_object_delete_private;
1376
- exports._v8_object_get_aligned_pointer_in_internal_field = _v8_object_get_aligned_pointer_in_internal_field;
1377
- exports._v8_object_get_index = _v8_object_get_index;
1378
- exports._v8_object_get_internal_field = _v8_object_get_internal_field;
1379
- exports._v8_object_get_key = _v8_object_get_key;
1380
- exports._v8_object_get_private = _v8_object_get_private;
1381
- exports._v8_object_has_private = _v8_object_has_private;
1382
- exports._v8_object_internal_field_count = _v8_object_internal_field_count;
1383
- exports._v8_object_new = _v8_object_new;
1384
- exports._v8_object_set = _v8_object_set;
1385
- exports._v8_object_set_aligned_pointer_in_internal_field = _v8_object_set_aligned_pointer_in_internal_field;
1386
- exports._v8_object_set_internal_field = _v8_object_set_internal_field;
1387
- exports._v8_object_set_private = _v8_object_set_private;
1388
- exports._v8_object_template_new = _v8_object_template_new;
1389
- exports._v8_object_template_new_instance = _v8_object_template_new_instance;
1390
- exports._v8_object_template_set_accessor = _v8_object_template_set_accessor;
1391
- exports._v8_object_template_set_internal_field_count = _v8_object_template_set_internal_field_count;
1392
- exports._v8_open_handle_scope = _v8_open_handle_scope;
1393
- exports._v8_private_for_api = _v8_private_for_api;
1394
- exports._v8_regex_new = _v8_regex_new;
1395
- exports._v8_script_compiler_compile_unbound_script = _v8_script_compiler_compile_unbound_script;
1396
- exports._v8_script_run = _v8_script_run;
1397
- exports._v8_signature_new = _v8_signature_new;
1398
- exports._v8_string_length = _v8_string_length;
1399
- exports._v8_string_new_external_one_byte = _v8_string_new_external_one_byte;
1400
- exports._v8_string_new_external_two_byte = _v8_string_new_external_two_byte;
1401
- exports._v8_string_new_from_one_byte = _v8_string_new_from_one_byte;
1402
- exports._v8_string_new_from_two_byte = _v8_string_new_from_two_byte;
1403
- exports._v8_string_new_from_utf8 = _v8_string_new_from_utf8;
1404
- exports._v8_string_object_new = _v8_string_object_new;
1405
- exports._v8_string_object_value_of = _v8_string_object_value_of;
1406
- exports._v8_string_utf8_length = _v8_string_utf8_length;
1407
- exports._v8_string_write_utf8 = _v8_string_write_utf8;
1408
- exports._v8_template_set = _v8_template_set;
1409
- exports._v8_trycatch_construct = _v8_trycatch_construct;
1410
- exports._v8_trycatch_destruct = _v8_trycatch_destruct;
1411
- exports._v8_trycatch_exception = _v8_trycatch_exception;
1412
- exports._v8_trycatch_has_caught = _v8_trycatch_has_caught;
1413
- exports._v8_trycatch_reset = _v8_trycatch_reset;
1414
- exports._v8_trycatch_rethrow = _v8_trycatch_rethrow;
1415
- exports._v8_uint32_value = _v8_uint32_value;
1416
- exports._v8_unbound_script_bind_to_current_context = _v8_unbound_script_bind_to_current_context;
1417
- exports._v8_value_is_false = _v8_value_is_false;
1418
- exports._v8_value_is_function = _v8_value_is_function;
1419
- exports._v8_value_is_null = _v8_value_is_null;
1420
- exports._v8_value_is_number = _v8_value_is_number;
1421
- exports._v8_value_is_string = _v8_value_is_string;
1422
- exports._v8_value_is_true = _v8_value_is_true;
1423
- exports._v8_value_is_undefined = _v8_value_is_undefined;
1424
- exports._v8_value_strict_equals = _v8_value_strict_equals;
1425
- exports._v8_value_to_array_index = _v8_value_to_array_index;
1426
- exports._v8_value_to_boolean = _v8_value_to_boolean;
1427
- exports._v8_value_to_int32 = _v8_value_to_int32;
1428
- exports._v8_value_to_integer = _v8_value_to_integer;
1429
- exports._v8_value_to_number = _v8_value_to_number;
1430
- exports._v8_value_to_object = _v8_value_to_object;
1431
- exports._v8_value_to_string = _v8_value_to_string;
1432
- exports._v8_value_to_uint32 = _v8_value_to_uint32;
1433
-
1434
- return exports;
1435
-
1436
- })({}, emnapiPluginCtx);
1437
- return {
1438
- importObject: (original) => {
1439
- Object.assign(original.env, mod);
1440
- }
1441
- };
1442
- }
1443
-
1444
- //#endregion src/emnapi/v8.js
1445
-
1446
- export { v8 as default };