Skip to content

Commit 9d896c7

Browse files
author
LongYinan
authored
feat(node-swc): Reduce binary size (#1418)
1 parent db85d12 commit 9d896c7

File tree

4 files changed

+28
-25
lines changed

4 files changed

+28
-25
lines changed

.github/workflows/publish-node.yml

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ env:
1313
jobs:
1414
build:
1515
strategy:
16+
fail-fast: false
1617
matrix:
1718
os: [ubuntu-latest, macos-latest, windows-latest]
1819

@@ -25,6 +26,12 @@ jobs:
2526
uses: actions/setup-node@v2
2627
with:
2728
node-version: 14
29+
30+
- name: Install Rust
31+
uses: actions-rs/toolchain@v1
32+
with:
33+
profile: minimal
34+
override: true
2835

2936
- name: Install node dependencies
3037
run: npm i
@@ -57,6 +64,7 @@ jobs:
5764
run: |
5865
choco install nodejs-lts --x86 -y --force
5966
refreshenv
67+
6068
- name: Set 32bit NodeJS path
6169
run: |
6270
echo "C:\\Program Files (x86)\\nodejs" >> $GITHUB_PATH
@@ -65,15 +73,12 @@ jobs:
6573
- name: NodeJS arch
6674
run: node -e "console.log(process.arch)"
6775

68-
- name: Install
76+
- name: Install Rust
6977
uses: actions-rs/toolchain@v1
7078
with:
71-
toolchain: stable
7279
profile: minimal
7380
override: true
74-
75-
- name: Install i686 toolchain
76-
run: rustup target add i686-pc-windows-msvc
81+
target: i686-pc-windows-msvc
7782

7883
- name: Install node dependencies
7984
run: npm i
@@ -117,6 +122,7 @@ jobs:
117122
run: |
118123
docker pull docker.pkg.github.com/napi-rs/napi-rs/nodejs-rust:10-alpine
119124
docker tag docker.pkg.github.com/napi-rs/napi-rs/nodejs-rust:10-alpine builder
125+
120126
- name: "Install dependencies"
121127
run: npm i
122128

@@ -142,15 +148,12 @@ jobs:
142148
with:
143149
node-version: 14
144150

145-
- name: Install
151+
- name: Install Rust
146152
uses: actions-rs/toolchain@v1
147153
with:
148-
toolchain: stable
149154
profile: minimal
150155
override: true
151-
152-
- name: Install aarch64 toolchain
153-
run: rustup target add aarch64-apple-darwin
156+
target: aarch64-apple-darwin
154157

155158
- name: Cache
156159
uses: actions/cache@v2
@@ -185,15 +188,12 @@ jobs:
185188
with:
186189
node-version: 14
187190

188-
- name: Install
191+
- name: Install Rust
189192
uses: actions-rs/toolchain@v1
190193
with:
191-
toolchain: stable
192194
profile: minimal
193195
override: true
194-
195-
- name: Install aarch64 toolchain
196-
run: rustup target add aarch64-unknown-linux-gnu
196+
target: aarch64-unknown-linux-gnu
197197

198198
- name: Cache
199199
uses: actions/cache@v2
@@ -202,7 +202,6 @@ jobs:
202202
target/
203203
key: aarch64-linux-gnu-publish-integration
204204

205-
206205
- name: Install cross compile toolchain
207206
run: |
208207
sudo apt-get update
@@ -234,15 +233,12 @@ jobs:
234233
with:
235234
node-version: 14
236235

237-
- name: Install
236+
- name: Install Rust
238237
uses: actions-rs/toolchain@v1
239238
with:
240-
toolchain: stable
241239
profile: minimal
242240
override: true
243-
244-
- name: Install aarch64 toolchain
245-
run: rustup target add armv7-unknown-linux-gnueabihf
241+
target: armv7-unknown-linux-gnueabihf
246242

247243
- name: Cache
248244
uses: actions/cache@v2
@@ -279,8 +275,12 @@ jobs:
279275
with:
280276
node-version: 14
281277

282-
- name: Install aarch64 toolchain
283-
run: rustup target add aarch64-linux-android
278+
- name: Install Rust
279+
uses: actions-rs/toolchain@v1
280+
with:
281+
profile: minimal
282+
override: true
283+
target: aarch64-linux-android
284284

285285
- name: Install node dependencies
286286
run: npm i

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
cargo-features = ["strip"]
2+
13
[workspace]
24
members = ["ecmascript", "ecmascript/jsdoc", "native", "spack", "wasm"]
35

@@ -55,6 +57,7 @@ name = "usage"
5557
[profile.release]
5658
codegen-units = 1
5759
lto = true
60+
strip = 'symbols'
5861
# debug = true
5962
# opt-level = 'z'
6063

macros/string_enum/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ fn make_as_str(i: &DeriveInput) -> ItemImpl {
219219
})),
220220
_ => Box::new(
221221
Quote::new(def_site::<Span>())
222-
.quote_with(smart_quote!(Vars { qual_name }, { qual_name{..} }))
222+
.quote_with(smart_quote!(Vars { qual_name }, { qual_name { .. } }))
223223
.parse(),
224224
),
225225
};

rust-toolchain

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
nightly-2020-11-24
1+
nightly-2021-02-19

0 commit comments

Comments
 (0)