refactor(bindings): Rename crates (#4337)

This commit is contained in:
Donny/강동윤 2022-04-15 22:47:44 +09:00 committed by GitHub
parent b8d9a58f13
commit 83a8f489ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
32 changed files with 94 additions and 111 deletions

View File

@ -32,7 +32,7 @@ jobs:
yarn build
- name: Print binary size
run: ls -al ./target/release/libnode*
run: ls -al ./target/release/libbinding*
benchmark:
name: Performance regression check
@ -71,7 +71,7 @@ jobs:
yarn
- name: Run benchmark
run: cargo bench --workspace --exclude swc_plugin --exclude wasm --exclude swc_cli --exclude node -- --output-format bencher | tee output.txt
run: cargo bench --workspace --exclude swc_plugin --exclude binding_core_wasm --exclude swc_cli --exclude binding_core_node -- --output-format bencher | tee output.txt
- name: Download previous benchmark results
run: mkdir raw-data && curl -o raw-data/benchmark-data.json https://raw.githubusercontent.com/swc-project/raw-data/gh-pages/benchmark-data.json

View File

@ -100,17 +100,16 @@ jobs:
os: ubuntu-latest
- crate: better_scoped_tls
os: ubuntu-latest
- crate: binding_core_node
os: ubuntu-latest
- crate: binding_core_wasm
os: ubuntu-latest
- crate: enum_kind
os: ubuntu-latest
- crate: from_variant
os: ubuntu-latest
- crate: jsdoc
os: ubuntu-latest
- crate: node
os: ubuntu-latest
check: |
cargo check --features plugin
cargo check --no-default-features --features plugin --features swc_v2
- crate: node_macro_deps
os: ubuntu-latest
- crate: preset_env_base
@ -162,6 +161,8 @@ jobs:
os: ubuntu-latest
- crate: swc_css_parser
os: windows-latest
- crate: swc_css_prefixer
os: ubuntu-latest
- crate: swc_css_utils
os: ubuntu-latest
- crate: swc_css_visit
@ -291,6 +292,8 @@ jobs:
os: windows-latest
- crate: swc_plugin_macro
os: ubuntu-latest
- crate: swc_plugin_proxy
os: ubuntu-latest
- crate: swc_plugin_runner
os: ubuntu-latest
- crate: swc_plugin_runner
@ -301,8 +304,6 @@ jobs:
os: ubuntu-latest
- crate: swc_plugin_testing
os: windows-latest
- crate: swc_css_prefixer
os: ubuntu-latest
- crate: swc_timer
os: ubuntu-latest
- crate: swc_trace_macro
@ -317,8 +318,6 @@ jobs:
os: ubuntu-latest
- crate: testing_macros
os: ubuntu-latest
- crate: wasm
os: ubuntu-latest
steps:
- name: Handle line endings

View File

@ -39,12 +39,12 @@ jobs:
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Build
run: (cd crates/wasm && wasm-pack build --release --scope=swc --target nodejs)
run: (cd crates/binding_core_wasm && wasm-pack build --release --scope=swc --target nodejs)
- name: Publish
run: |
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
(cd crates/wasm/pkg && npm publish --access public)
(cd crates/binding_core_wasm/pkg && npm publish --access public)
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
@ -77,17 +77,17 @@ jobs:
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Build
run: (cd crates/wasm && wasm-pack build --release --scope=swc --target web)
run: (cd crates/binding_core_wasm && wasm-pack build --release --scope=swc --target web)
- name: Rename
run: |
sed -i'' -e 's/"name": "@swc\/wasm"/"name": "@swc\/wasm-web"/g' package.json
working-directory: crates/wasm/pkg
working-directory: crates/binding_core_wasm/pkg
- name: Publish
run: |
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
(cd crates/wasm/pkg && npm publish --access public)
(cd crates/binding_core_wasm/pkg && npm publish --access public)
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

View File

@ -46,9 +46,9 @@ jobs:
- name: Build
run: |
(cd crates/wasm && yarn)
(cd crates/wasm && ./scripts/build.sh --features plugin)
(cd crates/binding_core_wasm && yarn)
(cd crates/binding_core_wasm && ./scripts/build.sh --features plugin)
- name: Test
run: |
(cd crates/wasm && ./scripts/test.sh)
(cd crates/binding_core_wasm && ./scripts/test.sh)

110
Cargo.lock generated
View File

@ -166,6 +166,61 @@ dependencies = [
"scoped-tls",
]
[[package]]
name = "binding_core_node"
version = "0.1.0"
dependencies = [
"anyhow",
"backtrace",
"napi",
"napi-build",
"napi-derive",
"node_macro_deps",
"path-clean",
"serde",
"serde_json",
"swc",
"swc_atoms",
"swc_bundler",
"swc_common",
"swc_ecma_ast",
"swc_ecma_lints",
"swc_ecma_loader",
"swc_ecma_parser",
"swc_node_base",
"swc_node_bundler",
"swc_plugin_runner",
"tracing",
"tracing-chrome",
"tracing-futures",
"tracing-subscriber",
"wasmer",
"wasmer-wasi",
]
[[package]]
name = "binding_core_wasm"
version = "1.2.165"
dependencies = [
"anyhow",
"console_error_panic_hook",
"js-sys",
"once_cell",
"parking_lot_core",
"path-clean",
"serde",
"serde_json",
"swc",
"swc_common",
"swc_ecma_lints",
"swc_ecmascript",
"swc_plugin_runner",
"tracing",
"wasm-bindgen",
"wasmer",
"wasmer-wasi",
]
[[package]]
name = "bitflags"
version = "1.3.2"
@ -1592,38 +1647,6 @@ version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54"
[[package]]
name = "node"
version = "0.1.0"
dependencies = [
"anyhow",
"backtrace",
"napi",
"napi-build",
"napi-derive",
"node_macro_deps",
"path-clean",
"serde",
"serde_json",
"swc",
"swc_atoms",
"swc_bundler",
"swc_common",
"swc_ecma_ast",
"swc_ecma_lints",
"swc_ecma_loader",
"swc_ecma_parser",
"swc_node_base",
"swc_node_bundler",
"swc_plugin_runner",
"tracing",
"tracing-chrome",
"tracing-futures",
"tracing-subscriber",
"wasmer",
"wasmer-wasi",
]
[[package]]
name = "node_macro_deps"
version = "0.1.0"
@ -4455,29 +4478,6 @@ version = "0.10.2+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6"
[[package]]
name = "wasm"
version = "1.2.165"
dependencies = [
"anyhow",
"console_error_panic_hook",
"js-sys",
"once_cell",
"parking_lot_core",
"path-clean",
"serde",
"serde_json",
"swc",
"swc_common",
"swc_ecma_lints",
"swc_ecmascript",
"swc_plugin_runner",
"tracing",
"wasm-bindgen",
"wasmer",
"wasmer-wasi",
]
[[package]]
name = "wasm-bindgen"
version = "0.2.79"

View File

@ -1,7 +1,8 @@
[workspace]
members = [
"crates/jsdoc",
"crates/node",
"crates/binding_core_node",
"crates/binding_core_wasm",
"crates/swc_cli",
"crates/swc_css",
"crates/swc_css_lints",
@ -18,25 +19,6 @@ members = [
"crates/swc_plugin_proxy",
"crates/swc_timer",
"crates/swc_webpack_ast",
"crates/wasm",
]
default-members = [
"crates/jsdoc",
"crates/swc_cli",
"crates/swc_css",
"crates/swc_css_lints",
"crates/swc_css_prefixer",
"crates/swc_ecmascript",
"crates/swc_ecma_lints",
"crates/swc_ecma_quote",
"crates/swc_estree_compat",
"crates/swc_plugin",
"crates/swc_plugin_macro",
"crates/swc_plugin_runner",
"crates/swc_plugin_testing",
"crates/swc_timer",
"crates/swc_webpack_ast",
]
[profile.release]

View File

@ -4,7 +4,7 @@ build = "build.rs"
edition = "2021"
exclude = ["artifacts.json", "index.node"]
license = "Apache-2.0"
name = "node"
name = "binding_core_node"
publish = false
version = "0.1.0"

View File

@ -3,7 +3,7 @@ authors = ["강동윤 <kdy1997.dev@gmail.com>"]
description = "wasm module for swc"
edition = "2021"
license = "Apache-2.0"
name = "wasm"
name = "binding_core_wasm"
publish = false
repository = "https://github.com/swc-project/swc.git"
version = "1.2.165"
@ -30,20 +30,20 @@ plugin = [
[dependencies]
anyhow = "1.0.42"
console_error_panic_hook = "0.1.6"
js-sys = { version = "0.3.56", optional = true }
js-sys = {version = "0.3.56", optional = true}
once_cell = "1.10.0"
parking_lot_core = "0.9.1"
path-clean = "0.1"
serde = { version = "1", features = ["derive"] }
serde = {version = "1", features = ["derive"]}
serde_json = "1"
swc = { path = "../swc" }
swc_common = { path = "../swc_common", features = ["perf"] }
swc_ecma_lints = { path = "../swc_ecma_lints", features = [
swc = {path = "../swc"}
swc_common = {path = "../swc_common", features = ["perf"]}
swc_ecma_lints = {path = "../swc_ecma_lints", features = [
"non_critical_lints",
] }
swc_ecmascript = { path = "../swc_ecmascript" }
swc_plugin_runner = { path = "../swc_plugin_runner", default-features = false, optional = true }
tracing = { version = "0.1.32", features = ["release_max_level_off"] }
wasm-bindgen = { version = "0.2", features = ["serde-serialize"] }
wasmer = { version = "2.2.1", optional = true, default-features = false }
wasmer-wasi = { version = "2.2.1", optional = true, default-features = false }
]}
swc_ecmascript = {path = "../swc_ecmascript"}
swc_plugin_runner = {path = "../swc_plugin_runner", default-features = false, optional = true}
tracing = {version = "0.1.32", features = ["release_max_level_off"]}
wasm-bindgen = {version = "0.2", features = ["serde-serialize"]}
wasmer = {version = "2.2.1", optional = true, default-features = false}
wasmer-wasi = {version = "2.2.1", optional = true, default-features = false}

View File

@ -59,8 +59,8 @@
"pack": "wasm-pack",
"build:ts": "tsc -d",
"build:wasm": "npm-run-all \"pack -- build ./crates/wasm --scope swc {1} -t {2} --features plugin\" --",
"build": "tsc -d && napi build --platform --cargo-name node --js ./node-swc/src/binding.js --dts ./node-swc/src/binding.d.ts -p node --release",
"build:dev": "tsc -d && napi build --platform --cargo-name node --js ./node-swc/src/binding.js --dts ./node-swc/src/binding.d.ts -p node",
"build": "tsc -d && napi build --platform --cargo-name binding_core_node --js ./node-swc/src/binding.js --dts ./node-swc/src/binding.d.ts -p binding_core_node --release",
"build:dev": "tsc -d && napi build --platform --cargo-name binding_core_node --js ./node-swc/src/binding.js --dts ./node-swc/src/binding.d.ts -p binding_core_node",
"test": "cross-env NODE_OPTIONS='--experimental-vm-modules' jest node-swc/__tests__",
"version": "napi version -p scripts/npm"
},

View File

@ -13,7 +13,7 @@ crates=$(\
)
# yq query syntax is weird, so we have to use jq
json_str="$(yq -o=json tests.yml)"
json_str="$(yq -o=json $SCRIPT_DIR/tests.yml)"
for crate in $crates
do

View File

@ -11,6 +11,8 @@ os:
- swc_ecma_preset_env
- swc_ecma_transforms_module
- swc_ecma_transforms_testing
- swc_html_codegen
- swc_html_parser
- swc_node_bundler
- swc_plugin
- swc_plugin_runner