Skip to content

Commit

Permalink
feat: support string array as well as Regexp matched files
Browse files Browse the repository at this point in the history
  • Loading branch information
deepjoy committed Jul 19, 2024
1 parent e5a4870 commit d07c49a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const unpluginFactory: UnpluginFactory<UnpluginStylexOptions | undefined>
// for handle vite
const questionMarkIndex = extname.indexOf('?')
const validExtName = questionMarkIndex > -1 ? extname.slice(0, questionMarkIndex) : extname
return validExts.test(validExtName)
return validExts instanceof RegExp ? validExts.test(validExtName) : validExts.includes(validExtName)
},

async transform(code, id) {
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export type StylexOptions = {

export type UnpluginStylexOptions = {
// compiler?: string
validExts?: RegExp
validExts?: RegExp | string[]
dev?: boolean
// enforce?: 'post' | 'pre'
stylex?: StylexOptions
Expand Down

0 comments on commit d07c49a

Please sign in to comment.