File tree Expand file tree Collapse file tree 1 file changed +14
-14
lines changed Expand file tree Collapse file tree 1 file changed +14
-14
lines changed Original file line number Diff line number Diff line change @@ -198,22 +198,22 @@ function dedupeNonExistent(nonExistent) {
198
198
199
199
// If the file is in a node module, use the root directory of the module
200
200
function getDirectory ( localConfig ) {
201
- function _getProjectPath ( filename ) {
202
- try {
203
- const nodeModuleParts = filename . split ( 'node_modules' ) ;
204
- const packageSubPathPath = nodeModuleParts . pop ( ) . split ( path . sep ) . filter ( Boolean ) ;
205
- const packageName = packageSubPathPath [ 0 ] . startsWith ( '@' ) ? `${ packageSubPathPath [ 0 ] } ${ path . sep } ${ packageSubPathPath [ 1 ] } ` : packageSubPathPath [ 0 ] ;
206
-
207
- return path . normalize ( [ ...nodeModuleParts , `${ path . sep } ${ packageName } ` ] . join ( 'node_modules' ) ) ;
208
- } catch {
209
- debug ( `Could not determine the root directory of package file ${ filename } . Using default` ) ;
210
- return null ;
211
- }
212
- }
213
-
214
201
if ( ! localConfig . filename . includes ( 'node_modules' ) ) {
215
202
return localConfig . directory ;
216
203
}
217
204
218
- return _getProjectPath ( path . dirname ( localConfig . filename ) ) || localConfig . directory ;
205
+ return getProjectPath ( path . dirname ( localConfig . filename ) ) || localConfig . directory ;
206
+ }
207
+
208
+ function getProjectPath ( filename ) {
209
+ try {
210
+ const nodeModuleParts = filename . split ( 'node_modules' ) ;
211
+ const packageSubPathPath = nodeModuleParts . pop ( ) . split ( path . sep ) . filter ( Boolean ) ;
212
+ const packageName = packageSubPathPath [ 0 ] . startsWith ( '@' ) ? `${ packageSubPathPath [ 0 ] } ${ path . sep } ${ packageSubPathPath [ 1 ] } ` : packageSubPathPath [ 0 ] ;
213
+
214
+ return path . normalize ( [ ...nodeModuleParts , `${ path . sep } ${ packageName } ` ] . join ( 'node_modules' ) ) ;
215
+ } catch {
216
+ debug ( `Could not determine the root directory of package file ${ filename } . Using default` ) ;
217
+ return null ;
218
+ }
219
219
}
You can’t perform that action at this time.
0 commit comments