mirror of
https://github.com/denoland/deno.git
synced 2024-12-22 15:24:46 -05:00
8608105208
Noticed that we're checking more module paths than necessary. In particular the module path array contains a couple of entries with a duplicated `node_modules/node_modules` suffix. ```js [ // ... more entries before here, where some also contain duplicate suffixes "/Users/marvinhagemeister/dev/preact-render-to-string/node_modules/.deno/node_modules", "/Users/marvinhagemeister/dev/preact-render-to-string/node_modules/node_modules", // <-- duplicate suffix "/Users/marvinhagemeister/dev/preact-render-to-string/node_modules", "/Users/marvinhagemeister/dev/node_modules", "/Users/marvinhagemeister/node_modules", "/Users/node_modules", "/node_modules", "/node_modules" // <-- duplicate entry ] ``` This was caused by a misunderstanding in how Rust's [`Path::ends_with()`](https://doc.rust-lang.org/std/path/struct.Path.html#method.ends_with) works. It's designed to match on whole path segments and the suffix `/node_modules` is not that, except for the root entry. This meant that our check for if the path already ended with `node_module` always returned `false`. Removing the leading slash fixes that. While we're at it, we can remove the last condition where we explicitly added the root `/node_modules` entry since the while loop prior to that takes care of it already. |
||
---|---|---|
.. | ||
args | ||
bench | ||
cache | ||
js | ||
lsp | ||
napi | ||
npm | ||
ops | ||
schemas | ||
standalone | ||
tests | ||
tools | ||
tsc | ||
util | ||
auth_tokens.rs | ||
build.rs | ||
Cargo.toml | ||
deno.ico | ||
deno_std.rs | ||
emit.rs | ||
errors.rs | ||
factory.rs | ||
file_fetcher.rs | ||
graph_util.rs | ||
http_util.rs | ||
js.rs | ||
main.rs | ||
module_loader.rs | ||
node.rs | ||
README.md | ||
resolver.rs | ||
version.rs | ||
watcher.rs | ||
worker.rs |