Conversation
commit: |
Move the git client behind an explicit Workspace option so the default package graph no longer pulls in isomorphic-git. The git subpath now exposes createGitClient() as a factory provider and keeps the pako replacement local to the bundled git entrypoint. Add a node:zlib-backed pako shim for the isomorphic-git paths used by the workspace git client. This preserves automatic git support for callers that opt in while avoiding pako for Worker builds that only use the core workspace.
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.
This change keeps git out of the default
@cloudflare/computerbundle while preserving first-class git support for callers that opt in. Previously, the mainWorkspacegraph madeisomorphic-gitreachable becauseworkspace.gitwas wired by default. That meant non-git Workers could still carry a lazy git chunk in their build. At the same time, git users paid forisomorphic-git's bundled JavaScriptpakocompression implementation even though Workers providenode:zlib.The new shape makes git an explicit
Workspacecapability. The default package graph no longer imports the git implementation. Callers that need git importcreateGitClientfrom@cloudflare/computer/gitand pass the returned factory intoWorkspaceOptions.git. That git subpath bundlesisomorphic-gitlazily and aliasespakoto a smallnode:zlibcompatibility layer, so git users still get the smaller compression payload while non-git users pay no git cost.Default filesystem and shell usage does not configure git:
Git usage opts in through the git subpath:
Advanced tests and custom adapters can configure the factory before binding it to a workspace:
If
workspace.gitis accessed withoutWorkspaceOptions.git, it now throws a clear configuration error. The worker backend's built-ingitcommand follows the same rule because it forwards to the host workspace's git client.The bundle outcome is now split by use case. A default
@cloudflare/computerimport does not reference the git chunk,isomorphic-git,pako, ornode:zlib. Git users opt into the git entrypoint and get the Worker-optimized lazy git chunk. In the current build,dist/index.jsis about 165 KB raw and 36 KB gzip, the git wrapper is about 102 KB raw and 21 KB gzip, and the lazyisomorphic-gitchunk is about 574 KB raw and 127 KB gzip.Verification run locally:
npm run build --workspace @cloudflare/computer npm run typecheck --workspace @cloudflare/computer npm test --workspace @cloudflare/computer npm run checkThe package README and git interface documentation were updated to show the opt-in API and explain that the default package graph stays free of git.