Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/066-js-print-arrow-directive-string.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"webpack": patch
---

Keep a parenthesized string opening an arrow body from printing as a directive.
4 changes: 2 additions & 2 deletions TESTING_DOCS.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ Directories come first, in alphabetical order, then the individual files worth t

#### `oxc/`

- **Purpose**: oxc's repository, pinned to the commit that released webpack's `oxc-minify` devDependency and read only under `crates/oxc_minifier/tests`: the source each `test…(` helper call in its Rust tests passes first, but TypeScript. Each is held to terser's bytes like the other corpora, and under the default minimizer's options every source of every corpus but test262 is also minified by `oxc-minify`: webpack's output may be no bigger than oxc's unless `OXC_SMALLER` lists why, and an oxc output that misprints is no lead.
- **Purpose**: oxc's repository, read only under `crates/oxc_minifier/tests`: the source each `test…(` helper call in its Rust tests passes first, but TypeScript. Each is held to terser's bytes like the other corpora, and under the default minimizer's options every source of every corpus but test262 is also minified by `oxc-minify`: webpack's output may be no bigger than oxc's unless `OXC_SMALLER` lists why, and an oxc output that misprints is no lead.
- **Usage**: Git submodule — initialize with `git submodule update --init --depth 1 test/external/oxc`. Test runner: `test/specCases/minify-corpora.spectest.js` (`yarn test:minify-corpora`), which also fails when the pin and the installed `oxc-minify` disagree.

#### `terser/`

- **Purpose**: terser's own repository, pinned to webpack's `terser` devDependency. Its `test/compress` cases and `test/input` files are two of the seven corpora `lib/javascript/syntax-printer.js` is held to (test262, swc's fixtures, `exec.rs` and `mangle.rs` tests, and oxc's tests are the other five): each source is minified by terser as published and by webpack's printer under several option sets, and the outputs, or the errors, must be byte-for-byte the same, but for what webpack's `correct` phase fixes. A case stating its `expect_stdout` also has each output run in terser's sandbox, which must print it — or, for `expect_stdout: true`, do whatever its input does, a throw or silence included.
- **Purpose**: terser's own repository. Its `test/compress` cases and `test/input` files are two of the seven corpora `lib/javascript/syntax-printer.js` is held to (test262, swc's fixtures, `exec.rs` and `mangle.rs` tests, and oxc's tests are the other five): each source is minified by terser as published and by webpack's printer under several option sets, and the outputs, or the errors, must be byte-for-byte the same, but for what webpack's `correct` phase fixes. A case stating its `expect_stdout` also has each output run in terser's sandbox, which must print it — or, for `expect_stdout: true`, do whatever its input does, a throw or silence included.
- **Usage**: Git submodule — initialize with `git submodule update --init --depth 1 test/external/terser`. Test runner: `test/specCases/minify-corpora.spectest.js` (`yarn test:minify-corpora`), which also fails when the pin and the installed `terser` disagree, so bumping the dependency means moving the pin with it. A new corpus is one entry in its `CORPORA` list.

### `fixtures/`
Expand Down
4 changes: 3 additions & 1 deletion lib/javascript/syntax-printer.js
Original file line number Diff line number Diff line change
Expand Up @@ -29303,7 +29303,9 @@ const createNodePrinter = (modules) => {
type === NodeType.FunctionDeclaration ||
type === NodeType.FunctionExpression ||
type === NodeType.MethodDefinition ||
type === NodeType.Property
type === NodeType.Property ||
(type === NodeType.ArrowFunctionExpression &&
A.type(A.field(0, Field.body, owner)) === NodeType.BlockStatement)
);
};

