import path from 'path' ; import type { Ast } from 'svelte/types/compiler/interfaces.d' ; param includePaths param filename returns export const isFileIncluded = async ( includePaths , filename ) : Promise < boolean > => { if ( includePaths . length < 1 ) { return true ; } const isIncluded = await new Promise ( ( resolve ) : void => { includePaths . forEach ( ( includePath , index ) : void => { if ( filename . indexOf ( path . resolve ( includePath ) ) !== - 1 ) { resolve ( true ) ; } if ( index === includePaths . length - 1 ) { resolve ( false ) ; } } ) ; } ) ; return isIncluded ; } ; param content returns export const hasModuleImports = ( content ) : boolean => { const pattern = /(?<!\/\/\s*)import\s*(?:(.+)\s+from\s+)?['|"](.+?(module\.s?css))['|"];?/gm ; return content . search ( pattern ) !== - 1 ; } ; param ast returns export const hasModuleAttribute = ( ast ) : boolean => { const moduleAttribute = ast ?. css ?. attributes . find ( ( item ) => item . name === 'module' ) ; return moduleAttribute !== undefined ; } ;