Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions packages/vite/src/node/plugins/importMetaGlob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,23 +66,30 @@ export function importGlobPlugin(config: ResolvedConfig): Plugin {
config.logger,
)
if (result) {
const allGlobs = result.matches.map((i) => i.globsResolved)
if (!importGlobMaps.has(this.environment)) {
importGlobMaps.set(this.environment, new Map())
}

const globMatchers = allGlobs.map((globs) => {
const globMatchers = result.matches.map((i) => {
const affirmed: string[] = []
const negated: string[] = []
for (const glob of globs) {
for (const glob of i.globsResolved) {
if (glob[0] === '!') {
negated.push(glob.slice(1))
} else {
affirmed.push(glob)
}
}
const affirmedMatcher = picomatch(affirmed)
const negatedMatcher = picomatch(negated)
const affirmedMatcher = picomatch(affirmed, {
noextglob: true,
dot: !!i.options.exhaustive,
ignore: i.options.exhaustive ? [] : ['**/node_modules/**'],
})
const negatedMatcher = picomatch(negated, {
noextglob: true,
dot: !!i.options.exhaustive,
ignore: i.options.exhaustive ? [] : ['**/node_modules/**'],
})
Comment on lines +83 to +92

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

await glob(globsResolved, {
absolute: true,
cwd,
dot: !!options.exhaustive,
expandDirectories: false,
ignore: options.exhaustive ? [] : ['**/node_modules/**'],
extglob: false,
})


return (file: string) => {
// (glob1 || glob2) && !(glob3 || glob4)...
Expand Down
Loading