Skip to content

Commit 0e97857

Browse files
authored
Don’t include lib/src files in package analysis (#12)
Closes #11
1 parent 39184b4 commit 0e97857

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

lib/src/library_analyzer.dart

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,18 @@ class LibraryScanner {
131131
String package, String packageDir) async {
132132
Map<String, List<String>> results = new SplayTreeMap();
133133
List<String> dartFiles = await listFiles(packageDir, endsWith: '.dart');
134-
List<String> mainFiles = dartFiles
135-
.where((path) => path.startsWith('lib/') || path.startsWith('bin/'))
136-
.toList();
134+
List<String> mainFiles = dartFiles.where((path) {
135+
if (p.isWithin('bin', path)) {
136+
return true;
137+
}
138+
139+
// Include all Dart files in lib – except for implementation files.
140+
if (p.isWithin('lib', path) && !p.isWithin('lib/src', path)) {
141+
return true;
142+
}
143+
144+
return false;
145+
}).toList();
137146
for (String relativePath in mainFiles) {
138147
String uri = _toUri(package, relativePath);
139148
if (!_cachedLibs.containsKey(uri)) {

0 commit comments

Comments
 (0)