Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
pathPrefixes = env.opts._.reduce(function(result, fileOrDir) {
fileOrDir = path.resolve( path.normalize(fileOrDir) );
if ( fs.statSync(fileOrDir).isDirectory() ) {
// ensure a trailing path separator
if ( fileOrDir.indexOf(path.sep, fileOrDir.length - path.sep.length) < 0 ) {
fileOrDir += path.sep;
}
result.push(fileOrDir);
}
return result;
}, []);
resourceNamePrefixes = pluginConfig.resourceNamePrefixes || [];
function resolveSourcePath(filepath) {
return path.resolve(process.cwd(), filepath);
}
staticFilePaths.forEach(function(filePath) {
var extraStaticFiles;
filePath = path.resolve(env.pwd, filePath);
extraStaticFiles = staticFileScanner.scan([filePath], 10, staticFileFilter);
extraStaticFiles.forEach(function(fileName) {
var sourcePath = fs.toDir(filePath);
var toDir = fs.toDir( fileName.replace(sourcePath, outdir) );
fs.mkPath(toDir);
fs.copyFileSync(fileName, toDir);
});
});
}
function resolveSourcePath(filepath) {
return path.resolve(process.cwd(), filepath);
}
function resolveSourcePath(filepath) {
return path.resolve(process.cwd(), filepath);
}
function getRelativePath(filename) {
var relative = path.resolve(filename);
for ( var i = 0; i < pathPrefixes.length; i++ ) {
if ( relative.indexOf(pathPrefixes[i]) === 0 ) {
relative = relative.slice(pathPrefixes[i].length);
break;
}
}
return relative.replace(/\\/g, '/');
}
function resolveSourcePath(filepath) {
return path.resolve(process.cwd(), filepath);
}
staticFilePaths.forEach(function(filePath) {
var extraStaticFiles;
filePath = path.resolve(env.pwd, filePath);
extraStaticFiles = staticFileScanner.scan([filePath], 10, staticFileFilter);
extraStaticFiles.forEach(function(fileName) {
var sourcePath = fs.toDir(filePath);
var toDir = fs.toDir( fileName.replace(sourcePath, outdir) );
fs.mkPath(toDir);
fs.copyFileSync(fileName, toDir);
});
});
}
staticFilePaths.forEach(function(filePath) {
var extraStaticFiles;
filePath = path.resolve(env.pwd, filePath);
extraStaticFiles = staticFileScanner.scan([filePath], 10, staticFileFilter);
extraStaticFiles.forEach(function(fileName) {
var sourcePath = fs.toDir(filePath);
var toDir = fs.toDir( fileName.replace(sourcePath, outdir) );
fs.mkPath(toDir);
fs.copyFileSync(fileName, toDir);
});
});
}