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
@@ -634,10 +634,19 @@ To create an npm token:
634
634
635
635
### Package Structure
636
636
637
-
The npm release consists of three packages:
637
+
The npm release consists of the following packages:
638
638
639
639
| Package | Description |
640
640
|---------|-------------|
641
641
|`@hyperlight/js-host-api`| Main package (installs correct binary automatically) |
642
-
|`@hyperlight/js-host-api-linux-x64-gnu`| Linux x86_64 native binary |
642
+
|`@hyperlight/js-host-api-linux-x64-gnu`| Linux x86_64 (glibc) native binary |
643
+
|`@hyperlight/js-host-api-linux-x64-musl`| Linux x86_64 (musl/Alpine) native binary |
643
644
|`@hyperlight/js-host-api-win32-x64-msvc`| Windows x86_64 native binary |
645
+
646
+
### How Platform Selection Works
647
+
648
+
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.
649
+
650
+
**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.
651
+
652
+
**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