A Zig library for talking to USB and Bluetooth HID devices on Linux, FreeBSD, Windows and macOS, without linking the C hidapi

serve the api documentation from a build step

Reading the generated documentation locally required a web server, and the README told the reader to find one: the viewer fetches sources.tar and main.wasm at runtime, and a browser refuses both from a file:// page, so opening index.html gives an empty page. `zig build docs-serve` now builds the pages and serves them at http://127.0.0.1:8000/, with -Ddocs-port=N for another port. This is the same reason `zig std` runs a server rather than opening a file. The server is tools/docs_server.zig, copied from z46, which has the same problem and solved it first. It serves one directory to one person on the loopback interface: a thread per connection, because a browser opens several at once and holds some open without sending anything, so a server that reads them one at a time blocks on a speculative connection and never answers the real requests. Requests containing .. or an absolute path are refused, and the MIME table covers what autodoc emits, which is what makes main.wasm load at all. It is built for b.graph.host rather than the -Dtarget the library is built for, since it runs on the machine doing the build. Its own test is attached to the test step, so `zig build test` now runs 8 tests over two binaries rather than 7 over one. tools was added to the package paths so the file ships with the package, as it does in z46. Checked by serving on port 8123 and requesting through it: / and /index.html return the page as text/html, main.wasm as application/wasm, sources.tar as application/x-tar, a missing file gives 404, a query string is stripped, and /../build.zig does not escape the documentation directory. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011JRTRSt3F4KkHY7ip2MgEk


Author jcollie.dev
Co-author Claude Opus 5 (1M context) Date Commit Parent c9eac2c0
+215 -3
4 changed files
+215 -3
4 changed files