Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
gulp.task('build-dts', function() {
var importsToAdd = []; // stores extracted imports
return gulp.src(paths.tsSource)
.pipe(tools.sortFiles())
.pipe(through2.obj(function(file, enc, callback) { // extract all imports to importsToAdd
file.contents = new Buffer(tools.extractImports(file.contents.toString('utf8'), importsToAdd));
this.push(file);
return callback();
}))
.pipe(concat(jsName))
.pipe(to5(assign({}, compilerOptions.dts())));
});
gulp.task('build-index', function(){
var importsToAdd = [];
return gulp.src(paths.source)
.pipe(tools.sortFiles())
.pipe(through2.obj(function(file, enc, callback) {
file.contents = new Buffer(tools.extractImports(file.contents.toString('utf8'), importsToAdd));
this.push(file);
return callback();
}))
.pipe(concat(jsName))
.pipe(insert.transform(function(contents) {
return tools.createImportBlock(importsToAdd) + contents;
}))
.pipe(gulp.dest(paths.output));
});
gulp.task('build-index', function(){
var importsToAdd = [];
return gulp.src([paths.root + '*.js', '!' + paths.root + 'index.js'])
.pipe(tools.sortFiles())
.pipe(through2.obj(function(file, enc, callback) {
file.contents = new Buffer(tools.extractImports(file.contents.toString("utf8"), importsToAdd));
this.push(file);
return callback();
}))
.pipe(concat(jsName))
.pipe(insert.transform(function(contents) {
return tools.createImportBlock(importsToAdd) + contents;
}))
.pipe(to5(assign({}, compilerOptions, {modules:'common'})));
});
gulp.task('build-index', function() {
var importsToAdd = paths.importsToAdd.slice();
var src = gulp.src(paths.files);
if (paths.sort) {
src = src.pipe(tools.sortFiles());
}
if (paths.ignore) {
paths.ignore.forEach(function(filename) {
src = src.pipe(gulpIgnore.exclude(filename));
});
}
return src
.pipe(through2.obj(function(file, enc, callback) {
file.contents = new Buffer(tools.extractImports(file.contents.toString('utf8'), importsToAdd));
this.push(file);
return callback();
}))
.pipe(concat(jsName))
.pipe(insert.transform(function(contents) {
gulp.task('build-index', function() {
var importsToAdd = paths.importsToAdd.slice();
var src = gulp.src(paths.files);
if (paths.sort) {
src = src.pipe(tools.sortFiles());
}
if (paths.ignore) {
paths.ignore.forEach(function(filename){
src = src.pipe(gulpIgnore.exclude(filename));
});
}
return src.pipe(through2.obj(function(file, enc, callback) {
file.contents = new Buffer(tools.extractImports(file.contents.toString('utf8'), importsToAdd));
this.push(file);
return callback();
}))
.pipe(concat(jsName))
.pipe(insert.transform(function(contents) {
return tools.createImportBlock(importsToAdd) + contents;