terser 5.10.0 → 5.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## v5.11.0
4
+
5
+ - Unicode code point escapes (`\u{abcde}`) are not emitted inside RegExp literals anymore (#1147)
6
+ - acorn is now a regular dependency
7
+
3
8
  ## v5.10.0
4
9
 
5
10
  - Massive optimization to max_line_len (#1109)
package/README.md CHANGED
@@ -60,6 +60,12 @@ in sequence and apply any compression options. The files are parsed in the
60
60
  same global scope, that is, a reference from a file to some
61
61
  variable/function declared in another file will be matched properly.
62
62
 
63
+ Command line arguments that take options (like --parse, --compress, --mangle and
64
+ --format) can take in a comma-separated list of default option overrides. For
65
+ instance:
66
+
67
+ terser input.js --compress ecma=2015,computed_props=false
68
+
63
69
  If no input file is specified, Terser will read from STDIN.
64
70
 
65
71
  If you wish to pass your options before the input files, separate the two with
@@ -7088,8 +7088,8 @@ function OutputStream(options) {
7088
7088
  var OUTPUT = new Rope();
7089
7089
  let printed_comments = new Set();
7090
7090
 
7091
- var to_utf8 = options.ascii_only ? function(str, identifier) {
7092
- if (options.ecma >= 2015 && !options.safari10) {
7091
+ var to_utf8 = options.ascii_only ? function(str, identifier = false, regexp = false) {
7092
+ if (options.ecma >= 2015 && !options.safari10 && !regexp) {
7093
7093
  str = str.replace(/[\ud800-\udbff][\udc00-\udfff]/g, function(ch) {
7094
7094
  var code = get_full_char_code(ch, 0).toString(16);
7095
7095
  return "\\u{" + code + "}";
@@ -9016,7 +9016,7 @@ function OutputStream(options) {
9016
9016
  flags = flags ? sort_regexp_flags(flags) : "";
9017
9017
  source = source.replace(r_slash_script, slash_script_replace);
9018
9018
 
9019
- output.print(output.to_utf8(`/${source}/${flags}`));
9019
+ output.print(output.to_utf8(`/${source}/${flags}`, false, true));
9020
9020
 
9021
9021
  const parent = output.parent();
9022
9022
  if (
package/lib/output.js CHANGED
@@ -285,8 +285,8 @@ function OutputStream(options) {
285
285
  var OUTPUT = new Rope();
286
286
  let printed_comments = new Set();
287
287
 
288
- var to_utf8 = options.ascii_only ? function(str, identifier) {
289
- if (options.ecma >= 2015 && !options.safari10) {
288
+ var to_utf8 = options.ascii_only ? function(str, identifier = false, regexp = false) {
289
+ if (options.ecma >= 2015 && !options.safari10 && !regexp) {
290
290
  str = str.replace(/[\ud800-\udbff][\udc00-\udfff]/g, function(ch) {
291
291
  var code = get_full_char_code(ch, 0).toString(16);
292
292
  return "\\u{" + code + "}";
@@ -2213,7 +2213,7 @@ function OutputStream(options) {
2213
2213
  flags = flags ? sort_regexp_flags(flags) : "";
2214
2214
  source = source.replace(r_slash_script, slash_script_replace);
2215
2215
 
2216
- output.print(output.to_utf8(`/${source}/${flags}`));
2216
+ output.print(output.to_utf8(`/${source}/${flags}`, false, true));
2217
2217
 
2218
2218
  const parent = output.parent();
2219
2219
  if (
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "homepage": "https://terser.org",
5
5
  "author": "Mihai Bazon <mihai.bazon@gmail.com> (http://lisperator.net/)",
6
6
  "license": "BSD-2-Clause",
7
- "version": "5.10.0",
7
+ "version": "5.11.0",
8
8
  "engines": {
9
9
  "node": ">=10"
10
10
  },
@@ -43,6 +43,7 @@
43
43
  "main.js"
44
44
  ],
45
45
  "dependencies": {
46
+ "acorn": "^8.5.0",
46
47
  "commander": "^2.20.0",
47
48
  "source-map": "~0.7.2",
48
49
  "source-map-support": "~0.5.20"
@@ -53,20 +54,12 @@
53
54
  "eslint": "^7.32.0",
54
55
  "eslump": "^3.0.0",
55
56
  "esm": "^3.2.25",
56
- "mocha": "^9.1.1",
57
+ "mocha": "^9.2.0",
57
58
  "pre-commit": "^1.2.2",
58
59
  "rimraf": "^3.0.2",
59
60
  "rollup": "2.56.3",
60
61
  "semver": "^7.3.4"
61
62
  },
62
- "peerDependencies": {
63
- "acorn": "^8.5.0"
64
- },
65
- "peerDependenciesMeta": {
66
- "acorn": {
67
- "optional": true
68
- }
69
- },
70
63
  "scripts": {
71
64
  "test": "node test/compress.js && mocha test/mocha",
72
65
  "test:compress": "node test/compress.js",
package/bin/terser.mjs DELETED
@@ -1,19 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- "use strict";
4
-
5
- import '../tools/exit.cjs'
6
- import fs from 'fs'
7
- import path from 'path'
8
- import program from 'commander'
9
-
10
- import { _run_cli as run_cli } from '../main.js'
11
-
12
- const packageJson = {
13
- name: 'terser',
14
- version: 'development-cli'
15
- }
16
- run_cli({ program, packageJson, fs, path }).catch((error) => {
17
- console.error(error);
18
- process.exitCode = 1;
19
- });