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 import assertions #17366
Add import assertions #17366
Conversation
javascript/operators/import.json
Outdated
"options": { | ||
"__compat": { | ||
"description": "The second options parameter", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I called it "options" instead of "assertions", because unlike the import
statement, the options here permit any unknown attributes from the start, so other keys won't throw parser errors either. In this case, should "assertions" be separately listed as a subfeature to increase discoverability?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Just a couple of quick updates, and then this will be LGTM!
Co-authored-by: Queen Vinyl Da.i'gyu-Kazotetsu <vinyldarkscratch@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the quick fixes!
Okay that looks hilarious... Also, I'm pretty confident it should be called experimental, since we only have V8 support. |
Experimental set to true sounds good to me! I've opened up #17367 to add v16.14.0 to the browser data, and will merge that promptly so this PR passes! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, we should actually set the second of the three NodeJS statements to partial_implementation
, since there are extra details to note regarding compatibility.
By the way, should we create a subfeature for the json
assertion type? It might be a little easier to represent the fact that NodeJS added support for the type in 16.15.0
and 17.5.0
(AKA 17.0.0
through 17.4.0
did not have support).
It's complicated for JSON modules. IIRC it's unflagged in 17.5, but backported to 16.15. I don't think we've reached resolution on what to do in that case—do we? I also don't plan to address #14053 — just focusing on the syntax in this PR. JSON modules would also involve web API I think. (Again it's complicated.) |
Head branch was pushed to by a user without write access
Co-authored-by: Queen Vinyl Da.i'gyu-Kazotetsu <vinyldarkscratch@gmail.com>
Co-authored-by: Queen Vinyl Da.i'gyu-Kazotetsu <vinyldarkscratch@gmail.com>
In a case like that, I'd say that we should do the following: [
{
"version_added": "17.5.0"
},
{
"version_added": "16.15.0",
"version_removed": "17.0.0"
},
{
"version_added": "17.0.0",
"version_removed": "17.5.0",
"flags": [
{
"type": "runtime_flag",
"name": "--experimental-json-modules"
}
]
},
{
"version_added": "16.0.0",
"version_removed": "16.15.0",
"flags": [
{
"type": "runtime_flag",
"name": "--experimental-json-modules"
}
]
}
] It's kind of messy, especially with the flag data, but it's the best we can do with Node's LTS release cycle. WDYT? |
This problem is kind of non-unique—also present in #15123. Also, do you want to me to do the |
Yeah, it's an ugly solution, but I feel it is a necessary one due to how NodeJS' release cycle works. On the plus side, doing this allows us to better represent exactly which versions support the feature! As for the flag, if you're down to incorporate it, that would be great! Otherwise, no big deal; flags quickly become useless to document once they're no longer needed for a feature. ;P |
Sorry @queengooborg I think I'm a bit lost on this. Could you update the PR in the way you want (or in the form of a suggestion) so we can get to merge this? |
@queengooborg ^^^ Could you please propose fixes as suggestions to unblock this? |
I have proposed a solution already, actually -- see #17366 (comment)! |
The flags data for Node is a bit of a mess—there are two flags: |
I went ahead and pushed the changes I'm looking to see to reduce the back-and-forth and to help get this merged quicker! |
Summary
Fixes #14052, fixes #14053, part of mdn/content#19220
First time doing actual compat data changes... I don't really know how this ought to be done. I don't know if this addresses #14053 either.
Test results and supporting details
See https://v8.dev/features/import-assertions
Node versions are hand-tested.
Related issues