@smthrs/platform-bun 1.0.0-rc.16 → 1.0.0-rc.23
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 +19 -0
- package/README.md +6 -5
- package/dist/cjs/BunDesktop.d.ts +49 -0
- package/dist/cjs/BunDesktop.d.ts.map +1 -0
- package/dist/cjs/BunDesktop.js +119 -0
- package/dist/cjs/BunDesktop.js.map +7 -0
- package/dist/cjs/BunFileReplacement.d.ts +10 -0
- package/dist/cjs/BunFileReplacement.d.ts.map +1 -0
- package/dist/cjs/BunFileReplacement.js +111 -0
- package/dist/cjs/BunFileReplacement.js.map +7 -0
- package/dist/cjs/BunFileSystem.d.ts +2 -0
- package/dist/cjs/BunFileSystem.d.ts.map +1 -1
- package/dist/cjs/BunFileSystem.js +4 -1
- package/dist/cjs/BunFileSystem.js.map +2 -2
- package/dist/cjs/BunGarbageCollector.d.ts +28 -0
- package/dist/cjs/BunGarbageCollector.d.ts.map +1 -0
- package/dist/cjs/BunGarbageCollector.js +44 -0
- package/dist/cjs/BunGarbageCollector.js.map +7 -0
- package/dist/cjs/BunHost.d.ts +6 -5
- package/dist/cjs/BunHost.d.ts.map +1 -1
- package/dist/cjs/BunHost.js +11 -31
- package/dist/cjs/BunHost.js.map +2 -2
- package/dist/cjs/BunRuntime.d.ts +55 -0
- package/dist/cjs/BunRuntime.d.ts.map +1 -0
- package/dist/cjs/BunRuntime.js +66 -0
- package/dist/cjs/BunRuntime.js.map +7 -0
- package/dist/cjs/BunServer.d.ts +4 -0
- package/dist/cjs/BunServer.d.ts.map +1 -0
- package/dist/cjs/BunServer.js +43 -0
- package/dist/cjs/BunServer.js.map +7 -0
- package/dist/cjs/Electrobun.d.ts +51 -0
- package/dist/cjs/index.d.ts +11 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +9 -1
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/internal/ElectrobunUnavailable.d.ts +12 -0
- package/dist/cjs/internal/ElectrobunUnavailable.d.ts.map +1 -0
- package/dist/cjs/internal/ElectrobunUnavailable.js +4 -0
- package/dist/cjs/internal/ElectrobunUnavailable.js.map +7 -0
- package/dist/cjs/package.json +1 -1
- package/dist/esm/BunDesktop.d.ts +49 -0
- package/dist/esm/BunDesktop.d.ts.map +1 -0
- package/dist/esm/BunDesktop.js +86 -0
- package/dist/esm/BunDesktop.js.map +1 -0
- package/dist/esm/BunFileReplacement.d.ts +10 -0
- package/dist/esm/BunFileReplacement.d.ts.map +1 -0
- package/dist/esm/BunFileReplacement.js +88 -0
- package/dist/esm/BunFileReplacement.js.map +1 -0
- package/dist/esm/BunFileSystem.d.ts +2 -0
- package/dist/esm/BunFileSystem.d.ts.map +1 -1
- package/dist/esm/BunFileSystem.js +2 -0
- package/dist/esm/BunFileSystem.js.map +1 -1
- package/dist/esm/BunGarbageCollector.d.ts +28 -0
- package/dist/esm/BunGarbageCollector.d.ts.map +1 -0
- package/dist/esm/BunGarbageCollector.js +33 -0
- package/dist/esm/BunGarbageCollector.js.map +1 -0
- package/dist/esm/BunHost.d.ts +6 -5
- package/dist/esm/BunHost.d.ts.map +1 -1
- package/dist/esm/BunHost.js +6 -2
- package/dist/esm/BunHost.js.map +1 -1
- package/dist/esm/BunRuntime.d.ts +55 -0
- package/dist/esm/BunRuntime.d.ts.map +1 -0
- package/dist/esm/BunRuntime.js +63 -0
- package/dist/esm/BunRuntime.js.map +1 -0
- package/dist/esm/BunServer.d.ts +4 -0
- package/dist/esm/BunServer.d.ts.map +1 -0
- package/dist/esm/BunServer.js +12 -0
- package/dist/esm/BunServer.js.map +1 -0
- package/dist/esm/Electrobun.d.ts +51 -0
- package/dist/esm/index.d.ts +11 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +11 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/internal/ElectrobunUnavailable.d.ts +12 -0
- package/dist/esm/internal/ElectrobunUnavailable.d.ts.map +1 -0
- package/dist/esm/internal/ElectrobunUnavailable.js +13 -0
- package/dist/esm/internal/ElectrobunUnavailable.js.map +1 -0
- package/dist/vendor/adapters.json +598 -394
- package/dist/vendor/bun/BunAddressResolver.js +2 -2
- package/dist/vendor/bun/BunChildProcessSpawner.js +7 -6
- package/dist/vendor/bun/BunClusterHttp.js +30 -28
- package/dist/vendor/bun/BunClusterSocket.js +10 -9
- package/dist/vendor/bun/BunCrypto.d.ts +20 -5
- package/dist/vendor/bun/BunCrypto.js +22 -4
- package/dist/vendor/bun/BunDatagramSocket.js +1 -1
- package/dist/vendor/bun/BunDns.js +2 -2
- package/dist/vendor/bun/BunFileSystem.js +3 -3
- package/dist/vendor/bun/BunHttpClient.d.ts +69 -4
- package/dist/vendor/bun/BunHttpClient.js +7 -1
- package/dist/vendor/bun/BunHttpPlatform.js +5 -5
- package/dist/vendor/bun/BunHttpServer.d.ts +23 -3
- package/dist/vendor/bun/BunHttpServer.js +21 -22
- package/dist/vendor/bun/BunHttpServerRequest.js +1 -1
- package/dist/vendor/bun/BunMultipart.js +5 -4
- package/dist/vendor/bun/BunPath.js +2 -2
- package/dist/vendor/bun/BunRedis.d.ts +8 -8
- package/dist/vendor/bun/BunRedis.js +1 -1
- package/dist/vendor/bun/BunRuntime.js +2 -2
- package/dist/vendor/bun/BunServices.d.ts +2 -3
- package/dist/vendor/bun/BunServices.js +16 -17
- package/dist/vendor/bun/BunSink.js +3 -2
- package/dist/vendor/bun/BunSocket.js +2 -4
- package/dist/vendor/bun/BunSocketServer.js +4 -3
- package/dist/vendor/bun/BunStdio.js +5 -4
- package/dist/vendor/bun/BunStream.js +6 -3
- package/dist/vendor/bun/BunTerminal.js +2 -2
- package/dist/vendor/bun/BunWorker.js +1 -1
- package/dist/vendor/bun/BunWorkerRunner.js +1 -1
- package/dist/vendor/bun/index.js +47 -45
- package/dist/vendor/chunk-2PQ5S62T.js +31 -0
- package/dist/vendor/{chunk-TCKM3JXD.js → chunk-2VOM2DDJ.js} +1 -1
- package/dist/vendor/{chunk-RX5TKFP7.js → chunk-347OLOBL.js} +2 -4
- package/dist/vendor/{chunk-DWSNOBD4.js → chunk-3LP7LB23.js} +2 -2
- package/dist/vendor/{chunk-BVV46N3V.js → chunk-44AVPIIM.js} +79 -42
- package/dist/vendor/{chunk-2AP6TO77.js → chunk-4KIRBZGZ.js} +14 -14
- package/dist/vendor/{chunk-BIR74JJK.js → chunk-4RLL7U2M.js} +44 -8
- package/dist/vendor/{chunk-TBMTA5LD.js → chunk-6HWUPHY4.js} +1 -1
- package/dist/vendor/{chunk-C7UMBJO6.js → chunk-6JQEUFBJ.js} +2 -2
- package/dist/vendor/{chunk-NNTJGFLB.js → chunk-6QSRJFVA.js} +1 -1
- package/dist/vendor/chunk-6QTK2X5U.js +131 -0
- package/dist/vendor/{chunk-JYD572EF.js → chunk-6VVM5RJR.js} +2 -2
- package/dist/vendor/{chunk-7VJC3PHX.js → chunk-6W6EO7I4.js} +1 -1
- package/dist/vendor/{chunk-QLI7T34M.js → chunk-7XBDLTLF.js} +2 -2
- package/dist/vendor/{chunk-AMAL6TRE.js → chunk-A3KXXIIX.js} +22 -7
- package/dist/vendor/{chunk-6R444NFO.js → chunk-AAEXZQSU.js} +1 -1
- package/dist/vendor/{chunk-PBM2HJOX.js → chunk-AB7KMX25.js} +1 -1
- package/dist/vendor/{chunk-6B775XB2.js → chunk-ABVAXOEY.js} +1 -1
- package/dist/vendor/{chunk-NU53DHQR.js → chunk-AIWVT6VS.js} +2 -2
- package/dist/vendor/chunk-AOKFNH4M.js +34 -0
- package/dist/vendor/{chunk-7JOAEKDV.js → chunk-B47KX35C.js} +28 -20
- package/dist/vendor/{chunk-UXIG7ALP.js → chunk-BT7B55TJ.js} +14 -14
- package/dist/vendor/{chunk-YJGNV6EV.js → chunk-BZ7TO5VD.js} +2 -2
- package/dist/vendor/chunk-C72L4GZO.js +42 -0
- package/dist/vendor/chunk-CUN3ZMYJ.js +10 -0
- package/dist/vendor/chunk-D327TUYX.js +16 -0
- package/dist/vendor/{chunk-Q5UCOQNO.js → chunk-DGFYEQ4D.js} +4 -2
- package/dist/vendor/{chunk-2LGUVSNM.js → chunk-DHSO5TJ7.js} +2 -2
- package/dist/vendor/{chunk-7ZKNPDTP.js → chunk-DKOC3BQ2.js} +2 -2
- package/dist/vendor/chunk-DNJXGU2W.js +18 -0
- package/dist/vendor/{chunk-J43O5GFH.js → chunk-DTZBARIG.js} +2 -2
- package/dist/vendor/{chunk-AW6WQVI7.js → chunk-EIPHNXJR.js} +1 -1
- package/dist/vendor/{chunk-R2PFJKSP.js → chunk-EOCSVRFC.js} +1 -1
- package/dist/vendor/{chunk-HXGVOKHF.js → chunk-ERKCQU5L.js} +2 -2
- package/dist/vendor/{chunk-BHV44Z6K.js → chunk-FBUO2YIE.js} +1 -1
- package/dist/vendor/chunk-FFCT74JI.js +31 -0
- package/dist/vendor/chunk-FRRVUBCI.js +158 -0
- package/dist/vendor/{chunk-JTST2Z7N.js → chunk-FSGWFTN3.js} +1 -1
- package/dist/vendor/{chunk-4YK2MHSO.js → chunk-FXNUPPT7.js} +2 -2
- package/dist/vendor/{chunk-FIPFWLCV.js → chunk-G4P3EWSY.js} +24 -7
- package/dist/vendor/{chunk-GITB76ZP.js → chunk-GJWC3O4Y.js} +2 -2
- package/dist/vendor/{chunk-ABPRHPJP.js → chunk-GR24JP5B.js} +1 -1
- package/dist/vendor/{chunk-X6FYP2EH.js → chunk-HF7CVDZF.js} +24 -6
- package/dist/vendor/chunk-I2ZM2SU3.js +16 -0
- package/dist/vendor/chunk-IKW7EDOI.js +30 -0
- package/dist/vendor/{chunk-HYPKWCVW.js → chunk-IYDTMNPA.js} +1 -1
- package/dist/vendor/{chunk-XAVBQY4D.js → chunk-KCUDAKDM.js} +2 -2
- package/dist/vendor/{chunk-OAY4MA3I.js → chunk-L4TISZP3.js} +2 -2
- package/dist/vendor/chunk-LF3TJRV7.js +34 -0
- package/dist/vendor/{chunk-EIO7BKW3.js → chunk-LHDAQQDP.js} +19 -17
- package/dist/vendor/chunk-M7RSCTM6.js +108 -0
- package/dist/vendor/chunk-O3BAZ7K4.js +190 -0
- package/dist/vendor/{chunk-T5WDTZCE.js → chunk-QEWYBXUN.js} +96 -54
- package/dist/vendor/{chunk-XF3WZCMZ.js → chunk-QGA4OLLE.js} +2 -2
- package/dist/vendor/{chunk-KANNAI65.js → chunk-QGDNGHST.js} +17 -15
- package/dist/vendor/{chunk-IXI7RW3A.js → chunk-SPNFIKEG.js} +148 -67
- package/dist/vendor/{chunk-226TYKP6.js → chunk-TONDZESC.js} +3 -3
- package/dist/vendor/{chunk-V577GRCI.js → chunk-TUOUGESD.js} +300 -76
- package/dist/vendor/chunk-UQC2TJSU.js +18 -0
- package/dist/vendor/chunk-URXB3D6R.js +753 -0
- package/dist/vendor/{chunk-NGGMPIWR.js → chunk-UYVYP32E.js} +16 -16
- package/dist/vendor/{chunk-M2QOSF47.js → chunk-UZ4NARUB.js} +3 -3
- package/dist/vendor/{chunk-XAZH2ZEU.js → chunk-V3T2GYGG.js} +2 -2
- package/dist/vendor/chunk-VEBJSD2W.js +28 -0
- package/dist/vendor/{chunk-QKYYD3AZ.js → chunk-VWDU5K3P.js} +11 -3
- package/dist/vendor/{chunk-Q7YXUH7M.js → chunk-WJ6OXPT2.js} +8 -11
- package/dist/vendor/{chunk-CN4K2U6M.js → chunk-WVB2LB5Z.js} +2 -2
- package/dist/vendor/{chunk-S3MN5OXB.js → chunk-X4ACOXCJ.js} +4 -2
- package/dist/vendor/{chunk-GMORYZG4.js → chunk-X57DDWLJ.js} +8 -23
- package/dist/vendor/{chunk-KEMBVIRS.js → chunk-ZE56V6WR.js} +4 -4
- package/dist/vendor/chunk-ZGPLAED5.js +18 -0
- package/dist/vendor/chunk-ZK2KWOJV.js +34 -0
- package/dist/vendor/chunk-ZLRCMSGP.js +18 -0
- package/dist/vendor/{chunk-3SUO3TTE.js → chunk-ZLUWSJEI.js} +2 -1
- package/dist/vendor/{chunk-VS6VBUH6.js → chunk-ZVDRCL5D.js} +3 -3
- package/dist/vendor/cjs/bun/BunCrypto.d.ts +20 -5
- package/dist/vendor/cjs/bun/BunHttpClient.d.ts +69 -4
- package/dist/vendor/cjs/bun/BunHttpServer.d.ts +23 -3
- package/dist/vendor/cjs/bun/BunRedis.d.ts +8 -8
- package/dist/vendor/cjs/bun/BunServices.d.ts +2 -3
- package/dist/vendor/cjs/node/NodeCrypto.d.ts +13 -5
- package/dist/vendor/cjs/node/NodeHttpClient.d.ts +2 -2
- package/dist/vendor/cjs/node/NodeHttpIncomingMessage.d.ts +8 -0
- package/dist/vendor/cjs/node/NodeHttpServer.d.ts +64 -13
- package/dist/vendor/cjs/node/NodeHttpServerRequest.d.ts +11 -7
- package/dist/vendor/cjs/node/NodeMultipart.d.ts +1 -1
- package/dist/vendor/cjs/node/NodeMultipartParser.d.ts +3 -6
- package/dist/vendor/cjs/node/NodeRedis.d.ts +19 -7
- package/dist/vendor/cjs/node/NodeServices.d.ts +2 -3
- package/dist/vendor/cjs/node/NodeSocket.d.ts +27 -14
- package/dist/vendor/cjs/node/NodeWS.d.ts +21 -0
- package/dist/vendor/cjs/node/NodeWS.js +1 -0
- package/dist/vendor/cjs/node/index.d.ts +5 -0
- package/dist/vendor/cjs/node/internal/http.d.ts +5 -0
- package/dist/vendor/cjs/node/internal/http.js +1 -0
- package/dist/vendor/cjs/node/internal/upgrade.d.ts +2 -0
- package/dist/vendor/cjs/node/internal/upgrade.js +1 -0
- package/dist/vendor/cjs/node-shared/NodeChildProcessSpawner.d.ts +3 -1
- package/dist/vendor/cjs/node-shared/NodeCrypto.d.ts +172 -13
- package/dist/vendor/cjs/node-shared/NodeSink.d.ts +7 -5
- package/dist/vendor/cjs/node-shared/NodeSocket.d.ts +24 -14
- package/dist/vendor/cjs/node-shared/NodeSocketServer.d.ts +16 -3
- package/dist/vendor/cjs/node-shared/NodeStream.d.ts +64 -2
- package/dist/vendor/cjs/node-shared/NodeTerminal.d.ts +3 -3
- package/dist/vendor/cjs/node-shared/NodeWS.d.ts +14 -0
- package/dist/vendor/cjs/node-shared/NodeWS.js +1 -0
- package/dist/vendor/cjs/node-shared/index.d.ts +5 -0
- package/dist/vendor/cjs/node-shared/internal/stream.d.ts +3 -0
- package/dist/vendor/cjs/node-shared/internal/stream.js +1 -0
- package/dist/vendor/cjs/platform-node-shared.d.ts +5 -0
- package/dist/vendor/cjs/platform-node.d.ts +5 -0
- package/dist/vendor/node/NodeAddressResolver.js +2 -2
- package/dist/vendor/node/NodeChildProcessSpawner.js +7 -6
- package/dist/vendor/node/NodeClusterHttp.js +37 -32
- package/dist/vendor/node/NodeClusterSocket.js +18 -15
- package/dist/vendor/node/NodeCrypto.d.ts +13 -5
- package/dist/vendor/node/NodeCrypto.js +22 -4
- package/dist/vendor/node/NodeDatagramSocket.js +2 -2
- package/dist/vendor/node/NodeDns.js +2 -2
- package/dist/vendor/node/NodeFileSystem.js +3 -3
- package/dist/vendor/node/NodeHttpClient.d.ts +2 -2
- package/dist/vendor/node/NodeHttpClient.js +8 -6
- package/dist/vendor/node/NodeHttpIncomingMessage.d.ts +8 -0
- package/dist/vendor/node/NodeHttpIncomingMessage.js +5 -4
- package/dist/vendor/node/NodeHttpPlatform.js +9 -8
- package/dist/vendor/node/NodeHttpServer.d.ts +64 -13
- package/dist/vendor/node/NodeHttpServer.js +29 -26
- package/dist/vendor/node/NodeHttpServerRequest.d.ts +11 -7
- package/dist/vendor/node/NodeHttpServerRequest.js +1 -1
- package/dist/vendor/node/NodeMultipart.d.ts +1 -1
- package/dist/vendor/node/NodeMultipart.js +6 -5
- package/dist/vendor/node/NodeMultipartParser.d.ts +3 -6
- package/dist/vendor/node/NodeMultipartParser.js +1 -1
- package/dist/vendor/node/NodePath.js +2 -2
- package/dist/vendor/node/NodeRedis.d.ts +19 -7
- package/dist/vendor/node/NodeRedis.js +1 -1
- package/dist/vendor/node/NodeRuntime.js +2 -2
- package/dist/vendor/node/NodeServices.d.ts +2 -3
- package/dist/vendor/node/NodeServices.js +16 -17
- package/dist/vendor/node/NodeSink.js +3 -2
- package/dist/vendor/node/NodeSocket.d.ts +27 -14
- package/dist/vendor/node/NodeSocket.js +3 -7
- package/dist/vendor/node/NodeSocketServer.js +4 -3
- package/dist/vendor/node/NodeStdio.js +5 -4
- package/dist/vendor/node/NodeStream.js +6 -3
- package/dist/vendor/node/NodeTerminal.js +2 -2
- package/dist/vendor/node/NodeWS.d.ts +21 -0
- package/dist/vendor/node/NodeWS.js +25 -0
- package/dist/vendor/node/NodeWorker.js +1 -1
- package/dist/vendor/node/NodeWorkerRunner.js +1 -1
- package/dist/vendor/node/Undici.js +1 -1
- package/dist/vendor/node/index.d.ts +5 -0
- package/dist/vendor/node/index.js +54 -46
- package/dist/vendor/node/internal/http.d.ts +5 -0
- package/dist/vendor/node/internal/http.js +9 -0
- package/dist/vendor/node/internal/upgrade.d.ts +2 -0
- package/dist/vendor/node/internal/upgrade.js +13 -0
- package/dist/vendor/node-shared/NodeAddressResolver.js +1 -1
- package/dist/vendor/node-shared/NodeChildProcessSpawner.d.ts +3 -1
- package/dist/vendor/node-shared/NodeChildProcessSpawner.js +6 -5
- package/dist/vendor/node-shared/NodeClusterSocket.js +4 -3
- package/dist/vendor/node-shared/NodeCrypto.d.ts +172 -13
- package/dist/vendor/node-shared/NodeCrypto.js +19 -3
- package/dist/vendor/node-shared/NodeDatagramSocket.js +1 -1
- package/dist/vendor/node-shared/NodeDns.js +1 -1
- package/dist/vendor/node-shared/NodeFileSystem.js +2 -2
- package/dist/vendor/node-shared/NodeHttpCompression.js +1 -1
- package/dist/vendor/node-shared/NodePath.js +1 -1
- package/dist/vendor/node-shared/NodeRuntime.js +1 -1
- package/dist/vendor/node-shared/NodeSink.d.ts +7 -5
- package/dist/vendor/node-shared/NodeSink.js +2 -1
- package/dist/vendor/node-shared/NodeSocket.d.ts +24 -14
- package/dist/vendor/node-shared/NodeSocket.js +1 -3
- package/dist/vendor/node-shared/NodeSocketServer.d.ts +16 -3
- package/dist/vendor/node-shared/NodeSocketServer.js +3 -2
- package/dist/vendor/node-shared/NodeStdio.js +4 -3
- package/dist/vendor/node-shared/NodeStream.d.ts +64 -2
- package/dist/vendor/node-shared/NodeStream.js +5 -2
- package/dist/vendor/node-shared/NodeTerminal.d.ts +3 -3
- package/dist/vendor/node-shared/NodeTerminal.js +1 -1
- package/dist/vendor/node-shared/NodeWS.d.ts +14 -0
- package/dist/vendor/node-shared/NodeWS.js +21 -0
- package/dist/vendor/node-shared/index.d.ts +5 -0
- package/dist/vendor/node-shared/index.js +25 -20
- package/dist/vendor/node-shared/internal/nodeChildProcessSpawner.js +1 -1
- package/dist/vendor/node-shared/internal/stream.d.ts +3 -0
- package/dist/vendor/node-shared/internal/stream.js +7 -0
- package/dist/vendor/node-shared/internal/utils.js +1 -1
- package/dist/vendor/platform-bun.js +47 -45
- package/dist/vendor/platform-node-shared.d.ts +5 -0
- package/dist/vendor/platform-node-shared.js +25 -20
- package/dist/vendor/platform-node.d.ts +5 -0
- package/dist/vendor/platform-node.js +54 -46
- package/dist/vendor/ws.d.mts +1 -0
- package/docs/README.md +8 -8
- package/docs/api.md +124 -12
- package/docs/concepts/host-surface.md +9 -2
- package/docs/concepts/runtime-parity.md +5 -3
- package/docs/guides/configure-the-filesystem-helper.md +4 -3
- package/docs/installation.md +7 -6
- package/docs/quickstart.md +50 -3
- package/docs/troubleshooting.md +1 -1
- package/package.json +43 -18
- package/patches/electrobun@1.18.1.patch +160 -0
- package/src/BunDesktop.d.ts +1 -0
- package/src/BunDesktop.d.vibe.ts +48 -0
- package/src/BunDesktop.vibe +83 -0
- package/src/BunFileReplacement.d.ts +1 -0
- package/src/BunFileReplacement.d.vibe.ts +9 -0
- package/src/BunFileReplacement.vibe +62 -0
- package/src/BunFileSystem.ts +3 -0
- package/src/BunGarbageCollector.ts +40 -0
- package/src/BunHost.ts +12 -13
- package/src/BunRuntime.ts +87 -0
- package/src/BunServer.d.ts +1 -0
- package/src/BunServer.d.vibe.ts +3 -0
- package/src/BunServer.vibe +8 -0
- package/src/Electrobun.d.ts +51 -0
- package/src/index.ts +15 -0
- package/src/internal/ElectrobunUnavailable.ts +14 -0
- package/dist/vendor/chunk-2ADOI6ZN.js +0 -18
- package/dist/vendor/chunk-4O4Z52A2.js +0 -48
- package/dist/vendor/chunk-6KYVM2ZC.js +0 -419
- package/dist/vendor/chunk-BTXZUHUI.js +0 -7
- package/dist/vendor/chunk-D6XNHJPW.js +0 -18
- package/dist/vendor/chunk-DHTPLWAP.js +0 -34
- package/dist/vendor/chunk-DX4VFONH.js +0 -81
- package/dist/vendor/chunk-IJON5WTO.js +0 -34
- package/dist/vendor/chunk-K6GWBGJM.js +0 -16
- package/dist/vendor/chunk-OV2KKGBA.js +0 -16
- package/dist/vendor/chunk-QR2ZOVOL.js +0 -18
- package/dist/vendor/chunk-WGUQHMX2.js +0 -18
- package/dist/vendor/chunk-WNS3OER2.js +0 -18
- package/dist/vendor/chunk-XDPP24MG.js +0 -129
- package/dist/vendor/chunk-ZJEHEPDQ.js +0 -18
- /package/dist/vendor/{chunk-6QPSLCUZ.js → chunk-LCVIQ46E.js} +0 -0
- /package/dist/vendor/{chunk-LOB26XOO.js → chunk-VX2SMMVZ.js} +0 -0
- /package/dist/vendor/{chunk-XXVMTKX5.js → chunk-XC54PUX6.js} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- File replacements on a raw filesystem now sync the file and its parent directory before reporting success. Sync failures propagate, and a replay retries the durability barriers.
|
|
8
|
+
- Native windows accept an application's title and frame through optional `WindowOptions`; calls without options use generic native defaults.
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- `BunRuntime`, the durable flow runtime on Bun, moved from
|
|
13
|
+
`@smthrs/flows/BunRuntime` to this package's root. Its SQLite driver loads
|
|
14
|
+
when a database opens, so the root still loads under Node.
|
|
15
|
+
|
|
5
16
|
### Added
|
|
6
17
|
|
|
7
18
|
- `BunHost.BunHostError`, the refusal `BunHost.layerAt` and
|
|
@@ -21,6 +32,14 @@
|
|
|
21
32
|
program that composed it instead of `BunHost.layer` reached origins the
|
|
22
33
|
capability kernel never authorized. Use `BunHost.layerHttpClient`.
|
|
23
34
|
|
|
35
|
+
### Fixed
|
|
36
|
+
|
|
37
|
+
- A browser bundle of the root no longer reaches Electrobun. `#electrobun`
|
|
38
|
+
resolves under the `browser` condition to a module that refuses with
|
|
39
|
+
`DesktopUnavailable`, so the Node-only root fails a browser build only on
|
|
40
|
+
`node:` and `bun:` built-ins, and `BunDesktop.layer` in a browser fails with
|
|
41
|
+
`DesktopUnavailable` as it does on Node.
|
|
42
|
+
|
|
24
43
|
## [1.0.0-rc.0] - 2026-09-01
|
|
25
44
|
|
|
26
45
|
### Added
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Release candidate scope, host requirements and compatibility review are defined in the [library support policy](https://github.com/smithersai/smithers/blob/main/RELEASE_SUPPORT.md).
|
|
4
4
|
|
|
5
|
-
This package declares `effect` as an exact `4.
|
|
5
|
+
This package declares `effect` as an exact `4.1.1` peer dependency. Install one
|
|
6
6
|
`effect` release at that version so all Smithers packages share one Effect
|
|
7
7
|
runtime.
|
|
8
8
|
|
|
@@ -23,14 +23,14 @@ package is that object for a process running on Bun.
|
|
|
23
23
|
## Install
|
|
24
24
|
|
|
25
25
|
```bash
|
|
26
|
-
bun add @smthrs/platform-bun@1.0.0-rc.
|
|
26
|
+
bun add @smthrs/platform-bun@1.0.0-rc.23 effect
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
`@smthrs/platform-node` and `effect` are required peers, as `package.json`
|
|
30
|
-
declares them, with `effect` at exactly `4.
|
|
30
|
+
declares them, with `effect` at exactly `4.1.1`. Package managers that
|
|
31
31
|
resolve required peers install both automatically. `@effect/platform-bun`,
|
|
32
32
|
`@effect/platform-node` and `@effect/platform-node-shared` are bundled
|
|
33
|
-
privately, built from `effect@4.
|
|
33
|
+
privately, built from `effect@4.1.1`.
|
|
34
34
|
|
|
35
35
|
The filesystem slot spawns the `smithers-jj-export` native helper, which
|
|
36
36
|
`@smthrs/platform-node` ships for macOS, Linux, and Windows. To use another
|
|
@@ -72,6 +72,7 @@ spawner instance.
|
|
|
72
72
|
| --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
73
73
|
| `BunHost` | The closed Host bundle: `layer`, `layerAt`, `layerContained`, `layerContainedAt`, and the `BunHostError` those two root-bound factories throw; `layerHttpClient`, the network slot with redirects stopped; re-exports `AtomicFileSystem`, `BunChildProcessSpawner`, and `BunFileSystem` |
|
|
74
74
|
| `BunFileSystem` | `@smthrs/platform-node`'s atomic `FileSystem`, plus `layerWith` for a host whose helper lives elsewhere |
|
|
75
|
+
| `BunRuntime` | The durable flow runtime on Bun: `layerHost`, `layer`, `make`, `storage`, and `signalExitCode`, the same API as `@smthrs/platform-node`'s `NodeRuntime`. Import it from the root; it has no subpath. Its SQLite driver loads when a database opens. |
|
|
75
76
|
|
|
76
77
|
Three variants change one slot each. `BunHost.layerAt(root)` binds version
|
|
77
78
|
control to one absolute repository root instead of the process working
|
|
@@ -94,7 +95,7 @@ shared egress client without automatic redirects, so a
|
|
|
94
95
|
|
|
95
96
|
## Runtimes
|
|
96
97
|
|
|
97
|
-
Bun >=1.4.0 and Node.js >=
|
|
98
|
+
Bun >=1.4.0 and Node.js >=22.19.0. The raw bundle's child-process spawner is
|
|
98
99
|
Effect's Node spawner re-exported. Contained POSIX bundles use the prepared
|
|
99
100
|
native adapter from `@smthrs/platform-node/ProcessReaper`. The bundle falls back to the
|
|
100
101
|
`@effect/platform-node` adapters off Bun and so resolves `node:` built-ins,
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Context, Effect, Layer, Schema } from "effect";
|
|
2
|
+
import type * as Electrobun from "#electrobun";
|
|
3
|
+
declare const DesktopUnavailable_base: Schema.Class<DesktopUnavailable, Schema.TaggedStruct<"DesktopUnavailable", {}>, import("effect/Cause").YieldableError>;
|
|
4
|
+
/** Failure to open a native window or dialog, without OS messages or paths in diagnostics. */
|
|
5
|
+
export declare class DesktopUnavailable extends DesktopUnavailable_base {
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Presentation chosen by the application; omitted options use Electrobun's defaults.
|
|
9
|
+
* @category models
|
|
10
|
+
* @since 0.1.0
|
|
11
|
+
*/
|
|
12
|
+
export interface WindowOptions {
|
|
13
|
+
readonly title: string;
|
|
14
|
+
readonly frame?: {
|
|
15
|
+
readonly x: number;
|
|
16
|
+
readonly y: number;
|
|
17
|
+
readonly width: number;
|
|
18
|
+
readonly height: number;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
type DesktopWindow_shape = {
|
|
22
|
+
readonly resources: string;
|
|
23
|
+
openExternal(url: string): Effect.Effect<void, DesktopUnavailable>;
|
|
24
|
+
open(url: string, options?: WindowOptions): Effect.Effect<void, DesktopUnavailable>;
|
|
25
|
+
chooseDirectory(): Effect.Effect<string | null, DesktopUnavailable>;
|
|
26
|
+
};
|
|
27
|
+
declare const DesktopWindow_base: Context.ServiceClass<DesktopWindow, "@smthrs/platform-bun/src/BunDesktop#DesktopWindow", DesktopWindow_shape>;
|
|
28
|
+
/** The native desktop seam; dialogs are selected by the person, never by web content. */
|
|
29
|
+
export declare class DesktopWindow extends DesktopWindow_base {
|
|
30
|
+
}
|
|
31
|
+
export declare namespace DesktopWindow {
|
|
32
|
+
type Shape = DesktopWindow_shape;
|
|
33
|
+
}
|
|
34
|
+
type NativeLoader_shape = {
|
|
35
|
+
readonly load: Effect.Effect<typeof Electrobun, DesktopUnavailable>;
|
|
36
|
+
};
|
|
37
|
+
declare const NativeLoader_base: Context.ServiceClass<NativeLoader, "@smthrs/platform-bun/src/BunDesktop#NativeLoader", NativeLoader_shape>;
|
|
38
|
+
/** The foreign native dependency, injectable as a real host port or a faulty Effect service. */
|
|
39
|
+
export declare class NativeLoader extends NativeLoader_base {
|
|
40
|
+
}
|
|
41
|
+
export declare namespace NativeLoader {
|
|
42
|
+
type Shape = NativeLoader_shape;
|
|
43
|
+
}
|
|
44
|
+
/** Compose the native seam with an explicit external binding service. */
|
|
45
|
+
export declare const layerWith: (loader: NativeLoader.Shape) => Layer.Layer<DesktopWindow, DesktopUnavailable, never>;
|
|
46
|
+
/** Load the supported Electrobun peer lazily at the host boundary. */
|
|
47
|
+
export declare const layer: Layer.Layer<DesktopWindow, DesktopUnavailable, never>;
|
|
48
|
+
export {};
|
|
49
|
+
//# sourceMappingURL=BunDesktop.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BunDesktop.d.ts","sources":["../../src/BunDesktop.vibe"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,UAAU,MAAM,aAAa,CAAA;;AAG9C,8FAA8F;AAC9F,qBAAoB,kBAAmB,SAAA,uBAAE;CAAA;AAEzC;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,KAAK,CAAC,EAAE;QAAE,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAA;CAC7G;;wBAIqB,MAAM;iBACb,GAAG,EAAE,MAAM,GAAO,MAAC,CAAD,MAAC,CAAL,IAAI,EAAC,kBAAkB,CAAA;SAC7C,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,GAAO,MAAC,CAAD,MAAC,CAAL,IAAI,EAAC,kBAAkB,CAAA;uBACjC,MAAC,CAAD,MAAC,CAAf,MAAM,GAAG,IAAI,EAAE,kBAAkB,CAAA;;;AALvD,yFAAyF;AACzF,qBAAe,aAAa;CAK3B;;;;;mBAa6D,MAAC,CAAD,MAAC,CAAlB,OAAO,UAAU,EAAC,kBAAkB,CAAA;;;AADjF,gGAAgG;AAChG,qBAAe,YAAY;CAAwD;;;;AA2CnF,yEAAyE;AACzE,eAAO,MAAM,SAAS,WAAY,kBAAkB,0DAA4E,CAAA;AAEhI,sEAAsE;AACtE,eAAO,MAAM,KAAK,uDAAiI,CAAA"}
|
|
@@ -0,0 +1,119 @@
|
|
|
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 BunDesktop_exports = {};
|
|
30
|
+
__export(BunDesktop_exports, {
|
|
31
|
+
DesktopUnavailable: () => DesktopUnavailable,
|
|
32
|
+
DesktopWindow: () => DesktopWindow,
|
|
33
|
+
NativeLoader: () => NativeLoader,
|
|
34
|
+
layer: () => layer,
|
|
35
|
+
layerWith: () => layerWith
|
|
36
|
+
});
|
|
37
|
+
module.exports = __toCommonJS(BunDesktop_exports);
|
|
38
|
+
var Effect = __toESM(require("effect/Effect"), 1);
|
|
39
|
+
var Exit = __toESM(require("effect/Exit"), 1);
|
|
40
|
+
var Layer = __toESM(require("effect/Layer"), 1);
|
|
41
|
+
var Metric = __toESM(require("effect/Metric"), 1);
|
|
42
|
+
var Schema = __toESM(require("effect/Schema"), 1);
|
|
43
|
+
var Scope = __toESM(require("effect/Scope"), 1);
|
|
44
|
+
var import_Effect = require("effect/Effect");
|
|
45
|
+
var import_internal = require("vibelang-runtime/internal");
|
|
46
|
+
var Effect_1 = __toESM(require("effect/Effect"), 1);
|
|
47
|
+
var runtime = __toESM(require("vibelang-runtime/internal"), 1);
|
|
48
|
+
class DesktopUnavailable extends Schema.TaggedError()("DesktopUnavailable", {
|
|
49
|
+
/**
|
|
50
|
+
* Presentation chosen by the application; omitted options use Electrobun's defaults.
|
|
51
|
+
* @category models
|
|
52
|
+
* @since 0.1.0
|
|
53
|
+
*/
|
|
54
|
+
}) {
|
|
55
|
+
static {
|
|
56
|
+
(0, import_internal.$schemaErrorMatcher)(this, "DesktopUnavailable");
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
class DesktopWindow extends runtime.$service("@smthrs/platform-bun/src/BunDesktop#DesktopWindow") {
|
|
60
|
+
}
|
|
61
|
+
function observed(operation, body) {
|
|
62
|
+
return (0, import_Effect.withSpan)(Effect_1.gen(function* () {
|
|
63
|
+
const result = yield* (0, import_Effect.exit)(body);
|
|
64
|
+
const outcome = Exit.isSuccess(result) ? "done" : "failed";
|
|
65
|
+
yield* Effect.logInfo("desktop.native").pipe(Effect.annotateLogs({ operation, outcome }));
|
|
66
|
+
yield* Metric.update(Metric.withAttributes(Metric.counter("desktop_native_operations", { incremental: true }), { operation, outcome }), 1);
|
|
67
|
+
return yield* result;
|
|
68
|
+
}), `desktop.native.${operation}`);
|
|
69
|
+
}
|
|
70
|
+
class NativeLoader extends runtime.$service("@smthrs/platform-bun/src/BunDesktop#NativeLoader") {
|
|
71
|
+
}
|
|
72
|
+
const implementation = Layer.effect(DesktopWindow, Effect_1.gen(function* () {
|
|
73
|
+
const scope = yield* Effect.scope;
|
|
74
|
+
const native = yield* (yield* NativeLoader).load;
|
|
75
|
+
if (native.SMITHERS_BUN14_COMPAT !== 3)
|
|
76
|
+
return yield* Effect_1.fail(new DesktopUnavailable());
|
|
77
|
+
return {
|
|
78
|
+
resources: native.PATHS.RESOURCES_FOLDER,
|
|
79
|
+
open: (url, options = { title: "" }) => observed("open", Effect_1.gen(function* () {
|
|
80
|
+
const window = yield* Effect.try({
|
|
81
|
+
try: () => new native.BrowserWindow({
|
|
82
|
+
title: options.title,
|
|
83
|
+
...options.frame === void 0 ? {} : { frame: {
|
|
84
|
+
x: options.frame.x,
|
|
85
|
+
y: options.frame.y,
|
|
86
|
+
width: options.frame.width,
|
|
87
|
+
height: options.frame.height
|
|
88
|
+
} },
|
|
89
|
+
url,
|
|
90
|
+
titleBarStyle: "hiddenInset",
|
|
91
|
+
renderer: "cef",
|
|
92
|
+
sandbox: true,
|
|
93
|
+
navigationRules: JSON.stringify(["^*", `${new URL(url).origin}/*`])
|
|
94
|
+
}),
|
|
95
|
+
catch: () => new DesktopUnavailable()
|
|
96
|
+
});
|
|
97
|
+
yield* Scope.addFinalizer(scope, observed("close", Effect.try({ try: () => window.close(), catch: () => new DesktopUnavailable() })).pipe(Effect.orDie));
|
|
98
|
+
yield* Effect.try({ try: () => window.webview.setNavigationRules(["^*", `${new URL(url).origin}/*`]), catch: () => new DesktopUnavailable() });
|
|
99
|
+
})),
|
|
100
|
+
openExternal: (url) => observed("external", Effect_1.gen(function* () {
|
|
101
|
+
const parsed = yield* Effect.try({ try: () => new URL(url), catch: () => new DesktopUnavailable() });
|
|
102
|
+
if (parsed.protocol !== "https:" || parsed.username !== "" || parsed.password !== "")
|
|
103
|
+
return yield* Effect_1.fail(new DesktopUnavailable());
|
|
104
|
+
const opened = yield* Effect.try({ try: () => native.Utils.openExternal(url), catch: () => new DesktopUnavailable() });
|
|
105
|
+
if (!opened)
|
|
106
|
+
return yield* Effect_1.fail(new DesktopUnavailable());
|
|
107
|
+
})),
|
|
108
|
+
chooseDirectory: () => observed("choose", Effect_1.gen(function* () {
|
|
109
|
+
const paths = yield* (0, import_Effect.tryPromise)({
|
|
110
|
+
try: () => native.Utils.openFileDialog({ canChooseFiles: false, canChooseDirectory: true, allowsMultipleSelection: false }),
|
|
111
|
+
catch: () => new DesktopUnavailable()
|
|
112
|
+
});
|
|
113
|
+
return paths.find((path) => path !== "") ?? null;
|
|
114
|
+
}))
|
|
115
|
+
};
|
|
116
|
+
}));
|
|
117
|
+
const layerWith = (loader) => implementation.pipe(Layer.provide(Layer.succeed(NativeLoader, loader)));
|
|
118
|
+
const layer = layerWith({ load: observed("load", (0, import_Effect.tryPromise)({ try: () => import("#electrobun"), catch: () => new DesktopUnavailable() })) });
|
|
119
|
+
//# sourceMappingURL=BunDesktop.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/BunDesktop.vibe"],
|
|
4
|
+
"sourcesContent": ["import type * as Electrobun from \"#electrobun\"\n\n// Electrobun native operations stay in the Bun host. Importing the package never loads native FFI.\n/** Failure to open a native window or dialog, without OS messages or paths in diagnostics. */\nexport schema error DesktopUnavailable {}\n\n/**\n * Presentation chosen by the application; omitted options use Electrobun's defaults.\n * @category models\n * @since 0.1.0\n */\nexport interface WindowOptions {\n readonly title: string\n readonly frame?: { readonly x: number; readonly y: number; readonly width: number; readonly height: number }\n}\n\n/** The native desktop seam; dialogs are selected by the person, never by web content. */\nexport service DesktopWindow {\n readonly resources: string\n openExternal(url: string): void!DesktopUnavailable\n open(url: string, options?: WindowOptions): void!DesktopUnavailable\n chooseDirectory(): (string | null)!DesktopUnavailable\n}\n\nfunction observed<A, E, R>(operation: string, body: A!E!R) {\n return withSpan(effect {\n const result = try exit(body)\n const outcome = Exit.isSuccess(result) ? \"done\" : \"failed\"\n try Effect.logInfo(\"desktop.native\").pipe(Effect.annotateLogs({ operation, outcome }))\n try Metric.update(Metric.withAttributes(Metric.counter(\"desktop_native_operations\", { incremental: true }), { operation, outcome }), 1)\n return try result\n }, `desktop.native.${operation}`)\n}\n\n/** The foreign native dependency, injectable as a real host port or a faulty Effect service. */\nexport service NativeLoader { readonly load: typeof Electrobun!DesktopUnavailable }\n\n/** Electrobun 1.x's Bun API. Loaded only in an Electrobun process, including Linux under Xvfb. */\nconst implementation = Layer.effect(DesktopWindow, effect {\n const scope = try Effect.scope\n const native = try (try NativeLoader).load\n // An upstream peer without the distributed patch fails before any native window opens.\n if (native.SMITHERS_BUN14_COMPAT !== 3) throw new DesktopUnavailable()\n return {\n resources: native.PATHS.RESOURCES_FOLDER,\n open: (url: string, options: WindowOptions = { title: \"\" }) => observed(\"open\", effect {\n const window = try Effect.try({\n try: () => new native.BrowserWindow({\n title: options.title,\n ...(options.frame === undefined ? {} : { frame: {\n x: options.frame.x, y: options.frame.y, width: options.frame.width, height: options.frame.height,\n } }),\n url,\n titleBarStyle: \"hiddenInset\", renderer: \"cef\", sandbox: true,\n navigationRules: JSON.stringify([\"^*\", `${new URL(url).origin}/*`]),\n }),\n catch: () => new DesktopUnavailable(),\n })\n try Scope.addFinalizer(scope, observed(\"close\", Effect.try({ try: () => window.close(), catch: () => new DesktopUnavailable() })).pipe(Effect.orDie))\n // Electrobun 1.x stores constructor rules in JS but applies native rules through this public setter.\n try Effect.try({ try: () => window.webview.setNavigationRules([\"^*\", `${new URL(url).origin}/*`]), catch: () => new DesktopUnavailable() })\n }),\n openExternal: (url: string) => observed(\"external\", effect {\n const parsed = try Effect.try({ try: () => new URL(url), catch: () => new DesktopUnavailable() })\n if (parsed.protocol !== \"https:\" || parsed.username !== \"\" || parsed.password !== \"\") throw new DesktopUnavailable()\n const opened = try Effect.try({ try: () => native.Utils.openExternal(url), catch: () => new DesktopUnavailable() })\n if (!opened) throw new DesktopUnavailable()\n }),\n chooseDirectory: () => observed(\"choose\", effect {\n const paths = try tryPromise({\n try: () => native.Utils.openFileDialog({ canChooseFiles: false, canChooseDirectory: true, allowsMultipleSelection: false }),\n catch: () => new DesktopUnavailable(),\n })\n return paths.find((path) => path !== \"\") ?? null\n }),\n }\n})\n\n/** Compose the native seam with an explicit external binding service. */\nexport const layerWith = (loader: NativeLoader.Shape) => implementation.pipe(Layer.provide(Layer.succeed(NativeLoader, loader)))\n\n/** Load the supported Electrobun peer lazily at the host boundary. */\nexport const layer = layerWith({ load: observed(\"load\", tryPromise({ try: () => import(\"#electrobun\"), catch: () => new DesktopUnavailable() })) })\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIM,MAAc,2BAAb,OAAA,YAAM,EAAO,sBAAmB;;;;;;CAAE,EAAA;EAAA,OAAA;AAArB,6CAAA,MAAA,oBAAkB;;;AAahC,MAAS,sBAAa,QAAA,SAAA,mDAAA,EAAA;;AAO5B,SAAS,SAAkB,WAAmB,MAAW;AACvD,aAAO,wBAAS,SAAA,IAAA,aAAA;AACd,UAAM,SAAM,WAAO,oBAAK,IAAI;AAC5B,UAAM,UAAU,KAAK,UAAU,MAAM,IAAI,SAAS;AAClD,WAAI,OAAO,QAAQ,gBAAgB,EAAE,KAAK,OAAO,aAAa,EAAE,WAAW,Q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
|
+
import { Effect, FileSystem, Path, Schema } from "effect";
|
|
2
|
+
import { SecureRandom } from "effect/crypto";
|
|
3
|
+
declare const FileChanged_base: Schema.Class<FileChanged, Schema.TaggedStruct<"FileChanged", {}>, import("effect/Cause").YieldableError>;
|
|
4
|
+
/** The file changed since the caller read it. Its contents never enter the error. */
|
|
5
|
+
export declare class FileChanged extends FileChanged_base {
|
|
6
|
+
}
|
|
7
|
+
/** Atomically replace a file without exposing a partial write. @since 1.0.0-rc.16 */
|
|
8
|
+
export declare function replaceFileString(fs: FileSystem.FileSystem, name: string, before: string, after: string): Effect.Effect<undefined, FileChanged | import("effect/PlatformError").PlatformError, Path.Path | SecureRandom.SecureRandom>;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=BunFileReplacement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BunFileReplacement.d.ts","sources":["../../src/BunFileReplacement.vibe"],"names":[],"mappings":";AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;;AAE5C,qFAAqF;AACrF,qBAAoB,WAAY,SAAA,gBAAE;CAAA;AA+ClC,qFAAqF;AACrF,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,UAAU,CAAC,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,+HAQvG"}
|
|
@@ -0,0 +1,111 @@
|
|
|
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 BunFileReplacement_exports = {};
|
|
30
|
+
__export(BunFileReplacement_exports, {
|
|
31
|
+
FileChanged: () => FileChanged,
|
|
32
|
+
replaceFileString: () => replaceFileString
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(BunFileReplacement_exports);
|
|
35
|
+
var Effect = __toESM(require("effect/Effect"), 1);
|
|
36
|
+
var Exit = __toESM(require("effect/Exit"), 1);
|
|
37
|
+
var Metric = __toESM(require("effect/Metric"), 1);
|
|
38
|
+
var Path = __toESM(require("effect/Path"), 1);
|
|
39
|
+
var Schema = __toESM(require("effect/Schema"), 1);
|
|
40
|
+
var import_Effect = require("effect/Effect");
|
|
41
|
+
var import_internal = require("vibelang-runtime/internal");
|
|
42
|
+
var Effect_1 = __toESM(require("effect/Effect"), 1);
|
|
43
|
+
var import_kernel = require("@smthrs/kernel");
|
|
44
|
+
var import_crypto = require("effect/crypto");
|
|
45
|
+
class FileChanged extends Schema.TaggedError()("FileChanged", {
|
|
46
|
+
/**
|
|
47
|
+
* Write to a private sibling, flush its data and mode, rename atomically, then sync its directory.
|
|
48
|
+
* Confined views already flush each write and rename through the native helper.
|
|
49
|
+
* Refuse a changed original before rename and accept an already completed replay.
|
|
50
|
+
* This is optimistic conflict detection, not a lock against an uncooperative external writer.
|
|
51
|
+
* The supplied filesystem must implement same-directory atomic rename (the Bun host does).
|
|
52
|
+
*/
|
|
53
|
+
}) {
|
|
54
|
+
static {
|
|
55
|
+
(0, import_internal.$schemaErrorMatcher)(this, "FileChanged");
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function replace(fs, name, before, after) {
|
|
59
|
+
return Effect_1.gen(function* replace2() {
|
|
60
|
+
const current = yield* fs.readFileString(name);
|
|
61
|
+
const path = yield* Path.Path;
|
|
62
|
+
const needsSync = (yield* (0, import_Effect.orDie)(Effect.try(() => import_kernel.FileSystem.confinedRoot(fs)))) === void 0;
|
|
63
|
+
if (current === after) {
|
|
64
|
+
if (needsSync)
|
|
65
|
+
yield* syncReplacement(fs, name, path.dirname(name));
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
if (current !== before)
|
|
69
|
+
return yield* Effect_1.fail(new FileChanged());
|
|
70
|
+
const stat = yield* fs.stat(name);
|
|
71
|
+
const random = yield* import_crypto.SecureRandom.SecureRandom;
|
|
72
|
+
const temporary = path.join(path.dirname(name), `.smithers-${yield* random.uuidV4()}.tmp`);
|
|
73
|
+
yield* (0, import_Effect.ensuring)(Effect_1.gen(function* () {
|
|
74
|
+
yield* fs.writeFileString(temporary, after, { flag: "wx", mode: stat.mode & 511 });
|
|
75
|
+
yield* fs.chmod(temporary, stat.mode & 511);
|
|
76
|
+
if (needsSync)
|
|
77
|
+
yield* (0, import_Effect.scoped)(Effect_1.gen(function* () {
|
|
78
|
+
const file = yield* fs.open(temporary, { flag: "r" });
|
|
79
|
+
yield* file.sync;
|
|
80
|
+
}));
|
|
81
|
+
if ((yield* fs.readFileString(name)) !== before)
|
|
82
|
+
return yield* Effect_1.fail(new FileChanged());
|
|
83
|
+
yield* fs.rename(temporary, name);
|
|
84
|
+
if (needsSync)
|
|
85
|
+
yield* (0, import_Effect.scoped)(Effect_1.gen(function* () {
|
|
86
|
+
const directory = yield* fs.open(path.dirname(name));
|
|
87
|
+
yield* directory.sync;
|
|
88
|
+
}));
|
|
89
|
+
}), fs.remove(temporary, { force: true }).pipe(Effect.orDie));
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
function syncReplacement(fs, name, parent) {
|
|
93
|
+
return Effect_1.gen(function* syncReplacement2() {
|
|
94
|
+
yield* (0, import_Effect.scoped)(Effect_1.gen(function* () {
|
|
95
|
+
const file = yield* fs.open(name, { flag: "r" });
|
|
96
|
+
yield* file.sync;
|
|
97
|
+
const directory = yield* fs.open(parent);
|
|
98
|
+
yield* directory.sync;
|
|
99
|
+
}));
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
function replaceFileString(fs, name, before, after) {
|
|
103
|
+
return (0, import_Effect.withSpan)(Effect_1.gen(function* () {
|
|
104
|
+
const result = yield* (0, import_Effect.exit)(replace(fs, name, before, after));
|
|
105
|
+
const outcome = Exit.isSuccess(result) ? "done" : "failed";
|
|
106
|
+
yield* Effect.logInfo("filesystem.replace").pipe(Effect.annotateLogs({ outcome }));
|
|
107
|
+
yield* Metric.update(Metric.withAttributes(Metric.counter("filesystem_replacements", { incremental: true }), { outcome }), 1);
|
|
108
|
+
return yield* result;
|
|
109
|
+
}), "filesystem.replace");
|
|
110
|
+
}
|
|
111
|
+
//# sourceMappingURL=BunFileReplacement.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/BunFileReplacement.vibe"],
|
|
4
|
+
"sourcesContent": ["// Durable replacement over a syncing filesystem, including the kernel's confined descriptor-relative view.\nimport { FileSystem as Confined } from \"@smthrs/kernel\"\nimport { SecureRandom } from \"effect/crypto\"\n\n/** The file changed since the caller read it. Its contents never enter the error. */\nexport schema error FileChanged {}\n\n/**\n * Write to a private sibling, flush its data and mode, rename atomically, then sync its directory.\n * Confined views already flush each write and rename through the native helper.\n * Refuse a changed original before rename and accept an already completed replay.\n * This is optimistic conflict detection, not a lock against an uncooperative external writer.\n * The supplied filesystem must implement same-directory atomic rename (the Bun host does).\n */\neffect function replace(fs: FileSystem.FileSystem, name: string, before: string, after: string) {\n const current = try fs.readFileString(name)\n const path = try Path.Path\n const needsSync = (try orDie(Effect.try(() => Confined.confinedRoot(fs)))) === undefined\n if (current === after) {\n // A replay also completes a directory flush that failed after the previous rename.\n if (needsSync) try syncReplacement(fs, name, path.dirname(name))\n return\n }\n if (current !== before) throw new FileChanged()\n const stat = try fs.stat(name)\n const random = try SecureRandom.SecureRandom\n const temporary = path.join(path.dirname(name), `.smithers-${try random.uuidV4()}.tmp`)\n try ensuring(effect {\n try fs.writeFileString(temporary, after, { flag: \"wx\", mode: stat.mode & 0o777 })\n try fs.chmod(temporary, stat.mode & 0o777)\n if (needsSync) try scoped(effect {\n const file = try fs.open(temporary, { flag: \"r\" })\n try file.sync\n })\n if ((try fs.readFileString(name)) !== before) throw new FileChanged()\n try fs.rename(temporary, name)\n if (needsSync) try scoped(effect {\n const directory = try fs.open(path.dirname(name))\n try directory.sync\n })\n }, fs.remove(temporary, { force: true }).pipe(Effect.orDie))\n}\n\neffect function syncReplacement(fs: FileSystem.FileSystem, name: string, parent: string) {\n try scoped(effect {\n const file = try fs.open(name, { flag: \"r\" })\n try file.sync\n const directory = try fs.open(parent)\n try directory.sync\n })\n}\n\n/** Atomically replace a file without exposing a partial write. @since 1.0.0-rc.16 */\nexport function replaceFileString(fs: FileSystem.FileSystem, name: string, before: string, after: string) {\n return withSpan(effect {\n const result = try exit(replace(fs, name, before, after))\n const outcome = Exit.isSuccess(result) ? \"done\" : \"failed\"\n try Effect.logInfo(\"filesystem.replace\").pipe(Effect.annotateLogs({ outcome }))\n try Metric.update(Metric.withAttributes(Metric.counter(\"filesystem_replacements\", { incremental: true }), { outcome }), 1)\n return try result\n }, \"filesystem.replace\")\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,oBAAuC;AACvC,oBAA6B;AAGvB,MAAc,oBAAb,OAAA,YAAM,EAAO,eAAY;;;;;;;;CAAE,EAAA;EAAA,OAAA;AAAd,6CAAA,MAAA,aAAW;;;AAS/B,SAAgB,QAAQ,IAA2B,MAAc,QAAgB,OAAa;AAAA,SAAA,SAAA,IAAA,UAAAA,WAAA;AAC5F,UAAM,UAAO,OAAO,GAAG,eAAe,IAAI;AAC1C,UAAM,OAAI,OAAO,KAAK;AACtB,UAAM,aAAY,WAAK,qBAAM,OAAO,IAAI,MAAM,cAAAC,WAAS,aAAa,EAAE,CAAC,CAAC,OAAO;AAC/E,QAAI,YAAY,OAAO;AAErB,UAAI;AAAW,eAAI,gBAAgB,IAAI,MAAM,KAAK,QAAQ,IAAI,CAAC;AAC/D;IACF;AACA,QAAI,YAAY;AAAQ,aAAA,OAAA,SAAA,KAAM,IAAI,YAAW,CAAE;AAC/C,UAAM,OAAI,OAAO,GAAG,KAAK,IAAI;AAC7B,UAAM,SAAM,OAAO,2BAAa;AAChC,UAAM,YAAY,KAAK,KAAK,KAAK,QAAQ,IAAI,GAAG,aAAa,OAAI,OAAO,OAAM,CAAE,MAAM;AACtF,eAAI,wBAAS,SAAA,IAAA,aAAA;AACX,aAAI,GAAG,gBAAgB,WAAW,OAAO,EAAE,MAAM,MAAM,MAAM,KAAK,OAAO,IAAK,CAAE;AAChF,aAAI,GAAG,MAAM,WAAW,KAAK,OAAO,GAAK;AACzC,UAAI;AAAW,mBAAI,sBAAO,SAAA,IAAA,aAAA;AACxB,gBAAM,OAAI,OAAO,GAAG,KAAK,WAAW,EAAE,MAAM,IAAG,CAAE;A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 @@ export declare const layerWith: (options: AtomicFileSystem.Options) => Layer.Lay
|
|
|
41
41
|
* @since 1.0.0-rc.0
|
|
42
42
|
*/
|
|
43
43
|
export type Options = AtomicFileSystem.Options;
|
|
44
|
+
/** Crash-safe same-directory file replacement with optimistic conflict detection. @since 1.0.0-rc.16 */
|
|
45
|
+
export { FileChanged, replaceFileString } from "./BunFileReplacement.ts";
|
|
44
46
|
//# sourceMappingURL=BunFileSystem.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BunFileSystem.d.ts","
|
|
1
|
+
{"version":3,"file":"BunFileSystem.d.ts","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;AAE9C,wGAAwG;AACxG,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,yBAA2B,CAAA"}
|
|
@@ -28,11 +28,14 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
var BunFileSystem_exports = {};
|
|
30
30
|
__export(BunFileSystem_exports, {
|
|
31
|
+
FileChanged: () => import_BunFileReplacement.FileChanged,
|
|
31
32
|
layer: () => layer,
|
|
32
|
-
layerWith: () => layerWith
|
|
33
|
+
layerWith: () => layerWith,
|
|
34
|
+
replaceFileString: () => import_BunFileReplacement.replaceFileString
|
|
33
35
|
});
|
|
34
36
|
module.exports = __toCommonJS(BunFileSystem_exports);
|
|
35
37
|
var AtomicFileSystem = __toESM(require("@smthrs/platform-node/AtomicFileSystem"), 1);
|
|
38
|
+
var import_BunFileReplacement = require("./BunFileReplacement.js");
|
|
36
39
|
const layer = AtomicFileSystem.layer;
|
|
37
40
|
const layerWith = AtomicFileSystem.layerWith;
|
|
38
41
|
//# sourceMappingURL=BunFileSystem.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/BunFileSystem.ts"],
|
|
4
|
-
"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"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA
|
|
4
|
+
"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\n/** Crash-safe same-directory file replacement with optimistic conflict detection. @since 1.0.0-rc.16 */\nexport { FileChanged, replaceFileString } from \"./BunFileReplacement.vibe\"\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;AAeA,uBAAkC;AAkClC,gCAA+C;AAtBxC,MAAM,QAAiC,iBAAiB;AAWxD,MAAM,YAA4E,iBAAiB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bun's full garbage collection, as the `GarbageCollector` that
|
|
3
|
+
* `@smthrs/sandbox`'s Microsandbox provider gives finished command handles
|
|
4
|
+
* back to the guest with.
|
|
5
|
+
*
|
|
6
|
+
* Bun takes no V8 flags; it exposes its collector itself as `Bun.gc`.
|
|
7
|
+
*
|
|
8
|
+
* @since 1.0.0
|
|
9
|
+
*/
|
|
10
|
+
import { MicrosandboxSandbox } from "@smthrs/sandbox";
|
|
11
|
+
import * as Layer from "effect/Layer";
|
|
12
|
+
/**
|
|
13
|
+
* The process's collector: `Bun.gc(true)`, which collects synchronously. It
|
|
14
|
+
* is one value, so every Microsandbox provider in the process counts its
|
|
15
|
+
* command starts toward the same collections.
|
|
16
|
+
*
|
|
17
|
+
* @category constructors
|
|
18
|
+
* @since 1.0.0
|
|
19
|
+
*/
|
|
20
|
+
export declare const collector: MicrosandboxSandbox.GarbageCollector;
|
|
21
|
+
/**
|
|
22
|
+
* Provides {@link collector}.
|
|
23
|
+
*
|
|
24
|
+
* @category layers
|
|
25
|
+
* @since 1.0.0
|
|
26
|
+
*/
|
|
27
|
+
export declare const layer: Layer.Layer<MicrosandboxSandbox.GarbageCollector>;
|
|
28
|
+
//# sourceMappingURL=BunGarbageCollector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BunGarbageCollector.d.ts","sources":["../../src/BunGarbageCollector.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAErD,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAKrC;;;;;;;GAOG;AACH,eAAO,MAAM,SAAS,EAAE,mBAAmB,CAAC,gBAI3C,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAExD,CAAA"}
|
|
@@ -0,0 +1,44 @@
|
|
|
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 BunGarbageCollector_exports = {};
|
|
30
|
+
__export(BunGarbageCollector_exports, {
|
|
31
|
+
collector: () => collector,
|
|
32
|
+
layer: () => layer
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(BunGarbageCollector_exports);
|
|
35
|
+
var import_sandbox = require("@smthrs/sandbox");
|
|
36
|
+
var Effect = __toESM(require("effect/Effect"), 1);
|
|
37
|
+
var Layer = __toESM(require("effect/Layer"), 1);
|
|
38
|
+
const collector = {
|
|
39
|
+
// Native Bun GC is exercised only by the real Bun lane, which has no V8 coverage.
|
|
40
|
+
/* v8 ignore next */
|
|
41
|
+
collect: Effect.sync(() => Bun.gc(true))
|
|
42
|
+
};
|
|
43
|
+
const layer = Layer.succeed(import_sandbox.MicrosandboxSandbox.GarbageCollector)(collector);
|
|
44
|
+
//# sourceMappingURL=BunGarbageCollector.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/BunGarbageCollector.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Bun's full garbage collection, as the `GarbageCollector` that\n * `@smthrs/sandbox`'s Microsandbox provider gives finished command handles\n * back to the guest with.\n *\n * Bun takes no V8 flags; it exposes its collector itself as `Bun.gc`.\n *\n * @since 1.0.0\n */\n\nimport { MicrosandboxSandbox } from \"@smthrs/sandbox\"\nimport * as Effect from \"effect/Effect\"\nimport * as Layer from \"effect/Layer\"\n\n/** The part of Bun's global this module calls. */\ndeclare const Bun: { readonly gc: (force: boolean) => void }\n\n/**\n * The process's collector: `Bun.gc(true)`, which collects synchronously. It\n * is one value, so every Microsandbox provider in the process counts its\n * command starts toward the same collections.\n *\n * @category constructors\n * @since 1.0.0\n */\nexport const collector: MicrosandboxSandbox.GarbageCollector = {\n // Native Bun GC is exercised only by the real Bun lane, which has no V8 coverage.\n /* v8 ignore next */\n collect: Effect.sync(() => Bun.gc(true))\n}\n\n/**\n * Provides {@link collector}.\n *\n * @category layers\n * @since 1.0.0\n */\nexport const layer: Layer.Layer<MicrosandboxSandbox.GarbageCollector> = Layer.succeed(\n MicrosandboxSandbox.GarbageCollector\n)(collector)\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;AAUA,qBAAoC;AACpC,aAAwB;AACxB,YAAuB;AAahB,MAAM,YAAkD;;;EAG7D,SAAS,OAAO,KAAK,MAAM,IAAI,GAAG,IAAI,CAAC;;AASlC,MAAM,QAA2D,MAAM,QAC5E,mCAAoB,gBAAgB,EACpC,SAAS;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/cjs/BunHost.d.ts
CHANGED
|
@@ -30,7 +30,8 @@ import type * as ProcessLedger from "@smthrs/kernel/ProcessLedger";
|
|
|
30
30
|
import * as AtomicFileSystem from "@smthrs/platform-node/AtomicFileSystem";
|
|
31
31
|
import * as HostLiveness from "@smthrs/platform-node/HostLiveness";
|
|
32
32
|
import * as ProcessReaper from "@smthrs/platform-node/ProcessReaper";
|
|
33
|
-
import type * as
|
|
33
|
+
import type * as EffectDigest from "effect/crypto/Digest";
|
|
34
|
+
import type * as SecureRandom from "effect/crypto/SecureRandom";
|
|
34
35
|
import type { FileSystem } from "effect/FileSystem";
|
|
35
36
|
import type { HttpClient } from "effect/http/HttpClient";
|
|
36
37
|
import * as Layer from "effect/Layer";
|
|
@@ -157,7 +158,7 @@ export declare const layerHttpClient: Layer.Layer<HttpClient>;
|
|
|
157
158
|
* @since 1.0.0-rc.0
|
|
158
159
|
* @slop
|
|
159
160
|
*/
|
|
160
|
-
export declare const layer: Layer.Layer<BunHost |
|
|
161
|
+
export declare const layer: Layer.Layer<BunHost | (EffectDigest.Digest | SecureRandom.SecureRandom)>;
|
|
161
162
|
/**
|
|
162
163
|
* Provides all five Bun Host services bound to one absolute repository root.
|
|
163
164
|
*
|
|
@@ -171,7 +172,7 @@ export declare const layer: Layer.Layer<BunHost | Crypto.Crypto>;
|
|
|
171
172
|
* @category layers
|
|
172
173
|
* @since 1.0.0-rc.0
|
|
173
174
|
*/
|
|
174
|
-
export declare const layerAt: (root: string) => Layer.Layer<BunHost |
|
|
175
|
+
export declare const layerAt: (root: string) => Layer.Layer<BunHost | (EffectDigest.Digest | SecureRandom.SecureRandom)>;
|
|
175
176
|
/**
|
|
176
177
|
* Provides the Bun host with process containment turned on.
|
|
177
178
|
*
|
|
@@ -190,7 +191,7 @@ export declare const layerAt: (root: string) => Layer.Layer<BunHost | Crypto.Cry
|
|
|
190
191
|
* @category layers
|
|
191
192
|
* @since 1.0.0-rc.0
|
|
192
193
|
*/
|
|
193
|
-
export declare const layerContained: (options?: ContainedOptions) => Layer.Layer<BunHost |
|
|
194
|
+
export declare const layerContained: (options?: ContainedOptions) => Layer.Layer<BunHost | (EffectDigest.Digest | SecureRandom.SecureRandom), never, ProcessLedger.ProcessLedger>;
|
|
194
195
|
/**
|
|
195
196
|
* Provides the contained Bun host bound to one absolute repository root.
|
|
196
197
|
*
|
|
@@ -201,5 +202,5 @@ export declare const layerContained: (options?: ContainedOptions) => Layer.Layer
|
|
|
201
202
|
* @category layers
|
|
202
203
|
* @since 1.0.0-rc.0
|
|
203
204
|
*/
|
|
204
|
-
export declare const layerContainedAt: (root: string, options?: ContainedOptions) => Layer.Layer<BunHost |
|
|
205
|
+
export declare const layerContainedAt: (root: string, options?: ContainedOptions) => Layer.Layer<BunHost | (EffectDigest.Digest | SecureRandom.SecureRandom), never, ProcessLedger.ProcessLedger>;
|
|
205
206
|
//# sourceMappingURL=BunHost.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BunHost.d.ts","
|
|
1
|
+
{"version":3,"file":"BunHost.d.ts","sources":["../../src/BunHost.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,sBAAsB,MAAM,6CAA6C,CAAA;AACrF,OAAO,KAAK,SAAS,MAAM,gCAAgC,CAAA;AAE3D,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,YAAY,CAAA;AAEpC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6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