Commit Graph

6136 Commits

Author SHA1 Message Date
SWC Bot
82479ec163 chore: Bump crates 2024-06-12 05:23:40 +00:00
Donny/강동윤
675916ccbd
perf(es/minifier): Do not visit var init multiple times (#9039)
**Description:**

I mistakenly introduced a performance regression with https://github.com/swc-project/swc/pull/9032. It makes the minifier visit the initializer of variables multiple times - once while normal visiting and once in `hoist_props_of_vars`. This PR fixes it.
2024-06-12 12:24:28 +09:00
Donny/강동윤
5bffd0ff9b
perf(es/parser): Optimize lexing of template literals, again (#9037)
**Description:**

Applies same trick as #9036, but for `cooked`
2024-06-12 01:12:05 +00:00
SWC Bot
9d2e1cee0b chore: Bump crates 2024-06-12 00:44:35 +00:00
David Sherret
91e92ececa
fix(es/codegen): Emit named type in mapped types (#9038)
**Description:**

Fixes the emit of mapped types.
2024-06-12 00:42:40 +00:00
SWC Bot
ac5eb02167 chore: Bump crates 2024-06-11 12:21:40 +00:00
Donny/강동윤
6ab19a1b5f
perf(es/parser): Optimize lexing of template literals (#9036)
**Description:**

We don't need to push one char at a time.
2024-06-11 21:20:00 +09:00
SWC Bot
6400140999 chore: Bump crates 2024-06-11 11:22:41 +00:00
Donny/강동윤
cb16994a8d
fix(es/minifier): Visit RHS while hoisting properties (#9032)
**Description:**

Handles 

```js
var FRUITS = { MANGO: "mango" }, getMangoLabel = (label) => label[FRUITS.MANGO];
```

while hoisting properties. In the code above, the initializer of the second variable declarator should be visited after hoisting the first variable declarator. Otherwise `FRUITS.MANGO` cannot be handled.


**Related issue:**

 - Closes #9030
2024-06-11 20:20:39 +09:00
SWC Bot
0a7aa10706 chore: Bump crates 2024-06-11 07:15:38 +00:00
Donny/강동윤
39654bf1e7
fix(es): Make output field optional (#9033) 2024-06-11 07:14:01 +00:00
SWC Bot
b31927cb66 chore: Bump crates 2024-06-11 06:01:25 +00:00
Donny/강동윤
6669343b4a
fix(es/minifier): Fix typescript enum detection (#9031)
**Description:**

This reverts commit cc8c1550dd because it caused a regression in the next.js canary.

 - Canary version: `15.0.0-canary.12`


**Related issue:**

 - Reverts #8986
2024-06-11 14:59:42 +09:00
SWC Bot
206b1e9b02 chore: Bump crates 2024-06-10 02:31:08 +00:00
Donny/강동윤
54ac992781
feat(es/renamer): Workaround a bug of Safari (#9029)
**Related issue:**

 - Closes #9015
2024-06-10 11:29:24 +09:00
SWC Bot
98540a588b chore: Bump crates 2024-06-07 12:02:11 +00:00
Donny/강동윤
825749f440
feat(es): Integrate experimental data API (#9027) 2024-06-07 21:00:26 +09:00
SWC Bot
f1ca6a7906 chore: Bump crates 2024-06-07 07:18:53 +00:00
Donny/강동윤
cada50b017
feat(es/minifier): Support module: "unknown" (#9026)
**Related issue:**

 - Closes #8571
2024-06-07 07:17:05 +00:00
SWC Bot
81ec70419b chore: Bump crates 2024-06-05 10:39:06 +00:00
Donny/강동윤
6ce112cfeb
feat(es/transforms): Add an API for returning metadata to JS (#9022) 2024-06-05 10:37:28 +00:00
강동윤 (Donny)
2b81d72333 chore: Workaround the bug of cargo-mono 2024-06-05 15:46:04 +09:00
Donny/강동윤
6fa79be081
feat(es/transforms): Add experimental output API for transforms (#9000)
**Description:**

This interface will provide a way to emit some outputs from transforms. This data will be emitted back to the JS caller.
2024-06-05 15:38:28 +09:00
SWC Bot
668a11d50d chore: Bump crates 2024-06-05 06:32:40 +00:00
SWC Bot
03edd92dc8 chore: Bump crates 2024-06-05 06:07:36 +00:00
Donny/강동윤
555e71cfd5
fix(es/es2015): Remove needless unreachable! (#9021)
**Related issue:**

 - Closes #9020
2024-06-05 06:05:22 +00:00
SWC Bot
277843e2e9 chore: Bump crates 2024-06-04 09:53:19 +00:00
Donny/강동윤
3bf31148ba
perf(es/parser): Add feature named tracing-spans (#9019) 2024-06-04 18:51:25 +09:00
강동윤 (Donny)
2fb890cf20 chore: Publish crates 2024-06-04 09:09:39 +09:00
SWC Bot
1496ed1814 chore: Bump crates 2024-06-02 10:34:24 +00:00
Donny/강동윤
9f8e24a76c
fix(es/minifier): Fix evaluation of -0 as a string (#9011)
**Related issue:**

 - Closes #9010

---------

Co-authored-by: magic-akari <akari.ccino@gmail.com>
2024-06-02 19:32:44 +09:00
SWC Bot
1f911f9d19 chore: Bump crates 2024-06-02 03:37:22 +00:00
Donny/강동윤
2879a4d42b
fix(es/minifier): Do not index a string with a surrogate pair (#9013)
**Related issue:**

 - Closes #9008
2024-06-02 03:35:43 +00:00
SWC Bot
04c183933a chore: Bump crates 2024-06-02 03:12:32 +00:00
Donny/강동윤
8a29577cc5
fix(es/minifier): Fix comparison of -0.0 (#9012)
**Related issue:**

 - Closes #9007
2024-06-02 03:10:55 +00:00
SWC Bot
d44ec65e36 chore: Bump crates 2024-06-01 14:20:10 +00:00
Donny/강동윤
0d9ecf39c1
fix(es/resolver): Fix hoisting of const and let (#8987)
**Description:**

 - Repro: https://github.com/kdy1/repro-next-66237

**Related issue:**

 - https://github.com/vercel/next.js/issues/66237
2024-06-01 23:18:34 +09:00
SWC Bot
629d59cb18 chore: Bump crates 2024-05-31 03:15:29 +00:00
Donny/강동윤
e764ff6f64
fix(es/minifier): Preserve unused special properties (#9005)
**Related issue:**

 - https://github.com/vercel/next.js/issues/66378
2024-05-31 03:13:43 +00:00
SWC Bot
74a1fd4341 chore: Bump crates 2024-05-31 00:57:55 +00:00
Donny/강동윤
da70ebed69
feat(x): Initialize project (#8999)
**Description:**

SWC X will be a cross-module optimizer that utilizes an enormous amount of information. After merging this, I'll experiment with several approaches.
2024-05-31 00:56:21 +00:00
SWC Bot
993eccbf9c chore: Bump crates 2024-05-31 00:33:36 +00:00
Donny/강동윤
09121a61cc
fix(es/es2015): Fix injection location of this for getter/setter properties (#8993)
**Related issue:**

 - Closes #8992

---------

Co-authored-by: magic-akari <akari.ccino@gmail.com>
2024-05-31 00:32:00 +00:00
SWC Bot
b534d03591 chore: Bump crates 2024-05-30 14:02:56 +00:00
Donny/강동윤
cc8c1550dd
feat(es/minifier): Detect TypeScript enum initialization pattern (#8986)
**Description:**

We can optimize
```js
var Foo;
Foo || Foo = {};
```

This code looks strange, but 
```ts
enum Foo {
    a = 1,
    b = 2,
}
```

transpiles to

```js
var Foo;
(function(Foo) {
    Foo[Foo["a"] = 1] = "a";
    Foo[Foo["b"] = 2] = "b";
})(Foo || (Foo = {}));

```

and after minification it becomes

```js
var Foo, Foo1;
(Foo1 = Foo || (Foo = {}))[Foo1.a = 1] = "a", Foo1[Foo1.b = 2] = "b";

```
2024-05-30 14:01:07 +00:00
SWC Bot
e07be900b9 chore: Bump crates 2024-05-30 09:49:05 +00:00
SWC Bot
1267e3ecd4 chore: Bump crates 2024-05-30 06:32:29 +00:00
Donny/강동윤
a81a01f629
fix(es/jest): Handle @jest/globals (#8994)
**Description:**

- We have two `jest` pass. One in `@swc/core` (via _hidden.jest flag), and one in the plugin. This PR fixes only the core one.

However, the linked issue is wrong because the code tries to break the rules of ESM specification. So, although this PR closes the issue, the final form is not the issue the author wanted.

**Related issue:**

 - Closes https://github.com/swc-project/plugins/issues/310
2024-05-30 15:30:45 +09:00
Donny/강동윤
c0dc5e44ab
test(es/minifier): Update the passing terser test list (#8984) 2024-05-27 22:45:44 +09:00
SWC Bot
ab32e694a0 chore: Bump crates 2024-05-26 12:43:18 +00:00