feat(perps-controller): expose subpath exports for constants, types, utils#8883
Open
abretonc7s wants to merge 2 commits into
Open
feat(perps-controller): expose subpath exports for constants, types, utils#8883abretonc7s wants to merge 2 commits into
abretonc7s wants to merge 2 commits into
Conversation
…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).
aganglada
previously approved these changes
May 21, 2026
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
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 legacymoduleResolution: "node"cannot resolve deep package imports through the package.jsonexportsfield. 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/typesmap 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
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.jsonsubpathexportsfor./constants,./constants/*,./types, and./utils/*, mapping both ESM/CJS and type entries directly todist/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.