Skip to content

Commit

Permalink
Exclude Yarn Plug'n'Play files
Browse files Browse the repository at this point in the history
  • Loading branch information
ammachado committed Oct 24, 2023
1 parent 99f4c4f commit 3af960a
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ public Stream<SourceFile> parseInputs(Iterable<Input> sources, @Nullable Path re
".ts", ".tsx", ".mts", ".cts"
));

// Exclude Yarn's Plug'n'Play loader files (https://yarnpkg.com/features/pnp)
private final static List<String> EXCLUSIONS = Collections.unmodifiableList(Arrays.asList(
".pnp.cjs", ".pnp.loader.mjs"
));

@Override
public boolean accept(Path path) {
if (path.toString().contains("/dist/")) {
Expand All @@ -88,7 +93,7 @@ public boolean accept(Path path) {

final String filename = path.getFileName().toString().toLowerCase();
for (String ext : EXTENSIONS) {
if (filename.endsWith(ext)) {
if (filename.endsWith(ext) && !EXCLUSIONS.contains(filename)) {
return true;
}
}
Expand Down

0 comments on commit 3af960a

Please sign in to comment.