@@ -80,6 +80,7 @@ import { equal } from 'tailwindcss-language-service/src/util/array'
80
80
import preflight from 'tailwindcss/lib/css/preflight.css'
81
81
import merge from 'deepmerge'
82
82
import { getTextWithoutComments } from 'tailwindcss-language-service/src/util/doc'
83
+ import { CONFIG_GLOB , CSS_GLOB , PACKAGE_LOCK_GLOB } from './lib/constants'
83
84
84
85
// @ts -ignore
85
86
global . __preflight = preflight
@@ -97,9 +98,6 @@ new Function(
97
98
`
98
99
) ( require , __dirname )
99
100
100
- const CONFIG_FILE_GLOB = '{tailwind,tailwind.config}.{js,cjs}'
101
- const PACKAGE_GLOB = '{package-lock.json,yarn.lock,pnpm-lock.yaml}'
102
- const CSS_GLOB = '*.{css,scss,sass,less,pcss}'
103
101
const TRIGGER_CHARACTERS = [
104
102
// class attributes
105
103
'"' ,
@@ -370,7 +368,7 @@ async function createProjectService(
370
368
371
369
let isConfigFile = projectConfig . configPath
372
370
? change . file === projectConfig . configPath
373
- : minimatch ( file , `**/${ CONFIG_FILE_GLOB } ` , { dot : true } )
371
+ : minimatch ( file , `**/${ CONFIG_GLOB } ` , { dot : true } )
374
372
let isDependency = state . dependencies && state . dependencies . includes ( change . file )
375
373
376
374
if ( ! isConfigFile && ! isDependency ) continue
@@ -1510,7 +1508,7 @@ class TW {
1510
1508
} else {
1511
1509
let projects : Record < string , Array < DocumentSelector > > = { }
1512
1510
1513
- let files = await glob ( [ `**/${ CONFIG_FILE_GLOB } ` , `**/${ CSS_GLOB } ` ] , {
1511
+ let files = await glob ( [ `**/${ CONFIG_GLOB } ` , `**/${ CSS_GLOB } ` ] , {
1514
1512
cwd : base ,
1515
1513
ignore : ( await getConfiguration ( ) ) . tailwindCSS . files . exclude ,
1516
1514
onlyFiles : true ,
@@ -1611,7 +1609,7 @@ class TW {
1611
1609
}
1612
1610
}
1613
1611
1614
- let isPackageFile = minimatch ( normalizedFilename , `**/${ PACKAGE_GLOB } ` , { dot : true } )
1612
+ let isPackageFile = minimatch ( normalizedFilename , `**/${ PACKAGE_LOCK_GLOB } ` , { dot : true } )
1615
1613
if ( isPackageFile ) {
1616
1614
for ( let [ key ] of this . projects ) {
1617
1615
let projectConfig = JSON . parse ( key ) as ProjectConfig
@@ -1649,7 +1647,7 @@ class TW {
1649
1647
}
1650
1648
}
1651
1649
1652
- let isConfigFile = minimatch ( normalizedFilename , `**/${ CONFIG_FILE_GLOB } ` , {
1650
+ let isConfigFile = minimatch ( normalizedFilename , `**/${ CONFIG_GLOB } ` , {
1653
1651
dot : true ,
1654
1652
} )
1655
1653
if ( isConfigFile && change . type === FileChangeType . Created ) {
@@ -1698,8 +1696,8 @@ class TW {
1698
1696
DidChangeWatchedFilesNotification . type ,
1699
1697
{
1700
1698
watchers : [
1701
- { globPattern : `**/${ CONFIG_FILE_GLOB } ` } ,
1702
- { globPattern : `**/${ PACKAGE_GLOB } ` } ,
1699
+ { globPattern : `**/${ CONFIG_GLOB } ` } ,
1700
+ { globPattern : `**/${ PACKAGE_LOCK_GLOB } ` } ,
1703
1701
{ globPattern : `**/${ CSS_GLOB } ` } ,
1704
1702
] ,
1705
1703
}
@@ -1749,7 +1747,7 @@ class TW {
1749
1747
} else {
1750
1748
let watch : typeof chokidar . watch = require ( 'chokidar' ) . watch
1751
1749
let chokidarWatcher = watch (
1752
- [ `**/${ CONFIG_FILE_GLOB } ` , `**/${ PACKAGE_GLOB } ` , `**/${ CSS_GLOB } ` ] ,
1750
+ [ `**/${ CONFIG_GLOB } ` , `**/${ PACKAGE_LOCK_GLOB } ` , `**/${ CSS_GLOB } ` ] ,
1753
1751
{
1754
1752
cwd : base ,
1755
1753
ignorePermissionErrors : true ,
0 commit comments