Skip to content

chore: use parse from svelte/compiler #568

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

manuel3108
Copy link
Member

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

This is a pretty rough poc to try and make sv work better with .svelte files. Under the hood, this uses svelte-ast-print

Step 1 (support for svelte files):

  • support for svelte specifc html syntax (@attach, self closing component tags, transitions, etc)
  • check and adapt all other usages of parseSvelte
  • make svelte-ast-print support indentation and quote styles (I think some of that already works)
  • fix formatting mistakes in svelte-ast-print (first write up: fix: formatting for text nodes xeho91/js-ast#128)

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 and svelte-ast-print. Check which hoops we need to jump to make that happen. We could potentially drop the following deps:
    • dom-serializer
    • domhandler
    • domutils
    • htmlparser2
    • postcss

Copy link

changeset-bot bot commented May 18, 2025

⚠️ No Changeset found

Latest commit: 4f84d68

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

@svelte-docs-bot
Copy link

Copy link

pkg-pr-new bot commented May 18, 2025

Open in StackBlitz

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

commit: 4f84d68

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