Skip to content

Commit

Permalink
Fix uglify-js special case (#41)
Browse files Browse the repository at this point in the history
* Fix uglify special case

* Add uglify-js to devDependencies
  • Loading branch information
styfle authored and kodiakhq[bot] committed Aug 12, 2019
1 parent 88709e0 commit aec4bf2
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
"tiny-json-http": "^7.1.2",
"twilio": "^3.33.0",
"typescript": "^3.5.2",
"uglify-js": "^3.6.0",
"vm2": "^3.8.2",
"vue": "^2.6.10",
"vue-server-renderer": "^2.6.10",
Expand Down
13 changes: 2 additions & 11 deletions src/utils/special-cases.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,18 +149,9 @@ const specialCases = {
emitAsset(path.resolve(id, '../exports.js'));
}
},
'uglify-js' ({ id, emitAsset }) {
'uglify-js' ({ id, emitAsset, emitAssetDirectory }) {
if (id.endsWith('uglify-js/tools/node.js')) {
emitAsset(path.resolve(id, '../../lib/utils.js'));
emitAsset(path.resolve(id, '../../lib/ast.js'));
emitAsset(path.resolve(id, '../../lib/parse.js'));
emitAsset(path.resolve(id, '../../lib/transform.js'));
emitAsset(path.resolve(id, '../../lib/scope.js'));
emitAsset(path.resolve(id, '../../lib/output.js'));
emitAsset(path.resolve(id, '../../lib/compress.js'));
emitAsset(path.resolve(id, '../../lib/sourcemap.js'));
emitAsset(path.resolve(id, '../../lib/mozilla-ast.js'));
emitAsset(path.resolve(id, '../../lib/propmangle.js'));
emitAssetDirectory(path.resolve(id, '../../lib'));
emitAsset(path.resolve(id, '../exports.js'));
}
}
Expand Down
4 changes: 4 additions & 0 deletions test/integration/uglify.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
const UglifyJS = require('uglify-js')
const code = 'function add(first, second) { return first + second; }'
const result = UglifyJS.minify(code)
console.log(result)
10 changes: 9 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3330,7 +3330,7 @@ commander@2.15.1:
resolved "https://registry.yarnpkg.com/commander/-/commander-2.15.1.tgz#df46e867d0fc2aec66a34662b406a9ccafff5b0f"
integrity sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==

commander@^2.12.2:
commander@^2.12.2, commander@~2.20.0:
version "2.20.0"
resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.0.tgz#d58bb2b5c1ee8f87b0d340027e9e94e222c5a422"
integrity sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==
Expand Down Expand Up @@ -13010,6 +13010,14 @@ uglify-js@^3.1.4:
commander "~2.19.0"
source-map "~0.6.1"

uglify-js@^3.6.0:
version "3.6.0"
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.6.0.tgz#704681345c53a8b2079fb6cec294b05ead242ff5"
integrity sha512-W+jrUHJr3DXKhrsS7NUVxn3zqMOFn0hL/Ei6v0anCIMoKC93TjcflTagwIHLW7SfMFfiQuktQyFVCFHGUE0+yg==
dependencies:
commander "~2.20.0"
source-map "~0.6.1"

uglify-js@~2.4:
version "2.4.24"
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.4.24.tgz#fad5755c1e1577658bb06ff9ab6e548c95bebd6e"
Expand Down

0 comments on commit aec4bf2

Please sign in to comment.