Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Make just-bash and acorn optional peer dependencies, pulled in only by the backend that needs them

未关闭
#220 3 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
45/100
Issue 类型
重构
描述清晰度
基本清楚
活跃度
活跃
技术栈
typescript

调研方向

Start with the dependencies block in package.json, then grep for just-bash imports under backends/worker-shell and the acorn import in backends/worker-javascript/module-graph.ts. Move both packages to peerDependencies with optional set in peerDependenciesMeta, and add a constructor check in each backend that throws an error naming the missing package. Update the README sections and Installation. Done when a consumer installs without either package, the filesystem, git and container backends still work, and constructing a backend without its peer throws the named error. Settle the capnweb question separately.

由索引模型根据 Issue 内容生成。

描述

enhancement

@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.
主要语言
TypeScript
星标
9.5k
派生
552
平均合并
1 天 17 小时
30 天内合并 PR
50

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

cloudflare/computer 的其他 Issue

查看 cloudflare/computer 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。