Skip to content

computer: Make just-bash an optional peer and stop installing acorn - #239

Merged
aron-cf merged 3 commits into
mainfrom
optional-backend-peers
Oct 15, 2026
Merged

aron-cf merged 3 commits into
mainfrom
optional-backend-peers

Conversation

@mattzcarey

Copy link
Copy Markdown
Member

Every install of @cloudflare/computer pulls in just-bash and acorn, even when the consumer only uses the filesystem, git, or the container backend (#220). just-bash alone is about 21 MB unpacked.

just-bash is now an optional peer dependency. Only the worker-shell backend imports it, and the published bundle already keeps it as an external import, so worker-shell users install it themselves:

npm install @cloudflare/computer just-bash

If they forget, their Worker fails at build time with Could not resolve "just-bash", which names the package to install. I left out a lazy-loading guard because that error is already clear.

acorn moves to devDependencies. The worker-javascript backend is its only user, and rolldown already inlines it into that entry point, so consumers never resolve it.

To check it, pack the package and install it into an empty project:

npm pack --workspace @cloudflare/computer --pack-destination /tmp/c
cd /tmp/c && npm init -y && npm install ./cloudflare-computer-*.tgz
ls node_modules   # no just-bash, no acorn

From there, bundling @cloudflare/computer/backends/worker-javascript with esbuild works. Bundling @cloudflare/computer/backends/worker-shell fails with Could not resolve "just-bash". After npm install just-bash it works, and the bundle is byte for byte the same size as one built from the published 0.5.1. With esbuild in both projects, node_modules was 24 MB for this branch and 122 MB for 0.5.1.

The examples that import the worker-shell backend now list just-bash. The README install section and docs/12_worker_backend.md say to install it. A minor changeset covers the change.

npm run check, npm run typecheck, and npm test --workspace @cloudflare/computer pass.

Every consumer of @cloudflare/computer installed just-bash and acorn,
even when it only used the filesystem, git, or the container backend.
just-bash alone is about 21 MB unpacked, and pulls in more on top.

just-bash is imported only by the worker-shell backend, and the
published bundle keeps it as an external import. It is now an
optional peer dependency. A Worker that imports the worker-shell
backend without it fails at build time with "Could not resolve
just-bash", which names the package to install.

acorn is imported only by the worker-javascript backend, and rolldown
already inlines it into that entry point, so nothing resolves it at
install or bundle time. It moves to devDependencies with no change for
consumers.

The examples that import the worker-shell backend now list just-bash
themselves, and the README and worker backend doc say to install it.

Fixes #220.
@changeset-bot

changeset-bot Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b3bda2b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@cloudflare/computer Minor
@cloudflare/dofs Minor
@cloudflare/computer-rpc Minor
@cloudflare/computerd Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Oct 14, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@cloudflare/computer@239

commit: dc5b498

@aron-cf
aron-cf marked this pull request as ready for review October 15, 2026 13:56
@aron-cf
aron-cf merged commit 5980264 into main Oct 15, 2026
2 of 3 checks passed
@aron-cf
aron-cf deleted the optional-backend-peers branch October 15, 2026 13:57

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@github-actions github-actions Bot mentioned this pull request Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants