-
-
Notifications
You must be signed in to change notification settings - Fork 191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: imporove dir match && add glob exclude #392
Conversation
I feel it might be better to normalize the glob instead. Say a dir without any wildcard, like |
Sorry, did you mean we will normalize the input? If the user input is 'src/utils', I will transform it to 'src/utils/*.xx'. |
Something like |
hh,ok |
src/core/ctx.ts
Outdated
@@ -19,7 +19,8 @@ export function createContext(options: Options = {}, root = process.cwd()) { | |||
dts: preferDTS = isPackageExists('typescript'), | |||
} = options | |||
|
|||
const dirs = options.dirs?.map(dir => resolve(root, dir)) | |||
const filePattern = '*.{tsx,jsx,ts,js,mjs,cjs,mts,cts}' | |||
const dirs = options.dirs?.map(dir => resolve(root, dir, !dir.includes('*') ? filePattern : '')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not seem to handle !
right? Can we extract this as a function and do some unit test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, unplugin-vue-components already has pr: unplugin/unplugin-vue-components#645
if that pr passed, I will change unplugin-auto-import code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@antfu I'm afraid this pr won't pass, so i am waiting.
scanDirExports from unimport can not work with glob exclude, so I write a new one. |
@lishaobos looks good. If you want, you could send a PR to unimport so we could remove the workaround here. |
of course, i will send a pr later. |
Description
config:
dir structure:
when i add new api and export in test.ts, dts can not update,
because minimatch('src/utils/test.ts', 'src/utils') return false
Linked Issues
Additional context