@@ -30,14 +30,15 @@ const leadingPathSegmentRegEx = /^(.?.[/\\])+/;
3030const moduleInfos = { } ;
3131const fileNodes = { } ;
3232
33- let inferredModuleRoot ;
33+ // Without explicit module ids, JSDoc will use the nearest shared ancestor directory
34+ let implicitModuleRoot ;
3435
35- function getInferredModuleRoot ( ) {
36- if ( inferredModuleRoot ) {
37- return inferredModuleRoot ;
36+ function getImplicitModuleRoot ( ) {
37+ if ( implicitModuleRoot ) {
38+ return implicitModuleRoot ;
3839 }
3940
40- inferredModuleRoot = env . sourceFiles . reduce ( ( nearestAncestor , curr , i ) => {
41+ implicitModuleRoot = env . sourceFiles . reduce ( ( nearestAncestor , curr , i ) => {
4142 if ( curr . startsWith ( nearestAncestor ) || i === 0 ) {
4243 return nearestAncestor ;
4344 }
@@ -52,7 +53,7 @@ function getInferredModuleRoot() {
5253 }
5354 } , path . dirname ( env . sourceFiles [ 0 ] ) ) ;
5455
55- return inferredModuleRoot ;
56+ return implicitModuleRoot ;
5657}
5758
5859function getModuleInfo ( modulePath , parser ) {
@@ -134,9 +135,9 @@ function getModuleId(modulePath) {
134135 }
135136 }
136137
137- if ( getInferredModuleRoot ( ) ) {
138+ if ( getImplicitModuleRoot ( ) ) {
138139 return path
139- . relative ( inferredModuleRoot , modulePath )
140+ . relative ( implicitModuleRoot , modulePath )
140141 . replace ( extensionReplaceRegEx , '' ) ;
141142 }
142143
0 commit comments