@cloudflare/computer lists acorn and just-bash in dependencies. Every consumer installs them, including ones that only use the filesystem, git, or the container backend:
just-bash is imported only by the worker-shell backend (backends/worker-shell/*).
acorn is imported only by the worker-javascript backend (backends/worker-javascript/module-graph.ts).
Those backends ship as separate subpath entries, so a bundler drops the code when it isn't imported. The packages still get installed and resolved, and they land in the lockfile. That matters for packages that build on Computer. We want @cloudflare/think in cloudflare/agents to default to a Computer Workspace, and Think users shouldn't pull in a shell interpreter or a JS parser they never run.
Proposal
- Move
just-bash and acorn to peerDependencies and mark them optional in peerDependenciesMeta, the same pattern ai, zod, and @platformatic/vfs already follow.
- Document in each backend's README section and in Installation that
backends/worker-shell needs just-bash and backends/worker-javascript needs acorn.
- If a backend is constructed and its peer is missing, throw an error naming the package to install.
- While at it, check whether
capnweb can go the same way for consumers that never use the container backend or the remote client.
@cloudflare/computerlistsacornandjust-bashindependencies. Every consumer installs them, including ones that only use the filesystem, git, or the container backend:just-bashis imported only by the worker-shell backend (backends/worker-shell/*).acornis imported only by the worker-javascript backend (backends/worker-javascript/module-graph.ts).Those backends ship as separate subpath entries, so a bundler drops the code when it isn't imported. The packages still get installed and resolved, and they land in the lockfile. That matters for packages that build on Computer. We want
@cloudflare/thinkin cloudflare/agents to default to a Computer Workspace, and Think users shouldn't pull in a shell interpreter or a JS parser they never run.Proposal
just-bashandacorntopeerDependenciesand mark themoptionalinpeerDependenciesMeta, the same patternai,zod, and@platformatic/vfsalready follow.backends/worker-shellneedsjust-bashandbackends/worker-javascriptneedsacorn.capnwebcan go the same way for consumers that never use the container backend or the remote client.