-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(unstable): support caching npm dependencies only as they're needed #27300
feat(unstable): support caching npm dependencies only as they're needed #27300
Conversation
e3ada55
to
03c5334
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Looks really good. Just have a few questions.
GraphKind::All, | ||
roots.clone(), | ||
&mut loader, | ||
graph_util::NpmCachingStrategy::Eager, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like maybe we could maybe get away with setting this as lazy in the lsp or just only install stuff found in the package.json, deno.json, or any specifiers.
Co-authored-by: Luca Casonato <[email protected]> Signed-off-by: Nathan Whitaker <[email protected]>
b7c7b2a
to
9bc0da0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…ed (#27300) Currently deno eagerly caches all npm packages in the workspace's npm resolution. So, for instance, running a file `foo.ts` that imports `npm:chalk` will also install all dependencies listed in `package.json` and all `npm` dependencies listed in the lockfile. This PR refactors things to give more control over when and what npm packages are automatically cached while building the module graph. After this PR, by default the current behavior is unchanged _except_ for `deno install --entrypoint`, which will only cache npm packages used by the given entrypoint. For the other subcommands, this behavior can be enabled with `--unstable-npm-lazy-caching` Fixes #25782. --------- Signed-off-by: Nathan Whitaker <[email protected]> Co-authored-by: Luca Casonato <[email protected]>
Currently deno eagerly caches all npm packages in the workspace's npm resolution. So, for instance, running a file
foo.ts
that importsnpm:chalk
will also install all dependencies listed inpackage.json
and allnpm
dependencies listed in the lockfile.This PR refactors things to give more control over when and what npm packages are automatically cached while building the module graph.
After this PR, by default the current behavior is unchanged except for
deno install --entrypoint
, which will only cache npm packages used by the given entrypoint. For the other subcommands, this behavior can be enabled with--unstable-npm-lazy-caching
TODO:
Fixes #25782.