Skip to content

Upgrade mutative to 2.0.2 - #56

Merged
timtebeek merged 1 commit into
mainfrom
tim/mutative-2
Dec 1, 2026
Merged

timtebeek merged 1 commit into
mainfrom
tim/mutative-2

Conversation

@timtebeek

Copy link
Copy Markdown
Member

This is the downstream counterpart of openrewrite/rewrite#10173, which moved @openrewrite/rewrite to mutative ^2.0.2. Mutative 2.0 keeps the 1.x API and is faster. 1.3.0 is the last 1.x release, and fixes are not being backported. 2.0.2 also fixes a bug that 1.3.0 has: an inner create() that assigns a draft from an outer create() could finalize it early.

The published @openrewrite/rewrite (8.122.0) still declares ^1.3.0, so until the next release npm installs 1.3.0 nested under @openrewrite/rewrite, next to our 2.0.2. openrewrite/rewrite#10173 checked that drafts from the two versions work together, since both mark drafts with the same Symbol.for key.

The only behaviour change 2.0 brings for code like ours is a new development-build warning when create() is given a draft. To find every such call rather than just the first, I patched mutative's dev build so it logs a stack trace on each one instead of warning once, and then ran the tests. No call site turned up, so no source changes are needed.

Verification: npm run build and jest pass, with 26 tests and no draft warnings. package-lock.json was regenerated with npm install --package-lock-only.

@timtebeek
timtebeek marked this pull request as ready for review December 1, 2026 15:33
@timtebeek
timtebeek merged commit 2cc939e into main Dec 1, 2026
2 checks passed
@timtebeek
timtebeek deleted the tim/mutative-2 branch December 1, 2026 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant