mdxjs-rs
mdxjs-rs copied to clipboard
Update `swc_core` to `v0.99.x `
https://swc.rs/docs/plugin/selecting-swc-core
I found that mdxjs-rs was using a hack based on SyntaxContext, but it's not possible anymore and I'm not sure how should I fix it.
Hey! Did this work for you locally? Are you still working on making CI green?
I'm not sure how I should modify the hack using SyntaxContext, and that's why I filed this PR.
what is the hack? 🤔
I meant https://github.com/wooorm/mdxjs-rs/blob/e07722061f4ac6da3b1c4f09750c05b4d4ef6908/src/hast_util_to_swc.rs#L43
Can you help remove the hack? The Span does not have SyntaxContext anymore, and if I ignoring explciit_jsx, the test fails
Nevermind, I fixed it
Nice! Does that mean you changed SWC to allow some magic number marking again? I see this PR is still a draft, do let me know if I can help / if it’s ready!
Instead of modifying swc back to allow magic number, I introduced FxHashSet<Span> that holds the spans of explicit JSX inputs. And now it's ready for a review. Thank you!
ok, I looked into applying the same updates to markdown-rs too, which has some more parsing tests. Something changed in SWC to make a (correct) test fail there. Will have to investigate tomorrow why that is and what’s needed!
It looks like when I pass " /* " to SWC, it now returns an error for Error { error: (1..1, Eof) }. I need to know that the error is at the end of the input. Seems the positional info of hi is incorrect? Could that be a regression?
Can confirm that I got Error { error: (2..5#0, UnterminatedBlockComment) } before on 0.94.0. It broke in 0.95.0.
Is this something that can be fixed in SWC, that EOF errors “stick” to the end again?
I can fix it in SWC. I'll do it tomorrow
Great, thank you! 🙏
@wooorm Do you have a PR for swc upgrade? I merged/published patch in https://github.com/swc-project/swc/pull/9361 but I'm not sure if it's fixed.
not seeing a release on https://crates.io/crates/swc_core/versions btw? :eyes:
PR at https://github.com/wooorm/markdown-rs/pull/120
Released, thank you! https://github.com/wooorm/mdxjs-rs/releases/tag/0.2.6
Thank you!