@@ -82,20 +82,19 @@ File tryExtensions(Folder dir, string basename, int priority) {
8282 * Gets the main module described by `pkg` with the given `priority`.
8383 */
8484File resolveMainModule ( PackageJSON pkg , int priority ) {
85- if exists ( MainModulePath:: of ( pkg ) )
86- then
87- exists ( PathExpr main | main = MainModulePath:: of ( pkg ) |
88- result = main .resolve ( ) and priority = 0
89- or
90- result = tryExtensions ( main .resolve ( ) , "index" , priority )
91- or
92- not exists ( main .resolve ( ) ) and
93- not exists ( main .getExtension ( ) ) and
94- exists ( int n | n = main .getNumComponent ( ) |
95- result = tryExtensions ( main .resolveUpTo ( n - 1 ) , main .getComponent ( n - 1 ) , priority )
96- )
85+ exists ( PathExpr main | main = MainModulePath:: of ( pkg ) |
86+ result = main .resolve ( ) and priority = 0
87+ or
88+ result = tryExtensions ( main .resolve ( ) , "index" , priority )
89+ or
90+ not exists ( main .resolve ( ) ) and
91+ not exists ( main .getExtension ( ) ) and
92+ exists ( int n | n = main .getNumComponent ( ) |
93+ result = tryExtensions ( main .resolveUpTo ( n - 1 ) , main .getComponent ( n - 1 ) , priority )
9794 )
98- else result = tryExtensions ( pkg .getFile ( ) .getParentContainer ( ) , "index" , priority )
95+ )
96+ or
97+ result = tryExtensions ( pkg .getFile ( ) .getParentContainer ( ) , "index" , priority - prioritiesPerCandidate ( ) )
9998}
10099
101100/**
0 commit comments