@@ -2,9 +2,7 @@ use napi::bindgen_prelude::External;
22use napi_derive:: napi;
33use nodejs_resolver:: { AliasMap , Resolver , ResolverOptions } ;
44use serde:: Deserialize ;
5- use std:: {
6- path:: { Path , PathBuf } ,
7- } ;
5+ use std:: path:: { Path , PathBuf } ;
86
97#[ derive( Debug , Clone , Deserialize ) ]
108#[ serde( rename_all = "camelCase" ) ]
@@ -47,9 +45,9 @@ impl RawResolverOptions {
4745 . map_or ( default. condition_names , |vec| vec. into_iter ( ) . collect ( ) ) ,
4846 symlinks : self . symlinks . unwrap_or ( default. symlinks ) ,
4947 description_file : self
50- . description_file
51- . to_owned ( )
52- . unwrap_or ( default. description_file ) ,
48+ . description_file
49+ . to_owned ( )
50+ . unwrap_or ( default. description_file ) ,
5351 main_files : self . main_files . to_owned ( ) . unwrap_or ( default. main_files ) ,
5452 main_fields : self . main_fields . to_owned ( ) . unwrap_or ( default. main_fields ) ,
5553 prefer_relative : self . prefer_relative . unwrap_or ( default. prefer_relative ) ,
@@ -86,7 +84,7 @@ pub fn create(options: RawResolverOptions) -> Result<External<Resolver>, napi::E
8684
8785#[ napi(
8886 ts_args_type = "resolver: ExternalObject<ResolverInternal>, base_dir: string, id: string" ,
89- ts_return_type = "string | false "
87+ ts_return_type = "string"
9088) ]
9189pub fn resolve (
9290 resolver : External < Resolver > ,
@@ -96,7 +94,12 @@ pub fn resolve(
9694 match ( * resolver) . resolve ( Path :: new ( & base_dir) , & id) {
9795 Ok ( val) => {
9896 if let nodejs_resolver:: ResolverResult :: Info ( info) = val {
99- Ok ( format ! ( "{}{}{}" , info. path. display( ) , & info. request. query, & info. request. fragment) )
97+ Ok ( format ! (
98+ "{}{}{}" ,
99+ info. path. display( ) ,
100+ & info. request. query,
101+ & info. request. fragment
102+ ) )
100103 } else {
101104 Ok ( String :: from ( "false" ) )
102105 }
0 commit comments