@@ -18,6 +18,7 @@ if (!fs.existsSync(moduleRootAbsolute)) {
1818const importRegEx = / i m p o r t \( [ " ' ] ( [ ^ " ' ] * ) [ " ' ] \) \. ( [ ^ \. \| \} > < , \) = \n ] * ) ( [ \. \| \} > < , \) = \n ] ) / g;
1919const typedefRegEx = / @ t y p e d e f \{ [ ^ \} ] * \} ( [ ^ \r ? \n ? ] * ) / ;
2020const noClassdescRegEx = / @ ( t y p e d e f | m o d u l e | t y p e ) / ;
21+ const slashRegEx = / \\ / g;
2122
2223const moduleInfos = { } ;
2324const fileNodes = { } ;
@@ -140,7 +141,7 @@ exports.astNodeVisitor = {
140141 const moduleId = path . relative ( path . join ( process . cwd ( ) , moduleRoot ) , absolutePath ) . replace ( / \. j s $ / , '' ) ;
141142 const exportName = identifier . defaultImport ? getDefaultExportName ( moduleId , parser ) : node . superClass . name ;
142143 const delimiter = identifier . defaultImport ? '~' : getDelimiter ( moduleId , exportName , parser ) ;
143- lines [ lines . length - 2 ] = ' * @extends ' + `module:${ moduleId } ${ exportName ? delimiter + exportName : '' } ` ;
144+ lines [ lines . length - 2 ] = ' * @extends ' + `module:${ moduleId . replace ( slashRegEx , '/' ) } ${ exportName ? delimiter + exportName : '' } ` ;
144145 } else {
145146 lines [ lines . length - 2 ] = ' * @extends ' + node . superClass . name ;
146147 }
@@ -167,10 +168,10 @@ exports.astNodeVisitor = {
167168 replacement = `module:${ importMatch [ 1 ] } ${ importMatch [ 2 ] === 'default' ? '' : '~' + importMatch [ 2 ] } ` ;
168169 } else {
169170 const rel = path . resolve ( path . dirname ( currentSourceName ) , importMatch [ 1 ] ) ;
170- const importModule = path . relative ( path . join ( process . cwd ( ) , moduleRoot ) , rel ) . replace ( / \. j s $ / , '' ) ;
171- const exportName = importMatch [ 2 ] === 'default' ? getDefaultExportName ( importModule , parser ) : importMatch [ 2 ] ;
172- const delimiter = importMatch [ 2 ] === 'default' ? '~' : getDelimiter ( importModule , exportName , parser ) ;
173- replacement = `module:${ importModule } ${ exportName ? delimiter + exportName : '' } ` ;
171+ const moduleId = path . relative ( path . join ( process . cwd ( ) , moduleRoot ) , rel ) . replace ( / \. j s $ / , '' ) ;
172+ const exportName = importMatch [ 2 ] === 'default' ? getDefaultExportName ( moduleId , parser ) : importMatch [ 2 ] ;
173+ const delimiter = importMatch [ 2 ] === 'default' ? '~' : getDelimiter ( moduleId , exportName , parser ) ;
174+ replacement = `module:${ moduleId . replace ( slashRegEx , '/' ) } ${ exportName ? delimiter + exportName : '' } ` ;
174175 }
175176 comment . value = comment . value . replace ( importMatch [ 0 ] , replacement + importMatch [ 3 ] ) ;
176177 }
@@ -192,7 +193,7 @@ exports.astNodeVisitor = {
192193 const moduleId = path . relative ( path . join ( process . cwd ( ) , moduleRoot ) , absolutePath ) . replace ( / \. j s $ / , '' ) ;
193194 const exportName = identifier . defaultImport ? getDefaultExportName ( moduleId , parser ) : key ;
194195 const delimiter = identifier . defaultImport ? '~' : getDelimiter ( moduleId , exportName , parser ) ;
195- const replacement = `module:${ moduleId } ${ exportName ? delimiter + exportName : '' } ` ;
196+ const replacement = `module:${ moduleId . replace ( slashRegEx , '/' ) } ${ exportName ? delimiter + exportName : '' } ` ;
196197 comment . value = comment . value . replace ( regex , '$1' + replacement ) ;
197198 }
198199 } ) ;
0 commit comments