@@ -57,18 +57,20 @@ function getEntrypoints(fs: Package, exportsObject: any, options: CheckPackageOp
57
57
return options . entrypoints . map ( ( e ) => formatEntrypointString ( e , fs . packageName ) ) ;
58
58
}
59
59
if ( exportsObject === undefined && fs ) {
60
- return getProxyDirectories ( `/node_modules/${ fs . packageName } ` , fs ) ;
60
+ const proxies = getProxyDirectories ( `/node_modules/${ fs . packageName } ` , fs ) ;
61
+ if ( proxies . length === 0 ) {
62
+ return [ "." ] ;
63
+ }
64
+ return proxies ;
61
65
}
62
66
const detectedSubpaths = getSubpaths ( exportsObject ) ;
63
67
if ( detectedSubpaths . length === 0 ) {
64
68
detectedSubpaths . push ( "." ) ;
65
69
}
66
- const included = Array . from (
67
- new Set ( [
68
- ...detectedSubpaths ,
69
- ...( options ?. includeEntrypoints ?. map ( ( e ) => formatEntrypointString ( e , fs . packageName ) ) ?? [ ] ) ,
70
- ] )
71
- ) ;
70
+ const included = unique ( [
71
+ ...detectedSubpaths ,
72
+ ...( options ?. includeEntrypoints ?. map ( ( e ) => formatEntrypointString ( e , fs . packageName ) ) ?? [ ] ) ,
73
+ ] ) ;
72
74
if ( ! options ?. excludeEntrypoints ) {
73
75
return included ;
74
76
}
@@ -118,7 +120,8 @@ function getProxyDirectories(rootDir: string, fs: Package) {
118
120
}
119
121
} )
120
122
. map ( ( f ) => "." + f . slice ( rootDir . length ) . slice ( 0 , - `/package.json` . length ) )
121
- . filter ( ( f ) => f !== "./" ) ;
123
+ . filter ( ( f ) => f !== "./" )
124
+ . sort ( ) ;
122
125
}
123
126
124
127
function getEntrypointInfo (
@@ -200,3 +203,7 @@ function getEntrypointResolution(
200
203
} ;
201
204
}
202
205
}
206
+
207
+ function unique < T > ( array : readonly T [ ] ) : T [ ] {
208
+ return array . filter ( ( value , index ) => array . indexOf ( value ) === index ) ;
209
+ }
0 commit comments