app-builder-lib 26.15.7 → 26.16.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 (63) hide show
  1. package/out/codeSign/macCodeSign.js +5 -3
  2. package/out/codeSign/macCodeSign.js.map +1 -1
  3. package/out/codeSign/windowsCodeSign.js +0 -3
  4. package/out/codeSign/windowsCodeSign.js.map +1 -1
  5. package/out/codeSign/windowsSignToolManager.js +4 -1
  6. package/out/codeSign/windowsSignToolManager.js.map +1 -1
  7. package/out/configuration.d.ts +32 -0
  8. package/out/configuration.js.map +1 -1
  9. package/out/electron/ElectronFramework.d.ts +2 -1
  10. package/out/electron/ElectronFramework.js +13 -5
  11. package/out/electron/ElectronFramework.js.map +1 -1
  12. package/out/electron/electronMac.js +1 -5
  13. package/out/electron/electronMac.js.map +1 -1
  14. package/out/macPackager.d.ts +7 -2
  15. package/out/macPackager.js +40 -11
  16. package/out/macPackager.js.map +1 -1
  17. package/out/node-module-collector/nodeModulesCollector.d.ts +11 -1
  18. package/out/node-module-collector/nodeModulesCollector.js +28 -5
  19. package/out/node-module-collector/nodeModulesCollector.js.map +1 -1
  20. package/out/node-module-collector/pnpmNodeModulesCollector.js +3 -1
  21. package/out/node-module-collector/pnpmNodeModulesCollector.js.map +1 -1
  22. package/out/packager.d.ts +2 -0
  23. package/out/packager.js +15 -0
  24. package/out/packager.js.map +1 -1
  25. package/out/platformPackager.d.ts +1 -0
  26. package/out/platformPackager.js +3 -0
  27. package/out/platformPackager.js.map +1 -1
  28. package/out/targets/AppxTarget.js +5 -5
  29. package/out/targets/AppxTarget.js.map +1 -1
  30. package/out/targets/MsiTarget.js +8 -11
  31. package/out/targets/MsiTarget.js.map +1 -1
  32. package/out/targets/appimage/appImageUtil.d.ts +1 -1
  33. package/out/targets/appimage/appImageUtil.js +3 -3
  34. package/out/targets/appimage/appImageUtil.js.map +1 -1
  35. package/out/targets/appimage/appLauncher.js +3 -9
  36. package/out/targets/appimage/appLauncher.js.map +1 -1
  37. package/out/targets/blockmap/blockmap.js +2 -2
  38. package/out/targets/blockmap/blockmap.js.map +1 -1
  39. package/out/targets/nsis/NsisTarget.d.ts +2 -2
  40. package/out/targets/nsis/NsisTarget.js +9 -1
  41. package/out/targets/nsis/NsisTarget.js.map +1 -1
  42. package/out/targets/nsis/nsisOptions.d.ts +2 -0
  43. package/out/targets/nsis/nsisOptions.js.map +1 -1
  44. package/out/targets/nsis/nsisUtil.d.ts +5 -2
  45. package/out/targets/nsis/nsisUtil.js +48 -24
  46. package/out/targets/nsis/nsisUtil.js.map +1 -1
  47. package/out/toolsets/icons.js +2 -2
  48. package/out/toolsets/icons.js.map +1 -1
  49. package/out/toolsets/linux.js +3 -3
  50. package/out/toolsets/linux.js.map +1 -1
  51. package/out/util/appFileCopier.d.ts +21 -0
  52. package/out/util/appFileCopier.js +58 -0
  53. package/out/util/appFileCopier.js.map +1 -1
  54. package/out/util/electronGet.d.ts +46 -0
  55. package/out/util/electronGet.js +174 -24
  56. package/out/util/electronGet.js.map +1 -1
  57. package/out/version.d.ts +1 -1
  58. package/out/version.js +1 -1
  59. package/out/version.js.map +1 -1
  60. package/package.json +8 -8
  61. package/scheme.json +20 -1
  62. package/templates/appx/appxmanifest.xml +1 -2
  63. package/templates/nsis/include/allowOnlyOneInstallerInstance.nsh +4 -4
