app-builder-lib 26.12.1 → 26.13.1

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.
Files changed (84) hide show
  1. package/out/asar/asarFileChecker.d.ts +2 -2
  2. package/out/asar/asarFileChecker.js +3 -2
  3. package/out/asar/asarFileChecker.js.map +1 -1
  4. package/out/asar/asarUtil.js +3 -2
  5. package/out/asar/asarUtil.js.map +1 -1
  6. package/out/binDownload.js +4 -4
  7. package/out/binDownload.js.map +1 -1
  8. package/out/codeSign/certInfo.d.ts +54 -0
  9. package/out/codeSign/certInfo.js +466 -0
  10. package/out/codeSign/certInfo.js.map +1 -0
  11. package/out/codeSign/macCodeSign.d.ts +1 -1
  12. package/out/codeSign/macCodeSign.js +8 -7
  13. package/out/codeSign/macCodeSign.js.map +1 -1
  14. package/out/codeSign/windowsSignToolManager.d.ts +2 -0
  15. package/out/codeSign/windowsSignToolManager.js +10 -9
  16. package/out/codeSign/windowsSignToolManager.js.map +1 -1
  17. package/out/configuration.d.ts +5 -0
  18. package/out/configuration.js.map +1 -1
  19. package/out/index.d.ts +2 -1
  20. package/out/index.js +3 -1
  21. package/out/index.js.map +1 -1
  22. package/out/mac/MacTargetHelper.d.ts +3 -3
  23. package/out/mac/MacTargetHelper.js +7 -5
  24. package/out/mac/MacTargetHelper.js.map +1 -1
  25. package/out/macPackager.js +3 -2
  26. package/out/macPackager.js.map +1 -1
  27. package/out/node-module-collector/moduleManager.d.ts +15 -3
  28. package/out/node-module-collector/moduleManager.js +24 -0
  29. package/out/node-module-collector/moduleManager.js.map +1 -1
  30. package/out/node-module-collector/nodeModulesCollector.d.ts +6 -0
  31. package/out/node-module-collector/nodeModulesCollector.js +40 -21
  32. package/out/node-module-collector/nodeModulesCollector.js.map +1 -1
  33. package/out/options/linuxOptions.d.ts +4 -3
  34. package/out/options/linuxOptions.js.map +1 -1
  35. package/out/options/macOptions.d.ts +6 -0
  36. package/out/options/macOptions.js.map +1 -1
  37. package/out/options/metadata.d.ts +2 -0
  38. package/out/options/metadata.js.map +1 -1
  39. package/out/platformPackager.d.ts +1 -1
  40. package/out/platformPackager.js +19 -17
  41. package/out/platformPackager.js.map +1 -1
  42. package/out/targets/LinuxTargetHelper.js +12 -5
  43. package/out/targets/LinuxTargetHelper.js.map +1 -1
  44. package/out/targets/appimage/AppImageTarget.d.ts +0 -2
  45. package/out/targets/appimage/AppImageTarget.js +25 -41
  46. package/out/targets/appimage/AppImageTarget.js.map +1 -1
  47. package/out/targets/appimage/appImageUtil.d.ts +3 -1
  48. package/out/targets/appimage/appImageUtil.js +33 -0
  49. package/out/targets/appimage/appImageUtil.js.map +1 -1
  50. package/out/targets/nsis/NsisTarget.js +29 -9
  51. package/out/targets/nsis/NsisTarget.js.map +1 -1
  52. package/out/targets/nsis/WebInstallerTarget.js +2 -2
  53. package/out/targets/nsis/WebInstallerTarget.js.map +1 -1
  54. package/out/targets/nsis/nsisValidation.d.ts +18 -0
  55. package/out/targets/nsis/nsisValidation.js +52 -0
  56. package/out/targets/nsis/nsisValidation.js.map +1 -0
  57. package/out/toolsets/linux.d.ts +3 -1
  58. package/out/toolsets/linux.js +49 -21
  59. package/out/toolsets/linux.js.map +1 -1
  60. package/out/util/config/config.js +6 -7
  61. package/out/util/config/config.js.map +1 -1
  62. package/out/util/config/schemaValidator.d.ts +7 -0
  63. package/out/util/config/schemaValidator.js +154 -0
  64. package/out/util/config/schemaValidator.js.map +1 -0
  65. package/out/util/dynamicImport.d.ts +1 -0
  66. package/out/util/dynamicImport.js +14 -0
  67. package/out/util/dynamicImport.js.map +1 -0
  68. package/out/util/electronGet.js +31 -1
  69. package/out/util/electronGet.js.map +1 -1
  70. package/out/util/rebuild.d.ts +1 -1
  71. package/out/util/rebuild.js.map +1 -1
  72. package/out/util/resEdit.js +16 -15
  73. package/out/util/resEdit.js.map +1 -1
  74. package/out/util/yarn.js.map +1 -1
  75. package/out/version.d.ts +1 -1
  76. package/out/version.js +1 -1
  77. package/out/version.js.map +1 -1
  78. package/out/winPackager.d.ts +1 -0
  79. package/out/winPackager.js +12 -9
  80. package/out/winPackager.js.map +1 -1
  81. package/package.json +12 -9
  82. package/scheme.json +22 -1
  83. package/templates/linux/after-remove.tpl +14 -2
  84. package/templates/nsis/include/allowOnlyOneInstallerInstance.nsh +5 -5
