@smthrs/platform-bun 0.0.0-stage → 1.0.0-rc.4
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,147 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var BunHost_exports = {};
|
|
30
|
+
__export(BunHost_exports, {
|
|
31
|
+
AtomicFileSystem: () => AtomicFileSystem,
|
|
32
|
+
BunChildProcessSpawner: () => BunChildProcessSpawner,
|
|
33
|
+
BunCrypto: () => BunCrypto,
|
|
34
|
+
BunFileSystem: () => BunFileSystem,
|
|
35
|
+
BunHostError: () => BunHostError,
|
|
36
|
+
HostLiveness: () => HostLiveness,
|
|
37
|
+
ProcessReaper: () => ProcessReaper,
|
|
38
|
+
implementationIds: () => implementationIds,
|
|
39
|
+
layer: () => layer,
|
|
40
|
+
layerAt: () => layerAt,
|
|
41
|
+
layerContained: () => layerContained,
|
|
42
|
+
layerContainedAt: () => layerContainedAt,
|
|
43
|
+
layerHttpClient: () => layerHttpClient
|
|
44
|
+
});
|
|
45
|
+
module.exports = __toCommonJS(BunHost_exports);
|
|
46
|
+
var BunChildProcessSpawner = __toESM(require("../vendor/cjs/bun/BunChildProcessSpawner.js"), 1);
|
|
47
|
+
var BunCrypto = __toESM(require("../vendor/cjs/bun/BunCrypto.js"), 1);
|
|
48
|
+
var BunPath = __toESM(require("../vendor/cjs/bun/BunPath.js"), 1);
|
|
49
|
+
var BunJj = __toESM(require("@smthrs/jj/bun/BunJj"), 1);
|
|
50
|
+
var AtomicFileSystem = __toESM(require("@smthrs/platform-node/AtomicFileSystem"), 1);
|
|
51
|
+
var EgressHttpClient = __toESM(require("@smthrs/platform-node/EgressHttpClient"), 1);
|
|
52
|
+
var HostLiveness = __toESM(require("@smthrs/platform-node/HostLiveness"), 1);
|
|
53
|
+
var ProcessConfinement = __toESM(require("@smthrs/platform-node/ProcessConfinement"), 1);
|
|
54
|
+
var ProcessReaper = __toESM(require("@smthrs/platform-node/ProcessReaper"), 1);
|
|
55
|
+
var Layer = __toESM(require("effect/Layer"), 1);
|
|
56
|
+
var Schema = __toESM(require("effect/Schema"), 1);
|
|
57
|
+
var import_node_path = require("node:path");
|
|
58
|
+
var BunFileSystem = __toESM(require("./BunFileSystem.js"), 1);
|
|
59
|
+
class BunHostError extends Schema.TaggedError()("@smthrs/platform-bun/BunHostError", {
|
|
60
|
+
code: Schema.Literal("invalid_repository_root"),
|
|
61
|
+
message: Schema.String
|
|
62
|
+
}) {
|
|
63
|
+
name = "BunHostError";
|
|
64
|
+
}
|
|
65
|
+
const messageLimit = 255;
|
|
66
|
+
const previewLimit = 64;
|
|
67
|
+
const preview = (root, budget) => {
|
|
68
|
+
const points = Array.from(root);
|
|
69
|
+
const whole = JSON.stringify(root);
|
|
70
|
+
if (points.length <= previewLimit && whole.length <= budget) return whole;
|
|
71
|
+
const suffix = `... (${points.length} characters)`;
|
|
72
|
+
const room = budget - suffix.length - 2;
|
|
73
|
+
let excerpt = "";
|
|
74
|
+
for (const point of points.slice(0, previewLimit)) {
|
|
75
|
+
const encoded = JSON.stringify(point).slice(1, -1);
|
|
76
|
+
if (excerpt.length + encoded.length > room) break;
|
|
77
|
+
excerpt += encoded;
|
|
78
|
+
}
|
|
79
|
+
return `"${excerpt}"${suffix}`;
|
|
80
|
+
};
|
|
81
|
+
const absoluteRoot = (factory, root) => {
|
|
82
|
+
if ((0, import_node_path.isAbsolute)(root)) return root;
|
|
83
|
+
const prefix = `BunHost.${factory} requires an absolute repository root, got `;
|
|
84
|
+
throw new BunHostError({
|
|
85
|
+
code: "invalid_repository_root",
|
|
86
|
+
message: `${prefix}${preview(root, messageLimit - prefix.length)}`
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
const implementationIds = {
|
|
90
|
+
"effect/FileSystem": "@smthrs/platform-node/AtomicFileSystem",
|
|
91
|
+
"effect/Path": "@effect/platform-bun/BunPath",
|
|
92
|
+
"effect/process/ChildProcessSpawner": "@effect/platform-bun/BunChildProcessSpawner",
|
|
93
|
+
"@smthrs/jj/Jj": "@smthrs/jj/bun/BunJj",
|
|
94
|
+
"effect/HttpClient": "@smthrs/platform-node/EgressHttpClient"
|
|
95
|
+
};
|
|
96
|
+
const reaping = (options) => ({
|
|
97
|
+
ownerPid: options?.ownerPid,
|
|
98
|
+
system: options?.system
|
|
99
|
+
});
|
|
100
|
+
const platform = Layer.mergeAll(BunFileSystem.layer, BunPath.layer, BunCrypto.layer);
|
|
101
|
+
const layerHttpClient = EgressHttpClient.layer(process.env);
|
|
102
|
+
const layer = Layer.mergeAll(
|
|
103
|
+
ProcessConfinement.layer(),
|
|
104
|
+
platform,
|
|
105
|
+
Layer.provide(BunChildProcessSpawner.layer, platform),
|
|
106
|
+
BunJj.layer,
|
|
107
|
+
layerHttpClient
|
|
108
|
+
);
|
|
109
|
+
const layerAt = (root) => {
|
|
110
|
+
const repositoryRoot = absoluteRoot("layerAt", root);
|
|
111
|
+
return Layer.mergeAll(
|
|
112
|
+
ProcessConfinement.layer(),
|
|
113
|
+
platform,
|
|
114
|
+
Layer.provide(BunChildProcessSpawner.layer, platform),
|
|
115
|
+
BunJj.layerAt(repositoryRoot),
|
|
116
|
+
layerHttpClient
|
|
117
|
+
);
|
|
118
|
+
};
|
|
119
|
+
const layerContained = (options) => {
|
|
120
|
+
const spawner = Layer.provide(
|
|
121
|
+
ProcessReaper.layerSpawner({ graceMs: options?.graceMs }),
|
|
122
|
+
Layer.provide(BunChildProcessSpawner.layer, platform)
|
|
123
|
+
);
|
|
124
|
+
return Layer.mergeAll(
|
|
125
|
+
ProcessConfinement.layer(),
|
|
126
|
+
platform,
|
|
127
|
+
layerHttpClient,
|
|
128
|
+
// jj goes through the CONTAINED spawner here, not around it, exactly as in
|
|
129
|
+
// `NodeHost.layerContained`: a jj child that starts its own process leads
|
|
130
|
+
// no recorded group, is in no ledger, and outlives the host that ran it.
|
|
131
|
+
Layer.provideMerge(BunJj.layerSpawner, spawner)
|
|
132
|
+
).pipe(Layer.provideMerge(ProcessReaper.layer(reaping(options))));
|
|
133
|
+
};
|
|
134
|
+
const layerContainedAt = (root, options) => {
|
|
135
|
+
const repositoryRoot = absoluteRoot("layerContainedAt", root);
|
|
136
|
+
const spawner = Layer.provide(
|
|
137
|
+
ProcessReaper.layerSpawner({ graceMs: options?.graceMs }),
|
|
138
|
+
Layer.provide(BunChildProcessSpawner.layer, platform)
|
|
139
|
+
);
|
|
140
|
+
return Layer.mergeAll(
|
|
141
|
+
ProcessConfinement.layer(),
|
|
142
|
+
platform,
|
|
143
|
+
layerHttpClient,
|
|
144
|
+
Layer.provideMerge(BunJj.layerSpawnerAt(repositoryRoot), spawner)
|
|
145
|
+
).pipe(Layer.provideMerge(ProcessReaper.layer(reaping(options))));
|
|
146
|
+
};
|
|
147
|
+
//# sourceMappingURL=BunHost.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/BunHost.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Aggregate Bun Host bundle.\n *\n * Runtime-specific dependencies stay inside this package; callers get the same\n * closed five-service Host surface every other bundle provides, plus native\n * `ProcessConfinement` for guarded commands.\n *\n * There is no Bun shell module: running a command is Effect's\n * `ChildProcessSpawner`, and `@effect/platform-bun`'s implementation is\n * `@effect/platform-node-shared`'s re-exported: the same code on both\n * runtimes, so no runtime detection is needed here.\n *\n * Outgoing HTTP uses the shared EgressHttpClient on both runtimes. Web\n * requests pin approved addresses; ordinary requests retain the shared pool.\n * Redirects remain visible to the capability kernel, and proxy routing follows\n * the host environment.\n *\n * The filesystem slot is `@smthrs/platform-node`'s `AtomicFileSystem`, byte for\n * byte the layer `NodeHost` uses, so a guarded path operation is\n * descriptor-relative and no-follow on both runtimes.\n *\n * @since 1.0.0-rc.0\n */\n\nimport * as BunChildProcessSpawner from \"@effect/platform-bun/BunChildProcessSpawner\"\nimport * as BunCrypto from \"@effect/platform-bun/BunCrypto\"\nimport * as BunPath from \"@effect/platform-bun/BunPath\"\nimport type { Jj, JjError } from \"@smthrs/jj\"\nimport * as BunJj from \"@smthrs/jj/bun/BunJj\"\nimport type { HostServiceIds } from \"@smthrs/kernel/HostServices\"\nimport type * as KernelProcessConfinement from \"@smthrs/kernel/ProcessConfinement\"\nimport type * as ProcessLedger from \"@smthrs/kernel/ProcessLedger\"\nimport * as AtomicFileSystem from \"@smthrs/platform-node/AtomicFileSystem\"\nimport * as EgressHttpClient from \"@smthrs/platform-node/EgressHttpClient\"\nimport * as HostLiveness from \"@smthrs/platform-node/HostLiveness\"\nimport * as ProcessConfinement from \"@smthrs/platform-node/ProcessConfinement\"\nimport * as ProcessReaper from \"@smthrs/platform-node/ProcessReaper\"\nimport type * as Crypto from \"effect/Crypto\"\nimport type { FileSystem } from \"effect/FileSystem\"\nimport * as Layer from \"effect/Layer\"\nimport type * as Path from \"effect/Path\"\nimport * as Schema from \"effect/Schema\"\nimport type { HttpClient } from \"effect/unstable/http/HttpClient\"\nimport type { ChildProcessSpawner } from \"effect/unstable/process/ChildProcessSpawner\"\nimport { isAbsolute } from \"node:path\"\nimport * as BunFileSystem from \"./BunFileSystem.ts\"\n\n/**\n * Bun platform modules for selectively providing individual services.\n *\n * `AtomicFileSystem` is here for the same reason `NodeHost` re-exports it: it\n * owns the only configuration escape hatch the filesystem slot has, and a Bun\n * program with a different packaged helper path needs to reach\n * `AtomicFileSystem.layerWith` without hand-composing the other four tags.\n *\n * `BunJj` is deliberately absent: it belongs to `@smthrs/jj` and is imported\n * from there, never re-exported here. So is `@effect/platform-bun/BunHttpClient`:\n * its `layer` follows redirects to origins the capability kernel never\n * authorized. The network slot on its own is {@link layerHttpClient}.\n *\n * @category re-exports\n * @since 1.0.0-rc.0\n * @slop\n */\nexport { AtomicFileSystem, BunChildProcessSpawner, BunCrypto, BunFileSystem, HostLiveness, ProcessReaper }\n\n/**\n * The complete closed Host service union provided by Bun.\n *\n * @category models\n * @since 1.0.0-rc.0\n * @slop\n */\nexport type BunHost =\n | FileSystem\n | Path.Path\n | ChildProcessSpawner\n | Jj\n | HttpClient\n | KernelProcessConfinement.ProcessConfinement\n\n/**\n * The stable codes a `BunHost` factory refuses with.\n *\n * A code is the contract a caller branches on; the message beside it is for a\n * person. `invalid_repository_root` is the root handed to {@link layerAt} or\n * {@link layerContainedAt} not being absolute, the empty string included.\n *\n * @category models\n * @since 1.0.0-rc.0\n */\nexport type BunHostErrorCode = \"invalid_repository_root\"\n\n/**\n * The refusal a `BunHost` factory throws before it builds a layer.\n *\n * It is thrown rather than failed because a factory is called while a program\n * composes its layers, where there is no fiber to fail yet and a wrong root is\n * a composition mistake, not a runtime outcome. It is this package's class,\n * not the `Jj` adapter's, because a Bun caller composes `BunHost` and should\n * learn nothing about the adapter behind the `Jj` slot from an error message.\n *\n * @category errors\n * @since 1.0.0-rc.0\n */\nexport class BunHostError extends Schema.TaggedError<BunHostError>()(\"@smthrs/platform-bun/BunHostError\", {\n code: Schema.Literal(\"invalid_repository_root\"),\n message: Schema.String\n}) {\n override readonly name = \"BunHostError\"\n}\n\n/** The longest message a factory refuses with, in UTF-16 code units. */\nconst messageLimit = 255\n\n/** How many code points of a refused root the message repeats at most. */\nconst previewLimit = 64\n\n/**\n * A bounded, quoted excerpt of a refused root that fits in `budget` code\n * units of the message.\n *\n * Counted in code points rather than UTF-16 units so a cut never splits a\n * surrogate pair, and passed through `JSON.stringify` so a newline in the root\n * cannot break the log line the message lands on. Each code point is encoded\n * on its own and admitted only while the quoted excerpt plus the length\n * suffix still fit, so a control character that widens to a `\\u0001` escape\n * shortens the excerpt instead of lengthening the message, and a cut never\n * lands inside an escape.\n */\nconst preview = (root: string, budget: number): string => {\n const points = Array.from(root)\n const whole = JSON.stringify(root)\n if (points.length <= previewLimit && whole.length <= budget) return whole\n const suffix = `... (${points.length} characters)`\n const room = budget - suffix.length - 2\n let excerpt = \"\"\n for (const point of points.slice(0, previewLimit)) {\n const encoded = JSON.stringify(point).slice(1, -1)\n if (excerpt.length + encoded.length > room) break\n excerpt += encoded\n }\n return `\"${excerpt}\"${suffix}`\n}\n\n/**\n * Refuses a root the `Jj` adapter underneath would refuse, here and in this\n * package's name.\n *\n * `BunJj.layerAt` and `BunJj.layerSpawnerAt` are `NodeJj`'s, and those throw a\n * bare `TypeError` that names `NodeJj`, carries no code, and echoes the whole\n * string. The predicate here is the same `isAbsolute` the adapter applies, so\n * a root that passes this check cannot reach that throw.\n */\nconst absoluteRoot = (factory: \"layerAt\" | \"layerContainedAt\", root: string): string => {\n if (isAbsolute(root)) return root\n const prefix = `BunHost.${factory} requires an absolute repository root, got `\n throw new BunHostError({\n code: \"invalid_repository_root\",\n message: `${prefix}${preview(root, messageLimit - prefix.length)}`\n })\n}\n\n/**\n * Stable implementation identities keyed by the closed Host service slots.\n *\n * Each value names the module behind that slot in the raw host bundle.\n * Contained POSIX factories replace the spawner with {@link ProcessReaper.layerSpawner}.\n * These are identity\n * tokens rather than import specifiers: the filesystem entry is\n * `@smthrs/platform-node/AtomicFileSystem` because that is the implementation,\n * even though a consumer reaches it through `@smthrs/platform-bun`.\n *\n * Nothing digests them yet. `@smthrs/plan`'s step key carries a `layers`\n * component these values are meant to feed, but no planner derives it from a\n * host bundle today, so changing one invalidates no cached step.\n *\n * The keys are written as literals rather than `HostServiceIds` positions so\n * that reordering the closed list cannot silently pair a slot with another\n * slot's implementation.\n *\n * @category models\n * @since 1.0.0-rc.0\n * @slop\n */\nexport const implementationIds: Readonly<Record<(typeof HostServiceIds)[number], string>> = {\n \"effect/FileSystem\": \"@smthrs/platform-node/AtomicFileSystem\",\n \"effect/Path\": \"@effect/platform-bun/BunPath\",\n \"effect/process/ChildProcessSpawner\": \"@effect/platform-bun/BunChildProcessSpawner\",\n \"@smthrs/jj/Jj\": \"@smthrs/jj/bun/BunJj\",\n \"effect/HttpClient\": \"@smthrs/platform-node/EgressHttpClient\"\n}\n\n/**\n * What a caller may configure about containment.\n *\n * `ContainedSpawner.Options.platform` is deliberately not part of it. It\n * decides one thing, whether a command that names no `detached` option gets a\n * process group of its own, and this native host detaches by `process.platform`\n * whatever a record claims. A\n * caller-supplied `\"win32\"` on a POSIX host would therefore record\n * `pgid: null` for a child that really does lead a group, and\n * {@link ProcessReaper.reap} would retire that record as `no-group` and leave\n * the orphan running forever: a durable lie rather than a compile error.\n *\n * @category models\n * @since 1.0.0-rc.0\n */\nexport type ContainedOptions = ProcessReaper.SpawnerOptions & ProcessReaper.Options\n\n/** The reaper half of {@link ContainedOptions}. */\nconst reaping = (options?: ContainedOptions): ProcessReaper.Options => ({\n ownerPid: options?.ownerPid,\n system: options?.system\n})\n\n/** The two services `BunChildProcessSpawner` resolves paths and files with. */\nconst platform = Layer.mergeAll(BunFileSystem.layer, BunPath.layer, BunCrypto.layer)\n\n/**\n * The network slot on its own: the shared egress client, which never follows a\n * redirect. A `3xx` comes back to the caller with its `location` intact and the\n * second origin uncontacted; following a redirect is `@smthrs/kernel`'s guarded\n * `HttpClient.layer`, which rechecks every hop.\n *\n * @category layers\n * @since 1.0.0-rc.0\n */\nexport const layerHttpClient: Layer.Layer<HttpClient> = EgressHttpClient.layer(process.env)\n\n/**\n * Provides all five Bun Host services, including the runtime-independent Path\n * service.\n *\n * Fails at construction with {@link JjError} carrying `not_installed` or\n * `unsupported_version`: the `Jj` slot is merged eagerly and probes\n * `jj --version` while the layer is built, before the program body runs and\n * whether or not the program asks for `Jj`. Requires jj 0.39.0 or later.\n *\n * @category layers\n * @since 1.0.0-rc.0\n * @slop\n */\nexport const layer: Layer.Layer<BunHost | Crypto.Crypto, JjError> = Layer.mergeAll(\n ProcessConfinement.layer(),\n platform,\n Layer.provide(BunChildProcessSpawner.layer, platform),\n BunJj.layer,\n layerHttpClient\n)\n\n/**\n * Provides all five Bun Host services bound to one absolute repository root.\n *\n * Throws {@link BunHostError} with code `invalid_repository_root` when `root`\n * is not absolute; the empty string counts. The check runs when the factory is\n * called, before any layer exists.\n *\n * Fails at construction with {@link JjError} exactly as {@link layer} does:\n * the `Jj` slot probes `jj --version` while the layer is built.\n *\n * @category layers\n * @since 1.0.0-rc.0\n */\nexport const layerAt = (root: string): Layer.Layer<BunHost | Crypto.Crypto, JjError> => {\n const repositoryRoot = absoluteRoot(\"layerAt\", root)\n return Layer.mergeAll(\n ProcessConfinement.layer(),\n platform,\n Layer.provide(BunChildProcessSpawner.layer, platform),\n BunJj.layerAt(repositoryRoot),\n layerHttpClient\n )\n}\n\n/**\n * Provides the Bun host with process containment turned on.\n *\n * Bun uses the same prepared native process lifecycle as Node on POSIX, while\n * preserving its underlying runtime spawner on Windows. `ContainedSpawner` gives\n * every child an escalation deadline and a ledger entry, and\n * `ProcessReaper` sweeps the entries a crashed incarnation of this host left\n * behind. The reaper module lives in `@smthrs/platform-node` because the calls\n * it makes, `process.kill` and `taskkill`, are Node's, and Bun implements\n * them unchanged.\n *\n * Fails at construction with {@link JjError} exactly as {@link layer} does;\n * here the `jj --version` probe runs through the contained spawner, so its\n * record enters and leaves the ledger like any other child.\n *\n * @category layers\n * @since 1.0.0-rc.0\n */\nexport const layerContained = (\n options?: ContainedOptions\n): Layer.Layer<BunHost | Crypto.Crypto, JjError, ProcessLedger.ProcessLedger> => {\n const spawner = Layer.provide(\n ProcessReaper.layerSpawner({ graceMs: options?.graceMs }),\n Layer.provide(BunChildProcessSpawner.layer, platform)\n )\n return Layer.mergeAll(\n ProcessConfinement.layer(),\n platform,\n layerHttpClient,\n // jj goes through the CONTAINED spawner here, not around it, exactly as in\n // `NodeHost.layerContained`: a jj child that starts its own process leads\n // no recorded group, is in no ledger, and outlives the host that ran it.\n Layer.provideMerge(BunJj.layerSpawner, spawner)\n ).pipe(Layer.provideMerge(ProcessReaper.layer(reaping(options))))\n}\n\n/**\n * Provides the contained Bun host bound to one absolute repository root.\n *\n * Refuses a root exactly as {@link layerAt} does: {@link BunHostError} with\n * code `invalid_repository_root`, thrown when the factory is called.\n * Fails at construction with {@link JjError} exactly as {@link layerContained}\n * does.\n *\n * @category layers\n * @since 1.0.0-rc.0\n */\nexport const layerContainedAt = (\n root: string,\n options?: ContainedOptions\n): Layer.Layer<BunHost | Crypto.Crypto, JjError, ProcessLedger.ProcessLedger> => {\n const repositoryRoot = absoluteRoot(\"layerContainedAt\", root)\n const spawner = Layer.provide(\n ProcessReaper.layerSpawner({ graceMs: options?.graceMs }),\n Layer.provide(BunChildProcessSpawner.layer, platform)\n )\n return Layer.mergeAll(\n ProcessConfinement.layer(),\n platform,\n layerHttpClient,\n Layer.provideMerge(BunJj.layerSpawnerAt(repositoryRoot), spawner)\n ).pipe(Layer.provideMerge(ProcessReaper.layer(reaping(options))))\n}\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@smthrs/platform-bun`, the Bun Host bundle.
|
|
3
|
+
*
|
|
4
|
+
* `BunHost.layer` composes the closed five-tag Host surface for Bun out of
|
|
5
|
+
* `@effect/platform-bun`'s child-process spawner and the shared egress `HttpClient`,
|
|
6
|
+
* Effect's runtime-independent `Path`, the Bun `Jj` adapter from
|
|
7
|
+
* `@smthrs/jj`, and `@smthrs/platform-node`'s `AtomicFileSystem`, which is the
|
|
8
|
+
* very layer the Node bundle puts in its own filesystem slot.
|
|
9
|
+
*
|
|
10
|
+
* Two host prerequisites come with it: `@effect/platform-bun`, which both this
|
|
11
|
+
* barrel and `@smthrs/platform-bun/BunHost` import at module load, and the
|
|
12
|
+
* `smithers-jj-export` native helper for the filesystem slot.
|
|
13
|
+
*
|
|
14
|
+
* @since 1.0.0-rc.0
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Bun's `FileSystem`, which is `@smthrs/platform-node`'s atomic filesystem.
|
|
18
|
+
* @slop
|
|
19
|
+
*/
|
|
20
|
+
export * as BunFileSystem from "./BunFileSystem.ts";
|
|
21
|
+
/**
|
|
22
|
+
* The complete closed Host bundle for Bun.
|
|
23
|
+
* @slop
|
|
24
|
+
*/
|
|
25
|
+
export * as BunHost from "./BunHost.ts";
|
|
26
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;;GAGG;AACH,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAA;AAEnD;;;GAGG;AACH,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var index_exports = {};
|
|
30
|
+
__export(index_exports, {
|
|
31
|
+
BunFileSystem: () => BunFileSystem,
|
|
32
|
+
BunHost: () => BunHost
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(index_exports);
|
|
35
|
+
var BunFileSystem = __toESM(require("./BunFileSystem.js"), 1);
|
|
36
|
+
var BunHost = __toESM(require("./BunHost.js"), 1);
|
|
37
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/index.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * `@smthrs/platform-bun`, the Bun Host bundle.\n *\n * `BunHost.layer` composes the closed five-tag Host surface for Bun out of\n * `@effect/platform-bun`'s child-process spawner and the shared egress `HttpClient`,\n * Effect's runtime-independent `Path`, the Bun `Jj` adapter from\n * `@smthrs/jj`, and `@smthrs/platform-node`'s `AtomicFileSystem`, which is the\n * very layer the Node bundle puts in its own filesystem slot.\n *\n * Two host prerequisites come with it: `@effect/platform-bun`, which both this\n * barrel and `@smthrs/platform-bun/BunHost` import at module load, and the\n * `smithers-jj-export` native helper for the filesystem slot.\n *\n * @since 1.0.0-rc.0\n */\n\n/**\n * Bun's `FileSystem`, which is `@smthrs/platform-node`'s atomic filesystem.\n * @slop\n */\nexport * as BunFileSystem from \"./BunFileSystem.ts\"\n\n/**\n * The complete closed Host bundle for Bun.\n * @slop\n */\nexport * as BunHost from \"./BunHost.ts\"\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAoBA,oBAA+B;AAM/B,cAAyB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"commonjs"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bun layer for Effect's `FileSystem` service.
|
|
3
|
+
*
|
|
4
|
+
* This is `@smthrs/platform-node`'s `AtomicFileSystem.layer`, the same
|
|
5
|
+
* implementation the Node bundle puts in its filesystem slot. It carries the
|
|
6
|
+
* kernel's atomic host extension, so `@smthrs/kernel`'s `FileSystem.layer`
|
|
7
|
+
* performs every guarded path operation descriptor-relative and no-follow
|
|
8
|
+
* instead of failing closed.
|
|
9
|
+
*
|
|
10
|
+
* The extension uses the packaged `smithers-jj-export --atomic-fs` helper.
|
|
11
|
+
* `layerWith` accepts another absolute executable path. Windows is unsupported.
|
|
12
|
+
*
|
|
13
|
+
* @since 1.0.0-rc.0
|
|
14
|
+
*/
|
|
15
|
+
import * as AtomicFileSystem from "@smthrs/platform-node/AtomicFileSystem";
|
|
16
|
+
import type { FileSystem } from "effect/FileSystem";
|
|
17
|
+
import type * as Layer from "effect/Layer";
|
|
18
|
+
/**
|
|
19
|
+
* Provides Bun's filesystem implementation, carrying the kernel's atomic host
|
|
20
|
+
* extension.
|
|
21
|
+
*
|
|
22
|
+
* @category layers
|
|
23
|
+
* @since 1.0.0-rc.0
|
|
24
|
+
* @slop
|
|
25
|
+
*/
|
|
26
|
+
export declare const layer: Layer.Layer<FileSystem>;
|
|
27
|
+
/**
|
|
28
|
+
* Provides the same filesystem against an explicitly configured helper and
|
|
29
|
+
* set of byte limits.
|
|
30
|
+
*
|
|
31
|
+
* This is the escape hatch for a host with a different packaged helper path.
|
|
32
|
+
*
|
|
33
|
+
* @category layers
|
|
34
|
+
* @since 1.0.0-rc.0
|
|
35
|
+
*/
|
|
36
|
+
export declare const layerWith: (options: AtomicFileSystem.Options) => Layer.Layer<FileSystem>;
|
|
37
|
+
/**
|
|
38
|
+
* The helper path and byte limits {@link layerWith} accepts.
|
|
39
|
+
*
|
|
40
|
+
* @category models
|
|
41
|
+
* @since 1.0.0-rc.0
|
|
42
|
+
*/
|
|
43
|
+
export type Options = AtomicFileSystem.Options;
|
|
44
|
+
//# sourceMappingURL=BunFileSystem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BunFileSystem.d.ts","sourceRoot":"","sources":["../../src/BunFileSystem.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,gBAAgB,MAAM,wCAAwC,CAAA;AAC1E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAA;AAE1C;;;;;;;GAOG;AACH,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,UAAU,CAA0B,CAAA;AAEpE;;;;;;;;GAQG;AACH,eAAO,MAAM,SAAS,EAAE,CAAC,OAAO,EAAE,gBAAgB,CAAC,OAAO,KAAK,KAAK,CAAC,KAAK,CAAC,UAAU,CAA8B,CAAA;AAEnH;;;;;GAKG;AACH,MAAM,MAAM,OAAO,GAAG,gBAAgB,CAAC,OAAO,CAAA"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bun layer for Effect's `FileSystem` service.
|
|
3
|
+
*
|
|
4
|
+
* This is `@smthrs/platform-node`'s `AtomicFileSystem.layer`, the same
|
|
5
|
+
* implementation the Node bundle puts in its filesystem slot. It carries the
|
|
6
|
+
* kernel's atomic host extension, so `@smthrs/kernel`'s `FileSystem.layer`
|
|
7
|
+
* performs every guarded path operation descriptor-relative and no-follow
|
|
8
|
+
* instead of failing closed.
|
|
9
|
+
*
|
|
10
|
+
* The extension uses the packaged `smithers-jj-export --atomic-fs` helper.
|
|
11
|
+
* `layerWith` accepts another absolute executable path. Windows is unsupported.
|
|
12
|
+
*
|
|
13
|
+
* @since 1.0.0-rc.0
|
|
14
|
+
*/
|
|
15
|
+
import * as AtomicFileSystem from "@smthrs/platform-node/AtomicFileSystem";
|
|
16
|
+
/**
|
|
17
|
+
* Provides Bun's filesystem implementation, carrying the kernel's atomic host
|
|
18
|
+
* extension.
|
|
19
|
+
*
|
|
20
|
+
* @category layers
|
|
21
|
+
* @since 1.0.0-rc.0
|
|
22
|
+
* @slop
|
|
23
|
+
*/
|
|
24
|
+
export const layer = AtomicFileSystem.layer;
|
|
25
|
+
/**
|
|
26
|
+
* Provides the same filesystem against an explicitly configured helper and
|
|
27
|
+
* set of byte limits.
|
|
28
|
+
*
|
|
29
|
+
* This is the escape hatch for a host with a different packaged helper path.
|
|
30
|
+
*
|
|
31
|
+
* @category layers
|
|
32
|
+
* @since 1.0.0-rc.0
|
|
33
|
+
*/
|
|
34
|
+
export const layerWith = AtomicFileSystem.layerWith;
|
|
35
|
+
//# sourceMappingURL=BunFileSystem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BunFileSystem.js","sourceRoot":"","sources":["../../src/BunFileSystem.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,gBAAgB,MAAM,wCAAwC,CAAA;AAI1E;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,KAAK,GAA4B,gBAAgB,CAAC,KAAK,CAAA;AAEpE;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,SAAS,GAAmE,gBAAgB,CAAC,SAAS,CAAA","sourcesContent":["/**\n * Bun layer for Effect's `FileSystem` service.\n *\n * This is `@smthrs/platform-node`'s `AtomicFileSystem.layer`, the same\n * implementation the Node bundle puts in its filesystem slot. It carries the\n * kernel's atomic host extension, so `@smthrs/kernel`'s `FileSystem.layer`\n * performs every guarded path operation descriptor-relative and no-follow\n * instead of failing closed.\n *\n * The extension uses the packaged `smithers-jj-export --atomic-fs` helper.\n * `layerWith` accepts another absolute executable path. Windows is unsupported.\n *\n * @since 1.0.0-rc.0\n */\n\nimport * as AtomicFileSystem from \"@smthrs/platform-node/AtomicFileSystem\"\nimport type { FileSystem } from \"effect/FileSystem\"\nimport type * as Layer from \"effect/Layer\"\n\n/**\n * Provides Bun's filesystem implementation, carrying the kernel's atomic host\n * extension.\n *\n * @category layers\n * @since 1.0.0-rc.0\n * @slop\n */\nexport const layer: Layer.Layer<FileSystem> = AtomicFileSystem.layer\n\n/**\n * Provides the same filesystem against an explicitly configured helper and\n * set of byte limits.\n *\n * This is the escape hatch for a host with a different packaged helper path.\n *\n * @category layers\n * @since 1.0.0-rc.0\n */\nexport const layerWith: (options: AtomicFileSystem.Options) => Layer.Layer<FileSystem> = AtomicFileSystem.layerWith\n\n/**\n * The helper path and byte limits {@link layerWith} accepts.\n *\n * @category models\n * @since 1.0.0-rc.0\n */\nexport type Options = AtomicFileSystem.Options\n"]}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Aggregate Bun Host bundle.
|
|
3
|
+
*
|
|
4
|
+
* Runtime-specific dependencies stay inside this package; callers get the same
|
|
5
|
+
* closed five-service Host surface every other bundle provides, plus native
|
|
6
|
+
* `ProcessConfinement` for guarded commands.
|
|
7
|
+
*
|
|
8
|
+
* There is no Bun shell module: running a command is Effect's
|
|
9
|
+
* `ChildProcessSpawner`, and `@effect/platform-bun`'s implementation is
|
|
10
|
+
* `@effect/platform-node-shared`'s re-exported: the same code on both
|
|
11
|
+
* runtimes, so no runtime detection is needed here.
|
|
12
|
+
*
|
|
13
|
+
* Outgoing HTTP uses the shared EgressHttpClient on both runtimes. Web
|
|
14
|
+
* requests pin approved addresses; ordinary requests retain the shared pool.
|
|
15
|
+
* Redirects remain visible to the capability kernel, and proxy routing follows
|
|
16
|
+
* the host environment.
|
|
17
|
+
*
|
|
18
|
+
* The filesystem slot is `@smthrs/platform-node`'s `AtomicFileSystem`, byte for
|
|
19
|
+
* byte the layer `NodeHost` uses, so a guarded path operation is
|
|
20
|
+
* descriptor-relative and no-follow on both runtimes.
|
|
21
|
+
*
|
|
22
|
+
* @since 1.0.0-rc.0
|
|
23
|
+
*/
|
|
24
|
+
import * as BunChildProcessSpawner from "../vendor/bun/BunChildProcessSpawner.js";
|
|
25
|
+
import * as BunCrypto from "../vendor/bun/BunCrypto.js";
|
|
26
|
+
import type { Jj, JjError } from "@smthrs/jj";
|
|
27
|
+
import type { HostServiceIds } from "@smthrs/kernel/HostServices";
|
|
28
|
+
import type * as KernelProcessConfinement from "@smthrs/kernel/ProcessConfinement";
|
|
29
|
+
import type * as ProcessLedger from "@smthrs/kernel/ProcessLedger";
|
|
30
|
+
import * as AtomicFileSystem from "@smthrs/platform-node/AtomicFileSystem";
|
|
31
|
+
import * as HostLiveness from "@smthrs/platform-node/HostLiveness";
|
|
32
|
+
import * as ProcessReaper from "@smthrs/platform-node/ProcessReaper";
|
|
33
|
+
import type * as Crypto from "effect/Crypto";
|
|
34
|
+
import type { FileSystem } from "effect/FileSystem";
|
|
35
|
+
import * as Layer from "effect/Layer";
|
|
36
|
+
import type * as Path from "effect/Path";
|
|
37
|
+
import * as Schema from "effect/Schema";
|
|
38
|
+
import type { HttpClient } from "effect/unstable/http/HttpClient";
|
|
39
|
+
import type { ChildProcessSpawner } from "effect/unstable/process/ChildProcessSpawner";
|
|
40
|
+
import * as BunFileSystem from "./BunFileSystem.ts";
|
|
41
|
+
/**
|
|
42
|
+
* Bun platform modules for selectively providing individual services.
|
|
43
|
+
*
|
|
44
|
+
* `AtomicFileSystem` is here for the same reason `NodeHost` re-exports it: it
|
|
45
|
+
* owns the only configuration escape hatch the filesystem slot has, and a Bun
|
|
46
|
+
* program with a different packaged helper path needs to reach
|
|
47
|
+
* `AtomicFileSystem.layerWith` without hand-composing the other four tags.
|
|
48
|
+
*
|
|
49
|
+
* `BunJj` is deliberately absent: it belongs to `@smthrs/jj` and is imported
|
|
50
|
+
* from there, never re-exported here. So is `@effect/platform-bun/BunHttpClient`:
|
|
51
|
+
* its `layer` follows redirects to origins the capability kernel never
|
|
52
|
+
* authorized. The network slot on its own is {@link layerHttpClient}.
|
|
53
|
+
*
|
|
54
|
+
* @category re-exports
|
|
55
|
+
* @since 1.0.0-rc.0
|
|
56
|
+
* @slop
|
|
57
|
+
*/
|
|
58
|
+
export { AtomicFileSystem, BunChildProcessSpawner, BunCrypto, BunFileSystem, HostLiveness, ProcessReaper };
|
|
59
|
+
/**
|
|
60
|
+
* The complete closed Host service union provided by Bun.
|
|
61
|
+
*
|
|
62
|
+
* @category models
|
|
63
|
+
* @since 1.0.0-rc.0
|
|
64
|
+
* @slop
|
|
65
|
+
*/
|
|
66
|
+
export type BunHost = FileSystem | Path.Path | ChildProcessSpawner | Jj | HttpClient | KernelProcessConfinement.ProcessConfinement;
|
|
67
|
+
/**
|
|
68
|
+
* The stable codes a `BunHost` factory refuses with.
|
|
69
|
+
*
|
|
70
|
+
* A code is the contract a caller branches on; the message beside it is for a
|
|
71
|
+
* person. `invalid_repository_root` is the root handed to {@link layerAt} or
|
|
72
|
+
* {@link layerContainedAt} not being absolute, the empty string included.
|
|
73
|
+
*
|
|
74
|
+
* @category models
|
|
75
|
+
* @since 1.0.0-rc.0
|
|
76
|
+
*/
|
|
77
|
+
export type BunHostErrorCode = "invalid_repository_root";
|
|
78
|
+
declare const BunHostError_base: Schema.Class<BunHostError, Schema.TaggedStruct<"@smthrs/platform-bun/BunHostError", {
|
|
79
|
+
readonly code: Schema.Literal<"invalid_repository_root">;
|
|
80
|
+
readonly message: Schema.String;
|
|
81
|
+
}>, import("effect/Cause").YieldableError>;
|
|
82
|
+
/**
|
|
83
|
+
* The refusal a `BunHost` factory throws before it builds a layer.
|
|
84
|
+
*
|
|
85
|
+
* It is thrown rather than failed because a factory is called while a program
|
|
86
|
+
* composes its layers, where there is no fiber to fail yet and a wrong root is
|
|
87
|
+
* a composition mistake, not a runtime outcome. It is this package's class,
|
|
88
|
+
* not the `Jj` adapter's, because a Bun caller composes `BunHost` and should
|
|
89
|
+
* learn nothing about the adapter behind the `Jj` slot from an error message.
|
|
90
|
+
*
|
|
91
|
+
* @category errors
|
|
92
|
+
* @since 1.0.0-rc.0
|
|
93
|
+
*/
|
|
94
|
+
export declare class BunHostError extends BunHostError_base {
|
|
95
|
+
readonly name = "BunHostError";
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Stable implementation identities keyed by the closed Host service slots.
|
|
99
|
+
*
|
|
100
|
+
* Each value names the module behind that slot in the raw host bundle.
|
|
101
|
+
* Contained POSIX factories replace the spawner with {@link ProcessReaper.layerSpawner}.
|
|
102
|
+
* These are identity
|
|
103
|
+
* tokens rather than import specifiers: the filesystem entry is
|
|
104
|
+
* `@smthrs/platform-node/AtomicFileSystem` because that is the implementation,
|
|
105
|
+
* even though a consumer reaches it through `@smthrs/platform-bun`.
|
|
106
|
+
*
|
|
107
|
+
* Nothing digests them yet. `@smthrs/plan`'s step key carries a `layers`
|
|
108
|
+
* component these values are meant to feed, but no planner derives it from a
|
|
109
|
+
* host bundle today, so changing one invalidates no cached step.
|
|
110
|
+
*
|
|
111
|
+
* The keys are written as literals rather than `HostServiceIds` positions so
|
|
112
|
+
* that reordering the closed list cannot silently pair a slot with another
|
|
113
|
+
* slot's implementation.
|
|
114
|
+
*
|
|
115
|
+
* @category models
|
|
116
|
+
* @since 1.0.0-rc.0
|
|
117
|
+
* @slop
|
|
118
|
+
*/
|
|
119
|
+
export declare const implementationIds: Readonly<Record<(typeof HostServiceIds)[number], string>>;
|
|
120
|
+
/**
|
|
121
|
+
* What a caller may configure about containment.
|
|
122
|
+
*
|
|
123
|
+
* `ContainedSpawner.Options.platform` is deliberately not part of it. It
|
|
124
|
+
* decides one thing, whether a command that names no `detached` option gets a
|
|
125
|
+
* process group of its own, and this native host detaches by `process.platform`
|
|
126
|
+
* whatever a record claims. A
|
|
127
|
+
* caller-supplied `"win32"` on a POSIX host would therefore record
|
|
128
|
+
* `pgid: null` for a child that really does lead a group, and
|
|
129
|
+
* {@link ProcessReaper.reap} would retire that record as `no-group` and leave
|
|
130
|
+
* the orphan running forever: a durable lie rather than a compile error.
|
|
131
|
+
*
|
|
132
|
+
* @category models
|
|
133
|
+
* @since 1.0.0-rc.0
|
|
134
|
+
*/
|
|
135
|
+
export type ContainedOptions = ProcessReaper.SpawnerOptions & ProcessReaper.Options;
|
|
136
|
+
/**
|
|
137
|
+
* The network slot on its own: the shared egress client, which never follows a
|
|
138
|
+
* redirect. A `3xx` comes back to the caller with its `location` intact and the
|
|
139
|
+
* second origin uncontacted; following a redirect is `@smthrs/kernel`'s guarded
|
|
140
|
+
* `HttpClient.layer`, which rechecks every hop.
|
|
141
|
+
*
|
|
142
|
+
* @category layers
|
|
143
|
+
* @since 1.0.0-rc.0
|
|
144
|
+
*/
|
|
145
|
+
export declare const layerHttpClient: Layer.Layer<HttpClient>;
|
|
146
|
+
/**
|
|
147
|
+
* Provides all five Bun Host services, including the runtime-independent Path
|
|
148
|
+
* service.
|
|
149
|
+
*
|
|
150
|
+
* Fails at construction with {@link JjError} carrying `not_installed` or
|
|
151
|
+
* `unsupported_version`: the `Jj` slot is merged eagerly and probes
|
|
152
|
+
* `jj --version` while the layer is built, before the program body runs and
|
|
153
|
+
* whether or not the program asks for `Jj`. Requires jj 0.39.0 or later.
|
|
154
|
+
*
|
|
155
|
+
* @category layers
|
|
156
|
+
* @since 1.0.0-rc.0
|
|
157
|
+
* @slop
|
|
158
|
+
*/
|
|
159
|
+
export declare const layer: Layer.Layer<BunHost | Crypto.Crypto, JjError>;
|
|
160
|
+
/**
|
|
161
|
+
* Provides all five Bun Host services bound to one absolute repository root.
|
|
162
|
+
*
|
|
163
|
+
* Throws {@link BunHostError} with code `invalid_repository_root` when `root`
|
|
164
|
+
* is not absolute; the empty string counts. The check runs when the factory is
|
|
165
|
+
* called, before any layer exists.
|
|
166
|
+
*
|
|
167
|
+
* Fails at construction with {@link JjError} exactly as {@link layer} does:
|
|
168
|
+
* the `Jj` slot probes `jj --version` while the layer is built.
|
|
169
|
+
*
|
|
170
|
+
* @category layers
|
|
171
|
+
* @since 1.0.0-rc.0
|
|
172
|
+
*/
|
|
173
|
+
export declare const layerAt: (root: string) => Layer.Layer<BunHost | Crypto.Crypto, JjError>;
|
|
174
|
+
/**
|
|
175
|
+
* Provides the Bun host with process containment turned on.
|
|
176
|
+
*
|
|
177
|
+
* Bun uses the same prepared native process lifecycle as Node on POSIX, while
|
|
178
|
+
* preserving its underlying runtime spawner on Windows. `ContainedSpawner` gives
|
|
179
|
+
* every child an escalation deadline and a ledger entry, and
|
|
180
|
+
* `ProcessReaper` sweeps the entries a crashed incarnation of this host left
|
|
181
|
+
* behind. The reaper module lives in `@smthrs/platform-node` because the calls
|
|
182
|
+
* it makes, `process.kill` and `taskkill`, are Node's, and Bun implements
|
|
183
|
+
* them unchanged.
|
|
184
|
+
*
|
|
185
|
+
* Fails at construction with {@link JjError} exactly as {@link layer} does;
|
|
186
|
+
* here the `jj --version` probe runs through the contained spawner, so its
|
|
187
|
+
* record enters and leaves the ledger like any other child.
|
|
188
|
+
*
|
|
189
|
+
* @category layers
|
|
190
|
+
* @since 1.0.0-rc.0
|
|
191
|
+
*/
|
|
192
|
+
export declare const layerContained: (options?: ContainedOptions) => Layer.Layer<BunHost | Crypto.Crypto, JjError, ProcessLedger.ProcessLedger>;
|
|
193
|
+
/**
|
|
194
|
+
* Provides the contained Bun host bound to one absolute repository root.
|
|
195
|
+
*
|
|
196
|
+
* Refuses a root exactly as {@link layerAt} does: {@link BunHostError} with
|
|
197
|
+
* code `invalid_repository_root`, thrown when the factory is called.
|
|
198
|
+
* Fails at construction with {@link JjError} exactly as {@link layerContained}
|
|
199
|
+
* does.
|
|
200
|
+
*
|
|
201
|
+
* @category layers
|
|
202
|
+
* @since 1.0.0-rc.0
|
|
203
|
+
*/
|
|
204
|
+
export declare const layerContainedAt: (root: string, options?: ContainedOptions) => Layer.Layer<BunHost | Crypto.Crypto, JjError, ProcessLedger.ProcessLedger>;
|
|
205
|
+
//# sourceMappingURL=BunHost.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BunHost.d.ts","sourceRoot":"","sources":["../../src/BunHost.ts"],"names":[],"mappings":"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"}
|