feat(perps-controller): add UI-safe subpath exports for formatters, calculations, constants#8517
Open
abretonc7s wants to merge 2 commits intomainfrom
Open
feat(perps-controller): add UI-safe subpath exports for formatters, calculations, constants#8517abretonc7s wants to merge 2 commits intomainfrom
abretonc7s wants to merge 2 commits intomainfrom
Conversation
…alculations, constants Expose `./formatters`, `./calculations`, and `./constants` subpath exports so consumers can import pure utilities without transitively loading the HyperLiquid SDK, avoiding ESM-only `@noble/hashes` in CJS Jest environments.
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.
Explanation
The
@metamask/perps-controllerpackage currently exposes a single entry point that transitively loads the HyperLiquid SDK, which pulls in the ESM-only@noble/hashespackage. In CJS Jest environments where consumers have not customizedtransformIgnorePatterns, importing anything from this package forces them to configure Babel/Jest transforms for@noble/hashes, or their test suites break.This PR adds three new UI-safe subpath exports so consumers can import pure formatting/calculation utilities without triggering the SDK chain:
@metamask/perps-controller/formatters→perpsFormatters@metamask/perps-controller/calculations→orderCalculations@metamask/perps-controller/constants→perpsConfigEach entry exports both ESM (
.mjs/.d.mts) and CJS (.cjs/.d.cts) artifacts matching the existing.export shape.References
N/A
Checklist
Note
Low Risk
Low risk: this only adds new
package.jsonexport entrypoints and a changelog note, without changing runtime logic. Main risk is misconfigured export paths/types causing consumer import or build failures.Overview
Adds UI-safe subpath exports for
@metamask/perps-controller(./formatters,./calculations,./constants,./constants/hyperliquid) so consumers can import formatting/calculation utilities and config without pulling in the HyperLiquid SDK (and its ESM-only transitive deps) in CJS/Jest environments.Updates the package changelog to document these new entrypoints.
Reviewed by Cursor Bugbot for commit 07b4c4c. Bugbot is set up for automated code reviews on this repo. Configure here.