electrobun 0.1.18-beta.0 → 0.1.19-beta.2

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.
Files changed (2) hide show
  1. package/dist/main.js +23 -4
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -3,12 +3,31 @@ var __require = import.meta.require;
3
3
 
4
4
  // src/launcher/main.ts
5
5
  import { join, dirname, resolve } from "path";
6
- import { dlopen, suffix } from "bun:ffi";
6
+ import { dlopen, suffix, ptr } from "bun:ffi";
7
7
  import { existsSync } from "fs";
8
8
  var pathToMacOS = dirname(process.argv0);
9
9
  var libPath = join(pathToMacOS, `libNativeWrapper.${suffix}`);
10
10
  var absoluteLibPath = resolve(libPath);
11
11
  function main() {
12
+ let channel = "";
13
+ let identifier = "";
14
+ try {
15
+ const pathToLauncherBin2 = process.argv0;
16
+ const pathToBinDir2 = dirname(pathToLauncherBin2);
17
+ const versionJsonPath = join(pathToBinDir2, "..", "Resources", "version.json");
18
+ if (existsSync(versionJsonPath)) {
19
+ const versionInfo = __require(versionJsonPath);
20
+ if (versionInfo.identifier) {
21
+ identifier = versionInfo.identifier;
22
+ }
23
+ if (versionInfo.channel) {
24
+ channel = versionInfo.channel;
25
+ }
26
+ console.log(`[LAUNCHER] Loaded identifier: ${identifier}, channel: ${channel}`);
27
+ }
28
+ } catch (error) {
29
+ console.error(`[LAUNCHER] Warning: Could not read version.json:`, error);
30
+ }
12
31
  if (process.platform === "linux") {
13
32
  const cefLibs = [join(pathToMacOS, "libcef.so"), join(pathToMacOS, "libvk_swiftshader.so")];
14
33
  const existingCefLibs = cefLibs.filter((lib2) => existsSync(lib2));
@@ -32,13 +51,13 @@ function main() {
32
51
  process.env.LD_LIBRARY_PATH = `.${process.env.LD_LIBRARY_PATH ? ":" + process.env.LD_LIBRARY_PATH : ""}`;
33
52
  }
34
53
  lib = dlopen(libPath, {
35
- runNSApplication: { args: [], returns: "void" }
54
+ runNSApplication: { args: ["cstring", "cstring"], returns: "void" }
36
55
  });
37
56
  } catch (error) {
38
57
  console.error(`[LAUNCHER] Failed to load library: ${error.message}`);
39
58
  try {
40
59
  lib = dlopen(absoluteLibPath, {
41
- runNSApplication: { args: [], returns: "void" }
60
+ runNSApplication: { args: ["cstring", "cstring"], returns: "void" }
42
61
  });
43
62
  } catch (absError) {
44
63
  console.error(`[LAUNCHER] Library loading failed. Try running: ldd ${libPath}`);
@@ -49,6 +68,6 @@ function main() {
49
68
  const pathToBinDir = dirname(pathToLauncherBin);
50
69
  const appEntrypointPath = join(pathToBinDir, "..", "Resources", "app", "bun", "index.js");
51
70
  new Worker(appEntrypointPath, {});
52
- lib.symbols.runNSApplication();
71
+ lib.symbols.runNSApplication(ptr(Buffer.from(identifier + "\x00", "utf8")), ptr(Buffer.from(channel + "\x00", "utf8")));
53
72
  }
54
73
  main();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "electrobun",
3
- "version": "0.1.18-beta.0",
3
+ "version": "0.1.19-beta.2",
4
4
  "description": "Build ultra fast, tiny, and cross-platform desktop apps with Typescript.",
5
5
  "license": "MIT",
6
6
  "author": "Blackboard Technologies Inc.",