File tree 1 file changed +10
-3
lines changed
packages/knip/src/plugins/tailwind
1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change 1
1
import { hasDependency } from '../../util/plugin.js' ;
2
- import type { IsPluginEnabledCallback } from '../../types/plugins.js' ;
2
+ import { toEntryPattern } from '../../util/protocols.js' ;
3
+ import type { GenericPluginCallback , IsPluginEnabledCallback } from '../../types/plugins.js' ;
3
4
4
5
// https://tailwindcss.com/docs/configuration
5
6
@@ -9,11 +10,17 @@ const ENABLERS = ['tailwindcss'];
9
10
10
11
const isEnabled : IsPluginEnabledCallback = ( { dependencies } ) => hasDependency ( dependencies , ENABLERS ) ;
11
12
12
- const CONFIG_FILE_PATTERNS = [ 'tailwind.config.{js,cjs,mjs,ts}' ] ;
13
+ const ENTRY_FILE_PATTERNS = [ 'tailwind.config.{js,cjs,mjs,ts}' ] ;
14
+
15
+ const findDependencies : GenericPluginCallback = async ( configFilePath , options ) => {
16
+ const { config } = options ;
17
+ return config . entry ? config . entry . map ( toEntryPattern ) : ENTRY_FILE_PATTERNS . map ( toEntryPattern ) ;
18
+ } ;
13
19
14
20
export default {
15
21
NAME ,
16
22
ENABLERS ,
17
23
isEnabled,
18
- CONFIG_FILE_PATTERNS ,
24
+ ENTRY_FILE_PATTERNS ,
25
+ findDependencies,
19
26
} ;
You can’t perform that action at this time.
0 commit comments