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

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 (384) hide show
  1. package/CHANGELOG.md +73 -0
  2. package/LICENSE +21 -0
  3. package/README.md +113 -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 +147 -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 +242 -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 +2707 -0
  30. package/dist/vendor/bun/BunChildProcessSpawner.d.ts +7 -0
  31. package/dist/vendor/bun/BunChildProcessSpawner.js +14 -0
  32. package/dist/vendor/bun/BunClusterHttp.d.ts +83 -0
  33. package/dist/vendor/bun/BunClusterHttp.js +39 -0
  34. package/dist/vendor/bun/BunClusterSocket.d.ts +65 -0
  35. package/dist/vendor/bun/BunClusterSocket.js +22 -0
  36. package/dist/vendor/bun/BunCrypto.d.ts +10 -0
  37. package/dist/vendor/bun/BunCrypto.js +8 -0
  38. package/dist/vendor/bun/BunFileSystem.d.ts +10 -0
  39. package/dist/vendor/bun/BunFileSystem.js +9 -0
  40. package/dist/vendor/bun/BunHttpClient.d.ts +9 -0
  41. package/dist/vendor/bun/BunHttpClient.js +1 -0
  42. package/dist/vendor/bun/BunHttpPlatform.d.ts +10 -0
  43. package/dist/vendor/bun/BunHttpPlatform.js +11 -0
  44. package/dist/vendor/bun/BunHttpServer.d.ts +142 -0
  45. package/dist/vendor/bun/BunHttpServer.js +38 -0
  46. package/dist/vendor/bun/BunHttpServerRequest.d.ts +18 -0
  47. package/dist/vendor/bun/BunHttpServerRequest.js +7 -0
  48. package/dist/vendor/bun/BunMultipart.d.ts +31 -0
  49. package/dist/vendor/bun/BunMultipart.js +12 -0
  50. package/dist/vendor/bun/BunPath.d.ts +24 -0
  51. package/dist/vendor/bun/BunPath.js +12 -0
  52. package/dist/vendor/bun/BunRedis.d.ts +49 -0
  53. package/dist/vendor/bun/BunRedis.js +11 -0
  54. package/dist/vendor/bun/BunRuntime.d.ts +85 -0
  55. package/dist/vendor/bun/BunRuntime.js +8 -0
  56. package/dist/vendor/bun/BunServices.d.ts +34 -0
  57. package/dist/vendor/bun/BunServices.js +23 -0
  58. package/dist/vendor/bun/BunSink.d.ts +8 -0
  59. package/dist/vendor/bun/BunSink.js +12 -0
  60. package/dist/vendor/bun/BunSocket.d.ts +40 -0
  61. package/dist/vendor/bun/BunSocket.js +29 -0
  62. package/dist/vendor/bun/BunSocketServer.d.ts +8 -0
  63. package/dist/vendor/bun/BunSocketServer.js +21 -0
  64. package/dist/vendor/bun/BunStdio.d.ts +11 -0
  65. package/dist/vendor/bun/BunStdio.js +10 -0
  66. package/dist/vendor/bun/BunStream.d.ts +19 -0
  67. package/dist/vendor/bun/BunStream.js +30 -0
  68. package/dist/vendor/bun/BunTerminal.d.ts +21 -0
  69. package/dist/vendor/bun/BunTerminal.js +10 -0
  70. package/dist/vendor/bun/BunWorker.d.ts +20 -0
  71. package/dist/vendor/bun/BunWorker.js +9 -0
  72. package/dist/vendor/bun/BunWorkerRunner.d.ts +12 -0
  73. package/dist/vendor/bun/BunWorkerRunner.js +7 -0
  74. package/dist/vendor/bun/LICENSE +21 -0
  75. package/dist/vendor/bun/index.d.ts +92 -0
  76. package/dist/vendor/bun/index.js +107 -0
  77. package/dist/vendor/chunk-2KZ2IFIZ.js +71 -0
  78. package/dist/vendor/chunk-2Y7WC4KU.js +109 -0
  79. package/dist/vendor/chunk-3GR5VZ2M.js +118 -0
  80. package/dist/vendor/chunk-3QW2PNUY.js +7 -0
  81. package/dist/vendor/chunk-42QKY6T6.js +40 -0
  82. package/dist/vendor/chunk-54RLBMTZ.js +61 -0
  83. package/dist/vendor/chunk-5U3MC37H.js +63 -0
  84. package/dist/vendor/chunk-5ZMHBXIK.js +55 -0
  85. package/dist/vendor/chunk-64Q2B7BA.js +34 -0
  86. package/dist/vendor/chunk-6CRG556Y.js +15 -0
  87. package/dist/vendor/chunk-6HWHSZL3.js +34 -0
  88. package/dist/vendor/chunk-6J25AYCI.js +93 -0
  89. package/dist/vendor/chunk-6ME2W7TF.js +28 -0
  90. package/dist/vendor/chunk-6TZ7LQAC.js +18 -0
  91. package/dist/vendor/chunk-B3FZ67QU.js +59 -0
  92. package/dist/vendor/chunk-BBLQEPNJ.js +22 -0
  93. package/dist/vendor/chunk-BKTBUBQY.js +437 -0
  94. package/dist/vendor/chunk-CIB6JB2Y.js +63 -0
  95. package/dist/vendor/chunk-DS7GF46S.js +34 -0
  96. package/dist/vendor/chunk-DVOAHXPG.js +104 -0
  97. package/dist/vendor/chunk-DWSHTSVX.js +229 -0
  98. package/dist/vendor/chunk-EGBNVEEW.js +14 -0
  99. package/dist/vendor/chunk-EHDTBBPL.js +45 -0
  100. package/dist/vendor/chunk-EZWY45HP.js +18 -0
  101. package/dist/vendor/chunk-F7VENFF4.js +507 -0
  102. package/dist/vendor/chunk-GXCHI7BM.js +131 -0
  103. package/dist/vendor/chunk-HX4AXITW.js +65 -0
  104. package/dist/vendor/chunk-IIJ52ZU6.js +20 -0
  105. package/dist/vendor/chunk-IR7WG7SA.js +564 -0
  106. package/dist/vendor/chunk-J7A4CZDO.js +92 -0
  107. package/dist/vendor/chunk-JG5TTWPT.js +85 -0
  108. package/dist/vendor/chunk-JJ24ARBQ.js +394 -0
  109. package/dist/vendor/chunk-JUVIPOOR.js +18 -0
  110. package/dist/vendor/chunk-KCLEGTEN.js +86 -0
  111. package/dist/vendor/chunk-KOZMM5PZ.js +426 -0
  112. package/dist/vendor/chunk-KUUXSID7.js +18 -0
  113. package/dist/vendor/chunk-KWOY4JDR.js +398 -0
  114. package/dist/vendor/chunk-LEUPYT3Q.js +36 -0
  115. package/dist/vendor/chunk-LJVI2DIF.js +57 -0
  116. package/dist/vendor/chunk-M32LDTW7.js +18 -0
  117. package/dist/vendor/chunk-M7CLUILA.js +0 -0
  118. package/dist/vendor/chunk-MBSKBQ5D.js +21 -0
  119. package/dist/vendor/chunk-MLKGABMK.js +9 -0
  120. package/dist/vendor/chunk-MMEGG3WE.js +96 -0
  121. package/dist/vendor/chunk-MSWDMTAF.js +18 -0
  122. package/dist/vendor/chunk-NBVRTDTV.js +129 -0
  123. package/dist/vendor/chunk-NBYGGMAE.js +70 -0
  124. package/dist/vendor/chunk-NLMT7VBU.js +18 -0
  125. package/dist/vendor/chunk-OXNGN5H7.js +81 -0
  126. package/dist/vendor/chunk-RBKBXDZW.js +18 -0
  127. package/dist/vendor/chunk-RNBBYWS2.js +26 -0
  128. package/dist/vendor/chunk-SFHVFMSR.js +18 -0
  129. package/dist/vendor/chunk-TFIKFFSC.js +26 -0
  130. package/dist/vendor/chunk-TXKLEBBL.js +143 -0
  131. package/dist/vendor/chunk-U6OWSZD2.js +62 -0
  132. package/dist/vendor/chunk-UFH5UUZK.js +48 -0
  133. package/dist/vendor/chunk-UJAEC4DS.js +20 -0
  134. package/dist/vendor/chunk-VZBDV3TV.js +18 -0
  135. package/dist/vendor/chunk-WGN4AMSX.js +0 -0
  136. package/dist/vendor/chunk-WIYD3THC.js +31 -0
  137. package/dist/vendor/chunk-XDKNKFBW.js +22 -0
  138. package/dist/vendor/chunk-XH4U3JSV.js +249 -0
  139. package/dist/vendor/chunk-XWPHMSXO.js +28 -0
  140. package/dist/vendor/chunk-Y35ZAO5U.js +53 -0
  141. package/dist/vendor/chunk-ZJMRMY57.js +0 -0
  142. package/dist/vendor/cjs/bun/BunChildProcessSpawner.d.ts +7 -0
  143. package/dist/vendor/cjs/bun/BunChildProcessSpawner.js +1 -0
  144. package/dist/vendor/cjs/bun/BunClusterHttp.d.ts +83 -0
  145. package/dist/vendor/cjs/bun/BunClusterHttp.js +1 -0
  146. package/dist/vendor/cjs/bun/BunClusterSocket.d.ts +65 -0
  147. package/dist/vendor/cjs/bun/BunClusterSocket.js +1 -0
  148. package/dist/vendor/cjs/bun/BunCrypto.d.ts +10 -0
  149. package/dist/vendor/cjs/bun/BunCrypto.js +1 -0
  150. package/dist/vendor/cjs/bun/BunFileSystem.d.ts +10 -0
  151. package/dist/vendor/cjs/bun/BunFileSystem.js +1 -0
  152. package/dist/vendor/cjs/bun/BunHttpClient.d.ts +9 -0
  153. package/dist/vendor/cjs/bun/BunHttpClient.js +1 -0
  154. package/dist/vendor/cjs/bun/BunHttpPlatform.d.ts +10 -0
  155. package/dist/vendor/cjs/bun/BunHttpPlatform.js +1 -0
  156. package/dist/vendor/cjs/bun/BunHttpServer.d.ts +142 -0
  157. package/dist/vendor/cjs/bun/BunHttpServer.js +1 -0
  158. package/dist/vendor/cjs/bun/BunHttpServerRequest.d.ts +18 -0
  159. package/dist/vendor/cjs/bun/BunHttpServerRequest.js +1 -0
  160. package/dist/vendor/cjs/bun/BunMultipart.d.ts +31 -0
  161. package/dist/vendor/cjs/bun/BunMultipart.js +1 -0
  162. package/dist/vendor/cjs/bun/BunPath.d.ts +24 -0
  163. package/dist/vendor/cjs/bun/BunPath.js +1 -0
  164. package/dist/vendor/cjs/bun/BunRedis.d.ts +49 -0
  165. package/dist/vendor/cjs/bun/BunRedis.js +1 -0
  166. package/dist/vendor/cjs/bun/BunRuntime.d.ts +85 -0
  167. package/dist/vendor/cjs/bun/BunRuntime.js +1 -0
  168. package/dist/vendor/cjs/bun/BunServices.d.ts +34 -0
  169. package/dist/vendor/cjs/bun/BunServices.js +1 -0
  170. package/dist/vendor/cjs/bun/BunSink.d.ts +8 -0
  171. package/dist/vendor/cjs/bun/BunSink.js +1 -0
  172. package/dist/vendor/cjs/bun/BunSocket.d.ts +40 -0
  173. package/dist/vendor/cjs/bun/BunSocket.js +1 -0
  174. package/dist/vendor/cjs/bun/BunSocketServer.d.ts +8 -0
  175. package/dist/vendor/cjs/bun/BunSocketServer.js +1 -0
  176. package/dist/vendor/cjs/bun/BunStdio.d.ts +11 -0
  177. package/dist/vendor/cjs/bun/BunStdio.js +1 -0
  178. package/dist/vendor/cjs/bun/BunStream.d.ts +19 -0
  179. package/dist/vendor/cjs/bun/BunStream.js +1 -0
  180. package/dist/vendor/cjs/bun/BunTerminal.d.ts +21 -0
  181. package/dist/vendor/cjs/bun/BunTerminal.js +1 -0
  182. package/dist/vendor/cjs/bun/BunWorker.d.ts +20 -0
  183. package/dist/vendor/cjs/bun/BunWorker.js +1 -0
  184. package/dist/vendor/cjs/bun/BunWorkerRunner.d.ts +12 -0
  185. package/dist/vendor/cjs/bun/BunWorkerRunner.js +1 -0
  186. package/dist/vendor/cjs/bun/index.d.ts +92 -0
  187. package/dist/vendor/cjs/bun/index.js +1 -0
  188. package/dist/vendor/cjs/node/NodeChildProcessSpawner.d.ts +7 -0
  189. package/dist/vendor/cjs/node/NodeChildProcessSpawner.js +1 -0
  190. package/dist/vendor/cjs/node/NodeClusterHttp.d.ts +63 -0
  191. package/dist/vendor/cjs/node/NodeClusterHttp.js +1 -0
  192. package/dist/vendor/cjs/node/NodeClusterSocket.d.ts +79 -0
  193. package/dist/vendor/cjs/node/NodeClusterSocket.js +1 -0
  194. package/dist/vendor/cjs/node/NodeCrypto.d.ts +10 -0
  195. package/dist/vendor/cjs/node/NodeCrypto.js +1 -0
  196. package/dist/vendor/cjs/node/NodeFileSystem.d.ts +10 -0
  197. package/dist/vendor/cjs/node/NodeFileSystem.js +1 -0
  198. package/dist/vendor/cjs/node/NodeHttpClient.d.ts +179 -0
  199. package/dist/vendor/cjs/node/NodeHttpClient.js +1 -0
  200. package/dist/vendor/cjs/node/NodeHttpIncomingMessage.d.ts +62 -0
  201. package/dist/vendor/cjs/node/NodeHttpIncomingMessage.js +1 -0
  202. package/dist/vendor/cjs/node/NodeHttpPlatform.d.ts +36 -0
  203. package/dist/vendor/cjs/node/NodeHttpPlatform.js +1 -0
  204. package/dist/vendor/cjs/node/NodeHttpServer.d.ts +120 -0
  205. package/dist/vendor/cjs/node/NodeHttpServer.js +1 -0
  206. package/dist/vendor/cjs/node/NodeHttpServerRequest.d.ts +29 -0
  207. package/dist/vendor/cjs/node/NodeHttpServerRequest.js +1 -0
  208. package/dist/vendor/cjs/node/NodeMultipart.d.ts +46 -0
  209. package/dist/vendor/cjs/node/NodeMultipart.js +1 -0
  210. package/dist/vendor/cjs/node/NodeMultipartParser.d.ts +97 -0
  211. package/dist/vendor/cjs/node/NodeMultipartParser.js +1 -0
  212. package/dist/vendor/cjs/node/NodePath.d.ts +27 -0
  213. package/dist/vendor/cjs/node/NodePath.js +1 -0
  214. package/dist/vendor/cjs/node/NodeRedis.d.ts +74 -0
  215. package/dist/vendor/cjs/node/NodeRedis.js +1 -0
  216. package/dist/vendor/cjs/node/NodeRuntime.d.ts +85 -0
  217. package/dist/vendor/cjs/node/NodeRuntime.js +1 -0
  218. package/dist/vendor/cjs/node/NodeServices.d.ts +34 -0
  219. package/dist/vendor/cjs/node/NodeServices.js +1 -0
  220. package/dist/vendor/cjs/node/NodeSink.d.ts +8 -0
  221. package/dist/vendor/cjs/node/NodeSink.js +1 -0
  222. package/dist/vendor/cjs/node/NodeSocket.d.ts +38 -0
  223. package/dist/vendor/cjs/node/NodeSocket.js +1 -0
  224. package/dist/vendor/cjs/node/NodeSocketServer.d.ts +8 -0
  225. package/dist/vendor/cjs/node/NodeSocketServer.js +1 -0
  226. package/dist/vendor/cjs/node/NodeStdio.d.ts +11 -0
  227. package/dist/vendor/cjs/node/NodeStdio.js +1 -0
  228. package/dist/vendor/cjs/node/NodeStream.d.ts +8 -0
  229. package/dist/vendor/cjs/node/NodeStream.js +1 -0
  230. package/dist/vendor/cjs/node/NodeTerminal.d.ts +21 -0
  231. package/dist/vendor/cjs/node/NodeTerminal.js +1 -0
  232. package/dist/vendor/cjs/node/NodeWorker.d.ts +22 -0
  233. package/dist/vendor/cjs/node/NodeWorker.js +1 -0
  234. package/dist/vendor/cjs/node/NodeWorkerRunner.d.ts +12 -0
  235. package/dist/vendor/cjs/node/NodeWorkerRunner.js +1 -0
  236. package/dist/vendor/cjs/node/Undici.d.ts +28 -0
  237. package/dist/vendor/cjs/node/Undici.js +1 -0
  238. package/dist/vendor/cjs/node/index.d.ts +100 -0
  239. package/dist/vendor/cjs/node/index.js +1 -0
  240. package/dist/vendor/cjs/node-shared/NodeChildProcessSpawner.d.ts +57 -0
  241. package/dist/vendor/cjs/node-shared/NodeChildProcessSpawner.js +1 -0
  242. package/dist/vendor/cjs/node-shared/NodeClusterSocket.d.ts +22 -0
  243. package/dist/vendor/cjs/node-shared/NodeClusterSocket.js +1 -0
  244. package/dist/vendor/cjs/node-shared/NodeCrypto.d.ts +27 -0
  245. package/dist/vendor/cjs/node-shared/NodeCrypto.js +1 -0
  246. package/dist/vendor/cjs/node-shared/NodeFileSystem.d.ts +11 -0
  247. package/dist/vendor/cjs/node-shared/NodeFileSystem.js +1 -0
  248. package/dist/vendor/cjs/node-shared/NodeHttpCompression.d.ts +36 -0
  249. package/dist/vendor/cjs/node-shared/NodeHttpCompression.js +1 -0
  250. package/dist/vendor/cjs/node-shared/NodePath.d.ts +27 -0
  251. package/dist/vendor/cjs/node-shared/NodePath.js +1 -0
  252. package/dist/vendor/cjs/node-shared/NodeRuntime.d.ts +47 -0
  253. package/dist/vendor/cjs/node-shared/NodeRuntime.js +1 -0
  254. package/dist/vendor/cjs/node-shared/NodeSink.d.ts +69 -0
  255. package/dist/vendor/cjs/node-shared/NodeSink.js +1 -0
  256. package/dist/vendor/cjs/node-shared/NodeSocket.d.ts +134 -0
  257. package/dist/vendor/cjs/node-shared/NodeSocket.js +1 -0
  258. package/dist/vendor/cjs/node-shared/NodeSocketServer.d.ts +80 -0
  259. package/dist/vendor/cjs/node-shared/NodeSocketServer.js +1 -0
  260. package/dist/vendor/cjs/node-shared/NodeStdio.d.ts +12 -0
  261. package/dist/vendor/cjs/node-shared/NodeStdio.js +1 -0
  262. package/dist/vendor/cjs/node-shared/NodeStream.d.ts +179 -0
  263. package/dist/vendor/cjs/node-shared/NodeStream.js +1 -0
  264. package/dist/vendor/cjs/node-shared/NodeTerminal.d.ts +22 -0
  265. package/dist/vendor/cjs/node-shared/NodeTerminal.js +1 -0
  266. package/dist/vendor/cjs/node-shared/index.d.ts +56 -0
  267. package/dist/vendor/cjs/node-shared/index.js +1 -0
  268. package/dist/vendor/cjs/node-shared/internal/nodeChildProcessSpawner.d.ts +4 -0
  269. package/dist/vendor/cjs/node-shared/internal/nodeChildProcessSpawner.js +1 -0
  270. package/dist/vendor/cjs/node-shared/internal/utils.d.ts +2 -0
  271. package/dist/vendor/cjs/node-shared/internal/utils.js +1 -0
  272. package/dist/vendor/cjs/package.json +1 -0
  273. package/dist/vendor/cjs/platform-bun.d.ts +92 -0
  274. package/dist/vendor/cjs/platform-bun.js +1 -0
  275. package/dist/vendor/cjs/platform-node-shared.d.ts +56 -0
  276. package/dist/vendor/cjs/platform-node-shared.js +1 -0
  277. package/dist/vendor/cjs/platform-node.d.ts +100 -0
  278. package/dist/vendor/cjs/platform-node.js +1 -0
  279. package/dist/vendor/node/LICENSE +21 -0
  280. package/dist/vendor/node/NodeChildProcessSpawner.d.ts +7 -0
  281. package/dist/vendor/node/NodeChildProcessSpawner.js +14 -0
  282. package/dist/vendor/node/NodeClusterHttp.d.ts +63 -0
  283. package/dist/vendor/node/NodeClusterHttp.js +43 -0
  284. package/dist/vendor/node/NodeClusterSocket.d.ts +79 -0
  285. package/dist/vendor/node/NodeClusterSocket.js +30 -0
  286. package/dist/vendor/node/NodeCrypto.d.ts +10 -0
  287. package/dist/vendor/node/NodeCrypto.js +8 -0
  288. package/dist/vendor/node/NodeFileSystem.d.ts +10 -0
  289. package/dist/vendor/node/NodeFileSystem.js +9 -0
  290. package/dist/vendor/node/NodeHttpClient.d.ts +179 -0
  291. package/dist/vendor/node/NodeHttpClient.js +46 -0
  292. package/dist/vendor/node/NodeHttpIncomingMessage.d.ts +62 -0
  293. package/dist/vendor/node/NodeHttpIncomingMessage.js +10 -0
  294. package/dist/vendor/node/NodeHttpPlatform.d.ts +36 -0
  295. package/dist/vendor/node/NodeHttpPlatform.js +16 -0
  296. package/dist/vendor/node/NodeHttpServer.d.ts +120 -0
  297. package/dist/vendor/node/NodeHttpServer.js +46 -0
  298. package/dist/vendor/node/NodeHttpServerRequest.d.ts +29 -0
  299. package/dist/vendor/node/NodeHttpServerRequest.js +9 -0
  300. package/dist/vendor/node/NodeMultipart.d.ts +46 -0
  301. package/dist/vendor/node/NodeMultipart.js +15 -0
  302. package/dist/vendor/node/NodeMultipartParser.d.ts +97 -0
  303. package/dist/vendor/node/NodeMultipartParser.js +11 -0
  304. package/dist/vendor/node/NodePath.d.ts +27 -0
  305. package/dist/vendor/node/NodePath.js +12 -0
  306. package/dist/vendor/node/NodeRedis.d.ts +74 -0
  307. package/dist/vendor/node/NodeRedis.js +11 -0
  308. package/dist/vendor/node/NodeRuntime.d.ts +85 -0
  309. package/dist/vendor/node/NodeRuntime.js +8 -0
  310. package/dist/vendor/node/NodeServices.d.ts +34 -0
  311. package/dist/vendor/node/NodeServices.js +23 -0
  312. package/dist/vendor/node/NodeSink.d.ts +8 -0
  313. package/dist/vendor/node/NodeSink.js +12 -0
  314. package/dist/vendor/node/NodeSocket.d.ts +38 -0
  315. package/dist/vendor/node/NodeSocket.js +31 -0
  316. package/dist/vendor/node/NodeSocketServer.d.ts +8 -0
  317. package/dist/vendor/node/NodeSocketServer.js +21 -0
  318. package/dist/vendor/node/NodeStdio.d.ts +11 -0
  319. package/dist/vendor/node/NodeStdio.js +10 -0
  320. package/dist/vendor/node/NodeStream.d.ts +8 -0
  321. package/dist/vendor/node/NodeStream.js +27 -0
  322. package/dist/vendor/node/NodeTerminal.d.ts +21 -0
  323. package/dist/vendor/node/NodeTerminal.js +10 -0
  324. package/dist/vendor/node/NodeWorker.d.ts +22 -0
  325. package/dist/vendor/node/NodeWorker.js +9 -0
  326. package/dist/vendor/node/NodeWorkerRunner.d.ts +12 -0
  327. package/dist/vendor/node/NodeWorkerRunner.js +7 -0
  328. package/dist/vendor/node/Undici.d.ts +28 -0
  329. package/dist/vendor/node/Undici.js +9 -0
  330. package/dist/vendor/node/index.d.ts +100 -0
  331. package/dist/vendor/node/index.js +115 -0
  332. package/dist/vendor/node-shared/LICENSE +21 -0
  333. package/dist/vendor/node-shared/NodeChildProcessSpawner.d.ts +57 -0
  334. package/dist/vendor/node-shared/NodeChildProcessSpawner.js +13 -0
  335. package/dist/vendor/node-shared/NodeClusterSocket.d.ts +22 -0
  336. package/dist/vendor/node-shared/NodeClusterSocket.js +11 -0
  337. package/dist/vendor/node-shared/NodeCrypto.d.ts +27 -0
  338. package/dist/vendor/node-shared/NodeCrypto.js +9 -0
  339. package/dist/vendor/node-shared/NodeFileSystem.d.ts +11 -0
  340. package/dist/vendor/node-shared/NodeFileSystem.js +8 -0
  341. package/dist/vendor/node-shared/NodeHttpCompression.d.ts +36 -0
  342. package/dist/vendor/node-shared/NodeHttpCompression.js +13 -0
  343. package/dist/vendor/node-shared/NodePath.d.ts +27 -0
  344. package/dist/vendor/node-shared/NodePath.js +11 -0
  345. package/dist/vendor/node-shared/NodeRuntime.d.ts +47 -0
  346. package/dist/vendor/node-shared/NodeRuntime.js +7 -0
  347. package/dist/vendor/node-shared/NodeSink.d.ts +69 -0
  348. package/dist/vendor/node-shared/NodeSink.js +11 -0
  349. package/dist/vendor/node-shared/NodeSocket.d.ts +134 -0
  350. package/dist/vendor/node-shared/NodeSocket.js +23 -0
  351. package/dist/vendor/node-shared/NodeSocketServer.d.ts +80 -0
  352. package/dist/vendor/node-shared/NodeSocketServer.js +20 -0
  353. package/dist/vendor/node-shared/NodeStdio.d.ts +12 -0
  354. package/dist/vendor/node-shared/NodeStdio.js +9 -0
  355. package/dist/vendor/node-shared/NodeStream.d.ts +179 -0
  356. package/dist/vendor/node-shared/NodeStream.js +26 -0
  357. package/dist/vendor/node-shared/NodeTerminal.d.ts +22 -0
  358. package/dist/vendor/node-shared/NodeTerminal.js +9 -0
  359. package/dist/vendor/node-shared/index.d.ts +56 -0
  360. package/dist/vendor/node-shared/index.js +58 -0
  361. package/dist/vendor/node-shared/internal/nodeChildProcessSpawner.d.ts +4 -0
  362. package/dist/vendor/node-shared/internal/nodeChildProcessSpawner.js +7 -0
  363. package/dist/vendor/node-shared/internal/utils.d.ts +2 -0
  364. package/dist/vendor/node-shared/internal/utils.js +7 -0
  365. package/dist/vendor/platform-bun.d.ts +92 -0
  366. package/dist/vendor/platform-bun.js +107 -0
  367. package/dist/vendor/platform-node-shared.d.ts +56 -0
  368. package/dist/vendor/platform-node-shared.js +58 -0
  369. package/dist/vendor/platform-node.d.ts +100 -0
  370. package/dist/vendor/platform-node.js +115 -0
  371. package/docs/README.md +132 -0
  372. package/docs/api.md +265 -0
  373. package/docs/concepts/host-surface.md +152 -0
  374. package/docs/concepts/runtime-parity.md +80 -0
  375. package/docs/guides/bind-a-repository-root.md +109 -0
  376. package/docs/guides/configure-the-filesystem-helper.md +109 -0
  377. package/docs/guides/contain-child-processes.md +176 -0
  378. package/docs/installation.md +128 -0
  379. package/docs/quickstart.md +159 -0
  380. package/docs/troubleshooting.md +178 -0
  381. package/package.json +146 -3
  382. package/src/BunFileSystem.ts +47 -0
  383. package/src/BunHost.ts +338 -0
  384. package/src/index.ts +27 -0
@@ -0,0 +1,507 @@
1
+ import {
2
+ persisted,
3
+ stream
4
+ } from "./chunk-WIYD3THC.js";
5
+ import {
6
+ fromReadableStream
7
+ } from "./chunk-NBYGGMAE.js";
8
+ import {
9
+ layer as layer2
10
+ } from "./chunk-6HWHSZL3.js";
11
+ import {
12
+ layer
13
+ } from "./chunk-LJVI2DIF.js";
14
+ import {
15
+ __export
16
+ } from "./chunk-MLKGABMK.js";
17
+
18
+ // ../../../../node_modules/.pnpm/@effect+platform-bun@4.0.0-rc.115_effect@4.0.0-rc.115/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 Config from "effect/Config";
29
+ import * as Context from "effect/Context";
30
+ import * as Deferred from "effect/Deferred";
31
+ import * as Duration from "effect/Duration";
32
+ import * as Effect from "effect/Effect";
33
+ import * as Exit from "effect/Exit";
34
+ import * as Fiber from "effect/Fiber";
35
+ import { constVoid, flow } from "effect/Function";
36
+ import * as Inspectable from "effect/Inspectable";
37
+ import * as Layer from "effect/Layer";
38
+ import * as Option from "effect/Option";
39
+ import * as Result from "effect/Result";
40
+ import * as Scheduler from "effect/Scheduler";
41
+ import * as Scope from "effect/Scope";
42
+ import * as Semaphore from "effect/Semaphore";
43
+ import * as Stream from "effect/Stream";
44
+ import * as Cookies from "effect/unstable/http/Cookies";
45
+ import * as Etag from "effect/unstable/http/Etag";
46
+ import * as FetchHttpClient from "effect/unstable/http/FetchHttpClient";
47
+ import * as Headers from "effect/unstable/http/Headers";
48
+ import * as HttpEffect from "effect/unstable/http/HttpEffect";
49
+ import * as IncomingMessage from "effect/unstable/http/HttpIncomingMessage";
50
+ import * as Server from "effect/unstable/http/HttpServer";
51
+ import * as Error from "effect/unstable/http/HttpServerError";
52
+ import * as ServerRequest from "effect/unstable/http/HttpServerRequest";
53
+ import * as ServerResponse from "effect/unstable/http/HttpServerResponse";
54
+ import * as UrlParams from "effect/unstable/http/UrlParams";
55
+ import * as NetAddress from "effect/unstable/net/NetAddress";
56
+ import * as Socket from "effect/unstable/socket/Socket";
57
+ var make3 = /* @__PURE__ */ Effect.fnUntraced(function* (options) {
58
+ const scope2 = yield* Effect.scope;
59
+ let listenOptions = options;
60
+ if (!("unix" in options) || options.unix === void 0) {
61
+ const internetOptions = options;
62
+ let hostname = internetOptions.hostname ?? "::";
63
+ if (Result.isFailure(NetAddress.ipFromString(hostname))) {
64
+ hostname = yield* Effect.tryPromise({
65
+ try: async () => {
66
+ const result = await Bun.dns.lookup(hostname, {
67
+ socketType: "tcp"
68
+ });
69
+ if (result.length === 0) throw new globalThis.Error(`Could not resolve hostname: ${hostname}`);
70
+ return result[0].address;
71
+ },
72
+ catch: (cause) => new Error.ServeError({
73
+ cause
74
+ })
75
+ });
76
+ }
77
+ listenOptions = {
78
+ ...options,
79
+ hostname
80
+ };
81
+ }
82
+ const {
83
+ compressionThreshold = MIN_COMPRESSIBLE_SIZE,
84
+ ...websocket
85
+ } = options.websocket ?? {};
86
+ const handlerStack = [function(_request, _server) {
87
+ return new Response("not found", {
88
+ status: 404
89
+ });
90
+ }];
91
+ const server = Bun.serve({
92
+ ...listenOptions,
93
+ fetch: handlerStack[0],
94
+ websocket: {
95
+ ...websocket,
96
+ open(ws) {
97
+ Deferred.doneUnsafe(ws.data.deferred, Exit.succeed(ws));
98
+ },
99
+ message(ws, message) {
100
+ ws.data.run(message);
101
+ },
102
+ close(ws, code, closeReason) {
103
+ code = typeof code === "number" ? code : 1001;
104
+ const error = new Socket.SocketError({
105
+ reason: new Socket.SocketCloseError({
106
+ code,
107
+ closeReason
108
+ })
109
+ });
110
+ ws.data.closeError = error;
111
+ ws.data.onClose(error);
112
+ }
113
+ }
114
+ });
115
+ const shutdown = yield* Effect.promise(() => server.stop()).pipe(Effect.cached);
116
+ const preemptiveShutdown = options.disablePreemptiveShutdown ? Effect.void : Effect.timeoutOrElse(shutdown, {
117
+ duration: options.gracefulShutdownTimeout ?? Duration.seconds(20),
118
+ orElse: () => Effect.void
119
+ });
120
+ yield* Scope.addFinalizer(scope2, shutdown);
121
+ 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({
122
+ cause
123
+ })));
124
+ return Server.make({
125
+ address,
126
+ serve: Effect.fnUntraced(function* (httpApp, middleware) {
127
+ const parent = yield* Effect.fiber;
128
+ const services = parent.context;
129
+ const serveScope = Context.getUnsafe(services, Scope.Scope);
130
+ const scope3 = Scope.forkUnsafe(serveScope, "parallel");
131
+ const httpEffect = HttpEffect.toHandled(httpApp, (request, response) => Effect.sync(() => {
132
+ ;
133
+ request.resolve(makeResponse(request, response, services, scope3));
134
+ }), middleware);
135
+ function handler(request, server2) {
136
+ return new Promise((resolve, _reject) => {
137
+ const context = Context.add(services, ServerRequest.HttpServerRequest, new BunServerRequest(request, resolve, removeHost(request.url), server2, compressionThreshold));
138
+ const fiber2 = Fiber.runIn(Effect.runForkWith(context)(httpEffect), scope3);
139
+ request.signal.addEventListener("abort", () => {
140
+ fiber2.interruptUnsafe(parent.id, Error.ClientAbort.annotation);
141
+ }, {
142
+ once: true
143
+ });
144
+ });
145
+ }
146
+ yield* Scope.addFinalizerExit(serveScope, () => {
147
+ const index = handlerStack.indexOf(handler);
148
+ if (index !== -1) handlerStack.splice(index, 1);
149
+ server.reload({
150
+ fetch: handlerStack[handlerStack.length - 1],
151
+ ...options.routes === void 0 ? void 0 : {
152
+ routes: options.routes
153
+ }
154
+ });
155
+ return handlerStack.length === 1 ? preemptiveShutdown : Effect.void;
156
+ });
157
+ handlerStack.push(handler);
158
+ server.reload({
159
+ fetch: handler,
160
+ ...options.routes === void 0 ? void 0 : {
161
+ routes: options.routes
162
+ }
163
+ });
164
+ })
165
+ });
166
+ });
167
+ var MIN_COMPRESSIBLE_SIZE = 1024;
168
+ var makeResponse = (request, response, context, scope2) => {
169
+ if (ServerResponse.omitsBody(response, request.method === "HEAD")) {
170
+ return ServerResponse.toWeb(response, {
171
+ withoutBody: true
172
+ });
173
+ }
174
+ const fields = {
175
+ headers: new globalThis.Headers(response.headers),
176
+ status: response.status
177
+ };
178
+ if (!Cookies.isEmpty(response.cookies)) {
179
+ for (const header of Cookies.toSetCookieHeaders(response.cookies)) {
180
+ fields.headers.append("set-cookie", header);
181
+ }
182
+ }
183
+ if (response.statusText !== void 0) {
184
+ fields.statusText = response.statusText;
185
+ }
186
+ response = HttpEffect.scopeTransferToStream(response);
187
+ const body = response.body;
188
+ switch (body._tag) {
189
+ case "Empty": {
190
+ return new Response(void 0, fields);
191
+ }
192
+ case "Uint8Array": {
193
+ return new Response(body.text ?? body.body, fields);
194
+ }
195
+ case "Raw": {
196
+ if (body.body instanceof Response) {
197
+ for (const [key, value] of fields.headers.entries()) {
198
+ body.body.headers.set(key, value);
199
+ }
200
+ return body.body;
201
+ }
202
+ return new Response(body.body, fields);
203
+ }
204
+ case "FormData": {
205
+ return new Response(body.formData, fields);
206
+ }
207
+ case "Stream": {
208
+ return new Response(Stream.toReadableStreamWith(Stream.unwrap(Effect.withFiber((fiber2) => {
209
+ Fiber.runIn(fiber2, scope2);
210
+ return Effect.succeed(body.stream);
211
+ })), context), fields);
212
+ }
213
+ }
214
+ };
215
+ var layerServer = /* @__PURE__ */ flow(make3, /* @__PURE__ */ Layer.effect(Server.HttpServer));
216
+ var layerHttpServices = /* @__PURE__ */ Layer.mergeAll(layer, Etag.layerWeak, layer2);
217
+ var layer4 = (options) => Layer.mergeAll(layerServer(options), layerHttpServices);
218
+ var layerTest = /* @__PURE__ */ Server.layerTestClient.pipe(/* @__PURE__ */ Layer.provide(/* @__PURE__ */ FetchHttpClient.layer.pipe(/* @__PURE__ */ Layer.provide(/* @__PURE__ */ Layer.succeed(FetchHttpClient.RequestInit)({
219
+ keepalive: false
220
+ })))), /* @__PURE__ */ Layer.provideMerge(/* @__PURE__ */ Layer.orDie(/* @__PURE__ */ layer4({
221
+ hostname: "127.0.0.1",
222
+ port: 0
223
+ }))));
224
+ var layerConfig = (options) => Layer.mergeAll(Layer.effect(Server.HttpServer)(Effect.flatMap(Config.unwrap(options), make3)), layerHttpServices);
225
+ function wsDefaultRun(_) {
226
+ this.buffer.push(_);
227
+ }
228
+ var BunServerRequest = class _BunServerRequest extends Inspectable.Class {
229
+ [ServerRequest.TypeId];
230
+ [IncomingMessage.TypeId];
231
+ source;
232
+ resolve;
233
+ url;
234
+ bunServer;
235
+ compressionThreshold;
236
+ headersOverride;
237
+ remoteAddressOverride;
238
+ constructor(source, resolve, url, bunServer, compressionThreshold, headersOverride, remoteAddressOverride) {
239
+ super();
240
+ this[ServerRequest.TypeId] = ServerRequest.TypeId;
241
+ this[IncomingMessage.TypeId] = IncomingMessage.TypeId;
242
+ this.source = source;
243
+ this.resolve = resolve;
244
+ this.url = url;
245
+ this.bunServer = bunServer;
246
+ this.compressionThreshold = compressionThreshold;
247
+ this.headersOverride = headersOverride;
248
+ this.remoteAddressOverride = remoteAddressOverride;
249
+ }
250
+ toJSON() {
251
+ return IncomingMessage.inspect(this, {
252
+ _id: "HttpServerRequest",
253
+ method: this.method,
254
+ url: this.originalUrl
255
+ });
256
+ }
257
+ modify(options) {
258
+ 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);
259
+ }
260
+ get method() {
261
+ return this.source.method.toUpperCase();
262
+ }
263
+ get originalUrl() {
264
+ return this.source.url;
265
+ }
266
+ get remoteAddress() {
267
+ return this.remoteAddressOverride ?? Option.fromNullishOr(this.bunServer.requestIP(this.source)?.address);
268
+ }
269
+ get headers() {
270
+ this.headersOverride ??= Headers.fromInput(this.source.headers);
271
+ return this.headersOverride;
272
+ }
273
+ cachedCookies;
274
+ get cookies() {
275
+ if (this.cachedCookies) {
276
+ return this.cachedCookies;
277
+ }
278
+ return this.cachedCookies = Cookies.parseHeader(this.headers.cookie ?? "");
279
+ }
280
+ get stream() {
281
+ return this.source.body ? fromReadableStream({
282
+ evaluate: () => this.source.body ?? emptyReadbleStream,
283
+ onError: (cause) => new Error.HttpServerError({
284
+ reason: new Error.RequestParseError({
285
+ request: this,
286
+ cause
287
+ })
288
+ })
289
+ }) : Stream.fail(new Error.HttpServerError({
290
+ reason: new Error.RequestParseError({
291
+ request: this,
292
+ description: "can not create stream from empty body"
293
+ })
294
+ }));
295
+ }
296
+ textEffect;
297
+ get text() {
298
+ if (this.textEffect) {
299
+ return this.textEffect;
300
+ }
301
+ this.textEffect = Effect.runSync(Effect.cached(Effect.tryPromise({
302
+ try: () => this.source.text(),
303
+ catch: (cause) => new Error.HttpServerError({
304
+ reason: new Error.RequestParseError({
305
+ request: this,
306
+ cause
307
+ })
308
+ })
309
+ })));
310
+ return this.textEffect;
311
+ }
312
+ get json() {
313
+ return Effect.flatMap(this.text, (_) => Effect.try({
314
+ try: () => JSON.parse(_),
315
+ catch: (cause) => new Error.HttpServerError({
316
+ reason: new Error.RequestParseError({
317
+ request: this,
318
+ cause
319
+ })
320
+ })
321
+ }));
322
+ }
323
+ get urlParamsBody() {
324
+ return Effect.flatMap(this.text, (_) => Effect.try({
325
+ try: () => UrlParams.fromInput(new URLSearchParams(_)),
326
+ catch: (cause) => new Error.HttpServerError({
327
+ reason: new Error.RequestParseError({
328
+ request: this,
329
+ cause
330
+ })
331
+ })
332
+ }));
333
+ }
334
+ multipartEffect;
335
+ get multipart() {
336
+ if (this.multipartEffect) {
337
+ return this.multipartEffect;
338
+ }
339
+ this.multipartEffect = Effect.runSync(Effect.cached(persisted(this.source)));
340
+ return this.multipartEffect;
341
+ }
342
+ get multipartStream() {
343
+ return stream(this.source);
344
+ }
345
+ arrayBufferEffect;
346
+ get arrayBuffer() {
347
+ if (this.arrayBufferEffect) {
348
+ return this.arrayBufferEffect;
349
+ }
350
+ this.arrayBufferEffect = Effect.runSync(Effect.cached(Effect.tryPromise({
351
+ try: () => this.source.arrayBuffer(),
352
+ catch: (cause) => new Error.HttpServerError({
353
+ reason: new Error.RequestParseError({
354
+ request: this,
355
+ cause
356
+ })
357
+ })
358
+ })));
359
+ this.textEffect = Effect.map(this.arrayBufferEffect, (_) => new TextDecoder().decode(_));
360
+ return this.arrayBufferEffect;
361
+ }
362
+ get upgrade() {
363
+ return Effect.callback((resume) => {
364
+ const deferred = Deferred.makeUnsafe();
365
+ const semaphore = Semaphore.makeUnsafe(1);
366
+ const success = this.bunServer.upgrade(this.source, {
367
+ data: {
368
+ deferred,
369
+ buffer: [],
370
+ closeError: void 0,
371
+ run: wsDefaultRun,
372
+ onClose: constVoid
373
+ }
374
+ });
375
+ if (!success) {
376
+ resume(Effect.fail(new Error.HttpServerError({
377
+ reason: new Error.RequestParseError({
378
+ request: this,
379
+ description: "Not an upgradeable ServerRequest"
380
+ })
381
+ })));
382
+ return;
383
+ }
384
+ const compressionThreshold = this.compressionThreshold;
385
+ resume(Effect.map(Deferred.await(deferred), (ws) => {
386
+ const write = (chunk) => Effect.sync(() => {
387
+ if (typeof chunk === "string") {
388
+ ws.sendText(chunk, chunk.length >= compressionThreshold);
389
+ } else if (Socket.isCloseEvent(chunk)) {
390
+ ws.close(chunk.code, chunk.reason);
391
+ } else {
392
+ ws.sendBinary(chunk, chunk.byteLength >= compressionThreshold);
393
+ }
394
+ });
395
+ const writeAll = (chunks) => Effect.sync(() => {
396
+ for (let i = 0; i < chunks.length; i++) {
397
+ const chunk = chunks[i];
398
+ if (typeof chunk === "string") {
399
+ ws.sendText(chunk, chunk.length >= compressionThreshold);
400
+ } else {
401
+ ws.sendBinary(chunk, chunk.byteLength >= compressionThreshold);
402
+ }
403
+ }
404
+ });
405
+ const writer = Effect.succeed({
406
+ write,
407
+ writeAll
408
+ });
409
+ const reader = Effect.gen(function* () {
410
+ const dispatcher = (yield* Scheduler.Scheduler).makeDispatcher();
411
+ yield* Effect.acquireRelease(semaphore.take(1), () => semaphore.release(1));
412
+ const closeError = ws.data.closeError ?? (ws.readyState >= 2 ? new Socket.SocketError({
413
+ reason: new Socket.SocketCloseError({
414
+ code: 1006
415
+ })
416
+ }) : void 0);
417
+ if (closeError !== void 0 && ws.data.buffer.length === 0) {
418
+ return yield* closeError;
419
+ }
420
+ const scope2 = yield* Effect.scope;
421
+ let buffer = ws.data.buffer.splice(0);
422
+ let error = closeError;
423
+ let waiter;
424
+ let flushScheduled = false;
425
+ function takeBuffer() {
426
+ const chunk = buffer;
427
+ buffer = [];
428
+ return chunk;
429
+ }
430
+ function deliver() {
431
+ flushScheduled = false;
432
+ if (waiter === void 0 || buffer.length === 0) return;
433
+ const resumeRead = waiter;
434
+ waiter = void 0;
435
+ resumeRead(Effect.succeed(takeBuffer()));
436
+ }
437
+ function push(data) {
438
+ buffer.push(data);
439
+ if (waiter !== void 0 && !flushScheduled) {
440
+ flushScheduled = true;
441
+ dispatcher.scheduleTask(deliver, 0);
442
+ }
443
+ }
444
+ function fail3(err) {
445
+ if (error === void 0) error = err;
446
+ if (waiter !== void 0) {
447
+ const resumeRead = waiter;
448
+ waiter = void 0;
449
+ resumeRead(buffer.length > 0 ? Effect.succeed(takeBuffer()) : Effect.fail(error));
450
+ }
451
+ }
452
+ ws.data.run = push;
453
+ ws.data.onClose = fail3;
454
+ yield* Scope.addFinalizer(scope2, Effect.suspend(() => {
455
+ fail3(new Socket.SocketError({
456
+ reason: new Socket.SocketCloseError({
457
+ code: 1006
458
+ })
459
+ }));
460
+ ws.data.run = wsDefaultRun;
461
+ ws.data.onClose = constVoid;
462
+ ws.close(1e3);
463
+ return Effect.void;
464
+ }));
465
+ return {
466
+ pull: Effect.callback((resumeRead) => {
467
+ if (buffer.length > 0) return resumeRead(Effect.succeed(takeBuffer()));
468
+ if (error !== void 0) return resumeRead(Effect.fail(error));
469
+ waiter = resumeRead;
470
+ return Effect.sync(() => {
471
+ if (waiter === resumeRead) waiter = void 0;
472
+ });
473
+ }),
474
+ upgrade: Socket.SocketUpgradeError.unsupported
475
+ };
476
+ });
477
+ return Socket.make({
478
+ reader,
479
+ writer
480
+ });
481
+ }));
482
+ });
483
+ }
484
+ };
485
+ var emptyReadbleStream = /* @__PURE__ */ new ReadableStream({
486
+ start(controller) {
487
+ controller.enqueue(new Uint8Array());
488
+ controller.close();
489
+ }
490
+ });
491
+ var removeHost = (url) => {
492
+ if (url[0] === "/") {
493
+ return url;
494
+ }
495
+ const index = url.indexOf("/", url.indexOf("//") + 2);
496
+ return index === -1 ? "/" : url.slice(index);
497
+ };
498
+
499
+ export {
500
+ make3 as make,
501
+ layerServer,
502
+ layerHttpServices,
503
+ layer4 as layer,
504
+ layerTest,
505
+ layerConfig,
506
+ BunHttpServer_exports
507
+ };
@@ -0,0 +1,131 @@
1
+ import {
2
+ make
3
+ } from "./chunk-2Y7WC4KU.js";
4
+ import {
5
+ fromReadable,
6
+ toUint8Array
7
+ } from "./chunk-XH4U3JSV.js";
8
+ import {
9
+ __export
10
+ } from "./chunk-MLKGABMK.js";
11
+
12
+ // ../../../../node_modules/.pnpm/@effect+platform-node@4.0.0-rc.115_effect@4.0.0-rc.115_redis@6.2.1_@opentelemetry+api@1.9.1_/node_modules/@effect/platform-node/dist/NodeMultipart.js
13
+ var NodeMultipart_exports = {};
14
+ __export(NodeMultipart_exports, {
15
+ fileToReadable: () => fileToReadable,
16
+ persisted: () => persisted,
17
+ stream: () => stream
18
+ });
19
+ import * as Effect from "effect/Effect";
20
+ import * as Inspectable from "effect/Inspectable";
21
+ import * as Stream from "effect/Stream";
22
+ import * as Multipart from "effect/unstable/http/Multipart";
23
+ import * as MultipartParser from "effect/unstable/http/MultipartParser";
24
+ import * as NFS from "node:fs";
25
+ import * as NodeStreamP from "node:stream/promises";
26
+ var stream = (source, headers) => Multipart.makeConfig(headers).pipe(Effect.map((config) => fromReadable({
27
+ evaluate() {
28
+ const parser = make(config);
29
+ source.pipe(parser);
30
+ return parser;
31
+ },
32
+ onError: (error) => convertError(error)
33
+ })), Stream.unwrap, Stream.map(convertPart));
34
+ var persisted = (source, headers) => Multipart.toPersisted(stream(source, headers), (path, file) => Effect.tryPromise({
35
+ try: (signal) => NodeStreamP.pipeline(file.file, NFS.createWriteStream(path), {
36
+ signal
37
+ }),
38
+ catch: (cause) => Multipart.MultipartError.fromReason("InternalError", cause)
39
+ }));
40
+ var fileToReadable = (file) => file.file;
41
+ var convertPart = (part) => part._tag === "Field" ? new FieldImpl(part.info, part.value) : new FileImpl(part);
42
+ var PartBase = class extends Inspectable.Class {
43
+ [Multipart.TypeId];
44
+ constructor() {
45
+ super();
46
+ this[Multipart.TypeId] = Multipart.TypeId;
47
+ }
48
+ };
49
+ var FieldImpl = class extends PartBase {
50
+ _tag = "Field";
51
+ key;
52
+ contentType;
53
+ value;
54
+ constructor(info, value) {
55
+ super();
56
+ this.key = info.name;
57
+ this.contentType = info.contentType;
58
+ this.value = MultipartParser.decodeField(info, value);
59
+ }
60
+ toJSON() {
61
+ return {
62
+ _id: "@effect/platform/Multipart/Part",
63
+ _tag: "Field",
64
+ key: this.key,
65
+ value: this.value,
66
+ contentType: this.contentType
67
+ };
68
+ }
69
+ };
70
+ var FileImpl = class extends PartBase {
71
+ _tag = "File";
72
+ key;
73
+ name;
74
+ contentType;
75
+ content;
76
+ contentEffect;
77
+ file;
78
+ constructor(file) {
79
+ super();
80
+ this.file = file;
81
+ this.key = file.info.name;
82
+ this.name = file.filename ?? file.info.name;
83
+ this.contentType = file.info.contentType;
84
+ this.content = fromReadable({
85
+ evaluate: () => file,
86
+ onError: (cause) => Multipart.MultipartError.fromReason("InternalError", cause)
87
+ });
88
+ this.contentEffect = toUint8Array(() => file, {
89
+ onError: (cause) => Multipart.MultipartError.fromReason("InternalError", cause)
90
+ });
91
+ }
92
+ toJSON() {
93
+ return {
94
+ _id: "@effect/platform/Multipart/Part",
95
+ _tag: "File",
96
+ key: this.key,
97
+ name: this.name,
98
+ contentType: this.contentType
99
+ };
100
+ }
101
+ };
102
+ function convertError(cause) {
103
+ switch (cause._tag) {
104
+ case "ReachedLimit": {
105
+ switch (cause.limit) {
106
+ case "MaxParts": {
107
+ return Multipart.MultipartError.fromReason("TooManyParts", cause);
108
+ }
109
+ case "MaxFieldSize": {
110
+ return Multipart.MultipartError.fromReason("FieldTooLarge", cause);
111
+ }
112
+ case "MaxPartSize": {
113
+ return Multipart.MultipartError.fromReason("FileTooLarge", cause);
114
+ }
115
+ case "MaxTotalSize": {
116
+ return Multipart.MultipartError.fromReason("BodyTooLarge", cause);
117
+ }
118
+ }
119
+ }
120
+ default: {
121
+ return Multipart.MultipartError.fromReason("Parse", cause);
122
+ }
123
+ }
124
+ }
125
+
126
+ export {
127
+ stream,
128
+ persisted,
129
+ fileToReadable,
130
+ NodeMultipart_exports
131
+ };
@@ -0,0 +1,65 @@
1
+ import {
2
+ layerWebSocketConstructor
3
+ } from "./chunk-EHDTBBPL.js";
4
+ import {
5
+ layerK8sHttpClient
6
+ } from "./chunk-CIB6JB2Y.js";
7
+ import {
8
+ layer as layer3
9
+ } from "./chunk-F7VENFF4.js";
10
+ import {
11
+ layer
12
+ } from "./chunk-6TZ7LQAC.js";
13
+ import {
14
+ layer as layer2
15
+ } from "./chunk-MSWDMTAF.js";
16
+ import {
17
+ __export
18
+ } from "./chunk-MLKGABMK.js";
19
+
20
+ // ../../../../node_modules/.pnpm/@effect+platform-bun@4.0.0-rc.115_effect@4.0.0-rc.115/node_modules/@effect/platform-bun/dist/BunClusterHttp.js
21
+ var BunClusterHttp_exports = {};
22
+ __export(BunClusterHttp_exports, {
23
+ layer: () => layer7,
24
+ layerHttpServer: () => layerHttpServer,
25
+ layerK8sHttpClient: () => layerK8sHttpClient
26
+ });
27
+ import * as Effect from "effect/Effect";
28
+ import * as Layer from "effect/Layer";
29
+ import * as Option from "effect/Option";
30
+ import * as HttpRunner from "effect/unstable/cluster/HttpRunner";
31
+ import * as MessageStorage from "effect/unstable/cluster/MessageStorage";
32
+ import * as RunnerHealth from "effect/unstable/cluster/RunnerHealth";
33
+ import * as Runners from "effect/unstable/cluster/Runners";
34
+ import * as RunnerStorage from "effect/unstable/cluster/RunnerStorage";
35
+ import * as ShardingConfig from "effect/unstable/cluster/ShardingConfig";
36
+ import * as SqlMessageStorage from "effect/unstable/cluster/SqlMessageStorage";
37
+ import * as SqlRunnerStorage from "effect/unstable/cluster/SqlRunnerStorage";
38
+ import * as FetchHttpClient from "effect/unstable/http/FetchHttpClient";
39
+ import * as RpcSerialization from "effect/unstable/rpc/RpcSerialization";
40
+ var layerHttpServer = /* @__PURE__ */ Effect.gen(function* () {
41
+ const config = yield* ShardingConfig.ShardingConfig;
42
+ const listenAddress = Option.orElse(config.runnerListenAddress, () => config.runnerAddress);
43
+ if (Option.isNone(listenAddress)) {
44
+ return yield* Effect.die("BunClusterHttp.layerHttpServer: ShardingConfig.runnerAddress is None");
45
+ }
46
+ return layer3({
47
+ hostname: listenAddress.value.host,
48
+ port: listenAddress.value.port
49
+ });
50
+ }).pipe(Layer.unwrap);
51
+ var layer7 = (options) => {
52
+ const layer8 = options.clientOnly ? options.transport === "http" ? Layer.provide(HttpRunner.layerHttpClientOnly, FetchHttpClient.layer) : Layer.provide(HttpRunner.layerWebsocketClientOnly, layerWebSocketConstructor) : options.transport === "http" ? Layer.provide(HttpRunner.layerHttp, [layerHttpServer, FetchHttpClient.layer]) : Layer.provide(HttpRunner.layerWebsocket, [layerHttpServer, layerWebSocketConstructor]);
53
+ const runnerHealth = options?.clientOnly ? Layer.empty : options?.runnerHealth === "k8s" ? RunnerHealth.layerK8s(options.runnerHealthK8s).pipe(Layer.provide([layer2, layerK8sHttpClient])) : RunnerHealth.layerPing.pipe(Layer.provide(Runners.layerRpc), Layer.provide(options.transport === "http" ? HttpRunner.layerClientProtocolHttpDefault.pipe(Layer.provide(FetchHttpClient.layer)) : HttpRunner.layerClientProtocolWebsocketDefault.pipe(Layer.provide(layerWebSocketConstructor))));
54
+ return layer8.pipe(Layer.provide(runnerHealth), Layer.provideMerge(options?.storage === "local" ? MessageStorage.layerNoop : options?.storage === "byo" ? Layer.empty : Layer.orDie(SqlMessageStorage.layer).pipe(Layer.provide(layer))), Layer.provide(options?.storage === "local" ? RunnerStorage.layerMemory : options?.storage === "byo" ? Layer.empty : Layer.orDie(SqlRunnerStorage.layer)), Layer.provide(ShardingConfig.layerFromEnv(options?.shardingConfig)), Layer.provide(options?.serialization === "ndjson" ? RpcSerialization.layerNdjsonWith({
55
+ maxBufferSize: options.serializationMaxBufferSize
56
+ }) : RpcSerialization.layerSchemaBinary({
57
+ maxFrameSize: options.serializationMaxBufferSize
58
+ })));
59
+ };
60
+
61
+ export {
62
+ layerHttpServer,
63
+ layer7 as layer,
64
+ BunClusterHttp_exports
65
+ };