24 releases

Uses new Rust 2021

new 0.0.26 Jul 4, 2022
0.0.25 Jun 29, 2022
0.0.14 May 31, 2022
0.0.2 Apr 27, 2022

#73 in Profiling

Download history 21/week @ 2022-04-19 68/week @ 2022-04-26 145/week @ 2022-05-03 207/week @ 2022-05-10 202/week @ 2022-05-17 523/week @ 2022-05-24 440/week @ 2022-05-31 503/week @ 2022-06-07 204/week @ 2022-06-14 543/week @ 2022-06-21 230/week @ 2022-06-28

1,547 downloads per month

MIT license

140KB
3.5K SLoC

nodejs_resolver

TodoList:

  • error message stack.
  • test cases for cache.

Benchmark

In the bench, compared the the performance along esbuild(wasm), 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::default();

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

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

Dependencies

~2.5–8MB
~146K SLoC