v0.51.0 - #9178
Merged
Merged
v0.51.0#9178
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
etrepum
marked this pull request as ready for review
September 17, 2026 15:32
etrepum
requested review from
acywatson,
fantactuka,
ivailop7,
potatowagon and
zurfyx
as code owners
September 17, 2026 15:32
zurfyx
approved these changes
Sep 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
v0.51.0 is a monthly release with one large new feature: nodes can now declare their JSON serialization as a schema on
$config. This declarative schema is faster, safer, and more flexible than the hand-written methods. The metadata it provides enables a compact export option with all default values elided, the code generator that provides faster import and export for every node that lexical ships, a new@lexical/fast-checkpackage for property-based tests, and it provides a path to future features that rely on knowing the structure of the nodes (e.g. additional codecs and dev tools).This is a big step towards Lexical 1.0, the next few releases are expected to be focused on moving everything (including docs and examples) to the latest Extension and
$configAPIs and removing deprecated functionality. Two related changes in this release are that we are publishing ESM-only to npm now (cjs builds are still supported in the source tree), andLexicalComposeris deprecated forLexicalExtensionComposer. Expect anything@deprecatedto be removed soon.Breaking Changes
"type": "module"and itsexportsmap offersdevelopment/production/defaultconditions with norequirebranch; the CommonJS build remains in-tree only for Meta's www. Bundlers are unaffected. CommonJS code canrequire()the packages on Node.js 20.19+ (the builds have no top-levelawait), and older Node.js must useawait import(...)— but a dependency the app also loads throughrequire()can then exist twice, which breaks handing its objects to Lexical (yjsdocs to@lexical/yjs,@preact/signals-coresignals from@lexical/extension), so load those as ESM too. Metro bundles both builds unless you add the condition for Lexical's packages; see the module formats FAQ (#9127)lexical—exportJSONmay serialize the instance as-is. A property declared withwithFieldis read straight off the node instead of through its accessor, soexportJSONno longer resolvesgetLatest()for you and a stale reference can write stale values (and a property whose accessor a subclass overrode still resolves, so one object can mix the two). Nothing inside Lexical is affected — the walk, the clipboard selection export andeditorState.toJSON()all start from the node map — but callgetLatest()yourself on a reference you kept across a mutation (#8602)@lexical/code— the deprecated Prism re-exports are gone, along with the@lexical/code-prismdependency (so Prism no longer lands in a bundle that only imports@lexical/code). ImportCODE_LANGUAGE_FRIENDLY_NAME_MAP,CODE_LANGUAGE_MAP,getCodeLanguageOptions,getCodeLanguages,getCodeThemeOptions,getLanguageFriendlyName,normalizeCodeLanguage(formerly alsonormalizeCodeLang),PrismTokenizerandregisterCodeHighlightingfrom@lexical/code-prism(#9141)Deprecations
@lexical/react—LexicalComposeris deprecated in favor ofLexicalExtensionComposerand is expected to be removed in a future major.LexicalComposercannot accept extensions, so any feature shipped as one is unreachable from an editor it builds; the migration is usually a two-line change (#9168, React extensions guide)New APIs & Features
lexical— Declarative serialization schemas (experimental). A node that uses$configdeclares its serialized properties once in the newjsonproperty, and that single declaration drivesimportJSON,updateFromJSONandexportJSON:nodeSchema,withField/withAccessors, and the value combinators (stringValue,numberValue,booleanValue,enumValue,arrayValue,objectValue,unionValue,rawValue,transformValue,nullable,optional, …). Every built-in node declares one, and most custom nodes now need no JSON serialization code at all. Output is unchanged by default (#8602, serialization docs).lexical— Compact JSON export, opt-in viaeditorState.toJSON(true)or$withCompactExport(true, cb)(with$isCompactExport()for schema getters, plus$exportNodeJSONand theCompactSerializedEditorState/ParsableSerializedEditorState/LexicalParseJSON/SerializedPartialtypes). It omits properties equal to their schema default, properties the parser derives, and the deprecatedversion. The raw objects are well under half the legacy size — which matters for structured clones and worker messages — but after gzip the two are a wash. Both forms parse back to the same document; only a Lexical new enough to know the schemas can read the compact one, so keep writing the legacy form until every reader is upgraded (#8602)@lexical/compiler— Generated serialization code. Every built-in node class ships straight-line serialization generated from its own schema at build time, producing byte-identical JSON to the schema-driven path that continues to serve custom nodes (#8602)@lexical/fast-check— New package deriving fast-check arbitraries from those schemas:nodeArbitrary(NodeClass)generates exactly the serialized JSON a node's parser accepts, each property independently present or absent. Useful for the bugs fixtures hide, such as a propertyafterCloneFromforgot to copy.fast-checkis a peer dependency;getComposedSchemaFieldsin core inspects a class's schema without generating anything (#8602)@lexical/extension— Published as subpath exports, one entry per extension (@lexical/extension/AutoFocusExtension, …), with compiler and lint enforcement of the source import convention. The barrel import is unchanged, and shared modules such as signals keep a single instance (#9161). This is primarily only useful as a consumer if you are not using tree-shaking.Notable Fixes
Bundling, tree-shaking & types
createCommandno longer retains the editor (#9121), and the remaining module-scope side effects that defeated tree-shaking are gone, with a bare-import residue check now run over every entry (#9124); extension editors build under loose-mode transpilation (#9134)defineExtensionwas uncallable, making the extension types unusable (#9132); declarations can now express an extension with dependencies (#9176); modern variance keywords survive into the www stubs (#9154)Selection & editing
TextNode.setMode,setTextContentandisSimpleTextread the latest state (#9162);$removeTextFromCaretRangeno longer leaves a childless list or table as the root's only child (#9116); a text entity keeps the style and detail of the text it replaces (#9130); selection overlay listeners are notified when rectangles are removed (#9117)Lists, tables & Markdown
$mergeCellsno longer keeps the empty paragraph of the target cell (#9122); text left outside a Markdown link keeps its format (#9131)Playground & docs
Plus the usual dependency updates across the rollup, shikijs, vitest, docusaurus/typedoc and flow/hermes groups.
What's Changed
New Contributors
Full Changelog: v0.50.0...v0.51.0