Repository navigation
[lexical-yjs][lexical-react] Feature: Allow custom Yjs XmlText - #6483
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
size-limit report 📦
|
|
This changes a public API in a backwards incompatible way, so it might be tricky to accept as-is |
Thanks for reviewing @etrepum! I thought about adding another param but I think a object param is probably better for the amount of parameters this function takes. |
|
I don't disagree that an options object probably makes more sense, but this is a module that gets a fair bit of use and I think it's unlikely to get approved without a migration plan that does not immediately break compatibility. I think the other concerns will be around what the use case is (a more concrete description would probably make sense, since there are existing examples that use multiple editors in the same collab without this feature, e.g. sticky notes and comments in the playground), as well as the lack of tests and documentation around the new feature. |
Thanks for the feedback @etrepum. I've updated the API now to receive an additional parameter. |
|
Hey, I have faced the same limitation/issue for multi document environment. Is it still planned to add this feature? EDIT: I saw the refactor of collab plugin. Would be great if specifying field in a ydoc is possible for instance for multiple editors being able to share the source instead of making more connections #7616 |
Review: Allow Custom Yjs XmlTextReviewed by: Navi (AI review assistant for @potatowagon) SummaryAdds an optional What I Verified
Concern
Verdict✅ Safe to approve — clean, minimal API extension with sensible defaults. No regressions possible for existing users. |
potatowagon
left a comment
There was a problem hiding this comment.
Review — Allow Custom Yjs XmlText
Assessment: Needs attention — minimal CI
What I verified:
-
Feature scope: Allows consumers to provide a custom Yjs XmlText instance for collaboration, enabling more flexible Yjs document structures.
-
CI status: Only CLA check passes. No test suite has run — this is the oldest PR in the queue and likely needs a significant rebase.
-
Staleness: Last updated May 29 (likely automated), but the actual code may be quite outdated relative to the current collab infrastructure (especially given the Named Slots PR #8603 which heavily touches Yjs integration).
Recommendation:
Author should rebase and ensure compatibility with current collab architecture. Given the Yjs-related changes in other active PRs, this may need rework.
— via Navi on behalf of potatowagon
## Description Brings the `getXmlText` branch (meta#6483, last updated against main at 472cf68) up to date with current main. The three files the PR touched all conflicted, and are resolved to main's content: - `Bindings.ts`: main has since replaced the positional `createBinding` with the `createYjsBinding({...})` options object (plus `rootName`, the V2 binding, and the shared `createBaseBinding`), so the PR's positional `getXmlText` parameter no longer applies. - `LexicalCollaborationPlugin.tsx`: main's plugin creates the binding through `createYjsBinding` with a `rootName` prop and a create-once effect guard. - `LexicalYjs.js.flow`: the PR declared `getXmlText` as `createBinding`'s fourth parameter and dropped `excludedProperties`, which does not match the TypeScript signature; main's declaration is kept. The feature the PR asked for is re-applied on top of this merge in an API-compatible form. ## Test plan The merge itself makes no code change: the resulting tree is identical to `origin/main`. ``` $ git diff origin/main --stat (no output) ```
… to a Yjs XmlText that is not a top-level shared type ## Description `createYjsBinding` resolves its root as `doc.get(rootName, XmlText)`, so an editor can only be bound to a top-level shared type of the Yjs `Doc` (`rootName` chooses which one). Applications that keep many independently editable documents in a single `Doc` — collaborative sticky notes, comment threads — store each body as an `XmlText` nested in a `Y.Map` or `Y.Array`, which `rootName` cannot express (meta#6483 asked for this by changing `createBinding`'s positional signature). This adds an optional `getXmlText: (doc: Doc) => XmlText` to `CreateYjsBindingOptions` and to the `CollaborationPlugin` props, resolving the root from the `Doc` when given and taking precedence over `rootName`. Both are additive optional fields on existing option/prop objects, so the positional `createBinding` signature, the default `'root'` behavior and every existing caller are unchanged. Also declares `createYjsBinding`/`CreateYjsBindingOptions` in the Flow types, which had not been updated when the options-object API was added, and documents both `rootName` and `getXmlText` in the React collaboration docs. ## Test plan ### Before New tests in `packages/lexical-yjs/src/__tests__/unit/CreateYjsBinding.test.ts` against the unchanged `Bindings.ts` — the option is ignored, so the binding falls back to the top-level `root`: ``` $ npx vitest --project unit --no-watch packages/lexical-yjs/src/__tests__/unit/CreateYjsBinding.test.ts × uses an XmlText that is not a top-level shared type 36ms × takes precedence over rootName 19ms × a nested root round-trips to another client 7ms AssertionError: expected YXmlText{ _item: null, …(10) } to be YXmlText{ _item: Item{ …(11) }, …(9) } // Object.is equality AssertionError: expected YXmlText{ _item: null, …(10) } to be YXmlText{ _item: Item{ …(11) }, …(9) } // Object.is equality AssertionError: expected 0 to be greater than 0 Test Files 1 failed (1) Tests 3 failed | 5 passed (8) ``` ### After ``` $ npx vitest --project unit --no-watch packages/lexical-yjs packages/lexical-react/src/__tests__/unit/Collaboration Test Files 12 passed (12) Tests 121 passed (121) $ pnpm run tsc > tsc $ pnpm run flow No errors! $ npx eslint packages/lexical-yjs/src/Bindings.ts packages/lexical-react/src/LexicalCollaborationPlugin.tsx packages/lexical-yjs/src/__tests__/unit/CreateYjsBinding.test.ts (no output) $ npx prettier --check <changed files> Checking formatting... All matched files use Prettier code style! ``` E2E and browser suites were not exercised for this change; it is covered by unit tests only. Co-Authored-By: Claude <[email protected]>
…or to a Yjs XmlElement that is not a top-level shared type
## Description
`createBindingV2__EXPERIMENTAL` resolves its root as
`doc.get(rootName, XmlElement)`, so a V2 editor can only be bound to a
top-level shared type of the Yjs `Doc`. This is the V2 counterpart of the
`getXmlText` option added for V1: applications that keep many independently
editable documents in one `Doc` store each body nested in a `Y.Map` or
`Y.Array`, which `rootName` cannot express.
This adds an optional `getXmlElement: (doc: Doc) => XmlElement` to the V2
binding options, to `useYjsCollaborationV2__EXPERIMENTAL` and to
`CollaborationPluginV2__EXPERIMENTAL`, taking precedence over `rootName` when
given. The inline options type is now the exported (structurally identical)
`CreateBindingV2Options__EXPERIMENTAL`, so the positional signature, the
default `'root-v2'` behavior and every existing caller are unchanged.
V2 identifies the root by node name (`isRootElement` checks for yjs's default
`'UNDEFINED'`) rather than by attachment, so a nested `new XmlElement()` is
already handled by the sync and snapshot paths; the constraint is documented on
the option. `createBindingV2__EXPERIMENTAL` is also declared in the Flow types,
which had no declaration for it.
## Test plan
### Before
New tests in `packages/lexical-yjs/src/__tests__/unit/CreateYjsBinding.test.ts`
against the unchanged `Bindings.ts` — the option is ignored, so the binding
falls back to the top-level `root-v2`:
```
$ npx vitest --project unit --no-watch packages/lexical-yjs/src/__tests__/unit/CreateYjsBinding.test.ts
× uses an XmlElement that is not a top-level shared type 22ms
× takes precedence over rootName 11ms
× a nested root round-trips to another client 7ms
AssertionError: expected YXmlElement{ _item: null, …(10) } to be YXmlElement{ …(11) } // Object.is equality
AssertionError: expected YXmlElement{ _item: null, …(10) } to be YXmlElement{ …(11) } // Object.is equality
AssertionError: expected 0 to be greater than 0
Test Files 1 failed (1)
Tests 3 failed | 8 passed (11)
```
### After
```
$ npx vitest --project unit --no-watch packages/lexical-yjs packages/lexical-react/src/__tests__/unit/Collaboration
Test Files 12 passed (12)
Tests 124 passed (124)
$ pnpm run tsc
> tsc
$ pnpm run flow
Running Flow...
No errors!
$ pnpm run build-types
> tsc -p ./tsconfig.build.json && node ./scripts/validate-tsc-types.mjs
$ npx eslint <changed ts/tsx files>
(no output)
$ npx prettier --check <changed files>
Checking formatting...
All matched files use Prettier code style!
```
E2E and browser suites were not exercised for this change; it is covered by
unit tests only.
Co-Authored-By: Claude <[email protected]>
…ts are validated, fixed for the binding's life, and scoped for cursors
## Description
Follow-up to the `getXmlText` / `getXmlElement` root resolvers, fixing five
problems a review of them turned up.
The root a binding uses is fixed for its lifetime — nothing reloads a mounted
editor from another root — but both plugins let a changed resolver reach the
binding. In V1 the effect that creates the binding is guarded by a ref that is
never reset, so a changed `getXmlText` destroyed the binding in cleanup and then
early-returned without building a replacement; the editor kept running against a
binding whose `collabNodeMap` had been emptied, which silently stops publishing
the caret of every node that predates the change. In V2 the binding really was
rebuilt on the new root, and since nothing loads that root's state into the
editor, the next local update serialized the previous document over it — losing
whatever the new root already contained. Both plugins now read the root
selection (`rootName` and the resolver) once, when the binding is created, via a
`useInitialValue` helper; to edit a different document, remount the plugin with
a React `key`, which the docs now say.
The resolvers themselves ran unchecked. `createYjsBinding` now requires the
returned `XmlText` to be an `XmlText` integrated into the same `Doc`, so a root
that could not be resolved (reaching into a `Y.Array` the provider has not synced
yet) or one that was never inserted fails with an invariant instead of a
`TypeError` from deep inside the sync code. `createBindingV2__EXPERIMENTAL`
checks the same, plus the previously documented-but-unenforced requirement that
the root have yjs's default `'UNDEFINED'` node name — an element created as
`new XmlElement('note')` used to bind fine and then throw `node name mismatch!`
locally, or `Node note is not registered` on the peer that received it. The
node name is now the shared `ROOT_NODE_NAME` constant rather than a literal in
`SyncV2`.
Finally, V1 cursor resolution was not scoped to the binding's own tree. With
several editors in one `Doc`, `sharedType._collabNode` holds whichever binding
materialized that type, so a peer editing note B resolved to a `NodeKey` from
note B's editor and note A painted a remote caret at whatever node happens to
carry that key. `getCollabNodeAndOffset` now walks to the collab node's root and
ignores anything outside this binding. V2 resolves through its own per-binding
mapping and was already scoped.
## Test plan
### Before
```
$ npx vitest --project unit --no-watch packages/lexical-yjs/src/__tests__/unit/CreateYjsBinding.test.ts packages/lexical-yjs/src/__tests__/unit/SyncCursorsSharedDoc.test.ts packages/lexical-react/src/__tests__/unit/LexicalCollaborationPlugin.test.tsx
× a peer editing another editor's root does not resolve in this editor 21ms
× rejects a root that is not integrated into the doc 8ms
× rejects a root that could not be resolved 4ms
× rejects a root that is not integrated into the doc 1ms
× rejects a root created with a nodeName 2ms
× changing getXmlText leaves the mounted editor on its own root 21ms
× changing getXmlElement leaves the mounted V2 editor on its own root 16ms
AssertionError: expected null not to be null
AssertionError: expected 2 to be +0 // Object.is equality
AssertionError: expected [Function] to throw an error
AssertionError: expected [Function] to throw error including 'getXmlText must return an XmlText' but got 'Cannot set properties of undefined (s…'
AssertionError: expected [Function] to throw an error
AssertionError: expected [Function] to throw an error
AssertionError: expected '14' to be null
Test Files 3 failed (3)
Tests 7 failed | 18 passed (25)
```
`expected 2 to be +0` is the V2 data loss (the other note received this
editor's content); `expected '14' to be null` is the foreign node key a peer's
caret resolved to in the wrong editor.
### After
```
$ npx vitest --project unit --no-watch packages/lexical-yjs/src/__tests__/unit/CreateYjsBinding.test.ts packages/lexical-yjs/src/__tests__/unit/SyncCursorsSharedDoc.test.ts packages/lexical-react/src/__tests__/unit/LexicalCollaborationPlugin.test.tsx
Test Files 3 passed (3)
Tests 25 passed (25)
$ pnpm run test-unit
Test Files 312 passed (312)
Tests 5650 passed | 1 skipped (5651)
$ pnpm run tsc
> tsc
$ pnpm run flow
No errors!
$ pnpm run build-types
> tsc -p ./tsconfig.build.json && node ./scripts/validate-tsc-types.mjs
$ npx eslint <changed ts/tsx files>
(no output)
$ npx prettier --check <changed files>
Checking formatting...
All matched files use Prettier code style!
```
E2E and browser suites were not exercised for this change; it is covered by
unit tests only.
Co-Authored-By: Claude <[email protected]>
…by shared type, build the binding once, and correct the root docs
## Description
Follow-up to the custom-root work, fixing what a second review of it found.
Scoping V1 cursor resolution to the binding by walking the collab node's
`_parent` chain was wrong: `CollabElementNode.destroy` does not clear
`sharedType._collabNode`, and `$getOrInitCollabNodeFromSharedType` reuses a
cached collab node without re-parenting it, so after a binding is rebuilt over a
root that an earlier binding materialized, the chain still ends at the old
binding's root and *every* remote cursor silently stopped rendering. The check
now walks the yjs type tree (`sharedType.parent` up to the binding's root shared
type), which describes where the position actually is and does not depend on
collab-node bookkeeping. Cross-editor positions are still rejected.
Freezing the root props at first render was also wrong for V1: the binding is
created on a later effect pass (the first returns early while the provider is
still unset), so a root that only resolves after mount was dropped and the
editor bound to the default `root`. The effect now reads `rootName`,
`getXmlText` and `excludedProperties` on the pass that creates the binding and
leaves them out of its dependencies, and destroying the binding moved to its own
binding-keyed effect — as the creation effect's cleanup, any input change tore
the binding down without building a replacement.
The V2 binding moved from `useMemo` to a lazily initialized `useState`. A memo
is a hint React may discard, and its inputs included an inline
`excludedProperties` map, so `getXmlElement` — a callback the docs invite you to
create shared types in — re-ran on every render and handed the editor a binding
the next update would overwrite the root with.
Finally the documentation: the V2 JSDoc and `react.md` both claimed the "root is
not shared with another binding" constraint was checked, which it is not (and
cannot be, since a legitimate rebuild reuses the same root). Both now say what
is checked and what the caller must guarantee, note that a resolver must be
idempotent because it can run more than once, give each editor its own `id`
(the id keys the page-wide document map and cursor-highlight registry), and put
the switch-documents `key` on the component that owns the editor rather than on
the plugin — remounting the plugin alone leaves the previous document's content
in the editor, which then lands in the newly selected root.
## Test plan
### Before
```
$ npx vitest --project unit --no-watch packages/lexical-yjs/src/__tests__/unit/SyncCursorsSharedDoc.test.ts packages/lexical-react/src/__tests__/unit/LexicalCollaborationPlugin.test.tsx
× a binding rebuilt over an already-materialized root still resolves 10ms
× a root that only resolves after mount is still used 21ms
× re-rendering does not re-run the V2 root resolver 14ms
AssertionError: expected '' to contain 'hello'
AssertionError: expected "vi.fn()" to be called 1 times, but got 3 times
AssertionError: expected null to be '21' // Object.is equality
Test Files 2 failed (2)
Tests 3 failed | 10 passed (13)
```
`expected null to be '21'` is the remote cursor that stopped resolving after the
binding was rebuilt.
### After
```
$ npx vitest --project unit --no-watch packages/lexical-yjs/src/__tests__/unit/SyncCursorsSharedDoc.test.ts packages/lexical-react/src/__tests__/unit/LexicalCollaborationPlugin.test.tsx
Test Files 2 passed (2)
Tests 13 passed (13)
$ pnpm run test-unit
Test Files 312 passed (312)
Tests 5653 passed | 1 skipped (5654)
$ pnpm run tsc
> tsc
$ pnpm run flow
No errors!
$ pnpm run build-types
> tsc -p ./tsconfig.build.json && node ./scripts/validate-tsc-types.mjs
$ npx eslint <changed ts/tsx files>
(no output)
$ npx prettier --check <changed files>
Checking formatting...
All matched files use Prettier code style!
```
E2E and browser suites were not exercised for this change; it is covered by
unit tests only.
Co-Authored-By: Claude <[email protected]>
…yj' into flavio/add-yjs-get-xml-text
…havior changes and deprecations into CHANGELOG.md for v0.23 to v0.52, add an Upgrading page ## Description Depends on the changesets tooling in #9357. Past versions in CHANGELOG.md only list commits, so someone upgrading from an older version cannot find what broke, or how to migrate, without reading every GitHub release. Future versions get curated sections from changesets; this gives v0.23.0 to v0.52.0 the same sections. - Every version from v0.23.0 to v0.52.0 now starts with `### Breaking changes` (35 entries), `### Behavior changes` (43) and `### Deprecations` (29), each with packages and a PR link. The existing lines are kept, unchanged, under `### All changes` (the diff only adds lines). - Rule, stated in the preamble: a breaking change needs a code change (an API removed or renamed, a type that no longer checks, a call that now throws) and has `Detect:` and `Migration:`. A behavior change keeps building but behaves or renders differently and has `Verify:`. The entries come from a verified inventory of those releases, which marked each change as manual, mechanical, or runtime-only ("no type or build error points at it"). Runtime-only entries are behavior changes, except #7341 (now throws) and #8603 (a signature change), which stay breaking. - v0.50.0: the items its release notes list as "Behavior Changes to Watch" (#8765, #8908, #8884, #9059, #9061, #8940, #8283) are behavior changes; the listener return-type tightening (#8990), the new invariants (#6483) and the two items the release called breaking (#8938, #8995) stay breaking. Checked against the v0.50.0 release notes. - Added the v0.42.0 removal of `@lexical/react/LexicalContextMenuPlugin` (#8199; present in the v0.41.0 tag, absent in v0.42.0). - Deprecations come from a pass over every `@deprecated` tag added between consecutive tags v0.22.0 to v0.52.0, each checked against the previous tag and attributed with `git log -S`. Each has `Replacement:` and `Removal:`: the version that removed it, "no earlier than v0.53.0" for the ones #9316 removes after v0.52.0, otherwise "not scheduled". Skipped: tags that only moved (`trimTextContentFromAnchor`, deprecated before v0.23.0) or restated earlier ones (v0.46.0 `HorizontalRulePlugin`, v0.51.0 `getScrollParent`), and the v0.47.0 `applyFormatToDom` deprecation that v0.48.0 reversed. - Entries that mixed a breaking change and a deprecation are split with no double counting (#7357, #8360, #8661); #8350 and #8662 only deprecated aliases, so they are listed under Deprecations alone. - `docs/upgrading.md` ("Upgrading" in the sidebar) is a short page: upgrade all packages together, read CHANGELOG.md between your version and the target (also at `node_modules/lexical/CHANGELOG.md`) or print that range, and a copy-paste `AGENTS.md` snippet that points coding agents at the installed changelog. Nothing is installed automatically. - The repository CHANGELOG.md test checks every backfilled entry: `Detect:` and `Migration:` on breaking changes, `Verify:` on behavior changes, `Replacement:` and a valid `Removal:` on deprecations, a PR link on all. ## Test plan ### Before ``` $ pnpm run changelog:range -- --from 0.49.0 --breaking Note: v0.50.0, v0.51.0, v0.52.0 have no curated sections (the changelog only lists their commits), so --breaking cannot show what changed there. Run without --breaking to read them in full. No breaking changes, behavior changes or deprecations recorded after 0.49.0. ``` ### After ``` $ git diff --numstat --diff-algorithm=patience HEAD~1 -- CHANGELOG.md 1412 0 CHANGELOG.md $ pnpm run changelog:range -- --from 0.49.0 --breaking | grep '^## \|^### ' ## v0.50.0 (2026-09-02) ### Breaking changes ### Behavior changes ### Deprecations ## v0.51.0 (2026-09-17) ### Breaking changes ### Deprecations ## v0.52.0 (2026-09-27) ### Breaking changes ### Behavior changes ### Deprecations $ pnpm run changelog:range -- --from 0.49.0 --to 0.50.0 --breaking --json # (kind, [(pr, behavior)]) [('breaking', [(8938, False), (8995, False), (8990, False), (6483, False)]), ('behavior', [(8765, True), (8908, True), (8884, True), (9059, True), (9061, True), (8940, True), (8283, True)]), ('deprecation', [(8918, False)])] $ pnpm run test-unit scripts/__tests__/unit/changelog.test.ts scripts/__tests__/unit/changesets.test.ts Tests 63 passed (63) $ pnpm -C packages/lexical-website run docusaurus build [SUCCESS] Generated static files in "build". ```
…havior changes and deprecations into CHANGELOG.md for v0.23 to v0.52, add an Upgrading page ## Description Depends on the changesets tooling in #9357. Past versions in CHANGELOG.md only list commits, so someone upgrading from an older version cannot find what broke, or how to migrate, without reading every GitHub release. Future versions get curated sections from changesets; this gives v0.23.0 to v0.52.0 the same sections. - Every version from v0.23.0 to v0.52.0 now starts with `### Breaking changes` (35 entries), `### Behavior changes` (43) and `### Deprecations` (29), each with packages and a PR link. The existing lines are kept, unchanged, under `### All changes` (the diff only adds lines). - Rule, stated in the preamble: a breaking change needs a code change (an API removed or renamed, a type that no longer checks, a call that now throws) and has `Detect:` and `Migration:`. A behavior change keeps building but behaves or renders differently and has `Verify:`. The entries come from a verified inventory of those releases, which marked each change as manual, mechanical, or runtime-only ("no type or build error points at it"). Runtime-only entries are behavior changes, except #7341 (now throws) and #8603 (a signature change), which stay breaking. - v0.50.0: the items its release notes list as "Behavior Changes to Watch" (#8765, #8908, #8884, #9059, #9061, #8940, #8283) are behavior changes; the listener return-type tightening (#8990), the new invariants (#6483) and the two items the release called breaking (#8938, #8995) stay breaking. Checked against the v0.50.0 release notes. - Added the v0.42.0 removal of `@lexical/react/LexicalContextMenuPlugin` (#8199; present in the v0.41.0 tag, absent in v0.42.0). - Deprecations come from a pass over every `@deprecated` tag added between consecutive tags v0.22.0 to v0.52.0, each checked against the previous tag and attributed with `git log -S`. Each has `Replacement:` and `Removal:`: the version that removed it, "no earlier than v0.53.0" for the ones #9316 removes after v0.52.0, otherwise "not scheduled". Skipped: tags that only moved (`trimTextContentFromAnchor`, deprecated before v0.23.0) or restated earlier ones (v0.46.0 `HorizontalRulePlugin`, v0.51.0 `getScrollParent`), and the v0.47.0 `applyFormatToDom` deprecation that v0.48.0 reversed. - Entries that mixed a breaking change and a deprecation are split with no double counting (#7357, #8360, #8661); #8350 and #8662 only deprecated aliases, so they are listed under Deprecations alone. - `docs/upgrading.md` ("Upgrading" in the sidebar) is a short page: upgrade all packages together, read CHANGELOG.md between your version and the target (also at `node_modules/lexical/CHANGELOG.md`) or print that range, and a copy-paste `AGENTS.md` snippet that points coding agents at the installed changelog. Nothing is installed automatically. - The repository CHANGELOG.md test checks every backfilled entry: `Detect:` and `Migration:` on breaking changes, `Verify:` on behavior changes, `Replacement:` and a valid `Removal:` on deprecations, a PR link on all. ## Test plan ### Before ``` $ pnpm run changelog:range -- --from 0.49.0 --breaking Note: v0.50.0, v0.51.0, v0.52.0 have no curated sections (the changelog only lists their commits), so --breaking cannot show what changed there. Run without --breaking to read them in full. No breaking changes, behavior changes or deprecations recorded after 0.49.0. ``` ### After ``` $ git diff --numstat --diff-algorithm=patience HEAD~1 -- CHANGELOG.md 1412 0 CHANGELOG.md $ pnpm run changelog:range -- --from 0.49.0 --breaking | grep '^## \|^### ' ## v0.50.0 (2026-09-02) ### Breaking changes ### Behavior changes ### Deprecations ## v0.51.0 (2026-09-17) ### Breaking changes ### Deprecations ## v0.52.0 (2026-09-27) ### Breaking changes ### Behavior changes ### Deprecations $ pnpm run changelog:range -- --from 0.49.0 --to 0.50.0 --breaking --json # (kind, [(pr, behavior)]) [('breaking', [(8938, False), (8995, False), (8990, False), (6483, False)]), ('behavior', [(8765, True), (8908, True), (8884, True), (9059, True), (9061, True), (8940, True), (8283, True)]), ('deprecation', [(8918, False)])] $ pnpm run test-unit scripts/__tests__/unit/changelog.test.ts scripts/__tests__/unit/changesets.test.ts Tests 63 passed (63) $ pnpm -C packages/lexical-website run docusaurus build [SUCCESS] Generated static files in "build". ```
…havior changes and deprecations into CHANGELOG.md for v0.23 to v0.52, add an Upgrading page Depends on the changesets tooling in #9357. Past versions in CHANGELOG.md only list commits, so someone upgrading from an older version cannot find what broke, or how to migrate, without reading every GitHub release. Future versions get curated sections from changesets; this gives v0.23.0 to v0.52.0 the same sections. - Every version from v0.23.0 to v0.52.0 now starts with `### Breaking changes` (35 entries), `### Behavior changes` (43) and `### Deprecations` (29), each with packages and a PR link. The existing lines are kept, unchanged, under `### All changes` (the diff only adds lines). - Rule, stated in the preamble: a breaking change needs a code change (an API removed or renamed, a type that no longer checks, a call that now throws) and has `Detect:` and `Migration:`. A behavior change keeps building but behaves or renders differently and has `Verify:`. The entries come from a verified inventory of those releases, which marked each change as manual, mechanical, or runtime-only ("no type or build error points at it"). Runtime-only entries are behavior changes, except #7341 (now throws) and #8603 (a signature change), which stay breaking. - v0.50.0: the items its release notes list as "Behavior Changes to Watch" (#8765, #8908, #8884, #9059, #9061, #8940, #8283) are behavior changes; the listener return-type tightening (#8990), the new invariants (#6483) and the two items the release called breaking (#8938, #8995) stay breaking. Checked against the v0.50.0 release notes. - Added the v0.42.0 removal of `@lexical/react/LexicalContextMenuPlugin` (#8199; present in the v0.41.0 tag, absent in v0.42.0). - Deprecations come from a pass over every `@deprecated` tag added between consecutive tags v0.22.0 to v0.52.0, each checked against the previous tag and attributed with `git log -S`. Each has `Replacement:` and `Removal:`: the version that removed it, "no earlier than v0.53.0" for the ones #9316 removes after v0.52.0, otherwise "not scheduled". Skipped: tags that only moved (`trimTextContentFromAnchor`, deprecated before v0.23.0) or restated earlier ones (v0.46.0 `HorizontalRulePlugin`, v0.51.0 `getScrollParent`), and the v0.47.0 `applyFormatToDom` deprecation that v0.48.0 reversed. - Entries that mixed a breaking change and a deprecation are split with no double counting (#7357, #8360, #8661); #8350 and #8662 only deprecated aliases, so they are listed under Deprecations alone. - `docs/upgrading.md` ("Upgrading" in the sidebar) is a short page: upgrade all packages together, read CHANGELOG.md between your version and the target (also at `node_modules/lexical/CHANGELOG.md`) or print that range, and a copy-paste `AGENTS.md` snippet that points coding agents at the installed changelog. Nothing is installed automatically. - The repository CHANGELOG.md test checks every backfilled entry: `Detect:` and `Migration:` on breaking changes, `Verify:` on behavior changes, `Replacement:` and a valid `Removal:` on deprecations, a PR link on all. ``` $ pnpm run changelog:range -- --from 0.49.0 --breaking Note: v0.50.0, v0.51.0, v0.52.0 have no curated sections (the changelog only lists their commits), so --breaking cannot show what changed there. Run without --breaking to read them in full. No breaking changes, behavior changes or deprecations recorded after 0.49.0. ``` ``` $ git diff --numstat --diff-algorithm=patience HEAD~1 -- CHANGELOG.md 1412 0 CHANGELOG.md $ pnpm run changelog:range -- --from 0.49.0 --breaking | grep '^## \|^### ' $ pnpm run changelog:range -- --from 0.49.0 --to 0.50.0 --breaking --json # (kind, [(pr, behavior)]) [('breaking', [(8938, False), (8995, False), (8990, False), (6483, False)]), ('behavior', [(8765, True), (8908, True), (8884, True), (9059, True), (9061, True), (8940, True), (8283, True)]), ('deprecation', [(8918, False)])] $ pnpm run test-unit scripts/__tests__/unit/changelog.test.ts scripts/__tests__/unit/changesets.test.ts Tests 63 passed (63) $ pnpm -C packages/lexical-website run docusaurus build [SUCCESS] Generated static files in "build". ```
Description