Skip to content
This repository has been archived by the owner on Nov 30, 2023. It is now read-only.

Commit

Permalink
Update Terser to 5.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
chicoxyzzy committed Aug 1, 2020
1 parent 9f61db2 commit 43cbaaa
Show file tree
Hide file tree
Showing 4 changed files with 1,040 additions and 794 deletions.
6 changes: 3 additions & 3 deletions package.json
Expand Up @@ -32,10 +32,10 @@
"author": "Bogdan Chadkin <trysound@yandex.ru>",
"license": "MIT",
"dependencies": {
"@babel/code-frame": "^7.8.3",
"jest-worker": "^26.0.0",
"@babel/code-frame": "^7.10.4",
"jest-worker": "^26.2.1",
"serialize-javascript": "^3.0.0",
"terser": "^4.7.0"
"terser": "^5.0.0"
},
"peerDependencies": {
"rollup": "^2.0.0"
Expand Down
6 changes: 6 additions & 0 deletions test/__snapshots__/test.js.snap
Expand Up @@ -8,11 +8,14 @@ Object {
"dynamicImports": Array [],
"exports": Array [],
"fileName": "chunk-1.js",
"implicitlyLoadedBefore": Array [],
"imports": Array [],
"isDynamicEntry": false,
"isEntry": true,
"isImplicitEntry": false,
"map": null,
"name": "chunk-1",
"referencedFiles": Array [],
"type": "chunk",
},
"chunk-2.js": Object {
Expand All @@ -21,11 +24,14 @@ Object {
"dynamicImports": Array [],
"exports": Array [],
"fileName": "chunk-2.js",
"implicitlyLoadedBefore": Array [],
"imports": Array [],
"isDynamicEntry": false,
"isEntry": true,
"isImplicitEntry": false,
"map": null,
"name": "chunk-2",
"referencedFiles": Array [],
"type": "chunk",
},
}
Expand Down
7 changes: 1 addition & 6 deletions transform.js
Expand Up @@ -2,12 +2,7 @@ const { minify } = require("terser");

const transform = (code, optionsString) => {
const options = eval(`(${optionsString})`);
const result = minify(code, options);
if (result.error) {
throw result.error;
} else {
return { result, nameCache: options.nameCache };
}
return minify(code, options).then(result => ({ result, nameCache: options.nameCache }));
};

exports.transform = transform;

0 comments on commit 43cbaaa

Please sign in to comment.