mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-08 09:08:48 +01:00
gulp: beware of es.merge and empty arrays
fixes the internal builds
This commit is contained in:
+16
-12
@@ -135,29 +135,33 @@ exports.optimizeTask = function(opts) {
|
||||
var loaderConfig = opts.loaderConfig;
|
||||
var bundledFileHeader = opts.header;
|
||||
var out = opts.out;
|
||||
|
||||
return function() {
|
||||
var bundles = es.through();
|
||||
var bundlesStream = es.through();
|
||||
|
||||
bundle.bundle(entryPoints, loaderConfig, function(err, result) {
|
||||
if (err) { return bundles.emit('error', JSON.stringify(err)); }
|
||||
if (err) { return bundlesStream.emit('error', JSON.stringify(err)); }
|
||||
|
||||
toBundleStream(bundledFileHeader, result).pipe(bundles);
|
||||
toBundleStream(bundledFileHeader, result).pipe(bundlesStream);
|
||||
});
|
||||
|
||||
var otherSourcesStream = es.through();
|
||||
(function() {
|
||||
var otherSourcesStreamArr = [];
|
||||
gulp.src(otherSources, { base: 'out-build' })
|
||||
.pipe(es.through(function write(data) {
|
||||
otherSourcesStreamArr.push(toConcatStream(bundledFileHeader, [data], data.relative));
|
||||
}, function end() {
|
||||
var otherSourcesStreamArr = [];
|
||||
|
||||
gulp.src(otherSources, { base: 'out-build' })
|
||||
.pipe(es.through(function (data) {
|
||||
otherSourcesStreamArr.push(toConcatStream(bundledFileHeader, [data], data.relative));
|
||||
}, function () {
|
||||
if (!otherSourcesStreamArr.length) {
|
||||
setTimeout(function () { otherSourcesStream.emit('end'); }, 0);
|
||||
} else {
|
||||
es.merge(otherSourcesStreamArr).pipe(otherSourcesStream);
|
||||
}))
|
||||
})();
|
||||
}
|
||||
}));
|
||||
|
||||
var result = es.merge(
|
||||
loader(bundledFileHeader),
|
||||
bundles,
|
||||
bundlesStream,
|
||||
otherSourcesStream,
|
||||
gulp.src(resources, { base: 'out-build' })
|
||||
);
|
||||
|
||||
Vendored
+2
-1
@@ -2,7 +2,8 @@ declare module "event-stream" {
|
||||
import { Stream } from 'stream';
|
||||
import { ThroughStream } from 'through';
|
||||
|
||||
function merge(...stream: Stream[]): ThroughStream;
|
||||
function merge(streams: Stream[]): ThroughStream;
|
||||
function merge(...streams: Stream[]): ThroughStream;
|
||||
function concat(...stream: Stream[]): ThroughStream;
|
||||
function duplex(istream: Stream, ostream: Stream): ThroughStream;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user