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

Verbosity/synchronization challenges #20

Open
bmeck opened this issue Nov 8, 2019 · 7 comments
Open

Verbosity/synchronization challenges #20

bmeck opened this issue Nov 8, 2019 · 7 comments

Comments

@bmeck
Copy link
Member

bmeck commented Nov 8, 2019

Both URL band and source text band solutions require potentially large duplication of these attributes. This is a challenge as it increases shipping size for web, which is the primary target of this proposal, and means keeping all location of the attributes in sync. Additionally, if the attributes are in multiple locations due to using a solution that allows/requires such, it should clarify how mismatches are resolved.

Example given a URL band solution:

// x.mjs
import a from 'import+json://foo.json';
import b from 'import+javascript://foo.json';
import c from 'import://foo.json';

// y.mjs
import d from 'import+json://foo.json';

Could all 3 in x.mjs succeed? They have separate request URLs in web spec terms, so it seems like they would resolve independently.

I think solving for the verbosity impacts synchronization of these in non-trivial ways. E.g. SRI being defined per source text would mean invalidating the whole dep graph when an SRI changes. Out of band solutions/single location solutions could preserve parts of the dep graph that were unchanged still.

I think having more attributes and their use cases discussed would increase the visibility of this concern.

@xtuc
Copy link
Member

xtuc commented Nov 8, 2019

I suppose the type JavaScript would be the default, only new module types would require an attribute. Compression will help with repeating the same attributes many times in a file, but will fail project-wide.

An advantage of the out-of-band format is that the type would be specified only once per file, as opposed to every file that imports it.

@bmeck
Copy link
Member Author

bmeck commented Nov 8, 2019

@xtuc the update for every file that imports it would apply to any attribute that would require updating. Changing the format of a file for type or changing the content of a file for integrity. This means updating dependencies and transitive dependencies would require updates to all dependent source files if done in band for every operation that needs to synchronize with an attribute.

@littledan
Copy link
Member

The SRI concerns that @bmeck mentions are exactly why we don't focus on inline SRI in this repository, and why there's a good chance it would never happen at all. We could discuss technical details more in #8 . On the other hand, for module type, I think it's important to be in-band and not out of band because that is indeed the place to do the update where appropriate. Finally, if you want to discuss the form of putting metadata inline in the module specifier, let's discuss this in #11 .

@bmeck
Copy link
Member Author

bmeck commented Nov 8, 2019

@littledan regardless of where it is located and what the attribute key/value pairs are, the issue here is the duplication and potential mismatches of attributes. Other attributes outside of SRI are interesting here if we don't want to discuss SRI, like language, no-top-level-await, and/or mobile. I can think of many varieties of useful attributes, and do not want this proposal to only focus on essentially specifying a single accept: header key/value pair.

@ljharb
Copy link
Member

ljharb commented Nov 8, 2019

The appropriate place to determine what type a module is is in the module itself, not in its consumers, which is why i also prefer out of band.

@littledan

This comment has been minimized.

@littledan
Copy link
Member

Sorry, my last comment got a bit off topic. Let's centralize the discussion about out of line attributes in #13

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