Permalink
Browse files

fix(d.ts): include only necessary imports

  • Loading branch information...
kellyethridge committed Apr 1, 2016
1 parent 8ccbd96 commit 2c292ac4143a22ca21a961f6064274a20e41d3a2
Showing with 4 additions and 5 deletions.
  1. +4 −5 build/tasks/build.js
@@ -22,14 +22,13 @@ gulp.task('build-dts', function() {
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);
if (file) {
file.contents = new Buffer(tools.extractImports(file.contents.toString('utf8'), importsToAdd));
this.push(file);
}
return callback();
}))
.pipe(concat(jsName)) // concat all selected files to jsName (now without their imports)
.pipe(insert.transform(function(contents) { // re-add extracted imports on top
return tools.createImportBlock(importsToAdd) + contents;
}))
.pipe(to5(assign({}, compilerOptions.dts()))); // compile to d.ts from file jsName. d.ts file is in folder paths.packageName
});

0 comments on commit 2c292ac

Please sign in to comment.