Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

9.0.0 #190

Closed
wants to merge 5 commits into from
Closed

9.0.0 #190

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [9.0.0]
### Changed
- Bump dependency `semver` from `^5.7.1` to `^7.6.0` ([#181](https://github.com/MetaMask/utils/pull/181)).

### Fixed
- **BREAKING:** Replace dependency `superstruct` `^1.0.3` with ESM-compatible `@metamask/superstruct` `^3.0.0` ([#185](https://github.com/MetaMask/utils/pull/185)).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should note why this is breaking? Or is this breaking? I think we still use the same functionality.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's the compare link for the package.json diff between these versions. The exports field and the dual type declaration files are added after we switch to @metamask/superstruct.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or wait would this dependency replacement not be a breaking change even if the dependency contains breaking changes?

Copy link
Contributor

@MajorLift MajorLift Jun 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My intuition is that since superstruct@^1.0.3 broke downstream packages of @metamask/utils by preventing them from being imported into TypeScript projects (e.g. core/*) that use the NodeNext setting for moduleResolution, the fixes introduced by @metamask/superstruct should count as breaking changes.

By that logic, it seems the type declaration files fix might also be a breaking change, since it fixes an issue that was breaking downstream packages, not just directly but also via nested dependencies.

Both of these might count as cases where a fix may need to be announced as a breaking change.

Copy link
Contributor

@mcmire mcmire Jun 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. superstruct is definitely unusable in a project that uses moduleResolution of nodenext, and that means that @metamask/utils is unusable too. So, upgrading this dependency makes @metamask/utils usable again (i.e. it's a fix). So, are there cases where this upgrade would break other kinds of TypeScript projects that currently use @metamask/utils? I don't believe the changes to the exports propagate to @metamask/utils, so people would be able to import it the same way. But, for instance, are there any specific TS compiler settings that a project would no longer be able to use after this upgrade?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good points! I'm finding that reverting the TypeScript version and module, moduleResolution settings on the core v5.0 upgrade PR does cause breakage, but so far I'm mostly seeing errors related to the multiformats dynamic import. I'll try out other compiler options combinations to see if any errors related to @metamask/utils pop up.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't look like the switch to @metamask/superstruct causes any new restrictions for downstream packages. Since there are no breaking changes left, I'll close this PR and create a new minor release.

- Remove chunk files ([#182](https://github.com/MetaMask/utils/pull/182))
- Previously, the build tool we used to generate JavaScript files extracted common code to "chunk" files. While this was intended to make this package more tree-shakeable, it also made debugging more difficult for our development teams. These chunk files are no longer present.
- Produce and export ESM-compatible TypeScript type declaration files in addition to CommonJS-compatible declaration files ([#182](https://github.com/MetaMask/utils/pull/182))
- Previously, this package shipped with only one variant of type declaration files, and these files were only CommonJS-compatible, and the `exports` field in `package.json` linked to these files. This is an anti-pattern and was rightfully flagged by the ["Are the Types Wrong?"](https://arethetypeswrong.github.io/) tool as ["masquerading as CJS"](https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/docs/problems/FalseCJS.md). All of the ATTW checks now pass.

## [8.4.0]
### Added
- Add `toCaipChainId` utility function ([#175](https://github.com/MetaMask/utils/pull/175))
Expand Down Expand Up @@ -223,7 +234,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Initial release

[Unreleased]: https://github.com/MetaMask/utils/compare/v8.4.0...HEAD
[Unreleased]: https://github.com/MetaMask/utils/compare/v9.0.0...HEAD
[9.0.0]: https://github.com/MetaMask/utils/compare/v8.4.0...v9.0.0
[8.4.0]: https://github.com/MetaMask/utils/compare/v8.3.0...v8.4.0
[8.3.0]: https://github.com/MetaMask/utils/compare/v8.2.1...v8.3.0
[8.2.1]: https://github.com/MetaMask/utils/compare/v8.2.0...v8.2.1
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@metamask/utils",
"version": "8.4.0",
"version": "9.0.0",
"description": "Various JavaScript/TypeScript utilities of wide relevance to the MetaMask codebase",
"homepage": "https://github.com/MetaMask/utils#readme",
"bugs": {
Expand Down
Loading