Export functions for each phase#60
Merged
wooorm merged 4 commits intowooorm:mainfrom Jan 30, 2025
Merged
Conversation
Owner
|
Hi! Why do that second part in hast, here, and not in swc when you get that later? It would probably be good to land mdx-js/mdx@e12f307 plus mdx-js/mdx@2c511a4 here. Would be easier to split this PR up into 2? I’m 👍 on half, but not sure about changing hast like this |
1079555 to
9f076c2
Compare
Contributor
Author
|
Yeah I can do that. I had to split out |
Contributor
Author
|
@wooorm lmk if there's anything else you want me to do here! |
wooorm
approved these changes
Jan 30, 2025
Owner
wooorm
left a comment
There was a problem hiding this comment.
Thanks for your patience and your work!
Owner
|
thank you, released in |
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.
Similar to #27 but with updated function names based on PR comments. In Parcel, we're looking to implement native support for MDX in Rust, and we'd like to avoid re-parsing since we already use SWC. See parcel-bundler/parcel#10064
Second commit may be more controversial. Basically I need a way to embed JSX expressions into Hast element nodes. In Parcel, we want to collect dependencies in MDX, e.g. image references and links. To do this, we need to transform<img src="foo.png" />into<img src={new URL('foo.png', import.meta.url).toString()} />. TheURLconstructor creates a dependency in later stages.I tried converting theNode::Elementinto aNode::MdxJsxElementin order to do this, but this gets treated as an "explicit" JSX element and no longer uses the injected_components.img. Simplest way to implement this was to add a JSX expression variant toPropertyValuebut I could change it if there's a better way.