@@ -5,8 +5,8 @@ import { ClassGenerator } from '@tailwindcss-mangle/shared'
55import { getConfig } from '@tailwindcss-mangle/config'
66import type { MangleUserConfig } from '@tailwindcss-mangle/config'
77import { sort } from 'fast-sort'
8- import defu from 'defu'
9- import { createGlobMatcher , defaultMangleClassFilter , escapeStringRegexp } from '@/utils'
8+ import { defu } from 'defu'
9+ import { defaultMangleClassFilter , escapeStringRegexp } from '@/utils'
1010
1111interface InitConfigOptions {
1212 cwd ?: string
@@ -16,8 +16,6 @@ interface InitConfigOptions {
1616
1717export class Context {
1818 options : MangleUserConfig
19- private includeMatcher : ( file : string ) => boolean
20- private excludeMatcher : ( file : string ) => boolean
2119 public replaceMap : Map < string , string >
2220 classSet : Set < string >
2321
@@ -30,8 +28,6 @@ export class Context {
3028 this . options = { }
3129 this . classSet = new Set ( )
3230 this . replaceMap = new Map ( )
33- this . includeMatcher = ( ) => true
34- this . excludeMatcher = ( ) => false
3531 this . classGenerator = new ClassGenerator ( )
3632 this . preserveFunctionSet = new Set ( )
3733 this . preserveClassNamesSet = new Set ( )
@@ -53,19 +49,13 @@ export class Context {
5349 private mergeOptions ( ...opts : ( MangleUserConfig | undefined ) [ ] ) {
5450 // 配置选项优先
5551 this . options = defu ( this . options , ...opts )
56- this . includeMatcher = createGlobMatcher ( this . options . include , true )
57- this . excludeMatcher = createGlobMatcher ( this . options . exclude , false )
5852 this . classGenerator = new ClassGenerator ( this . options . classGenerator )
5953 this . preserveFunctionSet = new Set ( this . options ?. preserveFunction ?? [ ] )
6054 this . preserveFunctionRegexs = [ ...this . preserveFunctionSet . values ( ) ] . map ( ( x ) => {
6155 return new RegExp ( `${ escapeStringRegexp ( x ) } \\(([^)]*)\\)` , 'g' )
6256 } )
6357 }
6458
65- isInclude ( file : string ) {
66- return this . includeMatcher ( file ) && ! this . excludeMatcher ( file )
67- }
68-
6959 currentMangleClassFilter ( className : string ) {
7060 return ( this . options . mangleClassFilter ?? defaultMangleClassFilter ) ( className )
7161 }
0 commit comments