@@ -1 +1 @@
1
- {"version":3,"file":"electronGet.js","sourceRoot":"","sources":["../../src/util/electronGet.ts"],"names":[],"mappings":";;AA0FA,8CA2BC;AAyDD,wCA+CC;AAyID,wDA+BC;AA8DD,kEAGC;AAED,4DASC;AAMD,oDAaC;AApeD,qCAAoC;AACpC,uCAOsB;AACtB,+CAAkJ;AAClJ,sEAAkE;AAClE,2BAAwD;AACxD,kCAAiC;AACjC,yBAAwB;AACxB,6BAA4B;AAC5B,4CAA2C;AAC3C,8CAA0C;AAC1C,2BAA0B;AAC1B,qCAAoC;AAEpC,6CAAmJ;AA4DnJ,SAAS,WAAW,CAAC,KAAa,EAAE,MAAM,GAAG,CAAC;IAC5C,IAAI,IAAI,GAAG,IAAI,CAAA;IACf,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,IAAI,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAA;IACnD,CAAC;IACD,IAAI,MAAM,CAAC,CAAA;IACX,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;IAC7B,OAAO,GAAG,CAAC,MAAM,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;AAChF,CAAC;AAED,SAAgB,iBAAiB,CAAC,OAA2E;;IAC3G,MAA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AAE,GAAG,YAAY,KAAK,OAAO,EAAE,EAAE,UAAU,CAAC,CAAA;IAEzH,OAAO,kBAAkB,CAAC,cAAc,EAAE,UAAU,EAAE,YAAY,CAAC,CAAA;AACrE,CAAC;AAED;;;GAGG;AACH,SAAgB,oBAAoB,CAAC,aAAqB;IACxD,KAAK,MAAM,MAAM,IAAI;QACnB,6CAA6C;QAC7C,6CAA6C;QAC7C,qDAAqD;QACrD,kCAAkC;KACnC,EAAE,CAAC;QACF,MAAM,GAAG,GAAG,IAAA,kCAAmB,EAAC,MAAM,CAAC,CAAA;QACvC,IAAI,GAAG,EAAE,CAAC;YACR,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 ElectronDownloadCacheMode,\n ElectronDownloadRequest,\n ElectronDownloadRequestOptions,\n ElectronPlatformArtifactDetails,\n GotDownloaderOptions,\n MirrorOptions,\n} from \"@electron/get\"\nimport { buildGotProxyAgent, exec, exists, getPath7za, log, PADDING, parseValidEnvVarUrl, sanitizeDirPath, to7zaOutputSwitch } from \"builder-util\"\nimport { MultiProgress } from \"electron-publish/out/multiProgress\"\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 { ElectronPlatformName } from \"../electron/ElectronFramework\"\nimport { CacheState, cleanupCacheDirectory, computeCacheMetadata, readCacheStateFile, validateCacheDirectory, writeCacheState } from \"./cacheState\"\nimport type { ProgressBar } from \"electron-publish\"\n\nexport type ElectronGetOptions = 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\" // to be added below\n> & {\n mirrorOptions?: Omit<MirrorOptions, \"customDir\" | \"customFilename\" | \"customVersion\">\n}\n\nexport type ArtifactDownloadOptions = {\n electronDownload?: ElectronGetOptions | ElectronDownloadOptions | null\n artifactName: string\n platformName: string\n arch: string\n version: string\n cacheDir?: string\n}\n\nexport interface ElectronDownloadOptions {\n // https://github.com/electron-userland/electron-builder/issues/3077\n // must be optional\n version?: string\n\n /**\n * The [cache location](https://github.com/electron-userland/electron-download#cache-location).\n */\n cache?: string | null\n\n /**\n * The mirror.\n */\n mirror?: string | null\n\n /** @private */\n customDir?: string | null\n /** @private */\n customFilename?: string | null\n\n /** @private */\n strictSSL?: boolean\n /** @private */\n isVerifyChecksum?: boolean\n\n platform?: ElectronPlatformName\n arch?: string\n}\n\nfunction 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\nexport function getCacheDirectory(options: { isAvoidSystemOnWindows?: boolean; allowEnvVarOverride: boolean }): 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 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\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 const entries = createReadStream(file).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 (!destPath.startsWith(dir + path.sep) && 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 (!resolvedTarget.startsWith(dir + path.sep) && 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}\n\nexport async function extractArchive(file: string, dir: string) {\n const tmpDir = `${dir}.tmp`\n await fs.mkdir(tmpDir, { recursive: true })\n\n const release = await lockfile.lock(tmpDir, {\n retries: { retries: 15, 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 if (file.endsWith(\".tar.gz\") || file.endsWith(\".tgz\")) {\n await tar.extract({ file, cwd: tmpDir, strip: 1 })\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, 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 fs.rename(tmpDir, dir)\n } finally {\n await release().catch(err => log.warn({ err }, \"failed to release lockfile\"))\n }\n}\n\nasync function downloadArtifactToFile(config: Parameters<typeof get.downloadArtifact>[0], label: string): Promise<string> {\n let lastLoggedMilestone = -1\n const state: { bar: ProgressBar | undefined } = { bar: undefined }\n\n const downloadOptions: GotDownloaderOptions = {\n timeout: { request: 10 * 60 * 1000 }, // prevent indefinite hang on stalled connections\n ...config.downloadOptions,\n agent: config.downloadOptions?.agent ?? buildGotProxyAgent(),\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 get.downloadArtifact(configWithProgress)\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 }\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: Parameters<typeof get.downloadArtifact>[0], extractDir: string, label: string): Promise<string> {\n await fs.mkdir(extractDir, { recursive: true })\n\n // Pre-lock fast path: only short-circuit for a definitively complete and valid cache.\n // Do NOT clean up here — concurrent processes could race to delete under each other.\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 const release = await lockfile.lock(extractDir, {\n retries: { retries: 15, 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 fs.mkdir(extractDir, { recursive: true })\n\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\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 * 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 const baseUrl = getBinariesMirrorUrl(githubOrgRepo)\n const fullUrl = overrideUrl ? `${overrideUrl}/${filenameWithExt}` : `${baseUrl}${releaseName}/${filenameWithExt}`\n const suffix = hashUrlSafe(fullUrl, 5)\n const folderName = `${filenameWithExt.replace(/\\.(tar\\.gz|tgz|zip|7z)$/, \"\")}-${suffix}`\n const extractDir = path.join(getCacheDirectory({ allowEnvVarOverride: true }), releaseName, folderName)\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 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(getCacheDirectory({ allowEnvVarOverride: true }), \"downloads\"),\n cacheMode: resolveCacheMode(),\n ...(checksums != null ? { checksums } : { unsafelyDisableChecksums: true }),\n mirrorOptions,\n isGeneric: true,\n }\n return downloadAndExtract(config, extractDir, filenameWithExt)\n}\n\n// Keys present in ElectronGetOptions but absent from ElectronDownloadOptions.\n// Used to discriminate between the two config shapes at runtime.\nconst ELECTRON_GET_EXCLUSIVE_KEYS: readonly string[] = [\"mirrorOptions\", \"force\", \"unsafelyDisableChecksums\"]\n\nfunction isElectronGetOptions(dl: ElectronGetOptions | ElectronDownloadOptions): dl is ElectronGetOptions {\n return ELECTRON_GET_EXCLUSIVE_KEYS.some(k => Object.hasOwnProperty.call(dl, k))\n}\n\n/**\n * Downloads and extracts an electron platform artifact (e.g. ffmpeg) using @electron/get.\n * Deduplicates concurrent calls for the same artifact within the same process.\n */\nfunction buildElectronArtifactConfig(options: ArtifactDownloadOptions): ElectronPlatformArtifactDetails {\n const { electronDownload, arch, version, platformName: platform, artifactName, cacheDir: cacheRoot } = options\n\n let artifactConfig: ElectronPlatformArtifactDetails = { cacheRoot, platform, arch, version, artifactName }\n\n if (electronDownload != null) {\n if (isElectronGetOptions(electronDownload)) {\n const { mirrorOptions, ...rest } = electronDownload\n artifactConfig = { ...artifactConfig, ...rest, cacheRoot, mirrorOptions }\n } else {\n const { mirror, customDir, cache, customFilename, isVerifyChecksum, strictSSL, platform: overridePlatform, arch: overrideArch } = electronDownload\n // strictSSL: false disables TLS certificate validation for all\n // electron/tool downloads. This option exists only for air-gapped or\n // self-signed-cert environments; ensure your build network is fully trusted.\n if (strictSSL === false) {\n log.warn(\n { option: \"electronDownload.strictSSL\" },\n \"strictSSL is false — TLS certificate validation is DISABLED for Electron downloads. Only use this option in a trusted, isolated build environment.\"\n )\n }\n artifactConfig = {\n ...artifactConfig,\n unsafelyDisableChecksums: isVerifyChecksum === false,\n cacheRoot: cache ?? cacheRoot,\n mirrorOptions: {\n mirror: mirror || undefined,\n customDir: customDir || undefined,\n customFilename: customFilename || undefined,\n },\n ...(strictSSL === false ? { downloadOptions: { https: { rejectUnauthorized: false } } } : {}),\n }\n if (overridePlatform != null) {\n artifactConfig.platform = overridePlatform\n }\n if (overrideArch != null) {\n artifactConfig.arch = overrideArch\n }\n }\n }\n\n artifactConfig.cacheMode = resolveCacheMode()\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 function downloadElectronArtifactZip(options: ArtifactDownloadOptions): Promise<string> {\n const config = buildElectronArtifactConfig(options)\n return downloadArtifactToFile(config, config.artifactName)\n}\n\nexport async function downloadElectronArtifact(options: ArtifactDownloadOptions): Promise<string> {\n const { arch, version, platformName: platform, artifactName } = options\n const artifactConfig = 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(getCacheDirectory({ allowEnvVarOverride: true }), `${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 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)\n if (url) {\n return url.endsWith(\"/\") ? url : `${url}/`\n }\n }\n return `https://github.com/${githubOrgRepo}/releases/download/`\n}\n"]}
1
+ {"version":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CAAA;AAC5D,CAAC;AAEM,KAAK,UAAU,wBAAwB,CAAC,OAAgC;IAC7E,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,OAAO,CAAA;IACvE,MAAM,cAAc,GAAG,2BAA2B,CAAC,OAAO,CAAC,CAAA;IAE3D,MAAM,MAAM,GAAG,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC,CAAA;IAC7D,MAAM,UAAU,GAAG,GAAG,YAAY,KAAK,OAAO,IAAI,QAAQ,IAAI,IAAI,IAAI,MAAM,EAAE,CAAA;IAC9E,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,EAAE,mBAAmB,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,YAAY,KAAK,OAAO,EAAE,EAAE,UAAU,CAAC,CAAA;IAEzH,OAAO,kBAAkB,CAAC,cAAc,EAAE,UAAU,EAAE,YAAY,CAAC,CAAA;AACrE,CAAC;AAED;;;GAGG;AACH,SAAgB,oBAAoB,CAAC,aAAqB;IACxD,KAAK,MAAM,MAAM,IAAI;QACnB,6CAA6C;QAC7C,6CAA6C;QAC7C,qDAAqD;QACrD,kCAAkC;KACnC,EAAE,CAAC;QACF,MAAM,GAAG,GAAG,IAAA,kCAAmB,EAAC,MAAM,CAAC,CAAA;QACvC,IAAI,GAAG,EAAE,CAAC;YACR,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 ElectronDownloadCacheMode,\n ElectronDownloadRequest,\n ElectronDownloadRequestOptions,\n ElectronPlatformArtifactDetails,\n GotDownloaderOptions,\n MirrorOptions,\n} from \"@electron/get\"\nimport { buildGotProxyAgent, exec, exists, getPath7za, log, PADDING, parseValidEnvVarUrl, sanitizeDirPath, to7zaOutputSwitch } from \"builder-util\"\nimport { MultiProgress } from \"electron-publish/out/multiProgress\"\nimport { createReadStream, createWriteStream } from \"fs\"\nimport * as fs from \"fs/promises\"\nimport * as crypto from \"crypto\"\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 { HttpError, retry } from \"builder-util-runtime\"\nimport { ElectronPlatformName } from \"../electron/ElectronFramework\"\nimport { CacheState, cleanupCacheDirectory, computeCacheMetadata, readCacheStateFile, validateCacheDirectory, writeCacheState } from \"./cacheState\"\nimport type { ProgressBar } from \"electron-publish\"\n\nexport type ElectronGetOptions = 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\" // to be added below\n> & {\n mirrorOptions?: Omit<MirrorOptions, \"customDir\" | \"customFilename\" | \"customVersion\">\n}\n\nexport type ArtifactDownloadOptions = {\n electronDownload?: ElectronGetOptions | ElectronDownloadOptions | null\n artifactName: string\n platformName: string\n arch: string\n version: string\n cacheDir?: string\n}\n\nexport interface ElectronDownloadOptions {\n // https://github.com/electron-userland/electron-builder/issues/3077\n // must be optional\n version?: string\n\n /**\n * The [cache location](https://github.com/electron-userland/electron-download#cache-location).\n */\n cache?: string | null\n\n /**\n * The mirror.\n */\n mirror?: string | null\n\n /** @private */\n customDir?: string | null\n /** @private */\n customFilename?: string | null\n\n /** @private */\n strictSSL?: boolean\n /** @private */\n isVerifyChecksum?: boolean\n\n platform?: ElectronPlatformName\n arch?: string\n}\n\nfunction 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\nexport function getCacheDirectory(options: { isAvoidSystemOnWindows?: boolean; allowEnvVarOverride: boolean }): 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 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\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 const entries = createReadStream(file).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 (!destPath.startsWith(dir + path.sep) && 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 (!resolvedTarget.startsWith(dir + path.sep) && 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}\n\nexport async function extractArchive(file: string, dir: string) {\n const tmpDir = `${dir}.tmp`\n await fs.mkdir(tmpDir, { recursive: true })\n\n const release = await lockfile.lock(tmpDir, {\n retries: { retries: 15, 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 new Promise(r => setTimeout(r, 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(\".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, 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 fs.rename(tmpDir, dir)\n } finally {\n await release().catch(err => log.warn({ err }, \"failed to release lockfile\"))\n }\n}\n\nasync function downloadArtifactToFile(config: Parameters<typeof get.downloadArtifact>[0], 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 artifactLockKey = crypto\n .createHash(\"sha256\")\n .update(JSON.stringify({ v: config.version, p: (config as any).platform, a: (config as any).arch, n: (config as any).artifactName }))\n .digest(\"hex\")\n .slice(0, 20)\n const artifactLockPath = path.join(os.tmpdir(), `eb-dl-${artifactLockKey}.lock`)\n const releaseArtifactLock = await lockfile.lock(artifactLockPath, {\n retries: { retries: 30, 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 const downloadOptions: GotDownloaderOptions = {\n timeout: { request: 10 * 60 * 1000 }, // prevent indefinite hang on stalled connections\n ...config.downloadOptions,\n agent: config.downloadOptions?.agent ?? buildGotProxyAgent(),\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 * 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: Parameters<typeof get.downloadArtifact>[0], extractDir: string, label: string): Promise<string> {\n await fs.mkdir(extractDir, { recursive: true })\n\n // Pre-lock fast path: only short-circuit for a definitively complete and valid cache.\n // Do NOT clean up here — concurrent processes could race to delete under each other.\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 const release = await lockfile.lock(extractDir, {\n retries: { retries: 15, 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 fs.mkdir(extractDir, { recursive: true })\n\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\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 * 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 const baseUrl = getBinariesMirrorUrl(githubOrgRepo)\n const fullUrl = overrideUrl ? `${overrideUrl}/${filenameWithExt}` : `${baseUrl}${releaseName}/${filenameWithExt}`\n const suffix = hashUrlSafe(fullUrl, 5)\n const folderName = `${filenameWithExt.replace(/\\.(tar\\.gz|tgz|zip|7z)$/, \"\")}-${suffix}`\n const extractDir = path.join(getCacheDirectory({ allowEnvVarOverride: true }), releaseName, folderName)\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 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(getCacheDirectory({ allowEnvVarOverride: true }), \"downloads\"),\n cacheMode: resolveCacheMode(),\n ...(checksums != null ? { checksums } : { unsafelyDisableChecksums: true }),\n mirrorOptions,\n isGeneric: true,\n }\n return downloadAndExtract(config, extractDir, filenameWithExt)\n}\n\n// Keys present in ElectronGetOptions but absent from ElectronDownloadOptions.\n// Used to discriminate between the two config shapes at runtime.\nconst ELECTRON_GET_EXCLUSIVE_KEYS: readonly string[] = [\"mirrorOptions\", \"force\", \"unsafelyDisableChecksums\"]\n\nfunction isElectronGetOptions(dl: ElectronGetOptions | ElectronDownloadOptions): dl is ElectronGetOptions {\n return ELECTRON_GET_EXCLUSIVE_KEYS.some(k => Object.hasOwnProperty.call(dl, k))\n}\n\n/**\n * Downloads and extracts an electron platform artifact (e.g. ffmpeg) using @electron/get.\n * Deduplicates concurrent calls for the same artifact within the same process.\n */\nfunction buildElectronArtifactConfig(options: ArtifactDownloadOptions): ElectronPlatformArtifactDetails {\n const { electronDownload, arch, version, platformName: platform, artifactName, cacheDir: cacheRoot } = options\n\n let artifactConfig: ElectronPlatformArtifactDetails = { cacheRoot, platform, arch, version, artifactName }\n\n if (electronDownload != null) {\n if (isElectronGetOptions(electronDownload)) {\n const { mirrorOptions, ...rest } = electronDownload\n artifactConfig = { ...artifactConfig, ...rest, cacheRoot, mirrorOptions }\n } else {\n const { mirror, customDir, cache, customFilename, isVerifyChecksum, strictSSL, platform: overridePlatform, arch: overrideArch } = electronDownload\n // strictSSL: false disables TLS certificate validation for all\n // electron/tool downloads. This option exists only for air-gapped or\n // self-signed-cert environments; ensure your build network is fully trusted.\n if (strictSSL === false) {\n log.warn(\n { option: \"electronDownload.strictSSL\" },\n \"strictSSL is false — TLS certificate validation is DISABLED for Electron downloads. Only use this option in a trusted, isolated build environment.\"\n )\n }\n artifactConfig = {\n ...artifactConfig,\n unsafelyDisableChecksums: isVerifyChecksum === false,\n cacheRoot: cache ?? cacheRoot,\n mirrorOptions: {\n mirror: mirror || undefined,\n customDir: customDir || undefined,\n customFilename: customFilename || undefined,\n },\n ...(strictSSL === false ? { downloadOptions: { https: { rejectUnauthorized: false } } } : {}),\n }\n if (overridePlatform != null) {\n artifactConfig.platform = overridePlatform\n }\n if (overrideArch != null) {\n artifactConfig.arch = overrideArch\n }\n }\n }\n\n artifactConfig.cacheMode = resolveCacheMode()\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 function downloadElectronArtifactZip(options: ArtifactDownloadOptions): Promise<string> {\n const config = buildElectronArtifactConfig(options)\n return downloadArtifactToFile(config, config.artifactName)\n}\n\nexport async function downloadElectronArtifact(options: ArtifactDownloadOptions): Promise<string> {\n const { arch, version, platformName: platform, artifactName } = options\n const artifactConfig = 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(getCacheDirectory({ allowEnvVarOverride: true }), `${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 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)\n if (url) {\n return url.endsWith(\"/\") ? url : `${url}/`\n }\n }\n return `https://github.com/${githubOrgRepo}/releases/download/`\n}\n"]}
@@ -1,2 +1,2 @@
1
- import { RebuildOptions } from "@electron/rebuild";
1
+ import type { RebuildOptions } from "@electron/rebuild";
2
2
  export declare const rebuild: (options: RebuildOptions) => Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"rebuild.js","sourceRoot":"","sources":["../../src/util/rebuild.ts"],"names":[],"mappings":";;;AACA,+CAAkC;AAClC,oCAAmC;AACnC,6BAA4B;AAErB,MAAM,OAAO,GAAG,KAAK,EAAE,OAAuB,EAAiB,EAAE;;IACtE,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAA;IACxB,kBAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,gCAAgC,CAAC,CAAA;IAEpD,MAAM,KAAK,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,iCAAiC,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,EAAE;QAC3G,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC;KACvC,CAAC,CAAA;IAEF,IAAI,YAAmB,CAAA;IAEvB,MAAA,KAAK,CAAC,MAAM,0CAAE,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE;QAC/B,kBAAG,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAA;IAC5B,CAAC,CAAC,CAAA;IACF,MAAA,KAAK,CAAC,MAAM,0CAAE,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE;QAC/B,kBAAG,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAA;IAC7B,C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AC,YAAY,IAAI,IAAI,KAAK,CAAC,oCAAoC,IAAI,EAAE,CAAC,CAAC,CAAA;YAC/E,CAAC;QACH,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA;AArDY,QAAA,OAAO,WAqDnB","sourcesContent":["import { RebuildOptions } from \"@electron/rebuild\"\nimport { log } from \"builder-util\"\nimport * as cp from \"child_process\"\nimport * as path from \"path\"\n\nexport const rebuild = async (options: RebuildOptions): Promise<void> => {\n const { arch } = options\n log.info({ arch }, `installing native dependencies`)\n\n const child = cp.fork(path.resolve(__dirname, \"../../helpers/remote-rebuild.js\"), [JSON.stringify(options)], {\n stdio: [\"pipe\", \"pipe\", \"pipe\", \"ipc\"],\n })\n\n let pendingError: Error\n\n child.stdout?.on(\"data\", chunk => {\n log.info(chunk.toString())\n })\n child.stderr?.on(\"data\", chunk => {\n log.error(chunk.toString())\n })\n\n child.on(\"message\", (message: { msg: string; moduleName: string; err: { message: string; stack: string } }) => {\n const { moduleName, msg } = message\n switch (msg) {\n case \"module-found\": {\n log.info({ moduleName, arch }, \"preparing\")\n break\n }\n case \"module-done\": {\n log.info({ moduleName, arch }, \"finished\")\n break\n }\n case \"module-skip\": {\n log.debug?.({ moduleName, arch }, \"skipped. set ENV=electron-rebuild to determine why\")\n break\n }\n case \"rebuild-error\": {\n pendingError = new Error(message.err.message)\n pendingError.stack = message.err.stack\n break\n }\n case \"rebuild-done\": {\n log.info(\"completed installing native dependencies\")\n break\n }\n }\n })\n\n await new Promise<void>((resolve, reject) => {\n child.on(\"exit\", code => {\n if (code === 0 && !pendingError) {\n resolve()\n } else {\n reject(pendingError || new Error(`Rebuilder failed with exit code: ${code}`))\n }\n })\n })\n}\n"]}
