app-builder-lib 26.0.12 → 26.0.14

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 (69) hide show
  1. package/out/asar/asarUtil.js +137 -143
  2. package/out/asar/asarUtil.js.map +1 -1
  3. package/out/asar/integrity.d.ts +0 -3
  4. package/out/asar/integrity.js +0 -60
  5. package/out/asar/integrity.js.map +1 -1
  6. package/out/codeSign/macCodeSign.js +3 -2
  7. package/out/codeSign/macCodeSign.js.map +1 -1
  8. package/out/codeSign/windowsSignAzureManager.js +1 -1
  9. package/out/codeSign/windowsSignAzureManager.js.map +1 -1
  10. package/out/configuration.d.ts +11 -0
  11. package/out/configuration.js.map +1 -1
  12. package/out/core.d.ts +2 -1
  13. package/out/core.js +5 -2
  14. package/out/core.js.map +1 -1
  15. package/out/macPackager.d.ts +2 -1
  16. package/out/macPackager.js +22 -3
  17. package/out/macPackager.js.map +1 -1
  18. package/out/node-module-collector/nodeModulesCollector.d.ts +4 -7
  19. package/out/node-module-collector/nodeModulesCollector.js +7 -79
  20. package/out/node-module-collector/nodeModulesCollector.js.map +1 -1
  21. package/out/node-module-collector/npmNodeModulesCollector.d.ts +3 -3
  22. package/out/node-module-collector/npmNodeModulesCollector.js +29 -42
  23. package/out/node-module-collector/npmNodeModulesCollector.js.map +1 -1
  24. package/out/node-module-collector/pnpmNodeModulesCollector.d.ts +3 -3
  25. package/out/node-module-collector/pnpmNodeModulesCollector.js +37 -43
  26. package/out/node-module-collector/pnpmNodeModulesCollector.js.map +1 -1
  27. package/out/node-module-collector/types.d.ts +1 -3
  28. package/out/node-module-collector/types.js.map +1 -1
  29. package/out/options/macOptions.d.ts +2 -0
  30. package/out/options/macOptions.js.map +1 -1
  31. package/out/packager.js +28 -2
  32. package/out/packager.js.map +1 -1
  33. package/out/platformPackager.d.ts +0 -1
  34. package/out/platformPackager.js +0 -9
  35. package/out/platformPackager.js.map +1 -1
  36. package/out/targets/AppxTarget.d.ts +1 -0
  37. package/out/targets/AppxTarget.js +13 -10
  38. package/out/targets/AppxTarget.js.map +1 -1
  39. package/out/targets/ArchiveTarget.js +46 -43
  40. package/out/targets/ArchiveTarget.js.map +1 -1
  41. package/out/targets/FpmTarget.d.ts +2 -0
  42. package/out/targets/FpmTarget.js +44 -8
  43. package/out/targets/FpmTarget.js.map +1 -1
  44. package/out/targets/MsiWrappedTarget.js +2 -1
  45. package/out/targets/MsiWrappedTarget.js.map +1 -1
  46. package/out/targets/nsis/Defines.d.ts +1 -2
  47. package/out/targets/nsis/Defines.js.map +1 -1
  48. package/out/targets/nsis/NsisTarget.js +40 -33
  49. package/out/targets/nsis/NsisTarget.js.map +1 -1
  50. package/out/targets/nsis/nsisOptions.d.ts +24 -1
  51. package/out/targets/nsis/nsisOptions.js.map +1 -1
  52. package/out/targets/nsis/nsisUtil.d.ts +1 -0
  53. package/out/targets/nsis/nsisUtil.js +11 -1
  54. package/out/targets/nsis/nsisUtil.js.map +1 -1
  55. package/out/targets/pkg.js +7 -1
  56. package/out/targets/pkg.js.map +1 -1
  57. package/out/targets/tools.d.ts +1 -0
  58. package/out/targets/tools.js +22 -0
  59. package/out/targets/tools.js.map +1 -1
  60. package/out/util/appFileCopier.js +10 -1
  61. package/out/util/appFileCopier.js.map +1 -1
  62. package/out/util/yarn.d.ts +5 -1
  63. package/out/util/yarn.js +7 -9
  64. package/out/util/yarn.js.map +1 -1
  65. package/out/version.d.ts +1 -1
  66. package/out/version.js +1 -1
  67. package/out/version.js.map +1 -1
  68. package/package.json +12 -12
  69. package/scheme.json +90 -4
@@ -1 +1 @@
1
- {"version":3,"file":"macCodeSign.js","sourceRoot":"","sources":["../../src/codeSign/macCodeSign.ts"],"names":[],"mappings":";;;AA6BA,sCA4BC;AAED,kCAoCC;AA+CD,wCAOC;AAED,wCA8CC;AAiBD,oBAEC;AAsGD,oCAeC;AA7UD,iDAA8C;AAE9C,iFAAmF;AACnF,+CAAuK;AAEvK,mCAAgD;AAChD,0CAAoC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,CAAC,CAAC,CAAA;IACvE,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,eAAe,GAAG,CAAC,CAAC,CAAA;IACnD,OAAO,IAAI,0BAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;AAClC,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 { signAsync } from \"@electron/osx-sign\"\nimport { SignOptions } from \"@electron/osx-sign/dist/cjs/types\"\nimport { Identity as _Identity } from \"@electron/osx-sign/dist/cjs/util-identities\"\nimport { copyFile, exec, Fields, InvalidConfigurationError, isEmptyOrSpaces, isEnvTrue, isPullRequest, log, Logger, retry, TmpDir, unlinkIfExists } from \"builder-util\"\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 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 (isPullRequest()) {\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 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 if (isMas || isForceCodeSigning) {\n throw new Error(Logger.createMessage(\"skipped macOS application code signing\", logFields, \"error\", it => it))\n } else {\n log.warn(logFields, \"skipped macOS application code signing\")\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 return retry(() => signAsync(opts), 3, 5000, 5000)\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 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 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\nfunction parseIdentity(line: string): Identity {\n const firstQuoteIndex = line.indexOf('\"')\n const name = line.substring(firstQuoteIndex + 1, line.lastIndexOf('\"'))\n const hash = line.substring(0, firstQuoteIndex - 1)\n return new _Identity(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":";;;AA6BA,sCA4BC;AAED,kCAqCC;AA+CD,wCAOC;AAED,wCA8CC;AAiBD,oBAEC;AAsGD,oCAeC;AA9UD,iDAA8C;AAE9C,iFAAmF;AACnF,+CAAuK;AAEvK,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,CA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A,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 { signAsync } from \"@electron/osx-sign\"\nimport { SignOptions } from \"@electron/osx-sign/dist/cjs/types\"\nimport { Identity as _Identity } from \"@electron/osx-sign/dist/cjs/util-identities\"\nimport { copyFile, exec, Fields, InvalidConfigurationError, isEmptyOrSpaces, isEnvTrue, isPullRequest, log, Logger, retry, TmpDir, unlinkIfExists } from \"builder-util\"\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 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 (isPullRequest()) {\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 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 return retry(() => signAsync(opts), 3, 5000, 5000)\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 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 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\nfunction parseIdentity(line: string): Identity {\n const firstQuoteIndex = line.indexOf('\"')\n const name = line.substring(firstQuoteIndex + 1, line.lastIndexOf('\"'))\n const hash = line.substring(0, firstQuoteIndex - 1)\n return new _Identity(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"]}
@@ -99,7 +99,7 @@ class WindowsSignAzureManager {
99
99
  TimestampRfc3161: timestampRfc3161 || "http://timestamp.acs.microsoft.com",
100
100
  TimestampDigest: timestampDigest || "SHA256",
101
101
  FileDigest: fileDigest || "SHA256",
102
- Files: `"${options.path}"`,
102
+ Files: options.path,
103
103
  };
