Commit Graph

4921 Commits

Author SHA1 Message Date
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
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
Yunfei He
dba78a0031
fix(es/compat): Mark reserved function names private (#7298) 2023-05-17 13:10:27 +00:00
SWC Bot
c520e7469e chore: Publish crates 2023-05-17 06:17:15 +00:00
Donny/강동윤
95291f2c5d
fix(common): Disable tracing/release_max_level_info (#7401) 2023-05-17 06:15:18 +00:00
SWC Bot
8052d4dabd chore: Publish crates 2023-05-17 04:53:45 +00:00
Donny/강동윤
1d3f32056c
fix(es/parser): Fix parsing of module identifier (#7400)
**Related issue:**

 - Closes #4176.
 - Closes #7372.
2023-05-17 04:51:57 +00:00
SWC Bot
820f29ffc1 chore: Publish crates 2023-05-17 03:57:12 +00:00
Donny/강동윤
6b92eecd39
test(css/module): Add a test for a fixed issue (#7399)
**Related issue:**

 - Closes #6897.
2023-05-17 03:55:24 +00:00
SWC Bot
227c272904 chore: Publish crates 2023-05-16 12:33:08 +00:00
Donny/강동윤
eaba323581
test(es/parser): Add a test for a fixed issue (#7398)
**Related issue:**

 - Closes #6976.
2023-05-16 12:31:05 +00:00
SWC Bot
da0c612d85 chore: Publish crates 2023-05-16 05:18:57 +00:00
Donny/강동윤
3a0565f377
chore(plugin): Update rkyv to v0.7.42 (#7397) 2023-05-16 14:17:12 +09:00
SWC Bot
d3db7edd51 chore: Publish crates 2023-05-16 04:14:36 +00:00
Donny/강동윤
40ba242076
fix(es/codegen): Do not create duplicate source map entry (#7309) 2023-05-16 04:12:46 +00:00
SWC Bot
02b22f7625 chore: Publish crates 2023-05-16 03:23:16 +00:00
Donny/강동윤
f9cdd741c2
test(es/minifier): Enable more terser tests (#7396) 2023-05-16 03:21:08 +00:00
Donny/강동윤
4a53951fe3 chore: Publish crates 2023-05-15 13:18:22 +09:00
SWC Bot
a05e28906b chore: Publish crates 2023-05-15 04:14:42 +00:00
OJ Kwon
05b4c11497
feat(swc_core): Expose plugin proxy to the host env (#7391) 2023-05-15 13:12:33 +09:00
Donny/강동윤
8e6fea8519 chore: Publish crates 2023-05-15 12:42:54 +09:00
SWC Bot
5e3d156aca chore: Publish crates 2023-05-15 03:20:03 +00:00
OJ Kwon
bba1fad35c
feat(plugin): Add versioned wrapper struct (#7382) 2023-05-15 03:17:31 +00:00
SWC Bot
5d30437206 chore: Publish crates 2023-05-15 02:27:59 +00:00
Donny/강동윤
cad18fae4b
feat(es/compat): Implement auto accessors fully (#7370)
**Related issue:**

 - Closes #7193.
2023-05-15 02:26:07 +00:00
SWC Bot
a2577adffa chore: Publish crates 2023-05-14 06:08:33 +00:00
OJ Kwon
e3868a7e00
feat(swc_core): Allow native env plugin to use memory cache (#7390)
**Description:**

I just realized there could be some case who'll want plugin in native env, but without filesystem cache. If there's a custom cache implementation, it'll make a conflict to swc's caching mechanism since swc does not expose any interface to the its cache.

PR takes simple approach to expose another feature to opt in native env with memory cache for those case. Ideally we should make `plugin_transform_host_native` to not to opt-in any cache, and then make `swc_plugin_runner` to run without any cache implementation - but that'll be a breaking changes with few more involved changes.
2023-05-14 06:06:24 +00:00
SWC Bot
a71d5b2180 chore: Publish crates 2023-05-14 05:23:11 +00:00
Austaras
fa7a3521f5
fix(es/parser): Fix >= with type instantiate (#7388) 2023-05-14 05:21:13 +00:00
SWC Bot
e88ae37a0c chore: Publish crates 2023-05-12 00:47:49 +00:00
OJ Kwon
9b3a41c57d
refactor(common): Derive ByteCheck for ArcString (#7380) 2023-05-12 09:45:59 +09:00
SWC Bot
7655aaa42a chore: Publish crates 2023-05-11 14:02:24 +00:00
Donny/강동윤
166e77c2b3
chore(es): Enable tracing spans for release builds (#7379) 2023-05-11 13:59:53 +00:00
SWC Bot
65785bdf21 chore: Publish crates 2023-05-10 04:19:21 +00:00
Donny/강동윤
041b491466
feat(es/parser): Implement explicit resource management (#7322)
**Description:**

 - Add `UsingDecl`.
 - Add `UsingDecl` to `Decl`.
 - Rename `VarDeclOrPat` to `ForHead`.
 - Add `UsingDecl` to `ForHead`.
 - Implement parser for using declarations.

**Related issue:**

 - #7316.
2023-05-10 04:16:44 +00:00
SWC Bot
6432e1f5c5 chore: Publish crates 2023-05-10 03:33:12 +00:00