WICG / import-maps

How to control the behavior of JavaScript imports
https://html.spec.whatwg.org/multipage/webappapis.html#import-maps
Other
2.68k stars 69 forks source link

Centralize and simplify checks on URLs/specifiers #158

Closed domenic closed 4 years ago

domenic commented 5 years ago

As originally mentioned by @hiroshige-g in https://github.com/WICG/import-maps/pull/152#issuecomment-510681264, we have a number of different checks (especially after #152): during parsing, resolving, and fetching. They are not all identical. We should try to centralize and simplify them.

@hiroshige-g has a table in this chromium.org document (unfortunately not public) where he has made a matrix of the differences.

hiroshige-g commented 5 years ago

FYI I made the doc public.

domenic commented 4 years ago

With the removal of built-in module support in #176 this becomes much simpler.

Since we no longer need to treat any schemes as special, perhaps we should just remove the fetch scheme check entirely, and then everything will be uniform. Thoughts appreciated.

bakkot commented 4 years ago

perhaps we should just remove the fetch scheme check entirely, and then everything will be uniform

Personally I'm in favor of this. It would make the error more uniform, so that having import('wss:foo') would give the same error as having import('foo') with an import map of { "imports": { "foo": "wss:foo" } }.

domenic commented 4 years ago

I think checks are pretty centralized and simple now. @hiroshige-g do you agree?

hiroshige-g commented 4 years ago

Agree. Closing.