Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function execFileGlobs (globs, baseDir) {
// NOTE: We have to create glob tasks, execute them and sort their results separately to preserve the same item order
// as in the older globby versions (<7.1.1)
const tasks = globby.generateGlobTasks(globs, { cwd: baseDir, expandDirectories: false, onlyFiles: true });
const files = await Promise.all(tasks.map(getFiles));
return flatten(files);
}
)
}
const files = args._ && args._.length
? args._
: ['src/**/*.ts', 'src/**/*.tsx', 'tests/**/*.ts', 'tests/**/*.tsx']
// respect linterOptions.exclude from tslint.json
if (config && config.linterOptions && config.linterOptions.exclude) {
// use the raw tslint.json data because config contains absolute paths
const rawTslintConfig = JSON.parse(fs.readFileSync(tslintConfigPath, 'utf-8'))
const excludedGlobs = rawTslintConfig.linterOptions.exclude
excludedGlobs.forEach((g) => files.push('!' + g))
}
return globby(files, { cwd }).then(files => {
files.forEach(lint)
if (silent) return
const result = linter.getResult()
if (!result) {
console.log(`No result.\n`)
} else if (result.output.trim()) {
process.stdout.write(result.output)
} else if (result.fixes && result.fixes.length) {
// some formatters do not report fixes.
const f = new tslint.Formatters.ProseFormatter()
process.stdout.write(f.format(result.failures, result.fixes))
} else if (!result.failures.length) {
console.log(`No lint errors found.\n`)
}
if (result.failures.length && !args.force) {
private findElmFilesInFolder(element: [string, boolean]): IFolder[] {
// Cleanup the path on windows, as globby does not like backslashes
const globUri = element[0].replace(/\\/g, "/");
return globby
.sync(`${globUri}/**/*.elm`, { suppressErrors: true })
.map(matchingPath => ({ path: matchingPath, writable: element[1] }));
}
paths = _.filter(paths, (pathName) => {
const exclude = _.endsWith(pathName, '/') === true;
if (exclude) {
appendPaths.push(pathName + '**/*.js');
appendPaths.push(pathName + '**/*.css');
appendPaths.push(pathName + '**/*.scss');
}
return !exclude;
});
paths = paths.concat(appendPaths);
paths = _.uniq(paths);
paths = glob.sync(paths);
// @todo Test whether glob.sync can return non-unique file paths.
// paths = _.unique(paths);
paths = _.map(paths, resolveAbsolutePath);
return paths;
};
'!**/wallaby.js',
'!**/karma-test-shim.js',
'!**/karma.conf.js',
'!**/test.ts',
'!**/tsconfig.app.json',
'!**/*stackblitz.*'
];
// exclude all specs if no spec is mentioned in `files[]`
if (!includeSpec) {
defaultExcludes.push('!**/*.spec.*','!**/spec.js');
}
gpaths.push(...defaultExcludes);
config.fileNames = globby.sync(gpaths, { ignore: ["**/node_modules/**"] });
return config;
}
}
public async reset() {
this.logWithMetadata(['info', 'optimize:watch_cache'], 'The optimizer watch cache will reset');
// start by deleting the state file to lower the
// amount of time that another process might be able to
// successfully read it once we decide to delete it
await del(this.statePath, { force: true });
// delete everything in optimize/.cache directory
await del(await globby([normalizePosixPath(this.cachePath)], { dot: true }));
// delete some empty folder that could be left
// from the previous cache path reset action
await deleteEmpty(this.cachePath);
// delete dlls
await del(this.dllsPath);
// re-write new cache state file
await this.write();
this.logWithMetadata(['info', 'optimize:watch_cache'], 'The optimizer watch cache has reset');
}
async function main() {
const inputFiles = program.args.length == 0 ? DEFAULT_FILES : program.args;
const paths = await globby([...inputFiles, ...IGNORED_FILES]);
paths.forEach(filePath => {
// $FlowFixMe: flow doesn't accept dynamic require
require(path.resolve(process.cwd(), filePath));
});
// Get all suites to run
const input = getBenchmark();
const previous = program.compare
? await loadResult(path.resolve(process.cwd(), program.compare))
: null;
const reporter = new BackgroundReporter();
// Setup options for scenarios
const options = {
function parseGlobs (args, parsed) {
let patterns = [];
if (parsed.globIndex === -1 && globby.hasMagic(args[0])) {
while (args[0] && args[0][0] !== "-") {
// We found an entry file glob pattern
let pattern = args.shift();
patterns.push(pattern);
// Set the baseDir, if not already set
parsed.baseDir = parsed.baseDir || helpers.getBaseDir(pattern);
}
if (patterns.length) {
// We found entry file(s), so set the glob index and create the glob function
parsed.globIndex = parsed.args.length;
parsed.args.push((options) => {
return globby.sync(patterns, options);
});
}
async function strictGlobMatch(file: string, options: object): Promise {
let matches = await globby(file, options);
if (matches.length === 0) {
if (hasMagic(file)) {
throw new Error(`Could not find any files matching "${file}".`);
}
else {
throw new Error(`Could not find file: ${file}.`);
}
}
// Return files in a predictable order
return matches.sort();
}
cfg.plugins.use('autoinstall', require('@rollup/plugin-auto-install'), [{}])
}
// if (['umd', 'iife'].includes(cfg.output.format)) {
cfg.plugins
.use('node-resolve', require('rollup-plugin-node-resolve'), [{
main: false,
module: true,
jsnext: true,
extensions: ['.js', '.json'],
preferBuiltIns: true,
browser: true
}])
// }
if (globby.hasMagic(cfg.input)) {
cfg.plugins.use('multi-entry', require('rollup-plugin-multi-entry'), [])
}
}
},