Commit Graph

5882 Commits

Author SHA1 Message Date
SWC Bot
5f9b7b4c8b chore: Bump crates 2024-01-25 07:20:48 +00:00
magic-akari
6a8dd8cbb3
fix(es/decorator): Skip TypeScript class method/prop declarations (#8555)
**Related issue:**

- Closes #8552
2024-01-25 07:19:20 +00:00
강동윤 (Donny)
1890e66023 chore: Publish crates 2024-01-25 14:07:30 +09:00
SWC Bot
c5053d1574 chore: Bump crates 2024-01-24 12:01:48 +00:00
Donny/강동윤
fab27dabed
fix(es/loader): Don't use browser versions for jsc.paths (#8548)
**Related issue:**

 - https://github.com/vercel/next.js/issues/56144
2024-01-24 12:00:05 +00:00
SWC Bot
994d7adcd0 chore: Bump crates 2024-01-24 09:19:54 +00:00
Donny/강동윤
ae786692a0
fix(es/codegen): Set sourceRoot of sourcemaps (#6086)
**Related issue:**

 - Closes #2362
2024-01-24 09:18:09 +00:00
Donny/강동윤
00619b1708
feat(css/parser): Implement error reporting for @value of CSS Modules (#8547) 2024-01-24 05:06:20 +00:00
SWC Bot
c3fd9d081e chore: Bump crates 2024-01-24 02:04:25 +00:00
Donny/강동윤
043ee85d08
fix(common): Fix source map generation with inputSourceMap (#8546)
**Description:**

- This PR fixes the source map generation when `inputSourceMap` is specified.
- This PR fixes `minify()` not accepting parsed source map in the option.


**Related issue:**

 - Closes #8372.
2024-01-24 02:02:45 +00:00
Donny/강동윤
aa70131c55
fix(es/minifier): Fix a bug related to inliner and the variable scoping (#8542)
**Related issue:**

 - Closes #8246
2024-01-24 01:12:02 +00:00
SWC Bot
2d15177ca9 chore: Bump crates 2024-01-23 08:38:01 +00:00
Donny/강동윤
4630426d6a
chore(common): Update sourcemap (#8544)
**Related issue:**

 - Closes #7822
2024-01-23 08:36:04 +00:00
SWC Bot
12be23cfb5 chore: Bump crates 2024-01-23 04:25:38 +00:00
Donny/강동윤
fc929e962b
fix(es/compat): Support vars from reserved_word pass (#8543)
**Related issue:**

 - Closes #8539
2024-01-23 04:23:48 +00:00
SWC Bot
ecd9403c1d chore: Bump crates 2024-01-23 03:46:27 +00:00
SWC Bot
979061f6ba chore: Bump crates 2024-01-22 13:04:29 +00:00
Fy
71930ffb56
fix(es/quote): Add support for import phase to quote macro (#8536)
**Description:**

When using quote! to generate import decl, compile error: missing field `phase` in initializer of 'swc_core::ecma::ast::Import'
2024-01-22 22:02:49 +09:00
SWC Bot
ae75dcb710 chore: Bump crates 2024-01-22 08:53:49 +00:00
Donny/강동윤
793f2651a8
feat(swc_core): Expose preset_env_base (#8537) 2024-01-22 17:51:26 +09:00
SWC Bot
990f291d43 chore: Bump crates 2024-01-21 15:30:11 +00:00
Donny/강동윤
2d8bd9ed89
fix(es/module): Fix handling of * in jsc.paths (#8535)
**Related issue:**

 - Closes #8375
2024-01-21 15:28:38 +00:00
SWC Bot
9c23f1cf38 chore: Bump crates 2024-01-21 12:37:38 +00:00
Donny/강동윤
71fb5c12a7
fix(es/module): Fix resolving of dependencies (#8533)
**Description:**

I changed the signature of `Resolve` because there was a need to pass the `value` part from `jsc.paths` to the caller.


**Related issue:**

 - Closes #8184
2024-01-21 21:35:57 +09:00
SWC Bot
6210bf19de chore: Bump crates 2024-01-21 03:08:11 +00:00
magic-akari
72048ae1ce feat(es/ast): Support import phase (#8279)
**Description:**

- https://github.com/tc39/proposal-source-phase-imports
2024-01-21 12:05:46 +09:00
Donny/강동윤
bc38ac906c fix(es/ast): Fix definition of SetterProp (#8314)
**Related issue:**

 - Closes #8157
 - Closes #8377
2024-01-21 12:05:46 +09:00
David Sherret
572bcaefc1 fix(es/ast): Add definite and is_override to AutoAccessor (#8436)
**Description:**

Adds a `definite` and `is_override` property to `AutoAccessor` as they were missing.
It also fixes codegen for `AutoAccessor` when emitting TypeScript (which is the main reason I need this PR).

**BREAKING CHANGE:**

Adds a `definite` and `is_override` property.

**Related issue:**

 - Closes #8344
2024-01-21 12:05:46 +09:00
SWC Bot
1ca0d65c29 chore: Bump crates 2024-01-21 02:34:11 +00:00
Donny/강동윤
014a6cda82
fix(common): Remove < and > from Display impl of FileName::Custom (#8530)
**Description:**

It caused a problem for next.js
2024-01-21 02:32:35 +00:00
SWC Bot
6d9939d18e chore: Bump crates 2024-01-19 15:19:51 +00:00
Donny/강동윤
5e40dc7d8c
chore(preset-env): Update browserslist-rs (#8524) 2024-01-19 15:18:08 +00:00
Donny/강동윤
974c6a0036
test(es/codegen): Add a JS test for ascii-only mode (#8519)
**Description:**

The issue was fixed by #8493, but it was not included in the latest release because of the wrong bump comment.

**Related issue:**

 - Closes #8491
2024-01-19 04:14:11 +00:00
Donny/강동윤
4b4a0a244d
test(es/module): Add a test for a fixed issue (#8521)
**Related issue:**

 - Closes #8375
2024-01-19 03:39:42 +00:00
Donny/강동윤
8fac2bb03c
test(es/minifier): Add a test for a fixed issue (#8520)
**Related issue:**

 - Closes #8407
2024-01-19 03:12:28 +00:00
Donny/강동윤
1c4eb1f54f
test(es/codegen): Add tests for @ctrl/tinycolor (#8518)
**Related issue:**

 - Closes #8475
 - #8496 (Fixed by #8510)
2024-01-19 02:46:05 +00:00
SWC Bot
e63a5c7e95 chore: Bump crates 2024-01-19 02:14:55 +00:00
Donny/강동윤
9f1ce3acd6
fix(es/codegen): Fix codegen of \\0 (#8433)
**Related issue:**

 - Closes #8431
2024-01-19 02:11:05 +00:00
SWC Bot
fefe9636f0 chore: Publish crates 2024-01-19 01:27:20 +00:00
melbourne2991
f40f59bd70
fix(es/typescript): Fix panic on invalid jsx pragma (#8513)
**Description:**

Currently a jsx pragma with an invalid js identifier (eg, with dashes: `@jsx bad-pragma` causes a panic.

This PR prevents a panic and will ignore an invalid pragma in a comment.

(There may be an argument for showing an error or warning instead, but
given a jsx pragma is still valid ES I'm not sure whether that makes
sense?)

[Original (Deno) issue
here](https://github.com/denoland/deno/issues/21927)
2024-01-19 01:25:46 +00:00
SWC Bot
3c00098dbe chore: Publish crates 2024-01-19 00:45:54 +00:00
Donny/강동윤
4946a11137
fix(es/minifier): Fix a bug in tpl string <-> string logic (#8510)
**Related issue:**

 - Closes #8496
2024-01-19 00:44:19 +00:00
SWC Bot
4520eca97a chore: Publish crates 2024-01-18 14:05:51 +00:00
Donny/강동윤
3741448b1b
chore: Update dependencies (#8514) 2024-01-18 14:04:09 +00:00
강동윤 (Donny)
585c24fc72 chore: Publish crates 2024-01-17 19:36:33 +09:00
SWC Bot
c9dfedf5ec chore: Publish crates 2024-01-17 09:01:13 +00:00
Donny/강동윤
ba753f1288
fix(plugin): Set swc_common::errors::HANDLER while invoking plugins (#8511)
**Description:**

- `swc_common::errors::handler::HANDLER` should be used, and `swc_core::plugin::errors::HANDLER` is now a simple alias.



**Related issue:**

 - Closes #8502
2024-01-17 08:59:30 +00:00
SWC Bot
0763e7e6d6 chore: Publish crates 2024-01-16 04:43:01 +00:00
Donny/강동윤
10449e08d9
fix(es): Fix plugin template & restore test! as test_inline! (#8508)
**Description:**

I made a bad decision while migrating tests in the core repository to snapshot testing. So, I'm adding the `test!` macro back with a slight renaming.

**Related issue:**

 - Closes #8504
2024-01-16 04:41:18 +00:00
SWC Bot
99d74f319f chore: Publish crates 2024-01-16 04:01:42 +00:00
magic-akari
0f94c8cf05
fix(es/systemjs): Handle top level this (#8506)
**Related issue:**

 - Closes #8505
2024-01-16 04:00:08 +00:00
강동윤 (Donny)
97266313ed chore: Publish crates 2024-01-15 12:32:43 +09:00
SWC Bot
37d36eb24b chore: Publish crates 2024-01-14 08:12:45 +00:00
Donny/강동윤
8d9bf4cfaa
fix(es/codegen): Fix codegen of a property key in ascii-only mode (#8493)
**Related issue:**

 - Closes #8491
2024-01-14 08:11:08 +00:00
SWC Bot
9cf91a375b chore: Publish crates 2024-01-09 18:56:56 +00:00
Donny/강동윤
f7c4934e59
fix(es/minifier): Correctly escape more characters (#8490)
**Related issue:**

 - Closes #8484
2024-01-09 18:55:25 +00:00
SWC Bot
a73ddc221e chore: Publish crates 2024-01-09 18:27:36 +00:00
magic-akari
52a8f05fe4
fix(es/compat): Correctly handle this in arrow function parameters (#8489)
**Related issue:**
- Closes #8488
2024-01-09 18:25:57 +00:00
SWC Bot
46cfc5e60f chore: Publish crates 2024-01-09 07:59:42 +00:00
SWC Bot
d9a79a0a39 chore: Publish crates 2024-01-04 12:28:02 +00:00
magic-akari
740e6f390a
fix(es/parser): Correctly parse the keyword (#8483)
**Related issue:**

 - Closes #8482.
2024-01-04 12:26:25 +00:00
SWC Bot
4e860c988d chore: Publish crates 2024-01-04 04:49:50 +00:00
David Sherret
e0bdc0f7c2
fix(es/codegen): Emit ? for an optional computed property (#8481)
**Description:**

Emits optional `?` for a computed property.
2024-01-04 04:48:07 +00:00
SWC Bot
8997ed1547 chore: Publish crates 2024-01-04 04:25:54 +00:00
Austaras
82bd8070cb
fix(es/resolver): Resolve top-level undefined, NaN, and Infinity correctly (#8471)
**Description:**

For following code
```js
var NaN = 1
console.log(NaN)
```
Result would be

|Envirnoment|Result|
|-|-|
|Non strict script(browser, nodejs repl)|NaN|
|Non strict script(nodejs script)|1|
|Strict script(browser, nodejs repl)|runtime error|
|Strict script(nodejs script)|1|
|ESM|1|

So SWC choose to behave like browser in script mode and confirm to esm
standard.


**Related issue:**

 - Closes #8465
2024-01-04 04:24:14 +00:00
SWC Bot
f00ff72b95 chore: Publish crates 2024-01-03 20:42:53 +00:00
Donny/강동윤
85be8a4de1
refactor(css/parser): Remove value normalization (#8434)
**Related issue :**

 - https://linear.app/vercel/issue/PACK-2154
2024-01-03 20:40:51 +00:00
SWC Bot
68b9646681 chore: Publish crates 2024-01-03 20:18:10 +00:00
Donny/강동윤
b70e96ffe9
fix(es/module): Fix resolving of .js files (#8480)
**Related issue:**

 - https://github.com/vercel/next.js/issues/56144
2024-01-03 20:15:53 +00:00
SWC Bot
229619779b chore: Publish crates 2024-01-03 07:39:06 +00:00
Marsel Shayhin
566063dca5
feat(html/parser): Allow self-closing /> on non-void HTML elements via a flag (#8460) 2024-01-03 07:37:37 +00:00
SWC Bot
f2ede40e38 chore: Publish crates 2024-01-03 06:58:23 +00:00
David Sherret
d98a28290b
fix(es/codegen): Emit implements clause with commas (#8477) 2024-01-03 06:56:46 +00:00
SWC Bot
cddb0165bb chore: Publish crates 2024-01-03 05:41:28 +00:00
David Sherret
2076ef8f35
fix(es/codegen): Emit declare keyword for class properties (#8478) 2024-01-03 14:40:01 +09:00
SWC Bot
a4e91af934 chore: Publish crates 2024-01-03 04:45:13 +00:00
David Sherret
a12eaae0e5
fix(es/codegen): Emit abstract keyword (#8479) 2024-01-03 04:43:45 +00:00
강동윤 (Donny)
f9bbd11911 chore: Publish crates 2024-01-02 15:44:51 +09:00
SWC Bot
8883fd4ffb chore: Publish crates 2024-01-02 06:01:48 +00:00
Austaras
b676e75cdd
test(es/minifier): Enable script mode for terser_exec and mangle (#8474) 2024-01-02 06:00:26 +00:00
SWC Bot
0ba043bd5f chore: Publish crates 2024-01-02 04:35:05 +00:00
Austaras
1120336f23
test(es/minifier): Enable non esm mode for tests (#8472) 2024-01-02 04:33:39 +00:00
SWC Bot
327bba294b chore: Publish crates 2024-01-02 02:38:22 +00:00
SWC Bot
98920ca78d chore: Publish crates 2024-01-02 02:10:29 +00:00
Austaras
4416077f4a
fix(es/compat): Set inserted var inside export class in destructing (#8470) 2024-01-02 02:09:13 +00:00
강동윤 (Donny)
7d4061bef4 chore: Publish crates 2023-12-31 20:57:43 +09:00
SWC Bot
e3f25c2011 chore: Publish crates 2023-12-29 12:26:47 +00:00
Luke Page
d681785b42
fix(es/minifier): Add WeakRef as a safe global reference (#8458)
**Description:**

I was trying to remove references to Weak Ref from minified code and
despite the expression not being used, it was still included.

E.g.
```
var x = WeakRef;
```
with

```
{
   "minify": true,
  "jsc": {
      "minify": {
            "compress": {
                "pure_getters": true,
                "unused": true
            },
            "mangle": true
        }
    }
}
```
outputs

```
WeakRef;
```

but when I use something on this list e.g. parseFloat, it gets cleaned
up and outputs empty string.

btw - I tried different options for pure_getters that I assumed would
allow me to say WeakRef as a getter was pure, but it had no effect.

WeakRef getter is as safe to remove as the other items on this list and
has no effect in accessing it.
2023-12-29 12:25:23 +00:00
SWC Bot
4229e7b99b chore: Publish crates 2023-12-29 08:49:51 +00:00
Ian Tan
0b188ccdff
fix(es/parser): Disallowing await as an identifier in class static block (#8450) 2023-12-29 08:48:24 +00:00
SWC Bot
3492e6f13e chore: Publish crates 2023-12-28 23:58:04 +00:00
Austaras
1e44e57a09
fix(es/renamer): Correctly check top level (#8456)
**Related issue:**

 - Closes #8451.
 - Closes #8185.
2023-12-28 23:56:38 +00:00
SWC Bot
d6dd1f9240 chore: Publish crates 2023-12-24 01:32:20 +00:00
David Sherret
0dd96f85e2
fix(es/codegen): Emit override keyword (#8449)
**Description:**

Emits the `override` keyword.
2023-12-24 10:30:46 +09:00
SWC Bot
a611932dd5 chore: Publish crates 2023-12-23 06:46:40 +00:00
Austaras
e68720a76c
fix(es): Apply paren_remover for minify (#8442)
**Related issue:**

 - Closes #8437
2023-12-23 06:45:21 +00:00
SWC Bot
4564a01927 chore: Publish crates 2023-12-23 03:41:17 +00:00
Donny/강동윤
d89b60a000
fix(css/parser): Fix parsing of hsla(var(--foo), 1) (#8443)
**Description:**

```css
.test {
    border-color: hsla(var(--ds-gray-200-value), 1);
}
```

should be compiled as

```css

.test {
    border-color: hsla(var(--ds-gray-200-value), 1);
}
```

Previously, it was

```
.test {
    border-color: hsla(var(--ds-gray-200-value),);
}

```


**Related issue:**

 - https://linear.app/vercel/issue/PACK-2175
2023-12-23 12:39:54 +09:00
SWC Bot
611d7175d4 chore: Publish crates 2023-12-22 03:27:18 +00:00
David Sherret
65dec905c0
fix(es/codegen): Fix codegen of type-only export declarations (#8447)
**Description:**

This fixes the emit for `export type { } from "..."` and `export { type A } from "..."`.
2023-12-22 12:25:52 +09:00
SWC Bot
37bb0e3bde chore: Publish crates 2023-12-21 09:19:08 +00:00
Austaras
a06d5b2341
fix(es/compat): Use correct span.lo in class transforms (#8439)
**Related issue:**

 - Closes #8435
2023-12-21 18:17:43 +09:00
강동윤 (Donny)
4983b1cef2 chore: Publish crates 2023-12-18 13:45:35 +09:00
SWC Bot
d6cd2146fa chore: Publish crates 2023-12-17 08:43:12 +00:00
Austaras
56992e3dcc
fix(es/compat): Preserve comment for arrow body (#8427)
**Related issue:**

 - Closes #8419
2023-12-17 08:41:51 +00:00
SWC Bot
45f62f7886 chore: Publish crates 2023-12-17 06:48:43 +00:00
David Sherret
7566ddf0b7
fix(es/codegen): Fix codegen of ts specific syntax in class props (#8426)
**Description:**

This fixes the codegen of private properties with `is_optional` or `definite` and class properties with `definite`.
2023-12-17 06:47:20 +00:00
SWC Bot
4bd15908c1 chore: Publish crates 2023-12-17 02:22:24 +00:00
SWC Bot
e21c0eaf5a chore: Publish crates 2023-12-13 10:43:38 +00:00
SWC Bot
dd9ed9c565 chore: Publish crates 2023-12-12 06:14:41 +00:00
Donny/강동윤
61c304fa9e
refactor(es/utils): Use exact type for factory methods (#8417)
**Description:**

This PR is extracted from #8333 because it's too large. 


**Breaking Changes**:

  - `ExprFactory::make_member()` now returns `MemberExpr` instead of `Box<Expr>`.
  - `member_expr!()` now returns `MemberExpr` instead of `Box<Expr>`.
2023-12-12 15:13:10 +09:00
SWC Bot
f736c3c2df chore: Publish crates 2023-12-12 05:55:01 +00:00
Austaras
dce369336d
fix(es/codegen): Emit extra paren emitting AssignExpr (#8413)
**Related issue:**

 - Closes #8412
2023-12-12 05:53:32 +00:00
SWC Bot
f202a2839f chore: Publish crates 2023-12-12 04:39:47 +00:00
Donny/강동윤
daf6265af4
feat(es/ast): Add as_import_with to ObjectLit to provide easier API (#8405) 2023-12-12 13:38:21 +09:00
SWC Bot
eb41cfcaf9 chore: Publish crates 2023-12-11 04:46:28 +00:00
SWC Bot
602584dd62 chore: Publish crates 2023-12-11 03:07:28 +00:00
magic-akari
a69f172aac
fix(es/fixer): Preserve parenthesis for optional chaining (#8399)
**Related issue:**
 - Closes #8398
2023-12-11 03:05:58 +00:00
SWC Bot
2aebd5fa2f chore: Publish crates 2023-12-08 14:01:33 +00:00
layton
f8ce31627b
fix(es/resolver): Handle TsInterfaceDecl and UsingDecl correctly (#8403)
**Related issue**:
 - Closes #7967
2023-12-08 14:00:00 +00:00
SWC Bot
595f13c019 chore: Publish crates 2023-12-08 07:18:16 +00:00
Donny/강동윤
835151e04d
build(macros): Drop pmutil to improve compile time (#8404)
**Description:**

`pmutil` born to die. Now almost all useful features are merged into `syn` and `quote`, so it's now just a compile-time bloat. (Although I didn't send PRs to them, sorry)
2023-12-08 16:15:44 +09:00
SWC Bot
dbeb869463 chore: Publish crates 2023-12-08 06:00:21 +00:00
magic-akari
29bec98647
fix(es/compat): Preserve spread in the generator pass (#8401)
**Related issue:**
 - Closes #8397
2023-12-08 05:58:53 +00:00
SWC Bot
0bde652b5c chore: Publish crates 2023-12-08 01:58:57 +00:00
Donny/강동윤
6a73d47aa1
perf(common): Fix OOM of inputSourceMap (#8402)
**Description:**

The previous code was very strange, and it could easily cause OOM.
2023-12-08 10:57:27 +09:00
SWC Bot
35fb6528f5 chore: Publish crates 2023-12-07 20:20:49 +00:00
magic-akari
19d1d013b2
refactor(css/lints): Support stable rust (#8384)
**Related issue:**
 - #8316
2023-12-08 05:19:22 +09:00
SWC Bot
11681e1892 chore: Publish crates 2023-12-07 19:45:03 +00:00
magic-akari
f93f2b8334
refactor(css/prefixer): Support stable rust (#8385)
**Related issue:**
 - #8316
2023-12-07 17:37:26 +00:00
SWC Bot
b9f3a0805d chore: Publish crates 2023-12-07 16:58:50 +00:00
magic-akari
bc1e32829d
refactor(css/compat): Support stable rust (#8386)
**Related issue:**
 - #8316
2023-12-07 16:57:26 +00:00
SWC Bot
6ef6cf6f35 chore: Publish crates 2023-12-07 16:22:39 +00:00
Ronak Jain
e09f4b6c60
Use sha2 in place of sha-1 (#8383)
**Descrption:**

`sha-1` crate has been deprecated and the algorithm itself is not considered secure or collision-proof. Moving to `sha2` solves this.

**Related issue:**

 - Closes #8382
2023-12-07 16:21:01 +00:00
SWC Bot
78d36e61f9 chore: Publish crates 2023-12-07 00:38:09 +00:00
magic-akari
305e72e672
refactor(css/minifier): Support stable rust (#8389)
**Related issue:**
 - #8316
2023-12-07 00:36:41 +00:00
SWC Bot
a6355c11a8 chore: Publish crates 2023-12-04 20:55:43 +00:00
magic-akari
7cddbc618a
refactor(css/codegen): Support stable rust (#8379)
**Related issue:**
- #8316
2023-12-04 20:54:14 +00:00
SWC Bot
7bf3aaa316 chore: Publish crates 2023-12-04 20:16:21 +00:00
magic-akari
77145ce47a
refactor(html/minifier): Support stable rust (#8380)
**Related issue:**
- #8316
2023-12-04 20:14:44 +00:00
SWC Bot
9b7a22c126 chore: Publish crates 2023-12-04 19:34:28 +00:00
magic-akari
0ff4157375
refactor(css/modules): Support stable rust (#8381)
**Related issue:**
- #8316
2023-12-04 19:32:54 +00:00
SWC Bot
c5ac93a9df chore: Publish crates 2023-12-04 18:52:58 +00:00
magic-akari
4870e8b47e
refactor(css/parser): Support stable rust (#8378)
**Related issue:**
- #8316
2023-12-04 18:51:26 +00:00
SWC Bot
7327f257d2 chore: Publish crates 2023-12-04 09:00:34 +00:00
SWC Bot
c6e64148b0 chore: Publish crates 2023-12-03 01:14:41 +00:00
Redfire
91e0fc7250
chore(deps): Update indexmap to v2 (#8370)
**Description:**

Updates `indexmap` to `v2`, reducing dependency duplication. Unfortunately there are still many dependencies that require `v1`, including `rkyv` and `cranelift-egraph` that have no published versions using indexmap `v2`.
2023-12-03 01:12:30 +00:00
SWC Bot
c73abc8319 chore: Publish crates 2023-12-03 00:44:55 +00:00
magic-akari
83c8fe56f0
fix(es/lints): Ignore ambient context binding (#8368)
**Related issue:**
- Closes #8367
2023-12-03 00:43:00 +00:00
SWC Bot
9a41fac89f chore: Publish crates 2023-12-02 23:25:06 +00:00