diff --git a/THIRD-PARTY-NOTICES.md b/THIRD-PARTY-NOTICES.md index 6bfe88fb4..d53cfc019 100644 --- a/THIRD-PARTY-NOTICES.md +++ b/THIRD-PARTY-NOTICES.md @@ -71,7 +71,7 @@ distributed by their own registries, not redistributed inside our binaries. - **Components**: `selfie_segmentation.tflite`, `selfie_segmentation_landscape.tflite` and the `selfie_segmentation_landscape.onnx` - derived from them, shipped inside `app.asar` under `dist/mediapipe/`. + derived from them, shipped under `resources/mediapipe/`. - **License**: Apache-2.0 — . Copyright The MediaPipe Authors. - The `.onnx` is a **derived work**, generated from the vendored `.tflite` by diff --git a/electron-builder.json5 b/electron-builder.json5 index dafe8c690..e874060ea 100644 --- a/electron-builder.json5 +++ b/electron-builder.json5 @@ -58,7 +58,23 @@ // needs a system libvips we don't provide and breaks on CI/local ("vips-cpp.42 not found"), so we // let electron-builder use the prebuilt instead of recompiling. "buildDependenciesFromSource": false, - "compression": "normal", + "compression": "maximum", + // Strip unused Chromium locale pak files (saves ~20 MB). Only package locales supported by OpenScreen. + "electronLanguages": [ + "en-US", + "fr", + "ar", + "es", + "it", + "ja", + "ko", + "pt-BR", + "ru", + "tr", + "vi", + "zh-CN", + "zh-TW" + ], "directories": { "output": "release/${version}", // Electron-builder's default, spelled out because the appx target depends on it: @@ -72,6 +88,16 @@ "files": [ "dist", "dist-electron", + // Exclude documentation assets that Vite copied from public/ (saves ~8 MB) + "!dist/demo.gif", + "!dist/preview*.png", + // Exclude assets already bundled into extraResources (saves ~17 MB duplicate in asar) + "!dist/wallpapers/**", + "!dist/cursors/**", + "!dist/mediapipe/**", + // Exclude dead-weight node_modules: all frontend and electron code is pre-bundled by Vite (saves ~238 MB) + "!node_modules/**", + "!**/node_modules/**", "!*.png", "!preview*.png", "!*.md", @@ -369,7 +395,7 @@ // in the app spawns. Shipping it added a large binary to every Windows // installer, plus an LGPL redistribution obligation, for a file no // shipped code opens. - "filter": ["win32-*/*", "!win32-*/ffmpeg.exe"] + "filter": ["win32-*/*", "!win32-*/ffmpeg.exe", "!win32-*/ffmpeg-shared.exe"] } ], // The D3D11 compositor addon deliberately does NOT travel through `files` into diff --git a/electron/main.ts b/electron/main.ts index ec961aead..88703f7bd 100644 --- a/electron/main.ts +++ b/electron/main.ts @@ -76,6 +76,11 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url)); // HUD/tray/menu. Parsed before any GUI side effects; see electron/cli/. const cliCommand = parseCliArgs(process.argv, app.isPackaged ? 1 : 2); +// Optimize V8 heap allocation to reduce memory footprint across renderer processes. +// Note: app.commandLine.appendSwitch('js-flags') does not affect the main process V8 isolate, +// which is already initialized before main.ts executes. +app.commandLine.appendSwitch("js-flags", "--optimize-for-size"); + // Use Screen & System Audio Recording permissions instead of the CoreAudio Tap API on macOS. // Tap needs NSAudioCaptureUsageDescription in the parent app's Info.plist, which breaks when // running from a terminal/IDE during dev.