core icon indicating copy to clipboard operation
core copied to clipboard

Bump TypeScript to `^5.0.4` and set `module`, `moduleResolution` to `NodeNext`

Open MajorLift opened this issue 2 years ago • 4 comments

Explanation

As part of the Wallet Framework Team's OKRs (Q2 2024 O3KR4), we are upgrading TypeScript to v5.0+ for all packages in the core monorepo.

References

  • Closes https://github.com/MetaMask/core/issues/3651

  • Blocked by:

    • eth-simple-keyring:

      • [x] https://github.com/MetaMask/eth-simple-keyring/pull/177
      • [x] https://github.com/MetaMask/eth-simple-keyring/pull/178 → keyring-controller
    • chain-api:

      • [x] https://github.com/MetaMask/accounts-chain-api/pull/5
      • [x] https://github.com/MetaMask/accounts-chain-api/releases/tag/v0.1.0 → chain-controller
    • rpc-errors:

      • [x] https://github.com/MetaMask/rpc-errors/pull/147
      • [x] https://github.com/MetaMask/rpc-errors/pull/148 → json-rpc-engine: publish as individual release → snaps-controllersprofile-sync-controller → all pkgs downstream of json-rpc-engine that are used in snaps:
        • core: eth-json-rpc-provider, json-rpc-middleware-stream, permission-controller
        • snaps: snaps-execution-environment, snaps-jest, snaps-rpc-methods, snaps-simulator
        • external: providers, eth-json-rpc-middleware
    • providers, ~rpc-errors~ → snaps-sdkkeyring-api: https://github.com/MetaMask/keyring-api/pull/328 → eth-snap-keyring: https://github.com/MetaMask/eth-snap-keyring/pull/311 → accounts-controller, assets-controllers, chain-controller, keyring-controller, transaction-controller

Changelog

@metamask/accounts-controller

### Changed

