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

Add ImportAttribute for import attributes (stage 3 Estree) #253

Open
aralroca opened this issue Mar 19, 2024 · 9 comments
Open

Add ImportAttribute for import attributes (stage 3 Estree) #253

aralroca opened this issue Mar 19, 2024 · 9 comments
Assignees

Comments

@aralroca
Copy link

Now that runtimes like Bun supports macros and the proposal is in stage 3 it would be nice to support import attributes.

https://github.com/tc39/proposal-import-attributes

Example in TypeScript:
Screenshot 2024-03-19 at 22 14 21

@3cp
Copy link
Member

3cp commented Mar 20, 2024

Note for implementation

https://github.com/estree/estree/blob/master/stage3/import-attributes.md

EStree which meriyah implements has different definition of this syntax.

@3cp
Copy link
Member

3cp commented Mar 20, 2024

BTW I don't think the typescript screenshot is a correct reference :-)

The typescript parser thinks that's the legacy with statement, not part of the import declaration. You can see they appear as two sibling nodes in the syntax tree.

@aralroca
Copy link
Author

@3cp thanks for the note, yes, the link to Estree is much more useful than the TypeScript image.

@aralroca
Copy link
Author

It will be great to replace the TypeScript parser that I used in this plugin with Meriyah, which is much faster!

https://github.com/aralroca/prerender-macro

@3cp
Copy link
Member

3cp commented Mar 27, 2024

I cannot guarantee a time frame for this feature as I don't have enough bandwidth on open source projects right now. But I will put it on my TODO list :)

@3cp 3cp self-assigned this Mar 27, 2024
@3cp
Copy link
Member

3cp commented Mar 27, 2024

Bun has a native parser. Maybe you can talk to them to expose some APIs. It's probably not in extree syntax, but nothing beats Bun's performance.

the parser in Bun is a Zig port of esbuild's parser.

@aralroca
Copy link
Author

Bun has a native parser. Maybe you can talk to them to expose some APIs. It's probably not in extree syntax, but nothing beats Bun's performance.

the parser in Bun is a Zig port of esbuild's parser.

Yes, I have discussed it several times on discord but I really don't know if they have plans to do it in the short term. Maybe @Jarred-Sumner can confirm

@aralroca aralroca changed the title Add WithStatement for import attributes Add ImportAttribute for import attributes (stage 3 Estree) May 5, 2024
@aralroca
Copy link
Author

aralroca commented Jun 4, 2024

@3cp Is there any news on this? 😊 if I can help in contributing I am open although I am not familiar with it.

@3cp
Copy link
Member

3cp commented Jun 4, 2024

Sorry I have not put on any effort. You are more than welcome to try.

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

No branches or pull requests

2 participants