Commit Graph

1861 Commits

Author SHA1 Message Date
SWC Bot
f8a33e3800 chore: Bump crates 2024-07-02 01:17:55 +00:00
Levi
570c47a9ac
feat(es/minifier): Handle more indexing expression (#8750)
**Related issue:**

 - Closes #8747
2024-07-02 10:15:45 +09:00
강동윤 (Donny)
47a79485d9 chore: Revert bump crates
This reverts commit 97b92aa6ff.
2024-06-29 18:28:54 +09:00
SWC Bot
97b92aa6ff chore: Bump crates 2024-06-29 09:26:51 +00:00
강동윤 (Donny)
56f03675bc chore: Publish crates for EsSyntax fix
Some checks are pending
CI / Test with @swc/cli (push) Waiting to run
CI / Miri (better_scoped_tls) (push) Waiting to run
CI / Miri (string_enum) (push) Waiting to run
CI / Miri (swc) (push) Waiting to run
CI / Miri (swc_bundler) (push) Waiting to run
CI / Miri (swc_ecma_codegen) (push) Waiting to run
CI / Miri (swc_ecma_minifier) (push) Waiting to run
CI / Done (push) Blocked by required conditions
Benchmark / List crates (push) Waiting to run
Benchmark / Bench ${{ matrix.crate }} (push) Blocked by required conditions
Benchmark / Process result (push) Blocked by required conditions
Bot / Start (push) Waiting to run
Publish (core) / stable - ${{ matrix.settings.target }} - node@20 (map[build:cargo build --manifest-path ../../bindings/swc_cli/Cargo.toml --release --features plugin --target x86_64-apple-darwin cp ../../bindings/target/x86_64-apple-darwin/release/swc . chmod +x ./swc… (push) Waiting to run
Publish (core) / stable - ${{ matrix.settings.target }} - node@20 (map[build:export CARGO_PROFILE_RELEASE_LTO=false yarn build --target x86_64-pc-windows-msvc cargo build --manifest-path ../../bindings/swc_cli/Cargo.toml --release --features plugin --target x86_64-pc-w… (push) Waiting to run
Publish (core) / stable - ${{ matrix.settings.target }} - node@20 (map[build:export DISABLE_PLUGIN_E2E_TESTS=true export CARGO_PROFILE_RELEASE_CODEGEN_UNITS=256 export CARGO_PROFILE_RELEASE_LTO=false cargo build --manifest-path ../../bindings/swc_cli/Cargo.toml --relea… (push) Waiting to run
Publish (core) / stable - ${{ matrix.settings.target }} - node@20 (map[build:export DISABLE_PLUGIN_E2E_TESTS=true export CARGO_PROFILE_RELEASE_LTO=false cargo build --manifest-path ../../bindings/swc_cli/Cargo.toml --release --target i686-pc-windows-msvc cp ../../bindi… (push) Waiting to run
Publish (core) / stable - ${{ matrix.settings.target }} - node@20 (map[build:export DISABLE_PLUGIN_E2E_TESTS=true yarn napi build --bin swc --release --target armv7-unknown-linux-gnueabihf --manifest-path ../../bindings/swc_cli/Cargo.toml -x --target-dir ../release -o … (push) Waiting to run
Publish (core) / stable - ${{ matrix.settings.target }} - node@20 (map[build:export JEMALLOC_SYS_WITH_LG_PAGE=16 && rustup toolchain install $(cat ../../rust-toolchain) && rustup target add aarch64-unknown-linux-musl && RUSTFLAGS='-C target-feature=+crt-static -C link-… (push) Waiting to run
Publish (core) / stable - ${{ matrix.settings.target }} - node@20 (map[build:set -e && export CARGO_PROFILE_RELEASE_LTO=false && RUSTFLAGS='-C target-feature=+sse2' cargo build --manifest-path ../../bindings/swc_cli/Cargo.toml --release --features plugin --target x86_6… (push) Waiting to run
Publish (core) / stable - ${{ matrix.settings.target }} - node@20 (map[build:set -e && export JEMALLOC_SYS_WITH_LG_PAGE=16 && rustup target add aarch64-unknown-linux-gnu && RUSTFLAGS='' cargo build --manifest-path ../../bindings/swc_cli/Cargo.toml --release --features … (push) Waiting to run
Publish (core) / stable - ${{ matrix.settings.target }} - node@20 (map[build:set -e && unset CC_x86_64_unknown_linux_gnu && unset CC && RUSTFLAGS='-C target-feature=+sse2' cargo build --manifest-path ../../bindings/swc_cli/Cargo.toml --release --features plugin --targe… (push) Waiting to run
Publish (core) / stable - ${{ matrix.settings.target }} - node@20 (map[build:sudo rm -Rf /Library/Developer/CommandLineTools/SDKs/*; export CC=$(xcrun -f clang); export CXX=$(xcrun -f clang++); SYSROOT=$(xcrun --sdk macosx --show-sdk-path); export CFLAGS="-isysroot $SY… (push) Waiting to run
Publish (core) / Test bindings on ${{ matrix.settings.target }} - node@${{ matrix.node }} (18, map[host:macos-latest target:x86_64-apple-darwin]) (push) Blocked by required conditions
Publish (core) / Test bindings on ${{ matrix.settings.target }} - node@${{ matrix.node }} (18, map[host:windows-latest target:x86_64-pc-windows-msvc]) (push) Blocked by required conditions
Publish (core) / Test bindings on Linux-x64-gnu - node@${{ matrix.node }} (18) (push) Blocked by required conditions
Publish (core) / Test bindings on x86_64-unknown-linux-musl - node@${{ matrix.node }} (18) (push) Blocked by required conditions
Publish (core) / Test bindings on armv7-unknown-linux-gnueabihf - node@${{ matrix.node }} (18) (push) Blocked by required conditions
Publish (core) / npm (push) Blocked by required conditions
Publish (core) / Build - wasm for node.js (push) Waiting to run
Publish (core) / Build - wasm for web (push) Waiting to run
2024-06-25 12:40:41 +09:00
Donny/강동윤
5520b236dd
refactor(es/parser): Rename EsConfig and TsConfig (#9094)
**Description:**

`EsConfig` and `TsConfig` sound like a general configuration for the whole language, while actually it's only about parsing.

To avoid a breaking change, I created type aliases that will work without changing the code, while warning the users.

**Related issue:**

 - Closes #9089.
2024-06-22 01:56:37 +09:00
SWC Bot
10eab94d81 chore: Bump crates 2024-06-14 14:47:30 +00:00
Donny/강동윤
e856478060
refactor(es/utils): Refine some APIs (#9049)
**Description:**

This PR
 - moves some APIs into `swc_ecma_ast`.
 - removes needless types.

**BREAKING CHANGE:**

 - `swc_ecma_utils::IdentExt::private` => `swc_ecma_ast::Ident::into_private`.
 - `swc_ecma_utils::IdentExt::prefix` => `swc_ecma_ast::Ident::with_prefix`.
 - `swc_ecma_utils::undefined` => `swc_ecma_ast::Expr::undefined`.
2024-06-14 21:53:16 +09:00
SWC Bot
931f752d54 chore: Bump crates 2024-06-14 05:24:10 +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
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
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
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
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
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
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
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
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
Donny/강동윤
c0dc5e44ab
test(es/minifier): Update the passing terser test list (#8984) 2024-05-27 22:45:44 +09:00
Donny/강동윤
a753c8d191
fix(es/minifier): Mark usage in TaggedTpl as ref (#8975)
**Related issue:**

 - Closes #8974
2024-05-24 05:11:00 +00:00
Donny/강동윤
2a43df4984
fix(es/minifier): Fix comparison of -0.0 and 0 (#8973)
**Related issue:**

 - Closes #8972
2024-05-24 09:16:42 +09:00
SWC Bot
ea14fc8e59 chore: Bump crates 2024-05-22 02:29:02 +00:00
Donny/강동윤
545ec51b51
fix(es/minifier): Add type check to & and | (#8965)
**Related issue:**

 - Closes #8964
2024-05-22 11:27:00 +09:00
Donny/강동윤
02729f24d8
fix(es/minifier): Abort property hoisting on eval (#8957)
**Description:**

 - Repro: https://github.com/kdy1/repro-next-46887-2


**Related issue:**

- https://github.com/vercel/next.js/issues/46887#issuecomment-2113264586
2024-05-16 11:35:45 +09:00
SWC Bot
f681924023 chore: Bump crates 2024-05-16 02:11:50 +00:00
Donny/강동윤
255485e373
fix(es/minifier): Abort array property inliner if the array is used as a ref (#8956)
**Description:**

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

**Related issue:**

 - https://github.com/vercel/next.js/issues/46887
2024-05-16 11:09:41 +09:00
Donny/강동윤
3046d71daa
fix(es/minifier): Abort seq inliner on ** (#8947)
**Related issue:**

 - Closes #8942
2024-05-13 01:11:46 +00:00
SWC Bot
8baa0e579c chore: Bump crates 2024-05-13 00:48:12 +00:00
Donny/강동윤
772c50fd76
fix(es/minifier): Fix evaluation of String.charCodeAt (#8946)
**Related issue:**

 - Closes #8943
2024-05-13 00:46:29 +00:00
Donny/강동윤
6362ff4ba8
fix(es/ast): Pin version of unicodes (#8941)
**Description:**

https://github.com/swc-project/swc/issues/8940#issuecomment-2102423586

> I found part of the problem:
> 
> U+30FB was added to `ID_Continue` from Unicode version 14 to 15, but v8 is using an older version of unicode ... which I can't find the exact version.
> 
> I spent 2 hours searching for all the missing pieces, I give up.
> 
> Let me back port unicode version 14.

**Related issue:**

 - Closes #8940
2024-05-10 11:23:52 +09:00
Austaras
5a3456c254
fix(es/minifier): Don't invoke IIFE containing reserved words (#8939)
**Description:**

`inline` and `seq inline` should apply this change too.

**Related issue:**

 - Closes #8622
2024-05-09 06:54:25 +00:00
SWC Bot
1f01cd42bd chore: Bump crates 2024-05-09 01:51:35 +00:00
Donny/강동윤
257afc92c9
fix(es/minifier): Abort inliner on mutation via property (#8938)
**Related issue:**

 - Closes #8937
2024-05-09 10:49:41 +09:00
SWC Bot
76393d9fd7 chore: Bump crates 2024-05-08 07:27:20 +00:00
Donny/강동윤
d4be383318
fix(es/minifier): Fix a bug about Tpl => Str (#8934)
**Description:**

I added the method to `swc_ecma_ast` to reuse it from plugins.

**Related issue:**

 - Closes #8931
2024-05-08 07:25:32 +00:00
Donny/강동윤
c9d72cdc6a
fix(es/minifier): Fix operand handling of ** (#8933)
**Related issue:**

 - Closes #8924
2024-05-08 01:37:57 +00:00
Austaras
8932a1b527
refactor(es/minifier): Remove unnecessary check (#8927) 2024-05-07 06:19:24 +00:00
SWC Bot
ad1cc5f972 chore: Bump crates 2024-05-07 05:28:42 +00:00
Donny/강동윤
4d4a7a9bcb
fix(es/minifier): Consider side effects of operands of binary expressions (#8929)
**Related issue:**

 - Closes #8923
2024-05-07 05:27:08 +00:00
SWC Bot
431b7306b8 chore: Bump crates 2024-05-07 03:17:29 +00:00
Donny/강동윤
aca6a77903
fix(es/minifier): Respect module: false (#8925)
**Description:**

Tests are modified because I enabled script detection for the fixture test suite.

**Related issue:**

 - Closes #8909
2024-05-07 12:15:47 +09:00
SWC Bot
9ec9459b16 chore: Bump crates 2024-04-30 07:55:10 +00:00