2021-08-25 18:07:09 +03:00
|
|
|
[package]
|
2022-08-11 12:52:44 +03:00
|
|
|
authors = ["강동윤 <kdy1997.dev@gmail.com>"]
|
|
|
|
description = "Runner for swc plugins. This crate is INTERNAL crate and used by swc itself."
|
2021-08-25 18:07:09 +03:00
|
|
|
documentation = "https://rustdoc.swc.rs/swc_plugin_runner/"
|
2022-08-11 12:52:44 +03:00
|
|
|
edition = "2021"
|
|
|
|
license = "Apache-2.0"
|
|
|
|
name = "swc_plugin_runner"
|
|
|
|
repository = "https://github.com/swc-project/swc.git"
|
2023-08-16 21:04:14 +03:00
|
|
|
version = "0.98.17"
|
2021-08-25 18:07:09 +03:00
|
|
|
|
2022-04-04 14:12:03 +03:00
|
|
|
[lib]
|
2023-06-21 18:38:46 +03:00
|
|
|
bench = false
|
|
|
|
doctest = false
|
2022-04-04 14:12:03 +03:00
|
|
|
|
2022-03-17 08:07:03 +03:00
|
|
|
[features]
|
2023-04-10 06:40:25 +03:00
|
|
|
default = ["filesystem_cache", "plugin_transform_host_native"]
|
|
|
|
plugin_transform_host_js = [
|
|
|
|
"wasmer/js-default",
|
|
|
|
"wasmer-wasix/js-default",
|
|
|
|
"wasmer-compiler-cranelift/wasm",
|
|
|
|
]
|
|
|
|
plugin_transform_host_native = [
|
|
|
|
"wasmer/default",
|
2023-04-10 07:54:08 +03:00
|
|
|
"wasmer-wasix/sys",
|
|
|
|
"wasmer-wasix/logging",
|
|
|
|
"wasmer-wasix/host-fs",
|
|
|
|
"wasmer-wasix/sys-poll",
|
|
|
|
"wasmer-wasix/sys-thread",
|
|
|
|
"wasmer-wasix/host-threads",
|
2023-04-10 06:40:25 +03:00
|
|
|
"wasmer-compiler-cranelift/default",
|
|
|
|
]
|
2023-06-08 05:19:07 +03:00
|
|
|
plugin_transform_host_native_shared_runtime = [
|
|
|
|
"tokio",
|
|
|
|
"wasmer-wasix/webc_runner",
|
|
|
|
]
|
|
|
|
|
2022-03-23 10:12:59 +03:00
|
|
|
# Supports a cache allow to store compiled bytecode into filesystem location.
|
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 10:05:39 +03:00
|
|
|
# This feature implies in-memory cache support. This is not supported on wasm32 target.
|
|
|
|
filesystem_cache = ["wasmer-cache"]
|
2022-08-11 12:52:44 +03:00
|
|
|
plugin_transform_schema_v1 = ["swc_common/plugin_transform_schema_v1"]
|
|
|
|
plugin_transform_schema_vtest = ["swc_common/plugin_transform_schema_vtest"]
|
2022-03-17 08:07:03 +03:00
|
|
|
|
2022-12-02 13:14:46 +03:00
|
|
|
# Enable ECMASCript support
|
|
|
|
ecma = ["swc_ecma_ast/rkyv-impl"]
|
|
|
|
# Enable CSS support
|
|
|
|
css = ["swc_css_ast/rkyv-impl"]
|
|
|
|
|
2023-04-13 08:49:58 +03:00
|
|
|
__rkyv = []
|
2022-12-02 13:14:46 +03:00
|
|
|
rkyv-impl = ["__rkyv", "swc_common/plugin-rt", "swc_plugin_proxy/plugin-rt"]
|
2022-09-09 11:05:51 +03:00
|
|
|
|
2021-08-25 18:07:09 +03:00
|
|
|
[dependencies]
|
2023-06-22 10:40:41 +03:00
|
|
|
anyhow = "1.0.71"
|
2023-06-22 16:37:35 +03:00
|
|
|
enumset = "1.1.2"
|
2023-06-24 04:28:50 +03:00
|
|
|
futures = { version = "0.3" }
|
2023-06-22 10:40:41 +03:00
|
|
|
once_cell = "1.18.0"
|
|
|
|
parking_lot = "0.12.1"
|
2023-04-10 06:40:25 +03:00
|
|
|
serde = { version = "1.0.126", features = ["derive"] }
|
|
|
|
serde_json = "1.0.64"
|
2023-06-08 05:19:07 +03:00
|
|
|
tokio = { version = "1", default-features = false, optional = true }
|
2023-06-22 10:40:41 +03:00
|
|
|
tracing = "0.1.37"
|
2023-06-24 04:28:50 +03:00
|
|
|
wasmer = { version = "4.0.0", default-features = false }
|
|
|
|
wasmer-wasix = { version = "0.9.0", default-features = false }
|
2023-03-24 07:46:42 +03:00
|
|
|
|
2023-08-16 21:04:14 +03:00
|
|
|
swc_common = { version = "0.31.21", path = "../swc_common", features = [
|
2022-08-11 12:52:44 +03:00
|
|
|
"concurrent",
|
2022-04-07 08:39:57 +03:00
|
|
|
] }
|
2023-08-16 21:04:14 +03:00
|
|
|
swc_css_ast = { version = "0.137.21", path = "../swc_css_ast", optional = true }
|
|
|
|
swc_ecma_ast = { version = "0.107.7", path = "../swc_ecma_ast", optional = true }
|
|
|
|
swc_plugin_proxy = { version = "0.36.7", path = "../swc_plugin_proxy" }
|
2023-03-24 07:46:42 +03:00
|
|
|
|
2022-03-16 01:45:40 +03:00
|
|
|
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
2023-06-24 04:28:50 +03:00
|
|
|
wasmer-cache = { version = "4.0.0", optional = true }
|
|
|
|
wasmer-compiler-cranelift = { version = "4.0.0", default-features = false }
|
2021-08-25 18:07:09 +03:00
|
|
|
|
|
|
|
[dev-dependencies]
|
2023-06-22 10:40:41 +03:00
|
|
|
criterion = "0.5"
|
2023-03-24 07:46:42 +03:00
|
|
|
|
2023-07-20 08:57:51 +03:00
|
|
|
swc_atoms = { version = "0.5.8", path = '../swc_atoms' }
|
2023-08-16 21:04:14 +03:00
|
|
|
swc_css_ast = { version = "0.137.21", path = "../swc_css_ast", features = [
|
2022-12-02 15:45:17 +03:00
|
|
|
"rkyv-impl",
|
|
|
|
] }
|
2023-08-16 21:04:14 +03:00
|
|
|
swc_css_parser = { version = "0.146.24", path = "../swc_css_parser" }
|
|
|
|
swc_ecma_ast = { version = "0.107.7", path = "../swc_ecma_ast", features = [
|
2022-12-02 13:14:46 +03:00
|
|
|
"rkyv-impl",
|
|
|
|
] }
|
2023-08-16 21:04:14 +03:00
|
|
|
swc_ecma_loader = { version = "0.43.23", path = "../swc_ecma_loader" }
|
|
|
|
swc_ecma_parser = { version = "0.137.15", path = "../swc_ecma_parser" }
|
|
|
|
swc_ecma_visit = { version = "0.93.7", path = "../swc_ecma_visit" }
|
2022-12-02 15:45:17 +03:00
|
|
|
swc_node_base = { version = "0.5.8", path = "../swc_node_base" }
|
2023-08-16 21:04:14 +03:00
|
|
|
testing = { version = "0.33.24", path = "../testing" }
|
2022-04-22 08:52:55 +03:00
|
|
|
|
|
|
|
[[bench]]
|
|
|
|
harness = false
|
2022-12-02 13:14:46 +03:00
|
|
|
name = "ecma_invoke"
|