Merge pull request #12454 from Snuffleupagus/terser-5

Upgrade `terser` to version 5
This commit is contained in:
Tim van der Meij 2020-10-07 22:04:31 +02:00 committed by GitHub
commit 99a2302d88
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 38 additions and 15 deletions

View File

@ -916,7 +916,7 @@ gulp.task(
}) })
); );
function parseMinified(dir) { async function parseMinified(dir) {
var pdfFile = fs.readFileSync(dir + "/build/pdf.js").toString(); var pdfFile = fs.readFileSync(dir + "/build/pdf.js").toString();
var pdfWorkerFile = fs.readFileSync(dir + "/build/pdf.worker.js").toString(); var pdfWorkerFile = fs.readFileSync(dir + "/build/pdf.worker.js").toString();
var pdfImageDecodersFile = fs var pdfImageDecodersFile = fs
@ -942,19 +942,19 @@ function parseMinified(dir) {
fs.writeFileSync( fs.writeFileSync(
dir + "/web/pdf.viewer.js", dir + "/web/pdf.viewer.js",
Terser.minify(viewerFiles, options).code (await Terser.minify(viewerFiles, options)).code
); );
fs.writeFileSync( fs.writeFileSync(
dir + "/build/pdf.min.js", dir + "/build/pdf.min.js",
Terser.minify(pdfFile, options).code (await Terser.minify(pdfFile, options)).code
); );
fs.writeFileSync( fs.writeFileSync(
dir + "/build/pdf.worker.min.js", dir + "/build/pdf.worker.min.js",
Terser.minify(pdfWorkerFile, options).code (await Terser.minify(pdfWorkerFile, options)).code
); );
fs.writeFileSync( fs.writeFileSync(
dir + "image_decoders/pdf.image_decoders.min.js", dir + "image_decoders/pdf.image_decoders.min.js",
Terser.minify(pdfImageDecodersFile, options).code (await Terser.minify(pdfImageDecodersFile, options)).code
); );
console.log(); console.log();
@ -975,16 +975,16 @@ function parseMinified(dir) {
gulp.task( gulp.task(
"minified", "minified",
gulp.series("minified-pre", function (done) { gulp.series("minified-pre", async function (done) {
parseMinified(MINIFIED_DIR); await parseMinified(MINIFIED_DIR);
done(); done();
}) })
); );
gulp.task( gulp.task(
"minified-es5", "minified-es5",
gulp.series("minified-es5-pre", function (done) { gulp.series("minified-es5-pre", async function (done) {
parseMinified(MINIFIED_ES5_DIR); await parseMinified(MINIFIED_ES5_DIR);
done(); done();
}) })
); );

33
package-lock.json generated
View File

@ -16042,14 +16042,14 @@
} }
}, },
"terser": { "terser": {
"version": "4.8.0", "version": "5.3.4",
"resolved": "https://registry.npmjs.org/terser/-/terser-4.8.0.tgz", "resolved": "https://registry.npmjs.org/terser/-/terser-5.3.4.tgz",
"integrity": "sha512-EAPipTNeWsb/3wLPeup1tVPaXfIaU68xMnVdPafIL1TV05OhASArYyIfFvnvJCNrR2NIOvDVNNTFRa+Re2MWyw==", "integrity": "sha512-dxuB8KQo8Gt6OVOeLg/rxfcxdNZI/V1G6ze1czFUzPeCFWZRtvZMgSzlZZ5OYBZ4HoG607F6pFPNLekJyV+yVw==",
"dev": true, "dev": true,
"requires": { "requires": {
"commander": "^2.20.0", "commander": "^2.20.0",
"source-map": "~0.6.1", "source-map": "~0.7.2",
"source-map-support": "~0.5.12" "source-map-support": "~0.5.19"
}, },
"dependencies": { "dependencies": {
"commander": { "commander": {
@ -16057,6 +16057,12 @@
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
"dev": true "dev": true
},
"source-map": {
"version": "0.7.3",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz",
"integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==",
"dev": true
} }
} }
}, },
@ -16077,6 +16083,12 @@
"worker-farm": "^1.7.0" "worker-farm": "^1.7.0"
}, },
"dependencies": { "dependencies": {
"commander": {
"version": "2.20.3",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
"dev": true
},
"schema-utils": { "schema-utils": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-1.0.0.tgz", "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-1.0.0.tgz",
@ -16087,6 +16099,17 @@
"ajv-errors": "^1.0.0", "ajv-errors": "^1.0.0",
"ajv-keywords": "^3.1.0" "ajv-keywords": "^3.1.0"
} }
},
"terser": {
"version": "4.8.0",
"resolved": "https://registry.npmjs.org/terser/-/terser-4.8.0.tgz",
"integrity": "sha512-EAPipTNeWsb/3wLPeup1tVPaXfIaU68xMnVdPafIL1TV05OhASArYyIfFvnvJCNrR2NIOvDVNNTFRa+Re2MWyw==",
"dev": true,
"requires": {
"commander": "^2.20.0",
"source-map": "~0.6.1",
"source-map-support": "~0.5.12"
}
} }
} }
}, },

View File

@ -50,7 +50,7 @@
"stylelint-prettier": "^1.1.2", "stylelint-prettier": "^1.1.2",
"systemjs": "^0.21.6", "systemjs": "^0.21.6",
"systemjs-plugin-babel": "^0.0.25", "systemjs-plugin-babel": "^0.0.25",
"terser": "^4.8.0", "terser": "^5.3.4",
"through2": "^4.0.2", "through2": "^4.0.2",
"ttest": "^3.0.0", "ttest": "^3.0.0",
"typescript": "^4.0.3", "typescript": "^4.0.3",