@crewhaus/single-binary-cli 0.1.5 → 0.1.7

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/dist/index.d.ts CHANGED
@@ -40,7 +40,20 @@ export type BuildTarget = {
40
40
  readonly arch: Arch;
41
41
  };
42
42
  export declare const BUILD_MATRIX: readonly BuildTarget[];
43
- /** Bun's --target string for a given (platform, arch) pair. */
43
+ /**
44
+ * Bun's --target string for a given (platform, arch) pair.
45
+ *
46
+ * Linux/Windows x64 compile against Bun's `-baseline` runtime so the binary
47
+ * runs on x64 CPUs/VMs without AVX2 (older servers, some cloud/CI hosts). Those
48
+ * baseline builds are genuinely AVX-free, distinct binaries.
49
+ *
50
+ * macOS x64 deliberately stays on the default target: Bun ships NO AVX-free
51
+ * macOS build (`bun-darwin-x64-baseline.zip` contains the byte-identical binary
52
+ * as `bun-darwin-x64.zip`), so `-baseline` would be a pure no-op there. The real
53
+ * macOS hazard is an Apple-Silicon host running the x64 binary under Rosetta 2
54
+ * (which emulates a pre-AVX CPU); those users are steered to the native arm64
55
+ * binary by the Homebrew formula instead. arm64 has no baseline variant.
56
+ */
44
57
  export declare function bunCompileTarget(t: BuildTarget): string;
45
58
  /**
46
59
  * Output filename of a built binary. Adds `.exe` on windows.
package/dist/index.js CHANGED
@@ -40,9 +40,23 @@ export const BUILD_MATRIX = [
40
40
  { platform: "macos", arch: "arm64" },
41
41
  { platform: "windows", arch: "x64" },
42
42
  ];
43
- /** Bun's --target string for a given (platform, arch) pair. */
43
+ /**
44
+ * Bun's --target string for a given (platform, arch) pair.
45
+ *
46
+ * Linux/Windows x64 compile against Bun's `-baseline` runtime so the binary
47
+ * runs on x64 CPUs/VMs without AVX2 (older servers, some cloud/CI hosts). Those
48
+ * baseline builds are genuinely AVX-free, distinct binaries.
49
+ *
50
+ * macOS x64 deliberately stays on the default target: Bun ships NO AVX-free
51
+ * macOS build (`bun-darwin-x64-baseline.zip` contains the byte-identical binary
52
+ * as `bun-darwin-x64.zip`), so `-baseline` would be a pure no-op there. The real
53
+ * macOS hazard is an Apple-Silicon host running the x64 binary under Rosetta 2
54
+ * (which emulates a pre-AVX CPU); those users are steered to the native arm64
55
+ * binary by the Homebrew formula instead. arm64 has no baseline variant.
56
+ */
44
57
  export function bunCompileTarget(t) {
45
- return `bun-${t.platform}-${t.arch}`;
58
+ const baseline = t.arch === "x64" && t.platform !== "macos";
59
+ return `bun-${t.platform}-${t.arch}${baseline ? "-baseline" : ""}`;
46
60
  }
47
61
  /**
48
62
  * Output filename of a built binary. Adds `.exe` on windows.
@@ -123,11 +137,16 @@ export function renderHomebrewFormula(inputs) {
123
137
  license "Apache-2.0"
124
138
 
125
139
  on_macos do
126
- on_arm do
140
+ # An x86_64 Homebrew running under Rosetta 2 on Apple Silicon reports
141
+ # Hardware::CPU.intel?, but the x64 binary then executes under Rosetta — which
142
+ # emulates a pre-AVX (Westmere) CPU. Bun's macOS x64 runtime requires AVX2 and
143
+ # there is no AVX-free macOS Bun build, so it warns ("CPU lacks AVX support")
144
+ # and may crash. Serve the native arm64 binary on every Apple-Silicon host,
145
+ # translated or not. Genuine Intel Macs (AVX2-capable) still get the x64 build.
146
+ if Hardware::CPU.physical_cpu_arm64?
127
147
  url "${downloadBaseUrl}/crewhaus-macos-arm64-${version}"
128
148
  sha256 "${macosArm64}"
129
- end
130
- on_intel do
149
+ else
131
150
  url "${downloadBaseUrl}/crewhaus-macos-x64-${version}"
132
151
  sha256 "${macosX64}"
133
152
  end
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crewhaus/single-binary-cli",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "type": "module",
5
5
  "description": "bun build --compile wrapper producing self-contained crewhaus binaries for linux/macos/windows × x64/arm64; auto-generated Homebrew/apt/Scoop/Winget manifests (Section 32)",
6
6
  "main": "dist/index.js",
@@ -17,7 +17,7 @@
17
17
  "manifests": "bun src/manifests.ts"
18
18
  },
19
19
  "dependencies": {
20
- "@crewhaus/errors": "0.1.5"
20
+ "@crewhaus/errors": "0.1.7"
21
21
  },
22
22
  "license": "Apache-2.0",
23
23
  "author": {