From c70122a5ec6e5a8aac5ddf117b5e1ab6aff61af7 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Tue, 18 Aug 2026 23:24:03 +0000 Subject: [PATCH 1/6] docs: define TypeScript package resolution fix Co-authored-by: Ulisses Ferreira --- ...026-08-18-typescript-package-resolution.md | 179 ++++++++++++++++++ ...18-typescript-package-resolution-design.md | 42 ++++ 2 files changed, 221 insertions(+) create mode 100644 docs/superpowers/plans/2026-08-18-typescript-package-resolution.md create mode 100644 docs/superpowers/specs/2026-08-18-typescript-package-resolution-design.md diff --git a/docs/superpowers/plans/2026-08-18-typescript-package-resolution.md b/docs/superpowers/plans/2026-08-18-typescript-package-resolution.md new file mode 100644 index 000000000..f312233ef --- /dev/null +++ b/docs/superpowers/plans/2026-08-18-typescript-package-resolution.md @@ -0,0 +1,179 @@ +# TypeScript Package Resolution Implementation Plan + +> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. + +**Goal:** Make local TypeScript and Jest resolution explicit for the workspace package while leaving all other `@metamask/*` dependencies on their installed declarations. + +**Architecture:** Replace the shared `@metamask/*` wildcard with exact and subpath mappings for `@metamask/snap-networks-utils`. Mirror those mappings in the package Jest configuration so tests and the TypeScript language service select the same local source files. + +**Tech Stack:** TypeScript 5.8, Jest 30, Yarn 4, JSON configuration, CommonJS Jest configuration. + +## Global Constraints + +- Only `@metamask/snap-networks-utils` is resolved to local source. +- All other `@metamask/*` packages use normal package resolution. +- TypeScript and Jest mappings must remain synchronized. +- No runtime source, dependency, or public API changes are introduced. + +--- + +### Task 1: Commit the approved design and implementation plan + +**Files:** +- Create: `docs/superpowers/specs/2026-08-18-typescript-package-resolution-design.md` +- Create: `docs/superpowers/plans/2026-08-18-typescript-package-resolution.md` + +**Interfaces:** +- Produces the documented resolution rules used by Task 2. + +- [ ] **Step 1: Review both documents for placeholders and contradictions** + +Confirm that the design identifies the wildcard assumption, the explicit allowlist, Jest synchronization, and validation commands. Confirm that the plan’s paths match the package layout under `packages/`. + +- [ ] **Step 2: Commit the documentation** + +Run: + +```bash +git add docs/superpowers/specs/2026-08-18-typescript-package-resolution-design.md docs/superpowers/plans/2026-08-18-typescript-package-resolution.md +git commit -m "docs: define TypeScript package resolution fix" +``` + +Expected: one commit containing only the design and implementation plan. + +### Task 2: Add explicit local package mappings + +**Files:** +- Modify: `tsconfig.packages.json:8-17` +- Modify: `jest.config.packages.js:79-93` + +**Interfaces:** +- TypeScript maps `@metamask/snap-networks-utils` to `../snap-networks-utils/src` and `@metamask/snap-networks-utils/*` to `../snap-networks-utils/src/*` relative to each package’s `baseUrl`. +- Jest maps the same package root and subpaths to `/../snap-networks-utils/src` and `/../snap-networks-utils/src/$1`. +- Other `@metamask/*` imports are not intercepted by these local mappings. + +- [ ] **Step 1: Write the expected configuration assertion** + +Use the existing effective-config commands as the regression check: + +```bash +yarn tsc --showConfig -p packages/tron-wallet-snap/tsconfig.json +``` + +The output must contain exactly the two `@metamask/snap-networks-utils` path patterns and must not contain `@metamask/*`. + +- [ ] **Step 2: Run the check before implementation** + +Run: + +```bash +yarn tsc --showConfig -p packages/tron-wallet-snap/tsconfig.json +``` + +Expected: the current output contains `"@metamask/*": ["../*/src"]`, demonstrating the behavior being replaced. + +- [ ] **Step 3: Update TypeScript configuration** + +Replace the wildcard `paths` entry with: + +```json +"paths": { + "@metamask/snap-networks-utils": ["../snap-networks-utils/src"], + "@metamask/snap-networks-utils/*": ["../snap-networks-utils/src/*"] +} +``` + +- [ ] **Step 4: Update Jest configuration** + +Replace the generic `'^@metamask/(.+)$'` local mapping and fallback with: + +```js +'^@metamask/snap-networks-utils$': '/../snap-networks-utils/src', +'^@metamask/snap-networks-utils/(.+)$': + '/../snap-networks-utils/src/$1', +``` + +Keep the existing `json-rpc-engine/v2` and `utils/node` special cases unchanged. + +- [ ] **Step 5: Commit the configuration change** + +Run: + +```bash +git add tsconfig.packages.json jest.config.packages.js +git commit -m "fix: resolve only workspace packages locally" +``` + +Expected: one commit containing only the TypeScript and Jest configuration changes. + +### Task 3: Verify local and published resolution behavior + +**Files:** +- No additional files. + +**Interfaces:** +- Validation demonstrates local root and subpath resolution for the workspace package and normal installed resolution for another `@metamask/*` dependency. + +- [ ] **Step 1: Push the pre-validation revision** + +Run: + +```bash +git push -u origin ulissesferreira/fix-typescript-package-resolution-5832 +``` + +- [ ] **Step 2: Verify effective TypeScript mappings** + +Run: + +```bash +yarn tsc --showConfig -p packages/tron-wallet-snap/tsconfig.json +``` + +Expected: both explicit workspace mappings are present and the broad `@metamask/*` mapping is absent. + +- [ ] **Step 3: Verify TypeScript resolution traces** + +Run: + +```bash +yarn tsc --noEmit -p packages/tron-wallet-snap/tsconfig.json --traceResolution +``` + +Expected: `@metamask/snap-networks-utils` and its `logger` subpath resolve under `packages/snap-networks-utils/src`; `@metamask/snaps-sdk` and `@metamask/utils` resolve under `node_modules/@metamask`. + +- [ ] **Step 4: Run affected package type checks** + +Run: + +```bash +yarn workspace @metamask/snap-networks-utils run build +yarn workspace @metamask/bitcoin-wallet-snap exec tsc --noEmit +yarn workspace @metamask/solana-wallet-snap exec tsc --noEmit +yarn workspace @metamask/tron-wallet-snap exec tsc --noEmit +``` + +Expected: all commands exit successfully. + +- [ ] **Step 5: Run affected tests and repository validation** + +Run: + +```bash +yarn workspace @metamask/snap-networks-utils run test +yarn workspace @metamask/tron-wallet-snap run test +yarn lint +yarn changelog:validate +``` + +Expected: all commands exit successfully. If lint removes build output, rebuild the affected package before any subsequent package test. + +- [ ] **Step 6: Commit any necessary validation-only corrections** + +If formatting or validation identifies a required correction, make the smallest fix, rerun the relevant check, and commit it separately: + +```bash +git add +git commit -m "chore: format TypeScript resolution configuration" +git push +``` diff --git a/docs/superpowers/specs/2026-08-18-typescript-package-resolution-design.md b/docs/superpowers/specs/2026-08-18-typescript-package-resolution-design.md new file mode 100644 index 000000000..0a79a1c97 --- /dev/null +++ b/docs/superpowers/specs/2026-08-18-typescript-package-resolution-design.md @@ -0,0 +1,42 @@ +# TypeScript Package Resolution Design + +## Problem + +The shared package TypeScript configuration maps every `@metamask/*` import to +`../*/src`. This assumes every scoped dependency has source code in a sibling +directory of the consuming package. That is not true for published +dependencies, and it makes resolution depend on which package directory is +using the inherited configuration. + +## Design + +Replace the wildcard mapping with an explicit mapping for +`@metamask/snap-networks-utils`, the workspace package whose source should be +used while developing the snaps in this repository. Map both its package root +and `logger` subpath to the local source tree. Leave all other +`@metamask/*` imports unmapped so TypeScript resolves them through their +installed package metadata and declarations. + +Mirror the same allowlist in Jest. Keep the existing special cases for +`@metamask/json-rpc-engine/v2` and `@metamask/utils/node`, and add local +resolution for the workspace package before the existing installed-package +fallback behavior. + +## Testing + +Verify the effective TypeScript configuration contains only the explicit +workspace mappings. Run type checking for the packages that consume +`@metamask/snap-networks-utils`, and run their Jest suites to verify that root +and subpath imports resolve to local source. Run repository lint and changelog +validation as final checks. + +## Alternatives considered + +1. Keep the wildcard and add more relative path variants. This preserves the + incorrect assumption and grows brittle as packages move. +2. Remove all path mappings and rely on Yarn workspace links. This would use + built declarations rather than source during development and would not + preserve the current Jest behavior. +3. Explicitly map only workspace packages. This addresses the resolution bug, + preserves local source development, and lets published dependencies follow + normal package resolution, so it is the selected approach. From 04677d994fdc40820625d800705e0332ed31489d Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Tue, 18 Aug 2026 23:24:38 +0000 Subject: [PATCH 2/6] fix: resolve only workspace packages locally Co-authored-by: Ulisses Ferreira --- jest.config.packages.js | 10 ++++------ tsconfig.packages.json | 3 ++- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/jest.config.packages.js b/jest.config.packages.js index a7c6bc1e1..5ac6ab36c 100644 --- a/jest.config.packages.js +++ b/jest.config.packages.js @@ -84,12 +84,10 @@ module.exports = { '/../json-rpc-engine/src/v2/index.ts', ], '^@metamask/utils/node$': require.resolve('@metamask/utils/node'), - '^@metamask/(.+)$': [ - '/../$1/src', - // Some @metamask/* packages we are referencing aren't in this monorepo, - // so in that case use their published versions - '/../../node_modules/@metamask/$1', - ], + '^@metamask/snap-networks-utils$': + '/../snap-networks-utils/src', + '^@metamask/snap-networks-utils/(.+)$': + '/../snap-networks-utils/src/$1', }, // An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader diff --git a/tsconfig.packages.json b/tsconfig.packages.json index a655abc1f..ab490dcf6 100644 --- a/tsconfig.packages.json +++ b/tsconfig.packages.json @@ -12,7 +12,8 @@ * `jest.config.packages.js`. */ "paths": { - "@metamask/*": ["../*/src"] + "@metamask/snap-networks-utils": ["../snap-networks-utils/src"], + "@metamask/snap-networks-utils/*": ["../snap-networks-utils/src/*"] } } } From fd29eeb4cf69a21a9c879c2449a232d752db4e83 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Tue, 18 Aug 2026 23:26:24 +0000 Subject: [PATCH 3/6] fix: use local workspace declarations for TypeScript Co-authored-by: Ulisses Ferreira --- tsconfig.packages.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tsconfig.packages.json b/tsconfig.packages.json index ab490dcf6..b15a1262e 100644 --- a/tsconfig.packages.json +++ b/tsconfig.packages.json @@ -12,8 +12,8 @@ * `jest.config.packages.js`. */ "paths": { - "@metamask/snap-networks-utils": ["../snap-networks-utils/src"], - "@metamask/snap-networks-utils/*": ["../snap-networks-utils/src/*"] + "@metamask/snap-networks-utils": ["../snap-networks-utils/dist"], + "@metamask/snap-networks-utils/*": ["../snap-networks-utils/dist/*"] } } } From 530f8f95a69cdfda8d2389d824549677ad2d5fb6 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Tue, 18 Aug 2026 23:33:28 +0000 Subject: [PATCH 4/6] fix: resolve workspace packages from the monorepo root Map @metamask/* imports to packages/*/src (including subpaths) from the repository root, disable composite for Snap configs so they can consume sibling source, and fall back to node_modules when no local package exists. Co-authored-by: Ulisses Ferreira --- ...026-08-18-typescript-package-resolution.md | 168 ++++-------------- ...18-typescript-package-resolution-design.md | 65 ++++--- jest.config.packages.js | 18 +- packages/bitcoin-wallet-snap/tsconfig.json | 12 +- packages/sample-snap/tsconfig.json | 9 +- packages/snap-networks-utils/tsconfig.json | 1 - packages/solana-wallet-snap/tsconfig.json | 19 +- packages/stellar-wallet-snap/tsconfig.json | 15 +- packages/tron-wallet-snap/tsconfig.json | 15 +- .../package-template/tsconfig.json | 3 - tsconfig.packages.json | 15 +- tsconfig.snaps.json | 25 +++ 12 files changed, 137 insertions(+), 228 deletions(-) create mode 100644 tsconfig.snaps.json diff --git a/docs/superpowers/plans/2026-08-18-typescript-package-resolution.md b/docs/superpowers/plans/2026-08-18-typescript-package-resolution.md index f312233ef..76d182775 100644 --- a/docs/superpowers/plans/2026-08-18-typescript-package-resolution.md +++ b/docs/superpowers/plans/2026-08-18-typescript-package-resolution.md @@ -2,178 +2,70 @@ > **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. -**Goal:** Make local TypeScript and Jest resolution explicit for the workspace package while leaving all other `@metamask/*` dependencies on their installed declarations. +**Goal:** Make TypeScript and Jest resolve workspace `@metamask/*` packages from monorepo `packages/*/src` while published scoped packages keep using `node_modules`. -**Architecture:** Replace the shared `@metamask/*` wildcard with exact and subpath mappings for `@metamask/snap-networks-utils`. Mirror those mappings in the package Jest configuration so tests and the TypeScript language service select the same local source files. +**Architecture:** Root-relative wildcard mappings for package roots and subpaths, a Snap-specific config with `composite: false`, and a Jest mapper that tries local source then the installed package. **Tech Stack:** TypeScript 5.8, Jest 30, Yarn 4, JSON configuration, CommonJS Jest configuration. ## Global Constraints -- Only `@metamask/snap-networks-utils` is resolved to local source. -- All other `@metamask/*` packages use normal package resolution. +- Only `@metamask/*` packages with matching source under `packages/*/src` are resolved locally. +- Other `@metamask/*` packages use normal package resolution. +- Package-root and subpath imports must both resolve. - TypeScript and Jest mappings must remain synchronized. +- Snap package configs use `composite: false` and avoid a conflicting `baseUrl`. - No runtime source, dependency, or public API changes are introduced. --- -### Task 1: Commit the approved design and implementation plan +### Task 1: Apply the root-relative resolution configuration **Files:** -- Create: `docs/superpowers/specs/2026-08-18-typescript-package-resolution-design.md` -- Create: `docs/superpowers/plans/2026-08-18-typescript-package-resolution.md` +- Modify: `tsconfig.packages.json` +- Create: `tsconfig.snaps.json` +- Modify: `jest.config.packages.js` +- Modify: `packages/*/tsconfig.json` +- Modify: `scripts/create-package/package-template/tsconfig.json` **Interfaces:** -- Produces the documented resolution rules used by Task 2. +- TypeScript maps `@metamask/*` to `./packages/*/src` and `@metamask/*/*` to `./packages/*/src/*`. +- Snap configs inherit `composite: false` from `tsconfig.snaps.json`. +- Jest maps `packages//src` first and falls back to `node_modules/@metamask/`. -- [ ] **Step 1: Review both documents for placeholders and contradictions** - -Confirm that the design identifies the wildcard assumption, the explicit allowlist, Jest synchronization, and validation commands. Confirm that the plan’s paths match the package layout under `packages/`. - -- [ ] **Step 2: Commit the documentation** - -Run: +- [x] **Step 1: Update TypeScript, Snap, and Jest configuration** +- [ ] **Step 2: Commit the configuration change** ```bash -git add docs/superpowers/specs/2026-08-18-typescript-package-resolution-design.md docs/superpowers/plans/2026-08-18-typescript-package-resolution.md -git commit -m "docs: define TypeScript package resolution fix" +git add tsconfig.packages.json tsconfig.snaps.json jest.config.packages.js packages/*/tsconfig.json scripts/create-package/package-template/tsconfig.json docs/superpowers +git commit -m "fix: resolve workspace packages from the monorepo root" ``` -Expected: one commit containing only the design and implementation plan. - -### Task 2: Add explicit local package mappings - -**Files:** -- Modify: `tsconfig.packages.json:8-17` -- Modify: `jest.config.packages.js:79-93` - -**Interfaces:** -- TypeScript maps `@metamask/snap-networks-utils` to `../snap-networks-utils/src` and `@metamask/snap-networks-utils/*` to `../snap-networks-utils/src/*` relative to each package’s `baseUrl`. -- Jest maps the same package root and subpaths to `/../snap-networks-utils/src` and `/../snap-networks-utils/src/$1`. -- Other `@metamask/*` imports are not intercepted by these local mappings. - -- [ ] **Step 1: Write the expected configuration assertion** +### Task 2: Verify local and published resolution behavior -Use the existing effective-config commands as the regression check: +- [ ] **Step 1: Verify effective TypeScript mappings** ```bash yarn tsc --showConfig -p packages/tron-wallet-snap/tsconfig.json +yarn tsc --showConfig -p packages/solana-wallet-snap/tsconfig.json ``` -The output must contain exactly the two `@metamask/snap-networks-utils` path patterns and must not contain `@metamask/*`. - -- [ ] **Step 2: Run the check before implementation** +Expected: Snap configs have `composite: false`. Tron has no `baseUrl` and inherits the root-relative mappings. Solana re-declares the same mappings relative to its `baseUrl`. -Run: +- [ ] **Step 2: Run affected package type checks** ```bash -yarn tsc --showConfig -p packages/tron-wallet-snap/tsconfig.json -``` - -Expected: the current output contains `"@metamask/*": ["../*/src"]`, demonstrating the behavior being replaced. - -- [ ] **Step 3: Update TypeScript configuration** - -Replace the wildcard `paths` entry with: - -```json -"paths": { - "@metamask/snap-networks-utils": ["../snap-networks-utils/src"], - "@metamask/snap-networks-utils/*": ["../snap-networks-utils/src/*"] -} +yarn tsc --noEmit -p packages/bitcoin-wallet-snap/tsconfig.json +yarn tsc --noEmit -p packages/solana-wallet-snap/tsconfig.json +yarn tsc --noEmit -p packages/tron-wallet-snap/tsconfig.json +yarn tsc --noEmit -p packages/stellar-wallet-snap/tsconfig.json +yarn tsc --noEmit -p packages/snap-networks-utils/tsconfig.json ``` -- [ ] **Step 4: Update Jest configuration** - -Replace the generic `'^@metamask/(.+)$'` local mapping and fallback with: - -```js -'^@metamask/snap-networks-utils$': '/../snap-networks-utils/src', -'^@metamask/snap-networks-utils/(.+)$': - '/../snap-networks-utils/src/$1', -``` - -Keep the existing `json-rpc-engine/v2` and `utils/node` special cases unchanged. - -- [ ] **Step 5: Commit the configuration change** - -Run: - -```bash -git add tsconfig.packages.json jest.config.packages.js -git commit -m "fix: resolve only workspace packages locally" -``` - -Expected: one commit containing only the TypeScript and Jest configuration changes. - -### Task 3: Verify local and published resolution behavior - -**Files:** -- No additional files. - -**Interfaces:** -- Validation demonstrates local root and subpath resolution for the workspace package and normal installed resolution for another `@metamask/*` dependency. - -- [ ] **Step 1: Push the pre-validation revision** - -Run: - -```bash -git push -u origin ulissesferreira/fix-typescript-package-resolution-5832 -``` - -- [ ] **Step 2: Verify effective TypeScript mappings** - -Run: - -```bash -yarn tsc --showConfig -p packages/tron-wallet-snap/tsconfig.json -``` - -Expected: both explicit workspace mappings are present and the broad `@metamask/*` mapping is absent. - -- [ ] **Step 3: Verify TypeScript resolution traces** - -Run: - -```bash -yarn tsc --noEmit -p packages/tron-wallet-snap/tsconfig.json --traceResolution -``` - -Expected: `@metamask/snap-networks-utils` and its `logger` subpath resolve under `packages/snap-networks-utils/src`; `@metamask/snaps-sdk` and `@metamask/utils` resolve under `node_modules/@metamask`. - -- [ ] **Step 4: Run affected package type checks** - -Run: - -```bash -yarn workspace @metamask/snap-networks-utils run build -yarn workspace @metamask/bitcoin-wallet-snap exec tsc --noEmit -yarn workspace @metamask/solana-wallet-snap exec tsc --noEmit -yarn workspace @metamask/tron-wallet-snap exec tsc --noEmit -``` - -Expected: all commands exit successfully. - -- [ ] **Step 5: Run affected tests and repository validation** - -Run: +- [ ] **Step 3: Run library tests, lint, and changelog validation** ```bash yarn workspace @metamask/snap-networks-utils run test -yarn workspace @metamask/tron-wallet-snap run test yarn lint yarn changelog:validate ``` - -Expected: all commands exit successfully. If lint removes build output, rebuild the affected package before any subsequent package test. - -- [ ] **Step 6: Commit any necessary validation-only corrections** - -If formatting or validation identifies a required correction, make the smallest fix, rerun the relevant check, and commit it separately: - -```bash -git add -git commit -m "chore: format TypeScript resolution configuration" -git push -``` diff --git a/docs/superpowers/specs/2026-08-18-typescript-package-resolution-design.md b/docs/superpowers/specs/2026-08-18-typescript-package-resolution-design.md index 0a79a1c97..07107f596 100644 --- a/docs/superpowers/specs/2026-08-18-typescript-package-resolution-design.md +++ b/docs/superpowers/specs/2026-08-18-typescript-package-resolution-design.md @@ -6,37 +6,54 @@ The shared package TypeScript configuration maps every `@metamask/*` import to `../*/src`. This assumes every scoped dependency has source code in a sibling directory of the consuming package. That is not true for published dependencies, and it makes resolution depend on which package directory is -using the inherited configuration. +using the inherited configuration. Snap configs also inherit `composite: true`, +which prevents a consuming project from including source files from a local +workspace package. ## Design -Replace the wildcard mapping with an explicit mapping for -`@metamask/snap-networks-utils`, the workspace package whose source should be -used while developing the snaps in this repository. Map both its package root -and `logger` subpath to the local source tree. Leave all other -`@metamask/*` imports unmapped so TypeScript resolves them through their -installed package metadata and declarations. +Use a monorepo-root wildcard with a published-package fallback: -Mirror the same allowlist in Jest. Keep the existing special cases for -`@metamask/json-rpc-engine/v2` and `@metamask/utils/node`, and add local -resolution for the workspace package before the existing installed-package -fallback behavior. +```json +"paths": { + "@metamask/*": ["./packages/*/src"], + "@metamask/*/*": ["./packages/*/src/*"] +} +``` + +The first mapping covers package-root imports such as +`@metamask/snap-networks-utils`. The second covers subpaths such as +`@metamask/snap-networks-utils/logger`. When no matching +`packages//src` directory exists, TypeScript continues with normal +package resolution from `node_modules`. Adding a new workspace package does +not require an allowlist change. + +Snap packages extend a shared `tsconfig.snaps.json` that disables `composite` +so they can typecheck against sibling workspace source without TS6307. Those +configs must not set `baseUrl` unless they also re-declare the workspace +`paths` relative to that `baseUrl`; inherited path mappings are resolved +against `baseUrl` when it is present. + +Jest uses the same rule: try `packages//src` (and `src/`) from +the monorepo root, then fall back to the installed `@metamask/` package. ## Testing -Verify the effective TypeScript configuration contains only the explicit -workspace mappings. Run type checking for the packages that consume -`@metamask/snap-networks-utils`, and run their Jest suites to verify that root -and subpath imports resolve to local source. Run repository lint and changelog -validation as final checks. +Verify the effective TypeScript configuration has the root-relative mappings +and `composite: false` for Snap packages. Confirm a local workspace import +resolves under `packages/*/src` and a published `@metamask/*` import resolves +under `node_modules`. Run type checking for Snap packages, the library +package tests, lint, and changelog validation. ## Alternatives considered -1. Keep the wildcard and add more relative path variants. This preserves the - incorrect assumption and grows brittle as packages move. -2. Remove all path mappings and rely on Yarn workspace links. This would use - built declarations rather than source during development and would not - preserve the current Jest behavior. -3. Explicitly map only workspace packages. This addresses the resolution bug, - preserves local source development, and lets published dependencies follow - normal package resolution, so it is the selected approach. +1. Keep the consumer-relative wildcard and add more sibling-path variants. + This preserves the incorrect parent-directory assumption. +2. Maintain an explicit allowlist of local packages. Correct, but every new + workspace package needs a config update. +3. Remove all path mappings and rely on Yarn workspace links. This uses built + declarations instead of source during development. +4. Root-relative wildcard, subpath mapping, published-package fallback, and + Snap `composite: false`. This is the selected approach because local + packages are picked up automatically and missing local packages use + `node_modules`. diff --git a/jest.config.packages.js b/jest.config.packages.js index 5ac6ab36c..bb3ef91aa 100644 --- a/jest.config.packages.js +++ b/jest.config.packages.js @@ -77,17 +77,23 @@ module.exports = { // ], // A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module - // Here we ensure that Jest resolves `@metamask/*` imports to the uncompiled source code for packages that live in this repo. - // NOTE: This must be synchronized with the `paths` option in `tsconfig.base.json`. + // Resolve workspace `@metamask/*` imports to uncompiled source. Paths are + // relative to the monorepo root, not to the consuming package. When a local + // `packages//src` directory does not exist, use the installed package. + // NOTE: This must be synchronized with the `paths` option in `tsconfig.packages.json`. moduleNameMapper: { '^@metamask/json-rpc-engine/v2$': [ '/../json-rpc-engine/src/v2/index.ts', ], '^@metamask/utils/node$': require.resolve('@metamask/utils/node'), - '^@metamask/snap-networks-utils$': - '/../snap-networks-utils/src', - '^@metamask/snap-networks-utils/(.+)$': - '/../snap-networks-utils/src/$1', + '^@metamask/([^/]+)$': [ + '/../../packages/$1/src', + '/../../node_modules/@metamask/$1', + ], + '^@metamask/([^/]+)/(.+)$': [ + '/../../packages/$1/src/$2', + '/../../node_modules/@metamask/$1/$2', + ], }, // An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader diff --git a/packages/bitcoin-wallet-snap/tsconfig.json b/packages/bitcoin-wallet-snap/tsconfig.json index a8a6abb0f..8dfec9077 100644 --- a/packages/bitcoin-wallet-snap/tsconfig.json +++ b/packages/bitcoin-wallet-snap/tsconfig.json @@ -1,19 +1,11 @@ { - "extends": "../../tsconfig.packages.json", + "extends": "../../tsconfig.snaps.json", "compilerOptions": { - "baseUrl": "./", "lib": ["ES2021", "DOM"], - "resolveJsonModule": true /* lets us import JSON modules from within TypeScript modules. */, - "jsx": "react-jsx", - "jsxImportSource": "@metamask/snaps-sdk", "exactOptionalPropertyTypes": false, "forceConsistentCasingInFileNames": true, "noErrorTruncation": true, - "noUncheckedIndexedAccess": true, - "skipLibCheck": true, - "module": "ESNext", - "moduleResolution": "bundler", - "types": ["jest"] + "noUncheckedIndexedAccess": true }, "include": ["**/*.ts", "**/*.tsx", "locales/*.json"] } diff --git a/packages/sample-snap/tsconfig.json b/packages/sample-snap/tsconfig.json index 6db6f2381..036b93ac5 100644 --- a/packages/sample-snap/tsconfig.json +++ b/packages/sample-snap/tsconfig.json @@ -1,11 +1,4 @@ { - "extends": "../../tsconfig.packages.json", - "compilerOptions": { - "baseUrl": "./", - "jsx": "react-jsx", - "skipLibCheck": true, - "jsxImportSource": "@metamask/snaps-sdk", - "types": ["jest"] - }, + "extends": "../../tsconfig.snaps.json", "include": ["**/*.ts", "**/*.tsx", "locales/*.json"] } diff --git a/packages/snap-networks-utils/tsconfig.json b/packages/snap-networks-utils/tsconfig.json index 464677940..081aced0e 100644 --- a/packages/snap-networks-utils/tsconfig.json +++ b/packages/snap-networks-utils/tsconfig.json @@ -1,7 +1,6 @@ { "extends": "../../tsconfig.packages.json", "compilerOptions": { - "baseUrl": "./", "skipLibCheck": true, "types": ["jest"] }, diff --git a/packages/solana-wallet-snap/tsconfig.json b/packages/solana-wallet-snap/tsconfig.json index 3eb63f359..40870b3b3 100644 --- a/packages/solana-wallet-snap/tsconfig.json +++ b/packages/solana-wallet-snap/tsconfig.json @@ -1,20 +1,17 @@ { - "extends": "../../tsconfig.packages.json", + "extends": "../../tsconfig.snaps.json", "compilerOptions": { "baseUrl": "./", - "jsx": "react-jsx", - "jsxImportSource": "@metamask/snaps-sdk", - "resolveJsonModule": true, + "paths": { + "@metamask/*": ["../../packages/*/src"], + "@metamask/*/*": ["../../packages/*/src/*"] + }, + "lib": ["ES2023", "DOM"], + "target": "es2023", "exactOptionalPropertyTypes": true, "forceConsistentCasingInFileNames": true, "noErrorTruncation": true, - "noUncheckedIndexedAccess": true, - "skipLibCheck": true, - "lib": ["ES2023", "DOM"], - "target": "es2023", - "module": "preserve", - "moduleResolution": "bundler", - "types": ["jest"] + "noUncheckedIndexedAccess": true }, "include": ["**/*.ts", "**/*.tsx", "locales/*.json"] } diff --git a/packages/stellar-wallet-snap/tsconfig.json b/packages/stellar-wallet-snap/tsconfig.json index df5a8f6b6..797db4496 100644 --- a/packages/stellar-wallet-snap/tsconfig.json +++ b/packages/stellar-wallet-snap/tsconfig.json @@ -1,19 +1,12 @@ { - "extends": "../../tsconfig.packages.json", + "extends": "../../tsconfig.snaps.json", "compilerOptions": { - "resolveJsonModule": true /* lets us import JSON modules from within TypeScript modules. */, - "jsx": "react-jsx", - "jsxImportSource": "@metamask/snaps-sdk", + "lib": ["ES2023", "DOM"], + "target": "es2023", "exactOptionalPropertyTypes": false, "forceConsistentCasingInFileNames": true, "noErrorTruncation": true, - "noUncheckedIndexedAccess": true, - "skipLibCheck": true, - "lib": ["ES2023", "DOM"], - "target": "es2023", - "module": "preserve", - "moduleResolution": "bundler", - "types": ["jest"] + "noUncheckedIndexedAccess": true }, "include": ["**/*.ts", "**/*.tsx", "locales/*.json"] } diff --git a/packages/tron-wallet-snap/tsconfig.json b/packages/tron-wallet-snap/tsconfig.json index df5a8f6b6..797db4496 100644 --- a/packages/tron-wallet-snap/tsconfig.json +++ b/packages/tron-wallet-snap/tsconfig.json @@ -1,19 +1,12 @@ { - "extends": "../../tsconfig.packages.json", + "extends": "../../tsconfig.snaps.json", "compilerOptions": { - "resolveJsonModule": true /* lets us import JSON modules from within TypeScript modules. */, - "jsx": "react-jsx", - "jsxImportSource": "@metamask/snaps-sdk", + "lib": ["ES2023", "DOM"], + "target": "es2023", "exactOptionalPropertyTypes": false, "forceConsistentCasingInFileNames": true, "noErrorTruncation": true, - "noUncheckedIndexedAccess": true, - "skipLibCheck": true, - "lib": ["ES2023", "DOM"], - "target": "es2023", - "module": "preserve", - "moduleResolution": "bundler", - "types": ["jest"] + "noUncheckedIndexedAccess": true }, "include": ["**/*.ts", "**/*.tsx", "locales/*.json"] } diff --git a/scripts/create-package/package-template/tsconfig.json b/scripts/create-package/package-template/tsconfig.json index 025ba2ef7..fabfb3eca 100644 --- a/scripts/create-package/package-template/tsconfig.json +++ b/scripts/create-package/package-template/tsconfig.json @@ -1,8 +1,5 @@ { "extends": "../../tsconfig.packages.json", - "compilerOptions": { - "baseUrl": "./" - }, "references": [], "include": ["../../types", "./src"] } diff --git a/tsconfig.packages.json b/tsconfig.packages.json index b15a1262e..22de4dfbd 100644 --- a/tsconfig.packages.json +++ b/tsconfig.packages.json @@ -5,15 +5,20 @@ "extends": "./tsconfig.base.json", "compilerOptions": { /** - * Here we ensure that TypeScript resolves `@metamask/*` imports to the - * uncompiled source code for packages that live in this repo. + * Resolve `@metamask/*` imports to uncompiled source for packages in this + * repo. Paths are relative to this file (the monorepo root). + * + * A local candidate is used only when `packages//src` exists. + * Published `@metamask/*` dependencies fall through to `node_modules`. + * The second mapping covers package subpaths such as `/logger`. * * NOTE: This must be synchronized with the `moduleNameMapper` option in - * `jest.config.packages.js`. + * `jest.config.packages.js`. Consuming configs should not set `baseUrl` + * unless they also re-declare these paths relative to that `baseUrl`. */ "paths": { - "@metamask/snap-networks-utils": ["../snap-networks-utils/dist"], - "@metamask/snap-networks-utils/*": ["../snap-networks-utils/dist/*"] + "@metamask/*": ["./packages/*/src"], + "@metamask/*/*": ["./packages/*/src/*"] } } } diff --git a/tsconfig.snaps.json b/tsconfig.snaps.json new file mode 100644 index 000000000..5019f992c --- /dev/null +++ b/tsconfig.snaps.json @@ -0,0 +1,25 @@ +{ + /** + * Shared TypeScript settings for Snap packages. + * + * Snaps are bundled with `mm-snap` and are not part of the root + * `tsc --build` graph, so `composite` is disabled here. That lets + * workspace `@metamask/*` path mappings resolve to sibling `src/` + * directories without requiring project-reference build artifacts. + * + * Do not set `baseUrl` here. Inherited path mappings are resolved + * against `baseUrl` when it is present, which would break the + * monorepo-root mappings in `tsconfig.packages.json`. + */ + "extends": "./tsconfig.packages.json", + "compilerOptions": { + "composite": false, + "jsx": "react-jsx", + "jsxImportSource": "@metamask/snaps-sdk", + "module": "preserve", + "moduleResolution": "bundler", + "resolveJsonModule": true, + "skipLibCheck": true, + "types": ["jest"] + } +} From 4e3366764c715cf02d918844940a8d188049c100 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Tue, 18 Aug 2026 23:36:51 +0000 Subject: [PATCH 5/6] fix: map workspace subpaths and keep source typecheckable TypeScript path patterns allow only one star, so keep the root wildcard for package-root imports and add an explicit mapping for @metamask/snap-networks-utils subpaths. Assign optional Logger fields without writing undefined so Snap consumers with exactOptionalPropertyTypes can typecheck against local source. Co-authored-by: Ulisses Ferreira --- ...2026-08-18-typescript-package-resolution.md | 4 +++- ...-18-typescript-package-resolution-design.md | 18 +++++++++++------- .../snap-networks-utils/src/logger/Logger.ts | 12 +++++++++--- packages/solana-wallet-snap/tsconfig.json | 4 +++- tsconfig.packages.json | 7 +++++-- 5 files changed, 31 insertions(+), 14 deletions(-) diff --git a/docs/superpowers/plans/2026-08-18-typescript-package-resolution.md b/docs/superpowers/plans/2026-08-18-typescript-package-resolution.md index 76d182775..2b31000b4 100644 --- a/docs/superpowers/plans/2026-08-18-typescript-package-resolution.md +++ b/docs/superpowers/plans/2026-08-18-typescript-package-resolution.md @@ -22,6 +22,7 @@ ### Task 1: Apply the root-relative resolution configuration **Files:** + - Modify: `tsconfig.packages.json` - Create: `tsconfig.snaps.json` - Modify: `jest.config.packages.js` @@ -29,7 +30,8 @@ - Modify: `scripts/create-package/package-template/tsconfig.json` **Interfaces:** -- TypeScript maps `@metamask/*` to `./packages/*/src` and `@metamask/*/*` to `./packages/*/src/*`. + +- TypeScript maps `@metamask/*` to `./packages/*/src` and `@metamask/snap-networks-utils/*` to that package's `src/*`. - Snap configs inherit `composite: false` from `tsconfig.snaps.json`. - Jest maps `packages//src` first and falls back to `node_modules/@metamask/`. diff --git a/docs/superpowers/specs/2026-08-18-typescript-package-resolution-design.md b/docs/superpowers/specs/2026-08-18-typescript-package-resolution-design.md index 07107f596..74749b506 100644 --- a/docs/superpowers/specs/2026-08-18-typescript-package-resolution-design.md +++ b/docs/superpowers/specs/2026-08-18-typescript-package-resolution-design.md @@ -17,16 +17,20 @@ Use a monorepo-root wildcard with a published-package fallback: ```json "paths": { "@metamask/*": ["./packages/*/src"], - "@metamask/*/*": ["./packages/*/src/*"] + "@metamask/snap-networks-utils/*": [ + "./packages/snap-networks-utils/src/*" + ] } ``` -The first mapping covers package-root imports such as -`@metamask/snap-networks-utils`. The second covers subpaths such as -`@metamask/snap-networks-utils/logger`. When no matching -`packages//src` directory exists, TypeScript continues with normal -package resolution from `node_modules`. Adding a new workspace package does -not require an allowlist change. +The wildcard covers package-root imports such as +`@metamask/snap-networks-utils`. TypeScript path patterns allow only one +`*`, so workspace packages with extra entry points need an explicit +subpath mapping (`/logger`). When no matching `packages//src` +directory exists, TypeScript continues with normal package resolution from +`node_modules`. Adding a new workspace package is automatic for package-root +imports; add a subpath mapping only if that package exposes extra entry +points. Snap packages extend a shared `tsconfig.snaps.json` that disables `composite` so they can typecheck against sibling workspace source without TS6307. Those diff --git a/packages/snap-networks-utils/src/logger/Logger.ts b/packages/snap-networks-utils/src/logger/Logger.ts index 57230867b..87dce9c41 100644 --- a/packages/snap-networks-utils/src/logger/Logger.ts +++ b/packages/snap-networks-utils/src/logger/Logger.ts @@ -128,8 +128,12 @@ export class Logger { assert(level, LogLevelStruct); this.#level = level; - this.#prefix = prefix; - this.#decorators = decorators; + if (prefix !== undefined) { + this.#prefix = prefix; + } + if (decorators !== undefined) { + this.#decorators = decorators; + } } /** @@ -146,7 +150,9 @@ export class Logger { return new Logger({ level: this.#level, prefix: this.#prefix ? `${this.#prefix} ${prefix}` : prefix, - decorators: this.#decorators, + ...(this.#decorators === undefined + ? {} + : { decorators: this.#decorators }), }); } diff --git a/packages/solana-wallet-snap/tsconfig.json b/packages/solana-wallet-snap/tsconfig.json index 40870b3b3..7031f2018 100644 --- a/packages/solana-wallet-snap/tsconfig.json +++ b/packages/solana-wallet-snap/tsconfig.json @@ -4,7 +4,9 @@ "baseUrl": "./", "paths": { "@metamask/*": ["../../packages/*/src"], - "@metamask/*/*": ["../../packages/*/src/*"] + "@metamask/snap-networks-utils/*": [ + "../../packages/snap-networks-utils/src/*" + ] }, "lib": ["ES2023", "DOM"], "target": "es2023", diff --git a/tsconfig.packages.json b/tsconfig.packages.json index 22de4dfbd..5710af502 100644 --- a/tsconfig.packages.json +++ b/tsconfig.packages.json @@ -10,7 +10,8 @@ * * A local candidate is used only when `packages//src` exists. * Published `@metamask/*` dependencies fall through to `node_modules`. - * The second mapping covers package subpaths such as `/logger`. + * TypeScript path patterns allow only one `*`, so workspace packages + * with extra entry points need an explicit subpath mapping. * * NOTE: This must be synchronized with the `moduleNameMapper` option in * `jest.config.packages.js`. Consuming configs should not set `baseUrl` @@ -18,7 +19,9 @@ */ "paths": { "@metamask/*": ["./packages/*/src"], - "@metamask/*/*": ["./packages/*/src/*"] + "@metamask/snap-networks-utils/*": [ + "./packages/snap-networks-utils/src/*" + ] } } } From 3e88345c50b8b993eea9be3731c32bb9ea6d59b4 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Tue, 18 Aug 2026 23:43:29 +0000 Subject: [PATCH 6/6] chore: drop plan docs and sync snap shasums Remove the TypeScript resolution plan and design notes from the branch, document the consumer-facing package changes, and update snap manifest shasums to match the CI build. Co-authored-by: Ulisses Ferreira --- ...026-08-18-typescript-package-resolution.md | 73 ------------------- ...18-typescript-package-resolution-design.md | 63 ---------------- packages/bitcoin-wallet-snap/CHANGELOG.md | 4 + .../bitcoin-wallet-snap/snap.manifest.json | 2 +- packages/snap-networks-utils/CHANGELOG.md | 4 + packages/solana-wallet-snap/CHANGELOG.md | 1 + .../solana-wallet-snap/snap.manifest.json | 2 +- packages/stellar-wallet-snap/CHANGELOG.md | 1 + packages/tron-wallet-snap/CHANGELOG.md | 1 + packages/tron-wallet-snap/snap.manifest.json | 2 +- 10 files changed, 14 insertions(+), 139 deletions(-) delete mode 100644 docs/superpowers/plans/2026-08-18-typescript-package-resolution.md delete mode 100644 docs/superpowers/specs/2026-08-18-typescript-package-resolution-design.md diff --git a/docs/superpowers/plans/2026-08-18-typescript-package-resolution.md b/docs/superpowers/plans/2026-08-18-typescript-package-resolution.md deleted file mode 100644 index 2b31000b4..000000000 --- a/docs/superpowers/plans/2026-08-18-typescript-package-resolution.md +++ /dev/null @@ -1,73 +0,0 @@ -# TypeScript Package Resolution Implementation Plan - -> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. - -**Goal:** Make TypeScript and Jest resolve workspace `@metamask/*` packages from monorepo `packages/*/src` while published scoped packages keep using `node_modules`. - -**Architecture:** Root-relative wildcard mappings for package roots and subpaths, a Snap-specific config with `composite: false`, and a Jest mapper that tries local source then the installed package. - -**Tech Stack:** TypeScript 5.8, Jest 30, Yarn 4, JSON configuration, CommonJS Jest configuration. - -## Global Constraints - -- Only `@metamask/*` packages with matching source under `packages/*/src` are resolved locally. -- Other `@metamask/*` packages use normal package resolution. -- Package-root and subpath imports must both resolve. -- TypeScript and Jest mappings must remain synchronized. -- Snap package configs use `composite: false` and avoid a conflicting `baseUrl`. -- No runtime source, dependency, or public API changes are introduced. - ---- - -### Task 1: Apply the root-relative resolution configuration - -**Files:** - -- Modify: `tsconfig.packages.json` -- Create: `tsconfig.snaps.json` -- Modify: `jest.config.packages.js` -- Modify: `packages/*/tsconfig.json` -- Modify: `scripts/create-package/package-template/tsconfig.json` - -**Interfaces:** - -- TypeScript maps `@metamask/*` to `./packages/*/src` and `@metamask/snap-networks-utils/*` to that package's `src/*`. -- Snap configs inherit `composite: false` from `tsconfig.snaps.json`. -- Jest maps `packages//src` first and falls back to `node_modules/@metamask/`. - -- [x] **Step 1: Update TypeScript, Snap, and Jest configuration** -- [ ] **Step 2: Commit the configuration change** - -```bash -git add tsconfig.packages.json tsconfig.snaps.json jest.config.packages.js packages/*/tsconfig.json scripts/create-package/package-template/tsconfig.json docs/superpowers -git commit -m "fix: resolve workspace packages from the monorepo root" -``` - -### Task 2: Verify local and published resolution behavior - -- [ ] **Step 1: Verify effective TypeScript mappings** - -```bash -yarn tsc --showConfig -p packages/tron-wallet-snap/tsconfig.json -yarn tsc --showConfig -p packages/solana-wallet-snap/tsconfig.json -``` - -Expected: Snap configs have `composite: false`. Tron has no `baseUrl` and inherits the root-relative mappings. Solana re-declares the same mappings relative to its `baseUrl`. - -- [ ] **Step 2: Run affected package type checks** - -```bash -yarn tsc --noEmit -p packages/bitcoin-wallet-snap/tsconfig.json -yarn tsc --noEmit -p packages/solana-wallet-snap/tsconfig.json -yarn tsc --noEmit -p packages/tron-wallet-snap/tsconfig.json -yarn tsc --noEmit -p packages/stellar-wallet-snap/tsconfig.json -yarn tsc --noEmit -p packages/snap-networks-utils/tsconfig.json -``` - -- [ ] **Step 3: Run library tests, lint, and changelog validation** - -```bash -yarn workspace @metamask/snap-networks-utils run test -yarn lint -yarn changelog:validate -``` diff --git a/docs/superpowers/specs/2026-08-18-typescript-package-resolution-design.md b/docs/superpowers/specs/2026-08-18-typescript-package-resolution-design.md deleted file mode 100644 index 74749b506..000000000 --- a/docs/superpowers/specs/2026-08-18-typescript-package-resolution-design.md +++ /dev/null @@ -1,63 +0,0 @@ -# TypeScript Package Resolution Design - -## Problem - -The shared package TypeScript configuration maps every `@metamask/*` import to -`../*/src`. This assumes every scoped dependency has source code in a sibling -directory of the consuming package. That is not true for published -dependencies, and it makes resolution depend on which package directory is -using the inherited configuration. Snap configs also inherit `composite: true`, -which prevents a consuming project from including source files from a local -workspace package. - -## Design - -Use a monorepo-root wildcard with a published-package fallback: - -```json -"paths": { - "@metamask/*": ["./packages/*/src"], - "@metamask/snap-networks-utils/*": [ - "./packages/snap-networks-utils/src/*" - ] -} -``` - -The wildcard covers package-root imports such as -`@metamask/snap-networks-utils`. TypeScript path patterns allow only one -`*`, so workspace packages with extra entry points need an explicit -subpath mapping (`/logger`). When no matching `packages//src` -directory exists, TypeScript continues with normal package resolution from -`node_modules`. Adding a new workspace package is automatic for package-root -imports; add a subpath mapping only if that package exposes extra entry -points. - -Snap packages extend a shared `tsconfig.snaps.json` that disables `composite` -so they can typecheck against sibling workspace source without TS6307. Those -configs must not set `baseUrl` unless they also re-declare the workspace -`paths` relative to that `baseUrl`; inherited path mappings are resolved -against `baseUrl` when it is present. - -Jest uses the same rule: try `packages//src` (and `src/`) from -the monorepo root, then fall back to the installed `@metamask/` package. - -## Testing - -Verify the effective TypeScript configuration has the root-relative mappings -and `composite: false` for Snap packages. Confirm a local workspace import -resolves under `packages/*/src` and a published `@metamask/*` import resolves -under `node_modules`. Run type checking for Snap packages, the library -package tests, lint, and changelog validation. - -## Alternatives considered - -1. Keep the consumer-relative wildcard and add more sibling-path variants. - This preserves the incorrect parent-directory assumption. -2. Maintain an explicit allowlist of local packages. Correct, but every new - workspace package needs a config update. -3. Remove all path mappings and rely on Yarn workspace links. This uses built - declarations instead of source during development. -4. Root-relative wildcard, subpath mapping, published-package fallback, and - Snap `composite: false`. This is the selected approach because local - packages are picked up automatically and missing local packages use - `node_modules`. diff --git a/packages/bitcoin-wallet-snap/CHANGELOG.md b/packages/bitcoin-wallet-snap/CHANGELOG.md index 570452d8e..e30fcfa79 100644 --- a/packages/bitcoin-wallet-snap/CHANGELOG.md +++ b/packages/bitcoin-wallet-snap/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed + +- Resolve workspace `@metamask/*` TypeScript types from the monorepo root instead of assuming sibling directories ([#167](https://github.com/MetaMask/internal-snaps/pull/167)) + ## [2.0.1] ### Fixed diff --git a/packages/bitcoin-wallet-snap/snap.manifest.json b/packages/bitcoin-wallet-snap/snap.manifest.json index f594f203d..9e59617f5 100644 --- a/packages/bitcoin-wallet-snap/snap.manifest.json +++ b/packages/bitcoin-wallet-snap/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/internal-snaps.git" }, "source": { - "shasum": "jV649WZbbfbj3FpOMD5U/xDPuRD0t4F+pxCoy08a/O0=", + "shasum": "PpNYFDDadcYp9uuFWMdaURUB5G8vsXrwOETgpFEzUW4=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/snap-networks-utils/CHANGELOG.md b/packages/snap-networks-utils/CHANGELOG.md index dac68b80a..cfe98ffe3 100644 --- a/packages/snap-networks-utils/CHANGELOG.md +++ b/packages/snap-networks-utils/CHANGELOG.md @@ -13,6 +13,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Bump `@metamask/utils` from `^11.9.0` to `^11.11.9` ([#161](https://github.com/MetaMask/internal-snaps/pull/161)) +### Fixed + +- Assign optional `Logger` `prefix` and `decorators` only when they are provided so `exactOptionalPropertyTypes` consumers can typecheck against workspace source ([#167](https://github.com/MetaMask/internal-snaps/pull/167)) + ## [1.0.0] ### Added diff --git a/packages/solana-wallet-snap/CHANGELOG.md b/packages/solana-wallet-snap/CHANGELOG.md index ab6dd1dbf..45931b301 100644 --- a/packages/solana-wallet-snap/CHANGELOG.md +++ b/packages/solana-wallet-snap/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Resolve workspace `@metamask/*` TypeScript types from the monorepo root instead of assuming sibling directories ([#167](https://github.com/MetaMask/internal-snaps/pull/167)) - Extract Snap-owned assets domain logic into `SnapAssetsAdapter`; `AssetsService` is a thin facade that delegates metadata, market data, fetch, persist, and account asset reads through the adapter (no Core routing yet). ([#121](https://github.com/MetaMask/internal-snaps/pull/121)) - Align `AssetsService` read API with `snap-networks-utils` / AssetsController shapes by adding `getAccountAssetByID`, `getAccountAssetsByIDs`, `getAccountAssetsByScope`, and `getAccountAssets`, and routing Keyring and Send through them (still Snap-owned storage). ([#120](https://github.com/MetaMask/internal-snaps/pull/120)) diff --git a/packages/solana-wallet-snap/snap.manifest.json b/packages/solana-wallet-snap/snap.manifest.json index 57d2ca99d..9ec50e91d 100644 --- a/packages/solana-wallet-snap/snap.manifest.json +++ b/packages/solana-wallet-snap/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/internal-snaps.git" }, "source": { - "shasum": "2c2WNzBfLdP/UYJdepbBVpyYrpjzuSob/iobC9JJRLo=", + "shasum": "ogadUr7kiFH3ZTJLvNrBtK3z9EpDy1UGFLA+DSe0XVU=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/stellar-wallet-snap/CHANGELOG.md b/packages/stellar-wallet-snap/CHANGELOG.md index e6268ac1d..eb9eb201f 100644 --- a/packages/stellar-wallet-snap/CHANGELOG.md +++ b/packages/stellar-wallet-snap/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Resolve workspace `@metamask/*` TypeScript types from the monorepo root instead of assuming sibling directories ([#167](https://github.com/MetaMask/internal-snaps/pull/167)) - This package was migrated from [snap-stellar-wallet](https://github.com/MetaMask/snap-stellar-wallet). See the source repository for the original [changelog](https://github.com/MetaMask/snap-stellar-wallet/blob/main/packages/snap/CHANGELOG.md) ([#161](https://github.com/MetaMask/internal-snaps/pull/161)) ### Fixed diff --git a/packages/tron-wallet-snap/CHANGELOG.md b/packages/tron-wallet-snap/CHANGELOG.md index 733239f5e..678db5766 100644 --- a/packages/tron-wallet-snap/CHANGELOG.md +++ b/packages/tron-wallet-snap/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Resolve workspace `@metamask/*` TypeScript types from the monorepo root instead of assuming sibling directories ([#167](https://github.com/MetaMask/internal-snaps/pull/167)) - Extract shared asset util functions and inject `SnapAssetsAdapter` from `context` into `AssetsService` ([#143](https://github.com/MetaMask/internal-snaps/pull/143)) - Rename `getByKeyringAccountId` to `getAccountAssets` (with essential-asset synthesis) and update keyring callers ([#143](https://github.com/MetaMask/internal-snaps/pull/143)) diff --git a/packages/tron-wallet-snap/snap.manifest.json b/packages/tron-wallet-snap/snap.manifest.json index fe36b7959..317ca5920 100644 --- a/packages/tron-wallet-snap/snap.manifest.json +++ b/packages/tron-wallet-snap/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/internal-snaps.git" }, "source": { - "shasum": "MbqwOXbHFI83/qWOj9zDSXJizgEt5oQ+QnpHq0g/sls=", + "shasum": "Dgq9UwYX7J/Mo+Ubvm4cwZGPlea3fC/CPtq7jJhReec=", "location": { "npm": { "filePath": "dist/bundle.js",