- Bump `@metamask/snaps-sdk` from `^4.2.0` to `^6.0.1`. ([#3645](https://github.com/MetaMask/core/pull/3645))
- Bump `@metamask/snaps-utils` from `^7.4.0` to `^7.7.1`. ([#3645](https://github.com/MetaMask/core/pull/3645))
- Bump `@metamask/utils` from `^8.3.0` to `^9.0.0`. ([#3645](https://github.com/MetaMask/core/pull/3645))

@metamask/approval-controller

### Changed
- Bump `@metamask/rpc-errors` from `^6.2.1` to `^6.3.1`. ([#3645](https://github.com/MetaMask/core/pull/3645))
- Bump `@metamask/utils` from `^8.3.0` to `^9.0.0`. ([#3645](https://github.com/MetaMask/core/pull/3645))

@metamask/assets-controllers (major)

### Changed

- **BREAKING:** `getIpfsCIDv1AndPath`, `getFormattedIpfsUrl` are now async functions. ([#3645](https://github.com/MetaMask/core/pull/3645))
- Add `immer` `^9.0.6` as a new dependency. ([#3645](https://github.com/MetaMask/core/pull/3645))
- Bump `@metamask/abi-utils` from `^2.0.2` to `^2.0.3`. ([#3645](https://github.com/MetaMask/core/pull/3645))
- Bump `@metamask/rpc-errors` from `^6.2.1` to `^6.3.1`. ([#3645](https://github.com/MetaMask/core/pull/3645))
- Bump `@metamask/utils` from `^8.3.0` to `^9.0.0`. ([#3645](https://github.com/MetaMask/core/pull/3645))
- Bump `multiformats` from `^9.5.2` to `^13.1.0`. ([#3645](https://github.com/MetaMask/core/pull/3645))

@metamask/chain-controller

### Changed

- Bump `@metamask/chain-api` from `^0.1.0` to `^0.1.0`. ([#3645](https://github.com/MetaMask/core/pull/3645))
- Bump `@metamask/snaps-sdk` from `^4.2.0` to `^6.0.1`. ([#3645](https://github.com/MetaMask/core/pull/3645))
- Bump `@metamask/snaps-utils` from `^7.4.0` to `^7.7.1`. ([#3645](https://github.com/MetaMask/core/pull/3645))
- Bump `@metamask/utils` from `^8.3.0` to `^9.0.0`. ([#3645](https://github.com/MetaMask/core/pull/3645))

@metamask/eth-json-rpc-provider

### Changed

- Bump `@metamask/json-rpc-engine` from `^9.0.0` to `^9.0.1`. ([#3645](https://github.com/MetaMask/core/pull/3645))
- Bump `@metamask/utils` from `^8.3.0` to `^9.0.0`. ([#3645](https://github.com/MetaMask/core/pull/3645))

@metamask/json-rpc-engine (patch)

## [9.0.1]

### Changed

- Bump `@metamask/rpc-errors` from `^6.2.1` to `^6.3.1`. ([#3645](https://github.com/MetaMask/core/pull/3645))
- Bump `@metamask/utils` from `^8.3.0` to `^9.0.0`. ([#3645](https://github.com/MetaMask/core/pull/3645))

@metamask/json-rpc-middleware-stream

### Changed

- Bump `@metamask/json-rpc-engine` from `^9.0.0` to `^9.0.1`. ([#3645](https://github.com/MetaMask/core/pull/3645))
- Bump `@metamask/utils` from `^8.3.0` to `^9.0.0`. ([#3645](https://github.com/MetaMask/core/pull/3645))

@metamask/keyring-controller

### Changed

- Bump `@metamask/eth-simple-keyring` from `^6.0.1` to `^6.0.2`. ([#3645](https://github.com/MetaMask/core/pull/3645))
- Bump `@metamask/utils` from `^8.3.0` to `^9.0.0`. ([#3645](https://github.com/MetaMask/core/pull/3645))

@metamask/network-controller (minor)

### Added

- Newly exports the following types: `AutoManagedNetworkClient`, `NetworkClientConfiguration`, `InfuraNetworkClientConfiguration`, `CustomNetworkClientConfiguration`. ([#3645](https://github.com/MetaMask/core/pull/3645))

### Changed 

- Bump `@metamask/rpc-errors` from `^6.2.1` to `^6.3.1`. ([#3645](https://github.com/MetaMask/core/pull/3645))
- Bump `@metamask/utils` from `^8.3.0` to `^9.0.0`. ([#3645](https://github.com/MetaMask/core/pull/3645))

@metamask/permission-controller

### Changed

- Bump `@metamask/json-rpc-engine` from `^9.0.0` to `^9.0.1`. ([#3645](https://github.com/MetaMask/core/pull/3645))
- Bump `@metamask/rpc-errors` from `^6.2.1` to `^6.3.1`. ([#3645](https://github.com/MetaMask/core/pull/3645))
- Bump `@metamask/utils` from `^8.3.0` to `^9.0.0`. ([#3645](https://github.com/MetaMask/core/pull/3645))

@metamask/profile-sync-controller

### Changed

- Bump `@metamask/snaps-sdk` from `^4.2.0` to `^6.0.1`. ([#3645](https://github.com/MetaMask/core/pull/3645))
- Bump `@metamask/snaps-utils` from `^7.4.0` to `^7.7.1`. ([#3645](https://github.com/MetaMask/core/pull/3645))

@metamask/queued-request-controller

### Changed

- Bump `@metamask/rpc-errors` from `^6.2.1` to `^6.3.1`. ([#3645](https://github.com/MetaMask/core/pull/3645))
- Bump `@metamask/utils` from `^8.3.0` to `^9.0.0`. ([#3645](https://github.com/MetaMask/core/pull/3645))

@metamask/rate-limit-controller

### Changed

- Bump `@metamask/rpc-errors` from `^6.2.1` to `^6.3.1`. ([#3645](https://github.com/MetaMask/core/pull/3645))
- Bump `@metamask/utils` from `^8.3.0` to `^9.0.0`. ([#3645](https://github.com/MetaMask/core/pull/3645))

@metamask/signature-controller

### Changed

- Bump `@metamask/rpc-errors` from `^6.2.1` to `^6.3.1`. ([#3645](https://github.com/MetaMask/core/pull/3645))
- Bump `@metamask/utils` from `^8.3.0` to `^9.0.0`. ([#3645](https://github.com/MetaMask/core/pull/3645))

@metamask/transaction-controller

### Changed

- Bump `@metamask/rpc-errors` from `^6.2.1` to `^6.3.1`. ([#3645](https://github.com/MetaMask/core/pull/3645))
- Bump `@metamask/utils` from `^8.3.0` to `^9.0.0`. ([#3645](https://github.com/MetaMask/core/pull/3645))

@metamask/user-operation-controller

### Changed 

- Bump `@metamask/rpc-errors` from `^6.2.1` to `^6.3.1`. ([#3645](https://github.com/MetaMask/core/pull/3645))
- Bump `@metamask/utils` from `^8.3.0` to `^9.0.0`. ([#3645](https://github.com/MetaMask/core/pull/3645))

### Fixed

- Replace `superstruct` with ESM-compatible `@metamask/superstruct` `^3.0.0` ([#3645](https://github.com/MetaMask/snaps/pull/3645))
  - This fixes the issue of this package being unusable by any TypeScript project that uses `Node16` or `NodeNext` as its `moduleResolution` option.

In addition to the above, the changelogs for the following packages need an entry about the @metamask/utils version bump:

address-book-controller, base-controller, build-utils, controller-utils, ens-controller, gas-fee-controller, message-manager, name-controller, notification-controller, permission-log-controller, polling-controller, selected-network-controller

Checklist

  • [x] I've updated the test suite for new or updated code as appropriate
  • [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • [x] I've highlighted breaking changes using the "BREAKING" category above as appropriate

MajorLift avatar Dec 08 '23 21:12 MajorLift

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@babel/[email protected] None 0 262 kB nicolo-ribaudo
npm/@discoveryjs/[email protected] None 0 81.1 kB lahmatiy
npm/@jridgewell/[email protected] None 0 177 kB jridgewell
npm/@metamask/[email protected] None 0 158 kB metamaskbot
npm/@metamask/[email protected] None 0 1.27 MB metamaskbot
npm/@metamask/[email protected] None 0 320 kB metamaskbot
npm/@noble/[email protected] None 0 624 kB paulmillr
npm/@types/[email protected] None 0 6.27 kB types
npm/@types/[email protected] None 0 192 kB types
npm/@types/[email protected] None 0 862 kB types
npm/@webassemblyjs/[email protected] None 0 207 kB xtuc
npm/@webassemblyjs/[email protected] None 0 5.14 kB xtuc
npm/@webassemblyjs/[email protected] None 0 5.4 kB xtuc
npm/@webassemblyjs/[email protected] None 0 10.8 kB xtuc
npm/@webassemblyjs/[email protected] None 0 6.68 kB xtuc
npm/@webassemblyjs/[email protected] None 0 16 kB xtuc
npm/@webassemblyjs/[email protected] None 0 19.7 kB xtuc
npm/@webassemblyjs/[email protected] None 0 3.18 kB xtuc
npm/@webassemblyjs/[email protected] None 0 30.7 kB xtuc
npm/@webassemblyjs/[email protected] None 0 7.31 kB xtuc
npm/@webassemblyjs/[email protected] None 0 34.6 kB xtuc
npm/@webassemblyjs/[email protected] None 0 28.1 kB xtuc
npm/@webassemblyjs/[email protected] None 0 14.4 kB xtuc
npm/@webassemblyjs/[email protected] None 0 129 kB xtuc
npm/@webassemblyjs/[email protected] None 0 39.6 kB xtuc
npm/@webpack-cli/[email protected] None 0 4.55 kB evilebottnawi
npm/@webpack-cli/[email protected] None 0 3.72 kB evilebottnawi
npm/@webpack-cli/[email protected] environment 0 11.6 kB evilebottnawi
npm/@xtuc/[email protected] None 0 8.57 kB xtuc
npm/@xtuc/[email protected] None 0 190 kB xtuc
npm/[email protected] None 0 25.7 kB xtuc
npm/[email protected] None 0 72.9 kB esp
npm/[email protected] None 0 14.2 kB samccone
npm/[email protected] None 0 8 kB jonschlinkert
npm/[email protected] None 0 409 kB connor.peet
npm/[email protected] None 0 17 kB jorgebucaran
npm/[email protected] unsafe 0 210 kB evilebottnawi
npm/[email protected] environment, eval, filesystem, shell 0 162 kB tabrindle
npm/[email protected] None 0 90.6 kB guybedford
npm/[email protected] None 0 21.3 kB ka-weihe
npm/[email protected] None 0 26.6 kB timoxley
npm/[email protected] None 0 18.1 kB nickfitzgerald
npm/[email protected] None 0 21.5 kB phated
npm/[email protected] None 0 7.5 kB jonschlinkert
npm/[email protected] None 0 6.93 kB doowb
npm/[email protected] None 0 22.8 kB doowb
npm/[email protected] eval, filesystem 0 18.4 kB sokra
npm/[email protected] None 0 322 kB npm-service-account-multiformats
npm/[email protected] None 0 298 kB suguru03
npm/[email protected] None 0 8.64 kB phated
npm/[email protected] environment, filesystem 0 277 kB isaacs
npm/[email protected] environment 0 84.8 kB evilebottnawi
npm/[email protected] None 0 16.9 kB redonkulus
npm/[email protected] None 0 9.45 kB jonschlinkert
npm/[email protected] None 0 46.9 kB sokra
npm/[email protected] None 0 88 kB evilebottnawi
npm/[email protected] environment, eval Transitive: filesystem, shell +1 2.25 MB fabiosantoscode
npm/[email protected] None 0 39.2 MB typescript-bot
npm/[email protected] environment, filesystem 0 56.2 kB evilebottnawi
npm/[email protected] environment, filesystem, unsafe Transitive: shell +1 285 kB evilebottnawi
npm/[email protected] None 0 47.9 kB bebraw
npm/[email protected] None 0 91.3 kB sokra
npm/[email protected] environment, filesystem, network, unsafe +1 4.94 MB evilebottnawi
npm/[email protected] None 0 13.5 kB damonoehlman

🚮 Removed packages: npm/@aashutoshrathi/[email protected], npm/@babel/[email protected], npm/@endo/[email protected], npm/@metamask/[email protected], npm/@noble/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/[email protected], npm/[email protected], npm/[email protected]

View full report↗︎

socket-security[bot] avatar Dec 09 '23 00:12 socket-security[bot]

I worked on this a bit and by bumping some packages and also using a local copy of utils which makes use of @metamask/superstruct instead of superstruct, I managed to get yarn build:types working. I created a separate branch and made a commit there with the necessary changes, and you can see the package bumps here: https://github.com/MetaMask/core/commit/df14ce8a9485671cca1460f6a318bb3cfa494219. You'll want to use your own local copy of utils with the use-metamask-superstruct branch checked out (make sure to run yarn build first).

I haven't tried running yarn test yet, so I don't know if that works. I will try that next.

mcmire avatar Mar 14 '24 23:03 mcmire

🚨 Potential security issues detected. Learn more about Socket for GitHub ↗︎

To accept the risk, merge this PR and you will not be notified again.

Alert Package Note
New author npm/[email protected]
New author npm/[email protected]
Network access npm/[email protected]
Network access npm/[email protected]
Network access npm/[email protected]
Shell access npm/[email protected]

View full report↗︎

Next steps

What is new author?

A new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.

Scrutinize new collaborator additions to packages because they now have the ability to publish code into your dependency tree. Packages should avoid frequent or unnecessary additions or changes to publishing rights.

What is network access?

This module accesses the network.

Packages should remove all network access that is functionally unnecessary. Consumers should audit network access to ensure legitimate use.

What is shell access?

This module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.

Packages should avoid accessing the shell which can reduce portability, and make it easier for malicious shell access to be introduced.

Take a deeper look at the dependency

Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support [AT] socket [DOT] dev.

Remove the package

If you happen to install a dependency that Socket reports as Known Malware you should immediately remove it and select a different dependency. For other alert types, you may may wish to investigate alternative packages or consider if there are other ways to mitigate the specific risk posed by the dependency.

Mark a package as acceptable risk

To ignore an alert, reply with a comment starting with @SocketSecurity ignore followed by a space separated list of ecosystem/package-name@version specifiers. e.g. @SocketSecurity ignore npm/[email protected] or ignore all packages with @SocketSecurity ignore-all

socket-security[bot] avatar May 09 '24 15:05 socket-security[bot]