Skip to content

feat(perps-controller): add UI-safe subpath exports for formatters, calculations, constants#8517

Open
abretonc7s wants to merge 2 commits intomainfrom
perps-sync-apr-18
Open

feat(perps-controller): add UI-safe subpath exports for formatters, calculations, constants#8517
abretonc7s wants to merge 2 commits intomainfrom
perps-sync-apr-18

Conversation

@abretonc7s
Copy link
Copy Markdown
Contributor

@abretonc7s abretonc7s commented Apr 18, 2026

Explanation

The @metamask/perps-controller package currently exposes a single entry point that transitively loads the HyperLiquid SDK, which pulls in the ESM-only @noble/hashes package. In CJS Jest environments where consumers have not customized transformIgnorePatterns, 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/formattersperpsFormatters
  • @metamask/perps-controller/calculationsorderCalculations
  • @metamask/perps-controller/constantsperpsConfig

Each entry exports both ESM (.mjs / .d.mts) and CJS (.cjs / .d.cts) artifacts matching the existing . export shape.

References

N/A

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Low Risk
Low risk: this only adds new package.json export 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.

…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.
@abretonc7s abretonc7s requested review from a team as code owners April 18, 2026 06:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant