-
Notifications
You must be signed in to change notification settings - Fork 75
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
feat: use xdmEsBuild for all compiling #45
Conversation
…ingle parser for all mdx Co-Authored-By: Gaël Haméon <17253950+gaelhameon@users.noreply.github.com>
Co-Authored-By: Gaël Haméon <17253950+gaelhameon@users.noreply.github.com>
I should explain a bit more about why we need our own plugin. The in-build xdm plugin starts its onLoad function with a call to The only way I can see esbuild doing that is instead of plugins using |
I’m not much of an esbuild export, but I imagine that plugin chaining isn’t that weird of an ask. I was under the impression that esbuild plugins only got file paths. |
Hi @Arcath Thanks for this ! I also made a PR #46 where I simply replace Nevertheless, extracting all the mdx compiling/bundling and putting it in the same place no matter where the data comes from seems like a good idea. On the other hand, using our own plugin means we don't benefit from all the options of the generic xdm plugin. For example, built-in management of multiple extensions: #45 (comment) Maybe we could do this but also leave in the original xdm plugin as a last resort ? |
@wooorm I'm passing it here through the @gaelhameon thanks! I've updated the filter matcher. I went down this route along with your solution as it seemed odd to me that we would be asking users to compile some mdx through our compiler and then other mdx through a different one. We could re-add the xdmESBuild plugin, although since it would most likely need re-configuring when used is it better to document how to do it and let users throw it in if the need it? ping @kentcdodds |
I’m not averse to accepting a |
We could use a |
I checked a couple, and see barely any use of I think |
Or should xdm also support “virtual” modules (https://esbuild.github.io/plugins/#namespaces)? 🤔 (edit: or should that be done with the in memory plugin here?) |
I'll have a play with namespaces, the 2 plugins in this PR are probabbly a good testbed for that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see this change as a definite improvement 👍
I haven't read through the conversation yet, but from what I see this is a ✅ from me :)
Ok, so the thing I like about this change is it means that the configuration people set via |
@kentcdodds my thoughts exactly, the easier we can make it the better. I've been working with namespaces and getting a little stuck with them. It appears that once you have said a file belongs to a namespace all the files it imports also belong to that namespace. This is leaving me a little stuck when it comes to files that esbuild should handle. By the time inMemory is saying "use the file loader" its too late and it wont try. I don't think namespaces work quite how we need them to. If you look at the sample http plugin it see the Thats leaving me thinking short term @wooorm could add support for reading from |
@wooorm Would it be possible to go with a temporary work around whereby the XDM plugin will accept For now |
Yeah, sure! Can you work on it? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good. Breaking change, but that's fine. And I'm happier with this :) Just a few smaller things.
Thanks @wooorm for merging that PR :) This now use your esbuild plugin exclusively! @kentcdodds This is now a breaking change as it removes the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
🎉 This PR is included in version 4.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Big thanks to @gaelhameon for the issue #41 and the code in there that helped me with esbuild! I've added you as a co-author as your fix in #41 was needed here.
Let me know what you think of the code in this PR.
What this does it removes the xdm parsing from
inMemoryPlugin
and puts it into its own plugin. This new plugin can read mdx from the disk and node_moudles fixing #41 and means that there is no need for users to configure xdm for disk files as its all going through one parser now.