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,1010 +0,0 @@
1
- //#region src/emnapi/threadsafe-function.js
2
- function threadsafeFunction (emnapiPluginCtx) {
3
- const { emnapiCtx, emnapiNodeBinding, _emnapi_node_emit_async_destroy: __emnapi_node_emit_async_destroy, _emnapi_node_emit_async_init: __emnapi_node_emit_async_init, _emnapi_runtime_keepalive_pop: __emnapi_runtime_keepalive_pop, _emnapi_runtime_keepalive_push: __emnapi_runtime_keepalive_push } = emnapiPluginCtx;
4
- var mod = (function (exports, emnapi_shared, emscripten_runtime) {
5
-
6
- //#region src/macro.ts
7
-
8
- //#endregion src/macro.ts
9
-
10
- //#region src/threadsafe-function.ts
11
- /* eslint-disable @stylistic/indent */
12
- /**
13
- * @__deps malloc
14
- * @__deps free
15
- * @__deps $emnapiCtx
16
- * @__deps $emnapiEnv
17
- * @__deps $emnapiNodeBinding
18
- * @__deps _emnapi_node_emit_async_destroy
19
- * @__deps _emnapi_runtime_keepalive_pop
20
- * @__postset
21
- * ```
22
- * emnapiTSFN.init();
23
- * ```
24
- */
25
- const emnapiTSFN = {
26
- _liveSet: {},
27
- offset: {
28
- __size__: 0,
29
- /* napi_ref */ resource: 0,
30
- /* double */ async_id: 0,
31
- /* double */ trigger_async_id: 0,
32
- /* size_t */ queue_size: 0,
33
- /* bool */ is_some: 0,
34
- /* void* */ queue: 0,
35
- // Reuse uv_async_t storage as JS-side wakeup state: pending event + scheduled drain.
36
- async_pending: 0,
37
- async_u_fd: 0,
38
- /* size_t */ thread_count: 0,
39
- /* int32_t */ state: 0,
40
- /* atomic_uchar */ dispatch_state: 0,
41
- /* void* */ context: 0,
42
- /* size_t */ max_queue_size: 0,
43
- /* napi_ref */ ref: 0,
44
- /* napi_env */ env: 0,
45
- /* void* */ finalize_data: 0,
46
- /* napi_finalize */ finalize_cb: 0,
47
- /* napi_threadsafe_function_call_js */ call_js_cb: 0,
48
- /* bool */ handles_closing: 0,
49
- /* bool */ async_ref: 0,
50
- /* int32_t */ mutex: 0,
51
- /* int32_t */ cond: 0,
52
- },
53
- init() {
54
- emnapiTSFN._liveSet = new Set();
55
- emnapiTSFN.offset.__size__ = 184 /* NapiTSFNOffset32.__size__ */;
56
- emnapiTSFN.offset.resource = 0 /* NapiTSFNOffset32.async_resource_resource */;
57
- emnapiTSFN.offset.async_id = 8 /* NapiTSFNOffset32.async_resource_async_context_async_id */;
58
- emnapiTSFN.offset.trigger_async_id = 16 /* NapiTSFNOffset32.async_resource_async_context_trigger_async_id */;
59
- emnapiTSFN.offset.queue_size = 60 /* NapiTSFNOffset32.queue_size */;
60
- emnapiTSFN.offset.is_some = 24 /* NapiTSFNOffset32.async_resource_is_some */;
61
- emnapiTSFN.offset.queue = 64 /* NapiTSFNOffset32.queue */;
62
- emnapiTSFN.offset.async_pending = 132 /* NapiTSFNOffset32.async_pending */;
63
- emnapiTSFN.offset.async_u_fd = 96 /* NapiTSFNOffset32.async_u_fd */;
64
- emnapiTSFN.offset.thread_count = 136 /* NapiTSFNOffset32.thread_count */;
65
- emnapiTSFN.offset.state = 140 /* NapiTSFNOffset32.state */;
66
- emnapiTSFN.offset.dispatch_state = 144 /* NapiTSFNOffset32.dispatch_state */;
67
- emnapiTSFN.offset.context = 148 /* NapiTSFNOffset32.context */;
68
- emnapiTSFN.offset.max_queue_size = 152 /* NapiTSFNOffset32.max_queue_size */;
69
- emnapiTSFN.offset.ref = 156 /* NapiTSFNOffset32.ref */;
70
- emnapiTSFN.offset.env = 160 /* NapiTSFNOffset32.env */;
71
- emnapiTSFN.offset.finalize_data = 164 /* NapiTSFNOffset32.finalize_data */;
72
- emnapiTSFN.offset.finalize_cb = 168 /* NapiTSFNOffset32.finalize_cb */;
73
- emnapiTSFN.offset.call_js_cb = 172 /* NapiTSFNOffset32.call_js_cb */;
74
- emnapiTSFN.offset.handles_closing = 176 /* NapiTSFNOffset32.handles_closing */;
75
- emnapiTSFN.offset.async_ref = 180 /* NapiTSFNOffset32.async_ref */;
76
- emnapiTSFN.offset.mutex = 32 /* NapiTSFNOffset32.mutex */;
77
- emnapiTSFN.offset.cond = 56 /* NapiTSFNOffset32.cond */;
78
- emnapiTSFN.offset.mutex = emnapiTSFN.offset.mutex + 4;
79
- if (typeof emscripten_runtime.PThread !== 'undefined') {
80
- emscripten_runtime.PThread.unusedWorkers.forEach(emnapiTSFN.addListener);
81
- Object.values(emscripten_runtime.PThread.pthreads).forEach(emnapiTSFN.addListener);
82
- const __original_getNewWorker = emscripten_runtime.PThread.getNewWorker;
83
- emscripten_runtime.PThread.getNewWorker = function () {
84
- const r = __original_getNewWorker.apply(this, arguments);
85
- emnapiTSFN.addListener(r);
86
- return r;
87
- };
88
- }
89
- },
90
- addListener(worker) {
91
- if (!worker)
92
- return false;
93
- if (worker._emnapiTSFNListener)
94
- return true;
95
- const handler = function (e) {
96
- const data = emscripten_runtime.ENVIRONMENT_IS_NODE ? e : e.data;
97
- const __emnapi__ = data.__emnapi__;
98
- if (__emnapi__) {
99
- const type = __emnapi__.type;
100
- const payload = __emnapi__.payload;
101
- if (type === 'tsfn-send') {
102
- const pendng = payload.tsfn + emnapiTSFN.offset.async_pending;
103
- if (Atomics.load(new Int32Array(emnapiTSFN.ensureBufferFor(pendng + 4)), pendng >>> 2) !== 0) {
104
- emnapiTSFN.enqueue(payload.tsfn);
105
- }
106
- }
107
- }
108
- };
109
- const dispose = function () {
110
- if (emscripten_runtime.ENVIRONMENT_IS_NODE) {
111
- worker.off('message', handler);
112
- }
113
- else {
114
- worker.removeEventListener('message', handler, false);
115
- }
116
- delete worker._emnapiTSFNListener;
117
- };
118
- worker._emnapiTSFNListener = { handler, dispose };
119
- if (emscripten_runtime.ENVIRONMENT_IS_NODE) {
120
- worker.on('message', handler);
121
- }
122
- else {
123
- worker.addEventListener('message', handler, false);
124
- }
125
- return true;
126
- },
127
- /**
128
- * When another thread grows the shared WebAssembly.Memory, this agent's
129
- * cached `wasmMemory.buffer` may still have the old shorter length
130
- * (V8 refreshes it lazily). If a pointer derived from shared memory lies
131
- * beyond the cached length, `wasmMemory.grow(0)` forces the agent to
132
- * observe the current memory size and refreshes the buffer.
133
- */
134
- ensureBufferFor(end) {
135
- let buffer = emscripten_runtime.wasmMemory.buffer;
136
- if (end > buffer.byteLength) {
137
- emscripten_runtime.wasmMemory.grow(0);
138
- buffer = emscripten_runtime.wasmMemory.buffer;
139
- }
140
- return buffer;
141
- },
142
- initQueue(func) {
143
- const size = 2 * 4;
144
- let queue = emscripten_runtime._malloc(size);
145
- if (!queue)
146
- return false;
147
- queue >>>= 0;
148
- new Uint8Array(emnapiTSFN.ensureBufferFor(queue + size), queue, size).fill(0);
149
- emnapiTSFN.storeSizeTypeValue(func + emnapiTSFN.offset.queue, queue, false);
150
- return true;
151
- },
152
- destroyQueue(func) {
153
- const queue = emnapiTSFN.loadSizeTypeValue(func + emnapiTSFN.offset.queue, false);
154
- if (queue) {
155
- let node = emnapiTSFN.loadSizeTypeValue(queue, false);
156
- while (node !== 0) {
157
- const next = emnapiTSFN.loadSizeTypeValue(node + 4, false);
158
- emscripten_runtime._free(node);
159
- node = next;
160
- }
161
- emscripten_runtime._free(queue);
162
- }
163
- },
164
- pushQueue(func, data) {
165
- const queue = emnapiTSFN.loadSizeTypeValue(func + emnapiTSFN.offset.queue, false);
166
- const head = emnapiTSFN.loadSizeTypeValue(queue, false);
167
- const tail = emnapiTSFN.loadSizeTypeValue(queue + 4, false);
168
- const size = 2 * 4;
169
- let node = emscripten_runtime._malloc(size);
170
- if (!node)
171
- throw new Error('OOM');
172
- node >>>= 0;
173
- emnapiTSFN.storeSizeTypeValue(node, data, false);
174
- emnapiTSFN.storeSizeTypeValue(node + 4, 0, false);
175
- if (head === 0 && tail === 0) {
176
- emnapiTSFN.storeSizeTypeValue(queue, node, false);
177
- emnapiTSFN.storeSizeTypeValue(queue + 4, node, false);
178
- }
179
- else {
180
- emnapiTSFN.storeSizeTypeValue(tail + 4, node, false);
181
- emnapiTSFN.storeSizeTypeValue(queue + 4, node, false);
182
- }
183
- emnapiTSFN.addQueueSize(func);
184
- },
185
- shiftQueue(func) {
186
- const queue = emnapiTSFN.loadSizeTypeValue(func + emnapiTSFN.offset.queue, false);
187
- const head = emnapiTSFN.loadSizeTypeValue(queue, false);
188
- if (head === 0)
189
- return 0;
190
- const node = head;
191
- const next = emnapiTSFN.loadSizeTypeValue(head + 4, false);
192
- emnapiTSFN.storeSizeTypeValue(queue, next, false);
193
- if (next === 0) {
194
- emnapiTSFN.storeSizeTypeValue(queue + 4, 0, false);
195
- }
196
- emnapiTSFN.storeSizeTypeValue(node + 4, 0, false);
197
- const value = emnapiTSFN.loadSizeTypeValue(node, false);
198
- emscripten_runtime._free(node);
199
- emnapiTSFN.subQueueSize(func);
200
- return value;
201
- },
202
- push(func, data, mode) {
203
- const mutex = emnapiTSFN.getMutex(func);
204
- const cond = emnapiTSFN.getCond(func);
205
- const waitCondition = () => {
206
- const queueSize = emnapiTSFN.getQueueSize(func);
207
- const maxSize = emnapiTSFN.getMaxQueueSize(func);
208
- return queueSize >= maxSize && maxSize > 0 && emnapiTSFN.getState(func) === 0 /* State.kOpen */;
209
- };
210
- const isBrowserMain = typeof window !== 'undefined' && typeof document !== 'undefined' && !emscripten_runtime.ENVIRONMENT_IS_NODE;
211
- let shouldDelete = false;
212
- const ret = mutex.execute(() => {
213
- while (waitCondition()) {
214
- if (mode === 0 /* napi_threadsafe_function_call_mode.napi_tsfn_nonblocking */) {
215
- return 15 /* napi_status.napi_queue_full */;
216
- }
217
- /**
218
- * Browser JS main thread can not use `Atomics.wait`
219
- *
220
- * Related:
221
- * https://github.com/nodejs/node/pull/32689
222
- * https://github.com/nodejs/node/pull/33453
223
- */
224
- if (isBrowserMain) {
225
- return 21 /* napi_status.napi_would_deadlock */;
226
- }
227
- cond.wait();
228
- }
229
- if (emnapiTSFN.getState(func) === 0 /* State.kOpen */) {
230
- emnapiTSFN.pushQueue(func, data);
231
- emnapiTSFN.send(func);
232
- return 0 /* napi_status.napi_ok */;
233
- }
234
- if (emnapiTSFN.getThreadCount(func) === 0) {
235
- return 1 /* napi_status.napi_invalid_arg */;
236
- }
237
- emnapiTSFN.subThreadCount(func);
238
- if (!(emnapiTSFN.getState(func) === 2 /* State.kClosed */ && emnapiTSFN.getThreadCount(func) === 0)) {
239
- return 16 /* napi_status.napi_closing */;
240
- }
241
- shouldDelete = true;
242
- return 16 /* napi_status.napi_closing */;
243
- });
244
- if (shouldDelete) {
245
- emnapiTSFN.destroy(func);
246
- }
247
- return ret;
248
- },
249
- getMutex(func) {
250
- const index = func + emnapiTSFN.offset.mutex;
251
- const mutex = {
252
- lock() {
253
- const isBrowserMain = typeof window !== 'undefined' && typeof document !== 'undefined' && !emscripten_runtime.ENVIRONMENT_IS_NODE;
254
- const i32a = new Int32Array(emnapiTSFN.ensureBufferFor(index + 4), index, 1);
255
- if (isBrowserMain) {
256
- while (true) {
257
- const oldValue = Atomics.compareExchange(i32a, 0, 0, 10);
258
- if (oldValue === 0) {
259
- return;
260
- }
261
- }
262
- }
263
- else {
264
- while (true) {
265
- const oldValue = Atomics.compareExchange(i32a, 0, 0, 10);
266
- if (oldValue === 0) {
267
- return;
268
- }
269
- Atomics.wait(i32a, 0, 10);
270
- }
271
- }
272
- },
273
- /* lockAsync () {
274
- return new Promise<void>(resolve => {
275
- const again = (): void => { fn() }
276
- const fn = (): void => {
277
- const i32a = new Int32Array(emnapiTSFN.ensureBufferFor(index + 4), index, 1)
278
- const oldValue = Atomics.compareExchange(i32a, 0, 0, 10)
279
- if (oldValue === 0) {
280
- resolve()
281
- return
282
- }
283
- (Atomics as any).waitAsync(i32a, 0, 10).value.then(again)
284
- }
285
- fn()
286
- })
287
- }, */
288
- unlock() {
289
- const i32a = new Int32Array(emnapiTSFN.ensureBufferFor(index + 4), index, 1);
290
- const oldValue = Atomics.compareExchange(i32a, 0, 10, 0);
291
- if (oldValue !== 10) {
292
- throw new Error('Tried to unlock while not holding the mutex');
293
- }
294
- Atomics.notify(i32a, 0, 1);
295
- },
296
- execute(fn) {
297
- mutex.lock();
298
- try {
299
- return fn();
300
- }
301
- finally {
302
- mutex.unlock();
303
- }
304
- } /* ,
305
- executeAsync<T> (fn: () => Promise<T>): Promise<T> {
306
- return mutex.lockAsync().then(() => {
307
- const r = fn()
308
- mutex.unlock()
309
- return r
310
- }, (err) => {
311
- mutex.unlock()
312
- throw err
313
- })
314
- } */
315
- };
316
- return mutex;
317
- },
318
- getCond(func) {
319
- const index = func + emnapiTSFN.offset.cond;
320
- const mutex = emnapiTSFN.getMutex(func);
321
- const cond = {
322
- wait() {
323
- const i32a = new Int32Array(emnapiTSFN.ensureBufferFor(index + 4), index, 1);
324
- const value = Atomics.load(i32a, 0);
325
- mutex.unlock();
326
- Atomics.wait(i32a, 0, value);
327
- mutex.lock();
328
- },
329
- /* waitAsync () {
330
- const i32a = new Int32Array(emnapiTSFN.ensureBufferFor(index + 4), index, 1)
331
- const value = Atomics.load(i32a, 0)
332
- mutex.unlock()
333
- const lock = (): Promise<void> => mutex.lockAsync()
334
- try {
335
- return (Atomics as any).waitAsync(i32a, 0, value).value.then(lock, lock)
336
- } catch (err) {
337
- return lock()
338
- }
339
- }, */
340
- signal() {
341
- const i32a = new Int32Array(emnapiTSFN.ensureBufferFor(index + 4), index, 1);
342
- Atomics.add(i32a, 0, 1);
343
- Atomics.notify(i32a, 0, 1);
344
- }
345
- };
346
- return cond;
347
- },
348
- getQueueSize(func) {
349
- return emnapiTSFN.loadSizeTypeValue(func + emnapiTSFN.offset.queue_size, true);
350
- },
351
- addQueueSize(func) {
352
- const offset = emnapiTSFN.offset.queue_size;
353
- let arr, index;
354
- arr = new Uint32Array(emnapiTSFN.ensureBufferFor(func + offset + 4));
355
- index = (func + offset) >>> 2;
356
- Atomics.add(arr, index, 1);
357
- },
358
- subQueueSize(func) {
359
- const offset = emnapiTSFN.offset.queue_size;
360
- let arr, index;
361
- arr = new Uint32Array(emnapiTSFN.ensureBufferFor(func + offset + 4));
362
- index = (func + offset) >>> 2;
363
- Atomics.sub(arr, index, 1);
364
- },
365
- getThreadCount(func) {
366
- return emnapiTSFN.loadSizeTypeValue(func + emnapiTSFN.offset.thread_count, true);
367
- },
368
- addThreadCount(func) {
369
- const offset = emnapiTSFN.offset.thread_count;
370
- let arr, index;
371
- arr = new Uint32Array(emnapiTSFN.ensureBufferFor(func + offset + 4));
372
- index = (func + offset) >>> 2;
373
- Atomics.add(arr, index, 1);
374
- },
375
- subThreadCount(func) {
376
- const offset = emnapiTSFN.offset.thread_count;
377
- let arr, index;
378
- arr = new Uint32Array(emnapiTSFN.ensureBufferFor(func + offset + 4));
379
- index = (func + offset) >>> 2;
380
- Atomics.sub(arr, index, 1);
381
- },
382
- getState(func) {
383
- return Atomics.load(new Int32Array(emnapiTSFN.ensureBufferFor(func + emnapiTSFN.offset.state + 4)), (func + emnapiTSFN.offset.state) >>> 2);
384
- },
385
- setState(func, value) {
386
- Atomics.store(new Int32Array(emnapiTSFN.ensureBufferFor(func + emnapiTSFN.offset.state + 4)), (func + emnapiTSFN.offset.state) >>> 2, value);
387
- },
388
- getHandlesClosing(func) {
389
- return Atomics.load(new Int8Array(emnapiTSFN.ensureBufferFor(func + emnapiTSFN.offset.handles_closing + 1)), (func + emnapiTSFN.offset.handles_closing));
390
- },
391
- setHandlesClosing(func, value) {
392
- Atomics.store(new Int8Array(emnapiTSFN.ensureBufferFor(func + emnapiTSFN.offset.handles_closing + 1)), (func + emnapiTSFN.offset.handles_closing), value);
393
- },
394
- getDispatchState(func) {
395
- return Atomics.load(new Uint32Array(emnapiTSFN.ensureBufferFor(func + emnapiTSFN.offset.dispatch_state + 4)), (func + emnapiTSFN.offset.dispatch_state) >>> 2);
396
- },
397
- getContext(func) {
398
- return emnapiTSFN.loadSizeTypeValue(func + emnapiTSFN.offset.context, false);
399
- },
400
- getMaxQueueSize(func) {
401
- return emnapiTSFN.loadSizeTypeValue(func + emnapiTSFN.offset.max_queue_size, true);
402
- },
403
- getEnv(func) {
404
- return emnapiTSFN.loadSizeTypeValue(func + emnapiTSFN.offset.env, false);
405
- },
406
- getCallJSCb(func) {
407
- return emnapiTSFN.loadSizeTypeValue(func + emnapiTSFN.offset.call_js_cb, false);
408
- },
409
- getRef(func) {
410
- return emnapiTSFN.loadSizeTypeValue(func + emnapiTSFN.offset.ref, false);
411
- },
412
- getResource(func) {
413
- return emnapiTSFN.loadSizeTypeValue(func + emnapiTSFN.offset.resource, false);
414
- },
415
- getFinalizeCb(func) {
416
- return emnapiTSFN.loadSizeTypeValue(func + emnapiTSFN.offset.finalize_cb, false);
417
- },
418
- getFinalizeData(func) {
419
- return emnapiTSFN.loadSizeTypeValue(func + emnapiTSFN.offset.finalize_data, false);
420
- },
421
- loadSizeTypeValue(offset, unsigned) {
422
- let ret;
423
- let arr;
424
- if (unsigned) {
425
- arr = new Uint32Array(emnapiTSFN.ensureBufferFor(offset + 4));
426
- ret = Atomics.load(arr, offset >>> 2);
427
- return ret;
428
- }
429
- else {
430
- arr = new Int32Array(emnapiTSFN.ensureBufferFor(offset + 4));
431
- ret = Atomics.load(arr, offset >>> 2);
432
- return ret;
433
- }
434
- },
435
- storeSizeTypeValue(offset, value, unsigned) {
436
- let arr;
437
- if (unsigned) {
438
- arr = new Uint32Array(emnapiTSFN.ensureBufferFor(offset + 4));
439
- Atomics.store(arr, offset >>> 2, value);
440
- return undefined;
441
- }
442
- else {
443
- arr = new Int32Array(emnapiTSFN.ensureBufferFor(offset + 4));
444
- Atomics.store(arr, offset >>> 2, value >>> 0);
445
- return undefined;
446
- }
447
- },
448
- releaseResources(func) {
449
- if (emnapiTSFN.getState(func) !== 2 /* State.kClosed */) {
450
- emnapiTSFN.setState(func, 2 /* State.kClosed */);
451
- emnapiTSFN.getEnv(func);
452
- const envObject = emnapi_shared.emnapiEnv;
453
- const ref = emnapiTSFN.getRef(func);
454
- if (ref) {
455
- emnapiCtx.getRef(ref).dispose();
456
- }
457
- const resource = emnapiTSFN.getResource(func);
458
- emnapiCtx.getRef(resource).dispose();
459
- emnapiTSFN.ensureBufferFor(func + emnapiTSFN.offset.is_some + 1);
460
- 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));
461
- GET_HEAP_DATA_VIEW().setInt8(func + emnapiTSFN.offset.is_some, 0, true);
462
- emnapiCtx.removeCleanupHook(envObject, emnapiTSFN.cleanup, func);
463
- envObject.unref();
464
- const asyncRefAddress = func + emnapiTSFN.offset.async_ref;
465
- const asyncRefOffset = asyncRefAddress >>> 2;
466
- const arr = new Uint32Array(emnapiTSFN.ensureBufferFor(asyncRefAddress + 4));
467
- if (Atomics.load(arr, asyncRefOffset) > 0) {
468
- Atomics.store(arr, asyncRefOffset, 0);
469
- __emnapi_runtime_keepalive_pop();
470
- emnapiCtx.decreaseWaitingRequestCounter();
471
- }
472
- if (emnapiNodeBinding) {
473
- const view = new DataView(emnapiTSFN.ensureBufferFor(func + emnapiTSFN.offset.trigger_async_id + 8));
474
- const asyncId = view.getFloat64(func + emnapiTSFN.offset.async_id, true);
475
- const triggerAsyncId = view.getFloat64(func + emnapiTSFN.offset.trigger_async_id, true);
476
- __emnapi_node_emit_async_destroy(asyncId, triggerAsyncId);
477
- }
478
- }
479
- },
480
- destroy(func) {
481
- emnapiTSFN._liveSet.delete(func);
482
- emnapiTSFN.destroyQueue(func);
483
- emnapiTSFN.releaseResources(func);
484
- emscripten_runtime._free(func);
485
- },
486
- emptyQueue(func) {
487
- const drainQueue = [];
488
- emnapiTSFN.getMutex(func).execute(() => {
489
- while (emnapiTSFN.getQueueSize(func) > 0) {
490
- drainQueue.push(emnapiTSFN.shiftQueue(func));
491
- }
492
- });
493
- const callJsCb = emnapiTSFN.getCallJSCb(func);
494
- const context = emnapiTSFN.getContext(func);
495
- let data;
496
- for (let i = 0; i < drainQueue.length; i++) {
497
- data = drainQueue[i];
498
- if (callJsCb) {
499
- (emnapiPluginCtx.wasmTable.get(callJsCb))(0, 0, context, data);
500
- }
501
- }
502
- },
503
- maybeDelete(func) {
504
- let shouldDelete = false;
505
- emnapiTSFN.getMutex(func).execute(() => {
506
- if (emnapiTSFN.getThreadCount(func) > 0) {
507
- emnapiTSFN.releaseResources(func);
508
- }
509
- else {
510
- shouldDelete = true;
511
- }
512
- });
513
- if (shouldDelete) {
514
- emnapiTSFN.destroy(func);
515
- }
516
- },
517
- finalize(func) {
518
- emnapiTSFN.getEnv(func);
519
- const envObject = emnapi_shared.emnapiEnv;
520
- emnapiCtx.openScope(envObject);
521
- const finalize = emnapiTSFN.getFinalizeCb(func);
522
- const data = emnapiTSFN.getFinalizeData(func);
523
- const context = emnapiTSFN.getContext(func);
524
- const f = () => {
525
- envObject.callFinalizerInternal(0, finalize, data, context);
526
- };
527
- try {
528
- emnapiTSFN.emptyQueue(func);
529
- if (finalize) {
530
- if (emnapiNodeBinding) {
531
- const resource = emnapiTSFN.getResource(func);
532
- const resource_value = emnapiCtx.getRef(resource).get();
533
- const resourceObject = emnapiCtx.jsValueFromNapiValue(resource_value);
534
- const view = new DataView(emnapiTSFN.ensureBufferFor(func + emnapiTSFN.offset.trigger_async_id + 8));
535
- const asyncId = view.getFloat64(func + emnapiTSFN.offset.async_id, true);
536
- const triggerAsyncId = view.getFloat64(func + emnapiTSFN.offset.trigger_async_id, true);
537
- emnapiNodeBinding.node.makeCallback(resourceObject, f, [], {
538
- asyncId,
539
- triggerAsyncId
540
- });
541
- }
542
- else {
543
- f();
544
- }
545
- }
546
- emnapiTSFN.maybeDelete(func);
547
- }
548
- finally {
549
- emnapiCtx.closeScope(envObject);
550
- }
551
- },
552
- cleanup(func) {
553
- emnapiTSFN.closeHandlesAndMaybeDelete(func, 1);
554
- },
555
- closeHandlesAndMaybeDelete(func, set_closing) {
556
- emnapiTSFN.getEnv(func);
557
- const envObject = emnapi_shared.emnapiEnv;
558
- emnapiCtx.openScope(envObject);
559
- try {
560
- if (set_closing) {
561
- emnapiTSFN.getMutex(func).execute(() => {
562
- emnapiTSFN.setState(func, 1 /* State.kClosing */);
563
- if (emnapiTSFN.getMaxQueueSize(func) > 0) {
564
- emnapiTSFN.getCond(func).signal();
565
- }
566
- });
567
- }
568
- if (emnapiTSFN.getHandlesClosing(func)) {
569
- return;
570
- }
571
- emnapiTSFN.setHandlesClosing(func, 1);
572
- Atomics.store(new Int32Array(emnapiTSFN.ensureBufferFor(func + emnapiTSFN.offset.async_pending + 4)), (func + emnapiTSFN.offset.async_pending) >>> 2, 1);
573
- emnapiCtx.features.setImmediate(() => {
574
- emnapiTSFN.finalize(func);
575
- });
576
- }
577
- finally {
578
- emnapiCtx.closeScope(envObject);
579
- }
580
- },
581
- dispatchOne(func) {
582
- let data = 0;
583
- let popped_value = false;
584
- let has_more = false;
585
- const mutex = emnapiTSFN.getMutex(func);
586
- const cond = emnapiTSFN.getCond(func);
587
- mutex.execute(() => {
588
- if (emnapiTSFN.getState(func) === 0 /* State.kOpen */) {
589
- let size = emnapiTSFN.getQueueSize(func);
590
- if (size > 0) {
591
- data = emnapiTSFN.shiftQueue(func);
592
- popped_value = true;
593
- const maxQueueSize = emnapiTSFN.getMaxQueueSize(func);
594
- if (size === maxQueueSize && maxQueueSize > 0) {
595
- cond.signal();
596
- }
597
- size--;
598
- }
599
- if (size === 0) {
600
- if (emnapiTSFN.getThreadCount(func) === 0) {
601
- emnapiTSFN.setState(func, 1 /* State.kClosing */);
602
- if (emnapiTSFN.getMaxQueueSize(func) > 0) {
603
- cond.signal();
604
- }
605
- emnapiTSFN.closeHandlesAndMaybeDelete(func, 0);
606
- }
607
- }
608
- else {
609
- has_more = true;
610
- }
611
- }
612
- else {
613
- emnapiTSFN.closeHandlesAndMaybeDelete(func, 0);
614
- }
615
- });
616
- if (popped_value) {
617
- const env = emnapiTSFN.getEnv(func);
618
- const envObject = emnapi_shared.emnapiEnv;
619
- emnapiCtx.openScope(envObject);
620
- const f = () => {
621
- envObject.callbackIntoModule(false, () => {
622
- const callJsCb = emnapiTSFN.getCallJSCb(func);
623
- const ref = emnapiTSFN.getRef(func);
624
- const js_callback = ref ? emnapiCtx.getRef(ref).get() : 0;
625
- if (callJsCb) {
626
- const context = emnapiTSFN.getContext(func);
627
- (emnapiPluginCtx.wasmTable.get(callJsCb))(env, js_callback, context, data);
628
- }
629
- else {
630
- const jsCallback = js_callback ? emnapiCtx.jsValueFromNapiValue(js_callback) : null;
631
- if (typeof jsCallback === 'function') {
632
- jsCallback();
633
- }
634
- }
635
- });
636
- };
637
- try {
638
- if (emnapiNodeBinding) {
639
- const resource = emnapiTSFN.getResource(func);
640
- const resource_value = emnapiCtx.getRef(resource).get();
641
- const resourceObject = emnapiCtx.jsValueFromNapiValue(resource_value);
642
- const view = new DataView(emnapiTSFN.ensureBufferFor(func + emnapiTSFN.offset.trigger_async_id + 8));
643
- emnapiNodeBinding.node.makeCallback(resourceObject, f, [], {
644
- asyncId: view.getFloat64(func + emnapiTSFN.offset.async_id, true),
645
- triggerAsyncId: view.getFloat64(func + emnapiTSFN.offset.trigger_async_id, true)
646
- });
647
- }
648
- else {
649
- f();
650
- }
651
- }
652
- finally {
653
- emnapiCtx.closeScope(envObject);
654
- }
655
- }
656
- return has_more;
657
- },
658
- dispatch(func) {
659
- let has_more = true;
660
- let iterations_left = 1000;
661
- const dispatchStateAddress = func + emnapiTSFN.offset.dispatch_state;
662
- const index = dispatchStateAddress >>> 2;
663
- while (has_more && --iterations_left !== 0) {
664
- Atomics.store(new Uint32Array(emnapiTSFN.ensureBufferFor(dispatchStateAddress + 4)), index, 1);
665
- try {
666
- has_more = emnapiTSFN.dispatchOne(func);
667
- }
668
- catch (err) {
669
- // A throwing callback must not leave dispatch_state marked as
670
- // dispatching, or every later send() would be swallowed. Re-arm
671
- // the state and schedule another drain before rethrowing.
672
- if (emnapiTSFN._liveSet.has(func)) {
673
- Atomics.exchange(new Uint32Array(emnapiTSFN.ensureBufferFor(dispatchStateAddress + 4)), index, 0);
674
- emnapiTSFN.send(func);
675
- }
676
- throw err;
677
- }
678
- if (Atomics.exchange(new Uint32Array(emnapiTSFN.ensureBufferFor(dispatchStateAddress + 4)), index, 0) !== 1) {
679
- has_more = true;
680
- }
681
- }
682
- if (has_more) {
683
- emnapiTSFN.send(func);
684
- }
685
- },
686
- enqueue(func) {
687
- // `pending` means a worker thread has requested a wakeup that has not
688
- // been drained on the main thread yet.
689
- const pending = func + emnapiTSFN.offset.async_pending;
690
- // `scheduled` prevents queueing the same main-thread drain chain more than
691
- // once while a previous wakeup is still in flight.
692
- const scheduled = func + emnapiTSFN.offset.async_u_fd;
693
- const end = Math.max(pending, scheduled) + 4;
694
- const state = () => new Int32Array(emnapiTSFN.ensureBufferFor(end));
695
- if (Atomics.exchange(state(), scheduled >>> 2, 1) !== 0) {
696
- return;
697
- }
698
- // Match uv_async_send-style coalescing in JS: the first turn represents
699
- // the wakeup reaching the main thread, and the second turn performs the
700
- // actual TSFN drain after nearby Send/Signal calls have had a chance to
701
- // collapse into the shared AsyncProgressWorker state.
702
- emnapiCtx.features.setImmediate(() => {
703
- if (!emnapiTSFN._liveSet.has(func)) {
704
- return;
705
- }
706
- if (Atomics.load(state(), pending >>> 2) === 0) {
707
- Atomics.store(state(), scheduled >>> 2, 0);
708
- return;
709
- }
710
- emnapiCtx.features.setImmediate(() => {
711
- // After destroy(), the func address is freed. Skip the atomics
712
- // on that address entirely to avoid use-after-free (JS-side
713
- // lifecycle check must run before touching the state words).
714
- if (!emnapiTSFN._liveSet.has(func)) {
715
- return;
716
- }
717
- try {
718
- // Consume the coalesced wakeup once, then let dispatch() observe any
719
- // queue mutations through dispatch_state like the C implementation.
720
- if (Atomics.exchange(state(), pending >>> 2, 0) === 0) {
721
- return;
722
- }
723
- emnapiTSFN.dispatch(func);
724
- }
725
- finally {
726
- // Allow a later wakeup to schedule a new drain chain. If another
727
- // worker-thread send raced with this drain, enqueue one more turn.
728
- if (emnapiTSFN._liveSet.has(func)) {
729
- Atomics.store(state(), scheduled >>> 2, 0);
730
- if (Atomics.load(state(), pending >>> 2) !== 0) {
731
- emnapiTSFN.enqueue(func);
732
- }
733
- }
734
- }
735
- });
736
- });
737
- },
738
- send(func) {
739
- const dispatchStateAddress = func + emnapiTSFN.offset.dispatch_state;
740
- const current_state = Atomics.or(new Uint32Array(emnapiTSFN.ensureBufferFor(dispatchStateAddress + 4)), dispatchStateAddress >>> 2, 1 << 1);
741
- if ((current_state & 1) === 1) {
742
- return;
743
- }
744
- const pendng = func + emnapiTSFN.offset.async_pending;
745
- // A wakeup is already pending, so this send only needs to leave the queued
746
- // work in the TSFN queue and let the existing drain pick it up.
747
- if (Atomics.load(new Int32Array(emnapiTSFN.ensureBufferFor(pendng + 4)), pendng >>> 2) !== 0) {
748
- return;
749
- }
750
- if (Atomics.exchange(new Int32Array(emnapiTSFN.ensureBufferFor(pendng + 4)), pendng >>> 2, 1) === 0) {
751
- if ((typeof emscripten_runtime.ENVIRONMENT_IS_PTHREAD !== 'undefined') && emscripten_runtime.ENVIRONMENT_IS_PTHREAD) {
752
- // Worker threads only post a wakeup token. Main-thread draining is
753
- // serialized by enqueue() once the message is received.
754
- postMessage({
755
- __emnapi__: {
756
- type: 'tsfn-send',
757
- payload: {
758
- tsfn: func
759
- }
760
- }
761
- });
762
- }
763
- else {
764
- // On the main thread we can skip the cross-thread hop and schedule the
765
- // coalesced drain chain directly.
766
- emnapiTSFN.enqueue(func);
767
- }
768
- }
769
- }
770
- };
771
- emnapiTSFN.init();
772
- emnapiPluginCtx.emnapiTSFN = emnapiTSFN;
773
- /**
774
- * @__deps _emnapi_node_emit_async_init
775
- * @__deps _emnapi_runtime_keepalive_push
776
- * @__sig ippppppppppp
777
- */
778
- function napi_create_threadsafe_function(env, func, async_resource, async_resource_name, max_queue_size, initial_thread_count, thread_finalize_data, thread_finalize_cb, context, call_js_cb, result) {
779
- if (!env)
780
- return 1 /* napi_status.napi_invalid_arg */;
781
- // @ts-expect-error
782
- const envObject = emnapi_shared.emnapiEnv;
783
- envObject.checkGCAccess();
784
- if (!async_resource_name)
785
- return envObject.setLastError(1 /* napi_status.napi_invalid_arg */);
786
- max_queue_size >>>= 0;
787
- initial_thread_count >>>= 0;
788
- env >>>= 0;
789
- thread_finalize_data >>>= 0;
790
- thread_finalize_cb >>>= 0;
791
- context >>>= 0;
792
- call_js_cb >>>= 0;
793
- max_queue_size = max_queue_size >>> 0;
794
- initial_thread_count = initial_thread_count >>> 0;
795
- if (initial_thread_count === 0) {
796
- return envObject.setLastError(1 /* napi_status.napi_invalid_arg */);
797
- }
798
- if (!result)
799
- return envObject.setLastError(1 /* napi_status.napi_invalid_arg */);
800
- let ref = 0;
801
- func >>>= 0;
802
- if (!func) {
803
- if (!call_js_cb)
804
- return envObject.setLastError(1 /* napi_status.napi_invalid_arg */);
805
- }
806
- else {
807
- const funcValue = emnapiCtx.jsValueFromNapiValue(func);
808
- if (typeof funcValue !== 'function') {
809
- return envObject.setLastError(1 /* napi_status.napi_invalid_arg */);
810
- }
811
- ref = emnapiCtx.createReference(envObject, func, 1, 1 /* ReferenceOwnership.kUserland */).id;
812
- }
813
- let asyncResourceObject;
814
- if (async_resource) {
815
- asyncResourceObject = emnapiCtx.jsValueFromNapiValue(async_resource);
816
- if (asyncResourceObject == null) {
817
- return envObject.setLastError(2 /* napi_status.napi_object_expected */);
818
- }
819
- asyncResourceObject = Object(asyncResourceObject);
820
- }
821
- else {
822
- asyncResourceObject = {};
823
- }
824
- const resource = emnapiCtx.napiValueFromJsValue(asyncResourceObject);
825
- let asyncResourceName = emnapiCtx.jsValueFromNapiValue(async_resource_name);
826
- if (typeof asyncResourceName === 'symbol') {
827
- return envObject.setLastError(3 /* napi_status.napi_string_expected */);
828
- }
829
- asyncResourceName = String(asyncResourceName);
830
- const resource_name = emnapiCtx.napiValueFromJsValue(asyncResourceName);
831
- // tsfn create
832
- const sizeofTSFN = emnapiTSFN.offset.__size__;
833
- let tsfn = emscripten_runtime._malloc(sizeofTSFN);
834
- if (!tsfn)
835
- return envObject.setLastError(9 /* napi_status.napi_generic_failure */);
836
- tsfn >>>= 0;
837
- new Uint8Array(emnapiTSFN.ensureBufferFor(tsfn + sizeofTSFN)).subarray(tsfn, tsfn + sizeofTSFN).fill(0);
838
- const resourceRef = emnapiCtx.createReference(envObject, resource, 1, 1 /* ReferenceOwnership.kUserland */);
839
- const resource_ = resourceRef.id;
840
- 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));
841
- GET_HEAP_DATA_VIEW().setUint32(tsfn + emnapiTSFN.offset.resource, resource_, true);
842
- if (!emnapiTSFN.initQueue(tsfn)) {
843
- emscripten_runtime._free(tsfn);
844
- resourceRef.dispose();
845
- return envObject.setLastError(9 /* napi_status.napi_generic_failure */);
846
- }
847
- __emnapi_node_emit_async_init(resource, resource_name, -1, tsfn + emnapiTSFN.offset.async_id);
848
- GET_HEAP_DATA_VIEW().setInt8(tsfn + emnapiTSFN.offset.is_some, 1, true);
849
- GET_HEAP_DATA_VIEW().setUint32(tsfn + emnapiTSFN.offset.thread_count, initial_thread_count, true);
850
- GET_HEAP_DATA_VIEW().setUint32(tsfn + emnapiTSFN.offset.context, context, true);
851
- GET_HEAP_DATA_VIEW().setUint32(tsfn + emnapiTSFN.offset.max_queue_size, max_queue_size, true);
852
- GET_HEAP_DATA_VIEW().setUint32(tsfn + emnapiTSFN.offset.ref, ref, true);
853
- GET_HEAP_DATA_VIEW().setUint32(tsfn + emnapiTSFN.offset.env, env, true);
854
- GET_HEAP_DATA_VIEW().setUint32(tsfn + emnapiTSFN.offset.finalize_data, thread_finalize_data, true);
855
- GET_HEAP_DATA_VIEW().setUint32(tsfn + emnapiTSFN.offset.finalize_cb, thread_finalize_cb, true);
856
- GET_HEAP_DATA_VIEW().setUint32(tsfn + emnapiTSFN.offset.call_js_cb, call_js_cb, true);
857
- emnapiCtx.addCleanupHook(envObject, emnapiTSFN.cleanup, tsfn);
858
- emnapiTSFN._liveSet.add(tsfn);
859
- envObject.ref();
860
- __emnapi_runtime_keepalive_push();
861
- emnapiCtx.increaseWaitingRequestCounter();
862
- GET_HEAP_DATA_VIEW().setUint32(tsfn + emnapiTSFN.offset.async_ref, 1, true);
863
- result >>>= 0;
864
- GET_HEAP_DATA_VIEW().setUint32(result, tsfn, true);
865
- return envObject.clearLastError();
866
- }
867
- /** @__sig ipp */
868
- function napi_get_threadsafe_function_context(func, result) {
869
- if (!func || !result) {
870
- emscripten_runtime.abort();
871
- return 1 /* napi_status.napi_invalid_arg */;
872
- }
873
- func >>>= 0;
874
- result >>>= 0;
875
- const context = emnapiTSFN.getContext(func);
876
- 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));
877
- GET_HEAP_DATA_VIEW().setUint32(result, context, true);
878
- return 0 /* napi_status.napi_ok */;
879
- }
880
- /** @__sig ippi */
881
- function napi_call_threadsafe_function(func, data, mode) {
882
- if (!func) {
883
- emscripten_runtime.abort();
884
- return 1 /* napi_status.napi_invalid_arg */;
885
- }
886
- func >>>= 0;
887
- data >>>= 0;
888
- return emnapiTSFN.push(func, data, mode);
889
- }
890
- /** @__sig ip */
891
- function napi_acquire_threadsafe_function(func) {
892
- if (!func) {
893
- emscripten_runtime.abort();
894
- return 1 /* napi_status.napi_invalid_arg */;
895
- }
896
- func >>>= 0;
897
- const mutex = emnapiTSFN.getMutex(func);
898
- return mutex.execute(() => {
899
- if (emnapiTSFN.getState(func) === 0 /* State.kOpen */) {
900
- emnapiTSFN.addThreadCount(func);
901
- return 0 /* napi_status.napi_ok */;
902
- }
903
- return 16 /* napi_status.napi_closing */;
904
- });
905
- }
906
- /** @__sig ipi */
907
- function napi_release_threadsafe_function(func, mode) {
908
- if (!func) {
909
- emscripten_runtime.abort();
910
- return 1 /* napi_status.napi_invalid_arg */;
911
- }
912
- func >>>= 0;
913
- const mutex = emnapiTSFN.getMutex(func);
914
- const cond = emnapiTSFN.getCond(func);
915
- let shouldDelete = false;
916
- const ret = mutex.execute(() => {
917
- if (emnapiTSFN.getThreadCount(func) === 0) {
918
- return 1 /* napi_status.napi_invalid_arg */;
919
- }
920
- emnapiTSFN.subThreadCount(func);
921
- if (emnapiTSFN.getThreadCount(func) === 0 || mode === 1 /* napi_threadsafe_function_release_mode.napi_tsfn_abort */) {
922
- if (emnapiTSFN.getState(func) === 0 /* State.kOpen */) {
923
- if (mode === 1 /* napi_threadsafe_function_release_mode.napi_tsfn_abort */) {
924
- emnapiTSFN.setState(func, 1 /* State.kClosing */);
925
- }
926
- if (emnapiTSFN.getState(func) === 1 /* State.kClosing */ && emnapiTSFN.getMaxQueueSize(func) > 0) {
927
- cond.signal();
928
- }
929
- emnapiTSFN.send(func);
930
- }
931
- }
932
- if (!(emnapiTSFN.getState(func) === 2 /* State.kClosed */ && emnapiTSFN.getThreadCount(func) === 0)) {
933
- return 0 /* napi_status.napi_ok */;
934
- }
935
- shouldDelete = true;
936
- return 0 /* napi_status.napi_ok */;
937
- });
938
- if (shouldDelete) {
939
- emnapiTSFN.destroy(func);
940
- }
941
- return ret;
942
- }
943
- /**
944
- * @__deps _emnapi_runtime_keepalive_pop
945
- * @__sig ipp
946
- */
947
- function napi_unref_threadsafe_function(env, func) {
948
- if (!func) {
949
- emscripten_runtime.abort();
950
- return 1 /* napi_status.napi_invalid_arg */;
951
- }
952
- func >>>= 0;
953
- const asyncRefAddress = func + emnapiTSFN.offset.async_ref;
954
- const asyncRefOffset = asyncRefAddress >>> 2;
955
- const arr = new Uint32Array(emnapiTSFN.ensureBufferFor(asyncRefAddress + 4));
956
- const currentValue = Atomics.load(arr, asyncRefOffset);
957
- if (currentValue > 0) {
958
- Atomics.store(arr, asyncRefOffset, currentValue - 1);
959
- if (currentValue === 1) {
960
- __emnapi_runtime_keepalive_pop();
961
- emnapiCtx.decreaseWaitingRequestCounter();
962
- }
963
- }
964
- return 0 /* napi_status.napi_ok */;
965
- }
966
- /**
967
- * @__deps _emnapi_runtime_keepalive_push
968
- * @__sig ipp
969
- */
970
- function napi_ref_threadsafe_function(env, func) {
971
- if (!func) {
972
- emscripten_runtime.abort();
973
- return 1 /* napi_status.napi_invalid_arg */;
974
- }
975
- func >>>= 0;
976
- const asyncRefAddress = func + emnapiTSFN.offset.async_ref;
977
- const asyncRefOffset = asyncRefAddress >>> 2;
978
- const arr = new Uint32Array(emnapiTSFN.ensureBufferFor(asyncRefAddress + 4));
979
- const currentValue = Atomics.load(arr, asyncRefOffset);
980
- if (!currentValue) {
981
- __emnapi_runtime_keepalive_push();
982
- emnapiCtx.increaseWaitingRequestCounter();
983
- }
984
- Atomics.store(arr, asyncRefOffset, currentValue + 1);
985
- return 0 /* napi_status.napi_ok */;
986
- }
987
-
988
- //#endregion src/threadsafe-function.ts
989
-
990
- exports.napi_acquire_threadsafe_function = napi_acquire_threadsafe_function;
991
- exports.napi_call_threadsafe_function = napi_call_threadsafe_function;
992
- exports.napi_create_threadsafe_function = napi_create_threadsafe_function;
993
- exports.napi_get_threadsafe_function_context = napi_get_threadsafe_function_context;
994
- exports.napi_ref_threadsafe_function = napi_ref_threadsafe_function;
995
- exports.napi_release_threadsafe_function = napi_release_threadsafe_function;
996
- exports.napi_unref_threadsafe_function = napi_unref_threadsafe_function;
997
-
998
- return exports;
999
-
1000
- })({}, emnapiPluginCtx, emnapiPluginCtx);
1001
- return {
1002
- importObject: (original) => {
1003
- Object.assign(original.napi, mod);
1004
- }
1005
- };
1006
- }
1007
-
1008
- //#endregion src/emnapi/threadsafe-function.js
1009
-
1010
- export { threadsafeFunction as default };