Skip to content

breaking: use modern-ast#512

Open
dummdidumm wants to merge 6 commits intomasterfrom
modern-ast
Open

breaking: use modern-ast#512
dummdidumm wants to merge 6 commits intomasterfrom
modern-ast

Conversation

@dummdidumm
Copy link
Copy Markdown
Member

Transform the code base to use the modern Svelte AST. Requires Svelte 5.

@mustafa0x
Copy link
Copy Markdown

getVisitorKeys: leaveAlone still includes 'Style', but modern AST uses 'StyleSheet'

In src/embed.ts the traversal stoplist contains 'Style' but not 'StyleSheet'.

  • In modern AST the code now handles case 'StyleSheet': return embedStyle(true);
  • But because 'StyleSheet' isn’t in leaveAlone, Prettier will traverse deep into the CSS AST unnecessarily.

This is probably not correctness-breaking (the embed switch returns null for CSS nodes), but it’s:

  • wasted work on big stylesheets, and
  • a potential recursion/perf footgun.

Suggested change: add 'StyleSheet' and remove 'Style' (unless deliberately keeping a hybrid path, which this PR otherwise removes).

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