nikaia bind js writes the WebAssembly library’s .js and .d.tsOpen and answer this issue on GitHub.
targets, blocked · opened 2026-11-19 · updated 2026-11-19 · 0 comments
nikaia bind js writes the JavaScript binding of a library: the WebAssembly build’s <package>.js and <package>.d.ts (ADR-284 D26, D28). This is the only part of “A binding is a generated file over the C library” (#112) that is not built. #112 is closed, and this issue carries the rest.
Found while tidying up “A library for other languages” (#88). Needs #111
nikaia bind python, nikaia bind node and nikaia bind java are built. cli_commands_bind_refusal in crates/nikaia-std/src/compiler/cli_commands.nika lets only these three through. For js it says: nikaia bind js is not built: python, node and java are (ADR-284 D26, D28, D34). JavaScript in a browser is served by the WebAssembly build, which is not built yet..js and .d.ts themselves come from the WebAssembly library: target = "wasm32-unknown" with artifact = "c-library" (D22, D23, D24). That generator is part of “A WebAssembly library is the same entry point on another target” (#111), which is not built and waits on “WebAssembly: where a parser’s hash keys come from” (#276). nikaia-std does not build for wasm32-unknown-unknown today (polling refuses the target).ADR-284 D26: nikaia bind js is D22’s .js and .d.ts. D28: JavaScript is served by the WebAssembly build; nikaia bind node stays the native shim for file and socket access. D29: a binding never widens what the library exports. No new decision is needed.
cli_commands_bind_refusal accepts js. nikaia bind js on a c-library package builds the package for wasm32-unknown and leaves <package>.js and <package>.d.ts beside the .wasm in target/nikaia/c-library/, carrying the ledger hash as the header does (D26). Whether this sets the target itself or refuses without target = "wasm32-unknown" is the builder’s choice; the refusal, if chosen, names the setting.
Test: tests/compiler/tests/bind_js_writes_the_wasm_librarys_js_and_dts.nika with .stdout, in the style of bind_java_writes_a_class_per_handle_and_a_record_per_struct.nika. It binds a small package and prints the exported names in the .d.ts.nikaia bind --help and the refusal text in cli_commands_bind_refusal name js among the built languages.nikaia bind js on a c-library package writes <package>.js and <package>.d.ts with the package’s entry points, and the test in item 1 shows them. The commit of item 1 carries Fixes #N. The report gives one Found: line per finding.
crates/nikaia-std/src/compiler/cli_commands.nika, crates/nikaia-std/src/compiler/project_drive.nika (the bind dispatch), and their lowered files..js generator itself, which #111 builds.