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 getAssetFilesAsync(
projectDir: string,
options: OptimizationOptions
): Promise<{ allFiles: string[]; selectedFiles: string[] }> {
const { exp } = await readConfigJsonAsync(projectDir, true, true);
const webOutputPath = await getWebOutputPath(exp);
const { assetBundlePatterns } = exp;
const globOptions = {
cwd: projectDir,
ignore: ['**/node_modules/**', '**/ios/**', '**/android/**', `**/${webOutputPath}/**`],
};
// All files must be returned even if flags are passed in to properly update assets.json
const allFiles: string[] = [];
const patterns = assetBundlePatterns || ['**/*'];
patterns.forEach((pattern: string) => {
allFiles.push(...glob.sync(pattern, globOptions));
});
// If --include is passed in, only return files matching that pattern
const included =
options && options.include ? [...glob.sync(options.include, globOptions)] : allFiles;
const toExclude = new Set();