Add /base subpath export and document Jest setup - #1550
Merged
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
What
Adds a
./basesubpath export to the package, so offline primitives can be imported without the rest of the SDK:Also adds
base/indexas an explicit rollup entry (guaranteeing emission independent of tree-shaking, likehttp-client), documents the new subpath in the stellar-base migration section, and adds a "Usage with Jest" README section covering thetransformIgnorePatternsrecipe and the ≥es2020 compilation-target requirement for the ESM-only crypto dependencies.Why
Since the v16 stellar-base fold-in, the package root is the only way to reach primitives like
StrKey. The root is a barrel, and under CommonJSrequire()can't tree-shake it, so importing one symbol loads Horizon, RPC, and the SEP helpers along with their networking dependencies (axios,eventsource,smol-toml) — which breaks Jest consumers on ESM-only transitive deps. With/base, a CJS require loads 101 modules with zero networking/SEP modules, versus 174 for the root import. The remaining Jest friction (@noble/*being ESM-only) is a test-runner transform concern, so it's documented rather than worked around in the build.Closes #1533