@smthrs/platform-bun 0.0.0-stage → 1.0.0-rc.12

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 (429) hide show
  1. package/CHANGELOG.md +73 -0
  2. package/LICENSE +21 -0
  3. package/README.md +110 -2
  4. package/dist/cjs/BunFileSystem.d.ts +44 -0
  5. package/dist/cjs/BunFileSystem.d.ts.map +1 -0
  6. package/dist/cjs/BunFileSystem.js +38 -0
  7. package/dist/cjs/BunFileSystem.js.map +7 -0
  8. package/dist/cjs/BunHost.d.ts +205 -0
  9. package/dist/cjs/BunHost.d.ts.map +1 -0
  10. package/dist/cjs/BunHost.js +148 -0
  11. package/dist/cjs/BunHost.js.map +7 -0
  12. package/dist/cjs/index.d.ts +26 -0
  13. package/dist/cjs/index.d.ts.map +1 -0
  14. package/dist/cjs/index.js +37 -0
  15. package/dist/cjs/index.js.map +7 -0
  16. package/dist/cjs/package.json +1 -0
  17. package/dist/esm/BunFileSystem.d.ts +44 -0
  18. package/dist/esm/BunFileSystem.d.ts.map +1 -0
  19. package/dist/esm/BunFileSystem.js +35 -0
  20. package/dist/esm/BunFileSystem.js.map +1 -0
  21. package/dist/esm/BunHost.d.ts +205 -0
  22. package/dist/esm/BunHost.d.ts.map +1 -0
  23. package/dist/esm/BunHost.js +248 -0
  24. package/dist/esm/BunHost.js.map +1 -0
  25. package/dist/esm/index.d.ts +26 -0
  26. package/dist/esm/index.d.ts.map +1 -0
  27. package/dist/esm/index.js +26 -0
  28. package/dist/esm/index.js.map +1 -0
  29. package/dist/vendor/adapters.json +3067 -0
  30. package/dist/vendor/bun/BunAddressResolver.d.ts +15 -0
  31. package/dist/vendor/bun/BunAddressResolver.js +8 -0
  32. package/dist/vendor/bun/BunChildProcessSpawner.d.ts +8 -0
  33. package/dist/vendor/bun/BunChildProcessSpawner.js +14 -0
  34. package/dist/vendor/bun/BunClusterHttp.d.ts +76 -0
  35. package/dist/vendor/bun/BunClusterHttp.js +39 -0
  36. package/dist/vendor/bun/BunClusterSocket.d.ts +70 -0
  37. package/dist/vendor/bun/BunClusterSocket.js +22 -0
  38. package/dist/vendor/bun/BunCrypto.d.ts +11 -0
  39. package/dist/vendor/bun/BunCrypto.js +8 -0
  40. package/dist/vendor/bun/BunDatagramSocket.d.ts +227 -0
  41. package/dist/vendor/bun/BunDatagramSocket.js +11 -0
  42. package/dist/vendor/bun/BunDns.d.ts +72 -0
  43. package/dist/vendor/bun/BunDns.js +12 -0
  44. package/dist/vendor/bun/BunFileSystem.d.ts +11 -0
  45. package/dist/vendor/bun/BunFileSystem.js +9 -0
  46. package/dist/vendor/bun/BunHttpClient.d.ts +10 -0
  47. package/dist/vendor/bun/BunHttpClient.js +1 -0
  48. package/dist/vendor/bun/BunHttpPlatform.d.ts +11 -0
  49. package/dist/vendor/bun/BunHttpPlatform.js +11 -0
  50. package/dist/vendor/bun/BunHttpServer.d.ts +151 -0
  51. package/dist/vendor/bun/BunHttpServer.js +38 -0
  52. package/dist/vendor/bun/BunHttpServerRequest.d.ts +20 -0
  53. package/dist/vendor/bun/BunHttpServerRequest.js +7 -0
  54. package/dist/vendor/bun/BunMultipart.d.ts +34 -0
  55. package/dist/vendor/bun/BunMultipart.js +12 -0
  56. package/dist/vendor/bun/BunPath.d.ts +27 -0
  57. package/dist/vendor/bun/BunPath.js +12 -0
  58. package/dist/vendor/bun/BunRedis.d.ts +53 -0
  59. package/dist/vendor/bun/BunRedis.js +11 -0
  60. package/dist/vendor/bun/BunRuntime.d.ts +88 -0
  61. package/dist/vendor/bun/BunRuntime.js +8 -0
  62. package/dist/vendor/bun/BunServices.d.ts +37 -0
  63. package/dist/vendor/bun/BunServices.js +23 -0
  64. package/dist/vendor/bun/BunSink.d.ts +9 -0
  65. package/dist/vendor/bun/BunSink.js +12 -0
  66. package/dist/vendor/bun/BunSocket.d.ts +45 -0
  67. package/dist/vendor/bun/BunSocket.js +29 -0
  68. package/dist/vendor/bun/BunSocketServer.d.ts +9 -0
  69. package/dist/vendor/bun/BunSocketServer.js +21 -0
  70. package/dist/vendor/bun/BunStdio.d.ts +12 -0
  71. package/dist/vendor/bun/BunStdio.js +10 -0
  72. package/dist/vendor/bun/BunStream.d.ts +20 -0
  73. package/dist/vendor/bun/BunStream.js +30 -0
  74. package/dist/vendor/bun/BunTerminal.d.ts +24 -0
  75. package/dist/vendor/bun/BunTerminal.js +10 -0
  76. package/dist/vendor/bun/BunWorker.d.ts +22 -0
  77. package/dist/vendor/bun/BunWorker.js +9 -0
  78. package/dist/vendor/bun/BunWorkerRunner.d.ts +13 -0
  79. package/dist/vendor/bun/BunWorkerRunner.js +7 -0
  80. package/dist/vendor/bun/LICENSE +21 -0
  81. package/dist/vendor/bun/index.d.ts +130 -0
  82. package/dist/vendor/bun/index.js +121 -0
  83. package/dist/vendor/chunk-2ZAGBWTH.js +40 -0
  84. package/dist/vendor/chunk-3SL3HKQA.js +118 -0
  85. package/dist/vendor/chunk-3WUGYBFU.js +0 -0
  86. package/dist/vendor/chunk-4WIQ2XN7.js +28 -0
  87. package/dist/vendor/chunk-5ET7NHI7.js +15 -0
  88. package/dist/vendor/chunk-6FSJ2PMW.js +53 -0
  89. package/dist/vendor/chunk-6L2NJEOV.js +62 -0
  90. package/dist/vendor/chunk-72X6VEVD.js +62 -0
  91. package/dist/vendor/chunk-7NMJM44J.js +26 -0
  92. package/dist/vendor/chunk-A7AY2JP7.js +71 -0
  93. package/dist/vendor/chunk-A7UXCEJA.js +81 -0
  94. package/dist/vendor/chunk-ADP5LRUF.js +274 -0
  95. package/dist/vendor/chunk-ASGOJ3XA.js +0 -0
  96. package/dist/vendor/chunk-AWNTTSHL.js +34 -0
  97. package/dist/vendor/chunk-BUKVIAEM.js +20 -0
  98. package/dist/vendor/chunk-BY3SDXID.js +501 -0
  99. package/dist/vendor/chunk-C3PGUWW5.js +414 -0
  100. package/dist/vendor/chunk-CL4EIDIY.js +7 -0
  101. package/dist/vendor/chunk-D2ZL4PLZ.js +93 -0
  102. package/dist/vendor/chunk-D4HEMNGU.js +22 -0
  103. package/dist/vendor/chunk-F4V5TRY7.js +85 -0
  104. package/dist/vendor/chunk-F772LLZ5.js +31 -0
  105. package/dist/vendor/chunk-FFD6R5JZ.js +104 -0
  106. package/dist/vendor/chunk-G4HOH7GK.js +65 -0
  107. package/dist/vendor/chunk-GJN7MEBF.js +18 -0
  108. package/dist/vendor/chunk-HDV6VIRM.js +48 -0
  109. package/dist/vendor/chunk-IHV7Z4SW.js +34 -0
  110. package/dist/vendor/chunk-IWSDM4CG.js +16 -0
  111. package/dist/vendor/chunk-JOQDB2HC.js +26 -0
  112. package/dist/vendor/chunk-KABHKTVG.js +18 -0
  113. package/dist/vendor/chunk-KFDBU6RR.js +60 -0
  114. package/dist/vendor/chunk-KHPN5DWT.js +20 -0
  115. package/dist/vendor/chunk-LNWGIDIG.js +20 -0
  116. package/dist/vendor/chunk-MLKGABMK.js +9 -0
  117. package/dist/vendor/chunk-MUEED3C3.js +144 -0
  118. package/dist/vendor/chunk-N6TK35N5.js +18 -0
  119. package/dist/vendor/chunk-NQO6V4KI.js +580 -0
  120. package/dist/vendor/chunk-NUJQMLJP.js +325 -0
  121. package/dist/vendor/chunk-OF3N2FN4.js +61 -0
  122. package/dist/vendor/chunk-OGZJACUS.js +57 -0
  123. package/dist/vendor/chunk-PCEVZYXO.js +63 -0
  124. package/dist/vendor/chunk-PECOFLCU.js +85 -0
  125. package/dist/vendor/chunk-PU7QVYND.js +18 -0
  126. package/dist/vendor/chunk-QGPZPULA.js +51 -0
  127. package/dist/vendor/chunk-QHR2RC5M.js +109 -0
  128. package/dist/vendor/chunk-R2YON4A6.js +28 -0
  129. package/dist/vendor/chunk-R327POEZ.js +18 -0
  130. package/dist/vendor/chunk-REFJNBQR.js +18 -0
  131. package/dist/vendor/chunk-RHJ6LV32.js +43 -0
  132. package/dist/vendor/chunk-RKVXYKHJ.js +29 -0
  133. package/dist/vendor/chunk-RP3EWS4C.js +0 -0
  134. package/dist/vendor/chunk-RQH5DSBA.js +249 -0
  135. package/dist/vendor/chunk-RQQ5TSCD.js +374 -0
  136. package/dist/vendor/chunk-S6QUQLBV.js +229 -0
  137. package/dist/vendor/chunk-SCXQLSNW.js +34 -0
  138. package/dist/vendor/chunk-SD4X5NGU.js +515 -0
  139. package/dist/vendor/chunk-T332WJRS.js +128 -0
  140. package/dist/vendor/chunk-T5FQGISI.js +18 -0
  141. package/dist/vendor/chunk-TBPDCAMH.js +70 -0
  142. package/dist/vendor/chunk-UFWLKG4I.js +16 -0
  143. package/dist/vendor/chunk-UPIQ52FQ.js +426 -0
  144. package/dist/vendor/chunk-UUQXJRMK.js +14 -0
  145. package/dist/vendor/chunk-UUYTTEDH.js +36 -0
  146. package/dist/vendor/chunk-V2EB7FHY.js +129 -0
  147. package/dist/vendor/chunk-VIWU4EBF.js +18 -0
  148. package/dist/vendor/chunk-WPZDL2D7.js +21 -0
  149. package/dist/vendor/chunk-X4YPHWAE.js +22 -0
  150. package/dist/vendor/chunk-XACFQJY7.js +93 -0
  151. package/dist/vendor/chunk-Y7V6ISZS.js +418 -0
  152. package/dist/vendor/chunk-YDY5P7GL.js +20 -0
  153. package/dist/vendor/chunk-ZNKZXDUD.js +18 -0
  154. package/dist/vendor/chunk-ZS3VW5QR.js +63 -0
  155. package/dist/vendor/chunk-ZUUCLHBP.js +18 -0
  156. package/dist/vendor/chunk-ZVJCBTJG.js +131 -0
  157. package/dist/vendor/cjs/bun/BunAddressResolver.d.ts +15 -0
  158. package/dist/vendor/cjs/bun/BunAddressResolver.js +1 -0
  159. package/dist/vendor/cjs/bun/BunChildProcessSpawner.d.ts +8 -0
  160. package/dist/vendor/cjs/bun/BunChildProcessSpawner.js +1 -0
  161. package/dist/vendor/cjs/bun/BunClusterHttp.d.ts +76 -0
  162. package/dist/vendor/cjs/bun/BunClusterHttp.js +1 -0
  163. package/dist/vendor/cjs/bun/BunClusterSocket.d.ts +70 -0
  164. package/dist/vendor/cjs/bun/BunClusterSocket.js +1 -0
  165. package/dist/vendor/cjs/bun/BunCrypto.d.ts +11 -0
  166. package/dist/vendor/cjs/bun/BunCrypto.js +1 -0
  167. package/dist/vendor/cjs/bun/BunDatagramSocket.d.ts +227 -0
  168. package/dist/vendor/cjs/bun/BunDatagramSocket.js +1 -0
  169. package/dist/vendor/cjs/bun/BunDns.d.ts +72 -0
  170. package/dist/vendor/cjs/bun/BunDns.js +1 -0
  171. package/dist/vendor/cjs/bun/BunFileSystem.d.ts +11 -0
  172. package/dist/vendor/cjs/bun/BunFileSystem.js +1 -0
  173. package/dist/vendor/cjs/bun/BunHttpClient.d.ts +10 -0
  174. package/dist/vendor/cjs/bun/BunHttpClient.js +1 -0
  175. package/dist/vendor/cjs/bun/BunHttpPlatform.d.ts +11 -0
  176. package/dist/vendor/cjs/bun/BunHttpPlatform.js +1 -0
  177. package/dist/vendor/cjs/bun/BunHttpServer.d.ts +151 -0
  178. package/dist/vendor/cjs/bun/BunHttpServer.js +1 -0
  179. package/dist/vendor/cjs/bun/BunHttpServerRequest.d.ts +20 -0
  180. package/dist/vendor/cjs/bun/BunHttpServerRequest.js +1 -0
  181. package/dist/vendor/cjs/bun/BunMultipart.d.ts +34 -0
  182. package/dist/vendor/cjs/bun/BunMultipart.js +1 -0
  183. package/dist/vendor/cjs/bun/BunPath.d.ts +27 -0
  184. package/dist/vendor/cjs/bun/BunPath.js +1 -0
  185. package/dist/vendor/cjs/bun/BunRedis.d.ts +53 -0
  186. package/dist/vendor/cjs/bun/BunRedis.js +1 -0
  187. package/dist/vendor/cjs/bun/BunRuntime.d.ts +88 -0
  188. package/dist/vendor/cjs/bun/BunRuntime.js +1 -0
  189. package/dist/vendor/cjs/bun/BunServices.d.ts +37 -0
  190. package/dist/vendor/cjs/bun/BunServices.js +1 -0
  191. package/dist/vendor/cjs/bun/BunSink.d.ts +9 -0
  192. package/dist/vendor/cjs/bun/BunSink.js +1 -0
  193. package/dist/vendor/cjs/bun/BunSocket.d.ts +45 -0
  194. package/dist/vendor/cjs/bun/BunSocket.js +1 -0
  195. package/dist/vendor/cjs/bun/BunSocketServer.d.ts +9 -0
  196. package/dist/vendor/cjs/bun/BunSocketServer.js +1 -0
  197. package/dist/vendor/cjs/bun/BunStdio.d.ts +12 -0
  198. package/dist/vendor/cjs/bun/BunStdio.js +1 -0
  199. package/dist/vendor/cjs/bun/BunStream.d.ts +20 -0
  200. package/dist/vendor/cjs/bun/BunStream.js +1 -0
  201. package/dist/vendor/cjs/bun/BunTerminal.d.ts +24 -0
  202. package/dist/vendor/cjs/bun/BunTerminal.js +1 -0
  203. package/dist/vendor/cjs/bun/BunWorker.d.ts +22 -0
  204. package/dist/vendor/cjs/bun/BunWorker.js +1 -0
  205. package/dist/vendor/cjs/bun/BunWorkerRunner.d.ts +13 -0
  206. package/dist/vendor/cjs/bun/BunWorkerRunner.js +1 -0
  207. package/dist/vendor/cjs/bun/index.d.ts +130 -0
  208. package/dist/vendor/cjs/bun/index.js +1 -0
  209. package/dist/vendor/cjs/node/NodeAddressResolver.d.ts +16 -0
  210. package/dist/vendor/cjs/node/NodeAddressResolver.js +1 -0
  211. package/dist/vendor/cjs/node/NodeChildProcessSpawner.d.ts +8 -0
  212. package/dist/vendor/cjs/node/NodeChildProcessSpawner.js +1 -0
  213. package/dist/vendor/cjs/node/NodeClusterHttp.d.ts +54 -0
  214. package/dist/vendor/cjs/node/NodeClusterHttp.js +1 -0
  215. package/dist/vendor/cjs/node/NodeClusterSocket.d.ts +85 -0
  216. package/dist/vendor/cjs/node/NodeClusterSocket.js +1 -0
  217. package/dist/vendor/cjs/node/NodeCrypto.d.ts +11 -0
  218. package/dist/vendor/cjs/node/NodeCrypto.js +1 -0
  219. package/dist/vendor/cjs/node/NodeDatagramSocket.d.ts +10 -0
  220. package/dist/vendor/cjs/node/NodeDatagramSocket.js +1 -0
  221. package/dist/vendor/cjs/node/NodeDns.d.ts +51 -0
  222. package/dist/vendor/cjs/node/NodeDns.js +1 -0
  223. package/dist/vendor/cjs/node/NodeFileSystem.d.ts +11 -0
  224. package/dist/vendor/cjs/node/NodeFileSystem.js +1 -0
  225. package/dist/vendor/cjs/node/NodeHttpClient.d.ts +198 -0
  226. package/dist/vendor/cjs/node/NodeHttpClient.js +1 -0
  227. package/dist/vendor/cjs/node/NodeHttpIncomingMessage.d.ts +64 -0
  228. package/dist/vendor/cjs/node/NodeHttpIncomingMessage.js +1 -0
  229. package/dist/vendor/cjs/node/NodeHttpPlatform.d.ts +38 -0
  230. package/dist/vendor/cjs/node/NodeHttpPlatform.js +1 -0
  231. package/dist/vendor/cjs/node/NodeHttpServer.d.ts +131 -0
  232. package/dist/vendor/cjs/node/NodeHttpServer.js +1 -0
  233. package/dist/vendor/cjs/node/NodeHttpServerRequest.d.ts +32 -0
  234. package/dist/vendor/cjs/node/NodeHttpServerRequest.js +1 -0
  235. package/dist/vendor/cjs/node/NodeMultipart.d.ts +50 -0
  236. package/dist/vendor/cjs/node/NodeMultipart.js +1 -0
  237. package/dist/vendor/cjs/node/NodeMultipartParser.d.ts +105 -0
  238. package/dist/vendor/cjs/node/NodeMultipartParser.js +1 -0
  239. package/dist/vendor/cjs/node/NodePath.d.ts +30 -0
  240. package/dist/vendor/cjs/node/NodePath.js +1 -0
  241. package/dist/vendor/cjs/node/NodeRedis.d.ts +78 -0
  242. package/dist/vendor/cjs/node/NodeRedis.js +1 -0
  243. package/dist/vendor/cjs/node/NodeRuntime.d.ts +88 -0
  244. package/dist/vendor/cjs/node/NodeRuntime.js +1 -0
  245. package/dist/vendor/cjs/node/NodeServices.d.ts +37 -0
  246. package/dist/vendor/cjs/node/NodeServices.js +1 -0
  247. package/dist/vendor/cjs/node/NodeSink.d.ts +9 -0
  248. package/dist/vendor/cjs/node/NodeSink.js +1 -0
  249. package/dist/vendor/cjs/node/NodeSocket.d.ts +45 -0
  250. package/dist/vendor/cjs/node/NodeSocket.js +1 -0
  251. package/dist/vendor/cjs/node/NodeSocketServer.d.ts +9 -0
  252. package/dist/vendor/cjs/node/NodeSocketServer.js +1 -0
  253. package/dist/vendor/cjs/node/NodeStdio.d.ts +12 -0
  254. package/dist/vendor/cjs/node/NodeStdio.js +1 -0
  255. package/dist/vendor/cjs/node/NodeStream.d.ts +9 -0
  256. package/dist/vendor/cjs/node/NodeStream.js +1 -0
  257. package/dist/vendor/cjs/node/NodeTerminal.d.ts +24 -0
  258. package/dist/vendor/cjs/node/NodeTerminal.js +1 -0
  259. package/dist/vendor/cjs/node/NodeWorker.d.ts +24 -0
  260. package/dist/vendor/cjs/node/NodeWorker.js +1 -0
  261. package/dist/vendor/cjs/node/NodeWorkerRunner.d.ts +13 -0
  262. package/dist/vendor/cjs/node/NodeWorkerRunner.js +1 -0
  263. package/dist/vendor/cjs/node/Undici.d.ts +31 -0
  264. package/dist/vendor/cjs/node/Undici.js +1 -0
  265. package/dist/vendor/cjs/node/index.d.ts +140 -0
  266. package/dist/vendor/cjs/node/index.js +1 -0
  267. package/dist/vendor/cjs/node-shared/NodeAddressResolver.d.ts +13 -0
  268. package/dist/vendor/cjs/node-shared/NodeAddressResolver.js +1 -0
  269. package/dist/vendor/cjs/node-shared/NodeChildProcessSpawner.d.ts +66 -0
  270. package/dist/vendor/cjs/node-shared/NodeChildProcessSpawner.js +1 -0
  271. package/dist/vendor/cjs/node-shared/NodeClusterSocket.d.ts +35 -0
  272. package/dist/vendor/cjs/node-shared/NodeClusterSocket.js +1 -0
  273. package/dist/vendor/cjs/node-shared/NodeCrypto.d.ts +30 -0
  274. package/dist/vendor/cjs/node-shared/NodeCrypto.js +1 -0
  275. package/dist/vendor/cjs/node-shared/NodeDatagramSocket.d.ts +246 -0
  276. package/dist/vendor/cjs/node-shared/NodeDatagramSocket.js +1 -0
  277. package/dist/vendor/cjs/node-shared/NodeDns.d.ts +221 -0
  278. package/dist/vendor/cjs/node-shared/NodeDns.js +1 -0
  279. package/dist/vendor/cjs/node-shared/NodeFileSystem.d.ts +12 -0
  280. package/dist/vendor/cjs/node-shared/NodeFileSystem.js +1 -0
  281. package/dist/vendor/cjs/node-shared/NodeHttpCompression.d.ts +40 -0
  282. package/dist/vendor/cjs/node-shared/NodeHttpCompression.js +1 -0
  283. package/dist/vendor/cjs/node-shared/NodePath.d.ts +30 -0
  284. package/dist/vendor/cjs/node-shared/NodePath.js +1 -0
  285. package/dist/vendor/cjs/node-shared/NodeRuntime.d.ts +51 -0
  286. package/dist/vendor/cjs/node-shared/NodeRuntime.js +1 -0
  287. package/dist/vendor/cjs/node-shared/NodeSink.d.ts +73 -0
  288. package/dist/vendor/cjs/node-shared/NodeSink.js +1 -0
  289. package/dist/vendor/cjs/node-shared/NodeSocket.d.ts +144 -0
  290. package/dist/vendor/cjs/node-shared/NodeSocket.js +1 -0
  291. package/dist/vendor/cjs/node-shared/NodeSocketServer.d.ts +87 -0
  292. package/dist/vendor/cjs/node-shared/NodeSocketServer.js +1 -0
  293. package/dist/vendor/cjs/node-shared/NodeStdio.d.ts +13 -0
  294. package/dist/vendor/cjs/node-shared/NodeStdio.js +1 -0
  295. package/dist/vendor/cjs/node-shared/NodeStream.d.ts +194 -0
  296. package/dist/vendor/cjs/node-shared/NodeStream.js +1 -0
  297. package/dist/vendor/cjs/node-shared/NodeTerminal.d.ts +24 -0
  298. package/dist/vendor/cjs/node-shared/NodeTerminal.js +1 -0
  299. package/dist/vendor/cjs/node-shared/index.d.ts +85 -0
  300. package/dist/vendor/cjs/node-shared/index.js +1 -0
  301. package/dist/vendor/cjs/node-shared/internal/nodeChildProcessSpawner.d.ts +4 -0
  302. package/dist/vendor/cjs/node-shared/internal/nodeChildProcessSpawner.js +1 -0
  303. package/dist/vendor/cjs/node-shared/internal/utils.d.ts +2 -0
  304. package/dist/vendor/cjs/node-shared/internal/utils.js +1 -0
  305. package/dist/vendor/cjs/package.json +1 -0
  306. package/dist/vendor/cjs/platform-bun.d.ts +130 -0
  307. package/dist/vendor/cjs/platform-bun.js +1 -0
  308. package/dist/vendor/cjs/platform-node-shared.d.ts +85 -0
  309. package/dist/vendor/cjs/platform-node-shared.js +1 -0
  310. package/dist/vendor/cjs/platform-node.d.ts +140 -0
  311. package/dist/vendor/cjs/platform-node.js +1 -0
  312. package/dist/vendor/node/LICENSE +21 -0
  313. package/dist/vendor/node/NodeAddressResolver.d.ts +16 -0
  314. package/dist/vendor/node/NodeAddressResolver.js +8 -0
  315. package/dist/vendor/node/NodeChildProcessSpawner.d.ts +8 -0
  316. package/dist/vendor/node/NodeChildProcessSpawner.js +14 -0
  317. package/dist/vendor/node/NodeClusterHttp.d.ts +54 -0
  318. package/dist/vendor/node/NodeClusterHttp.js +43 -0
  319. package/dist/vendor/node/NodeClusterSocket.d.ts +85 -0
  320. package/dist/vendor/node/NodeClusterSocket.js +30 -0
  321. package/dist/vendor/node/NodeCrypto.d.ts +11 -0
  322. package/dist/vendor/node/NodeCrypto.js +8 -0
  323. package/dist/vendor/node/NodeDatagramSocket.d.ts +10 -0
  324. package/dist/vendor/node/NodeDatagramSocket.js +12 -0
  325. package/dist/vendor/node/NodeDns.d.ts +51 -0
  326. package/dist/vendor/node/NodeDns.js +12 -0
  327. package/dist/vendor/node/NodeFileSystem.d.ts +11 -0
  328. package/dist/vendor/node/NodeFileSystem.js +9 -0
  329. package/dist/vendor/node/NodeHttpClient.d.ts +198 -0
  330. package/dist/vendor/node/NodeHttpClient.js +46 -0
  331. package/dist/vendor/node/NodeHttpIncomingMessage.d.ts +64 -0
  332. package/dist/vendor/node/NodeHttpIncomingMessage.js +10 -0
  333. package/dist/vendor/node/NodeHttpPlatform.d.ts +38 -0
  334. package/dist/vendor/node/NodeHttpPlatform.js +16 -0
  335. package/dist/vendor/node/NodeHttpServer.d.ts +131 -0
  336. package/dist/vendor/node/NodeHttpServer.js +46 -0
  337. package/dist/vendor/node/NodeHttpServerRequest.d.ts +32 -0
  338. package/dist/vendor/node/NodeHttpServerRequest.js +9 -0
  339. package/dist/vendor/node/NodeMultipart.d.ts +50 -0
  340. package/dist/vendor/node/NodeMultipart.js +15 -0
  341. package/dist/vendor/node/NodeMultipartParser.d.ts +105 -0
  342. package/dist/vendor/node/NodeMultipartParser.js +11 -0
  343. package/dist/vendor/node/NodePath.d.ts +30 -0
  344. package/dist/vendor/node/NodePath.js +12 -0
  345. package/dist/vendor/node/NodeRedis.d.ts +78 -0
  346. package/dist/vendor/node/NodeRedis.js +11 -0
  347. package/dist/vendor/node/NodeRuntime.d.ts +88 -0
  348. package/dist/vendor/node/NodeRuntime.js +8 -0
  349. package/dist/vendor/node/NodeServices.d.ts +37 -0
  350. package/dist/vendor/node/NodeServices.js +23 -0
  351. package/dist/vendor/node/NodeSink.d.ts +9 -0
  352. package/dist/vendor/node/NodeSink.js +12 -0
  353. package/dist/vendor/node/NodeSocket.d.ts +45 -0
  354. package/dist/vendor/node/NodeSocket.js +31 -0
  355. package/dist/vendor/node/NodeSocketServer.d.ts +9 -0
  356. package/dist/vendor/node/NodeSocketServer.js +21 -0
  357. package/dist/vendor/node/NodeStdio.d.ts +12 -0
  358. package/dist/vendor/node/NodeStdio.js +10 -0
  359. package/dist/vendor/node/NodeStream.d.ts +9 -0
  360. package/dist/vendor/node/NodeStream.js +27 -0
  361. package/dist/vendor/node/NodeTerminal.d.ts +24 -0
  362. package/dist/vendor/node/NodeTerminal.js +10 -0
  363. package/dist/vendor/node/NodeWorker.d.ts +24 -0
  364. package/dist/vendor/node/NodeWorker.js +9 -0
  365. package/dist/vendor/node/NodeWorkerRunner.d.ts +13 -0
  366. package/dist/vendor/node/NodeWorkerRunner.js +7 -0
  367. package/dist/vendor/node/Undici.d.ts +31 -0
  368. package/dist/vendor/node/Undici.js +9 -0
  369. package/dist/vendor/node/index.d.ts +140 -0
  370. package/dist/vendor/node/index.js +130 -0
  371. package/dist/vendor/node-shared/LICENSE +21 -0
  372. package/dist/vendor/node-shared/NodeAddressResolver.d.ts +13 -0
  373. package/dist/vendor/node-shared/NodeAddressResolver.js +7 -0
  374. package/dist/vendor/node-shared/NodeChildProcessSpawner.d.ts +66 -0
  375. package/dist/vendor/node-shared/NodeChildProcessSpawner.js +13 -0
  376. package/dist/vendor/node-shared/NodeClusterSocket.d.ts +35 -0
  377. package/dist/vendor/node-shared/NodeClusterSocket.js +11 -0
  378. package/dist/vendor/node-shared/NodeCrypto.d.ts +30 -0
  379. package/dist/vendor/node-shared/NodeCrypto.js +9 -0
  380. package/dist/vendor/node-shared/NodeDatagramSocket.d.ts +246 -0
  381. package/dist/vendor/node-shared/NodeDatagramSocket.js +11 -0
  382. package/dist/vendor/node-shared/NodeDns.d.ts +221 -0
  383. package/dist/vendor/node-shared/NodeDns.js +31 -0
  384. package/dist/vendor/node-shared/NodeFileSystem.d.ts +12 -0
  385. package/dist/vendor/node-shared/NodeFileSystem.js +8 -0
  386. package/dist/vendor/node-shared/NodeHttpCompression.d.ts +40 -0
  387. package/dist/vendor/node-shared/NodeHttpCompression.js +13 -0
  388. package/dist/vendor/node-shared/NodePath.d.ts +30 -0
  389. package/dist/vendor/node-shared/NodePath.js +11 -0
  390. package/dist/vendor/node-shared/NodeRuntime.d.ts +51 -0
  391. package/dist/vendor/node-shared/NodeRuntime.js +7 -0
  392. package/dist/vendor/node-shared/NodeSink.d.ts +73 -0
  393. package/dist/vendor/node-shared/NodeSink.js +11 -0
  394. package/dist/vendor/node-shared/NodeSocket.d.ts +144 -0
  395. package/dist/vendor/node-shared/NodeSocket.js +23 -0
  396. package/dist/vendor/node-shared/NodeSocketServer.d.ts +87 -0
  397. package/dist/vendor/node-shared/NodeSocketServer.js +20 -0
  398. package/dist/vendor/node-shared/NodeStdio.d.ts +13 -0
  399. package/dist/vendor/node-shared/NodeStdio.js +9 -0
  400. package/dist/vendor/node-shared/NodeStream.d.ts +194 -0
  401. package/dist/vendor/node-shared/NodeStream.js +26 -0
  402. package/dist/vendor/node-shared/NodeTerminal.d.ts +24 -0
  403. package/dist/vendor/node-shared/NodeTerminal.js +9 -0
  404. package/dist/vendor/node-shared/index.d.ts +85 -0
  405. package/dist/vendor/node-shared/index.js +70 -0
  406. package/dist/vendor/node-shared/internal/nodeChildProcessSpawner.d.ts +4 -0
  407. package/dist/vendor/node-shared/internal/nodeChildProcessSpawner.js +7 -0
  408. package/dist/vendor/node-shared/internal/utils.d.ts +2 -0
  409. package/dist/vendor/node-shared/internal/utils.js +7 -0
  410. package/dist/vendor/platform-bun.d.ts +130 -0
  411. package/dist/vendor/platform-bun.js +121 -0
  412. package/dist/vendor/platform-node-shared.d.ts +85 -0
  413. package/dist/vendor/platform-node-shared.js +70 -0
  414. package/dist/vendor/platform-node.d.ts +140 -0
  415. package/dist/vendor/platform-node.js +130 -0
  416. package/docs/README.md +135 -0
  417. package/docs/api.md +264 -0
  418. package/docs/concepts/host-surface.md +152 -0
  419. package/docs/concepts/runtime-parity.md +80 -0
  420. package/docs/guides/bind-a-repository-root.md +109 -0
  421. package/docs/guides/configure-the-filesystem-helper.md +113 -0
  422. package/docs/guides/contain-child-processes.md +178 -0
  423. package/docs/installation.md +131 -0
  424. package/docs/quickstart.md +163 -0
  425. package/docs/troubleshooting.md +163 -0
  426. package/package.json +146 -3
  427. package/src/BunFileSystem.ts +47 -0
  428. package/src/BunHost.ts +345 -0
  429. package/src/index.ts +27 -0
