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

Fermée
#220 3 commentaires 1 réaction 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
3/5
Temps estimé
1-2 jours
Accessibilité débutants
45/100
Type d'issue
Refactorisation
Clarté
Plutôt claire
Activité
Active
Stack technique
typescript

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

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.
Langage dominant
TypeScript
Étoiles
9.7k
Forks
577
Merge moyen
1 j 15 h
PR mergées (30 j)
79

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de cloudflare/computer

Toutes les issues de cloudflare/computer

Issues similaires

Plus d'issues TypeScript

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.