Commit Graph

7185 Commits

Author SHA1 Message Date
OJ Kwon
1868d36cfe
fix(plugin/runner): Disable wasi_env cleanup (#7458) 2023-05-28 14:11:01 +00:00
SWC Bot
dcda6498f3 chore: Publish crates 2023-05-28 13:29:30 +00:00
Donny/강동윤
e15adaf6ea
chore(es/preset-env): Update data (#7459) 2023-05-28 13:27:38 +00:00
SWC Bot
15217a1f9e chore: Publish crates 2023-05-25 05:40:33 +00:00
suxin2017
d370324cfd
fix(css/modules): Don't drop the correct selector (#7450)
**Related issue:**

 - Closes #7447.
2023-05-25 05:38:41 +00:00
SWC Bot
a85816d505 chore: Publish crates 2023-05-25 04:54:11 +00:00
Donny/강동윤
77850dd8f0
fix(es/parser): Fix parsing of generic jsx element name (#7449)
**Related issue:**

 - Closes #7444.
2023-05-25 13:52:14 +09:00
SWC Bot
8d52500a9a chore: Publish crates 2023-05-25 04:00:53 +00:00
Austaras
0cd2b61b05
feat(es/minifier): Inline for loop variables (#7445) 2023-05-25 03:59:02 +00:00
Donny/강동윤
c856808f61 chore: Publish crates 2023-05-25 11:25:07 +09:00
Donny/강동윤
df7a2be938
chore: Publish v1.3.60 with swc_core v0.76.30 (#7448) 2023-05-25 11:23:55 +09:00
SWC Bot
1b5aa4a09b chore: Publish crates 2023-05-25 02:17:22 +00:00
limerick
0c92e534a5
fix(es): Ignore input sourcemap error (#7446) 2023-05-25 11:15:21 +09:00
SWC Bot
6c3ff01a53 chore: Publish crates 2023-05-24 07:48:00 +00:00
Donny/강동윤
e83368e574
refactor(visit): Reduce expanded LOCs (#7442)
**Description:**

x-ref: https://vercel.slack.com/archives/C03EWR7LGEN/p1684898884673379

**Related issue:**

 - https://github.com/web-infra-dev/rspack/issues/3058.
2023-05-24 07:45:40 +00:00
SWC Bot
c1f2b4a09f chore: Publish crates 2023-05-24 06:59:37 +00:00
Donny/강동윤
a37d59a134
fix(es/parser): Fix parsing of tsx with a type annotation in a conditional expression (#7440)
**Related issue:**

 - Closes #7224.
2023-05-24 15:57:50 +09:00
SWC Bot
b95cd8444e chore: Publish crates 2023-05-24 06:27:35 +00:00
Donny/강동윤
33a922b6f8
fix(es/parser): Allow using package as a parameter name in interface (#7438)
**Related issue:**

 - Closes #7186.
2023-05-24 06:25:39 +00:00
SWC Bot
f9f0cc2380 chore: Publish crates 2023-05-24 05:44:06 +00:00
Donny/강동윤
f3d660f972
fix(es/compat): Fix variable scoping of object rest pass. (#7437)
**Related issue:**

 - Closes #6988.
2023-05-24 05:41:57 +00:00
SWC Bot
c14306c914 chore: Publish crates 2023-05-24 04:52:50 +00:00
OJ Kwon
786cf3a10f
fix(es): Init filesystem cache only if plugin exists (#7436) 2023-05-24 04:50:51 +00:00
SWC Bot
552bc0ba18 chore: Publish crates 2023-05-23 07:16:28 +00:00
Donny/강동윤
2071f89d4e
fix(es/preset-env): Fix pass ordering (#7434)
**Related issue:**

 - Closes #6898.
 - Closes #7432.
2023-05-23 07:14:37 +00:00
SWC Bot
8872b41272 chore: Publish crates 2023-05-23 06:25:54 +00:00
Donny/강동윤
97d0f79142
fix(es/compat): Fix stage 3 decorator pass (#7392) 2023-05-23 06:24:05 +00:00
SWC Bot
47114702ef chore: Publish crates 2023-05-23 05:30:42 +00:00
Donny/강동윤
1cab43f17d
fix(es/parser): Reset class context (#7433)
**Related issue:**

 - Closes #7428.
2023-05-23 05:28:56 +00:00
SWC Bot
ed9d316833 chore: Publish crates 2023-05-22 05:29:02 +00:00
OJ Kwon
558ca40b99
fix(swc_core): Correctly expose plugin with host (#7427)
**Description:**

Following up https://github.com/swc-project/swc/pull/7422, `swc_core::plugin` itself is not exposed to `__plugin_transform_host`, so still not able to access the inner plugin proxy.
2023-05-22 05:27:01 +00:00
SWC Bot
7964e1cb78 chore: Publish crates 2023-05-22 04:09:40 +00:00
OJ Kwon
cfdd407896
refactor(swc_core): Make common_plugin_transform agnostic to mode (#7422) 2023-05-22 04:07:55 +00:00
SWC Bot
12b966ea21 chore: Publish crates 2023-05-22 03:23:50 +00:00
Donny/강동윤
66d52ec849
fix(es/compat): Fix destructuring handling of block_scoping (#7425)
**Related issue:**

 - Closes #7418.
2023-05-22 03:21:50 +00:00
SWC Bot
344a6ea7be chore: Publish crates 2023-05-20 04:47:53 +00:00
OJ Kwon
c03a74c198
refactor(plugin/runner): Add attributes to the module bytes (#7419) 2023-05-20 04:46:09 +00:00
SWC Bot
920013511b chore: Publish crates 2023-05-20 04:00:44 +00:00
OJ Kwon
f8fe365c3b
feat(plugin/runner): Enable in-memory precompiled module cache (#7420) 2023-05-20 03:58:55 +00:00
Donny/강동윤
0ac3aebe3d chore: Publish crates 2023-05-19 14:25:31 +09:00
Donny/강동윤
a79a9cf6ff
chore: Publish v1.3.59 with swc_core v0.76.16 (#7416) 2023-05-19 14:24:32 +09:00
SWC Bot
b2c9bb47a0 chore: Publish crates 2023-05-19 04:37:45 +00:00
Austaras
40d2bf7ec3
fix(es/minifier): Prevent inlining vars assigned outside current function scope (#7414)
**Related issue:**

 - Closes #7412.
2023-05-19 13:35:50 +09:00
SWC Bot
135c4fd16b chore: Publish crates 2023-05-18 08:20:26 +00:00
Donny/강동윤
57ad722d06
fix(es/parser): Fix parsing of > in typescript mode (#7407)
**Related issue:**

 - Closes #7403.
2023-05-18 08:18:27 +00:00
SWC Bot
9440f4b196 chore: Publish crates 2023-05-18 07:08:08 +00:00
OJ Kwon
ac5ab607c9
refactor(plugin/runner): Revise cache, module loading (#7408)
**Description:**

One of the oversight around design of `TransformExecutor` is
encapsulating plugin module logic. It has access to the cache and do its
own loading & storing. This means consumer of plugin runner have tricky
challenge to control its caching system. First, there is no way to
escape how swc_plugin_runner controls cache and cannot synchronize into
their own, also depends on the usecases cannot control the features they
want to opt in: for example, there's no way one interface uses in-memory
cache, and another uses filesystem since it is compile time configured
singleton.

PR revisits overall design of TransformExecutor: now it accepts a tratir
`PluginModuleBytes`, which abstracts any kind of bytes we are dealing
with, such as raw file slice or serialized `wasmer::Module`. Cache
instantiation and managing is now bubbled up to the application level
(`swc` in here), so if someone wants non-singleton caching or integrate
into their own caching system it can be customized.

Lastly, deprecated `memory_cache` feature and only exposes
`filesystem_cache`. Cache implementation uses in-memory is always
available, and can opt in filesystem cache where it's supported.


**BREAKING CHANGE:**

This is clearly breaking changes for the consumers of swc_core. for the
@swc/core, this PR takes care of necessary changes. I'll work on
next-swc changes later once we have new @swc/core version with this
changes.
2023-05-18 07:05:39 +00:00
SWC Bot
31d7b88555 chore: Publish crates 2023-05-18 01:21:08 +00:00
Austaras
5dbbbea2ef
fix(es/minifier): Mark all function params as potential property mutation (#7409)
**Description:**

This issue is more severe than I originally thought. It raises not in
array indexing, but in function calls and property mutation. We should
treat all function arguments as potentially be property mutated,
otherwise following example

```js
class A {
	a = 1

	toString() {
		return this.a
	}
}

const a = new A()

function foo(x) {
	x.a++
}

const b = a + 1

foo(a)

console.log(b)
```

would be error(It should log 2, but logs 3 after compress).

As the result, massive regressions is unavoidable, since some of these
optimizations may indeed cause error. Part of them can be mitigated with
following optimization -- allow inline of ident even if its original
value is mutated. Consider

```js
export function foo(x) {
   const y = x
   x.a = 1
   y.b = 2
}
```

If x is a primitive value, all mutations to its properties are ignored;
if x is a object, then y refers to the same object no matter what
mutation is performed.

And there's still room for more, currently following code
```js
export function foo(x) {
    const y = Math.floor(x);
    g(y);
}
```
But I'd rather do it in a separate PR.


**Related issue:**

 - Closes #7402.
2023-05-18 01:19:17 +00:00
SWC Bot
a2a544a0ae chore: Publish crates 2023-05-17 13:12:20 +00:00