Skip to content

[lexical-headless][lexical-html] Bug Fix: Fix entrypoint for @lexical/headless/dom and generalize $generateNodesFromDOM#7859

Merged
etrepum merged 11 commits intofacebook:mainfrom
etrepum:www-browser-entrypoint
Sep 29, 2025
Merged

[lexical-headless][lexical-html] Bug Fix: Fix entrypoint for @lexical/headless/dom and generalize $generateNodesFromDOM#7859
etrepum merged 11 commits intofacebook:mainfrom
etrepum:www-browser-entrypoint

Conversation

@etrepum
Copy link
Copy Markdown
Collaborator

@etrepum etrepum commented Sep 25, 2025

Description

Fixes the issue with the generate package.json for the new lexical-headless DOM module, the browser condition exports had the extensions in the wrong order.

Also generalizes the @lexical/html $generateNodesFromDOM to work with any ParentNode not just a Document, which is useful in situations where the HTML is not being parsed directly from a string (e.g. hydration, or only generating from a subtree of the parsed HTML)

For www it's hard to know if this works being on the outside of haste but this gives the capability to add a special combined .www.cjs entrypoint instaed of the dual .ts + .browser.ts files. It's up to the www dev to come up with these special cases, but I don't think we'll really need more of them than here?

Test plan

Before

Produced code that would require jsdom unconditionally even if not used (e.g. in the browser) when the LexicalHeadlessDom module was loaded.

After

Produces code that requires jsdom conditionally by doing an unholy combination of a specially written entrypoint plus a hack to effectively un-hoist the require.

@vercel
Copy link
Copy Markdown

vercel bot commented Sep 25, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
lexical Ready Ready Preview Comment Sep 26, 2025 11:48pm
lexical-playground Ready Ready Preview Comment Sep 26, 2025 11:48pm

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Sep 25, 2025
@etrepum etrepum changed the title [lexical-headless] Bug Fix: Custom www entrypoint for @lexical/headless/dom [lexical-headless][lexical-html] Bug Fix: Fix entrypoint for @lexical/headless/dom and generalize $generateNodesFromDOM Sep 27, 2025
@etrepum etrepum added this pull request to the merge queue Sep 29, 2025
Merged via the queue into facebook:main with commit ea5cb1d Sep 29, 2025
39 checks passed
@etrepum etrepum deleted the www-browser-entrypoint branch September 29, 2025 18:58
@etrepum etrepum mentioned this pull request Oct 1, 2025
etrepum added a commit to etrepum/lexical that referenced this pull request Oct 21, 2025
github-merge-queue bot pushed a commit that referenced this pull request Oct 27, 2025
Co-authored-by: Christopher Norman <normtronics@gmail.com>
This was referenced Oct 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. extended-tests Run extended e2e tests on a PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants