electrobun 0.0.19-beta.29 → 0.0.19-beta.32

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/BUILD.md ADDED
@@ -0,0 +1,90 @@
1
+ # Build System
2
+
3
+ This document describes Electrobun's build system and cross-platform compilation approach.
4
+
5
+ ## Overview
6
+
7
+ Electrobun uses a custom build system (`build.ts`) that handles:
8
+ - Vendoring dependencies (Bun, Zig, CEF, WebView2)
9
+ - Building native wrappers for each platform
10
+ - Creating distribution packages
11
+
12
+ ## Platform-Specific Native Wrappers
13
+
14
+ ### macOS
15
+ - Single `libNativeWrapper.dylib` with weak linking to CEF framework
16
+ - Uses `-weak_framework 'Chromium Embedded Framework'` for optional CEF support
17
+ - Gracefully falls back to WebKit when CEF is not bundled
18
+
19
+ ### Windows
20
+ - Single `libNativeWrapper.dll` with runtime CEF detection
21
+ - Links both WebView2 and CEF libraries at build time
22
+ - Uses runtime checks to determine which webview engine to use
23
+
24
+ ### Linux
25
+ **Dual Binary Approach** - Linux builds create two separate native wrapper binaries:
26
+
27
+ #### `libNativeWrapper.so` (GTK-only)
28
+ - Size: ~1.46MB
29
+ - Dependencies: WebKitGTK, GTK+3, AppIndicator only
30
+ - No CEF dependencies linked
31
+ - Used when `bundleCEF: false` in electrobun.config
32
+
33
+ #### `libNativeWrapper_cef.so` (CEF-enabled)
34
+ - Size: ~3.47MB
35
+ - Dependencies: WebKitGTK, GTK+3, AppIndicator + CEF libraries
36
+ - Full CEF functionality available
37
+ - Used when `bundleCEF: true` in electrobun.config
38
+
39
+ #### Why Dual Binaries?
40
+
41
+ Unlike macOS and Windows, Linux doesn't have reliable weak linking for shared libraries. Hard linking CEF libraries causes `dlopen` failures when CEF isn't bundled. The dual binary approach provides:
42
+
43
+ 1. **Small bundle sizes** - Developers can ship lightweight apps without CEF overhead
44
+ 2. **Flexibility** - Same codebase supports both system WebKitGTK and CEF rendering
45
+ 3. **Reliability** - No runtime linking failures or undefined symbols
46
+
47
+ #### CLI Binary Selection
48
+
49
+ The Electrobun CLI automatically copies the appropriate binary based on the `bundleCEF` setting:
50
+
51
+ ```typescript
52
+ const useCEF = config.build.linux?.bundleCEF;
53
+ const nativeWrapperSource = useCEF
54
+ ? PATHS.NATIVE_WRAPPER_LINUX_CEF
55
+ : PATHS.NATIVE_WRAPPER_LINUX;
56
+ ```
57
+
58
+ Both binaries are included in the distributed `electrobun` npm package, ensuring developers can toggle CEF support without recompilation.
59
+
60
+ ## Build Commands
61
+
62
+ ```bash
63
+ # Full build with all platforms
64
+ bun build.ts
65
+
66
+ # Development build with playground
67
+ bun dev:playground
68
+
69
+ # Release build
70
+ bun build.ts --release
71
+
72
+ # CI build
73
+ bun build.ts --ci
74
+ ```
75
+
76
+ ## Architecture Support
77
+
78
+ - **macOS**: ARM64 (Apple Silicon), x64 (Intel)
79
+ - **Windows**: x64 only (ARM Windows users run via automatic emulation)
80
+ - **Linux**: x64, ARM64
81
+
82
+ ### Windows Architecture Notes
83
+
84
+ Windows builds are created on ARM VMs but target x64 architecture. Both x64 and ARM Windows users use the same x64 binary:
85
+ - **x64 Windows**: Runs natively
86
+ - **ARM Windows**: Runs via automatic Windows emulation layer
87
+
88
+ This approach simplifies distribution while maintaining compatibility across Windows architectures.
89
+
90
+ The build system automatically detects the host architecture and downloads appropriate dependencies.
@@ -25,7 +25,8 @@ function getArch() {
25
25
  }
26
26
 
27
27
  const platform = getPlatform();
28
- const arch = getArch();
28
+ // Always use x64 for Windows since we only build x64 Windows binaries
29
+ const arch = platform === 'win' ? 'x64' : getArch();
29
30
  const binExt = platform === 'win' ? '.exe' : '';
30
31
 
31
32
  // Paths
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "electrobun",
3
- "version": "0.0.19-beta.29",
3
+ "version": "0.0.19-beta.32",
4
4
  "description": "Build ultra fast, tiny, and cross-platform desktop apps with Typescript.",
5
5
  "license": "MIT",
6
6
  "author": "Blackboard Technologies Inc.",
package/src/cli/index.ts CHANGED
@@ -18,7 +18,8 @@ const MAX_CHUNK_SIZE = 1024 * 2;
18
18
 
19
19
  // TODO: dedup with built.ts
20
20
  const OS: 'win' | 'linux' | 'macos' = getPlatform();
21
- const ARCH: 'arm64' | 'x64' = getArch();
21
+ // Always use x64 for Windows since we only build x64 Windows binaries
22
+ const ARCH: 'arm64' | 'x64' = OS === 'win' ? 'x64' : getArch();
22
23
 
23
24
  function getPlatform() {
24
25
  switch (platform()) {