Expand Down
2 changes: 1 addition & 1 deletion test/external/html5lib-tests
2 changes: 1 addition & 1 deletion test/external/oxc
Submodule oxc updated 1334 files
2 changes: 1 addition & 1 deletion test/external/swc
Submodule swc updated 9107 files
2 changes: 1 addition & 1 deletion test/external/test262-cases
Submodule test262-cases updated 89 files
+16 −3 harness/testIntl.js
+16 −0 test/built-ins/Date/makedate-float-arithmetic.js
+39 −0 test/built-ins/Date/prototype/setDate/this-value-valid-date-arg-non-finite.js
+40 −0 test/built-ins/Date/prototype/setFullYear/this-value-valid-date-arg-non-finite.js
+45 −0 test/built-ins/Date/prototype/setHours/this-value-valid-date-arg-non-finite.js
+39 −0 test/built-ins/Date/prototype/setMilliseconds/this-value-valid-date-arg-non-finite.js
+43 −0 test/built-ins/Date/prototype/setMinutes/this-value-valid-date-arg-non-finite.js
+41 −0 test/built-ins/Date/prototype/setMonth/this-value-valid-date-arg-non-finite.js
+41 −0 test/built-ins/Date/prototype/setSeconds/this-value-valid-date-arg-non-finite.js
+32 −0 test/built-ins/Date/prototype/setTime/this-value-valid-date-arg-non-finite.js
+38 −0 test/built-ins/Date/prototype/setUTCDate/this-value-valid-date-arg-non-finite.js
+40 −0 test/built-ins/Date/prototype/setUTCFullYear/this-value-valid-date-arg-non-finite.js
+44 −0 test/built-ins/Date/prototype/setUTCHours/this-value-valid-date-arg-non-finite.js
+38 −0 test/built-ins/Date/prototype/setUTCMilliseconds/this-value-valid-date-arg-non-finite.js
+42 −0 test/built-ins/Date/prototype/setUTCMinutes/this-value-valid-date-arg-non-finite.js
+40 −0 test/built-ins/Date/prototype/setUTCMonth/this-value-valid-date-arg-non-finite.js
+40 −0 test/built-ins/Date/prototype/setUTCSeconds/this-value-valid-date-arg-non-finite.js
+8 −0 test/built-ins/Temporal/Duration/compare/relativeto-sub-minute-offset.js
+8 −0 test/built-ins/Temporal/Duration/prototype/round/relativeto-sub-minute-offset.js
+8 −0 test/built-ins/Temporal/Duration/prototype/total/relativeto-sub-minute-offset.js
+12 −1 test/built-ins/Temporal/Instant/prototype/toString/timezone-string-sub-minute-offset.js
+12 −1 test/built-ins/Temporal/Instant/prototype/toZonedDateTimeISO/timezone-string-sub-minute-offset.js
+12 −1 test/built-ins/Temporal/Now/plainDateISO/timezone-string-sub-minute-offset.js
+12 −1 test/built-ins/Temporal/Now/plainDateTimeISO/timezone-string-sub-minute-offset.js
+12 −1 test/built-ins/Temporal/Now/plainTimeISO/timezone-string-sub-minute-offset.js
+12 −1 test/built-ins/Temporal/Now/zonedDateTimeISO/timezone-string-sub-minute-offset.js
+25 −0 test/built-ins/Temporal/PlainDate/prototype/add/makedate-float-arithmetic.js
+25 −0 test/built-ins/Temporal/PlainDate/prototype/subtract/makedate-float-arithmetic.js
+12 −1 test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/timezone-string-sub-minute-offset.js
+25 −0 test/built-ins/Temporal/PlainDateTime/prototype/add/makedate-float-arithmetic.js
+25 −0 test/built-ins/Temporal/PlainDateTime/prototype/subtract/makedate-float-arithmetic.js
+31 −0 test/built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/timezone-string-sub-minute-offset.js
+26 −26 test/built-ins/Temporal/PlainMonthDay/from/iso-year-used-only-for-overflow.js
+23 −0 test/built-ins/Temporal/PlainYearMonth/prototype/add/makedate-float-arithmetic.js
+23 −0 test/built-ins/Temporal/PlainYearMonth/prototype/subtract/makedate-float-arithmetic.js
+12 −1 test/built-ins/Temporal/ZonedDateTime/compare/argument-propertybag-timezone-string-sub-minute-offset.js
+18 −12 test/built-ins/Temporal/ZonedDateTime/compare/argument-string-sub-minute-offset.js
+12 −1 test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-timezone-string-sub-minute-offset.js
+9 −2 test/built-ins/Temporal/ZonedDateTime/from/argument-string-sub-minute-offset.js
+12 −1 ...built-ins/Temporal/ZonedDateTime/prototype/equals/argument-propertybag-timezone-string-sub-minute-offset.js
+9 −2 test/built-ins/Temporal/ZonedDateTime/prototype/equals/argument-string-sub-minute-offset.js
+12 −1 .../built-ins/Temporal/ZonedDateTime/prototype/since/argument-propertybag-timezone-string-sub-minute-offset.js
+9 −2 test/built-ins/Temporal/ZonedDateTime/prototype/since/argument-string-sub-minute-offset.js
+12 −1 .../built-ins/Temporal/ZonedDateTime/prototype/until/argument-propertybag-timezone-string-sub-minute-offset.js
+9 −2 test/built-ins/Temporal/ZonedDateTime/prototype/until/argument-string-sub-minute-offset.js
+12 −1 test/built-ins/Temporal/ZonedDateTime/prototype/withTimeZone/timezone-string-sub-minute-offset.js
+24 −0 test/built-ins/Temporal/ZonedDateTime/timezone-string-sub-minute-offset.js
+14 −7 test/intl402/NumberFormat/prototype/format/format-fraction-digits.js
+18 −6 test/intl402/NumberFormat/prototype/format/format-significant-digits-rounding-magnitude.js
+42 −42 test/intl402/NumberFormat/test-option-roundingPriority-mixed-options.js
+28 −0 test/intl402/Temporal/Duration/compare/calendar-intl-objects.js
+27 −0 test/intl402/Temporal/Duration/prototype/round/calendar-intl-objects.js
+27 −0 test/intl402/Temporal/Duration/prototype/total/calendar-intl-objects.js
+25 −0 test/intl402/Temporal/PlainDate/from/calendar-intl-objects.js
+26 −0 test/intl402/Temporal/PlainDate/prototype/withCalendar/calendar-intl-objects.js
+25 −0 test/intl402/Temporal/PlainDateTime/from/calendar-intl-objects.js
+26 −0 test/intl402/Temporal/PlainDateTime/prototype/withCalendar/calendar-intl-objects.js
+25 −0 test/intl402/Temporal/PlainMonthDay/from/calendar-intl-objects.js
+25 −0 test/intl402/Temporal/PlainYearMonth/from/calendar-intl-objects.js
+25 −0 test/intl402/Temporal/ZonedDateTime/from/calendar-intl-objects.js
+26 −0 test/intl402/Temporal/ZonedDateTime/prototype/withCalendar/calendar-intl-objects.js
+0 −26 test/language/expressions/compound-assignment/S11.13.2_A7.10_T4.js
+0 −26 test/language/expressions/compound-assignment/S11.13.2_A7.11_T4.js
+0 −26 test/language/expressions/compound-assignment/S11.13.2_A7.1_T4.js
+0 −26 test/language/expressions/compound-assignment/S11.13.2_A7.2_T4.js
+0 −26 test/language/expressions/compound-assignment/S11.13.2_A7.3_T4.js
+0 −26 test/language/expressions/compound-assignment/S11.13.2_A7.4_T4.js
+0 −26 test/language/expressions/compound-assignment/S11.13.2_A7.5_T4.js
+0 −26 test/language/expressions/compound-assignment/S11.13.2_A7.6_T4.js
+0 −26 test/language/expressions/compound-assignment/S11.13.2_A7.7_T4.js
+0 −26 test/language/expressions/compound-assignment/S11.13.2_A7.8_T4.js
+0 −26 test/language/expressions/compound-assignment/S11.13.2_A7.9_T4.js
+46 −0 test/language/expressions/compound-assignment/left-hand-side-property-reference-topropertykey-once-add.js
+46 −0 test/language/expressions/compound-assignment/left-hand-side-property-reference-topropertykey-once-bitand.js
+46 −0 test/language/expressions/compound-assignment/left-hand-side-property-reference-topropertykey-once-bitor.js
+46 −0 test/language/expressions/compound-assignment/left-hand-side-property-reference-topropertykey-once-bitxor.js
+46 −0 test/language/expressions/compound-assignment/left-hand-side-property-reference-topropertykey-once-div.js
+47 −0 test/language/expressions/compound-assignment/left-hand-side-property-reference-topropertykey-once-exp.js
+46 −0 test/language/expressions/compound-assignment/left-hand-side-property-reference-topropertykey-once-lshift.js
+46 −0 test/language/expressions/compound-assignment/left-hand-side-property-reference-topropertykey-once-mod.js
+46 −0 test/language/expressions/compound-assignment/left-hand-side-property-reference-topropertykey-once-mult.js
+46 −0 test/language/expressions/compound-assignment/left-hand-side-property-reference-topropertykey-once-rshift.js
+46 −0 test/language/expressions/compound-assignment/left-hand-side-property-reference-topropertykey-once-srshift.js
+46 −0 test/language/expressions/compound-assignment/left-hand-side-property-reference-topropertykey-once-sub.js
+47 −0 test/language/expressions/logical-assignment/lgcl-and-assignment-operator-topropertykey-once.js
+47 −0 test/language/expressions/logical-assignment/lgcl-nullish-assignment-operator-topropertykey-once.js
+47 −0 test/language/expressions/logical-assignment/lgcl-or-assignment-operator-topropertykey-once.js
+6 −13 test/language/literals/regexp/S7.8.5_A1.4_T2.js
+6 −13 test/language/literals/regexp/S7.8.5_A2.4_T2.js
2 changes: 1 addition & 1 deletion test/external/wpt
Submodule wpt updated 1882 files
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
(() => {
("use strict");
return this;
})();
(async () => {
("use strict");
x = 1;
})();
(() => {
"use strict";
x = 1;
})();
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[
{
"mode": "print"
},
{
"mode": "minify"
}
]
116 changes: 70 additions & 46 deletions test/helpers/oxcSmaller.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,40 @@ const OXC_SMALLER_BY_REASON = [
"oxc minifier: peephole/replace_known_methods.rs:207",
"oxc minifier: peephole/replace_known_methods.rs:209",
"oxc minifier: peephole/replace_known_methods.rs:210",
"oxc minifier: peephole/replace_known_methods.rs:392",
"oxc minifier: peephole/replace_known_methods.rs:393",
"oxc minifier: peephole/replace_known_methods.rs:394",
"oxc minifier: peephole/replace_known_methods.rs:395",
"oxc minifier: peephole/replace_known_methods.rs:397",
"oxc minifier: peephole/replace_known_methods.rs:398",
"oxc minifier: peephole/replace_known_methods.rs:425",
"oxc minifier: peephole/replace_known_methods.rs:426",
"oxc minifier: peephole/replace_known_methods.rs:427",
"oxc minifier: peephole/replace_known_methods.rs:428",
"oxc minifier: peephole/replace_known_methods.rs:430",
"oxc minifier: peephole/replace_known_methods.rs:431",
"oxc minifier: peephole/replace_known_methods.rs:931",
"oxc minifier: peephole/replace_known_methods.rs:932",
"oxc minifier: peephole/replace_known_methods.rs:933",
"oxc minifier: peephole/replace_known_methods.rs:405",
"oxc minifier: peephole/replace_known_methods.rs:406",
"oxc minifier: peephole/replace_known_methods.rs:407",
"oxc minifier: peephole/replace_known_methods.rs:408",
"oxc minifier: peephole/replace_known_methods.rs:410",
"oxc minifier: peephole/replace_known_methods.rs:411",
"oxc minifier: peephole/replace_known_methods.rs:438",
"oxc minifier: peephole/replace_known_methods.rs:439",
"oxc minifier: peephole/replace_known_methods.rs:440",
"oxc minifier: peephole/replace_known_methods.rs:441",
"oxc minifier: peephole/replace_known_methods.rs:443",
"oxc minifier: peephole/replace_known_methods.rs:444",
"oxc minifier: peephole/replace_known_methods.rs:944",
"oxc minifier: peephole/replace_known_methods.rs:945",
"oxc minifier: peephole/replace_known_methods.rs:946",
"oxc minifier: peephole/replace_known_methods.rs:1000",
"oxc minifier: peephole/replace_known_methods.rs:1001",
"oxc minifier: peephole/replace_known_methods.rs:1002",
"oxc minifier: peephole/replace_known_methods.rs:1102",
"oxc minifier: peephole/replace_known_methods.rs:1106",
"oxc minifier: peephole/replace_known_methods.rs:231",
"oxc minifier: peephole/replace_known_methods.rs:232",
"oxc minifier: peephole/replace_known_methods.rs:233",
"oxc minifier: peephole/replace_known_methods.rs:234",
"oxc minifier: peephole/replace_known_methods.rs:235",
"oxc minifier: peephole/replace_known_methods.rs:236",
"oxc minifier: peephole/replace_known_methods.rs:949",
"oxc minifier: peephole/replace_known_methods.rs:951",
"oxc minifier: peephole/replace_known_methods.rs:955",
"oxc minifier: peephole/replace_known_methods.rs:959",
"oxc minifier: peephole/replace_known_methods.rs:961",
"oxc minifier: peephole/replace_known_methods.rs:962",
"oxc minifier: peephole/replace_known_methods.rs:963",
"oxc minifier: peephole/replace_known_methods.rs:1063",
"oxc minifier: peephole/replace_known_methods.rs:1067"
"oxc minifier: peephole/replace_known_methods.rs:970",
"oxc minifier: peephole/replace_known_methods.rs:1129"
]
],
[
Expand Down Expand Up @@ -122,22 +136,22 @@ const OXC_SMALLER_BY_REASON = [
[
"oxc knows more expressions have no side effects and drops them when their value is unused, as oxc's `ecmascript/may_have_side_effects.rs` tests show",
[
"oxc minifier: ecmascript/may_have_side_effects.rs:743",
"oxc minifier: ecmascript/may_have_side_effects.rs:1300",
"oxc minifier: ecmascript/may_have_side_effects.rs:1365",
"oxc minifier: ecmascript/may_have_side_effects.rs:783",
"oxc minifier: ecmascript/may_have_side_effects.rs:907",
"oxc minifier: ecmascript/may_have_side_effects.rs:755",
"oxc minifier: ecmascript/may_have_side_effects.rs:1312",
"oxc minifier: ecmascript/may_have_side_effects.rs:1377",
"oxc minifier: ecmascript/may_have_side_effects.rs:795",
"oxc minifier: ecmascript/may_have_side_effects.rs:919",
"oxc minifier: ecmascript/may_have_side_effects.rs:215",
"oxc minifier: ecmascript/may_have_side_effects.rs:216",
"oxc minifier: ecmascript/may_have_side_effects.rs:627",
"oxc minifier: ecmascript/may_have_side_effects.rs:636",
"oxc minifier: ecmascript/may_have_side_effects.rs:784",
"oxc minifier: ecmascript/may_have_side_effects.rs:791",
"oxc minifier: ecmascript/may_have_side_effects.rs:792",
"oxc minifier: ecmascript/may_have_side_effects.rs:1036",
"oxc minifier: ecmascript/may_have_side_effects.rs:1047",
"oxc minifier: ecmascript/may_have_side_effects.rs:1146",
"oxc minifier: ecmascript/may_have_side_effects.rs:1401",
"oxc minifier: ecmascript/may_have_side_effects.rs:796",
"oxc minifier: ecmascript/may_have_side_effects.rs:803",
"oxc minifier: ecmascript/may_have_side_effects.rs:804",
"oxc minifier: ecmascript/may_have_side_effects.rs:1048",
"oxc minifier: ecmascript/may_have_side_effects.rs:1059",
"oxc minifier: ecmascript/may_have_side_effects.rs:1158",
"oxc minifier: ecmascript/may_have_side_effects.rs:1413",
"swc minifier: fixture/issues/9460/side-effects/input.js",
"swc minifier: fixture/issues/12566/defaults/input.js",
"swc minifier: fixture/issues/12566/without-reduce-vars/input.js"
Expand All @@ -155,7 +169,6 @@ const OXC_SMALLER_BY_REASON = [
"oxc minifier: ecmascript/value_type.rs:167",
"oxc minifier: ecmascript/value_type.rs:169",
"oxc minifier: peephole/minimize_statements.rs:32",
"oxc minifier: peephole/replace_known_methods.rs:1090",
"swc exec: terser_arguments_modified",
"swc minifier: fixture/issues/10412/input.js",
"swc minifier: fixture/issues/11684/identifier-preserved/input.js",
Expand Down Expand Up @@ -598,7 +611,7 @@ const OXC_SMALLER_BY_REASON = [
"mangled-name choice: the same program with other mangled names, or one name given to other bindings",
[
"oxc minifier: peephole/dead_code_elimination.rs:917",
"oxc minifier: peephole/fold_constants.rs:1377",
"oxc minifier: peephole/fold_constants.rs:1391",
"oxc minifier: peephole/inline_single_use_variable.rs:359",
"oxc minifier: peephole/substitute_alternate_syntax.rs:1137",
"swc exec: issue_10095",
Expand Down Expand Up @@ -971,9 +984,9 @@ const OXC_SMALLER_BY_REASON = [
[
'oxc converts the operands of `Math.pow` or `"".concat` in another order, writing `a ** +b`, a template or one `concat` for a chain of them, where a getter or `valueOf` of one may see what converting the other did',
[
"oxc minifier: peephole/replace_known_methods.rs:637",
"oxc minifier: peephole/replace_known_methods.rs:638",
"oxc minifier: peephole/replace_known_methods.rs:639"
"oxc minifier: peephole/replace_known_methods.rs:650",
"oxc minifier: peephole/replace_known_methods.rs:651",
"oxc minifier: peephole/replace_known_methods.rs:652"
]
],
[
Expand All @@ -989,14 +1002,15 @@ const OXC_SMALLER_BY_REASON = [
"oxc goes further than webpack on what oxc's `peephole/fold_constants.rs` tests cover",
[
"oxc minifier: peephole/fold_constants.rs:521",
"oxc minifier: peephole/fold_constants.rs:1681",
"oxc minifier: peephole/fold_constants.rs:1689"
"oxc minifier: peephole/fold_constants.rs:1695",
"oxc minifier: peephole/fold_constants.rs:1703",
"oxc minifier: peephole/fold_constants.rs:1342"
]
],
[
"oxc's output is wrong: it writes `x -= 1` as `--x` and `x -= -1` as `++x` on a name or property that may hold a BigInt, where the input throws a TypeError and the update does not; webpack, like swc, rewrites only a name holding only numbers",
[
"oxc minifier: ecmascript/may_have_side_effects.rs:1638",
"oxc minifier: ecmascript/may_have_side_effects.rs:1650",
"oxc minifier: ecmascript/value_type.rs:192",
"oxc minifier: peephole/minimize_conditions.rs:158",
"oxc minifier: peephole/minimize_conditions.rs:163",
Expand All @@ -1010,10 +1024,10 @@ const OXC_SMALLER_BY_REASON = [
[
"oxc's output is wrong: it folds a string method otherwise than the spec, as its own tests now show: `slice` and `substring` keep a surrogate pair they split, an `undefined` end reads as 0, `indexOf` wraps a position past 2**32, and `trim` keeps U+FEFF and drops U+0085",
[
"oxc minifier: peephole/replace_known_methods.rs:449",
"oxc minifier: peephole/replace_known_methods.rs:450",
"oxc minifier: peephole/replace_known_methods.rs:451",
"oxc minifier: peephole/replace_known_methods.rs:452"
"oxc minifier: peephole/replace_known_methods.rs:462",
"oxc minifier: peephole/replace_known_methods.rs:463",
"oxc minifier: peephole/replace_known_methods.rs:464",
"oxc minifier: peephole/replace_known_methods.rs:465"
]
],
[
Expand Down Expand Up @@ -1325,8 +1339,8 @@ const OXC_SMALLER_BY_REASON = [
[
"oxc drops an unused `Symbol.for`, which webpack keeps: running it at build time would keep its key in the build's own symbol registry",
[
"oxc minifier: ecmascript/may_have_side_effects.rs:1259",
"oxc minifier: ecmascript/may_have_side_effects.rs:1404"
"oxc minifier: ecmascript/may_have_side_effects.rs:1271",
"oxc minifier: ecmascript/may_have_side_effects.rs:1416"
]
],
[
Expand Down Expand Up @@ -1463,7 +1477,7 @@ const OXC_SMALLER_BY_REASON = [
],
[
"oxc folds a `parseFloat` of more than 20 digits, which ECMAScript lets an engine round otherwise, so webpack keeps the call",
["oxc minifier: peephole/replace_known_methods.rs:790"]
["oxc minifier: peephole/replace_known_methods.rs:803"]
],
[
"oxc goes further than webpack on what terser's `issue-143` tests cover",
Expand All @@ -1487,14 +1501,24 @@ const OXC_SMALLER_BY_REASON = [
[
"oxc minifier: ecmascript/may_have_side_effects.rs:445",
"oxc minifier: ecmascript/may_have_side_effects.rs:451",
"oxc minifier: ecmascript/may_have_side_effects.rs:816",
"oxc minifier: ecmascript/may_have_side_effects.rs:828",
"oxc minifier: peephole/remove_unused_expression.rs:850",
"oxc minifier: peephole/remove_unused_expression.rs:865"
]
],
[
"oxc goes further than webpack on what oxc's `peephole/manual_pure_functions.rs` tests cover",
["oxc minifier: peephole/manual_pure_functions.rs:119"]
],
[
"oxc goes further than webpack on what swc's `fixture/issues` tests cover",
[
"swc minifier: fixture/issues/12643/input.js",
"swc minifier: fixture/issues/12643/runtime/input.js",
"swc minifier: fixture/issues/12669/class-methods/input.js",
"swc minifier: fixture/issues/12669/function-kinds/input.js",
"swc minifier: fixture/issues/12669/object-method/input.js"
]
]
];

Expand Down
2 changes: 1 addition & 1 deletion test/helpers/rivalSmallerByDesign.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const BY_DESIGN = [
"terser compress: issue-597/beautify_off_1",
"terser compress: issue-597/beautify_on_1",
"terser compress: harmony/array_literal_with_spread_3b",
"oxc minifier: peephole/replace_known_methods.rs:1082",
"oxc minifier: peephole/replace_known_methods.rs:1121",
"terser compress: collapse_vars/collapse_vars_if",
"terser compress: conditionals/equality_conditionals_false",
"terser compress: conditionals/equality_conditionals_true",
Expand Down
20 changes: 19 additions & 1 deletion test/helpers/swcSmaller.js
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,8 @@ const SWC_SMALLER_BY_REASON = [
"swc minifier: pass-1/1/input.js",
"swc minifier: pass-1/7/input.js",
"swc minifier: pass-1/8/input.js",
"swc minifier: pass-1/issue-6788/1/input.js"
"swc minifier: pass-1/issue-6788/1/input.js",
"swc minifier: pass-1/issue-6405/1/input.js"
]
],
[
Expand Down Expand Up @@ -1087,6 +1088,23 @@ const SWC_SMALLER_BY_REASON = [
[
"swc goes further than webpack on what swc's `fixture/non-finite-number-literals` tests cover",
["swc minifier: fixture/non-finite-number-literals/input.js"]
],
[
"swc goes further than webpack on what swc's `fixture/issues` tests cover",
[
"swc minifier: fixture/issues/12587/input.js",
"swc minifier: fixture/issues/12587/top-level/input.js",
"swc minifier: fixture/issues/12643/input.js",
"swc minifier: fixture/issues/12643/runtime/input.js",
"swc minifier: fixture/issues/12669/another/input.js",
"swc minifier: fixture/issues/12669/class-methods/input.js",
"swc minifier: fixture/issues/12669/constructor-default/input.js",
"swc minifier: fixture/issues/12669/destructured-array/input.js",
"swc minifier: fixture/issues/12669/destructured-object/input.js",
"swc minifier: fixture/issues/12669/object-method/input.js",
"swc minifier: fixture/issues/12669/parameter-scope/input.js",
"swc minifier: fixture/issues/12669/setter-default/input.js"
]
]
];

Expand Down
37 changes: 8 additions & 29 deletions test/specCases/minify-corpora.spectest.js
Original file line number Diff line number Diff line change
Expand Up @@ -1082,12 +1082,12 @@ const FOR_OF_SEQUENCE =
*/
const REFUSED_BY_WEBPACK = {
"oxc minifier: ecmascript/may_have_side_effects.rs:465": SUPER_OUTSIDE,
"oxc minifier: ecmascript/may_have_side_effects.rs:818": AUTO_ACCESSOR,
"oxc minifier: ecmascript/may_have_side_effects.rs:819": AUTO_ACCESSOR,
"oxc minifier: ecmascript/may_have_side_effects.rs:821": AUTO_ACCESSOR,
"oxc minifier: ecmascript/may_have_side_effects.rs:822": AUTO_ACCESSOR,
"oxc minifier: ecmascript/may_have_side_effects.rs:823": AUTO_ACCESSOR,
"oxc minifier: ecmascript/may_have_side_effects.rs:824": AUTO_ACCESSOR,
"oxc minifier: ecmascript/may_have_side_effects.rs:830": AUTO_ACCESSOR,
"oxc minifier: ecmascript/may_have_side_effects.rs:831": AUTO_ACCESSOR,
"oxc minifier: ecmascript/may_have_side_effects.rs:833": AUTO_ACCESSOR,
"oxc minifier: ecmascript/may_have_side_effects.rs:834": AUTO_ACCESSOR,
"oxc minifier: ecmascript/may_have_side_effects.rs:835": AUTO_ACCESSOR,
"oxc minifier: ecmascript/may_have_side_effects.rs:836": AUTO_ACCESSOR,
"oxc minifier: mangler/property_mangler.rs:311": AUTO_ACCESSOR,
"oxc minifier: peephole/remove_unused_declaration.rs:356": AUTO_ACCESSOR,
"oxc minifier: peephole/remove_unused_declaration.rs:357": AUTO_ACCESSOR,
Expand All @@ -1096,8 +1096,8 @@ const REFUSED_BY_WEBPACK = {
"oxc minifier: peephole/remove_unused_expression.rs:975": AUTO_ACCESSOR,
"oxc minifier: peephole/remove_unused_private_members.rs:49": AUTO_ACCESSOR,
"oxc minifier: peephole/remove_unused_private_members.rs:53": AUTO_ACCESSOR,
"oxc minifier: peephole/replace_known_methods.rs:1423": INVALID_PATTERN,
"oxc minifier: peephole/replace_known_methods.rs:1425": INVALID_PATTERN,
"oxc minifier: peephole/replace_known_methods.rs:1462": INVALID_PATTERN,
"oxc minifier: peephole/replace_known_methods.rs:1464": INVALID_PATTERN,
"oxc minifier: peephole/substitute_alternate_syntax.rs:708": AUTO_ACCESSOR,
"oxc minifier: peephole/substitute_alternate_syntax.rs:722": AUTO_ACCESSOR,
"oxc minifier: peephole/substitute_alternate_syntax.rs:734": AUTO_ACCESSOR,
Expand Down Expand Up @@ -1563,27 +1563,6 @@ describe("JavaScript minifier", () => {
expect(() => nodeSatisfies(`^${major}`)).toThrow(/Unsupported/);
});

if (part === 1 && isPresent(referenceDir)) {
it("should pin the reference's corpus to the version it is compared with", () => {
const pinned = JSON.parse(
fs.readFileSync(path.join(referenceDir, "package.json"), "utf8")
).version;
expect(pinned).toBe(require("terser/package.json").version);
});
}

if (part === 1 && isPresent(oxcTestsDir)) {
it("should pin oxc's corpus to the oxc-minify it is compared with", () => {
const pinned = JSON.parse(
fs.readFileSync(
path.join(externalDir, "oxc/napi/minify/package.json"),
"utf8"
)
).version;
expect(pinned).toBe(require("oxc-minify/package.json").version);
});
}

/**
* @param {Stdout} stdout what a source prints
* @param {string} code a program
Expand Down
Loading
Loading