OverviewFilesCommitsIssuesDocsReleasesPeers

favela-bridge commits / acae1c0

the deferred hyper-svc import has to be opaque to actually stay out
⛔ DEFERRING IT CHANGED NOTHING, and I claimed otherwise one commit ago. `await import('hyper-svc')` is a static string, so bare-pack FOLLOWS it — measured on the packed worklet: a THIRD copy of hyper-svc appeared under favela-host/node_modules/favela-bridge/node_modules/hyper-svc, 610 files to 915. A computed specifier is unfollowable at pack time and resolves normally at runtime, which is the trick this repo's own deployment rules already name for bare-sidecar (`'pear-' + 'runtime'`). The socket path is the only one that loads it, and it is only ever taken on a desktop — a phone can never open a unix socket for it. Measured after: 915 files back to 610, three copies to two, bundle 43.40 MB to 41.93 MB. The whole on-device projector now costs +0.93 MB over the 41.00 MB baseline. The functional half of the previous commit stands: an injected transport IS a configured sink. Only the bundle-size claim was wrong. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
acae1c033535d4a829372f16cba045c47219f9bb
by plankatron <fleeky@gmail.com> · 2026-09-11T22:51:08.000Z

Changed files (2) +13 -2

lib/bsky.js +8 -1
……@@ -36,7 +36,14 @@ export class BskySink {
3636
3737 async _open () {
3838 if (this._connect) return this._connect(this.sock)
39 const { Client } = await import('hyper-svc')
39 // ⛔ OPAQUE, AND MEASURED. `await import('hyper-svc')` is a static string, so bare-pack FOLLOWS it
40 // and bundles the whole transport anyway — deferring it changed nothing: the packed worklet grew a
41 // third copy of hyper-svc at
42 // favela-host/node_modules/favela-bridge/node_modules/hyper-svc (610 files → 915). The repo's
43 // deployment rules already name this trick for bare-sidecar (`'pear-' + 'runtime'`); a computed
44 // specifier still resolves normally at runtime on a desktop, where this path is the only one used,
45 // and is unfollowable at pack time for a phone that can never open a unix socket anyway.
46 const { Client } = await import('hyper-' + 'svc')
4047 return Client.discover({ uds: this.sock, prefer: 'uds' })
4148 }
4249
test/sink-injection.test.js +5 -1
……@@ -92,5 +92,9 @@ test('★★ hyper-svc is not imported at module scope', (t) => {
9292 const src = fs.readFileSync(ROOT + 'lib/bsky.js', 'utf8')
9393 t.absent(/^import .*from 'hyper-svc'/m.test(src),
9494 'a top-level import ships bare-net and a unix socket into the worklet')
95 t.ok(/await import\('hyper-svc'\)/.test(src), 'it is loaded on the socket path, which is the only path that uses it')
95 // ⛔ AND OPAQUE. A plain `await import('hyper-svc')` is a static string that bare-pack FOLLOWS, so
96 // deferring alone bundled the transport regardless — measured: a third copy of hyper-svc appeared
97 // under favela-host/node_modules/favela-bridge, 610 files to 915.
98 t.ok(/await import\('hyper-' \+ 'svc'\)/.test(src),
99 'a computed specifier resolves at runtime and is unfollowable at pack time')
96100})