diff --git a/src/main/java/org/openrewrite/javascript/JavaScriptParser.java b/src/main/java/org/openrewrite/javascript/JavaScriptParser.java index 0e3dfa69..57c3dec9 100644 --- a/src/main/java/org/openrewrite/javascript/JavaScriptParser.java +++ b/src/main/java/org/openrewrite/javascript/JavaScriptParser.java @@ -79,6 +79,11 @@ public Stream parseInputs(Iterable 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 EXCLUSIONS = Collections.unmodifiableList(Arrays.asList( + ".pnp.cjs", ".pnp.loader.mjs" + )); + @Override public boolean accept(Path path) { if (path.toString().contains("/dist/")) { @@ -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; } }