Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[plugin] plugin to support WordPress Gutenberg specific blocks features (including how it injects window.React, window.wp.element, etc) within JSX decompilation #151

Open
0xdevalias opened this issue Mar 3, 2025 · 0 comments
Labels
enhancement New feature or request

Comments

@0xdevalias
Copy link
Contributor

0xdevalias commented Mar 3, 2025

Mostly creating this based on the exploration I did in #10 (comment) before I realised it was likely unrelated to more core React / JSX handling.

I suspect the bulk of this is niche enough that it wouldn't make sense to include in core, but would be a good candidate for a plugin as per #143 (comment) / #143 (comment)

This is also aligned to wakaru's proposed module-detection feature:

@j4k0xb I also don't expect this to be something you create; but figured since I already did the deeper exploration in this repo, I may as well create a standalone reference point for it, even if this issue ends up getting closed.


From my prior exploration:

Edit 2: Looking a bit deeper, I think window.wp.element relates more specifically to how the Wordpress Gutenberg editor may inject things:

Specifically in the 'plain JS' usage:

So using window.wp.element would map to a version of @wordpress/element, provided by the backend through the window.wp global:

Whereas in the non-static version, we can see that registerBlockType directly refers to the imported Edit / Save, which seem to handle their own imports, and/or use a JSX transform defined elsewhere in the build chain:

We can also see that the window.React global might come from Wordpress Gutenberg as well, as we can see from this example code that injects it:

We also get another clue here, where again window.React is injected into the function, and then a followup note to that:

So I guess, similar to the comment made in #143 (comment), the deeper specifics of this may belong in a separate plugin instead of webcrack core.

Though.. I do wonder if the window.React (assigned to a variable) usage is generic enough that it might make sense to include in core?

Originally posted by @0xdevalias in #10 (comment)

See Also

@0xdevalias 0xdevalias added the enhancement New feature or request label Mar 3, 2025
@0xdevalias 0xdevalias changed the title [plugin] plugin to support Wordpress Gutenberg specific blocks features (including how it injects window.React, window.wp.element, etc) within JSX decompilation [plugin] plugin to support WordPress Gutenberg specific blocks features (including how it injects window.React, window.wp.element, etc) within JSX decompilation Mar 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant