@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.
- package/CHANGELOG.md +73 -0
- package/LICENSE +21 -0
- package/README.md +113 -2
- package/dist/cjs/BunFileSystem.d.ts +44 -0
- package/dist/cjs/BunFileSystem.d.ts.map +1 -0
- package/dist/cjs/BunFileSystem.js +38 -0
- package/dist/cjs/BunFileSystem.js.map +7 -0
- package/dist/cjs/BunHost.d.ts +205 -0
- package/dist/cjs/BunHost.d.ts.map +1 -0
- package/dist/cjs/BunHost.js +147 -0
- package/dist/cjs/BunHost.js.map +7 -0
- package/dist/cjs/index.d.ts +26 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +37 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/package.json +1 -0
- package/dist/esm/BunFileSystem.d.ts +44 -0
- package/dist/esm/BunFileSystem.d.ts.map +1 -0
- package/dist/esm/BunFileSystem.js +35 -0
- package/dist/esm/BunFileSystem.js.map +1 -0
- package/dist/esm/BunHost.d.ts +205 -0
- package/dist/esm/BunHost.d.ts.map +1 -0
- package/dist/esm/BunHost.js +242 -0
- package/dist/esm/BunHost.js.map +1 -0
- package/dist/esm/index.d.ts +26 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +26 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/vendor/adapters.json +2707 -0
- package/dist/vendor/bun/BunChildProcessSpawner.d.ts +7 -0
- package/dist/vendor/bun/BunChildProcessSpawner.js +14 -0
- package/dist/vendor/bun/BunClusterHttp.d.ts +83 -0
- package/dist/vendor/bun/BunClusterHttp.js +39 -0
- package/dist/vendor/bun/BunClusterSocket.d.ts +65 -0
- package/dist/vendor/bun/BunClusterSocket.js +22 -0
- package/dist/vendor/bun/BunCrypto.d.ts +10 -0
- package/dist/vendor/bun/BunCrypto.js +8 -0
- package/dist/vendor/bun/BunFileSystem.d.ts +10 -0
- package/dist/vendor/bun/BunFileSystem.js +9 -0
- package/dist/vendor/bun/BunHttpClient.d.ts +9 -0
- package/dist/vendor/bun/BunHttpClient.js +1 -0
- package/dist/vendor/bun/BunHttpPlatform.d.ts +10 -0
- package/dist/vendor/bun/BunHttpPlatform.js +11 -0
- package/dist/vendor/bun/BunHttpServer.d.ts +142 -0
- package/dist/vendor/bun/BunHttpServer.js +38 -0
- package/dist/vendor/bun/BunHttpServerRequest.d.ts +18 -0
- package/dist/vendor/bun/BunHttpServerRequest.js +7 -0
- package/dist/vendor/bun/BunMultipart.d.ts +31 -0
- package/dist/vendor/bun/BunMultipart.js +12 -0
- package/dist/vendor/bun/BunPath.d.ts +24 -0
- package/dist/vendor/bun/BunPath.js +12 -0
- package/dist/vendor/bun/BunRedis.d.ts +49 -0
- package/dist/vendor/bun/BunRedis.js +11 -0
- package/dist/vendor/bun/BunRuntime.d.ts +85 -0
- package/dist/vendor/bun/BunRuntime.js +8 -0
- package/dist/vendor/bun/BunServices.d.ts +34 -0
- package/dist/vendor/bun/BunServices.js +23 -0
- package/dist/vendor/bun/BunSink.d.ts +8 -0
- package/dist/vendor/bun/BunSink.js +12 -0
- package/dist/vendor/bun/BunSocket.d.ts +40 -0
- package/dist/vendor/bun/BunSocket.js +29 -0
- package/dist/vendor/bun/BunSocketServer.d.ts +8 -0
- package/dist/vendor/bun/BunSocketServer.js +21 -0
- package/dist/vendor/bun/BunStdio.d.ts +11 -0
- package/dist/vendor/bun/BunStdio.js +10 -0
- package/dist/vendor/bun/BunStream.d.ts +19 -0
- package/dist/vendor/bun/BunStream.js +30 -0
- package/dist/vendor/bun/BunTerminal.d.ts +21 -0
- package/dist/vendor/bun/BunTerminal.js +10 -0
- package/dist/vendor/bun/BunWorker.d.ts +20 -0
- package/dist/vendor/bun/BunWorker.js +9 -0
- package/dist/vendor/bun/BunWorkerRunner.d.ts +12 -0
- package/dist/vendor/bun/BunWorkerRunner.js +7 -0
- package/dist/vendor/bun/LICENSE +21 -0
- package/dist/vendor/bun/index.d.ts +92 -0
- package/dist/vendor/bun/index.js +107 -0
- package/dist/vendor/chunk-2KZ2IFIZ.js +71 -0
- package/dist/vendor/chunk-2Y7WC4KU.js +109 -0
- package/dist/vendor/chunk-3GR5VZ2M.js +118 -0
- package/dist/vendor/chunk-3QW2PNUY.js +7 -0
- package/dist/vendor/chunk-42QKY6T6.js +40 -0
- package/dist/vendor/chunk-54RLBMTZ.js +61 -0
- package/dist/vendor/chunk-5U3MC37H.js +63 -0
- package/dist/vendor/chunk-5ZMHBXIK.js +55 -0
- package/dist/vendor/chunk-64Q2B7BA.js +34 -0
- package/dist/vendor/chunk-6CRG556Y.js +15 -0
- package/dist/vendor/chunk-6HWHSZL3.js +34 -0
- package/dist/vendor/chunk-6J25AYCI.js +93 -0
- package/dist/vendor/chunk-6ME2W7TF.js +28 -0
- package/dist/vendor/chunk-6TZ7LQAC.js +18 -0
- package/dist/vendor/chunk-B3FZ67QU.js +59 -0
- package/dist/vendor/chunk-BBLQEPNJ.js +22 -0
- package/dist/vendor/chunk-BKTBUBQY.js +437 -0
- package/dist/vendor/chunk-CIB6JB2Y.js +63 -0
- package/dist/vendor/chunk-DS7GF46S.js +34 -0
- package/dist/vendor/chunk-DVOAHXPG.js +104 -0
- package/dist/vendor/chunk-DWSHTSVX.js +229 -0
- package/dist/vendor/chunk-EGBNVEEW.js +14 -0
- package/dist/vendor/chunk-EHDTBBPL.js +45 -0
- package/dist/vendor/chunk-EZWY45HP.js +18 -0
- package/dist/vendor/chunk-F7VENFF4.js +507 -0
- package/dist/vendor/chunk-GXCHI7BM.js +131 -0
- package/dist/vendor/chunk-HX4AXITW.js +65 -0
- package/dist/vendor/chunk-IIJ52ZU6.js +20 -0
- package/dist/vendor/chunk-IR7WG7SA.js +564 -0
- package/dist/vendor/chunk-J7A4CZDO.js +92 -0
- package/dist/vendor/chunk-JG5TTWPT.js +85 -0
- package/dist/vendor/chunk-JJ24ARBQ.js +394 -0
- package/dist/vendor/chunk-JUVIPOOR.js +18 -0
- package/dist/vendor/chunk-KCLEGTEN.js +86 -0
- package/dist/vendor/chunk-KOZMM5PZ.js +426 -0
- package/dist/vendor/chunk-KUUXSID7.js +18 -0
- package/dist/vendor/chunk-KWOY4JDR.js +398 -0
- package/dist/vendor/chunk-LEUPYT3Q.js +36 -0
- package/dist/vendor/chunk-LJVI2DIF.js +57 -0
- package/dist/vendor/chunk-M32LDTW7.js +18 -0
- package/dist/vendor/chunk-M7CLUILA.js +0 -0
- package/dist/vendor/chunk-MBSKBQ5D.js +21 -0
- package/dist/vendor/chunk-MLKGABMK.js +9 -0
- package/dist/vendor/chunk-MMEGG3WE.js +96 -0
- package/dist/vendor/chunk-MSWDMTAF.js +18 -0
- package/dist/vendor/chunk-NBVRTDTV.js +129 -0
- package/dist/vendor/chunk-NBYGGMAE.js +70 -0
- package/dist/vendor/chunk-NLMT7VBU.js +18 -0
- package/dist/vendor/chunk-OXNGN5H7.js +81 -0
- package/dist/vendor/chunk-RBKBXDZW.js +18 -0
- package/dist/vendor/chunk-RNBBYWS2.js +26 -0
- package/dist/vendor/chunk-SFHVFMSR.js +18 -0
- package/dist/vendor/chunk-TFIKFFSC.js +26 -0
- package/dist/vendor/chunk-TXKLEBBL.js +143 -0
- package/dist/vendor/chunk-U6OWSZD2.js +62 -0
- package/dist/vendor/chunk-UFH5UUZK.js +48 -0
- package/dist/vendor/chunk-UJAEC4DS.js +20 -0
- package/dist/vendor/chunk-VZBDV3TV.js +18 -0
- package/dist/vendor/chunk-WGN4AMSX.js +0 -0
- package/dist/vendor/chunk-WIYD3THC.js +31 -0
- package/dist/vendor/chunk-XDKNKFBW.js +22 -0
- package/dist/vendor/chunk-XH4U3JSV.js +249 -0
- package/dist/vendor/chunk-XWPHMSXO.js +28 -0
- package/dist/vendor/chunk-Y35ZAO5U.js +53 -0
- package/dist/vendor/chunk-ZJMRMY57.js +0 -0
- package/dist/vendor/cjs/bun/BunChildProcessSpawner.d.ts +7 -0
- package/dist/vendor/cjs/bun/BunChildProcessSpawner.js +1 -0
- package/dist/vendor/cjs/bun/BunClusterHttp.d.ts +83 -0
- package/dist/vendor/cjs/bun/BunClusterHttp.js +1 -0
- package/dist/vendor/cjs/bun/BunClusterSocket.d.ts +65 -0
- package/dist/vendor/cjs/bun/BunClusterSocket.js +1 -0
- package/dist/vendor/cjs/bun/BunCrypto.d.ts +10 -0
- package/dist/vendor/cjs/bun/BunCrypto.js +1 -0
- package/dist/vendor/cjs/bun/BunFileSystem.d.ts +10 -0
- package/dist/vendor/cjs/bun/BunFileSystem.js +1 -0
- package/dist/vendor/cjs/bun/BunHttpClient.d.ts +9 -0
- package/dist/vendor/cjs/bun/BunHttpClient.js +1 -0
- package/dist/vendor/cjs/bun/BunHttpPlatform.d.ts +10 -0
- package/dist/vendor/cjs/bun/BunHttpPlatform.js +1 -0
- package/dist/vendor/cjs/bun/BunHttpServer.d.ts +142 -0
- package/dist/vendor/cjs/bun/BunHttpServer.js +1 -0
- package/dist/vendor/cjs/bun/BunHttpServerRequest.d.ts +18 -0
- package/dist/vendor/cjs/bun/BunHttpServerRequest.js +1 -0
- package/dist/vendor/cjs/bun/BunMultipart.d.ts +31 -0
- package/dist/vendor/cjs/bun/BunMultipart.js +1 -0
- package/dist/vendor/cjs/bun/BunPath.d.ts +24 -0
- package/dist/vendor/cjs/bun/BunPath.js +1 -0
- package/dist/vendor/cjs/bun/BunRedis.d.ts +49 -0
- package/dist/vendor/cjs/bun/BunRedis.js +1 -0
- package/dist/vendor/cjs/bun/BunRuntime.d.ts +85 -0
- package/dist/vendor/cjs/bun/BunRuntime.js +1 -0
- package/dist/vendor/cjs/bun/BunServices.d.ts +34 -0
- package/dist/vendor/cjs/bun/BunServices.js +1 -0
- package/dist/vendor/cjs/bun/BunSink.d.ts +8 -0
- package/dist/vendor/cjs/bun/BunSink.js +1 -0
- package/dist/vendor/cjs/bun/BunSocket.d.ts +40 -0
- package/dist/vendor/cjs/bun/BunSocket.js +1 -0
- package/dist/vendor/cjs/bun/BunSocketServer.d.ts +8 -0
- package/dist/vendor/cjs/bun/BunSocketServer.js +1 -0
- package/dist/vendor/cjs/bun/BunStdio.d.ts +11 -0
- package/dist/vendor/cjs/bun/BunStdio.js +1 -0
- package/dist/vendor/cjs/bun/BunStream.d.ts +19 -0
- package/dist/vendor/cjs/bun/BunStream.js +1 -0
- package/dist/vendor/cjs/bun/BunTerminal.d.ts +21 -0
- package/dist/vendor/cjs/bun/BunTerminal.js +1 -0
- package/dist/vendor/cjs/bun/BunWorker.d.ts +20 -0
- package/dist/vendor/cjs/bun/BunWorker.js +1 -0
- package/dist/vendor/cjs/bun/BunWorkerRunner.d.ts +12 -0
- package/dist/vendor/cjs/bun/BunWorkerRunner.js +1 -0
- package/dist/vendor/cjs/bun/index.d.ts +92 -0
- package/dist/vendor/cjs/bun/index.js +1 -0
- package/dist/vendor/cjs/node/NodeChildProcessSpawner.d.ts +7 -0
- package/dist/vendor/cjs/node/NodeChildProcessSpawner.js +1 -0
- package/dist/vendor/cjs/node/NodeClusterHttp.d.ts +63 -0
- package/dist/vendor/cjs/node/NodeClusterHttp.js +1 -0
- package/dist/vendor/cjs/node/NodeClusterSocket.d.ts +79 -0
- package/dist/vendor/cjs/node/NodeClusterSocket.js +1 -0
- package/dist/vendor/cjs/node/NodeCrypto.d.ts +10 -0
- package/dist/vendor/cjs/node/NodeCrypto.js +1 -0
- package/dist/vendor/cjs/node/NodeFileSystem.d.ts +10 -0
- package/dist/vendor/cjs/node/NodeFileSystem.js +1 -0
- package/dist/vendor/cjs/node/NodeHttpClient.d.ts +179 -0
- package/dist/vendor/cjs/node/NodeHttpClient.js +1 -0
- package/dist/vendor/cjs/node/NodeHttpIncomingMessage.d.ts +62 -0
- package/dist/vendor/cjs/node/NodeHttpIncomingMessage.js +1 -0
- package/dist/vendor/cjs/node/NodeHttpPlatform.d.ts +36 -0
- package/dist/vendor/cjs/node/NodeHttpPlatform.js +1 -0
- package/dist/vendor/cjs/node/NodeHttpServer.d.ts +120 -0
- package/dist/vendor/cjs/node/NodeHttpServer.js +1 -0
- package/dist/vendor/cjs/node/NodeHttpServerRequest.d.ts +29 -0
- package/dist/vendor/cjs/node/NodeHttpServerRequest.js +1 -0
- package/dist/vendor/cjs/node/NodeMultipart.d.ts +46 -0
- package/dist/vendor/cjs/node/NodeMultipart.js +1 -0
- package/dist/vendor/cjs/node/NodeMultipartParser.d.ts +97 -0
- package/dist/vendor/cjs/node/NodeMultipartParser.js +1 -0
- package/dist/vendor/cjs/node/NodePath.d.ts +27 -0
- package/dist/vendor/cjs/node/NodePath.js +1 -0
- package/dist/vendor/cjs/node/NodeRedis.d.ts +74 -0
- package/dist/vendor/cjs/node/NodeRedis.js +1 -0
- package/dist/vendor/cjs/node/NodeRuntime.d.ts +85 -0
- package/dist/vendor/cjs/node/NodeRuntime.js +1 -0
- package/dist/vendor/cjs/node/NodeServices.d.ts +34 -0
- package/dist/vendor/cjs/node/NodeServices.js +1 -0
- package/dist/vendor/cjs/node/NodeSink.d.ts +8 -0
- package/dist/vendor/cjs/node/NodeSink.js +1 -0
- package/dist/vendor/cjs/node/NodeSocket.d.ts +38 -0
- package/dist/vendor/cjs/node/NodeSocket.js +1 -0
- package/dist/vendor/cjs/node/NodeSocketServer.d.ts +8 -0
- package/dist/vendor/cjs/node/NodeSocketServer.js +1 -0
- package/dist/vendor/cjs/node/NodeStdio.d.ts +11 -0
- package/dist/vendor/cjs/node/NodeStdio.js +1 -0
- package/dist/vendor/cjs/node/NodeStream.d.ts +8 -0
- package/dist/vendor/cjs/node/NodeStream.js +1 -0
- package/dist/vendor/cjs/node/NodeTerminal.d.ts +21 -0
- package/dist/vendor/cjs/node/NodeTerminal.js +1 -0
- package/dist/vendor/cjs/node/NodeWorker.d.ts +22 -0
- package/dist/vendor/cjs/node/NodeWorker.js +1 -0
- package/dist/vendor/cjs/node/NodeWorkerRunner.d.ts +12 -0
- package/dist/vendor/cjs/node/NodeWorkerRunner.js +1 -0
- package/dist/vendor/cjs/node/Undici.d.ts +28 -0
- package/dist/vendor/cjs/node/Undici.js +1 -0
- package/dist/vendor/cjs/node/index.d.ts +100 -0
- package/dist/vendor/cjs/node/index.js +1 -0
- package/dist/vendor/cjs/node-shared/NodeChildProcessSpawner.d.ts +57 -0
- package/dist/vendor/cjs/node-shared/NodeChildProcessSpawner.js +1 -0
- package/dist/vendor/cjs/node-shared/NodeClusterSocket.d.ts +22 -0
- package/dist/vendor/cjs/node-shared/NodeClusterSocket.js +1 -0
- package/dist/vendor/cjs/node-shared/NodeCrypto.d.ts +27 -0
- package/dist/vendor/cjs/node-shared/NodeCrypto.js +1 -0
- package/dist/vendor/cjs/node-shared/NodeFileSystem.d.ts +11 -0
- package/dist/vendor/cjs/node-shared/NodeFileSystem.js +1 -0
- package/dist/vendor/cjs/node-shared/NodeHttpCompression.d.ts +36 -0
- package/dist/vendor/cjs/node-shared/NodeHttpCompression.js +1 -0
- package/dist/vendor/cjs/node-shared/NodePath.d.ts +27 -0
- package/dist/vendor/cjs/node-shared/NodePath.js +1 -0
- package/dist/vendor/cjs/node-shared/NodeRuntime.d.ts +47 -0
- package/dist/vendor/cjs/node-shared/NodeRuntime.js +1 -0
- package/dist/vendor/cjs/node-shared/NodeSink.d.ts +69 -0
- package/dist/vendor/cjs/node-shared/NodeSink.js +1 -0
- package/dist/vendor/cjs/node-shared/NodeSocket.d.ts +134 -0
- package/dist/vendor/cjs/node-shared/NodeSocket.js +1 -0
- package/dist/vendor/cjs/node-shared/NodeSocketServer.d.ts +80 -0
- package/dist/vendor/cjs/node-shared/NodeSocketServer.js +1 -0
- package/dist/vendor/cjs/node-shared/NodeStdio.d.ts +12 -0
- package/dist/vendor/cjs/node-shared/NodeStdio.js +1 -0
- package/dist/vendor/cjs/node-shared/NodeStream.d.ts +179 -0
- package/dist/vendor/cjs/node-shared/NodeStream.js +1 -0
- package/dist/vendor/cjs/node-shared/NodeTerminal.d.ts +22 -0
- package/dist/vendor/cjs/node-shared/NodeTerminal.js +1 -0
- package/dist/vendor/cjs/node-shared/index.d.ts +56 -0
- package/dist/vendor/cjs/node-shared/index.js +1 -0
- package/dist/vendor/cjs/node-shared/internal/nodeChildProcessSpawner.d.ts +4 -0
- package/dist/vendor/cjs/node-shared/internal/nodeChildProcessSpawner.js +1 -0
- package/dist/vendor/cjs/node-shared/internal/utils.d.ts +2 -0
- package/dist/vendor/cjs/node-shared/internal/utils.js +1 -0
- package/dist/vendor/cjs/package.json +1 -0
- package/dist/vendor/cjs/platform-bun.d.ts +92 -0
- package/dist/vendor/cjs/platform-bun.js +1 -0
- package/dist/vendor/cjs/platform-node-shared.d.ts +56 -0
- package/dist/vendor/cjs/platform-node-shared.js +1 -0
- package/dist/vendor/cjs/platform-node.d.ts +100 -0
- package/dist/vendor/cjs/platform-node.js +1 -0
- package/dist/vendor/node/LICENSE +21 -0
- package/dist/vendor/node/NodeChildProcessSpawner.d.ts +7 -0
- package/dist/vendor/node/NodeChildProcessSpawner.js +14 -0
- package/dist/vendor/node/NodeClusterHttp.d.ts +63 -0
- package/dist/vendor/node/NodeClusterHttp.js +43 -0
- package/dist/vendor/node/NodeClusterSocket.d.ts +79 -0
- package/dist/vendor/node/NodeClusterSocket.js +30 -0
- package/dist/vendor/node/NodeCrypto.d.ts +10 -0
- package/dist/vendor/node/NodeCrypto.js +8 -0
- package/dist/vendor/node/NodeFileSystem.d.ts +10 -0
- package/dist/vendor/node/NodeFileSystem.js +9 -0
- package/dist/vendor/node/NodeHttpClient.d.ts +179 -0
- package/dist/vendor/node/NodeHttpClient.js +46 -0
- package/dist/vendor/node/NodeHttpIncomingMessage.d.ts +62 -0
- package/dist/vendor/node/NodeHttpIncomingMessage.js +10 -0
- package/dist/vendor/node/NodeHttpPlatform.d.ts +36 -0
- package/dist/vendor/node/NodeHttpPlatform.js +16 -0
- package/dist/vendor/node/NodeHttpServer.d.ts +120 -0
- package/dist/vendor/node/NodeHttpServer.js +46 -0
- package/dist/vendor/node/NodeHttpServerRequest.d.ts +29 -0
- package/dist/vendor/node/NodeHttpServerRequest.js +9 -0
- package/dist/vendor/node/NodeMultipart.d.ts +46 -0
- package/dist/vendor/node/NodeMultipart.js +15 -0
- package/dist/vendor/node/NodeMultipartParser.d.ts +97 -0
- package/dist/vendor/node/NodeMultipartParser.js +11 -0
- package/dist/vendor/node/NodePath.d.ts +27 -0
- package/dist/vendor/node/NodePath.js +12 -0
- package/dist/vendor/node/NodeRedis.d.ts +74 -0
- package/dist/vendor/node/NodeRedis.js +11 -0
- package/dist/vendor/node/NodeRuntime.d.ts +85 -0
- package/dist/vendor/node/NodeRuntime.js +8 -0
- package/dist/vendor/node/NodeServices.d.ts +34 -0
- package/dist/vendor/node/NodeServices.js +23 -0
- package/dist/vendor/node/NodeSink.d.ts +8 -0
- package/dist/vendor/node/NodeSink.js +12 -0
- package/dist/vendor/node/NodeSocket.d.ts +38 -0
- package/dist/vendor/node/NodeSocket.js +31 -0
- package/dist/vendor/node/NodeSocketServer.d.ts +8 -0
- package/dist/vendor/node/NodeSocketServer.js +21 -0
- package/dist/vendor/node/NodeStdio.d.ts +11 -0
- package/dist/vendor/node/NodeStdio.js +10 -0
- package/dist/vendor/node/NodeStream.d.ts +8 -0
- package/dist/vendor/node/NodeStream.js +27 -0
- package/dist/vendor/node/NodeTerminal.d.ts +21 -0
- package/dist/vendor/node/NodeTerminal.js +10 -0
- package/dist/vendor/node/NodeWorker.d.ts +22 -0
- package/dist/vendor/node/NodeWorker.js +9 -0
- package/dist/vendor/node/NodeWorkerRunner.d.ts +12 -0
- package/dist/vendor/node/NodeWorkerRunner.js +7 -0
- package/dist/vendor/node/Undici.d.ts +28 -0
- package/dist/vendor/node/Undici.js +9 -0
- package/dist/vendor/node/index.d.ts +100 -0
- package/dist/vendor/node/index.js +115 -0
- package/dist/vendor/node-shared/LICENSE +21 -0
- package/dist/vendor/node-shared/NodeChildProcessSpawner.d.ts +57 -0
- package/dist/vendor/node-shared/NodeChildProcessSpawner.js +13 -0
- package/dist/vendor/node-shared/NodeClusterSocket.d.ts +22 -0
- package/dist/vendor/node-shared/NodeClusterSocket.js +11 -0
- package/dist/vendor/node-shared/NodeCrypto.d.ts +27 -0
- package/dist/vendor/node-shared/NodeCrypto.js +9 -0
- package/dist/vendor/node-shared/NodeFileSystem.d.ts +11 -0
- package/dist/vendor/node-shared/NodeFileSystem.js +8 -0
- package/dist/vendor/node-shared/NodeHttpCompression.d.ts +36 -0
- package/dist/vendor/node-shared/NodeHttpCompression.js +13 -0
- package/dist/vendor/node-shared/NodePath.d.ts +27 -0
- package/dist/vendor/node-shared/NodePath.js +11 -0
- package/dist/vendor/node-shared/NodeRuntime.d.ts +47 -0
- package/dist/vendor/node-shared/NodeRuntime.js +7 -0
- package/dist/vendor/node-shared/NodeSink.d.ts +69 -0
- package/dist/vendor/node-shared/NodeSink.js +11 -0
- package/dist/vendor/node-shared/NodeSocket.d.ts +134 -0
- package/dist/vendor/node-shared/NodeSocket.js +23 -0
- package/dist/vendor/node-shared/NodeSocketServer.d.ts +80 -0
- package/dist/vendor/node-shared/NodeSocketServer.js +20 -0
- package/dist/vendor/node-shared/NodeStdio.d.ts +12 -0
- package/dist/vendor/node-shared/NodeStdio.js +9 -0
- package/dist/vendor/node-shared/NodeStream.d.ts +179 -0
- package/dist/vendor/node-shared/NodeStream.js +26 -0
- package/dist/vendor/node-shared/NodeTerminal.d.ts +22 -0
- package/dist/vendor/node-shared/NodeTerminal.js +9 -0
- package/dist/vendor/node-shared/index.d.ts +56 -0
- package/dist/vendor/node-shared/index.js +58 -0
- package/dist/vendor/node-shared/internal/nodeChildProcessSpawner.d.ts +4 -0
- package/dist/vendor/node-shared/internal/nodeChildProcessSpawner.js +7 -0
- package/dist/vendor/node-shared/internal/utils.d.ts +2 -0
- package/dist/vendor/node-shared/internal/utils.js +7 -0
- package/dist/vendor/platform-bun.d.ts +92 -0
- package/dist/vendor/platform-bun.js +107 -0
- package/dist/vendor/platform-node-shared.d.ts +56 -0
- package/dist/vendor/platform-node-shared.js +58 -0
- package/dist/vendor/platform-node.d.ts +100 -0
- package/dist/vendor/platform-node.js +115 -0
- package/docs/README.md +132 -0
- package/docs/api.md +265 -0
- package/docs/concepts/host-surface.md +152 -0
- package/docs/concepts/runtime-parity.md +80 -0
- package/docs/guides/bind-a-repository-root.md +109 -0
- package/docs/guides/configure-the-filesystem-helper.md +109 -0
- package/docs/guides/contain-child-processes.md +176 -0
- package/docs/installation.md +128 -0
- package/docs/quickstart.md +159 -0
- package/docs/troubleshooting.md +178 -0
- package/package.json +146 -3
- package/src/BunFileSystem.ts +47 -0
- package/src/BunHost.ts +338 -0
- package/src/index.ts +27 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__export
|
|
3
|
+
} from "./chunk-MLKGABMK.js";
|
|
4
|
+
|
|
5
|
+
// ../../../../node_modules/.pnpm/@effect+platform-bun@4.0.0-rc.115_effect@4.0.0-rc.115/node_modules/@effect/platform-bun/dist/BunRedis.js
|
|
6
|
+
var BunRedis_exports = {};
|
|
7
|
+
__export(BunRedis_exports, {
|
|
8
|
+
BunRedis: () => BunRedis,
|
|
9
|
+
layer: () => layer,
|
|
10
|
+
layerConfig: () => layerConfig
|
|
11
|
+
});
|
|
12
|
+
import * as Config from "effect/Config";
|
|
13
|
+
import * as Context from "effect/Context";
|
|
14
|
+
import * as Deferred from "effect/Deferred";
|
|
15
|
+
import * as Effect from "effect/Effect";
|
|
16
|
+
import * as Fn from "effect/Function";
|
|
17
|
+
import * as Layer from "effect/Layer";
|
|
18
|
+
import * as Scope from "effect/Scope";
|
|
19
|
+
import * as Redis from "effect/unstable/persistence/Redis";
|
|
20
|
+
var BunRedis = class extends (/* @__PURE__ */ Context.Service()("@effect/platform-bun/BunRedis")) {
|
|
21
|
+
};
|
|
22
|
+
var make4 = /* @__PURE__ */ Effect.fnUntraced(function* (options) {
|
|
23
|
+
const {
|
|
24
|
+
RedisClient
|
|
25
|
+
} = yield* Effect.promise(() => import("bun"));
|
|
26
|
+
const scope2 = yield* Effect.scope;
|
|
27
|
+
yield* Scope.addFinalizer(scope2, Effect.sync(() => client.close()));
|
|
28
|
+
const client = new RedisClient(options?.url, options);
|
|
29
|
+
const use = (f) => Effect.tryPromise({
|
|
30
|
+
try: () => f(client),
|
|
31
|
+
catch: (cause) => new Redis.RedisError({
|
|
32
|
+
cause
|
|
33
|
+
})
|
|
34
|
+
});
|
|
35
|
+
const redis = yield* Redis.make({
|
|
36
|
+
send: (command, ...args) => Effect.tryPromise({
|
|
37
|
+
try: () => client.send(command, args),
|
|
38
|
+
catch: (cause) => new Redis.RedisError({
|
|
39
|
+
cause
|
|
40
|
+
})
|
|
41
|
+
}),
|
|
42
|
+
subscribe: (channel, onMessage) => Effect.gen(function* () {
|
|
43
|
+
const terminal = yield* Deferred.make();
|
|
44
|
+
yield* Effect.acquireRelease(Effect.tryPromise({
|
|
45
|
+
try: async () => {
|
|
46
|
+
const subscriber = new RedisClient(options?.url, {
|
|
47
|
+
...options,
|
|
48
|
+
autoReconnect: false
|
|
49
|
+
});
|
|
50
|
+
subscriber.onclose = (cause) => {
|
|
51
|
+
Deferred.doneUnsafe(terminal, new Redis.RedisError({
|
|
52
|
+
cause
|
|
53
|
+
}));
|
|
54
|
+
};
|
|
55
|
+
try {
|
|
56
|
+
await subscriber.subscribe(channel, (message, channel2) => {
|
|
57
|
+
onMessage({
|
|
58
|
+
channel: channel2,
|
|
59
|
+
message
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
return subscriber;
|
|
63
|
+
} catch (cause) {
|
|
64
|
+
subscriber.onclose = null;
|
|
65
|
+
subscriber.close();
|
|
66
|
+
throw cause;
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
catch: (cause) => new Redis.RedisError({
|
|
70
|
+
cause
|
|
71
|
+
})
|
|
72
|
+
}), (subscriber) => Effect.sync(() => {
|
|
73
|
+
subscriber.onclose = null;
|
|
74
|
+
subscriber.close();
|
|
75
|
+
}));
|
|
76
|
+
return Deferred.await(terminal);
|
|
77
|
+
})
|
|
78
|
+
});
|
|
79
|
+
const bunRedis = Fn.identity({
|
|
80
|
+
client,
|
|
81
|
+
use
|
|
82
|
+
});
|
|
83
|
+
return Context.make(BunRedis, bunRedis).pipe(Context.add(Redis.Redis, redis));
|
|
84
|
+
});
|
|
85
|
+
var layer = (options) => Layer.effectContext(make4(options));
|
|
86
|
+
var layerConfig = (options) => Layer.effectContext(Config.unwrap(options).pipe(Effect.flatMap(make4)));
|
|
87
|
+
|
|
88
|
+
export {
|
|
89
|
+
BunRedis,
|
|
90
|
+
layer,
|
|
91
|
+
layerConfig,
|
|
92
|
+
BunRedis_exports
|
|
93
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IncomingMessage,
|
|
3
|
+
layer,
|
|
4
|
+
layerTls,
|
|
5
|
+
layerWebSocket,
|
|
6
|
+
make,
|
|
7
|
+
makeTls,
|
|
8
|
+
makeWebSocket
|
|
9
|
+
} from "./chunk-DWSHTSVX.js";
|
|
10
|
+
import {
|
|
11
|
+
__export
|
|
12
|
+
} from "./chunk-MLKGABMK.js";
|
|
13
|
+
|
|
14
|
+
// ../../../../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/NodeSocketServer.js
|
|
15
|
+
var NodeSocketServer_exports = {};
|
|
16
|
+
__export(NodeSocketServer_exports, {
|
|
17
|
+
IncomingMessage: () => IncomingMessage,
|
|
18
|
+
layer: () => layer,
|
|
19
|
+
layerTls: () => layerTls,
|
|
20
|
+
layerWebSocket: () => layerWebSocket,
|
|
21
|
+
make: () => make,
|
|
22
|
+
makeTls: () => makeTls,
|
|
23
|
+
makeWebSocket: () => makeWebSocket
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export {
|
|
27
|
+
NodeSocketServer_exports
|
|
28
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {
|
|
2
|
+
layer
|
|
3
|
+
} from "./chunk-UFH5UUZK.js";
|
|
4
|
+
import {
|
|
5
|
+
__export
|
|
6
|
+
} from "./chunk-MLKGABMK.js";
|
|
7
|
+
|
|
8
|
+
// ../../../../node_modules/.pnpm/@effect+platform-bun@4.0.0-rc.115_effect@4.0.0-rc.115/node_modules/@effect/platform-bun/dist/BunCrypto.js
|
|
9
|
+
var BunCrypto_exports = {};
|
|
10
|
+
__export(BunCrypto_exports, {
|
|
11
|
+
layer: () => layer2
|
|
12
|
+
});
|
|
13
|
+
var layer2 = layer;
|
|
14
|
+
|
|
15
|
+
export {
|
|
16
|
+
layer2 as layer,
|
|
17
|
+
BunCrypto_exports
|
|
18
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import {
|
|
2
|
+
fromReadable
|
|
3
|
+
} from "./chunk-XH4U3JSV.js";
|
|
4
|
+
import {
|
|
5
|
+
fromWritable
|
|
6
|
+
} from "./chunk-OXNGN5H7.js";
|
|
7
|
+
import {
|
|
8
|
+
__export
|
|
9
|
+
} from "./chunk-MLKGABMK.js";
|
|
10
|
+
|
|
11
|
+
// ../../../../node_modules/.pnpm/@effect+platform-node-shared@4.0.0-rc.115_effect@4.0.0-rc.115/node_modules/@effect/platform-node-shared/dist/NodeStdio.js
|
|
12
|
+
var NodeStdio_exports = {};
|
|
13
|
+
__export(NodeStdio_exports, {
|
|
14
|
+
layer: () => layer
|
|
15
|
+
});
|
|
16
|
+
import * as Effect from "effect/Effect";
|
|
17
|
+
import * as Layer from "effect/Layer";
|
|
18
|
+
import { systemError } from "effect/PlatformError";
|
|
19
|
+
import * as Stdio from "effect/Stdio";
|
|
20
|
+
var layer = /* @__PURE__ */ Layer.succeed(Stdio.Stdio, /* @__PURE__ */ Stdio.make({
|
|
21
|
+
args: /* @__PURE__ */ Effect.sync(() => process.argv.slice(2)),
|
|
22
|
+
stdinIsTerminal: /* @__PURE__ */ Effect.sync(() => process.stdin.isTTY === true),
|
|
23
|
+
stdoutIsTerminal: /* @__PURE__ */ Effect.sync(() => process.stdout.isTTY === true),
|
|
24
|
+
stdout: (options) => fromWritable({
|
|
25
|
+
evaluate: () => process.stdout,
|
|
26
|
+
onError: (cause) => systemError({
|
|
27
|
+
module: "Stdio",
|
|
28
|
+
method: "stdout",
|
|
29
|
+
_tag: "Unknown",
|
|
30
|
+
cause
|
|
31
|
+
}),
|
|
32
|
+
endOnDone: options?.endOnDone ?? false
|
|
33
|
+
}),
|
|
34
|
+
stderr: (options) => fromWritable({
|
|
35
|
+
evaluate: () => process.stderr,
|
|
36
|
+
onError: (cause) => systemError({
|
|
37
|
+
module: "Stdio",
|
|
38
|
+
method: "stderr",
|
|
39
|
+
_tag: "Unknown",
|
|
40
|
+
cause
|
|
41
|
+
}),
|
|
42
|
+
endOnDone: options?.endOnDone ?? false
|
|
43
|
+
}),
|
|
44
|
+
stdin: /* @__PURE__ */ fromReadable({
|
|
45
|
+
evaluate: () => process.stdin,
|
|
46
|
+
onError: (cause) => systemError({
|
|
47
|
+
module: "Stdio",
|
|
48
|
+
method: "stdin",
|
|
49
|
+
_tag: "Unknown",
|
|
50
|
+
cause
|
|
51
|
+
}),
|
|
52
|
+
closeOnDone: false
|
|
53
|
+
})
|
|
54
|
+
}));
|
|
55
|
+
|
|
56
|
+
export {
|
|
57
|
+
layer,
|
|
58
|
+
NodeStdio_exports
|
|
59
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {
|
|
2
|
+
layer,
|
|
3
|
+
make
|
|
4
|
+
} from "./chunk-TXKLEBBL.js";
|
|
5
|
+
import {
|
|
6
|
+
__export
|
|
7
|
+
} from "./chunk-MLKGABMK.js";
|
|
8
|
+
|
|
9
|
+
// ../../../../node_modules/.pnpm/@effect+platform-bun@4.0.0-rc.115_effect@4.0.0-rc.115/node_modules/@effect/platform-bun/dist/BunTerminal.js
|
|
10
|
+
var BunTerminal_exports = {};
|
|
11
|
+
__export(BunTerminal_exports, {
|
|
12
|
+
layer: () => layer2,
|
|
13
|
+
make: () => make2
|
|
14
|
+
});
|
|
15
|
+
var make2 = make;
|
|
16
|
+
var layer2 = layer;
|
|
17
|
+
|
|
18
|
+
export {
|
|
19
|
+
make2 as make,
|
|
20
|
+
layer2 as layer,
|
|
21
|
+
BunTerminal_exports
|
|
22
|
+
};
|
|
@@ -0,0 +1,437 @@
|
|
|
1
|
+
import {
|
|
2
|
+
handleErrnoException
|
|
3
|
+
} from "./chunk-42QKY6T6.js";
|
|
4
|
+
import {
|
|
5
|
+
__export
|
|
6
|
+
} from "./chunk-MLKGABMK.js";
|
|
7
|
+
|
|
8
|
+
// ../../../../node_modules/.pnpm/@effect+platform-node-shared@4.0.0-rc.115_effect@4.0.0-rc.115/node_modules/@effect/platform-node-shared/dist/NodeFileSystem.js
|
|
9
|
+
var NodeFileSystem_exports = {};
|
|
10
|
+
__export(NodeFileSystem_exports, {
|
|
11
|
+
layer: () => layer
|
|
12
|
+
});
|
|
13
|
+
import * as BI from "effect/BigInt";
|
|
14
|
+
import * as ByteSize from "effect/ByteSize";
|
|
15
|
+
import * as Cause from "effect/Cause";
|
|
16
|
+
import * as Effect from "effect/Effect";
|
|
17
|
+
import { effectify } from "effect/Effect";
|
|
18
|
+
import * as FileSystem from "effect/FileSystem";
|
|
19
|
+
import { pipe } from "effect/Function";
|
|
20
|
+
import * as Layer from "effect/Layer";
|
|
21
|
+
import * as Option from "effect/Option";
|
|
22
|
+
import * as Error from "effect/PlatformError";
|
|
23
|
+
import * as Queue from "effect/Queue";
|
|
24
|
+
import * as Stream from "effect/Stream";
|
|
25
|
+
import * as Crypto from "node:crypto";
|
|
26
|
+
import * as NFS from "node:fs";
|
|
27
|
+
import * as OS from "node:os";
|
|
28
|
+
import * as Path from "node:path";
|
|
29
|
+
var handleBadArgument = (method) => (err) => Error.badArgument({
|
|
30
|
+
module: "FileSystem",
|
|
31
|
+
method,
|
|
32
|
+
description: err.message ?? String(err)
|
|
33
|
+
});
|
|
34
|
+
var bigintToNumber = (value, field) => {
|
|
35
|
+
const number = Number(value);
|
|
36
|
+
if (!Number.isSafeInteger(number)) {
|
|
37
|
+
throw new RangeError(`${field} exceeds the safe integer range: ${value}`);
|
|
38
|
+
}
|
|
39
|
+
return number;
|
|
40
|
+
};
|
|
41
|
+
var bigintToNumberOption = (value) => Option.flatMap(Option.fromNullishOr(value), BI.toNumber);
|
|
42
|
+
var positionToNumber = (position, method) => Effect.try({
|
|
43
|
+
try: () => bigintToNumber(position, "position"),
|
|
44
|
+
catch: handleBadArgument(method)
|
|
45
|
+
});
|
|
46
|
+
var access2 = /* @__PURE__ */ (() => {
|
|
47
|
+
const nodeAccess = /* @__PURE__ */ effectify(NFS.access, /* @__PURE__ */ handleErrnoException("FileSystem", "access"), /* @__PURE__ */ handleBadArgument("access"));
|
|
48
|
+
return (path, options) => {
|
|
49
|
+
let mode = NFS.constants.F_OK;
|
|
50
|
+
if (options?.readable) {
|
|
51
|
+
mode |= NFS.constants.R_OK;
|
|
52
|
+
}
|
|
53
|
+
if (options?.writable) {
|
|
54
|
+
mode |= NFS.constants.W_OK;
|
|
55
|
+
}
|
|
56
|
+
return nodeAccess(path, mode);
|
|
57
|
+
};
|
|
58
|
+
})();
|
|
59
|
+
var copy = /* @__PURE__ */ (() => {
|
|
60
|
+
const nodeCp = /* @__PURE__ */ effectify(NFS.cp, /* @__PURE__ */ handleErrnoException("FileSystem", "copy"), /* @__PURE__ */ handleBadArgument("copy"));
|
|
61
|
+
return (fromPath, toPath, options) => nodeCp(fromPath, toPath, {
|
|
62
|
+
force: options?.overwrite ?? false,
|
|
63
|
+
preserveTimestamps: options?.preserveTimestamps ?? false,
|
|
64
|
+
recursive: true
|
|
65
|
+
});
|
|
66
|
+
})();
|
|
67
|
+
var copyFile2 = /* @__PURE__ */ (() => {
|
|
68
|
+
const nodeCopyFile = /* @__PURE__ */ effectify(NFS.copyFile, /* @__PURE__ */ handleErrnoException("FileSystem", "copyFile"), /* @__PURE__ */ handleBadArgument("copyFile"));
|
|
69
|
+
return (fromPath, toPath) => nodeCopyFile(fromPath, toPath);
|
|
70
|
+
})();
|
|
71
|
+
var chmod2 = /* @__PURE__ */ (() => {
|
|
72
|
+
const nodeChmod = /* @__PURE__ */ effectify(NFS.chmod, /* @__PURE__ */ handleErrnoException("FileSystem", "chmod"), /* @__PURE__ */ handleBadArgument("chmod"));
|
|
73
|
+
return (path, mode) => nodeChmod(path, mode);
|
|
74
|
+
})();
|
|
75
|
+
var chown2 = /* @__PURE__ */ (() => {
|
|
76
|
+
const nodeChown = /* @__PURE__ */ effectify(NFS.chown, /* @__PURE__ */ handleErrnoException("FileSystem", "chown"), /* @__PURE__ */ handleBadArgument("chown"));
|
|
77
|
+
return (path, uid, gid) => nodeChown(path, uid, gid);
|
|
78
|
+
})();
|
|
79
|
+
var glob2 = /* @__PURE__ */ (() => {
|
|
80
|
+
const nodeGlob = /* @__PURE__ */ effectify(NFS.glob, /* @__PURE__ */ handleErrnoException("FileSystem", "glob"), /* @__PURE__ */ handleBadArgument("glob"));
|
|
81
|
+
return (pattern, options) => nodeGlob(pattern, {
|
|
82
|
+
cwd: options?.root,
|
|
83
|
+
exclude: options?.exclude
|
|
84
|
+
});
|
|
85
|
+
})();
|
|
86
|
+
var link2 = /* @__PURE__ */ (() => {
|
|
87
|
+
const nodeLink = /* @__PURE__ */ effectify(NFS.link, /* @__PURE__ */ handleErrnoException("FileSystem", "link"), /* @__PURE__ */ handleBadArgument("link"));
|
|
88
|
+
return (existingPath, newPath) => nodeLink(existingPath, newPath);
|
|
89
|
+
})();
|
|
90
|
+
var makeDirectory = /* @__PURE__ */ (() => {
|
|
91
|
+
const nodeMkdir = /* @__PURE__ */ effectify(NFS.mkdir, /* @__PURE__ */ handleErrnoException("FileSystem", "makeDirectory"), /* @__PURE__ */ handleBadArgument("makeDirectory"));
|
|
92
|
+
return (path, options) => nodeMkdir(path, {
|
|
93
|
+
recursive: options?.recursive ?? false,
|
|
94
|
+
mode: options?.mode
|
|
95
|
+
});
|
|
96
|
+
})();
|
|
97
|
+
var makeTempDirectoryFactory = (method) => {
|
|
98
|
+
const nodeMkdtemp = effectify(NFS.mkdtemp, handleErrnoException("FileSystem", method), handleBadArgument(method));
|
|
99
|
+
return (options) => Effect.suspend(() => {
|
|
100
|
+
const prefix = options?.prefix ?? "";
|
|
101
|
+
const directory = typeof options?.directory === "string" ? Path.join(options.directory, ".") : OS.tmpdir();
|
|
102
|
+
return nodeMkdtemp(prefix ? Path.join(directory, prefix) : directory + "/");
|
|
103
|
+
});
|
|
104
|
+
};
|
|
105
|
+
var makeTempDirectory = /* @__PURE__ */ makeTempDirectoryFactory("makeTempDirectory");
|
|
106
|
+
var removeFactory = (method) => {
|
|
107
|
+
const nodeRm = effectify(NFS.rm, handleErrnoException("FileSystem", method), handleBadArgument(method));
|
|
108
|
+
return (path, options) => nodeRm(path, {
|
|
109
|
+
recursive: options?.recursive ?? false,
|
|
110
|
+
force: options?.force ?? false
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
var remove = /* @__PURE__ */ removeFactory("remove");
|
|
114
|
+
var makeTempDirectoryScoped = /* @__PURE__ */ (() => {
|
|
115
|
+
const makeDirectory2 = /* @__PURE__ */ makeTempDirectoryFactory("makeTempDirectoryScoped");
|
|
116
|
+
const removeDirectory = /* @__PURE__ */ removeFactory("makeTempDirectoryScoped");
|
|
117
|
+
return (options) => Effect.acquireRelease(makeDirectory2(options), (directory) => Effect.orDie(removeDirectory(directory, {
|
|
118
|
+
recursive: true
|
|
119
|
+
})));
|
|
120
|
+
})();
|
|
121
|
+
var openFactory = (method) => {
|
|
122
|
+
const nodeOpen = effectify(NFS.open, handleErrnoException("FileSystem", method), handleBadArgument(method));
|
|
123
|
+
const nodeClose = effectify(NFS.close, handleErrnoException("FileSystem", method), handleBadArgument(method));
|
|
124
|
+
return (path, options) => pipe(Effect.acquireRelease(nodeOpen(path, options?.flag ?? "r", options?.mode), (fd) => Effect.orDie(nodeClose(fd))), Effect.map((fd) => makeFile(fd, options?.flag?.startsWith("a") ?? false)));
|
|
125
|
+
};
|
|
126
|
+
var open2 = /* @__PURE__ */ openFactory("open");
|
|
127
|
+
var makeFile = /* @__PURE__ */ (() => {
|
|
128
|
+
const nodeReadFactory = (method) => effectify(NFS.read, handleErrnoException("FileSystem", method), handleBadArgument(method));
|
|
129
|
+
const nodeRead = /* @__PURE__ */ nodeReadFactory("read");
|
|
130
|
+
const nodeReadAlloc = /* @__PURE__ */ nodeReadFactory("readAlloc");
|
|
131
|
+
const nodeStat = /* @__PURE__ */ effectify(NFS.fstat, /* @__PURE__ */ handleErrnoException("FileSystem", "stat"), /* @__PURE__ */ handleBadArgument("stat"));
|
|
132
|
+
const nodeTruncate = /* @__PURE__ */ effectify(NFS.ftruncate, /* @__PURE__ */ handleErrnoException("FileSystem", "truncate"), /* @__PURE__ */ handleBadArgument("truncate"));
|
|
133
|
+
const nodeSync = /* @__PURE__ */ effectify(NFS.fsync, /* @__PURE__ */ handleErrnoException("FileSystem", "sync"), /* @__PURE__ */ handleBadArgument("sync"));
|
|
134
|
+
const nodeWriteFactory = (method) => effectify(NFS.write, handleErrnoException("FileSystem", method), handleBadArgument(method));
|
|
135
|
+
const nodeWrite = /* @__PURE__ */ nodeWriteFactory("write");
|
|
136
|
+
const nodeWriteAll = /* @__PURE__ */ nodeWriteFactory("writeAll");
|
|
137
|
+
class FileImpl {
|
|
138
|
+
[FileSystem.FileTypeId];
|
|
139
|
+
fd;
|
|
140
|
+
append;
|
|
141
|
+
position = /* @__PURE__ */ BigInt(0);
|
|
142
|
+
constructor(fd, append) {
|
|
143
|
+
this[FileSystem.FileTypeId] = FileSystem.FileTypeId;
|
|
144
|
+
this.fd = fd;
|
|
145
|
+
this.append = append;
|
|
146
|
+
}
|
|
147
|
+
get stat() {
|
|
148
|
+
return Effect.flatMap(nodeStat(this.fd, {
|
|
149
|
+
bigint: true
|
|
150
|
+
}), makeFileInfo);
|
|
151
|
+
}
|
|
152
|
+
get sync() {
|
|
153
|
+
return nodeSync(this.fd);
|
|
154
|
+
}
|
|
155
|
+
seek(offset, from) {
|
|
156
|
+
return Effect.suspend(() => {
|
|
157
|
+
const position = from === "start" ? offset : this.position + offset;
|
|
158
|
+
if (position < BigInt(0)) {
|
|
159
|
+
return Effect.fail(Error.badArgument({
|
|
160
|
+
module: "FileSystem",
|
|
161
|
+
method: "seek",
|
|
162
|
+
description: "Cannot seek before the start of the file"
|
|
163
|
+
}));
|
|
164
|
+
}
|
|
165
|
+
this.position = position;
|
|
166
|
+
return Effect.succeed(position);
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
read(buffer) {
|
|
170
|
+
return Effect.suspend(() => {
|
|
171
|
+
const position = this.position;
|
|
172
|
+
return Effect.map(nodeRead(this.fd, {
|
|
173
|
+
buffer,
|
|
174
|
+
position
|
|
175
|
+
}), (bytesRead) => {
|
|
176
|
+
this.position = position + BigInt(bytesRead);
|
|
177
|
+
return bytesRead;
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
readAlloc(size) {
|
|
182
|
+
return Effect.suspend(() => {
|
|
183
|
+
try {
|
|
184
|
+
if (!Number.isInteger(size) || size < 0) {
|
|
185
|
+
throw new RangeError("size must be a non-negative integer");
|
|
186
|
+
}
|
|
187
|
+
const buffer = Buffer.allocUnsafeSlow(size);
|
|
188
|
+
const position = this.position;
|
|
189
|
+
return Effect.map(nodeReadAlloc(this.fd, {
|
|
190
|
+
buffer,
|
|
191
|
+
position
|
|
192
|
+
}), (bytesRead) => {
|
|
193
|
+
if (bytesRead === 0) {
|
|
194
|
+
return Option.none();
|
|
195
|
+
}
|
|
196
|
+
this.position = position + BigInt(bytesRead);
|
|
197
|
+
if (bytesRead === size) {
|
|
198
|
+
return Option.some(buffer);
|
|
199
|
+
}
|
|
200
|
+
const dst = Buffer.allocUnsafeSlow(bytesRead);
|
|
201
|
+
buffer.copy(dst, 0, 0, bytesRead);
|
|
202
|
+
return Option.some(dst);
|
|
203
|
+
});
|
|
204
|
+
} catch (cause) {
|
|
205
|
+
return Effect.fail(handleBadArgument("readAlloc")(cause));
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
truncate(length) {
|
|
210
|
+
return Effect.map(nodeTruncate(this.fd, length || void 0), () => {
|
|
211
|
+
if (!this.append) {
|
|
212
|
+
const len = BigInt(length ?? 0);
|
|
213
|
+
if (this.position > len) {
|
|
214
|
+
this.position = len;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
write(buffer) {
|
|
220
|
+
return Effect.suspend(() => {
|
|
221
|
+
const position = this.position;
|
|
222
|
+
return Effect.flatMap(this.append ? Effect.succeed(void 0) : positionToNumber(position, "write"), (nodePosition) => Effect.map(nodeWrite(this.fd, buffer, void 0, void 0, nodePosition), (bytesWritten) => {
|
|
223
|
+
if (!this.append) {
|
|
224
|
+
this.position = position + BigInt(bytesWritten);
|
|
225
|
+
}
|
|
226
|
+
return bytesWritten;
|
|
227
|
+
}));
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
writeAllChunk(buffer) {
|
|
231
|
+
return Effect.suspend(() => {
|
|
232
|
+
const position = this.position;
|
|
233
|
+
return Effect.flatMap(this.append ? Effect.succeed(void 0) : positionToNumber(position, "writeAll"), (nodePosition) => Effect.flatMap(nodeWriteAll(this.fd, buffer, void 0, void 0, nodePosition), (bytesWritten) => {
|
|
234
|
+
if (bytesWritten === 0) {
|
|
235
|
+
return Effect.fail(Error.systemError({
|
|
236
|
+
module: "FileSystem",
|
|
237
|
+
method: "writeAll",
|
|
238
|
+
_tag: "WriteZero",
|
|
239
|
+
pathOrDescriptor: this.fd,
|
|
240
|
+
description: "write returned 0 bytes written"
|
|
241
|
+
}));
|
|
242
|
+
}
|
|
243
|
+
if (!this.append) {
|
|
244
|
+
this.position = position + BigInt(bytesWritten);
|
|
245
|
+
}
|
|
246
|
+
return bytesWritten < buffer.length ? this.writeAllChunk(buffer.subarray(bytesWritten)) : Effect.void;
|
|
247
|
+
}));
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
writeAll(buffer) {
|
|
251
|
+
return buffer.length === 0 ? Effect.void : this.writeAllChunk(buffer);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
return (fd, append) => new FileImpl(fd, append);
|
|
255
|
+
})();
|
|
256
|
+
var makeTempFileFactory = (method) => {
|
|
257
|
+
const makeDirectory2 = makeTempDirectoryFactory(method);
|
|
258
|
+
return Effect.fnUntraced(function* (options) {
|
|
259
|
+
const directory = yield* makeDirectory2(options);
|
|
260
|
+
const random = Crypto.randomBytes(6).toString("hex");
|
|
261
|
+
const name = Path.join(directory, options?.suffix ? `${random}${options.suffix}` : random);
|
|
262
|
+
yield* writeFile2(name, new Uint8Array(0));
|
|
263
|
+
return name;
|
|
264
|
+
});
|
|
265
|
+
};
|
|
266
|
+
var makeTempFile = /* @__PURE__ */ makeTempFileFactory("makeTempFile");
|
|
267
|
+
var makeTempFileScoped = /* @__PURE__ */ (() => {
|
|
268
|
+
const makeFile2 = /* @__PURE__ */ makeTempFileFactory("makeTempFileScoped");
|
|
269
|
+
const removeDirectory = /* @__PURE__ */ removeFactory("makeTempFileScoped");
|
|
270
|
+
return (options) => Effect.acquireRelease(makeFile2(options), (file) => Effect.orDie(removeDirectory(Path.dirname(file), {
|
|
271
|
+
recursive: true
|
|
272
|
+
})));
|
|
273
|
+
})();
|
|
274
|
+
var readDirectory = (path, options) => Effect.tryPromise({
|
|
275
|
+
try: () => NFS.promises.readdir(path, options),
|
|
276
|
+
catch: (err) => handleErrnoException("FileSystem", "readDirectory")(err, [path])
|
|
277
|
+
});
|
|
278
|
+
var readFile2 = (path) => Effect.callback((resume, signal) => {
|
|
279
|
+
try {
|
|
280
|
+
NFS.readFile(path, {
|
|
281
|
+
signal
|
|
282
|
+
}, (err, data) => {
|
|
283
|
+
if (err) {
|
|
284
|
+
resume(Effect.fail(handleErrnoException("FileSystem", "readFile")(err, [path])));
|
|
285
|
+
} else {
|
|
286
|
+
resume(Effect.succeed(data));
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
} catch (err) {
|
|
290
|
+
resume(Effect.fail(handleBadArgument("readFile")(err)));
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
var readLink = /* @__PURE__ */ (() => {
|
|
294
|
+
const nodeReadLink = /* @__PURE__ */ effectify(NFS.readlink, /* @__PURE__ */ handleErrnoException("FileSystem", "readLink"), /* @__PURE__ */ handleBadArgument("readLink"));
|
|
295
|
+
return (path) => nodeReadLink(path);
|
|
296
|
+
})();
|
|
297
|
+
var realPath = /* @__PURE__ */ (() => {
|
|
298
|
+
const nodeRealPath = /* @__PURE__ */ effectify(NFS.realpath, /* @__PURE__ */ handleErrnoException("FileSystem", "realPath"), /* @__PURE__ */ handleBadArgument("realPath"));
|
|
299
|
+
return (path) => nodeRealPath(path);
|
|
300
|
+
})();
|
|
301
|
+
var rename2 = /* @__PURE__ */ (() => {
|
|
302
|
+
const nodeRename = /* @__PURE__ */ effectify(NFS.rename, /* @__PURE__ */ handleErrnoException("FileSystem", "rename"), /* @__PURE__ */ handleBadArgument("rename"));
|
|
303
|
+
return (oldPath, newPath) => nodeRename(oldPath, newPath);
|
|
304
|
+
})();
|
|
305
|
+
var makeFileInfo = (stat3) => Effect.try({
|
|
306
|
+
try: () => ({
|
|
307
|
+
type: stat3.isFile() ? "File" : stat3.isDirectory() ? "Directory" : stat3.isSymbolicLink() ? "SymbolicLink" : stat3.isBlockDevice() ? "BlockDevice" : stat3.isCharacterDevice() ? "CharacterDevice" : stat3.isFIFO() ? "FIFO" : stat3.isSocket() ? "Socket" : "Unknown",
|
|
308
|
+
mtime: Option.fromNullishOr(stat3.mtime),
|
|
309
|
+
atime: Option.fromNullishOr(stat3.atime),
|
|
310
|
+
birthtime: Option.fromNullishOr(stat3.birthtime),
|
|
311
|
+
dev: bigintToNumber(stat3.dev, "dev"),
|
|
312
|
+
rdev: bigintToNumberOption(stat3.rdev),
|
|
313
|
+
ino: bigintToNumberOption(stat3.ino),
|
|
314
|
+
mode: bigintToNumber(stat3.mode, "mode"),
|
|
315
|
+
nlink: bigintToNumberOption(stat3.nlink),
|
|
316
|
+
uid: bigintToNumberOption(stat3.uid),
|
|
317
|
+
gid: bigintToNumberOption(stat3.gid),
|
|
318
|
+
size: ByteSize.bytes(stat3.size),
|
|
319
|
+
blksize: stat3.blksize !== void 0 ? Option.some(ByteSize.bytes(stat3.blksize)) : Option.none(),
|
|
320
|
+
blocks: bigintToNumberOption(stat3.blocks)
|
|
321
|
+
}),
|
|
322
|
+
catch: handleBadArgument("stat")
|
|
323
|
+
});
|
|
324
|
+
var stat2 = /* @__PURE__ */ (() => {
|
|
325
|
+
const nodeStat = /* @__PURE__ */ effectify(NFS.stat, /* @__PURE__ */ handleErrnoException("FileSystem", "stat"), /* @__PURE__ */ handleBadArgument("stat"));
|
|
326
|
+
return (path) => Effect.flatMap(nodeStat(path, {
|
|
327
|
+
bigint: true
|
|
328
|
+
}), makeFileInfo);
|
|
329
|
+
})();
|
|
330
|
+
var symlink2 = /* @__PURE__ */ (() => {
|
|
331
|
+
const nodeSymlink = /* @__PURE__ */ effectify(NFS.symlink, /* @__PURE__ */ handleErrnoException("FileSystem", "symlink"), /* @__PURE__ */ handleBadArgument("symlink"));
|
|
332
|
+
return (target, path) => nodeSymlink(target, path);
|
|
333
|
+
})();
|
|
334
|
+
var truncate2 = /* @__PURE__ */ (() => {
|
|
335
|
+
const nodeTruncate = /* @__PURE__ */ effectify(NFS.truncate, /* @__PURE__ */ handleErrnoException("FileSystem", "truncate"), /* @__PURE__ */ handleBadArgument("truncate"));
|
|
336
|
+
return (path, length) => nodeTruncate(path, length);
|
|
337
|
+
})();
|
|
338
|
+
var utimes2 = /* @__PURE__ */ (() => {
|
|
339
|
+
const nodeUtimes = /* @__PURE__ */ effectify(NFS.utimes, /* @__PURE__ */ handleErrnoException("FileSystem", "utime"), /* @__PURE__ */ handleBadArgument("utime"));
|
|
340
|
+
return (path, atime, mtime) => nodeUtimes(path, atime, mtime);
|
|
341
|
+
})();
|
|
342
|
+
var watchNode = (path, info, options) => Stream.callback((queue) => Effect.acquireRelease(Effect.sync(() => {
|
|
343
|
+
const directory = info.type === "Directory" ? path : Path.dirname(path);
|
|
344
|
+
const watcher = NFS.watch(path, {
|
|
345
|
+
recursive: options?.recursive ?? false
|
|
346
|
+
}, (event, path2) => {
|
|
347
|
+
if (!path2) return;
|
|
348
|
+
switch (event) {
|
|
349
|
+
case "rename": {
|
|
350
|
+
Effect.runFork(Effect.matchEffect(stat2(Path.resolve(directory, path2)), {
|
|
351
|
+
onSuccess: (_) => Queue.offer(queue, {
|
|
352
|
+
_tag: "Create",
|
|
353
|
+
path: path2
|
|
354
|
+
}),
|
|
355
|
+
onFailure: (_) => Queue.offer(queue, {
|
|
356
|
+
_tag: "Remove",
|
|
357
|
+
path: path2
|
|
358
|
+
})
|
|
359
|
+
}));
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
362
|
+
case "change": {
|
|
363
|
+
Queue.offerUnsafe(queue, {
|
|
364
|
+
_tag: "Update",
|
|
365
|
+
path: path2
|
|
366
|
+
});
|
|
367
|
+
return;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
});
|
|
371
|
+
watcher.on("error", (error) => {
|
|
372
|
+
Queue.failCauseUnsafe(queue, Cause.fail(Error.systemError({
|
|
373
|
+
module: "FileSystem",
|
|
374
|
+
_tag: "Unknown",
|
|
375
|
+
method: "watch",
|
|
376
|
+
pathOrDescriptor: path,
|
|
377
|
+
cause: error
|
|
378
|
+
})));
|
|
379
|
+
});
|
|
380
|
+
watcher.on("close", () => {
|
|
381
|
+
Queue.endUnsafe(queue);
|
|
382
|
+
});
|
|
383
|
+
return watcher;
|
|
384
|
+
}), (watcher) => Effect.sync(() => watcher.close())));
|
|
385
|
+
var watch2 = (backend, path, options) => stat2(path).pipe(Effect.map((stat3) => backend.pipe(Option.flatMap((_) => _.register(path, stat3, options)), Option.getOrElse(() => watchNode(path, stat3, options)))), Stream.unwrap);
|
|
386
|
+
var writeFile2 = (path, data, options) => Effect.callback((resume, signal) => {
|
|
387
|
+
try {
|
|
388
|
+
NFS.writeFile(path, data, {
|
|
389
|
+
signal,
|
|
390
|
+
flag: options?.flag,
|
|
391
|
+
mode: options?.mode
|
|
392
|
+
}, (err) => {
|
|
393
|
+
if (err) {
|
|
394
|
+
resume(Effect.fail(handleErrnoException("FileSystem", "writeFile")(err, [path])));
|
|
395
|
+
} else {
|
|
396
|
+
resume(Effect.void);
|
|
397
|
+
}
|
|
398
|
+
});
|
|
399
|
+
} catch (err) {
|
|
400
|
+
resume(Effect.fail(handleBadArgument("writeFile")(err)));
|
|
401
|
+
}
|
|
402
|
+
});
|
|
403
|
+
var makeFileSystem = /* @__PURE__ */ Effect.map(/* @__PURE__ */ Effect.serviceOption(FileSystem.WatchBackend), (backend) => FileSystem.make({
|
|
404
|
+
access: access2,
|
|
405
|
+
chmod: chmod2,
|
|
406
|
+
chown: chown2,
|
|
407
|
+
copy,
|
|
408
|
+
copyFile: copyFile2,
|
|
409
|
+
glob: glob2,
|
|
410
|
+
link: link2,
|
|
411
|
+
makeDirectory,
|
|
412
|
+
makeTempDirectory,
|
|
413
|
+
makeTempDirectoryScoped,
|
|
414
|
+
makeTempFile,
|
|
415
|
+
makeTempFileScoped,
|
|
416
|
+
open: open2,
|
|
417
|
+
readDirectory,
|
|
418
|
+
readFile: readFile2,
|
|
419
|
+
readLink,
|
|
420
|
+
realPath,
|
|
421
|
+
remove,
|
|
422
|
+
rename: rename2,
|
|
423
|
+
stat: stat2,
|
|
424
|
+
symlink: symlink2,
|
|
425
|
+
truncate: truncate2,
|
|
426
|
+
utimes: utimes2,
|
|
427
|
+
watch(path, options) {
|
|
428
|
+
return watch2(backend, path, options);
|
|
429
|
+
},
|
|
430
|
+
writeFile: writeFile2
|
|
431
|
+
}));
|
|
432
|
+
var layer = /* @__PURE__ */ Layer.effect(FileSystem.FileSystem)(makeFileSystem);
|
|
433
|
+
|
|
434
|
+
export {
|
|
435
|
+
layer,
|
|
436
|
+
NodeFileSystem_exports
|
|
437
|
+
};
|