@@ -0,0 +1,109 @@
1
+ import {
2
+ __export
3
+ } from "./chunk-MLKGABMK.js";
4
+
5
+ // ../../../../node_modules/.pnpm/@effect+platform-node@4.0.4_effect@4.0.4_redis@6.2.1_@opentelemetry+api@1.9.1_/node_modules/@effect/platform-node/dist/NodeMultipartParser.js
6
+ var NodeMultipartParser_exports = {};
7
+ __export(NodeMultipartParser_exports, {
8
+ FileStream: () => FileStream,
9
+ MultipartStream: () => MultipartStream,
10
+ make: () => make
11
+ });
12
+ import { make as makeParser } from "effect/http/MultipartParser";
13
+ import { Duplex, Readable } from "node:stream";
14
+ var MultipartStream = class extends Duplex {
15
+ _parser;
16
+ _canWrite = true;
17
+ _writeCallback;
18
+ constructor(config) {
19
+ super({
20
+ readableObjectMode: true
21
+ });
22
+ let currentError;
23
+ let currentFile;
24
+ this._parser = makeParser({
25
+ ...config,
26
+ onField: (info, value) => {
27
+ if (currentError !== void 0) return;
28
+ const field = {
29
+ _tag: "Field",
30
+ info,
31
+ value
32
+ };
33
+ this.push(field);
34
+ this.emit("field", field);
35
+ },
36
+ onFile: (info) => {
37
+ if (currentError !== void 0) return (_) => {
38
+ };
39
+ const file = new FileStream(info, this);
40
+ currentFile = file;
41
+ this.push(file);
42
+ this.emit("file", file);
43
+ return (chunk) => {
44
+ if (currentError !== void 0) return;
45
+ this._canWrite = file.push(chunk);
46
+ if (chunk === null && !this._canWrite) {
47
+ currentFile = void 0;
48
+ this._resume();
49
+ }
50
+ };
51
+ },
52
+ onError: (error) => {
53
+ this.emit("error", error);
54
+ currentFile?.emit("error", error);
55
+ currentError = error;
56
+ },
57
+ onDone: () => {
58
+ this.push(null);
59
+ }
60
+ });
61
+ }
62
+ _resume() {
63
+ this._canWrite = true;
64
+ if (this._writeCallback !== void 0) {
65
+ const callback = this._writeCallback;
66
+ this._writeCallback = void 0;
67
+ callback();
68
+ }
69
+ }
70
+ _read(_size) {
71
+ }
72
+ _write(chunk, encoding, callback) {
73
+ this._parser.write(chunk instanceof Uint8Array ? chunk : Buffer.from(chunk, encoding));
74
+ if (this._canWrite) {
75
+ callback();
76
+ } else {
77
+ this._writeCallback = callback;
78
+ }
79
+ }
80
+ _final(callback) {
81
+ this._parser.end();
82
+ callback();
83
+ }
84
+ };
85
+ var make = (config) => new MultipartStream(config);
86
+ var FileStream = class extends Readable {
87
+ _tag = "File";
88
+ filename;
89
+ info;
90
+ _parent;
91
+ constructor(info, parent) {
92
+ super();
93
+ this.info = info;
94
+ this._parent = parent;
95
+ this.filename = info.filename;
96
+ }
97
+ _read(_size) {
98
+ if (this._parent._canWrite === false) {
99
+ this._parent._resume();
100
+ }
101
+ }
102
+ };
103
+
104
+ export {
105
+ MultipartStream,
106
+ make,
107
+ FileStream,
108
+ NodeMultipartParser_exports
109
+ };
@@ -0,0 +1,28 @@
1
+ import {
2
+ IncomingMessage,
3
+ layer,
4
+ layerTls,
5
+ layerWebSocket,
6
+ make,
7
+ makeTls,
8
+ makeWebSocket
9
+ } from "./chunk-S6QUQLBV.js";
10
+ import {
11
+ __export
12
+ } from "./chunk-MLKGABMK.js";
13
+
14
+ // ../../../../node_modules/.pnpm/@effect+platform-bun@4.0.4_effect@4.0.4/node_modules/@effect/platform-bun/dist/BunSocketServer.js
15
+ var BunSocketServer_exports = {};
16
+ __export(BunSocketServer_exports, {
17
+ IncomingMessage: () => IncomingMessage,
18
+ layer: () => layer,
19
+ layerTls: () => layerTls,
20
+ layerWebSocket: () => layerWebSocket,
21
+ make: () => make,
22
+ makeTls: () => makeTls,
23
+ makeWebSocket: () => makeWebSocket
24
+ });
25
+
26
+ export {
27
+ BunSocketServer_exports
28
+ };
@@ -0,0 +1,18 @@
1
+ import {
2
+ flattenCommand,
3
+ layer
4
+ } from "./chunk-NQO6V4KI.js";
5
+ import {
6
+ __export
7
+ } from "./chunk-MLKGABMK.js";
8
+
9
+ // ../../../../node_modules/.pnpm/@effect+platform-node@4.0.4_effect@4.0.4_redis@6.2.1_@opentelemetry+api@1.9.1_/node_modules/@effect/platform-node/dist/NodeChildProcessSpawner.js
10
+ var NodeChildProcessSpawner_exports = {};
11
+ __export(NodeChildProcessSpawner_exports, {
12
+ flattenCommand: () => flattenCommand,
13
+ layer: () => layer
14
+ });
15
+
16
+ export {
17
+ NodeChildProcessSpawner_exports
18
+ };
@@ -0,0 +1,18 @@
1
+ import {
2
+ runMain
3
+ } from "./chunk-UUYTTEDH.js";
4
+ import {
5
+ __export
6
+ } from "./chunk-MLKGABMK.js";
7
+
8
+ // ../../../../node_modules/.pnpm/@effect+platform-bun@4.0.4_effect@4.0.4/node_modules/@effect/platform-bun/dist/BunRuntime.js
9
+ var BunRuntime_exports = {};
10
+ __export(BunRuntime_exports, {
11
+ runMain: () => runMain2
12
+ });
13
+ var runMain2 = runMain;
14
+
15
+ export {
16
+ runMain2 as runMain,
17
+ BunRuntime_exports
18
+ };
@@ -0,0 +1,43 @@
1
+ import {
2
+ addressesFromLookup,
3
+ dnsErrorFromCause,
4
+ resolver,
5
+ toFamily
6
+ } from "./chunk-ADP5LRUF.js";
7
+ import {
8
+ __export
9
+ } from "./chunk-MLKGABMK.js";
10
+
11
+ // ../../../../node_modules/.pnpm/@effect+platform-bun@4.0.4_effect@4.0.4/node_modules/@effect/platform-bun/dist/BunDns.js
12
+ var BunDns_exports = {};
13
+ __export(BunDns_exports, {
14
+ layer: () => layer,
15
+ layerConfig: () => layerConfig,
16
+ make: () => make2
17
+ });
18
+ import * as Config from "effect/Config";
19
+ import * as Effect from "effect/Effect";
20
+ import * as Layer from "effect/Layer";
21
+ import * as Dns from "effect/net/Dns";
22
+ var make2 = /* @__PURE__ */ Effect.fnUntraced(function* (options) {
23
+ const resolve = yield* resolver(options);
24
+ return Dns.make({
25
+ lookup: (host, family) => Effect.tryPromise({
26
+ try: () => Bun.dns.lookup(host, {
27
+ family: toFamily(family),
28
+ backend: "system"
29
+ }),
30
+ catch: (cause) => dnsErrorFromCause(cause, "lookup", host)
31
+ }).pipe(Effect.map(addressesFromLookup)),
32
+ resolve
33
+ });
34
+ });
35
+ var layer = /* @__PURE__ */ Layer.effect(Dns.Dns, /* @__PURE__ */ Effect.orDie(/* @__PURE__ */ make2()));
36
+ var layerConfig = (options) => Layer.effect(Dns.Dns, Effect.flatMap(Config.unwrap(options), make2));
37
+
38
+ export {
39
+ make2 as make,
40
+ layer,
41
+ layerConfig,
42
+ BunDns_exports
43
+ };
@@ -0,0 +1,29 @@
1
+ import {
2
+ __export
3
+ } from "./chunk-MLKGABMK.js";
4
+
5
+ // ../../../../node_modules/.pnpm/@effect+platform-node-shared@4.0.4_effect@4.0.4/node_modules/@effect/platform-node-shared/dist/NodeAddressResolver.js
6
+ var NodeAddressResolver_exports = {};
7
+ __export(NodeAddressResolver_exports, {
8
+ layer: () => layer2
9
+ });
10
+ import * as Effect from "effect/Effect";
11
+ import * as AddressResolver from "effect/net/AddressResolver";
12
+ import * as NetAddress from "effect/net/NetAddress";
13
+ import * as Os from "node:os";
14
+ var scopeId = (name) => Effect.try({
15
+ try: () => NetAddress.scopeIdFromInterface(Os.networkInterfaces()[name]),
16
+ catch: (cause) => new NetAddress.NetAddressError({
17
+ input: name,
18
+ message: "cannot list network interfaces",
19
+ cause
20
+ })
21
+ });
22
+ var layer2 = /* @__PURE__ */ AddressResolver.layer({
23
+ scopeId
24
+ });
25
+
26
+ export {
27
+ layer2 as layer,
28
+ NodeAddressResolver_exports
29
+ };
File without changes
@@ -0,0 +1,249 @@
1
+ import {
2
+ pullIntoWritable
3
+ } from "./chunk-A7UXCEJA.js";
4
+ import {
5
+ __export
6
+ } from "./chunk-MLKGABMK.js";
7
+
8
+ // ../../../../node_modules/.pnpm/@effect+platform-node-shared@4.0.4_effect@4.0.4/node_modules/@effect/platform-node-shared/dist/NodeStream.js
9
+ var NodeStream_exports = {};
10
+ __export(NodeStream_exports, {
11
+ fromDuplex: () => fromDuplex,
12
+ fromReadable: () => fromReadable,
13
+ fromReadableChannel: () => fromReadableChannel,
14
+ pipeThroughDuplex: () => pipeThroughDuplex,
15
+ pipeThroughSimple: () => pipeThroughSimple,
16
+ toArrayBuffer: () => toArrayBuffer,
17
+ toReadable: () => toReadable,
18
+ toReadableNever: () => toReadableNever,
19
+ toString: () => toString,
20
+ toUint8Array: () => toUint8Array
21
+ });
22
+ import * as Arr from "effect/Array";
23
+ import * as ByteSize from "effect/ByteSize";
24
+ import * as Cause from "effect/Cause";
25
+ import * as Channel from "effect/Channel";
26
+ import * as Context from "effect/Context";
27
+ import * as Effect from "effect/Effect";
28
+ import * as Exit from "effect/Exit";
29
+ import * as Fiber from "effect/Fiber";
30
+ import { dual } from "effect/Function";
31
+ import * as Latch from "effect/Latch";
32
+ import * as MutableRef from "effect/MutableRef";
33
+ import * as Pull from "effect/Pull";
34
+ import * as Scope from "effect/Scope";
35
+ import * as Stream from "effect/Stream";
36
+ import { Readable } from "node:stream";
37
+ var fromReadable = (options) => Stream.fromChannel(fromReadableChannel(options));
38
+ var fromReadableChannel = (options) => Channel.fromTransform((_, scope) => readableToPullUnsafe({
39
+ scope,
40
+ readable: options.evaluate(),
41
+ onError: options.onError ?? defaultOnError,
42
+ chunkSize: options.chunkSize,
43
+ closeOnDone: options.closeOnDone
44
+ }));
45
+ var fromDuplex = (options) => Channel.fromTransform((upstream, scope) => {
46
+ const duplex = options.evaluate();
47
+ const exit = MutableRef.make(void 0);
48
+ const latch = Latch.makeUnsafe(false);
49
+ return pullIntoWritable({
50
+ pull: upstream,
51
+ writable: duplex,
52
+ onError: options.onError ?? defaultOnError,
53
+ endOnDone: options.endOnDone,
54
+ encoding: options.encoding
55
+ }).pipe(Effect.catchCause((cause) => {
56
+ if (Pull.isDoneCause(cause)) return Effect.void;
57
+ exit.current = Exit.failCause(cause);
58
+ latch.openUnsafe();
59
+ return Effect.void;
60
+ }), Effect.forkIn(scope), Effect.flatMap(() => readableToPullUnsafe({
61
+ scope,
62
+ exit,
63
+ latch,
64
+ readable: duplex,
65
+ onError: options.onError ?? defaultOnError,
66
+ chunkSize: options.chunkSize
67
+ })));
68
+ });
69
+ var pipeThroughDuplex = /* @__PURE__ */ dual(2, (self, options) => Stream.pipeThroughChannelOrFail(self, fromDuplex(options)));
70
+ var pipeThroughSimple = /* @__PURE__ */ dual(2, (self, duplex) => pipeThroughDuplex(self, {
71
+ evaluate: duplex
72
+ }));
73
+ var toReadable = (stream) => Effect.map(Effect.context(), (context2) => new StreamAdapter(context2, stream));
74
+ var toReadableNever = (stream) => new StreamAdapter(Context.empty(), stream);
75
+ var toString = (readable, options) => {
76
+ const maxBytesNumber = toMaxBytes(options?.maxBytes);
77
+ const onError = options?.onError ?? defaultOnError;
78
+ const encoding = options?.encoding ?? "utf8";
79
+ return Effect.callback((resume) => {
80
+ const stream = readable();
81
+ stream.setEncoding(encoding);
82
+ stream.once("error", (err) => {
83
+ if ("closed" in stream && !stream.closed) {
84
+ stream.destroy();
85
+ }
86
+ resume(Effect.fail(onError(err)));
87
+ });
88
+ let string = "";
89
+ let bytes = 0;
90
+ stream.once("end", () => {
91
+ resume(Effect.succeed(string));
92
+ });
93
+ stream.on("data", (chunk) => {
94
+ string += chunk;
95
+ bytes += Buffer.byteLength(chunk);
96
+ if (maxBytesNumber !== void 0 && bytes > maxBytesNumber) {
97
+ if ("closed" in stream && !stream.closed) {
98
+ stream.destroy();
99
+ }
100
+ resume(Effect.fail(onError(new Error("maxBytes exceeded"))));
101
+ }
102
+ });
103
+ return Effect.sync(() => {
104
+ if ("closed" in stream && !stream.closed) {
105
+ stream.destroy();
106
+ }
107
+ });
108
+ });
109
+ };
110
+ var toArrayBuffer = (readable, options) => {
111
+ const maxBytesNumber = toMaxBytes(options?.maxBytes);
112
+ const onError = options?.onError ?? defaultOnError;
113
+ return Effect.callback((resume) => {
114
+ const stream = readable();
115
+ const buffers = [];
116
+ let bytes = 0;
117
+ stream.once("error", (err) => {
118
+ if ("closed" in stream && !stream.closed) {
119
+ stream.destroy();
120
+ }
121
+ resume(Effect.fail(onError(err)));
122
+ });
123
+ stream.once("end", () => {
124
+ const buffer = buffers.length === 1 ? buffers[0] : Buffer.concat(buffers);
125
+ if (buffer.byteOffset === 0 && buffer.buffer.byteLength === buffer.byteLength) {
126
+ return resume(Effect.succeed(buffer.buffer));
127
+ }
128
+ resume(Effect.succeed(buffer.buffer.slice(buffer.byteOffset, buffer.byteOffset + buffer.byteLength)));
129
+ });
130
+ stream.on("data", (chunk) => {
131
+ buffers.push(chunk);
132
+ bytes += chunk.length;
133
+ if (maxBytesNumber !== void 0 && bytes > maxBytesNumber) {
134
+ if ("closed" in stream && !stream.closed) {
135
+ stream.destroy();
136
+ }
137
+ resume(Effect.fail(onError(new Error("maxBytes exceeded"))));
138
+ }
139
+ });
140
+ return Effect.sync(() => {
141
+ if ("closed" in stream && !stream.closed) {
142
+ stream.destroy();
143
+ }
144
+ });
145
+ });
146
+ };
147
+ var toUint8Array = (readable, options) => Effect.map(toArrayBuffer(readable, options), (buffer) => new Uint8Array(buffer));
148
+ var readableToPullUnsafe = (options) => {
149
+ const readable = options.readable;
150
+ const closeOnDone = options.closeOnDone ?? true;
151
+ const exit = options.exit ?? MutableRef.make(void 0);
152
+ const latch = options.latch ?? Latch.makeUnsafe(false);
153
+ function onReadable() {
154
+ latch.openUnsafe();
155
+ }
156
+ function onError(error) {
157
+ exit.current = Exit.fail(options.onError(error));
158
+ latch.openUnsafe();
159
+ }
160
+ function onEnd() {
161
+ exit.current = Exit.fail(Cause.Done());
162
+ latch.openUnsafe();
163
+ }
164
+ readable.on("readable", onReadable);
165
+ readable.once("error", onError);
166
+ readable.once("end", onEnd);
167
+ const pull = Effect.suspend(function loop() {
168
+ let item = options.readable.read(options.chunkSize);
169
+ if (item === null) {
170
+ if (exit.current) {
171
+ return exit.current;
172
+ }
173
+ if (readable.readableEnded) {
174
+ return Effect.fail(Cause.Done());
175
+ }
176
+ latch.closeUnsafe();
177
+ return Effect.flatMap(latch.await, loop);
178
+ }
179
+ const chunk = Arr.of(item);
180
+ while (true) {
181
+ item = options.readable.read(options.chunkSize);
182
+ if (item === null) break;
183
+ chunk.push(item);
184
+ }
185
+ return Effect.succeed(chunk);
186
+ });
187
+ return Effect.as(Scope.addFinalizer(options.scope, Effect.sync(() => {
188
+ readable.off("readable", onReadable);
189
+ readable.off("error", onError);
190
+ readable.off("end", onEnd);
191
+ if (closeOnDone && "closed" in options.readable && !options.readable.closed) {
192
+ options.readable.destroy();
193
+ }
194
+ })), pull);
195
+ };
196
+ var StreamAdapter = class extends Readable {
197
+ readLatch;
198
+ fiber = void 0;
199
+ constructor(context2, stream) {
200
+ super({});
201
+ this.readLatch = Latch.makeUnsafe(false);
202
+ this.fiber = Stream.runForEachArray(stream, (chunk) => this.readLatch.whenOpen(Effect.sync(() => {
203
+ this.readLatch.closeUnsafe();
204
+ for (let i = 0; i < chunk.length; i++) {
205
+ const item = chunk[i];
206
+ if (typeof item === "string") {
207
+ this.push(item, "utf8");
208
+ } else {
209
+ this.push(item);
210
+ }
211
+ }
212
+ }))).pipe(this.readLatch.whenOpen, Effect.provideContext(context2), Effect.runFork);
213
+ this.fiber.addObserver((exit) => {
214
+ this.fiber = void 0;
215
+ if (Exit.isSuccess(exit)) {
216
+ this.push(null);
217
+ } else {
218
+ this.destroy(Cause.squash(exit.cause));
219
+ }
220
+ });
221
+ }
222
+ _read(_size) {
223
+ this.readLatch.openUnsafe();
224
+ }
225
+ _destroy(error, callback2) {
226
+ if (!this.fiber) {
227
+ return callback2(error);
228
+ }
229
+ Effect.runFork(Fiber.interrupt(this.fiber)).addObserver((exit) => {
230
+ callback2(exit._tag === "Failure" ? Cause.squash(exit.cause) : error);
231
+ });
232
+ }
233
+ };
234
+ var defaultOnError = (error) => new Cause.UnknownError(error);
235
+ var toMaxBytes = (maxBytes) => maxBytes === void 0 || maxBytes === Infinity ? void 0 : Number(ByteSize.fromInputUnsafe(maxBytes));
236
+
237
+ export {
238
+ fromReadable,
239
+ fromReadableChannel,
240
+ fromDuplex,
241
+ pipeThroughDuplex,
242
+ pipeThroughSimple,
243
+ toReadable,
244
+ toReadableNever,
245
+ toString,
246
+ toArrayBuffer,
247
+ toUint8Array,
248
+ NodeStream_exports
249
+ };