Log minification time

Summary: public

Add an activity to log minification time.

Reviewed By: vjeux

Differential Revision: D2604863

fb-gh-sync-id: cbdf0297f0611c87b589b87928af235f9ba81172
This commit is contained in:
Tadeu Zagallo 2015-11-03 01:19:15 -08:00 committed by facebook-github-bot-4
parent 02c3c465f8
commit a0dd08e26c

View File

@ -12,6 +12,7 @@ const _ = require('underscore');
const base64VLQ = require('./base64-vlq'); const base64VLQ = require('./base64-vlq');
const UglifyJS = require('uglify-js'); const UglifyJS = require('uglify-js');
const ModuleTransport = require('../lib/ModuleTransport'); const ModuleTransport = require('../lib/ModuleTransport');
const Activity = require('../Activity');
const SOURCEMAPPING_URL = '\n\/\/@ sourceMappingURL='; const SOURCEMAPPING_URL = '\n\/\/@ sourceMappingURL=';
@ -128,11 +129,13 @@ class Bundle {
const source = this._getSource(); const source = this._getSource();
try { try {
const minifyActivity = Activity.startEvent('minify');
this._minifiedSourceAndMap = UglifyJS.minify(source, { this._minifiedSourceAndMap = UglifyJS.minify(source, {
fromString: true, fromString: true,
outSourceMap: 'bundle.js', outSourceMap: 'bundle.js',
inSourceMap: this.getSourceMap(), inSourceMap: this.getSourceMap(),
}); });
Activity.endEvent(minifyActivity);
return this._minifiedSourceAndMap; return this._minifiedSourceAndMap;
} catch(e) { } catch(e) {
// Sometimes, when somebody is using a new syntax feature that we // Sometimes, when somebody is using a new syntax feature that we