87 releases

0.1.1 Nov 27, 2023
0.0.88 May 30, 2023
0.0.76 Mar 30, 2023
0.0.58 Dec 7, 2022
0.0.33 Jul 21, 2022

#11 in #resolve

Download history 28/week @ 2024-07-22 33/week @ 2024-07-29 17/week @ 2024-08-05 16/week @ 2024-08-12 15/week @ 2024-08-19 13/week @ 2024-08-26 13/week @ 2024-09-02 17/week @ 2024-09-09 26/week @ 2024-09-16 236/week @ 2024-09-23 34/week @ 2024-09-30 40/week @ 2024-10-07 32/week @ 2024-10-14 7/week @ 2024-10-21 9/week @ 2024-10-28 14/week @ 2024-11-04

66 downloads per month

MIT license

190KB
6K SLoC

nodejs_resolver

Benchmark

In the bench, compared the the performance along esbuild, enhanced-resolve and this project base on ant-design


lib.rs:

nodejs_resolver

How to use?

// |-- node_modules
// |---- foo
// |------ index.js
// | src
// |-- foo.ts
// |-- foo.js
// | tests

use nodejs_resolver::Resolver;

let cwd = std::env::current_dir().unwrap();
let resolver = Resolver::new(Default::default());

resolver.resolve(&cwd.join("./src"), "foo");
// -> ResolveResult::Info(ResolveInfo {
//    path: PathBuf::from("<cwd>/node_modules/foo/index.js")
//    request: Request {
//       target: "",
//       fragment: "",
//       query: ""
//    }
//  })
//

resolver.resolve(&cwd.join("./src"), "./foo");
// -> ResolveResult::Info(ResolveInfo {
//    path: PathBuf::from("<cwd>/src/foo.js")
//    request: Request {
//       target: "",
//       fragment: "",
//       query: ""
//    }
//  })
//

Dependencies

~6–13MB
~155K SLoC