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
315 downloads per month
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