electrobun 1.9.0-beta.3 → 1.10.0-beta.1
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.
|
@@ -123,6 +123,17 @@ export interface ElectrobunConfig {
|
|
|
123
123
|
*/
|
|
124
124
|
asarUnpack?: string[];
|
|
125
125
|
|
|
126
|
+
/**
|
|
127
|
+
* Override the CEF (Chromium Embedded Framework) version.
|
|
128
|
+
* Format: "CEF_VERSION+chromium-CHROMIUM_VERSION"
|
|
129
|
+
* Example: "144.0.11+ge135be2+chromium-144.0.7559.97"
|
|
130
|
+
*
|
|
131
|
+
* Check the electrobun-cef-compat compatibility matrix for tested combinations
|
|
132
|
+
* before overriding. Using an untested version may cause runtime issues.
|
|
133
|
+
* @default Uses the version bundled with this Electrobun release
|
|
134
|
+
*/
|
|
135
|
+
cefVersion?: string;
|
|
136
|
+
|
|
126
137
|
/**
|
|
127
138
|
* macOS-specific build configuration
|
|
128
139
|
*/
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// Default CEF version shipped with this Electrobun release.
|
|
2
|
+
// All platforms use the same version. Update this single pair when bumping CEF.
|
|
3
|
+
export const CEF_VERSION = `144.0.11+ge135be2`;
|
|
4
|
+
export const CHROMIUM_VERSION = `144.0.7559.97`;
|
|
5
|
+
export const DEFAULT_CEF_VERSION_STRING = `${CEF_VERSION}+chromium-${CHROMIUM_VERSION}`;
|
package/package.json
CHANGED
|
@@ -1,64 +1,65 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
2
|
+
"name": "electrobun",
|
|
3
|
+
"version": "1.10.0-beta.1",
|
|
4
|
+
"description": "Build ultra fast, tiny, and cross-platform desktop apps with Typescript.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Blackboard Technologies Inc.",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"bun",
|
|
9
|
+
"desktop",
|
|
10
|
+
"app",
|
|
11
|
+
"cross-platform",
|
|
12
|
+
"typescript"
|
|
13
|
+
],
|
|
14
|
+
"exports": {
|
|
15
|
+
".": "./dist/api/bun/index.ts",
|
|
16
|
+
"./bun": "./dist/api/bun/index.ts",
|
|
17
|
+
"./view": "./dist/api/browser/index.ts"
|
|
18
|
+
},
|
|
19
|
+
"type": "module",
|
|
20
|
+
"bin": {
|
|
21
|
+
"electrobun": "./bin/electrobun.cjs"
|
|
22
|
+
},
|
|
23
|
+
"homepage": "https://electrobun.dev",
|
|
24
|
+
"repository": {
|
|
25
|
+
"type": "git",
|
|
26
|
+
"url": "git+https://github.com/blackboardsh/electrobun.git"
|
|
27
|
+
},
|
|
28
|
+
"scripts": {
|
|
29
|
+
"build:cli": "mkdir -p bin && vendors/bun/bun build src/cli/index.ts --compile --outfile bin/electrobun",
|
|
30
|
+
"start": "bun src/bun/index.ts",
|
|
31
|
+
"check-zig-version": "vendors/zig/zig version",
|
|
32
|
+
"build:dev": "bun build.ts",
|
|
33
|
+
"build:release": "bun build.ts --release",
|
|
34
|
+
"dev": "bun install && bun build:dev && bun build:cli && cd ../kitchen && bun install && bun build:dev && bun start",
|
|
35
|
+
"dev:clean": "cd ../kitchen && rm -rf node_modules && rm -rf vendors/cef && cd ../package && bun dev",
|
|
36
|
+
"dev:rerun": "cd ../kitchen && bun start",
|
|
37
|
+
"dev:canary": "bun install && bun build:release && bun build:cli && cd ../kitchen && bun install && bun build:canary",
|
|
38
|
+
"dev:stable": "bun install && bun build:release && bun build:cli && cd ../kitchen && bun install && bun build:stable",
|
|
39
|
+
"run:template": "bun install && bun build:dev && bun build:cli && cd ../templates/interactive-playground && bun install && bun build:dev && bun start",
|
|
40
|
+
"dev:docs": "cd ../documentation && bun start",
|
|
41
|
+
"build:docs:release": "cd ../documentation && bun run build",
|
|
42
|
+
"npm:publish": "bun build:release && npm publish",
|
|
43
|
+
"npm:publish:beta": "bun build:release && npm publish --tag beta",
|
|
44
|
+
"push:beta": "bun scripts/push-version.js beta",
|
|
45
|
+
"push:patch": "bun scripts/push-version.js patch",
|
|
46
|
+
"push:minor": "bun scripts/push-version.js minor",
|
|
47
|
+
"push:major": "bun scripts/push-version.js major",
|
|
48
|
+
"push:stable": "bun scripts/push-version.js stable",
|
|
49
|
+
"build:push:artifacts": "bun scripts/build-and-upload-artifacts.js",
|
|
50
|
+
"test": "bun install && bun build:dev && bun build:cli && cd ../tests && bun install && bun build:dev && bun start",
|
|
51
|
+
"test:unit": "bun test src/shared",
|
|
52
|
+
"bump-cef": "bun scripts/update-cef-version.ts"
|
|
53
|
+
},
|
|
54
|
+
"devDependencies": {
|
|
55
|
+
"@types/archiver": "^6.0.3",
|
|
56
|
+
"@types/bun": "1.1.9",
|
|
57
|
+
"typescript": "^5.9.3"
|
|
58
|
+
},
|
|
59
|
+
"dependencies": {
|
|
60
|
+
"archiver": "^7.0.1",
|
|
61
|
+
"png-to-ico": "^2.1.8",
|
|
62
|
+
"rcedit": "^4.0.1",
|
|
63
|
+
"rpc-anywhere": "1.5.0"
|
|
64
|
+
}
|
|
64
65
|
}
|
package/src/cli/index.ts
CHANGED
|
@@ -20,6 +20,7 @@ import { execSync } from "child_process";
|
|
|
20
20
|
import * as readline from "readline";
|
|
21
21
|
import archiver from "archiver";
|
|
22
22
|
import { OS, ARCH } from "../shared/platform";
|
|
23
|
+
import { DEFAULT_CEF_VERSION_STRING } from "../shared/cef-version";
|
|
23
24
|
import {
|
|
24
25
|
getAppFileName,
|
|
25
26
|
getBundleFileName,
|
|
@@ -118,9 +119,9 @@ function getPlatformPaths(
|
|
|
118
119
|
"cef",
|
|
119
120
|
"Chromium Embedded Framework.framework",
|
|
120
121
|
),
|
|
121
|
-
CEF_HELPER_MACOS: join(platformDistDir, "
|
|
122
|
-
CEF_HELPER_WIN: join(platformDistDir, "
|
|
123
|
-
CEF_HELPER_LINUX: join(platformDistDir, "
|
|
122
|
+
CEF_HELPER_MACOS: join(platformDistDir, "process_helper"),
|
|
123
|
+
CEF_HELPER_WIN: join(platformDistDir, "process_helper.exe"),
|
|
124
|
+
CEF_HELPER_LINUX: join(platformDistDir, "process_helper"),
|
|
124
125
|
CEF_DIR: join(platformDistDir, "cef"),
|
|
125
126
|
|
|
126
127
|
// Shared platform-independent files (from dist/)
|
|
@@ -361,10 +362,28 @@ async function ensureCoreDependencies(
|
|
|
361
362
|
}
|
|
362
363
|
}
|
|
363
364
|
|
|
365
|
+
/**
|
|
366
|
+
* Returns the effective CEF directory path. When a custom cefVersion is set,
|
|
367
|
+
* CEF files are stored in node_modules/.electrobun-cache/ which survives
|
|
368
|
+
* both dist rebuilds and bun install (which replaces node_modules/electrobun).
|
|
369
|
+
* When using the default version, returns the standard dist-{platform}/cef/ path.
|
|
370
|
+
*/
|
|
371
|
+
function getEffectiveCEFDir(
|
|
372
|
+
platformOS: "macos" | "win" | "linux",
|
|
373
|
+
platformArch: "arm64" | "x64",
|
|
374
|
+
cefVersion?: string,
|
|
375
|
+
): string {
|
|
376
|
+
if (cefVersion) {
|
|
377
|
+
return join(projectRoot, "node_modules", ".electrobun-cache", "cef-override", `${platformOS}-${platformArch}`);
|
|
378
|
+
}
|
|
379
|
+
return getPlatformPaths(platformOS, platformArch).CEF_DIR;
|
|
380
|
+
}
|
|
381
|
+
|
|
364
382
|
async function ensureCEFDependencies(
|
|
365
383
|
targetOS?: "macos" | "win" | "linux",
|
|
366
384
|
targetArch?: "arm64" | "x64",
|
|
367
|
-
|
|
385
|
+
cefVersion?: string,
|
|
386
|
+
): Promise<string> {
|
|
368
387
|
// Use provided target platform or default to host platform
|
|
369
388
|
const platformOS = targetOS || OS;
|
|
370
389
|
const platformArch = targetArch || ARCH;
|
|
@@ -372,12 +391,40 @@ async function ensureCEFDependencies(
|
|
|
372
391
|
// Get platform-specific paths
|
|
373
392
|
const platformPaths = getPlatformPaths(platformOS, platformArch);
|
|
374
393
|
|
|
394
|
+
// If custom CEF version specified, download from Spotify CDN
|
|
395
|
+
// Custom CEF is stored in vendors/cef-override/ to survive dist rebuilds
|
|
396
|
+
if (cefVersion) {
|
|
397
|
+
const overrideDir = getEffectiveCEFDir(platformOS, platformArch, cefVersion);
|
|
398
|
+
// Check if already downloaded with matching version
|
|
399
|
+
const cefVersionFile = join(overrideDir, ".cef-version");
|
|
400
|
+
if (existsSync(overrideDir) && existsSync(cefVersionFile)) {
|
|
401
|
+
const cachedVersion = readFileSync(cefVersionFile, "utf8").trim();
|
|
402
|
+
if (cachedVersion === cefVersion) {
|
|
403
|
+
console.log(
|
|
404
|
+
`Custom CEF ${cefVersion} already cached for ${platformOS}-${platformArch} at ${overrideDir}`,
|
|
405
|
+
);
|
|
406
|
+
return overrideDir;
|
|
407
|
+
}
|
|
408
|
+
// Version mismatch - remove stale cache
|
|
409
|
+
console.log(
|
|
410
|
+
`Cached CEF version "${cachedVersion}" does not match requested "${cefVersion}", re-downloading...`,
|
|
411
|
+
);
|
|
412
|
+
rmSync(overrideDir, { recursive: true, force: true });
|
|
413
|
+
} else if (existsSync(overrideDir)) {
|
|
414
|
+
// Override dir exists but no version stamp - remove it
|
|
415
|
+
rmSync(overrideDir, { recursive: true, force: true });
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
await downloadAndExtractCustomCEF(cefVersion, platformOS, platformArch);
|
|
419
|
+
return overrideDir;
|
|
420
|
+
}
|
|
421
|
+
|
|
375
422
|
// Check if CEF dependencies already exist
|
|
376
423
|
if (existsSync(platformPaths.CEF_DIR)) {
|
|
377
424
|
console.log(
|
|
378
425
|
`CEF dependencies found for ${platformOS}-${platformArch}, using cached version`,
|
|
379
426
|
);
|
|
380
|
-
return;
|
|
427
|
+
return platformPaths.CEF_DIR;
|
|
381
428
|
}
|
|
382
429
|
|
|
383
430
|
console.log(
|
|
@@ -603,6 +650,7 @@ async function ensureCEFDependencies(
|
|
|
603
650
|
console.log(
|
|
604
651
|
`✓ CEF dependencies for ${platformOS}-${platformArch} downloaded and cached successfully`,
|
|
605
652
|
);
|
|
653
|
+
return platformPaths.CEF_DIR;
|
|
606
654
|
} catch (error: any) {
|
|
607
655
|
console.error(
|
|
608
656
|
`Failed to download CEF dependencies for ${platformOS}-${platformArch}:`,
|
|
@@ -647,6 +695,195 @@ async function ensureCEFDependencies(
|
|
|
647
695
|
}
|
|
648
696
|
}
|
|
649
697
|
|
|
698
|
+
/**
|
|
699
|
+
* Downloads CEF runtime files from Spotify CDN for a custom version override.
|
|
700
|
+
* Extracts the minimal distribution and restructures runtime files to the
|
|
701
|
+
* layout the CLI expects. No compilation is needed — process_helper ships in
|
|
702
|
+
* the core tarball and uses CEF's stable C API at runtime.
|
|
703
|
+
*
|
|
704
|
+
* The C API is designed for ABI stability within the same major version line.
|
|
705
|
+
* Across major versions, breaking changes are possible.
|
|
706
|
+
*/
|
|
707
|
+
async function downloadAndExtractCustomCEF(
|
|
708
|
+
cefVersion: string,
|
|
709
|
+
platformOS: "macos" | "win" | "linux",
|
|
710
|
+
platformArch: "arm64" | "x64",
|
|
711
|
+
) {
|
|
712
|
+
// Parse "CEF_VERSION+chromium-CHROMIUM_VERSION"
|
|
713
|
+
const match = cefVersion.match(/^(.+)\+chromium-(.+)$/);
|
|
714
|
+
if (!match) {
|
|
715
|
+
throw new Error(
|
|
716
|
+
`Invalid cefVersion format: "${cefVersion}". ` +
|
|
717
|
+
`Expected: "CEF_VERSION+chromium-CHROMIUM_VERSION" ` +
|
|
718
|
+
`(e.g. "144.0.11+ge135be2+chromium-144.0.7559.97")`,
|
|
719
|
+
);
|
|
720
|
+
}
|
|
721
|
+
const [, cefVer, chromiumVer] = match;
|
|
722
|
+
|
|
723
|
+
// Map platform names to Spotify CDN naming
|
|
724
|
+
const cefPlatformMap: Record<string, string> = {
|
|
725
|
+
"macos-arm64": "macosarm64",
|
|
726
|
+
"macos-x64": "macosx64",
|
|
727
|
+
"win-x64": "windows64",
|
|
728
|
+
"win-arm64": "windowsarm64",
|
|
729
|
+
"linux-x64": "linux64",
|
|
730
|
+
"linux-arm64": "linuxarm64",
|
|
731
|
+
};
|
|
732
|
+
const cefPlatform = cefPlatformMap[`${platformOS}-${platformArch}`];
|
|
733
|
+
if (!cefPlatform) {
|
|
734
|
+
throw new Error(
|
|
735
|
+
`Unsupported platform/arch for custom CEF: ${platformOS}-${platformArch}`,
|
|
736
|
+
);
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
// URL-encode the + as %2B
|
|
740
|
+
const encodedCefVer = cefVer.replace(/\+/g, "%2B");
|
|
741
|
+
const cefUrl = `https://cef-builds.spotifycdn.com/cef_binary_${encodedCefVer}%2Bchromium-${chromiumVer}_${cefPlatform}_minimal.tar.bz2`;
|
|
742
|
+
|
|
743
|
+
console.log(`Using custom CEF version: ${cefVersion}`);
|
|
744
|
+
console.log(`Downloading from: ${cefUrl}`);
|
|
745
|
+
|
|
746
|
+
// Store custom CEF in .electrobun-cache so it survives dist rebuilds and bun install
|
|
747
|
+
const cefDir = getEffectiveCEFDir(platformOS, platformArch, cefVersion);
|
|
748
|
+
console.log(`Caching custom CEF to ${cefDir}`);
|
|
749
|
+
mkdirSync(cefDir, { recursive: true });
|
|
750
|
+
|
|
751
|
+
// Download to temp file
|
|
752
|
+
const tempFile = join(
|
|
753
|
+
ELECTROBUN_DEP_PATH,
|
|
754
|
+
`cef-custom-${platformOS}-${platformArch}-${Date.now()}.tar.bz2`,
|
|
755
|
+
);
|
|
756
|
+
|
|
757
|
+
try {
|
|
758
|
+
console.log(`Downloading custom CEF...`);
|
|
759
|
+
const response = await fetch(cefUrl);
|
|
760
|
+
if (!response.ok) {
|
|
761
|
+
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
const contentLength = response.headers.get("content-length");
|
|
765
|
+
const totalSize = contentLength ? parseInt(contentLength, 10) : 0;
|
|
766
|
+
const fileStream = createWriteStream(tempFile);
|
|
767
|
+
let downloadedSize = 0;
|
|
768
|
+
let lastReportedPercent = -1;
|
|
769
|
+
|
|
770
|
+
if (response.body) {
|
|
771
|
+
const reader = response.body.getReader();
|
|
772
|
+
while (true) {
|
|
773
|
+
const { done, value } = await reader.read();
|
|
774
|
+
if (done) break;
|
|
775
|
+
|
|
776
|
+
const chunk = Buffer.from(value);
|
|
777
|
+
fileStream.write(chunk);
|
|
778
|
+
downloadedSize += chunk.length;
|
|
779
|
+
|
|
780
|
+
if (totalSize > 0) {
|
|
781
|
+
const percent = Math.round((downloadedSize / totalSize) * 100);
|
|
782
|
+
const percentTier = Math.floor(percent / 10) * 10;
|
|
783
|
+
if (percentTier > lastReportedPercent && percentTier <= 100) {
|
|
784
|
+
console.log(
|
|
785
|
+
` Progress: ${percentTier}% (${Math.round(downloadedSize / 1024 / 1024)}MB/${Math.round(totalSize / 1024 / 1024)}MB)`,
|
|
786
|
+
);
|
|
787
|
+
lastReportedPercent = percentTier;
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
await new Promise((resolve, reject) => {
|
|
794
|
+
fileStream.end((error: any) => {
|
|
795
|
+
if (error) reject(error);
|
|
796
|
+
else resolve(void 0);
|
|
797
|
+
});
|
|
798
|
+
});
|
|
799
|
+
|
|
800
|
+
console.log(
|
|
801
|
+
`Download completed (${Math.round(downloadedSize / 1024 / 1024)}MB), extracting...`,
|
|
802
|
+
);
|
|
803
|
+
|
|
804
|
+
// Extract tar.bz2 using system tar (bz2 requires it)
|
|
805
|
+
execSync(
|
|
806
|
+
`tar -xjf "${tempFile}" --strip-components=1 -C "${cefDir}"`,
|
|
807
|
+
{ stdio: "inherit" },
|
|
808
|
+
);
|
|
809
|
+
|
|
810
|
+
// The Spotify distribution layout has runtime files in Release/ and Resources/
|
|
811
|
+
// subdirectories, but the CLI expects them at the cef/ root. Copy them up.
|
|
812
|
+
console.log("Copying CEF runtime files to expected locations...");
|
|
813
|
+
const releaseDir = join(cefDir, "Release");
|
|
814
|
+
const resourcesDir = join(cefDir, "Resources");
|
|
815
|
+
|
|
816
|
+
if (platformOS === "macos") {
|
|
817
|
+
// macOS: copy the framework from Release/ to cef/ root
|
|
818
|
+
const fwSrc = join(releaseDir, "Chromium Embedded Framework.framework");
|
|
819
|
+
const fwDst = join(cefDir, "Chromium Embedded Framework.framework");
|
|
820
|
+
if (existsSync(fwSrc) && !existsSync(fwDst)) {
|
|
821
|
+
cpSync(fwSrc, fwDst, { recursive: true, dereference: true });
|
|
822
|
+
}
|
|
823
|
+
} else {
|
|
824
|
+
// Windows and Linux: copy all files from Release/ and Resources/ to cef/ root
|
|
825
|
+
if (existsSync(releaseDir)) {
|
|
826
|
+
for (const entry of readdirSync(releaseDir)) {
|
|
827
|
+
const src = join(releaseDir, entry);
|
|
828
|
+
const dst = join(cefDir, entry);
|
|
829
|
+
if (!existsSync(dst)) {
|
|
830
|
+
cpSync(src, dst, { recursive: true, dereference: true });
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
if (existsSync(resourcesDir)) {
|
|
835
|
+
for (const entry of readdirSync(resourcesDir)) {
|
|
836
|
+
const src = join(resourcesDir, entry);
|
|
837
|
+
const dst = join(cefDir, entry);
|
|
838
|
+
if (!existsSync(dst)) {
|
|
839
|
+
cpSync(src, dst, { recursive: true, dereference: true });
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
// Write version stamp
|
|
846
|
+
writeFileSync(join(cefDir, ".cef-version"), cefVersion);
|
|
847
|
+
|
|
848
|
+
console.log(
|
|
849
|
+
`Custom CEF ${cefVersion} for ${platformOS}-${platformArch} set up successfully`,
|
|
850
|
+
);
|
|
851
|
+
console.log(
|
|
852
|
+
`Note: process_helper ships in the core tarball and uses CEF's stable C API.`,
|
|
853
|
+
);
|
|
854
|
+
console.log(
|
|
855
|
+
`C API compatibility is expected within the same major version line.`,
|
|
856
|
+
);
|
|
857
|
+
} catch (error: any) {
|
|
858
|
+
// Clean up on failure
|
|
859
|
+
if (existsSync(cefDir)) {
|
|
860
|
+
try {
|
|
861
|
+
rmSync(cefDir, { recursive: true, force: true });
|
|
862
|
+
} catch {}
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
console.error(
|
|
866
|
+
`Failed to set up custom CEF ${cefVersion} for ${platformOS}-${platformArch}:`,
|
|
867
|
+
error.message,
|
|
868
|
+
);
|
|
869
|
+
console.error(
|
|
870
|
+
`\nVerify the CEF version string and that it exists at: https://cef-builds.spotifycdn.com/`,
|
|
871
|
+
);
|
|
872
|
+
console.error(
|
|
873
|
+
`Note: CEF's C API is ABI-stable within the same major version. ` +
|
|
874
|
+
`Across major versions, breaking changes are possible.`,
|
|
875
|
+
);
|
|
876
|
+
process.exit(1);
|
|
877
|
+
} finally {
|
|
878
|
+
// Clean up temp file
|
|
879
|
+
if (existsSync(tempFile)) {
|
|
880
|
+
try {
|
|
881
|
+
unlinkSync(tempFile);
|
|
882
|
+
} catch {}
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
|
|
650
887
|
// @ts-expect-error - reserved for future use
|
|
651
888
|
const _commandDefaults = {
|
|
652
889
|
init: {
|
|
@@ -678,6 +915,7 @@ const defaultConfig = {
|
|
|
678
915
|
targets: undefined as unknown, // Will default to current platform if not specified
|
|
679
916
|
useAsar: false,
|
|
680
917
|
asarUnpack: undefined as string[] | undefined, // Glob patterns for files to exclude from ASAR (e.g., ["*.node", "*.dll"])
|
|
918
|
+
cefVersion: undefined as string | undefined, // Override CEF version: "CEF_VERSION+chromium-CHROMIUM_VERSION"
|
|
681
919
|
mac: {
|
|
682
920
|
codesign: false,
|
|
683
921
|
notarize: false,
|
|
@@ -2013,7 +2251,7 @@ ${schemesXml}
|
|
|
2013
2251
|
cpSync(nativeWrapperLinuxSource, nativeWrapperLinuxDestination, {
|
|
2014
2252
|
dereference: true,
|
|
2015
2253
|
});
|
|
2016
|
-
console.log(`Using ${useCEF ? "CEF" : "GTK"} native wrapper for Linux`);
|
|
2254
|
+
console.log(`Using ${useCEF ? "CEF (with weak linking)" : "GTK-only"} native wrapper for Linux`);
|
|
2017
2255
|
} else {
|
|
2018
2256
|
throw new Error(
|
|
2019
2257
|
`Native wrapper not found: ${nativeWrapperLinuxSource}`,
|
|
@@ -2063,9 +2301,9 @@ ${schemesXml}
|
|
|
2063
2301
|
(targetOS === "win" && config.build.win?.bundleCEF) ||
|
|
2064
2302
|
(targetOS === "linux" && config.build.linux?.bundleCEF)
|
|
2065
2303
|
) {
|
|
2066
|
-
await ensureCEFDependencies(currentTarget.os, currentTarget.arch);
|
|
2304
|
+
const effectiveCEFDir = await ensureCEFDependencies(currentTarget.os, currentTarget.arch, config.build.cefVersion);
|
|
2067
2305
|
if (targetOS === "macos") {
|
|
2068
|
-
const cefFrameworkSource =
|
|
2306
|
+
const cefFrameworkSource = join(effectiveCEFDir, "Chromium Embedded Framework.framework");
|
|
2069
2307
|
const cefFrameworkDestination = join(
|
|
2070
2308
|
appBundleFolderFrameworksPath,
|
|
2071
2309
|
"Chromium Embedded Framework.framework",
|
|
@@ -2106,8 +2344,8 @@ ${schemesXml}
|
|
|
2106
2344
|
});
|
|
2107
2345
|
});
|
|
2108
2346
|
} else if (targetOS === "win") {
|
|
2109
|
-
// Copy CEF DLLs from
|
|
2110
|
-
const cefSourcePath =
|
|
2347
|
+
// Copy CEF DLLs from CEF directory to the main executable directory
|
|
2348
|
+
const cefSourcePath = effectiveCEFDir;
|
|
2111
2349
|
const cefDllFiles = [
|
|
2112
2350
|
"libcef.dll",
|
|
2113
2351
|
"chrome_elf.dll",
|
|
@@ -2153,7 +2391,7 @@ ${schemesXml}
|
|
|
2153
2391
|
});
|
|
2154
2392
|
|
|
2155
2393
|
// Copy CEF resources to MacOS/cef/ subdirectory for other resources like locales
|
|
2156
|
-
const cefResourcesSource =
|
|
2394
|
+
const cefResourcesSource = effectiveCEFDir;
|
|
2157
2395
|
const cefResourcesDestination = join(appBundleMacOSPath, "cef");
|
|
2158
2396
|
|
|
2159
2397
|
if (existsSync(cefResourcesSource)) {
|
|
@@ -2186,7 +2424,7 @@ ${schemesXml}
|
|
|
2186
2424
|
}
|
|
2187
2425
|
} else if (targetOS === "linux") {
|
|
2188
2426
|
// Copy CEF shared libraries from platform-specific dist/cef/ to the main executable directory
|
|
2189
|
-
const cefSourcePath =
|
|
2427
|
+
const cefSourcePath = effectiveCEFDir;
|
|
2190
2428
|
|
|
2191
2429
|
if (existsSync(cefSourcePath)) {
|
|
2192
2430
|
const cefSoFiles = [
|
|
@@ -2725,6 +2963,7 @@ ${schemesXml}
|
|
|
2725
2963
|
defaultRenderer: platformConfig?.defaultRenderer ?? "native",
|
|
2726
2964
|
availableRenderers: bundlesCEF ? ["native", "cef"] : ["native"],
|
|
2727
2965
|
runtime: config.runtime ?? {},
|
|
2966
|
+
...(bundlesCEF ? { cefVersion: config.build?.cefVersion ?? DEFAULT_CEF_VERSION_STRING } : {}),
|
|
2728
2967
|
};
|
|
2729
2968
|
|
|
2730
2969
|
// Include chromiumFlags only if the developer defined them
|
|
@@ -3472,7 +3711,7 @@ ${schemesXml}
|
|
|
3472
3711
|
try {
|
|
3473
3712
|
cpSync(correctLibSource, currentLibPath, { dereference: true });
|
|
3474
3713
|
console.log(
|
|
3475
|
-
`Updated libNativeWrapper.so for ${config.build.linux?.bundleCEF ? "CEF" : "GTK-only"} mode`,
|
|
3714
|
+
`Updated libNativeWrapper.so for ${config.build.linux?.bundleCEF ? "CEF (with weak linking)" : "GTK-only"} mode`,
|
|
3476
3715
|
);
|
|
3477
3716
|
} catch (error) {
|
|
3478
3717
|
console.warn("Failed to update libNativeWrapper.so:", error);
|