Include code cache for preload bundle

Co-authored-by: Scott Nonnenberg <scott@signal.org>
This commit is contained in:
Fedor Indutny 2024-09-08 14:09:57 -07:00 committed by GitHub
parent 3c9332449f
commit 695f64a55a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 230 additions and 11 deletions

View file

@ -0,0 +1,35 @@
// Copyright 2024 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { pathToFileURL } from 'node:url';
import { join } from 'node:path';
import { app, BrowserWindow, ipcMain } from 'electron';
app.on('ready', async () => {
ipcMain.handle('done', () => {
app.quit();
});
ipcMain.handle('error', (_event, err) => {
console.error(err);
process.exit(1);
});
const window = new BrowserWindow({
show: false,
webPreferences: {
devTools: true,
nodeIntegration: false,
sandbox: false,
contextIsolation: true,
preload: join(__dirname, 'generate-preload-cache.preload.js'),
},
});
await window.loadURL(
pathToFileURL(join(__dirname, 'generate-preload-cache.html')).toString()
);
window.webContents.openDevTools();
window.webContents.send('compile', process.argv[2], process.argv[3]);
});