Repository navigation
computer: Make just-bash an optional peer and stop installing acorn - #239
Merged
Merged
Conversation
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 detectedLatest commit: b3bda2b The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
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 |
commit: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every install of
@cloudflare/computerpulls injust-bashandacorn, even when the consumer only uses the filesystem, git, or the container backend (#220).just-bashalone is about 21 MB unpacked.just-bashis 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: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.acornmoves todevDependencies. 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:
From there, bundling
@cloudflare/computer/backends/worker-javascriptwith esbuild works. Bundling@cloudflare/computer/backends/worker-shellfails withCould not resolve "just-bash". Afternpm install just-bashit 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_moduleswas 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 anddocs/12_worker_backend.mdsay to install it. A minor changeset covers the change.npm run check,npm run typecheck, andnpm test --workspace @cloudflare/computerpass.