fix(eth-block-tracker): promote @metamask/json-rpc-engine to a production dependency - #9830
Open
SnowingFox wants to merge 1 commit into
Open
Conversation
…tion dependency Fixes MetaMask#6864
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.
Summary
Fixes #6864
@metamask/json-rpc-engineis only declared as adevDependencyof@metamask/eth-block-tracker, butPollingBlockTracker.tsimports theContextConstraintandMiddlewareContexttypes from@metamask/json-rpc-engine/v2with a type-only import. Those types appear in the published declaration files throughPollingBlockTrackerOptionsand thePollingBlockTrackerclass generic, so downstream consumers that type-check against the published package need@metamask/json-rpc-engineresolvable. Today the resolution happens to work because@metamask/json-rpc-engineis pulled in transitively through@metamask/eth-json-rpc-provider; declaring it only as a dev dependency makes the dependency graph correct by accident rather than by contract.Changes
packages/eth-block-tracker/package.json: promote@metamask/json-rpc-enginefromdevDependenciestodependencies. The range is unchanged (^10.5.0), matching the version the source imports and the version@metamask/eth-json-rpc-provideralready requires.packages/eth-block-tracker/src/dependencies.test.ts: add a regression test asserting@metamask/json-rpc-engineis declared as a production dependency. It fails onmainand passes with this change.packages/eth-block-tracker/CHANGELOG.md: add an[Unreleased]Fixedentry.Test plan
main:Expected: not undefined, Received: undefined.@metamask/json-rpc-engineis declared independencies.No
yarn.lockchange is needed: the lockfile records workspace dependency sets as a union, so moving a dependency between thedependencies/devDependenciessections does not alter the resolution metadata for@metamask/eth-block-tracker.Notes
[Unreleased]changelog entry currently links to the issue; it can be updated to this PR's number once assigned.assets-controllers, NFT ownership restore).Note
Low Risk
Dependency classification fix with no runtime behavior change; only ensures types already used in public declarations are correctly declared.
Overview
Promotes
@metamask/json-rpc-enginefrom a devDependency to a production dependency so types that leak intoPollingBlockTracker's published declarations resolve for consumers.PollingBlockTrackertype-only-importsContextConstraintandMiddlewareContext, which appear in public.d.tsfiles viaPollingBlockTrackerOptionsand the class generic. Declaring the package only as a dev dependency left resolution dependent on a transitive install. Adds a regression test that asserts the production dependency is present.Reviewed by Cursor Bugbot for commit 6bfe741. Bugbot is set up for automated code reviews on this repo. Configure here.