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

#6 in #resolve

Download history 32/week @ 2024-06-17 21/week @ 2024-06-24 7/week @ 2024-07-01 21/week @ 2024-07-08 21/week @ 2024-07-15 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

315 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
~153K SLoC