@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,515 @@
1
+ import {
2
+ layer as layer2
3
+ } from "./chunk-IHV7Z4SW.js";
4
+ import {
5
+ layer
6
+ } from "./chunk-OGZJACUS.js";
7
+ import {
8
+ persisted,
9
+ stream
10
+ } from "./chunk-F772LLZ5.js";
11
+ import {
12
+ fromReadableStream
13
+ } from "./chunk-TBPDCAMH.js";
14
+ import {
15
+ __export
16
+ } from "./chunk-MLKGABMK.js";
17
+
18
+ // ../../../../node_modules/.pnpm/@effect+platform-bun@4.0.4_effect@4.0.4/node_modules/@effect/platform-bun/dist/BunHttpServer.js
19
+ var BunHttpServer_exports = {};
20
+ __export(BunHttpServer_exports, {
21
+ layer: () => layer4,
22
+ layerConfig: () => layerConfig,
23
+ layerHttpServices: () => layerHttpServices,
24
+ layerServer: () => layerServer,
25
+ layerTest: () => layerTest,
26
+ make: () => make3
27
+ });
28
+ import * as Cause from "effect/Cause";
29
+ import * as Config from "effect/Config";
30
+ import * as Context from "effect/Context";
31
+ import * as Deferred from "effect/Deferred";
32
+ import * as Duration from "effect/Duration";
33
+ import * as Effect from "effect/Effect";
34
+ import * as Exit from "effect/Exit";
35
+ import * as Fiber from "effect/Fiber";
36
+ import { constVoid, flow } from "effect/Function";
37
+ import * as Cookies from "effect/http/Cookies";
38
+ import * as Etag from "effect/http/Etag";
39
+ import * as FetchHttpClient from "effect/http/FetchHttpClient";
40
+ import * as Headers from "effect/http/Headers";
41
+ import * as HttpEffect from "effect/http/HttpEffect";
42
+ import * as IncomingMessage from "effect/http/HttpIncomingMessage";
43
+ import * as Server from "effect/http/HttpServer";
44
+ import * as Error from "effect/http/HttpServerError";
45
+ import * as ServerRequest from "effect/http/HttpServerRequest";
46
+ import * as ServerResponse from "effect/http/HttpServerResponse";
47
+ import * as UrlParams from "effect/http/UrlParams";
48
+ import * as Inspectable from "effect/Inspectable";
49
+ import * as Layer from "effect/Layer";
50
+ import * as NetAddress from "effect/net/NetAddress";
51
+ import * as Option from "effect/Option";
52
+ import * as Result from "effect/Result";
53
+ import * as Scheduler from "effect/Scheduler";
54
+ import * as Scope from "effect/Scope";
55
+ import * as Semaphore from "effect/Semaphore";
56
+ import * as Socket from "effect/socket/Socket";
57
+ import * as Stream from "effect/Stream";
58
+ var make3 = /* @__PURE__ */ Effect.fnUntraced(function* (options) {
59
+ const scope2 = yield* Effect.scope;
60
+ let listenOptions = options;
61
+ if (!("unix" in options) || options.unix === void 0) {
62
+ const internetOptions = options;
63
+ let hostname = internetOptions.hostname ?? "::";
64
+ if (Result.isFailure(NetAddress.ipFromString(hostname))) {
65
+ hostname = yield* Effect.tryPromise({
66
+ try: async () => {
67
+ const result = await Bun.dns.lookup(hostname, {
68
+ socketType: "tcp"
69
+ });
70
+ if (result.length === 0) throw new globalThis.Error(`Could not resolve hostname: ${hostname}`);
71
+ return result[0].address;
72
+ },
73
+ catch: (cause) => new Error.ServeError({
74
+ cause
75
+ })
76
+ });
77
+ }
78
+ listenOptions = {
79
+ ...options,
80
+ hostname
81
+ };
82
+ }
83
+ const {
84
+ compressionThreshold = MIN_COMPRESSIBLE_SIZE,
85
+ ...websocket
86
+ } = options.websocket ?? {};
87
+ const handlerStack = [function(_request, _server) {
88
+ return new Response("not found", {
89
+ status: 404
90
+ });
91
+ }];
92
+ const server = Bun.serve({
93
+ ...listenOptions,
94
+ fetch: handlerStack[0],
95
+ websocket: {
96
+ ...websocket,
97
+ open(ws) {
98
+ Deferred.doneUnsafe(ws.data.deferred, Exit.succeed(ws));
99
+ },
100
+ message(ws, message) {
101
+ ws.data.run(message);
102
+ },
103
+ close(ws, code, closeReason) {
104
+ code = typeof code === "number" ? code : 1001;
105
+ const error = new Socket.SocketError({
106
+ reason: new Socket.SocketCloseError({
107
+ code,
108
+ closeReason
109
+ })
110
+ });
111
+ ws.data.closeError = error;
112
+ ws.data.onClose(error);
113
+ }
114
+ }
115
+ });
116
+ const shutdown = yield* Effect.promise(() => server.stop()).pipe(Effect.cached);
117
+ const preemptiveShutdown = options.disablePreemptiveShutdown ? Effect.void : Effect.timeoutOrElse(shutdown, {
118
+ duration: options.gracefulShutdownTimeout ?? Duration.seconds(20),
119
+ orElse: () => Effect.void
120
+ });
121
+ yield* Scope.addFinalizer(scope2, shutdown);
122
+ const address = "unix" in options && options.unix !== void 0 ? NetAddress.unixPathAddress(options.unix) : yield* Effect.fromResult(NetAddress.inetAddressFromIpString(server.hostname, server.port)).pipe(Effect.mapError((cause) => new Error.ServeError({
123
+ cause
124
+ })));
125
+ return Server.make({
126
+ address,
127
+ serve: Effect.fnUntraced(function* (httpApp, middleware) {
128
+ const parent = yield* Effect.fiber;
129
+ const services = parent.context;
130
+ const serveScope = Context.getUnsafe(services, Scope.Scope);
131
+ const scope3 = Scope.forkUnsafe(serveScope, "parallel");
132
+ const httpEffect = HttpEffect.toHandled(httpApp, (request, response) => Effect.sync(() => {
133
+ const bunRequest = request;
134
+ bunRequest.resolve(makeResponse(request, response, services, scope3));
135
+ if (upgradedSources.has(bunRequest.source)) return upgradedResponse;
136
+ }), middleware);
137
+ function handler(request, server2) {
138
+ return new Promise((resolve, _reject) => {
139
+ const context = Context.add(services, ServerRequest.HttpServerRequest, new BunServerRequest(request, resolve, removeHost(request.url), server2, compressionThreshold));
140
+ const fiber2 = Fiber.runIn(Effect.runForkWith(context)(httpEffect), scope3);
141
+ request.signal.addEventListener("abort", () => {
142
+ fiber2.interruptUnsafe(parent.id, Error.ClientAbort.annotation);
143
+ }, {
144
+ once: true
145
+ });
146
+ });
147
+ }
148
+ yield* Scope.addFinalizerExit(serveScope, () => {
149
+ const index = handlerStack.indexOf(handler);
150
+ if (index !== -1) handlerStack.splice(index, 1);
151
+ server.reload({
152
+ fetch: handlerStack[handlerStack.length - 1],
153
+ ...options.routes === void 0 ? void 0 : {
154
+ routes: options.routes
155
+ }
156
+ });
157
+ return handlerStack.length === 1 ? preemptiveShutdown : Effect.void;
158
+ });
159
+ handlerStack.push(handler);
160
+ server.reload({
161
+ fetch: handler,
162
+ ...options.routes === void 0 ? void 0 : {
163
+ routes: options.routes
164
+ }
165
+ });
166
+ })
167
+ });
168
+ });
169
+ var MIN_COMPRESSIBLE_SIZE = 1024;
170
+ var upgradedResponse = /* @__PURE__ */ ServerResponse.empty({
171
+ status: 101
172
+ });
173
+ var upgradedSources = /* @__PURE__ */ new WeakSet();
174
+ var makeResponse = (request, response, context, scope2) => {
175
+ if (ServerResponse.omitsBody(response, request.method === "HEAD")) {
176
+ return ServerResponse.toWeb(response, {
177
+ withoutBody: true
178
+ });
179
+ }
180
+ const fields = {
181
+ headers: new globalThis.Headers(response.headers),
182
+ status: response.status
183
+ };
184
+ if (!Cookies.isEmpty(response.cookies)) {
185
+ for (const header of Cookies.toSetCookieHeaders(response.cookies)) {
186
+ fields.headers.append("set-cookie", header);
187
+ }
188
+ }
189
+ if (response.statusText !== void 0) {
190
+ fields.statusText = response.statusText;
191
+ }
192
+ response = HttpEffect.scopeTransferToStream(response);
193
+ const body = response.body;
194
+ switch (body._tag) {
195
+ case "Empty": {
196
+ return new Response(void 0, fields);
197
+ }
198
+ case "Uint8Array": {
199
+ return new Response(body.text ?? body.body, fields);
200
+ }
201
+ case "Raw": {
202
+ if (body.body instanceof Response) {
203
+ for (const [key, value] of fields.headers.entries()) {
204
+ body.body.headers.set(key, value);
205
+ }
206
+ return body.body;
207
+ }
208
+ return new Response(body.body, fields);
209
+ }
210
+ case "FormData": {
211
+ return new Response(body.formData, fields);
212
+ }
213
+ case "Stream": {
214
+ return new Response(Stream.toReadableStreamWith(Stream.unwrap(Effect.withFiber((fiber2) => {
215
+ Fiber.runIn(fiber2, scope2);
216
+ return Effect.succeed(body.stream);
217
+ })), context), fields);
218
+ }
219
+ }
220
+ };
221
+ var layerServer = /* @__PURE__ */ flow(make3, /* @__PURE__ */ Layer.effect(Server.HttpServer));
222
+ var layerHttpServices = /* @__PURE__ */ Layer.mergeAll(layer, Etag.layerWeak, layer2);
223
+ var layer4 = (options) => Layer.mergeAll(layerServer(options), layerHttpServices);
224
+ var layerTest = /* @__PURE__ */ Server.layerTestClient.pipe(/* @__PURE__ */ Layer.provide(/* @__PURE__ */ FetchHttpClient.layer.pipe(/* @__PURE__ */ Layer.provide(/* @__PURE__ */ Layer.succeed(FetchHttpClient.RequestInit)({
225
+ keepalive: false
226
+ })))), /* @__PURE__ */ Layer.provideMerge(/* @__PURE__ */ Layer.orDie(/* @__PURE__ */ layer4({
227
+ hostname: "127.0.0.1",
228
+ port: 0
229
+ }))));
230
+ var layerConfig = (options) => Layer.mergeAll(Layer.effect(Server.HttpServer)(Effect.flatMap(Config.unwrap(options), make3)), layerHttpServices);
231
+ function wsDefaultRun(_) {
232
+ this.buffer.push(_);
233
+ }
234
+ var BunServerRequest = class _BunServerRequest extends Inspectable.Class {
235
+ [ServerRequest.TypeId];
236
+ [IncomingMessage.TypeId];
237
+ source;
238
+ resolve;
239
+ url;
240
+ bunServer;
241
+ compressionThreshold;
242
+ headersOverride;
243
+ remoteAddressOverride;
244
+ constructor(source, resolve, url, bunServer, compressionThreshold, headersOverride, remoteAddressOverride) {
245
+ super();
246
+ this[ServerRequest.TypeId] = ServerRequest.TypeId;
247
+ this[IncomingMessage.TypeId] = IncomingMessage.TypeId;
248
+ this.source = source;
249
+ this.resolve = resolve;
250
+ this.url = url;
251
+ this.bunServer = bunServer;
252
+ this.compressionThreshold = compressionThreshold;
253
+ this.headersOverride = headersOverride;
254
+ this.remoteAddressOverride = remoteAddressOverride;
255
+ }
256
+ toJSON() {
257
+ return IncomingMessage.inspect(this, {
258
+ _id: "HttpServerRequest",
259
+ method: this.method,
260
+ url: this.originalUrl
261
+ });
262
+ }
263
+ modify(options) {
264
+ return new _BunServerRequest(this.source, this.resolve, options.url ?? this.url, this.bunServer, this.compressionThreshold, options.headers ?? this.headersOverride, "remoteAddress" in options ? options.remoteAddress : this.remoteAddressOverride);
265
+ }
266
+ get method() {
267
+ return this.source.method.toUpperCase();
268
+ }
269
+ get originalUrl() {
270
+ return this.source.url;
271
+ }
272
+ get remoteAddress() {
273
+ return this.remoteAddressOverride ?? Option.fromNullishOr(this.bunServer.requestIP(this.source)?.address);
274
+ }
275
+ get headers() {
276
+ this.headersOverride ??= Headers.fromInput(this.source.headers);
277
+ return this.headersOverride;
278
+ }
279
+ cachedCookies;
280
+ get cookies() {
281
+ if (this.cachedCookies) {
282
+ return this.cachedCookies;
283
+ }
284
+ return this.cachedCookies = Cookies.parseHeader(this.headers.cookie ?? "");
285
+ }
286
+ get stream() {
287
+ return this.source.body ? fromReadableStream({
288
+ evaluate: () => this.source.body ?? emptyReadbleStream,
289
+ onError: (cause) => new Error.HttpServerError({
290
+ reason: new Error.RequestParseError({
291
+ request: this,
292
+ cause
293
+ })
294
+ })
295
+ }) : Stream.fail(new Error.HttpServerError({
296
+ reason: new Error.RequestParseError({
297
+ request: this,
298
+ description: "can not create stream from empty body"
299
+ })
300
+ }));
301
+ }
302
+ textEffect;
303
+ get text() {
304
+ if (this.textEffect) {
305
+ return this.textEffect;
306
+ }
307
+ this.textEffect = Effect.runSync(Effect.cached(Effect.tryPromise({
308
+ try: () => this.source.text(),
309
+ catch: (cause) => new Error.HttpServerError({
310
+ reason: new Error.RequestParseError({
311
+ request: this,
312
+ cause
313
+ })
314
+ })
315
+ })));
316
+ return this.textEffect;
317
+ }
318
+ get json() {
319
+ return Effect.flatMap(this.text, (_) => Effect.try({
320
+ try: () => JSON.parse(_),
321
+ catch: (cause) => new Error.HttpServerError({
322
+ reason: new Error.RequestParseError({
323
+ request: this,
324
+ cause
325
+ })
326
+ })
327
+ }));
328
+ }
329
+ get urlParamsBody() {
330
+ return Effect.flatMap(this.text, (_) => Effect.try({
331
+ try: () => UrlParams.fromInput(new URLSearchParams(_)),
332
+ catch: (cause) => new Error.HttpServerError({
333
+ reason: new Error.RequestParseError({
334
+ request: this,
335
+ cause
336
+ })
337
+ })
338
+ }));
339
+ }
340
+ multipartEffect;
341
+ get multipart() {
342
+ if (this.multipartEffect) {
343
+ return this.multipartEffect;
344
+ }
345
+ this.multipartEffect = Effect.runSync(Effect.cached(persisted(this.source)));
346
+ return this.multipartEffect;
347
+ }
348
+ get multipartStream() {
349
+ return stream(this.source);
350
+ }
351
+ arrayBufferEffect;
352
+ get arrayBuffer() {
353
+ if (this.arrayBufferEffect) {
354
+ return this.arrayBufferEffect;
355
+ }
356
+ this.arrayBufferEffect = Effect.runSync(Effect.cached(Effect.tryPromise({
357
+ try: () => this.source.arrayBuffer(),
358
+ catch: (cause) => new Error.HttpServerError({
359
+ reason: new Error.RequestParseError({
360
+ request: this,
361
+ cause
362
+ })
363
+ })
364
+ })));
365
+ this.textEffect = Effect.map(this.arrayBufferEffect, (_) => new TextDecoder().decode(_));
366
+ return this.arrayBufferEffect;
367
+ }
368
+ get upgrade() {
369
+ return Effect.callback((resume) => {
370
+ const deferred = Deferred.makeUnsafe();
371
+ const semaphore = Semaphore.makeUnsafe(1);
372
+ const success = this.bunServer.upgrade(this.source, {
373
+ data: {
374
+ deferred,
375
+ buffer: [],
376
+ closeError: void 0,
377
+ run: wsDefaultRun,
378
+ onClose: constVoid
379
+ }
380
+ });
381
+ if (!success) {
382
+ resume(Effect.fail(new Error.HttpServerError({
383
+ reason: new Error.RequestParseError({
384
+ request: this,
385
+ description: "Not an upgradeable ServerRequest"
386
+ })
387
+ })));
388
+ return;
389
+ }
390
+ upgradedSources.add(this.source);
391
+ const compressionThreshold = this.compressionThreshold;
392
+ resume(Effect.map(Deferred.await(deferred), (ws) => {
393
+ const write = (chunk) => Effect.sync(() => {
394
+ if (typeof chunk === "string") {
395
+ ws.sendText(chunk, chunk.length >= compressionThreshold);
396
+ } else if (Socket.isCloseEvent(chunk)) {
397
+ ws.close(chunk.code, chunk.reason);
398
+ } else {
399
+ ws.sendBinary(chunk, chunk.byteLength >= compressionThreshold);
400
+ }
401
+ });
402
+ const writeAll = (chunks) => Effect.sync(() => {
403
+ for (let i = 0; i < chunks.length; i++) {
404
+ const chunk = chunks[i];
405
+ if (typeof chunk === "string") {
406
+ ws.sendText(chunk, chunk.length >= compressionThreshold);
407
+ } else {
408
+ ws.sendBinary(chunk, chunk.byteLength >= compressionThreshold);
409
+ }
410
+ }
411
+ });
412
+ const writer = Effect.succeed({
413
+ write,
414
+ writeAll
415
+ });
416
+ const reader = Effect.gen(function* () {
417
+ const dispatcher = (yield* Scheduler.Scheduler).makeDispatcher();
418
+ yield* Effect.acquireRelease(semaphore.take(1), () => semaphore.release(1));
419
+ const closeError = ws.data.closeError ?? (ws.readyState >= 2 ? new Socket.SocketError({
420
+ reason: new Socket.SocketCloseError({
421
+ code: 1006
422
+ })
423
+ }) : void 0);
424
+ if (closeError !== void 0 && ws.data.buffer.length === 0) {
425
+ return yield* closeError;
426
+ }
427
+ const scope2 = yield* Effect.scope;
428
+ let buffer = ws.data.buffer.splice(0);
429
+ let error = closeError;
430
+ let waiter;
431
+ let flushScheduled = false;
432
+ function takeBuffer() {
433
+ const chunk = buffer;
434
+ buffer = [];
435
+ return chunk;
436
+ }
437
+ function deliver() {
438
+ flushScheduled = false;
439
+ if (waiter === void 0 || buffer.length === 0) return;
440
+ const resumeRead = waiter;
441
+ waiter = void 0;
442
+ resumeRead(Effect.succeed(takeBuffer()));
443
+ }
444
+ function push(data) {
445
+ buffer.push(data);
446
+ if (waiter !== void 0 && !flushScheduled) {
447
+ flushScheduled = true;
448
+ dispatcher.scheduleTask(deliver, 0);
449
+ }
450
+ }
451
+ function fail3(err) {
452
+ if (error === void 0) error = err;
453
+ if (waiter !== void 0) {
454
+ const resumeRead = waiter;
455
+ waiter = void 0;
456
+ resumeRead(buffer.length > 0 ? Effect.succeed(takeBuffer()) : Effect.fail(error));
457
+ }
458
+ }
459
+ ws.data.run = push;
460
+ ws.data.onClose = fail3;
461
+ yield* Scope.addFinalizerExit(scope2, (exit) => Effect.suspend(() => {
462
+ fail3(new Socket.SocketError({
463
+ reason: new Socket.SocketCloseError({
464
+ code: 1006
465
+ })
466
+ }));
467
+ ws.data.run = wsDefaultRun;
468
+ ws.data.onClose = constVoid;
469
+ ws.close(closeCode(exit));
470
+ return Effect.void;
471
+ }));
472
+ return {
473
+ pull: Effect.callback((resumeRead) => {
474
+ if (buffer.length > 0) return resumeRead(Effect.succeed(takeBuffer()));
475
+ if (error !== void 0) return resumeRead(Effect.fail(error));
476
+ waiter = resumeRead;
477
+ return Effect.sync(() => {
478
+ if (waiter === resumeRead) waiter = void 0;
479
+ });
480
+ }),
481
+ upgrade: Socket.SocketUpgradeError.unsupported
482
+ };
483
+ });
484
+ return Socket.make({
485
+ reader,
486
+ writer
487
+ });
488
+ }));
489
+ });
490
+ }
491
+ };
492
+ var closeCode = (exit) => Exit.isSuccess(exit) ? 1e3 : Cause.hasInterruptsOnly(exit.cause) ? 1001 : 1011;
493
+ var emptyReadbleStream = /* @__PURE__ */ new ReadableStream({
494
+ start(controller) {
495
+ controller.enqueue(new Uint8Array());
496
+ controller.close();
497
+ }
498
+ });
499
+ var removeHost = (url) => {
500
+ if (url[0] === "/") {
501
+ return url;
502
+ }
503
+ const index = url.indexOf("/", url.indexOf("//") + 2);
504
+ return index === -1 ? "/" : url.slice(index);
505
+ };
506
+
507
+ export {
508
+ make3 as make,
509
+ layerServer,
510
+ layerHttpServices,
511
+ layer4 as layer,
512
+ layerTest,
513
+ layerConfig,
514
+ BunHttpServer_exports
515
+ };
@@ -0,0 +1,128 @@
1
+ import {
2
+ layer
3
+ } from "./chunk-VIWU4EBF.js";
4
+ import {
5
+ algorithms,
6
+ compressTransform,
7
+ make
8
+ } from "./chunk-3SL3HKQA.js";
9
+ import {
10
+ pipeThroughDuplex
11
+ } from "./chunk-RQH5DSBA.js";
12
+ import {
13
+ __export
14
+ } from "./chunk-MLKGABMK.js";
15
+
16
+ // ../../../../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/NodeHttpPlatform.js
17
+ var NodeHttpPlatform_exports = {};
18
+ __export(NodeHttpPlatform_exports, {
19
+ layer: () => layer3,
20
+ make: () => make3
21
+ });
22
+ import * as Effect from "effect/Effect";
23
+ import { pipe } from "effect/Function";
24
+ import * as EtagImpl from "effect/http/Etag";
25
+ import * as Headers from "effect/http/Headers";
26
+ import * as HttpBody from "effect/http/HttpBody";
27
+ import * as Platform from "effect/http/HttpPlatform";
28
+ import * as ServerResponse from "effect/http/HttpServerResponse";
29
+ import * as Mime from "effect/http/Mime";
30
+ import * as Layer from "effect/Layer";
31
+ import * as Option from "effect/Option";
32
+ import * as Fs from "node:fs";
33
+ import { pipeline, Readable } from "node:stream";
34
+ var lazyReadable = (evaluate, onDestroy) => {
35
+ let source;
36
+ return new Readable({
37
+ read() {
38
+ if (source === void 0) {
39
+ try {
40
+ source = evaluate();
41
+ } catch (cause) {
42
+ this.destroy(cause instanceof Error ? cause : new Error(String(cause)));
43
+ return;
44
+ }
45
+ source.on("data", (chunk) => {
46
+ if (!this.push(chunk)) source.pause();
47
+ });
48
+ source.once("end", () => this.push(null));
49
+ source.once("error", (cause) => this.destroy(cause));
50
+ source.once("close", () => {
51
+ if (!source.readableEnded) this.destroy(new Error("Response stream closed prematurely"));
52
+ });
53
+ }
54
+ source.resume();
55
+ },
56
+ destroy(error, callback) {
57
+ source?.destroy(error ?? void 0);
58
+ onDestroy?.();
59
+ callback(error);
60
+ }
61
+ });
62
+ };
63
+ var compressedBody = (response, body) => ServerResponse.removeHeader(ServerResponse.setBody(response, body), "content-length");
64
+ var compression = /* @__PURE__ */ make({
65
+ algorithms,
66
+ compressResponse(response, algorithm, options) {
67
+ const body = response.body;
68
+ switch (body._tag) {
69
+ case "Stream": {
70
+ return Effect.succeed(compressedBody(response, HttpBody.stream(pipeThroughDuplex(body.stream, {
71
+ evaluate: () => compressTransform(algorithm, options)
72
+ }), response.headers["content-type"] ?? body.contentType)));
73
+ }
74
+ case "Raw": {
75
+ let readable = body.body instanceof Readable ? body.body : void 0;
76
+ const compressed = lazyReadable(() => {
77
+ const transform = compressTransform(algorithm, options);
78
+ readable ??= Readable.fromWeb(new Response(body.body).body);
79
+ return pipeline(readable, transform, (cause) => {
80
+ if (cause) compressed.destroy(cause);
81
+ });
82
+ }, () => readable?.destroy());
83
+ return Effect.succeed(compressedBody(response, HttpBody.raw(compressed, {
84
+ contentType: response.headers["content-type"] ?? body.contentType
85
+ })));
86
+ }
87
+ default: {
88
+ return Effect.succeed(response);
89
+ }
90
+ }
91
+ }
92
+ });
93
+ var make3 = /* @__PURE__ */ Platform.make({
94
+ platform: "node",
95
+ compression,
96
+ fileResponse(path, status, statusText, headers, start, end, contentLength) {
97
+ const stream2 = lazyReadable(() => contentLength === BigInt(0) ? Readable.from([]) : Fs.createReadStream(path, {
98
+ start,
99
+ end: end === void 0 ? void 0 : end - 1
100
+ }));
101
+ return ServerResponse.raw(stream2, {
102
+ headers: {
103
+ ...headers,
104
+ "content-type": headers["content-type"] ?? Option.getOrElse(Mime.getType(path), () => "application/octet-stream"),
105
+ "content-length": contentLength.toString()
106
+ },
107
+ status,
108
+ statusText
109
+ });
110
+ },
111
+ fileWebResponse(file, status, statusText, headers, _options) {
112
+ return ServerResponse.raw(lazyReadable(() => Readable.fromWeb(file.stream())), {
113
+ headers: Headers.merge(headers, Headers.fromRecordUnsafe({
114
+ "content-type": headers["content-type"] ?? (file.type === "" ? Option.getOrElse(Mime.getType(file.name), () => "application/octet-stream") : file.type),
115
+ "content-length": file.size.toString()
116
+ })),
117
+ status,
118
+ statusText
119
+ });
120
+ }
121
+ });
122
+ var layer3 = /* @__PURE__ */ pipe(/* @__PURE__ */ Layer.effect(Platform.HttpPlatform)(make3), /* @__PURE__ */ Layer.provide(layer), /* @__PURE__ */ Layer.provide(EtagImpl.layer));
123
+
124
+ export {
125
+ make3 as make,
126
+ layer3 as layer,
127
+ NodeHttpPlatform_exports
128
+ };
@@ -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-bun@4.0.4_effect@4.0.4/node_modules/@effect/platform-bun/dist/BunChildProcessSpawner.js
10
+ var BunChildProcessSpawner_exports = {};
11
+ __export(BunChildProcessSpawner_exports, {
12
+ flattenCommand: () => flattenCommand,
13
+ layer: () => layer
14
+ });
15
+
16
+ export {
17
+ BunChildProcessSpawner_exports
18
+ };