feat(ci): bundle the renderer in the desktop shell (#3339)

This commit is contained in:
Hampus authored and GitHub committed 2026-10-09 02:31:37 +02:00
1 parent 82abd03a37
commit 4ce4d4e09a
4 files changed
+240 -49

No files matched your search

@@ -1596,6 +1596,7 @@ module.exports = {
smartUnpack: false,
unpack: [
'**/*.node',
'dist/renderer/**/*',
'node_modules/@fluxer/win-process-loopback/*.node',
...winGameCaptureTargetArchs.map(
(arch) => `node_modules/@fluxer/win-game-capture/win-game-capture.win32-${arch}-msvc.node`,
+11 -10
View File
@@ -22,6 +22,7 @@ const SPLASH_SRC_DIR = path.join(SRC_DIR, 'splash');
const SPLASH_DIST_DIR = path.join(DIST_DIR, 'splash');
const SPLASH_PRELOAD_FILE_NAME = 'splash.cjs';
const REQUIRED_RENDERER_ENTRIES = Object.freeze(['index.html', 'assets']);
const BUNDLED_RENDERER_ENTRIES = Object.freeze([...REQUIRED_RENDERER_ENTRIES, 'version.json']);
const FORBIDDEN_RENDERER_ENTRIES = Object.freeze(['sw.js', 'sw.js.map']);
const SUPPORTED_BUILD_ARGUMENTS = Object.freeze(['--shared-assets', '--use-shared-renderer']);
const MAIN_BOOTSTRAP_ENTRY_NAME = 'index';
@@ -89,10 +90,10 @@ class RendererOutputIncompleteError extends Error {
}
}
class PackedRendererNotPrunedError extends Error {
constructor(location) {
super(`The renderer is a required module, so ${location} must be empty after the prune step.`);
this.name = 'PackedRendererNotPrunedError';
class BundledRendererMissingError extends Error {
constructor(location, missing) {
super(`The shell bundles its renderer, so ${location} must still hold ${missing.join(', ')} after the prune step.`);
this.name = 'BundledRendererMissingError';
}
}
@@ -839,14 +840,14 @@ function ensureBuildChannelFile() {
}
function prunePackedRendererModules() {
console.log('Pruning module-owned assets from the packed renderer...');
console.log('Pruning on-demand module assets from the bundled renderer...');
const startedAt = Date.now();
runDesktopBuildStep('strip_shell_renderer');
const survivors = findMissingEntries(REQUIRED_RENDERER_ENTRIES, RENDERER_DIST_DIR);
if (survivors.length !== REQUIRED_RENDERER_ENTRIES.length) {
throw new PackedRendererNotPrunedError(RENDERER_DIST_DIR);
runDesktopBuildStep('prune_shell_renderer');
const missing = findMissingEntries(BUNDLED_RENDERER_ENTRIES, RENDERER_DIST_DIR);
if (missing.length > 0) {
throw new BundledRendererMissingError(RENDERER_DIST_DIR, missing);
}
console.log(` Packed renderer pruned in ${Date.now() - startedAt}ms`);
console.log(` Bundled renderer pruned in ${Date.now() - startedAt}ms`);
}
async function build() {