fix(desktop): stop requiring the removed win-toast at startup (#3345)

This commit is contained in:
Hampus authored and GitHub committed 2026-10-09 05:39:56 +02:00
1 parent cadf7ea532
commit 48a19dedd8
4 files changed
+203 -109

No files matched your search

@@ -73,6 +73,9 @@ function loadPreflight({
}),
};
}
if (specifier === '@electron/main/NativeModulePreflightModules.json') {
return JSON.parse(readFileSync(new URL('./NativeModulePreflightModules.json', import.meta.url), 'utf8'));
}
if (specifier === '@electron/main/AppStoreNativeBoundary') return {APP_STORE_ADDON_PACKAGE: '@fluxer/app-store'};
if (specifier === '@electron/main/GatewaySocketNativeBoundary') {
return {GATEWAY_SOCKET_ADDON_PACKAGE: '@fluxer/gateway-socket'};
@@ -166,3 +169,13 @@ describe('NativeModulePreflight', () => {
assert.equal(preflight.spawns.length, 1);
});
});
test('every module the preflight requires is a dependency of the desktop app', () => {
const modules = JSON.parse(readFileSync(new URL('./NativeModulePreflightModules.json', import.meta.url), 'utf8'));
const manifest = JSON.parse(readFileSync(new URL('../../package.json', import.meta.url), 'utf8'));
const dependencies = {...manifest.dependencies, ...manifest.optionalDependencies};
assert.deepEqual(
modules.map((spec) => spec.name).filter((name) => !Object.hasOwn(dependencies, name)),
[],
);
});
@@ -5,8 +5,7 @@ import {createHash} from 'node:crypto';
import {existsSync, mkdirSync, readFileSync, writeFileSync} from 'node:fs';
import {createRequire} from 'node:module';
import path from 'node:path';
import {APP_STORE_ADDON_PACKAGE} from '@electron/main/AppStoreNativeBoundary';
import {GATEWAY_SOCKET_ADDON_PACKAGE} from '@electron/main/GatewaySocketNativeBoundary';
import NATIVE_MODULE_PREFLIGHT_MODULES from '@electron/main/NativeModulePreflightModules.json';
import {app} from 'electron';
import log from 'electron-log';
@@ -43,113 +42,13 @@ export interface NativeModulePreflightResult {
readonly degraded: ReadonlyArray<string>;
}
const NATIVE_MODULE_PREFLIGHT_SPECS: ReadonlyArray<NativeModulePreflightSpec> = [
{
name: '@fluxer/webauthn',
platforms: new Set(['darwin', 'linux', 'win32']),
severity: 'fatal',
},
{
name: '@fluxer/platform-info',
platforms: new Set(['darwin', 'linux', 'win32']),
severity: 'fatal',
},
{
name: '@fluxer/mac-app-audio',
platforms: new Set(['darwin']),
severity: 'fatal',
},
{
name: '@fluxer/mac-clipboard',
platforms: new Set(['darwin']),
severity: 'fatal',
},
{
name: '@fluxer/mac-sysctl',
platforms: new Set(['darwin']),
severity: 'fatal',
},
{
name: '@fluxer/mac-tcc',
platforms: new Set(['darwin']),
severity: 'fatal',
},
{
name: '@fluxer/macos-input-hook',
platforms: new Set(['darwin']),
severity: 'fatal',
},
{
name: '@fluxer/linux-audio-capture',
platforms: new Set(['linux']),
severity: 'fatal',
},
{
name: '@fluxer/linux-evdev',
platforms: new Set(['linux']),
severity: 'fatal',
},
{
name: '@fluxer/linux-input-hook',
platforms: new Set(['linux']),
severity: 'fatal',
},
{
name: '@fluxer/linux-notifications',
platforms: new Set(['linux']),
severity: 'fatal',
},
{
name: '@fluxer/linux-portals',
platforms: new Set(['linux']),
severity: 'fatal',
},
{
name: '@fluxer/linux-screen-capture',
platforms: new Set(['linux']),
severity: 'fatal',
},
{
name: '@fluxer/system-hunspell',
platforms: new Set(['linux']),
severity: 'fatal',
},
{
name: '@fluxer/win-clipboard',
platforms: new Set(['win32']),
severity: 'fatal',
},
{
name: '@fluxer/win-process-loopback',
platforms: new Set(['win32']),
severity: 'fatal',
},
{
name: '@fluxer/win-shell',
platforms: new Set(['win32']),
severity: 'fatal',
},
{
name: '@fluxer/win-toast',
platforms: new Set(['win32']),
severity: 'fatal',
},
{
name: '@fluxer/windows-input-hook',
platforms: new Set(['win32']),
severity: 'fatal',
},
{
name: APP_STORE_ADDON_PACKAGE,
platforms: new Set(['darwin', 'linux', 'win32']),
severity: 'degraded',
},
{
name: GATEWAY_SOCKET_ADDON_PACKAGE,
platforms: new Set(['darwin', 'linux', 'win32']),
severity: 'degraded',
},
];
const NATIVE_MODULE_PREFLIGHT_SPECS: ReadonlyArray<NativeModulePreflightSpec> = NATIVE_MODULE_PREFLIGHT_MODULES.map(
(spec) => ({
name: spec.name,
platforms: new Set(spec.platforms as ReadonlyArray<NodeJS.Platform>),
severity: spec.severity as NativeModuleSeverity,
}),
);
const PROBE_SCRIPT = `
const modulePaths = process.argv.slice(1);
function write(obj) {
@@ -0,0 +1,102 @@
[
{
"name": "@fluxer/webauthn",
"platforms": ["darwin", "linux", "win32"],
"severity": "fatal"
},
{
"name": "@fluxer/platform-info",
"platforms": ["darwin", "linux", "win32"],
"severity": "fatal"
},
{
"name": "@fluxer/mac-app-audio",
"platforms": ["darwin"],
"severity": "fatal"
},
{
"name": "@fluxer/mac-clipboard",
"platforms": ["darwin"],
"severity": "fatal"
},
{
"name": "@fluxer/mac-sysctl",
"platforms": ["darwin"],
"severity": "fatal"
},
{
"name": "@fluxer/mac-tcc",
"platforms": ["darwin"],
"severity": "fatal"
},
{
"name": "@fluxer/macos-input-hook",
"platforms": ["darwin"],
"severity": "fatal"
},
{
"name": "@fluxer/linux-audio-capture",
"platforms": ["linux"],
"severity": "fatal"
},
{
"name": "@fluxer/linux-evdev",
"platforms": ["linux"],
"severity": "fatal"
},
{
"name": "@fluxer/linux-input-hook",
"platforms": ["linux"],
"severity": "fatal"
},
{
"name": "@fluxer/linux-notifications",
"platforms": ["linux"],
"severity": "fatal"
},
{
"name": "@fluxer/linux-portals",
"platforms": ["linux"],
"severity": "fatal"
},
{
"name": "@fluxer/linux-screen-capture",
"platforms": ["linux"],
"severity": "fatal"
},
{
"name": "@fluxer/system-hunspell",
"platforms": ["linux"],
"severity": "fatal"
},
{
"name": "@fluxer/win-clipboard",
"platforms": ["win32"],
"severity": "fatal"
},
{
"name": "@fluxer/win-process-loopback",
"platforms": ["win32"],
"severity": "fatal"
},
{
"name": "@fluxer/win-shell",
"platforms": ["win32"],
"severity": "fatal"
},
{
"name": "@fluxer/windows-input-hook",
"platforms": ["win32"],
"severity": "fatal"
},
{
"name": "@fluxer/app-store",
"platforms": ["darwin", "linux", "win32"],
"severity": "degraded"
},
{
"name": "@fluxer/gateway-socket",
"platforms": ["darwin", "linux", "win32"],
"severity": "degraded"
}
]