Skip to content

Commit f5f5eb6

Browse files
committed
Improve monaco.d.ts generation task
1 parent 02adcfd commit f5f5eb6

1 file changed

Lines changed: 22 additions & 18 deletions

File tree

gulpfile.js

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,6 @@ function watchTask(out, build) {
106106

107107
function monacodtsTask(out, isWatch) {
108108

109-
var filesToWatchMap = {};
110-
monacodts.getFilesToWatch(out).forEach(function(filePath) {
111-
filesToWatchMap[path.normalize(filePath)] = true;
112-
});
113-
114109
var timer = -1;
115110

116111
var runSoon = function(howSoon) {
@@ -144,23 +139,32 @@ function monacodtsTask(out, isWatch) {
144139
};
145140

146141
if (isWatch) {
142+
143+
var filesToWatchMap = {};
144+
monacodts.getFilesToWatch(out).forEach(function(filePath) {
145+
filesToWatchMap[path.normalize(filePath)] = true;
146+
});
147+
147148
watch('build/monaco/*').pipe(es.through(function() {
148-
runSoon(500);
149+
runSoon(5000);
149150
}));
150-
}
151151

152-
var resultStream = es.through(function(data) {
153-
var filePath = path.normalize(data.path);
154-
if (isWatch && filesToWatchMap[filePath]) {
155-
runSoon(5000);
156-
}
157-
this.emit('data', data);
158-
}, function(end) {
159-
runNow();
160-
this.emit('end');
161-
});
152+
return es.through(function(data) {
153+
var filePath = path.normalize(data.path);
154+
if (filesToWatchMap[filePath]) {
155+
runSoon(5000);
156+
}
157+
this.emit('data', data);
158+
});
159+
160+
} else {
162161

163-
return resultStream;
162+
return es.through(null, function(end) {
163+
runNow();
164+
this.emit('end');
165+
});
166+
167+
}
164168
}
165169

166170
// Fast compile for development time

0 commit comments

Comments
 (0)