terser 5.13.0 → 5.14.1

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/lib/minify.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  map_to_object,
8
8
  HOP,
9
9
  } from "./utils/index.js";
10
- import { AST_Toplevel, AST_Node } from "./ast.js";
10
+ import { AST_Toplevel, AST_Node, walk, AST_Scope } from "./ast.js";
11
11
  import { parse } from "./parse.js";
12
12
  import { OutputStream } from "./output.js";
13
13
  import { Compressor } from "./compress/index.js";
@@ -194,6 +194,8 @@ async function minify(files, options, _fs_module) {
194
194
  url: null,
195
195
  }, true);
196
196
  }
197
+
198
+ // -- Parse phase --
197
199
  if (timings) timings.parse = Date.now();
198
200
  var toplevel;
199
201
  if (files instanceof AST_Toplevel) {
@@ -243,12 +245,16 @@ async function minify(files, options, _fs_module) {
243
245
  toplevel.figure_out_scope(options.mangle);
244
246
  toplevel.expand_names(options.mangle);
245
247
  }
248
+
249
+ // -- Compress phase --
246
250
  if (timings) timings.compress = Date.now();
247
251
  if (options.compress) {
248
252
  toplevel = new Compressor(options.compress, {
249
253
  mangle_options: options.mangle
250
254
  }).compress(toplevel);
251
255
  }
256
+
257
+ // -- Mangle phase --
252
258
  if (timings) timings.scope = Date.now();
253
259
  if (options.mangle) toplevel.figure_out_scope(options.mangle);
254
260
  if (timings) timings.mangle = Date.now();
@@ -261,6 +267,8 @@ async function minify(files, options, _fs_module) {
261
267
  if (options.mangle && options.mangle.properties) {
262
268
  toplevel = mangle_properties(toplevel, options.mangle.properties);
263
269
  }
270
+
271
+ // Format phase
264
272
  if (timings) timings.format = Date.now();
265
273
  var result = {};
266
274
  if (options.format.ast) {
@@ -270,19 +278,34 @@ async function minify(files, options, _fs_module) {
270
278
  result.ast = toplevel.to_mozilla_ast();
271
279
  }
272
280
  if (!HOP(options.format, "code") || options.format.code) {
281
+ if (!options.format.ast) {
282
+ // Destroy stuff to save RAM. (unless the deprecated `ast` option is on)
283
+ options.format._destroy_ast = true;
284
+
285
+ walk(toplevel, node => {
286
+ if (node instanceof AST_Scope) {
287
+ node.variables = undefined;
288
+ node.enclosed = undefined;
289
+ node.parent_scope = undefined;
290
+ }
291
+ if (node.block_scope) {
292
+ node.block_scope.variables = undefined;
293
+ node.block_scope.enclosed = undefined;
294
+ node.parent_scope = undefined;
295
+ }
296
+ });
297
+ }
298
+
273
299
  if (options.sourceMap) {
300
+ if (options.sourceMap.includeSources && files instanceof AST_Toplevel) {
301
+ throw new Error("original source content unavailable");
302
+ }
274
303
  options.format.source_map = await SourceMap({
275
304
  file: options.sourceMap.filename,
276
305
  orig: options.sourceMap.content,
277
- root: options.sourceMap.root
306
+ root: options.sourceMap.root,
307
+ files: options.sourceMap.includeSources ? files : null,
278
308
  });
279
- if (options.sourceMap.includeSources) {
280
- if (files instanceof AST_Toplevel) {
281
- throw new Error("original source content unavailable");
282
- } else for (var name in files) if (HOP(files, name)) {
283
- options.format.source_map.get().setSourceContent(name, files[name]);
284
- }
285
- }
286
309
  }
287
310
  delete options.format.ast;
288
311
  delete options.format.code;
@@ -291,11 +314,21 @@ async function minify(files, options, _fs_module) {
291
314
  toplevel.print(stream);
292
315
  result.code = stream.get();
293
316
  if (options.sourceMap) {
294
- if(options.sourceMap.asObject) {
295
- result.map = options.format.source_map.get().toJSON();
296
- } else {
297
- result.map = options.format.source_map.toString();
298
- }
317
+ Object.defineProperty(result, "map", {
318
+ configurable: true,
319
+ enumerable: true,
320
+ get() {
321
+ const map = options.format.source_map.getEncoded();
322
+ return (result.map = options.sourceMap.asObject ? map : JSON.stringify(map));
323
+ },
324
+ set(value) {
325
+ Object.defineProperty(result, "map", {
326
+ value,
327
+ writable: true,
328
+ });
329
+ }
330
+ });
331
+ result.decoded_map = options.format.source_map.getDecoded();
299
332
  if (options.sourceMap.url == "inline") {
300
333
  var sourceMap = typeof result.map === "object" ? JSON.stringify(result.map) : result.map;
301
334
  result.code += "\n//# sourceMappingURL=data:application/json;charset=utf-8;base64," + to_base64(sourceMap);
package/lib/output.js CHANGED
@@ -247,6 +247,8 @@ function OutputStream(options) {
247
247
  width : 80,
248
248
  wrap_iife : false,
249
249
  wrap_func_args : true,
250
+
251
+ _destroy_ast : false
250
252
  }, true);
251
253
 
252
254
  if (options.shorthand === undefined)
@@ -796,6 +798,18 @@ function OutputStream(options) {
796
798
  if (OUTPUT.length() > insert) newline_insert = insert;
797
799
  }
798
800
 
801
+ /**
802
+ * When output.option("_destroy_ast") is enabled, destroy the function.
803
+ * Call this after printing it.
804
+ */
805
+ const gc_scope =
806
+ options["_destroy_ast"]
807
+ ? function gc_scope(scope) {
808
+ scope.body.length = 0;
809
+ scope.argnames.length = 0;
810
+ }
811
+ : noop;
812
+
799
813
  var stack = [];
800
814
  return {
801
815
  get : get,
@@ -842,6 +856,7 @@ function OutputStream(options) {
842
856
  with_square : with_square,
843
857
  add_mapping : add_mapping,
844
858
  option : function(opt) { return options[opt]; },
859
+ gc_scope,
845
860
  printed_comments: printed_comments,
846
861
  prepend_comments: readonly ? noop : prepend_comments,
847
862
  append_comments : readonly || comment_filter === return_false ? noop : append_comments,
@@ -1358,6 +1373,7 @@ function OutputStream(options) {
1358
1373
  });
1359
1374
  DEFPRINT(AST_Lambda, function(self, output) {
1360
1375
  self._do_print(output);
1376
+ output.gc_scope(self);
1361
1377
  });
1362
1378
 
1363
1379
  DEFPRINT(AST_PrefixedTemplateString, function(self, output) {
@@ -1437,6 +1453,7 @@ function OutputStream(options) {
1437
1453
  print_braced(self, output);
1438
1454
  }
1439
1455
  if (needs_parens) { output.print(")"); }
1456
+ output.gc_scope(self);
1440
1457
  });
1441
1458
 
1442
1459
  /* -----[ exits ]----- */
package/lib/parse.js CHANGED
@@ -162,7 +162,7 @@ import {
162
162
  } from "./ast.js";
163
163
 
164
164
  var LATEST_RAW = ""; // Only used for numbers and template strings
165
- var LATEST_TEMPLATE_END = true;
165
+ var TEMPLATE_RAWS = new Map(); // Raw template strings
166
166
 
167
167
  var KEYWORDS = "break case catch class const continue debugger default delete do else export extends finally for function if in instanceof let new return switch throw try typeof var void while with";
168
168
  var KEYWORDS_ATOM = "false null true";
@@ -693,8 +693,8 @@ function tokenizer($TEXT, filename, html5_comments, shebang) {
693
693
  next(true, true);
694
694
  S.brace_counter++;
695
695
  tok = token(begin ? "template_head" : "template_substitution", content);
696
- LATEST_RAW = raw;
697
- LATEST_TEMPLATE_END = false;
696
+ TEMPLATE_RAWS.set(tok, raw);
697
+ tok.template_end = false;
698
698
  return tok;
699
699
  }
700
700
 
@@ -710,8 +710,8 @@ function tokenizer($TEXT, filename, html5_comments, shebang) {
710
710
  }
711
711
  S.template_braces.pop();
712
712
  tok = token(begin ? "template_head" : "template_substitution", content);
713
- LATEST_RAW = raw;
714
- LATEST_TEMPLATE_END = true;
713
+ TEMPLATE_RAWS.set(tok, raw);
714
+ tok.template_end = true;
715
715
  return tok;
716
716
  });
717
717
 
@@ -1572,66 +1572,66 @@ function parse($TEXT, options) {
1572
1572
  });
1573
1573
  };
1574
1574
 
1575
- function track_used_binding_identifiers(is_parameter, strict) {
1576
- var parameters = new Set();
1577
- var duplicate = false;
1578
- var default_assignment = false;
1579
- var spread = false;
1580
- var strict_mode = !!strict;
1581
- var tracker = {
1582
- add_parameter: function(token) {
1583
- if (parameters.has(token.value)) {
1584
- if (duplicate === false) {
1585
- duplicate = token;
1586
- }
1587
- tracker.check_strict();
1588
- } else {
1589
- parameters.add(token.value);
1590
- if (is_parameter) {
1591
- switch (token.value) {
1592
- case "arguments":
1593
- case "eval":
1594
- case "yield":
1595
- if (strict_mode) {
1596
- token_error(token, "Unexpected " + token.value + " identifier as parameter inside strict mode");
1597
- }
1598
- break;
1599
- default:
1600
- if (RESERVED_WORDS.has(token.value)) {
1601
- unexpected();
1602
- }
1575
+ class UsedParametersTracker {
1576
+ constructor(is_parameter, strict, duplicates_ok = false) {
1577
+ this.is_parameter = is_parameter;
1578
+ this.duplicates_ok = duplicates_ok;
1579
+ this.parameters = new Set();
1580
+ this.duplicate = null;
1581
+ this.default_assignment = false;
1582
+ this.spread = false;
1583
+ this.strict_mode = !!strict;
1584
+ }
1585
+ add_parameter(token) {
1586
+ if (this.parameters.has(token.value)) {
1587
+ if (this.duplicate === null) {
1588
+ this.duplicate = token;
1589
+ }
1590
+ this.check_strict();
1591
+ } else {
1592
+ this.parameters.add(token.value);
1593
+ if (this.is_parameter) {
1594
+ switch (token.value) {
1595
+ case "arguments":
1596
+ case "eval":
1597
+ case "yield":
1598
+ if (this.strict_mode) {
1599
+ token_error(token, "Unexpected " + token.value + " identifier as parameter inside strict mode");
1600
+ }
1601
+ break;
1602
+ default:
1603
+ if (RESERVED_WORDS.has(token.value)) {
1604
+ unexpected();
1603
1605
  }
1604
1606
  }
1605
1607
  }
1606
- },
1607
- mark_default_assignment: function(token) {
1608
- if (default_assignment === false) {
1609
- default_assignment = token;
1610
- }
1611
- },
1612
- mark_spread: function(token) {
1613
- if (spread === false) {
1614
- spread = token;
1615
- }
1616
- },
1617
- mark_strict_mode: function() {
1618
- strict_mode = true;
1619
- },
1620
- is_strict: function() {
1621
- return default_assignment !== false || spread !== false || strict_mode;
1622
- },
1623
- check_strict: function() {
1624
- if (tracker.is_strict() && duplicate !== false) {
1625
- token_error(duplicate, "Parameter " + duplicate.value + " was used already");
1626
- }
1627
1608
  }
1628
- };
1629
-
1630
- return tracker;
1609
+ }
1610
+ mark_default_assignment(token) {
1611
+ if (this.default_assignment === false) {
1612
+ this.default_assignment = token;
1613
+ }
1614
+ }
1615
+ mark_spread(token) {
1616
+ if (this.spread === false) {
1617
+ this.spread = token;
1618
+ }
1619
+ }
1620
+ mark_strict_mode() {
1621
+ this.strict_mode = true;
1622
+ }
1623
+ is_strict() {
1624
+ return this.default_assignment !== false || this.spread !== false || this.strict_mode;
1625
+ }
1626
+ check_strict() {
1627
+ if (this.is_strict() && this.duplicate !== null && !this.duplicates_ok) {
1628
+ token_error(this.duplicate, "Parameter " + this.duplicate.value + " was used already");
1629
+ }
1630
+ }
1631
1631
  }
1632
1632
 
1633
1633
  function parameters(params) {
1634
- var used_parameters = track_used_binding_identifiers(true, S.input.has_directive("use strict"));
1634
+ var used_parameters = new UsedParametersTracker(true, S.input.has_directive("use strict"));
1635
1635
 
1636
1636
  expect("(");
1637
1637
 
@@ -1655,7 +1655,7 @@ function parse($TEXT, options) {
1655
1655
  var param;
1656
1656
  var expand = false;
1657
1657
  if (used_parameters === undefined) {
1658
- used_parameters = track_used_binding_identifiers(true, S.input.has_directive("use strict"));
1658
+ used_parameters = new UsedParametersTracker(true, S.input.has_directive("use strict"));
1659
1659
  }
1660
1660
  if (is("expand", "...")) {
1661
1661
  expand = S.token;
@@ -1698,7 +1698,9 @@ function parse($TEXT, options) {
1698
1698
  var expand_token;
1699
1699
  var first_token = S.token;
1700
1700
  if (used_parameters === undefined) {
1701
- used_parameters = track_used_binding_identifiers(false, S.input.has_directive("use strict"));
1701
+ const strict = S.input.has_directive("use strict");
1702
+ const duplicates_ok = symbol_type === AST_SymbolVar;
1703
+ used_parameters = new UsedParametersTracker(false, strict, duplicates_ok);
1702
1704
  }
1703
1705
  symbol_type = symbol_type === undefined ? AST_SymbolFunarg : symbol_type;
1704
1706
  if (is("punc", "[")) {
@@ -2091,7 +2093,7 @@ function parse($TEXT, options) {
2091
2093
  if (is("punc", "{") || is("punc", "[")) {
2092
2094
  def = new AST_VarDef({
2093
2095
  start: S.token,
2094
- name: binding_element(undefined ,sym_type),
2096
+ name: binding_element(undefined, sym_type),
2095
2097
  value: is("operator", "=") ? (expect_token("operator", "="), expression(false, no_in)) : null,
2096
2098
  end: prev()
2097
2099
  });
@@ -2365,19 +2367,19 @@ function parse($TEXT, options) {
2365
2367
 
2366
2368
  segments.push(new AST_TemplateSegment({
2367
2369
  start: S.token,
2368
- raw: LATEST_RAW,
2370
+ raw: TEMPLATE_RAWS.get(S.token),
2369
2371
  value: S.token.value,
2370
2372
  end: S.token
2371
2373
  }));
2372
2374
 
2373
- while (!LATEST_TEMPLATE_END) {
2375
+ while (!S.token.template_end) {
2374
2376
  next();
2375
2377
  handle_regexp();
2376
2378
  segments.push(expression(true));
2377
2379
 
2378
2380
  segments.push(new AST_TemplateSegment({
2379
2381
  start: S.token,
2380
- raw: LATEST_RAW,
2382
+ raw: TEMPLATE_RAWS.get(S.token),
2381
2383
  value: S.token.value,
2382
2384
  end: S.token
2383
2385
  }));
@@ -3340,6 +3342,7 @@ function parse($TEXT, options) {
3340
3342
  } else {
3341
3343
  toplevel = new AST_Toplevel({ start: start, body: body, end: end });
3342
3344
  }
3345
+ TEMPLATE_RAWS = new Map();
3343
3346
  return toplevel;
3344
3347
  })();
3345
3348
 
package/lib/size.js CHANGED
@@ -115,6 +115,7 @@ AST_Directive.prototype._size = function () {
115
115
  return 2 + this.value.length;
116
116
  };
117
117
 
118
+ /** Count commas/semicolons necessary to show a list of expressions/statements */
118
119
  const list_overhead = (array) => array.length && array.length - 1;
119
120
 
120
121
  AST_Block.prototype._size = function () {
@@ -167,7 +168,7 @@ AST_Arrow.prototype._size = function () {
167
168
  && this.argnames[0] instanceof AST_Symbol
168
169
  )
169
170
  ) {
170
- args_and_arrow += 2;
171
+ args_and_arrow += 2; // parens around the args
171
172
  }
172
173
 
173
174
  const body_overhead = this.is_braceless() ? 0 : list_overhead(this.body) + 2;
@@ -229,19 +230,16 @@ AST_Finally.prototype._size = function () {
229
230
  return 7 + list_overhead(this.body);
230
231
  };
231
232
 
232
- /*#__INLINE__*/
233
- const def_size = (size, def) => size + list_overhead(def.definitions);
234
-
235
233
  AST_Var.prototype._size = function () {
236
- return def_size(4, this);
234
+ return 4 + list_overhead(this.definitions);
237
235
  };
238
236
 
239
237
  AST_Let.prototype._size = function () {
240
- return def_size(4, this);
238
+ return 4 + list_overhead(this.definitions);
241
239
  };
242
240
 
243
241
  AST_Const.prototype._size = function () {
244
- return def_size(6, this);
242
+ return 6 + list_overhead(this.definitions);
245
243
  };
246
244
 
247
245
  AST_VarDef.prototype._size = function () {
@@ -477,7 +475,7 @@ AST_NaN.prototype._size = () => 3;
477
475
 
478
476
  AST_Undefined.prototype._size = () => 6; // "void 0"
479
477
 
480
- AST_Hole.prototype._size = () => 0; // comma is taken into account
478
+ AST_Hole.prototype._size = () => 0; // comma is taken into account by list_overhead()
481
479
 
482
480
  AST_Infinity.prototype._size = () => 8;
483
481
 
package/lib/sourcemap.js CHANGED
@@ -43,45 +43,59 @@
43
43
 
44
44
  "use strict";
45
45
 
46
- import MOZ_SourceMap from "source-map";
47
- import {
48
- defaults,
49
- } from "./utils/index.js";
46
+ import {SourceMapConsumer, SourceMapGenerator} from "@jridgewell/source-map";
47
+ import {defaults, HOP} from "./utils/index.js";
50
48
 
51
- // a small wrapper around fitzgen's source-map library
49
+ // a small wrapper around source-map and @jridgewell/source-map
52
50
  async function SourceMap(options) {
53
51
  options = defaults(options, {
54
52
  file : null,
55
53
  root : null,
56
54
  orig : null,
57
-
58
- orig_line_diff : 0,
59
- dest_line_diff : 0,
55
+ files: {},
60
56
  });
61
57
 
62
58
  var orig_map;
63
- var generator = new MOZ_SourceMap.SourceMapGenerator({
59
+ var generator = new SourceMapGenerator({
64
60
  file : options.file,
65
61
  sourceRoot : options.root
66
62
  });
67
63
 
64
+ let sourcesContent = {__proto__: null};
65
+ let files = options.files;
66
+ for (var name in files) if (HOP(files, name)) {
67
+ sourcesContent[name] = files[name];
68
+ }
68
69
  if (options.orig) {
69
- orig_map = await new MOZ_SourceMap.SourceMapConsumer(options.orig);
70
- orig_map.sources.forEach(function(source) {
71
- var sourceContent = orig_map.sourceContentFor(source, true);
72
- if (sourceContent) {
73
- generator.setSourceContent(source, sourceContent);
74
- }
75
- });
70
+ // We support both @jridgewell/source-map (which has a sync
71
+ // SourceMapConsumer) and source-map (which has an async
72
+ // SourceMapConsumer).
73
+ orig_map = await new SourceMapConsumer(options.orig);
74
+ if (orig_map.sourcesContent) {
75
+ orig_map.sources.forEach(function(source, i) {
76
+ var content = orig_map.sourcesContent[i];
77
+ if (content) {
78
+ sourcesContent[source] = content;
79
+ }
80
+ });
81
+ }
76
82
  }
77
83
 
78
84
  function add(source, gen_line, gen_col, orig_line, orig_col, name) {
85
+ let generatedPos = { line: gen_line, column: gen_col };
86
+
79
87
  if (orig_map) {
80
88
  var info = orig_map.originalPositionFor({
81
89
  line: orig_line,
82
90
  column: orig_col
83
91
  });
84
92
  if (info.source === null) {
93
+ generator.addMapping({
94
+ generated: generatedPos,
95
+ original: null,
96
+ source: null,
97
+ name: null
98
+ });
85
99
  return;
86
100
  }
87
101
  source = info.source;
@@ -90,22 +104,42 @@ async function SourceMap(options) {
90
104
  name = info.name || name;
91
105
  }
92
106
  generator.addMapping({
93
- generated : { line: gen_line + options.dest_line_diff, column: gen_col },
94
- original : { line: orig_line + options.orig_line_diff, column: orig_col },
107
+ generated : generatedPos,
108
+ original : { line: orig_line, column: orig_col },
95
109
  source : source,
96
110
  name : name
97
111
  });
112
+ generator.setSourceContent(source, sourcesContent[source]);
113
+ }
114
+
115
+ function clean(map) {
116
+ const allNull = map.sourcesContent && map.sourcesContent.every(c => c == null);
117
+ if (allNull) delete map.sourcesContent;
118
+ if (map.file === undefined) delete map.file;
119
+ if (map.sourceRoot === undefined) delete map.sourceRoot;
120
+ return map;
121
+ }
122
+
123
+ function getDecoded() {
124
+ if (!generator.toDecodedMap) return null;
125
+ return clean(generator.toDecodedMap());
126
+ }
127
+
128
+ function getEncoded() {
129
+ return clean(generator.toJSON());
130
+ }
131
+
132
+ function destroy() {
133
+ // @jridgewell/source-map's SourceMapConsumer does not need to be
134
+ // manually freed.
135
+ if (orig_map && orig_map.destroy) orig_map.destroy();
98
136
  }
99
137
 
100
138
  return {
101
- add : add,
102
- get : function() { return generator; },
103
- toString : function() { return generator.toString(); },
104
- destroy : function () {
105
- if (orig_map && orig_map.destroy) {
106
- orig_map.destroy();
107
- }
108
- }
139
+ add,
140
+ getDecoded,
141
+ getEncoded,
142
+ destroy,
109
143
  };
110
144
  }
111
145
 
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.13.0",
7
+ "version": "5.14.1",
8
8
  "engines": {
9
9
  "node": ">=10"
10
10
  },
@@ -18,6 +18,7 @@
18
18
  "exports": {
19
19
  ".": [
20
20
  {
21
+ "types": "./tools/terser.d.ts",
21
22
  "import": "./main.js",
22
23
  "require": "./dist/bundle.min.js"
23
24
  },
@@ -43,9 +44,9 @@
43
44
  "main.js"
44
45
  ],
45
46
  "dependencies": {
47
+ "@jridgewell/source-map": "^0.3.2",
46
48
  "acorn": "^8.5.0",
47
49
  "commander": "^2.20.0",
48
- "source-map": "~0.8.0-beta.0",
49
50
  "source-map-support": "~0.5.20"
50
51
  },
51
52
  "devDependencies": {
@@ -58,7 +59,8 @@
58
59
  "pre-commit": "^1.2.2",
59
60
  "rimraf": "^3.0.2",
60
61
  "rollup": "2.56.3",
61
- "semver": "^7.3.4"
62
+ "semver": "^7.3.4",
63
+ "source-map": "~0.8.0-beta.0"
62
64
  },
63
65
  "scripts": {
64
66
  "test": "node test/compress.js && mocha test/mocha",
package/tools/domprops.js CHANGED
@@ -320,6 +320,7 @@ export var domprops = [
320
320
  "COMMENT_NODE",
321
321
  "COMPARE_REF_TO_TEXTURE",
322
322
  "COMPILE_STATUS",
323
+ "COMPLETION_STATUS_KHR",
323
324
  "COMPRESSED_RGBA_S3TC_DXT1_EXT",
324
325
  "COMPRESSED_RGBA_S3TC_DXT3_EXT",
325
326
  "COMPRESSED_RGBA_S3TC_DXT5_EXT",
package/tools/terser.d.ts CHANGED
@@ -1,11 +1,12 @@
1
1
  /// <reference lib="es2015" />
2
2
 
3
- import { RawSourceMap } from 'source-map';
3
+ import { SectionedSourceMapInput, EncodedSourceMap, DecodedSourceMap } from '@jridgewell/source-map';
4
4
 
5
5
  export type ECMA = 5 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020;
6
6
 
7
7
  export interface ParseOptions {
8
8
  bare_returns?: boolean;
9
+ /** @deprecated legacy option. Currently, all supported EcmaScript is valid to parse. */
9
10
  ecma?: ECMA;
10
11
  html5_comments?: boolean;
11
12
  shebang?: boolean;
@@ -144,6 +145,7 @@ export interface FormatOptions {
144
145
  }) => boolean );
145
146
  ecma?: ECMA;
146
147
  ie8?: boolean;
148
+ keep_numbers?: boolean;
147
149
  indent_level?: number;
148
150
  indent_start?: number;
149
151
  inline_script?: boolean;
@@ -192,12 +194,13 @@ export interface MinifyOptions {
192
194
 
193
195
  export interface MinifyOutput {
194
196
  code?: string;
195
- map?: RawSourceMap | string;
197
+ map?: EncodedSourceMap | string;
198
+ decoded_map?: DecodedSourceMap | null;
196
199
  }
197
200
 
198
201
  export interface SourceMapOptions {
199
202
  /** Source map object, 'inline' or source map file content */
200
- content?: RawSourceMap | string;
203
+ content?: SectionedSourceMapInput | string;
201
204
  includeSources?: boolean;
202
205
  filename?: string;
203
206
  root?: string;