electrobun 1.18.1 → 1.18.4-beta.5
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 +2 -0
- package/dist/api/browser/global.d.ts +5 -0
- package/dist/api/browser/index.ts +64 -22
- package/dist/api/bun/ElectrobunConfig.ts +45 -1
- package/dist/api/bun/core/BrowserView.ts +95 -54
- package/dist/api/bun/core/BrowserWindow.ts +19 -29
- package/dist/api/bun/core/BuildConfig.ts +31 -4
- package/dist/api/bun/core/GpuWindow.ts +20 -7
- package/dist/api/bun/core/Socket.ts +13 -196
- package/dist/api/bun/core/Tray.ts +33 -32
- package/dist/api/bun/core/Utils.ts +2 -4
- package/dist/api/bun/core/WGPUView.ts +43 -13
- package/dist/api/bun/index.ts +35 -0
- package/dist/api/bun/preload/.generated/compiled.ts +1 -1
- package/dist/api/bun/preload/globals.d.ts +7 -0
- package/dist/api/bun/preload/index.ts +18 -8
- package/dist/api/bun/preload/webviewTag.ts +32 -3
- package/dist/api/bun/proc/native.ts +914 -745
- package/dist/api/bun/webGPU.ts +1 -1
- package/dist/main.js +26 -22
- package/dist/preload-full.js +913 -0
- package/dist/preload-sandboxed.js +111 -0
- package/dist/zig-sdk/electrobun.zig +1993 -0
- package/package.json +2 -3
- package/src/cli/index.ts +410 -139
- package/dist/api/bun/core/windowIds.ts +0 -5
package/dist/api/bun/webGPU.ts
CHANGED
|
@@ -291,7 +291,7 @@ const WGPU_LIB_NAMES: Record<string, string[]> = {
|
|
|
291
291
|
};
|
|
292
292
|
|
|
293
293
|
function findWgpuLibraryPath(): string | null {
|
|
294
|
-
const envPath = process.env[
|
|
294
|
+
const envPath = process.env["ELECTROBUN_WGPU_PATH"];
|
|
295
295
|
if (envPath && existsSync(envPath)) return envPath;
|
|
296
296
|
|
|
297
297
|
const names = WGPU_LIB_NAMES[process.platform] ?? ["libwebgpu_dawn." + suffix];
|
package/dist/main.js
CHANGED
|
@@ -7,8 +7,9 @@ import { dlopen, suffix, ptr, toArrayBuffer } from "bun:ffi";
|
|
|
7
7
|
import { existsSync, writeFileSync } from "fs";
|
|
8
8
|
import { tmpdir } from "os";
|
|
9
9
|
var pathToMacOS = dirname(process.argv0);
|
|
10
|
-
var
|
|
11
|
-
var
|
|
10
|
+
var coreLibFileName = process.platform === "win32" ? "ElectrobunCore.dll" : `libElectrobunCore.${suffix}`;
|
|
11
|
+
var coreLibPath = join(pathToMacOS, coreLibFileName);
|
|
12
|
+
var absoluteCoreLibPath = resolve(coreLibPath);
|
|
12
13
|
function main() {
|
|
13
14
|
let channel = "";
|
|
14
15
|
let identifier = "";
|
|
@@ -58,31 +59,31 @@ function main() {
|
|
|
58
59
|
if (!process.env["LD_LIBRARY_PATH"]?.includes(".")) {
|
|
59
60
|
process.env["LD_LIBRARY_PATH"] = `.${process.env["LD_LIBRARY_PATH"] ? ":" + process.env["LD_LIBRARY_PATH"] : ""}`;
|
|
60
61
|
}
|
|
61
|
-
lib = dlopen(
|
|
62
|
-
|
|
63
|
-
args: ["cstring", "cstring", "cstring"],
|
|
64
|
-
returns: "
|
|
62
|
+
lib = dlopen(coreLibPath, {
|
|
63
|
+
electrobun_core_run_main_thread: {
|
|
64
|
+
args: ["cstring", "cstring", "cstring", "i32"],
|
|
65
|
+
returns: "i32"
|
|
65
66
|
},
|
|
66
|
-
|
|
67
|
-
args: [
|
|
68
|
-
returns: "
|
|
67
|
+
electrobun_core_last_error: {
|
|
68
|
+
args: [],
|
|
69
|
+
returns: "cstring"
|
|
69
70
|
}
|
|
70
71
|
});
|
|
71
72
|
} catch (error) {
|
|
72
|
-
console.error(`[LAUNCHER] Failed to load
|
|
73
|
+
console.error(`[LAUNCHER] Failed to load ElectrobunCore: ${error.message}`);
|
|
73
74
|
try {
|
|
74
|
-
lib = dlopen(
|
|
75
|
-
|
|
76
|
-
args: ["cstring", "cstring", "cstring"],
|
|
77
|
-
returns: "
|
|
75
|
+
lib = dlopen(absoluteCoreLibPath, {
|
|
76
|
+
electrobun_core_run_main_thread: {
|
|
77
|
+
args: ["cstring", "cstring", "cstring", "i32"],
|
|
78
|
+
returns: "i32"
|
|
78
79
|
},
|
|
79
|
-
|
|
80
|
-
args: [
|
|
81
|
-
returns: "
|
|
80
|
+
electrobun_core_last_error: {
|
|
81
|
+
args: [],
|
|
82
|
+
returns: "cstring"
|
|
82
83
|
}
|
|
83
84
|
});
|
|
84
85
|
} catch (absError) {
|
|
85
|
-
console.error(`[LAUNCHER]
|
|
86
|
+
console.error(`[LAUNCHER] Core library loading failed. Try running: ldd ${coreLibPath}`);
|
|
86
87
|
throw error;
|
|
87
88
|
}
|
|
88
89
|
}
|
|
@@ -97,8 +98,7 @@ function main() {
|
|
|
97
98
|
let asarLibPath;
|
|
98
99
|
let asarLib;
|
|
99
100
|
if (process.platform === "win32") {
|
|
100
|
-
asarLibPath =
|
|
101
|
-
console.log(`[LAUNCHER] Using native wrapper's ASAR reader: ${asarLibPath}`);
|
|
101
|
+
asarLibPath = join(pathToMacOS, "libasar.dll");
|
|
102
102
|
} else {
|
|
103
103
|
asarLibPath = join(pathToMacOS, `libasar.${suffix}`);
|
|
104
104
|
}
|
|
@@ -158,7 +158,11 @@ ${fileData.toString("utf8")}
|
|
|
158
158
|
process.on("SIGINT", () => {});
|
|
159
159
|
process.on("SIGTERM", () => {});
|
|
160
160
|
new Worker(appEntrypointPath, {});
|
|
161
|
-
lib.symbols.
|
|
162
|
-
|
|
161
|
+
const runStatus = lib.symbols.electrobun_core_run_main_thread(ptr(new Uint8Array(Buffer.from(identifier + "\x00", "utf8"))), ptr(new Uint8Array(Buffer.from(name + "\x00", "utf8"))), ptr(new Uint8Array(Buffer.from(channel + "\x00", "utf8"))), 0);
|
|
162
|
+
if (runStatus !== 0) {
|
|
163
|
+
const coreError = lib.symbols.electrobun_core_last_error();
|
|
164
|
+
console.error(`[LAUNCHER] ElectrobunCore failed: ${coreError ? coreError.toString() : "Unknown error"}`);
|
|
165
|
+
process.exit(runStatus);
|
|
166
|
+
}
|
|
163
167
|
}
|
|
164
168
|
main();
|