Repository navigation
fix(adapter-polkadot): declare the UIKit peers its inlined wallet UI imports - #88
Merged
Merged
Conversation
pasevin
force-pushed
the
fix/adapter-polkadot-ui-components-peer
branch
from
September 20, 2026 19:14
1651bdf to
5aa0781
Compare
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The new dist-import validation script currently misses most dynamic import() usages due to an anchored regex, undermining the guard’s stated purpose.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (1)
What changed in this PR
This PR fixes @openzeppelin/adapter-polkadot’s published runtime dependency contract by declaring the UIKit packages that remain external in the final bundle as peers, and adds a build-time guard to prevent future “dist imports undeclared runtime dependency” regressions across adapter packages.
Changes:
- Add
@openzeppelin/ui-componentsand@openzeppelin/ui-reacttoadapter-polkadotpeerDependencies and include them in the runtimevalidatePeerVersionscheck. - Add a new
validate:dist-externalsscript and run it after workspace builds to detect undeclared external runtime imports. - Add a changeset bumping
@openzeppelin/adapter-polkadotfor the peer dependency contract change.
| File | Description |
|---|---|
| scripts/validate-dist-externals.cjs | New post-build guard that scans adapter dist/ outputs for bare imports and checks they’re declared as runtime deps/peers. |
| packages/adapter-polkadot/src/index.ts | Extends runtime peer-version validation to cover ui-components and ui-react. |
| packages/adapter-polkadot/package.json | Declares @openzeppelin/ui-components and @openzeppelin/ui-react as peerDependencies (keeping devDependencies). |
| package.json | Adds validate:dist-externals and wires it into pnpm build. |
| .changeset/polkadot-declare-uikit-peers.md | Documents the breaking peer dependency contract update and consumer action. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
pasevin
force-pushed
the
fix/adapter-polkadot-ui-components-peer
branch
from
September 20, 2026 20:53
5b45f91 to
5099c02
Compare
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.

Problem
Published
@openzeppelin/adapter-polkadotbundles contain bare runtime imports of@openzeppelin/ui-componentsand@openzeppelin/ui-react, but the manifest declared both only as dev dependencies. Under pnpm strict resolution those imports are unresolvable unless the consumer happens to hoist compatible UIKit packages. Role Manager hit this atadapter-polkadot@5.0.0after removing its global override and currently carries a version-scopedpackageExtensionsworkaround.Root cause
Polkadot inlines
@openzeppelin/adapter-evm-coreand@openzeppelin/adapter-runtime-utilsthroughnoExternal. EVM core's wallet components import the UIKit packages, while Polkadot keeps them external in its final bundle. Inlining therefore drops EVM core's peer-dependency boundary, and the Polkadot manifest never recreated it. The UIKit v3 range update in #86 moved these entries in dev dependencies but did not add the missing peers.Fix
@openzeppelin/ui-components ^3.9.0and@openzeppelin/ui-react ^3.3.2as Polkadot peers, retaining the matching dev dependencies used for local builds and tests.validatePeerVersionscheck. The existingozPeerMinimumsbuild mechanism now derives and embeds all four UIKit floors from the corrected manifest.Guard
Add
validate:dist-externalsafter workspace builds. It scans every published adapter's runtime dist files, normalizes bare import subpaths to package names, and fails when an imported package is absent from bothdependenciesandpeerDependencies.Against the unmodified main manifests, the guard failed with exactly two violations:
@openzeppelin/adapter-polkadot→@openzeppelin/ui-components@openzeppelin/adapter-polkadot→@openzeppelin/ui-reactIt passes after this fix. The audit also confirmed Solana's generated dist imports only its already-declared OpenZeppelin peers (
ui-typesandui-utils).Semver
Adding required runtime peers is breaking for consumers that do not already provide them, so the changeset bumps
@openzeppelin/adapter-polkadotmajor to 7.0.0, following #86's precedent. Changesets also propagates a major bump to@openzeppelin/adapters-vite14.0.0 because it peer-depends on the adapter packages.Consumer notes
Consumers must install or declare
@openzeppelin/ui-components ^3.9.0and@openzeppelin/ui-react ^3.3.2. Role Manager can remove its version-scoped Polkadot package extension after upgrading to this release.Verification
pnpm install— pass, 9 workspace projectspnpm build— pass, 7 build targets; includes Vite config, host-peer, and dist-external validationpnpm test— pass, 3,197 passed / 11 skipped tests across 200 passed / 1 skipped filespnpm lint— pass, 7 lint targetspnpm changeset status --verbose— pass, 2 major release entries (adapter-polkadot7.0.0 andadapters-vite14.0.0)