Skip to content

Commit e167725

Browse files
committedAug 24, 2021
Ensure async method is completely async
Fixes #190
1 parent c69526f commit e167725

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed
 

‎index.js

+15-3
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,19 @@ const getFilterSync = options => options && options.gitignore
9696
? isGitIgnoredSync({cwd: options.cwd, ignore: options.ignore})
9797
: DEFAULT_FILTER;
9898

99-
const globToTask = task => glob => {
99+
const globToTask = task => async glob => {
100+
const {options} = task;
101+
if (options.ignore && Array.isArray(options.ignore) && options.expandDirectories) {
102+
options.ignore = await dirGlob(options.ignore);
103+
}
104+
105+
return {
106+
pattern: glob,
107+
options,
108+
};
109+
};
110+
111+
const globToTaskSync = task => glob => {
100112
const {options} = task;
101113
if (options.ignore && Array.isArray(options.ignore) && options.expandDirectories) {
102114
options.ignore = dirGlob.sync(options.ignore);
@@ -135,7 +147,7 @@ export const globbySync = (patterns, options) => {
135147

136148
const tasks = [];
137149
for (const task of globTasks) {
138-
const newTask = getPattern(task, dirGlob.sync).map(globToTask(task));
150+
const newTask = getPattern(task, dirGlob.sync).map(globToTaskSync(task));
139151
tasks.push(...newTask);
140152
}
141153

@@ -154,7 +166,7 @@ export const globbyStream = (patterns, options) => {
154166

155167
const tasks = [];
156168
for (const task of globTasks) {
157-
const newTask = getPattern(task, dirGlob.sync).map(globToTask(task));
169+
const newTask = getPattern(task, dirGlob.sync).map(globToTaskSync(task));
158170
tasks.push(...newTask);
159171
}
160172

0 commit comments

Comments
 (0)
Please sign in to comment.