@@ -8,52 +8,61 @@ use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion};
88use rayon:: prelude:: * ;
99
1010fn data ( ) -> Vec < ( PathBuf , & ' static str ) > {
11- let cwd = env:: current_dir ( ) . unwrap ( ) . join ( "fixtures/enhanced_resolve" ) ;
12- let f = cwd. join ( "test/fixtures" ) ;
11+ let cwd = env:: current_dir ( ) . unwrap ( ) ;
12+ let f1 = cwd. join ( "fixtures/enhanced_resolve" ) ;
13+ let f2 = f1. join ( "test/fixtures" ) ;
1314 vec ! [
14- ( cwd. clone( ) , "./" ) ,
15- ( cwd. clone( ) , "./lib/index" ) ,
16- ( cwd. clone( ) , "/absolute/path" ) ,
15+ // real packages
16+ ( cwd. clone( ) , "@napi-rs/cli" ) ,
17+ ( cwd. clone( ) , "@napi-rs/wasm-runtime" ) ,
18+ ( cwd. clone( ) , "ava" ) ,
19+ ( cwd. clone( ) , "emnapi" ) ,
20+ ( cwd. clone( ) , "typescript" ) ,
21+ // relative path
22+ ( f1. clone( ) , "./" ) ,
23+ ( f1. clone( ) , "./lib/index" ) ,
24+ // absolute path
25+ ( f1. clone( ) , "/absolute/path" ) ,
1726 // query fragment
18- ( f . clone( ) , "./main1.js#fragment?query" ) ,
19- ( f . clone( ) , "m1/a.js?query#fragment" ) ,
27+ ( f2 . clone( ) , "./main1.js#fragment?query" ) ,
28+ ( f2 . clone( ) , "m1/a.js?query#fragment" ) ,
2029 // browserField
21- ( f . join( "browser-module" ) , "./lib/replaced" ) ,
22- ( f . join( "browser-module/lib" ) , "./replaced" ) ,
30+ ( f2 . join( "browser-module" ) , "./lib/replaced" ) ,
31+ ( f2 . join( "browser-module/lib" ) , "./replaced" ) ,
2332 // exportsField
24- ( f . join( "exports-field" ) , "exports-field" ) ,
25- ( f . join( "exports-field" ) , "exports-field/dist/main.js" ) ,
26- ( f . join( "exports-field" ) , "exports-field/dist/main.js?foo" ) ,
27- ( f . join( "exports-field" ) , "exports-field/dist/main.js#foo" ) ,
28- ( f . join( "exports-field" ) , "@exports-field/core" ) ,
29- ( f . join( "imports-exports-wildcard" ) , "m/features/f.js" ) ,
33+ ( f2 . join( "exports-field" ) , "exports-field" ) ,
34+ ( f2 . join( "exports-field" ) , "exports-field/dist/main.js" ) ,
35+ ( f2 . join( "exports-field" ) , "exports-field/dist/main.js?foo" ) ,
36+ ( f2 . join( "exports-field" ) , "exports-field/dist/main.js#foo" ) ,
37+ ( f2 . join( "exports-field" ) , "@exports-field/core" ) ,
38+ ( f2 . join( "imports-exports-wildcard" ) , "m/features/f.js" ) ,
3039 // extensionAlias
31- ( f . join( "extension-alias" ) , "./index.js" ) ,
32- ( f . join( "extension-alias" ) , "./dir2/index.mjs" ) ,
40+ ( f2 . join( "extension-alias" ) , "./index.js" ) ,
41+ ( f2 . join( "extension-alias" ) , "./dir2/index.mjs" ) ,
3342 // extensions
34- ( f . join( "extensions" ) , "./foo" ) ,
35- ( f . join( "extensions" ) , "." ) ,
36- ( f . join( "extensions" ) , "./dir" ) ,
37- ( f . join( "extensions" ) , "module/" ) ,
43+ ( f2 . join( "extensions" ) , "./foo" ) ,
44+ ( f2 . join( "extensions" ) , "." ) ,
45+ ( f2 . join( "extensions" ) , "./dir" ) ,
46+ ( f2 . join( "extensions" ) , "module/" ) ,
3847 // importsField
39- ( f . join( "imports-field" ) , "#imports-field" ) ,
40- ( f . join( "imports-exports-wildcard/node_modules/m/" ) , "#internal/i.js" ) ,
48+ ( f2 . join( "imports-field" ) , "#imports-field" ) ,
49+ ( f2 . join( "imports-exports-wildcard/node_modules/m/" ) , "#internal/i.js" ) ,
4150 // scoped
42- ( f . join( "scoped" ) , "@scope/pack1" ) ,
43- ( f . join( "scoped" ) , "@scope/pack2/lib" ) ,
51+ ( f2 . join( "scoped" ) , "@scope/pack1" ) ,
52+ ( f2 . join( "scoped" ) , "@scope/pack2/lib" ) ,
4453 // dashed name
45- ( f . clone( ) , "dash" ) ,
46- ( f . clone( ) , "dash-name" ) ,
47- ( f . join( "node_modules/dash" ) , "dash" ) ,
48- ( f . join( "node_modules/dash" ) , "dash-name" ) ,
49- ( f . join( "node_modules/dash-name" ) , "dash" ) ,
50- ( f . join( "node_modules/dash-name" ) , "dash-name" ) ,
54+ ( f2 . clone( ) , "dash" ) ,
55+ ( f2 . clone( ) , "dash-name" ) ,
56+ ( f2 . join( "node_modules/dash" ) , "dash" ) ,
57+ ( f2 . join( "node_modules/dash" ) , "dash-name" ) ,
58+ ( f2 . join( "node_modules/dash-name" ) , "dash" ) ,
59+ ( f2 . join( "node_modules/dash-name" ) , "dash-name" ) ,
5160 // alias
52- ( cwd . clone( ) , "aaa" ) ,
53- ( cwd . clone( ) , "ggg" ) ,
54- ( cwd . clone( ) , "rrr" ) ,
55- ( cwd . clone( ) , "@" ) ,
56- ( cwd , "@@@" ) ,
61+ ( f1 . clone( ) , "aaa" ) ,
62+ ( f1 . clone( ) , "ggg" ) ,
63+ ( f1 . clone( ) , "rrr" ) ,
64+ ( f1 . clone( ) , "@" ) ,
65+ ( f1 , "@@@" ) ,
5766 ]
5867}
5968
0 commit comments