本文整理汇总了TypeScript中minimatch.default方法的典型用法代码示例。如果您正苦于以下问题:TypeScript minimatch.default方法的具体用法?TypeScript minimatch.default怎么用?TypeScript minimatch.default使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类minimatch
的用法示例。
在下文中一共展示了minimatch.default方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: minimatch
return (globs || []).some(glob => {
try {
const globStat = lstatSync(join(configDir, glob))
const newGlob = glob.length === 0 ? '.' : glob
const globToMatch = globStat.isDirectory() ? `${glob}/**` : glob
return minimatch(filePath, globToMatch, { matchBase: true })
} catch (error) {
// Out of errors that lstat provides, EACCES and ENOENT are the
// most likely. For both cases, run the match with the raw glob
// and return the result.
return minimatch(filePath, glob, { matchBase: true })
}
})
示例2: minimatch
export const getModuleSourceDirectory = (state: ApplicationState) => {
if (state.fileCache.length) {
const pcFileCacheItem = state.fileCache.find((item) => (
minimatch(state.options.projectConfig.sourceFilePattern, item.filePath)
));
if (pcFileCacheItem) {
return path.dirname(pcFileCacheItem.filePath);
}
}
const sourceFiles = getModuleFilePaths(state);
if (!sourceFiles.length) {
if (minimatch(state.options.projectConfig.sourceFilePattern, DEFAULT_COMPONENT_SOURCE_DIRECTORY)) {
return path.join(state.options.cwd,DEFAULT_COMPONENT_SOURCE_DIRECTORY);
} else {
// scan for ALL files and directories if source directory does not match
const allFiles = glob.sync(state.options.projectConfig.sourceFilePattern.replace(/\.*\w+$/, ""));
for (const file of allFiles) {
if (fs.lstatSync(file).isDirectory()) {
return file;
}
}
}
}
return path.dirname(sourceFiles[0]);
}
示例3:
const shouldUnpackFile = (file: VinylFile): boolean => {
for (let i = 0; i < unpackGlobs.length; i++) {
if (minimatch(file.relative, unpackGlobs[i])) {
return true;
}
}
return false;
};
示例4:
keys.forEach((key) => {
if (!minimatch(key, dependency)) {
return;
}
if (fullDependencies.indexOf(key) === -1) {
fullDependencies.push(key);
}
fullDependencies = fullDependencies.concat(traverse(treeStorage[key]));
});
示例5: while
patterns.forEach(function (pattern) {
if (pattern[0] === "!") {
i = list.length - 1;
while (i > -1) {
if (!minimatch(list[i], pattern)) {
list.splice(i, 1);
}
i--;
}
}
else {
var newList = glob.sync(pattern, options);
newList.forEach(function (item) {
if (list.indexOf(item) === -1) {
list.push(item);
}
});
}
});
示例6:
sourceFiles = sourceFiles.filter(source => !minimatch(source, `**/${constants.TNS_MODULES_FOLDER_NAME}/**`, { nocase: true }));
示例7:
if (paths.find(path => minimatch(path, watcher.source))) {
示例8: minimatch
fileGlobs.some(p => minimatch(relativeFilePath, p));
示例9: minimatch
constants.LIVESYNC_EXCLUDED_FILE_PATTERNS.forEach(pattern => scriptRelatedFiles = _.concat(scriptRelatedFiles, localToDevicePaths.filter(file => minimatch(file.getDevicePath(), pattern, { nocase: true }))));