chore(dependencies): update @electron/get to version 3.1.0 and adjust patching logic in electron-builder file system script

This commit is contained in:
Ivan 2026-05-27 12:07:56 -05:00
parent bd0eef6ac9
commit 39ed5fdd31
No known key found for this signature in database
GPG key ID: B84314E2D9332AE0
3 changed files with 42 additions and 9 deletions

2
pnpm-lock.yaml generated
View file

@ -6782,7 +6782,7 @@ snapshots:
'@develar/schema-utils': 2.6.5
'@electron/asar': 3.4.1
'@electron/fuses': 1.8.0
'@electron/get': 3.0.0
'@electron/get': 3.1.0
'@electron/notarize': 2.5.0
'@electron/osx-sign': 1.3.3
'@electron/rebuild': 4.0.3

View file

@ -15,6 +15,7 @@ allowBuilds:
esbuild: true
overrides:
"@electron/get": "3.1.0"
dompurify: ">=3.4.5"
lodash: ">=4.17.23"
"@isaacs/brace-expansion": ">=5.0.1"

View file

@ -24,16 +24,48 @@ const preamble = `const __ebFsConstants = (() => {
`;
const cacheModeFallback = {
ReadWrite: 0,
ReadOnly: 1,
WriteOnly: 2,
Bypass: 3,
};
function patchBinDownload(source) {
if (source.includes("__ebFsConstants")) {
return source;
let next = source;
let changed = false;
if (!next.includes("__ebFsConstants")) {
next = preamble + next;
next = next.replace(/fs_1\.constants\.R_OK/g, "__ebFsConstants.R_OK");
next = next.replace(/fs_1\.constants\.W_OK/g, "__ebFsConstants.W_OK");
next = next.replace(/fs\.constants\.R_OK/g, "__ebFsConstants.R_OK");
next = next.replace(/fs\.constants\.W_OK/g, "__ebFsConstants.W_OK");
changed = true;
}
let next = preamble + source;
next = next.replace(/fs_1\.constants\.R_OK/g, "__ebFsConstants.R_OK");
next = next.replace(/fs_1\.constants\.W_OK/g, "__ebFsConstants.W_OK");
next = next.replace(/fs\.constants\.R_OK/g, "__ebFsConstants.R_OK");
next = next.replace(/fs\.constants\.W_OK/g, "__ebFsConstants.W_OK");
return next;
if (!next.includes("__ebElectronDownloadCacheMode")) {
const injectAfterGetRequire =
/(const get_1 = require\("@electron\/get"\);)/;
if (injectAfterGetRequire.test(next)) {
next = next.replace(
injectAfterGetRequire,
`$1
const __ebElectronDownloadCacheMode = get_1.ElectronDownloadCacheMode ?? ${JSON.stringify(cacheModeFallback)};`,
);
next = next.replace(
/get_1\.ElectronDownloadCacheMode\.ReadWrite/g,
"__ebElectronDownloadCacheMode.ReadWrite",
);
next = next.replace(
/in get_1\.ElectronDownloadCacheMode/g,
"in __ebElectronDownloadCacheMode",
);
changed = true;
}
}
return changed ? next : source;
}
for (const target of targets) {