@@ -84,7 +84,7 @@ const colorNames = Object.keys(namedColors)
84
84
85
85
function getConfigId ( configPath : string , configDependencies : string [ ] ) : string {
86
86
return JSON . stringify (
87
- [ configPath , ...configDependencies ] . map ( ( file ) => [ file , fs . statSync ( file ) . mtimeMs ] )
87
+ [ configPath , ...configDependencies ] . map ( ( file ) => [ file , fs . statSync ( file ) . mtimeMs ] ) ,
88
88
)
89
89
}
90
90
@@ -180,7 +180,7 @@ export async function createProjectService(
180
180
refreshDiagnostics : ( ) => void ,
181
181
watchPatterns : ( patterns : string [ ] ) => void ,
182
182
initialTailwindVersion : string ,
183
- getConfiguration : ( uri ?: string ) => Promise < Settings >
183
+ getConfiguration : ( uri ?: string ) => Promise < Settings > ,
184
184
) : Promise < ProjectService > {
185
185
let enabled = false
186
186
const folder = projectConfig . folder
@@ -228,11 +228,11 @@ export async function createProjectService(
228
228
return ( await isExcluded (
229
229
state ,
230
230
document ,
231
- path . join ( directory , dirent . name , isDirectory ? '/' : '' )
231
+ path . join ( directory , dirent . name , isDirectory ? '/' : '' ) ,
232
232
) )
233
233
? null
234
234
: [ dirent . name , { isDirectory } ]
235
- } )
235
+ } ) ,
236
236
)
237
237
return result . filter ( ( item ) => item !== null )
238
238
} catch {
@@ -255,7 +255,7 @@ export async function createProjectService(
255
255
256
256
function log ( ...args : string [ ] ) : void {
257
257
console . log (
258
- `[${ path . relative ( projectConfig . folder , projectConfig . configPath ) } ] ${ args . join ( ' ' ) } `
258
+ `[${ path . relative ( projectConfig . folder , projectConfig . configPath ) } ] ${ args . join ( ' ' ) } ` ,
259
259
)
260
260
}
261
261
@@ -280,12 +280,12 @@ export async function createProjectService(
280
280
) {
281
281
documentSelector = [
282
282
...documentSelector . filter (
283
- ( { priority } ) => priority !== DocumentSelectorPriority . CONTENT_FILE
283
+ ( { priority } ) => priority !== DocumentSelectorPriority . CONTENT_FILE ,
284
284
) ,
285
285
...getContentDocumentSelectorFromConfigFile (
286
286
projectConfig . configPath ,
287
287
initialTailwindVersion ,
288
- projectConfig . folder
288
+ projectConfig . folder ,
289
289
) ,
290
290
]
291
291
@@ -390,7 +390,7 @@ export async function createProjectService(
390
390
return findUp . stop
391
391
}
392
392
} ,
393
- { cwd : folder }
393
+ { cwd : folder } ,
394
394
)
395
395
396
396
if ( pnpPath ) {
@@ -498,10 +498,9 @@ export async function createProjectService(
498
498
resolveConfigFn = ( config ) => resolveConfig ( [ config , defaultConfig ] )
499
499
} catch ( _ ) {
500
500
try {
501
- const resolveConfig = require ( resolveFrom (
502
- tailwindDir ,
503
- './lib/util/mergeConfigWithDefaults.js'
504
- ) )
501
+ const resolveConfig = require (
502
+ resolveFrom ( tailwindDir , './lib/util/mergeConfigWithDefaults.js' ) ,
503
+ )
505
504
const defaultConfig = require ( resolveFrom ( tailwindDir , './defaultConfig.js' ) )
506
505
resolveConfigFn = ( config ) => resolveConfig . default ( config , defaultConfig ( ) )
507
506
} catch ( _ ) {
@@ -522,7 +521,7 @@ export async function createProjectService(
522
521
523
522
if ( semver . gte ( tailwindcssVersion , '1.99.0' ) ) {
524
523
applyComplexClasses = firstOptional ( ( ) =>
525
- require ( resolveFrom ( tailwindDir , './lib/lib/substituteClassApplyAtRules' ) )
524
+ require ( resolveFrom ( tailwindDir , './lib/lib/substituteClassApplyAtRules' ) ) ,
526
525
)
527
526
} else if ( semver . gte ( tailwindcssVersion , '1.7.0' ) ) {
528
527
applyComplexClasses = require ( resolveFrom ( tailwindDir , './lib/flagged/applyComplexClasses' ) )
@@ -541,43 +540,39 @@ export async function createProjectService(
541
540
try {
542
541
let createContext = first (
543
542
( ) => {
544
- let createContextFn = require ( resolveFrom (
545
- configDir ,
546
- 'tailwindcss/lib/lib/setupContextUtils'
547
- ) ) . createContext
543
+ let createContextFn = require (
544
+ resolveFrom ( configDir , 'tailwindcss/lib/lib/setupContextUtils' ) ,
545
+ ) . createContext
548
546
assert . strictEqual ( typeof createContextFn , 'function' )
549
547
return ( state ) => createContextFn ( state . config )
550
548
} ,
551
549
( ) => {
552
- let createContextFn = require ( resolveFrom (
553
- configDir ,
554
- 'tailwindcss/lib/jit/lib/setupContextUtils'
555
- ) ) . createContext
550
+ let createContextFn = require (
551
+ resolveFrom ( configDir , 'tailwindcss/lib/jit/lib/setupContextUtils' ) ,
552
+ ) . createContext
556
553
assert . strictEqual ( typeof createContextFn , 'function' )
557
554
return ( state ) => createContextFn ( state . config )
558
555
} ,
559
556
// TODO: the next two are canary releases only so can probably be removed
560
557
( ) => {
561
- let setupTrackingContext = require ( resolveFrom (
562
- configDir ,
563
- 'tailwindcss/lib/jit/lib/setupTrackingContext'
564
- ) ) . default
558
+ let setupTrackingContext = require (
559
+ resolveFrom ( configDir , 'tailwindcss/lib/jit/lib/setupTrackingContext' ) ,
560
+ ) . default
565
561
assert . strictEqual ( typeof setupTrackingContext , 'function' )
566
562
return ( state ) =>
567
563
setupTrackingContext (
568
564
state . configPath ,
569
565
tailwindDirectives ,
570
- registerDependency
566
+ registerDependency ,
571
567
) ( result , root )
572
568
} ,
573
569
( ) => {
574
- let setupContext = require ( resolveFrom (
575
- configDir ,
576
- 'tailwindcss/lib/jit/lib/setupContext'
577
- ) ) . default
570
+ let setupContext = require (
571
+ resolveFrom ( configDir , 'tailwindcss/lib/jit/lib/setupContext' ) ,
572
+ ) . default
578
573
assert . strictEqual ( typeof setupContext , 'function' )
579
574
return ( state ) => setupContext ( state . configPath , tailwindDirectives ) ( result , root )
580
- }
575
+ } ,
581
576
)
582
577
583
578
jitModules = {
@@ -587,7 +582,7 @@ export async function createProjectService(
587
582
require ( resolveFrom ( configDir , 'tailwindcss/lib/lib/generateRules' ) ) . generateRules ,
588
583
( ) =>
589
584
require ( resolveFrom ( configDir , 'tailwindcss/lib/jit/lib/generateRules' ) )
590
- . generateRules
585
+ . generateRules ,
591
586
) ,
592
587
} ,
593
588
createContext : {
@@ -599,14 +594,14 @@ export async function createProjectService(
599
594
require ( resolveFrom ( configDir , 'tailwindcss/lib/lib/expandApplyAtRules' ) ) . default ,
600
595
( ) =>
601
596
require ( resolveFrom ( configDir , 'tailwindcss/lib/jit/lib/expandApplyAtRules' ) )
602
- . default
597
+ . default ,
603
598
) ,
604
599
} ,
605
600
evaluateTailwindFunctions : {
606
601
module : firstOptional (
607
602
( ) =>
608
603
require ( resolveFrom ( configDir , 'tailwindcss/lib/lib/evaluateTailwindFunctions' ) )
609
- . default
604
+ . default ,
610
605
) ,
611
606
} ,
612
607
}
@@ -670,7 +665,7 @@ export async function createProjectService(
670
665
671
666
try {
672
667
state . corePlugins = Object . keys (
673
- require ( resolveFrom ( path . dirname ( state . configPath ) , 'tailwindcss/lib/plugins/index.js' ) )
668
+ require ( resolveFrom ( path . dirname ( state . configPath ) , 'tailwindcss/lib/plugins/index.js' ) ) ,
674
669
)
675
670
} catch ( _ ) { }
676
671
@@ -693,7 +688,7 @@ export async function createProjectService(
693
688
rule . before (
694
689
postcss . comment ( {
695
690
text : '__ORIGINAL_SELECTOR__:' + rule . selector ,
696
- } )
691
+ } ) ,
697
692
)
698
693
rule . selector = newSelector
699
694
}
@@ -738,7 +733,7 @@ export async function createProjectService(
738
733
let designSystem = await loadDesignSystem (
739
734
state . modules . tailwindcss . module ,
740
735
state . configPath ,
741
- css
736
+ css ,
742
737
)
743
738
744
739
state . designSystem = designSystem
@@ -851,13 +846,13 @@ export async function createProjectService(
851
846
if ( ! projectConfig . isUserConfigured ) {
852
847
documentSelector = [
853
848
...documentSelector . filter (
854
- ( { priority } ) => priority !== DocumentSelectorPriority . CONTENT_FILE
849
+ ( { priority } ) => priority !== DocumentSelectorPriority . CONTENT_FILE ,
855
850
) ,
856
851
...getContentDocumentSelectorFromConfigFile (
857
852
state . configPath ,
858
853
tailwindcss . version ,
859
854
projectConfig . folder ,
860
- originalConfig
855
+ originalConfig ,
861
856
) ,
862
857
]
863
858
}
@@ -931,7 +926,7 @@ export async function createProjectService(
931
926
. join ( '\n' ) ,
932
927
{
933
928
from : undefined ,
934
- }
929
+ } ,
935
930
)
936
931
} catch ( error ) {
937
932
throw error
@@ -947,8 +942,8 @@ export async function createProjectService(
947
942
// chokidarWatcher?.add(state.dependencies)
948
943
watchPatterns (
949
944
( state . dependencies ?? [ ] ) . flatMap ( ( dep ) =>
950
- getWatchPatternsForFile ( dep , projectConfig . folder )
951
- )
945
+ getWatchPatternsForFile ( dep , projectConfig . folder ) ,
946
+ ) ,
952
947
)
953
948
954
949
state . configId = getConfigId ( state . configPath , state . dependencies )
@@ -1043,15 +1038,15 @@ export async function createProjectService(
1043
1038
let document = documentService . getDocument ( params . textDocument . uri )
1044
1039
if ( ! document ) return null
1045
1040
return getDocumentLinks ( state , document , ( linkPath ) =>
1046
- URI . file ( path . resolve ( path . dirname ( URI . parse ( document . uri ) . fsPath ) , linkPath ) ) . toString ( )
1041
+ URI . file ( path . resolve ( path . dirname ( URI . parse ( document . uri ) . fsPath ) , linkPath ) ) . toString ( ) ,
1047
1042
)
1048
1043
} ,
1049
1044
provideDiagnostics : debounce (
1050
1045
( document : TextDocument ) => {
1051
1046
if ( ! state . enabled ) return
1052
1047
provideDiagnostics ( state , document )
1053
1048
} ,
1054
- params . initializationOptions ?. testMode ? 0 : 500
1049
+ params . initializationOptions ?. testMode ? 0 : 500 ,
1055
1050
) ,
1056
1051
provideDiagnosticsForce : ( document : TextDocument ) => {
1057
1052
if ( ! state . enabled ) return
@@ -1071,7 +1066,7 @@ export async function createProjectService(
1071
1066
if ( ! document ) return [ ]
1072
1067
let className = document . getText ( params . range )
1073
1068
let match = className . match (
1074
- new RegExp ( `-\\[(${ colorNames . join ( '|' ) } |(?:(?:#|rgba?\\(|hsla?\\())[^\\]]+)\\]$` , 'i' )
1069
+ new RegExp ( `-\\[(${ colorNames . join ( '|' ) } |(?:(?:#|rgba?\\(|hsla?\\())[^\\]]+)\\]$` , 'i' ) ,
1075
1070
)
1076
1071
// let match = className.match(/-\[((?:#|rgba?\(|hsla?\()[^\]]+)\]$/i)
1077
1072
if ( match === null ) return [ ]
@@ -1193,7 +1188,7 @@ type Plugin = SimplePlugin | WrappedPlugin
1193
1188
function runPlugin (
1194
1189
plugin : Plugin ,
1195
1190
state : State ,
1196
- apiOverrides : Record < string , Function > = { }
1191
+ apiOverrides : Record < string , Function > = { } ,
1197
1192
) : void {
1198
1193
let config = state . config
1199
1194
let postcss = state . modules . postcss . module
@@ -1266,7 +1261,7 @@ function getVariants(state: State): Array<Variant> {
1266
1261
}
1267
1262
1268
1263
let fns = ( Array . isArray ( variantFnOrFns [ 0 ] ) ? variantFnOrFns : [ variantFnOrFns ] ) . map (
1269
- ( [ _sort , fn ] ) => fn
1264
+ ( [ _sort , fn ] ) => fn ,
1270
1265
)
1271
1266
1272
1267
let placeholder = '__variant_placeholder__'
@@ -1324,7 +1319,7 @@ function getVariants(state: State): Array<Variant> {
1324
1319
definition = `@${ rule . name } ${ rule . params } `
1325
1320
}
1326
1321
} ,
1327
- } )
1322
+ } ) ,
1328
1323
)
1329
1324
1330
1325
if ( ! definition ) {
@@ -1355,7 +1350,7 @@ function getVariants(state: State): Array<Variant> {
1355
1350
return definitions
1356
1351
} ,
1357
1352
} )
1358
- }
1353
+ } ,
1359
1354
)
1360
1355
1361
1356
return result
@@ -1454,7 +1449,7 @@ async function getPlugins(config: any) {
1454
1449
return {
1455
1450
name : fnName ,
1456
1451
}
1457
- } )
1452
+ } ) ,
1458
1453
)
1459
1454
}
1460
1455
@@ -1470,7 +1465,7 @@ function getPackageRoot(cwd: string, rootDir: string) {
1470
1465
return findUp . stop
1471
1466
}
1472
1467
} ,
1473
- { cwd }
1468
+ { cwd } ,
1474
1469
)
1475
1470
return pkgJsonPath ? path . dirname ( pkgJsonPath ) : rootDir
1476
1471
} catch {
@@ -1482,7 +1477,7 @@ function getContentDocumentSelectorFromConfigFile(
1482
1477
configPath : string ,
1483
1478
tailwindVersion : string ,
1484
1479
rootDir : string ,
1485
- actualConfig ?: any
1480
+ actualConfig ?: any ,
1486
1481
) : DocumentSelector [ ] {
1487
1482
let config = actualConfig ?? require ( configPath )
1488
1483
let contentConfig : unknown = config . content ?. files ?? config . content
@@ -1501,7 +1496,7 @@ function getContentDocumentSelectorFromConfigFile(
1501
1496
. map ( ( item ) =>
1502
1497
item . startsWith ( '!' )
1503
1498
? `!${ path . resolve ( contentBase , item . slice ( 1 ) ) } `
1504
- : path . resolve ( contentBase , item )
1499
+ : path . resolve ( contentBase , item ) ,
1505
1500
)
1506
1501
. map ( ( item ) => ( {
1507
1502
pattern : normalizePath ( item ) ,
0 commit comments