@@ -16,7 +16,6 @@ import resolveFrom from './util/resolveFrom'
16
16
import { type Feature , supportedFeatures } from '@tailwindcss/language-service/src/features'
17
17
import { pathToFileURL } from 'node:url'
18
18
import { resolveCssImports } from './resolve-css-imports'
19
- import type { GlobEntry } from '@tailwindcss/oxide'
20
19
21
20
export interface ProjectConfig {
22
21
/** The folder that contains the project */
@@ -439,38 +438,36 @@ async function* contentSelectorsFromCssConfig(entry: ConfigEntry): AsyncIterable
439
438
}
440
439
} else if ( item . kind === 'auto' && ! auto ) {
441
440
auto = true
442
- for await ( let file of detectContentFiles ( entry . packageRoot ) ) {
443
- if ( typeof file === 'string' ) {
444
- yield {
445
- pattern : normalizePath ( file ) ,
446
- priority : DocumentSelectorPriority . CONTENT_FILE ,
447
- }
441
+ for await ( let pattern of detectContentFiles ( entry . packageRoot ) ) {
442
+ yield {
443
+ pattern,
444
+ priority : DocumentSelectorPriority . CONTENT_FILE ,
448
445
}
449
446
}
450
447
}
451
448
}
452
449
}
453
450
454
- async function * detectContentFiles ( base : string ) : AsyncIterable < string | GlobEntry > {
451
+ async function * detectContentFiles ( base : string ) : AsyncIterable < string > {
455
452
try {
456
453
let oxidePath = resolveFrom ( path . dirname ( base ) , '@tailwindcss/oxide' )
457
454
oxidePath = pathToFileURL ( oxidePath ) . href
458
455
456
+ const oxide : typeof import ( '@tailwindcss/oxide' ) = await import ( oxidePath )
457
+
459
458
// This isn't a v4 project
460
- const oxide = await import ( oxidePath )
459
+ if ( ! oxide . scanDir ) return
461
460
462
- function validateOxide ( input : any ) : input is typeof import ( '@tailwindcss/oxide' ) {
463
- return ! ! oxide . scanDir
464
- }
461
+ let { files, globs } = oxide . scanDir ( { base, globs : true } )
465
462
466
- if ( ! validateOxide ( oxide ) ) {
467
- return
463
+ for ( let file of files ) {
464
+ yield normalizePath ( file )
468
465
}
469
466
470
- let { files , globs } = oxide . scanDir ( { base , globs : true } )
471
-
472
- yield * files
473
- yield * globs
467
+ for ( let { base , glob } of globs ) {
468
+ // Do not normalize the glob itself as it may contain escape sequences
469
+ yield normalizePath ( base ) + '/' + glob
470
+ }
474
471
} catch {
475
472
//
476
473
}
0 commit comments