reqlanOverviewIdeasFilesCode filesClustersAttributesGraphPrint

Printable idea sheet

native_host_binary_development

reqlan rq/distribution/native_host_binary.rq:29

Katz 0.078

Use this procedure on a developer machine ( F5 and `pnpm run build` ).
Identify the host from `process.platform` and `process.arch` of the build process.
The build process and the extension host must be the same machine.
Copy the matching `.node` file to `packages/extension/native/reqlan_napi.node`.
Write `packages/extension/native/target.json` with the host tuple.
If the binary is not present, build it with `cargo build -p reqlan-napi -p reqlan-lsp --release`.
At run time, search in this order:
1. The `native/` folder of the extension, if `target.json` records the host tuple.
2. The resolved `main` of the host npm package ( `createRequire` from `@reqlan/analytical/package.json` ).
3. The host file in `packages/analytical-native/<napiSuffix>/` ( workspace package directory, same layout as a published package ).
4. The host npm package name.
5. `crates/target/<rustTarget>/release` and `crates/target/release`.
6. The debug folders with the same names.
Do not search packages for other platforms.
If `target.json` records a different tuple, do not load `native/reqlan_napi.node`.
Windows cargo emits `reqlan_napi.dll`; the loader uses `process.dlopen` for `.dll` and `.node` ( Node `require` only loads `.node` ).
Windows UI with a WSL extension host uses the linux tuple ( native_host_binary ).
Windows UI with a Windows extension host cannot load a `.node` staged from WSL; restage on Windows or open the folder in a WSL remote window.
Before tests, the workspace host package must contain the `.node` so loaders behave like production ( native_host_binary_distributed ). `scripts/ensure-host-native.mjs` uses an existing matrix binary, or cargo locally.
Azure compiles the native_targets matrix from git and stages those artifacts; it does not fetch binaries from npm.
Detail: extension_host_native_stage.
Implementation: stage-host-native.mjs, ensure-host-native.mjs, index.ts.

status
done
tests
load-native.test.ts, native-packaging.test.ts

Interactive page: native_host_binary_development