Skip to content

Commit

Permalink
Update to Uglify Harmony 2.8.22 and add support Babili fallback.
Browse files Browse the repository at this point in the history
This is the same behavior of the official `minifier-js` package, except
with the Harmony branch.
  • Loading branch information
abernix committed Apr 27, 2017
1 parent de2dbda commit 472fcf8
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 69 deletions.
12 changes: 6 additions & 6 deletions .npm/package/npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

49 changes: 4 additions & 45 deletions .versions
Original file line number Diff line number Diff line change
@@ -1,49 +1,8 @@
abernix:minifier-js@1.3.19
allow-deny@1.0.5
babel-compiler@6.14.1
babel-runtime@1.0.1
base64@1.0.10
binary-heap@1.0.10
blaze@2.1.9
blaze-tools@1.0.10
boilerplate-generator@1.0.11
callback-hook@1.0.10
check@1.2.5
ddp@1.2.5
ddp-client@1.3.3
ddp-common@1.2.8
ddp-server@1.3.13
deps@1.0.12
diff-sequence@1.0.7
ecmascript@0.6.3
abernix:minifier-js@2.0.0
babel-compiler@6.18.1
ecmascript-runtime@0.3.15
ejson@1.0.13
geojson-utils@1.0.10
html-tools@1.0.11
htmljs@1.0.11
id-map@1.0.9
jquery@1.11.10
local-test:abernix:minifier-js@1.3.19
logging@1.1.17
meteor@1.6.1
minimongo@1.0.21
modules@0.7.9
modules-runtime@0.7.9
mongo@1.1.16
mongo-id@1.0.6
npm-mongo@2.2.24
observe-sequence@1.0.16
ordered-dict@1.0.9
modules@0.8.1
modules-runtime@0.7.10
promise@0.8.8
random@1.0.10
reactive-var@1.0.11
retry@1.0.9
routepolicy@1.0.12
spacebars@1.0.13
spacebars-compiler@1.0.13
tinytest@1.0.12
tracker@1.1.2
ui@1.0.12
underscore@1.0.10
webapp@1.3.14
webapp-hashing@1.0.9
27 changes: 25 additions & 2 deletions minifier.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,25 @@
UglifyJS = Npm.require('uglify-js');
UglifyJSMinify = UglifyJS.minify;
var uglify;

meteorJsMinify = function (source) {
var result = {};
uglify = uglify || Npm.require("uglify-js");

try {
result.code = uglify.minify(source, {
fromString: true,
compress: {
drop_debugger: false,
unused: false,
dead_code: false
}
}).code;

} catch (e) {
// Although Babel.minify can handle a wider variety of ECMAScript
// 2015+ syntax, it is substantially slower than UglifyJS, so we use
// it only as a fallback.
result.code = Babel.minify(source).code;
}

return result;
};
20 changes: 4 additions & 16 deletions package.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,16 @@
Package.describe({
name: 'abernix:minifier-js',
summary: "JavaScript minifier",
version: "1.3.19"
version: "2.0.0"
});

Npm.depends({
"source-map": "0.5.6",
"uglify-js": "git+https://github.com/mishoo/UglifyJS2#harmony-v2.8.15",
});

Npm.strip({
"uglify-js": ["test/"]
"uglify-js": "git+https://github.com/mishoo/UglifyJS2#harmony-v2.8.22",
});

Package.onUse(function (api) {
api.export(['UglifyJSMinify', 'UglifyJS']);
api.use('babel-compiler@6.18.1');
api.export(['meteorJsMinify']);
api.addFiles(['minifier.js'], 'server');
});

Package.onTest(function (api) {
api.use('abernix:minifier-js', 'server');
api.use('tinytest');

api.addFiles([
'beautify-tests.js',
], 'server');
});

0 comments on commit 472fcf8

Please sign in to comment.