How to use fast-glob

Comprehensive fast-glob code examples:

How to use fast-glob.escapePath:

149
150
151
152
153
154
155
156
157
158
		? path.join(globCWD, entry)
		: path.normalize(entry);

	if (fs.existsSync(absolutePath)) {
		// This path points to a file. Return an escaped path to avoid globbing
		return fastGlob.escapePath(normalizePath(entry));
	}

	return entry;
});

How to use fast-glob.isDynamicPattern:

173
174
175
176
177
178
179
180
181
182
183


module.exports.generateGlobTasks = generateGlobTasks;


module.exports.hasMagic = (patterns, options) => []
	.concat(patterns)
	.some(pattern => fastGlob.isDynamicPattern(pattern, options));


module.exports.gitignore = gitignore;

How to use fast-glob.stream:

164
165
166
167
168
169
170
171
172
173
174
175


	const filter = getFilterSync(options);
	const filterStream = new FilterStream(p => !filter(p));
	const uniqueStream = new UniqueStream();


	return merge2(tasks.map(task => fastGlob.stream(task.pattern, task.options)))
		.pipe(filterStream)
		.pipe(uniqueStream);
};

How to use fast-glob.sync:

60
61
62
63
64
65
66
67
68
  .mockReturnValue('serviceAcc')
  .mockReturnValue(file);

core.getBooleanInput.mockReturnValue(dryRun);

fg.sync.mockReturnValue([file]);

mockFs({ [file]: configFixtures.valid });
loadSecrets.mockResolvedValue(secrets);

How to use fast-glob.default:

156
157
158
159
160
161
162
163
164
165
},
readContentPaths () {
    let content = [];
    // Resolve globs from the content config
    // TODO: When we make the postcss plugin async-capable this can become async
    let files = _fastGlob.default.sync(this.contentPatterns.all);
    for (let file of files){
        if (_sharedState.env.OXIDE) {
            content.push({
                file,