Skip to content

Commit

Permalink
bump terser
Browse files Browse the repository at this point in the history
  • Loading branch information
lifeart committed Oct 22, 2020
1 parent 98b70d1 commit b6ab9ac
Show file tree
Hide file tree
Showing 5 changed files with 2,583 additions and 1,930 deletions.
12 changes: 3 additions & 9 deletions lib/summarize.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,9 @@ const Terser = require('terser');
const zlib = require('zlib');
const pify = require('pify');

function uglify(content) {
return new Promise((resolve, reject) => {
let uglified = Terser.minify(content);
if (uglified.error) {
reject(uglified.error);
} else {
resolve(uglified.code);
}
});
async function uglify(content) {
const { code } = await Terser.minify(content);
return code;
}

function compress(content) {
Expand Down
32 changes: 14 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,30 +20,26 @@
},
"homepage": "https://github.com/stefanpenner/broccoli-concat-analyser#readme",
"dependencies": {
"filesize": "^3.3.0",
"fs-extra": "^4.0.2",
"ora": "^0.3.0",
"pify": "^4.0.0",
"terser": "^3.10.11",
"walk-sync": "^0.3.1",
"workerpool": "^5.0.4",
"filesize": "^6.1.0",
"fs-extra": "^9.0.1",
"ora": "^5.1.0",
"pify": "^5.0.0",
"terser": "^5.3.2",
"walk-sync": "^2.2.0",
"workerpool": "^6.0.1",
"zlib": "^1.0.5"
},
"devDependencies": {
"eslint": "^5.16.0",
"eslint-plugin-jest": "^22.21.0",
"html-validator": "^3.0.6",
"jest": "^22.4.3",
"tmp": "^0.0.33"
},
"jest": {
"verbose": true,
"testURL": "http://localhost/"
"eslint": "^7.9.0",
"eslint-plugin-jest": "^24.0.2",
"html-validator": "^5.1.17",
"jest": "^26.4.2",
"tmp": "^0.2.1"
},
"engines": {
"node": "6.* || 8.* || >= 10.*"
"node": ">= 10.*"
},
"volta": {
"node": "6.17.1"
"node": "10.22.1"
}
}
28 changes: 14 additions & 14 deletions test/acceptance/__snapshots__/cli.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -8,56 +8,56 @@ exports[`CLI generates expected output 1`] = `
\\"relativePath\\": \\"test-app/app.js\\",
\\"sizes\\": {
\\"raw\\": 606,
\\"uglified\\": 375,
\\"compressed\\": 119.82860520094562
\\"uglified\\": 377,
\\"compressed\\": 120.451057165231
}
},
{
\\"relativePath\\": \\"test-app/initializers/app-version.js\\",
\\"sizes\\": {
\\"raw\\": 510,
\\"uglified\\": 311,
\\"compressed\\": 99.37785657998424
\\"uglified\\": 313,
\\"compressed\\": 100.00313234142521
}
},
{
\\"relativePath\\": \\"test-app/initializers/container-debug-adapter.js\\",
\\"sizes\\": {
\\"raw\\": 590,
\\"uglified\\": 428,
\\"compressed\\": 136.76438140267928
\\"uglified\\": 430,
\\"compressed\\": 137.38449490994518
}
},
{
\\"relativePath\\": \\"test-app/initializers/export-application-global.js\\",
\\"sizes\\": {
\\"raw\\": 1377,
\\"uglified\\": 684,
\\"compressed\\": 218.56737588652481
\\"uglified\\": 686,
\\"compressed\\": 219.17619420516837
}
},
{
\\"relativePath\\": \\"test-app/resolver.js\\",
\\"sizes\\": {
\\"raw\\": 231,
\\"uglified\\": 154,
\\"compressed\\": 49.20961386918834
\\"uglified\\": 156,
\\"compressed\\": 49.841816758026624
}
},
{
\\"relativePath\\": \\"test-app/router.js\\",
\\"sizes\\": {
\\"raw\\": 425,
\\"uglified\\": 264,
\\"compressed\\": 84.35933806146572
\\"uglified\\": 268,
\\"compressed\\": 85.62568519968676
}
},
{
\\"relativePath\\": \\"test-app/templates/application.js\\",
\\"sizes\\": {
\\"raw\\": 399,
\\"uglified\\": 322,
\\"compressed\\": 102.89282899921197
\\"uglified\\": 324,
\\"compressed\\": 103.51761942051684
}
}
]
Expand Down
84 changes: 42 additions & 42 deletions test/integration/__snapshots__/summarize.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -8,56 +8,56 @@ exports[`summarize summarize calculates sizes 1`] = `
\\"relativePath\\": \\"test-app/app.js\\",
\\"sizes\\": {
\\"raw\\": 606,
\\"uglified\\": 375,
\\"compressed\\": 119.82860520094562
\\"uglified\\": 377,
\\"compressed\\": 120.451057165231
}
},
{
\\"relativePath\\": \\"test-app/initializers/app-version.js\\",
\\"sizes\\": {
\\"raw\\": 510,
\\"uglified\\": 311,
\\"compressed\\": 99.37785657998424
\\"uglified\\": 313,
\\"compressed\\": 100.00313234142521
}
},
{
\\"relativePath\\": \\"test-app/initializers/container-debug-adapter.js\\",
\\"sizes\\": {
\\"raw\\": 590,
\\"uglified\\": 428,
\\"compressed\\": 136.76438140267928
\\"uglified\\": 430,
\\"compressed\\": 137.38449490994518
}
},
{
\\"relativePath\\": \\"test-app/initializers/export-application-global.js\\",
\\"sizes\\": {
\\"raw\\": 1377,
\\"uglified\\": 684,
\\"compressed\\": 218.56737588652481
\\"uglified\\": 686,
\\"compressed\\": 219.17619420516837
}
},
{
\\"relativePath\\": \\"test-app/resolver.js\\",
\\"sizes\\": {
\\"raw\\": 231,
\\"uglified\\": 154,
\\"compressed\\": 49.20961386918834
\\"uglified\\": 156,
\\"compressed\\": 49.841816758026624
}
},
{
\\"relativePath\\": \\"test-app/router.js\\",
\\"sizes\\": {
\\"raw\\": 425,
\\"uglified\\": 264,
\\"compressed\\": 84.35933806146572
\\"uglified\\": 268,
\\"compressed\\": 85.62568519968676
}
},
{
\\"relativePath\\": \\"test-app/templates/application.js\\",
\\"sizes\\": {
\\"raw\\": 399,
\\"uglified\\": 322,
\\"compressed\\": 102.89282899921197
\\"uglified\\": 324,
\\"compressed\\": 103.51761942051684
}
}
]
Expand All @@ -72,56 +72,56 @@ exports[`summarize summarize-all calculates sizes of all files 1`] = `
\\"relativePath\\": \\"test-app/app.js\\",
\\"sizes\\": {
\\"raw\\": 606,
\\"uglified\\": 375,
\\"compressed\\": 119.82860520094562
\\"uglified\\": 377,
\\"compressed\\": 120.451057165231
}
},
{
\\"relativePath\\": \\"test-app/initializers/app-version.js\\",
\\"sizes\\": {
\\"raw\\": 510,
\\"uglified\\": 311,
\\"compressed\\": 99.37785657998424
\\"uglified\\": 313,
\\"compressed\\": 100.00313234142521
}
},
{
\\"relativePath\\": \\"test-app/initializers/container-debug-adapter.js\\",
\\"sizes\\": {
\\"raw\\": 590,
\\"uglified\\": 428,
\\"compressed\\": 136.76438140267928
\\"uglified\\": 430,
\\"compressed\\": 137.38449490994518
}
},
{
\\"relativePath\\": \\"test-app/initializers/export-application-global.js\\",
\\"sizes\\": {
\\"raw\\": 1377,
\\"uglified\\": 684,
\\"compressed\\": 218.56737588652481
\\"uglified\\": 686,
\\"compressed\\": 219.17619420516837
}
},
{
\\"relativePath\\": \\"test-app/resolver.js\\",
\\"sizes\\": {
\\"raw\\": 231,
\\"uglified\\": 154,
\\"compressed\\": 49.20961386918834
\\"uglified\\": 156,
\\"compressed\\": 49.841816758026624
}
},
{
\\"relativePath\\": \\"test-app/router.js\\",
\\"sizes\\": {
\\"raw\\": 425,
\\"uglified\\": 264,
\\"compressed\\": 84.35933806146572
\\"uglified\\": 268,
\\"compressed\\": 85.62568519968676
}
},
{
\\"relativePath\\": \\"test-app/templates/application.js\\",
\\"sizes\\": {
\\"raw\\": 399,
\\"uglified\\": 322,
\\"compressed\\": 102.89282899921197
\\"uglified\\": 324,
\\"compressed\\": 103.51761942051684
}
}
]
Expand Down Expand Up @@ -165,56 +165,56 @@ exports[`summarize summarize-all can ignore files 1`] = `
\\"relativePath\\": \\"test-app/app.js\\",
\\"sizes\\": {
\\"raw\\": 606,
\\"uglified\\": 375,
\\"compressed\\": 119.82860520094562
\\"uglified\\": 377,
\\"compressed\\": 120.451057165231
}
},
{
\\"relativePath\\": \\"test-app/initializers/app-version.js\\",
\\"sizes\\": {
\\"raw\\": 510,
\\"uglified\\": 311,
\\"compressed\\": 99.37785657998424
\\"uglified\\": 313,
\\"compressed\\": 100.00313234142521
}
},
{
\\"relativePath\\": \\"test-app/initializers/container-debug-adapter.js\\",
\\"sizes\\": {
\\"raw\\": 590,
\\"uglified\\": 428,
\\"compressed\\": 136.76438140267928
\\"uglified\\": 430,
\\"compressed\\": 137.38449490994518
}
},
{
\\"relativePath\\": \\"test-app/initializers/export-application-global.js\\",
\\"sizes\\": {
\\"raw\\": 1377,
\\"uglified\\": 684,
\\"compressed\\": 218.56737588652481
\\"uglified\\": 686,
\\"compressed\\": 219.17619420516837
}
},
{
\\"relativePath\\": \\"test-app/resolver.js\\",
\\"sizes\\": {
\\"raw\\": 231,
\\"uglified\\": 154,
\\"compressed\\": 49.20961386918834
\\"uglified\\": 156,
\\"compressed\\": 49.841816758026624
}
},
{
\\"relativePath\\": \\"test-app/router.js\\",
\\"sizes\\": {
\\"raw\\": 425,
\\"uglified\\": 264,
\\"compressed\\": 84.35933806146572
\\"uglified\\": 268,
\\"compressed\\": 85.62568519968676
}
},
{
\\"relativePath\\": \\"test-app/templates/application.js\\",
\\"sizes\\": {
\\"raw\\": 399,
\\"uglified\\": 322,
\\"compressed\\": 102.89282899921197
\\"uglified\\": 324,
\\"compressed\\": 103.51761942051684
}
}
]
Expand Down
Loading

0 comments on commit b6ab9ac

Please sign in to comment.