-
Notifications
You must be signed in to change notification settings - Fork 323
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 attributes feature post #729
Conversation
Also @nicolo-ribaudo PTAL if you have some time. |
@syg Thanks for the post. It looks good to me. |
src/features/import-attributes.md
Outdated
|
||
Since then, import assertions has evolved into [import attributes](https://github.com/tc39/proposal-import-attributes). The point of the feature remains the same: to allow module import statements to include additional information. | ||
|
||
The most important difference is that import assertions had assert-only semantics, while import attributes has more relaxed semantics. Assert-only semantics means that the additional information as part no effect on _how_ a module is loaded, only on _whether_ it is loaded. For example, a JSON module is always loaded as JSON module by virtue of its MIME type, and the `assert { type: 'json' }` clause can cause loading to fail if the requested module's MIME type is not `application/json`. |
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.
The most important difference is that import assertions had assert-only semantics, while import attributes has more relaxed semantics. Assert-only semantics means that the additional information as part no effect on _how_ a module is loaded, only on _whether_ it is loaded. For example, a JSON module is always loaded as JSON module by virtue of its MIME type, and the `assert { type: 'json' }` clause can cause loading to fail if the requested module's MIME type is not `application/json`. | |
The most important difference is that import assertions had assert-only semantics, while import attributes has more relaxed semantics. Assert-only semantics means that the additional information as part no effect on _how_ a module is loaded, only on _whether_ it can be executed. For example, a JSON module is always loaded as JSON module by virtue of its MIME type, and the `assert { type: 'json' }` clause can cause loading to fail if the requested module's MIME type is not `application/json`. |
Nit, but with assertions even when the module was loaded before checking the assertion, and the assertion only prevented it from being actually "executed" (if we can call execution the conversion of JSON/CSS files into JS values)
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'm going to leave this as is. That level of understanding of "loaded" is not what's intended here, and I think using "executed" in the context of a JSON module, which developers would think of as data instead of code, would be more confusing.
No description provided.