1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-23 07:29:51 -05:00
denoland-deno/ext/node
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
..
ops fix(node): duplicate node_module suffixes (#19222) 2023-05-23 12:46:14 +02:00
polyfills fix(node): duplicate node_module suffixes (#19222) 2023-05-23 12:46:14 +02:00
analyze.rs fix(npm): add performance.markResourceTiming sham (#19123) 2023-05-16 05:16:24 +02:00
build.rs refactor(ext/node): use a snapshottable global name for Node's globalThis (#18860) 2023-04-26 18:53:13 -04:00
Cargo.toml chore: forward v1.33.4 release commit to main (#19181) 2023-05-18 20:44:10 +02:00
clippy.toml refactor(ext/fs): deno_fs::FileSystem - conditional Send + Sync (#18993) 2023-05-08 11:02:02 -04:00
errors.rs chore: upgrade to Rust 1.67 (#17548) 2023-01-27 10:43:16 -05:00
lib.rs fix(ext/node): make nodeGlobalThis configurable (#19163) 2023-05-17 15:23:18 +03:00
package_json.rs refactor(ext/node): combine deno_node::Fs with deno_fs::FileSystem (#18991) 2023-05-05 16:44:24 +00:00
path.rs chore(ext/node): fix variable name (#17948) 2023-02-27 21:26:02 +01:00
polyfill.rs fix(node): export diagnostics_channel module (#19167) 2023-05-17 12:29:50 +00:00
README.md chore(ext/node): correct publishing for ext/node (#15461) 2022-08-11 17:25:41 -04:00
resolution.rs fix(node): conditional exports edge case (#19082) 2023-05-10 23:55:48 +02:00

deno_node

require and other node related functionality for Deno.