You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/js-host-api/README.md
+11-2Lines changed: 11 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -664,10 +664,19 @@ To create an npm token:
664
664
665
665
### Package Structure
666
666
667
-
The npm release consists of three packages:
667
+
The npm release consists of the following packages:
668
668
669
669
| Package | Description |
670
670
|---------|-------------|
671
671
|`@hyperlight/js-host-api`| Main package (installs correct binary automatically) |
672
-
|`@hyperlight/js-host-api-linux-x64-gnu`| Linux x86_64 native binary |
672
+
|`@hyperlight/js-host-api-linux-x64-gnu`| Linux x86_64 (glibc) native binary |
673
+
|`@hyperlight/js-host-api-linux-x64-musl`| Linux x86_64 (musl/Alpine) native binary |
673
674
|`@hyperlight/js-host-api-win32-x64-msvc`| Windows x86_64 native binary |
675
+
676
+
### How Platform Selection Works
677
+
678
+
This project uses the [napi-rs](https://napi.rs/docs/deep-dive/release#3-the-native-addon-for-different-platforms-is-distributed-through-different-npm-packages) approach for distributing native addons across platforms. Each platform-specific binary is published as a separate npm package and listed as an `optionalDependency` of the main package.
679
+
680
+
**At install time:** npm uses the `os`, `cpu`, and `libc` fields in each platform sub-package's `package.json` to determine which optional dependency to install. Packages that don't match the user's platform are silently skipped. The main package itself does **not** have `os`/`cpu` fields because it contains only JavaScript — restricting it would prevent installation on unsupported platforms even for type-checking or development purposes.
681
+
682
+
**At runtime:** The napi-rs generated `index.js` detects the platform (including glibc vs musl on Linux) and loads the correct `.node` binary.
0 commit comments