ESM merge to main (#227184)

Co-authored-by: Johannes Rieken <jrieken@microsoft.com>
Co-authored-by: Alexandru Dima <alexdima@microsoft.com>
This commit is contained in:
Benjamin Pasero
2024-08-30 10:31:46 +02:00
committed by GitHub
parent 11ad426fe2
commit 6b924c5152
3921 changed files with 50060 additions and 50016 deletions
+11 -3
View File
@@ -10,7 +10,7 @@
// come before any mocha imports.
process.env.MOCHA_COLORS = '1';
const { app, BrowserWindow, ipcMain, crashReporter } = require('electron');
const { app, BrowserWindow, ipcMain, crashReporter, session } = require('electron');
const product = require('../../../product.json');
const { tmpdir } = require('os');
const { existsSync, mkdirSync } = require('fs');
@@ -218,6 +218,12 @@ class IPCRunner extends events.EventEmitter {
app.on('ready', () => {
// needed when loading resources from the renderer, e.g xterm.js or the encoding lib
session.defaultSession.protocol.registerFileProtocol('vscode-file', (request, callback) => {
const path = new URL(request.url).pathname;
callback({ path });
});
ipcMain.on('error', (_, err) => {
if (!args.dev) {
console.error(err);
@@ -249,7 +255,7 @@ app.on('ready', () => {
width: 800,
show: false,
webPreferences: {
preload: path.join(__dirname, 'preload.js'),
preload: path.join(__dirname, 'preload.js'), // ensure similar environment as VSCode as tests may depend on this
additionalArguments: [`--vscode-window-config=vscode:test-vscode-window-config`],
nodeIntegration: true,
contextIsolation: false,
@@ -302,7 +308,9 @@ app.on('ready', () => {
win.webContents.send('run', args);
}
win.loadURL(url.format({ pathname: path.join(__dirname, 'renderer.html'), protocol: 'file:', slashes: true }));
const target = url.pathToFileURL(path.join(__dirname, 'renderer.html'));
target.searchParams.set('argv', JSON.stringify(args));
win.loadURL(target.href);
const runner = new IPCRunner(win);
createStatsCollector(runner);