tree-sitter / tree-sitter-javascript

Javascript grammar for tree-sitter
MIT License
318 stars 107 forks source link

Support import assertions #238

Closed mskelton closed 1 year ago

mskelton commented 1 year ago

This adds support for import assertions which are at stage 3 and experimental in Node. Reading some other issues, I'm not sure this is desired at this stage, but I thought I would throw it out there to at least get thoughts on adding it.

Checklist:

mjambon commented 1 year ago

Hi. Sorry for the slow reaction time. I see that the proposal has been demoted from stage 3 to stage 2:

:warning: This proposal has been demoted from Stage 3 to Stage 2 in January 2023 due to https://github.com/whatwg/html/issues/7233. TC39 is working on a solution, which will require relaxing the "assert only" semantics and potentially changing the syntax. Import assertions have already been shipped in some implementations, consider the current instability when using them.

I suggest we pause until we're more confident that the syntax will stick unless you can make a strong case for it.

mskelton commented 1 year ago

@mjambon Yeah, I'm fine to close this with the change to stage 2.

bennypowers commented 5 months ago

We're back to stage 3 with a new keyword and the feature is called "import attributes" now, instead of "import assertions"

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

Before:

import manifest from './package.json' assert { type: 'json' };

After

import manifest from './package.json' with { type: 'json' };
mskelton commented 5 months ago

@bennypowers Yep, I opened #277 to support import attributes