-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
feat: Expose more AST types from "svelte/compiler"
#14601
Conversation
🦋 Changeset detectedLatest commit: 7971acf The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
preview: https://svelte-dev-git-preview-svelte-14601-svelte.vercel.app/ this is an automated message |
In the meantime, I have a small proposal to add another type: type AttributeLike = Attribute | SpreadAttribute | Directive; EDIT. I went ahead and added it. |
And also, I have another issue: namespace I am not sure which one is the best solution:
EDIT. I went ahead with the 2nd option. |
Thank you! At a high level I think this makes sense. I also think we should probably |
I agree with this sentiment 👍 I wasn't sure if you meant: |
Hm... as an developer using those types at higher level... let me demonstrate with a simple reproduction: https://stackblitz.com/edit/stackblitz-starters-evnjpuos?file=index.js Without |
It'd probably be best to rename it as |
That's true, it is useful to have a union of all the types you might encounter while walking. I did wonder about dividing things up more neatly so that in addition to |
So, given that in the Advent of Svelte you have created some new features to Svelte syntax.
Such as
<svelte:boundary>
andas
in{#each}
block is no longer needed.So, I thought it's time to upgrade
svelte-ast-print
to support printing them too!Firstly, I noticed that type
SvelteBoundary
was not a part ofElementLike
type. Hence I was getting type error (any) when attempting to walk on it usingzimmerframe
.In the meantime, I thought of taking an opportunity to export more types, which I had to manually provide in following places:
So, I've moved those types inside the
AST
namespace.In the meantime I've updaded the codebase where those types are used, with this change - by using
AST
namespace.Before submitting the PR, please make sure you do the following
feat:
,fix:
,chore:
, ordocs:
.packages/svelte/src
, add a changeset (npx changeset
).Tests and linting
pnpm test
and lint the project withpnpm lint