app-builder-lib 27.0.0-alpha.7 → 27.0.0-alpha.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/codeSign/mac/macCodeSign.d.ts.map +1 -1
- package/dist/codeSign/mac/macCodeSign.js +6 -4
- package/dist/codeSign/mac/macCodeSign.js.map +1 -1
- package/dist/codeSign/signResult.d.ts +26 -0
- package/dist/codeSign/signResult.d.ts.map +1 -0
- package/dist/codeSign/signResult.js +12 -0
- package/dist/codeSign/signResult.js.map +1 -0
- package/dist/codeSign/win/signManager.d.ts +2 -1
- package/dist/codeSign/win/signManager.d.ts.map +1 -1
- package/dist/codeSign/win/signManager.js.map +1 -1
- package/dist/codeSign/win/signtoolBaseSignManager.d.ts +2 -1
- package/dist/codeSign/win/signtoolBaseSignManager.d.ts.map +1 -1
- package/dist/codeSign/win/signtoolBaseSignManager.js +3 -3
- package/dist/codeSign/win/signtoolBaseSignManager.js.map +1 -1
- package/dist/codeSign/win/windowsCodeSign.d.ts +2 -1
- package/dist/codeSign/win/windowsCodeSign.d.ts.map +1 -1
- package/dist/codeSign/win/windowsCodeSign.js +16 -7
- package/dist/codeSign/win/windowsCodeSign.js.map +1 -1
- package/dist/codeSign/win/windowsSignAzureManager.d.ts +2 -1
- package/dist/codeSign/win/windowsSignAzureManager.d.ts.map +1 -1
- package/dist/codeSign/win/windowsSignAzureManager.js +2 -2
- package/dist/codeSign/win/windowsSignAzureManager.js.map +1 -1
- package/dist/configuration.d.ts +14 -3
- package/dist/configuration.d.ts.map +1 -1
- package/dist/configuration.js.map +1 -1
- package/dist/core.d.ts +5 -0
- package/dist/core.d.ts.map +1 -1
- package/dist/core.js.map +1 -1
- package/dist/fileMatcher.d.ts.map +1 -1
- package/dist/fileMatcher.js +1 -0
- package/dist/fileMatcher.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/macPackager.d.ts +16 -8
- package/dist/macPackager.d.ts.map +1 -1
- package/dist/macPackager.js +59 -31
- package/dist/macPackager.js.map +1 -1
- package/dist/options/PlatformSpecificBuildOptions.d.ts +2 -2
- package/dist/options/PlatformSpecificBuildOptions.js.map +1 -1
- package/dist/options/linuxOptions.d.ts +8 -2
- package/dist/options/linuxOptions.d.ts.map +1 -1
- package/dist/options/linuxOptions.js.map +1 -1
- package/dist/options/macOptions.d.ts +1 -1
- package/dist/options/macOptions.js.map +1 -1
- package/dist/options/pkgOptions.d.ts +1 -1
- package/dist/options/pkgOptions.js.map +1 -1
- package/dist/options/winOptions.d.ts +3 -3
- package/dist/options/winOptions.js.map +1 -1
- package/dist/packager.d.ts.map +1 -1
- package/dist/packager.js +5 -2
- package/dist/packager.js.map +1 -1
- package/dist/platformPackager.d.ts +2 -1
- package/dist/platformPackager.d.ts.map +1 -1
- package/dist/platformPackager.js +5 -3
- package/dist/platformPackager.js.map +1 -1
- package/dist/publish/PublishManager.js +37 -0
- package/dist/publish/PublishManager.js.map +1 -1
- package/dist/publish/updateInfoBuilder.d.ts.map +1 -1
- package/dist/publish/updateInfoBuilder.js +6 -4
- package/dist/publish/updateInfoBuilder.js.map +1 -1
- package/dist/targets/linux/FpmTarget.d.ts +7 -0
- package/dist/targets/linux/FpmTarget.d.ts.map +1 -1
- package/dist/targets/linux/FpmTarget.js +20 -2
- package/dist/targets/linux/FpmTarget.js.map +1 -1
- package/dist/targets/mac/MacTargetHelper.d.ts +5 -3
- package/dist/targets/mac/MacTargetHelper.d.ts.map +1 -1
- package/dist/targets/mac/MacTargetHelper.js +3 -3
- package/dist/targets/mac/MacTargetHelper.js.map +1 -1
- package/dist/targets/mac/pkg.js +1 -1
- package/dist/targets/mac/pkg.js.map +1 -1
- package/dist/toolsets/7zip.d.ts +32 -0
- package/dist/toolsets/7zip.d.ts.map +1 -1
- package/dist/toolsets/7zip.js +39 -13
- package/dist/toolsets/7zip.js.map +1 -1
- package/dist/toolsets/linuxToolsMac.d.ts.map +1 -1
- package/dist/toolsets/linuxToolsMac.js +15 -5
- package/dist/toolsets/linuxToolsMac.js.map +1 -1
- package/dist/util/electronGet.d.ts +11 -0
- package/dist/util/electronGet.d.ts.map +1 -1
- package/dist/util/electronGet.js +46 -3
- package/dist/util/electronGet.js.map +1 -1
- package/dist/util/installOrRebuild.d.ts +6 -0
- package/dist/util/installOrRebuild.d.ts.map +1 -1
- package/dist/util/installOrRebuild.js +47 -0
- package/dist/util/installOrRebuild.js.map +1 -1
- package/dist/util/repositoryInfo.js +6 -3
- package/dist/util/repositoryInfo.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/dist/winPackager.d.ts +4 -3
- package/dist/winPackager.d.ts.map +1 -1
- package/dist/winPackager.js +22 -16
- package/dist/winPackager.js.map +1 -1
- package/package.json +10 -10
- package/scheme.json +28 -26
- package/templates/nsis/common.nsh +2 -2
- package/templates/nsis/include/allowOnlyOneInstallerInstance.nsh +68 -4
- package/templates/nsis/include/extractAppPackage.nsh +1 -1
- package/templates/nsis/include/installUtil.nsh +2 -2
- package/templates/nsis/include/installer.nsh +1 -1
- package/templates/nsis/installer.nsi +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"electronGet.d.ts","sourceRoot":"","sources":["../../src/util/electronGet.ts"],"names":[],"mappings":"AACA,OAAO,EAKL,+BAA+B,EAE/B,aAAa,EACd,MAAM,eAAe,CAAA;AAEtB,OAAO,EAAa,QAAQ,EAAgB,MAAM,sBAAsB,CAAA;AAexE,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAC9C,+BAA+B,EAC7B,UAAU,GACV,MAAM,GACN,SAAS,GACT,cAAc,GACd,gBAAgB,GAChB,gBAAgB,GAChB,eAAe,GACf,YAAY,GACZ,WAAW,GACX,WAAW,GACX,iBAAiB,GACjB,WAAW,GACX,eAAe,CAClB;IACC,aAAa,CAAC,EAAE,IAAI,C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;;;GAGG;AACH,wBAAsB,2BAA2B,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,MAAM,CAAC,CAGnG;AAED;;;;GAIG;AACH,wBAAsB,wBAAwB,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,MAAM,CAAC,CAShG;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAclE"}
|
package/dist/util/electronGet.js
CHANGED
|
@@ -233,6 +233,47 @@ function initializeProxyOnce() {
|
|
|
233
233
|
export function reinitializeProxy() {
|
|
234
234
|
get.initializeProxy();
|
|
235
235
|
}
|
|
236
|
+
/**
|
|
237
|
+
* Error codes considered transient for artifact downloads. Plain node socket errors carry the code
|
|
238
|
+
* directly on `error.code`; undici (the fetch implementation used by @electron/get v5) wraps them in
|
|
239
|
+
* a `TypeError: fetch failed` whose code lives on `error.cause.code` — including undici's own
|
|
240
|
+
* `UND_ERR_*` codes for connection resets and connect timeouts.
|
|
241
|
+
*/
|
|
242
|
+
const TRANSIENT_DOWNLOAD_ERROR_CODES = new Set([
|
|
243
|
+
"ENOTFOUND",
|
|
244
|
+
"ETIMEDOUT",
|
|
245
|
+
"ECONNRESET",
|
|
246
|
+
"ECONNREFUSED",
|
|
247
|
+
"EAI_AGAIN",
|
|
248
|
+
"EPIPE",
|
|
249
|
+
"ENOENT",
|
|
250
|
+
"UND_ERR_SOCKET",
|
|
251
|
+
"UND_ERR_CONNECT_TIMEOUT",
|
|
252
|
+
]);
|
|
253
|
+
/**
|
|
254
|
+
* Decides whether a failed @electron/get download should be retried. Handles all three error shapes
|
|
255
|
+
* seen in practice (exported for tests):
|
|
256
|
+
* - builder-util-runtime's `HttpError` — retry on 5xx.
|
|
257
|
+
* - @electron/get v5's `HTTPError` (`FetchDownloader`) — a plain `Error` subclass with the fetch
|
|
258
|
+
* `Response` on `.response` and NO `.code`; retry on 5xx and 429. Matched by class and by
|
|
259
|
+
* `name === "HTTPError"` as a fallback in case multiple @electron/get copies are loaded.
|
|
260
|
+
* - transient network errors — code on `error.code`, or on `error.cause.code` for undici's
|
|
261
|
+
* `TypeError: fetch failed` wrapper.
|
|
262
|
+
*/
|
|
263
|
+
export function shouldRetryDownloadError(e) {
|
|
264
|
+
if (e == null) {
|
|
265
|
+
return false;
|
|
266
|
+
}
|
|
267
|
+
if (e instanceof HttpError) {
|
|
268
|
+
return e.isServerError();
|
|
269
|
+
}
|
|
270
|
+
if (e instanceof get.HTTPError || e.name === "HTTPError") {
|
|
271
|
+
const status = e.response?.status;
|
|
272
|
+
return typeof status === "number" && (status >= 500 || status === 429);
|
|
273
|
+
}
|
|
274
|
+
const code = typeof e.code === "string" ? e.code : typeof e.cause?.code === "string" ? e.cause.code : undefined;
|
|
275
|
+
return code != null && TRANSIENT_DOWNLOAD_ERROR_CODES.has(code);
|
|
276
|
+
}
|
|
236
277
|
async function downloadArtifactToFile(config, label) {
|
|
237
278
|
// Serialize concurrent downloads of the same artifact across vitest workers to prevent @electron/get's
|
|
238
279
|
// non-atomic putFileInCache (remove + move) from racing with a concurrent reader.
|
|
@@ -298,7 +339,7 @@ async function downloadArtifactToFile(config, label) {
|
|
|
298
339
|
retries: 3,
|
|
299
340
|
interval: 2000,
|
|
300
341
|
backoff: 2000,
|
|
301
|
-
shouldRetry:
|
|
342
|
+
shouldRetry: shouldRetryDownloadError,
|
|
302
343
|
});
|
|
303
344
|
}
|
|
304
345
|
catch (err) {
|
|
@@ -498,7 +539,7 @@ const CUSTOM_DIR_ENV_VARS = [
|
|
|
498
539
|
* Resolves the final download URL for a builder binary, honouring:
|
|
499
540
|
* ELECTRON_BUILDER_BINARIES_DOWNLOAD_OVERRIDE_URL – fully replaces the URL directory
|
|
500
541
|
* ELECTRON_BUILDER_BINARIES_CUSTOM_DIR (and npm_ variants) – replaces releaseName in the path
|
|
501
|
-
* overrideUrl (caller-supplied) – used as-is when no env var is set
|
|
542
|
+
* overrideUrl (caller-supplied) – the complete file URL, used as-is when no env var is set
|
|
502
543
|
*
|
|
503
544
|
* Exported for unit testing; not part of the public API.
|
|
504
545
|
* @internal
|
|
@@ -509,7 +550,9 @@ export function resolveBuilderBinaryUrl(releaseName, filenameWithExt, baseUrl, o
|
|
|
509
550
|
return `${envOverrideUrl}/${filenameWithExt}`;
|
|
510
551
|
}
|
|
511
552
|
if (overrideUrl != null) {
|
|
512
|
-
|
|
553
|
+
// The caller-supplied override (ToolsetCustom.url) points directly at the file — appending
|
|
554
|
+
// filenameWithExt would double the last path segment (e.g. …/bundle.7z/bundle.7z, issue #10084).
|
|
555
|
+
return overrideUrl;
|
|
513
556
|
}
|
|
514
557
|
const customDirEntry = CUSTOM_DIR_ENV_VARS.map(name => ({ name, value: process.env[name] })).find(e => e.value != null);
|
|
515
558
|
if (customDirEntry != null) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"electronGet.js","sourceRoot":"","sources":["../../src/util/electronGet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,eAAe,CAAA;AACpC,OAAO,EAEL,yBAAyB,GAM1B,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,iBAAiB,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAC5I,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AACxE,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AAEhC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,IAAI,CAAA;AACxD,OAAO,KAAK,EAAE,MAAM,aAAa,CAAA;AACjC,OAAO,KAAK,EAAE,MAAM,IAAI,CAAA;AACxB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAC5B,OA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AC,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,CAAA;QAC5C,CAAC;IACH,CAAC;IACD,OAAO,sBAAsB,aAAa,qBAAqB,CAAA;AACjE,CAAC","sourcesContent":["import * as get from \"@electron/get\"\nimport {\n ElectronArtifactDetails,\n ElectronDownloadCacheMode,\n ElectronDownloadRequest,\n ElectronDownloadRequestOptions,\n ElectronPlatformArtifactDetails,\n FetchDownloaderOptions,\n MirrorOptions,\n} from \"@electron/get\"\nimport { exec, exists, log, PADDING, parseValidEnvVarUrl, sanitizeDirPath, to7zaOutputSwitch, ensureDir, moveDirAtomic } from \"builder-util\"\nimport { HttpError, MemoLazy, retry, sleep } from \"builder-util-runtime\"\nimport * as crypto from \"crypto\"\nimport type { ProgressBar } from \"electron-publish\"\nimport { MultiProgress } from \"electron-publish\"\nimport { createReadStream, createWriteStream } from \"fs\"\nimport * as fs from \"fs/promises\"\nimport * as os from \"os\"\nimport * as path from \"path\"\nimport * as lockfile from \"proper-lockfile\"\nimport { pipeline } from \"stream/promises\"\nimport * as tar from \"tar\"\nimport * as unzipper from \"unzipper\"\nimport { getPath7za } from \"../toolsets/7zip.js\"\nimport { CacheState, cleanupCacheDirectory, computeCacheMetadata, readCacheStateFile, validateCacheDirectory, writeCacheState } from \"./cacheState.js\"\n\nexport interface ElectronGetOptions extends Omit<\n ElectronPlatformArtifactDetails,\n | \"platform\"\n | \"arch\"\n | \"version\"\n | \"artifactName\"\n | \"artifactSuffix\"\n | \"customFilename\"\n | \"tempDirectory\"\n | \"downloader\"\n | \"cacheMode\"\n | \"cacheRoot\"\n | \"downloadOptions\"\n | \"isGeneric\"\n | \"mirrorOptions\"\n> {\n mirrorOptions?: Omit<MirrorOptions, \"customDir\" | \"customFilename\" | \"customVersion\">\n}\n\nexport type ArtifactDownloadOptions = {\n options?: ElectronGetOptions | null\n artifactName: string\n platformName: string\n arch: string\n version: string\n cacheDir?: string\n}\n\nexport function hashUrlSafe(input: string, length = 6): string {\n let hash = 5381\n for (let i = 0; i < input.length; i++) {\n hash = ((hash << 5) + hash) ^ input.charCodeAt(i)\n }\n hash >>>= 0\n const out = hash.toString(36)\n return out.length >= length ? out.slice(0, length) : out.padStart(length, \"0\")\n}\n\n// MemoLazy (not Lazy): keyed on ELECTRON_BUILDER_CACHE so the resolved cache dir is recomputed if the\n// override env var changes, while staying memoized when it doesn't (the production case). The creator\n// also ensures the resolved dir exists — that side effect lives here, at the point of use, so\n// getCacheDirectoryInternal stays a pure path resolver.\nexport const cacheDirectoryOverrideAllowed = new MemoLazy<string | undefined, string>(\n () => process.env.ELECTRON_BUILDER_CACHE?.trim(),\n async () => {\n const dir = await getCacheDirectoryInternal({ isAvoidSystemOnWindows: true, allowEnvVarOverride: true })\n await ensureDir(dir)\n return dir\n }\n)\n// Exposed for testing; not intended for public use. Pure path resolution (no I/O) — use the memoized\n// const's above when you need the directory to exist on disk. Kept async for a stable Promise-returning\n// contract across all call sites.\n// eslint-disable-next-line @typescript-eslint/require-await\nexport async function getCacheDirectoryInternal(options: { isAvoidSystemOnWindows?: boolean; allowEnvVarOverride: boolean }): Promise<string> {\n const { isAvoidSystemOnWindows = true, allowEnvVarOverride } = options\n const env = process.env.ELECTRON_BUILDER_CACHE?.trim()\n if (allowEnvVarOverride && env && path.parse(env).root) {\n return sanitizeDirPath(env)\n }\n\n const appName = \"electron-builder\"\n const platform = os.platform()\n const homeDir = os.homedir()\n\n if (platform === \"darwin\") {\n return path.join(homeDir, \"Library\", \"Caches\", appName)\n }\n if (platform === \"win32\") {\n const localAppData = process.env.LOCALAPPDATA?.trim()\n const username = process.env.USERNAME?.trim()?.toLowerCase()\n // https://github.com/electron-userland/electron-builder/issues/1164\n const isSystemUser = isAvoidSystemOnWindows && (localAppData?.toLowerCase()?.includes(\"\\\\windows\\\\system32\\\\\") || username === \"system\")\n if (!localAppData || isSystemUser) {\n return path.join(os.tmpdir(), `${appName}-cache`)\n }\n return path.join(localAppData, appName, \"Cache\")\n }\n\n const xdgCache = process.env.XDG_CACHE_HOME\n return xdgCache && path.parse(xdgCache).root ? path.join(xdgCache, appName) : path.join(homeDir, \".cache\", appName)\n}\n\nfunction resolveCacheMode(): ElectronDownloadCacheMode {\n const varName = \"ELECTRON_DOWNLOAD_CACHE_MODE\"\n const cacheOverride = process.env[varName]?.trim()\n if (cacheOverride && Number(cacheOverride) in ElectronDownloadCacheMode) {\n const mode = Number(cacheOverride) as ElectronDownloadCacheMode\n log.debug({ mode }, `cache mode overridden via env var ${varName}`)\n return mode\n }\n return ElectronDownloadCacheMode.ReadWrite\n}\n\n/**\n * Returns true when `destPath` is safely contained within `dir` (direct child or deeper).\n * On Windows the filesystem is case-insensitive so the comparison is normalised to lowercase.\n * @internal exported for unit testing\n */\nexport function isSafeExtractPath(destPath: string, dir: string): boolean {\n const normalizedDest = path.resolve(destPath)\n const normalizedDir = path.resolve(dir)\n if (process.platform === \"win32\") {\n const d = normalizedDest.toLowerCase()\n const b = normalizedDir.toLowerCase()\n return d.startsWith(b + path.sep) || d === b\n }\n return normalizedDest.startsWith(normalizedDir + path.sep) || normalizedDest === normalizedDir\n}\n\nasync function extractZipStreaming(file: string, dir: string): Promise<void> {\n // Pass 1: read central directory once to collect Unix modes (one seek to EOF)\n const zipDir = await unzipper.Open.file(file)\n const entryModes = new Map<string, number>()\n for (const entry of zipDir.files) {\n const mode = (entry.externalFileAttributes >> 16) & 0xffff\n if (mode > 0) {\n entryModes.set(entry.path, mode)\n }\n }\n const isSymlink = (mode: number) => (mode & 0o170000) === 0o120000\n\n // Pass 2: stream from byte 0 — no per-entry seeks, no Docker hang.\n // Destroy the read stream in a finally block so the file handle is always released,\n // including when the loop exits early due to a thrown error.\n const readStream = createReadStream(file)\n try {\n const entries = readStream.pipe(unzipper.Parse({ forceStream: true }))\n for await (const entry of entries as AsyncIterable<unzipper.Entry>) {\n const destPath = path.resolve(dir, entry.path)\n if (!isSafeExtractPath(destPath, dir)) {\n throw new Error(`Path traversal blocked: ${entry.path}`)\n }\n const mode = entryModes.get(entry.path) ?? 0\n if (mode > 0 && isSymlink(mode)) {\n const target = (await entry.buffer()).toString()\n if (path.isAbsolute(target)) {\n throw new Error(`Absolute symlink target blocked: ${target}`)\n }\n const resolvedTarget = path.resolve(path.dirname(destPath), target)\n if (!isSafeExtractPath(resolvedTarget, dir)) {\n throw new Error(`Symlink target escapes extraction dir: ${target}`)\n }\n await fs.mkdir(path.dirname(destPath), { recursive: true })\n await fs.symlink(target, destPath)\n } else if (entry.type === \"Directory\") {\n await fs.mkdir(destPath, { recursive: true })\n entry.autodrain()\n } else {\n await fs.mkdir(path.dirname(destPath), { recursive: true })\n await pipeline(entry, createWriteStream(destPath))\n if (mode > 0) {\n await fs.chmod(destPath, mode & 0o7777)\n }\n }\n }\n } finally {\n readStream.destroy()\n }\n}\n\nexport async function extractArchive(archive: string, dir: string) {\n const file = sanitizeDirPath(archive)\n\n const tmpDir = `${dir}.tmp`\n await fs.mkdir(tmpDir, { recursive: true })\n\n const release = await lockfile.lock(tmpDir, {\n // 100 retries (not 15) so concurrent callers wait out a slow first extraction instead of failing\n // with ELOCKED; the update heartbeat keeps an in-progress holder's lock fresh against `stale`.\n retries: { retries: 100, minTimeout: 1000, maxTimeout: 5000 },\n stale: 120000, // Increased from 60s to allow long-running extractions\n })\n\n try {\n // rm + mkdir happen AFTER acquiring the lock so no concurrent caller can clear our tmpDir mid-extraction\n await fs.rm(tmpDir, { recursive: true, force: true })\n await fs.mkdir(tmpDir, { recursive: true })\n\n // Guard against the transient window in @electron/get's non-atomic putFileInCache (remove → move).\n // A concurrent worker may have deleted and not yet replaced the source archive; wait briefly for it.\n for (let i = 0; !(await exists(file)); i++) {\n if (i >= 4) {\n throw Object.assign(new Error(`Source archive not found after retries: ${file}`), { code: \"ENOENT\", path: file })\n }\n log.warn({ file, attempt: i + 1 }, \"source archive transiently missing, retrying\")\n await sleep(300 * (i + 1))\n }\n\n if (file.endsWith(\".tar.gz\") || file.endsWith(\".tgz\")) {\n await tar.extract({ file, cwd: tmpDir, strip: 1 })\n } else if (file.endsWith(\".tar.xz\") || file.endsWith(\".txz\") || file.endsWith(\".tar.7z\")) {\n // Compressed tarballs node-tar cannot decompress itself (xz, 7z): use 7za to strip the outer\n // compression layer into a .tar, then extract that tar.\n // Note: the .tar.7z check MUST stay ahead of the plain .7z branch below, otherwise only the outer\n // 7z layer is removed and the inner tar is left behind as-is (see https://github.com/electron-userland/electron-builder/issues/10002).\n const cmd7za = await getPath7za()\n const decompressOutDir = `${tmpDir}.decompress`\n await fs.rm(decompressOutDir, { recursive: true, force: true })\n await fs.mkdir(decompressOutDir, { recursive: true })\n try {\n await exec(cmd7za, [\"x\", \"-bd\", file, to7zaOutputSwitch(sanitizeDirPath(decompressOutDir)), \"-y\"])\n const innerTar = (await fs.readdir(decompressOutDir)).find(f => f.endsWith(\".tar\"))\n if (innerTar == null) {\n throw new Error(`decompression of ${path.basename(file)} produced no .tar archive`)\n }\n await tar.extract({ file: path.join(decompressOutDir, innerTar), cwd: tmpDir, strip: 1 })\n } finally {\n await fs.rm(decompressOutDir, { recursive: true, force: true })\n }\n } else if (file.endsWith(\".zip\")) {\n await extractZipStreaming(file, tmpDir)\n } else if (file.endsWith(\".7z\")) {\n const cmd7za = await getPath7za()\n try {\n await exec(cmd7za, [\"x\", \"-bd\", file, to7zaOutputSwitch(sanitizeDirPath(tmpDir)), \"-y\"])\n } catch (e: any) {\n // Check if extraction actually failed or just had benign warnings\n const files = await fs.readdir(tmpDir)\n if (files.length === 0) {\n log.warn({ file: log.filePath(file), tmpDir: log.filePath(tmpDir), error: e.message }, \"7z extraction produced no output\")\n throw new Error(`7z extraction failed for ${file}: ${e.message}`)\n }\n // If files were extracted despite the error, log and continue\n log.warn({ error: e.message, filesExtracted: files.length }, \"7z reported error but extracted files\")\n }\n } else {\n throw new Error(`Unsupported archive format: ${path.basename(file)}`)\n }\n\n // Verify extraction produced files\n const extractedFiles = await fs.readdir(tmpDir)\n if (extractedFiles.length === 0) {\n throw new Error(`Extraction of ${path.basename(file)} produced no files`)\n }\n\n await fs.rm(dir, { recursive: true, force: true })\n await moveDirAtomic(tmpDir, dir)\n } finally {\n await release().catch(err => log.warn({ err }, \"failed to release lockfile\"))\n }\n}\n\nlet proxyInitialized = false\nfunction initializeProxyOnce(): void {\n if (!proxyInitialized) {\n reinitializeProxy()\n proxyInitialized = true\n }\n}\n\n/**\n * Forces undici's global proxy dispatcher to re-read the current HTTP(S)_PROXY / NO_PROXY env vars,\n * bypassing the once-guard in initializeProxyOnce(). Exported for integration testing only.\n */\nexport function reinitializeProxy(): void {\n get.initializeProxy()\n}\n\nasync function downloadArtifactToFile(config: ElectronArtifactDetails, label: string): Promise<string> {\n // Serialize concurrent downloads of the same artifact across vitest workers to prevent @electron/get's\n // non-atomic putFileInCache (remove + move) from racing with a concurrent reader.\n const key = {\n p: (config as ElectronPlatformArtifactDetails).platform,\n a: (config as ElectronPlatformArtifactDetails).arch,\n v: config.version,\n n: config.artifactName,\n g: config.isGeneric,\n }\n\n const artifactLockKey = crypto.createHash(\"sha256\").update(JSON.stringify(key)).digest(\"hex\").slice(0, 20)\n const artifactLockPath = path.join(os.tmpdir(), `eb-dl-${artifactLockKey}.lock`)\n // This lock is taken even for cache hits (the cache-hit check lives inside @electron/get), so under\n // heavy concurrency many builds serialize here. 30 retries (~137s of backoff) is too few — waiters\n // were exhausting it and failing with ELOCKED while the holder fetched a large artifact. 100 retries\n // matches the other toolset locks; stale (10min) + proper-lockfile's update heartbeat keep a live\n // downloader's lock fresh so the longer wait never falsely steals an in-progress download.\n const releaseArtifactLock = await lockfile.lock(artifactLockPath, {\n retries: { retries: 100, minTimeout: 500, maxTimeout: 5000 },\n stale: 600_000,\n realpath: false,\n })\n let lastLoggedMilestone = -1\n const state: { bar: ProgressBar | undefined } = { bar: undefined }\n\n // @electron/get v5 downloads via fetch, whose proxy support comes from undici's global dispatcher.\n // initializeProxy() wires that up from HTTP(S)_PROXY/NO_PROXY env vars (replaces the got proxy agent).\n initializeProxyOnce()\n\n const downloadOptions: FetchDownloaderOptions = {\n signal: AbortSignal.timeout(10 * 60 * 1000), // prevent indefinite hang on stalled connections\n ...config.downloadOptions,\n getProgressCallback: info => {\n // @electron/get passes downloadOptions (including this callback) to its internal\n // SHASUMS256.txt validation download. That file is tiny (<1 MB) and fires at 100%\n // immediately, producing a spurious bar even when the artifact itself is cached.\n // Skip progress display for any download whose total size is known and small.\n if (info.total && info.total < 1_000_000) {\n return Promise.resolve()\n }\n if (!state.bar && process.stdout.isTTY) {\n log.info({ label }, \"downloading\")\n state.bar = new MultiProgress().createBar(`${\" \".repeat(PADDING + 2)}[:bar] :percent | ${label}`, { total: 100 })\n }\n const pct = info.percent != null ? Math.floor(info.percent * 100) : 0\n if (state.bar) {\n state.bar.update(pct)\n } else {\n // log every 25% milestone for non-TTY environments (e.g. CI logs) to provide some visibility into download progress without overwhelming logs with too many updates\n const percentCompleted = info.transferred && info.total ? Math.floor((info.transferred / info.total) * 100) : Math.floor(pct / 25) * 25\n if (percentCompleted > lastLoggedMilestone && percentCompleted > 0) {\n lastLoggedMilestone = percentCompleted\n log.info({ label, progress: `${percentCompleted}%` }, percentCompleted !== 100 ? \"downloading\" : \"downloaded\")\n }\n }\n return Promise.resolve()\n },\n }\n\n const configWithProgress = { ...config, downloadOptions }\n try {\n let filePath: string\n try {\n filePath = await retry(() => get.downloadArtifact(configWithProgress), {\n retries: 3,\n interval: 2000,\n backoff: 2000,\n shouldRetry: (e: any) =>\n e instanceof HttpError ? e.isServerError() : typeof e?.code === \"string\" && [\"ENOTFOUND\", \"ETIMEDOUT\", \"ECONNRESET\", \"EPIPE\", \"ENOENT\"].includes(e.code),\n })\n } catch (err) {\n if (typeof (err as any)?.message === \"string\" && (err as any).message.includes(\"dest already exists\")) {\n filePath = await get.downloadArtifact(configWithProgress)\n } else {\n throw err\n }\n }\n if (!(await exists(filePath))) {\n log.warn({ filePath, label }, \"cached artifact missing from disk; retrying with cache write\")\n filePath = await get.downloadArtifact({ ...configWithProgress, cacheMode: ElectronDownloadCacheMode.WriteOnly })\n }\n if (!state.bar && lastLoggedMilestone === -1) {\n log.info({ label }, \"using cached artifact\")\n }\n return filePath\n } finally {\n state.bar?.update(100)\n state.bar?.terminate()\n await releaseArtifactLock().catch(err => log.warn({ err }, \"failed to release artifact download lock\"))\n }\n}\n\n/**\n * Checks electron-builder's own archive cache for a previously downloaded archive.\n * Validates the SHA-256 checksum when one is known. Returns the cached path on hit,\n * null on miss or checksum mismatch (mismatch also deletes the stale file).\n *\n * Air-gapped seeding contract: placing the archive at\n * `<cacheDir>/<releaseName>/<archive>` (e.g. `$ELECTRON_BUILDER_CACHE/appimage@1.0.3/appimage-tools-runtime-20251108.tar.gz`)\n * is sufficient for a fully offline toolset resolution — the checksum here is computed locally\n * against the value hardcoded in the toolset module, and extraction happens locally too. No\n * `.state` file needs to be seeded. See https://www.electron.build/tutorials/offline-air-gapped-builds.\n */\nasync function resolveFromArchiveCache(archiveCachePath: string, label: string, expectedSha256: string | undefined): Promise<string | null> {\n if (!(await exists(archiveCachePath))) {\n return null\n }\n if (expectedSha256) {\n const hash = await new Promise<string>((resolve, reject) => {\n const h = crypto.createHash(\"sha256\")\n const s = createReadStream(archiveCachePath)\n s.on(\"error\", reject)\n s.on(\"data\", (chunk: Buffer | string) => h.update(chunk))\n s.on(\"end\", () => resolve(h.digest(\"hex\")))\n })\n if (hash !== expectedSha256) {\n log.warn({ file: label, archiveCachePath }, \"cached archive checksum mismatch — removing and re-downloading\")\n await fs.rm(archiveCachePath).catch(() => {})\n return null\n }\n }\n log.debug({ file: label, archiveCachePath }, \"using cached archive — skipping download\")\n return archiveCachePath\n}\n\n/**\n * Copies a freshly downloaded archive into electron-builder's own archive cache so that\n * future builds (including offline environments) can skip the network request entirely.\n */\nasync function persistToArchiveCache(sourcePath: string, archiveCachePath: string): Promise<void> {\n try {\n await fs.mkdir(path.dirname(archiveCachePath), { recursive: true })\n await fs.copyFile(sourcePath, archiveCachePath)\n } catch (err) {\n log.warn({ err, archiveCachePath }, \"failed to persist archive to cache — will re-download next time\")\n }\n}\n\n/**\n * Core download + extract engine. Handles lockfile, cache-hit short-circuit,\n * progress bar, extraction (.zip or .tar.gz), and completion marker.\n * Both public download functions delegate here after building their respective configs.\n */\nasync function downloadAndExtract(config: ElectronArtifactDetails, extractDir: string, label: string, archiveCachePath?: string): Promise<string> {\n // Create only the PARENT dir (e.g. <cache>/fpm@2.2.1), never extractDir itself, before locking.\n // The parent is stable — cleanup only ever removes extractDir and its .state/.tmp/.lock siblings —\n // so extractDir's whole lifecycle (mkdir, rm, re-mkdir) stays inside the lock. ensureDir absorbs\n // the concurrent-recursive-mkdir ENOENT/EEXIST race while peers populate the cold cache tree.\n await ensureDir(path.dirname(extractDir))\n\n // Pre-lock fast path: read-only short-circuit for a definitively complete and valid cache.\n // Safe unlocked — the cache-state helpers return null/false for a missing or half-written dir,\n // so a racing read only ever falls through to take the lock. Do NOT mutate the dir here.\n const stateData = await readCacheStateFile(extractDir)\n if (stateData?.state === CacheState.complete) {\n const isValid = await validateCacheDirectory(extractDir, stateData.fileCount)\n if (isValid) {\n log.debug({ file: label, path: extractDir }, \"using cached artifact - cache valid\")\n return extractDir\n }\n }\n\n // Be patient: when many targets/builds contend on the same toolset cache concurrently, all but the\n // first wait here while the winner downloads+extracts (a large bundle can take >1min). 15 retries\n // (~67s) is too few and waiters fail with ELOCKED before the winner finishes; 100 matches the\n // patience of withToolsetLock. proper-lockfile's update heartbeat keeps a live holder's lock fresh,\n // so increasing waiter retries never falsely steals an in-progress extraction.\n const release = await lockfile.lock(extractDir, {\n // realpath:false so proper-lockfile creates <extractDir>.lock in the (already-created) parent\n // WITHOUT calling fs.realpath(extractDir) first — which would throw ENOENT now that extractDir\n // is created lazily inside the lock. This filesystem lock serializes peers both across worker\n // processes AND within a single process (a second lock() for the same path retries until the\n // first releases), so no in-process promise cache is needed — and one wouldn't help across the\n // separate test worker processes anyway.\n realpath: false,\n retries: { retries: 100, minTimeout: 1000, maxTimeout: 5000 },\n stale: 120000,\n })\n let downloadedFile: string | null = null\n try {\n // Re-check after acquiring lock: another worker may have completed while we waited.\n const stateDataAfterLock = await readCacheStateFile(extractDir)\n if (stateDataAfterLock?.state === CacheState.complete) {\n const isValid = await validateCacheDirectory(extractDir, stateDataAfterLock.fileCount)\n if (isValid) {\n log.debug({ file: label, path: extractDir }, \"using cached artifact - skipping download/extract\")\n return extractDir\n }\n log.warn({ extractDir }, \"Cache marked complete but files invalid, clearing\")\n } else if (stateDataAfterLock?.state === CacheState.corrupted) {\n log.warn({ extractDir }, \"Corrupted cache detected, cleaning up and re-extracting\")\n }\n\n // Cleanup inside the lock — skip lock files since we currently hold them\n await cleanupCacheDirectory(extractDir, { skipLockFiles: true })\n await ensureDir(extractDir)\n\n // Check electron-builder's own archive cache before touching @electron/get.\n // The cache lives alongside the extract dir: <cacheDir>/<releaseName>/<filename>.\n // This lets repeated builds (or offline environments) skip the download entirely once\n // the archive has been fetched at least once.\n if (archiveCachePath) {\n downloadedFile = await resolveFromArchiveCache(archiveCachePath, label, (config as any).checksums?.[label])\n }\n\n if (!downloadedFile) {\n log.debug({ file: label }, \"downloading\")\n downloadedFile = await downloadArtifactToFile(config, label)\n if (!downloadedFile) {\n throw new Error(`Failed to download artifact: ${label}`)\n }\n // Persist the downloaded archive so future builds (and offline environments) can\n // skip the network request entirely.\n if (archiveCachePath) {\n await persistToArchiveCache(downloadedFile, archiveCachePath)\n }\n }\n\n await writeCacheState(extractDir, CacheState.downloaded)\n\n // Mark extracting so stale-lock detection can recover a crashed mid-extraction process\n await writeCacheState(extractDir, CacheState.extracting)\n\n // Extract while holding the lock to prevent concurrent interference\n await extractArchive(downloadedFile, extractDir)\n\n // Compute metadata with a full recursive walk now that tmpDir has been renamed to extractDir\n const { fileCount, extractedSize } = await computeCacheMetadata(extractDir)\n\n // Write complete state with metadata BEFORE releasing the lock; throwOnError=true so a\n // failed write (disk full, permissions) propagates instead of silently producing a no-op cache\n await writeCacheState(extractDir, CacheState.complete, { fileCount, extractedSize }, true)\n } finally {\n await release().catch(err => log.warn({ err }, \"failed to release lockfile\"))\n }\n return extractDir\n}\n\n// ─── Public API ───────────────────────────────────────────────────────────────\n\n/**\n * Copies a remote artifact to a specific output path on disk.\n * Unlike downloadBuilderToolset, this does not extract archives — it copies the raw file.\n * Used for certificate imports where the caller needs the file at a known path.\n */\nexport async function download(url: string, output: string, checksum?: string | null): Promise<void> {\n const filenameWithExt = path.basename(new URL(url).pathname)\n if (checksum == null) {\n log.warn({ url }, \"downloading without an integrity checksum — the download is not verified against a known-good hash\")\n }\n const downloadedFile = await downloadArtifactToFile(\n {\n version: \"9.9.9\",\n artifactName: filenameWithExt,\n cacheRoot: path.resolve(await cacheDirectoryOverrideAllowed.value, \"downloads\"),\n cacheMode: resolveCacheMode(),\n ...(checksum != null ? { checksums: { [filenameWithExt]: checksum } } : { unsafelyDisableChecksums: true }),\n mirrorOptions: { resolveAssetURL: async () => Promise.resolve(url) },\n isGeneric: true,\n },\n filenameWithExt\n )\n await fs.copyFile(downloadedFile, output)\n}\n\nfunction validateBinaryCustomDir(envVarName: string, value: string): string {\n if (value.includes(\"://\") || value.includes(\"..\") || value.startsWith(\"/\")) {\n throw new Error(\n `${envVarName} must be a safe relative path component (e.g. \"v1.0.0-custom\"). ` + `Values containing \"://\", \"..\", or a leading \"/\" are not allowed. Got: \"${value}\"`\n )\n }\n return value\n}\n\nconst CUSTOM_DIR_ENV_VARS = [\n \"NPM_CONFIG_ELECTRON_BUILDER_BINARIES_CUSTOM_DIR\",\n \"npm_config_electron_builder_binaries_custom_dir\",\n \"npm_package_config_electron_builder_binaries_custom_dir\",\n \"ELECTRON_BUILDER_BINARIES_CUSTOM_DIR\",\n] as const\n\n/**\n * Resolves the final download URL for a builder binary, honouring:\n * ELECTRON_BUILDER_BINARIES_DOWNLOAD_OVERRIDE_URL – fully replaces the URL directory\n * ELECTRON_BUILDER_BINARIES_CUSTOM_DIR (and npm_ variants) – replaces releaseName in the path\n * overrideUrl (caller-supplied) – used as-is when no env var is set\n *\n * Exported for unit testing; not part of the public API.\n * @internal\n */\nexport function resolveBuilderBinaryUrl(releaseName: string, filenameWithExt: string, baseUrl: string, overrideUrl?: string): string {\n const envOverrideUrl = parseValidEnvVarUrl(\"ELECTRON_BUILDER_BINARIES_DOWNLOAD_OVERRIDE_URL\")\n if (envOverrideUrl != null) {\n return `${envOverrideUrl}/${filenameWithExt}`\n }\n if (overrideUrl != null) {\n return `${overrideUrl}/${filenameWithExt}`\n }\n const customDirEntry = CUSTOM_DIR_ENV_VARS.map(name => ({ name, value: process.env[name] })).find(e => e.value != null)\n if (customDirEntry != null) {\n return `${baseUrl}${validateBinaryCustomDir(customDirEntry.name, customDirEntry.value!)}/${filenameWithExt}`\n }\n return `${baseUrl}${releaseName}/${filenameWithExt}`\n}\n\n/**\n * Downloads a generic artifact (.tar.gz or .zip) from a GitHub release.\n * Used for electron-builder-binaries tools (appimage, etc.).\n */\nexport async function downloadBuilderToolset(options: {\n releaseName: string\n filenameWithExt: string\n checksums?: Record<string, string>\n githubOrgRepo?: string\n overrideUrl?: string\n}): Promise<string> {\n const { releaseName, filenameWithExt, checksums, githubOrgRepo = \"electron-userland/electron-builder-binaries\", overrideUrl } = options\n\n if (/[/\\\\]|^\\.\\./.test(filenameWithExt) || filenameWithExt.includes(\"..\")) {\n throw new Error(`downloadBuilderToolset: unsafe filenameWithExt \"${filenameWithExt}\" — must be a plain filename with no path separators or traversal sequences`)\n }\n\n const baseUrl = getBinariesMirrorUrl(githubOrgRepo)\n const fullUrl = resolveBuilderBinaryUrl(releaseName, filenameWithExt, baseUrl, overrideUrl)\n const suffix = hashUrlSafe(fullUrl, 5)\n // tar.7z is listed before 7z so the full extension is stripped. Deliberate side effect: this changes the\n // extract-dir name for .tar.7z toolsets (e.g. the snap template) from \"<name>.tar-<hash>\" to \"<name>-<hash>\",\n // which busts caches poisoned by the broken .tar.7z extraction in 26.15.0-26.15.6 (issue #10002).\n const folderName = `${filenameWithExt.replace(/\\.(tar\\.gz|tgz|tar\\.xz|txz|tar\\.7z|zip|7z)$/, \"\")}-${suffix}`\n // releaseName is library input; enforce cache-dir containment (rejects traversal, clears taint into shell extraction)\n const cacheDir = await cacheDirectoryOverrideAllowed.value\n const extractDir = sanitizeDirPath(path.join(cacheDir, releaseName, folderName), cacheDir)\n\n // Use resolveAssetURL so @electron/get's ELECTRON_MIRROR env var check cannot override\n // the builder-binaries URL we've already resolved (see getArtifactRemoteURL in @electron/get).\n const mirrorOptions: MirrorOptions = {\n resolveAssetURL: async () => Promise.resolve(fullUrl),\n }\n\n // Predictable archive cache: <cacheDir>/<releaseName>/<filename>, next to the extract dir.\n // downloadAndExtract checks here before touching @electron/get and persists the archive here\n // after every successful download, so subsequent builds never need a network round-trip.\n const archiveCachePath = sanitizeDirPath(path.join(cacheDir, releaseName, filenameWithExt), cacheDir)\n\n const config: ElectronDownloadRequest & ElectronDownloadRequestOptions & { isGeneric: true } = {\n version: \"9.9.9\", // must be >1.3.2 to bypass @electron/get validation shortcut\n artifactName: filenameWithExt,\n cacheRoot: path.resolve(await cacheDirectoryOverrideAllowed.value, \"downloads\"),\n cacheMode: resolveCacheMode(),\n ...(checksums != null ? { checksums } : { unsafelyDisableChecksums: true }),\n mirrorOptions,\n isGeneric: true,\n }\n return downloadAndExtract(config, extractDir, filenameWithExt, archiveCachePath)\n}\n\n/**\n * Mirrors @electron/get's default cache root (`env-paths(\"electron\", { suffix: \"\" }).cache`).\n * @electron/get does not export it and its package `exports` map blocks deep imports, so the\n * (deliberately tiny) platform switch is replicated here. Must stay in sync with the\n * `cacheRoot` default documented in @electron/get's `ElectronDownloadRequestOptions`.\n * @internal exported for unit testing\n */\nexport function defaultElectronGetCacheRoot(): string {\n const name = \"electron\"\n const homeDir = os.homedir()\n switch (os.platform()) {\n case \"darwin\":\n return path.join(homeDir, \"Library\", \"Caches\", name)\n case \"win32\":\n return path.join(process.env.LOCALAPPDATA || path.join(homeDir, \"AppData\", \"Local\"), name, \"Cache\")\n default:\n return path.join(process.env.XDG_CACHE_HOME || path.join(homeDir, \".cache\"), name)\n }\n}\n\n/**\n * Parses the upstream `SHASUMS256.txt` format into the `Record<filename, sha256-hex>` shape that\n * @electron/get accepts as inline `checksums`. Each line is `<sha256-hex> *<filename>` (binary\n * mode) or `<sha256-hex> <filename>` (text mode); malformed lines are ignored.\n * @internal exported for unit testing\n */\nexport function parseChecksumFile(content: string): Record<string, string> {\n const checksums: Record<string, string> = {}\n for (const rawLine of content.split(\"\\n\")) {\n const match = /^([a-fA-F0-9]{64})\\s+\\*?(.+)$/.exec(rawLine.trim())\n if (match != null) {\n checksums[match[2]] = match[1].toLowerCase()\n }\n }\n return checksums\n}\n\n/**\n * Looks for a locally seeded SHASUMS256 file at the root of the @electron/get cache and returns\n * its contents as inline `checksums`, or null when nothing usable is seeded.\n *\n * Why: without inline `checksums`, @electron/get re-downloads `SHASUMS256.txt` with a hardcoded\n * `cacheMode: Bypass` on EVERY build — even when the artifact itself is a cache hit — so a fully\n * seeded cache still requires network access and air-gapped builds fail (#10039). Cache-seeding\n * tools (e.g. flatpak-node-generator) already place `SHASUMS256.txt-<version>` flat at the cache\n * root; feeding it back as inline `checksums` keeps checksum validation enabled while making it\n * fully offline. A plain `SHASUMS256.txt` at the cache root is accepted as a manual-seeding\n * fallback. A candidate file is only used when it actually contains an entry for the requested\n * artifact, so a stale file for another version can never break an online build.\n * See https://www.electron.build/tutorials/offline-air-gapped-builds for the seeding contract.\n * @internal exported for unit testing\n */\nexport async function resolveSeededChecksums(cacheRoot: string, version: string, artifactFileName: string): Promise<Record<string, string> | null> {\n const candidates = [path.join(cacheRoot, `SHASUMS256.txt-${version}`), path.join(cacheRoot, \"SHASUMS256.txt\")]\n for (const candidate of candidates) {\n if (!(await exists(candidate))) {\n continue\n }\n let content: string\n try {\n content = await fs.readFile(candidate, \"utf-8\")\n } catch (err: any) {\n log.warn({ file: log.filePath(candidate), err: err.message }, \"failed to read seeded SHASUMS file — ignoring it\")\n continue\n }\n const checksums = parseChecksumFile(content)\n if (checksums[artifactFileName] == null) {\n log.warn({ file: log.filePath(candidate), artifactFileName }, \"seeded SHASUMS file has no entry for the requested artifact — ignoring it\")\n continue\n }\n log.debug({ file: log.filePath(candidate), artifactFileName }, \"using locally seeded SHASUMS256 checksums — checksum validation can run offline\")\n return checksums\n }\n return null\n}\n\n/**\n * Assembles the `@electron/get` artifact config (`ElectronPlatformArtifactDetails`) from\n * `ArtifactDownloadOptions`: spreads the caller's options and pins `cacheRoot`/`platform`/`arch`/\n * `version`/`artifactName` and the resolved cache mode, warning when checksum verification is\n * disabled. When the caller provides no `checksums` (user-provided `electronGet.checksums` always\n * wins) and verification is not disabled, a locally seeded `SHASUMS256.txt-<version>` at the cache\n * root is picked up as inline `checksums` so validation works offline (see resolveSeededChecksums).\n * Callers pass the result to `downloadArtifactToFile` / `downloadAndExtract`.\n * @internal exported for unit testing\n */\nexport async function buildElectronArtifactConfig(artifactOptions: ArtifactDownloadOptions): Promise<ElectronPlatformArtifactDetails> {\n const { options, arch, version, platformName: platform, artifactName, cacheDir: cacheRoot } = artifactOptions\n\n if (options?.unsafelyDisableChecksums) {\n log.warn(\n { artifactName },\n \"electronGet.unsafelyDisableChecksums is enabled — downloaded artifacts will NOT be verified; a compromised mirror can serve malicious binaries undetected\"\n )\n }\n\n const artifactConfig: ElectronPlatformArtifactDetails = { ...options, cacheRoot, platform, arch, version, artifactName, cacheMode: resolveCacheMode() }\n if (artifactConfig.checksums == null && !artifactConfig.unsafelyDisableChecksums) {\n // Matches @electron/get's getArtifactFileName for non-generic artifacts; `artifactSuffix` and\n // `customFilename` cannot diverge here — both are excluded from ElectronGetOptions.\n const artifactFileName = `${artifactName}-v${version}-${platform}-${arch}.zip`\n const seededChecksums = await resolveSeededChecksums(cacheRoot ?? defaultElectronGetCacheRoot(), version, artifactFileName)\n if (seededChecksums != null) {\n artifactConfig.checksums = seededChecksums\n }\n }\n return artifactConfig\n}\n\n/**\n * Downloads the electron artifact zip via @electron/get (with caching) and returns the zip file path.\n * Use when you need to extract the zip yourself (e.g. directly to appOutDir to preserve empty dirs and symlinks).\n */\nexport async function downloadElectronArtifactZip(options: ArtifactDownloadOptions): Promise<string> {\n const config = await buildElectronArtifactConfig(options)\n return downloadArtifactToFile(config, config.artifactName)\n}\n\n/**\n * Downloads an electron platform artifact (e.g. ffmpeg) via `@electron/get` and extracts it into a\n * content-addressed cache directory (keyed on a hash of the resolved artifact config), returning the\n * extraction path.\n */\nexport async function downloadElectronArtifact(options: ArtifactDownloadOptions): Promise<string> {\n const { arch, version, platformName: platform, artifactName } = options\n const artifactConfig = await buildElectronArtifactConfig(options)\n\n const suffix = hashUrlSafe(JSON.stringify(artifactConfig), 5)\n const folderName = `${artifactName}-v${version}-${platform}-${arch}-${suffix}`\n const extractDir = path.join(await cacheDirectoryOverrideAllowed.value, `${artifactName}-v${version}`, folderName)\n\n return downloadAndExtract(artifactConfig, extractDir, artifactName)\n}\n\n/**\n * Get the binaries mirror URL from environment variables.\n * Supports various npm config formats and falls back to GitHub.\n */\nexport function getBinariesMirrorUrl(githubOrgRepo: string): string {\n const allowHttp = process.env[\"ELECTRON_BUILDER_DANGEROUSLY_ALLOW_HTTP\"] === \"true\"\n for (const envVar of [\n \"NPM_CONFIG_ELECTRON_BUILDER_BINARIES_MIRROR\",\n \"npm_config_electron_builder_binaries_mirror\",\n \"npm_package_config_electron_builder_binaries_mirror\",\n \"ELECTRON_BUILDER_BINARIES_MIRROR\",\n ]) {\n const url = parseValidEnvVarUrl(envVar, allowHttp)\n if (url) {\n return url.endsWith(\"/\") ? url : `${url}/`\n }\n }\n return `https://github.com/${githubOrgRepo}/releases/download/`\n}\n"]}
|
|
1
|
+
{"version":3,"file":"electronGet.js","sourceRoot":"","sources":["../../src/util/electronGet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,eAAe,CAAA;AACpC,OAAO,EAEL,yBAAyB,GAM1B,MAAM,eAAe,CAAA;AACtB,OAAO,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R,OAAO,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,CAAA;QAC5C,CAAC;IACH,CAAC;IACD,OAAO,sBAAsB,aAAa,qBAAqB,CAAA;AACjE,CAAC","sourcesContent":["import * as get from \"@electron/get\"\nimport {\n ElectronArtifactDetails,\n ElectronDownloadCacheMode,\n ElectronDownloadRequest,\n ElectronDownloadRequestOptions,\n ElectronPlatformArtifactDetails,\n FetchDownloaderOptions,\n MirrorOptions,\n} from \"@electron/get\"\nimport { exec, exists, log, PADDING, parseValidEnvVarUrl, sanitizeDirPath, to7zaOutputSwitch, ensureDir, moveDirAtomic } from \"builder-util\"\nimport { HttpError, MemoLazy, retry, sleep } from \"builder-util-runtime\"\nimport * as crypto from \"crypto\"\nimport type { ProgressBar } from \"electron-publish\"\nimport { MultiProgress } from \"electron-publish\"\nimport { createReadStream, createWriteStream } from \"fs\"\nimport * as fs from \"fs/promises\"\nimport * as os from \"os\"\nimport * as path from \"path\"\nimport * as lockfile from \"proper-lockfile\"\nimport { pipeline } from \"stream/promises\"\nimport * as tar from \"tar\"\nimport * as unzipper from \"unzipper\"\nimport { getPath7za } from \"../toolsets/7zip.js\"\nimport { CacheState, cleanupCacheDirectory, computeCacheMetadata, readCacheStateFile, validateCacheDirectory, writeCacheState } from \"./cacheState.js\"\n\nexport interface ElectronGetOptions extends Omit<\n ElectronPlatformArtifactDetails,\n | \"platform\"\n | \"arch\"\n | \"version\"\n | \"artifactName\"\n | \"artifactSuffix\"\n | \"customFilename\"\n | \"tempDirectory\"\n | \"downloader\"\n | \"cacheMode\"\n | \"cacheRoot\"\n | \"downloadOptions\"\n | \"isGeneric\"\n | \"mirrorOptions\"\n> {\n mirrorOptions?: Omit<MirrorOptions, \"customDir\" | \"customFilename\" | \"customVersion\">\n}\n\nexport type ArtifactDownloadOptions = {\n options?: ElectronGetOptions | null\n artifactName: string\n platformName: string\n arch: string\n version: string\n cacheDir?: string\n}\n\nexport function hashUrlSafe(input: string, length = 6): string {\n let hash = 5381\n for (let i = 0; i < input.length; i++) {\n hash = ((hash << 5) + hash) ^ input.charCodeAt(i)\n }\n hash >>>= 0\n const out = hash.toString(36)\n return out.length >= length ? out.slice(0, length) : out.padStart(length, \"0\")\n}\n\n// MemoLazy (not Lazy): keyed on ELECTRON_BUILDER_CACHE so the resolved cache dir is recomputed if the\n// override env var changes, while staying memoized when it doesn't (the production case). The creator\n// also ensures the resolved dir exists — that side effect lives here, at the point of use, so\n// getCacheDirectoryInternal stays a pure path resolver.\nexport const cacheDirectoryOverrideAllowed = new MemoLazy<string | undefined, string>(\n () => process.env.ELECTRON_BUILDER_CACHE?.trim(),\n async () => {\n const dir = await getCacheDirectoryInternal({ isAvoidSystemOnWindows: true, allowEnvVarOverride: true })\n await ensureDir(dir)\n return dir\n }\n)\n// Exposed for testing; not intended for public use. Pure path resolution (no I/O) — use the memoized\n// const's above when you need the directory to exist on disk. Kept async for a stable Promise-returning\n// contract across all call sites.\n// eslint-disable-next-line @typescript-eslint/require-await\nexport async function getCacheDirectoryInternal(options: { isAvoidSystemOnWindows?: boolean; allowEnvVarOverride: boolean }): Promise<string> {\n const { isAvoidSystemOnWindows = true, allowEnvVarOverride } = options\n const env = process.env.ELECTRON_BUILDER_CACHE?.trim()\n if (allowEnvVarOverride && env && path.parse(env).root) {\n return sanitizeDirPath(env)\n }\n\n const appName = \"electron-builder\"\n const platform = os.platform()\n const homeDir = os.homedir()\n\n if (platform === \"darwin\") {\n return path.join(homeDir, \"Library\", \"Caches\", appName)\n }\n if (platform === \"win32\") {\n const localAppData = process.env.LOCALAPPDATA?.trim()\n const username = process.env.USERNAME?.trim()?.toLowerCase()\n // https://github.com/electron-userland/electron-builder/issues/1164\n const isSystemUser = isAvoidSystemOnWindows && (localAppData?.toLowerCase()?.includes(\"\\\\windows\\\\system32\\\\\") || username === \"system\")\n if (!localAppData || isSystemUser) {\n return path.join(os.tmpdir(), `${appName}-cache`)\n }\n return path.join(localAppData, appName, \"Cache\")\n }\n\n const xdgCache = process.env.XDG_CACHE_HOME\n return xdgCache && path.parse(xdgCache).root ? path.join(xdgCache, appName) : path.join(homeDir, \".cache\", appName)\n}\n\nfunction resolveCacheMode(): ElectronDownloadCacheMode {\n const varName = \"ELECTRON_DOWNLOAD_CACHE_MODE\"\n const cacheOverride = process.env[varName]?.trim()\n if (cacheOverride && Number(cacheOverride) in ElectronDownloadCacheMode) {\n const mode = Number(cacheOverride) as ElectronDownloadCacheMode\n log.debug({ mode }, `cache mode overridden via env var ${varName}`)\n return mode\n }\n return ElectronDownloadCacheMode.ReadWrite\n}\n\n/**\n * Returns true when `destPath` is safely contained within `dir` (direct child or deeper).\n * On Windows the filesystem is case-insensitive so the comparison is normalised to lowercase.\n * @internal exported for unit testing\n */\nexport function isSafeExtractPath(destPath: string, dir: string): boolean {\n const normalizedDest = path.resolve(destPath)\n const normalizedDir = path.resolve(dir)\n if (process.platform === \"win32\") {\n const d = normalizedDest.toLowerCase()\n const b = normalizedDir.toLowerCase()\n return d.startsWith(b + path.sep) || d === b\n }\n return normalizedDest.startsWith(normalizedDir + path.sep) || normalizedDest === normalizedDir\n}\n\nasync function extractZipStreaming(file: string, dir: string): Promise<void> {\n // Pass 1: read central directory once to collect Unix modes (one seek to EOF)\n const zipDir = await unzipper.Open.file(file)\n const entryModes = new Map<string, number>()\n for (const entry of zipDir.files) {\n const mode = (entry.externalFileAttributes >> 16) & 0xffff\n if (mode > 0) {\n entryModes.set(entry.path, mode)\n }\n }\n const isSymlink = (mode: number) => (mode & 0o170000) === 0o120000\n\n // Pass 2: stream from byte 0 — no per-entry seeks, no Docker hang.\n // Destroy the read stream in a finally block so the file handle is always released,\n // including when the loop exits early due to a thrown error.\n const readStream = createReadStream(file)\n try {\n const entries = readStream.pipe(unzipper.Parse({ forceStream: true }))\n for await (const entry of entries as AsyncIterable<unzipper.Entry>) {\n const destPath = path.resolve(dir, entry.path)\n if (!isSafeExtractPath(destPath, dir)) {\n throw new Error(`Path traversal blocked: ${entry.path}`)\n }\n const mode = entryModes.get(entry.path) ?? 0\n if (mode > 0 && isSymlink(mode)) {\n const target = (await entry.buffer()).toString()\n if (path.isAbsolute(target)) {\n throw new Error(`Absolute symlink target blocked: ${target}`)\n }\n const resolvedTarget = path.resolve(path.dirname(destPath), target)\n if (!isSafeExtractPath(resolvedTarget, dir)) {\n throw new Error(`Symlink target escapes extraction dir: ${target}`)\n }\n await fs.mkdir(path.dirname(destPath), { recursive: true })\n await fs.symlink(target, destPath)\n } else if (entry.type === \"Directory\") {\n await fs.mkdir(destPath, { recursive: true })\n entry.autodrain()\n } else {\n await fs.mkdir(path.dirname(destPath), { recursive: true })\n await pipeline(entry, createWriteStream(destPath))\n if (mode > 0) {\n await fs.chmod(destPath, mode & 0o7777)\n }\n }\n }\n } finally {\n readStream.destroy()\n }\n}\n\nexport async function extractArchive(archive: string, dir: string) {\n const file = sanitizeDirPath(archive)\n\n const tmpDir = `${dir}.tmp`\n await fs.mkdir(tmpDir, { recursive: true })\n\n const release = await lockfile.lock(tmpDir, {\n // 100 retries (not 15) so concurrent callers wait out a slow first extraction instead of failing\n // with ELOCKED; the update heartbeat keeps an in-progress holder's lock fresh against `stale`.\n retries: { retries: 100, minTimeout: 1000, maxTimeout: 5000 },\n stale: 120000, // Increased from 60s to allow long-running extractions\n })\n\n try {\n // rm + mkdir happen AFTER acquiring the lock so no concurrent caller can clear our tmpDir mid-extraction\n await fs.rm(tmpDir, { recursive: true, force: true })\n await fs.mkdir(tmpDir, { recursive: true })\n\n // Guard against the transient window in @electron/get's non-atomic putFileInCache (remove → move).\n // A concurrent worker may have deleted and not yet replaced the source archive; wait briefly for it.\n for (let i = 0; !(await exists(file)); i++) {\n if (i >= 4) {\n throw Object.assign(new Error(`Source archive not found after retries: ${file}`), { code: \"ENOENT\", path: file })\n }\n log.warn({ file, attempt: i + 1 }, \"source archive transiently missing, retrying\")\n await sleep(300 * (i + 1))\n }\n\n if (file.endsWith(\".tar.gz\") || file.endsWith(\".tgz\")) {\n await tar.extract({ file, cwd: tmpDir, strip: 1 })\n } else if (file.endsWith(\".tar.xz\") || file.endsWith(\".txz\") || file.endsWith(\".tar.7z\")) {\n // Compressed tarballs node-tar cannot decompress itself (xz, 7z): use 7za to strip the outer\n // compression layer into a .tar, then extract that tar.\n // Note: the .tar.7z check MUST stay ahead of the plain .7z branch below, otherwise only the outer\n // 7z layer is removed and the inner tar is left behind as-is (see https://github.com/electron-userland/electron-builder/issues/10002).\n const cmd7za = await getPath7za()\n const decompressOutDir = `${tmpDir}.decompress`\n await fs.rm(decompressOutDir, { recursive: true, force: true })\n await fs.mkdir(decompressOutDir, { recursive: true })\n try {\n await exec(cmd7za, [\"x\", \"-bd\", file, to7zaOutputSwitch(sanitizeDirPath(decompressOutDir)), \"-y\"])\n const innerTar = (await fs.readdir(decompressOutDir)).find(f => f.endsWith(\".tar\"))\n if (innerTar == null) {\n throw new Error(`decompression of ${path.basename(file)} produced no .tar archive`)\n }\n await tar.extract({ file: path.join(decompressOutDir, innerTar), cwd: tmpDir, strip: 1 })\n } finally {\n await fs.rm(decompressOutDir, { recursive: true, force: true })\n }\n } else if (file.endsWith(\".zip\")) {\n await extractZipStreaming(file, tmpDir)\n } else if (file.endsWith(\".7z\")) {\n const cmd7za = await getPath7za()\n try {\n await exec(cmd7za, [\"x\", \"-bd\", file, to7zaOutputSwitch(sanitizeDirPath(tmpDir)), \"-y\"])\n } catch (e: any) {\n // Check if extraction actually failed or just had benign warnings\n const files = await fs.readdir(tmpDir)\n if (files.length === 0) {\n log.warn({ file: log.filePath(file), tmpDir: log.filePath(tmpDir), error: e.message }, \"7z extraction produced no output\")\n throw new Error(`7z extraction failed for ${file}: ${e.message}`)\n }\n // If files were extracted despite the error, log and continue\n log.warn({ error: e.message, filesExtracted: files.length }, \"7z reported error but extracted files\")\n }\n } else {\n throw new Error(`Unsupported archive format: ${path.basename(file)}`)\n }\n\n // Verify extraction produced files\n const extractedFiles = await fs.readdir(tmpDir)\n if (extractedFiles.length === 0) {\n throw new Error(`Extraction of ${path.basename(file)} produced no files`)\n }\n\n await fs.rm(dir, { recursive: true, force: true })\n await moveDirAtomic(tmpDir, dir)\n } finally {\n await release().catch(err => log.warn({ err }, \"failed to release lockfile\"))\n }\n}\n\nlet proxyInitialized = false\nfunction initializeProxyOnce(): void {\n if (!proxyInitialized) {\n reinitializeProxy()\n proxyInitialized = true\n }\n}\n\n/**\n * Forces undici's global proxy dispatcher to re-read the current HTTP(S)_PROXY / NO_PROXY env vars,\n * bypassing the once-guard in initializeProxyOnce(). Exported for integration testing only.\n */\nexport function reinitializeProxy(): void {\n get.initializeProxy()\n}\n\n/**\n * Error codes considered transient for artifact downloads. Plain node socket errors carry the code\n * directly on `error.code`; undici (the fetch implementation used by @electron/get v5) wraps them in\n * a `TypeError: fetch failed` whose code lives on `error.cause.code` — including undici's own\n * `UND_ERR_*` codes for connection resets and connect timeouts.\n */\nconst TRANSIENT_DOWNLOAD_ERROR_CODES = new Set([\n \"ENOTFOUND\",\n \"ETIMEDOUT\",\n \"ECONNRESET\",\n \"ECONNREFUSED\",\n \"EAI_AGAIN\",\n \"EPIPE\",\n \"ENOENT\",\n \"UND_ERR_SOCKET\",\n \"UND_ERR_CONNECT_TIMEOUT\",\n])\n\n/**\n * Decides whether a failed @electron/get download should be retried. Handles all three error shapes\n * seen in practice (exported for tests):\n * - builder-util-runtime's `HttpError` — retry on 5xx.\n * - @electron/get v5's `HTTPError` (`FetchDownloader`) — a plain `Error` subclass with the fetch\n * `Response` on `.response` and NO `.code`; retry on 5xx and 429. Matched by class and by\n * `name === \"HTTPError\"` as a fallback in case multiple @electron/get copies are loaded.\n * - transient network errors — code on `error.code`, or on `error.cause.code` for undici's\n * `TypeError: fetch failed` wrapper.\n */\nexport function shouldRetryDownloadError(e: any): boolean {\n if (e == null) {\n return false\n }\n if (e instanceof HttpError) {\n return e.isServerError()\n }\n if (e instanceof get.HTTPError || e.name === \"HTTPError\") {\n const status = e.response?.status\n return typeof status === \"number\" && (status >= 500 || status === 429)\n }\n const code = typeof e.code === \"string\" ? e.code : typeof e.cause?.code === \"string\" ? e.cause.code : undefined\n return code != null && TRANSIENT_DOWNLOAD_ERROR_CODES.has(code)\n}\n\nasync function downloadArtifactToFile(config: ElectronArtifactDetails, label: string): Promise<string> {\n // Serialize concurrent downloads of the same artifact across vitest workers to prevent @electron/get's\n // non-atomic putFileInCache (remove + move) from racing with a concurrent reader.\n const key = {\n p: (config as ElectronPlatformArtifactDetails).platform,\n a: (config as ElectronPlatformArtifactDetails).arch,\n v: config.version,\n n: config.artifactName,\n g: config.isGeneric,\n }\n\n const artifactLockKey = crypto.createHash(\"sha256\").update(JSON.stringify(key)).digest(\"hex\").slice(0, 20)\n const artifactLockPath = path.join(os.tmpdir(), `eb-dl-${artifactLockKey}.lock`)\n // This lock is taken even for cache hits (the cache-hit check lives inside @electron/get), so under\n // heavy concurrency many builds serialize here. 30 retries (~137s of backoff) is too few — waiters\n // were exhausting it and failing with ELOCKED while the holder fetched a large artifact. 100 retries\n // matches the other toolset locks; stale (10min) + proper-lockfile's update heartbeat keep a live\n // downloader's lock fresh so the longer wait never falsely steals an in-progress download.\n const releaseArtifactLock = await lockfile.lock(artifactLockPath, {\n retries: { retries: 100, minTimeout: 500, maxTimeout: 5000 },\n stale: 600_000,\n realpath: false,\n })\n let lastLoggedMilestone = -1\n const state: { bar: ProgressBar | undefined } = { bar: undefined }\n\n // @electron/get v5 downloads via fetch, whose proxy support comes from undici's global dispatcher.\n // initializeProxy() wires that up from HTTP(S)_PROXY/NO_PROXY env vars (replaces the got proxy agent).\n initializeProxyOnce()\n\n const downloadOptions: FetchDownloaderOptions = {\n signal: AbortSignal.timeout(10 * 60 * 1000), // prevent indefinite hang on stalled connections\n ...config.downloadOptions,\n getProgressCallback: info => {\n // @electron/get passes downloadOptions (including this callback) to its internal\n // SHASUMS256.txt validation download. That file is tiny (<1 MB) and fires at 100%\n // immediately, producing a spurious bar even when the artifact itself is cached.\n // Skip progress display for any download whose total size is known and small.\n if (info.total && info.total < 1_000_000) {\n return Promise.resolve()\n }\n if (!state.bar && process.stdout.isTTY) {\n log.info({ label }, \"downloading\")\n state.bar = new MultiProgress().createBar(`${\" \".repeat(PADDING + 2)}[:bar] :percent | ${label}`, { total: 100 })\n }\n const pct = info.percent != null ? Math.floor(info.percent * 100) : 0\n if (state.bar) {\n state.bar.update(pct)\n } else {\n // log every 25% milestone for non-TTY environments (e.g. CI logs) to provide some visibility into download progress without overwhelming logs with too many updates\n const percentCompleted = info.transferred && info.total ? Math.floor((info.transferred / info.total) * 100) : Math.floor(pct / 25) * 25\n if (percentCompleted > lastLoggedMilestone && percentCompleted > 0) {\n lastLoggedMilestone = percentCompleted\n log.info({ label, progress: `${percentCompleted}%` }, percentCompleted !== 100 ? \"downloading\" : \"downloaded\")\n }\n }\n return Promise.resolve()\n },\n }\n\n const configWithProgress = { ...config, downloadOptions }\n try {\n let filePath: string\n try {\n filePath = await retry(() => get.downloadArtifact(configWithProgress), {\n retries: 3,\n interval: 2000,\n backoff: 2000,\n shouldRetry: shouldRetryDownloadError,\n })\n } catch (err) {\n if (typeof (err as any)?.message === \"string\" && (err as any).message.includes(\"dest already exists\")) {\n filePath = await get.downloadArtifact(configWithProgress)\n } else {\n throw err\n }\n }\n if (!(await exists(filePath))) {\n log.warn({ filePath, label }, \"cached artifact missing from disk; retrying with cache write\")\n filePath = await get.downloadArtifact({ ...configWithProgress, cacheMode: ElectronDownloadCacheMode.WriteOnly })\n }\n if (!state.bar && lastLoggedMilestone === -1) {\n log.info({ label }, \"using cached artifact\")\n }\n return filePath\n } finally {\n state.bar?.update(100)\n state.bar?.terminate()\n await releaseArtifactLock().catch(err => log.warn({ err }, \"failed to release artifact download lock\"))\n }\n}\n\n/**\n * Checks electron-builder's own archive cache for a previously downloaded archive.\n * Validates the SHA-256 checksum when one is known. Returns the cached path on hit,\n * null on miss or checksum mismatch (mismatch also deletes the stale file).\n *\n * Air-gapped seeding contract: placing the archive at\n * `<cacheDir>/<releaseName>/<archive>` (e.g. `$ELECTRON_BUILDER_CACHE/appimage@1.0.3/appimage-tools-runtime-20251108.tar.gz`)\n * is sufficient for a fully offline toolset resolution — the checksum here is computed locally\n * against the value hardcoded in the toolset module, and extraction happens locally too. No\n * `.state` file needs to be seeded. See https://www.electron.build/tutorials/offline-air-gapped-builds.\n */\nasync function resolveFromArchiveCache(archiveCachePath: string, label: string, expectedSha256: string | undefined): Promise<string | null> {\n if (!(await exists(archiveCachePath))) {\n return null\n }\n if (expectedSha256) {\n const hash = await new Promise<string>((resolve, reject) => {\n const h = crypto.createHash(\"sha256\")\n const s = createReadStream(archiveCachePath)\n s.on(\"error\", reject)\n s.on(\"data\", (chunk: Buffer | string) => h.update(chunk))\n s.on(\"end\", () => resolve(h.digest(\"hex\")))\n })\n if (hash !== expectedSha256) {\n log.warn({ file: label, archiveCachePath }, \"cached archive checksum mismatch — removing and re-downloading\")\n await fs.rm(archiveCachePath).catch(() => {})\n return null\n }\n }\n log.debug({ file: label, archiveCachePath }, \"using cached archive — skipping download\")\n return archiveCachePath\n}\n\n/**\n * Copies a freshly downloaded archive into electron-builder's own archive cache so that\n * future builds (including offline environments) can skip the network request entirely.\n */\nasync function persistToArchiveCache(sourcePath: string, archiveCachePath: string): Promise<void> {\n try {\n await fs.mkdir(path.dirname(archiveCachePath), { recursive: true })\n await fs.copyFile(sourcePath, archiveCachePath)\n } catch (err) {\n log.warn({ err, archiveCachePath }, \"failed to persist archive to cache — will re-download next time\")\n }\n}\n\n/**\n * Core download + extract engine. Handles lockfile, cache-hit short-circuit,\n * progress bar, extraction (.zip or .tar.gz), and completion marker.\n * Both public download functions delegate here after building their respective configs.\n */\nasync function downloadAndExtract(config: ElectronArtifactDetails, extractDir: string, label: string, archiveCachePath?: string): Promise<string> {\n // Create only the PARENT dir (e.g. <cache>/fpm@2.2.1), never extractDir itself, before locking.\n // The parent is stable — cleanup only ever removes extractDir and its .state/.tmp/.lock siblings —\n // so extractDir's whole lifecycle (mkdir, rm, re-mkdir) stays inside the lock. ensureDir absorbs\n // the concurrent-recursive-mkdir ENOENT/EEXIST race while peers populate the cold cache tree.\n await ensureDir(path.dirname(extractDir))\n\n // Pre-lock fast path: read-only short-circuit for a definitively complete and valid cache.\n // Safe unlocked — the cache-state helpers return null/false for a missing or half-written dir,\n // so a racing read only ever falls through to take the lock. Do NOT mutate the dir here.\n const stateData = await readCacheStateFile(extractDir)\n if (stateData?.state === CacheState.complete) {\n const isValid = await validateCacheDirectory(extractDir, stateData.fileCount)\n if (isValid) {\n log.debug({ file: label, path: extractDir }, \"using cached artifact - cache valid\")\n return extractDir\n }\n }\n\n // Be patient: when many targets/builds contend on the same toolset cache concurrently, all but the\n // first wait here while the winner downloads+extracts (a large bundle can take >1min). 15 retries\n // (~67s) is too few and waiters fail with ELOCKED before the winner finishes; 100 matches the\n // patience of withToolsetLock. proper-lockfile's update heartbeat keeps a live holder's lock fresh,\n // so increasing waiter retries never falsely steals an in-progress extraction.\n const release = await lockfile.lock(extractDir, {\n // realpath:false so proper-lockfile creates <extractDir>.lock in the (already-created) parent\n // WITHOUT calling fs.realpath(extractDir) first — which would throw ENOENT now that extractDir\n // is created lazily inside the lock. This filesystem lock serializes peers both across worker\n // processes AND within a single process (a second lock() for the same path retries until the\n // first releases), so no in-process promise cache is needed — and one wouldn't help across the\n // separate test worker processes anyway.\n realpath: false,\n retries: { retries: 100, minTimeout: 1000, maxTimeout: 5000 },\n stale: 120000,\n })\n let downloadedFile: string | null = null\n try {\n // Re-check after acquiring lock: another worker may have completed while we waited.\n const stateDataAfterLock = await readCacheStateFile(extractDir)\n if (stateDataAfterLock?.state === CacheState.complete) {\n const isValid = await validateCacheDirectory(extractDir, stateDataAfterLock.fileCount)\n if (isValid) {\n log.debug({ file: label, path: extractDir }, \"using cached artifact - skipping download/extract\")\n return extractDir\n }\n log.warn({ extractDir }, \"Cache marked complete but files invalid, clearing\")\n } else if (stateDataAfterLock?.state === CacheState.corrupted) {\n log.warn({ extractDir }, \"Corrupted cache detected, cleaning up and re-extracting\")\n }\n\n // Cleanup inside the lock — skip lock files since we currently hold them\n await cleanupCacheDirectory(extractDir, { skipLockFiles: true })\n await ensureDir(extractDir)\n\n // Check electron-builder's own archive cache before touching @electron/get.\n // The cache lives alongside the extract dir: <cacheDir>/<releaseName>/<filename>.\n // This lets repeated builds (or offline environments) skip the download entirely once\n // the archive has been fetched at least once.\n if (archiveCachePath) {\n downloadedFile = await resolveFromArchiveCache(archiveCachePath, label, (config as any).checksums?.[label])\n }\n\n if (!downloadedFile) {\n log.debug({ file: label }, \"downloading\")\n downloadedFile = await downloadArtifactToFile(config, label)\n if (!downloadedFile) {\n throw new Error(`Failed to download artifact: ${label}`)\n }\n // Persist the downloaded archive so future builds (and offline environments) can\n // skip the network request entirely.\n if (archiveCachePath) {\n await persistToArchiveCache(downloadedFile, archiveCachePath)\n }\n }\n\n await writeCacheState(extractDir, CacheState.downloaded)\n\n // Mark extracting so stale-lock detection can recover a crashed mid-extraction process\n await writeCacheState(extractDir, CacheState.extracting)\n\n // Extract while holding the lock to prevent concurrent interference\n await extractArchive(downloadedFile, extractDir)\n\n // Compute metadata with a full recursive walk now that tmpDir has been renamed to extractDir\n const { fileCount, extractedSize } = await computeCacheMetadata(extractDir)\n\n // Write complete state with metadata BEFORE releasing the lock; throwOnError=true so a\n // failed write (disk full, permissions) propagates instead of silently producing a no-op cache\n await writeCacheState(extractDir, CacheState.complete, { fileCount, extractedSize }, true)\n } finally {\n await release().catch(err => log.warn({ err }, \"failed to release lockfile\"))\n }\n return extractDir\n}\n\n// ─── Public API ───────────────────────────────────────────────────────────────\n\n/**\n * Copies a remote artifact to a specific output path on disk.\n * Unlike downloadBuilderToolset, this does not extract archives — it copies the raw file.\n * Used for certificate imports where the caller needs the file at a known path.\n */\nexport async function download(url: string, output: string, checksum?: string | null): Promise<void> {\n const filenameWithExt = path.basename(new URL(url).pathname)\n if (checksum == null) {\n log.warn({ url }, \"downloading without an integrity checksum — the download is not verified against a known-good hash\")\n }\n const downloadedFile = await downloadArtifactToFile(\n {\n version: \"9.9.9\",\n artifactName: filenameWithExt,\n cacheRoot: path.resolve(await cacheDirectoryOverrideAllowed.value, \"downloads\"),\n cacheMode: resolveCacheMode(),\n ...(checksum != null ? { checksums: { [filenameWithExt]: checksum } } : { unsafelyDisableChecksums: true }),\n mirrorOptions: { resolveAssetURL: async () => Promise.resolve(url) },\n isGeneric: true,\n },\n filenameWithExt\n )\n await fs.copyFile(downloadedFile, output)\n}\n\nfunction validateBinaryCustomDir(envVarName: string, value: string): string {\n if (value.includes(\"://\") || value.includes(\"..\") || value.startsWith(\"/\")) {\n throw new Error(\n `${envVarName} must be a safe relative path component (e.g. \"v1.0.0-custom\"). ` + `Values containing \"://\", \"..\", or a leading \"/\" are not allowed. Got: \"${value}\"`\n )\n }\n return value\n}\n\nconst CUSTOM_DIR_ENV_VARS = [\n \"NPM_CONFIG_ELECTRON_BUILDER_BINARIES_CUSTOM_DIR\",\n \"npm_config_electron_builder_binaries_custom_dir\",\n \"npm_package_config_electron_builder_binaries_custom_dir\",\n \"ELECTRON_BUILDER_BINARIES_CUSTOM_DIR\",\n] as const\n\n/**\n * Resolves the final download URL for a builder binary, honouring:\n * ELECTRON_BUILDER_BINARIES_DOWNLOAD_OVERRIDE_URL – fully replaces the URL directory\n * ELECTRON_BUILDER_BINARIES_CUSTOM_DIR (and npm_ variants) – replaces releaseName in the path\n * overrideUrl (caller-supplied) – the complete file URL, used as-is when no env var is set\n *\n * Exported for unit testing; not part of the public API.\n * @internal\n */\nexport function resolveBuilderBinaryUrl(releaseName: string, filenameWithExt: string, baseUrl: string, overrideUrl?: string): string {\n const envOverrideUrl = parseValidEnvVarUrl(\"ELECTRON_BUILDER_BINARIES_DOWNLOAD_OVERRIDE_URL\")\n if (envOverrideUrl != null) {\n return `${envOverrideUrl}/${filenameWithExt}`\n }\n if (overrideUrl != null) {\n // The caller-supplied override (ToolsetCustom.url) points directly at the file — appending\n // filenameWithExt would double the last path segment (e.g. …/bundle.7z/bundle.7z, issue #10084).\n return overrideUrl\n }\n const customDirEntry = CUSTOM_DIR_ENV_VARS.map(name => ({ name, value: process.env[name] })).find(e => e.value != null)\n if (customDirEntry != null) {\n return `${baseUrl}${validateBinaryCustomDir(customDirEntry.name, customDirEntry.value!)}/${filenameWithExt}`\n }\n return `${baseUrl}${releaseName}/${filenameWithExt}`\n}\n\n/**\n * Downloads a generic artifact (.tar.gz or .zip) from a GitHub release.\n * Used for electron-builder-binaries tools (appimage, etc.).\n */\nexport async function downloadBuilderToolset(options: {\n releaseName: string\n filenameWithExt: string\n checksums?: Record<string, string>\n githubOrgRepo?: string\n overrideUrl?: string\n}): Promise<string> {\n const { releaseName, filenameWithExt, checksums, githubOrgRepo = \"electron-userland/electron-builder-binaries\", overrideUrl } = options\n\n if (/[/\\\\]|^\\.\\./.test(filenameWithExt) || filenameWithExt.includes(\"..\")) {\n throw new Error(`downloadBuilderToolset: unsafe filenameWithExt \"${filenameWithExt}\" — must be a plain filename with no path separators or traversal sequences`)\n }\n\n const baseUrl = getBinariesMirrorUrl(githubOrgRepo)\n const fullUrl = resolveBuilderBinaryUrl(releaseName, filenameWithExt, baseUrl, overrideUrl)\n const suffix = hashUrlSafe(fullUrl, 5)\n // tar.7z is listed before 7z so the full extension is stripped. Deliberate side effect: this changes the\n // extract-dir name for .tar.7z toolsets (e.g. the snap template) from \"<name>.tar-<hash>\" to \"<name>-<hash>\",\n // which busts caches poisoned by the broken .tar.7z extraction in 26.15.0-26.15.6 (issue #10002).\n const folderName = `${filenameWithExt.replace(/\\.(tar\\.gz|tgz|tar\\.xz|txz|tar\\.7z|zip|7z)$/, \"\")}-${suffix}`\n // releaseName is library input; enforce cache-dir containment (rejects traversal, clears taint into shell extraction)\n const cacheDir = await cacheDirectoryOverrideAllowed.value\n const extractDir = sanitizeDirPath(path.join(cacheDir, releaseName, folderName), cacheDir)\n\n // Use resolveAssetURL so @electron/get's ELECTRON_MIRROR env var check cannot override\n // the builder-binaries URL we've already resolved (see getArtifactRemoteURL in @electron/get).\n const mirrorOptions: MirrorOptions = {\n resolveAssetURL: async () => Promise.resolve(fullUrl),\n }\n\n // Predictable archive cache: <cacheDir>/<releaseName>/<filename>, next to the extract dir.\n // downloadAndExtract checks here before touching @electron/get and persists the archive here\n // after every successful download, so subsequent builds never need a network round-trip.\n const archiveCachePath = sanitizeDirPath(path.join(cacheDir, releaseName, filenameWithExt), cacheDir)\n\n const config: ElectronDownloadRequest & ElectronDownloadRequestOptions & { isGeneric: true } = {\n version: \"9.9.9\", // must be >1.3.2 to bypass @electron/get validation shortcut\n artifactName: filenameWithExt,\n cacheRoot: path.resolve(await cacheDirectoryOverrideAllowed.value, \"downloads\"),\n cacheMode: resolveCacheMode(),\n ...(checksums != null ? { checksums } : { unsafelyDisableChecksums: true }),\n mirrorOptions,\n isGeneric: true,\n }\n return downloadAndExtract(config, extractDir, filenameWithExt, archiveCachePath)\n}\n\n/**\n * Mirrors @electron/get's default cache root (`env-paths(\"electron\", { suffix: \"\" }).cache`).\n * @electron/get does not export it and its package `exports` map blocks deep imports, so the\n * (deliberately tiny) platform switch is replicated here. Must stay in sync with the\n * `cacheRoot` default documented in @electron/get's `ElectronDownloadRequestOptions`.\n * @internal exported for unit testing\n */\nexport function defaultElectronGetCacheRoot(): string {\n const name = \"electron\"\n const homeDir = os.homedir()\n switch (os.platform()) {\n case \"darwin\":\n return path.join(homeDir, \"Library\", \"Caches\", name)\n case \"win32\":\n return path.join(process.env.LOCALAPPDATA || path.join(homeDir, \"AppData\", \"Local\"), name, \"Cache\")\n default:\n return path.join(process.env.XDG_CACHE_HOME || path.join(homeDir, \".cache\"), name)\n }\n}\n\n/**\n * Parses the upstream `SHASUMS256.txt` format into the `Record<filename, sha256-hex>` shape that\n * @electron/get accepts as inline `checksums`. Each line is `<sha256-hex> *<filename>` (binary\n * mode) or `<sha256-hex> <filename>` (text mode); malformed lines are ignored.\n * @internal exported for unit testing\n */\nexport function parseChecksumFile(content: string): Record<string, string> {\n const checksums: Record<string, string> = {}\n for (const rawLine of content.split(\"\\n\")) {\n const match = /^([a-fA-F0-9]{64})\\s+\\*?(.+)$/.exec(rawLine.trim())\n if (match != null) {\n checksums[match[2]] = match[1].toLowerCase()\n }\n }\n return checksums\n}\n\n/**\n * Looks for a locally seeded SHASUMS256 file at the root of the @electron/get cache and returns\n * its contents as inline `checksums`, or null when nothing usable is seeded.\n *\n * Why: without inline `checksums`, @electron/get re-downloads `SHASUMS256.txt` with a hardcoded\n * `cacheMode: Bypass` on EVERY build — even when the artifact itself is a cache hit — so a fully\n * seeded cache still requires network access and air-gapped builds fail (#10039). Cache-seeding\n * tools (e.g. flatpak-node-generator) already place `SHASUMS256.txt-<version>` flat at the cache\n * root; feeding it back as inline `checksums` keeps checksum validation enabled while making it\n * fully offline. A plain `SHASUMS256.txt` at the cache root is accepted as a manual-seeding\n * fallback. A candidate file is only used when it actually contains an entry for the requested\n * artifact, so a stale file for another version can never break an online build.\n * See https://www.electron.build/tutorials/offline-air-gapped-builds for the seeding contract.\n * @internal exported for unit testing\n */\nexport async function resolveSeededChecksums(cacheRoot: string, version: string, artifactFileName: string): Promise<Record<string, string> | null> {\n const candidates = [path.join(cacheRoot, `SHASUMS256.txt-${version}`), path.join(cacheRoot, \"SHASUMS256.txt\")]\n for (const candidate of candidates) {\n if (!(await exists(candidate))) {\n continue\n }\n let content: string\n try {\n content = await fs.readFile(candidate, \"utf-8\")\n } catch (err: any) {\n log.warn({ file: log.filePath(candidate), err: err.message }, \"failed to read seeded SHASUMS file — ignoring it\")\n continue\n }\n const checksums = parseChecksumFile(content)\n if (checksums[artifactFileName] == null) {\n log.warn({ file: log.filePath(candidate), artifactFileName }, \"seeded SHASUMS file has no entry for the requested artifact — ignoring it\")\n continue\n }\n log.debug({ file: log.filePath(candidate), artifactFileName }, \"using locally seeded SHASUMS256 checksums — checksum validation can run offline\")\n return checksums\n }\n return null\n}\n\n/**\n * Assembles the `@electron/get` artifact config (`ElectronPlatformArtifactDetails`) from\n * `ArtifactDownloadOptions`: spreads the caller's options and pins `cacheRoot`/`platform`/`arch`/\n * `version`/`artifactName` and the resolved cache mode, warning when checksum verification is\n * disabled. When the caller provides no `checksums` (user-provided `electronGet.checksums` always\n * wins) and verification is not disabled, a locally seeded `SHASUMS256.txt-<version>` at the cache\n * root is picked up as inline `checksums` so validation works offline (see resolveSeededChecksums).\n * Callers pass the result to `downloadArtifactToFile` / `downloadAndExtract`.\n * @internal exported for unit testing\n */\nexport async function buildElectronArtifactConfig(artifactOptions: ArtifactDownloadOptions): Promise<ElectronPlatformArtifactDetails> {\n const { options, arch, version, platformName: platform, artifactName, cacheDir: cacheRoot } = artifactOptions\n\n if (options?.unsafelyDisableChecksums) {\n log.warn(\n { artifactName },\n \"electronGet.unsafelyDisableChecksums is enabled — downloaded artifacts will NOT be verified; a compromised mirror can serve malicious binaries undetected\"\n )\n }\n\n const artifactConfig: ElectronPlatformArtifactDetails = { ...options, cacheRoot, platform, arch, version, artifactName, cacheMode: resolveCacheMode() }\n if (artifactConfig.checksums == null && !artifactConfig.unsafelyDisableChecksums) {\n // Matches @electron/get's getArtifactFileName for non-generic artifacts; `artifactSuffix` and\n // `customFilename` cannot diverge here — both are excluded from ElectronGetOptions.\n const artifactFileName = `${artifactName}-v${version}-${platform}-${arch}.zip`\n const seededChecksums = await resolveSeededChecksums(cacheRoot ?? defaultElectronGetCacheRoot(), version, artifactFileName)\n if (seededChecksums != null) {\n artifactConfig.checksums = seededChecksums\n }\n }\n return artifactConfig\n}\n\n/**\n * Downloads the electron artifact zip via @electron/get (with caching) and returns the zip file path.\n * Use when you need to extract the zip yourself (e.g. directly to appOutDir to preserve empty dirs and symlinks).\n */\nexport async function downloadElectronArtifactZip(options: ArtifactDownloadOptions): Promise<string> {\n const config = await buildElectronArtifactConfig(options)\n return downloadArtifactToFile(config, config.artifactName)\n}\n\n/**\n * Downloads an electron platform artifact (e.g. ffmpeg) via `@electron/get` and extracts it into a\n * content-addressed cache directory (keyed on a hash of the resolved artifact config), returning the\n * extraction path.\n */\nexport async function downloadElectronArtifact(options: ArtifactDownloadOptions): Promise<string> {\n const { arch, version, platformName: platform, artifactName } = options\n const artifactConfig = await buildElectronArtifactConfig(options)\n\n const suffix = hashUrlSafe(JSON.stringify(artifactConfig), 5)\n const folderName = `${artifactName}-v${version}-${platform}-${arch}-${suffix}`\n const extractDir = path.join(await cacheDirectoryOverrideAllowed.value, `${artifactName}-v${version}`, folderName)\n\n return downloadAndExtract(artifactConfig, extractDir, artifactName)\n}\n\n/**\n * Get the binaries mirror URL from environment variables.\n * Supports various npm config formats and falls back to GitHub.\n */\nexport function getBinariesMirrorUrl(githubOrgRepo: string): string {\n const allowHttp = process.env[\"ELECTRON_BUILDER_DANGEROUSLY_ALLOW_HTTP\"] === \"true\"\n for (const envVar of [\n \"NPM_CONFIG_ELECTRON_BUILDER_BINARIES_MIRROR\",\n \"npm_config_electron_builder_binaries_mirror\",\n \"npm_package_config_electron_builder_binaries_mirror\",\n \"ELECTRON_BUILDER_BINARIES_MIRROR\",\n ]) {\n const url = parseValidEnvVarUrl(envVar, allowHttp)\n if (url) {\n return url.endsWith(\"/\") ? url : `${url}/`\n }\n }\n return `https://github.com/${githubOrgRepo}/releases/download/`\n}\n"]}
|
|
@@ -6,6 +6,12 @@ export interface DesktopFrameworkInfo {
|
|
|
6
6
|
useCustomDist: boolean;
|
|
7
7
|
}
|
|
8
8
|
export declare function getGypEnv(frameworkInfo: DesktopFrameworkInfo, platform: NodeJS.Platform, arch: string, buildFromSource: boolean): any;
|
|
9
|
+
/**
|
|
10
|
+
* Returns the environment variables explicitly referenced by Yarn's npm authentication configuration.
|
|
11
|
+
* This keeps the default child-process credential deny-list intact while allowing Yarn Berry to
|
|
12
|
+
* resolve a registry credential that the project has explicitly configured it to use.
|
|
13
|
+
*/
|
|
14
|
+
export declare function getYarnBerryNpmAuthEnv(projectDir: string, env: NodeJS.ProcessEnv): Promise<NodeJS.ProcessEnv>;
|
|
9
15
|
/**
|
|
10
16
|
* Whether a failed dependency-install spawn should be retried. Everything not matched here fails fast —
|
|
11
17
|
* a genuine install error (E404, ERESOLVE, EACCES, …) must surface immediately, not after 3 backoff
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"installOrRebuild.d.ts","sourceRoot":"","sources":["../../src/util/installOrRebuild.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAOnD,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"installOrRebuild.d.ts","sourceRoot":"","sources":["../../src/util/installOrRebuild.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAOnD,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAK9C,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,aAAa,EACrB,EAAE,MAAM,EAAE,UAAU,EAAE,aAAa,EAAE,EAAE,cAAc,EACrD,OAAO,EAAE,cAAc,EACvB,YAAY,qBAAQ,EACpB,GAAG,EAAE,MAAM,CAAC,UAAU,iBAuBvB;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAA;IACf,aAAa,EAAE,OAAO,CAAA;CACvB;AAMD,wBAAgB,SAAS,CAAC,aAAa,EAAE,oBAAoB,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,eAAe,EAAE,OAAO,OAiC/H;AA2BD;;;;GAIG;AACH,wBAAsB,sBAAsB,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,CAkBnH;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAQhE;AAED,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,aAAa,EACrB,EAAE,MAAM,EAAE,UAAU,EAAE,aAAa,EAAE,EAAE,cAAc,EACrD,OAAO,EAAE,cAAc,EACvB,GAAG,EAAE,MAAM,CAAC,UAAU,GACrB,OAAO,CAAC,GAAG,CAAC,CA6Ed;AAED,wBAAsB,cAAc,CAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,aAAa,EAAE,oBAAoB,iBAiBhH;AACD,MAAM,WAAW,cAAc;IAC7B,aAAa,EAAE,oBAAoB,CAAA;IAEnC,QAAQ,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAA;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAA;IAEb,eAAe,CAAC,EAAE,OAAO,CAAA;IAEzB,cAAc,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,IAAI,CAAA;CACtC;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,MAAM,CAAA;IAClB,aAAa,EAAE,MAAM,GAAG,OAAO,CAAA;CAChC"}
|
|
@@ -8,6 +8,7 @@ import { streamSpawnToFile } from "./streamSpawnToFile.js";
|
|
|
8
8
|
import { rebuild as remoteRebuild } from "./rebuild.js";
|
|
9
9
|
import which from "which";
|
|
10
10
|
import _fsExtra from "fs-extra";
|
|
11
|
+
import { load } from "js-yaml";
|
|
11
12
|
const { pathExists, readFile } = _fsExtra;
|
|
12
13
|
export async function installOrRebuild(config, { appDir, projectDir, workspaceRoot }, options, forceInstall = false, env) {
|
|
13
14
|
const effectiveOptions = {
|
|
@@ -64,6 +65,50 @@ export function getGypEnv(frameworkInfo, platform, arch, buildFromSource) {
|
|
|
64
65
|
npm_config_devdir: getElectronGypCacheDir(),
|
|
65
66
|
};
|
|
66
67
|
}
|
|
68
|
+
// Yarn's own grammar, from miscUtils.replaceEnvVariables: only `${NAME}`,
|
|
69
|
+
// `${NAME-default}` and `${NAME:-default}` interpolate, a name starts with a
|
|
70
|
+
// letter, and a backslash escapes the sigil. The escape alternative has to come
|
|
71
|
+
// first so `\${FOO}` is consumed rather than read as a reference, and not
|
|
72
|
+
// requiring the closing brace is what picks up a nested `${A:-${B}}`.
|
|
73
|
+
const YARN_ENV_VAR_REFERENCE_RE = /\\[\\$}]|\$\{([a-zA-Z]\w*)(?::-|-|(?=\}))/g;
|
|
74
|
+
function isRecord(value) {
|
|
75
|
+
return value != null && typeof value === "object" && !Array.isArray(value);
|
|
76
|
+
}
|
|
77
|
+
function getYarnNpmAuthValues(config) {
|
|
78
|
+
if (!isRecord(config)) {
|
|
79
|
+
return [];
|
|
80
|
+
}
|
|
81
|
+
const values = [config.npmAuthToken, config.npmAuthIdent];
|
|
82
|
+
for (const scopes of [config.npmScopes, config.npmRegistries]) {
|
|
83
|
+
if (isRecord(scopes)) {
|
|
84
|
+
values.push(...Object.values(scopes).flatMap(scope => (isRecord(scope) ? [scope.npmAuthToken, scope.npmAuthIdent] : [])));
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return values.filter((value) => typeof value === "string");
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Returns the environment variables explicitly referenced by Yarn's npm authentication configuration.
|
|
91
|
+
* This keeps the default child-process credential deny-list intact while allowing Yarn Berry to
|
|
92
|
+
* resolve a registry credential that the project has explicitly configured it to use.
|
|
93
|
+
*/
|
|
94
|
+
export async function getYarnBerryNpmAuthEnv(projectDir, env) {
|
|
95
|
+
let config;
|
|
96
|
+
try {
|
|
97
|
+
config = load(await readFile(path.join(projectDir, ".yarnrc.yml"), "utf8"));
|
|
98
|
+
}
|
|
99
|
+
catch {
|
|
100
|
+
return {};
|
|
101
|
+
}
|
|
102
|
+
const names = new Set();
|
|
103
|
+
for (const value of getYarnNpmAuthValues(config)) {
|
|
104
|
+
for (const match of value.matchAll(YARN_ENV_VAR_REFERENCE_RE)) {
|
|
105
|
+
if (match[1] != null) {
|
|
106
|
+
names.add(match[1]);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return Object.fromEntries(Array.from(names, name => [name, env[name]]).filter(([, value]) => value !== undefined));
|
|
111
|
+
}
|
|
67
112
|
/**
|
|
68
113
|
* Whether a failed dependency-install spawn should be retried. Everything not matched here fails fast —
|
|
69
114
|
* a genuine install error (E404, ERESOLVE, EACCES, …) must surface immediately, not after 3 backoff
|
|
@@ -107,8 +152,10 @@ export async function installDependencies(config, { appDir, projectDir, workspac
|
|
|
107
152
|
if (additionalArgs != null) {
|
|
108
153
|
execArgs.push(...additionalArgs);
|
|
109
154
|
}
|
|
155
|
+
const yarnNpmAuthEnv = pm === PM.YARN_BERRY ? await getYarnBerryNpmAuthEnv(_resolvedWorkspaceDir ?? projectDir, process.env) : {};
|
|
110
156
|
const spawnEnv = {
|
|
111
157
|
...getGypEnv(options.frameworkInfo, platform, arch, options.buildFromSource === true),
|
|
158
|
+
...yarnNpmAuthEnv,
|
|
112
159
|
...env,
|
|
113
160
|
// Silence corepack's activation/download chatter so a `pnpm install` doesn't flood the build log;
|
|
114
161
|
// strict=0 so the app's `packageManager` pin can't abort the install, download prompt/notice off.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"installOrRebuild.js","sourceRoot":"","sources":["../../src/util/installOrRebuild.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,qBAAqB,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACxF,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAE5C,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAA;AAC5B,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAE5B,OAAO,EAAE,EAAE,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAA;AAChF,OAAO,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAA;AACjF,OAAO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,GAAG,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAA;IACrD,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAA;IAEzC,MAAM,EACJ,aAAa,EAAE,EAAE,OAAO,EAAE,eAAe,EAAE,GAC5C,GAAG,OAAO,CAAA;IACX,MAAM,eAAe,GAAG,aAAa,IAAI,UAAU,IAAI,MAAM,CAAA;IAC7D,MAAM,OAAO,GAAG;QACd,eAAe;QACf,IAAI;QACJ,eAAe;QACf,aAAa;QACb,UAAU,EAAE,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,IAAI;QAC5C,MAAM,EAAE,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,IAAI;KACrC,CAAA;IACD,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,6BAA6B,CAAC,CAAA;IAEhD,MAAM,IAAI,GAAG,MAAM,CAAC,aAAa,EAAE,WAAW,IAAI,YAAY,CAAA;IAC9D,MAAM,cAAc,GAA2B;QAC7C,SAAS,EAAE,MAAM;QACjB,eAAe;QACf,IAAI;QACJ,QAAQ;QACR,eAAe;QACf,eAAe;QACf,IAAI;QACJ,iBAAiB,EAAE,IAAI;KACxB,CAAA;IACD,OAAO,aAAa,CAAC,cAAc,CAAC,CAAA;AACtC,CAAC","sourcesContent":["import { asArray, log, retry, spawn, stripSensitiveEnvVars, TmpDir } from \"builder-util\"\nimport { isNpmNoBinLinks } from \"./flags.js\"\n\nimport { homedir } from \"os\"\nimport * as path from \"path\"\nimport { Configuration } from \"../configuration.js\"\nimport { PM, getPackageManagerCommand } from \"../node-module-collector/index.js\"\nimport { detectPackageManager } from \"../node-module-collector/packageManager.js\"\nimport { streamSpawnToFile } from \"./streamSpawnToFile.js\"\nimport { rebuild as remoteRebuild } from \"./rebuild.js\"\nimport which from \"which\"\nimport type { RebuildOptions as ElectronRebuildOptions } from \"@electron/rebuild\"\nimport { Nullish } from \"builder-util-runtime\"\nimport _fsExtra from \"fs-extra\"\nconst { pathExists, readFile } = _fsExtra\n\nexport async function installOrRebuild(\n config: Configuration,\n { appDir, projectDir, workspaceRoot }: DirectoryPaths,\n options: RebuildOptions,\n forceInstall = false,\n env: NodeJS.ProcessEnv\n) {\n const effectiveOptions: RebuildOptions = {\n buildFromSource: config.nativeModules?.buildDependenciesFromSource === true,\n additionalArgs: asArray(config.npmArgs),\n ...options,\n }\n let isDependenciesInstalled = false\n\n const dirsToCheck = [...new Set([projectDir, appDir, workspaceRoot].filter((d): d is string => !!d))]\n for (const fileOrDir of [\"node_modules\", \".pnp.js\"]) {\n if ((await Promise.all(dirsToCheck.map(d => pathExists(path.join(d, fileOrDir))))).some(Boolean)) {\n isDependenciesInstalled = true\n\n break\n }\n }\n\n if (forceInstall || !isDependenciesInstalled) {\n await installDependencies(config, { appDir, projectDir, workspaceRoot }, effectiveOptions, env)\n } else {\n await rebuild(config, { appDir, projectDir, workspaceRoot }, effectiveOptions)\n }\n}\n\nexport interface DesktopFrameworkInfo {\n version: string\n useCustomDist: boolean\n}\n\nfunction getElectronGypCacheDir() {\n return path.join(homedir(), \".electron-gyp\")\n}\n\nexport function getGypEnv(frameworkInfo: DesktopFrameworkInfo, platform: NodeJS.Platform, arch: string, buildFromSource: boolean) {\n const npmConfigArch = arch === \"armv7l\" ? \"arm\" : arch\n const common: any = {\n ...stripSensitiveEnvVars(process.env),\n npm_config_arch: npmConfigArch,\n npm_config_target_arch: npmConfigArch,\n npm_config_platform: platform,\n npm_config_build_from_source: buildFromSource,\n // required for node-pre-gyp\n npm_config_target_platform: platform,\n npm_config_update_binary: true,\n npm_config_fallback_to_build: true,\n }\n\n if (platform !== process.platform) {\n common.npm_config_force = \"true\"\n }\n if (platform === \"win32\" || platform === \"darwin\") {\n common.npm_config_target_libc = \"unknown\"\n }\n\n if (!frameworkInfo.useCustomDist) {\n return common\n }\n\n // https://github.com/nodejs/node-gyp/issues/21\n return {\n ...common,\n npm_config_disturl: common.npm_config_electron_mirror || \"https://electronjs.org/headers\",\n npm_config_target: frameworkInfo.version,\n npm_config_runtime: \"electron\",\n npm_config_devdir: getElectronGypCacheDir(),\n }\n}\n\n/**\n * Whether a failed dependency-install spawn should be retried. Everything not matched here fails fast —\n * a genuine install error (E404, ERESOLVE, EACCES, …) must surface immediately, not after 3 backoff\n * retries. Two transient classes are retriable:\n * - Network blips while fetching from the registry.\n * - A Windows-only cmd.exe race: cross-spawn invokes the package manager's `.cmd`/`.CMD` shim via\n * `cmd.exe /d /s /c`, and cmd.exe re-opens the batch file between commands. Under CI load (Defender\n * scan locks, an 8.3/temp cwd, heavy parallel I/O) that re-open intermittently fails with\n * \"The batch file cannot be found.\" *after* the package manager has already finished — a spurious\n * exit code, not a missing file. The install is idempotent (a no-op once node_modules is up to\n * date), so re-running is safe. Guarded to win32 so the narrow message match can't affect other\n * platforms. (Durable fix: stop routing install through cmd.exe, mirroring the collector's\n * powershell.exe -EncodedCommand spawn — tracked separately.)\n */\nexport function isRetriableInstallError(message: string): boolean {\n if (/ENOTFOUND|ECONNRESET|ETIMEDOUT|EAI_AGAIN|ECONNREFUSED/.test(message)) {\n return true\n }\n if (process.platform === \"win32\" && /The batch file cannot be found/i.test(message)) {\n return true\n }\n return false\n}\n\nexport async function installDependencies(\n config: Configuration,\n { appDir, projectDir, workspaceRoot }: DirectoryPaths,\n options: RebuildOptions,\n env: NodeJS.ProcessEnv\n): Promise<any> {\n const platform = options.platform || process.platform\n const arch = options.arch || process.arch\n const additionalArgs = options.additionalArgs\n\n const searchPaths = [projectDir, appDir].concat(workspaceRoot ? [workspaceRoot] : [])\n const { pm, resolvedDirectory: _resolvedWorkspaceDir } = await detectPackageManager(searchPaths)\n\n log.info({ pm, platform, arch, projectDir, appDir, workspaceRoot: _resolvedWorkspaceDir }, \"installing dependencies\")\n\n const execArgs = [\"install\"]\n if (pm === PM.YARN) {\n execArgs.push(\"--prefer-offline\")\n } else if (pm === PM.YARN_BERRY) {\n if (isNpmNoBinLinks()) {\n execArgs.push(\"--no-bin-links\")\n }\n }\n\n const execPath = getPackageManagerCommand(pm)\n\n if (additionalArgs != null) {\n execArgs.push(...additionalArgs)\n }\n\n const spawnEnv = {\n ...getGypEnv(options.frameworkInfo, platform, arch, options.buildFromSource === true),\n ...env,\n // Silence corepack's activation/download chatter so a `pnpm install` doesn't flood the build log;\n // strict=0 so the app's `packageManager` pin can't abort the install, download prompt/notice off.\n COREPACK_ENABLE_STRICT: \"0\",\n COREPACK_ENABLE_DOWNLOAD_PROMPT: \"0\",\n }\n\n const tmpDir = new TmpDir(\"install-dependencies\")\n try {\n await retry(\n async () => {\n // Stream install output to a file instead of inheriting/buffering it: corepack and the package\n // managers are extremely chatty, so the common (success) path stays quiet and only surfaces the\n // log on failure. On Windows streamSpawnToFile routes through powershell.exe -EncodedCommand\n // rather than cmd.exe, which also sidesteps the spurious \".cmd\" shim \"batch file cannot be\n // found.\" re-open race that previously forced the win32 retry guard below.\n const outputFile = await tmpDir.getTempFile({ prefix: \"install-\", suffix: \".log\" })\n const { code, stderr } = await streamSpawnToFile(execPath, execArgs, appDir, outputFile, spawnEnv)\n if (code !== 0) {\n const stdout = await readFile(outputFile, \"utf8\").catch(() => \"\")\n throw new Error(`Package install (${execPath} ${execArgs.join(\" \")}) exited with code ${code}:\\n${stdout}\\n${stderr}`)\n }\n if (log.isDebugEnabled) {\n const stdout = await readFile(outputFile, \"utf8\").catch(() => \"\")\n log.debug({ stdout, stderr }, \"installed dependencies\")\n }\n },\n {\n retries: 3,\n interval: 1000,\n backoff: 2000,\n shouldRetry: (e: any) => {\n const message = e?.message ?? \"\"\n const retriable = isRetriableInstallError(message)\n if (retriable) {\n log.warn({ error: String(message).split(\"\\n\")[0] }, \"transient error during package install, retrying\")\n }\n return retriable\n },\n }\n )\n } finally {\n await tmpDir.cleanup()\n }\n\n // Some native dependencies no longer use `install` hook for building their native module, (yarn 3+ removed implicit link of `install` and `rebuild` steps)\n // https://github.com/electron-userland/electron-builder/issues/8024\n return rebuild(config, { appDir, projectDir, workspaceRoot }, options)\n}\n\nexport async function nodeGypRebuild(platform: NodeJS.Platform, arch: string, frameworkInfo: DesktopFrameworkInfo) {\n log.info({ platform, arch }, \"executing node-gyp rebuild\")\n // this script must be used only for electron\n const nodeGyp = process.platform === \"win32\" ? which.sync(\"node-gyp\") : \"node-gyp\"\n const args = [\"rebuild\"]\n // headers of old Electron versions do not have a valid config.gypi file\n // and --force-process-config must be passed to node-gyp >= 8.4.0 to\n // correctly build modules for them.\n // see also https://github.com/nodejs/node-gyp/pull/2497\n const [major, minor] = frameworkInfo.version\n .split(\".\")\n .slice(0, 2)\n .map(n => parseInt(n, 10))\n if (major <= 13 || (major == 14 && minor <= 1) || (major == 15 && minor <= 2)) {\n args.push(\"--force-process-config\")\n }\n await spawn(nodeGyp, args, { env: getGypEnv(frameworkInfo, platform, arch, true) })\n}\nexport interface RebuildOptions {\n frameworkInfo: DesktopFrameworkInfo\n\n platform?: NodeJS.Platform\n arch?: string\n\n buildFromSource?: boolean\n\n additionalArgs?: Array<string> | null\n}\n\nexport interface DirectoryPaths {\n appDir: string\n projectDir: string\n workspaceRoot: string | Nullish\n}\n\n/** @internal */\nexport async function rebuild(config: Configuration, { appDir, projectDir, workspaceRoot }: DirectoryPaths, options: RebuildOptions) {\n const buildFromSource = options.buildFromSource === true\n const platform = options.platform || process.platform\n const arch = options.arch || process.arch\n\n const {\n frameworkInfo: { version: electronVersion },\n } = options\n const projectRootPath = workspaceRoot || projectDir || appDir\n const logInfo = {\n electronVersion,\n arch,\n buildFromSource,\n workspaceRoot,\n projectDir: log.filePath(projectDir) || \"./\",\n appDir: log.filePath(appDir) || \"./\",\n }\n log.info(logInfo, \"executing @electron/rebuild\")\n\n const mode = config.nativeModules?.rebuildMode ?? \"sequential\"\n const rebuildOptions: ElectronRebuildOptions = {\n buildPath: appDir,\n electronVersion,\n arch,\n platform,\n buildFromSource,\n projectRootPath,\n mode,\n disablePreGypCopy: true,\n }\n return remoteRebu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CAAC,EAAE,CAAC,CAAA;AACrF,CAAC;AAkBD,gBAAgB;AAChB,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,MAAqB,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,aAAa,EAAkB,EAAE,OAAuB;IACjI,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,KAAK,IAAI,CAAA;IACxD,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAA;IACrD,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAA;IAEzC,MAAM,EACJ,aAAa,EAAE,EAAE,OAAO,EAAE,eAAe,EAAE,GAC5C,GAAG,OAAO,CAAA;IACX,MAAM,eAAe,GAAG,aAAa,IAAI,UAAU,IAAI,MAAM,CAAA;IAC7D,MAAM,OAAO,GAAG;QACd,eAAe;QACf,IAAI;QACJ,eAAe;QACf,aAAa;QACb,UAAU,EAAE,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,IAAI;QAC5C,MAAM,EAAE,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,IAAI;KACrC,CAAA;IACD,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,6BAA6B,CAAC,CAAA;IAEhD,MAAM,IAAI,GAAG,MAAM,CAAC,aAAa,EAAE,WAAW,IAAI,YAAY,CAAA;IAC9D,MAAM,cAAc,GAA2B;QAC7C,SAAS,EAAE,MAAM;QACjB,eAAe;QACf,IAAI;QACJ,QAAQ;QACR,eAAe;QACf,eAAe;QACf,IAAI;QACJ,iBAAiB,EAAE,IAAI;KACxB,CAAA;IACD,OAAO,aAAa,CAAC,cAAc,CAAC,CAAA;AACtC,CAAC","sourcesContent":["import { asArray, log, retry, spawn, stripSensitiveEnvVars, TmpDir } from \"builder-util\"\nimport { isNpmNoBinLinks } from \"./flags.js\"\n\nimport { homedir } from \"os\"\nimport * as path from \"path\"\nimport { Configuration } from \"../configuration.js\"\nimport { PM, getPackageManagerCommand } from \"../node-module-collector/index.js\"\nimport { detectPackageManager } from \"../node-module-collector/packageManager.js\"\nimport { streamSpawnToFile } from \"./streamSpawnToFile.js\"\nimport { rebuild as remoteRebuild } from \"./rebuild.js\"\nimport which from \"which\"\nimport type { RebuildOptions as ElectronRebuildOptions } from \"@electron/rebuild\"\nimport { Nullish } from \"builder-util-runtime\"\nimport _fsExtra from \"fs-extra\"\nimport { load } from \"js-yaml\"\nconst { pathExists, readFile } = _fsExtra\n\nexport async function installOrRebuild(\n config: Configuration,\n { appDir, projectDir, workspaceRoot }: DirectoryPaths,\n options: RebuildOptions,\n forceInstall = false,\n env: NodeJS.ProcessEnv\n) {\n const effectiveOptions: RebuildOptions = {\n buildFromSource: config.nativeModules?.buildDependenciesFromSource === true,\n additionalArgs: asArray(config.npmArgs),\n ...options,\n }\n let isDependenciesInstalled = false\n\n const dirsToCheck = [...new Set([projectDir, appDir, workspaceRoot].filter((d): d is string => !!d))]\n for (const fileOrDir of [\"node_modules\", \".pnp.js\"]) {\n if ((await Promise.all(dirsToCheck.map(d => pathExists(path.join(d, fileOrDir))))).some(Boolean)) {\n isDependenciesInstalled = true\n\n break\n }\n }\n\n if (forceInstall || !isDependenciesInstalled) {\n await installDependencies(config, { appDir, projectDir, workspaceRoot }, effectiveOptions, env)\n } else {\n await rebuild(config, { appDir, projectDir, workspaceRoot }, effectiveOptions)\n }\n}\n\nexport interface DesktopFrameworkInfo {\n version: string\n useCustomDist: boolean\n}\n\nfunction getElectronGypCacheDir() {\n return path.join(homedir(), \".electron-gyp\")\n}\n\nexport function getGypEnv(frameworkInfo: DesktopFrameworkInfo, platform: NodeJS.Platform, arch: string, buildFromSource: boolean) {\n const npmConfigArch = arch === \"armv7l\" ? \"arm\" : arch\n const common: any = {\n ...stripSensitiveEnvVars(process.env),\n npm_config_arch: npmConfigArch,\n npm_config_target_arch: npmConfigArch,\n npm_config_platform: platform,\n npm_config_build_from_source: buildFromSource,\n // required for node-pre-gyp\n npm_config_target_platform: platform,\n npm_config_update_binary: true,\n npm_config_fallback_to_build: true,\n }\n\n if (platform !== process.platform) {\n common.npm_config_force = \"true\"\n }\n if (platform === \"win32\" || platform === \"darwin\") {\n common.npm_config_target_libc = \"unknown\"\n }\n\n if (!frameworkInfo.useCustomDist) {\n return common\n }\n\n // https://github.com/nodejs/node-gyp/issues/21\n return {\n ...common,\n npm_config_disturl: common.npm_config_electron_mirror || \"https://electronjs.org/headers\",\n npm_config_target: frameworkInfo.version,\n npm_config_runtime: \"electron\",\n npm_config_devdir: getElectronGypCacheDir(),\n }\n}\n\n// Yarn's own grammar, from miscUtils.replaceEnvVariables: only `${NAME}`,\n// `${NAME-default}` and `${NAME:-default}` interpolate, a name starts with a\n// letter, and a backslash escapes the sigil. The escape alternative has to come\n// first so `\\${FOO}` is consumed rather than read as a reference, and not\n// requiring the closing brace is what picks up a nested `${A:-${B}}`.\nconst YARN_ENV_VAR_REFERENCE_RE = /\\\\[\\\\$}]|\\$\\{([a-zA-Z]\\w*)(?::-|-|(?=\\}))/g\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return value != null && typeof value === \"object\" && !Array.isArray(value)\n}\n\nfunction getYarnNpmAuthValues(config: unknown): Array<string> {\n if (!isRecord(config)) {\n return []\n }\n\n const values = [config.npmAuthToken, config.npmAuthIdent]\n for (const scopes of [config.npmScopes, config.npmRegistries]) {\n if (isRecord(scopes)) {\n values.push(...Object.values(scopes).flatMap(scope => (isRecord(scope) ? [scope.npmAuthToken, scope.npmAuthIdent] : [])))\n }\n }\n return values.filter((value): value is string => typeof value === \"string\")\n}\n\n/**\n * Returns the environment variables explicitly referenced by Yarn's npm authentication configuration.\n * This keeps the default child-process credential deny-list intact while allowing Yarn Berry to\n * resolve a registry credential that the project has explicitly configured it to use.\n */\nexport async function getYarnBerryNpmAuthEnv(projectDir: string, env: NodeJS.ProcessEnv): Promise<NodeJS.ProcessEnv> {\n let config: unknown\n try {\n config = load(await readFile(path.join(projectDir, \".yarnrc.yml\"), \"utf8\"))\n } catch {\n return {}\n }\n\n const names = new Set<string>()\n for (const value of getYarnNpmAuthValues(config)) {\n for (const match of value.matchAll(YARN_ENV_VAR_REFERENCE_RE)) {\n if (match[1] != null) {\n names.add(match[1])\n }\n }\n }\n\n return Object.fromEntries(Array.from(names, name => [name, env[name]]).filter(([, value]) => value !== undefined))\n}\n\n/**\n * Whether a failed dependency-install spawn should be retried. Everything not matched here fails fast —\n * a genuine install error (E404, ERESOLVE, EACCES, …) must surface immediately, not after 3 backoff\n * retries. Two transient classes are retriable:\n * - Network blips while fetching from the registry.\n * - A Windows-only cmd.exe race: cross-spawn invokes the package manager's `.cmd`/`.CMD` shim via\n * `cmd.exe /d /s /c`, and cmd.exe re-opens the batch file between commands. Under CI load (Defender\n * scan locks, an 8.3/temp cwd, heavy parallel I/O) that re-open intermittently fails with\n * \"The batch file cannot be found.\" *after* the package manager has already finished — a spurious\n * exit code, not a missing file. The install is idempotent (a no-op once node_modules is up to\n * date), so re-running is safe. Guarded to win32 so the narrow message match can't affect other\n * platforms. (Durable fix: stop routing install through cmd.exe, mirroring the collector's\n * powershell.exe -EncodedCommand spawn — tracked separately.)\n */\nexport function isRetriableInstallError(message: string): boolean {\n if (/ENOTFOUND|ECONNRESET|ETIMEDOUT|EAI_AGAIN|ECONNREFUSED/.test(message)) {\n return true\n }\n if (process.platform === \"win32\" && /The batch file cannot be found/i.test(message)) {\n return true\n }\n return false\n}\n\nexport async function installDependencies(\n config: Configuration,\n { appDir, projectDir, workspaceRoot }: DirectoryPaths,\n options: RebuildOptions,\n env: NodeJS.ProcessEnv\n): Promise<any> {\n const platform = options.platform || process.platform\n const arch = options.arch || process.arch\n const additionalArgs = options.additionalArgs\n\n const searchPaths = [projectDir, appDir].concat(workspaceRoot ? [workspaceRoot] : [])\n const { pm, resolvedDirectory: _resolvedWorkspaceDir } = await detectPackageManager(searchPaths)\n\n log.info({ pm, platform, arch, projectDir, appDir, workspaceRoot: _resolvedWorkspaceDir }, \"installing dependencies\")\n\n const execArgs = [\"install\"]\n if (pm === PM.YARN) {\n execArgs.push(\"--prefer-offline\")\n } else if (pm === PM.YARN_BERRY) {\n if (isNpmNoBinLinks()) {\n execArgs.push(\"--no-bin-links\")\n }\n }\n\n const execPath = getPackageManagerCommand(pm)\n\n if (additionalArgs != null) {\n execArgs.push(...additionalArgs)\n }\n\n const yarnNpmAuthEnv = pm === PM.YARN_BERRY ? await getYarnBerryNpmAuthEnv(_resolvedWorkspaceDir ?? projectDir, process.env) : {}\n const spawnEnv = {\n ...getGypEnv(options.frameworkInfo, platform, arch, options.buildFromSource === true),\n ...yarnNpmAuthEnv,\n ...env,\n // Silence corepack's activation/download chatter so a `pnpm install` doesn't flood the build log;\n // strict=0 so the app's `packageManager` pin can't abort the install, download prompt/notice off.\n COREPACK_ENABLE_STRICT: \"0\",\n COREPACK_ENABLE_DOWNLOAD_PROMPT: \"0\",\n }\n\n const tmpDir = new TmpDir(\"install-dependencies\")\n try {\n await retry(\n async () => {\n // Stream install output to a file instead of inheriting/buffering it: corepack and the package\n // managers are extremely chatty, so the common (success) path stays quiet and only surfaces the\n // log on failure. On Windows streamSpawnToFile routes through powershell.exe -EncodedCommand\n // rather than cmd.exe, which also sidesteps the spurious \".cmd\" shim \"batch file cannot be\n // found.\" re-open race that previously forced the win32 retry guard below.\n const outputFile = await tmpDir.getTempFile({ prefix: \"install-\", suffix: \".log\" })\n const { code, stderr } = await streamSpawnToFile(execPath, execArgs, appDir, outputFile, spawnEnv)\n if (code !== 0) {\n const stdout = await readFile(outputFile, \"utf8\").catch(() => \"\")\n throw new Error(`Package install (${execPath} ${execArgs.join(\" \")}) exited with code ${code}:\\n${stdout}\\n${stderr}`)\n }\n if (log.isDebugEnabled) {\n const stdout = await readFile(outputFile, \"utf8\").catch(() => \"\")\n log.debug({ stdout, stderr }, \"installed dependencies\")\n }\n },\n {\n retries: 3,\n interval: 1000,\n backoff: 2000,\n shouldRetry: (e: any) => {\n const message = e?.message ?? \"\"\n const retriable = isRetriableInstallError(message)\n if (retriable) {\n log.warn({ error: String(message).split(\"\\n\")[0] }, \"transient error during package install, retrying\")\n }\n return retriable\n },\n }\n )\n } finally {\n await tmpDir.cleanup()\n }\n\n // Some native dependencies no longer use `install` hook for building their native module, (yarn 3+ removed implicit link of `install` and `rebuild` steps)\n // https://github.com/electron-userland/electron-builder/issues/8024\n return rebuild(config, { appDir, projectDir, workspaceRoot }, options)\n}\n\nexport async function nodeGypRebuild(platform: NodeJS.Platform, arch: string, frameworkInfo: DesktopFrameworkInfo) {\n log.info({ platform, arch }, \"executing node-gyp rebuild\")\n // this script must be used only for electron\n const nodeGyp = process.platform === \"win32\" ? which.sync(\"node-gyp\") : \"node-gyp\"\n const args = [\"rebuild\"]\n // headers of old Electron versions do not have a valid config.gypi file\n // and --force-process-config must be passed to node-gyp >= 8.4.0 to\n // correctly build modules for them.\n // see also https://github.com/nodejs/node-gyp/pull/2497\n const [major, minor] = frameworkInfo.version\n .split(\".\")\n .slice(0, 2)\n .map(n => parseInt(n, 10))\n if (major <= 13 || (major == 14 && minor <= 1) || (major == 15 && minor <= 2)) {\n args.push(\"--force-process-config\")\n }\n await spawn(nodeGyp, args, { env: getGypEnv(frameworkInfo, platform, arch, true) })\n}\nexport interface RebuildOptions {\n frameworkInfo: DesktopFrameworkInfo\n\n platform?: NodeJS.Platform\n arch?: string\n\n buildFromSource?: boolean\n\n additionalArgs?: Array<string> | null\n}\n\nexport interface DirectoryPaths {\n appDir: string\n projectDir: string\n workspaceRoot: string | Nullish\n}\n\n/** @internal */\nexport async function rebuild(config: Configuration, { appDir, projectDir, workspaceRoot }: DirectoryPaths, options: RebuildOptions) {\n const buildFromSource = options.buildFromSource === true\n const platform = options.platform || process.platform\n const arch = options.arch || process.arch\n\n const {\n frameworkInfo: { version: electronVersion },\n } = options\n const projectRootPath = workspaceRoot || projectDir || appDir\n const logInfo = {\n electronVersion,\n arch,\n buildFromSource,\n workspaceRoot,\n projectDir: log.filePath(projectDir) || \"./\",\n appDir: log.filePath(appDir) || \"./\",\n }\n log.info(logInfo, \"executing @electron/rebuild\")\n\n const mode = config.nativeModules?.rebuildMode ?? \"sequential\"\n const rebuildOptions: ElectronRebuildOptions = {\n buildPath: appDir,\n electronVersion,\n arch,\n platform,\n buildFromSource,\n projectRootPath,\n mode,\n disablePreGypCopy: true,\n }\n return remoteRebuild(rebuildOptions)\n}\n"]}
|