Skip to content

Commit deddbd0

Browse files
committed
Post Revisions: Migrate remaining diff imports, add CHANGELOG entries
Addresses review feedback on #77992 (findings 2, 3, 4, 10). - `preserve-client-ids.js` and `block-compare/index.js` now import `diffArrays` / `diffChars` from the top-level `'diff'` package instead of the deep `'diff/lib/diff/<name>'` paths. v8's `package.json` `exports` map only wildcards `./lib/*.js` (with extension); the bare-folder `./lib/` mapping requires a trailing slash. The deep paths only resolve here because the bundler/Jest resolver fills in `.js` -- a future tooling change could break them. v8 also marks the package `sideEffects: false`, so the historical tree-shaking reason for the deep imports no longer applies. The "diff doesn't tree-shake correctly" comment in `block-compare/index.js` is now stale and gets removed. - Add `### Internal` entries to `packages/editor/CHANGELOG.md` and `packages/block-editor/CHANGELOG.md` recording the major dependency bump.
1 parent ed40824 commit deddbd0

4 files changed

Lines changed: 10 additions & 4 deletions

File tree

packages/block-editor/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66

77
- `BlockManager`: Add stacking context isolation to category list ([#77759](https://github.com/WordPress/gutenberg/pull/77759)).
88

9+
### Internal
10+
11+
- Updated `diff` dependency from `^4.0.2` to `^8.0.3` ([#77992](https://github.com/WordPress/gutenberg/pull/77992)).
12+
913
## 15.18.0 (2026-04-29)
1014

1115
### Enhancements

packages/block-editor/src/components/block-compare/index.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
* External dependencies
33
*/
44
import clsx from 'clsx';
5-
// diff doesn't tree-shake correctly, so we import from the individual
6-
// module here, to avoid including too much of the library
7-
import { diffChars } from 'diff/lib/diff/character';
5+
import { diffChars } from 'diff';
86

97
/**
108
* WordPress dependencies

packages/editor/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## Unreleased
44

5+
### Internal
6+
7+
- Updated `diff` dependency from `^4.0.2` to `^8.0.3` ([#77992](https://github.com/WordPress/gutenberg/pull/77992)).
8+
59
## 14.45.0 (2026-04-29)
610

711
## 14.44.0 (2026-04-15)

packages/editor/src/components/post-revisions-preview/preserve-client-ids.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* External dependencies
33
*/
4-
import { diffArrays } from 'diff/lib/diff/array';
4+
import { diffArrays } from 'diff';
55

66
/**
77
* Preserves clientIds from previously rendered blocks to prevent flashing.

0 commit comments

Comments
 (0)