Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var makeRequire = (base, root) => (path, callback) => {
var dir = dirName(base) || '.',
url = cononicalPath.normalize(dir + '/' + path + '.lua')
;(DEPENDENCY_MAP[base] || (DEPENDENCY_MAP[base] = { }))[url] = 1
if (checkDependency(base, url))
throw 'circular dependency found between `' + base + '` and `' + url + '` !'
// use async loader
if (callback !== undefined) {
if (!IMPORT_CACHE[url])
IMPORT_CACHE[url] = doRequireAsync(url, root)
IMPORT_CACHE[url].then(callback)
}
// use sync loader
else {
if (!IMPORT_CACHE[url])
IMPORT_CACHE[url] = doRequireSync(url, root)
return IMPORT_CACHE[url]
newFileName = basename + extension + ext;
}
else {
newFileName = basename + ext;
}
// If this is a stable release
if (releaseDir) {
// Create the stable directory if it doesn't exist
if (!fs.existsSync(releaseDir)) {
fs.mkdirSync(releaseDir);
}
var releasePath = path.join(releaseDir, oldFileName);
if (path.normalize(f) !== path.normalize(releasePath)) {
grunt.log.writeln('Copying ' + f + ' to ' + releasePath);
// fs.createReadStream(f).pipe(fs.createWriteStream(stablePath));
shell.cp('-f', f, releasePath);
}
}
var newPath = path.join(file.dest, newFileName);
if (path.normalize(f) !== path.normalize(newPath)) {
grunt.log.writeln('Copying ' + f + ' to ' + newPath);
// fs.createReadStream(f).pipe(fs.createWriteStream(newPath));
shell.cp('-f', f, newPath);
}
if (options.cleanup && path.normalize(f) !== path.normalize(newPath)) {
grunt.log.writeln('Unlinking ' + f, newPath);
options.styles = _.map(options.styles, function(file) {
var fileName = path.normalize(file);
if (/^((https?:)?\/\/)/.test(file)) {
return file;
} else {
fstreams.push(streamFile(file, path.join('css', path.dirname(fileName)), fakeDest));
return path.join('css', fileName);
}
});
options.scripts = _.map(options.scripts, function (file) {
var fileName = path.normalize(file);
scriptNames.push(fileName);
if (/^((https?:)?\/\/)/.test(file)) {
return file;
} else {
fstreams.push(streamFile(file, path.join('js', path.dirname(fileName)), fakeDest));
return path.join('js', fileName);
}
});
_.forEach(defaultScripts, function (script, i) {
var fileName = path.normalize(script).split('/').pop();
if (scriptNames.indexOf(fileName) === -1) {
fstreams.push(streamFile(script, 'js', fakeDest));
options.scripts.splice(i, 0, path.join('js', fileName));
}
});
_(main).map(function (file) {
return path.relative(path.normalize(bowerDir), path.normalize(file));
}).filter(function (file) {
var res = false;