Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Vow.all(bhFiles.map(function(file) {
return vowFs.read(file.fullname, 'utf8').then(function(data) {
var relPath = node.relativePath(file.fullname);
return '// begin: ' + relPath + '\n' +
bhClientProcessor.process(data) + '\n' +
'// end: ' + relPath + '\n';
});
})).then(function(sr) {
return sr.join('\n');
return fileCache.get(file.fullname, file.mtime).then(function (codeFromCache) {
// Если кэш пуст, то читаем исходный файл
if (codeFromCache === null) {
return vowFs.read(file.fullname).then(function (codeFromFile) {
// Явно приводим трансформаторы к массиву
var transformators = [].concat(_this._transformators);
// Так как, трансформаторы могут быть промисами, то работаем через промисы
var firstPromise = vow.resolve(codeFromFile);
// Запускаем последовательое преоброазоваение каждым трансформатором
var resultPromise = _.reduce(transformators, function (promise, transformator) {
return promise.then(function (result) {
if (Buffer.isBuffer(result)) {
result = result.toString();
}
return transformator(result, jobQueue);
});
}, firstPromise);
process: function(sourcePath, targetPath) {
return vowFs.read(sourcePath, 'utf8').then(function(data) {
return vowFs.write(targetPath, uglifyJs(data), 'utf8');
});
}
});
process: function(sourcePath, targetPath, preserveStructure) {
return vowFs.read(sourcePath, 'utf8').then(function(data) {
data = csso.justDoIt(data, preserveStructure);
return vowFs.write(targetPath, data, 'utf8');
});
}
});
Checker.prototype.checkFile = function(path) {
if (this._configuration.isFileExcluded(path)) {
return Vow.resolve(null);
}
return vowFs.read(path, 'utf8').then(function(data) {
return this.checkString(data, path);
}, this);
};
return fs.exists(entityPath).then(function(exists) {
if(exists) {
return fs.read(entityPath, 'utf-8').then(function(data) {
return {
tech: data,
level: entityPath
};
});
} else {
return {
tech: 'WRITE SOME CODE FOR THIS LEVEL HERE',
level: entityPath
};
}
});
}, this))
return vow.all(langs.map(function (lang) {
return vow.all([
vowFs.read(path.join(errorBundlesPath, 'error-404', 'error-404.' + lang + '.html'), 'utf-8'),
vowFs.read(path.join(errorBundlesPath, 'error-500', 'error-500.' + lang + '.html'), 'utf-8')
]).spread(function (error404, error500) {
errorPages[lang] = {
error404: error404.replace(/\{STATICS_HOST\}/g, staticsUrl),
error500: error500.replace(/\{STATICS_HOST\}/g, staticsUrl)
};
});
}))
.then(function () {
this.load = function (options) {
logger.debug(util.format('load data from file %s', options.path), module);
return vowFs.read(options.path, 'utf-8');
};
.then(function () {
return vowFs.read(reportFile);
})
.then(function (json) {
.act(function (opts, args) {
return vow.all([
vfs.read(path.resolve(args.path1), 'utf-8'),
vfs.read(path.resolve(args.path2), 'utf-8'),
opts.config ? vfs.read(path.resolve(opts.config)) : undefined
]).spread(function (html1, html2, config) {
config = config ? JSON.parse(config) : {};
if (opts.preset) {
config.preset = opts.preset;
}
var options = defaults(config),
loggerOptions = {
charsAroundDiff: opts.charsAroundDiff
},
htmlDiffer = new HtmlDiffer(options);
diffLogger.logDiffText(htmlDiffer.diffHtml(html1, html2), loggerOptions);