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

Reference implementation cleanup: allow setting the list of built-in modules #165

Closed domenic closed 4 years ago

domenic commented 5 years ago

This is a low-priority code cleanup that I want to just write down while it is fresh in my mind.

Until recently the reference implementation has had a list of built-in modules as a hard-coded list:

https://github.com/WICG/import-maps/blob/da5665cb6ce03cbda7a9b9c68e8654b8d0fc757b/reference-implementation/lib/resolver.js#L5

It only had std:blank, which we anticipate being specified as a built-in module that does nothing with no exports.

164 added std:blank/for-testing in order to test some cases. That's not going to be specified anywhere. But it seemed important to get that coverage.

This architecture is inelegant. Instead, the reference implementation should take a list of built-in modules as an argument to resolve(), and the tests should inject a list appropriate for their testing.

domenic commented 4 years ago

Built-in module support was removed in #176 so this is no longer applicable.