104
104
  const paramsString = Object.entries(params)
105
105
  .filter(([_, value]) => value != null)
@@ -1 +1 @@
1
- {"version":3,"file":"windowsSignAzureManager.js","sourceRoot":"","sources":["../../src/codeSign/windowsSignAzureManager.ts"],"names":[],"mappings":";;;AAAA,+CAAsE;AACtE,+DAA+C;AAC/C,uCAA+B;AAO/B,MAAa,uBAAuB;IAgBlC,YAA6B,QAAqB;QAArB,aAAQ,GAAR,QAAQ,CAAa;QAbzC,0BAAqB,GAAG,IAAI,eAAI,CAAuB,GAAG,EAAE;;YACnE,MAAM,aAAa,GAAG,MAAA,IAAI,CAAC,4BAA4B,CAAC,gBAAgB,0CAAE,aAAa,CAAA;YACvF,IAAI,aAAa,KAAK,IAAI,EAAE,CAAC;gBAC3B,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;YAC9B,CAAC;iBAAM,IAAI,aAAa,IAAI,IAAI,EAAE,CAAC;gBACjC,OAAO,OAAO,CAAC,OAAO,CAAC,IAAA,sBAAO,EAAC,aAAa,CAAC,CAAC,CAAA;YAChD,CAAC;YAED,6FAA6F;YAC7F,uBAAuB;YACvB,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;QAC9B,CAAC,CAAC,CAAA;QA6EO,YAAO,GAAG,IAAI,+BAAQ,CAC7B,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,C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,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,EAAE;YAC9B,MAAM,YAAY,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;YACtD,OAAO,CAAC,GAAG,GAAG,EAAE,IAAI,KAAK,EAAE,EAAE,IAAI,YAAY,GAAG,CAAC,CAAA;QACnD,CAAC,EAAE,EAAc,CAAC;aACjB,IAAI,CAAC,GAAG,CAAC,CAAA;QACZ,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,YAAY,EAAE,iBAAiB,EAAE,UAAU,EAAE,yBAAyB,YAAY,EAAE,CAAC,CAAC,CAAA;QAEzG,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AAnID,0DAmIC","sourcesContent":["import { asArray, InvalidConfigurationError, log } from \"builder-util\"\nimport { MemoLazy } from \"builder-util-runtime\"\nimport { Lazy } from \"lazy-val\"\nimport { WindowsAzureSigningConfiguration, WindowsConfiguration } from \"../options/winOptions\"\nimport { WinPackager } from \"../winPackager\"\nimport { SignManager } from \"./signManager\"\nimport { WindowsSignOptions } from \"./windowsCodeSign\"\nimport { CertificateFromStoreInfo, FileCodeSigningInfo } from \"./windowsSignToolManager\"\n\nexport class WindowsSignAzureManager implements SignManager {\n private readonly platformSpecificBuildOptions: WindowsConfiguration\n\n readonly computedPublisherName = new Lazy<Array<string> | null>(() => {\n const publisherName = this.platformSpecificBuildOptions.azureSignOptions?.publisherName\n if (publisherName === null) {\n return Promise.resolve(null)\n } else if (publisherName != null) {\n return Promise.resolve(asArray(publisherName))\n }\n\n // TODO: Is there another way to automatically pull Publisher Name from AzureTrusted service?\n // For now return null.\n return Promise.resolve(null)\n })\n\n constructor(private readonly packager: WinPackager) {\n this.platformSpecificBuildOptions = packager.platformSpecificBuildOptions\n }\n\n async initialize() {\n const vm = await this.packager.vm.value\n const ps = await vm.powershellCommand.value\n\n log.info(null, \"installing required module (TrustedSigning) with scope CurrentUser\")\n try {\n await vm.exec(ps, [\"-NoProfile\", \"-NonInteractive\", \"-Command\", \"Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force -Scope CurrentUser\"])\n } catch (error: any) {\n // Might not be needed, seems GH runners already have NuGet set up.\n // Logging to debug just in case users run into this. If NuGet isn't present, Install-Module -Name TrustedSigning will fail, so we'll get the logs at that point\n log.debug({ message: error.message || error.stack }, \"unable to install PackageProvider Nuget. Might be a false alarm though as some systems already have it installed\")\n }\n await vm.exec(ps, [\"-NoProfile\", \"-NonInteractive\", \"-Command\", \"Install-Module -Name TrustedSigning -MinimumVersion 0.5.0 -Force -Repository PSGallery -Scope CurrentUser\"])\n\n // Preemptively check env vars once during initialization\n // Options: https://learn.microsoft.com/en-us/dotnet/api/azure.identity.environmentcredential?view=azure-dotnet#definition\n log.info(null, \"verifying env vars for authenticating to Microsoft Entra ID\")\n this.verifyRequiredEnvVars()\n if (!(this.verifyPrincipleSecretEnv() || this.verifyPrincipleCertificateEnv() || this.verifyUsernamePasswordEnv())) {\n throw new InvalidConfigurationError(\n `Unable to find valid azure env configuration for signing. Missing field(s) can be debugged via \"DEBUG=electron-builder\". Please refer to: https://learn.microsoft.com/en-us/dotnet/api/azure.identity.environmentcredential?view=azure-dotnet#definition`\n )\n }\n }\n\n verifyRequiredEnvVars() {\n ;[\"AZURE_TENANT_ID\", \"AZURE_CLIENT_ID\"].forEach(field => {\n if (!process.env[field]) {\n throw new InvalidConfigurationError(\n `Unable to find valid azure env field ${field} for signing. Please refer to: https://learn.microsoft.com/en-us/dotnet/api/azure.identity.environmentcredential?view=azure-dotnet#definition`\n )\n }\n })\n }\n\n verifyPrincipleSecretEnv() {\n if (!process.env.AZURE_CLIENT_SECRET) {\n log.debug({ envVar: \"AZURE_CLIENT_SECRET\" }, \"no secret found for authenticating to Microsoft Entra ID\")\n return false\n }\n return true\n }\n\n verifyPrincipleCertificateEnv() {\n if (!process.env.AZURE_CLIENT_CERTIFICATE_PATH) {\n log.debug({ envVar: \"AZURE_CLIENT_CERTIFICATE_PATH\" }, \"no path found for signing certificate for authenticating to Microsoft Entra ID\")\n return false\n }\n if (!process.env.AZURE_CLIENT_CERTIFICATE_PASSWORD) {\n log.debug({ envVar: \"AZURE_CLIENT_CERTIFICATE_PASSWORD\" }, \"(optional) certificate password not found, assuming no password\")\n }\n if (!process.env.AZURE_CLIENT_SEND_CERTIFICATE_CHAIN) {\n log.debug({ envVar: \"AZURE_CLIENT_SEND_CERTIFICATE_CHAIN\" }, \"(optional) certificate chain not found\")\n }\n return true\n }\n\n verifyUsernamePasswordEnv() {\n if (!process.env.AZURE_USERNAME) {\n log.debug({ envVar: \"AZURE_USERNAME\" }, \"no username found for authenticating to Microsoft Entra ID\")\n if (!process.env.AZURE_PASSWORD) {\n log.debug({ envVar: \"AZURE_PASSWORD\" }, \"no password found for authenticating to Microsoft Entra ID\")\n }\n return false\n }\n return true\n }\n\n computePublisherName(): Promise<string> {\n return Promise.resolve(this.packager.platformSpecificBuildOptions.azureSignOptions!.publisherName)\n }\n readonly cscInfo = new MemoLazy<WindowsConfiguration, FileCodeSigningInfo | CertificateFromStoreInfo | null>(\n () => this.packager.platformSpecificBuildOptions,\n _selected => Promise.resolve(null)\n )\n // prerequisite: requires `initializeProviderModules` to already have been executed\n async signFile(options: WindowsSignOptions): Promise<boolean> {\n const vm = await this.packager.vm.value\n const ps = await vm.powershellCommand.value\n\n const {\n publisherName: _publisher, // extract from `extraSigningArgs`\n endpoint,\n certificateProfileName,\n codeSigningAccountName,\n fileDigest,\n timestampRfc3161,\n timestampDigest,\n ...extraSigningArgs\n }: WindowsAzureSigningConfiguration = options.options.azureSignOptions!\n const params = {\n ...extraSigningArgs,\n Endpoint: endpoint,\n CertificateProfileName: certificateProfileName,\n CodeSigningAccountName: codeSigningAccountName,\n TimestampRfc3161: timestampRfc3161 || \"http://timestamp.acs.microsoft.com\",\n TimestampDigest: timestampDigest || \"SHA256\",\n FileDigest: fileDigest || \"SHA256\",\n Files: `\"${options.path}\"`,\n }\n const paramsString = Object.entries(params)\n .filter(([_, value]) => value != null)\n .reduce((res, [field, value]) => {\n const escapedValue = String(value).replace(/'/g, \"''\")\n return [...res, `-${field}`, `'${escapedValue}'`]\n }, [] as string[])\n .join(\" \")\n await vm.exec(ps, [\"-NoProfile\", \"-NonInteractive\", \"-Command\", `Invoke-TrustedSigning ${paramsString}`])\n\n return true\n }\n}\n"]}
1
+ {"version":3,"file":"windowsSignAzureManager.js","sourceRoot":"","sources":["../../src/codeSign/windowsSignAzureManager.ts"],"names":[],"mappings":";;;AAAA,+CAAsE;AACtE,+DAA+C;AAC/C,uCAA+B;AAO/B,MAAa,uBAAuB;IAgBlC,YAA6B,QAAqB;QAArB,aAAQ,GAAR,QAAQ,CAAa;QAbzC,0BAAqB,GAAG,IAAI,eAAI,CAAuB,GAAG,EAAE;;YACnE,MAAM,aAAa,GAAG,MAAA,IAAI,CAAC,4BAA4B,CAAC,gBAAgB,0CAAE,aAAa,CAAA;YACvF,IAAI,aAAa,KAAK,IAAI,EAAE,CAAC;gBAC3B,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;YAC9B,CAAC;iBAAM,IAAI,aAAa,IAAI,IAAI,EAAE,CAAC;gBACjC,OAAO,OAAO,CAAC,OAAO,CAAC,IAAA,sBAAO,EAAC,aAAa,CAAC,CAAC,CAAA;YAChD,CAAC;YAED,6FAA6F;YAC7F,uBAAuB;YACvB,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;QAC9B,CAAC,CAAC,CAAA;QA6EO,YAAO,GAAG,IAAI,+BAAQ,CAC7B,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,4BAA4B,EAChD,SAAS,CAAC,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CACnC,CAAA;QA7EC,IAAI,CAAC,4BAA4B,GAAG,QAAQ,CAAC,4BAA4B,CAAA;IAC3E,C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D,OAAO,CAAC,GAAG,GAAG,EAAE,IAAI,KAAK,EAAE,EAAE,IAAI,YAAY,GAAG,CAAC,CAAA;QACnD,CAAC,EAAE,EAAc,CAAC;aACjB,IAAI,CAAC,GAAG,CAAC,CAAA;QACZ,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,YAAY,EAAE,iBAAiB,EAAE,UAAU,EAAE,yBAAyB,YAAY,EAAE,CAAC,CAAC,CAAA;QAEzG,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AAnID,0DAmIC","sourcesContent":["import { asArray, InvalidConfigurationError, log } from \"builder-util\"\nimport { MemoLazy } from \"builder-util-runtime\"\nimport { Lazy } from \"lazy-val\"\nimport { WindowsAzureSigningConfiguration, WindowsConfiguration } from \"../options/winOptions\"\nimport { WinPackager } from \"../winPackager\"\nimport { SignManager } from \"./signManager\"\nimport { WindowsSignOptions } from \"./windowsCodeSign\"\nimport { CertificateFromStoreInfo, FileCodeSigningInfo } from \"./windowsSignToolManager\"\n\nexport class WindowsSignAzureManager implements SignManager {\n private readonly platformSpecificBuildOptions: WindowsConfiguration\n\n readonly computedPublisherName = new Lazy<Array<string> | null>(() => {\n const publisherName = this.platformSpecificBuildOptions.azureSignOptions?.publisherName\n if (publisherName === null) {\n return Promise.resolve(null)\n } else if (publisherName != null) {\n return Promise.resolve(asArray(publisherName))\n }\n\n // TODO: Is there another way to automatically pull Publisher Name from AzureTrusted service?\n // For now return null.\n return Promise.resolve(null)\n })\n\n constructor(private readonly packager: WinPackager) {\n this.platformSpecificBuildOptions = packager.platformSpecificBuildOptions\n }\n\n async initialize() {\n const vm = await this.packager.vm.value\n const ps = await vm.powershellCommand.value\n\n log.info(null, \"installing required module (TrustedSigning) with scope CurrentUser\")\n try {\n await vm.exec(ps, [\"-NoProfile\", \"-NonInteractive\", \"-Command\", \"Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force -Scope CurrentUser\"])\n } catch (error: any) {\n // Might not be needed, seems GH runners already have NuGet set up.\n // Logging to debug just in case users run into this. If NuGet isn't present, Install-Module -Name TrustedSigning will fail, so we'll get the logs at that point\n log.debug({ message: error.message || error.stack }, \"unable to install PackageProvider Nuget. Might be a false alarm though as some systems already have it installed\")\n }\n await vm.exec(ps, [\"-NoProfile\", \"-NonInteractive\", \"-Command\", \"Install-Module -Name TrustedSigning -MinimumVersion 0.5.0 -Force -Repository PSGallery -Scope CurrentUser\"])\n\n // Preemptively check env vars once during initialization\n // Options: https://learn.microsoft.com/en-us/dotnet/api/azure.identity.environmentcredential?view=azure-dotnet#definition\n log.info(null, \"verifying env vars for authenticating to Microsoft Entra ID\")\n this.verifyRequiredEnvVars()\n if (!(this.verifyPrincipleSecretEnv() || this.verifyPrincipleCertificateEnv() || this.verifyUsernamePasswordEnv())) {\n throw new InvalidConfigurationError(\n `Unable to find valid azure env configuration for signing. Missing field(s) can be debugged via \"DEBUG=electron-builder\". Please refer to: https://learn.microsoft.com/en-us/dotnet/api/azure.identity.environmentcredential?view=azure-dotnet#definition`\n )\n }\n }\n\n verifyRequiredEnvVars() {\n ;[\"AZURE_TENANT_ID\", \"AZURE_CLIENT_ID\"].forEach(field => {\n if (!process.env[field]) {\n throw new InvalidConfigurationError(\n `Unable to find valid azure env field ${field} for signing. Please refer to: https://learn.microsoft.com/en-us/dotnet/api/azure.identity.environmentcredential?view=azure-dotnet#definition`\n )\n }\n })\n }\n\n verifyPrincipleSecretEnv() {\n if (!process.env.AZURE_CLIENT_SECRET) {\n log.debug({ envVar: \"AZURE_CLIENT_SECRET\" }, \"no secret found for authenticating to Microsoft Entra ID\")\n return false\n }\n return true\n }\n\n verifyPrincipleCertificateEnv() {\n if (!process.env.AZURE_CLIENT_CERTIFICATE_PATH) {\n log.debug({ envVar: \"AZURE_CLIENT_CERTIFICATE_PATH\" }, \"no path found for signing certificate for authenticating to Microsoft Entra ID\")\n return false\n }\n if (!process.env.AZURE_CLIENT_CERTIFICATE_PASSWORD) {\n log.debug({ envVar: \"AZURE_CLIENT_CERTIFICATE_PASSWORD\" }, \"(optional) certificate password not found, assuming no password\")\n }\n if (!process.env.AZURE_CLIENT_SEND_CERTIFICATE_CHAIN) {\n log.debug({ envVar: \"AZURE_CLIENT_SEND_CERTIFICATE_CHAIN\" }, \"(optional) certificate chain not found\")\n }\n return true\n }\n\n verifyUsernamePasswordEnv() {\n if (!process.env.AZURE_USERNAME) {\n log.debug({ envVar: \"AZURE_USERNAME\" }, \"no username found for authenticating to Microsoft Entra ID\")\n if (!process.env.AZURE_PASSWORD) {\n log.debug({ envVar: \"AZURE_PASSWORD\" }, \"no password found for authenticating to Microsoft Entra ID\")\n }\n return false\n }\n return true\n }\n\n computePublisherName(): Promise<string> {\n return Promise.resolve(this.packager.platformSpecificBuildOptions.azureSignOptions!.publisherName)\n }\n readonly cscInfo = new MemoLazy<WindowsConfiguration, FileCodeSigningInfo | CertificateFromStoreInfo | null>(\n () => this.packager.platformSpecificBuildOptions,\n _selected => Promise.resolve(null)\n )\n // prerequisite: requires `initializeProviderModules` to already have been executed\n async signFile(options: WindowsSignOptions): Promise<boolean> {\n const vm = await this.packager.vm.value\n const ps = await vm.powershellCommand.value\n\n const {\n publisherName: _publisher, // extract from `extraSigningArgs`\n endpoint,\n certificateProfileName,\n codeSigningAccountName,\n fileDigest,\n timestampRfc3161,\n timestampDigest,\n ...extraSigningArgs\n }: WindowsAzureSigningConfiguration = options.options.azureSignOptions!\n const params = {\n ...extraSigningArgs,\n Endpoint: endpoint,\n CertificateProfileName: certificateProfileName,\n CodeSigningAccountName: codeSigningAccountName,\n TimestampRfc3161: timestampRfc3161 || \"http://timestamp.acs.microsoft.com\",\n TimestampDigest: timestampDigest || \"SHA256\",\n FileDigest: fileDigest || \"SHA256\",\n Files: options.path,\n }\n const paramsString = Object.entries(params)\n .filter(([_, value]) => value != null)\n .reduce((res, [field, value]) => {\n const escapedValue = String(value).replace(/'/g, \"''\")\n return [...res, `-${field}`, `'${escapedValue}'`]\n }, [] as string[])\n .join(\" \")\n await vm.exec(ps, [\"-NoProfile\", \"-NonInteractive\", \"-Command\", `Invoke-TrustedSigning ${paramsString}`])\n\n return true\n }\n}\n"]}
@@ -169,6 +169,10 @@ export interface CommonConfiguration {
169
169
  * Ref: https://github.com/electron/fuses
170
170
  */
171
171
  readonly electronFuses?: FuseOptionsV1 | null;
172
+ /**
173
+ * [Experimental] Configuration for concurrent builds.
174
+ */
175
+ readonly concurrency?: Concurrency | null;
172
176
  }
