Commit Graph

9796 Commits

Author SHA1 Message Date
CPunisher
7344a638b5
feat(es/minifier): Optimize switch with side effect and termination tests (#9677)
**Description:**

This is learnt from https://github.com/terser/terser/pull/1044
**Key point:** all the cases (statements) after the last side-effect and
non-terminated one are useless.

There are also some points on whether a statement is side-effect free:
- **Var declaration:** I think var declaration always contains side
effect.
- **Function declaration:** In non-strict mode, function declaration is
same as var declaration. In strict mode, function is declared in
enclosing block scope, so it's side-effect free. But there is a bad case
when we call the function before it is declared in the switch case:
```js
"use strict";
const k = (() => {
    let x = 1;
    switch (x) {
        case y():
        case x: {
            async function y() {
                console.log(123);
            }
        }
    }
    return x;
})();
```

**This is an existing bug.** I'm not sure whether we should fix it since
it is a very bad code and I also find some similar bad cases with
terser.

~I'm also not sure it's appropriate to introduce context variable
`in_strict` for `StmtExt:: may_have_side_effects`, because `in_strict`
could change from `false` to `true`. But this is a **conservative**
mistake and does not break the program. Maybe we should use visitor for
context-aware side effect checker in the future.~

**Related issue:**

 - Closes https://github.com/swc-project/swc/issues/8953
2024-10-29 10:39:05 +09:00
David Sherret
2bbd1e8485
feat(es/parser): Ability to get script's potential module errors (#9682)
**Description:**

In Deno I'm now parsing stuff as a program more often because I sometimes now need to discover if something is a script or es module by looking at the contents. A problem is that the module errors are discarded when parsing as a script, but I still might need them later if I discover the program the program should be treated as an ES module.

**BREAKING CHANGE:**

Adds a new method to the `Tokens` trait.
2024-10-29 09:50:14 +09:00
SWC Bot
97c90a1fb7 chore: Update changelog
Some checks failed
CI / Cargo fmt (push) Has been cancelled
CI / Cargo clippy (push) Has been cancelled
CI / Check license of dependencies (push) Has been cancelled
CI / Check (macos-latest) (push) Has been cancelled
CI / Check (ubuntu-latest) (push) Has been cancelled
CI / Check (windows-latest) (push) Has been cancelled
CI / Test wasm (binding_core_wasm) (push) Has been cancelled
CI / Test wasm (binding_minifier_wasm) (push) Has been cancelled
CI / Test wasm (binding_typescript_wasm) (push) Has been cancelled
CI / List crates (push) Has been cancelled
CI / Test node bindings - ${{ matrix.os }} (macos-latest) (push) Has been cancelled
CI / Test node bindings - ${{ matrix.os }} (windows-latest) (push) Has been cancelled
CI / Test with @swc/cli (push) Has been cancelled
CI / Miri (better_scoped_tls) (push) Has been cancelled
CI / Miri (string_enum) (push) Has been cancelled
CI / Miri (swc) (push) Has been cancelled
CI / Miri (swc_bundler) (push) Has been cancelled
Benchmark / Bench everything (push) Has been cancelled
Publish crates (auto) / Publish cargo crates (push) Has been cancelled
CI / Test - ${{ matrix.settings.crate }} - ${{ matrix.settings.os }} (push) Has been cancelled
CI / Done (push) Has been cancelled
2024-10-26 09:47:08 +00:00
SWC Bot
75e237b31a chore: Publish 1.7.40 with swc_core v1.0.6 2024-10-26 09:47:07 +00:00
SWC Bot
a5ea3271ee chore: Publish 1.7.40-nightly-20241026.1 with swc_core v1.0.6 2024-10-26 08:50:07 +00:00
강동윤 (Donny)
17b05f283d chore: Publish crates with swc_core v1.0.6 2024-10-26 17:33:51 +09:00
CPunisher
78500af546
fix(typescript): Check whether the method is abstract when checking is_overload (#9678)
Some checks failed
CI / Cargo fmt (push) Has been cancelled
CI / Cargo clippy (push) Has been cancelled
CI / Check license of dependencies (push) Has been cancelled
CI / Check (macos-latest) (push) Has been cancelled
CI / Check (ubuntu-latest) (push) Has been cancelled
CI / Check (windows-latest) (push) Has been cancelled
CI / Test wasm (binding_core_wasm) (push) Has been cancelled
CI / Test wasm (binding_minifier_wasm) (push) Has been cancelled
CI / Test wasm (binding_typescript_wasm) (push) Has been cancelled
CI / List crates (push) Has been cancelled
CI / Test node bindings - ${{ matrix.os }} (macos-latest) (push) Has been cancelled
CI / Test node bindings - ${{ matrix.os }} (windows-latest) (push) Has been cancelled
CI / Test with @swc/cli (push) Has been cancelled
CI / Miri (better_scoped_tls) (push) Has been cancelled
CI / Miri (string_enum) (push) Has been cancelled
CI / Miri (swc) (push) Has been cancelled
CI / Miri (swc_bundler) (push) Has been cancelled
Benchmark / Bench everything (push) Has been cancelled
Publish crates (auto) / Publish cargo crates (push) Has been cancelled
CI / Test - ${{ matrix.settings.crate }} - ${{ matrix.settings.os }} (push) Has been cancelled
CI / Done (push) Has been cancelled
**Related issue:**

 - Closes https://github.com/swc-project/swc/issues/9656
2024-10-25 12:53:48 +09:00
renovate[bot]
b8d255bf5a
chore(deps): update dependency swc-plugin-coverage-instrument to ^0.0.25 (#9676)
Some checks are pending
CI / Cargo fmt (push) Waiting to run
CI / Cargo clippy (push) Waiting to run
CI / Check license of dependencies (push) Waiting to run
CI / Check (macos-latest) (push) Waiting to run
CI / Check (ubuntu-latest) (push) Waiting to run
CI / Check (windows-latest) (push) Waiting to run
CI / Test wasm (binding_core_wasm) (push) Waiting to run
CI / Test wasm (binding_minifier_wasm) (push) Waiting to run
CI / Test wasm (binding_typescript_wasm) (push) Waiting to run
CI / List crates (push) Waiting to run
CI / Test - ${{ matrix.settings.crate }} - ${{ matrix.settings.os }} (push) Blocked by required conditions
CI / Test node bindings - ${{ matrix.os }} (macos-latest) (push) Waiting to run
CI / Test node bindings - ${{ matrix.os }} (windows-latest) (push) Waiting to run
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 / Done (push) Blocked by required conditions
Benchmark / Bench everything (push) Waiting to run
Publish crates (auto) / Publish cargo crates (push) Waiting to run
This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
|
[swc-plugin-coverage-instrument](https://redirect.github.com/kwonoj/swc-coverage-instrument)
| [`^0.0.24` ->
`^0.0.25`](https://renovatebot.com/diffs/npm/swc-plugin-coverage-instrument/0.0.24/0.0.25)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/swc-plugin-coverage-instrument/0.0.25?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/swc-plugin-coverage-instrument/0.0.25?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/swc-plugin-coverage-instrument/0.0.24/0.0.25?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/swc-plugin-coverage-instrument/0.0.24/0.0.25?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>kwonoj/swc-coverage-instrument
(swc-plugin-coverage-instrument)</summary>

###
[`v0.0.25`](https://redirect.github.com/kwonoj/swc-coverage-instrument/compare/v0.0.24...v0.0.25)

[Compare
Source](https://redirect.github.com/kwonoj/swc-coverage-instrument/compare/v0.0.24...v0.0.25)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/swc-project/swc).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC4xMjAuMSIsInVwZGF0ZWRJblZlciI6IjM4LjEyMC4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-10-24 15:11:16 +00:00
강동윤 (Donny)
dacb6cfce7 chore: Publish crates with swc_core v1.0.5 2024-10-24 23:28:24 +09:00
James Zhan
715c42c0bf
fix(bindings/node): Add VisitTsPropertySignature (#9670)
Some checks are pending
CI / Cargo fmt (push) Waiting to run
CI / Cargo clippy (push) Waiting to run
CI / Check license of dependencies (push) Waiting to run
CI / Check (macos-latest) (push) Waiting to run
CI / Check (ubuntu-latest) (push) Waiting to run
CI / Check (windows-latest) (push) Waiting to run
CI / Test wasm (binding_core_wasm) (push) Waiting to run
CI / Test wasm (binding_minifier_wasm) (push) Waiting to run
CI / Test wasm (binding_typescript_wasm) (push) Waiting to run
CI / List crates (push) Waiting to run
CI / Test - ${{ matrix.settings.crate }} - ${{ matrix.settings.os }} (push) Blocked by required conditions
CI / Test node bindings - ${{ matrix.os }} (macos-latest) (push) Waiting to run
CI / Test node bindings - ${{ matrix.os }} (windows-latest) (push) Waiting to run
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 / Done (push) Blocked by required conditions
Benchmark / Bench everything (push) Waiting to run
Publish crates (auto) / Publish cargo crates (push) Waiting to run
**Description:**

As per PR #8955

> TsPropertySignature can not have params, type params, or an initializer.

This PR cleans up these fields from ts definition and visitor
2024-10-24 16:35:35 +09:00
CamWass
ba2a942f56
fix(es/codegen): Improve EndsWithAlphaNum (#9675)
**Description:**

This PR makes EndsWithAlphaNum smarter, improving codegen of in/instanceof binary expressions, and for in/of heads. For example:

Before: 
```js
foo() in b;
```
After:
```js
foo()in b;
```

---------

Co-authored-by: Donny/강동윤 <kdy1997.dev@gmail.com>
2024-10-24 16:34:18 +09:00
LongYinan
8f45eaf837
fix(bindings): Update napi to handle string with \0 (#9665)
Some checks failed
CI / Cargo fmt (push) Has been cancelled
CI / Cargo clippy (push) Has been cancelled
CI / Check license of dependencies (push) Has been cancelled
CI / Check (macos-latest) (push) Has been cancelled
CI / Check (ubuntu-latest) (push) Has been cancelled
CI / Check (windows-latest) (push) Has been cancelled
CI / Test wasm (binding_core_wasm) (push) Has been cancelled
CI / Test wasm (binding_minifier_wasm) (push) Has been cancelled
CI / Test wasm (binding_typescript_wasm) (push) Has been cancelled
CI / List crates (push) Has been cancelled
CI / Test node bindings - ${{ matrix.os }} (macos-latest) (push) Has been cancelled
CI / Test node bindings - ${{ matrix.os }} (windows-latest) (push) Has been cancelled
CI / Test with @swc/cli (push) Has been cancelled
CI / Miri (better_scoped_tls) (push) Has been cancelled
CI / Miri (string_enum) (push) Has been cancelled
CI / Miri (swc) (push) Has been cancelled
CI / Miri (swc_bundler) (push) Has been cancelled
Benchmark / Bench everything (push) Has been cancelled
Publish crates (auto) / Publish cargo crates (push) Has been cancelled
CI / Test - ${{ matrix.settings.crate }} - ${{ matrix.settings.os }} (push) Has been cancelled
CI / Done (push) Has been cancelled
- Closes https://github.com/swc-project/swc/issues/8868
2024-10-23 10:31:28 +09:00
Donny/강동윤
602c667b9d
doc(contributing): Document changeset (#9667)
Requested from https://github.com/swc-project/swc/pull/9666#issuecomment-2428091630
2024-10-23 10:30:43 +09:00
CPunisher
aec0e402d8
chore(ci): Remove miri ci for swc_ecma_codegen and swc_ecma_minifier (#9664)
Some checks are pending
CI / Cargo fmt (push) Waiting to run
CI / Cargo clippy (push) Waiting to run
CI / Check license of dependencies (push) Waiting to run
CI / Check (macos-latest) (push) Waiting to run
CI / Check (ubuntu-latest) (push) Waiting to run
CI / Check (windows-latest) (push) Waiting to run
CI / Test wasm (binding_core_wasm) (push) Waiting to run
CI / Test wasm (binding_minifier_wasm) (push) Waiting to run
CI / Test wasm (binding_typescript_wasm) (push) Waiting to run
CI / List crates (push) Waiting to run
CI / Test - ${{ matrix.settings.crate }} - ${{ matrix.settings.os }} (push) Blocked by required conditions
CI / Test node bindings - ${{ matrix.os }} (macos-latest) (push) Waiting to run
CI / Test node bindings - ${{ matrix.os }} (windows-latest) (push) Waiting to run
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 / Done (push) Blocked by required conditions
Benchmark / Bench everything (push) Waiting to run
Publish crates (auto) / Publish cargo crates (push) Waiting to run
**Description:**


Running miri for `swc_ecma_codegen` and `swc_ecma_minifier` is too slow.
Miri on `swc_ecma_codegen` consumes up to 4 hours, and miri on
`swc_ecma_minifier` consumes up to 6 hours, which exceeded github's 6
hour limit and makes ci bound to error.

Since they do not introduce too much unsafe code, I think we'd better
remove the miri tests for them or run partial tests in a reasonable
time.
2024-10-22 14:03:20 +09:00
unbyte
87b4e10e5d
fix(es/renamer): Check preserved in normal renaming mode (#9666)
**Description:**

Check `preserved` in normal renaming mode

**Related issue:**

 - Closes https://github.com/swc-project/swc/issues/9663
2024-10-22 14:02:38 +09:00
SWC Bot
d38f9fc5f0 chore: Update changelog 2024-10-22 02:54:35 +00:00
SWC Bot
530ba3a9ab chore: Publish 1.7.39 with swc_core v1.0.4 2024-10-22 02:54:34 +00:00
SWC Bot
55e1996f89 chore: Publish 1.7.39-nightly-20241022.1 with swc_core v1.0.4
Some checks are pending
CI / Cargo fmt (push) Waiting to run
CI / Cargo clippy (push) Waiting to run
CI / Check license of dependencies (push) Waiting to run
CI / Check (macos-latest) (push) Waiting to run
CI / Check (ubuntu-latest) (push) Waiting to run
CI / Check (windows-latest) (push) Waiting to run
CI / Test wasm (binding_core_wasm) (push) Waiting to run
CI / Test wasm (binding_minifier_wasm) (push) Waiting to run
CI / Test wasm (binding_typescript_wasm) (push) Waiting to run
CI / List crates (push) Waiting to run
CI / Test - ${{ matrix.settings.crate }} - ${{ matrix.settings.os }} (push) Blocked by required conditions
CI / Test node bindings - ${{ matrix.os }} (macos-latest) (push) Waiting to run
CI / Test node bindings - ${{ matrix.os }} (windows-latest) (push) Waiting to run
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 / Bench everything (push) Waiting to run
Publish crates (auto) / Publish cargo crates (push) Waiting to run
2024-10-22 01:38:57 +00:00
강동윤 (Donny)
057dbac899 chore: Disable nest-cli of swc-ecosystem-ci 2024-10-22 10:31:04 +09:00
SWC Bot
82c6059121 chore: Publish 1.7.38-nightly-20241021.1 with swc_core v1.0.4
Some checks are pending
CI / Cargo fmt (push) Waiting to run
CI / Cargo clippy (push) Waiting to run
CI / Check license of dependencies (push) Waiting to run
CI / Check (macos-latest) (push) Waiting to run
CI / Check (ubuntu-latest) (push) Waiting to run
CI / Check (windows-latest) (push) Waiting to run
CI / Test wasm (binding_core_wasm) (push) Waiting to run
CI / Test wasm (binding_minifier_wasm) (push) Waiting to run
CI / Test wasm (binding_typescript_wasm) (push) Waiting to run
CI / List crates (push) Waiting to run
CI / Test - ${{ matrix.settings.crate }} - ${{ matrix.settings.os }} (push) Blocked by required conditions
CI / Test node bindings - ${{ matrix.os }} (macos-latest) (push) Waiting to run
CI / Test node bindings - ${{ matrix.os }} (windows-latest) (push) Waiting to run
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 / Bench everything (push) Waiting to run
Publish crates (auto) / Publish cargo crates (push) Waiting to run
2024-10-21 08:18:14 +00:00
강동윤 (Donny)
4833434525 chore: Configure run-name 2024-10-21 17:10:48 +09:00
강동윤 (Donny)
e1e3962754 chore: Disable zod of swc-ecosystem-ci 2024-10-21 17:08:29 +09:00
SWC Bot
251ed8db5b chore: Update changelog 2024-10-21 03:58:15 +00:00
SWC Bot
c9b81917c7 chore: Publish 1.7.37-nightly-20241021.1 with swc_core v1.0.4 2024-10-21 03:58:13 +00:00
SWC Bot
0708b49e70 chore: Publish crates with swc_core v1.0.4 2024-10-21 03:52:08 +00:00
CPunisher
f70b842c55
feat(es/minifier): Implement optional catch binding (#9657)
Some checks are pending
CI / Cargo fmt (push) Waiting to run
CI / Cargo clippy (push) Waiting to run
CI / Check license of dependencies (push) Waiting to run
CI / Check (macos-latest) (push) Waiting to run
CI / Check (ubuntu-latest) (push) Waiting to run
CI / Check (windows-latest) (push) Waiting to run
CI / Test wasm (binding_core_wasm) (push) Waiting to run
CI / Test wasm (binding_minifier_wasm) (push) Waiting to run
CI / Test wasm (binding_typescript_wasm) (push) Waiting to run
CI / List crates (push) Waiting to run
CI / Test - ${{ matrix.settings.crate }} - ${{ matrix.settings.os }} (push) Blocked by required conditions
CI / Test node bindings - ${{ matrix.os }} (macos-latest) (push) Waiting to run
CI / Test node bindings - ${{ matrix.os }} (windows-latest) (push) Waiting to run
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 / Bench everything (push) Waiting to run
Publish crates (auto) / Publish cargo crates (push) Waiting to run
**Description:**

I think removing `!v.declared_as_catch_param` is safe, since I can't think of a bad case:
1. for the vars in the params of catch-clause, we prevent the removal if `self.options.ecma < EsVersion::Es2019 || !self.options.unused` is not satisfied.
2. for the usages or re-declarations with the same var name in the body of catch-clause, I think it's safe to remove them.


**Related issue:**

 - Closes https://github.com/swc-project/swc/issues/8966
2024-10-20 18:42:38 +09:00
Benny Powers - עם ישראל חי!
4cbe33c32f
fix(wasm-typescript): Fix option types of functions (#9662)
**Description:**

The types for the wasm-typescript functions are incorrect due to a typo.

Without this fix:

```
Property 'TransformConfig' is missing in type '{ module: true; filename: any; sourceMap:   • 
 true; mode: "transform"; transform: { verbatimModuleSyntax: boolean; nativeClassProperties:       
 boolean; importNotUsedAsValues: string; importExportAssignConfig: string; }; }' but required in   
 type 'Options'. [2345]  
```
2024-10-20 09:41:09 +00:00
pshu
32116a0940
fix(es/compat): Add missing visit children for destructuring (#9658)
Some checks failed
CI / Cargo fmt (push) Has been cancelled
CI / Cargo clippy (push) Has been cancelled
CI / Check license of dependencies (push) Has been cancelled
CI / Check (macos-latest) (push) Has been cancelled
CI / Check (ubuntu-latest) (push) Has been cancelled
CI / Check (windows-latest) (push) Has been cancelled
CI / Test wasm (binding_core_wasm) (push) Has been cancelled
CI / Test wasm (binding_minifier_wasm) (push) Has been cancelled
CI / Test wasm (binding_typescript_wasm) (push) Has been cancelled
CI / List crates (push) Has been cancelled
CI / Test node bindings - ${{ matrix.os }} (macos-latest) (push) Has been cancelled
CI / Test node bindings - ${{ matrix.os }} (windows-latest) (push) Has been cancelled
CI / Test with @swc/cli (push) Has been cancelled
CI / Miri (better_scoped_tls) (push) Has been cancelled
CI / Miri (string_enum) (push) Has been cancelled
CI / Miri (swc) (push) Has been cancelled
CI / Miri (swc_bundler) (push) Has been cancelled
CI / Miri (swc_ecma_codegen) (push) Has been cancelled
CI / Miri (swc_ecma_minifier) (push) Has been cancelled
Benchmark / Bench everything (push) Has been cancelled
Publish crates (auto) / Publish cargo crates (push) Has been cancelled
CI / Test - ${{ matrix.settings.crate }} - ${{ matrix.settings.os }} (push) Has been cancelled
CI / Done (push) Has been cancelled
**Related issue:**

 - Closes https://github.com/swc-project/swc/discussions/9647
2024-10-19 01:28:07 +09:00
강동윤 (Donny)
9c355207d2 chore: Publish crates with swc_core v1.0.3
Some checks failed
CI / Cargo fmt (push) Has been cancelled
CI / Cargo clippy (push) Has been cancelled
CI / Check license of dependencies (push) Has been cancelled
CI / Check (macos-latest) (push) Has been cancelled
CI / Check (ubuntu-latest) (push) Has been cancelled
CI / Check (windows-latest) (push) Has been cancelled
CI / Test wasm (binding_core_wasm) (push) Has been cancelled
CI / Test wasm (binding_minifier_wasm) (push) Has been cancelled
CI / Test wasm (binding_typescript_wasm) (push) Has been cancelled
CI / List crates (push) Has been cancelled
CI / Test node bindings - ${{ matrix.os }} (macos-latest) (push) Has been cancelled
CI / Test node bindings - ${{ matrix.os }} (windows-latest) (push) Has been cancelled
CI / Test with @swc/cli (push) Has been cancelled
CI / Miri (better_scoped_tls) (push) Has been cancelled
CI / Miri (string_enum) (push) Has been cancelled
CI / Miri (swc) (push) Has been cancelled
CI / Miri (swc_bundler) (push) Has been cancelled
CI / Miri (swc_ecma_codegen) (push) Has been cancelled
CI / Miri (swc_ecma_minifier) (push) Has been cancelled
Benchmark / Bench everything (push) Has been cancelled
Publish crates (auto) / Publish cargo crates (push) Has been cancelled
CI / Test - ${{ matrix.settings.crate }} - ${{ matrix.settings.os }} (push) Has been cancelled
CI / Done (push) Has been cancelled
2024-10-17 15:30:51 +09:00
Donny/강동윤
f735108017
fix(es/proposal): Use tsc version of explicit resource management (#9585)
**Related issue:**

 - Closes https://github.com/swc-project/swc/issues/9576
2024-10-17 05:51:43 +00:00
강동윤 (Donny)
b2d40a7f93 chore: Publish crates with swc_core v1.0.2 2024-10-17 10:54:06 +09:00
강동윤 (Donny)
39e0f9c9db chore(ci): Auto-publish crates on bump 2024-10-17 10:53:50 +09:00
magic-akari
31fe3b6be1
chore(es/typescript): Improve enum comments and sourcemap (#9652) 2024-10-17 10:50:53 +09:00
magic-akari
abffc07356
fix(es/parser): Correct > and < when exit type context (#9653)
**Related issue:**

- Close https://github.com/swc-project/swc/issues/9471
2024-10-17 10:49:46 +09:00
SWC Bot
3ae87b5497 chore: Update changelog
Some checks failed
CI / Cargo fmt (push) Has been cancelled
CI / Cargo clippy (push) Has been cancelled
CI / Check license of dependencies (push) Has been cancelled
CI / Check (macos-latest) (push) Has been cancelled
CI / Check (ubuntu-latest) (push) Has been cancelled
CI / Check (windows-latest) (push) Has been cancelled
CI / Test wasm (binding_core_wasm) (push) Has been cancelled
CI / Test wasm (binding_minifier_wasm) (push) Has been cancelled
CI / Test wasm (binding_typescript_wasm) (push) Has been cancelled
CI / List crates (push) Has been cancelled
CI / Test node bindings - ${{ matrix.os }} (macos-latest) (push) Has been cancelled
CI / Test node bindings - ${{ matrix.os }} (windows-latest) (push) Has been cancelled
CI / Test with @swc/cli (push) Has been cancelled
CI / Miri (better_scoped_tls) (push) Has been cancelled
CI / Miri (string_enum) (push) Has been cancelled
CI / Miri (swc) (push) Has been cancelled
CI / Miri (swc_bundler) (push) Has been cancelled
CI / Miri (swc_ecma_codegen) (push) Has been cancelled
CI / Miri (swc_ecma_minifier) (push) Has been cancelled
Benchmark / Bench everything (push) Has been cancelled
CI / Test - ${{ matrix.settings.crate }} - ${{ matrix.settings.os }} (push) Has been cancelled
CI / Done (push) Has been cancelled
2024-10-15 15:24:00 +00:00
SWC Bot
2407b4f397 chore: Publish 1.7.36 with swc_core v1.0.1 2024-10-15 15:23:59 +00:00
SWC Bot
05232ce0a7 chore: Update changelog
Some checks are pending
CI / Cargo fmt (push) Waiting to run
CI / Cargo clippy (push) Waiting to run
CI / Check license of dependencies (push) Waiting to run
CI / Check (macos-latest) (push) Waiting to run
CI / Check (ubuntu-latest) (push) Waiting to run
CI / Check (windows-latest) (push) Waiting to run
CI / Test wasm (binding_core_wasm) (push) Waiting to run
CI / Test wasm (binding_minifier_wasm) (push) Waiting to run
CI / Test wasm (binding_typescript_wasm) (push) Waiting to run
CI / List crates (push) Waiting to run
CI / Test - ${{ matrix.settings.crate }} - ${{ matrix.settings.os }} (push) Blocked by required conditions
CI / Test node bindings - ${{ matrix.os }} (macos-latest) (push) Waiting to run
CI / Test node bindings - ${{ matrix.os }} (windows-latest) (push) Waiting to run
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 / Bench everything (push) Waiting to run
2024-10-15 14:26:16 +00:00
SWC Bot
3ea96ec968 chore: Publish 1.7.36-nightly-20241015.1 with swc_core v1.0.1 2024-10-15 14:26:15 +00:00
강동윤 (Donny)
56c4416726 chore: Publish crates with swc_core v1.0.1 2024-10-15 23:13:49 +09:00
Donny/강동윤
3d3e4340b3
feat(es): Introduce runPluginFirst for Wasm plugins (#9645)
**Related issue:**

 - Closes https://github.com/swc-project/swc/issues/9132
2024-10-15 23:13:02 +09:00
Donny/강동윤
8a19201824
fix(es): Run esnext transforms on esnext target (#9644)
**Related issue:**

 - Closes https://github.com/swc-project/swc/issues/9640
 - Closes https://github.com/swc-project/swc/issues/9641
2024-10-15 23:12:50 +09:00
Levi
88a2186ba4
feat(es/minifier): Support unary negate in cast_to_number (#9642)
Some checks are pending
CI / Cargo fmt (push) Waiting to run
CI / Cargo clippy (push) Waiting to run
CI / Check license of dependencies (push) Waiting to run
CI / Check (macos-latest) (push) Waiting to run
CI / Check (ubuntu-latest) (push) Waiting to run
CI / Check (windows-latest) (push) Waiting to run
CI / Test wasm (binding_core_wasm) (push) Waiting to run
CI / Test wasm (binding_minifier_wasm) (push) Waiting to run
CI / Test wasm (binding_typescript_wasm) (push) Waiting to run
CI / List crates (push) Waiting to run
CI / Test - ${{ matrix.settings.crate }} - ${{ matrix.settings.os }} (push) Blocked by required conditions
CI / Test node bindings - ${{ matrix.os }} (macos-latest) (push) Waiting to run
CI / Test node bindings - ${{ matrix.os }} (windows-latest) (push) Waiting to run
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 / Bench everything (push) Waiting to run
**Description:**

Adds support for `-` in `cast_to_number`. Before it only worked if `arg` is `Infinity`. Now it uses a recursive call on `arg` so it works for expressions like `-5`, `-[]` etc.

This change is important because negative number literals (e.g. `-5`) are a `UnaryExpr` with `op`=`-` & `arg`=`5`, unless you apply `expr_simplifier` pass or something else that uses it.
2024-10-15 08:00:39 +09:00
renovate[bot]
085bc191e4
chore(deps): update dependency magic-string to v0.30.12 (#9634)
Some checks are pending
CI / Cargo fmt (push) Waiting to run
CI / Cargo clippy (push) Waiting to run
CI / Check license of dependencies (push) Waiting to run
CI / Check (macos-latest) (push) Waiting to run
CI / Check (ubuntu-latest) (push) Waiting to run
CI / Check (windows-latest) (push) Waiting to run
CI / Test wasm (binding_core_wasm) (push) Waiting to run
CI / Test wasm (binding_minifier_wasm) (push) Waiting to run
CI / Test wasm (binding_typescript_wasm) (push) Waiting to run
CI / List crates (push) Waiting to run
CI / Test - ${{ matrix.settings.crate }} - ${{ matrix.settings.os }} (push) Blocked by required conditions
CI / Test node bindings - ${{ matrix.os }} (macos-latest) (push) Waiting to run
CI / Test node bindings - ${{ matrix.os }} (windows-latest) (push) Waiting to run
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 / Bench everything (push) Waiting to run
This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [magic-string](https://redirect.github.com/rich-harris/magic-string) |
[`0.30.11` ->
`0.30.12`](https://renovatebot.com/diffs/npm/magic-string/0.30.11/0.30.12)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/magic-string/0.30.12?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/magic-string/0.30.12?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/magic-string/0.30.11/0.30.12?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/magic-string/0.30.11/0.30.12?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>rich-harris/magic-string (magic-string)</summary>

###
[`v0.30.12`](https://redirect.github.com/rich-harris/magic-string/blob/HEAD/CHANGELOG.md#03012-2024-10-11)

[Compare
Source](https://redirect.github.com/rich-harris/magic-string/compare/v0.30.11...v0.30.12)

##### Performance Improvements

- skip line break mappings
([#&#8203;284](https://redirect.github.com/rich-harris/magic-string/issues/284))
([5b1ecf7](5b1ecf701f))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/swc-project/swc).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC4xMTUuMSIsInVwZGF0ZWRJblZlciI6IjM4LjExNS4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-10-14 12:01:30 +09:00
CPunisher
4436621564
fix(es/minifier): Check type of assignment target before merging assignments (#9617)
**Description:**

Collect types of vars, maybe other optimization could benefit from this:
`merged_var_type: Option<Value<Type>>`

When the variable is reassigned, the we merge the types with some simple
rules:
`None` + `None` = `None`
`None` + `Some(ty)` = `Some(ty)`
`Some(ty1)` + `Some(ty2)` if `ty1` == `ty2` = `Some(ty1)`
Otherwise = Unknown

**Related issue:**

 - Closes https://github.com/swc-project/swc/issues/8718
2024-10-14 09:55:53 +09:00
강동윤 (Donny)
30f9a70d57 chore: Publish crates with swc_core v1.0.0
Some checks failed
CI / Cargo fmt (push) Has been cancelled
CI / Cargo clippy (push) Has been cancelled
CI / Check license of dependencies (push) Has been cancelled
CI / Check (macos-latest) (push) Has been cancelled
CI / Check (ubuntu-latest) (push) Has been cancelled
CI / Check (windows-latest) (push) Has been cancelled
CI / Test wasm (binding_core_wasm) (push) Has been cancelled
CI / Test wasm (binding_minifier_wasm) (push) Has been cancelled
CI / Test wasm (binding_typescript_wasm) (push) Has been cancelled
CI / List crates (push) Has been cancelled
CI / Test node bindings - ${{ matrix.os }} (macos-latest) (push) Has been cancelled
CI / Test node bindings - ${{ matrix.os }} (windows-latest) (push) Has been cancelled
CI / Test with @swc/cli (push) Has been cancelled
CI / Miri (better_scoped_tls) (push) Has been cancelled
CI / Miri (string_enum) (push) Has been cancelled
CI / Miri (swc) (push) Has been cancelled
CI / Miri (swc_bundler) (push) Has been cancelled
CI / Miri (swc_ecma_codegen) (push) Has been cancelled
CI / Miri (swc_ecma_minifier) (push) Has been cancelled
Benchmark / Bench everything (push) Has been cancelled
CI / Test - ${{ matrix.settings.crate }} - ${{ matrix.settings.os }} (push) Has been cancelled
CI / Done (push) Has been cancelled
2024-10-12 16:20:07 +09:00
Donny/강동윤
7970d4186a
chore: Use major version for breaking changes (#9637) 2024-10-12 16:16:46 +09:00
강동윤 (Donny)
46f0116d4a chore: Publish crates with swc_core v0.109.2 2024-10-12 16:08:03 +09:00
Austaras
6f52949210
fix(es/minifier): Only merge last if return (#9633)
**Related issue:**
 - Closes https://github.com/swc-project/swc/issues/9628
2024-10-12 16:07:08 +09:00
magic-akari
f74c1f3e5a
fix(es/lints): Correct the false positive error of TS2309 (#9635)
**Related issue:**

- Closes https://github.com/swc-project/swc/issues/9632
2024-10-12 16:05:49 +09:00
Austaras
f2be26efe0
fix(es/codegen): Emit space after div if rhs has leading comment (#9631)
Some checks are pending
CI / Cargo fmt (push) Waiting to run
CI / Cargo clippy (push) Waiting to run
CI / Check license of dependencies (push) Waiting to run
CI / Check (macos-latest) (push) Waiting to run
CI / Check (ubuntu-latest) (push) Waiting to run
CI / Check (windows-latest) (push) Waiting to run
CI / Test wasm (binding_core_wasm) (push) Waiting to run
CI / Test wasm (binding_minifier_wasm) (push) Waiting to run
CI / Test wasm (binding_typescript_wasm) (push) Waiting to run
CI / List crates (push) Waiting to run
CI / Test - ${{ matrix.settings.crate }} - ${{ matrix.settings.os }} (push) Blocked by required conditions
CI / Test node bindings - ${{ matrix.os }} (macos-latest) (push) Waiting to run
CI / Test node bindings - ${{ matrix.os }} (windows-latest) (push) Waiting to run
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 / Bench everything (push) Waiting to run
**Related issue:**

 - Closes https://github.com/swc-project/swc/issues/9630
2024-10-11 15:48:14 +09:00