Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return through.obj(function(file: any, encoding: any, callback: any) {
if (file.isNull()) {
// nothing to do
return callback(null, file);
}
if (file.isBuffer()) {
const res = buildOptimizer({
content: file.contents.toString(),
emitSourceMap: true
});
if (res.content) {
file.contents = Buffer.from(res.content + inlineSourceMap(res.sourceMap), encoding);
}
return callback(null, file);
}
});
};
const buildOptimize = await ls(path.normalize('out-tsc/**/*.component.js')).forEach(function (file) {
let content = fs.readFileSync(file, 'utf-8');
fs.writeFileSync(file, buildOptimizer({ content: content }).content);
});
transform(content, id) {
let isSideEffectFree = false;
if(id.indexOf('node_modules/@angular') > -1 || id.indexOf('node_modules/rxjs') > -1){
isSideEffectFree = true;
}
const { content: code, sourceMap: map } = buildOptimizer.buildOptimizer({
content, inputFilePath: id, emitSourceMap: true, isSideEffectFree,
});
return { code, map };
}
}
readFile(file, 'utf-8', (err, data) => {
if (err) rej(err);
writeFile(file, buildOptimizer({ content: data }).content, (err) => {
if (err) rej(err);
res(file);
});
});
})