173
177
  export interface Configuration extends CommonConfiguration, PlatformSpecificBuildOptions, Hooks {
174
178
  /**
@@ -402,3 +406,10 @@ export interface FuseOptionsV1 {
402
406
  */
403
407
  resetAdHocDarwinSignature?: boolean;
404
408
  }
409
+ export interface Concurrency {
410
+ /**
411
+ * The maximum number of concurrent jobs to run.
412
+ * @default 1
413
+ */
414
+ jobs: number;
415
+ }
@@ -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, ElectronDownloadOptions } from \"./electron/ElectronFramework\"\nimport { PrepareApplicationStageDirectoryOptions } from \"./Framework\"\nimport { AppXOptions } from \"./options/AppXOptions\"\nimport { AppImageOptions, DebOptions, FlatpakOptions, LinuxConfiguration, LinuxTargetSpecificOptions } 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 { 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\"\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 * 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 readonly nsis?: NsisOptions | null\n readonly nsisWeb?: NsisWebOptions | null\n readonly portable?: PortableOptions | null\n readonly appx?: AppXOptions | null\n /** @private */\n readonly msi?: MsiOptions | null\n /** @private */\n readonly msiWrapped?: MsiWrappedOptions | null\n readonly squirrelWindows?: SquirrelWindowsOptions | null\n\n /**\n * Options related to how build Linux targets.\n */\n readonly linux?: LinuxConfiguration | null\n /**\n * Debian package options.\n */\n readonly deb?: DebOptions | null\n /**\n * Snap options.\n */\n readonly snap?: SnapOptions | null\n /**\n * AppImage options.\n */\n readonly appImage?: AppImageOptions | null\n /**\n * Flatpak options.\n */\n readonly flatpak?: FlatpakOptions | null\n readonly pacman?: LinuxTargetSpecificOptions | null\n readonly rpm?: LinuxTargetSpecificOptions | null\n readonly freebsd?: LinuxTargetSpecificOptions | null\n readonly p5p?: LinuxTargetSpecificOptions | null\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}\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 */\n readonly electronCompile?: boolean\n\n /**\n * The [electron-download](https://github.com/electron-userland/electron-download#usage) options.\n */\n readonly electronDownload?: ElectronDownloadOptions\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 */\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 */\n readonly launchUiVersion?: boolean | string | null\n\n /**\n * The framework name. One of `electron`, `proton`, `libui`. Defaults to `electron`.\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\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\nexport interface Hooks {\n /**\nThe function (or path to file or module id) to be run before pack.\n\n```typescript\n(context: BeforePackContext): Promise<any> | any\n```\n\n!!! example \"As function\"\n\n ```js\n beforePack: async (context) => {\n // your code\n }\n ```\n\nBecause in a configuration file you cannot use JavaScript, can be specified as a path to file or module id. Function must be exported as default export.\n\n```json\n\"build\": {\n \"beforePack\": \"./myBeforePackHook.js\"\n}\n```\n\nFile `myBeforePackHook.js` in the project root directory:\n\n!!! example \"myBeforePackHook.js\"\n ```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](#afterextract)\n * Same setup as {@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](#afterpack) (but before pack into distributable format and sign).\n * Same setup as {@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](#aftersign) (but before pack into distributable format).\n * Same setup as {@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 on artifact build start.\n * Same setup as {@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 on artifact build completed.\n * Same setup as {@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\n```typescript\n(buildResult: BuildResult): Promise<Array<string>> | Array<string>\n```\n\nConfiguration in the same way as `afterPack` (see above).\n\n!!! example \"myAfterAllArtifactBuild.js\"\n ```js\n exports.default = function () {\n // you can 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](./file-patterns.md#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"]}
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, ElectronDownloadOptions } from \"./electron/ElectronFramework\"\nimport { PrepareApplicationStageDirectoryOptions } from \"./Framework\"\nimport { AppXOptions } from \"./options/AppXOptions\"\nimport { AppImageOptions, DebOptions, FlatpakOptions, LinuxConfiguration, LinuxTargetSpecificOptions } 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 { 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\"\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 * 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 readonly nsis?: NsisOptions | null\n readonly nsisWeb?: NsisWebOptions | null\n readonly portable?: PortableOptions | null\n readonly appx?: AppXOptions | null\n /** @private */\n readonly msi?: MsiOptions | null\n /** @private */\n readonly msiWrapped?: MsiWrappedOptions | null\n readonly squirrelWindows?: SquirrelWindowsOptions | null\n\n /**\n * Options related to how build Linux targets.\n */\n readonly linux?: LinuxConfiguration | null\n /**\n * Debian package options.\n */\n readonly deb?: DebOptions | null\n /**\n * Snap options.\n */\n readonly snap?: SnapOptions | null\n /**\n * AppImage options.\n */\n readonly appImage?: AppImageOptions | null\n /**\n * Flatpak options.\n */\n readonly flatpak?: FlatpakOptions | null\n readonly pacman?: LinuxTargetSpecificOptions | null\n readonly rpm?: LinuxTargetSpecificOptions | null\n readonly freebsd?: LinuxTargetSpecificOptions | null\n readonly p5p?: LinuxTargetSpecificOptions | null\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 */\n readonly electronCompile?: boolean\n\n /**\n * The [electron-download](https://github.com/electron-userland/electron-download#usage) options.\n */\n readonly electronDownload?: ElectronDownloadOptions\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 */\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 */\n readonly launchUiVersion?: boolean | string | null\n\n /**\n * The framework name. One of `electron`, `proton`, `libui`. Defaults to `electron`.\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\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\nexport interface Hooks {\n /**\nThe function (or path to file or module id) to be run before pack.\n\n```typescript\n(context: BeforePackContext): Promise<any> | any\n```\n\n!!! example \"As function\"\n\n ```js\n beforePack: async (context) => {\n // your code\n }\n ```\n\nBecause in a configuration file you cannot use JavaScript, can be specified as a path to file or module id. Function must be exported as default export.\n\n```json\n\"build\": {\n \"beforePack\": \"./myBeforePackHook.js\"\n}\n```\n\nFile `myBeforePackHook.js` in the project root directory:\n\n!!! example \"myBeforePackHook.js\"\n ```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](#afterextract)\n * Same setup as {@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](#afterpack) (but before pack into distributable format and sign).\n * Same setup as {@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](#aftersign) (but before pack into distributable format).\n * Same setup as {@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 on artifact build start.\n * Same setup as {@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 on artifact build completed.\n * Same setup as {@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\n```typescript\n(buildResult: BuildResult): Promise<Array<string>> | Array<string>\n```\n\nConfiguration in the same way as `afterPack` (see above).\n\n!!! example \"myAfterAllArtifactBuild.js\"\n ```js\n exports.default = function () {\n // you can 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](./file-patterns.md#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"]}
package/out/core.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Arch, ArchType } from "builder-util";
1
+ import { Arch, ArchType, AsyncTaskManager } from "builder-util";
2
2
  import { AllPublishOptions, Nullish } from "builder-util-runtime";
