Fast path for single part matching in doesNodeMatchPattern
MODIFY
packages/@romejs/js-ast-utils/doesNodeMatchPattern.ts
packages/@romejs/js-ast-utils/doesNodeMatchPattern.ts
@@ -52,6 +52,11 @@ export default function doesNodeMatchPattern(
const {parts: expectedParts, hasDoubleStar} = split(match);
+ // Fast path for single part pattern matching
+ if (expectedParts.length && expectedParts[0] !== '*' && !hasDoubleStar) {
+ return isIdentifierish(node) && node.name === expectedParts[0];
+ }
+
const {bailed, parts: actualParts} = getNodeReferenceParts(node);
// Bailed will be true if we were unable to derive a name for one of the parts

Fast path for single part matching in doesNodeMatchPattern