@johnhenry/objectify-cli 0.0.0 → 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -37,7 +37,7 @@ npx @johnhenry/objectify-cli --help
37
37
 
38
38
  This package is a thin ~100-line Node.js shim (`bin/objectify.js`). It ships
39
39
  no compiled code itself — it detects your OS/architecture at runtime and
40
- delegates to the real binary, which lives in one of five tiny per-platform
40
+ delegates to the real binary, which lives in one of six tiny per-platform
41
41
  packages:
42
42
 
43
43
  | Package | Platform |
@@ -46,6 +46,7 @@ packages:
46
46
  | `@johnhenry/objectify-cli-darwin-x64` | macOS, Intel |
47
47
  | `@johnhenry/objectify-cli-linux-x64` | Linux, x64 (glibc) |
48
48
  | `@johnhenry/objectify-cli-linux-arm64` | Linux, arm64 (glibc) |
49
+ | `@johnhenry/objectify-cli-linux-x64-musl` | Linux, x64 (musl, e.g. Alpine) |
49
50
  | `@johnhenry/objectify-cli-win32-x64` | Windows, x64 |
50
51
 
51
52
  `npm install` only downloads the one matching your machine — it's listed as
@@ -58,9 +59,11 @@ error messages if the right platform package didn't get installed.
58
59
 
59
60
  ## Platform support
60
61
 
61
- Linux `x64`/`arm64` builds target glibc; there is currently no separate
62
- `musl` build (e.g. for Alpine-based Docker images). If you need one, please
63
- open an issue.
62
+ Linux `x64`/`arm64` builds target glibc. Linux `x64` also has a separate
63
+ `musl` build for Alpine-based images; `bin/objectify.js` detects musl at
64
+ runtime (via `process.report`, falling back to `ldd --version`) and picks it
65
+ automatically. There is no `arm64` musl build yet; Alpine on arm64 is
66
+ unsupported.
64
67
 
65
68
  ## Integrity
66
69
 
