Move generic Closure Compiler fixes into build/minify.js.

Former-commit-id: 8492f60a67cbf7a2d7d3118f9653e6997ab1d15b
This commit is contained in:
John-David Dalton
2013-01-21 01:13:51 -08:00
parent 27f1e5e2f2
commit 607abf89f7
6 changed files with 54 additions and 44 deletions

View File

@@ -2174,12 +2174,6 @@
if (!isDebug) {
outputPath || (outputPath = path.join(cwd, basename + '.min.js'));
// convert the IIFE into a function call so Closure Compiler (advanced) won't strip it
if (!isIIFE) {
source = source
.replace(/\(function/, 'iife$&')
.replace(/\(this\)\)(;\s*)$/, ', this)$1');
}
minify(source, {
'filePath': filePath,
'isMapped': isMapped,
@@ -2188,16 +2182,6 @@
'modes': isIIFE && ['simple', 'hybrid'],
'outputPath': outputPath,
'onComplete': function(data) {
// restore IIFE
if (!isIIFE) {
data.source = data.source
.replace(/iife\(/, '(')
.replace(/, *this\)([\s;]*(\n\/\/.+)?)$/, '(this))$1');
}
// inject "use strict" directive
if (isStrict) {
data.source = data.source.replace(/^([\s\S]*?function[^{]+{\s*)([^"'])/, '$1"use strict";$2');
}
if (isCustom) {
data.source = addCommandsToHeader(data.source, options);
}