build: update to yarn v4 (#48995)

* build: update to yarn v4

(cherry picked from commit 6adec744f3)

* chore: fixup types after yarn v4 migration

* chore: update nan yarn.lock file

* build: automatically install git for dugite
This commit is contained in:
John Kleinschmidt
2025-11-20 10:13:44 -05:00
committed by GitHub
parent 9b89d19b1b
commit 3e6dd7f771
48 changed files with 18204 additions and 11244 deletions

2
spec/ambient.d.ts vendored
View File

@@ -1,4 +1,2 @@
declare let standardScheme: string;
declare let serviceWorkerScheme: string;
declare module 'dbus-native';

View File

@@ -671,7 +671,7 @@ describe('contextBridge', () => {
it('should release the global hold on methods sent across contexts', async () => {
await makeBindingWindow(() => {
const trackedValues: WeakRef<object>[] = [];
require('electron').ipcRenderer.on('get-gc-info', e => e.sender.send('gc-info', { trackedValues: trackedValues.filter(value => value.deref()).length }));
require('electron').ipcRenderer.on('get-gc-info', (e: any) => e.sender.send('gc-info', { trackedValues: trackedValues.filter(value => value.deref()).length }));
contextBridge.exposeInMainWorld('example', {
getFunction: () => () => 123,
track: (value: object) => { trackedValues.push(new WeakRef(value)); }
@@ -699,7 +699,7 @@ describe('contextBridge', () => {
it('should not leak the global hold on methods sent across contexts when reloading a sandboxed renderer', async () => {
await makeBindingWindow(() => {
const trackedValues: WeakRef<object>[] = [];
require('electron').ipcRenderer.on('get-gc-info', e => e.sender.send('gc-info', { trackedValues: trackedValues.filter(value => value.deref()).length }));
require('electron').ipcRenderer.on('get-gc-info', (e: any) => e.sender.send('gc-info', { trackedValues: trackedValues.filter(value => value.deref()).length }));
contextBridge.exposeInMainWorld('example', {
getFunction: () => () => 123,
track: (value: object) => { trackedValues.push(new WeakRef(value)); }

View File

@@ -243,7 +243,6 @@ describe('ipc module', () => {
await w.webContents.executeJavaScript(`(${function () {
try {
const buffer = new ArrayBuffer(10);
// @ts-expect-error
require('electron').ipcRenderer.postMessage('port', '', [buffer]);
} catch (e) {
require('electron').ipcRenderer.postMessage('port', { error: (e as Error).message });
@@ -323,7 +322,7 @@ describe('ipc module', () => {
w.loadURL('about:blank');
await w.webContents.executeJavaScript(`(${function () {
const { ipcRenderer } = require('electron');
ipcRenderer.on('port', e => {
ipcRenderer.on('port', (e: any) => {
const [port] = e.ports;
port.start();
port.onclose = () => {
@@ -480,8 +479,8 @@ describe('ipc module', () => {
w.loadURL('about:blank');
await w.webContents.executeJavaScript(`(${function () {
const { ipcRenderer } = require('electron');
ipcRenderer.on('port', ev => {
const [port] = ev.ports;
ipcRenderer.on('port', (e: any) => {
const [port] = e.ports;
port.onmessage = () => {
ipcRenderer.send('done');
};
@@ -498,9 +497,9 @@ describe('ipc module', () => {
w.loadURL('about:blank');
await w.webContents.executeJavaScript(`(${function () {
const { ipcRenderer } = require('electron');
ipcRenderer.on('port', e1 => {
e1.ports[0].onmessage = e2 => {
e2.ports[0].onmessage = e3 => {
ipcRenderer.on('port', (e1: any) => {
e1.ports[0].onmessage = (e2: any) => {
e2.ports[0].onmessage = (e3: any) => {
ipcRenderer.send('done', e3.data);
};
};
@@ -587,7 +586,7 @@ describe('ipc module', () => {
w.loadURL('about:blank');
await w.webContents.executeJavaScript(`(${function () {
const { ipcRenderer } = require('electron');
ipcRenderer.on('foo', (_e, msg) => {
ipcRenderer.on('foo', (_e: Event, msg: string) => {
ipcRenderer.send('bar', msg);
});
}})()`);

View File

@@ -10,7 +10,7 @@ import { nativeImage } from 'electron/common';
import { app } from 'electron/main';
import { expect } from 'chai';
import * as dbus from 'dbus-native';
import * as dbus from 'dbus-ts';
import * as path from 'node:path';
import { promisify } from 'node:util';
@@ -40,10 +40,9 @@ ifdescribe(!skip)('Notification module (dbus)', () => {
const path = '/org/freedesktop/Notifications';
const iface = 'org.freedesktop.DBus.Mock';
console.log(`session bus: ${process.env.DBUS_SESSION_BUS_ADDRESS}`);
const bus = dbus.sessionBus();
const bus = await dbus.sessionBus();
const service = bus.getService(serviceName);
const getInterface = promisify(service.getInterface.bind(service));
mock = await getInterface(path, iface);
mock = await service.getInterface(path, iface);
getCalls = promisify(mock.GetCalls.bind(mock));
reset = promisify(mock.Reset.bind(mock));
});

View File

@@ -7,7 +7,7 @@
// See https://pypi.python.org/pypi/python-dbusmock for more information about
// python-dbusmock.
import { expect } from 'chai';
import * as dbus from 'dbus-native';
import * as dbus from 'dbus-ts';
import { once } from 'node:events';
import { setTimeout } from 'node:timers/promises';
@@ -20,10 +20,9 @@ describe('powerMonitor', () => {
ifdescribe(process.platform === 'linux' && process.env.DBUS_SYSTEM_BUS_ADDRESS != null)('when powerMonitor module is loaded with dbus mock', () => {
before(async () => {
const systemBus = dbus.systemBus();
const systemBus = await dbus.systemBus();
const loginService = systemBus.getService('org.freedesktop.login1');
const getInterface = promisify(loginService.getInterface.bind(loginService));
logindMock = await getInterface('/org/freedesktop/login1', 'org.freedesktop.DBus.Mock');
logindMock = await loginService.getInterface('/org/freedesktop/login1', 'org.freedesktop.DBus.Mock');
getCalls = promisify(logindMock.GetCalls.bind(logindMock));
emitSignal = promisify(logindMock.EmitSignal.bind(logindMock));
reset = promisify(logindMock.Reset.bind(logindMock));

View File

@@ -2639,7 +2639,13 @@ describe('webContents module', () => {
const errMsg = Buffer.concat(stderr).toString().trim();
console.error(`Error parsing PDF file, exit code was ${code}; signal was ${signal}, error: ${errMsg}`);
}
return JSON.parse(Buffer.concat(stdout).toString().trim());
try {
return JSON.parse(Buffer.concat(stdout).toString().trim());
} catch (err) {
console.error('Error parsing PDF file:', err);
console.error('Raw output:', Buffer.concat(stdout).toString().trim());
throw err;
}
};
let w: BrowserWindow;

View File

@@ -1,5 +1,8 @@
{
"main": "./lib/echo.js",
"name": "@electron-ci/echo",
"version": "0.0.1"
"version": "0.0.1",
"main": "./lib/echo.js",
"scripts": {
"install": "node-gyp configure && node-gyp build"
}
}

View File

@@ -1,5 +1,8 @@
{
"main": "./lib/test-array-buffer.js",
"name": "@electron-ci/external-ab",
"version": "0.0.1"
"version": "0.0.1",
"main": "./lib/test-array-buffer.js",
"scripts": {
"install": "node-gyp configure && node-gyp build"
}
}

View File

@@ -0,0 +1,13 @@
{
"name": "@electron-ci/is-valid-window",
"version": "0.0.5",
"main": "./lib/is-valid-window.js",
"private": true,
"licenses": "MIT",
"dependencies": {
"nan": "2.x"
},
"scripts": {
"install": "node-gyp configure && node-gyp build"
}
}

View File

@@ -1,5 +1,9 @@
{
"main": "./lib/osr-gpu.js",
"name": "@electron-ci/osr-gpu",
"version": "0.0.1"
"version": "0.0.1",
"main": "./lib/osr-gpu.js",
"private": true,
"scripts": {
"install": "node-gyp configure && node-gyp build"
}
}

View File

@@ -1,5 +1,9 @@
{
"name": "@electron-ci/uv-dlopen",
"version": "0.0.1",
"main": "index.js"
"main": "index.js",
"private": true,
"scripts": {
"install": "node-gyp configure && node-gyp build"
}
}

View File

@@ -1,9 +0,0 @@
{
"main": "./lib/is-valid-window.js",
"name": "is-valid-window",
"version": "0.0.5",
"licenses": "Public Domain",
"dependencies": {
"nan": "2.x"
}
}

View File

@@ -7,6 +7,13 @@
"node-gyp-install": "node-gyp install"
},
"devDependencies": {
"@electron-ci/echo": "*",
"@electron-ci/external-ab": "*",
"@electron-ci/is-valid-window": "*",
"@electron-ci/osr-gpu": "*",
"@electron-ci/uv-dlopen": "*",
"@electron/fuses": "^1.8.0",
"@electron/packager": "^18.3.2",
"@types/basic-auth": "^1.1.8",
"@types/busboy": "^1.5.4",
"@types/chai": "^4.3.19",
@@ -15,32 +22,25 @@
"@types/express": "^4.17.13",
"@types/mocha": "^7.0.2",
"@types/send": "^0.14.5",
"@types/sinon": "^9.0.4",
"@types/split": "^1.0.5",
"@types/uuid": "^3.4.6",
"@types/w3c-web-serial": "^1.0.7",
"express": "^4.20.0",
"@electron-ci/echo": "file:./fixtures/native-addon/echo",
"@electron-ci/is-valid-window": "file:./is-valid-window",
"@electron-ci/uv-dlopen": "file:./fixtures/native-addon/uv-dlopen/",
"@electron-ci/osr-gpu": "file:./fixtures/native-addon/osr-gpu/",
"@electron-ci/external-ab": "file:./fixtures/native-addon/external-ab/",
"@electron/fuses": "^1.8.0",
"@electron/packager": "^18.3.2",
"@types/sinon": "^9.0.4",
"@types/ws": "^7.2.0",
"basic-auth": "^2.0.1",
"busboy": "^1.6.0",
"chai": "^4.2.0",
"chai-as-promised": "^7.1.1",
"coffeescript": "^2.4.1",
"dbus-native": "github:nornagon/dbus-native#master",
"dbus-ts": "^0.0.7",
"dirty-chai": "^2.0.1",
"express": "^4.20.0",
"graceful-fs": "^4.1.15",
"mkdirp": "^0.5.1",
"mocha": "^10.0.0",
"mocha-junit-reporter": "^1.18.0",
"mocha-multi-reporters": "^1.1.7",
"pdfjs-dist": "^4.2.67",
"pdfjs-dist": "4.2.67",
"ps-list": "^7.0.0",
"q": "^1.5.1",
"send": "^0.19.0",
@@ -50,11 +50,5 @@
"winreg": "1.2.4",
"ws": "^7.5.10",
"yargs": "^16.0.3"
},
"resolutions": {
"nan": "file:../../third_party/nan",
"dbus-native/optimist/minimist": "1.2.7",
"dbus-native/xml2js": "0.5.0",
"abstract-socket": "github:deepak1556/node-abstractsocket#928cc591decd12aff7dad96449da8afc29832c19"
}
}

File diff suppressed because it is too large Load Diff