[react-packager] Add more granular Activity logging

This commit is contained in:
Martín Bigio 2015-08-10 16:00:20 -07:00
parent 2afeb8fbe6
commit a303a42e28
2 changed files with 16 additions and 4 deletions

View File

@ -101,7 +101,7 @@ class DependencyGraph {
this._loading = Promise.all([ this._loading = Promise.all([
this._fastfs.build() this._fastfs.build()
.then(() => { .then(() => {
const hasteActivity = Activity.startEvent('haste map'); const hasteActivity = Activity.startEvent('Building Haste Map');
this._buildHasteMap().then(() => Activity.endEvent(hasteActivity)); this._buildHasteMap().then(() => Activity.endEvent(hasteActivity));
}), }),
this._buildAssetMap_DEPRECATED(), this._buildAssetMap_DEPRECATED(),
@ -518,9 +518,18 @@ class DependencyGraph {
fastfs.on('change', this._processAssetChange_DEPRECATED.bind(this)); fastfs.on('change', this._processAssetChange_DEPRECATED.bind(this));
return fastfs.build().then( return fastfs.build().then(
() => fastfs.findFilesByExts(this._opts.assetExts).map( () => {
file => this._processAsset_DEPRECATED(file) const processAsset_DEPRECATEDActivity = Activity.startEvent(
) 'Building (deprecated) Asset Map',
);
const assets = fastfs.findFilesByExts(this._opts.assetExts).map(
file => this._processAsset_DEPRECATED(file)
);
Activity.endEvent(processAsset_DEPRECATEDActivity);
return assets;
}
); );
} }

View File

@ -1,5 +1,6 @@
'use strict'; 'use strict';
const Activity = require('../Activity');
const Promise = require('promise'); const Promise = require('promise');
const {EventEmitter} = require('events'); const {EventEmitter} = require('events');
@ -28,6 +29,7 @@ class Fastfs extends EventEmitter {
); );
return this._crawling.then(files => { return this._crawling.then(files => {
const fastfsActivity = Activity.startEvent('Building in-memory fs');
files.forEach(filePath => { files.forEach(filePath => {
if (filePath.match(rootsPattern)) { if (filePath.match(rootsPattern)) {
const newFile = new File(filePath, { isDir: false }); const newFile = new File(filePath, { isDir: false });
@ -44,6 +46,7 @@ class Fastfs extends EventEmitter {
} }
} }
}); });
Activity.endEvent(fastfsActivity);
this._fileWatcher.on('all', this._processFileChange.bind(this)); this._fileWatcher.on('all', this._processFileChange.bind(this));
}); });
} }