electrobun 1.3.0-beta.7 → 1.5.0-beta.0
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/bun.lock +0 -5
- package/dist/api/browser/rpc/webview.ts +9 -0
- package/dist/api/browser/webviewtag.ts +38 -0
- package/dist/api/bun/ElectrobunConfig.ts +6 -0
- package/dist/api/bun/core/BrowserView.ts +12 -0
- package/dist/api/bun/core/Updater.ts +38 -9
- package/dist/api/bun/proc/native.ts +49 -7
- package/package.json +1 -2
- package/src/cli/index.ts +786 -407
- package/src/cli/package-lock.json +0 -12
package/bun.lock
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
"": {
|
|
6
6
|
"name": "electrobun",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@oneidentity/zstd-js": "^1.0.3",
|
|
9
8
|
"archiver": "^7.0.1",
|
|
10
9
|
"png-to-ico": "^2.1.8",
|
|
11
10
|
"rcedit": "^4.0.1",
|
|
@@ -23,16 +22,12 @@
|
|
|
23
22
|
|
|
24
23
|
"@malept/cross-spawn-promise": ["@malept/cross-spawn-promise@1.1.1", "", { "dependencies": { "cross-spawn": "^7.0.1" } }, "sha512-RTBGWL5FWQcg9orDOCcp4LvItNzUPcyEU9bwaeJX0rJ1IQxzucC48Y0/sQLp/g6t99IQgAlGIaesJS+gTn7tVQ=="],
|
|
25
24
|
|
|
26
|
-
"@oneidentity/zstd-js": ["@oneidentity/zstd-js@1.0.3", "", { "dependencies": { "@types/emscripten": "^1.39.4" } }, "sha512-Jm6sawqxLzBrjC4sg2BeXToa33yPzUmq20CKsehKY2++D/gHb/oSwVjNgT+RH4vys+r8FynrgcNzGwhZWMLzfQ=="],
|
|
27
|
-
|
|
28
25
|
"@pkgjs/parseargs": ["@pkgjs/parseargs@0.11.0", "", {}, "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg=="],
|
|
29
26
|
|
|
30
27
|
"@types/archiver": ["@types/archiver@6.0.4", "", { "dependencies": { "@types/readdir-glob": "*" } }, "sha512-ULdQpARQ3sz9WH4nb98mJDYA0ft2A8C4f4fovvUcFwINa1cgGjY36JCAYuP5YypRq4mco1lJp1/7jEMS2oR0Hg=="],
|
|
31
28
|
|
|
32
29
|
"@types/bun": ["@types/bun@1.1.9", "", { "dependencies": { "bun-types": "1.1.27" } }, "sha512-SXJRejXpmAc3qxyN/YS4/JGWEzLf4dDBa5fLtRDipQXHqNccuMU4EUYCooXNTsylG0DmwFQsGgEDHxZF+3DqRw=="],
|
|
33
30
|
|
|
34
|
-
"@types/emscripten": ["@types/emscripten@1.40.1", "", {}, "sha512-sr53lnYkQNhjHNN0oJDdUm5564biioI5DuOpycufDVK7D3y+GR3oUswe2rlwY1nPNyusHbrJ9WoTyIHl4/Bpwg=="],
|
|
35
|
-
|
|
36
31
|
"@types/filesystem": ["@types/filesystem@0.0.36", "", { "dependencies": { "@types/filewriter": "*" } }, "sha512-vPDXOZuannb9FZdxgHnqSwAG/jvdGM8Wq+6N4D/d80z+D4HWH+bItqsZaVRQykAn6WEVeEkLm2oQigyHtgb0RA=="],
|
|
37
32
|
|
|
38
33
|
"@types/filewriter": ["@types/filewriter@0.0.33", "", {}, "sha512-xFU8ZXTw4gd358lb2jw25nxY9QAgqn2+bKKjKOYfNCzN4DKCFetK7sPtrlpg66Ywe3vWY9FNxprZawAh9wfJ3g=="],
|
|
@@ -84,5 +84,14 @@ export type WebviewTagHandlers = RPCSchema<{
|
|
|
84
84
|
webviewTagStopFind: {
|
|
85
85
|
id: number;
|
|
86
86
|
};
|
|
87
|
+
webviewTagOpenDevTools: {
|
|
88
|
+
id: number;
|
|
89
|
+
};
|
|
90
|
+
webviewTagCloseDevTools: {
|
|
91
|
+
id: number;
|
|
92
|
+
};
|
|
93
|
+
webviewTagToggleDevTools: {
|
|
94
|
+
id: number;
|
|
95
|
+
};
|
|
87
96
|
};
|
|
88
97
|
}>;
|
|
@@ -73,6 +73,11 @@ interface WebviewTagElement extends HTMLElement {
|
|
|
73
73
|
options?: { forward?: boolean; matchCase?: boolean },
|
|
74
74
|
): void;
|
|
75
75
|
stopFindInPage(): void;
|
|
76
|
+
|
|
77
|
+
// Developer tools
|
|
78
|
+
openDevTools(): void;
|
|
79
|
+
closeDevTools(): void;
|
|
80
|
+
toggleDevTools(): void;
|
|
76
81
|
}
|
|
77
82
|
|
|
78
83
|
const ConfigureWebviewTags = (
|
|
@@ -686,6 +691,39 @@ const ConfigureWebviewTags = (
|
|
|
686
691
|
id: this.webviewId,
|
|
687
692
|
});
|
|
688
693
|
}
|
|
694
|
+
|
|
695
|
+
openDevTools() {
|
|
696
|
+
if (!this.webviewId) {
|
|
697
|
+
console.warn("openDevTools called on removed webview");
|
|
698
|
+
return;
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
this.internalRpc.send.webviewTagOpenDevTools({
|
|
702
|
+
id: this.webviewId,
|
|
703
|
+
});
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
closeDevTools() {
|
|
707
|
+
if (!this.webviewId) {
|
|
708
|
+
console.warn("closeDevTools called on removed webview");
|
|
709
|
+
return;
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
this.internalRpc.send.webviewTagCloseDevTools({
|
|
713
|
+
id: this.webviewId,
|
|
714
|
+
});
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
toggleDevTools() {
|
|
718
|
+
if (!this.webviewId) {
|
|
719
|
+
console.warn("toggleDevTools called on removed webview");
|
|
720
|
+
return;
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
this.internalRpc.send.webviewTagToggleDevTools({
|
|
724
|
+
id: this.webviewId,
|
|
725
|
+
});
|
|
726
|
+
}
|
|
689
727
|
}
|
|
690
728
|
|
|
691
729
|
customElements.define("electrobun-webview", WebviewTag);
|
|
@@ -232,5 +232,11 @@ export interface ElectrobunConfig {
|
|
|
232
232
|
* Used for auto-updates and patch generation
|
|
233
233
|
*/
|
|
234
234
|
baseUrl?: string;
|
|
235
|
+
/**
|
|
236
|
+
* Generate delta patch files by diffing against the previous release.
|
|
237
|
+
* Disable to skip patch generation for local canary/stable testing.
|
|
238
|
+
* @default true
|
|
239
|
+
*/
|
|
240
|
+
generatePatch?: boolean;
|
|
235
241
|
};
|
|
236
242
|
}
|
|
@@ -264,6 +264,18 @@ export class BrowserView<T extends RPCWithTransport = RPCWithTransport> {
|
|
|
264
264
|
native.symbols.webviewStopFind(this.ptr);
|
|
265
265
|
}
|
|
266
266
|
|
|
267
|
+
openDevTools() {
|
|
268
|
+
native.symbols.webviewOpenDevTools(this.ptr);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
closeDevTools() {
|
|
272
|
+
native.symbols.webviewCloseDevTools(this.ptr);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
toggleDevTools() {
|
|
276
|
+
native.symbols.webviewToggleDevTools(this.ptr);
|
|
277
|
+
}
|
|
278
|
+
|
|
267
279
|
// todo (yoav): move this to a class that also has off, append, prepend, etc.
|
|
268
280
|
// name should only allow browserView events
|
|
269
281
|
// Note: normalize event names to willNavigate instead of ['will-navigate'] to save
|
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
readdirSync,
|
|
10
10
|
} from "fs";
|
|
11
11
|
import { execSync } from "child_process";
|
|
12
|
-
import { ZstdInit } from "@oneidentity/zstd-js/wasm";
|
|
13
12
|
import { OS as currentOS, ARCH as currentArch } from "../../shared/platform";
|
|
14
13
|
import { getPlatformPrefix, getTarballFileName } from "../../shared/naming";
|
|
15
14
|
import { quit } from "./Utils";
|
|
@@ -714,15 +713,45 @@ const Updater = {
|
|
|
714
713
|
}
|
|
715
714
|
|
|
716
715
|
emitStatus("decompressing", "Decompressing update bundle...");
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
);
|
|
721
|
-
const uncompressedData = ZstdSimple.decompress(data);
|
|
716
|
+
const bunBinDir = dirname(process.execPath);
|
|
717
|
+
const zstdBinName = currentOS === "win" ? "zig-zstd.exe" : "zig-zstd";
|
|
718
|
+
const zstdPath = join(bunBinDir, zstdBinName);
|
|
722
719
|
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
720
|
+
if (!statSync(zstdPath, { throwIfNoEntry: false })) {
|
|
721
|
+
updateInfo.error = `zig-zstd not found: ${zstdPath}`;
|
|
722
|
+
emitStatus("error", updateInfo.error, { zstdPath });
|
|
723
|
+
console.error("zig-zstd not found:", zstdPath);
|
|
724
|
+
} else {
|
|
725
|
+
const decompressResult = Bun.spawnSync(
|
|
726
|
+
[
|
|
727
|
+
zstdPath,
|
|
728
|
+
"decompress",
|
|
729
|
+
"-i",
|
|
730
|
+
prevVersionCompressedTarballPath,
|
|
731
|
+
"-o",
|
|
732
|
+
latestTarPath,
|
|
733
|
+
"--no-timing",
|
|
734
|
+
],
|
|
735
|
+
{
|
|
736
|
+
cwd: extractionFolder,
|
|
737
|
+
stdout: "inherit",
|
|
738
|
+
stderr: "inherit",
|
|
739
|
+
},
|
|
740
|
+
);
|
|
741
|
+
if (!decompressResult.success) {
|
|
742
|
+
updateInfo.error = `zig-zstd failed with exit code ${decompressResult.exitCode}`;
|
|
743
|
+
emitStatus("error", updateInfo.error, {
|
|
744
|
+
zstdPath,
|
|
745
|
+
exitCode: decompressResult.exitCode,
|
|
746
|
+
});
|
|
747
|
+
console.error("zig-zstd failed", {
|
|
748
|
+
exitCode: decompressResult.exitCode,
|
|
749
|
+
zstdPath,
|
|
750
|
+
});
|
|
751
|
+
} else {
|
|
752
|
+
emitStatus("decompressing", "Decompression complete");
|
|
753
|
+
}
|
|
754
|
+
}
|
|
726
755
|
|
|
727
756
|
unlinkSync(prevVersionCompressedTarballPath);
|
|
728
757
|
}
|
|
@@ -296,6 +296,18 @@ export const native = (() => {
|
|
|
296
296
|
args: [FFIType.ptr, FFIType.cstring],
|
|
297
297
|
returns: FFIType.void,
|
|
298
298
|
},
|
|
299
|
+
webviewOpenDevTools: {
|
|
300
|
+
args: [FFIType.ptr],
|
|
301
|
+
returns: FFIType.void,
|
|
302
|
+
},
|
|
303
|
+
webviewCloseDevTools: {
|
|
304
|
+
args: [FFIType.ptr],
|
|
305
|
+
returns: FFIType.void,
|
|
306
|
+
},
|
|
307
|
+
webviewToggleDevTools: {
|
|
308
|
+
args: [FFIType.ptr],
|
|
309
|
+
returns: FFIType.void,
|
|
310
|
+
},
|
|
299
311
|
// Tray
|
|
300
312
|
createTray: {
|
|
301
313
|
args: [
|
|
@@ -1921,13 +1933,13 @@ const webviewEventHandler = (id: number, eventName: string, detail: string) => {
|
|
|
1921
1933
|
: undefined;
|
|
1922
1934
|
|
|
1923
1935
|
if (!handler) {
|
|
1924
|
-
console.error(
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
);
|
|
1936
|
+
// console.error(
|
|
1937
|
+
// "[webviewEventHandler] No handler found for event:",
|
|
1938
|
+
// eventName,
|
|
1939
|
+
// "(mapped to:",
|
|
1940
|
+
// mappedName,
|
|
1941
|
+
// ")",
|
|
1942
|
+
// );
|
|
1931
1943
|
return { success: false };
|
|
1932
1944
|
}
|
|
1933
1945
|
|
|
@@ -2443,6 +2455,36 @@ export const internalRpcHandlers = {
|
|
|
2443
2455
|
}
|
|
2444
2456
|
native.symbols.webviewStopFind(webview.ptr);
|
|
2445
2457
|
},
|
|
2458
|
+
webviewTagOpenDevTools: (params: { id: number }) => {
|
|
2459
|
+
const webview = BrowserView.getById(params.id);
|
|
2460
|
+
if (!webview || !webview.ptr) {
|
|
2461
|
+
console.error(
|
|
2462
|
+
`webviewTagOpenDevTools: BrowserView not found or has no ptr for id ${params.id}`,
|
|
2463
|
+
);
|
|
2464
|
+
return;
|
|
2465
|
+
}
|
|
2466
|
+
native.symbols.webviewOpenDevTools(webview.ptr);
|
|
2467
|
+
},
|
|
2468
|
+
webviewTagCloseDevTools: (params: { id: number }) => {
|
|
2469
|
+
const webview = BrowserView.getById(params.id);
|
|
2470
|
+
if (!webview || !webview.ptr) {
|
|
2471
|
+
console.error(
|
|
2472
|
+
`webviewTagCloseDevTools: BrowserView not found or has no ptr for id ${params.id}`,
|
|
2473
|
+
);
|
|
2474
|
+
return;
|
|
2475
|
+
}
|
|
2476
|
+
native.symbols.webviewCloseDevTools(webview.ptr);
|
|
2477
|
+
},
|
|
2478
|
+
webviewTagToggleDevTools: (params: { id: number }) => {
|
|
2479
|
+
const webview = BrowserView.getById(params.id);
|
|
2480
|
+
if (!webview || !webview.ptr) {
|
|
2481
|
+
console.error(
|
|
2482
|
+
`webviewTagToggleDevTools: BrowserView not found or has no ptr for id ${params.id}`,
|
|
2483
|
+
);
|
|
2484
|
+
return;
|
|
2485
|
+
}
|
|
2486
|
+
native.symbols.webviewToggleDevTools(webview.ptr);
|
|
2487
|
+
},
|
|
2446
2488
|
webviewEvent: (params: unknown) => {
|
|
2447
2489
|
console.log("-----------------+webviewEvent", params);
|
|
2448
2490
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "electrobun",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0-beta.0",
|
|
4
4
|
"description": "Build ultra fast, tiny, and cross-platform desktop apps with Typescript.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Blackboard Technologies Inc.",
|
|
@@ -56,7 +56,6 @@
|
|
|
56
56
|
"typescript": "^5.9.3"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@oneidentity/zstd-js": "^1.0.3",
|
|
60
59
|
"archiver": "^7.0.1",
|
|
61
60
|
"png-to-ico": "^2.1.8",
|
|
62
61
|
"rcedit": "^4.0.1",
|