Commit graph

54 commits

Author SHA1 Message Date
Boshen
14e1dacd0a
feat(minifier): reenable minifier tests (#969) 2023-10-09 11:25:29 +08:00
Boshen
55b2f031df
feat(minifier): partially re-enable minifier (#963)
closes #949
closes #950
closes #951

All minifier tests are disable from this PR.

We are going to fix the compilation errors first, then the behavioral
errors.
2023-10-08 11:06:42 +08:00
Don Isaac
027a67d94c
feat(minifier): constant addition expression folding (#882)
Fold constant addition expressions. Handles string concatenation and
addition, both with implicit casting.

For example,
```ts
let x = 1 + 1
let y = "hello " + "world"
```
now becomes
```ts
let x = 2
let y = "hello world"
```

## Extra Goodies
- test(minifier): add `test_snapshot` helper to perform snapshot tests
with `insta`
- up(hir): implement `std::ops::Add` for `NumericValue`
- up(span): impl `TryFrom<Cow<'_, &str>>` for `Atom`
2023-09-11 10:38:35 +08:00
阿良仔
e090b560be
feat(minifier): initialize conditions folding (#658)
related: #401
2023-07-30 01:02:32 +08:00
Boshen
b34ef4f07a chore: reformat 2023-07-27 13:11:46 +08:00
Matthew "strager" Glazar
ad00720d75 refactor: avoid unstable let_chains
The let_chains Rust feature is unstable, preventing Oxc from using a
stable Rust compiler. Refactor the code to avoid let_chains.
2023-07-27 09:44:57 +08:00
阿良仔
3c76cef11c
feat(minifier): fold NaN comparison (#580) 2023-07-21 11:00:21 +08:00
阿良仔
3cbec3459a
test: add tests for boolean related comparison (#563) 2023-07-17 20:55:42 +08:00
Don Isaac
2591194dba
feat(minifier): drop console statements and exprs (#552) 2023-07-16 14:41:51 +08:00
阿良仔
c09678a48f
test: add tests for null comparison (#548) 2023-07-14 23:25:25 +08:00
阿良仔
db3ef449fc
test(minifier): add tests for bigint string comparison (#541) 2023-07-13 11:44:03 +08:00
阿良仔
f0495ef924
feat(minifier): fold string number comparison (#538) 2023-07-11 21:50:51 +08:00
阿良仔
2d984f0401
feat(minifier): fold bigint number comparison (#536) 2023-07-10 23:11:28 +08:00
Don Isaac
fd899be4a9
feat(minifier): compress undefined variable declarations (#532) 2023-07-10 10:33:42 +08:00
Wenzhe Wang
a32320646d
feat(minfier): try fold and or operator (#472) 2023-06-28 14:58:55 +08:00
阿良仔
1182985bb0
feat(minifier): implement try_fold_shift (#478)
* feat: implement `try_fold_shift`

* update minsize
2023-06-27 04:44:23 +08:00
Wenzhe Wang
cb94937ba6
feat(minifier): fold string string comparison (#471) 2023-06-26 22:37:50 +08:00
阿良仔
26c3ece37c
feat: handle UnaryOpsWithBigInt (#475) 2023-06-25 22:37:36 +08:00
Wenzhe Wang
b8f5e3ad92
feat(minifier): try reduce void (#457) 2023-06-23 00:10:46 +08:00
Wenzhe Wang
a5ccc7da30
feat(minifier): port undefined_comparison1 (#458) 2023-06-20 22:25:28 +08:00
Wenzhe Wang
5d10f96051
feat(minifier): try fold unary expression (#430) 2023-06-16 00:08:14 +08:00
Carter Snook
985b8f21d9
feat: support hashbang interpreter comments (#431) 2023-06-11 23:55:58 +08:00
Boshen
5c91fd54e3
feat(minifier): print [-In] Context (#428) 2023-06-11 16:44:48 +08:00
Wenzhe Wang
7c79fbc026
feat(minifier): try fold typeof (#408) 2023-06-07 10:44:28 +08:00
Wenzhe Wang
ddc129262d
feat(minifer): minify number (#405) 2023-06-03 21:24:39 +08:00
Boshen
f8125af850 feat(minimizer): print parentheses 2023-06-01 22:45:26 +08:00
Wenzhe Wang
4109c8b8a5
feat(parser): distinguish exponential number (#399) 2023-06-01 15:15:22 +08:00
Wenzhe Wang
3792b70dbd
feat(minifier): may add space before RegExpLiteral (#397) 2023-05-29 23:11:40 +08:00
Boshen
6ffc348e34
feat(minifier): initialize constant folding (#393)
Co-authored-by: Wenzhe Wang <mysteryven@gmail.com>
2023-05-28 11:32:10 +08:00
Wenzhe Wang
a20d5b55cd
feat(minifier): may add space before binaryOperator (#380) 2023-05-27 19:18:06 +08:00
Wenzhe Wang
a0b9628177
feat(minifer): distinguish-op-lessthan (#391) 2023-05-27 17:04:54 +08:00
Wenzhe Wang
b52efcb8d6
refactor(minifer): rename commented tests too (#392) 2023-05-27 16:47:28 +08:00
Boshen
b22c62de4f
refactor(minifier): rename expect to test 2023-05-27 13:54:46 +08:00
Boshen
829f945479
chore(minifier): add a few passing tests 2023-05-27 12:27:25 +08:00
Boshen
8ea9e38ee5
feat(minifier): remove redundant curly braces from block statements (#390) 2023-05-27 10:52:15 +08:00
Boshen
db51772c8c
chore(minifier): add "undefined" tests from closure compiler 2023-05-26 12:29:18 +08:00
Boshen
c4a67b6cfb
feat(minifier): fold return undefined to return (#387) 2023-05-25 22:37:55 +08:00
Boshen
b244065954
chore(minifier): enable some tests 2023-05-24 23:23:19 +08:00
Boshen
f5b57944e2
feat(minifier): print shorter numbers (#381) 2023-05-24 22:03:50 +08:00
Boshen
6325b4f862
chore(minifier): enable a few passing tests 2023-05-23 19:28:25 +08:00
Boshen
1f96a05d47
chore(minifier): port printer test from closure compiler
closes #372
2023-05-23 14:16:28 +08:00
Boshen
1e27903243
chore(minifier): port tests from tdewolff/minify
closes #374
2023-05-23 13:37:46 +08:00
Boshen
af95d5bd0f
chore(minifier): port esbuild tests 2023-05-23 13:02:10 +08:00
Boshen
dee09da60b
feat(minifier): implement peephole reorder constant expression from closure compiler (#376) 2023-05-23 12:29:29 +08:00
Boshen
009fc5f285
feat(minifier): minify Infinity 2023-05-21 22:01:47 +08:00
Boshen
70a713126f
feat(minifier): setup minifier tests 2023-05-21 14:33:06 +08:00
Boshen
61f0483891
feat(minifier): move terser tests do its directory 2023-05-21 14:19:50 +08:00
Boshen
0607b1493f
feat(minifier): remove whitespace printing from minifier
This should make the minifier even faster.
Use the formatter for debugging instead.
2023-05-16 23:22:43 +08:00
Boshen
af95b59a0e
feat(ast): split Property into ObjectProperty and BindingProperty (#361) 2023-05-16 15:51:50 +08:00
Boshen
6e8d342403
feat(minifier): add mangle option 2023-05-13 16:03:43 +08:00