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

Module Import Headers #61

Closed
Randy-Buchholz opened this issue May 24, 2020 · 5 comments
Closed

Module Import Headers #61

Randy-Buchholz opened this issue May 24, 2020 · 5 comments

Comments

@Randy-Buchholz
Copy link

I have a related item on the WICG Discourse.
https://discourse.wicg.io/t/proposal-module-import-headers/4467/1

I'm proposing adding headers to the request when the request is for a module. This helps when building handlers on the request pipeline on the server. Though not directly related, this seems to be a case whose implementation could benfit from headers specific to modules.

@littledan
Copy link
Member

This is a good topic to discuss, and we're discussing it in some other issues here, such as #24, e.g., #24 (comment). Ultimately, ECMA-262 isn't going to say which headers are sent to the server--this is up to host environments, like HTML. I'm proposing that we come to a good conclusion on how some of those environments would work before Stage 3, but ultimately, that we will leave it up to them to make these calls. What do you think?

@Randy-Buchholz
Copy link
Author

I'm generally of the same mind about which headers should be sent, and that it should be up to the implementers since in the simplest form (just adding a "import" header item) it isn't something that would show up in the language proper. But I think if a client is expecting a module it would be good manners to let the server know lol.

What I would propose is that in Section 15.2.2 we add an optional "with" clause:

import ImportClause FromClause [WithClause];

This would provide a standardized hook for implementers, and a node for additional specification.

I'm new to the ECMA-262 language specification world and took a look at the specification. To me it reads much like an abstract design. Is there a corresponding "requirements" document? By that I mean something in a form similar to "The language shall...", The language may...". That would be a place to put "recommendations" on what to do with the WithClause.

@littledan
Copy link
Member

The standardized hook for implementers to provide their header is called HostResolveImportedModule . It's where the fetching happens, and the module attributes are passed to it.

@xtuc
Copy link
Member

xtuc commented Jun 12, 2020

To help reach a decision we opened a discussion against the HTML spec whatwg/html#5640.

@nicolo-ribaudo
Copy link
Member

This is done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants