fix(node): improve cjs tracking (#22673)

We were missing saying that a file is CJS when some Deno code imported
from the node_modules directory at runtime.
This commit is contained in:
David Sherret 2024-03-05 19:23:51 -05:00 committed by GitHub
parent 3fd4b882a4
commit 3eaf174bfc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 250 additions and 169 deletions

4
cli/cache/mod.rs vendored
View file

@ -196,7 +196,9 @@ impl Loader for FetchCacher {
) -> LoadFuture {
use deno_graph::source::CacheSetting as LoaderCacheSetting;
if specifier.path().contains("/node_modules/") {
if specifier.scheme() == "file"
&& specifier.path().contains("/node_modules/")
{
// The specifier might be in a completely different symlinked tree than
// what the node_modules url is in (ex. `/my-project-1/node_modules`
// symlinked to `/my-project-2/node_modules`), so first we checked if the path