From 01727e0fcc10ff8f6c65fcdfa1ab322f57faf2f8 Mon Sep 17 00:00:00 2001 From: Wojciech Maj Date: Fri, 23 Nov 2018 12:06:07 +0100 Subject: [PATCH] Replace UglifyJS with Terser --- gulpfile.js | 10 +++++----- package-lock.json | 29 +++++++++++++++++++++++++++++ package.json | 2 +- 3 files changed, 35 insertions(+), 6 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 4d37837dd..118cb279b 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -717,18 +717,18 @@ gulp.task('minified-post', ['minified-pre'], function () { console.log(); console.log('### Minifying js files'); - var UglifyES = require('uglify-es'); + var Terser = require('terser'); // V8 chokes on very long sequences. Works around that. var optsForHugeFile = { compress: { sequences: false, }, }; fs.writeFileSync(MINIFIED_DIR + '/web/pdf.viewer.js', - UglifyES.minify(viewerFiles).code); + Terser.minify(viewerFiles).code); fs.writeFileSync(MINIFIED_DIR + '/build/pdf.min.js', - UglifyES.minify(pdfFile).code); + Terser.minify(pdfFile).code); fs.writeFileSync(MINIFIED_DIR + '/build/pdf.worker.min.js', - UglifyES.minify(pdfWorkerFile, optsForHugeFile).code); + Terser.minify(pdfWorkerFile, optsForHugeFile).code); fs.writeFileSync(MINIFIED_DIR + 'image_decoders/pdf.image_decoders.min.js', - UglifyES.minify(pdfImageDecodersFile).code); + Terser.minify(pdfImageDecodersFile).code); console.log(); console.log('### Cleaning js files'); diff --git a/package-lock.json b/package-lock.json index a156d03cb..4867eba70 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12872,6 +12872,35 @@ "integrity": "sha512-IlqtmLVaZA2qab8epUXbVWRn3aB1imbDMJtjB3nu4X0NqPkcY/JH9ZtCBWKHWPxs8Svi9tyo8w2dBoi07qZbBA==", "dev": true }, + "terser": { + "version": "3.10.12", + "resolved": "https://registry.npmjs.org/terser/-/terser-3.10.12.tgz", + "integrity": "sha512-3ODPC1eVt25EVNb04s/PkHxOmzKBQUF6bwwuR6h2DbEF8/j265Y1UkwNtOk9am/pRxfJ5HPapOlUlO6c16mKQQ==", + "dev": true, + "requires": { + "commander": "~2.17.1", + "source-map": "~0.6.1", + "source-map-support": "~0.5.6" + }, + "dependencies": { + "commander": { + "version": "2.17.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.17.1.tgz", + "integrity": "sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg==", + "dev": true + }, + "source-map-support": { + "version": "0.5.9", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.9.tgz", + "integrity": "sha512-gR6Rw4MvUlYy83vP0vxoVNzM6t8MUXqNuRsuBmBHQDu1Fh6X015FrLdgoDKcNdkwGubozq0P4N0Q37UyFVr1EA==", + "dev": true, + "requires": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + } + } + }, "text-table": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", diff --git a/package.json b/package.json index 3769ae4a8..0c3ed19c3 100644 --- a/package.json +++ b/package.json @@ -32,9 +32,9 @@ "streamqueue": "^1.1.2", "systemjs": "^0.21.5", "systemjs-plugin-babel": "^0.0.25", + "terser": "^3.10.12", "ttest": "^1.1.0", "typogr": "^0.6.8", - "uglify-es": "^3.3.9", "vinyl": "^2.2.0", "vinyl-fs": "^3.0.3", "webpack": "4.21.0",