Skip to content

Commit

Permalink
feat: add swc plugin for react server component
Browse files Browse the repository at this point in the history
  • Loading branch information
ClarkXia committed Sep 15, 2023
1 parent 09fcc74 commit 73db784
Show file tree
Hide file tree
Showing 15 changed files with 528 additions and 57 deletions.
89 changes: 45 additions & 44 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ members = [
"packages/remove-export",
"packages/keep-platform",
"packages/keep-export",
"packages/node-transform"
"packages/node-transform",
"packages/react-server-component"
]

[profile.release]
Expand Down
6 changes: 3 additions & 3 deletions packages/keep-export/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ serde = "1"
fxhash= "0.2.1"
easy-error = "1.0.0"
tracing = { version="0.1.34", features = ["release_max_level_info"] }
swc_core = {version = "0.79.56", features = [
swc_core = {version = "0.83.10", features = [
"ecma_plugin_transform",
"ecma_utils",
"ecma_visit",
"ecma_ast",
"common",
]}
swc_common = { version = "0.31.18", features = ["concurrent"] }
swc_common = { version = "0.32.1", features = ["concurrent"] }
serde_json = {version = "1", features = ["unbounded_depth"]}

[dev-dependencies]
testing = "0.33.21"
testing = "0.34.1"
6 changes: 3 additions & 3 deletions packages/keep-platform/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ fxhash= "0.2.1"
lazy_static = "1.4.0"
easy-error = "1.0.0"
tracing = { version="0.1.34", features = ["release_max_level_info"] }
swc_core = { version = "0.79.56", features = [
swc_core = { version = "0.83.10", features = [
"ecma_plugin_transform",
"ecma_utils",
"ecma_visit",
"ecma_ast",
"common",
]}
swc_common = { version = "0.31.18", features = ["concurrent"] }
swc_common = { version = "0.32.1", features = ["concurrent"] }
serde_json = {version = "1", features = ["unbounded_depth"]}

[dev-dependencies]
testing = "0.33.21"
testing = "0.34.1"
6 changes: 3 additions & 3 deletions packages/node-transform/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ serde = "1"
fxhash= "0.2.1"
easy-error = "1.0.0"
tracing = { version="0.1.34", features = ["release_max_level_info"] }
swc_core = { version = "0.79.56", features = [
swc_core = { version = "0.83.10", features = [
"ecma_plugin_transform",
"ecma_utils",
"ecma_visit",
"ecma_ast",
"common",
]}
swc_common = { version = "0.31.18", features = ["concurrent"] }
swc_common = { version = "0.32.1", features = ["concurrent"] }
serde_json = {version = "1", features = ["unbounded_depth"]}

[dev-dependencies]
testing = "0.33.21"
testing = "0.34.1"
4 changes: 4 additions & 0 deletions packages/react-server-component/.cargo/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# These command aliases are not final, may change
[alias]
# Alias to build actual plugin binary for the specified target.
prepublish = "build --target wasm32-wasi"
25 changes: 25 additions & 0 deletions packages/react-server-component/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[package]
name = "swc_plugin_react_server_component"
version = "0.1.0"
edition = "2021"

[lib]
crate-type = ["cdylib", "rlib"]

[dependencies]
serde = "1"
fxhash= "0.2.1"
easy-error = "1.0.0"
tracing = { version="0.1.34", features = ["release_max_level_info"] }
swc_core = { version = "0.83.10", features = [
"ecma_plugin_transform",
"ecma_utils",
"ecma_visit",
"ecma_ast",
"common"
]}
swc_common = { version = "0.32.1", features = ["concurrent"] }
serde_json = {version = "1", features = ["unbounded_depth"]}

[dev-dependencies]
testing = "0.34.1"
13 changes: 13 additions & 0 deletions packages/react-server-component/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "@ice/swc-plugin-react-server-component",
"version": "0.1.0",
"license": "MIT",
"keywords": ["swc-plugin"],
"main": "swc_plugin_react_server_component.wasm",
"scripts": {
"prepublishOnly": "cargo prepublish --release && cp ../../target/wasm32-wasi/release/swc_plugin_react_server_component.wasm ."
},
"publishConfig": {
"access": "public"
}
}
Loading

0 comments on commit 73db784

Please sign in to comment.