Repository navigation
userid 2.0: prebuilt binaries, TypeScript, ESM, installs everywhere - #9
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n Windows Native (src/userid.cc, replaces six files): - node-addon-api 8, Node-API 8, so one binary loads on every Node.js version - reentrant *_r lookups with growing buffers: safe from worker threads - ids validated as integers in [0, 2^32) (RangeError); names with null bytes rejected; gids always unsigned and never duplicated - not-found errors carry code ERR_USERID_NOT_FOUND; system errors carry errno + syscall, which the wrapper turns into Node-style code/message JavaScript (lib/, compiled to dist/): - TypeScript, with ES module and CommonJS entry points via an exports map - loads prebuilt binaries via node-gyp-build (drops bindings) - Windows: installs without building; isSupported is false and every lookup throws ERR_USERID_UNSUPPORTED_PLATFORM Tooling: Bun (bun.lock) for install, node:test with Node's type stripping (replaces mocha/should/ts-node/nyc), a curated clang-tidy config that fails on warnings, publint + attw for the package shape. Node.js >= 22.12. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Prebuilds (prebuildify) for linux x64/arm64 (glibc 2.31 and musl), linux armv7, darwin arm64/x64, and freebsd x64, packed into one tarball. That tarball is installed by npm, pnpm and Bun on Linux, macOS (arm64 and Intel), Windows, Alpine and armv7, with no compiler, and the full test suite runs against the installed copy. Bun matters most: it skips dependency install scripts, so it only works with prebuilds. The release workflow now publishes that exact tarball. Dependabot replaces the old weekly update job. Based on the prebuild matrix in #8. Co-Authored-By: Matthew Hershberger <247648+matthewh@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pnpm 11+ fails `pnpm add` (ERR_PNPM_IGNORED_BUILDS) for any dependency with an install script, even one that does nothing because a prebuild exists, and treats a shipped binding.gyp the same way. So the package now ships only dist/ and prebuilds/: - no install script, gypfile false; node-addon-api is a dev dependency - the native sources and binding.gyp live in native/, so no package manager auto-builds the repo root (Bun did, breaking Windows dev) - build:native is prebuildify, so dev, CI and releases build one way - platforms without a prebuild get ERR_USERID_NO_PREBUILT_BINARY with a pointer to building from source; the smoke test checks that - new prebuilds and emulated consumer tests: linux ppc64le, s390x Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s prebuildify headers There's no node:22-bullseye image for ppc64le or s390x (and no Node.js image at all for s390x), so those build in debian:bullseye with the official Node.js 22 tarball (scripts/ci-install-node.sh), keeping glibc 2.31 like the other Linux prebuilds. clang-tidy looked for headers in node-gyp's cache, but prebuildify downloads them to its own (tmpdir/prebuildify), for a version it picks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Debian 11's Docker images have dropped ppc64le and s390x too. Ubuntu 20.04 has both, with the same glibc 2.31. The runner's clang-tidy (newer than 18) adds misc-const-correctness, which misfires on an out-parameter of the *_r lookups (disabled), and prefers #ifdef (done). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
prebuildify defaults to the newest Node.js headers (26.0.0), whose common.gypi passes -std=gnu++20, which Ubuntu 20.04's gcc 9 rejects. Under Node-API the binary is the same either way, so pin the target to our engines floor: reproducible, and kinder to older compilers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Static libstdc++ made each Linux binary ~5x bigger (316 kB vs 60 kB on x64, an 824 kB tarball) and less portable, not more: it pulled in the build machine's newest glibc symbols. Dynamically linked, the binary needs only GLIBC_2.14 and GLIBCXX_3.4.21, far older than what Node.js 22 itself requires. scripts/check-prebuilds.sh reads each glibc prebuild's symbol versions (readelf, any architecture) and fails CI past Node.js 22's own floor (glibc 2.28, GLIBCXX 3.4.25). The README now says glibc 2.28+. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
userid 2.0: prebuilt binaries, TypeScript, ES modules, and a clean install everywhere. The full list is in CHANGELOG.md.
What changes for users
isSupportedisfalse, and every lookup throwsERR_USERID_UNSUPPORTED_PLATFORM.*_rlookups), with errors that carry codes (ERR_USERID_NOT_FOUND,EIO, ...).RangeError),exportsmap, no build-from-source fallback on install. See the migration notes in the changelog.How it's built and tested
native/userid.ccis a rewrite (node-addon-api 8, Node-API 8). The TypeScript wrapper lives inlib/. Tests usenode:test, run by Node's own type stripping, and compare againstid.release.ymlpublishes that exact tarball with provenance via npm trusted publishing when av*tag is pushed.The prebuild matrix started from @matthewh's #8 (credited as co-author on the CI commit). Planning notes: plans/triage-and-modernize.md.
🤖 Generated with Claude Code