Skip to content

feat(perps-controller): expose subpath exports for constants, types, utils#8883

Open
abretonc7s wants to merge 2 commits into
mainfrom
chore/perps-subpath-exports
Open

feat(perps-controller): expose subpath exports for constants, types, utils#8883
abretonc7s wants to merge 2 commits into
mainfrom
chore/perps-subpath-exports

Conversation

@abretonc7s
Copy link
Copy Markdown
Contributor

@abretonc7s abretonc7s commented May 21, 2026

Explanation

Follow-up to #8871 (the perps-controller source-of-truth migration into core).

Mobile (@metamask/metamask-mobile) and other consumers that still rely on TypeScript's legacy moduleResolution: "node" cannot resolve deep package imports through the package.json exports field. Declaring explicit subpath entries lets imports such as

  • @metamask/perps-controller/constants
  • @metamask/perps-controller/constants/perpsConfig
  • @metamask/perps-controller/constants/hyperLiquidConfig
  • @metamask/perps-controller/utils/coalescePerpsRestRequest
  • @metamask/perps-controller/utils/perpsDiskPersistence
  • @metamask/perps-controller/utils/hyperLiquidAdapter
  • @metamask/perps-controller/types

map back to the compiled artifacts in dist/ while preserving tree-shaking — each subpath points at its own emitted file rather than going through the barrel.

This change was authored locally during #8871 but never committed before merge. Splitting it out so the new entry points are reviewed on their own and the CHANGELOG entry is clearly attributable.

References

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 because this only changes package export maps and documentation; main behavior changes are limited to how consumers resolve deep imports at build/runtime.

Overview
Adds explicit package.json subpath exports for ./constants, ./constants/*, ./types, and ./utils/*, mapping both ESM/CJS and type entries directly to dist/ artifacts to support consumers using legacy Node/TypeScript module resolution while preserving tree-shaking.

Updates the perps-controller changelog to record the new deep-import entry points.

Reviewed by Cursor Bugbot for commit dd98053. Bugbot is set up for automated code reviews on this repo. Configure here.

…utils

Mobile (`@metamask/metamask-mobile`) and other consumers still on
TypeScript's legacy `moduleResolution: "node"` cannot resolve deep
package imports through the package.json `exports` field. Declare
explicit subpath entries so imports such as
`@metamask/perps-controller/constants/perpsConfig` or
`@metamask/perps-controller/utils/coalescePerpsRestRequest` map back
to the compiled artifacts in `dist/` while keeping tree-shaking
working (each subpath points at its own dist file rather than
re-exporting from the barrel).
@abretonc7s abretonc7s requested review from a team as code owners May 21, 2026 14:09
@abretonc7s abretonc7s enabled auto-merge May 21, 2026 14:12
aganglada
aganglada previously approved these changes May 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants