Commit Graph

1421 Commits

Author SHA1 Message Date
SWC Bot
b9acc83fa7 chore: Publish crates 2023-06-16 02:59:35 +00:00
SWC Bot
39276402bf chore: Publish crates 2023-06-14 05:01:49 +00:00
SWC Bot
db85bf3ee2 chore: Publish crates 2023-06-13 16:14:41 +00:00
SWC Bot
275db1baec chore: Publish crates 2023-06-13 03:39:28 +00:00
SWC Bot
08574e690b chore: Publish crates 2023-06-12 08:04:50 +00:00
SWC Bot
96895b1f3f chore: Publish crates 2023-06-12 06:49:35 +00:00
Donny/강동윤
aa83584634
refactor(es/ast): Reimplement optional chaining (#7441)
**Related issue:**

 - Closes #7003.
 - Closes #7156.
2023-06-12 06:47:40 +00:00
SWC Bot
d8f5158963 chore: Publish crates 2023-06-12 02:24:36 +00:00
SWC Bot
cea1237c5e chore: Publish crates 2023-06-12 01:39:32 +00:00
SWC Bot
b46bcf3f50 chore: Publish crates 2023-06-08 05:08:56 +00:00
SWC Bot
37634a758d chore: Publish crates 2023-06-08 04:15:29 +00:00
Austaras
7f9f0b8bce
fix(es/minifier): Infect mutation when assigning a property (#7503) 2023-06-08 04:13:42 +00:00
SWC Bot
89bee900e4 chore: Publish crates 2023-06-07 05:10:31 +00:00
David Sherret
064bcf4854
fix(es/codegen): Remove extra spaces in AssignPatProp and KeyValuePatProp (#7488)
Co-authored-by: Donny/강동윤 <kdy1997.dev@gmail.com>
2023-06-07 05:08:35 +00:00
SWC Bot
f634c3ad2f chore: Publish crates 2023-06-07 04:25:48 +00:00
Austaras
62075faeaa
feat(es/minifier): Remove unused labels (#7478) 2023-06-07 04:23:40 +00:00
SWC Bot
b6b4b0fd2e chore: Publish crates 2023-06-07 03:03:16 +00:00
SWC Bot
61dc611da3 chore: Publish crates 2023-06-05 04:47:07 +00:00
SWC Bot
9de08611e1 chore: Publish crates 2023-06-02 15:24:25 +00:00
Donny/강동윤
65ce5d1081
perf(es/minifier): Make minifier not overly generic (#7483)
**Description:**

Generics cause binary bloat.

**Related issue:**

 - https://github.com/vercel/next.js/pull/50365
2023-06-03 00:22:30 +09:00
SWC Bot
d6bbbc332d chore: Publish crates 2023-05-31 01:59:26 +00:00
Donny/강동윤
e506635f74
fix(es/minifier): Don't generate generator arrows (#7466)
**Related issue:**

 - Closes #7457.
2023-05-31 01:57:13 +00:00
SWC Bot
a63905aa2c chore: Publish crates 2023-05-30 05:18:06 +00:00
SWC Bot
076b4d4023 chore: Publish crates 2023-05-30 03:24:10 +00:00
SWC Bot
a85816d505 chore: Publish crates 2023-05-25 04:54:11 +00:00
SWC Bot
8d52500a9a chore: Publish crates 2023-05-25 04:00:53 +00:00
Austaras
0cd2b61b05
feat(es/minifier): Inline for loop variables (#7445) 2023-05-25 03:59:02 +00:00
SWC Bot
6c3ff01a53 chore: Publish crates 2023-05-24 07:48:00 +00:00
SWC Bot
c1f2b4a09f chore: Publish crates 2023-05-24 06:59:37 +00:00
SWC Bot
b95cd8444e chore: Publish crates 2023-05-24 06:27:35 +00:00
SWC Bot
f9f0cc2380 chore: Publish crates 2023-05-24 05:44:06 +00:00
SWC Bot
8872b41272 chore: Publish crates 2023-05-23 06:25:54 +00:00
SWC Bot
47114702ef chore: Publish crates 2023-05-23 05:30:42 +00:00
SWC Bot
12b966ea21 chore: Publish crates 2023-05-22 03:23:50 +00:00
SWC Bot
b2c9bb47a0 chore: Publish crates 2023-05-19 04:37:45 +00:00
Austaras
40d2bf7ec3
fix(es/minifier): Prevent inlining vars assigned outside current function scope (#7414)
**Related issue:**

 - Closes #7412.
2023-05-19 13:35:50 +09:00
SWC Bot
135c4fd16b chore: Publish crates 2023-05-18 08:20:26 +00:00
SWC Bot
31d7b88555 chore: Publish crates 2023-05-18 01:21:08 +00:00
Austaras
5dbbbea2ef
fix(es/minifier): Mark all function params as potential property mutation (#7409)
**Description:**

This issue is more severe than I originally thought. It raises not in
array indexing, but in function calls and property mutation. We should
treat all function arguments as potentially be property mutated,
otherwise following example

```js
class A {
	a = 1

	toString() {
		return this.a
	}
}

const a = new A()

function foo(x) {
	x.a++
}

const b = a + 1

foo(a)

console.log(b)
```

would be error(It should log 2, but logs 3 after compress).

As the result, massive regressions is unavoidable, since some of these
optimizations may indeed cause error. Part of them can be mitigated with
following optimization -- allow inline of ident even if its original
value is mutated. Consider

```js
export function foo(x) {
   const y = x
   x.a = 1
   y.b = 2
}
```

If x is a primitive value, all mutations to its properties are ignored;
if x is a object, then y refers to the same object no matter what
mutation is performed.

And there's still room for more, currently following code
```js
export function foo(x) {
    const y = Math.floor(x);
    g(y);
}
```
But I'd rather do it in a separate PR.


**Related issue:**

 - Closes #7402.
2023-05-18 01:19:17 +00:00
SWC Bot
a2a544a0ae chore: Publish crates 2023-05-17 13:12:20 +00:00
SWC Bot
8052d4dabd chore: Publish crates 2023-05-17 04:53:45 +00:00
SWC Bot
da0c612d85 chore: Publish crates 2023-05-16 05:18:57 +00:00
SWC Bot
d3db7edd51 chore: Publish crates 2023-05-16 04:14:36 +00:00
Donny/강동윤
f9cdd741c2
test(es/minifier): Enable more terser tests (#7396) 2023-05-16 03:21:08 +00:00
SWC Bot
5e3d156aca chore: Publish crates 2023-05-15 03:20:03 +00:00
SWC Bot
5d30437206 chore: Publish crates 2023-05-15 02:27:59 +00:00
SWC Bot
a71d5b2180 chore: Publish crates 2023-05-14 05:23:11 +00:00
SWC Bot
e88ae37a0c chore: Publish crates 2023-05-12 00:47:49 +00:00
SWC Bot
7655aaa42a chore: Publish crates 2023-05-11 14:02:24 +00:00
SWC Bot
65785bdf21 chore: Publish crates 2023-05-10 04:19:21 +00:00
Donny/강동윤
041b491466
feat(es/parser): Implement explicit resource management (#7322)
**Description:**

 - Add `UsingDecl`.
 - Add `UsingDecl` to `Decl`.
 - Rename `VarDeclOrPat` to `ForHead`.
 - Add `UsingDecl` to `ForHead`.
 - Implement parser for using declarations.

**Related issue:**

 - #7316.
2023-05-10 04:16:44 +00:00
SWC Bot
6432e1f5c5 chore: Publish crates 2023-05-10 03:33:12 +00:00
Donny/강동윤
1dced17998
fix(es/minifier): Fix remapping of vars upon inlining (#7362)
**Related issue:**

 - Closes #7331.
2023-05-10 03:31:15 +00:00
SWC Bot
e1c9182e1c chore: Publish crates 2023-05-09 05:47:00 +00:00
SWC Bot
7fc9b00443 chore: Publish crates 2023-05-08 03:40:27 +00:00
SWC Bot
aef5ac4812 chore: Publish crates 2023-05-06 03:56:38 +00:00
SWC Bot
e9f3371c5f chore: Publish crates 2023-05-02 02:13:33 +00:00
SWC Bot
4ad18beca3 chore: Publish crates 2023-04-29 13:48:25 +00:00
SWC Bot
767284e27f chore: Publish crates 2023-04-29 13:28:01 +00:00
SWC Bot
b80ceaed03 chore: Publish crates 2023-04-29 13:21:14 +00:00
Donny/강동윤
246300ae25
feat(es/minifier): Drop expressions using sequential inliner (#6936) 2023-04-29 22:19:00 +09:00
SWC Bot
e7911ee594 chore: Publish crates 2023-04-26 01:25:19 +00:00
SWC Bot
d67f9bfd75 chore: Publish crates 2023-04-25 10:06:32 +00:00
SWC Bot
923ed13b6a chore: Publish crates 2023-04-24 09:25:42 +00:00
SWC Bot
51f3840609 chore: Publish crates 2023-04-24 05:25:39 +00:00
SWC Bot
5400648de8 chore: Publish crates 2023-04-24 04:17:24 +00:00
SWC Bot
f2a38e808a chore: Publish crates 2023-04-21 06:13:37 +00:00
SWC Bot
c8e6774070 chore: Publish crates 2023-04-20 08:28:29 +00:00
SWC Bot
af8e158948 chore: Publish crates 2023-04-20 07:35:26 +00:00
SWC Bot
7fd1e93434 chore: Publish crates 2023-04-19 21:54:39 +00:00
SWC Bot
0e4d764f90 chore: Publish crates 2023-04-19 11:27:00 +00:00
SWC Bot
0d4fe74ab5 chore: Publish crates 2023-04-19 07:24:45 +00:00
Donny/강동윤
0aab90c005
fix(es/minifier): Fix a inliner bug related to Script (#7288)
**Related issue:**

 - Closes https://github.com/swc-project/swc/issues/7287.
2023-04-19 07:22:48 +00:00
SWC Bot
1c530b8919 chore: Publish crates 2023-04-18 02:46:59 +00:00
SWC Bot
f7355420dd chore: Publish crates 2023-04-15 14:52:40 +00:00
Donny/강동윤
4c06a56e52
fix(es/minifier): Use UTF16 length for str.length (#7275)
**Related issue:**

 - Closes #7274.
2023-04-15 14:50:52 +00:00
SWC Bot
d90d14fc23 chore: Publish crates 2023-04-15 13:58:51 +00:00
SWC Bot
9e752bd1aa chore: Publish crates 2023-04-15 04:21:44 +00:00
Austaras
93a264c9a4
fix(es/renamer): Ensure that param and function body are in same scope (#7271)
**Description:**

The problem arises in L235 of swc_ecma_transforms_base/src/rename/mod.rs

```rs
unit!(visit_mut_fn_decl, FnDecl, true);
```

which calls `get_map` and evals to

```rs
node.visit_children_with(&mut v);
```

with `FnDecl` and `Analyzer` in L132. However, in `Analyzer`, a visit to raw function was not overloaded, so function arguments and function body are considered different scopes.

**Related issue:**

 - Closes #7261.
2023-04-15 04:19:52 +00:00
SWC Bot
42c4b07f34 chore: Publish crates 2023-04-15 03:29:04 +00:00
SWC Bot
db9320c051 chore: Publish crates 2023-04-15 02:19:38 +00:00
SWC Bot
5f0660667f chore: Publish crates 2023-04-14 23:50:14 +00:00
SWC Bot
e6cffb7581 chore: Publish crates 2023-04-13 08:41:47 +00:00
SWC Bot
8fc527343b chore: Publish crates 2023-04-13 05:52:04 +00:00
SWC Bot
604667d522 chore: Publish crates 2023-04-13 03:25:23 +00:00
Donny/강동윤
a44fea1ec8
fix(es/minifier): Fix handling of optional chaining when hoist_props is enabled (#7246)
**Related issue:**

 - Closes https://github.com/swc-project/swc/issues/7228.
2023-04-13 03:23:29 +00:00
SWC Bot
8e5cb60183 chore: Publish crates 2023-04-12 12:33:03 +00:00
SWC Bot
d4782ee526 chore: Publish crates 2023-04-12 11:46:53 +00:00
SWC Bot
f31f67c7fb chore: Publish crates 2023-04-11 07:05:27 +00:00
SWC Bot
33ff2ba7c4 chore: Publish crates 2023-04-11 04:50:23 +00:00
Donny/강동윤
559d1202bc
feat(es/minifier): Support PURE comment of seq exprs (#7245)
**Related issue:**

 - Closes https://github.com/swc-project/swc/issues/7241.
2023-04-11 04:48:11 +00:00
SWC Bot
80e125a386 chore: Publish crates 2023-04-11 02:13:17 +00:00
SWC Bot
2a662350e6 chore: Publish crates 2023-04-10 10:47:52 +00:00
SWC Bot
ab9e793fa8 chore: Publish crates 2023-04-10 08:48:13 +00:00
SWC Bot
2204b7809b chore: Publish crates 2023-04-10 03:42:39 +00:00
SWC Bot
bb80c659b3 chore: Publish crates 2023-04-07 01:46:34 +00:00
SWC Bot
4b9cfbb4dd chore: Publish crates 2023-04-06 13:48:37 +00:00
SWC Bot
150e54dc3a chore: Publish crates 2023-04-06 08:56:53 +00:00
SWC Bot
c6b28f91cc chore: Publish crates 2023-04-05 05:17:51 +00:00
SWC Bot
a22a8a70ed chore: Publish crates 2023-04-05 04:37:50 +00:00