Commit Graph

5502 Commits

Author SHA1 Message Date
Anders Kaseorg
b87ac646f8
fix(es/minifier): Parse a file as a module only if opts.module is true (#7943)
**Description:**

Previously it was impossible to minify non-strict code (e.g. `delete identifier;`) because `minify()` unconditionally parsed the input as a module regardless of the `module` setting.

**BREAKING CHANGE:**

`minify()` now respects the `module` parameter instead of ignoring it, so users who had been processing modules with `minify()` without passing `{ module: true }` will now need to pass it.

**Related issue**

 - Closes #6130.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2023-09-13 05:55:34 +00:00
SWC Bot
858a4f4a22 chore: Publish crates 2023-09-13 02:05:35 +00:00
Austaras
c091c5e295
feat(es/compat): Support pure_getters for optional_chaining (#7933)
**Related issue:**

 - Closes #7921
2023-09-13 02:03:41 +00:00
Donny/강동윤
26b01bd01b chore: Publish crates 2023-09-11 23:26:44 +09:00
SWC Bot
0d0f04689c chore: Publish crates 2023-09-11 08:33:49 +00:00
Donny/강동윤
dac8888829
fix(es/codegen): Use emitAssertForImportAttributes (#7936)
**Description:**

 - Add `format.emitAssertForImportAttributes` to `minify()`
 - Use `jsc.experimental. emitAssertForImportAttributes`.

**Related issue (if exists):**

 - Closes #7926
 - Closes #7928
2023-09-11 08:31:46 +00:00
SWC Bot
5431010c75 chore: Publish crates 2023-09-10 07:00:21 +00:00
magic-akari
2da58959c2
fix(es/codegen): Emit leading comments for ExprStmt (#7916) 2023-09-10 06:58:26 +00:00
SWC Bot
3210556c7e chore: Publish crates 2023-09-10 06:29:19 +00:00
Austaras
97068e12d1
fix(es/compat): Visit assign expr in generator (#7932)
**Related issue:**
 - Closes #7809
2023-09-10 06:27:30 +00:00
Donny/강동윤
8bb2925e23 chore: Publish crates 2023-09-07 10:23:00 +09:00
SWC Bot
8bb911269c chore: Publish crates 2023-09-06 17:31:41 +00:00
Donny/강동윤
a86e9f3bb5
fix(es/module): Fix jsc.paths for projects using pnpm (#7918)
**Related issue:**

- x-ref: https://vercel.slack.com/archives/C04DUD7EB1B/p1693911653100299?thread_ts=1693819683.070959&cid=C04DUD7EB1B
2023-09-06 17:29:47 +00:00
SWC Bot
5c005256d6 chore: Publish crates 2023-09-06 10:26:13 +00:00
Kei Sakamoto
0db25a252c
fix(css/modules): Aggregate class names when composes is chained. (#7917)
**Description:**

aggregate class names when composes is chained.

**Related issue:**

 - Closes #7737
 - https://github.com/web-infra-dev/rspack/issues/3875
2023-09-06 19:24:26 +09:00
SWC Bot
4623b3e07f chore: Publish crates 2023-09-05 12:26:15 +00:00
Donny/강동윤
ee7575695d
feat(es/codegen): Add an option to print assert for import attributes (#7914)
**Description:**

- `jsc.experimental.keepImportAssertions` is renamed to `jsc.experimental.keepImportAttributes`.
 - `jsc.experimental.emitAssertForImportAttributes` is added.

**Related issue:**

 - Closes #7908
2023-09-05 21:24:25 +09:00
SWC Bot
92d08c38e2 chore: Publish crates 2023-09-01 05:26:46 +00:00
Donny/강동윤
85d6e9be07
fix(es/module): Revert #7901 (#7906)
**Description:**

I'm reverting #7901 because it caused a regression in next.js CI.
https://github.com/vercel/next.js/pull/54653


**Related issue:**

 - Reverts #7901.
2023-09-01 14:24:50 +09:00
Donny/강동윤
fd1c0cfdae chore: Publish crates 2023-09-01 11:36:14 +09:00
SWC Bot
d1ec49e3e5 chore: Publish crates 2023-08-31 13:25:10 +00:00
Donny/강동윤
aa6495519b
fix(common): Fix logic for excluding FileName from source maps (#7900)
**Description:**

This PR also modifies React transform to use `FileName::Internal` and makes `SourceMapGenConfig` skips `FileName::Internal`.

**Related issue:**

 - Closes #5272
2023-08-31 13:23:11 +00:00
SWC Bot
e5f7a9dab0 chore: Publish crates 2023-08-31 07:26:53 +00:00
Donny/강동윤
c714dd20de
fix(es/module): Make jsc.paths fully resolve TypeScript files (#7901)
**Related issue:**

 - Closes #7861
 - Closes #7898
2023-08-31 07:24:12 +00:00
SWC Bot
482306086d chore: Publish crates 2023-08-31 05:56:04 +00:00
Austaras
2db10e9fd1
fix(es/resolver): Correctly resolve global value (#7893)
**Related issue:**

 - Closes #7685
2023-08-31 05:54:18 +00:00
Donny/강동윤
15d3900f60 chore: Publish crates 2023-08-30 21:08:25 +09:00
SWC Bot
3127ad9515 chore: Publish crates 2023-08-30 10:15:47 +00:00
Donny/강동윤
5fbc251db1
fix(es/module): Don't create absolute paths for jsc.paths on Windows (#7892)
**Related issue:**

 - Closes #7806
2023-08-30 10:11:34 +00:00
SWC Bot
766d3e8896 chore: Publish crates 2023-08-30 03:03:30 +00:00
Austaras
8db968a25d
refactor(es/minifier): Remove mutated and mutation_by_call_count (#7890)
**Description:**

`mutated` can be seen as a combination of `reassigned` and `has_property_mutation`, and `mutation_by_call_count` is simply useless.
2023-08-30 03:01:29 +00:00
SWC Bot
853b4803ad chore: Publish crates 2023-08-30 02:26:08 +00:00
Donny/강동윤
01cbd6edbd
chore(deps): Update memchr (#7891) 2023-08-30 02:23:57 +00:00
SWC Bot
aa8ad10ad8 chore: Publish crates 2023-08-29 10:23:30 +00:00
Austaras
87a47bfb2c
fix(es/minifier): Report is_fn_local even if var is hoisted (#7876)
**Related issue:**
 - Closes #7847
2023-08-29 10:21:14 +00:00
SWC Bot
c31f05a675 chore: Publish crates 2023-08-29 05:47:51 +00:00
Donny/강동윤
4b33d41fab
fix(es/compat): Make SwitchCase handler of block-scoping stateless (#7888)
**Related issue:**

 - Closes #7885
2023-08-29 05:45:13 +00:00
SWC Bot
4a2c24bbec chore: Publish crates 2023-08-29 05:06:03 +00:00
Donny/강동윤
a50501255d
perf(es/transforms): Remove wrong parallelism (#7889) 2023-08-29 05:04:11 +00:00
SWC Bot
3e41468a3a chore: Publish crates 2023-08-29 01:41:18 +00:00
David Sherret
057bd5f3ef
fix(es/dep-graph): Analyze import type children (#7883)
**Description:**

It was not analyzing children of a dynamic imports.
2023-08-29 01:39:05 +00:00
SWC Bot
44de87f481 chore: Publish crates 2023-08-28 01:12:12 +00:00
Donny/강동윤
a97d8b42b1
feat(es/preset-env): Update data (#7882) 2023-08-28 01:09:38 +00:00
SWC Bot
562f5e1eb3 chore: Publish crates 2023-08-28 00:31:39 +00:00
Donny/강동윤
4d3fcb86e4
feat(es/ast): Support import attributes proposal (#7868)
**Related issue:**

 - Closes #7179
2023-08-28 00:29:45 +00:00
SWC Bot
5d25307a1a chore: Publish crates 2023-08-27 23:38:50 +00:00
Lewis Liu
122d14c0d3
fix(es/codegen): Fix placing of comments of yield arguments (#7858)
**Description:**

Looks like the bug I ran into had nothing to do with the changes in
#7856, since it's reproducible without it. Looks like it might have only
surfaced now because https://github.com/swc-project/swc/pull/7853
changed the default value of `jsc.minify.format.comments`? Added a
minimal test case here with the expected result.

Here's the actual output:

```js
 export var padding = '';
 export function exec2({ commands }) {
     return __awaiter(this, void 0, void 0, function*() {
         for(let i2 = 0; i2 < commands.length; i2++){
             let command = commands[i2];
             yield // some-comment
             function({ command }) {
                 command();
             }({
                 command,
                 handleError
             });
         }
     });
 }
```

The comment ends up getting added after the yield, which makes the
output invalid.

Going to see if I can figure out a fix tomorrow, but let me know if you
have any ideas on where to start looking in the meantime!
2023-08-27 23:36:50 +00:00
SWC Bot
2be46c920c chore: Publish crates 2023-08-27 18:25:51 +00:00
Donny/강동윤
3180e68bf2
fix(es/compat): Apply transforms for explicit resource management (#7881)
**Related issue:**

 - Closes #7879
2023-08-27 18:23:32 +00:00
SWC Bot
84737cdcd8 chore: Publish crates 2023-08-26 01:14:53 +00:00
Donny/강동윤
71d01ec127
feat(es): Add an option to disable builtin transforms (#7873) 2023-08-26 01:12:36 +00:00
SWC Bot
606b57c101 chore: Publish crates 2023-08-25 22:13:55 +00:00
Donny/강동윤
7911973020 chore: Publish crates 2023-08-25 22:55:28 +09:00
SWC Bot
5c96b8545d chore: Publish crates 2023-08-25 13:48:47 +00:00
Donny/강동윤
11ebae1bdd
fix(es/module): Don't resolve as node_modules from TscResolver (#7866)
**Related issue:**

 - Closes #7863
2023-08-25 22:46:53 +09:00
SWC Bot
7986566128 chore: Publish crates 2023-08-25 07:25:19 +00:00
Donny/강동윤
52a1ee78da
fix(es/module): Fix logic for exact matches in jsc.paths (#7860)
**Related issue:**

 - Closes #7829
2023-08-25 07:23:19 +00:00
Donny/강동윤
c18051fb0b chore: Publish crates 2023-08-25 15:21:54 +09:00
SWC Bot
9c69caf665 chore: Publish crates 2023-08-25 06:07:50 +00:00
Donny/강동윤
d33a97303c
fix(es/module): Make jsc.paths work for a nest.js app (#7852) 2023-08-25 15:05:43 +09:00
SWC Bot
f79ca54584 chore: Publish crates 2023-08-25 04:49:30 +00:00
Lewis Liu
ae8cd9430d
fix(es/minifier): Don't remove exports (#7856) 2023-08-25 13:47:42 +09:00
SWC Bot
5ae2e810d8 chore: Publish crates 2023-08-25 03:34:55 +00:00
SWC Bot
e3b4cfbbf9 chore: Publish crates 2023-08-24 18:52:19 +00:00
Donny/강동윤
64e51d3a28
fix(es): Fix default value of jsc.minify.format.comments (#7853)
**Related issue:**

 - Closes #7842
2023-08-24 18:50:21 +00:00
SWC Bot
7b5cb902a5 chore: Publish crates 2023-08-24 12:58:41 +00:00
Donny/강동윤
c65732496e
refactor(common): Mark some methods of Input unsafe (#7848)
**Related issue:**

 - Closes #7709
2023-08-24 12:56:38 +00:00
SWC Bot
a9a6928a4e chore: Publish crates 2023-08-24 08:20:56 +00:00
Jason
a34f3592b3
feat(css/ast): Support @scope at-rule (#7837)
> ### Describe the feature
> [Chrome 118 is shipping
soon](https://chromium-review.googlesource.com/c/chromium/src/+/4790561),
which is expected to be one of the more popular CSS features, giving new
hope for style isolation of components.
> 
> * Explainer https://css.oddbird.net/scope/explainer
> * Specification https://drafts.csswg.org/css-cascade-6/#scope-atrule
> 

Closed: #7836
2023-08-24 08:18:35 +00:00
SWC Bot
da5bc1084d chore: Publish crates 2023-08-24 07:37:21 +00:00
Austaras
65db1badff
refactor(es/minifier): Pre-calculate reassigned (#7832) 2023-08-24 07:35:26 +00:00
SWC Bot
662f236aa5 chore: Publish crates 2023-08-22 02:06:20 +00:00
Donny/강동윤
7fe01e64dd
fix(es/minifier): Don't inline properties if the var is not fn-local (#7839)
**Related issue:**

 - https://github.com/vercel/next.js/issues/54192.
2023-08-22 11:04:15 +09:00
SWC Bot
6a8ea89f4b chore: Publish crates 2023-08-18 06:26:59 +00:00
SWC Bot
f87581f67d chore: Publish crates 2023-08-18 04:27:30 +00:00
Donny/강동윤
1ab406cd7a
refactor(es/helpers): Move packages for monorepo (#7833) 2023-08-18 04:25:37 +00:00
Donny/강동윤
6e37fd2932 chore: Publish crates 2023-08-18 04:30:40 +09:00
SWC Bot
becea47a2d chore: Publish crates 2023-08-17 18:11:16 +00:00
Donny/강동윤
31de19ece2
fix(es/minifier): Preserve more analysis data upon inlining (#7823)
**Related issue:**

 - Closes #7821.
2023-08-17 18:09:02 +00:00
SWC Bot
9dbfadb48d chore: Publish crates 2023-08-17 14:38:07 +00:00
Donny/강동윤
9099883175
feat(es/module): Improve error message about relative jsc.baseUrl (#7827) 2023-08-17 14:35:39 +00:00
SWC Bot
ebbc9292e3 chore: Publish crates 2023-08-17 05:18:03 +00:00
Austaras
f8ca366cc1
fix(es/minifier): Abort seq inliner if var is not fn_local or reassigned (#7804)
**Description:**

It turns out that the original implementation of `infect`is incomplete
because it cannot cover function param, and the new implementation
introduced in #7772 is redundant because what
[terser](https://github.com/terser/terser/blob/master/lib/compress/tighten-body.js#L909C18-L909C28)
do is basically checking `fn_local`


**Related issue:**

 - Closes #7784
2023-08-17 05:15:59 +00:00
SWC Bot
a6a5ec30cd chore: Publish crates 2023-08-17 04:37:14 +00:00
Donny/강동윤
05990a98fd
fix(es/minifier): Preserve cooked while compressing template literals (#7773)
**Related issue:**

 - Closes #7770
2023-08-17 04:35:07 +00:00
SWC Bot
05200ad352 chore: Publish crates 2023-08-17 04:03:33 +00:00
Donny/강동윤
3766a7c776
fix(es/compat): Remove wrong logic for object patterns in object_rest (#7788)
**Related issue:**

 - Closes #7776
2023-08-17 04:01:30 +00:00
SWC Bot
0d036b4915 chore: Publish crates 2023-08-16 19:11:18 +00:00
Donny/강동윤
04921f301a
fix(es/codegen): Add quotes to property names when ascii_only is true (#7820)
**Related issue:**

 - Closes #7805.
2023-08-16 19:09:27 +00:00
SWC Bot
e9dfe879d9 chore: Publish crates 2023-08-16 18:04:14 +00:00
David Sherret
981d7b152b
refactor(common): Make ahash optional (#7816)
**Description:**

This adds the ability to not include `ahash` with swc_common, which
caused some issues for me compiling dprint-plugin-typescript to Wasm
because of:

```
   Compiling ahash v0.8.3
   Compiling getrandom v0.2.10
error: the wasm*-unknown-unknown targets are not supported by default, you may need to enable the "js" feature. For more information see: https://docs.rs/getrandom/#webassembly-support
   --> C:\Users\david\.cargo\registry\src\index.crates.io-6f17d22bba15001f\getrandom-0.2.10\src\lib.rs:285:9
    |
285 | /         compile_error!("the wasm*-unknown-unknown targets are not supported by \
286 | |                         default, you may need to enable the \"js\" feature. \
287 | |                         For more information see: \
288 | |                         https://docs.rs/getrandom/#webassembly-support");
    | |________________________________________________________________________^
``` 

(I can't enable the JS feature because it's running the wasm file in
Wasmer and also I don't support Wasi in dprint plugins)

**BREAKING CHANGE:**

This removes swc_common's "perf" feature and makes it the default, then
adds an `ahash` feature instead. An alternative would be to make the
`ahash` dep optional and part of the default features, then do
`default-features = false` in the downstream crates (I think, but I'm
not sure), but I figure most people will be using the perf default
anyway? I'm not sure what's preferable.

**Related issue:**

 - Closes #7729.
2023-08-16 18:02:05 +00:00
SWC Bot
d5495eeb9a chore: Publish crates 2023-08-16 14:18:56 +00:00
David Sherret
b43e38d3f9
refactor: Use ahash from swc_common in more places (#7815)
**Description:**

Uses ahash from swc_common in more places. This allows for more easily
swapping out ahash with rustc_hash.
2023-08-16 23:16:52 +09:00
SWC Bot
2dc88ef147 chore: Publish crates 2023-08-16 13:26:52 +00:00
Donny/강동윤
8b809dbe23
refactor(es/parser): Remove needless unsafe (#7818)
**Related issue:**

 - Closes #7797
2023-08-16 13:24:35 +00:00
SWC Bot
a671afa0aa chore: Publish crates 2023-08-16 02:12:39 +00:00
Johnil Quezada
478fa4736f
feat(es/ast): Expose Archived types (#7811)
**Description:**

For crates using both `rkyv` and `swc`, where ast nodes from
`swc_ecma_ast` are included in data that's serialized with `rkyv`, it's
difficult to access the archived data from the archived ast nodes since
the types are private.

More context in the issue.

**Related issue:**

 - Closes #7810.
2023-08-16 02:10:51 +00:00
SWC Bot
023042dfb9 chore: Publish crates 2023-08-15 15:29:35 +00:00
Donny/강동윤
42dec557ed
fix(es/compat): Revert #7610 (#7813)
**Related issue:**

 - Reverts #7610.
 - Closes #7798.
 - Closes #7789.
 - Opens #7561.
2023-08-15 15:27:38 +00:00
SWC Bot
47350a8ac6 chore: Publish crates 2023-08-14 16:35:22 +00:00
Donny/강동윤
fe1ca26218
fix(es): Resolve jsc.baseUrl for .swcrc specified by --config-file (#7801)
**Related issue:**

 - Closes #7800
2023-08-14 16:33:17 +00:00
SWC Bot
0f66ee315a chore: Publish crates 2023-08-14 15:47:58 +00:00
David Sherret
e527c12a82
fix(es/parser): Revert lexer fix for << (#7807)
This temporarily reverts commit 68503726a7
until https://github.com/swc-project/swc/issues/7621 can be fixed.

Re-opens #7187.
2023-08-14 15:45:51 +00:00
SWC Bot
74d446f759 chore: Publish crates 2023-08-14 01:35:45 +00:00
Manish Goregaokar
5e7834aa2e
refactor(es/parser): Don't attempt to handle shebangs in read_token_number_sign (#7803)
bump() has a safety invariant that there must be input in the buffer to
read (See https://github.com/swc-project/swc/issues/7709).

This function as currently written calls `bump()` after calling
`read_token_interpreter()`, which *may* have exhausted the buffer
already in the specific case that it is handling a shebang. (The input
string `#!/bin/js` with no newline is sufficient to cause UB here)

Fortunately, shebangs never reach this function, due to `read_shebang`!
Hurray!

It's cleaner to not attempt to handle shebangs here when this code path
will never be reached, and use a debug assertion to ensure that we're
not dealing with shebangs.
2023-08-14 01:33:50 +00:00
Donny/강동윤
7fac0270c4 chore: Publish crates 2023-08-10 17:13:03 +09:00
SWC Bot
b5dcce03c1 chore: Publish crates 2023-08-10 08:01:19 +00:00
Donny/강동윤
54f38cb47e chore: Publish crates 2023-08-10 12:05:44 +09:00
SWC Bot
be58d36c42 chore: Publish crates 2023-08-10 02:50:53 +00:00
Donny/강동윤
552d9aa344
fix(es/minifier): Do not drop properties used via this (#7785)
**Related issue:**

 - Closes #7783.
2023-08-10 02:48:35 +00:00
SWC Bot
e90b555790 chore: Publish crates 2023-08-09 20:44:26 +00:00
Donny/강동윤
eff0caca2b
feat(es/minifier): Support mangle.eval (#7777)
**Related issue:**

 - Closes #7754
2023-08-09 20:42:12 +00:00
SWC Bot
0edc4207f4 chore: Publish crates 2023-08-09 20:04:15 +00:00
Austaras
ef8d12154d
fix(es/minifier): Abort seq inliner if a same var is defined in outer scope (#7772)
**Description:**

The algorithm here is directly copied from terser, I don't if it's correct or can be improved, but it does fix the issue.


**Related issue:**

 - Closes #7749
2023-08-09 20:01:59 +00:00
SWC Bot
c04ca528b8 chore: Publish crates 2023-08-09 09:19:00 +00:00
Donny/강동윤
76c6258d15
perf(es/compat): Improve time complexity of class_properties (#7786)
**Related issue:**

 - Closes #7780
2023-08-09 09:17:14 +00:00
SWC Bot
fd2d6747be chore: Publish crates 2023-08-09 08:37:37 +00:00
SWC Bot
1c2eb88a60 chore: Publish crates 2023-08-09 05:00:38 +00:00
Donny/강동윤
5c4bfa61f9
fix(es/module): Use jsc.baseUrl while resolving absolute paths (#7775)
**Related issue:**

 - Closes #7761
2023-08-09 13:58:45 +09:00
Donny/강동윤
000f817bcc chore: Publish crates 2023-08-08 14:05:39 +09:00
SWC Bot
83983f49c8 chore: Publish crates 2023-08-07 22:56:50 +00:00
Donny/강동윤
f7afe7edec
refactor(es/minifier): Support stable rustc (#7734) 2023-08-07 22:55:00 +00:00
SWC Bot
14906e279f chore: Publish crates 2023-08-07 22:20:08 +00:00
Donny/강동윤
b45649b8d6
fix(es/codegen): Don't strip necessary escape characters (#7687)
**Related issue:**

 - Closes #7678.
2023-08-07 22:17:59 +00:00
SWC Bot
0219eebeb9 chore: Publish crates 2023-08-07 21:31:50 +00:00
Fy
5f97f8656f
refactor(es/parser): Do not validate top-level await with target (#7774) 2023-08-07 21:30:04 +00:00
SWC Bot
1323c25ed6 chore: Publish crates 2023-08-07 20:38:40 +00:00
Donny/강동윤
36ccbec061
fix(es/minifier): Abort on Array.slice with start >= end (#7745)
**Related issue:**

 - Closes #7742.
2023-08-07 20:36:15 +00:00
SWC Bot
1e6ade8cfa chore: Publish crates 2023-08-07 20:01:21 +00:00
Manish Goregaokar
2258274233
refactor(es/ast): Avoid transmute in impl of Hash for Number (#7771)
**Description:**

[`f64::to_bits()`](https://doc.rust-lang.org/stable/std/primitive.f64.html#method.to_bits) does the same thing.
2023-08-08 04:59:15 +09:00
SWC Bot
76c78f8794 chore: Publish crates 2023-08-07 08:17:54 +00:00
SWC Bot
51d17b66ad chore: Publish crates 2023-08-06 22:16:01 +00:00
Donny/강동윤
d57ac0dd28
fix(es/utils): Ignore typeof Id while preserving side effects (#7763)
**Related issue:**

 - Closes #7750
2023-08-06 22:14:05 +00:00
SWC Bot
434472a678 chore: Publish crates 2023-08-06 21:44:26 +00:00
Ian Kerins
b69ae8f433
fix(es/compat): Fix loose mode of the spread pass (#7760) 2023-08-06 21:42:33 +00:00
SWC Bot
97289b4edc chore: Publish crates 2023-08-06 20:31:13 +00:00
Gareth McSorley
e50cfde938
refactor(es/parser): Do not use lexical (#7758)
This PR replaces the current usage of lexical within the swc_ecma_parser
crate with equivalent parsing of large numbers using BigInt.

**Description:**

As discussed in
https://github.com/swc-project/swc/issues/7752, lexical contains a
number of soundness issues but doesn't appear to be actively supported.
Given the relatively low integration surface it seems reasonable to
replace the usage of lexical with another package to avoid this issue.

**Related issue:**

- Closes #7752
2023-08-06 20:29:17 +00:00
SWC Bot
c9a55603ae chore: Publish crates 2023-08-03 22:23:07 +00:00
Fy
1122de7d8b
fix(plugin/runner): Use fs cache properly (#7748) 2023-08-03 22:20:51 +00:00
SWC Bot
875a7a7393 chore: Publish crates 2023-08-03 03:23:59 +00:00
Donny/강동윤
28dfc51887
feat(es): Alias format as output for minify() (#7746)
**Related issue:**

 - Closes #7738.
2023-08-03 03:22:09 +00:00
SWC Bot
d0ea6bdd84 chore: Publish crates 2023-08-03 02:45:17 +00:00
thy486
f713f6aba8
fix(es/module): Fix handling of continuous assignments in systemjs (#7741)
**Description:**

Fix transpile the continuous assignment code like `d.a = d.b = d.c = d.d = ... = void 0;` to SystemJS may cause Infinite loop.

**Related issue:**

 - Closes #7143.
2023-08-03 02:43:17 +00:00
Donny/강동윤
5afdd2ed54 chore: Publish crates 2023-08-03 07:19:43 +09:00
SWC Bot
e22cdccedd chore: Publish crates 2023-08-02 22:04:35 +00:00
Donny/강동윤
3873f58499
fix(es/minifier): Mark args of news as references (#7743)
**Related issue:**

 - Closes #7739.
2023-08-03 07:02:15 +09:00
SWC Bot
791025943a chore: Publish crates 2023-08-02 20:43:00 +00:00
Jean-Cédric Huet
22e06cce63
fix(es): Fix typo in a warning (#7740) 2023-08-02 20:40:57 +00:00
Donny/강동윤
6d7e13ae26 chore: Publish crates 2023-08-01 12:41:32 +09:00
SWC Bot
383509fd9d chore: Publish crates 2023-07-31 15:46:19 +00:00
Felipe Armoni
216c4f17df
test(es/compat): Add a test for optional chaining with loose mode (#7726) 2023-07-31 15:44:28 +00:00
SWC Bot
5284220d6c chore: Publish crates 2023-07-31 08:08:38 +00:00
Donny/강동윤
b4f3332b21
feat(es/preset-env): Update builtin definitions for core-js imports (#7715)
**Related issue:**

 - Closes #7712.
2023-07-31 08:06:24 +00:00
SWC Bot
1a5a3313cf chore: Publish crates 2023-07-31 04:12:06 +00:00
Austaras
5ea6f27eb0
fix(es/minifier): Handle synthesized export default expression (#7707)
**Related issue:**

 - Closes #7634.
2023-07-31 04:10:18 +00:00
SWC Bot
ef306256d2 chore: Publish crates 2023-07-31 03:33:30 +00:00
Donny/강동윤
e8c58cfd77
fix(es/utils): Fix string evaluation of array literals (#7731)
**Related issue:**

 - Closes #7714.
2023-07-31 03:31:37 +00:00
Donny/강동윤
ffe99a9665 chore: Publish crates 2023-07-29 04:36:29 +09:00
SWC Bot
640318c616 chore: Publish crates 2023-07-28 16:59:14 +00:00
Donny/강동윤
f901b417d1
fix(es/minifier): Do not drop used properties (#7702)
**Related issue:**

 - Closes #7700.
 - Closes #7710.
2023-07-28 16:57:07 +00:00
SWC Bot
d3b516d692 chore: Publish crates 2023-07-28 05:59:26 +00:00
Rene B
864bdefbe0
refactor(es/parser): Make stacker an optional dependency (#7720) 2023-07-28 05:57:31 +00:00
SWC Bot
9a57f8ab6d chore: Publish crates 2023-07-28 05:22:07 +00:00
magic-akari
40136f7c54
fix(es/module): Do not determine module name for modules without exports in UMD (#7718)
**Related issue:**

 - Closes #6263.
2023-07-28 05:20:16 +00:00
SWC Bot
3f3de2e316 chore: Publish crates 2023-07-28 04:42:31 +00:00
Felipe Armoni
7ba7b6ec1f
fix(es/compat): Fix handling of private members in optional chaining pass (#7610)
**Related issue:**

 - Closes #7561.
2023-07-28 04:40:19 +00:00
SWC Bot
e105f207df chore: Publish crates 2023-07-28 03:30:04 +00:00
OJ Kwon
2bc96373b7
feat(swc_core): Expose visit/serde as serde feature (#7722) 2023-07-28 12:27:55 +09:00
SWC Bot
9daa0e2c6a chore: Publish crates 2023-07-25 08:17:01 +00:00
Donny/강동윤
900701fbf2
feat(es): Add a validation for a wrong config (#7704)
**Related issue:**

 - Closes #6956.
2023-07-25 08:14:49 +00:00
Donny/강동윤
42198679aa chore: Publish crates 2023-07-25 12:53:29 +09:00
SWC Bot
4c43d5aa3d chore: Publish crates 2023-07-25 03:32:13 +00:00
Donny/강동윤
a26dbce981
fix(es/minifier): Abort seq inliner using visitor (#7699)
**Related issue:**

 - Closes #7697.
2023-07-25 03:30:33 +00:00
SWC Bot
cd98859482 chore: Publish crates 2023-07-25 02:56:16 +00:00
Austaras
bf723625b0
refactor(es/minifier): Respect top-level when invoking IIFE (#7690) 2023-07-25 02:53:55 +00:00
SWC Bot
11efd4e7c5 chore: Publish crates 2023-07-24 04:39:18 +00:00
Donny/강동윤
c017874085
fix(es/typescript): Fix handling of optional chaining (#7660)
**Related issue:**

 - Closes #7659.
2023-07-24 04:37:30 +00:00
SWC Bot
ab17d2a4ae chore: Publish crates 2023-07-21 05:24:53 +00:00
Donny/강동윤
951138cd13
fix(es/minifier): Drop line comments starting with ! (#7689)
**Related issue:**

 - Closes #7653
2023-07-21 05:23:11 +00:00
SWC Bot
aff07b1a0a chore: Publish crates 2023-07-21 02:00:00 +00:00
magic-akari
241c04ab4a
fix(es/minifier): Only cast global Infinity/undefined/NaN (#7684)
**Related issue:**

 - Closes #7683.
2023-07-21 01:57:39 +00:00
SWC Bot
549e138443 chore: Publish crates 2023-07-20 07:15:09 +00:00
Donny/강동윤
57398af270
chore(ci): Fix CI (#7679) 2023-07-20 07:13:12 +00:00
SWC Bot
026101b71e chore: Publish crates 2023-07-20 05:57:51 +00:00
Jason
cfb7b511ee
feat(css/parser): Support @starting-style (#7677) 2023-07-20 14:55:50 +09:00
SWC Bot
c61dd52909 chore: Publish crates 2023-07-20 02:37:25 +00:00
Austaras
9893bd2d43
refactor(es/minifier): Respect toplevel and module options (#7671) 2023-07-20 11:35:08 +09:00
SWC Bot
ce7f4b693d chore: Publish crates 2023-07-19 05:22:34 +00:00
Kei Sakamoto
11b4679231
fix(css/modules): Preserve attr selectors used with :global (#7670)
**Related issue:**

 - Closes #7669
2023-07-19 05:20:37 +00:00
Donny/강동윤
6c181256f3 chore: Publish crates 2023-07-18 13:22:16 +09:00
SWC Bot
3c89bdfd99 chore: Publish crates 2023-07-18 04:13:08 +00:00
Donny/강동윤
a65be14a00
fix(es/minifier): Do not reuse identifier used for import bindings (#7639)
**Related issue:**

 - Closes #7634.
2023-07-18 04:11:00 +00:00
SWC Bot
c31846ded6 chore: Publish crates 2023-07-18 03:35:40 +00:00
SWC Bot
7c12060b70 chore: Publish crates 2023-07-18 01:10:44 +00:00
Donny/강동윤
6be1f7075d
fix(es/minifier): Fix a bug about eval of name mangler (#7615)
**Description:**

 - Repro: https://github.com/avitorio/swcminify-debug


**Related issue:**

 - https://github.com/vercel/next.js/discussions/30237#discussioncomment-6288339
2023-07-18 01:09:00 +00:00
SWC Bot
3930f77b54 chore: Publish crates 2023-07-17 07:19:08 +00:00
magic-akari
a2d0408597
fix(es/module): Skip CJS and AMD transformations for Script (#7661)
**Related issue:**

 - Closes #7650
2023-07-17 07:17:17 +00:00
SWC Bot
bed73c168c chore: Publish crates 2023-07-14 20:56:32 +00:00
Austaras
04b0f6d823
feat(es/minifier): Drop recursively used var declaration (#7649) 2023-07-15 05:54:34 +09:00
SWC Bot
7bf4ab39b0 chore: Publish crates 2023-07-13 05:13:38 +00:00
Donny/강동윤
c0e480593f
test(es): Add a test for a unreproducible issue (#7656)
**Related issue:**

 - Closes #5644.
2023-07-13 05:11:51 +00:00
SWC Bot
7d5feccccf chore: Publish crates 2023-07-13 04:36:21 +00:00
Donny/강동윤
7528de1897
test(es/modules): Add a test for unreproducible issue (#7655)
**Related issue:**

 - Closes #7417.
2023-07-13 04:34:22 +00:00
Donny/강동윤
d9209ec3d7 chore: Publish crates 2023-07-13 11:21:28 +09:00
SWC Bot
26d79444c6 chore: Publish crates 2023-07-13 02:09:23 +00:00
Manish Goregaokar
a961090c9d
chore(es/parser): Scope use of lexical to certain features (#7644) 2023-07-13 11:07:25 +09:00
SWC Bot
e4f9f734ad chore: Publish crates 2023-07-07 04:09:05 +00:00
Donny/강동윤
19ba714ea1
fix(es/minifier): Don't drop unused properties of top-level vars (#7638)
**Related issue:**

 - Closes #7635.
2023-07-07 04:07:13 +00:00
SWC Bot
e80c695c89 chore: Publish crates 2023-07-07 02:59:38 +00:00
Donny/강동윤
7e9e84e230
feat(es/preset-env): Update compat data (#7630) 2023-07-07 02:57:48 +00:00
SWC Bot
1fe263903d chore: Publish crates 2023-07-07 02:17:07 +00:00
lsdyi
a7daa5b28e
fix(es/compat): Fix loose mode of the spread pass (#7608)
**Related issue:** 

 - Closes #7354
2023-07-07 11:15:07 +09:00
SWC Bot
2ef760357f chore: Publish crates 2023-07-06 03:29:42 +00:00
Donny/강동윤
d2ac2c16a3
fix(es/compat): Visit children of while statement in the generator pass (#7624)
**Related issue:**

 - Closes #7622.
2023-07-06 03:27:49 +00:00
SWC Bot
2e7b05e588 chore: Publish crates 2023-07-05 06:54:45 +00:00
SWC Bot
735a82d6a4 chore: Publish crates 2023-07-05 03:52:51 +00:00
Donny/강동윤
b34f1adbcc
build(cargo): Update rustc to 2023-07-03 (#7623) 2023-07-05 03:50:43 +00:00
Donny/강동윤
40ee26b2c9 chore: Publish crates 2023-07-05 10:08:41 +09:00
SWC Bot
7544ea960b chore: Publish crates 2023-07-04 07:01:59 +00:00
Donny/강동윤
c087c82aa3
fix(es/compat): Visit transformed expression in optional chaining pass (#7614)
**Related issue:**

 - Closes #7612.
2023-07-04 06:59:58 +00:00
SWC Bot
984fdc8ef5 chore: Publish crates 2023-07-04 06:25:39 +00:00
Austaras
4f866de878
fix(es/minifier): Add usage to inlined ident eagerly (#7597)
**Related issue:**

 - Closes #7591.
2023-07-04 06:23:49 +00:00
SWC Bot
9214427667 chore: Publish crates 2023-07-04 05:49:44 +00:00
Austaras
ff1ad95b59
feat(es/minifier): Compress common sub expressions in sequences (#7587) 2023-07-04 05:47:37 +00:00
SWC Bot
9cb9f055ba chore: Publish crates 2023-07-04 05:13:14 +00:00
Donny/강동윤
47d2edd4dc
feat(es/minifier): Drop unused properties (#7534)
**Related issue:**

 - Closes #7472.
2023-07-04 05:11:33 +00:00
SWC Bot
cf902d3808 chore: Publish crates 2023-07-03 01:54:53 +00:00
David Sherret
0a26066b7b
refactor(es/compat): Remove usage of box_patterns (#7613) 2023-07-03 01:52:51 +00:00
SWC Bot
cba986807a chore: Publish crates 2023-06-30 07:43:11 +00:00
Donny/강동윤
68503726a7
fix(es/parser): Re-lex << as two <-s if required (#7439)
**Related issue:**

 - Closes #7187.
2023-06-30 07:41:19 +00:00
SWC Bot
af3654c0c3 chore: Publish crates 2023-06-30 03:30:23 +00:00
OJ Kwon
8209594a8c
fix(plugin/runner): Disable wasi env cleanup (#7607)
**Description:**

Even after setting shared runtime for the wasi env, `cleanup` still panics. I suspect something internal to cleanup doesn't honor those handles correctly; for now, disable it and try to see if this works.

As commented, this is not a huge issue as the plugin usually doesn't have resources to be cleaned up anyway.
2023-06-30 03:28:35 +00:00
SWC Bot
efcad6a499 chore: Publish crates 2023-06-30 02:55:28 +00:00
suxin2017
f0ab5b39f7
fix(css/modules): Fix :local and :global (#7600)
**Related issue:**

 - Close #7599.
2023-06-30 02:53:10 +00:00
SWC Bot
3aee9a23aa chore: Publish crates 2023-06-30 02:15:04 +00:00
廖应龙
ac02b84918
feat(es/optimization): Support default imports for const modules (#7604) 2023-06-30 02:12:45 +00:00
SWC Bot
efc1afd96a chore: Publish crates 2023-06-29 14:15:31 +00:00
Donny/강동윤
bcd5a1d666
feat(es/compat): Implement transform for explicit resource management (#7376)
**Related issue:**

 - Closes #7316.
 - Closes #7369.
2023-06-29 14:13:43 +00:00
SWC Bot
be33efaecd chore: Publish crates 2023-06-29 07:52:19 +00:00
underfin
e2725451aa
fix(es/fixer): Don't change default decls to default expr exports (#7585)
**Related issue:**

 - Closes #7584.
2023-06-29 07:50:25 +00:00
SWC Bot
ae0d81b48d chore: Publish crates 2023-06-29 06:13:42 +00:00
Cong-Cong Pan
769d6516a5
fix(xml/codegen): Fix wrong minification of spaces in a self-closing tag (#7595)
**Description:**

xml codegen with option `minify: true`.

input:
```xml
<foo attributeName="OK" />
```

expected:
```xml
<foo attributeName="OK"/>
```

actual:

```xml
<foo attributeName="OK" />
```

---

We already escape the attribute value in `escape_string` function, so we
do not need to check whether it contains a specific string.
2023-06-29 06:11:34 +00:00
Donny/강동윤
00eb41847b chore: Publish crates 2023-06-29 11:20:28 +09:00
SWC Bot
8f016cd8f3 chore: Publish crates 2023-06-29 01:58:47 +00:00
OJ Kwon
9512ea31ff
feat(plugin/runner): Share runtime Engine (#7590) 2023-06-29 01:56:55 +00:00
SWC Bot
ed9a4ae5bc chore: Publish crates 2023-06-27 15:25:59 +00:00
Donny/강동윤
a685c88c61
fix(es/minifier): Don't drop assignments to unused top-level variables (#7581)
**Related issue:**

 - Closes #7568
2023-06-27 15:24:06 +00:00
SWC Bot
d3b934f619 chore: Publish crates 2023-06-27 14:36:35 +00:00
SWC Bot
7f2ace5d3f chore: Publish crates 2023-06-27 02:16:08 +00:00
Donny/강동윤
398e922ca0
feat(es/minifier): Inline constants even if they are exported (#7583)
**Related issue:**

 - Closes #7575.
2023-06-27 02:14:09 +00:00