jspm / generator

JSPM Import Map Generator
Apache License 2.0
165 stars 21 forks source link

feat: reinstate trace install #171

Closed guybedford closed 2 years ago

guybedford commented 2 years ago

This reinstates generator.traceInstall, instead of the recently attempted generator.pin name change.

traceInstall is then updated to always install traces into top-level imports rather than scopes, so it behaves like a full local install operator as opposed to making scopes that might be orphaned later on.

traceInstall effectively stops on bare specifiers, moving to scoped installs after that. This makes it useful for both adding local mappings (eg generator.traceInstall('#local') to add a local package.json "imports" map), and external (generator.traceInstall('https://site.com/external.js') - still populating "imports").

Since htmlInject uses this internally this then fully matches the expectations of HTML tracing as well.