@@ -156,16 +156,18 @@ async function createKeychain({ tmpDir, cscLink, cscKeyPassword, cscILink, cscIK
156
156
  if (cscIKeyPassword != null) {
157
157
  cscPasswords.push(cscIKeyPassword);
158
158
  }
159
- return await importCerts(keychainFile, certPaths, cscPasswords);
159
+ return await importCerts(keychainFile, certPaths, cscPasswords, keychainPassword);
160
160
  }
161
- async function importCerts(keychainFile, paths, keyPasswords) {
161
+ async function importCerts(keychainFile, paths, keyPasswords, keychainPassword) {
162
162
  var _a;
163
163
  for (let i = 0; i < paths.length; i++) {
164
164
  const password = (_a = keyPasswords[i]) !== null && _a !== void 0 ? _a : "";
165
165
  await (0, builder_util_1.exec)("/usr/bin/security", ["import", paths[i], "-k", keychainFile, "-T", "/usr/bin/codesign", "-T", "/usr/bin/productbuild", "-P", password]);
166
166
  // https://stackoverflow.com/questions/39868578/security-codesign-in-sierra-keychain-ignores-access-control-settings-and-ui-p
167
167
  // https://github.com/electron-userland/electron-packager/issues/701#issuecomment-322315996
168
- await (0, builder_util_1.exec)("/usr/bin/security", ["set-key-partition-list", "-S", "apple-tool:,apple:", "-s", "-k", password, keychainFile]);
168
+ // `-k` expects the keychain's own unlock password (as used by create-keychain/unlock-keychain above),
169
+ // not the imported item's password used by `security import -P`.
170
+ await (0, builder_util_1.exec)("/usr/bin/security", ["set-key-partition-list", "-S", "apple-tool:,apple:", "-s", "-k", keychainPassword, keychainFile]);
169
171
  }
170
172
  return {
171
173
  keychainFile,
@@ -1 +1 @@
1
- {"version":3,"file":"macCodeSign.js","sourceRoot":"","sources":["../../src/codeSign/macCodeSign.ts"],"names":[],"mappings":";;;AA4BA,sCA6BC;AAED,kCAqCC;AA+CD,wCAOC;AAED,wCA8CC;AAiBD,oBAOC;AAuGD,oCAeC;AAnVD,+CAAuK;AACvK,yDAAqD;AAErD,mCAAgD;AAChD,0CAAoC;AACpC,uCAA+B;AAC/B,2BAAoC;AACpC,6BAA4B;AAC5B,yCAAuC;AACvC,yCAA+D;AAC/D,yCAA8C;AAEjC,QAAA,wBAAwB,GAAG,CAAC,2BAA2B,EAAE,yBAAyB,EAAE,sCAAsC,EAAE,oCAAoC,CAAC,CAAA;AAe9K,SAAgB,aAAa,CAAC,WAAW,GAAG,IAAI;IAC9C,IAAI,OAAO,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAClC,IAAI,WAAW,EAAE,CAAC;YAChB,kBAAG,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,yBAAyB,EAAE,EAAE,wCAAwC,CAAC,CAAA;QAC3F,CAAC;QACD,OAAO,KAAK,CAAA;IACd,CAAC;IAED,IAAI,IAAA,4BAAa,GAAE,EAA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QAAkB,EAAE,SAAyB,EAAE,QAAwB;IAClG,IAAI,QAAQ,GAAG,SAAS,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAA;IAChD,IAAI,IAAA,8BAAe,EAAC,QAAQ,CAAC,EAAE,CAAC;QAC9B,IAAI,IAAA,uCAA+B,GAAE,EAAE,CAAC;YACtC,OAAO,aAAa,CAAC,QAAQ,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAA;QAChD,CAAC;aAAM,CAAC;YACN,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;QAC9B,CAAC;IACH,CAAC;SAAM,CAAC;QACN,QAAQ,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAA;QAC1B,KAAK,MAAM,MAAM,IAAI,gCAAwB,EAAE,CAAC;YAC9C,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;QAC/B,CAAC;QACD,OAAO,aAAa,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAA;IACpD,CAAC;AACH,CAAC;AAED,SAAS,WAAW,CAAC,IAAY,EAAE,MAAc;IAC/C,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,wCAAyB,CAAC,yBAAyB,MAAM,kFAAkF,CAAC,CAAA;IACxJ,CAAC;AACH,CAAC","sourcesContent":["import type { SignOptions } from \"@electron/osx-sign/dist/cjs/types\"\nimport { copyFile, exec, Fields, InvalidConfigurationError, isEmptyOrSpaces, isEnvTrue, isPullRequest, log, Logger, retry, TmpDir, unlinkIfExists } from \"builder-util\"\nimport { dynamicImport } from \"../util/dynamicImport\"\nimport { Nullish } from \"builder-util-runtime\"\nimport { createHash, randomBytes } from \"crypto\"\nimport { rename } from \"fs/promises\"\nimport { Lazy } from \"lazy-val\"\nimport { homedir, tmpdir } from \"os\"\nimport * as path from \"path\"\nimport { getTempName } from \"temp-file\"\nimport { isAutoDiscoveryCodeSignIdentity } from \"../util/flags\"\nimport { importCertificate } from \"./codesign\"\n\nexport const appleCertificatePrefixes = [\"Developer ID Application:\", \"Developer ID Installer:\", \"3rd Party Mac Developer Application:\", \"3rd Party Mac Developer Installer:\"]\n\nexport type CertType =\n | \"Developer ID Application\"\n | \"Developer ID Installer\"\n | \"3rd Party Mac Developer Application\"\n | \"3rd Party Mac Developer Installer\"\n | \"Mac Developer\"\n | \"Apple Development\"\n | \"Apple Distribution\"\n\nexport interface CodeSigningInfo {\n keychainFile?: string | null\n}\n\nexport function isSignAllowed(isPrintWarn = true): boolean {\n if (process.platform !== \"darwin\") {\n if (isPrintWarn) {\n log.warn({ reason: \"supported only on macOS\" }, \"skipped macOS application code signing\")\n }\n return false\n }\n\n if (isPullRequest()) {\n const buildForPrWarning =\n \"There are serious security concerns with CSC_FOR_PULL_REQUEST=true (see the CircleCI documentation (https://circleci.com/docs/1.0/fork-pr-builds/) for details)\" +\n \"\\nIf you have SSH keys, sensitive env vars or AWS credentials stored in your project settings and untrusted forks can make pull requests against your repo, then this option isn't for you.\"\n\n if (isEnvTrue(process.env.CSC_FOR_PULL_REQUEST)) {\n if (isPrintWarn) {\n log.warn(buildForPrWarning)\n }\n } else {\n if (isPrintWarn) {\n // https://github.com/electron-userland/electron-builder/issues/1524\n log.warn(\n \"Current build is a part of pull request, code signing will be skipped.\" + \"\\nSet env CSC_FOR_PULL_REQUEST to true to force code signing.\" + `\\n${buildForPrWarning}`\n )\n }\n return false\n }\n }\n\n return true\n}\n\nexport async function reportError(isMas: boolean, certificateTypes: CertType[], qualifier: string | Nullish, keychainFile: string | Nullish, isForceCodeSigning: boolean) {\n const logFields: Fields = {}\n if (qualifier == null) {\n logFields.reason = \"\"\n if (isAutoDiscoveryCodeSignIdentity()) {\n logFields.reason += `cannot find valid \"${certificateTypes.join(\", \")}\" identity${\n isMas ? \"\" : ` or custom non-Apple code signing certificate, it could cause some undefined behaviour, e.g. macOS localized description not visible`\n }`\n }\n logFields.reason += \", see https://electron.build/code-signing\"\n if (!isAutoDiscoveryCodeSignIdentity()) {\n logFields.CSC_IDENTITY_AUTO_DISCOVERY = false\n }\n } else {\n logFields.reason = \"Identity name is specified, but no valid identity with this name in the keychain\"\n logFields.identity = qualifier\n }\n\n const args = [\"find-identity\"]\n if (keychainFile != null) {\n args.push(keychainFile)\n }\n\n if (qualifier != null || isAutoDiscoveryCodeSignIdentity()) {\n logFields.allIdentities = (await exec(\"/usr/bin/security\", args))\n .trim()\n .split(\"\\n\")\n .filter(it => !(it.includes(\"Policy: X.509 Basic\") || it.includes(\"Matching identities\")))\n .join(\"\\n\")\n }\n\n const skipMessage = \"skipped macOS application code signing\"\n if (isMas || isForceCodeSigning) {\n throw new Error(Logger.createMessage(skipMessage, logFields, \"error\", it => it))\n } else {\n log.warn(logFields, skipMessage)\n }\n}\n\n// \"Note that filename will not be searched to resolve the signing identity's certificate chain unless it is also on the user's keychain search list.\"\n// but \"security list-keychains\" doesn't support add - we should 1) get current list 2) set new list - it is very bad http://stackoverflow.com/questions/10538942/add-a-keychain-to-search-list\n// \"overly complicated and introduces a race condition.\"\n// https://github.com/electron-userland/electron-builder/issues/398\nconst bundledCertKeychainAdded = new Lazy<void>(async () => {\n // copy to temp and then atomic rename to final path\n const cacheDir = getCacheDirectory()\n const tmpKeychainPath = path.join(cacheDir, getTempName(\"electron-builder-root-certs\"))\n const keychainPath = path.join(cacheDir, \"electron-builder-root-certs.keychain\")\n const results = await Promise.all<any>([\n listUserKeychains(),\n copyFile(path.join(__dirname, \"..\", \"..\", \"certs\", \"root_certs.keychain\"), tmpKeychainPath).then(() => rename(tmpKeychainPath, keychainPath)),\n ])\n const list = results[0]\n if (!list.includes(keychainPath)) {\n await exec(\"/usr/bin/security\", [\"list-keychains\", \"-d\", \"user\", \"-s\", keychainPath].concat(list))\n }\n})\n\nfunction getCacheDirectory(): string {\n const env = process.env.ELECTRON_BUILDER_CACHE\n return isEmptyOrSpaces(env) ? path.join(homedir(), \"Library\", \"Caches\", \"electron-builder\") : path.resolve(env)\n}\n\nfunction listUserKeychains(): Promise<Array<string>> {\n return exec(\"/usr/bin/security\", [\"list-keychains\", \"-d\", \"user\"]).then(it =>\n it\n .split(\"\\n\")\n .map(it => {\n const r = it.trim()\n return r.substring(1, r.length - 1)\n })\n .filter(it => it.length > 0)\n )\n}\n\nexport interface CreateKeychainOptions {\n tmpDir: TmpDir\n cscLink: string\n cscKeyPassword: string\n cscILink?: string | null\n cscIKeyPassword?: string | null\n currentDir: string\n}\n\nexport function removeKeychain(keychainFile: string, printWarn = true): Promise<any> {\n return exec(\"/usr/bin/security\", [\"delete-keychain\", keychainFile]).catch((e: any) => {\n if (printWarn) {\n log.warn({ file: keychainFile, error: e.stack || e }, \"cannot delete keychain\")\n }\n return unlinkIfExists(keychainFile)\n })\n}\n\nexport async function createKeychain({ tmpDir, cscLink, cscKeyPassword, cscILink, cscIKeyPassword, currentDir }: CreateKeychainOptions): Promise<CodeSigningInfo> {\n // travis has correct AppleWWDRCA cert\n if (process.env.TRAVIS !== \"true\") {\n await bundledCertKeychainAdded.value\n }\n\n // https://github.com/electron-userland/electron-builder/issues/3685\n // use constant file\n const keychainFile = path.join(process.env.APP_BUILDER_TMP_DIR || tmpdir(), `${createHash(\"sha256\").update(currentDir).update(\"app-builder\").digest(\"hex\")}.keychain`)\n // noinspection JSUnusedLocalSymbols\n\n await removeKeychain(keychainFile, false).catch(_ => {\n /* ignore*/\n })\n\n const certLinks = [cscLink]\n if (cscILink != null) {\n certLinks.push(cscILink)\n }\n\n const certPaths = new Array(certLinks.length)\n const keychainPassword = randomBytes(32).toString(\"base64\")\n const securityCommands = [\n [\"create-keychain\", \"-p\", keychainPassword, keychainFile],\n [\"unlock-keychain\", \"-p\", keychainPassword, keychainFile],\n [\"set-keychain-settings\", keychainFile],\n ]\n\n // https://stackoverflow.com/questions/42484678/codesign-keychain-gets-ignored\n // https://github.com/electron-userland/electron-builder/issues/1457\n const list = await listUserKeychains()\n if (!list.includes(keychainFile)) {\n securityCommands.push([\"list-keychains\", \"-d\", \"user\", \"-s\", keychainFile].concat(list))\n }\n\n await Promise.all([\n // we do not clear downloaded files - will be removed on tmpDir cleanup automatically. not a security issue since in any case data is available as env variables and protected by password.\n ...certLinks.map((link, i) => importCertificate(link, tmpDir, currentDir).then(it => (certPaths[i] = it))),\n // queue each security command\n securityCommands.reduce((promise, cmd) => promise.then(() => exec(\"/usr/bin/security\", cmd)), new Promise(resolve => resolve(null))),\n ])\n const cscPasswords: Array<string> = [cscKeyPassword]\n if (cscIKeyPassword != null) {\n cscPasswords.push(cscIKeyPassword)\n }\n return await importCerts(keychainFile, certPaths, cscPasswords)\n}\n\nasync function importCerts(keychainFile: string, paths: Array<string>, keyPasswords: Array<string>): Promise<CodeSigningInfo> {\n for (let i = 0; i < paths.length; i++) {\n const password = keyPasswords[i] ?? \"\"\n await exec(\"/usr/bin/security\", [\"import\", paths[i], \"-k\", keychainFile, \"-T\", \"/usr/bin/codesign\", \"-T\", \"/usr/bin/productbuild\", \"-P\", password])\n\n // https://stackoverflow.com/questions/39868578/security-codesign-in-sierra-keychain-ignores-access-control-settings-and-ui-p\n // https://github.com/electron-userland/electron-packager/issues/701#issuecomment-322315996\n await exec(\"/usr/bin/security\", [\"set-key-partition-list\", \"-S\", \"apple-tool:,apple:\", \"-s\", \"-k\", password, keychainFile])\n }\n\n return {\n keychainFile,\n }\n}\n\nexport async function sign(opts: SignOptions): Promise<void> {\n const { signAsync } = await dynamicImport<typeof import(\"@electron/osx-sign\")>(\"@electron/osx-sign\")\n return retry(() => signAsync(opts), {\n retries: 3,\n interval: 5000,\n backoff: 5000,\n })\n}\n\nexport let findIdentityRawResult: Promise<Array<string>> | null = null\n\nasync function getValidIdentities(keychain?: string | null): Promise<Array<string>> {\n function addKeychain(args: Array<string>) {\n if (keychain != null) {\n args.push(keychain)\n }\n return args\n }\n\n let result = findIdentityRawResult\n if (result == null || keychain != null) {\n // https://github.com/electron-userland/electron-builder/issues/481\n // https://github.com/electron-userland/electron-builder/issues/535\n result = Promise.all<Array<string>>([\n exec(\"/usr/bin/security\", addKeychain([\"find-identity\", \"-v\"])).then(it =>\n it\n .trim()\n .split(\"\\n\")\n .filter(it => {\n for (const prefix of appleCertificatePrefixes) {\n if (it.includes(prefix)) {\n return true\n }\n }\n return false\n })\n ),\n exec(\"/usr/bin/security\", addKeychain([\"find-identity\", \"-v\", \"-p\", \"codesigning\"])).then(it => it.trim().split(\"\\n\")),\n ]).then(it => {\n const array = it[0]\n .concat(it[1])\n .filter(\n it => !it.includes(\"(Missing required extension)\") && !it.includes(\"valid identities found\") && !it.includes(\"iPhone \") && !it.includes(\"com.apple.idms.appleid.prd.\")\n )\n // remove 1)\n .map(it => it.substring(it.indexOf(\")\") + 1).trim())\n return Array.from(new Set(array))\n })\n\n if (keychain == null) {\n findIdentityRawResult = result\n }\n }\n return result\n}\n\nasync function _findIdentity(type: CertType, qualifier?: string | null, keychain?: string | null): Promise<Identity | null> {\n // https://github.com/electron-userland/electron-builder/issues/484\n //noinspection SpellCheckingInspection\n const lines = await getValidIdentities(keychain)\n const namePrefix = `${type}:`\n for (const line of lines) {\n if (qualifier != null && !line.includes(qualifier)) {\n continue\n }\n\n if (line.includes(namePrefix)) {\n return await parseIdentity(line)\n }\n }\n\n if (type === \"Developer ID Application\") {\n // find non-Apple certificate\n // https://github.com/electron-userland/electron-builder/issues/458\n l: for (const line of lines) {\n if (qualifier != null && !line.includes(qualifier)) {\n continue\n }\n\n if (line.includes(\"Mac Developer:\")) {\n continue\n }\n\n for (const prefix of appleCertificatePrefixes) {\n if (line.includes(prefix)) {\n continue l\n }\n }\n\n return await parseIdentity(line)\n }\n }\n return null\n}\n\nexport declare class Identity {\n readonly name: string\n readonly hash?: string\n\n constructor(name: string, hash?: string)\n}\n\nasync function parseIdentity(line: string): Promise<Identity> {\n const firstQuoteIndex = line.indexOf('\"')\n const name = line.substring(firstQuoteIndex + 1, line.lastIndexOf('\"'))\n const hash = line.substring(0, firstQuoteIndex - 1)\n const { Identity: IdentityClass } = await dynamicImport<{ Identity: new (name: string, hash?: string) => Identity }>(\"@electron/osx-sign/dist/cjs/util-identities\")\n return new IdentityClass(name, hash)\n}\n\nexport function findIdentity(certType: CertType, qualifier?: string | null, keychain?: string | null): Promise<Identity | null> {\n let identity = qualifier || process.env.CSC_NAME\n if (isEmptyOrSpaces(identity)) {\n if (isAutoDiscoveryCodeSignIdentity()) {\n return _findIdentity(certType, null, keychain)\n } else {\n return Promise.resolve(null)\n }\n } else {\n identity = identity.trim()\n for (const prefix of appleCertificatePrefixes) {\n checkPrefix(identity, prefix)\n }\n return _findIdentity(certType, identity, keychain)\n }\n}\n\nfunction checkPrefix(name: string, prefix: string) {\n if (name.startsWith(prefix)) {\n throw new InvalidConfigurationError(`Please remove prefix \"${prefix}\" from the specified name — appropriate certificate will be chosen automatically`)\n }\n}\n"]}
1
+ {"version":3,"file":"macCodeSign.js","sourceRoot":"","sources":["../../src/codeSign/macCodeSign.ts"],"names":[],"mappings":";;;AA4BA,sCA6BC;AAED,kCAqCC;AA+CD,wCAOC;AAED,wCA8CC;AAmBD,oBAOC;AAuGD,oCAeC;AArVD,+CAAuK;AACvK,yDAAqD;AAErD,mCAAgD;AAChD,0CAAoC;AACpC,uCAA+B;AAC/B,2BAAoC;AACpC,6BAA4B;AAC5B,yCAAuC;AACvC,yCAA+D;AAC/D,yCAA8C;AAEjC,QAAA,wBAAwB,GAAG,CAAC,2BAA2B,EAAE,yBAAyB,EAAE,sCAAsC,EAAE,oCAAoC,CAAC,CAAA;AAe9K,SAAgB,aAAa,CAAC,WAAW,GAAG,IAAI;IAC9C,IAAI,OAAO,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAClC,IAAI,WAAW,EAAE,CAAC;YAChB,kBAAG,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,yBAAyB,EAAE,EAAE,wCAAwC,CAAC,CAAA;QAC3F,CAAC;QACD,OAAO,KAAK,CAAA;IACd,CAAC;IAED,IAAI,IAAA,4BAAa,GAA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AAI,EAAE,IAAI,CAAC,CAAA;AACtC,CAAC;AAED,SAAgB,YAAY,CAAC,QAAkB,EAAE,SAAyB,EAAE,QAAwB;IAClG,IAAI,QAAQ,GAAG,SAAS,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAA;IAChD,IAAI,IAAA,8BAAe,EAAC,QAAQ,CAAC,EAAE,CAAC;QAC9B,IAAI,IAAA,uCAA+B,GAAE,EAAE,CAAC;YACtC,OAAO,aAAa,CAAC,QAAQ,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAA;QAChD,CAAC;aAAM,CAAC;YACN,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;QAC9B,CAAC;IACH,CAAC;SAAM,CAAC;QACN,QAAQ,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAA;QAC1B,KAAK,MAAM,MAAM,IAAI,gCAAwB,EAAE,CAAC;YAC9C,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;QAC/B,CAAC;QACD,OAAO,aAAa,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAA;IACpD,CAAC;AACH,CAAC;AAED,SAAS,WAAW,CAAC,IAAY,EAAE,MAAc;IAC/C,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,wCAAyB,CAAC,yBAAyB,MAAM,kFAAkF,CAAC,CAAA;IACxJ,CAAC;AACH,CAAC","sourcesContent":["import type { SignOptions } from \"@electron/osx-sign/dist/cjs/types\"\nimport { copyFile, exec, Fields, InvalidConfigurationError, isEmptyOrSpaces, isEnvTrue, isPullRequest, log, Logger, retry, TmpDir, unlinkIfExists } from \"builder-util\"\nimport { dynamicImport } from \"../util/dynamicImport\"\nimport { Nullish } from \"builder-util-runtime\"\nimport { createHash, randomBytes } from \"crypto\"\nimport { rename } from \"fs/promises\"\nimport { Lazy } from \"lazy-val\"\nimport { homedir, tmpdir } from \"os\"\nimport * as path from \"path\"\nimport { getTempName } from \"temp-file\"\nimport { isAutoDiscoveryCodeSignIdentity } from \"../util/flags\"\nimport { importCertificate } from \"./codesign\"\n\nexport const appleCertificatePrefixes = [\"Developer ID Application:\", \"Developer ID Installer:\", \"3rd Party Mac Developer Application:\", \"3rd Party Mac Developer Installer:\"]\n\nexport type CertType =\n | \"Developer ID Application\"\n | \"Developer ID Installer\"\n | \"3rd Party Mac Developer Application\"\n | \"3rd Party Mac Developer Installer\"\n | \"Mac Developer\"\n | \"Apple Development\"\n | \"Apple Distribution\"\n\nexport interface CodeSigningInfo {\n keychainFile?: string | null\n}\n\nexport function isSignAllowed(isPrintWarn = true): boolean {\n if (process.platform !== \"darwin\") {\n if (isPrintWarn) {\n log.warn({ reason: \"supported only on macOS\" }, \"skipped macOS application code signing\")\n }\n return false\n }\n\n if (isPullRequest()) {\n const buildForPrWarning =\n \"There are serious security concerns with CSC_FOR_PULL_REQUEST=true (see the CircleCI documentation (https://circleci.com/docs/1.0/fork-pr-builds/) for details)\" +\n \"\\nIf you have SSH keys, sensitive env vars or AWS credentials stored in your project settings and untrusted forks can make pull requests against your repo, then this option isn't for you.\"\n\n if (isEnvTrue(process.env.CSC_FOR_PULL_REQUEST)) {\n if (isPrintWarn) {\n log.warn(buildForPrWarning)\n }\n } else {\n if (isPrintWarn) {\n // https://github.com/electron-userland/electron-builder/issues/1524\n log.warn(\n \"Current build is a part of pull request, code signing will be skipped.\" + \"\\nSet env CSC_FOR_PULL_REQUEST to true to force code signing.\" + `\\n${buildForPrWarning}`\n )\n }\n return false\n }\n }\n\n return true\n}\n\nexport async function reportError(isMas: boolean, certificateTypes: CertType[], qualifier: string | Nullish, keychainFile: string | Nullish, isForceCodeSigning: boolean) {\n const logFields: Fields = {}\n if (qualifier == null) {\n logFields.reason = \"\"\n if (isAutoDiscoveryCodeSignIdentity()) {\n logFields.reason += `cannot find valid \"${certificateTypes.join(\", \")}\" identity${\n isMas ? \"\" : ` or custom non-Apple code signing certificate, it could cause some undefined behaviour, e.g. macOS localized description not visible`\n }`\n }\n logFields.reason += \", see https://electron.build/code-signing\"\n if (!isAutoDiscoveryCodeSignIdentity()) {\n logFields.CSC_IDENTITY_AUTO_DISCOVERY = false\n }\n } else {\n logFields.reason = \"Identity name is specified, but no valid identity with this name in the keychain\"\n logFields.identity = qualifier\n }\n\n const args = [\"find-identity\"]\n if (keychainFile != null) {\n args.push(keychainFile)\n }\n\n if (qualifier != null || isAutoDiscoveryCodeSignIdentity()) {\n logFields.allIdentities = (await exec(\"/usr/bin/security\", args))\n .trim()\n .split(\"\\n\")\n .filter(it => !(it.includes(\"Policy: X.509 Basic\") || it.includes(\"Matching identities\")))\n .join(\"\\n\")\n }\n\n const skipMessage = \"skipped macOS application code signing\"\n if (isMas || isForceCodeSigning) {\n throw new Error(Logger.createMessage(skipMessage, logFields, \"error\", it => it))\n } else {\n log.warn(logFields, skipMessage)\n }\n}\n\n// \"Note that filename will not be searched to resolve the signing identity's certificate chain unless it is also on the user's keychain search list.\"\n// but \"security list-keychains\" doesn't support add - we should 1) get current list 2) set new list - it is very bad http://stackoverflow.com/questions/10538942/add-a-keychain-to-search-list\n// \"overly complicated and introduces a race condition.\"\n// https://github.com/electron-userland/electron-builder/issues/398\nconst bundledCertKeychainAdded = new Lazy<void>(async () => {\n // copy to temp and then atomic rename to final path\n const cacheDir = getCacheDirectory()\n const tmpKeychainPath = path.join(cacheDir, getTempName(\"electron-builder-root-certs\"))\n const keychainPath = path.join(cacheDir, \"electron-builder-root-certs.keychain\")\n const results = await Promise.all<any>([\n listUserKeychains(),\n copyFile(path.join(__dirname, \"..\", \"..\", \"certs\", \"root_certs.keychain\"), tmpKeychainPath).then(() => rename(tmpKeychainPath, keychainPath)),\n ])\n const list = results[0]\n if (!list.includes(keychainPath)) {\n await exec(\"/usr/bin/security\", [\"list-keychains\", \"-d\", \"user\", \"-s\", keychainPath].concat(list))\n }\n})\n\nfunction getCacheDirectory(): string {\n const env = process.env.ELECTRON_BUILDER_CACHE\n return isEmptyOrSpaces(env) ? path.join(homedir(), \"Library\", \"Caches\", \"electron-builder\") : path.resolve(env)\n}\n\nfunction listUserKeychains(): Promise<Array<string>> {\n return exec(\"/usr/bin/security\", [\"list-keychains\", \"-d\", \"user\"]).then(it =>\n it\n .split(\"\\n\")\n .map(it => {\n const r = it.trim()\n return r.substring(1, r.length - 1)\n })\n .filter(it => it.length > 0)\n )\n}\n\nexport interface CreateKeychainOptions {\n tmpDir: TmpDir\n cscLink: string\n cscKeyPassword: string\n cscILink?: string | null\n cscIKeyPassword?: string | null\n currentDir: string\n}\n\nexport function removeKeychain(keychainFile: string, printWarn = true): Promise<any> {\n return exec(\"/usr/bin/security\", [\"delete-keychain\", keychainFile]).catch((e: any) => {\n if (printWarn) {\n log.warn({ file: keychainFile, error: e.stack || e }, \"cannot delete keychain\")\n }\n return unlinkIfExists(keychainFile)\n })\n}\n\nexport async function createKeychain({ tmpDir, cscLink, cscKeyPassword, cscILink, cscIKeyPassword, currentDir }: CreateKeychainOptions): Promise<CodeSigningInfo> {\n // travis has correct AppleWWDRCA cert\n if (process.env.TRAVIS !== \"true\") {\n await bundledCertKeychainAdded.value\n }\n\n // https://github.com/electron-userland/electron-builder/issues/3685\n // use constant file\n const keychainFile = path.join(process.env.APP_BUILDER_TMP_DIR || tmpdir(), `${createHash(\"sha256\").update(currentDir).update(\"app-builder\").digest(\"hex\")}.keychain`)\n // noinspection JSUnusedLocalSymbols\n\n await removeKeychain(keychainFile, false).catch(_ => {\n /* ignore*/\n })\n\n const certLinks = [cscLink]\n if (cscILink != null) {\n certLinks.push(cscILink)\n }\n\n const certPaths = new Array(certLinks.length)\n const keychainPassword = randomBytes(32).toString(\"base64\")\n const securityCommands = [\n [\"create-keychain\", \"-p\", keychainPassword, keychainFile],\n [\"unlock-keychain\", \"-p\", keychainPassword, keychainFile],\n [\"set-keychain-settings\", keychainFile],\n ]\n\n // https://stackoverflow.com/questions/42484678/codesign-keychain-gets-ignored\n // https://github.com/electron-userland/electron-builder/issues/1457\n const list = await listUserKeychains()\n if (!list.includes(keychainFile)) {\n securityCommands.push([\"list-keychains\", \"-d\", \"user\", \"-s\", keychainFile].concat(list))\n }\n\n await Promise.all([\n // we do not clear downloaded files - will be removed on tmpDir cleanup automatically. not a security issue since in any case data is available as env variables and protected by password.\n ...certLinks.map((link, i) => importCertificate(link, tmpDir, currentDir).then(it => (certPaths[i] = it))),\n // queue each security command\n securityCommands.reduce((promise, cmd) => promise.then(() => exec(\"/usr/bin/security\", cmd)), new Promise(resolve => resolve(null))),\n ])\n const cscPasswords: Array<string> = [cscKeyPassword]\n if (cscIKeyPassword != null) {\n cscPasswords.push(cscIKeyPassword)\n }\n return await importCerts(keychainFile, certPaths, cscPasswords, keychainPassword)\n}\n\nasync function importCerts(keychainFile: string, paths: Array<string>, keyPasswords: Array<string>, keychainPassword: string): Promise<CodeSigningInfo> {\n for (let i = 0; i < paths.length; i++) {\n const password = keyPasswords[i] ?? \"\"\n await exec(\"/usr/bin/security\", [\"import\", paths[i], \"-k\", keychainFile, \"-T\", \"/usr/bin/codesign\", \"-T\", \"/usr/bin/productbuild\", \"-P\", password])\n\n // https://stackoverflow.com/questions/39868578/security-codesign-in-sierra-keychain-ignores-access-control-settings-and-ui-p\n // https://github.com/electron-userland/electron-packager/issues/701#issuecomment-322315996\n // `-k` expects the keychain's own unlock password (as used by create-keychain/unlock-keychain above),\n // not the imported item's password used by `security import -P`.\n await exec(\"/usr/bin/security\", [\"set-key-partition-list\", \"-S\", \"apple-tool:,apple:\", \"-s\", \"-k\", keychainPassword, keychainFile])\n }\n\n return {\n keychainFile,\n }\n}\n\nexport async function sign(opts: SignOptions): Promise<void> {\n const { signAsync } = await dynamicImport<typeof import(\"@electron/osx-sign\")>(\"@electron/osx-sign\")\n return retry(() => signAsync(opts), {\n retries: 3,\n interval: 5000,\n backoff: 5000,\n })\n}\n\nexport let findIdentityRawResult: Promise<Array<string>> | null = null\n\nasync function getValidIdentities(keychain?: string | null): Promise<Array<string>> {\n function addKeychain(args: Array<string>) {\n if (keychain != null) {\n args.push(keychain)\n }\n return args\n }\n\n let result = findIdentityRawResult\n if (result == null || keychain != null) {\n // https://github.com/electron-userland/electron-builder/issues/481\n // https://github.com/electron-userland/electron-builder/issues/535\n result = Promise.all<Array<string>>([\n exec(\"/usr/bin/security\", addKeychain([\"find-identity\", \"-v\"])).then(it =>\n it\n .trim()\n .split(\"\\n\")\n .filter(it => {\n for (const prefix of appleCertificatePrefixes) {\n if (it.includes(prefix)) {\n return true\n }\n }\n return false\n })\n ),\n exec(\"/usr/bin/security\", addKeychain([\"find-identity\", \"-v\", \"-p\", \"codesigning\"])).then(it => it.trim().split(\"\\n\")),\n ]).then(it => {\n const array = it[0]\n .concat(it[1])\n .filter(\n it => !it.includes(\"(Missing required extension)\") && !it.includes(\"valid identities found\") && !it.includes(\"iPhone \") && !it.includes(\"com.apple.idms.appleid.prd.\")\n )\n // remove 1)\n .map(it => it.substring(it.indexOf(\")\") + 1).trim())\n return Array.from(new Set(array))\n })\n\n if (keychain == null) {\n findIdentityRawResult = result\n }\n }\n return result\n}\n\nasync function _findIdentity(type: CertType, qualifier?: string | null, keychain?: string | null): Promise<Identity | null> {\n // https://github.com/electron-userland/electron-builder/issues/484\n //noinspection SpellCheckingInspection\n const lines = await getValidIdentities(keychain)\n const namePrefix = `${type}:`\n for (const line of lines) {\n if (qualifier != null && !line.includes(qualifier)) {\n continue\n }\n\n if (line.includes(namePrefix)) {\n return await parseIdentity(line)\n }\n }\n\n if (type === \"Developer ID Application\") {\n // find non-Apple certificate\n // https://github.com/electron-userland/electron-builder/issues/458\n l: for (const line of lines) {\n if (qualifier != null && !line.includes(qualifier)) {\n continue\n }\n\n if (line.includes(\"Mac Developer:\")) {\n continue\n }\n\n for (const prefix of appleCertificatePrefixes) {\n if (line.includes(prefix)) {\n continue l\n }\n }\n\n return await parseIdentity(line)\n }\n }\n return null\n}\n\nexport declare class Identity {\n readonly name: string\n readonly hash?: string\n\n constructor(name: string, hash?: string)\n}\n\nasync function parseIdentity(line: string): Promise<Identity> {\n const firstQuoteIndex = line.indexOf('\"')\n const name = line.substring(firstQuoteIndex + 1, line.lastIndexOf('\"'))\n const hash = line.substring(0, firstQuoteIndex - 1)\n const { Identity: IdentityClass } = await dynamicImport<{ Identity: new (name: string, hash?: string) => Identity }>(\"@electron/osx-sign/dist/cjs/util-identities\")\n return new IdentityClass(name, hash)\n}\n\nexport function findIdentity(certType: CertType, qualifier?: string | null, keychain?: string | null): Promise<Identity | null> {\n let identity = qualifier || process.env.CSC_NAME\n if (isEmptyOrSpaces(identity)) {\n if (isAutoDiscoveryCodeSignIdentity()) {\n return _findIdentity(certType, null, keychain)\n } else {\n return Promise.resolve(null)\n }\n } else {\n identity = identity.trim()\n for (const prefix of appleCertificatePrefixes) {\n checkPrefix(identity, prefix)\n }\n return _findIdentity(certType, identity, keychain)\n }\n}\n\nfunction checkPrefix(name: string, prefix: string) {\n if (name.startsWith(prefix)) {\n throw new InvalidConfigurationError(`Please remove prefix \"${prefix}\" from the specified name — appropriate certificate will be chosen automatically`)\n }\n}\n"]}
@@ -9,9 +9,6 @@ async function signWindows(options, packager) {
9
9
  }
10
10
  builder_util_1.log.info({ path: builder_util_1.log.filePath(options.path) }, "signing with Azure Trusted Signing");
11
11
  }
12
- else {
13
- builder_util_1.log.info({ path: builder_util_1.log.filePath(options.path) }, "signing with signtool.exe");
14
- }
15
12
  const packageManager = await packager.signingManager.value;
16
13
  return signWithRetry(async () => packageManager.signFile(options));
17
14
  }
@@ -1 +1 @@
1
- {"version":3,"file":"windowsCodeSign.js","sourceRoot":"","sources":["../../src/codeSign/windowsCodeSign.ts"],"names":[],"mappings":";;AASA,kCAWC;AApBD,+CAAyC;AASlC,KAAK,UAAU,WAAW,CAAC,OAA2B,EAAE,QAAqB;IAClF,IAAI,OAAO,CAAC,OAAO,CAAC,gBAAgB,EAAE,CAAC;QACrC,IAAI,OAAO,CAAC,OAAO,CAAC,eAAe,EAAE,CAAC;YACpC,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\nimport { WinPackager } from \"../winPackager\"\n\nexport interface WindowsSignOptions {\n readonly path: string\n readonly options: WindowsConfiguration\n}\n\nexport async function signWindows(options: WindowsSignOptions, packager: WinPackager): Promise<boolean> {\n if (options.options.azureSignOptions) {\n if (options.options.signtoolOptions) {\n log.warn(null, \"ignoring signtool options, using Azure Trusted Signing; please only configure one\")\n }\n log.info({ path: log.filePath(options.path) }, \"signing with Azure Trusted Signing\")\n } else {\n log.info({ path: log.filePath(options.path) }, \"signing with signtool.exe\")\n }\n const packageManager = await packager.signingManager.value\n return signWithRetry(async () => packageManager.signFile(options))\n}\n\nfunction signWithRetry(signer: () => Promise<boolean>): Promise<boolean> {\n return retry(signer, {\n retries: 3,\n interval: 1000,\n backoff: 1000,\n shouldRetry: (e: any) => {\n const message = e.message\n if (\n // https://github.com/electron-userland/electron-builder/issues/1414\n message?.includes(\"Couldn't resolve host name\") ||\n // https://github.com/electron-userland/electron-builder/issues/8615\n message?.includes(\"being used by another process.\")\n ) {\n log.warn({ error: message }, \"attempt to sign failed, another attempt will be made\")\n return true\n }\n return false\n },\n })\n}\n"]}
1
+ {"version":3,"file":"windowsCodeSign.js","sourceRoot":"","sources":["../../src/codeSign/windowsCodeSign.ts"],"names":[],"mappings":";;AASA,kCASC;AAlBD,+CAAyC;AASlC,KAAK,UAAU,WAAW,CAAC,OAA2B,EAAE,QAAqB;IAClF,IAAI,OAAO,CAAC,OAAO,CAAC,gBAAgB,EAAE,CAAC;QACrC,IAAI,OAAO,CAAC,OAAO,CAAC,eAAe,EAAE,CAAC;YACpC,kBAAG,CAAC,IAAI,CAAC,IAAI,EAAE,mFAAmF,CAAC,CAAA;QACrG,CAAC;QACD,kBAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,kBAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,oCAAoC,CAAC,CAAA;IACtF,CAAC;IACD,MAAM,cAAc,GAAG,MAAM,QAAQ,CAAC,cAAc,CAAC,KAAK,CAAA;IAC1D,OAAO,aAAa,CAAC,KAAK,IAAI,EAAE,CAAC,cAAc,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAA;AACpE,CAAC;AAED,SAAS,aAAa,CAAC,MAA8B;IACnD,OAAO,IAAA,oBAAK,EAAC,MAAM,EAAE;QACnB,OAAO,EAAE,CAAC;QACV,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,IAAI;QACb,WAAW,EAAE,CAAC,CAAM,EAAE,EAAE;YACtB,MAAM,OAAO,GAAG,CAAC,CAAC,OAAO,CAAA;YACzB;YACE,oEAAoE;YACpE,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,CAAC,4BAA4B,CAAC;;gBAC/C,oEAAoE;gBACpE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,CAAC,gCAAgC,CAAC,CAAA,EACnD,CAAC;gBACD,kBAAG,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,sDAAsD,CAAC,CAAA;gBACpF,OAAO,IAAI,CAAA;YACb,CAAC;YACD,OAAO,KAAK,CAAA;QACd,CAAC;KACF,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import { log, retry } from \"builder-util\"\nimport { WindowsConfiguration } from \"../options/winOptions\"\nimport { WinPackager } from \"../winPackager\"\n\nexport interface WindowsSignOptions {\n readonly path: string\n readonly options: WindowsConfiguration\n}\n\nexport async function signWindows(options: WindowsSignOptions, packager: WinPackager): Promise<boolean> {\n if (options.options.azureSignOptions) {\n if (options.options.signtoolOptions) {\n log.warn(null, \"ignoring signtool options, using Azure Trusted Signing; please only configure one\")\n }\n log.info({ path: log.filePath(options.path) }, \"signing with Azure Trusted Signing\")\n }\n const packageManager = await packager.signingManager.value\n return signWithRetry(async () => packageManager.signFile(options))\n}\n\nfunction signWithRetry(signer: () => Promise<boolean>): Promise<boolean> {\n return retry(signer, {\n retries: 3,\n interval: 1000,\n backoff: 1000,\n shouldRetry: (e: any) => {\n const message = e.message\n if (\n // https://github.com/electron-userland/electron-builder/issues/1414\n message?.includes(\"Couldn't resolve host name\") ||\n // https://github.com/electron-userland/electron-builder/issues/8615\n message?.includes(\"being used by another process.\")\n ) {\n log.warn({ error: message }, \"attempt to sign failed, another attempt will be made\")\n return true\n }\n return false\n },\n })\n}\n"]}
@@ -132,6 +132,9 @@ class WindowsSignToolManager {
132
132
  const customSign = await (0, resolve_1.resolveFunction)(this.packager.appInfo.type, (_b = options.options.signtoolOptions) === null || _b === void 0 ? void 0 : _b.sign, "sign", await this.packager.info.getWorkspaceRoot());
133
133
  const cscInfo = await this.cscInfo.value;
134
134
  if (cscInfo) {
135
+ if (!customSign) {
136
+ builder_util_1.log.info({ path: builder_util_1.log.filePath(options.path) }, "signing with signtool.exe");
137
+ }
135
138
  let logInfo = {
136
139
  file: builder_util_1.log.filePath(options.path),
137
140
  };
@@ -153,7 +156,7 @@ class WindowsSignToolManager {
153
156
  builder_util_1.log.info(logInfo, "signing");
154
157
  }
155
158
  else if (!customSign) {
156
- builder_util_1.log.debug({ signHook: !!customSign, cscInfo }, "no signing info identified, signing is skipped");
159
+ builder_util_1.log.info({ path: builder_util_1.log.filePath(options.path) }, "no code signing certificate configured, signing is skipped");
157
160
  return false;
158
161
  }
159
162
  const executor = customSign || ((config, packager) => this.doSign(config, packager));
@@ -1 +1 @@
1
- {"version":3,"file":"windowsSignToolManager.js","sourceRoot":"","sources":["../../src/codeSign/windowsSignToolManager.ts"],"names":[],"mappings":";;;AAAA,+CAA6E;AAC7E,+DAAwD;AACxD,uCAAiC;AACjC,uCAA+B;AAC/B,6BAA4B;AAG5B,sDAA8C;AAC9C,iDAAqD;AAErD,6CAAiD;AACjD,yCAAyC;AACzC,iCAAoC;AAEpC,yCAA8C;AAgD9C,MAAa,sBAAsB;IAGjC,YAA6B,QAAqB;QAArB,aAAQ,GAAR,QAAQ,CAAa;QAIzC,0BAAqB,GAAG,IAAI,eAAI,CAAuB,KAAK,IAA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IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE;YACpG,OAAO,EAAE,CAAC;YACV,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE,KAAK;YACd,WAAW,EAAE,CAAC,CAAM,EAAE,EAAE;gBACtB,IACE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,2CAA2C,CAAC;oBAC/D,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,4DAA4D,CAAC;oBAChF,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,6DAA6D,CAAC,EACjF,CAAC;oBACD,kBAAG,CAAC,IAAI,CAAC,4EAA4E,CAAC,CAAC,OAAO,EAAE,CAAC,CAAA;oBACjG,OAAO,IAAI,CAAA;gBACb,CAAC;gBACD,OAAO,KAAK,CAAA;YACd,CAAC;SACF,CAAC,CAAA;IACJ,CAAC;CACF;AAtZD,wDAsZC","sourcesContent":["import { asArray, InvalidConfigurationError, log, retry } from \"builder-util\"\nimport { MemoLazy, parseDn } from \"builder-util-runtime\"\nimport { rename } from \"fs-extra\"\nimport { Lazy } from \"lazy-val\"\nimport * as path from \"path\"\nimport { Target } from \"../core\"\nimport { WindowsConfiguration } from \"../options/winOptions\"\nimport AppXTarget from \"../targets/AppxTarget\"\nimport { getSignToolPath } from \"../toolsets/windows\"\nimport { ToolInfo } from \"../util/bundledTool\"\nimport { resolveFunction } from \"../util/resolve\"\nimport { readCertInfo } from \"./certInfo\"\nimport { VmManager } from \"../vm/vm\"\nimport { WinPackager } from \"../winPackager\"\nimport { importCertificate } from \"./codesign\"\nimport { SignManager } from \"./signManager\"\nimport { WindowsSignOptions } from \"./windowsCodeSign\"\n\nexport type CustomWindowsSign = (configuration: CustomWindowsSignTaskConfiguration, packager?: WinPackager) => Promise<any>\n\nexport interface WindowsSignToolOptions extends WindowsSignOptions {\n readonly name: string\n readonly site: string | null\n}\n\nexport interface FileCodeSigningInfo {\n readonly file: string\n readonly password: string | null\n}\n\nexport interface WindowsSignTaskConfiguration extends WindowsSignToolOptions {\n readonly cscInfo: FileCodeSigningInfo | CertificateFromStoreInfo | null\n\n // set if output path differs from input (e.g. osslsigncode cannot sign file in-place)\n resultOutputPath?: string\n\n hash: string\n isNest: boolean\n}\n\nexport interface CustomWindowsSignTaskConfiguration extends WindowsSignTaskConfiguration {\n computeSignToolArgs(isWin: boolean): Array<string>\n}\n\nexport interface CertificateInfo {\n readonly commonName: string\n readonly bloodyMicrosoftSubjectDn: string\n}\n\nexport interface CertificateFromStoreInfo {\n thumbprint: string\n subject: string\n store: string\n isLocalMachineStore: boolean\n}\n\ninterface CertInfo {\n Subject: string\n Thumbprint: string\n PSParentPath: string\n}\n\nexport class WindowsSignToolManager implements SignManager {\n private readonly platformSpecificBuildOptions: WindowsConfiguration\n\n constructor(private readonly packager: WinPackager) {\n this.platformSpecificBuildOptions = packager.platformSpecificBuildOptions\n }\n\n readonly computedPublisherName = new Lazy<Array<string> | null>(async () => {\n const publisherName = this.platformSpecificBuildOptions.signtoolOptions?.publisherName\n if (publisherName === null) {\n return null\n } else if (publisherName != null) {\n return asArray(publisherName)\n }\n\n const certInfo = await this.lazyCertInfo.value\n return certInfo == null ? null : [certInfo.commonName]\n })\n\n readonly lazyCertInfo = new MemoLazy<MemoLazy<WindowsConfiguration, FileCodeSigningInfo | CertificateFromStoreInfo | null>, CertificateInfo | null>(\n () => this.cscInfo,\n async csc => {\n const cscInfo = await csc.value\n if (cscInfo == null) {\n return null\n }\n\n if (\"subject\" in cscInfo) {\n const bloodyMicrosoftSubjectDn = cscInfo.subject\n return {\n commonName: parseDn(bloodyMicrosoftSubjectDn).get(\"CN\")!,\n bloodyMicrosoftSubjectDn,\n }\n }\n\n const cscFile = cscInfo.file\n if (cscFile == null) {\n return null\n }\n return await this.getCertInfo(cscFile, cscInfo.password || \"\")\n }\n )\n\n readonly cscInfo = new MemoLazy<WindowsConfiguration, FileCodeSigningInfo | CertificateFromStoreInfo | null>(\n () => this.platformSpecificBuildOptions,\n platformSpecificBuildOptions => {\n const subjectName = platformSpecificBuildOptions.signtoolOptions?.certificateSubjectName\n const shaType = platformSpecificBuildOptions.signtoolOptions?.certificateSha1\n if (subjectName != null || shaType != null) {\n return this.packager.vm.value\n .then(vm => this.getCertificateFromStoreInfo(platformSpecificBuildOptions, vm))\n .catch((e: any) => {\n // https://github.com/electron-userland/electron-builder/pull/2397\n if (platformSpecificBuildOptions.signtoolOptions?.sign == null) {\n throw e\n } else {\n log.debug({ error: e }, \"getCertificateFromStoreInfo error\")\n return null\n }\n })\n }\n\n const certificateFile = platformSpecificBuildOptions.signtoolOptions?.certificateFile\n if (certificateFile != null) {\n const certificatePassword = this.packager.getCscPassword()\n return Promise.resolve({\n file: certificateFile,\n password: certificatePassword == null ? null : certificatePassword.trim(),\n })\n }\n\n const cscLink = this.packager.getCscLink(\"WIN_CSC_LINK\")\n if (cscLink == null || cscLink === \"\") {\n return Promise.resolve(null)\n }\n\n return (\n importCertificate(cscLink, this.packager.info.tempDirManager, this.packager.projectDir)\n // before then\n .catch((e: any) => {\n if (e instanceof InvalidConfigurationError) {\n throw new InvalidConfigurationError(`Env WIN_CSC_LINK is not correct, cannot resolve: ${e.message}`)\n } else {\n throw e\n }\n })\n .then(path => {\n return {\n file: path,\n password: this.packager.getCscPassword(),\n }\n })\n )\n }\n )\n\n initialize(): Promise<void> {\n return Promise.resolve()\n }\n\n // https://github.com/electron-userland/electron-builder/issues/2108#issuecomment-333200711\n async computePublisherName(target: Target, publisherName: string) {\n if (target instanceof AppXTarget && (await this.cscInfo.value) == null) {\n log.info({ reason: \"Windows Store only build\" }, \"AppX is not signed\")\n return publisherName || \"CN=ms\"\n }\n\n const certInfo = await this.lazyCertInfo.value\n const publisher = publisherName || (certInfo == null ? null : certInfo.bloodyMicrosoftSubjectDn)\n if (publisher == null) {\n throw new Error(\"Internal error: cannot compute subject using certificate info\")\n }\n return publisher\n }\n\n async signFile(options: WindowsSignOptions): Promise<boolean> {\n let hashes = options.options.signtoolOptions?.signingHashAlgorithms\n // msi does not support dual-signing\n if (options.path.endsWith(\".msi\")) {\n hashes = [hashes != null && !hashes.includes(\"sha1\") ? \"sha256\" : \"sha1\"]\n } else if (options.path.endsWith(\".appx\")) {\n hashes = [\"sha256\"]\n } else if (hashes == null) {\n hashes = [\"sha1\", \"sha256\"]\n } else {\n hashes = Array.isArray(hashes) ? hashes : [hashes]\n }\n\n const name = this.packager.appInfo.productName\n const site = await this.packager.appInfo.computePackageUrl()\n\n const customSign = await resolveFunction(this.packager.appInfo.type, options.options.signtoolOptions?.sign, \"sign\", await this.packager.info.getWorkspaceRoot())\n\n const cscInfo = await this.cscInfo.value\n if (cscInfo) {\n let logInfo: any = {\n file: log.filePath(options.path),\n }\n if (\"file\" in cscInfo) {\n logInfo = {\n ...logInfo,\n certificateFile: cscInfo.file,\n }\n } else {\n logInfo = {\n ...logInfo,\n subject: cscInfo.subject,\n thumbprint: cscInfo.thumbprint,\n store: cscInfo.store,\n user: cscInfo.isLocalMachineStore ? \"local machine\" : \"current user\",\n }\n }\n log.info(logInfo, \"signing\")\n } else if (!customSign) {\n log.debug({ signHook: !!customSign, cscInfo }, \"no signing info identified, signing is skipped\")\n return false\n }\n\n const executor = customSign || ((config: CustomWindowsSignTaskConfiguration, packager: WinPackager) => this.doSign(config, packager))\n let isNest = false\n for (const hash of hashes) {\n const taskConfiguration: WindowsSignTaskConfiguration = { ...options, name, site, cscInfo, hash, isNest }\n await Promise.resolve(\n executor(\n {\n ...taskConfiguration,\n computeSignToolArgs: isWin => this.computeSignToolArgs(taskConfiguration, isWin),\n },\n this.packager\n )\n )\n isNest = true\n if (taskConfiguration.resultOutputPath != null) {\n await rename(taskConfiguration.resultOutputPath, options.path)\n }\n }\n\n return true\n }\n\n async getCertInfo(file: string, password: string): Promise<CertificateInfo> {\n const errorMessagePrefix = \"Cannot extract publisher name from code signing certificate. As workaround, set win.publisherName. Error: \"\n try {\n return await readCertInfo(file, password)\n } catch (e: any) {\n throw new InvalidConfigurationError(`${errorMessagePrefix}${e.message || e}`)\n }\n }\n\n // on windows be aware of http://stackoverflow.com/a/32640183/1910191\n computeSignToolArgs(options: WindowsSignTaskConfiguration, isWin: boolean, vm: VmManager = new VmManager()): Array<string> {\n return isWin ? this.computeWindowsSignArgs(options, vm) : this.computeOsslsigncodeArgs(options, vm)\n }\n\n private computeWindowsSignArgs(options: WindowsSignTaskConfiguration, vm: VmManager): Array<string> {\n const inputFile = vm.toVmFile(options.path)\n const args = [\"sign\"]\n\n // Timestamping\n if (process.env.ELECTRON_BUILDER_OFFLINE !== \"true\") {\n const isRfc3161 = options.isNest || options.hash === \"sha256\"\n args.push(isRfc3161 ? \"/tr\" : \"/t\")\n\n const timestampUrl = isRfc3161\n ? options.options.signtoolOptions?.rfc3161TimeStampServer || \"http://timestamp.digicert.com\"\n : options.options.signtoolOptions?.timeStampServer || \"http://timestamp.digicert.com\"\n args.push(timestampUrl)\n }\n\n // Certificate\n this.addCertificateArgs(args, options, vm, true)\n\n // Hash algorithm\n const isLegacyToolset = this.packager.config.toolsets?.winCodeSign === \"0.0.0\" || this.packager.config.toolsets?.winCodeSign == null\n if (isLegacyToolset) {\n // Legacy || v0.0.0: Only add /fd for non-SHA1 (original behavior)\n if (options.hash !== \"sha1\") {\n args.push(\"/fd\", options.hash)\n if (process.env.ELECTRON_BUILDER_OFFLINE !== \"true\") {\n args.push(\"/td\", \"sha256\")\n }\n }\n } else {\n // Modern: Always add /fd (required by new Windows Kits)\n args.push(\"/fd\", options.hash.toLowerCase())\n // Only add /td for RFC3161 timestamps (incompatible with /t)\n if (process.env.ELECTRON_BUILDER_OFFLINE !== \"true\" && (options.isNest || options.hash === \"sha256\")) {\n args.push(\"/td\", \"sha256\")\n }\n }\n\n // Optional parameters\n this.addCommonSigningArgs(args, options, vm, true)\n\n // Windows-specific\n args.push(\"/debug\")\n args.push(inputFile) // Must be last\n\n return args\n }\n\n private computeOsslsigncodeArgs(options: WindowsSignTaskConfiguration, vm: VmManager): Array<string> {\n const inputFile = vm.toVmFile(options.path)\n const outputPath = this.getOutputPath(inputFile, options.hash)\n options.resultOutputPath = outputPath\n\n const args = [\"sign\", \"-in\", inputFile, \"-out\", outputPath]\n\n // Timestamping\n if (process.env.ELECTRON_BUILDER_OFFLINE !== \"true\") {\n const timestampUrl = options.options.signtoolOptions?.timeStampServer || \"http://timestamp.digicert.com\"\n args.push(\"-t\", timestampUrl)\n }\n\n // Certificate\n this.addCertificateArgs(args, options, vm, false)\n\n // Hash algorithm\n args.push(\"-h\", options.hash.toLowerCase())\n\n // Optional parameters\n this.addCommonSigningArgs(args, options, vm, false)\n\n // Proxy support\n const httpsProxy = process.env.HTTPS_PROXY\n if (httpsProxy?.length) {\n args.push(\"-p\", httpsProxy)\n }\n\n return args\n }\n\n private addCertificateArgs(args: Array<string>, options: WindowsSignTaskConfiguration, vm: VmManager, isWin: boolean): void {\n if (options.cscInfo == null) {\n throw new Error(\"No code signing certificate configured. Provide certificateFile, certificateSha1, or certificateSubjectName.\")\n }\n const certificateFile = (options.cscInfo as FileCodeSigningInfo).file\n\n if (certificateFile == null) {\n // Certificate from store (Windows only)\n if (!isWin) {\n throw new Error(\"certificateSha1/certificateSubjectName supported only on Windows\")\n }\n\n const cscInfo = options.cscInfo as CertificateFromStoreInfo\n args.push(\"/sha1\", cscInfo.thumbprint)\n args.push(\"/s\", cscInfo.store)\n if (cscInfo.isLocalMachineStore) {\n args.push(\"/sm\")\n }\n } else {\n // Certificate file\n const certExtension = path.extname(certificateFile)\n if (certExtension === \".p12\" || certExtension === \".pfx\") {\n args.push(isWin ? \"/f\" : \"-pkcs12\", vm.toVmFile(certificateFile))\n } else {\n throw new Error(`Please specify pkcs12 (.p12/.pfx) file, ${certificateFile} is not correct`)\n }\n }\n }\n\n private addCommonSigningArgs(args: Array<string>, options: WindowsSignTaskConfiguration, vm: VmManager, isWin: boolean): void {\n if (options.name) {\n args.push(isWin ? \"/d\" : \"-n\", options.name)\n }\n\n if (options.site) {\n args.push(isWin ? \"/du\" : \"-i\", options.site)\n }\n\n if (options.isNest) {\n args.push(isWin ? \"/as\" : \"-nest\")\n }\n\n const password = (options.cscInfo as FileCodeSigningInfo)?.password\n if (password) {\n args.push(isWin ? \"/p\" : \"-pass\", password)\n }\n\n const additionalCert = options.options.signtoolOptions?.additionalCertificateFile\n if (additionalCert) {\n args.push(isWin ? \"/ac\" : \"-ac\", vm.toVmFile(additionalCert))\n }\n }\n\n getOutputPath(inputPath: string, hash: string) {\n const extension = path.extname(inputPath)\n return path.join(path.dirname(inputPath), `${path.basename(inputPath, extension)}-signed-${hash}${extension}`)\n }\n\n async getCertificateFromStoreInfo(options: WindowsConfiguration, vm: VmManager): Promise<CertificateFromStoreInfo> {\n const certificateSubjectName = options.signtoolOptions?.certificateSubjectName\n const certificateSha1 = options.signtoolOptions?.certificateSha1?.toUpperCase()\n\n const ps = await vm.powershellCommand.value\n const rawResult = await vm.exec(ps, [\n \"-NoProfile\",\n \"-NonInteractive\",\n \"-Command\",\n \"Get-ChildItem -Recurse Cert: -CodeSigningCert | Select-Object -Property Subject,PSParentPath,Thumbprint | ConvertTo-Json -Compress\",\n ])\n const certList = rawResult.length === 0 ? [] : asArray<CertInfo>(JSON.parse(rawResult))\n for (const certInfo of certList) {\n if (\n (certificateSubjectName != null && !certInfo.Subject.includes(certificateSubjectName)) ||\n (certificateSha1 != null && certInfo.Thumbprint.toUpperCase() !== certificateSha1)\n ) {\n continue\n }\n\n const parentPath = certInfo.PSParentPath\n const store = parentPath.substring(parentPath.lastIndexOf(\"\\\\\") + 1)\n log.debug({ store, PSParentPath: parentPath }, \"auto-detect certificate store\")\n // https://github.com/electron-userland/electron-builder/issues/1717\n const isLocalMachineStore = parentPath.includes(\"Certificate::LocalMachine\")\n log.debug(null, \"auto-detect using of LocalMachine store\")\n return {\n thumbprint: certInfo.Thumbprint,\n subject: certInfo.Subject,\n store,\n isLocalMachineStore,\n }\n }\n\n throw new Error(`Cannot find certificate ${certificateSubjectName || certificateSha1}, all certs: ${rawResult}`)\n }\n\n async getToolPath(isWin = process.platform === \"win32\"): Promise<ToolInfo> {\n return getSignToolPath(this.packager.config.toolsets?.winCodeSign, isWin)\n }\n\n async doSign(configuration: CustomWindowsSignTaskConfiguration, packager: WinPackager) {\n // https://github.com/electron-userland/electron-builder/pull/1944\n const timeout = parseInt(process.env.SIGNTOOL_TIMEOUT as any, 10) || 10 * 60 * 1000\n // decide runtime argument by cases\n let args: Array<string>\n let vm: VmManager\n const useVmIfNotOnWin = configuration.path.endsWith(\".appx\") || !(\"file\" in configuration.cscInfo!) /* certificateSubjectName and other such options */\n const isWin = process.platform === \"win32\" || useVmIfNotOnWin\n const toolInfo = await getSignToolPath(this.packager.config.toolsets?.winCodeSign, isWin)\n const tool = toolInfo.path\n if (useVmIfNotOnWin) {\n vm = await packager.vm.value\n args = this.computeSignToolArgs(configuration, isWin, vm)\n } else {\n vm = new VmManager()\n args = configuration.computeSignToolArgs(isWin)\n }\n\n await retry(() => vm.exec(tool, args, { timeout, env: { ...process.env, ...(toolInfo.env || {}) } }), {\n retries: 2,\n interval: 15000,\n backoff: 10000,\n shouldRetry: (e: any) => {\n if (\n e.message.includes(\"The file is being used by another process\") ||\n e.message.includes(\"The specified timestamp server either could not be reached\") ||\n e.message.includes(\"No certificates were found that met all the given criteria.\")\n ) {\n log.warn(`Attempt to code sign failed, another attempt will be made in 15 seconds: ${e.message}`)\n return true\n }\n return false\n },\n })\n }\n}\n"]}
1
+ {"version":3,"file":"windowsSignToolManager.js","sourceRoot":"","sources":["../../src/codeSign/windowsSignToolManager.ts"],"names":[],"mappings":";;;AAAA,+CAA6E;AAC7E,+DAAwD;AACxD,uCAAiC;AACjC,uCAA+B;AAC/B,6BAA4B;AAG5B,sDAA8C;AAC9C,iDAAqD;AAErD,6CAAiD;AACjD,yCAAyC;AACzC,iCAAoC;AAEpC,yCAA8C;AAgD9C,MAAa,sBAAsB;IAGjC,YAA6B,QAAqB;QAArB,aAAQ,GAAR,QAAQ,CAAa;QAIzC,0BAAqB,GAAG,IA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AAC,KAAK,CAAC,CAAA;QACjD,CAAC;QAED,MAAM,IAAA,oBAAK,EAAC,GAAG,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,QAAQ,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE;YACpG,OAAO,EAAE,CAAC;YACV,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE,KAAK;YACd,WAAW,EAAE,CAAC,CAAM,EAAE,EAAE;gBACtB,IACE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,2CAA2C,CAAC;oBAC/D,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,4DAA4D,CAAC;oBAChF,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,6DAA6D,CAAC,EACjF,CAAC;oBACD,kBAAG,CAAC,IAAI,CAAC,4EAA4E,CAAC,CAAC,OAAO,EAAE,CAAC,CAAA;oBACjG,OAAO,IAAI,CAAA;gBACb,CAAC;gBACD,OAAO,KAAK,CAAA;YACd,CAAC;SACF,CAAC,CAAA;IACJ,CAAC;CACF;AAzZD,wDAyZC","sourcesContent":["import { asArray, InvalidConfigurationError, log, retry } from \"builder-util\"\nimport { MemoLazy, parseDn } from \"builder-util-runtime\"\nimport { rename } from \"fs-extra\"\nimport { Lazy } from \"lazy-val\"\nimport * as path from \"path\"\nimport { Target } from \"../core\"\nimport { WindowsConfiguration } from \"../options/winOptions\"\nimport AppXTarget from \"../targets/AppxTarget\"\nimport { getSignToolPath } from \"../toolsets/windows\"\nimport { ToolInfo } from \"../util/bundledTool\"\nimport { resolveFunction } from \"../util/resolve\"\nimport { readCertInfo } from \"./certInfo\"\nimport { VmManager } from \"../vm/vm\"\nimport { WinPackager } from \"../winPackager\"\nimport { importCertificate } from \"./codesign\"\nimport { SignManager } from \"./signManager\"\nimport { WindowsSignOptions } from \"./windowsCodeSign\"\n\nexport type CustomWindowsSign = (configuration: CustomWindowsSignTaskConfiguration, packager?: WinPackager) => Promise<any>\n\nexport interface WindowsSignToolOptions extends WindowsSignOptions {\n readonly name: string\n readonly site: string | null\n}\n\nexport interface FileCodeSigningInfo {\n readonly file: string\n readonly password: string | null\n}\n\nexport interface WindowsSignTaskConfiguration extends WindowsSignToolOptions {\n readonly cscInfo: FileCodeSigningInfo | CertificateFromStoreInfo | null\n\n // set if output path differs from input (e.g. osslsigncode cannot sign file in-place)\n resultOutputPath?: string\n\n hash: string\n isNest: boolean\n}\n\nexport interface CustomWindowsSignTaskConfiguration extends WindowsSignTaskConfiguration {\n computeSignToolArgs(isWin: boolean): Array<string>\n}\n\nexport interface CertificateInfo {\n readonly commonName: string\n readonly bloodyMicrosoftSubjectDn: string\n}\n\nexport interface CertificateFromStoreInfo {\n thumbprint: string\n subject: string\n store: string\n isLocalMachineStore: boolean\n}\n\ninterface CertInfo {\n Subject: string\n Thumbprint: string\n PSParentPath: string\n}\n\nexport class WindowsSignToolManager implements SignManager {\n private readonly platformSpecificBuildOptions: WindowsConfiguration\n\n constructor(private readonly packager: WinPackager) {\n this.platformSpecificBuildOptions = packager.platformSpecificBuildOptions\n }\n\n readonly computedPublisherName = new Lazy<Array<string> | null>(async () => {\n const publisherName = this.platformSpecificBuildOptions.signtoolOptions?.publisherName\n if (publisherName === null) {\n return null\n } else if (publisherName != null) {\n return asArray(publisherName)\n }\n\n const certInfo = await this.lazyCertInfo.value\n return certInfo == null ? null : [certInfo.commonName]\n })\n\n readonly lazyCertInfo = new MemoLazy<MemoLazy<WindowsConfiguration, FileCodeSigningInfo | CertificateFromStoreInfo | null>, CertificateInfo | null>(\n () => this.cscInfo,\n async csc => {\n const cscInfo = await csc.value\n if (cscInfo == null) {\n return null\n }\n\n if (\"subject\" in cscInfo) {\n const bloodyMicrosoftSubjectDn = cscInfo.subject\n return {\n commonName: parseDn(bloodyMicrosoftSubjectDn).get(\"CN\")!,\n bloodyMicrosoftSubjectDn,\n }\n }\n\n const cscFile = cscInfo.file\n if (cscFile == null) {\n return null\n }\n return await this.getCertInfo(cscFile, cscInfo.password || \"\")\n }\n )\n\n readonly cscInfo = new MemoLazy<WindowsConfiguration, FileCodeSigningInfo | CertificateFromStoreInfo | null>(\n () => this.platformSpecificBuildOptions,\n platformSpecificBuildOptions => {\n const subjectName = platformSpecificBuildOptions.signtoolOptions?.certificateSubjectName\n const shaType = platformSpecificBuildOptions.signtoolOptions?.certificateSha1\n if (subjectName != null || shaType != null) {\n return this.packager.vm.value\n .then(vm => this.getCertificateFromStoreInfo(platformSpecificBuildOptions, vm))\n .catch((e: any) => {\n // https://github.com/electron-userland/electron-builder/pull/2397\n if (platformSpecificBuildOptions.signtoolOptions?.sign == null) {\n throw e\n } else {\n log.debug({ error: e }, \"getCertificateFromStoreInfo error\")\n return null\n }\n })\n }\n\n const certificateFile = platformSpecificBuildOptions.signtoolOptions?.certificateFile\n if (certificateFile != null) {\n const certificatePassword = this.packager.getCscPassword()\n return Promise.resolve({\n file: certificateFile,\n password: certificatePassword == null ? null : certificatePassword.trim(),\n })\n }\n\n const cscLink = this.packager.getCscLink(\"WIN_CSC_LINK\")\n if (cscLink == null || cscLink === \"\") {\n return Promise.resolve(null)\n }\n\n return (\n importCertificate(cscLink, this.packager.info.tempDirManager, this.packager.projectDir)\n // before then\n .catch((e: any) => {\n if (e instanceof InvalidConfigurationError) {\n throw new InvalidConfigurationError(`Env WIN_CSC_LINK is not correct, cannot resolve: ${e.message}`)\n } else {\n throw e\n }\n })\n .then(path => {\n return {\n file: path,\n password: this.packager.getCscPassword(),\n }\n })\n )\n }\n )\n\n initialize(): Promise<void> {\n return Promise.resolve()\n }\n\n // https://github.com/electron-userland/electron-builder/issues/2108#issuecomment-333200711\n async computePublisherName(target: Target, publisherName: string) {\n if (target instanceof AppXTarget && (await this.cscInfo.value) == null) {\n log.info({ reason: \"Windows Store only build\" }, \"AppX is not signed\")\n return publisherName || \"CN=ms\"\n }\n\n const certInfo = await this.lazyCertInfo.value\n const publisher = publisherName || (certInfo == null ? null : certInfo.bloodyMicrosoftSubjectDn)\n if (publisher == null) {\n throw new Error(\"Internal error: cannot compute subject using certificate info\")\n }\n return publisher\n }\n\n async signFile(options: WindowsSignOptions): Promise<boolean> {\n let hashes = options.options.signtoolOptions?.signingHashAlgorithms\n // msi does not support dual-signing\n if (options.path.endsWith(\".msi\")) {\n hashes = [hashes != null && !hashes.includes(\"sha1\") ? \"sha256\" : \"sha1\"]\n } else if (options.path.endsWith(\".appx\")) {\n hashes = [\"sha256\"]\n } else if (hashes == null) {\n hashes = [\"sha1\", \"sha256\"]\n } else {\n hashes = Array.isArray(hashes) ? hashes : [hashes]\n }\n\n const name = this.packager.appInfo.productName\n const site = await this.packager.appInfo.computePackageUrl()\n\n const customSign = await resolveFunction(this.packager.appInfo.type, options.options.signtoolOptions?.sign, \"sign\", await this.packager.info.getWorkspaceRoot())\n\n const cscInfo = await this.cscInfo.value\n if (cscInfo) {\n if (!customSign) {\n log.info({ path: log.filePath(options.path) }, \"signing with signtool.exe\")\n }\n let logInfo: any = {\n file: log.filePath(options.path),\n }\n if (\"file\" in cscInfo) {\n logInfo = {\n ...logInfo,\n certificateFile: cscInfo.file,\n }\n } else {\n logInfo = {\n ...logInfo,\n subject: cscInfo.subject,\n thumbprint: cscInfo.thumbprint,\n store: cscInfo.store,\n user: cscInfo.isLocalMachineStore ? \"local machine\" : \"current user\",\n }\n }\n log.info(logInfo, \"signing\")\n } else if (!customSign) {\n log.info({ path: log.filePath(options.path) }, \"no code signing certificate configured, signing is skipped\")\n return false\n }\n\n const executor = customSign || ((config: CustomWindowsSignTaskConfiguration, packager: WinPackager) => this.doSign(config, packager))\n let isNest = false\n for (const hash of hashes) {\n const taskConfiguration: WindowsSignTaskConfiguration = { ...options, name, site, cscInfo, hash, isNest }\n await Promise.resolve(\n executor(\n {\n ...taskConfiguration,\n computeSignToolArgs: isWin => this.computeSignToolArgs(taskConfiguration, isWin),\n },\n this.packager\n )\n )\n isNest = true\n if (taskConfiguration.resultOutputPath != null) {\n await rename(taskConfiguration.resultOutputPath, options.path)\n }\n }\n\n return true\n }\n\n async getCertInfo(file: string, password: string): Promise<CertificateInfo> {\n const errorMessagePrefix = \"Cannot extract publisher name from code signing certificate. As workaround, set win.publisherName. Error: \"\n try {\n return await readCertInfo(file, password)\n } catch (e: any) {\n throw new InvalidConfigurationError(`${errorMessagePrefix}${e.message || e}`)\n }\n }\n\n // on windows be aware of http://stackoverflow.com/a/32640183/1910191\n computeSignToolArgs(options: WindowsSignTaskConfiguration, isWin: boolean, vm: VmManager = new VmManager()): Array<string> {\n return isWin ? this.computeWindowsSignArgs(options, vm) : this.computeOsslsigncodeArgs(options, vm)\n }\n\n private computeWindowsSignArgs(options: WindowsSignTaskConfiguration, vm: VmManager): Array<string> {\n const inputFile = vm.toVmFile(options.path)\n const args = [\"sign\"]\n\n // Timestamping\n if (process.env.ELECTRON_BUILDER_OFFLINE !== \"true\") {\n const isRfc3161 = options.isNest || options.hash === \"sha256\"\n args.push(isRfc3161 ? \"/tr\" : \"/t\")\n\n const timestampUrl = isRfc3161\n ? options.options.signtoolOptions?.rfc3161TimeStampServer || \"http://timestamp.digicert.com\"\n : options.options.signtoolOptions?.timeStampServer || \"http://timestamp.digicert.com\"\n args.push(timestampUrl)\n }\n\n // Certificate\n this.addCertificateArgs(args, options, vm, true)\n\n // Hash algorithm\n const isLegacyToolset = this.packager.config.toolsets?.winCodeSign === \"0.0.0\" || this.packager.config.toolsets?.winCodeSign == null\n if (isLegacyToolset) {\n // Legacy || v0.0.0: Only add /fd for non-SHA1 (original behavior)\n if (options.hash !== \"sha1\") {\n args.push(\"/fd\", options.hash)\n if (process.env.ELECTRON_BUILDER_OFFLINE !== \"true\") {\n args.push(\"/td\", \"sha256\")\n }\n }\n } else {\n // Modern: Always add /fd (required by new Windows Kits)\n args.push(\"/fd\", options.hash.toLowerCase())\n // Only add /td for RFC3161 timestamps (incompatible with /t)\n if (process.env.ELECTRON_BUILDER_OFFLINE !== \"true\" && (options.isNest || options.hash === \"sha256\")) {\n args.push(\"/td\", \"sha256\")\n }\n }\n\n // Optional parameters\n this.addCommonSigningArgs(args, options, vm, true)\n\n // Windows-specific\n args.push(\"/debug\")\n args.push(inputFile) // Must be last\n\n return args\n }\n\n private computeOsslsigncodeArgs(options: WindowsSignTaskConfiguration, vm: VmManager): Array<string> {\n const inputFile = vm.toVmFile(options.path)\n const outputPath = this.getOutputPath(inputFile, options.hash)\n options.resultOutputPath = outputPath\n\n const args = [\"sign\", \"-in\", inputFile, \"-out\", outputPath]\n\n // Timestamping\n if (process.env.ELECTRON_BUILDER_OFFLINE !== \"true\") {\n const timestampUrl = options.options.signtoolOptions?.timeStampServer || \"http://timestamp.digicert.com\"\n args.push(\"-t\", timestampUrl)\n }\n\n // Certificate\n this.addCertificateArgs(args, options, vm, false)\n\n // Hash algorithm\n args.push(\"-h\", options.hash.toLowerCase())\n\n // Optional parameters\n this.addCommonSigningArgs(args, options, vm, false)\n\n // Proxy support\n const httpsProxy = process.env.HTTPS_PROXY\n if (httpsProxy?.length) {\n args.push(\"-p\", httpsProxy)\n }\n\n return args\n }\n\n private addCertificateArgs(args: Array<string>, options: WindowsSignTaskConfiguration, vm: VmManager, isWin: boolean): void {\n if (options.cscInfo == null) {\n throw new Error(\"No code signing certificate configured. Provide certificateFile, certificateSha1, or certificateSubjectName.\")\n }\n const certificateFile = (options.cscInfo as FileCodeSigningInfo).file\n\n if (certificateFile == null) {\n // Certificate from store (Windows only)\n if (!isWin) {\n throw new Error(\"certificateSha1/certificateSubjectName supported only on Windows\")\n }\n\n const cscInfo = options.cscInfo as CertificateFromStoreInfo\n args.push(\"/sha1\", cscInfo.thumbprint)\n args.push(\"/s\", cscInfo.store)\n if (cscInfo.isLocalMachineStore) {\n args.push(\"/sm\")\n }\n } else {\n // Certificate file\n const certExtension = path.extname(certificateFile)\n if (certExtension === \".p12\" || certExtension === \".pfx\") {\n args.push(isWin ? \"/f\" : \"-pkcs12\", vm.toVmFile(certificateFile))\n } else {\n throw new Error(`Please specify pkcs12 (.p12/.pfx) file, ${certificateFile} is not correct`)\n }\n }\n }\n\n private addCommonSigningArgs(args: Array<string>, options: WindowsSignTaskConfiguration, vm: VmManager, isWin: boolean): void {\n if (options.name) {\n args.push(isWin ? \"/d\" : \"-n\", options.name)\n }\n\n if (options.site) {\n args.push(isWin ? \"/du\" : \"-i\", options.site)\n }\n\n if (options.isNest) {\n args.push(isWin ? \"/as\" : \"-nest\")\n }\n\n const password = (options.cscInfo as FileCodeSigningInfo)?.password\n if (password) {\n args.push(isWin ? \"/p\" : \"-pass\", password)\n }\n\n const additionalCert = options.options.signtoolOptions?.additionalCertificateFile\n if (additionalCert) {\n args.push(isWin ? \"/ac\" : \"-ac\", vm.toVmFile(additionalCert))\n }\n }\n\n getOutputPath(inputPath: string, hash: string) {\n const extension = path.extname(inputPath)\n return path.join(path.dirname(inputPath), `${path.basename(inputPath, extension)}-signed-${hash}${extension}`)\n }\n\n async getCertificateFromStoreInfo(options: WindowsConfiguration, vm: VmManager): Promise<CertificateFromStoreInfo> {\n const certificateSubjectName = options.signtoolOptions?.certificateSubjectName\n const certificateSha1 = options.signtoolOptions?.certificateSha1?.toUpperCase()\n\n const ps = await vm.powershellCommand.value\n const rawResult = await vm.exec(ps, [\n \"-NoProfile\",\n \"-NonInteractive\",\n \"-Command\",\n \"Get-ChildItem -Recurse Cert: -CodeSigningCert | Select-Object -Property Subject,PSParentPath,Thumbprint | ConvertTo-Json -Compress\",\n ])\n const certList = rawResult.length === 0 ? [] : asArray<CertInfo>(JSON.parse(rawResult))\n for (const certInfo of certList) {\n if (\n (certificateSubjectName != null && !certInfo.Subject.includes(certificateSubjectName)) ||\n (certificateSha1 != null && certInfo.Thumbprint.toUpperCase() !== certificateSha1)\n ) {\n continue\n }\n\n const parentPath = certInfo.PSParentPath\n const store = parentPath.substring(parentPath.lastIndexOf(\"\\\\\") + 1)\n log.debug({ store, PSParentPath: parentPath }, \"auto-detect certificate store\")\n // https://github.com/electron-userland/electron-builder/issues/1717\n const isLocalMachineStore = parentPath.includes(\"Certificate::LocalMachine\")\n log.debug(null, \"auto-detect using of LocalMachine store\")\n return {\n thumbprint: certInfo.Thumbprint,\n subject: certInfo.Subject,\n store,\n isLocalMachineStore,\n }\n }\n\n throw new Error(`Cannot find certificate ${certificateSubjectName || certificateSha1}, all certs: ${rawResult}`)\n }\n\n async getToolPath(isWin = process.platform === \"win32\"): Promise<ToolInfo> {\n return getSignToolPath(this.packager.config.toolsets?.winCodeSign, isWin)\n }\n\n async doSign(configuration: CustomWindowsSignTaskConfiguration, packager: WinPackager) {\n // https://github.com/electron-userland/electron-builder/pull/1944\n const timeout = parseInt(process.env.SIGNTOOL_TIMEOUT as any, 10) || 10 * 60 * 1000\n // decide runtime argument by cases\n let args: Array<string>\n let vm: VmManager\n const useVmIfNotOnWin = configuration.path.endsWith(\".appx\") || !(\"file\" in configuration.cscInfo!) /* certificateSubjectName and other such options */\n const isWin = process.platform === \"win32\" || useVmIfNotOnWin\n const toolInfo = await getSignToolPath(this.packager.config.toolsets?.winCodeSign, isWin)\n const tool = toolInfo.path\n if (useVmIfNotOnWin) {\n vm = await packager.vm.value\n args = this.computeSignToolArgs(configuration, isWin, vm)\n } else {\n vm = new VmManager()\n args = configuration.computeSignToolArgs(isWin)\n }\n\n await retry(() => vm.exec(tool, args, { timeout, env: { ...process.env, ...(toolInfo.env || {}) } }), {\n retries: 2,\n interval: 15000,\n backoff: 10000,\n shouldRetry: (e: any) => {\n if (\n e.message.includes(\"The file is being used by another process\") ||\n e.message.includes(\"The specified timestamp server either could not be reached\") ||\n e.message.includes(\"No certificates were found that met all the given criteria.\")\n ) {\n log.warn(`Attempt to code sign failed, another attempt will be made in 15 seconds: ${e.message}`)\n return true\n }\n return false\n },\n })\n }\n}\n"]}
@@ -188,6 +188,31 @@ export interface CommonConfiguration {
188
188
  * @default sequential
189
189
  */
190
190
  readonly nativeRebuilder?: "legacy" | "sequential" | "parallel" | null;
191
+ /**
192
+ * Whether production dependencies that cannot be resolved during node-module collection are
193
+ * allowed — i.e. whether the build should continue with a warning instead of failing.
194
+ *
195
+ * During collection every production dependency must resolve to an installed package on disk. A
196
+ * dependency that does not resolve (`cannot find path for dependency` / `dependency not found on
197
+ * disk`) is not bundled, which typically breaks the packaged app at runtime with
198
+ * `MODULE_NOT_FOUND`.
199
+ *
200
+ * - `true` (or omitted — the v26 default): missing production dependencies are only logged as
201
+ * warnings, keeping the historical behavior of the stable 26.x line. (electron-builder 27+
202
+ * defaults to `false` and fails the build instead.)
203
+ * - `false` or `null`: the build fails after dependency collection completes, reporting the
204
+ * **complete** list of missing production dependencies at once.
205
+ * - `string[]`: the listed dependency names are allowed to be missing; any other missing
206
+ * production dependency fails the build. Entries match the package name of the reported
207
+ * `name@version` entry (e.g. `some-native-module`, `@scope/pkg`), or an exact `name@version`
208
+ * string to allow only that resolved version to be missing.
209
+ *
210
+ * Missing *optional* dependencies (declared in `optionalDependencies`, e.g. `fsevents` on
211
+ * Linux/Windows, or platform-specific packages) are always allowed and never fail the build.
212
+ *
213
+ * @default true
214
+ */
215
+ readonly allowMissingDependencies?: boolean | Array<string> | null;
191
216
  /**
192
217
  * The build number. Maps to the `--iteration` flag for builds using FPM on Linux.
193
218
  * If not defined, then it will fallback to `BUILD_NUMBER` or `TRAVIS_BUILD_NUMBER` or `APPVEYOR_BUILD_NUMBER` or `CIRCLE_BUILD_NUM` or `BUILD_BUILDNUMBER` or `CI_PIPELINE_IID` env.
@@ -247,6 +272,13 @@ export interface Configuration extends CommonConfiguration, PlatformSpecificBuil
247
272
  /**
248
273
  * The [electron-download](https://github.com/electron-userland/electron-download#usage) options. (legacy)
249
274
  * Alternatively, you can use [electron/get](https://github.com/electron/get#usage) options.
275
+ *
276
+ * `checksums` (a map of artifact file name → SHA-256 hex) makes checksum validation fully offline —
277
+ * without it, `@electron/get` fetches `SHASUMS256.txt` from the network on every build, even when the
278
+ * artifact itself is already cached. When `checksums` is not configured, electron-builder automatically
279
+ * picks up a locally seeded `SHASUMS256.txt-<version>` (or `SHASUMS256.txt`) file at the root of the
280
+ * Electron cache directory. See the
281
+ * [air-gapped / offline builds guide](https://www.electron.build/tutorials/offline-air-gapped-builds).
250
282
  */
251
283
  readonly electronDownload?: ElectronDownloadOptions | ElectronGetOptions | null;
252
284
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"configuration.js","sourceRoot":"","sources":["../src/configuration.ts"],"names":[],"mappings":"","sourcesContent":["import { Arch } from \"builder-util\"\nimport { BeforeBuildContext, Target } from \"./core\"\nimport { ElectronBrandingOptions } from \"./electron/ElectronFramework\"\nimport { PrepareApplicationStageDirectoryOptions } from \"./Framework\"\nimport { AppXOptions } from \"./options/AppXOptions\"\nimport { AppImageOptions, DebOptions, FlatpakOptions, LinuxConfiguration, LinuxTargetSpecificOptions, PacmanOptions, RpmOptions } from \"./options/linuxOptions\"\nimport { DmgOptions, MacConfiguration, MasConfiguration } from \"./options/macOptions\"\nimport { MsiOptions } from \"./options/MsiOptions\"\nimport { MsiWrappedOptions } from \"./options/MsiWrappedOptions\"\nimport { PkgOptions } from \"./options/pkgOptions\"\nimport { PlatformSpecificBuildOptions } from \"./options/PlatformSpecificBuildOptions\"\nimport { SnapcraftOptions, SnapOptions } from \"./options/SnapOptions\"\nimport { SquirrelWindowsOptions } from \"./options/SquirrelWindowsOptions\"\nimport { WindowsConfiguration } from \"./options/winOptions\"\nimport { BuildResult } from \"./packager\"\nimport { ArtifactBuildStarted, ArtifactCreated } from \"./packagerApi\"\nimport { PlatformPackager } from \"./platformPackager\"\nimport { NsisOptions, NsisWebOptions, PortableOptions } from \"./targets/nsis/nsisOptions\"\nimport { ElectronDownloadOptions, ElectronGetOptions } from \"./util/electronGet\"\n\n// duplicate appId here because it is important\n/**\n * Configuration Options\n */\nexport interface CommonConfiguration {\n /**\n * The application id. Used as [CFBundleIdentifier](https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/20001431-102070) for MacOS and as\n * [Application User Model ID](https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx) for Windows (NSIS target only, Squirrel.Windows not supported). It is strongly recommended that an explicit ID is set.\n * @default com.electron.${name}\n */\n readonly appId?: string | null\n\n /**\n * As [name](#metadata), but allows you to specify a product name for your executable which contains spaces and other special characters not allowed in the [name property](https://docs.npmjs.com/files/package.json#name).\n * If not specified inside of the `build` configuration, `productName` property defined at the top level of `package.json` is used. If not specified at the top level of `package.json`, [name property](https://docs.npmjs.com/files/package.json#name) is used.\n */\n readonly productName?: string | null\n\n /**\n * The human-readable copyright line for the app.\n * @default Copyright © year ${author}\n */\n readonly copyright?: string | null\n\n /**\n * Directories for build resources\n */\n readonly directories?: MetadataDirectories | null\n\n /**\n * Configuration of toolsets utilized by electron-builder\n */\n readonly toolsets?: ToolsetConfig | null\n\n /**\n * Options related to how build macOS targets.\n */\n readonly mac?: MacConfiguration | null\n /**\n * MAS (Mac Application Store) options.\n */\n readonly mas?: MasConfiguration | null\n /**\n * MAS (Mac Application Store) development options (`mas-dev` target).\n */\n readonly masDev?: MasConfiguration | null\n /**\n * macOS DMG options.\n */\n readonly dmg?: DmgOptions | null\n /**\n * macOS PKG options.\n */\n readonly pkg?: PkgOptions | null\n\n /**\n * Options related to how build Windows targets.\n */\n readonly win?: WindowsConfiguration | null\n /** NSIS installer options. */\n readonly nsis?: NsisOptions | null\n /** NSIS web installer options (downloads app package at install time). */\n readonly nsisWeb?: NsisWebOptions | null\n /** Portable executable options (no installation required). */\n readonly portable?: PortableOptions | null\n /** Windows Store (AppX) package options. */\n readonly appx?: AppXOptions | null\n /**\n * MSI package options.\n */\n readonly msi?: MsiOptions | null\n /**\n * MSI-wrapped installer options.\n */\n readonly msiWrapped?: MsiWrappedOptions | null\n /**\n * Squirrel.Windows installer options. Requires the `electron-builder-squirrel-windows` dependency.\n */\n readonly squirrelWindows?: SquirrelWindowsOptions | null\n /**\n * General Linux build options shared across all Linux targets (icon, category, desktop entry,\n * executable name, etc.). Target-specific compression and packaging options live in the\n * per-format interfaces (`DebOptions`, `RpmOptions`, `PacmanOptions`, etc.).\n */\n readonly linux?: LinuxConfiguration | null\n /**\n * Debian package options. Targets Debian, Ubuntu, and Debian-based distributions.\n * Produces a `.deb` archive installable via `dpkg -i` or `apt install`.\n */\n readonly deb?: DebOptions | null\n /**\n * Flat snap configuration targeting core22 and older snap bases.\n *\n * @deprecated Use `snapcraft` instead — it supersedes `snap` when both are present and supports\n * all snap bases including core24. `snap` will be removed in a future major release.\n * See {@link SnapOptions} for available properties.\n */\n readonly snap?: SnapOptions | null\n /**\n * Snapcraft configuration. Prefer this over the deprecated `snap` field.\n *\n * Selects the snapcraft base and provides per-core options:\n * - `base: \"core18\" | \"core20\" | \"core22\"` — legacy builds; accepts the same options as `snap`\n * - `base: \"core24\"` — modern builds with the GNOME extension (recommended for new apps, requires Electron 25+)\n * - `base: \"custom\"` — pass an existing `snapcraft.yaml` through unchanged; no plugs, extensions,\n * or desktop files are injected\n *\n * When both `snapcraft` and `snap` are set, `snapcraft` takes precedence.\n *\n * @example\n * ```json\n * { \"snapcraft\": { \"base\": \"core24\", \"core24\": { \"useLXD\": true } } }\n * ```\n *\n * See {@link SnapcraftOptions} for all available properties.\n */\n readonly snapcraft?: SnapcraftOptions | null\n /**\n * AppImage options. AppImage is a portable application format that bundles the app\n * and its dependencies into a single self-contained executable that runs on most\n * Linux distributions without installation.\n */\n readonly appImage?: AppImageOptions | null\n /**\n * Flatpak options. Flatpak is a sandboxed application distribution format for Linux\n * that runs in a controlled environment and is distributed via [Flathub](https://flathub.org/)\n * or other Flatpak repositories.\n */\n readonly flatpak?: FlatpakOptions | null\n /**\n * Pacman package options. Targets Arch Linux and Arch-based distributions\n * (Manjaro, EndeavourOS, etc.). Produces a `.pacman` archive installable via `pacman -U`.\n */\n readonly pacman?: PacmanOptions | null\n /**\n * RPM package options. Targets Fedora, Red Hat Enterprise Linux, SUSE, and related\n * distributions. Produces a `.rpm` archive installable via `rpm` or `dnf`.\n */\n readonly rpm?: RpmOptions | null\n /**\n * FreeBSD package options. Produces a `.pkg` archive for the FreeBSD `pkg` package manager.\n */\n readonly freebsd?: LinuxTargetSpecificOptions | null\n /**\n * Solaris IPS package options. Produces a `.p5p` archive for the Solaris Image Packaging\n * System (`pkg`).\n */\n readonly p5p?: LinuxTargetSpecificOptions | null\n /**\n * Alpine Linux APK package options. Produces an `.apk` archive installable via `apk add`.\n */\n readonly apk?: LinuxTargetSpecificOptions | null\n\n /**\n * Whether to build the application native dependencies from source.\n * @default false\n */\n buildDependenciesFromSource?: boolean\n /**\n * Whether to execute `node-gyp rebuild` before starting to package the app.\n *\n * Don't [use](https://github.com/electron-userland/electron-builder/issues/683#issuecomment-241214075) [npm](http://electron.atom.io/docs/tutorial/using-native-node-modules/#using-npm) (neither `.npmrc`) for configuring electron headers. Use `electron-builder node-gyp-rebuild` instead.\n * @default false\n */\n readonly nodeGypRebuild?: boolean\n /**\n * Additional command line arguments to use when installing app native deps.\n */\n readonly npmArgs?: Array<string> | string | null\n /**\n * Whether to [rebuild](https://docs.npmjs.com/cli/rebuild) native dependencies before starting to package the app.\n * @default true\n */\n readonly npmRebuild?: boolean\n /**\n * Use `legacy` app-builder binary for installing native dependencies, or `@electron/rebuild` in `sequential` or `parallel` compilation modes.\n * @default sequential\n */\n readonly nativeRebuilder?: \"legacy\" | \"sequential\" | \"parallel\" | null\n\n /**\n * The build number. Maps to the `--iteration` flag for builds using FPM on Linux.\n * If not defined, then it will fallback to `BUILD_NUMBER` or `TRAVIS_BUILD_NUMBER` or `APPVEYOR_BUILD_NUMBER` or `CIRCLE_BUILD_NUM` or `BUILD_BUILDNUMBER` or `CI_PIPELINE_IID` env.\n */\n readonly buildNumber?: string | null\n\n /**\n * The build version. Maps to the `CFBundleVersion` on macOS, and `FileVersion` metadata property on Windows. Defaults to the `version`.\n * If `buildVersion` is not defined and `buildNumber` (or one of the `buildNumber` envs) is defined, it will be used as a build version (`version.buildNumber`).\n */\n readonly buildVersion?: string | null\n\n /**\n * Whether to download the alternate FFmpeg library from Electron's release assets and replace the default FFmpeg library prior to signing\n */\n readonly downloadAlternateFFmpeg?: boolean\n\n /**\n * Inject properties to `package.json`.\n */\n readonly extraMetadata?: any\n\n /**\n * Whether to fail if the application is not signed (to prevent unsigned app if code signing configuration is not correct).\n * @default false\n */\n readonly forceCodeSigning?: boolean\n\n /**\n * Whether to include PDB files.\n * @default false\n */\n readonly includePdb?: boolean\n\n /**\n * Whether to remove `scripts` field from `package.json` files.\n *\n * @default true\n */\n readonly removePackageScripts?: boolean\n\n /**\n * Whether to remove `keywords` field from `package.json` files.\n *\n * @default true\n */\n readonly removePackageKeywords?: boolean\n\n /**\n * Options to pass to `@electron/fuses`\n * Ref: https://github.com/electron/fuses\n */\n readonly electronFuses?: FuseOptionsV1 | null\n\n /**\n * [Experimental] Configuration for concurrent builds.\n */\n readonly concurrency?: Concurrency | null\n}\n\nexport interface Configuration extends CommonConfiguration, PlatformSpecificBuildOptions, Hooks {\n /**\n * Whether to use [electron-compile](http://github.com/electron/electron-compile) to compile app. Defaults to `true` if `electron-compile` in the dependencies. And `false` if in the `devDependencies` or doesn't specified.\n * @deprecated `electron-compile` is no longer maintained. Compile your app with a modern bundler (webpack, vite, etc.) instead.\n */\n readonly electronCompile?: boolean\n\n /**\n * The [electron-download](https://github.com/electron-userland/electron-download#usage) options. (legacy)\n * Alternatively, you can use [electron/get](https://github.com/electron/get#usage) options.\n */\n readonly electronDownload?: ElectronDownloadOptions | ElectronGetOptions | null\n\n /**\n * The branding used by Electron's distributables. This is needed if a fork has modified Electron's BRANDING.json file.\n */\n readonly electronBranding?: ElectronBrandingOptions\n\n /**\n * The version of electron you are packaging for. Defaults to version of `electron`, `electron-prebuilt` or `electron-prebuilt-compile` dependency.\n */\n electronVersion?: string | null\n\n /**\n * The name of a built-in configuration preset (currently, only `react-cra` is supported) or any number of paths to config files (relative to project dir).\n *\n * The latter allows to mixin a config from multiple other configs, as if you `Object.assign` them, but properly combine `files` glob patterns.\n *\n * If `react-scripts` in the app dependencies, `react-cra` will be set automatically. Set to `null` to disable automatic detection.\n */\n extends?: Array<string> | string | null\n\n /**\n * *libui-based frameworks only* The version of NodeJS you are packaging for.\n * You can set it to `current` to set the Node.js version that you use to run.\n * @deprecated libui-based frameworks (proton-native, etc.) are no longer actively maintained. This option has no effect when using Electron.\n */\n readonly nodeVersion?: string | null\n\n /**\n * *libui-based frameworks only* The version of LaunchUI you are packaging for. Applicable for Windows only. Defaults to version suitable for used framework version.\n * @deprecated libui-based frameworks (proton-native, etc.) are no longer actively maintained. This option has no effect when using Electron.\n */\n readonly launchUiVersion?: boolean | string | null\n\n /**\n * The framework name. One of `electron`, `proton`, `libui`. Defaults to `electron`.\n * @deprecated `proton` and `libui` framework support is no longer actively maintained. Use `electron` (the default).\n */\n readonly framework?: string | null\n\n /**\n * Whether to disable sanity check asar package (useful for custom electron forks that implement their own encrypted integrity validation)\n * @default false\n */\n readonly disableSanityCheckAsar?: boolean\n\n /**\n * Whether to skip ASAR integrity hash computation. Useful for custom electron forks with encrypted ASAR support where the header is not readable by standard tools.\n * @default false\n */\n readonly disableAsarIntegrity?: boolean\n}\n\nexport type Hook<T, V> = (contextOrPath: T) => Promise<V> | V\n\nexport interface PackContext {\n readonly outDir: string\n readonly appOutDir: string\n readonly packager: PlatformPackager<any>\n readonly electronPlatformName: string\n readonly arch: Arch\n readonly targets: Array<Target>\n}\nexport type AfterPackContext = PackContext\nexport type BeforePackContext = PackContext\nexport type AfterExtractContext = PackContext\n\n/**\n * Configuration of toolsets utilized by electron-builder\n */\nexport interface ToolsetConfig {\n /**\n * `win-codesign` version to use for signing Windows artifacts.\n * Located at https://github.com/electron-userland/electron-builder-binaries/releases?q=win-codesign&expanded=true\n *\n * Stable:\n * v0.0.0 (winCodeSign)\n *\n * Beta:\n * Windows Kits 10.0.26100.0\n * v1.0.0, v1.1.0\n *\n * @default \"0.0.0\"\n */\n readonly winCodeSign?: \"0.0.0\" | \"1.0.0\" | \"1.1.0\" | null\n\n /**\n * `appimage` bundle version to use for Appimage packaging and runtime.\n * Located at https://github.com/electron-userland/electron-builder-binaries/releases?q=appimage&expanded=true\n * 0.0.0 - legacy toolset (appimage)\n *\n * Betas:\n * 1.0.2 - Runtime 20251108\n * 1.0.3 - Runtime 20251108 (Resolves GH issue #9598)\n *\n * @default \"0.0.0\"\n */\n readonly appimage?: \"0.0.0\" | \"1.0.2\" | \"1.0.3\" | null\n\n /**\n * `nsis` bundle version to use for NSIS installer compilation.\n * Located at https://github.com/electron-userland/electron-builder-binaries/releases?q=nsis&expanded=true\n * 0.0.0 - legacy toolset (nsis-3.0.4.1 + nsis-resources-3.4.1)\n *\n * Betas:\n * 1.2.1 - unified bundle (makensis 3.12 + plugins in one archive, entrypoint scripts auto-set NSISDIR)\n *\n * @default \"0.0.0\"\n */\n readonly nsis?: \"0.0.0\" | \"1.2.1\" | null\n\n /**\n * `wine` bundle version to use for running Windows tools on non-Windows platforms.\n * Located at https://github.com/electron-userland/electron-builder-binaries/releases?q=wine&expanded=true\n * 0.0.0 - legacy toolset (wine 4.0.1 portable; mac-only support)\n *\n * Beta:\n * 1.0.1 - Wine 11 bundle (unified wine binary, ia32 via WoW64)\n *\n * @default \"0.0.0\"\n */\n readonly wine?: \"0.0.0\" | \"1.0.1\" | null\n}\n\nexport interface Hooks {\n /**\n * The function (or path to file or module id) to be run before pack.\n * Receives a {@link BeforePackContext}.\n *\n * Can be specified inline as a function in JavaScript configs:\n * ```js\n * // electron-builder.config.js\n * module.exports = {\n * beforePack: async (context) => {\n * // your code\n * }\n * }\n * ```\n *\n * Or as a path to a module that exports the function as its default export:\n * ```json\n * { \"build\": { \"beforePack\": \"./myBeforePackHook.js\" } }\n * ```\n * ```js\n * // myBeforePackHook.js\n * exports.default = async function(context) {\n * // your custom code\n * }\n * ```\n */\n readonly beforePack?: Hook<BeforePackContext, void> | string | null\n\n /**\n * The function (or path to file or module id) to be run after the prebuilt Electron binary has been extracted to the output directory.\n * Receives an {@link AfterExtractContext}. For file/module setup, see {@link beforePack}.\n */\n readonly afterExtract?: Hook<AfterExtractContext, void> | string | null\n\n /**\n * The function (or path to file or module id) to be run after pack but before pack into distributable format and sign.\n * Receives an {@link AfterPackContext}. For file/module setup, see {@link beforePack}.\n */\n readonly afterPack?: Hook<AfterPackContext, void> | string | null\n\n /**\n * The function (or path to file or module id) to be run after pack and sign but before pack into distributable format.\n * Receives an {@link AfterPackContext}. For file/module setup, see {@link beforePack}.\n */\n readonly afterSign?: Hook<AfterPackContext, void> | string | null\n\n /**\n * The function (or path to file or module id) to be run when an individual artifact build starts.\n * Receives an {@link ArtifactBuildStarted}. For file/module setup, see {@link beforePack}.\n */\n readonly artifactBuildStarted?: Hook<ArtifactBuildStarted, void> | string | null\n /**\n * The function (or path to file or module id) to be run when an individual artifact build completes.\n * Receives an {@link ArtifactCreated}. For file/module setup, see {@link beforePack}.\n */\n readonly artifactBuildCompleted?: Hook<ArtifactCreated, void> | string | null\n /**\n * The function (or path to file or module id) to be run after all artifacts are built.\n * Receives a {@link BuildResult}. May return an array of additional file paths to publish.\n *\n * For file/module setup, see {@link beforePack}.\n *\n * @example\n * ```js\n * exports.default = function () {\n * // return additional files to publish\n * return [\"/path/to/additional/result/file\"]\n * }\n * ```\n */\n readonly afterAllArtifactBuild?: Hook<BuildResult, Array<string>> | string | null\n /**\n * The function (or path to file or module id) to be run after MSI project created on disk - not packed into .msi package yet.\n */\n readonly msiProjectCreated?: Hook<string, void> | string | null\n /**\n * The function (or path to file or module id) to be run after Appx manifest created on disk - not packed into .appx package yet.\n */\n readonly appxManifestCreated?: Hook<string, void> | string | null\n /**\n * The function (or path to file or module id) to be [run on each node module](#onnodemodulefile) file. Returning `true`/`false` will determine whether to force include or to use the default copier logic\n */\n readonly onNodeModuleFile?: Hook<string, void | boolean> | string | null\n /**\n * The function (or path to file or module id) to be run before dependencies are installed or rebuilt. Works when `npmRebuild` is set to `true`. Resolving to `false` will skip dependencies install or rebuild.\n *\n * If provided and `node_modules` are missing, it will not invoke production dependencies check.\n */\n readonly beforeBuild?: Hook<BeforeBuildContext, boolean | void> | string | null\n /**\n * The function (or path to file or module id) to be run when staging the electron artifact environment.\n * Returns the path to custom Electron build (e.g. `~/electron/out/R`) or folder of electron zips.\n *\n * Zip files must follow the pattern `electron-v${version}-${platformName}-${arch}.zip`, otherwise it will be assumed to be an unpacked Electron app directory\n */\n readonly electronDist?: Hook<PrepareApplicationStageDirectoryOptions, string> | string | null\n}\n\nexport interface MetadataDirectories {\n /**\n * The path to build resources.\n *\n * Please note — build resources are not packed into the app. If you need to use some files, e.g. as tray icon, please include required files explicitly: `\"files\": [\"**\\/*\", \"build/icon.*\"]`\n * @default build\n */\n readonly buildResources?: string | null\n\n /**\n * The output directory. [File macros](https://www.electron.build/file-patterns#file-macros) are supported.\n * @default dist\n */\n readonly output?: string | null\n\n /**\n * The application directory (containing the application package.json), defaults to `app`, `www` or working directory.\n */\n readonly app?: string | null\n}\n\n/**\n * All options come from [@electron/fuses](https://github.com/electron/fuses)\n * Ref: https://raw.githubusercontent.com/electron/electron/refs/heads/main/docs/tutorial/fuses.md\n */\nexport interface FuseOptionsV1 {\n /**\n *The runAsNode fuse toggles whether the `ELECTRON_RUN_AS_NODE` environment variable is respected or not. Please note that if this fuse is disabled then `process.fork` in the main process will not function as expected as it depends on this environment variable to function. Instead, we recommend that you use [Utility Processes](https://github.com/electron/electron/blob/main/docs/api/utility-process.md), which work for many use cases where you need a standalone Node.js process (like a Sqlite server process or similar scenarios).\n */\n runAsNode?: boolean\n /**\n * The cookieEncryption fuse toggles whether the cookie store on disk is encrypted using OS level cryptography keys. By default the sqlite database that Chromium uses to store cookies stores the values in plaintext. If you wish to ensure your apps cookies are encrypted in the same way Chrome does then you should enable this fuse. Please note it is a one-way transition, if you enable this fuse existing unencrypted cookies will be encrypted-on-write but if you then disable the fuse again your cookie store will effectively be corrupt and useless. Most apps can safely enable this fuse.\n */\n enableCookieEncryption?: boolean\n /**\n * The nodeOptions fuse toggles whether the [`NODE_OPTIONS`](https://nodejs.org/api/cli.html#node_optionsoptions) and [`NODE_EXTRA_CA_CERTS`](https://github.com/nodejs/node/blob/main/doc/api/cli.md#node_extra_ca_certsfile) environment variables are respected. The `NODE_OPTIONS` environment variable can be used to pass all kinds of custom options to the Node.js runtime and isn't typically used by apps in production. Most apps can safely disable this fuse.\n */\n enableNodeOptionsEnvironmentVariable?: boolean\n /**\n * The nodeCliInspect fuse toggles whether the `--inspect`, `--inspect-brk`, etc. flags are respected or not. When disabled it also ensures that `SIGUSR1` signal does not initialize the main process inspector. Most apps can safely disable this fuse.\n */\n enableNodeCliInspectArguments?: boolean\n /**\n * The embeddedAsarIntegrityValidation fuse toggles an experimental feature on macOS that validates the content of the `app.asar` file when it is loaded. This feature is designed to have a minimal performance impact but may marginally slow down file reads from inside the `app.asar` archive.\n * Currently, ASAR integrity checking is supported on:\n *\n * - macOS as of electron>=16.0.0\n * - Windows as of electron>=30.0.0\n *\n * For more information on how to use asar integrity validation please read the [Asar Integrity](https://github.com/electron/electron/blob/main/docs/tutorial/asar-integrity.md) documentation.\n */\n enableEmbeddedAsarIntegrityValidation?: boolean\n /**\n * The onlyLoadAppFromAsar fuse changes the search system that Electron uses to locate your app code. By default Electron will search in the following order `app.asar` -> `app` -> `default_app.asar`. When this fuse is enabled the search order becomes a single entry `app.asar` thus ensuring that when combined with the `embeddedAsarIntegrityValidation` fuse it is impossible to load non-validated code.\n */\n onlyLoadAppFromAsar?: boolean\n /**\n * The loadBrowserProcessSpecificV8Snapshot fuse changes which V8 snapshot file is used for the browser process. By default Electron's processes will all use the same V8 snapshot file. When this fuse is enabled the browser process uses the file called `browser_v8_context_snapshot.bin` for its V8 snapshot. The other processes will use the V8 snapshot file that they normally do.\n */\n loadBrowserProcessSpecificV8Snapshot?: boolean\n /**\n * The grantFileProtocolExtraPrivileges fuse changes whether pages loaded from the `file://` protocol are given privileges beyond what they would receive in a traditional web browser. This behavior was core to Electron apps in original versions of Electron but is no longer required as apps should be [serving local files from custom protocols](https://github.com/electron/electron/blob/main/docs/tutorial/security.md#18-avoid-usage-of-the-file-protocol-and-prefer-usage-of-custom-protocols) now instead. If you aren't serving pages from `file://` you should disable this fuse.\n * The extra privileges granted to the `file://` protocol by this fuse are incompletely documented below:\n *\n * - `file://` protocol pages can use `fetch` to load other assets over `file://`\n * - `file://` protocol pages can use service workers\n * - `file://` protocol pages have universal access granted to child frames also running on `file://` protocols regardless of sandbox settings\n */\n grantFileProtocolExtraPrivileges?: boolean\n /**\n * Resets the app signature, specifically used for macOS.\n * Note: This should be unneeded since electron-builder signs the app directly after flipping the fuses.\n * Ref: https://github.com/electron/fuses?tab=readme-ov-file#apple-silicon\n */\n resetAdHocDarwinSignature?: boolean\n}\n\nexport interface Concurrency {\n /**\n * The maximum number of concurrent jobs to run.\n * @default 1\n */\n jobs: number\n}\n"]}
1
+ {"version":3,"file":"configuration.js","sourceRoot":"","sources":["../src/configuration.ts"],"names":[],"mappings":"","sourcesContent":["import { Arch } from \"builder-util\"\nimport { BeforeBuildContext, Target } from \"./core\"\nimport { ElectronBrandingOptions } from \"./electron/ElectronFramework\"\nimport { PrepareApplicationStageDirectoryOptions } from \"./Framework\"\nimport { AppXOptions } from \"./options/AppXOptions\"\nimport { AppImageOptions, DebOptions, FlatpakOptions, LinuxConfiguration, LinuxTargetSpecificOptions, PacmanOptions, RpmOptions } from \"./options/linuxOptions\"\nimport { DmgOptions, MacConfiguration, MasConfiguration } from \"./options/macOptions\"\nimport { MsiOptions } from \"./options/MsiOptions\"\nimport { MsiWrappedOptions } from \"./options/MsiWrappedOptions\"\nimport { PkgOptions } from \"./options/pkgOptions\"\nimport { PlatformSpecificBuildOptions } from \"./options/PlatformSpecificBuildOptions\"\nimport { SnapcraftOptions, SnapOptions } from \"./options/SnapOptions\"\nimport { SquirrelWindowsOptions } from \"./options/SquirrelWindowsOptions\"\nimport { WindowsConfiguration } from \"./options/winOptions\"\nimport { BuildResult } from \"./packager\"\nimport { ArtifactBuildStarted, ArtifactCreated } from \"./packagerApi\"\nimport { PlatformPackager } from \"./platformPackager\"\nimport { NsisOptions, NsisWebOptions, PortableOptions } from \"./targets/nsis/nsisOptions\"\nimport { ElectronDownloadOptions, ElectronGetOptions } from \"./util/electronGet\"\n\n// duplicate appId here because it is important\n/**\n * Configuration Options\n */\nexport interface CommonConfiguration {\n /**\n * The application id. Used as [CFBundleIdentifier](https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/20001431-102070) for MacOS and as\n * [Application User Model ID](https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx) for Windows (NSIS target only, Squirrel.Windows not supported). It is strongly recommended that an explicit ID is set.\n * @default com.electron.${name}\n */\n readonly appId?: string | null\n\n /**\n * As [name](#metadata), but allows you to specify a product name for your executable which contains spaces and other special characters not allowed in the [name property](https://docs.npmjs.com/files/package.json#name).\n * If not specified inside of the `build` configuration, `productName` property defined at the top level of `package.json` is used. If not specified at the top level of `package.json`, [name property](https://docs.npmjs.com/files/package.json#name) is used.\n */\n readonly productName?: string | null\n\n /**\n * The human-readable copyright line for the app.\n * @default Copyright © year ${author}\n */\n readonly copyright?: string | null\n\n /**\n * Directories for build resources\n */\n readonly directories?: MetadataDirectories | null\n\n /**\n * Configuration of toolsets utilized by electron-builder\n */\n readonly toolsets?: ToolsetConfig | null\n\n /**\n * Options related to how build macOS targets.\n */\n readonly mac?: MacConfiguration | null\n /**\n * MAS (Mac Application Store) options.\n */\n readonly mas?: MasConfiguration | null\n /**\n * MAS (Mac Application Store) development options (`mas-dev` target).\n */\n readonly masDev?: MasConfiguration | null\n /**\n * macOS DMG options.\n */\n readonly dmg?: DmgOptions | null\n /**\n * macOS PKG options.\n */\n readonly pkg?: PkgOptions | null\n\n /**\n * Options related to how build Windows targets.\n */\n readonly win?: WindowsConfiguration | null\n /** NSIS installer options. */\n readonly nsis?: NsisOptions | null\n /** NSIS web installer options (downloads app package at install time). */\n readonly nsisWeb?: NsisWebOptions | null\n /** Portable executable options (no installation required). */\n readonly portable?: PortableOptions | null\n /** Windows Store (AppX) package options. */\n readonly appx?: AppXOptions | null\n /**\n * MSI package options.\n */\n readonly msi?: MsiOptions | null\n /**\n * MSI-wrapped installer options.\n */\n readonly msiWrapped?: MsiWrappedOptions | null\n /**\n * Squirrel.Windows installer options. Requires the `electron-builder-squirrel-windows` dependency.\n */\n readonly squirrelWindows?: SquirrelWindowsOptions | null\n /**\n * General Linux build options shared across all Linux targets (icon, category, desktop entry,\n * executable name, etc.). Target-specific compression and packaging options live in the\n * per-format interfaces (`DebOptions`, `RpmOptions`, `PacmanOptions`, etc.).\n */\n readonly linux?: LinuxConfiguration | null\n /**\n * Debian package options. Targets Debian, Ubuntu, and Debian-based distributions.\n * Produces a `.deb` archive installable via `dpkg -i` or `apt install`.\n */\n readonly deb?: DebOptions | null\n /**\n * Flat snap configuration targeting core22 and older snap bases.\n *\n * @deprecated Use `snapcraft` instead — it supersedes `snap` when both are present and supports\n * all snap bases including core24. `snap` will be removed in a future major release.\n * See {@link SnapOptions} for available properties.\n */\n readonly snap?: SnapOptions | null\n /**\n * Snapcraft configuration. Prefer this over the deprecated `snap` field.\n *\n * Selects the snapcraft base and provides per-core options:\n * - `base: \"core18\" | \"core20\" | \"core22\"` — legacy builds; accepts the same options as `snap`\n * - `base: \"core24\"` — modern builds with the GNOME extension (recommended for new apps, requires Electron 25+)\n * - `base: \"custom\"` — pass an existing `snapcraft.yaml` through unchanged; no plugs, extensions,\n * or desktop files are injected\n *\n * When both `snapcraft` and `snap` are set, `snapcraft` takes precedence.\n *\n * @example\n * ```json\n * { \"snapcraft\": { \"base\": \"core24\", \"core24\": { \"useLXD\": true } } }\n * ```\n *\n * See {@link SnapcraftOptions} for all available properties.\n */\n readonly snapcraft?: SnapcraftOptions | null\n /**\n * AppImage options. AppImage is a portable application format that bundles the app\n * and its dependencies into a single self-contained executable that runs on most\n * Linux distributions without installation.\n */\n readonly appImage?: AppImageOptions | null\n /**\n * Flatpak options. Flatpak is a sandboxed application distribution format for Linux\n * that runs in a controlled environment and is distributed via [Flathub](https://flathub.org/)\n * or other Flatpak repositories.\n */\n readonly flatpak?: FlatpakOptions | null\n /**\n * Pacman package options. Targets Arch Linux and Arch-based distributions\n * (Manjaro, EndeavourOS, etc.). Produces a `.pacman` archive installable via `pacman -U`.\n */\n readonly pacman?: PacmanOptions | null\n /**\n * RPM package options. Targets Fedora, Red Hat Enterprise Linux, SUSE, and related\n * distributions. Produces a `.rpm` archive installable via `rpm` or `dnf`.\n */\n readonly rpm?: RpmOptions | null\n /**\n * FreeBSD package options. Produces a `.pkg` archive for the FreeBSD `pkg` package manager.\n */\n readonly freebsd?: LinuxTargetSpecificOptions | null\n /**\n * Solaris IPS package options. Produces a `.p5p` archive for the Solaris Image Packaging\n * System (`pkg`).\n */\n readonly p5p?: LinuxTargetSpecificOptions | null\n /**\n * Alpine Linux APK package options. Produces an `.apk` archive installable via `apk add`.\n */\n readonly apk?: LinuxTargetSpecificOptions | null\n\n /**\n * Whether to build the application native dependencies from source.\n * @default false\n */\n buildDependenciesFromSource?: boolean\n /**\n * Whether to execute `node-gyp rebuild` before starting to package the app.\n *\n * Don't [use](https://github.com/electron-userland/electron-builder/issues/683#issuecomment-241214075) [npm](http://electron.atom.io/docs/tutorial/using-native-node-modules/#using-npm) (neither `.npmrc`) for configuring electron headers. Use `electron-builder node-gyp-rebuild` instead.\n * @default false\n */\n readonly nodeGypRebuild?: boolean\n /**\n * Additional command line arguments to use when installing app native deps.\n */\n readonly npmArgs?: Array<string> | string | null\n /**\n * Whether to [rebuild](https://docs.npmjs.com/cli/rebuild) native dependencies before starting to package the app.\n * @default true\n */\n readonly npmRebuild?: boolean\n /**\n * Use `legacy` app-builder binary for installing native dependencies, or `@electron/rebuild` in `sequential` or `parallel` compilation modes.\n * @default sequential\n */\n readonly nativeRebuilder?: \"legacy\" | \"sequential\" | \"parallel\" | null\n\n /**\n * Whether production dependencies that cannot be resolved during node-module collection are\n * allowed — i.e. whether the build should continue with a warning instead of failing.\n *\n * During collection every production dependency must resolve to an installed package on disk. A\n * dependency that does not resolve (`cannot find path for dependency` / `dependency not found on\n * disk`) is not bundled, which typically breaks the packaged app at runtime with\n * `MODULE_NOT_FOUND`.\n *\n * - `true` (or omitted — the v26 default): missing production dependencies are only logged as\n * warnings, keeping the historical behavior of the stable 26.x line. (electron-builder 27+\n * defaults to `false` and fails the build instead.)\n * - `false` or `null`: the build fails after dependency collection completes, reporting the\n * **complete** list of missing production dependencies at once.\n * - `string[]`: the listed dependency names are allowed to be missing; any other missing\n * production dependency fails the build. Entries match the package name of the reported\n * `name@version` entry (e.g. `some-native-module`, `@scope/pkg`), or an exact `name@version`\n * string to allow only that resolved version to be missing.\n *\n * Missing *optional* dependencies (declared in `optionalDependencies`, e.g. `fsevents` on\n * Linux/Windows, or platform-specific packages) are always allowed and never fail the build.\n *\n * @default true\n */\n readonly allowMissingDependencies?: boolean | Array<string> | null\n\n /**\n * The build number. Maps to the `--iteration` flag for builds using FPM on Linux.\n * If not defined, then it will fallback to `BUILD_NUMBER` or `TRAVIS_BUILD_NUMBER` or `APPVEYOR_BUILD_NUMBER` or `CIRCLE_BUILD_NUM` or `BUILD_BUILDNUMBER` or `CI_PIPELINE_IID` env.\n */\n readonly buildNumber?: string | null\n\n /**\n * The build version. Maps to the `CFBundleVersion` on macOS, and `FileVersion` metadata property on Windows. Defaults to the `version`.\n * If `buildVersion` is not defined and `buildNumber` (or one of the `buildNumber` envs) is defined, it will be used as a build version (`version.buildNumber`).\n */\n readonly buildVersion?: string | null\n\n /**\n * Whether to download the alternate FFmpeg library from Electron's release assets and replace the default FFmpeg library prior to signing\n */\n readonly downloadAlternateFFmpeg?: boolean\n\n /**\n * Inject properties to `package.json`.\n */\n readonly extraMetadata?: any\n\n /**\n * Whether to fail if the application is not signed (to prevent unsigned app if code signing configuration is not correct).\n * @default false\n */\n readonly forceCodeSigning?: boolean\n\n /**\n * Whether to include PDB files.\n * @default false\n */\n readonly includePdb?: boolean\n\n /**\n * Whether to remove `scripts` field from `package.json` files.\n *\n * @default true\n */\n readonly removePackageScripts?: boolean\n\n /**\n * Whether to remove `keywords` field from `package.json` files.\n *\n * @default true\n */\n readonly removePackageKeywords?: boolean\n\n /**\n * Options to pass to `@electron/fuses`\n * Ref: https://github.com/electron/fuses\n */\n readonly electronFuses?: FuseOptionsV1 | null\n\n /**\n * [Experimental] Configuration for concurrent builds.\n */\n readonly concurrency?: Concurrency | null\n}\n\nexport interface Configuration extends CommonConfiguration, PlatformSpecificBuildOptions, Hooks {\n /**\n * Whether to use [electron-compile](http://github.com/electron/electron-compile) to compile app. Defaults to `true` if `electron-compile` in the dependencies. And `false` if in the `devDependencies` or doesn't specified.\n * @deprecated `electron-compile` is no longer maintained. Compile your app with a modern bundler (webpack, vite, etc.) instead.\n */\n readonly electronCompile?: boolean\n\n /**\n * The [electron-download](https://github.com/electron-userland/electron-download#usage) options. (legacy)\n * Alternatively, you can use [electron/get](https://github.com/electron/get#usage) options.\n *\n * `checksums` (a map of artifact file name → SHA-256 hex) makes checksum validation fully offline —\n * without it, `@electron/get` fetches `SHASUMS256.txt` from the network on every build, even when the\n * artifact itself is already cached. When `checksums` is not configured, electron-builder automatically\n * picks up a locally seeded `SHASUMS256.txt-<version>` (or `SHASUMS256.txt`) file at the root of the\n * Electron cache directory. See the\n * [air-gapped / offline builds guide](https://www.electron.build/tutorials/offline-air-gapped-builds).\n */\n readonly electronDownload?: ElectronDownloadOptions | ElectronGetOptions | null\n\n /**\n * The branding used by Electron's distributables. This is needed if a fork has modified Electron's BRANDING.json file.\n */\n readonly electronBranding?: ElectronBrandingOptions\n\n /**\n * The version of electron you are packaging for. Defaults to version of `electron`, `electron-prebuilt` or `electron-prebuilt-compile` dependency.\n */\n electronVersion?: string | null\n\n /**\n * The name of a built-in configuration preset (currently, only `react-cra` is supported) or any number of paths to config files (relative to project dir).\n *\n * The latter allows to mixin a config from multiple other configs, as if you `Object.assign` them, but properly combine `files` glob patterns.\n *\n * If `react-scripts` in the app dependencies, `react-cra` will be set automatically. Set to `null` to disable automatic detection.\n */\n extends?: Array<string> | string | null\n\n /**\n * *libui-based frameworks only* The version of NodeJS you are packaging for.\n * You can set it to `current` to set the Node.js version that you use to run.\n * @deprecated libui-based frameworks (proton-native, etc.) are no longer actively maintained. This option has no effect when using Electron.\n */\n readonly nodeVersion?: string | null\n\n /**\n * *libui-based frameworks only* The version of LaunchUI you are packaging for. Applicable for Windows only. Defaults to version suitable for used framework version.\n * @deprecated libui-based frameworks (proton-native, etc.) are no longer actively maintained. This option has no effect when using Electron.\n */\n readonly launchUiVersion?: boolean | string | null\n\n /**\n * The framework name. One of `electron`, `proton`, `libui`. Defaults to `electron`.\n * @deprecated `proton` and `libui` framework support is no longer actively maintained. Use `electron` (the default).\n */\n readonly framework?: string | null\n\n /**\n * Whether to disable sanity check asar package (useful for custom electron forks that implement their own encrypted integrity validation)\n * @default false\n */\n readonly disableSanityCheckAsar?: boolean\n\n /**\n * Whether to skip ASAR integrity hash computation. Useful for custom electron forks with encrypted ASAR support where the header is not readable by standard tools.\n * @default false\n */\n readonly disableAsarIntegrity?: boolean\n}\n\nexport type Hook<T, V> = (contextOrPath: T) => Promise<V> | V\n\nexport interface PackContext {\n readonly outDir: string\n readonly appOutDir: string\n readonly packager: PlatformPackager<any>\n readonly electronPlatformName: string\n readonly arch: Arch\n readonly targets: Array<Target>\n}\nexport type AfterPackContext = PackContext\nexport type BeforePackContext = PackContext\nexport type AfterExtractContext = PackContext\n\n/**\n * Configuration of toolsets utilized by electron-builder\n */\nexport interface ToolsetConfig {\n /**\n * `win-codesign` version to use for signing Windows artifacts.\n * Located at https://github.com/electron-userland/electron-builder-binaries/releases?q=win-codesign&expanded=true\n *\n * Stable:\n * v0.0.0 (winCodeSign)\n *\n * Beta:\n * Windows Kits 10.0.26100.0\n * v1.0.0, v1.1.0\n *\n * @default \"0.0.0\"\n */\n readonly winCodeSign?: \"0.0.0\" | \"1.0.0\" | \"1.1.0\" | null\n\n /**\n * `appimage` bundle version to use for Appimage packaging and runtime.\n * Located at https://github.com/electron-userland/electron-builder-binaries/releases?q=appimage&expanded=true\n * 0.0.0 - legacy toolset (appimage)\n *\n * Betas:\n * 1.0.2 - Runtime 20251108\n * 1.0.3 - Runtime 20251108 (Resolves GH issue #9598)\n *\n * @default \"0.0.0\"\n */\n readonly appimage?: \"0.0.0\" | \"1.0.2\" | \"1.0.3\" | null\n\n /**\n * `nsis` bundle version to use for NSIS installer compilation.\n * Located at https://github.com/electron-userland/electron-builder-binaries/releases?q=nsis&expanded=true\n * 0.0.0 - legacy toolset (nsis-3.0.4.1 + nsis-resources-3.4.1)\n *\n * Betas:\n * 1.2.1 - unified bundle (makensis 3.12 + plugins in one archive, entrypoint scripts auto-set NSISDIR)\n *\n * @default \"0.0.0\"\n */\n readonly nsis?: \"0.0.0\" | \"1.2.1\" | null\n\n /**\n * `wine` bundle version to use for running Windows tools on non-Windows platforms.\n * Located at https://github.com/electron-userland/electron-builder-binaries/releases?q=wine&expanded=true\n * 0.0.0 - legacy toolset (wine 4.0.1 portable; mac-only support)\n *\n * Beta:\n * 1.0.1 - Wine 11 bundle (unified wine binary, ia32 via WoW64)\n *\n * @default \"0.0.0\"\n */\n readonly wine?: \"0.0.0\" | \"1.0.1\" | null\n}\n\nexport interface Hooks {\n /**\n * The function (or path to file or module id) to be run before pack.\n * Receives a {@link BeforePackContext}.\n *\n * Can be specified inline as a function in JavaScript configs:\n * ```js\n * // electron-builder.config.js\n * module.exports = {\n * beforePack: async (context) => {\n * // your code\n * }\n * }\n * ```\n *\n * Or as a path to a module that exports the function as its default export:\n * ```json\n * { \"build\": { \"beforePack\": \"./myBeforePackHook.js\" } }\n * ```\n * ```js\n * // myBeforePackHook.js\n * exports.default = async function(context) {\n * // your custom code\n * }\n * ```\n */\n readonly beforePack?: Hook<BeforePackContext, void> | string | null\n\n /**\n * The function (or path to file or module id) to be run after the prebuilt Electron binary has been extracted to the output directory.\n * Receives an {@link AfterExtractContext}. For file/module setup, see {@link beforePack}.\n */\n readonly afterExtract?: Hook<AfterExtractContext, void> | string | null\n\n /**\n * The function (or path to file or module id) to be run after pack but before pack into distributable format and sign.\n * Receives an {@link AfterPackContext}. For file/module setup, see {@link beforePack}.\n */\n readonly afterPack?: Hook<AfterPackContext, void> | string | null\n\n /**\n * The function (or path to file or module id) to be run after pack and sign but before pack into distributable format.\n * Receives an {@link AfterPackContext}. For file/module setup, see {@link beforePack}.\n */\n readonly afterSign?: Hook<AfterPackContext, void> | string | null\n\n /**\n * The function (or path to file or module id) to be run when an individual artifact build starts.\n * Receives an {@link ArtifactBuildStarted}. For file/module setup, see {@link beforePack}.\n */\n readonly artifactBuildStarted?: Hook<ArtifactBuildStarted, void> | string | null\n /**\n * The function (or path to file or module id) to be run when an individual artifact build completes.\n * Receives an {@link ArtifactCreated}. For file/module setup, see {@link beforePack}.\n */\n readonly artifactBuildCompleted?: Hook<ArtifactCreated, void> | string | null\n /**\n * The function (or path to file or module id) to be run after all artifacts are built.\n * Receives a {@link BuildResult}. May return an array of additional file paths to publish.\n *\n * For file/module setup, see {@link beforePack}.\n *\n * @example\n * ```js\n * exports.default = function () {\n * // return additional files to publish\n * return [\"/path/to/additional/result/file\"]\n * }\n * ```\n */\n readonly afterAllArtifactBuild?: Hook<BuildResult, Array<string>> | string | null\n /**\n * The function (or path to file or module id) to be run after MSI project created on disk - not packed into .msi package yet.\n */\n readonly msiProjectCreated?: Hook<string, void> | string | null\n /**\n * The function (or path to file or module id) to be run after Appx manifest created on disk - not packed into .appx package yet.\n */\n readonly appxManifestCreated?: Hook<string, void> | string | null\n /**\n * The function (or path to file or module id) to be [run on each node module](#onnodemodulefile) file. Returning `true`/`false` will determine whether to force include or to use the default copier logic\n */\n readonly onNodeModuleFile?: Hook<string, void | boolean> | string | null\n /**\n * The function (or path to file or module id) to be run before dependencies are installed or rebuilt. Works when `npmRebuild` is set to `true`. Resolving to `false` will skip dependencies install or rebuild.\n *\n * If provided and `node_modules` are missing, it will not invoke production dependencies check.\n */\n readonly beforeBuild?: Hook<BeforeBuildContext, boolean | void> | string | null\n /**\n * The function (or path to file or module id) to be run when staging the electron artifact environment.\n * Returns the path to custom Electron build (e.g. `~/electron/out/R`) or folder of electron zips.\n *\n * Zip files must follow the pattern `electron-v${version}-${platformName}-${arch}.zip`, otherwise it will be assumed to be an unpacked Electron app directory\n */\n readonly electronDist?: Hook<PrepareApplicationStageDirectoryOptions, string> | string | null\n}\n\nexport interface MetadataDirectories {\n /**\n * The path to build resources.\n *\n * Please note — build resources are not packed into the app. If you need to use some files, e.g. as tray icon, please include required files explicitly: `\"files\": [\"**\\/*\", \"build/icon.*\"]`\n * @default build\n */\n readonly buildResources?: string | null\n\n /**\n * The output directory. [File macros](https://www.electron.build/file-patterns#file-macros) are supported.\n * @default dist\n */\n readonly output?: string | null\n\n /**\n * The application directory (containing the application package.json), defaults to `app`, `www` or working directory.\n */\n readonly app?: string | null\n}\n\n/**\n * All options come from [@electron/fuses](https://github.com/electron/fuses)\n * Ref: https://raw.githubusercontent.com/electron/electron/refs/heads/main/docs/tutorial/fuses.md\n */\nexport interface FuseOptionsV1 {\n /**\n *The runAsNode fuse toggles whether the `ELECTRON_RUN_AS_NODE` environment variable is respected or not. Please note that if this fuse is disabled then `process.fork` in the main process will not function as expected as it depends on this environment variable to function. Instead, we recommend that you use [Utility Processes](https://github.com/electron/electron/blob/main/docs/api/utility-process.md), which work for many use cases where you need a standalone Node.js process (like a Sqlite server process or similar scenarios).\n */\n runAsNode?: boolean\n /**\n * The cookieEncryption fuse toggles whether the cookie store on disk is encrypted using OS level cryptography keys. By default the sqlite database that Chromium uses to store cookies stores the values in plaintext. If you wish to ensure your apps cookies are encrypted in the same way Chrome does then you should enable this fuse. Please note it is a one-way transition, if you enable this fuse existing unencrypted cookies will be encrypted-on-write but if you then disable the fuse again your cookie store will effectively be corrupt and useless. Most apps can safely enable this fuse.\n */\n enableCookieEncryption?: boolean\n /**\n * The nodeOptions fuse toggles whether the [`NODE_OPTIONS`](https://nodejs.org/api/cli.html#node_optionsoptions) and [`NODE_EXTRA_CA_CERTS`](https://github.com/nodejs/node/blob/main/doc/api/cli.md#node_extra_ca_certsfile) environment variables are respected. The `NODE_OPTIONS` environment variable can be used to pass all kinds of custom options to the Node.js runtime and isn't typically used by apps in production. Most apps can safely disable this fuse.\n */\n enableNodeOptionsEnvironmentVariable?: boolean\n /**\n * The nodeCliInspect fuse toggles whether the `--inspect`, `--inspect-brk`, etc. flags are respected or not. When disabled it also ensures that `SIGUSR1` signal does not initialize the main process inspector. Most apps can safely disable this fuse.\n */\n enableNodeCliInspectArguments?: boolean\n /**\n * The embeddedAsarIntegrityValidation fuse toggles an experimental feature on macOS that validates the content of the `app.asar` file when it is loaded. This feature is designed to have a minimal performance impact but may marginally slow down file reads from inside the `app.asar` archive.\n * Currently, ASAR integrity checking is supported on:\n *\n * - macOS as of electron>=16.0.0\n * - Windows as of electron>=30.0.0\n *\n * For more information on how to use asar integrity validation please read the [Asar Integrity](https://github.com/electron/electron/blob/main/docs/tutorial/asar-integrity.md) documentation.\n */\n enableEmbeddedAsarIntegrityValidation?: boolean\n /**\n * The onlyLoadAppFromAsar fuse changes the search system that Electron uses to locate your app code. By default Electron will search in the following order `app.asar` -> `app` -> `default_app.asar`. When this fuse is enabled the search order becomes a single entry `app.asar` thus ensuring that when combined with the `embeddedAsarIntegrityValidation` fuse it is impossible to load non-validated code.\n */\n onlyLoadAppFromAsar?: boolean\n /**\n * The loadBrowserProcessSpecificV8Snapshot fuse changes which V8 snapshot file is used for the browser process. By default Electron's processes will all use the same V8 snapshot file. When this fuse is enabled the browser process uses the file called `browser_v8_context_snapshot.bin` for its V8 snapshot. The other processes will use the V8 snapshot file that they normally do.\n */\n loadBrowserProcessSpecificV8Snapshot?: boolean\n /**\n * The grantFileProtocolExtraPrivileges fuse changes whether pages loaded from the `file://` protocol are given privileges beyond what they would receive in a traditional web browser. This behavior was core to Electron apps in original versions of Electron but is no longer required as apps should be [serving local files from custom protocols](https://github.com/electron/electron/blob/main/docs/tutorial/security.md#18-avoid-usage-of-the-file-protocol-and-prefer-usage-of-custom-protocols) now instead. If you aren't serving pages from `file://` you should disable this fuse.\n * The extra privileges granted to the `file://` protocol by this fuse are incompletely documented below:\n *\n * - `file://` protocol pages can use `fetch` to load other assets over `file://`\n * - `file://` protocol pages can use service workers\n * - `file://` protocol pages have universal access granted to child frames also running on `file://` protocols regardless of sandbox settings\n */\n grantFileProtocolExtraPrivileges?: boolean\n /**\n * Resets the app signature, specifically used for macOS.\n * Note: This should be unneeded since electron-builder signs the app directly after flipping the fuses.\n * Ref: https://github.com/electron/fuses?tab=readme-ov-file#apple-silicon\n */\n resetAdHocDarwinSignature?: boolean\n}\n\nexport interface Concurrency {\n /**\n * The maximum number of concurrent jobs to run.\n * @default 1\n */\n jobs: number\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import { Configuration } from "../configuration";
2
- import { BeforeCopyExtraFilesOptions, Framework } from "../Framework";
2
+ import { BeforeCopyExtraFilesOptions, Framework, PrepareApplicationStageDirectoryOptions } from "../Framework";
3
3
  import { Packager } from "../index";
4
4
  import { ElectronDownloadOptions } from "../util/electronGet";
5
5
  export { ElectronDownloadOptions };
@@ -15,3 +15,4 @@ export interface ElectronBrandingOptions {
15
15
  export declare function createBrandingOpts(opts: Configuration): Required<ElectronBrandingOptions>;
16
16
  export declare function removeUnusedLanguagesIfNeeded(options: BeforeCopyExtraFilesOptions): Promise<void>;
17
17
  export declare function createElectronFrameworkSupport(configuration: Configuration, packager: Packager): Promise<Framework>;
18
+ export declare function cleanupAfterUnpack(prepareOptions: PrepareApplicationStageDirectoryOptions, distMacOsAppName: string, isFullCleanup: boolean): Promise<[void, void, void]>;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createBrandingOpts = createBrandingOpts;
4
4
  exports.removeUnusedLanguagesIfNeeded = removeUnusedLanguagesIfNeeded;
5
5
  exports.createElectronFrameworkSupport = createElectronFrameworkSupport;
6
+ exports.cleanupAfterUnpack = cleanupAfterUnpack;
6
7
  const builder_util_1 = require("builder-util");
7
8
  const fs_extra_1 = require("fs-extra");
8
9
  const path = require("path");
@@ -237,11 +238,18 @@ function cleanupAfterUnpack(prepareOptions, distMacOsAppName, isFullCleanup) {
237
238
  return Promise.all([
238
239
  isFullCleanup ? (0, builder_util_1.unlinkIfExists)(path.join(resourcesPath, "default_app.asar")) : Promise.resolve(),
239
240
  isFullCleanup ? (0, builder_util_1.unlinkIfExists)(path.join(out, "version")) : Promise.resolve(),
240
- isMac
241
- ? Promise.resolve()
242
- : (0, fs_extra_1.rename)(path.join(out, "LICENSE"), path.join(out, "LICENSE.electron.txt")).catch(() => {
243
- /* ignore */
244
- }),
241
+ retainElectronLicenseFiles(out, resourcesPath, isMac),
245
242
  ]);
246
243
  }
244
+ /**
245
+ * The Electron dist ships Electron's own `LICENSE` and Chromium's `LICENSES.chromium.html` next to the binary, and both licenses require them to be
246
+ * retained in distributables. On win/linux they stay next to the executable, but on macOS they sit outside the `.app` bundle, which is the only thing
247
+ * packaged into the artifacts, so move them into `Contents/Resources`. See https://github.com/electron-userland/electron-builder/issues/9407
248
+ */
249
+ async function retainElectronLicenseFiles(appOutDir, resourcesPath, isMac) {
250
+ const destinationDir = isMac ? resourcesPath : appOutDir;
251
+ // a custom Electron distribution may not ship license files, so only a missing source file is tolerated; any other error propagates
252
+ const move = (name, newName = name) => (0, builder_util_1.orIfFileNotExist)((0, fs_extra_1.rename)(path.join(appOutDir, name), path.join(destinationDir, newName)), undefined);
253
+ await Promise.all([move("LICENSE", "LICENSE.electron.txt"), ...(isMac ? [move("LICENSES.chromium.html")] : [])]);
254
+ }
247
255
  //# sourceMappingURL=ElectronFramework.js.map