Skip to content

Conversation

@manuel3108
Copy link
Member

@manuel3108 manuel3108 commented Oct 26, 2025

This is basically #568 but with a proper pr description and re-implemented from scratch, as the other branch was horribly out of date.

Closes #94
Closes svelte-add/svelte-add#193
Closes svelte-add/svelte-add#507

Relates sveltejs/svelte#16188

This pr is based on #620, since svelte alreday uses esrap@2

Step 1 (support for svelte files):

  • support for svelte specifc html syntax (@attach, self closing component tags, transitions, etc) (NOTE: referenced svelte pr was last updated in june, everything that got released after that is not going to work right now)
  • check and adapt all other usages of parseSvelte (approximately 10 occurences)
  • make generated code from print more readable, probably needs to be done in feat: add print(...) function svelte#16188

Step 2 (reduce deps, different pr probably)

  • we currently use many different libraries for parsing and serializing JS / CSS / HTML. All of that could in theory be handled by svelte/compiler. Check which hoops we need to jump to make that happen. We could potentially drop the following deps:
    • dom-serializer
    • domhandler
    • domutils
    • htmlparser2
    • postcss

@changeset-bot
Copy link

changeset-bot bot commented Oct 26, 2025

⚠️ No Changeset found

Latest commit: b540ab5

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@pkg-pr-new
Copy link

pkg-pr-new bot commented Oct 26, 2025

Open in StackBlitz

npx https://pkg.pr.new/sveltejs/cli/sv@751
npx https://pkg.pr.new/sveltejs/cli/svelte-migrate@751

commit: b540ab5

@manuel3108
Copy link
Member Author

manuel3108 commented Nov 30, 2025

This is ready.

Depending on how good tree-shaking works, this is going to temporarily increase our bundle size. Personally, I wouldn't bother because this is won't be a problem as soon as we tackle step 2 described above in a different PR

Edit: to be merged after #620 as this is the base for everything. Reviewing this after #620 was merged should also dramatically reduce the diff

@manuel3108 manuel3108 marked this pull request as ready for review November 30, 2025 17:07
Copy link
Contributor

@jycouet jycouet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM :)

@manuel3108 manuel3108 merged commit 35b3e02 into main Dec 6, 2025
8 checks passed
@manuel3108 manuel3108 deleted the chore/svelte-compiler-2 branch December 6, 2025 15:22
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.

Use { parse } from 'svelte/compiler' End tags added for self-closing elements HTMLX (aka Svelte's templating language) proper support

3 participants