Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const tasks = [];
const globs = [];
for (const file of job.files) {
const absoluteFilePath = upath.join(libraryPath, file);
const relativeFilePath = upath.relative(libraryPath, absoluteFilePath);
if (relativeFilePath.startsWith('../')) {
Shout_1.Shout.warning(`Copy skip: ${chalk.cyan(file)} is outside library ${chalk.cyan(job.library)} folder!`);
continue;
}
try {
const fileStats = yield fse.lstat(absoluteFilePath);
if (fileStats.isFile()) {
globs.push(FastGlob.escapePath(relativeFilePath));
}
else if (fileStats.isDirectory()) {
const globbedPath = upath.join(FastGlob.escapePath(relativeFilePath), '**');
globs.push(globbedPath);
}
else {
Shout_1.Shout.warning(`Copy skip: ${absoluteFilePath} is neither a file nor a folder?!`);
}
}
catch (e) {
if (FastGlob.isDynamicPattern(relativeFilePath)) {
globs.push(relativeFilePath);
}
}
}
const assets = yield FastGlob(globs, {
cwd: libraryPath
});
const commonPath = this.findCommonParentFolderPath(assets);
return __awaiter(this, void 0, void 0, function* () {
const libraryPath = upath.join(this.pathFinder.npmFolder, job.library);
const targetPath = upath.join(this.pathFinder.outputFolderPath, job.destination);
const tasks = [];
const globs = [];
for (const file of job.files) {
const absoluteFilePath = upath.join(libraryPath, file);
const relativeFilePath = upath.relative(libraryPath, absoluteFilePath);
if (relativeFilePath.startsWith('../')) {
Shout_1.Shout.warning(`Copy skip: ${chalk.cyan(file)} is outside library ${chalk.cyan(job.library)} folder!`);
continue;
}
try {
const fileStats = yield fse.lstat(absoluteFilePath);
if (fileStats.isFile()) {
globs.push(FastGlob.escapePath(relativeFilePath));
}
else if (fileStats.isDirectory()) {
const globbedPath = upath.join(FastGlob.escapePath(relativeFilePath), '**');
globs.push(globbedPath);
}
else {
Shout_1.Shout.warning(`Copy skip: ${absoluteFilePath} is neither a file nor a folder?!`);
}
}
catch (e) {
if (FastGlob.isDynamicPattern(relativeFilePath)) {
globs.push(relativeFilePath);
}
}
}
const assets = yield FastGlob(globs, {