terser 5.19.1 → 5.19.2
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 +3 -0
- package/dist/bundle.min.js +4 -20
- package/lib/output.js +4 -20
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/bundle.min.js
CHANGED
@@ -8954,18 +8954,6 @@ class Rope {
|
|
8954
8954
|
this.current += str;
|
8955
8955
|
}
|
8956
8956
|
|
8957
|
-
endsWith(str) {
|
8958
|
-
const { committed, current } = this;
|
8959
|
-
const len = str.length;
|
8960
|
-
if (committed.length >= len) {
|
8961
|
-
return committed.slice(committed.length - str.length) === str;
|
8962
|
-
} else {
|
8963
|
-
// `str` is small and this is a rare case so keep it simple
|
8964
|
-
const last_bit = committed.slice(-len) + current;
|
8965
|
-
return last_bit.endsWith(str);
|
8966
|
-
}
|
8967
|
-
}
|
8968
|
-
|
8969
8957
|
insertAt(char, index) {
|
8970
8958
|
const { committed, current } = this;
|
8971
8959
|
if (index < committed.length) {
|
@@ -9347,10 +9335,6 @@ function OutputStream(options) {
|
|
9347
9335
|
might_need_semicolon = true;
|
9348
9336
|
};
|
9349
9337
|
|
9350
|
-
function ends_with(str) {
|
9351
|
-
return OUTPUT.endsWith(str);
|
9352
|
-
}
|
9353
|
-
|
9354
9338
|
function force_semicolon() {
|
9355
9339
|
might_need_semicolon = false;
|
9356
9340
|
print(";");
|
@@ -9620,7 +9604,6 @@ function OutputStream(options) {
|
|
9620
9604
|
comma : comma,
|
9621
9605
|
colon : colon,
|
9622
9606
|
last : function() { return last; },
|
9623
|
-
ends_with : ends_with,
|
9624
9607
|
semicolon : semicolon,
|
9625
9608
|
force_semicolon : force_semicolon,
|
9626
9609
|
to_utf8 : to_utf8,
|
@@ -10744,7 +10727,8 @@ function OutputStream(options) {
|
|
10744
10727
|
});
|
10745
10728
|
DEFPRINT(AST_UnaryPrefix, function(self, output) {
|
10746
10729
|
var op = self.operator;
|
10747
|
-
if (op === "--" && output.
|
10730
|
+
if (op === "--" && output.last().endsWith("!")) {
|
10731
|
+
// avoid printing "<!--"
|
10748
10732
|
output.print(" ");
|
10749
10733
|
}
|
10750
10734
|
output.print(op);
|
@@ -10764,7 +10748,7 @@ function OutputStream(options) {
|
|
10764
10748
|
var op = self.operator;
|
10765
10749
|
self.left.print(output);
|
10766
10750
|
if (op[0] == ">" /* ">>" ">>>" ">" ">=" */
|
10767
|
-
&& output.
|
10751
|
+
&& output.last().endsWith("--")) {
|
10768
10752
|
// space is mandatory to avoid outputting -->
|
10769
10753
|
output.print(" ");
|
10770
10754
|
} else {
|
@@ -11083,7 +11067,7 @@ function OutputStream(options) {
|
|
11083
11067
|
|
11084
11068
|
// Avoid outputting end of script tag
|
11085
11069
|
source = source.replace(r_slash_script, slash_script_replace);
|
11086
|
-
if (r_starts_with_script.test(source) && output.
|
11070
|
+
if (r_starts_with_script.test(source) && output.last().endsWith("<")) {
|
11087
11071
|
output.print(" ");
|
11088
11072
|
}
|
11089
11073
|
|
package/lib/output.js
CHANGED
@@ -190,18 +190,6 @@ class Rope {
|
|
190
190
|
this.current += str;
|
191
191
|
}
|
192
192
|
|
193
|
-
endsWith(str) {
|
194
|
-
const { committed, current } = this;
|
195
|
-
const len = str.length;
|
196
|
-
if (committed.length >= len) {
|
197
|
-
return committed.slice(committed.length - str.length) === str;
|
198
|
-
} else {
|
199
|
-
// `str` is small and this is a rare case so keep it simple
|
200
|
-
const last_bit = committed.slice(-len) + current;
|
201
|
-
return last_bit.endsWith(str);
|
202
|
-
}
|
203
|
-
}
|
204
|
-
|
205
193
|
insertAt(char, index) {
|
206
194
|
const { committed, current } = this;
|
207
195
|
if (index < committed.length) {
|
@@ -583,10 +571,6 @@ function OutputStream(options) {
|
|
583
571
|
might_need_semicolon = true;
|
584
572
|
};
|
585
573
|
|
586
|
-
function ends_with(str) {
|
587
|
-
return OUTPUT.endsWith(str);
|
588
|
-
}
|
589
|
-
|
590
574
|
function force_semicolon() {
|
591
575
|
might_need_semicolon = false;
|
592
576
|
print(";");
|
@@ -856,7 +840,6 @@ function OutputStream(options) {
|
|
856
840
|
comma : comma,
|
857
841
|
colon : colon,
|
858
842
|
last : function() { return last; },
|
859
|
-
ends_with : ends_with,
|
860
843
|
semicolon : semicolon,
|
861
844
|
force_semicolon : force_semicolon,
|
862
845
|
to_utf8 : to_utf8,
|
@@ -1980,7 +1963,8 @@ function OutputStream(options) {
|
|
1980
1963
|
});
|
1981
1964
|
DEFPRINT(AST_UnaryPrefix, function(self, output) {
|
1982
1965
|
var op = self.operator;
|
1983
|
-
if (op === "--" && output.
|
1966
|
+
if (op === "--" && output.last().endsWith("!")) {
|
1967
|
+
// avoid printing "<!--"
|
1984
1968
|
output.print(" ");
|
1985
1969
|
}
|
1986
1970
|
output.print(op);
|
@@ -2000,7 +1984,7 @@ function OutputStream(options) {
|
|
2000
1984
|
var op = self.operator;
|
2001
1985
|
self.left.print(output);
|
2002
1986
|
if (op[0] == ">" /* ">>" ">>>" ">" ">=" */
|
2003
|
-
&& output.
|
1987
|
+
&& output.last().endsWith("--")) {
|
2004
1988
|
// space is mandatory to avoid outputting -->
|
2005
1989
|
output.print(" ");
|
2006
1990
|
} else {
|
@@ -2319,7 +2303,7 @@ function OutputStream(options) {
|
|
2319
2303
|
|
2320
2304
|
// Avoid outputting end of script tag
|
2321
2305
|
source = source.replace(r_slash_script, slash_script_replace);
|
2322
|
-
if (r_starts_with_script.test(source) && output.
|
2306
|
+
if (r_starts_with_script.test(source) && output.last().endsWith("<")) {
|
2323
2307
|
output.print(" ");
|
2324
2308
|
}
|
2325
2309
|
|