feat(node-swc): Reduce binary size (#1418)

This commit is contained in:
LongYinan 2021-02-20 16:07:58 +08:00 committed by GitHub
parent db85d123b7
commit 9d896c746e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 25 deletions

View File

@ -13,6 +13,7 @@ env:
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
@ -25,6 +26,12 @@ jobs:
uses: actions/setup-node@v2
with:
node-version: 14
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
override: true
- name: Install node dependencies
run: npm i
@ -57,6 +64,7 @@ jobs:
run: |
choco install nodejs-lts --x86 -y --force
refreshenv
- name: Set 32bit NodeJS path
run: |
echo "C:\\Program Files (x86)\\nodejs" >> $GITHUB_PATH
@ -65,15 +73,12 @@ jobs:
- name: NodeJS arch
run: node -e "console.log(process.arch)"
- name: Install
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- name: Install i686 toolchain
run: rustup target add i686-pc-windows-msvc
target: i686-pc-windows-msvc
- name: Install node dependencies
run: npm i
@ -117,6 +122,7 @@ jobs:
run: |
docker pull docker.pkg.github.com/napi-rs/napi-rs/nodejs-rust:10-alpine
docker tag docker.pkg.github.com/napi-rs/napi-rs/nodejs-rust:10-alpine builder
- name: "Install dependencies"
run: npm i
@ -142,15 +148,12 @@ jobs:
with:
node-version: 14
- name: Install
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- name: Install aarch64 toolchain
run: rustup target add aarch64-apple-darwin
target: aarch64-apple-darwin
- name: Cache
uses: actions/cache@v2
@ -185,15 +188,12 @@ jobs:
with:
node-version: 14
- name: Install
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- name: Install aarch64 toolchain
run: rustup target add aarch64-unknown-linux-gnu
target: aarch64-unknown-linux-gnu
- name: Cache
uses: actions/cache@v2
@ -202,7 +202,6 @@ jobs:
target/
key: aarch64-linux-gnu-publish-integration
- name: Install cross compile toolchain
run: |
sudo apt-get update
@ -234,15 +233,12 @@ jobs:
with:
node-version: 14
- name: Install
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- name: Install aarch64 toolchain
run: rustup target add armv7-unknown-linux-gnueabihf
target: armv7-unknown-linux-gnueabihf
- name: Cache
uses: actions/cache@v2
@ -279,8 +275,12 @@ jobs:
with:
node-version: 14
- name: Install aarch64 toolchain
run: rustup target add aarch64-linux-android
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
override: true
target: aarch64-linux-android
- name: Install node dependencies
run: npm i

View File

@ -1,3 +1,5 @@
cargo-features = ["strip"]
[workspace]
members = ["ecmascript", "ecmascript/jsdoc", "native", "spack", "wasm"]
@ -55,6 +57,7 @@ name = "usage"
[profile.release]
codegen-units = 1
lto = true
strip = 'symbols'
# debug = true
# opt-level = 'z'

View File

@ -219,7 +219,7 @@ fn make_as_str(i: &DeriveInput) -> ItemImpl {
})),
_ => Box::new(
Quote::new(def_site::<Span>())
.quote_with(smart_quote!(Vars { qual_name }, { qual_name{..} }))
.quote_with(smart_quote!(Vars { qual_name }, { qual_name { .. } }))
.parse(),
),
};

View File

@ -1 +1 @@
nightly-2020-11-24
nightly-2021-02-19