deno/tests
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
..
config
ffi feat: suggest deno install --entrypoint instead of deno cache (#25228) 2024-09-18 19:55:50 +00:00
integration chore: deprecate check itests (#25963) 2024-10-02 09:22:35 +00:00
napi chore: disable flaky uv_test.js for now (#26003) 2024-10-02 23:41:58 +00:00
node_compat feat(ext/node): buffer.transcode() (#25972) 2024-10-02 08:23:14 +00:00
registry feat(lsp): quick fix for @deno-types="npm:@types/*" (#25954) 2024-10-01 22:55:02 +01:00
specs fix(install): store tags associated with package in node_modules dir (#26000) 2024-10-02 17:16:46 -07:00
testdata chore: deprecate check itests (#25963) 2024-10-02 09:22:35 +00:00
unit Revert "fix(urlpattern): fallback to empty string for undefined group values" (#25961) 2024-10-02 09:02:46 -07:00
unit_node BREAKING(ext/net): improved error code accuracy (#25383) 2024-09-27 14:07:20 +00:00
util chore: update std submodule (#25595) 2024-09-12 22:32:09 +10:00
wpt Revert "fix(urlpattern): fallback to empty string for undefined group values" (#25961) 2024-10-02 09:02:46 -07:00
Cargo.toml feat: improve lockfile v4 to store normalized version constraints and be more terse (#25247) 2024-08-28 14:17:47 -04:00
lib.rs
README.md

Deno Integration Tests