3
3
  export type Publish = AllPublishOptions | Array<AllPublishOptions> | null;
4
4
  export type TargetConfigType = Array<string | TargetConfiguration> | string | TargetConfiguration | null;
@@ -30,6 +30,7 @@ export declare abstract class Target {
30
30
  readonly isAsyncSupported: boolean;
31
31
  abstract readonly outDir: string;
32
32
  abstract readonly options: TargetSpecificOptions | Nullish;
33
+ readonly buildQueueManager: AsyncTaskManager;
33
34
  protected constructor(name: string, isAsyncSupported?: boolean);
34
35
  checkOptions(): Promise<any>;
35
36
  abstract build(appOutDir: string, arch: Arch): Promise<any>;
package/out/core.js CHANGED
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DIR_TARGET = exports.DEFAULT_TARGET = exports.Target = exports.Platform = void 0;
4
4
  const builder_util_1 = require("builder-util");
5
+ const builder_util_runtime_1 = require("builder-util-runtime");
5
6
  class Platform {
6
7
  constructor(name, buildConfigurationKey, nodeName) {
7
8
  this.name = name;
@@ -49,12 +50,14 @@ class Target {
49
50
  constructor(name, isAsyncSupported = true) {
50
51
  this.name = name;
51
52
  this.isAsyncSupported = isAsyncSupported;
53
+ // use only for tasks that cannot be executed in parallel (such as signing on windows and hdiutil on macOS due to file locking)
54
+ this.buildQueueManager = new builder_util_1.AsyncTaskManager(new builder_util_runtime_1.CancellationToken());
52
55
  }
53
56
  async checkOptions() {
54
57
  // ignore
55
58
  }
56
- finishBuild() {
57
- return Promise.resolve();
59
+ async finishBuild() {
60
+ await this.buildQueueManager.awaitTasks();
58
61
  }
59
62
  }
60
63
  exports.Target = Target;
package/out/core.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":";;;AAAA,+CAA6D;AAoB7D,MAAa,QAAQ;IAKnB,YACS,IAAY,EACZ,qBAA6B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AAE,CAAC;YACb,KAAK,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC;YAC3B,KAAK,QAAQ,CAAC,GAAG,CAAC,IAAI;gBACpB,OAAO,QAAQ,CAAC,GAAG,CAAA;YAErB,KAAK,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC;YAC/B,KAAK,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC;YAC3B,KAAK,QAAQ,CAAC,OAAO,CAAC,qBAAqB;gBACzC,OAAO,QAAQ,CAAC,OAAO,CAAA;YAEzB,KAAK,QAAQ,CAAC,KAAK,CAAC,QAAQ;gBAC1B,OAAO,QAAQ,CAAC,KAAK,CAAA;YAEvB;gBACE,MAAM,IAAI,KAAK,CAAC,qBAAqB,IAAI,EAAE,CAAC,CAAA;QAChD,CAAC;IACH,CAAC;;AAlDH,4BAmDC;AAlDQ,YAAG,GAAG,IAAI,QAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAA;AAC1C,cAAK,GAAG,IAAI,QAAQ,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAA;AAC/C,gBAAO,GAAG,IAAI,QAAQ,CAAC,SAAS,EAAE,KAAK,EAAE,OAAO,CAAC,CAAA;AAkD1D,MAAsB,MAAM;IAI1B,YACW,IAAY,EACZ,mBAA4B,IAAI;QADhC,SAAI,GAAJ,IAAI,CAAQ;QACZ,qBAAgB,GAAhB,gBAAgB,CAAgB;IACxC,CAAC;IAEJ,KAAK,CAAC,YAAY;QAChB,SAAS;IACX,CAAC;IAID,WAAW;QACT,OAAO,OAAO,CAAC,OAAO,EAAE,CAAA;IAC1B,CAAC;CACF;AAlBD,wBAkBC;AAWY,QAAA,cAAc,GAAG,SAAS,CAAA;AAC1B,QAAA,UAAU,GAAG,KAAK,CAAA","sourcesContent":["import { Arch, archFromString, ArchType } from \"builder-util\"\nimport { AllPublishOptions, Nullish } from \"builder-util-runtime\"\n\n// https://github.com/YousefED/typescript-json-schema/issues/80\nexport type Publish = AllPublishOptions | Array<AllPublishOptions> | null\n\nexport type TargetConfigType = Array<string | TargetConfiguration> | string | TargetConfiguration | null\n\nexport interface TargetConfiguration {\n /**\n * The target name. e.g. `snap`.\n */\n readonly target: string\n\n /**\n * The arch or list of archs.\n */\n readonly arch?: Array<ArchType> | ArchType\n}\n\nexport class Platform {\n static MAC = new Platform(\"mac\", \"mac\", \"darwin\")\n static LINUX = new Platform(\"linux\", \"linux\", \"linux\")\n static WINDOWS = new Platform(\"windows\", \"win\", \"win32\")\n\n constructor(\n public name: string,\n public buildConfigurationKey: string,\n public nodeName: NodeJS.Platform\n ) {}\n\n toString() {\n return this.name\n }\n\n createTarget(type?: string | Array<string> | null, ...archs: Array<Arch>): Map<Platform, Map<Arch, Array<string>>> {\n if (type == null && (archs == null || archs.length === 0)) {\n return new Map([[this, new Map()]])\n }\n\n const archToType = new Map()\n\n for (const arch of archs == null || archs.length === 0 ? [archFromString(process.arch)] : archs) {\n archToType.set(arch, type == null ? [] : Array.isArray(type) ? type : [type])\n }\n return new Map([[this, archToType]])\n }\n\n static current(): Platform {\n return Platform.fromString(process.platform)\n }\n\n static fromString(name: string): Platform {\n name = name.toLowerCase()\n switch (name) {\n case Platform.MAC.nodeName:\n case Platform.MAC.name:\n return Platform.MAC\n\n case Platform.WINDOWS.nodeName:\n case Platform.WINDOWS.name:\n case Platform.WINDOWS.buildConfigurationKey:\n return Platform.WINDOWS\n\n case Platform.LINUX.nodeName:\n return Platform.LINUX\n\n default:\n throw new Error(`Unknown platform: ${name}`)\n }\n }\n}\n\nexport abstract class Target {\n abstract readonly outDir: string\n abstract readonly options: TargetSpecificOptions | Nullish\n\n protected constructor(\n readonly name: string,\n readonly isAsyncSupported: boolean = true\n ) {}\n\n async checkOptions(): Promise<any> {\n // ignore\n }\n\n abstract build(appOutDir: string, arch: Arch): Promise<any>\n\n finishBuild(): Promise<any> {\n return Promise.resolve()\n }\n}\n\nexport interface TargetSpecificOptions {\n /**\n The [artifact file name template](./configuration.md#artifact-file-name-template).\n */\n readonly artifactName?: string | null\n\n publish?: Publish\n}\n\nexport const DEFAULT_TARGET = \"default\"\nexport const DIR_TARGET = \"dir\"\n\nexport type CompressionLevel = \"store\" | \"normal\" | \"maximum\"\n\nexport interface BeforeBuildContext {\n readonly appDir: string\n readonly electronVersion: string\n readonly platform: Platform\n readonly arch: string\n}\n\nexport interface SourceRepositoryInfo {\n type?: string\n domain?: string\n user: string\n project: string\n}\n"]}
1
+ {"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":";;;AAAA,+CAA+E;AAC/E,+DAAoF;AAmBpF,MAAa,QAAQ;IAKnB,YACS,IAAY,EACZ,qBAA6B,EAC7B,QAAyB;QAFzB,SAAI,GAAJ,IAAI,CAAQ;QACZ,0BAAqB,GAArB,qBAAqB,CAAQ;QAC7B,aAAQ,GAAR,QAAQ,CAAiB;IAC/B,CAAC;IAEJ,QAAQ;QACN,OAAO,IAAI,CAAC,IAAI,CAAA;IAClB,CAAC;IAED,YAAY,CAAC,IAAoC,EAAE,GAAG,KAAkB;QACtE,IAAI,IAAI,IAAI,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,EAAE,CAAC;YAC1D,OAAO,IAAI,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,CAAA;QACrC,CAAC;QAED,MAAM,UAAU,GAAG,IAAI,GAAG,EAAE,CAAA;QAE5B,KAAK,MAAM,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAA,6BAAc,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC;YAChG,UAAU,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC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AO1B,YACW,IAAY,EACZ,mBAA4B,IAAI;QADhC,SAAI,GAAJ,IAAI,CAAQ;QACZ,qBAAgB,GAAhB,gBAAgB,CAAgB;QAL3C,+HAA+H;QACtH,sBAAiB,GAAG,IAAI,+BAAgB,CAAC,IAAI,wCAAiB,EAAE,CAAC,CAAA;IAKvE,CAAC;IAEJ,KAAK,CAAC,YAAY;QAChB,SAAS;IACX,CAAC;IAID,KAAK,CAAC,WAAW;QACf,MAAM,IAAI,CAAC,iBAAiB,CAAC,UAAU,EAAE,CAAA;IAC3C,CAAC;CACF;AArBD,wBAqBC;AAWY,QAAA,cAAc,GAAG,SAAS,CAAA;AAC1B,QAAA,UAAU,GAAG,KAAK,CAAA","sourcesContent":["import { Arch, archFromString, ArchType, AsyncTaskManager } from \"builder-util\"\nimport { AllPublishOptions, CancellationToken, Nullish } from \"builder-util-runtime\"\n\n// https://github.com/YousefED/typescript-json-schema/issues/80\nexport type Publish = AllPublishOptions | Array<AllPublishOptions> | null\n\nexport type TargetConfigType = Array<string | TargetConfiguration> | string | TargetConfiguration | null\n\nexport interface TargetConfiguration {\n /**\n * The target name. e.g. `snap`.\n */\n readonly target: string\n\n /**\n * The arch or list of archs.\n */\n readonly arch?: Array<ArchType> | ArchType\n}\n\nexport class Platform {\n static MAC = new Platform(\"mac\", \"mac\", \"darwin\")\n static LINUX = new Platform(\"linux\", \"linux\", \"linux\")\n static WINDOWS = new Platform(\"windows\", \"win\", \"win32\")\n\n constructor(\n public name: string,\n public buildConfigurationKey: string,\n public nodeName: NodeJS.Platform\n ) {}\n\n toString() {\n return this.name\n }\n\n createTarget(type?: string | Array<string> | null, ...archs: Array<Arch>): Map<Platform, Map<Arch, Array<string>>> {\n if (type == null && (archs == null || archs.length === 0)) {\n return new Map([[this, new Map()]])\n }\n\n const archToType = new Map()\n\n for (const arch of archs == null || archs.length === 0 ? [archFromString(process.arch)] : archs) {\n archToType.set(arch, type == null ? [] : Array.isArray(type) ? type : [type])\n }\n return new Map([[this, archToType]])\n }\n\n static current(): Platform {\n return Platform.fromString(process.platform)\n }\n\n static fromString(name: string): Platform {\n name = name.toLowerCase()\n switch (name) {\n case Platform.MAC.nodeName:\n case Platform.MAC.name:\n return Platform.MAC\n\n case Platform.WINDOWS.nodeName:\n case Platform.WINDOWS.name:\n case Platform.WINDOWS.buildConfigurationKey:\n return Platform.WINDOWS\n\n case Platform.LINUX.nodeName:\n return Platform.LINUX\n\n default:\n throw new Error(`Unknown platform: ${name}`)\n }\n }\n}\n\nexport abstract class Target {\n abstract readonly outDir: string\n abstract readonly options: TargetSpecificOptions | Nullish\n\n // use only for tasks that cannot be executed in parallel (such as signing on windows and hdiutil on macOS due to file locking)\n readonly buildQueueManager = new AsyncTaskManager(new CancellationToken())\n\n protected constructor(\n readonly name: string,\n readonly isAsyncSupported: boolean = true\n ) {}\n\n async checkOptions(): Promise<any> {\n // ignore\n }\n\n abstract build(appOutDir: string, arch: Arch): Promise<any>\n\n async finishBuild(): Promise<any> {\n await this.buildQueueManager.awaitTasks()\n }\n}\n\nexport interface TargetSpecificOptions {\n /**\n The [artifact file name template](./configuration.md#artifact-file-name-template).\n */\n readonly artifactName?: string | null\n\n publish?: Publish\n}\n\nexport const DEFAULT_TARGET = \"default\"\nexport const DIR_TARGET = \"dir\"\n\nexport type CompressionLevel = \"store\" | \"normal\" | \"maximum\"\n\nexport interface BeforeBuildContext {\n readonly appDir: string\n readonly electronVersion: string\n readonly platform: Platform\n readonly arch: string\n}\n\nexport interface SourceRepositoryInfo {\n type?: string\n domain?: string\n user: string\n project: string\n}\n"]}
@@ -1,8 +1,9 @@
1
1
  import { SignOptions } from "@electron/osx-sign/dist/cjs/types";
2
+ import { Identity } from "@electron/osx-sign/dist/cjs/util-identities";
2
3
  import { Arch, AsyncTaskManager } from "builder-util";
3
4
  import { MemoLazy, Nullish } from "builder-util-runtime";
4
5
  import { AppInfo } from "./appInfo";
5
- import { CodeSigningInfo, CreateKeychainOptions, Identity } from "./codeSign/macCodeSign";
6
+ import { CodeSigningInfo, CreateKeychainOptions } from "./codeSign/macCodeSign";
6
7
  import { Target } from "./core";
7
8
  import { AfterPackContext } from "./index";
8
9
  import { MacConfiguration } from "./options/macOptions";
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MacPackager = void 0;
4
4
  const notarize_1 = require("@electron/notarize");
5
+ const util_identities_1 = require("@electron/osx-sign/dist/cjs/util-identities");
5
6
  const builder_util_1 = require("builder-util");
6
7
  const builder_util_runtime_1 = require("builder-util-runtime");
7
8
  const fs = require("fs/promises");
@@ -196,11 +197,15 @@ class MacPackager extends platformPackager_1.PlatformPackager {
196
197
  const isMas = masOptions != null;
197
198
  const options = masOptions == null ? this.platformSpecificBuildOptions : masOptions;
198
199
  const qualifier = options.identity;
200
+ const fallBackToAdhoc = (arch === builder_util_1.Arch.arm64 || arch === builder_util_1.Arch.universal) && !this.forceCodeSigning;
199
201
  if (qualifier === null) {
200
202
  if (this.forceCodeSigning) {
201
203
  throw new builder_util_1.InvalidConfigurationError("identity explicitly is set to null, but forceCodeSigning is set to true");
202
204
  }
203
205
  builder_util_1.log.info({ reason: "identity explicitly is set to null" }, "skipped macOS code signing");
206
+ if (fallBackToAdhoc) {
207
+ builder_util_1.log.warn("arm64 requires signing, but identity is set to null and signing is being skipped");
208
+ }
204
209
  return false;
205
210
  }
206
211
  const keychainFile = (await this.codeSigningInfo.value).keychainFile;
@@ -222,7 +227,15 @@ class MacPackager extends platformPackager_1.PlatformPackager {
222
227
  builder_util_1.log.warn("Mac Developer is used to sign app — it is only for development and testing, not for production");
223
228
  }
224
229
  }
225
- if (!options.sign && identity == null) {
230
+ const noIdentity = !options.sign && identity == null;
231
+ if (qualifier === "-") {
232
+ identity = new util_identities_1.Identity("-", undefined);
233
+ }
234
+ else if (noIdentity && fallBackToAdhoc) {
235
+ builder_util_1.log.warn(null, "falling back to ad-hoc signature for macOS application code signing");
236
+ identity = new util_identities_1.Identity("-", undefined);
237
+ }
238
+ else if (noIdentity) {
226
239
  await (0, macCodeSign_1.reportError)(isMas, certificateTypes, qualifier, keychainFile, this.forceCodeSigning);
227
240
  return false;
228
241
  }
@@ -299,7 +312,13 @@ class MacPackager extends platformPackager_1.PlatformPackager {
299
312
  const artifactName = this.expandArtifactNamePattern(masOptions, "pkg", arch);
300
313
  const artifactPath = path.join(outDir, artifactName);
301
314
  await this.doFlat(appPath, artifactPath, masInstallerIdentity, keychainFile);
302
- await this.dispatchArtifactCreated(artifactPath, null, builder_util_1.Arch.x64, this.computeSafeArtifactName(artifactName, "pkg", arch, true, this.platformSpecificBuildOptions.defaultArch));
315
+ await this.info.emitArtifactBuildCompleted({
316
+ file: artifactPath,
317
+ target: null,
318
+ arch: builder_util_1.Arch.x64,
319
+ safeArtifactName: this.computeSafeArtifactName(artifactName, "pkg", arch, true, this.platformSpecificBuildOptions.defaultArch),
320
+ packager: this,
321
+ });
303
322
  }
304
323
  if (!isMas) {
305
324
  await this.notarizeIfProvided(appPath);
@@ -424,7 +443,7 @@ class MacPackager extends platformPackager_1.PlatformPackager {
424
443
  const readDirectoryAndSign = async (sourceDirectory, directories, shouldSign) => {
425
444
  await Promise.all(directories.map(async (file) => {
426
445
  if (shouldSign(file)) {
427
- await this.sign(path.join(sourceDirectory, file), null, null, null);
446
+ await this.sign(path.join(sourceDirectory, file), null, null, packContext.arch);
428
447
  }
429
448
  }));
430
449
  return true;