1
+ {"version":3,"file":"rebuild.js","sourceRoot":"","sources":["../../src/util/rebuild.ts"],"names":[],"mappings":";;;AACA,+CAAkC;AAClC,oCAAmC;AACnC,6BAA4B;AAErB,MAAM,OAAO,GAAG,KAAK,EAAE,OAAuB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aAAa,CAAC,CAAC,CAAC;gBACnB,MAAA,kBAAG,CAAC,KAAK,mEAAG,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,oDAAoD,CAAC,CAAA;gBACvF,MAAK;YACP,CAAC;YACD,KAAK,eAAe,CAAC,CAAC,CAAC;gBACrB,YAAY,GAAG,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;gBAC7C,YAAY,CAAC,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,CAAA;gBACtC,MAAK;YACP,CAAC;YACD,KAAK,cAAc,CAAC,CAAC,CAAC;gBACpB,kBAAG,CAAC,IAAI,CAAC,0CAA0C,CAAC,CAAA;gBACpD,MAAK;YACP,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAA;IAEF,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC1C,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE;YACtB,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;gBAChC,OAAO,EAAE,CAAA;YACX,CAAC;iBAAM,CAAC;gBACN,MAAM,CAAC,YAAY,IAAI,IAAI,KAAK,CAAC,oCAAoC,IAAI,EAAE,CAAC,CAAC,CAAA;YAC/E,CAAC;QACH,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA;AArDY,QAAA,OAAO,WAqDnB","sourcesContent":["import type { RebuildOptions } from \"@electron/rebuild\"\nimport { log } from \"builder-util\"\nimport * as cp from \"child_process\"\nimport * as path from \"path\"\n\nexport const rebuild = async (options: RebuildOptions): Promise<void> => {\n const { arch } = options\n log.info({ arch }, `installing native dependencies`)\n\n const child = cp.fork(path.resolve(__dirname, \"../../helpers/remote-rebuild.js\"), [JSON.stringify(options)], {\n stdio: [\"pipe\", \"pipe\", \"pipe\", \"ipc\"],\n })\n\n let pendingError: Error\n\n child.stdout?.on(\"data\", chunk => {\n log.info(chunk.toString())\n })\n child.stderr?.on(\"data\", chunk => {\n log.error(chunk.toString())\n })\n\n child.on(\"message\", (message: { msg: string; moduleName: string; err: { message: string; stack: string } }) => {\n const { moduleName, msg } = message\n switch (msg) {\n case \"module-found\": {\n log.info({ moduleName, arch }, \"preparing\")\n break\n }\n case \"module-done\": {\n log.info({ moduleName, arch }, \"finished\")\n break\n }\n case \"module-skip\": {\n log.debug?.({ moduleName, arch }, \"skipped. set ENV=electron-rebuild to determine why\")\n break\n }\n case \"rebuild-error\": {\n pendingError = new Error(message.err.message)\n pendingError.stack = message.err.stack\n break\n }\n case \"rebuild-done\": {\n log.info(\"completed installing native dependencies\")\n break\n }\n }\n })\n\n await new Promise<void>((resolve, reject) => {\n child.on(\"exit\", code => {\n if (code === 0 && !pendingError) {\n resolve()\n } else {\n reject(pendingError || new Error(`Rebuilder failed with exit code: ${code}`))\n }\n })\n })\n}\n"]}
@@ -26,23 +26,24 @@ async function editWindowsResources(opts) {
26
26
  resedit_1.Resource.IconGroupEntry.replaceIconsForResource(res.entries, 1, lang.lang, iconFile.icons.map(i => i.data));
27
27
  }
