1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 23:34:47 -05:00
denoland-deno/ext
Marvin Hagemeister 8608105208
fix(node): duplicate node_module suffixes (#19222)
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.
2023-05-23 12:46:14 +02:00
..
broadcast_channel chore: forward v1.33.4 release commit to main (#19181) 2023-05-18 20:44:10 +02:00
cache chore: forward v1.33.4 release commit to main (#19181) 2023-05-18 20:44:10 +02:00
console chore: forward v1.33.4 release commit to main (#19181) 2023-05-18 20:44:10 +02:00
crypto chore: forward v1.33.4 release commit to main (#19181) 2023-05-18 20:44:10 +02:00
fetch feat(unstable): add more options to Deno.createHttpClient (#17385) 2023-05-21 03:43:54 +02:00
ffi chore: forward v1.33.4 release commit to main (#19181) 2023-05-18 20:44:10 +02:00
fs chore: forward v1.33.4 release commit to main (#19181) 2023-05-18 20:44:10 +02:00
http feat(ext/http): ref/unref for server (#19197) 2023-05-19 15:14:40 -06:00
io chore: forward v1.33.4 release commit to main (#19181) 2023-05-18 20:44:10 +02:00
kv chore: forward v1.33.4 release commit to main (#19181) 2023-05-18 20:44:10 +02:00
napi chore: forward v1.33.4 release commit to main (#19181) 2023-05-18 20:44:10 +02:00
net chore: forward v1.33.4 release commit to main (#19181) 2023-05-18 20:44:10 +02:00
node fix(node): duplicate node_module suffixes (#19222) 2023-05-23 12:46:14 +02:00
tls chore: forward v1.33.4 release commit to main (#19181) 2023-05-18 20:44:10 +02:00
url chore: forward v1.33.4 release commit to main (#19181) 2023-05-18 20:44:10 +02:00
web fix(node): make sure "setImmediate" is not clamped to 4ms (#19213) 2023-05-22 22:19:44 +00:00
webidl chore: forward v1.33.4 release commit to main (#19181) 2023-05-18 20:44:10 +02:00
websocket chore: forward v1.33.4 release commit to main (#19181) 2023-05-18 20:44:10 +02:00
webstorage chore: forward v1.33.4 release commit to main (#19181) 2023-05-18 20:44:10 +02:00