1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-28 16:20:57 -05:00
denoland-deno/cli/npm/managed
Nathan Whitaker 275418473e
fix(install): store tags associated with package in node_modules dir (#26000)
Fixes #25998. Fixes https://github.com/denoland/deno/issues/25928.

Originally I was just going to make this an error message instead of a
panic, but once I got to a minimal repro I felt that this really should
work.

The panic occurs when you have `nodeModulesDir: manual` (or a
package.json present), and you have an npm package with a tag in your
deno.json (see the spec test that illustrates this).

This code path only actually executes when trying to choose an
appropriate package version from `node_modules/.deno`, so we should be
able to fix it by storing some extra data at install time.

The fix proposed here is to repurpose the `.initialized` file that we
store in `node_modules` to store the tags associated with a package.
Basically, if you have a version requirement with a tag (e.g.
`npm:chalk@latest`), when we set up the node_modules folder for that
package, we store the tag (`latest`) in `.initialized`. Then, when doing
BYONM resolution, if we have a version requirement with a tag, we read
that file and check if the tag is present.

The downside is that we do more work when setting up `node_modules`. We
_could_ do this only when BYONM is enabled, but that would have the
downside of needing to re-run `deno install` when you switch from auto
-> manual, though maybe that's not a big deal.
2024-10-02 17:16:46 -07:00
..
cache refactor: move NpmCacheDir to deno_cache_dir (#25916) 2024-09-28 08:50:16 -04:00
resolvers fix(install): store tags associated with package in node_modules dir (#26000) 2024-10-02 17:16:46 -07:00
mod.rs feat(byonm): support deno run npm:<package> when package is not in package.json (#25981) 2024-10-02 21:17:39 +01:00
registry.rs refactor: NpmRegistryApi - #[async_trait(?Send)] (#24126) 2024-06-06 22:37:41 +00:00
resolution.rs feat: TypeScript 5.6 and npm:@types/node@22 (#25614) 2024-09-14 11:58:47 +01:00