28
28
  if (opts.requestedExecutionLevel && opts.requestedExecutionLevel !== "asInvoker") {
29
- const manifestEntry = res.entries.find(e => e.type === 24 && e.id === 1);
30
- if (!manifestEntry) {
31
- builder_util_1.log.warn({ file: opts.file }, "no RT_MANIFEST resource found; requestedExecutionLevel will not be applied");
32
- }
33
- else {
34
- const originalXml = Buffer.from(manifestEntry.bin).toString("utf-8");
35
- const updatedXml = originalXml.replace(/(<requestedExecutionLevel[^>]*\blevel=")[^"]*(")/i, `$1${opts.requestedExecutionLevel}$2`);
36
- if (updatedXml === originalXml) {
37
- builder_util_1.log.warn({ file: opts.file, requestedExecutionLevel: opts.requestedExecutionLevel }, "requestedExecutionLevel node not found in manifest; execution level not updated");
38
- }
39
- else {
40
- const newBuf = Buffer.from(updatedXml, "utf-8");
41
- manifestEntry.bin = newBuf.buffer.slice(newBuf.byteOffset, newBuf.byteOffset + newBuf.byteLength);
42
- }
43
- }
29
+ patchManifestExecutionLevel(res, opts.requestedExecutionLevel, opts.file);
44
30
  }
45
31
  res.outputResource(executable);
46
32
  await (0, promises_1.writeFile)(opts.file, Buffer.from(executable.generate()));
47
33
  }
34
+ function patchManifestExecutionLevel(res, level, file) {
35
+ const manifestEntry = res.entries.find(e => e.type === 24 && e.id === 1);
36
+ if (!manifestEntry) {
37
+ builder_util_1.log.warn({ file }, "no RT_MANIFEST resource found; requestedExecutionLevel will not be applied");
38
+ return;
39
+ }
40
+ const originalXml = Buffer.from(manifestEntry.bin).toString("utf-8");
41
+ const updatedXml = originalXml.replace(/(<requestedExecutionLevel[^>]*\blevel=")[^"]*(")/i, `$1${level}$2`);
42
+ if (updatedXml === originalXml) {
43
+ builder_util_1.log.warn({ file, requestedExecutionLevel: level }, "requestedExecutionLevel node not found in manifest; execution level not updated");
44
+ return;
45
+ }
46
+ const newBuf = Buffer.from(updatedXml, "utf-8");
47
+ manifestEntry.bin = newBuf.buffer.slice(newBuf.byteOffset, newBuf.byteOffset + newBuf.byteLength);
48
+ }
48
49
  //# sourceMappingURL=resEdit.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"resEdit.js","sourceRoot":"","sources":["../../src/util/resEdit.ts"],"names":[],"mappings":";;AAcA,oDAgDC;AA9DD,+CAAkC;AAClC,0CAAiD;AACjD,qCAA4E;AAYrE,KAAK,UAAU,oBAAoB,CAAC,IAAyB;IAClE,MAAM,MAAM,GAAG,MAAM,IAAA,mBAAQ,EAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACxC,MAAM,UAAU,GAAG,sBAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAC5C,MAAM,GAAG,GAAG,8BAAoB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;IAEjD,MAAM,MAAM,GAAG,kBAAQ,CAAC,WAAW,CAAC,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;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,CAAC,CAAA;AAChE,CAAC","sourcesContent":["import { log } from \"builder-util\"\nimport { readFile, writeFile } from \"fs/promises\"\nimport { Data, NtExecutable, NtExecutableResource, Resource } from \"resedit\"\nimport { RequestedExecutionLevel } from \"../options/winOptions\"\n\nexport interface ResourceEditOptions {\n file: string\n versionStrings: Record<string, string>\n fileVersion: string\n productVersion: string\n requestedExecutionLevel?: RequestedExecutionLevel | null\n iconPath?: string | null\n}\n\nexport async function editWindowsResources(opts: ResourceEditOptions): Promise<void> {\n const buffer = await readFile(opts.file)\n const executable = NtExecutable.from(buffer)\n const res = NtExecutableResource.from(executable)\n\n const viList = Resource.VersionInfo.fromEntries(res.entries)\n // Mirror rcedit: create version info from scratch if none exists; use first if multiple\n const vi = viList.length > 0 ? viList[0] : Resource.VersionInfo.createEmpty()\n // Mirror rcedit: default to en-US (1033) if no languages present; use first if multiple\n const languages = vi.getAllLanguagesForStringValues()\n const lang = languages.length > 0 ? languages[0] : { lang: 0x0409, codepage: 1200 }\n\n vi.setStringValues(lang, opts.versionStrings)\n vi.setFileVersion(opts.fileVersion)\n vi.setProductVersion(opts.productVersion)\n // resedit normalizes the string to 4-part numeric; restore the original (e.g. \"1.1.0\" or \"3.0.0-beta.2\")\n vi.setStringValues(lang, { FileVersion: opts.fileVersion })\n vi.outputToResourceEntries(res.entries)\n\n if (opts.iconPath) {\n const iconBuf = await readFile(opts.iconPath)\n const iconFile = Data.IconFile.from(iconBuf)\n Resource.IconGroupEntry.replaceIconsForResource(\n res.entries,\n 1,\n lang.lang,\n iconFile.icons.map(i => i.data)\n )\n }\n\n if (opts.requestedExecutionLevel && opts.requestedExecutionLevel !== \"asInvoker\") {\n const manifestEntry = res.entries.find(e => e.type === 24 && e.id === 1)\n if (!manifestEntry) {\n log.warn({ file: opts.file }, \"no RT_MANIFEST resource found; requestedExecutionLevel will not be applied\")\n } else {\n const originalXml = Buffer.from(manifestEntry.bin).toString(\"utf-8\")\n const updatedXml = originalXml.replace(/(<requestedExecutionLevel[^>]*\\blevel=\")[^\"]*(\")/i, `$1${opts.requestedExecutionLevel}$2`)\n if (updatedXml === originalXml) {\n log.warn({ file: opts.file, requestedExecutionLevel: opts.requestedExecutionLevel }, \"requestedExecutionLevel node not found in manifest; execution level not updated\")\n } else {\n const newBuf = Buffer.from(updatedXml, \"utf-8\")\n manifestEntry.bin = newBuf.buffer.slice(newBuf.byteOffset, newBuf.byteOffset + newBuf.byteLength)\n }\n }\n }\n\n res.outputResource(executable)\n await writeFile(opts.file, Buffer.from(executable.generate()))\n}\n"]}
1
+ {"version":3,"file":"resEdit.js","sourceRoot":"","sources":["../../src/util/resEdit.ts"],"names":[],"mappings":";;AAcA,oDAoCC;AAlDD,+CAAkC;AAClC,0CAAiD;AACjD,qCAA4E;AAYrE,KAAK,UAAU,oBAAoB,CAAC,IAAyB;IAClE,MAAM,MAAM,GAAG,MAAM,IAAA,mBAAQ,EAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACxC,MAAM,UAAU,GAAG,sBAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAC5C,MAAM,GAAG,GAAG,8BAAoB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;IAEjD,MAAM,MAAM,GAAG,kBAAQ,CAAC,WAAW,CAAC,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;IAC5D,wFAAwF;IACxF,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,kBAAQ,CAAC,WAAW,CAAC,WAAW,EAAE,CAAA;IAC7E,wFAAwF;IACxF,MAAM,SAAS,GAAG,EAAE,CAAC,8BAA8B,EAAE,CAAA;IACrD,MAAM,IAAI,GAAG,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IA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;IACzF,MAAM,aAAa,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,EAAE,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAA;IACxE,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,kBAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,4EAA4E,CAAC,CAAA;QAChG,OAAM;IACR,CAAC;IACD,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;IACpE,MAAM,UAAU,GAAG,WAAW,CAAC,OAAO,CAAC,mDAAmD,EAAE,KAAK,KAAK,IAAI,CAAC,CAAA;IAC3G,IAAI,UAAU,KAAK,WAAW,EAAE,CAAC;QAC/B,kBAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,uBAAuB,EAAE,KAAK,EAAE,EAAE,iFAAiF,CAAC,CAAA;QACrI,OAAM;IACR,CAAC;IACD,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,CAAA;IAC/C,aAAa,CAAC,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC,CAAA;AACnG,CAAC","sourcesContent":["import { log } from \"builder-util\"\nimport { readFile, writeFile } from \"fs/promises\"\nimport { Data, NtExecutable, NtExecutableResource, Resource } from \"resedit\"\nimport { RequestedExecutionLevel } from \"../options/winOptions\"\n\nexport interface ResourceEditOptions {\n file: string\n versionStrings: Record<string, string>\n fileVersion: string\n productVersion: string\n requestedExecutionLevel?: RequestedExecutionLevel | null\n iconPath?: string | null\n}\n\nexport async function editWindowsResources(opts: ResourceEditOptions): Promise<void> {\n const buffer = await readFile(opts.file)\n const executable = NtExecutable.from(buffer)\n const res = NtExecutableResource.from(executable)\n\n const viList = Resource.VersionInfo.fromEntries(res.entries)\n // Mirror rcedit: create version info from scratch if none exists; use first if multiple\n const vi = viList.length > 0 ? viList[0] : Resource.VersionInfo.createEmpty()\n // Mirror rcedit: default to en-US (1033) if no languages present; use first if multiple\n const languages = vi.getAllLanguagesForStringValues()\n const lang = languages.length > 0 ? languages[0] : { lang: 0x0409, codepage: 1200 }\n\n vi.setStringValues(lang, opts.versionStrings)\n vi.setFileVersion(opts.fileVersion)\n vi.setProductVersion(opts.productVersion)\n // resedit normalizes the string to 4-part numeric; restore the original (e.g. \"1.1.0\" or \"3.0.0-beta.2\")\n vi.setStringValues(lang, { FileVersion: opts.fileVersion })\n vi.outputToResourceEntries(res.entries)\n\n if (opts.iconPath) {\n const iconBuf = await readFile(opts.iconPath)\n const iconFile = Data.IconFile.from(iconBuf)\n Resource.IconGroupEntry.replaceIconsForResource(\n res.entries,\n 1,\n lang.lang,\n iconFile.icons.map(i => i.data)\n )\n }\n\n if (opts.requestedExecutionLevel && opts.requestedExecutionLevel !== \"asInvoker\") {\n patchManifestExecutionLevel(res, opts.requestedExecutionLevel, opts.file)\n }\n\n res.outputResource(executable)\n await writeFile(opts.file, Buffer.from(executable.generate()))\n}\n\nfunction patchManifestExecutionLevel(res: NtExecutableResource, level: string, file: string): void {\n const manifestEntry = res.entries.find(e => e.type === 24 && e.id === 1)\n if (!manifestEntry) {\n log.warn({ file }, \"no RT_MANIFEST resource found; requestedExecutionLevel will not be applied\")\n return\n }\n const originalXml = Buffer.from(manifestEntry.bin).toString(\"utf-8\")\n const updatedXml = originalXml.replace(/(<requestedExecutionLevel[^>]*\\blevel=\")[^\"]*(\")/i, `$1${level}$2`)\n if (updatedXml === originalXml) {\n log.warn({ file, requestedExecutionLevel: level }, \"requestedExecutionLevel node not found in manifest; execution level not updated\")\n return\n }\n const newBuf = Buffer.from(updatedXml, \"utf-8\")\n manifestEntry.bin = newBuf.buffer.slice(newBuf.byteOffset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AA6B,EAAC,CAAC,sBAAsB,CAAC,EAAE,aAAa,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,CAAA;IACrG,CAAC;IAED,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,kBAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,IAAI;QAC5C,MAAM,EAAE,kBAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,IAAI;KACrC,CAAA;IACD,kBAAG,CAAC,IAAI,CAAC,OAAO,EAAE,6BAA6B,CAAC,CAAA;IAEhD,MAAM,cAAc,GAA2B;QAC7C,SAAS,EAAE,MAAM;QACjB,eAAe;QACf,IAAI;QACJ,QAAQ;QACR,eAAe;QACf,eAAe;QACf,IAAI,EAAE,MAAM,CAAC,eAAe,IAAI,YAAY;QAC5C,iBAAiB,EAAE,IAAI;KACxB,CAAA;IACD,OAAO,IAAA,iBAAa,EAAC,cAAc,CAAC,CAAA;AACtC,CAAC","sourcesContent":["import { asArray, log, spawn, stripSensitiveEnvVars } from \"builder-util\"\nimport { pathExists } from \"fs-extra\"\nimport { Lazy } from \"lazy-val\"\nimport { homedir } from \"os\"\nimport * as path from \"path\"\nimport { Configuration } from \"../configuration\"\nimport { executeAppBuilderAndWriteJson } from \"./appBuilder\"\nimport { PM, getPackageManagerCommand } from \"../node-module-collector\"\nimport { detectPackageManager } from \"../node-module-collector/packageManager\"\nimport { NodeModuleDirInfo } from \"./packageDependencies\"\nimport { rebuild as remoteRebuild } from \"./rebuild\"\nimport * as which from \"which\"\nimport { RebuildOptions as ElectronRebuildOptions } from \"@electron/rebuild\"\nimport { Nullish } from \"builder-util-runtime\"\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.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\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 (process.env.NPM_NO_BIN_LINKS === \"true\") {\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 await spawn(execPath, execArgs, {\n cwd: appDir,\n env: {\n ...getGypEnv(options.frameworkInfo, platform, arch, options.buildFromSource === true),\n ...env,\n },\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 productionDeps: Lazy<Array<NodeModuleDirInfo>>\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 if (config.nativeRebuilder === \"legacy\") {\n const configuration = {\n platform,\n arch,\n buildFromSource,\n dependencies: await options.productionDeps.value,\n nodeExecPath: process.execPath,\n additionalArgs: options.additionalArgs,\n execPath: process.env.npm_execpath || process.env.NPM_CLI_JS,\n }\n const env = getGypEnv(options.frameworkInfo, platform, arch, buildFromSource)\n return executeAppBuilderAndWriteJson([\"rebuild-node-modules\"], configuration, { env, cwd: appDir })\n }\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 rebuildOptions: ElectronRebuildOptions = {\n buildPath: appDir,\n electronVersion,\n arch,\n platform,\n buildFromSource,\n projectRootPath,\n mode: config.nativeRebuilder || \"sequential\",\n disablePreGypCopy: true,\n }\n return remoteRebuild(rebuildOptions)\n}\n"]}
1
+ {"version":3,"file":"yarn.js","sourceRoot":"","sources":["../../src/util/yarn.ts"],"names":[],"mappings":";;AAeA,4CA4BC;AAWD,8BAiCC;AAED,kD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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,kBAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,IAAI;QAC5C,MAAM,EAAE,kBAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,IAAI;KACrC,CAAA;IACD,kBAAG,CAAC,IAAI,CAAC,OAAO,EAAE,6BAA6B,CAAC,CAAA;IAEhD,MAAM,cAAc,GAA2B;QAC7C,SAAS,EAAE,MAAM;QACjB,eAAe;QACf,IAAI;QACJ,QAAQ;QACR,eAAe;QACf,eAAe;QACf,IAAI,EAAE,MAAM,CAAC,eAAe,IAAI,YAAY;QAC5C,iBAAiB,EAAE,IAAI;KACxB,CAAA;IACD,OAAO,IAAA,iBAAa,EAAC,cAAc,CAAC,CAAA;AACtC,CAAC","sourcesContent":["import { asArray, log, spawn, stripSensitiveEnvVars } from \"builder-util\"\nimport { pathExists } from \"fs-extra\"\nimport { Lazy } from \"lazy-val\"\nimport { homedir } from \"os\"\nimport * as path from \"path\"\nimport { Configuration } from \"../configuration\"\nimport { executeAppBuilderAndWriteJson } from \"./appBuilder\"\nimport { PM, getPackageManagerCommand } from \"../node-module-collector\"\nimport { detectPackageManager } from \"../node-module-collector/packageManager\"\nimport { NodeModuleDirInfo } from \"./packageDependencies\"\nimport { rebuild as remoteRebuild } from \"./rebuild\"\nimport * as which from \"which\"\nimport type { RebuildOptions as ElectronRebuildOptions } from \"@electron/rebuild\"\nimport { Nullish } from \"builder-util-runtime\"\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.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\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 (process.env.NPM_NO_BIN_LINKS === \"true\") {\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 await spawn(execPath, execArgs, {\n cwd: appDir,\n env: {\n ...getGypEnv(options.frameworkInfo, platform, arch, options.buildFromSource === true),\n ...env,\n },\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 productionDeps: Lazy<Array<NodeModuleDirInfo>>\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 if (config.nativeRebuilder === \"legacy\") {\n const configuration = {\n platform,\n arch,\n buildFromSource,\n dependencies: await options.productionDeps.value,\n nodeExecPath: process.execPath,\n additionalArgs: options.additionalArgs,\n execPath: process.env.npm_execpath || process.env.NPM_CLI_JS,\n }\n const env = getGypEnv(options.frameworkInfo, platform, arch, buildFromSource)\n return executeAppBuilderAndWriteJson([\"rebuild-node-modules\"], configuration, { env, cwd: appDir })\n }\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 rebuildOptions: ElectronRebuildOptions = {\n buildPath: appDir,\n electronVersion,\n arch,\n platform,\n buildFromSource,\n projectRootPath,\n mode: config.nativeRebuilder || \"sequential\",\n disablePreGypCopy: true,\n }\n return remoteRebuild(rebuildOptions)\n}\n"]}
package/out/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const PACKAGE_VERSION = "26.12.1";
1
+ export declare const PACKAGE_VERSION = "26.13.1";
package/out/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PACKAGE_VERSION = void 0;
4
- exports.PACKAGE_VERSION = "26.12.1";
4
+ exports.PACKAGE_VERSION = "26.13.1";
5
5
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG,SAAS,CAAA","sourcesContent":["export const PACKAGE_VERSION = \"26.12.1\"\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG,SAAS,CAAA","sourcesContent":["export const PACKAGE_VERSION = \"26.13.1\"\n"]}
@@ -25,4 +25,5 @@ export declare class WinPackager extends PlatformPackager<WindowsConfiguration>
25
25
  private shouldSignFile;
26
26
  protected createTransformerForExtraFiles(packContext: AfterPackContext): FileTransformer | null;
27
27
  protected signApp(packContext: AfterPackContext, isAsar: boolean): Promise<boolean>;
28
+ private walkSignableFiles;
28
29
  }
@@ -201,10 +201,10 @@ class WinPackager extends platformPackager_1.PlatformPackager {
201
201
  }
202
202
  }
203
203
  shouldSignFile(file, fallbackValue = false) {
204
- const backwardCompatibility = file.endsWith(".exe");
204
+ const isExe = file.endsWith(".exe");
205
205
  const signExts = this.platformSpecificBuildOptions.signExts;
206
206
  if (!(signExts === null || signExts === void 0 ? void 0 : signExts.length)) {
207
- return backwardCompatibility || fallbackValue;
207
+ return isExe || fallbackValue;
208
208
  }
209
209
  // process patterns ( !exe => exclude .exe, .dll => include .dll )
210
210
  // we process first to allow literal negatives in case a filename matches "help!.txt" or similar
@@ -215,8 +215,7 @@ class WinPackager extends platformPackager_1.PlatformPackager {
215
215
  if (signExts.some(ext => ext.startsWith("!") && file.endsWith(ext.substring(1)))) {
216
216
  return false;
217
217
  }
218
- // if no explicit patterns matched, fall back to backward compatibility
219
- return backwardCompatibility || fallbackValue;
218
+ return isExe || fallbackValue;
220
219
  }
221
220
  createTransformerForExtraFiles(packContext) {
222
221
  if (this.platformSpecificBuildOptions.signAndEditExecutable === false || this.platformSpecificBuildOptions.signExecutable === false) {
@@ -239,6 +238,7 @@ class WinPackager extends platformPackager_1.PlatformPackager {
239
238
  throw new builder_util_1.InvalidConfigurationError("Signing is disabled (`signExecutable: false` or `signAndEditExecutable: false`) but `forceCodeSigning` is enabled. Remove one of these options.");
240
239
  }
241
240
  if (this.platformSpecificBuildOptions.signAndEditExecutable === false) {
241
+ builder_util_1.log.info({ exe: builder_util_1.log.filePath(path.join(packContext.appOutDir, exeFileName)) }, "executable resource editing and code signing skipped — signAndEditExecutable is false. To skip only code signing while keeping icon and metadata applied, use signExecutable: false instead.");
242
242
  return false;
243
243
  }
244
244
  const files = await (0, promises_1.readdir)(packContext.appOutDir);
@@ -253,16 +253,19 @@ class WinPackager extends platformPackager_1.PlatformPackager {
253
253
  if (!isAsar || this.platformSpecificBuildOptions.signExecutable === false) {
254
254
  return true;
255
255
  }
256
- const filesPromise = (filepath) => {
257
- const outDir = path.join(packContext.appOutDir, ...filepath);
258
- return (0, builder_util_1.walk)(outDir, (file, stat) => stat.isDirectory() || this.shouldSignFile(file));
259
- };
260
- const filesToSign = await Promise.all([filesPromise(["resources", "app.asar.unpacked"]), filesPromise(["swiftshader"])]);
256
+ const filesToSign = await Promise.all([
257
+ this.walkSignableFiles(packContext.appOutDir, "resources", "app.asar.unpacked"),
258
+ // Note: The `swiftshader` directory is absent in modern electron versions. `swiftshader/` held Chromium's legacy SwiftShader GL fallback (libEGL.dll / libGLESv2.dll), removed in Chromium 102 (Electron 19+) in favor of SwANGLE (ANGLE + SwiftShader Vulkan). This is kept here only for backwards compat with older Electron; `walk` no-ops on a missing dir (readdir ENOENT is swallowed), so this is harmless when the directory is absent.
259
+ this.walkSignableFiles(packContext.appOutDir, "swiftshader"),
260
+ ]);
261
261
  for (const file of filesToSign.flat(1)) {
262
262
  await this.signIf(file);
263
263
  }
264
264
  return true;
265
265
  }
266
+ walkSignableFiles(baseDir, ...subpath) {
267
+ return (0, builder_util_1.walk)(path.join(baseDir, ...subpath), (file, stat) => stat.isDirectory() || this.shouldSignFile(file));
268
+ }
266
269
  }
267
270
  exports.WinPackager = WinPackager;
268
271
  //# sourceMappingURL=winPackager.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"winPackager.js","sourceRoot":"","sources":["../src/winPackager.ts"],"names":[],"mappings":";;;AAAA,+CAAuH;AAEvH,qCAA8B;AAC9B,mCAAmC;AACnC,0CAAqC;AACrC,uCAA+B;AAC/B,6BAA4B;AAC5B,sCAA4C;AAE5C,gEAA4E;AAC5E,gFAA4E;AAC5E,8EAA+F;AAE/F,iCAAqD;AAGrD,yDAAoE;AAIpE,0DAAsD;AACtD,sDAA6E;AAC7E,0EAAsE;AACtE,2DAA4D;AAC5D,sDAA+D;AAC/D,wCAAkD;AAClD,4CAA0E;AAC1E,wCAAmC;AACnC,gCAAiD;AAEjD,MAAa,WAAY,SAAQ,mCAAsC;IAiBrE,IAAI,8BAA8B;QAChC,OAAO,IAAI,CAAC,4BAA4B,CAAC,yBAAyB,KAAK,KAAK,CAAA;IAC9E,CAAC;IAED,YAAY,IAAc;QACxB,KAAK,CAAC,IAAI,EAAE,eAAQ,CAAC,OAAO,CAAC,CAAA;QArB/B,cAAS,GAAG,IAAI,eAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAA;QAE/C,OAAE,GAAG,IAAI,eAAI,CAAY,GAAG,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,cAAS,EAAE,CAAC,CAAC,CAAC,CAAC,IAAA,iBAAY,EAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAA;QAElI,mBAAc,GAAG,IAAI,eAAI,CAAC,KAAK,IAAI,EAAE;YAC5C,IAAI,OAAoB,CAAA;YACxB,IAAI,IAAI,CAAC,4BAA4B,CAAC,gBAAgB,IAAI,IAAI,EAAE,CAAC;gBAC/D,OAAO,GAAG,IAAI,iDAAuB,CAAC,IAAI,CA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AI,CAAC,IAAI,CAAC,WAAW,CAAC,SAAS,EAAE,GAAG,QAAQ,CAAC,CAAA;YAC5D,OAAO,IAAA,mBAAI,EAAC,MAAM,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAA;QACtF,CAAC,CAAA;QACD,MAAM,WAAW,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,YAAY,CAAC,CAAC,WAAW,EAAE,mBAAmB,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAA;QACxH,KAAK,MAAM,IAAI,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;YACvC,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;QACzB,CAAC;QAED,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AA5RD,kCA4RC","sourcesContent":["import { Arch, CopyFileTransformer, exists, FileTransformer, InvalidConfigurationError, log, walk } from \"builder-util\"\nimport { Nullish } from \"builder-util-runtime\"\nimport { isCI } from \"ci-info\"\nimport { createHash } from \"crypto\"\nimport { readdir } from \"fs/promises\"\nimport { Lazy } from \"lazy-val\"\nimport * as path from \"path\"\nimport { readAsarHeader } from \"./asar/asar\"\nimport { SignManager } from \"./codeSign/signManager\"\nimport { signWindows, WindowsSignOptions } from \"./codeSign/windowsCodeSign\"\nimport { WindowsSignAzureManager } from \"./codeSign/windowsSignAzureManager\"\nimport { FileCodeSigningInfo, WindowsSignToolManager } from \"./codeSign/windowsSignToolManager\"\nimport { AfterPackContext } from \"./configuration\"\nimport { DIR_TARGET, Platform, Target } from \"./core\"\nimport { RequestedExecutionLevel, WindowsConfiguration } from \"./options/winOptions\"\nimport { Packager } from \"./packager\"\nimport { chooseNotNull, PlatformPackager } from \"./platformPackager\"\nimport AppXTarget from \"./targets/AppxTarget\"\nimport MsiTarget from \"./targets/MsiTarget\"\nimport MsiWrappedTarget from \"./targets/MsiWrappedTarget\"\nimport { NsisTarget } from \"./targets/nsis/NsisTarget\"\nimport { AppPackageHelper, CopyElevateHelper } from \"./targets/nsis/nsisUtil\"\nimport { WebInstallerTarget } from \"./targets/nsis/WebInstallerTarget\"\nimport { createCommonTarget } from \"./targets/targetFactory\"\nimport { BuildCacheManager, digest } from \"./util/cacheManager\"\nimport { isBuildCacheEnabled } from \"./util/flags\"\nimport { editWindowsResources, ResourceEditOptions } from \"./util/resEdit\"\nimport { time } from \"./util/timer\"\nimport { getWindowsVm, VmManager } from \"./vm/vm\"\n\nexport class WinPackager extends PlatformPackager<WindowsConfiguration> {\n _iconPath = new Lazy(() => this.getOrConvertIcon(\"ico\"))\n\n readonly vm = new Lazy<VmManager>(() => (process.platform === \"win32\" ? Promise.resolve(new VmManager()) : getWindowsVm(this.debugLogger)))\n\n readonly signingManager = new Lazy(async () => {\n let manager: SignManager\n if (this.platformSpecificBuildOptions.azureSignOptions != null) {\n manager = new WindowsSignAzureManager(this)\n } else {\n manager = new WindowsSignToolManager(this)\n }\n await manager.initialize()\n return manager\n })\n private signingQueue = Promise.resolve(true)\n\n get isForceCodeSigningVerification(): boolean {\n return this.platformSpecificBuildOptions.verifyUpdateCodeSignature !== false\n }\n\n constructor(info: Packager) {\n super(info, Platform.WINDOWS)\n }\n\n get defaultTarget(): Array<string> {\n return [\"nsis\"]\n }\n\n createTargets(targets: Array<string>, mapper: (name: string, factory: (outDir: string) => Target) => void): void {\n let copyElevateHelper: CopyElevateHelper | null\n const getCopyElevateHelper = () => {\n if (copyElevateHelper == null) {\n copyElevateHelper = new CopyElevateHelper()\n }\n return copyElevateHelper\n }\n\n let helper: AppPackageHelper | null\n const getHelper = () => {\n if (helper == null) {\n helper = new AppPackageHelper(getCopyElevateHelper())\n }\n return helper\n }\n\n for (const name of targets) {\n if (name === DIR_TARGET) {\n continue\n }\n\n if (name === \"nsis\" || name === \"portable\") {\n mapper(name, outDir => new NsisTarget(this, outDir, name, getHelper()))\n } else if (name === \"nsis-web\") {\n // package file format differs from nsis target\n mapper(name, outDir => new WebInstallerTarget(this, path.join(outDir, name), name, new AppPackageHelper(getCopyElevateHelper())))\n } else {\n const targetClass: typeof NsisTarget | typeof AppXTarget | typeof MsiTarget | typeof MsiWrappedTarget | null = (() => {\n switch (name) {\n case \"squirrel\":\n try {\n return require(\"electron-builder-squirrel-windows\").default\n } catch (e: any) {\n throw new InvalidConfigurationError(`Module electron-builder-squirrel-windows must be installed in addition to build Squirrel.Windows: ${e.stack || e}`)\n }\n\n case \"appx\":\n return require(\"./targets/AppxTarget\").default\n\n case \"msi\":\n return require(\"./targets/MsiTarget\").default\n\n case \"msiwrapped\":\n return require(\"./targets/MsiWrappedTarget\").default\n\n default:\n return null\n }\n })()\n\n mapper(name, outDir => (targetClass === null ? createCommonTarget(name, outDir, this) : new (targetClass as any)(this, outDir, name)))\n }\n }\n }\n\n getIconPath() {\n return this._iconPath.value\n }\n\n doGetCscPassword(): string | Nullish {\n return chooseNotNull(chooseNotNull(this.platformSpecificBuildOptions.signtoolOptions?.certificatePassword, process.env.WIN_CSC_KEY_PASSWORD), super.doGetCscPassword())\n }\n\n async signIf(file: string): Promise<boolean> {\n const logFields = { file: log.filePath(file) }\n if (!this.shouldSignFile(file, true)) {\n log.info(logFields, \"file signing skipped via signExts configuration\")\n return false\n }\n if (this.platformSpecificBuildOptions.signExecutable === false) {\n log.info(logFields, \"file signing skipped via signExecutable configuration\")\n return false\n }\n\n const promise = this.signingQueue.then(() => this._sign(file))\n this.signingQueue = promise.catch(e => {\n log.warn({ file: log.filePath(file), error: e.message }, \"signing failed for file, queue will continue to next file\")\n return false\n })\n return promise\n }\n\n private async _sign(file: string): Promise<boolean> {\n const signOptions: WindowsSignOptions = {\n path: file,\n options: this.platformSpecificBuildOptions,\n }\n\n const didSignSuccessfully = await signWindows(signOptions, this)\n if (!didSignSuccessfully && this.forceCodeSigning) {\n throw new InvalidConfigurationError(\n `App is not signed and \"forceCodeSigning\" is set to true, please ensure that code signing configuration is correct, please see https://electron.build/code-signing`\n )\n }\n return didSignSuccessfully\n }\n\n async signAndEditResources(file: string, arch: Arch, outDir: string, internalName?: string | null, requestedExecutionLevel?: RequestedExecutionLevel | null) {\n const appInfo = this.appInfo\n\n const files: Array<string> = []\n\n const versionStrings: Record<string, string> = {\n FileDescription: appInfo.productName,\n ProductName: appInfo.productName,\n LegalCopyright: appInfo.copyright,\n }\n\n if (internalName != null) {\n versionStrings.InternalName = internalName\n versionStrings.OriginalFilename = \"\"\n }\n\n if (appInfo.companyName != null) {\n versionStrings.CompanyName = appInfo.companyName\n }\n if (this.platformSpecificBuildOptions.legalTrademarks != null) {\n versionStrings.LegalTrademarks = this.platformSpecificBuildOptions.legalTrademarks\n }\n\n const iconPath = await this.getIconPath()\n if (iconPath != null) {\n files.push(iconPath)\n }\n\n const opts: ResourceEditOptions = {\n file,\n versionStrings,\n fileVersion: appInfo.shortVersion || appInfo.buildVersion,\n productVersion: appInfo.shortVersionWindows || appInfo.getVersionInWeirdWindowsForm(),\n requestedExecutionLevel,\n iconPath,\n }\n\n const config = this.config\n const cscInfoForCacheDigest = !isBuildCacheEnabled() || isCI || config.electronDist != null ? null : await (await this.signingManager.value).cscInfo.value\n let buildCacheManager: BuildCacheManager | null = null\n // resources editing doesn't change executable for the same input and executed quickly - no need to complicate\n if (cscInfoForCacheDigest != null) {\n const cscFile = (cscInfoForCacheDigest as FileCodeSigningInfo).file\n if (cscFile != null) {\n files.push(cscFile)\n }\n\n const timer = time(\"executable cache\")\n const hash = createHash(\"sha512\")\n hash.update(config.electronVersion || \"no electronVersion\")\n hash.update(JSON.stringify(this.platformSpecificBuildOptions))\n hash.update(JSON.stringify(opts))\n hash.update(this.platformSpecificBuildOptions.signtoolOptions?.certificateSha1 || \"no certificateSha1\")\n hash.update(this.platformSpecificBuildOptions.signtoolOptions?.certificateSubjectName || \"no subjectName\")\n\n const asar = path.resolve(this.getResourcesDir(outDir), \"app.asar\")\n if (await exists(asar)) {\n hash.update((await readAsarHeader(asar)).header)\n } else {\n hash.update(\"no asar\")\n }\n\n buildCacheManager = new BuildCacheManager(outDir, file, arch)\n if (await buildCacheManager.copyIfValid(await digest(hash, files))) {\n timer.end()\n return\n }\n timer.end()\n }\n\n const timer = time(\"resource-edit&sign\")\n await editWindowsResources(opts)\n await this.signIf(file)\n timer.end()\n\n if (buildCacheManager != null) {\n await buildCacheManager.save()\n }\n }\n\n private shouldSignFile(file: string, fallbackValue = false): boolean {\n const backwardCompatibility = file.endsWith(\".exe\")\n const signExts = this.platformSpecificBuildOptions.signExts\n if (!signExts?.length) {\n return backwardCompatibility || fallbackValue\n }\n // process patterns ( !exe => exclude .exe, .dll => include .dll )\n // we process first to allow literal negatives in case a filename matches \"help!.txt\" or similar\n if (signExts.some(ext => file.endsWith(ext))) {\n return true\n }\n // process negative patterns\n if (signExts.some(ext => ext.startsWith(\"!\") && file.endsWith(ext.substring(1)))) {\n return false\n }\n // if no explicit patterns matched, fall back to backward compatibility\n return backwardCompatibility || fallbackValue\n }\n\n protected createTransformerForExtraFiles(packContext: AfterPackContext): FileTransformer | null {\n if (this.platformSpecificBuildOptions.signAndEditExecutable === false || this.platformSpecificBuildOptions.signExecutable === false) {\n return null\n }\n\n return file => {\n if (this.shouldSignFile(file)) {\n const parentDir = path.dirname(file)\n if (parentDir !== packContext.appOutDir) {\n return new CopyFileTransformer(file => this.signIf(file))\n }\n }\n return null\n }\n }\n\n protected async signApp(packContext: AfterPackContext, isAsar: boolean): Promise<boolean> {\n const exeFileName = `${this.appInfo.productFilename}.exe`\n const signingDisabled = this.platformSpecificBuildOptions.signExecutable === false || this.platformSpecificBuildOptions.signAndEditExecutable === false\n if (signingDisabled && this.forceCodeSigning) {\n throw new InvalidConfigurationError(\n \"Signing is disabled (`signExecutable: false` or `signAndEditExecutable: false`) but `forceCodeSigning` is enabled. Remove one of these options.\"\n )\n }\n if (this.platformSpecificBuildOptions.signAndEditExecutable === false) {\n return false\n }\n\n const files = await readdir(packContext.appOutDir)\n for (const file of files) {\n if (file === exeFileName) {\n await this.signAndEditResources(\n path.join(packContext.appOutDir, exeFileName),\n packContext.arch,\n packContext.outDir,\n path.basename(exeFileName, \".exe\"),\n this.platformSpecificBuildOptions.requestedExecutionLevel\n )\n } else if (this.shouldSignFile(file)) {\n await this.signIf(path.join(packContext.appOutDir, file))\n }\n }\n\n if (!isAsar || this.platformSpecificBuildOptions.signExecutable === false) {\n return true\n }\n\n const filesPromise = (filepath: string[]) => {\n const outDir = path.join(packContext.appOutDir, ...filepath)\n return walk(outDir, (file, stat) => stat.isDirectory() || this.shouldSignFile(file))\n }\n const filesToSign = await Promise.all([filesPromise([\"resources\", \"app.asar.unpacked\"]), filesPromise([\"swiftshader\"])])\n for (const file of filesToSign.flat(1)) {\n await this.signIf(file)\n }\n\n return true\n }\n}\n"]}
1
+ {"version":3,"file":"winPackager.js","sourceRoot":"","sources":["../src/winPackager.ts"],"names":[],"mappings":";;;AAAA,+CAAuH;AAEvH,qCAA8B;AAC9B,mCAAmC;AACnC,0CAAqC;AACrC,uCAA+B;AAC/B,6BAA4B;AAC5B,sCAA4C;AAE5C,gEAA4E;AAC5E,gFAA4E;AAC5E,8EAA+F;AAE/F,iCAAqD;AAGrD,yDAAoE;AAIpE,0DAAsD;AACtD,sDAA6E;AAC7E,0EAAsE;AACtE,2DAA4D;AAC5D,sDAA+D;AAC/D,wCAAkD;AAClD,4CAA0E;AAC1E,wCAAmC;AACnC,gCAAiD;AAEjD,MAAa,WAAY,SAAQ,mCAAsC;IAiBrE,IAAI,8BAA8B;QAChC,OAAO,IAAI,CAAC,4BAA4B,CAAC,yBAAyB,KAAK,KAAK,CAAA;IAC9E,CAAC;IAED,YAAY,IAAc;QACxB,KAAK,CAAC,IAAI,EAAE,eAAQ,CAAC,OAAO,CAAC,CAAA;QArB/B,cAAS,GAAG,IAAI,eAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAA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AC9G,CAAC;CACF;AAnSD,kCAmSC","sourcesContent":["import { Arch, CopyFileTransformer, exists, FileTransformer, InvalidConfigurationError, log, walk } from \"builder-util\"\nimport { Nullish } from \"builder-util-runtime\"\nimport { isCI } from \"ci-info\"\nimport { createHash } from \"crypto\"\nimport { readdir } from \"fs/promises\"\nimport { Lazy } from \"lazy-val\"\nimport * as path from \"path\"\nimport { readAsarHeader } from \"./asar/asar\"\nimport { SignManager } from \"./codeSign/signManager\"\nimport { signWindows, WindowsSignOptions } from \"./codeSign/windowsCodeSign\"\nimport { WindowsSignAzureManager } from \"./codeSign/windowsSignAzureManager\"\nimport { FileCodeSigningInfo, WindowsSignToolManager } from \"./codeSign/windowsSignToolManager\"\nimport { AfterPackContext } from \"./configuration\"\nimport { DIR_TARGET, Platform, Target } from \"./core\"\nimport { RequestedExecutionLevel, WindowsConfiguration } from \"./options/winOptions\"\nimport { Packager } from \"./packager\"\nimport { chooseNotNull, PlatformPackager } from \"./platformPackager\"\nimport AppXTarget from \"./targets/AppxTarget\"\nimport MsiTarget from \"./targets/MsiTarget\"\nimport MsiWrappedTarget from \"./targets/MsiWrappedTarget\"\nimport { NsisTarget } from \"./targets/nsis/NsisTarget\"\nimport { AppPackageHelper, CopyElevateHelper } from \"./targets/nsis/nsisUtil\"\nimport { WebInstallerTarget } from \"./targets/nsis/WebInstallerTarget\"\nimport { createCommonTarget } from \"./targets/targetFactory\"\nimport { BuildCacheManager, digest } from \"./util/cacheManager\"\nimport { isBuildCacheEnabled } from \"./util/flags\"\nimport { editWindowsResources, ResourceEditOptions } from \"./util/resEdit\"\nimport { time } from \"./util/timer\"\nimport { getWindowsVm, VmManager } from \"./vm/vm\"\n\nexport class WinPackager extends PlatformPackager<WindowsConfiguration> {\n _iconPath = new Lazy(() => this.getOrConvertIcon(\"ico\"))\n\n readonly vm = new Lazy<VmManager>(() => (process.platform === \"win32\" ? Promise.resolve(new VmManager()) : getWindowsVm(this.debugLogger)))\n\n readonly signingManager = new Lazy(async () => {\n let manager: SignManager\n if (this.platformSpecificBuildOptions.azureSignOptions != null) {\n manager = new WindowsSignAzureManager(this)\n } else {\n manager = new WindowsSignToolManager(this)\n }\n await manager.initialize()\n return manager\n })\n private signingQueue = Promise.resolve(true)\n\n get isForceCodeSigningVerification(): boolean {\n return this.platformSpecificBuildOptions.verifyUpdateCodeSignature !== false\n }\n\n constructor(info: Packager) {\n super(info, Platform.WINDOWS)\n }\n\n get defaultTarget(): Array<string> {\n return [\"nsis\"]\n }\n\n createTargets(targets: Array<string>, mapper: (name: string, factory: (outDir: string) => Target) => void): void {\n let copyElevateHelper: CopyElevateHelper | null\n const getCopyElevateHelper = () => {\n if (copyElevateHelper == null) {\n copyElevateHelper = new CopyElevateHelper()\n }\n return copyElevateHelper\n }\n\n let helper: AppPackageHelper | null\n const getHelper = () => {\n if (helper == null) {\n helper = new AppPackageHelper(getCopyElevateHelper())\n }\n return helper\n }\n\n for (const name of targets) {\n if (name === DIR_TARGET) {\n continue\n }\n\n if (name === \"nsis\" || name === \"portable\") {\n mapper(name, outDir => new NsisTarget(this, outDir, name, getHelper()))\n } else if (name === \"nsis-web\") {\n // package file format differs from nsis target\n mapper(name, outDir => new WebInstallerTarget(this, path.join(outDir, name), name, new AppPackageHelper(getCopyElevateHelper())))\n } else {\n const targetClass: typeof NsisTarget | typeof AppXTarget | typeof MsiTarget | typeof MsiWrappedTarget | null = (() => {\n switch (name) {\n case \"squirrel\":\n try {\n return require(\"electron-builder-squirrel-windows\").default\n } catch (e: any) {\n throw new InvalidConfigurationError(`Module electron-builder-squirrel-windows must be installed in addition to build Squirrel.Windows: ${e.stack || e}`)\n }\n\n case \"appx\":\n return require(\"./targets/AppxTarget\").default\n\n case \"msi\":\n return require(\"./targets/MsiTarget\").default\n\n case \"msiwrapped\":\n return require(\"./targets/MsiWrappedTarget\").default\n\n default:\n return null\n }\n })()\n\n mapper(name, outDir => (targetClass === null ? createCommonTarget(name, outDir, this) : new (targetClass as any)(this, outDir, name)))\n }\n }\n }\n\n getIconPath() {\n return this._iconPath.value\n }\n\n doGetCscPassword(): string | Nullish {\n return chooseNotNull(chooseNotNull(this.platformSpecificBuildOptions.signtoolOptions?.certificatePassword, process.env.WIN_CSC_KEY_PASSWORD), super.doGetCscPassword())\n }\n\n async signIf(file: string): Promise<boolean> {\n const logFields = { file: log.filePath(file) }\n if (!this.shouldSignFile(file, true)) {\n log.info(logFields, \"file signing skipped via signExts configuration\")\n return false\n }\n if (this.platformSpecificBuildOptions.signExecutable === false) {\n log.info(logFields, \"file signing skipped via signExecutable configuration\")\n return false\n }\n\n const promise = this.signingQueue.then(() => this._sign(file))\n this.signingQueue = promise.catch(e => {\n log.warn({ file: log.filePath(file), error: e.message }, \"signing failed for file, queue will continue to next file\")\n return false\n })\n return promise\n }\n\n private async _sign(file: string): Promise<boolean> {\n const signOptions: WindowsSignOptions = {\n path: file,\n options: this.platformSpecificBuildOptions,\n }\n\n const didSignSuccessfully = await signWindows(signOptions, this)\n if (!didSignSuccessfully && this.forceCodeSigning) {\n throw new InvalidConfigurationError(\n `App is not signed and \"forceCodeSigning\" is set to true, please ensure that code signing configuration is correct, please see https://electron.build/code-signing`\n )\n }\n return didSignSuccessfully\n }\n\n async signAndEditResources(file: string, arch: Arch, outDir: string, internalName?: string | null, requestedExecutionLevel?: RequestedExecutionLevel | null) {\n const appInfo = this.appInfo\n\n const files: Array<string> = []\n\n const versionStrings: Record<string, string> = {\n FileDescription: appInfo.productName,\n ProductName: appInfo.productName,\n LegalCopyright: appInfo.copyright,\n }\n\n if (internalName != null) {\n versionStrings.InternalName = internalName\n versionStrings.OriginalFilename = \"\"\n }\n\n if (appInfo.companyName != null) {\n versionStrings.CompanyName = appInfo.companyName\n }\n if (this.platformSpecificBuildOptions.legalTrademarks != null) {\n versionStrings.LegalTrademarks = this.platformSpecificBuildOptions.legalTrademarks\n }\n\n const iconPath = await this.getIconPath()\n if (iconPath != null) {\n files.push(iconPath)\n }\n\n const opts: ResourceEditOptions = {\n file,\n versionStrings,\n fileVersion: appInfo.shortVersion || appInfo.buildVersion,\n productVersion: appInfo.shortVersionWindows || appInfo.getVersionInWeirdWindowsForm(),\n requestedExecutionLevel,\n iconPath,\n }\n\n const config = this.config\n const cscInfoForCacheDigest = !isBuildCacheEnabled() || isCI || config.electronDist != null ? null : await (await this.signingManager.value).cscInfo.value\n let buildCacheManager: BuildCacheManager | null = null\n // resources editing doesn't change executable for the same input and executed quickly - no need to complicate\n if (cscInfoForCacheDigest != null) {\n const cscFile = (cscInfoForCacheDigest as FileCodeSigningInfo).file\n if (cscFile != null) {\n files.push(cscFile)\n }\n\n const timer = time(\"executable cache\")\n const hash = createHash(\"sha512\")\n hash.update(config.electronVersion || \"no electronVersion\")\n hash.update(JSON.stringify(this.platformSpecificBuildOptions))\n hash.update(JSON.stringify(opts))\n hash.update(this.platformSpecificBuildOptions.signtoolOptions?.certificateSha1 || \"no certificateSha1\")\n hash.update(this.platformSpecificBuildOptions.signtoolOptions?.certificateSubjectName || \"no subjectName\")\n\n const asar = path.resolve(this.getResourcesDir(outDir), \"app.asar\")\n if (await exists(asar)) {\n hash.update((await readAsarHeader(asar)).header)\n } else {\n hash.update(\"no asar\")\n }\n\n buildCacheManager = new BuildCacheManager(outDir, file, arch)\n if (await buildCacheManager.copyIfValid(await digest(hash, files))) {\n timer.end()\n return\n }\n timer.end()\n }\n\n const timer = time(\"resource-edit&sign\")\n await editWindowsResources(opts)\n await this.signIf(file)\n timer.end()\n\n if (buildCacheManager != null) {\n await buildCacheManager.save()\n }\n }\n\n private shouldSignFile(file: string, fallbackValue = false): boolean {\n const isExe = file.endsWith(\".exe\")\n const signExts = this.platformSpecificBuildOptions.signExts\n if (!signExts?.length) {\n return isExe || fallbackValue\n }\n // process patterns ( !exe => exclude .exe, .dll => include .dll )\n // we process first to allow literal negatives in case a filename matches \"help!.txt\" or similar\n if (signExts.some(ext => file.endsWith(ext))) {\n return true\n }\n // process negative patterns\n if (signExts.some(ext => ext.startsWith(\"!\") && file.endsWith(ext.substring(1)))) {\n return false\n }\n return isExe || fallbackValue\n }\n\n protected createTransformerForExtraFiles(packContext: AfterPackContext): FileTransformer | null {\n if (this.platformSpecificBuildOptions.signAndEditExecutable === false || this.platformSpecificBuildOptions.signExecutable === false) {\n return null\n }\n\n return file => {\n if (this.shouldSignFile(file)) {\n const parentDir = path.dirname(file)\n if (parentDir !== packContext.appOutDir) {\n return new CopyFileTransformer(file => this.signIf(file))\n }\n }\n return null\n }\n }\n\n protected async signApp(packContext: AfterPackContext, isAsar: boolean): Promise<boolean> {\n const exeFileName = `${this.appInfo.productFilename}.exe`\n const signingDisabled = this.platformSpecificBuildOptions.signExecutable === false || this.platformSpecificBuildOptions.signAndEditExecutable === false\n if (signingDisabled && this.forceCodeSigning) {\n throw new InvalidConfigurationError(\n \"Signing is disabled (`signExecutable: false` or `signAndEditExecutable: false`) but `forceCodeSigning` is enabled. Remove one of these options.\"\n )\n }\n if (this.platformSpecificBuildOptions.signAndEditExecutable === false) {\n log.info(\n { exe: log.filePath(path.join(packContext.appOutDir, exeFileName)) },\n \"executable resource editing and code signing skipped — signAndEditExecutable is false. To skip only code signing while keeping icon and metadata applied, use signExecutable: false instead.\"\n )\n return false\n }\n\n const files = await readdir(packContext.appOutDir)\n for (const file of files) {\n if (file === exeFileName) {\n await this.signAndEditResources(\n path.join(packContext.appOutDir, exeFileName),\n packContext.arch,\n packContext.outDir,\n path.basename(exeFileName, \".exe\"),\n this.platformSpecificBuildOptions.requestedExecutionLevel\n )\n } else if (this.shouldSignFile(file)) {\n await this.signIf(path.join(packContext.appOutDir, file))\n }\n }\n\n if (!isAsar || this.platformSpecificBuildOptions.signExecutable === false) {\n return true\n }\n\n const filesToSign = await Promise.all([\n this.walkSignableFiles(packContext.appOutDir, \"resources\", \"app.asar.unpacked\"),\n // Note: The `swiftshader` directory is absent in modern electron versions. `swiftshader/` held Chromium's legacy SwiftShader GL fallback (libEGL.dll / libGLESv2.dll), removed in Chromium 102 (Electron 19+) in favor of SwANGLE (ANGLE + SwiftShader Vulkan). This is kept here only for backwards compat with older Electron; `walk` no-ops on a missing dir (readdir ENOENT is swallowed), so this is harmless when the directory is absent.\n this.walkSignableFiles(packContext.appOutDir, \"swiftshader\"),\n ])\n for (const file of filesToSign.flat(1)) {\n await this.signIf(file)\n }\n\n return true\n }\n\n private walkSignableFiles(baseDir: string, ...subpath: string[]): Promise<string[]> {\n return walk(path.join(baseDir, ...subpath), (file, stat) => stat.isDirectory() || this.shouldSignFile(file))\n }\n}\n"]}