Closed vovacodes closed 2 years ago
What if we had a generator.installAll()
or generator.reinstall()
operation which would reinstall all the top-level installs, and apply pruning? The inputMap
would imply the top-level imports so that module1URL
and module2URL
shouldn't be necessary. This seems to have a nice compatibility with a generator.uninstall()
.
Thing is, we don't feed the "entrypoint" modules to the generator because it's impractical in our case (generator is running in a separate worker and we have hundreds of equally important entrypoint modules). module1URL
in my example is one of such "entrypoint" modules though, and what I'd like to get is a dependencies subgraph required for that specific module.
@vovacodes would it make sense to treat all "imports"
keys as entry points?
This is now implemented in https://github.com/jspm/generator/pull/134 as generator.extractMap(['react', '...'])
.
Another use-case we have at Framer arises from the modules copy/paste functionality. In Framer every project has its own import map, so when we copy/paste a component from one project to another we need to bring the "source" project's import map along with it and merge it with the "destination" one.
The reasons we won't simply use
generator.traceInstall(pastedModuleURL)
are:Unfortunately this solution results in bloating the destination import map with a bunch of unnecessary resolutions that are not even used by the pasted module. A better alternative would be to merge only the part of the source import map that we know is required by the pasted module.
The API can be: