Closed devsnek closed 5 years ago
This proposal builds on top of the import maps proposal. On a conceptual level exports
is a contribution to the import map. Pseudo code:
imports = {}
for each pkg in packages
for each exportKey, resolution of pkg.exports
imports[pkg.name + exportKey] = new URL(resolution, pkg.url).href
// `imports` is now a valid import map
The explanation above skips scopes and nesting but the general idea is that just using package.json
meta data and a rough package mapping, e.g. package-lock.json
, you could build a complete in-memory import map and would never have to hit the disk to resolve anything.
I think the current semantics are aligned with import maps as much as we can (given that import maps aren't 100% finalized yet).
is there any plan to have a reconciliation of the import maps proposal and this? having two different formats floating around to do basically the same thing is annoying, especially when we have the opportunity now to fix it.
cc @domenic