electrobun 0.0.19-beta.13 → 0.0.19-beta.130
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 +90 -0
- package/README.md +1 -1
- package/bin/electrobun.cjs +2 -9
- package/debug.js +5 -0
- package/dist/api/browser/builtinrpcSchema.ts +19 -0
- package/dist/api/browser/index.ts +409 -0
- package/dist/api/browser/rpc/webview.ts +79 -0
- package/dist/api/browser/stylesAndElements.ts +3 -0
- package/dist/api/browser/webviewtag.ts +586 -0
- package/dist/api/bun/ElectrobunConfig.ts +171 -0
- package/dist/api/bun/core/ApplicationMenu.ts +66 -0
- package/dist/api/bun/core/BrowserView.ts +349 -0
- package/dist/api/bun/core/BrowserWindow.ts +195 -0
- package/dist/api/bun/core/ContextMenu.ts +67 -0
- package/dist/api/bun/core/Paths.ts +5 -0
- package/dist/api/bun/core/Socket.ts +181 -0
- package/dist/api/bun/core/Tray.ts +121 -0
- package/dist/api/bun/core/Updater.ts +681 -0
- package/dist/api/bun/core/Utils.ts +48 -0
- package/dist/api/bun/events/ApplicationEvents.ts +14 -0
- package/dist/api/bun/events/event.ts +29 -0
- package/dist/api/bun/events/eventEmitter.ts +45 -0
- package/dist/api/bun/events/trayEvents.ts +9 -0
- package/dist/api/bun/events/webviewEvents.ts +16 -0
- package/dist/api/bun/events/windowEvents.ts +12 -0
- package/dist/api/bun/index.ts +47 -0
- package/dist/api/bun/proc/linux.md +43 -0
- package/dist/api/bun/proc/native.ts +1322 -0
- package/dist/api/shared/platform.ts +48 -0
- package/dist/main.js +54 -0
- package/package.json +11 -6
- package/src/cli/index.ts +1353 -239
- package/templates/hello-world/README.md +57 -0
- package/templates/hello-world/bun.lock +225 -0
- package/templates/hello-world/electrobun.config.ts +28 -0
- package/templates/hello-world/package.json +16 -0
- package/templates/hello-world/src/bun/index.ts +15 -0
- package/templates/hello-world/src/mainview/index.css +124 -0
- package/templates/hello-world/src/mainview/index.html +46 -0
- package/templates/hello-world/src/mainview/index.ts +1 -0
- package/templates/interactive-playground/README.md +26 -0
- package/templates/interactive-playground/assets/tray-icon.png +0 -0
- package/templates/interactive-playground/electrobun.config.ts +36 -0
- package/templates/interactive-playground/package-lock.json +36 -0
- package/templates/interactive-playground/package.json +15 -0
- package/templates/interactive-playground/src/bun/demos/files.ts +70 -0
- package/templates/interactive-playground/src/bun/demos/menus.ts +139 -0
- package/templates/interactive-playground/src/bun/demos/rpc.ts +83 -0
- package/templates/interactive-playground/src/bun/demos/system.ts +72 -0
- package/templates/interactive-playground/src/bun/demos/updates.ts +105 -0
- package/templates/interactive-playground/src/bun/demos/windows.ts +90 -0
- package/templates/interactive-playground/src/bun/index.ts +124 -0
- package/templates/interactive-playground/src/bun/types/rpc.ts +109 -0
- package/templates/interactive-playground/src/mainview/components/EventLog.ts +107 -0
- package/templates/interactive-playground/src/mainview/components/Sidebar.ts +65 -0
- package/templates/interactive-playground/src/mainview/components/Toast.ts +57 -0
- package/templates/interactive-playground/src/mainview/demos/FileDemo.ts +211 -0
- package/templates/interactive-playground/src/mainview/demos/MenuDemo.ts +102 -0
- package/templates/interactive-playground/src/mainview/demos/RPCDemo.ts +229 -0
- package/templates/interactive-playground/src/mainview/demos/TrayDemo.ts +132 -0
- package/templates/interactive-playground/src/mainview/demos/WebViewDemo.ts +411 -0
- package/templates/interactive-playground/src/mainview/demos/WindowDemo.ts +207 -0
- package/templates/interactive-playground/src/mainview/index.css +538 -0
- package/templates/interactive-playground/src/mainview/index.html +103 -0
- package/templates/interactive-playground/src/mainview/index.ts +238 -0
- package/templates/multitab-browser/README.md +34 -0
- package/templates/multitab-browser/bun.lock +224 -0
- package/templates/multitab-browser/electrobun.config.ts +32 -0
- package/templates/multitab-browser/package-lock.json +20 -0
- package/templates/multitab-browser/package.json +12 -0
- package/templates/multitab-browser/src/bun/index.ts +144 -0
- package/templates/multitab-browser/src/bun/tabManager.ts +200 -0
- package/templates/multitab-browser/src/bun/types/rpc.ts +78 -0
- package/templates/multitab-browser/src/mainview/index.css +487 -0
- package/templates/multitab-browser/src/mainview/index.html +94 -0
- package/templates/multitab-browser/src/mainview/index.ts +630 -0
- package/templates/photo-booth/README.md +108 -0
- package/templates/photo-booth/bun.lock +239 -0
- package/templates/photo-booth/electrobun.config.ts +28 -0
- package/templates/photo-booth/package.json +16 -0
- package/templates/photo-booth/src/bun/index.ts +92 -0
- package/templates/photo-booth/src/mainview/index.css +465 -0
- package/templates/photo-booth/src/mainview/index.html +124 -0
- package/templates/photo-booth/src/mainview/index.ts +499 -0
- package/tests/bun.lock +14 -0
- package/tests/electrobun.config.ts +45 -0
- package/tests/package-lock.json +36 -0
- package/tests/package.json +13 -0
- package/tests/src/bun/index.ts +100 -0
- package/tests/src/bun/test-runner.ts +508 -0
- package/tests/src/mainview/index.html +110 -0
- package/tests/src/mainview/index.ts +458 -0
- package/tests/src/mainview/styles/main.css +451 -0
- package/tests/src/testviews/tray-test.html +57 -0
- package/tests/src/testviews/webview-mask.html +114 -0
- package/tests/src/testviews/webview-navigation.html +36 -0
- package/tests/src/testviews/window-create.html +17 -0
- package/tests/src/testviews/window-events.html +29 -0
- package/tests/src/testviews/window-focus.html +37 -0
- package/tests/src/webviewtag/index.ts +11 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { platform, arch } from 'os';
|
|
2
|
+
|
|
3
|
+
export type SupportedOS = 'macos' | 'win' | 'linux';
|
|
4
|
+
export type SupportedArch = 'arm64' | 'x64';
|
|
5
|
+
|
|
6
|
+
// Cache platform() result to avoid multiple system calls
|
|
7
|
+
const platformName = platform();
|
|
8
|
+
const archName = arch();
|
|
9
|
+
|
|
10
|
+
// Determine OS once
|
|
11
|
+
export const OS: SupportedOS = (() => {
|
|
12
|
+
switch (platformName) {
|
|
13
|
+
case "win32":
|
|
14
|
+
return 'win';
|
|
15
|
+
case "darwin":
|
|
16
|
+
return 'macos';
|
|
17
|
+
case 'linux':
|
|
18
|
+
return 'linux';
|
|
19
|
+
default:
|
|
20
|
+
throw new Error(`Unsupported platform: ${platformName}`);
|
|
21
|
+
}
|
|
22
|
+
})();
|
|
23
|
+
|
|
24
|
+
// Determine ARCH once, with Windows override
|
|
25
|
+
export const ARCH: SupportedArch = (() => {
|
|
26
|
+
// Always use x64 for Windows since we only build x64 Windows binaries
|
|
27
|
+
if (OS === 'win') {
|
|
28
|
+
return 'x64';
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
switch (archName) {
|
|
32
|
+
case "arm64":
|
|
33
|
+
return 'arm64';
|
|
34
|
+
case "x64":
|
|
35
|
+
return 'x64';
|
|
36
|
+
default:
|
|
37
|
+
throw new Error(`Unsupported architecture: ${archName}`);
|
|
38
|
+
}
|
|
39
|
+
})();
|
|
40
|
+
|
|
41
|
+
// Export functions for backwards compatibility if needed
|
|
42
|
+
export function getPlatformOS(): SupportedOS {
|
|
43
|
+
return OS;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function getPlatformArch(): SupportedArch {
|
|
47
|
+
return ARCH;
|
|
48
|
+
}
|
package/dist/main.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
var __require = import.meta.require;
|
|
3
|
+
|
|
4
|
+
// src/launcher/main.ts
|
|
5
|
+
import { join, dirname, resolve } from "path";
|
|
6
|
+
import { dlopen, suffix } from "bun:ffi";
|
|
7
|
+
import { existsSync } from "fs";
|
|
8
|
+
var pathToMacOS = dirname(process.argv0);
|
|
9
|
+
var libPath = join(pathToMacOS, `libNativeWrapper.${suffix}`);
|
|
10
|
+
var absoluteLibPath = resolve(libPath);
|
|
11
|
+
function main() {
|
|
12
|
+
if (process.platform === "linux") {
|
|
13
|
+
const cefLibs = [join(pathToMacOS, "libcef.so"), join(pathToMacOS, "libvk_swiftshader.so")];
|
|
14
|
+
const existingCefLibs = cefLibs.filter((lib2) => existsSync(lib2));
|
|
15
|
+
if (existingCefLibs.length > 0 && !process.env.LD_PRELOAD) {
|
|
16
|
+
console.error(`[LAUNCHER] ERROR: CEF libraries found but LD_PRELOAD not set!`);
|
|
17
|
+
console.error(`[LAUNCHER] Please run through the wrapper script: ./run.sh`);
|
|
18
|
+
console.error(`[LAUNCHER] Or set: LD_PRELOAD="${existingCefLibs.join(":")}" before starting.`);
|
|
19
|
+
const { spawn } = __require("child_process");
|
|
20
|
+
const env = { ...process.env, LD_PRELOAD: existingCefLibs.join(":") };
|
|
21
|
+
const child = spawn(process.argv[0], process.argv.slice(1), {
|
|
22
|
+
env,
|
|
23
|
+
stdio: "inherit"
|
|
24
|
+
});
|
|
25
|
+
child.on("exit", (code) => process.exit(code));
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
let lib;
|
|
30
|
+
try {
|
|
31
|
+
if (!process.env.LD_LIBRARY_PATH?.includes(".")) {
|
|
32
|
+
process.env.LD_LIBRARY_PATH = `.${process.env.LD_LIBRARY_PATH ? ":" + process.env.LD_LIBRARY_PATH : ""}`;
|
|
33
|
+
}
|
|
34
|
+
lib = dlopen(libPath, {
|
|
35
|
+
runNSApplication: { args: [], returns: "void" }
|
|
36
|
+
});
|
|
37
|
+
} catch (error) {
|
|
38
|
+
console.error(`[LAUNCHER] Failed to load library: ${error.message}`);
|
|
39
|
+
try {
|
|
40
|
+
lib = dlopen(absoluteLibPath, {
|
|
41
|
+
runNSApplication: { args: [], returns: "void" }
|
|
42
|
+
});
|
|
43
|
+
} catch (absError) {
|
|
44
|
+
console.error(`[LAUNCHER] Library loading failed. Try running: ldd ${libPath}`);
|
|
45
|
+
throw error;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const pathToLauncherBin = process.argv0;
|
|
49
|
+
const pathToBinDir = dirname(pathToLauncherBin);
|
|
50
|
+
const appEntrypointPath = join(pathToBinDir, "..", "Resources", "app", "bun", "index.js");
|
|
51
|
+
new Worker(appEntrypointPath, {});
|
|
52
|
+
lib.symbols.runNSApplication();
|
|
53
|
+
}
|
|
54
|
+
main();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "electrobun",
|
|
3
|
-
"version": "0.0.19-beta.
|
|
3
|
+
"version": "0.0.19-beta.130",
|
|
4
4
|
"description": "Build ultra fast, tiny, and cross-platform desktop apps with Typescript.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Blackboard Technologies Inc.",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"type": "module",
|
|
20
20
|
"bin": {
|
|
21
|
-
"electrobun": "./bin/electrobun"
|
|
21
|
+
"electrobun": "./bin/electrobun.cjs"
|
|
22
22
|
},
|
|
23
23
|
"homepage": "https://electrobun.dev",
|
|
24
24
|
"repository": {
|
|
@@ -26,7 +26,6 @@
|
|
|
26
26
|
"url": "git+https://github.com/blackboardsh/electrobun.git"
|
|
27
27
|
},
|
|
28
28
|
"scripts": {
|
|
29
|
-
"postinstall": "node bin/electrobun.cjs --install-only",
|
|
30
29
|
"build:cli": "mkdir -p bin && bun build src/cli/index.ts --compile --outfile bin/electrobun",
|
|
31
30
|
"start": "bun src/bun/index.ts",
|
|
32
31
|
"check-zig-version": "vendors/zig/zig version",
|
|
@@ -37,6 +36,7 @@
|
|
|
37
36
|
"dev:playground:clean": "cd playground && rm -rf node_modules && npm install && cd .. && bun dev:playground",
|
|
38
37
|
"dev:playground:rerun": "cd playground && bun start",
|
|
39
38
|
"dev:playground:canary": "bun build:release && cd playground && npm install && bun build:canary && bun start:canary",
|
|
39
|
+
"run:playground": "bun build:dev && bun build:cli && cd templates/interactive-playground && npm install && bun build:dev && bun start",
|
|
40
40
|
"dev:docs": "cd documentation && bun start",
|
|
41
41
|
"build:docs:release": "cd documentation && bun run build",
|
|
42
42
|
"npm:publish": "bun build:release && npm publish",
|
|
@@ -45,12 +45,17 @@
|
|
|
45
45
|
"push:beta": "bun npm:version:beta && git push origin main --tags",
|
|
46
46
|
"push:patch": "npm version patch && git push origin main --tags",
|
|
47
47
|
"push:minor": "npm version minor && git push origin main --tags",
|
|
48
|
-
"push:major": "npm version major && git push origin main --tags"
|
|
48
|
+
"push:major": "npm version major && git push origin main --tags",
|
|
49
|
+
"build:push:artifacts": "bun scripts/build-and-upload-artifacts.js",
|
|
50
|
+
"test": "bun build:dev && bun build:cli && cd tests && npm install && bun build:dev && bun start"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@types/archiver": "^6.0.3",
|
|
54
|
+
"@types/bun": "1.1.9"
|
|
49
55
|
},
|
|
50
56
|
"dependencies": {
|
|
51
57
|
"@oneidentity/zstd-js": "^1.0.3",
|
|
52
|
-
"
|
|
53
|
-
"bun": "1.1.9",
|
|
58
|
+
"archiver": "^7.0.1",
|
|
54
59
|
"rpc-anywhere": "1.5.0",
|
|
55
60
|
"tar": "^6.2.1"
|
|
56
61
|
}
|