@@ -18,14 +18,46 @@ export function createTaggedTemplateIgnore(
1818 const bindingIgnoreCache = new Map < Binding , boolean > ( )
1919 const taggedTemplateIgnoreCache = new WeakMap < Node , boolean > ( )
2020 const seenBindings = new Set < Binding > ( )
21- const canonicalIgnoreNames = new Set (
22- ( names ?? [ ] )
23- . filter ( ( item ) : item is string => typeof item === 'string' ) ,
24- )
25- const hasCanonicalIgnoreNames = canonicalIgnoreNames . size > 0
21+ let singleCanonicalIgnoreName : string | undefined
22+ let canonicalIgnoreNames : Set < string > | undefined
23+
24+ for ( const item of names ?? [ ] ) {
25+ if ( typeof item !== 'string' ) {
26+ continue
27+ }
28+
29+ if ( singleCanonicalIgnoreName === undefined ) {
30+ singleCanonicalIgnoreName = item
31+ continue
32+ }
33+
34+ if ( item === singleCanonicalIgnoreName ) {
35+ continue
36+ }
37+
38+ if ( ! canonicalIgnoreNames ) {
39+ canonicalIgnoreNames = new Set ( [ singleCanonicalIgnoreName , item ] )
40+ continue
41+ }
42+
43+ canonicalIgnoreNames . add ( item )
44+ }
45+
46+ const hasCanonicalIgnoreNames = singleCanonicalIgnoreName !== undefined
2647
2748 const matchesIgnoreName = ( value : string ) : boolean => {
28- return ( hasCanonicalIgnoreNames && canonicalIgnoreNames . has ( value ) ) || matcher ( value )
49+ if ( hasCanonicalIgnoreNames ) {
50+ if ( canonicalIgnoreNames ) {
51+ if ( canonicalIgnoreNames . has ( value ) ) {
52+ return true
53+ }
54+ }
55+ else if ( value === singleCanonicalIgnoreName ) {
56+ return true
57+ }
58+ }
59+
60+ return matcher ( value )
2961 }
3062
3163 const propertyMatches = ( propertyPath : NodePath < Node > | undefined ) : boolean => {
0 commit comments