Skip to content

Commit 713a5e3

Browse files
authored
[JS] Remove extra files from package (#138)
Make the package smaller. Fix CI issues: rust-lang/rust#131477 The PR doesn't directly mention undefined N-API symbols. But the fact that the runner image updated Rust from 1.90 to 1.91, and that's when the linking failures started, is compelling evidence. The fix I added (the -undefined dynamic_lookup flags) is the correct solution regardless - it's been the standard approach for N-API addons on macOS for years. Why the linker flags are now needed: 1. GitHub Actions runner image update: The macos-15-arm64 runner image was updated from version 20251021.0066 (used in Oct 26 successful build) to 20251104.0104 (used in Nov 7 failed builds) 2. Rust version upgrade: The runner image update included Rust 1.90.0 → 1.91.0 3. Rust 1.91 macOS linking changes: Rust 1.91 rust-lang/rust#131477 via the SDKROOT environment variable. This appears to have made the linker stricter about undefined symbols in cdylibs. 4. The fix: Adding -undefined dynamic_lookup linker flags for macOS targets is the standard solution for N-API native addons, as these symbols are intentionally undefined and resolved at runtime by Node.js. The flags tell the macOS linker to allow these undefined symbols.
1 parent 7b02bfd commit 713a5e3

File tree

4 files changed

+42
-8
lines changed

4 files changed

+42
-8
lines changed

.github/workflows/JS_build_test_publish.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ jobs:
4343
- host: macos-latest
4444
target: x86_64-apple-darwin
4545
build: |
46-
set -eu
46+
set -eux
47+
rustc --version
4748
yarn build --target x86_64-apple-darwin
4849
yarn build:ts
4950
- host: windows-latest
@@ -78,7 +79,9 @@ jobs:
7879
target: aarch64-unknown-linux-musl
7980
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
8081
build: |-
81-
set -eu
82+
set -eux
83+
rustc --version
84+
rustup update stable
8285
rustc --version
8386
npm install -g corepack
8487
corepack enable
Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
[target.aarch64-unknown-linux-musl]
22
linker = "aarch64-linux-musl-gcc"
33
rustflags = ["-C", "target-feature=-crt-static"]
4+
45
[target.x86_64-pc-windows-msvc]
5-
rustflags = ["-C", "target-feature=+crt-static"]
6+
rustflags = ["-C", "target-feature=+crt-static"]
7+
8+
[target.x86_64-apple-darwin]
9+
rustflags = ["-C", "link-arg=-undefined", "-C", "link-arg=dynamic_lookup"]
10+
11+
[target.aarch64-apple-darwin]
12+
rustflags = ["-C", "link-arg=-undefined", "-C", "link-arg=dynamic_lookup"]

js/optify-config/.npmignore

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,37 @@
1+
# Rust build artifacts and source
12
target
23
Cargo.lock
4+
Cargo.toml
35
.cargo
6+
build.rs
7+
src/*.rs
8+
rustfmt.toml
9+
10+
# Development and CI/CD
411
.github
5-
npm
12+
.claude
13+
.vscode
14+
.nvmrc
15+
.yarnrc.yml
616
.eslintrc
717
.prettierignore
8-
rustfmt.toml
18+
renovate.json
19+
20+
# Package management
21+
npm
922
yarn.lock
10-
*.node
1123
.yarn
24+
25+
# Tests
1226
__test__
13-
renovate.json
27+
tests
28+
jest.config.js
29+
30+
# TypeScript config
31+
tsconfig.json
32+
33+
# Native bindings (users will download platform-specific ones)
34+
*.node
35+
36+
# TypeScript source (use compiled dist/ instead)
37+
src/*.ts

js/optify-config/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@optify/config",
3-
"version": "1.1.3",
3+
"version": "1.1.4",
44
"description": "Simplifies **configuration driven development**: getting the right configuration options for a process or request using pre-loaded configurations from files (JSON, YAML, etc.) to manage options for feature flags, experiments, or flights.",
55
"repository": {
66
"type": "git",

0 commit comments

Comments
 (0)