package/bin/objectify.js CHANGED
@@ -4,7 +4,7 @@
4
4
  /**
5
5
  * Platform-detection shim for the `objectify` CLI.
6
6
  *
7
- * The real compiled binary lives in one of five tiny per-platform npm
7
+ * The real compiled binary lives in one of six tiny per-platform npm
8
8
  * packages (each published from CI, one per Rust build target) and is
9
9
  * installed via `optionalDependencies` — npm only installs the ones whose
10
10
  * `os`/`cpu` fields match the current machine, so exactly one (usually)
@@ -35,9 +35,45 @@ const PACKAGES = {
35
35
  'darwin x64': '@johnhenry/objectify-cli-darwin-x64',
36
36
  'linux arm64': '@johnhenry/objectify-cli-linux-arm64',
37
37
  'linux x64': '@johnhenry/objectify-cli-linux-x64',
38
+ 'linux x64 musl': '@johnhenry/objectify-cli-linux-x64-musl',
38
39
  'win32 x64': '@johnhenry/objectify-cli-win32-x64',
39
40
  };
40
41
 
42
+ // True when running on a musl libc (Alpine and friends). Same approach as
43
+ // esbuild/@swc wrappers: glibc builds of Node expose `glibcVersionRuntime` in
44
+ // the diagnostic report header; musl builds do not. Falls back to scanning the
45
+ // `ldd` banner (musl's prints "musl libc") if the report is unavailable.
46
+ function isMusl() {
47
+ if (process.platform !== 'linux') {
48
+ return false;
49
+ }
50
+ try {
51
+ const report = process.report && process.report.getReport();
52
+ if (report) {
53
+ const header = typeof report === 'string' ? JSON.parse(report).header : report.header;
54
+ if (header) {
55
+ return !header.glibcVersionRuntime;
56
+ }
57
+ }
58
+ } catch (e) {
59
+ // fall through to ldd
60
+ }
61
+ try {
62
+ const out = spawnSync('ldd', ['--version'], { encoding: 'utf8' });
63
+ return /musl/i.test(`${out.stdout || ''}${out.stderr || ''}`);
64
+ } catch (e) {
65
+ return false;
66
+ }
67
+ }
68
+
69
+ // Maps (platform, arch, musl) to the platform package name, or undefined.
70
+ function platformPackage(platform, arch, musl) {
71
+ if (platform === 'linux' && musl) {
72
+ return PACKAGES[`${platform} ${arch} musl`];
73
+ }
74
+ return PACKAGES[`${platform} ${arch}`];
75
+ }
76
+
41
77
  function binSubpath(platform) {
42
78
  return platform === 'win32' ? 'bin/objectify.exe' : 'bin/objectify';
43
79
  }
@@ -53,8 +89,9 @@ function resolveBinaryPath() {
53
89
 
54
90
  const platform = process.platform;
55
91
  const arch = process.arch;
56
- const key = `${platform} ${arch}`;
57
- const pkg = PACKAGES[key];
92
+ const musl = isMusl();
93
+ const key = `${platform} ${arch}${musl ? ' (musl)' : ''}`;
94
+ const pkg = platformPackage(platform, arch, musl);
58
95
 
59
96
  if (!pkg) {
60
97
  fail(
@@ -93,7 +130,7 @@ function resolveBinaryPath() {
93
130
  // release.yml) pins the expected sha256 of each platform's binary at the
94
131
  // version this package was published with. Verifying it here means a
95
132
  // compromised npm token, CI runner, or registry mirror can't silently swap
96
- // in a different binary for one of the five platform packages without also
133
+ // in a different binary for one of the six platform packages without also
97
134
  // tripping this check (short of also compromising the main package's
98
135
  // checksums.json in the same way, which `npm publish --provenance` in the
99
136
  // release workflow independently guards against).
@@ -179,4 +216,9 @@ function main() {
179
216
  process.exit(result.status === null ? 1 : result.status);
180
217
  }
181
218
 
182
- main();
219
+ if (require.main === module) {
220
+ main();
221
+ } else {
222
+ // Exposed for the smoke test (test/resolve.test.js); not a public API.
223
+ module.exports = { PACKAGES, platformPackage, isMusl };
224
+ }
package/checksums.json CHANGED
@@ -1,5 +1,6 @@
1
1
  {
2
- "linux-arm64": "05836ebdd234e42c5ca98b19f0a8fd266852975b7c00eb93f8b233bce80e7a77",
3
- "linux-x64": "46467922b9fb2293398986f54e499cdd88384949dc75e131a653ed78b307f24a",
4
- "win32-x64": "df1a4c7ab8b9bda2270ff8f8a6d450271a027efe7323ec79ed5cd268dbadeec2"
2
+ "linux-arm64": "e6a08a5bf4133dc1c7d856ca8702143e4e4dc206338ca5dd1626742f09a5a655",
3
+ "linux-x64": "f3f271b0c179fd58c20fb8c93f546c76bc7ecd662b8e26d458cd624575434414",
4
+ "linux-x64-musl": "acfffeeee0f1fc1739162adeb9e2c2b6f7c8614185bbc3005bae02c7e8503e8f",
5
+ "win32-x64": "045ac864b52502e2c7961867a412850f701ac9f4b407b90bd27f5044c4a9f124"
5
6
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@johnhenry/objectify-cli",
3
- "version": "0.0.0",
3
+ "version": "0.0.1",
4
4
  "description": "Persistent, versioned JSON objects backed by SQLite — a stateful, agent-friendly CLI.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -28,11 +28,12 @@
28
28
  "node": ">=26.0.0"
29
29
  },
30
30
  "optionalDependencies": {
31
- "@johnhenry/objectify-cli-darwin-arm64": "0.0.0",
32
- "@johnhenry/objectify-cli-darwin-x64": "0.0.0",
33
- "@johnhenry/objectify-cli-linux-x64": "0.0.0",
34
- "@johnhenry/objectify-cli-linux-arm64": "0.0.0",
35
- "@johnhenry/objectify-cli-win32-x64": "0.0.0"
31
+ "@johnhenry/objectify-cli-darwin-arm64": "0.0.1",
32
+ "@johnhenry/objectify-cli-darwin-x64": "0.0.1",
33
+ "@johnhenry/objectify-cli-linux-x64": "0.0.1",
34
+ "@johnhenry/objectify-cli-linux-arm64": "0.0.1",
35
+ "@johnhenry/objectify-cli-win32-x64": "0.0.1",
36
+ "@johnhenry/objectify-cli-linux-x64-musl": "0.0.1"
36
37
  },
37
38
  "publishConfig": {
38
39
  "access": "public"