@@ -16,7 +16,6 @@ import resolveFrom from './util/resolveFrom'
1616import { type Feature , supportedFeatures } from '@tailwindcss/language-service/src/features'
1717import { pathToFileURL } from 'node:url'
1818import { resolveCssImports } from './resolve-css-imports'
19- import type { GlobEntry } from '@tailwindcss/oxide'
2019
2120export interface ProjectConfig {
2221 /** The folder that contains the project */
@@ -439,38 +438,36 @@ async function* contentSelectorsFromCssConfig(entry: ConfigEntry): AsyncIterable
439438 }
440439 } else if ( item . kind === 'auto' && ! auto ) {
441440 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 ,
448445 }
449446 }
450447 }
451448 }
452449}
453450
454- async function * detectContentFiles ( base : string ) : AsyncIterable < string | GlobEntry > {
451+ async function * detectContentFiles ( base : string ) : AsyncIterable < string > {
455452 try {
456453 let oxidePath = resolveFrom ( path . dirname ( base ) , '@tailwindcss/oxide' )
457454 oxidePath = pathToFileURL ( oxidePath ) . href
458455
456+ const oxide : typeof import ( '@tailwindcss/oxide' ) = await import ( oxidePath )
457+
459458 // This isn't a v4 project
460- const oxide = await import ( oxidePath )
459+ if ( ! oxide . scanDir ) return
461460
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 } )
465462
466- if ( ! validateOxide ( oxide ) ) {
467- return
463+ for ( let file of files ) {
464+ yield normalizePath ( file )
468465 }
469466
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+ }
474471 } catch {
475472 //
476473 }
0 commit comments