Skip to content

Commit

Permalink
Merge pull request #28 from ahorek/terser5131
Browse files Browse the repository at this point in the history
update terser to 5.13.1
  • Loading branch information
ahorek authored May 4, 2022
2 parents b36cb3a + a1de7dd commit 2a629f4
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 31 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
## Unreleased
## 1.1.9 (04 May 2022)
- update TerserJS to [5.13.1]

## 1.1.8 (25 November 2021)
- update TerserJS to [5.10.0]

Expand Down
2 changes: 1 addition & 1 deletion lib/terser.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/terser/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

class Terser
# Current version of Terser.
VERSION = "1.1.8"
VERSION = "1.1.9"
end
2 changes: 1 addition & 1 deletion lib/terser_wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function terser_wrapper(options) {
inputs[inputFilename] = source;

try {
return Terser.minifySync(inputs, options);
return Terser.minifySync(inputs, options, null);
} catch (error) {
const { message, filename, line, col, pos } = error;
return {error: {message: message, filename: filename, line: line, col: col, pos: pos}}
Expand Down
37 changes: 20 additions & 17 deletions patches/revert-source-maps.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git a/lib/minify.js b/lib/minify.js
index b9625e53..9060f985 100644
index 82d9ca3d..9d4bd976 100644
--- a/lib/minify.js
+++ b/lib/minify.js
@@ -221,7 +221,10 @@ async function minify(files, options) {
@@ -271,7 +271,10 @@ async function minify(files, options, _fs_module) {
}
if (!HOP(options.format, "code") || options.format.code) {
if (options.sourceMap) {
Expand All @@ -14,7 +14,7 @@ index b9625e53..9060f985 100644
file: options.sourceMap.filename,
orig: options.sourceMap.content,
root: options.sourceMap.root
@@ -260,9 +263,6 @@ async function minify(files, options) {
@@ -310,9 +313,6 @@ async function minify(files, options, _fs_module) {
options.nameCache.props = cache_to_json(options.mangle.properties.cache);
}
}
Expand Down Expand Up @@ -74,24 +74,27 @@ index 178a2088..86a7e02d 100644
}

diff --git a/package-lock.json b/package-lock.json
index 9a953b23..87e62bfc 100644
index 7c41d257..997ebebf 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -4864,24 +4864,17 @@
@@ -1491,27 +1491,17 @@
}
},
"source-map": {
- "version": "0.7.3",
- "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz",
- "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ=="
- "version": "0.8.0-beta.0",
- "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.8.0-beta.0.tgz",
- "integrity": "sha512-2ymg6oRBpebeZi9UUNsgQ89bhx01TcTkmNTGnNO88imTmbSgy4nfujrgVEFKWpMTEGA11EDkTt7mqObTPdigIA==",
- "requires": {
- "whatwg-url": "^7.0.0"
- }
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g=="
},
"source-map-support": {
- "version": "0.5.19",
- "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz",
- "integrity": "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==",
- "version": "0.5.20",
- "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.20.tgz",
- "integrity": "sha512-n1lZZ8Ve4ksRqizaBQgxXDgKwttHDhyfQjA6YZZn8+AroHbsIz+JjwxQDxbp+7y5OYCI8t1Yk7etjD9CRd2hIw==",
+ "version": "0.5.13",
+ "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.13.tgz",
+ "integrity": "sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w==",
Expand All @@ -109,20 +112,20 @@ index 9a953b23..87e62bfc 100644
},
"spawn-sync": {
diff --git a/package.json b/package.json
index fd23ab58..39e84296 100644
index 2f11ca4e..693f6119 100644
--- a/package.json
+++ b/package.json
@@ -44,8 +44,8 @@
],
@@ -45,8 +45,8 @@
"dependencies": {
"acorn": "^8.5.0",
"commander": "^2.20.0",
- "source-map": "~0.7.2",
- "source-map-support": "~0.5.19"
- "source-map": "~0.8.0-beta.0",
- "source-map-support": "~0.5.20"
+ "source-map": "~0.6.1",
+ "source-map-support": "~0.5.12"
},
"devDependencies": {
"@ls-lint/ls-lint": "^1.9.2",
"@ls-lint/ls-lint": "^1.10.0",
diff --git a/test/benchmark.cjs b/test/benchmark.cjs
index aea0059b..45769600 100644
--- a/test/benchmark.cjs
Expand Down
20 changes: 10 additions & 10 deletions patches/terser-sync.patch
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
diff --git a/lib/minify.js b/lib/minify.js
index b9625e53..265f4d67 100644
index 82d9ca3d..e896e5b1 100644
--- a/lib/minify.js
+++ b/lib/minify.js
@@ -61,6 +61,10 @@ function cache_to_json(cache) {
@@ -100,6 +100,10 @@ function log_input(files, options, fs, debug_folder) {
}

async function minify(files, options) {
+ return minifySync(files, options);
async function minify(files, options, _fs_module) {
+ return minifySync(files, options, _fs_module);
+}
+
+function minifySync(files, options) {
options = defaults(options, {
compress: {},
ecma: undefined,
@@ -281,5 +285,6 @@ async function minify(files, options) {
+
+function minifySync(files, options, _fs_module) {
if (
_fs_module
&& typeof process === "object"
@@ -331,5 +335,6 @@ async function minify(files, options, _fs_module) {

export {
minify,
Expand Down
5 changes: 5 additions & 0 deletions spec/terser_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,11 @@
it "defaults to not collapsing variables" do
expect(Terser.compile(code)).to include("return window.Handlebars")
end

it "collapse self-assignment" do
code = 'export function f(x) { x = x; }'
expect(Terser.compile(code, :compress => { :collapse_vars => true })).to include("export function f(){}")
end
end

it "keeps unused function arguments when keep_fargs option is set" do
Expand Down

0 comments on commit 2a629f4

Please sign in to comment.