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

Update swc_core to v0.100.x #49

Closed
wants to merge 9 commits into from
Closed

Update swc_core to v0.100.x #49

wants to merge 9 commits into from

Conversation

kdy1
Copy link
Contributor

@kdy1 kdy1 commented Jul 23, 2024

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.

@wooorm
Copy link
Owner

wooorm commented Jul 23, 2024

Hey! Did this work for you locally? Are you still working on making CI green?

@kdy1
Copy link
Contributor Author

kdy1 commented Jul 23, 2024

I'm not sure how I should modify the hack using SyntaxContext, and that's why I filed this PR.

@wooorm
Copy link
Owner

wooorm commented Jul 23, 2024

what is the hack? 🤔

@kdy1
Copy link
Contributor Author

kdy1 commented Jul 23, 2024

I meant

pub const MAGIC_EXPLICIT_MARKER: u32 = 1337;

@kdy1
Copy link
Contributor Author

kdy1 commented Jul 30, 2024

Can you help remove the hack? The Span does not have SyntaxContext anymore, and if I ignoring explciit_jsx, the test fails

@kdy1
Copy link
Contributor Author

kdy1 commented Jul 30, 2024

Nevermind, I fixed it

@wooorm
Copy link
Owner

wooorm commented Jul 30, 2024

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!

@kdy1 kdy1 marked this pull request as ready for review July 30, 2024 10:51
@kdy1
Copy link
Contributor Author

kdy1 commented Jul 30, 2024

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!

@wooorm
Copy link
Owner

wooorm commented Jul 30, 2024

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!

@wooorm
Copy link
Owner

wooorm commented Jul 31, 2024

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?

@wooorm
Copy link
Owner

wooorm commented Jul 31, 2024

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?

@kdy1
Copy link
Contributor Author

kdy1 commented Jul 31, 2024

I can fix it in SWC. I'll do it tomorrow

@wooorm
Copy link
Owner

wooorm commented Jul 31, 2024

Great, thank you! 🙏

@kdy1
Copy link
Contributor Author

kdy1 commented Aug 1, 2024

@wooorm Do you have a PR for swc upgrade? I merged/published patch in swc-project/swc#9361 but I'm not sure if it's fixed.

@wooorm
Copy link
Owner

wooorm commented Aug 1, 2024

not seeing a release on https://crates.io/crates/swc_core/versions btw? 👀

@wooorm
Copy link
Owner

wooorm commented Aug 1, 2024

PR at wooorm/markdown-rs#120

@kdy1 kdy1 changed the title Update swc_core to v0.99.x Update swc_core to v0.100.x Aug 5, 2024
@wooorm wooorm closed this in b6d961e Aug 5, 2024
@wooorm
Copy link
Owner

wooorm commented Aug 5, 2024

Released, thank you! https://github.com/wooorm/mdxjs-rs/releases/tag/0.2.6

@kdy1 kdy1 deleted the swc-0-99 branch August 5, 2024 12:26
@kdy1
Copy link
Contributor Author

kdy1 commented Aug 5, 2024

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants