terser 5.39.1 → 5.40.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 +12 -0
- package/dist/bundle.min.js +63 -58
- package/lib/cli.js +1 -1
- package/lib/mozilla-ast.js +54 -41
- package/lib/parse.js +8 -16
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## v5.40.0
|
4
|
+
|
5
|
+
- Fix exporting AssignmentExpression (default assign pattern) to ESTree
|
6
|
+
- Fix ESTree output of object keys with quotes
|
7
|
+
- Fix handling of an ESTree empty `export {}` (#1601)
|
8
|
+
- Fix some `const` and `let` resulting from ESTree input (#1599)
|
9
|
+
|
10
|
+
## v5.39.2
|
11
|
+
|
12
|
+
- Fix crash when parsing bare `yield` inside a template string.
|
13
|
+
- Update internally used acorn version requirement
|
14
|
+
|
3
15
|
## v5.39.1
|
4
16
|
|
5
17
|
- Fix bitwise operations that could mix `BigInt` and `number`
|
package/dist/bundle.min.js
CHANGED
@@ -843,7 +843,7 @@ function tokenizer($TEXT, filename, html5_comments, shebang) {
|
|
843
843
|
} else if (ch == "$" && peek() == "{") {
|
844
844
|
next(true, true);
|
845
845
|
S.brace_counter++;
|
846
|
-
tok = token(begin ? "template_head" : "
|
846
|
+
tok = token(begin ? "template_head" : "template_cont", content);
|
847
847
|
TEMPLATE_RAWS.set(tok, raw);
|
848
848
|
tok.template_end = false;
|
849
849
|
return tok;
|
@@ -860,7 +860,7 @@ function tokenizer($TEXT, filename, html5_comments, shebang) {
|
|
860
860
|
content += ch;
|
861
861
|
}
|
862
862
|
S.template_braces.pop();
|
863
|
-
tok = token(begin ? "template_head" : "
|
863
|
+
tok = token(begin ? "template_head" : "template_cont", content);
|
864
864
|
TEMPLATE_RAWS.set(tok, raw);
|
865
865
|
tok.template_end = true;
|
866
866
|
return tok;
|
@@ -1685,14 +1685,9 @@ function parse($TEXT, options) {
|
|
1685
1685
|
|
1686
1686
|
var body = _function_body(is("punc", "{"), false, is_async);
|
1687
1687
|
|
1688
|
-
var end =
|
1689
|
-
body instanceof Array && body.length ? body[body.length - 1].end :
|
1690
|
-
body instanceof Array ? start :
|
1691
|
-
body.end;
|
1692
|
-
|
1693
1688
|
return new AST_Arrow({
|
1694
1689
|
start : start,
|
1695
|
-
end : end,
|
1690
|
+
end : body.end,
|
1696
1691
|
async : is_async,
|
1697
1692
|
argnames : argnames,
|
1698
1693
|
body : body
|
@@ -2111,11 +2106,6 @@ function parse($TEXT, options) {
|
|
2111
2106
|
}
|
2112
2107
|
|
2113
2108
|
function _yield_expression() {
|
2114
|
-
// Previous token must be keyword yield and not be interpret as an identifier
|
2115
|
-
if (!is_in_generator()) {
|
2116
|
-
croak("Unexpected yield expression outside generator function",
|
2117
|
-
S.prev.line, S.prev.col, S.prev.pos);
|
2118
|
-
}
|
2119
2109
|
var start = S.token;
|
2120
2110
|
var star = false;
|
2121
2111
|
var has_expression = true;
|
@@ -2130,10 +2120,12 @@ function parse($TEXT, options) {
|
|
2130
2120
|
// Note 1: It isn't allowed for yield* to close without an expression
|
2131
2121
|
// Note 2: If there is a nlb between yield and star, it is interpret as
|
2132
2122
|
// yield <explicit undefined> <inserted automatic semicolon> *
|
2133
|
-
if (
|
2134
|
-
(
|
2123
|
+
if (
|
2124
|
+
can_insert_semicolon()
|
2125
|
+
|| is("punc") && PUNC_AFTER_EXPRESSION.has(S.token.value)
|
2126
|
+
|| is("template_cont")
|
2127
|
+
) {
|
2135
2128
|
has_expression = false;
|
2136
|
-
|
2137
2129
|
} else if (is("operator", "*")) {
|
2138
2130
|
star = true;
|
2139
2131
|
next();
|
@@ -7361,6 +7353,9 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
|
|
7361
7353
|
start : my_start_token(key || M.value),
|
7362
7354
|
end : my_end_token(M.value),
|
7363
7355
|
key : key.type == "Identifier" ? key.name : key.value,
|
7356
|
+
quote : !key.computed && key.type === "Literal" && typeof key.value === "string"
|
7357
|
+
? '"'
|
7358
|
+
: null,
|
7364
7359
|
value : from_moz(M.value)
|
7365
7360
|
};
|
7366
7361
|
if (M.computed) {
|
@@ -7393,7 +7388,6 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
|
|
7393
7388
|
if (M.kind == "method") {
|
7394
7389
|
args.async = M.value.async;
|
7395
7390
|
args.is_generator = M.value.generator;
|
7396
|
-
args.quote = M.computed ? "\"" : null;
|
7397
7391
|
return new AST_ConciseMethod(args);
|
7398
7392
|
}
|
7399
7393
|
},
|
@@ -7637,14 +7631,26 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
|
|
7637
7631
|
},
|
7638
7632
|
|
7639
7633
|
ExportNamedDeclaration: function(M) {
|
7640
|
-
|
7641
|
-
|
7642
|
-
|
7643
|
-
|
7644
|
-
|
7645
|
-
|
7646
|
-
|
7647
|
-
|
7634
|
+
if (M.declaration) {
|
7635
|
+
// export const, export function, ...
|
7636
|
+
return new AST_Export({
|
7637
|
+
start: my_start_token(M),
|
7638
|
+
end: my_end_token(M),
|
7639
|
+
exported_definition: from_moz(M.declaration),
|
7640
|
+
exported_names: null,
|
7641
|
+
module_name: null,
|
7642
|
+
attributes: null,
|
7643
|
+
});
|
7644
|
+
} else {
|
7645
|
+
return new AST_Export({
|
7646
|
+
start: my_start_token(M),
|
7647
|
+
end: my_end_token(M),
|
7648
|
+
exported_definition: null,
|
7649
|
+
exported_names: M.specifiers && M.specifiers.length ? M.specifiers.map(from_moz) : [],
|
7650
|
+
module_name: from_moz(M.source),
|
7651
|
+
attributes: import_attributes_from_moz(M.attributes || M.assertions),
|
7652
|
+
});
|
7653
|
+
}
|
7648
7654
|
},
|
7649
7655
|
|
7650
7656
|
ExportDefaultDeclaration: function(M) {
|
@@ -7736,8 +7742,9 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
|
|
7736
7742
|
|
7737
7743
|
Identifier: function(M) {
|
7738
7744
|
var p = FROM_MOZ_STACK[FROM_MOZ_STACK.length - 2];
|
7745
|
+
var q = FROM_MOZ_STACK[FROM_MOZ_STACK.length - 3];
|
7739
7746
|
return new ( p.type == "LabeledStatement" ? AST_Label
|
7740
|
-
: p.type == "VariableDeclarator" && p.id === M ? (
|
7747
|
+
: p.type == "VariableDeclarator" && p.id === M ? (q.kind == "const" ? AST_SymbolConst : q.kind == "let" ? AST_SymbolLet : AST_SymbolVar)
|
7741
7748
|
: /Import.*Specifier/.test(p.type) ? (p.local === M ? AST_SymbolImport : AST_SymbolImportForeign)
|
7742
7749
|
: p.type == "ExportSpecifier" ? (p.local === M ? AST_SymbolExport : AST_SymbolExportForeign)
|
7743
7750
|
: p.type == "FunctionExpression" ? (p.id === M ? AST_SymbolLambda : AST_SymbolFunarg)
|
@@ -8189,30 +8196,6 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
|
|
8189
8196
|
type: "Super"
|
8190
8197
|
};
|
8191
8198
|
});
|
8192
|
-
def_to_moz(AST_Binary, function To_Moz_BinaryExpression(M) {
|
8193
|
-
return {
|
8194
|
-
type: "BinaryExpression",
|
8195
|
-
operator: M.operator,
|
8196
|
-
left: to_moz(M.left),
|
8197
|
-
right: to_moz(M.right)
|
8198
|
-
};
|
8199
|
-
});
|
8200
|
-
def_to_moz(AST_Binary, function To_Moz_LogicalExpression(M) {
|
8201
|
-
return {
|
8202
|
-
type: "LogicalExpression",
|
8203
|
-
operator: M.operator,
|
8204
|
-
left: to_moz(M.left),
|
8205
|
-
right: to_moz(M.right)
|
8206
|
-
};
|
8207
|
-
});
|
8208
|
-
def_to_moz(AST_Assign, function To_Moz_AssignmentExpression(M) {
|
8209
|
-
return {
|
8210
|
-
type: "AssignmentExpression",
|
8211
|
-
operator: M.operator,
|
8212
|
-
left: to_moz(M.left),
|
8213
|
-
right: to_moz(M.right)
|
8214
|
-
};
|
8215
|
-
});
|
8216
8199
|
def_to_moz(AST_Conditional, function To_Moz_ConditionalExpression(M) {
|
8217
8200
|
return {
|
8218
8201
|
type: "ConditionalExpression",
|
@@ -8339,6 +8322,14 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
|
|
8339
8322
|
};
|
8340
8323
|
});
|
8341
8324
|
|
8325
|
+
def_to_moz(AST_DefaultAssign, function To_Moz_AssignmentExpression(M) {
|
8326
|
+
return {
|
8327
|
+
type: "AssignmentPattern",
|
8328
|
+
left: to_moz(M.left),
|
8329
|
+
right: to_moz(M.right),
|
8330
|
+
};
|
8331
|
+
});
|
8332
|
+
|
8342
8333
|
def_to_moz(AST_Directive, function To_Moz_Directive(M) {
|
8343
8334
|
return {
|
8344
8335
|
type: "ExpressionStatement",
|
@@ -8415,8 +8406,7 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
|
|
8415
8406
|
def_to_moz(AST_Export, function To_Moz_ExportDeclaration(M) {
|
8416
8407
|
if (M.exported_names) {
|
8417
8408
|
var first_exported = M.exported_names[0];
|
8418
|
-
|
8419
|
-
if (first_exported_name.name === "*" && !first_exported_name.quote) {
|
8409
|
+
if (first_exported && first_exported.name.name === "*" && !first_exported.name.quote) {
|
8420
8410
|
var foreign_name = first_exported.foreign_name;
|
8421
8411
|
var exported = foreign_name.name === "*" && !foreign_name.quote
|
8422
8412
|
? null
|
@@ -8563,6 +8553,15 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
|
|
8563
8553
|
};
|
8564
8554
|
});
|
8565
8555
|
|
8556
|
+
def_to_moz(AST_Assign, function To_Moz_AssignmentExpression(M) {
|
8557
|
+
return {
|
8558
|
+
type: "AssignmentExpression",
|
8559
|
+
operator: M.operator,
|
8560
|
+
left: to_moz(M.left),
|
8561
|
+
right: to_moz(M.right)
|
8562
|
+
};
|
8563
|
+
});
|
8564
|
+
|
8566
8565
|
def_to_moz(AST_PrivateIn, function To_Moz_BinaryExpression_PrivateIn(M) {
|
8567
8566
|
return {
|
8568
8567
|
type: "BinaryExpression",
|
@@ -8589,7 +8588,7 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
|
|
8589
8588
|
def_to_moz(AST_ObjectProperty, function To_Moz_Property(M, parent) {
|
8590
8589
|
var key = M.key instanceof AST_Node ? to_moz(M.key) : {
|
8591
8590
|
type: "Identifier",
|
8592
|
-
value: M.key
|
8591
|
+
value: M.key,
|
8593
8592
|
};
|
8594
8593
|
if (typeof M.key === "number") {
|
8595
8594
|
key = {
|
@@ -8598,10 +8597,16 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
|
|
8598
8597
|
};
|
8599
8598
|
}
|
8600
8599
|
if (typeof M.key === "string") {
|
8601
|
-
key =
|
8602
|
-
|
8603
|
-
|
8604
|
-
|
8600
|
+
key = M.quote
|
8601
|
+
? {
|
8602
|
+
type: "Literal",
|
8603
|
+
value: M.key,
|
8604
|
+
raw: JSON.stringify(M.key),
|
8605
|
+
}
|
8606
|
+
: {
|
8607
|
+
type: "Identifier",
|
8608
|
+
name: M.key,
|
8609
|
+
};
|
8605
8610
|
}
|
8606
8611
|
var kind;
|
8607
8612
|
var string_or_num = typeof M.key === "string" || typeof M.key === "number";
|
@@ -32837,7 +32842,7 @@ async function run_cli({ program, packageJson, fs, path }) {
|
|
32837
32842
|
if (program.parse.acorn) {
|
32838
32843
|
files = convert_ast(function(toplevel, name) {
|
32839
32844
|
return require("acorn").parse(files[name], {
|
32840
|
-
ecmaVersion:
|
32845
|
+
ecmaVersion: 2024,
|
32841
32846
|
locations: true,
|
32842
32847
|
program: toplevel,
|
32843
32848
|
sourceFile: name,
|
package/lib/cli.js
CHANGED
@@ -202,7 +202,7 @@ export async function run_cli({ program, packageJson, fs, path }) {
|
|
202
202
|
if (program.parse.acorn) {
|
203
203
|
files = convert_ast(function(toplevel, name) {
|
204
204
|
return require("acorn").parse(files[name], {
|
205
|
-
ecmaVersion:
|
205
|
+
ecmaVersion: 2024,
|
206
206
|
locations: true,
|
207
207
|
program: toplevel,
|
208
208
|
sourceFile: name,
|
package/lib/mozilla-ast.js
CHANGED
@@ -355,6 +355,9 @@ import { is_basic_identifier_string } from "./parse.js";
|
|
355
355
|
start : my_start_token(key || M.value),
|
356
356
|
end : my_end_token(M.value),
|
357
357
|
key : key.type == "Identifier" ? key.name : key.value,
|
358
|
+
quote : !key.computed && key.type === "Literal" && typeof key.value === "string"
|
359
|
+
? '"'
|
360
|
+
: null,
|
358
361
|
value : from_moz(M.value)
|
359
362
|
};
|
360
363
|
if (M.computed) {
|
@@ -387,7 +390,6 @@ import { is_basic_identifier_string } from "./parse.js";
|
|
387
390
|
if (M.kind == "method") {
|
388
391
|
args.async = M.value.async;
|
389
392
|
args.is_generator = M.value.generator;
|
390
|
-
args.quote = M.computed ? "\"" : null;
|
391
393
|
return new AST_ConciseMethod(args);
|
392
394
|
}
|
393
395
|
},
|
@@ -631,14 +633,26 @@ import { is_basic_identifier_string } from "./parse.js";
|
|
631
633
|
},
|
632
634
|
|
633
635
|
ExportNamedDeclaration: function(M) {
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
636
|
+
if (M.declaration) {
|
637
|
+
// export const, export function, ...
|
638
|
+
return new AST_Export({
|
639
|
+
start: my_start_token(M),
|
640
|
+
end: my_end_token(M),
|
641
|
+
exported_definition: from_moz(M.declaration),
|
642
|
+
exported_names: null,
|
643
|
+
module_name: null,
|
644
|
+
attributes: null,
|
645
|
+
});
|
646
|
+
} else {
|
647
|
+
return new AST_Export({
|
648
|
+
start: my_start_token(M),
|
649
|
+
end: my_end_token(M),
|
650
|
+
exported_definition: null,
|
651
|
+
exported_names: M.specifiers && M.specifiers.length ? M.specifiers.map(from_moz) : [],
|
652
|
+
module_name: from_moz(M.source),
|
653
|
+
attributes: import_attributes_from_moz(M.attributes || M.assertions),
|
654
|
+
});
|
655
|
+
}
|
642
656
|
},
|
643
657
|
|
644
658
|
ExportDefaultDeclaration: function(M) {
|
@@ -730,8 +744,9 @@ import { is_basic_identifier_string } from "./parse.js";
|
|
730
744
|
|
731
745
|
Identifier: function(M) {
|
732
746
|
var p = FROM_MOZ_STACK[FROM_MOZ_STACK.length - 2];
|
747
|
+
var q = FROM_MOZ_STACK[FROM_MOZ_STACK.length - 3];
|
733
748
|
return new ( p.type == "LabeledStatement" ? AST_Label
|
734
|
-
: p.type == "VariableDeclarator" && p.id === M ? (
|
749
|
+
: p.type == "VariableDeclarator" && p.id === M ? (q.kind == "const" ? AST_SymbolConst : q.kind == "let" ? AST_SymbolLet : AST_SymbolVar)
|
735
750
|
: /Import.*Specifier/.test(p.type) ? (p.local === M ? AST_SymbolImport : AST_SymbolImportForeign)
|
736
751
|
: p.type == "ExportSpecifier" ? (p.local === M ? AST_SymbolExport : AST_SymbolExportForeign)
|
737
752
|
: p.type == "FunctionExpression" ? (p.id === M ? AST_SymbolLambda : AST_SymbolFunarg)
|
@@ -1183,30 +1198,6 @@ import { is_basic_identifier_string } from "./parse.js";
|
|
1183
1198
|
type: "Super"
|
1184
1199
|
};
|
1185
1200
|
});
|
1186
|
-
def_to_moz(AST_Binary, function To_Moz_BinaryExpression(M) {
|
1187
|
-
return {
|
1188
|
-
type: "BinaryExpression",
|
1189
|
-
operator: M.operator,
|
1190
|
-
left: to_moz(M.left),
|
1191
|
-
right: to_moz(M.right)
|
1192
|
-
};
|
1193
|
-
});
|
1194
|
-
def_to_moz(AST_Binary, function To_Moz_LogicalExpression(M) {
|
1195
|
-
return {
|
1196
|
-
type: "LogicalExpression",
|
1197
|
-
operator: M.operator,
|
1198
|
-
left: to_moz(M.left),
|
1199
|
-
right: to_moz(M.right)
|
1200
|
-
};
|
1201
|
-
});
|
1202
|
-
def_to_moz(AST_Assign, function To_Moz_AssignmentExpression(M) {
|
1203
|
-
return {
|
1204
|
-
type: "AssignmentExpression",
|
1205
|
-
operator: M.operator,
|
1206
|
-
left: to_moz(M.left),
|
1207
|
-
right: to_moz(M.right)
|
1208
|
-
};
|
1209
|
-
});
|
1210
1201
|
def_to_moz(AST_Conditional, function To_Moz_ConditionalExpression(M) {
|
1211
1202
|
return {
|
1212
1203
|
type: "ConditionalExpression",
|
@@ -1333,6 +1324,14 @@ import { is_basic_identifier_string } from "./parse.js";
|
|
1333
1324
|
};
|
1334
1325
|
});
|
1335
1326
|
|
1327
|
+
def_to_moz(AST_DefaultAssign, function To_Moz_AssignmentExpression(M) {
|
1328
|
+
return {
|
1329
|
+
type: "AssignmentPattern",
|
1330
|
+
left: to_moz(M.left),
|
1331
|
+
right: to_moz(M.right),
|
1332
|
+
};
|
1333
|
+
});
|
1334
|
+
|
1336
1335
|
def_to_moz(AST_Directive, function To_Moz_Directive(M) {
|
1337
1336
|
return {
|
1338
1337
|
type: "ExpressionStatement",
|
@@ -1409,8 +1408,7 @@ import { is_basic_identifier_string } from "./parse.js";
|
|
1409
1408
|
def_to_moz(AST_Export, function To_Moz_ExportDeclaration(M) {
|
1410
1409
|
if (M.exported_names) {
|
1411
1410
|
var first_exported = M.exported_names[0];
|
1412
|
-
|
1413
|
-
if (first_exported_name.name === "*" && !first_exported_name.quote) {
|
1411
|
+
if (first_exported && first_exported.name.name === "*" && !first_exported.name.quote) {
|
1414
1412
|
var foreign_name = first_exported.foreign_name;
|
1415
1413
|
var exported = foreign_name.name === "*" && !foreign_name.quote
|
1416
1414
|
? null
|
@@ -1557,6 +1555,15 @@ import { is_basic_identifier_string } from "./parse.js";
|
|
1557
1555
|
};
|
1558
1556
|
});
|
1559
1557
|
|
1558
|
+
def_to_moz(AST_Assign, function To_Moz_AssignmentExpression(M) {
|
1559
|
+
return {
|
1560
|
+
type: "AssignmentExpression",
|
1561
|
+
operator: M.operator,
|
1562
|
+
left: to_moz(M.left),
|
1563
|
+
right: to_moz(M.right)
|
1564
|
+
};
|
1565
|
+
});
|
1566
|
+
|
1560
1567
|
def_to_moz(AST_PrivateIn, function To_Moz_BinaryExpression_PrivateIn(M) {
|
1561
1568
|
return {
|
1562
1569
|
type: "BinaryExpression",
|
@@ -1583,7 +1590,7 @@ import { is_basic_identifier_string } from "./parse.js";
|
|
1583
1590
|
def_to_moz(AST_ObjectProperty, function To_Moz_Property(M, parent) {
|
1584
1591
|
var key = M.key instanceof AST_Node ? to_moz(M.key) : {
|
1585
1592
|
type: "Identifier",
|
1586
|
-
value: M.key
|
1593
|
+
value: M.key,
|
1587
1594
|
};
|
1588
1595
|
if (typeof M.key === "number") {
|
1589
1596
|
key = {
|
@@ -1592,10 +1599,16 @@ import { is_basic_identifier_string } from "./parse.js";
|
|
1592
1599
|
};
|
1593
1600
|
}
|
1594
1601
|
if (typeof M.key === "string") {
|
1595
|
-
key =
|
1596
|
-
|
1597
|
-
|
1598
|
-
|
1602
|
+
key = M.quote
|
1603
|
+
? {
|
1604
|
+
type: "Literal",
|
1605
|
+
value: M.key,
|
1606
|
+
raw: JSON.stringify(M.key),
|
1607
|
+
}
|
1608
|
+
: {
|
1609
|
+
type: "Identifier",
|
1610
|
+
name: M.key,
|
1611
|
+
};
|
1599
1612
|
}
|
1600
1613
|
var kind;
|
1601
1614
|
var string_or_num = typeof M.key === "string" || typeof M.key === "number";
|
package/lib/parse.js
CHANGED
@@ -698,7 +698,7 @@ function tokenizer($TEXT, filename, html5_comments, shebang) {
|
|
698
698
|
} else if (ch == "$" && peek() == "{") {
|
699
699
|
next(true, true);
|
700
700
|
S.brace_counter++;
|
701
|
-
tok = token(begin ? "template_head" : "
|
701
|
+
tok = token(begin ? "template_head" : "template_cont", content);
|
702
702
|
TEMPLATE_RAWS.set(tok, raw);
|
703
703
|
tok.template_end = false;
|
704
704
|
return tok;
|
@@ -715,7 +715,7 @@ function tokenizer($TEXT, filename, html5_comments, shebang) {
|
|
715
715
|
content += ch;
|
716
716
|
}
|
717
717
|
S.template_braces.pop();
|
718
|
-
tok = token(begin ? "template_head" : "
|
718
|
+
tok = token(begin ? "template_head" : "template_cont", content);
|
719
719
|
TEMPLATE_RAWS.set(tok, raw);
|
720
720
|
tok.template_end = true;
|
721
721
|
return tok;
|
@@ -1540,14 +1540,9 @@ function parse($TEXT, options) {
|
|
1540
1540
|
|
1541
1541
|
var body = _function_body(is("punc", "{"), false, is_async);
|
1542
1542
|
|
1543
|
-
var end =
|
1544
|
-
body instanceof Array && body.length ? body[body.length - 1].end :
|
1545
|
-
body instanceof Array ? start :
|
1546
|
-
body.end;
|
1547
|
-
|
1548
1543
|
return new AST_Arrow({
|
1549
1544
|
start : start,
|
1550
|
-
end : end,
|
1545
|
+
end : body.end,
|
1551
1546
|
async : is_async,
|
1552
1547
|
argnames : argnames,
|
1553
1548
|
body : body
|
@@ -1966,11 +1961,6 @@ function parse($TEXT, options) {
|
|
1966
1961
|
}
|
1967
1962
|
|
1968
1963
|
function _yield_expression() {
|
1969
|
-
// Previous token must be keyword yield and not be interpret as an identifier
|
1970
|
-
if (!is_in_generator()) {
|
1971
|
-
croak("Unexpected yield expression outside generator function",
|
1972
|
-
S.prev.line, S.prev.col, S.prev.pos);
|
1973
|
-
}
|
1974
1964
|
var start = S.token;
|
1975
1965
|
var star = false;
|
1976
1966
|
var has_expression = true;
|
@@ -1985,10 +1975,12 @@ function parse($TEXT, options) {
|
|
1985
1975
|
// Note 1: It isn't allowed for yield* to close without an expression
|
1986
1976
|
// Note 2: If there is a nlb between yield and star, it is interpret as
|
1987
1977
|
// yield <explicit undefined> <inserted automatic semicolon> *
|
1988
|
-
if (
|
1989
|
-
(
|
1978
|
+
if (
|
1979
|
+
can_insert_semicolon()
|
1980
|
+
|| is("punc") && PUNC_AFTER_EXPRESSION.has(S.token.value)
|
1981
|
+
|| is("template_cont")
|
1982
|
+
) {
|
1990
1983
|
has_expression = false;
|
1991
|
-
|
1992
1984
|
} else if (is("operator", "*")) {
|
1993
1985
|
star = true;
|
1994
1986
|
next();
|
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.
|
7
|
+
"version": "5.40.0",
|
8
8
|
"engines": {
|
9
9
|
"node": ">=10"
|
10
10
|
},
|
@@ -45,7 +45,7 @@
|
|
45
45
|
],
|
46
46
|
"dependencies": {
|
47
47
|
"@jridgewell/source-map": "^0.3.3",
|
48
|
-
"acorn": "^8.
|
48
|
+
"acorn": "^8.14.0",
|
49
49
|
"commander": "^2.20.0",
|
50
50
|
"source-map-support": "~0.5.20"
|
51
51
|
},
|