Commit Graph

92 Commits

Author SHA1 Message Date
Donny/강동윤
66d52ec849
fix(es/compat): Fix destructuring handling of block_scoping (#7425)
**Related issue:**

 - Closes #7418.
2023-05-22 03:21:50 +00:00
OJ Kwon
c03a74c198
refactor(plugin/runner): Add attributes to the module bytes (#7419) 2023-05-20 04:46:09 +00:00
OJ Kwon
f8fe365c3b
feat(plugin/runner): Enable in-memory precompiled module cache (#7420) 2023-05-20 03:58:55 +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
OJ Kwon
bba1fad35c
feat(plugin): Add versioned wrapper struct (#7382) 2023-05-15 03:17:31 +00:00
Donny/강동윤
97ec259144
feat(es/compat): Partially support auto accessors (#7364)
**Description:**

I'll create a follow-up PR for a full support for auto accessors.

**Related issue:**

 - #7193.
2023-05-09 05:45:16 +00:00
OJ Kwon
4e278befcf
build(cargo): Update wasmer to v3.3 (#7352) 2023-05-05 07:26:38 +00:00
OJ Kwon
91a3fbe460
refactor(plugin/runner): Refine cache location (#7346) 2023-04-30 21:43:13 +09:00
Donny/강동윤
d6999ba1ac
fix(plugin/runner): Revert #7341 (#7344)
**Description:**

This reverts commit 245163a778.
2023-04-29 21:58:48 +09:00
OJ Kwon
245163a778
feat(plugin/runner): Improve caching (#7341)
**Description:**

Previously disabled cache (storing compiled module in memory) still doesn't work, so falling back to storing raw bytes and create new module each time. This is the same behavior to the wasm build's approach.

Also minor improved caching root to include more information. Previous rustc didn't seem to work unfortunately, so removed but instead using plugin_runner's version.
2023-04-29 11:14:21 +00:00
OJ Kwon
efad714983
feat(plugin): Enable validation (#7250) 2023-04-12 12:30:38 +00:00
Donny/강동윤
70b86dbe37
refactor(plugin/runner): Fix clippy warnings (#7244) 2023-04-11 03:45:49 +00:00
OJ Kwon
56bdacc72d
feat(plugin/runner): Update wasmer to v3 (#7197)
**Description:**

This PR reattempts https://github.com/swc-project/swc/pull/5456.

Most of the changes are for the breaking changes of wasmer@3, as well as enabling rkyv's strict mode (https://github.com/swc-project/swc/pull/6922). This could not be seperated since wasmer@3 enables strict mode by default without a way to turn it off.

There are a couple of changes worth noting:

- Disabling in-memory module lookup: https://github.com/swc-project/swc/pull/7197/files#diff-3bda5def6ce2b7553c3b3a5ad241c0bdb7021e67b7de1e594df4cd5a54d403b3R154-R159
- Disabling plugin_runner in bindings_wasm: https://github.com/swc-project/swc/pull/7197/files#diff-dc3ded556a1fd709a129acd588e5eda651b842c6acc3f5340d40088a1f927facR310-R312
- Skipping plugin compat test: https://github.com/swc-project/swc/pull/7197/files#diff-531197dfcefba05faca53f0cf442ecc2dc6b59d5ead01979f5ffb912aa36249aR64-R66
2023-04-10 03:40:25 +00:00
OJ Kwon
976667f7d9
feat(plugin/runner): Improve cache path (#7188)
**Description:**

This PR is minor improvement, non breaking changes to cache path for the plugin. In short, it tries to combine rustc version if available to expand. `option_env!` supposed to embed build time rustc version. It'd be ideal if we could match between plugin's as well, but I doubt if we could before actually load plugin.
2023-04-02 00:22:58 +00:00
Donny/강동윤
0259a7465f
build(cargo): Update rustc to nightly-2023-03-20 (#7170)
**Description:**

This PR also updates `rkyv` to `=0.7.40`.

**Related issue:**

 - Closes https://github.com/swc-project/swc/issues/6807.
2023-03-30 08:06:02 +00:00
Donny/강동윤
12546c853a
build(cargo): Revert rustc upgrade (#7162)
**Description:**

The `rkyv` bug is not fixed.
2023-03-29 17:48:45 +09:00
Donny/강동윤
e445502072
build(cargo): Update rustc to nightly-2023-03-28 (#7154)
**Description:**

This PR also updates `rkyv` to `=0.7.40`.

**Related issue:**

 - Closes https://github.com/swc-project/swc/issues/6807.
2023-03-29 06:24:19 +00:00
Donny/강동윤
99d48e305e
fix(plugin): Make span_to_source use dedicated function (#6853)
**Related issue:**

 - Closes https://github.com/swc-project/swc/issues/6852.
 - Closes https://github.com/swc-project/swc/issues/6404.
2023-01-26 02:09:36 +00:00
Donny/강동윤
99934b09f7
fix(es/minifier): Change the default of mangle.toplevel to false (#6439) 2022-11-15 02:28:38 +00:00
Andreas
b6c1cc49e1
fix(es/plugin): Print more details on pointer conversion failures (#6378) 2022-11-11 22:47:44 +00:00
Donny/강동윤
e8a80c8a8b
chore: Publish v1.3.9 (#6177) 2022-10-17 20:32:18 +09:00
Donny/강동윤
d13a397360
build(es/plugin): Fix Wasm build (#6181) 2022-10-17 20:17:29 +09:00
Donny/강동윤
ea4ae3dfbc
build(es/plugin): Fix Wasm build, really (#6180) 2022-10-17 20:06:08 +09:00
Donny/강동윤
7c40e44d3f
build(es/plugin): Fix Wasm build (#6179) 2022-10-17 19:30:28 +09:00
Donny/강동윤
cb8f3500b2
fix(es/plugin): Fix plugin on non x86_64 (#6178) 2022-10-17 09:36:26 +00:00
Donny/강동윤
899021e440
fix(es/plugin): Disable SIMD (#6163)
**Description:**

This PR disables SIMD for all hosts because wasmer cache is not portable.
2022-10-15 05:18:19 +00:00
Donny/강동윤
3c3529cb84
build(rustc): Update rustc (#5943)
**Description:**

This PR updates rustc, and fix some performance bugs of `swc_common`.
2022-09-24 03:33:47 +00:00
Donny/강동윤
2bbc9bd73b
refactor(es/plugin): Fix lints (#5801) 2022-09-10 12:50:54 +09:00
OJ Kwon
6f19f8902f
refactor(swc_core): enable bytechecked flag (#5792)
**Description:**

Another update to enable bytecheck rkyv feature flag.

Our dep tree is quite tangled with implicit enable (plugin -> rkyv). PR tries to detach some of it while trying to preserve existing behavior as much as it can.
2022-09-09 08:05:51 +00:00
OJ Kwon
a3e855f720
feat(es/plugin): Provide swc_core diagnostic from plugin (#5591) 2022-08-22 23:48:50 +00:00
OJ Kwon
d46418bb47
feat(es/plugin/runner): Add more traces for the plugin host (#5538) 2022-08-18 06:54:17 +09:00
OJ Kwon
4a9b1dde1a
fix(es/plugin/runner): Revert wasmer@3 (#5521) 2022-08-17 05:18:56 +00:00
OJ Kwon
3bdb39c0ee
fix(es/plugin/runner): Provide guest memory allocator for the sourcemap (#5517) 2022-08-17 00:25:40 +00:00
OJ Kwon
92f006c9a0
feat(es/plugin): Update wasmer to 3 (#5456) 2022-08-16 16:12:37 +09:00
OJ Kwon
ff7f6f63f9
fix(es/plugin): Share SourceFile for plugin transforms (#5475) 2022-08-15 00:45:19 +00:00
OJ Kwon
83417b6f75
refactor(bindings): Use published swc_core as interface (#5482) 2022-08-14 04:39:27 +00:00
OJ Kwon
d36e48efbf
build(plugin): Downgrade rkyv (#5459) 2022-08-12 14:04:05 +00:00
OJ Kwon
001607f341
feat(plugin): Add some tracing for plugin host (#5438) 2022-08-11 02:01:58 +00:00
OJ Kwon
5a164bd137
feat(plugin): Make metadata api lazy (#5310) 2022-07-27 13:16:44 +09:00
OJ Kwon
43eeeb35a5
feat(es/plugin): Pass experimental metadata from host (#5261) 2022-07-21 05:34:48 +00:00
OJ Kwon
cd94f0a2e9
test(es/plugin): Build plugins for e2e testing (#5210) 2022-07-15 02:10:13 +00:00
OJ Kwon
92c0153cb5
feat(plugin): Pass unresolved_mark to plugins (#5212) 2022-07-15 01:11:17 +00:00
OJ Kwon
f167198470
feat(plugin/macros): Export new interface for getting plugin schema version (#5166) 2022-07-11 01:44:00 +00:00
OJ Kwon
e8214babf5
refactor(plugin): Refactor transform executor (#5147) 2022-07-08 06:02:42 +00:00
OJ Kwon
82fbe15a57
feat(plugin): Wrap serialized struct with a version (#5128) 2022-07-07 07:46:49 +00:00
OJ Kwon
2ba8b39fa0
refactor(common): Bikeshed plugin apis (#5120) 2022-07-06 04:42:00 +00:00
OJ Kwon
b30032dd46
feat(plugin): Upgrade wasmer (#4929) 2022-06-10 12:54:17 +00:00
OJ Kwon
6bc33cb042
feat(es/codegen): Support other source map implementations (#4879) 2022-06-05 14:40:55 +00:00
OJ Kwon
a937357d47
feat(plugin): Implement SourceMap.span_to_* (#4781) 2022-05-25 02:09:55 +00:00
OJ Kwon
3298cb7906
feat(plugin): Implement more SourceMap apis (#4769) 2022-05-24 07:19:27 +00:00