app-builder-lib 27.0.0-alpha.13 → 27.0.0-alpha.15

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 (203) hide show
  1. package/dist/codeSign/win/hsmSignManager.d.ts.map +1 -1
  2. package/dist/codeSign/win/hsmSignManager.js +3 -2
  3. package/dist/codeSign/win/hsmSignManager.js.map +1 -1
  4. package/dist/codeSign/win/pkcs11SignManager.d.ts.map +1 -1
  5. package/dist/codeSign/win/pkcs11SignManager.js +2 -1
  6. package/dist/codeSign/win/pkcs11SignManager.js.map +1 -1
  7. package/dist/codeSign/win/signtoolBaseSignManager.d.ts.map +1 -1
  8. package/dist/codeSign/win/signtoolBaseSignManager.js +15 -5
  9. package/dist/codeSign/win/signtoolBaseSignManager.js.map +1 -1
  10. package/dist/configuration.d.ts +78 -20
  11. package/dist/configuration.d.ts.map +1 -1
  12. package/dist/configuration.js.map +1 -1
  13. package/dist/indexInternal.d.ts +5 -3
  14. package/dist/indexInternal.d.ts.map +1 -1
  15. package/dist/indexInternal.js +4 -3
  16. package/dist/indexInternal.js.map +1 -1
  17. package/dist/options/FileAssociation.d.ts +1 -1
  18. package/dist/options/FileAssociation.js.map +1 -1
  19. package/dist/options/PlatformSpecificBuildOptions.d.ts +4 -1
  20. package/dist/options/PlatformSpecificBuildOptions.d.ts.map +1 -1
  21. package/dist/options/PlatformSpecificBuildOptions.js.map +1 -1
  22. package/dist/options/SnapOptions.d.ts +13 -3
  23. package/dist/options/SnapOptions.d.ts.map +1 -1
  24. package/dist/options/SnapOptions.js.map +1 -1
  25. package/dist/options/macOptions.d.ts +9 -6
  26. package/dist/options/macOptions.d.ts.map +1 -1
  27. package/dist/options/macOptions.js.map +1 -1
  28. package/dist/options/winOptions.d.ts +2 -2
  29. package/dist/options/winOptions.js.map +1 -1
  30. package/dist/packager.d.ts +22 -0
  31. package/dist/packager.d.ts.map +1 -1
  32. package/dist/packager.js +115 -66
  33. package/dist/packager.js.map +1 -1
  34. package/dist/platformPackager.d.ts.map +1 -1
  35. package/dist/platformPackager.js +10 -8
  36. package/dist/platformPackager.js.map +1 -1
  37. package/dist/publish/PublishManager.d.ts +5 -0
  38. package/dist/publish/PublishManager.d.ts.map +1 -1
  39. package/dist/publish/PublishManager.js +102 -24
  40. package/dist/publish/PublishManager.js.map +1 -1
  41. package/dist/publish/manifestUploadCheck.d.ts +12 -0
  42. package/dist/publish/manifestUploadCheck.d.ts.map +1 -1
  43. package/dist/publish/manifestUploadCheck.js +84 -12
  44. package/dist/publish/manifestUploadCheck.js.map +1 -1
  45. package/dist/publish/updateInfoBuilder.d.ts.map +1 -1
  46. package/dist/publish/updateInfoBuilder.js +12 -7
  47. package/dist/publish/updateInfoBuilder.js.map +1 -1
  48. package/dist/publish/updateManifestVerifier.d.ts +54 -0
  49. package/dist/publish/updateManifestVerifier.d.ts.map +1 -1
  50. package/dist/publish/updateManifestVerifier.js +121 -1
  51. package/dist/publish/updateManifestVerifier.js.map +1 -1
  52. package/dist/publish/updaterSettingsCheck.d.ts +8 -0
  53. package/dist/publish/updaterSettingsCheck.d.ts.map +1 -0
  54. package/dist/publish/updaterSettingsCheck.js +136 -0
  55. package/dist/publish/updaterSettingsCheck.js.map +1 -0
  56. package/dist/targets/ArchiveTarget.js +1 -1
  57. package/dist/targets/ArchiveTarget.js.map +1 -1
  58. package/dist/targets/archive.d.ts.map +1 -1
  59. package/dist/targets/archive.js +4 -3
  60. package/dist/targets/archive.js.map +1 -1
  61. package/dist/targets/blockmap/blockmap.d.ts +30 -0
  62. package/dist/targets/blockmap/blockmap.d.ts.map +1 -1
  63. package/dist/targets/blockmap/blockmap.js +99 -31
  64. package/dist/targets/blockmap/blockmap.js.map +1 -1
  65. package/dist/targets/blockmap/blockmapV3.d.ts +36 -0
  66. package/dist/targets/blockmap/blockmapV3.d.ts.map +1 -0
  67. package/dist/targets/blockmap/blockmapV3.js +41 -0
  68. package/dist/targets/blockmap/blockmapV3.js.map +1 -0
  69. package/dist/targets/blockmap/verbatimRange.d.ts +6 -0
  70. package/dist/targets/blockmap/verbatimRange.d.ts.map +1 -1
  71. package/dist/targets/blockmap/verbatimRange.js +11 -0
  72. package/dist/targets/blockmap/verbatimRange.js.map +1 -1
  73. package/dist/targets/differentialUpdateInfoBuilder.d.ts +92 -4
  74. package/dist/targets/differentialUpdateInfoBuilder.d.ts.map +1 -1
  75. package/dist/targets/differentialUpdateInfoBuilder.js +266 -10
  76. package/dist/targets/differentialUpdateInfoBuilder.js.map +1 -1
  77. package/dist/targets/linux/FlatpakTarget.js +1 -1
  78. package/dist/targets/linux/FlatpakTarget.js.map +1 -1
  79. package/dist/targets/linux/FpmTarget.d.ts.map +1 -1
  80. package/dist/targets/linux/FpmTarget.js +23 -31
  81. package/dist/targets/linux/FpmTarget.js.map +1 -1
  82. package/dist/targets/linux/LinuxTargetHelper.d.ts.map +1 -1
  83. package/dist/targets/linux/LinuxTargetHelper.js +6 -14
  84. package/dist/targets/linux/LinuxTargetHelper.js.map +1 -1
  85. package/dist/targets/linux/appimage/appLauncher.d.ts +4 -3
  86. package/dist/targets/linux/appimage/appLauncher.d.ts.map +1 -1
  87. package/dist/targets/linux/appimage/appLauncher.js +10 -6
  88. package/dist/targets/linux/appimage/appLauncher.js.map +1 -1
  89. package/dist/targets/linux/snap/coreLegacy.d.ts +8 -0
  90. package/dist/targets/linux/snap/coreLegacy.d.ts.map +1 -1
  91. package/dist/targets/linux/snap/coreLegacy.js +42 -9
  92. package/dist/targets/linux/snap/coreLegacy.js.map +1 -1
  93. package/dist/targets/mac/pkg.d.ts.map +1 -1
  94. package/dist/targets/mac/pkg.js +13 -9
  95. package/dist/targets/mac/pkg.js.map +1 -1
  96. package/dist/targets/targetFactory.d.ts +22 -3
  97. package/dist/targets/targetFactory.d.ts.map +1 -1
  98. package/dist/targets/targetFactory.js +70 -29
  99. package/dist/targets/targetFactory.js.map +1 -1
  100. package/dist/targets/win/MsiTarget.d.ts +7 -0
  101. package/dist/targets/win/MsiTarget.d.ts.map +1 -1
  102. package/dist/targets/win/MsiTarget.js +140 -21
  103. package/dist/targets/win/MsiTarget.js.map +1 -1
  104. package/dist/targets/win/nsis/Defines.d.ts +1 -0
  105. package/dist/targets/win/nsis/Defines.d.ts.map +1 -1
  106. package/dist/targets/win/nsis/Defines.js.map +1 -1
  107. package/dist/targets/win/nsis/NsisTarget.d.ts +3 -0
  108. package/dist/targets/win/nsis/NsisTarget.d.ts.map +1 -1
  109. package/dist/targets/win/nsis/NsisTarget.js +33 -12
  110. package/dist/targets/win/nsis/NsisTarget.js.map +1 -1
  111. package/dist/targets/win/nsis/nsisLicense.d.ts.map +1 -1
  112. package/dist/targets/win/nsis/nsisLicense.js +8 -5
  113. package/dist/targets/win/nsis/nsisLicense.js.map +1 -1
  114. package/dist/targets/win/nsis/nsisOptions.d.ts +31 -3
  115. package/dist/targets/win/nsis/nsisOptions.d.ts.map +1 -1
  116. package/dist/targets/win/nsis/nsisOptions.js.map +1 -1
  117. package/dist/targets/win/nsis/nsisScriptGenerator.d.ts +6 -0
  118. package/dist/targets/win/nsis/nsisScriptGenerator.d.ts.map +1 -1
  119. package/dist/targets/win/nsis/nsisScriptGenerator.js +16 -5
  120. package/dist/targets/win/nsis/nsisScriptGenerator.js.map +1 -1
  121. package/dist/targets/win/nsis/nsisUtil.d.ts.map +1 -1
  122. package/dist/targets/win/nsis/nsisUtil.js +11 -29
  123. package/dist/targets/win/nsis/nsisUtil.js.map +1 -1
  124. package/dist/toolsets/7zip.d.ts +10 -0
  125. package/dist/toolsets/7zip.d.ts.map +1 -1
  126. package/dist/toolsets/7zip.js +12 -1
  127. package/dist/toolsets/7zip.js.map +1 -1
  128. package/dist/toolsets/appimage.d.ts +3 -0
  129. package/dist/toolsets/appimage.d.ts.map +1 -1
  130. package/dist/toolsets/appimage.js +4 -1
  131. package/dist/toolsets/appimage.js.map +1 -1
  132. package/dist/toolsets/archive.d.ts +13 -0
  133. package/dist/toolsets/archive.d.ts.map +1 -0
  134. package/dist/toolsets/archive.js +55 -0
  135. package/dist/toolsets/archive.js.map +1 -0
  136. package/dist/toolsets/custom.d.ts.map +1 -1
  137. package/dist/toolsets/custom.js +19 -2
  138. package/dist/toolsets/custom.js.map +1 -1
  139. package/dist/toolsets/fpm.d.ts +23 -0
  140. package/dist/toolsets/fpm.d.ts.map +1 -1
  141. package/dist/toolsets/fpm.js +52 -19
  142. package/dist/toolsets/fpm.js.map +1 -1
  143. package/dist/toolsets/nsis.d.ts +23 -4
  144. package/dist/toolsets/nsis.d.ts.map +1 -1
  145. package/dist/toolsets/nsis.js +49 -14
  146. package/dist/toolsets/nsis.js.map +1 -1
  147. package/dist/toolsets/winCodeSign.d.ts +20 -1
  148. package/dist/toolsets/winCodeSign.d.ts.map +1 -1
  149. package/dist/toolsets/winCodeSign.js +32 -5
  150. package/dist/toolsets/winCodeSign.js.map +1 -1
  151. package/dist/toolsets/wix.d.ts +44 -0
  152. package/dist/toolsets/wix.d.ts.map +1 -0
  153. package/dist/toolsets/wix.js +91 -0
  154. package/dist/toolsets/wix.js.map +1 -0
  155. package/dist/util/buildOutputVerifier.d.ts +2 -1
  156. package/dist/util/buildOutputVerifier.d.ts.map +1 -1
  157. package/dist/util/buildOutputVerifier.js +41 -63
  158. package/dist/util/buildOutputVerifier.js.map +1 -1
  159. package/dist/util/bundledTool.d.ts +8 -0
  160. package/dist/util/bundledTool.d.ts.map +1 -1
  161. package/dist/util/bundledTool.js +34 -0
  162. package/dist/util/bundledTool.js.map +1 -1
  163. package/dist/util/electronGet.d.ts.map +1 -1
  164. package/dist/util/electronGet.js +107 -10
  165. package/dist/util/electronGet.js.map +1 -1
  166. package/dist/util/electronUpdaterCompatibility.d.ts +64 -0
  167. package/dist/util/electronUpdaterCompatibility.d.ts.map +1 -0
  168. package/dist/util/electronUpdaterCompatibility.js +82 -0
  169. package/dist/util/electronUpdaterCompatibility.js.map +1 -0
  170. package/dist/util/flags.d.ts +5 -0
  171. package/dist/util/flags.d.ts.map +1 -1
  172. package/dist/util/flags.js +8 -2
  173. package/dist/util/flags.js.map +1 -1
  174. package/dist/util/mac/macosVersion.d.ts +0 -1
  175. package/dist/util/mac/macosVersion.d.ts.map +1 -1
  176. package/dist/util/mac/macosVersion.js +0 -21
  177. package/dist/util/mac/macosVersion.js.map +1 -1
  178. package/dist/util/packageMetadata.d.ts +14 -1
  179. package/dist/util/packageMetadata.d.ts.map +1 -1
  180. package/dist/util/packageMetadata.js +115 -51
  181. package/dist/util/packageMetadata.js.map +1 -1
  182. package/dist/util/removedEnvVars.js +1 -1
  183. package/dist/util/removedEnvVars.js.map +1 -1
  184. package/dist/version.d.ts +1 -1
  185. package/dist/version.js +1 -1
  186. package/dist/version.js.map +1 -1
  187. package/package.json +8 -8
  188. package/scheme.json +182 -49
  189. package/templates/msi/template.xml +5 -5
  190. package/templates/msiWrapped/template.xml +1 -1
  191. package/templates/nsis/assistedInstaller.nsh +37 -1
  192. package/templates/nsis/common.nsh +142 -1
  193. package/templates/nsis/include/installUtil.nsh +12 -0
  194. package/templates/nsis/include/installer.nsh +12 -0
  195. package/templates/nsis/installSection.nsh +3 -0
  196. package/templates/nsis/installer.nsi +25 -13
  197. package/templates/nsis/multiUser.nsh +50 -10
  198. package/templates/nsis/portable.nsi +1 -1
  199. package/templates/nsis/uninstaller.nsh +6 -0
  200. package/dist/toolsets/linuxToolsMac.d.ts +0 -8
  201. package/dist/toolsets/linuxToolsMac.d.ts.map +0 -1
  202. package/dist/toolsets/linuxToolsMac.js +0 -44
  203. package/dist/toolsets/linuxToolsMac.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"macOptions.js","sourceRoot":"","sources":["../../src/options/macOptions.ts"],"names":[],"mappings":"","sourcesContent":["import { TargetConfiguration, TargetSpecificOptions } from \"../core.js\"\nimport { PlatformSpecificBuildOptions } from \"./PlatformSpecificBuildOptions.js\"\nimport { CustomMacSign } from \"../macPackager.js\"\nimport type { OnlySignOptions, SigningDistributionType } from \"@electron/osx-sign\"\nimport type { MakeUniversalOpts } from \"@electron/universal\"\n\n/**\n * Options forwarded to `@electron/universal`'s `makeUniversalApp`.\n * Electron-builder fills in the app paths and `force`; everything else is configurable here\n * and auto-tracks upstream additions to `MakeUniversalOpts`.\n *\n * @see https://github.com/electron/universal\n */\nexport interface ElectronUniversalOptions extends Omit<MakeUniversalOpts, \"x64AppPath\" | \"arm64AppPath\" | \"outAppPath\" | \"force\"> {\n /**\n * Whether to merge x64 and arm64 ASARs into one.\n *\n * @default true\n */\n mergeASARs?: boolean\n}\n\n/**\n * Signing options passed to `@electron/osx-sign`. Electron-builder owns the fields it must control\n * itself — `app`, `keychain`, `platform`, `version`, and `optionsForFile` — and forwards everything else.\n *\n * Additionally exposes a small set of per-file convenience fields that electron-builder maps\n * internally through `optionsForFile`.\n *\n * @see https://packages.electronjs.org/osx-sign\n */\nexport interface ElectronSignOptions extends Omit<OnlySignOptions, \"optionsForFile\" | \"version\"> {\n /**\n * The type of certificate to use when signing: `development` or `distribution`.\n *\n * Defaults to a value derived from the build flavor: `mas-dev` → `development`, otherwise `distribution`.\n * Set it explicitly to override — e.g. `development` on a darwin build signs with a `Mac Developer` or\n * `Apple Development` certificate instead of `Developer ID Application` and embeds a matching\n * development provisioning profile.\n *\n * Development-signed apps are blocked by Gatekeeper on other machines; users must use the\n * right-click → Open workaround documented at https://support.apple.com/en-us/guide/mac-help/mh40616/mac.\n * Such builds are not suitable for production distribution and cannot be notarized.\n */\n readonly type?: SigningDistributionType\n /**\n * The signing identity (certificate name or SHA-1 hash). Applies to both app signing and DMG signing.\n * Prefer the environment variables `CSC_LINK` / `CSC_NAME` over hardcoding this value.\n *\n * - **Not set** (default): electron-builder searches the keychain for a valid certificate.\n * - **`null`**: skip signing entirely.\n * - **`\"-\"`**: ad-hoc signing (requires disabling library validation — see `hardenedRuntime`).\n */\n readonly identity?: string | null\n /**\n * Path to the main app entitlements file. Resolved relative to the build resources directory, then the project directory.\n * Falls back to `build/entitlements.mac.plist` (or `build/entitlements.mas.plist` for MAS targets) if it exists.\n * Otherwise `mac` builds use the bundled default, which grants only `com.apple.security.cs.allow-jit`\n * (ad-hoc builds use a bundled ad-hoc template that also disables library validation), and MAS builds use\n * `@electron/osx-sign`'s built-in sandboxed `default.mas.plist`.\n */\n readonly entitlements?: string | null\n /**\n * Path to child entitlements inherited by embedded frameworks and bundles. Resolved relative to the build resources directory, then the project directory.\n * Falls back to `build/entitlements.mac.inherit.plist` (or `build/entitlements.mas.inherit.plist` for MAS targets) if it exists.\n * Otherwise nested binaries receive `@electron/osx-sign`'s per-file defaults (renderer/GPU helpers: `allow-jit`;\n * plugin helper: Chromium's looser set; everything else: `default.darwin.plist`); ad-hoc `mac` builds use the\n * bundled ad-hoc template instead.\n */\n readonly entitlementsInherit?: string | null\n /**\n * Path to entitlements for the Login Helper.\n * Required when using App Sandbox, because the Login Helper cannot inherit entitlements.\n * Defaults to the value of `entitlements`.\n */\n readonly entitlementsLoginHelper?: string | null\n /**\n * Whether to enable [Hardened Runtime](https://developer.apple.com/documentation/security/hardened_runtime).\n *\n * Hardened Runtime is a prerequisite for notarization (mandatory on macOS 10.15+).\n * Defaults to `true` for `darwin` builds and `false` for MAS builds (`mas` and `mas-dev`).\n */\n readonly hardenedRuntime?: boolean\n /**\n * Path to a [requirements file](https://developer.apple.com/library/mac/documentation/Security/Conceptual/CodeSigningGuide/RequirementLang/RequirementLang.html).\n * Not applicable for MAS.\n */\n readonly requirements?: string | null\n /**\n * URL of the timestamp authority server. Passed per-file to `codesign --timestamp=<url>`.\n */\n readonly timestamp?: string | null\n /**\n * Extra arguments passed to each `codesign` invocation.\n * @example [\"--deep\"]\n */\n readonly additionalArguments?: Array<string> | null\n}\n\nexport type MacOsTargetName = \"default\" | \"dmg\" | \"mas\" | \"mas-dev\" | \"pkg\" | \"7z\" | \"zip\" | \"tar.xz\" | \"tar.lz\" | \"tar.gz\" | \"tar.bz2\" | \"dir\"\n\nexport interface MacConfiguration extends PlatformSpecificBuildOptions {\n /**\n * The application category type, as shown in the Finder via *View -> Arrange by Application Category* when viewing the Applications directory.\n *\n * For example, `\"category\": \"public.app-category.developer-tools\"` will set the application category to *Developer Tools*.\n *\n * Valid values are listed in [Apple's documentation](https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/LaunchServicesKeys.html#//apple_ref/doc/uid/TP40009250-SW8).\n */\n readonly category?: string | null\n\n /**\n * The target package type: list of `default`, `dmg`, `mas`, `mas-dev`, `pkg`, `7z`, `zip`, `tar.xz`, `tar.lz`, `tar.gz`, `tar.bz2`, `dir`.\n * Note: Squirrel.Mac auto update mechanism requires both `dmg` and `zip` to be enabled, even when only `dmg` is used. Disabling `zip` will break auto update in `dmg` packages.\n * @default default (dmg and zip for Squirrel.Mac)\n */\n readonly target?: Array<MacOsTargetName | TargetConfiguration> | MacOsTargetName | TargetConfiguration | null\n\n /**\n * The path to application icon.\n * Accepts `.icns` (legacy) or `.icon` (Icon Composer asset).\n * If a `.icon` asset is provided, it will be preferred and compiled to an asset catalog.\n * @default build/icon.icns\n */\n readonly icon?: string | null\n\n /**\n * The `CFBundleVersion`. Do not use it unless [you need to](https://github.com/electron-userland/electron-builder/issues/565#issuecomment-230678643).\n */\n readonly bundleVersion?: string | null\n\n /**\n * The `CFBundleShortVersionString`. Do not use it unless you need to.\n */\n readonly bundleShortVersion?: string | null\n\n /**\n * Whether a dark mode is supported. If your app does have a dark mode, you can make your app follow the system-wide dark mode setting.\n * @default false\n */\n readonly darkModeSupport?: boolean\n\n /**\n * The bundle identifier to use in the application helper's plist.\n * @default ${appBundleIdentifier}.helper\n */\n readonly helperBundleId?: string | null\n\n /**\n * The bundle identifier to use in the Renderer helper's plist.\n * @default ${appBundleIdentifier}.helper.Renderer\n */\n readonly helperRendererBundleId?: string | null\n\n /**\n * The bundle identifier to use in the Plugin helper's plist.\n * @default ${appBundleIdentifier}.helper.Plugin\n */\n readonly helperPluginBundleId?: string | null\n\n /**\n * The bundle identifier to use in the GPU helper's plist.\n * @default ${appBundleIdentifier}.helper.GPU\n */\n readonly helperGPUBundleId?: string | null\n\n /**\n * The bundle identifier to use in the EH helper's plist.\n * @default ${appBundleIdentifier}.helper.EH\n */\n readonly helperEHBundleId?: string | null\n\n /**\n * The bundle identifier to use in the NP helper's plist.\n * @default ${appBundleIdentifier}.helper.NP\n */\n readonly helperNPBundleId?: string | null\n\n /**\n * The extra entries for `Info.plist`.\n */\n readonly extendInfo?: any\n\n /**\n * The minimum version of macOS required for the app to run. Corresponds to `LSMinimumSystemVersion`.\n */\n readonly minimumSystemVersion?: string | null\n\n /** @private */\n readonly cscInstallerLink?: string | null\n /** @private */\n readonly cscInstallerKeyPassword?: string | null\n\n /**\n * Extra files to put in archive. Not applicable for `tar.*`.\n */\n readonly extraDistFiles?: Array<string> | string | null\n\n /**\n * Codesigning configuration. The signing certificate is selected via `sign.identity` (or the\n * `CSC_LINK` / `CSC_NAME` environment variables).\n *\n * - **Not set** (default): electron-builder auto-discovers a valid certificate in the keychain. If none is found, signing is skipped.\n * - **`null`**: skip signing entirely.\n * - **`string`**: path or module ID of a file that exports a {@link CustomMacSign} function.\n * - **{@link CustomMacSign}**: inline custom signing function (JS/TS config only).\n * - **{@link ElectronSignOptions}**: options forwarded directly to `@electron/osx-sign`.\n *\n * @see {@link ElectronSignOptions}\n * @see https://www.electron.build/docs/features/code-signing\n */\n readonly sign?: CustomMacSign | ElectronSignOptions | string | null\n\n /**\n * Options forwarded to `@electron/universal` when building a universal (multi-arch) app.\n * Has no effect unless the target arch is `universal`.\n *\n * @see {@link ElectronUniversalOptions}\n * @see https://github.com/electron/universal\n */\n readonly universal?: ElectronUniversalOptions | null\n\n /**\n * Whether to notarize the app with [@electron/notarize](https://github.com/electron/notarize).\n *\n * - unset (the default): notarize when notarization credentials are set, otherwise skip it with a warning.\n * - `true`: notarization is required: the build fails when no credentials are set, wherever notarization would run (a macOS host,\n * outside a pull-request build, with signing not turned off), at build start and when notarizing.\n * - `false`: never notarize (for an ad-hoc or development-signed app, or one notarized in an `afterSign` hook).\n *\n * The credentials are one of the following sets of environment variables:\n *\n * 1. `APPLE_API_KEY` (path to the `.p8` file, or its contents base64-encoded), `APPLE_API_KEY_ID` and `APPLE_API_ISSUER`.\n * 2. `APPLE_ID`, `APPLE_APP_SPECIFIC_PASSWORD`, and `APPLE_TEAM_ID`\n * 3. `APPLE_KEYCHAIN` and `APPLE_KEYCHAIN_PROFILE`\n *\n * For security reasons it is recommended to use the first option (see https://github.com/electron-userland/electron-builder/issues/7859)\n */\n readonly notarize?: boolean\n\n /**\n * Whether to embed the [ASAR integrity](https://www.electronjs.org/docs/latest/tutorial/asar-integrity) digest into the Electron Framework binary.\n *\n * The digest covers the `ElectronAsarIntegrity` entries of `Info.plist`, so with the `enableEmbeddedAsarIntegrityValidation` fuse (see `electronFuses`) the app refuses to launch if those entries are changed, for example to match a modified `app.asar`. Embedding the digest modifies the Electron Framework, which is then signed again ad hoc; code signing the app replaces that signature.\n *\n * Applies only when:\n * - Electron is 41 or later\n * - the build runs on macOS (`codesign` signs the modified framework again)\n * - `asar` is enabled and `asar.disableIntegrity` is not `true`\n *\n * Set to `false` if you change `app.asar` or `Info.plist` after the `afterPack` hook, sign the app yourself in `afterPack`, or merge separately built `x64` and `arm64` apps with `@electron/universal` yourself (build the `universal` arch instead).\n * @default true\n */\n readonly asarIntegrityDigest?: boolean\n}\n\nexport interface DmgOptions extends TargetSpecificOptions {\n /**\n * The path to background image (default: `build/background.tiff` or `build/background.png` if exists). The resolution of this file determines the resolution of the installer window.\n * If background is not specified, use `window.size`. Default locations expected background size to be 540x380.\n * @see [DMG with Retina background support](http://stackoverflow.com/a/11204769/1910191).\n */\n background?: string | null\n\n /**\n * The background color (accepts css colors). Used when no background image is set.\n * @default #ffffff\n */\n backgroundColor?: string | null\n\n /**\n * The path to DMG icon (badge icon), which will be shown when mounted, relative to the [build resources](https://www.electron.build/contents#extraresources) or to the project directory.\n */\n badgeIcon?: string | null\n\n /**\n * The path to DMG icon (volume icon), which will be shown when mounted, relative to the [build resources](https://www.electron.build/contents#extraresources) or to the project directory.\n * Defaults to the application icon (`build/icon.icns`).\n */\n icon?: string | null\n\n /**\n * The size of all the icons inside the DMG.\n * @default 80\n */\n readonly iconSize?: number | null\n\n /**\n * The size of all the icon texts inside the DMG.\n * @default 12\n */\n readonly iconTextSize?: number | null\n\n /**\n * The title of the produced DMG, which will be shown when mounted (volume name).\n *\n * Macro `${productName}`, `${version}` and `${name}` are supported.\n * @default ${productName} ${version}\n */\n readonly title?: string | null\n\n /**\n * The content — to customize icon locations. The x and y coordinates refer to the position of the **center** of the icon (at 1x scale), and do not take the label into account.\n */\n contents?: Array<DmgContent>\n\n /**\n * The disk image format. `ULFO` (lzfse-compressed image (OS X 10.11+ only)). `ULMO` (lzma-compressed image (macOS 10.15+ only)).\n * @default UDZO\n */\n format?: \"UDRW\" | \"UDRO\" | \"UDCO\" | \"UDZO\" | \"UDBZ\" | \"ULFO\" | \"ULMO\"\n\n /**\n * The filesystem for the DMG volume (e.g. `\"APFS\"` or `\"HFS+\"`)\n * As of v27 this defaults to APFS. Set it explicitly to `\"HFS+\"` if you need compatibility with older macOS versions (pre-10.13 High Sierra cannot mount APFS volumes).\n * @default APFS\n */\n readonly filesystem?: \"HFS+\" | \"APFS\" | null\n\n /**\n * The initial size of the DMG filesystem. Accepts the same syntax as the `-size` argument to `hdiutil`, e.g. `\"150m\"`, `\"4g\"`.\n * If not specified, the size is calculated automatically.\n * Set this explicitly for large apps or apps with sparse files to avoid \"No space left on device\" errors.\n */\n readonly size?: string | null\n\n /**\n * Whether to shrink the DMG filesystem to the minimum size after copying files.\n * Set to `false` to preserve the explicit `size` you specified.\n * @default true\n */\n readonly shrink?: boolean\n\n /**\n * The DMG window position and size. With y co-ordinates running from bottom to top.\n *\n * The Finder makes sure that the window will be on the user’s display, so if you want your window at the top left of the display you could use `\"x\": 0, \"y\": 100000` as the x, y co-ordinates.\n * It is not to be possible to position the window relative to the [top left](https://github.com/electron-userland/electron-builder/issues/3990#issuecomment-512960957) or relative to the center of the user’s screen.\n */\n window?: DmgWindow\n\n /**\n * Whether to create internet-enabled disk image (when it is downloaded using a browser it will automatically decompress the image, put the application on the desktop, unmount and remove the disk image file).\n * @default false\n */\n readonly internetEnabled?: boolean\n\n /**\n * Whether to sign the DMG or not. Signing is not required and will lead to unwanted errors in combination with notarization requirements.\n * @default false\n */\n readonly sign?: boolean\n\n /**\n * License agreement to display when the DMG is mounted.\n *\n * Accepts a single file path (`.rtf`, `.txt`, or `.html`) used as the English/default license,\n * or a language-code → file-path map for multi-language builds.\n *\n * When set, this takes precedence over the file-naming convention\n * (`license_en.txt`, etc. in the build resources directory).\n * Paths are resolved relative to the build resources directory or project root.\n *\n * @example Single language\n * ```yaml\n * dmg:\n * license: \"build/license.rtf\"\n * ```\n *\n * @example Multi-language\n * ```yaml\n * dmg:\n * license:\n * en_US: \"build/license.rtf\"\n * de_DE: \"build/license_de.txt\"\n * ja_JP: \"build/license_ja.txt\"\n * ```\n *\n * If not set, electron-builder scans the build resources directory for\n * `license_LANG.{rtf,txt,html}` files automatically.\n */\n license?: string | Record<string, string> | null\n\n /**\n * @private\n * @default true\n */\n writeUpdateInfo?: boolean\n}\n\nexport interface DmgWindow {\n /**\n * The X position relative to left of the screen.\n * @default 400\n */\n x?: number\n\n /**\n * The Y position relative to bottom of the screen.\n * @default 100\n */\n y?: number\n\n /**\n * The width. Defaults to background image width or 540.\n */\n width?: number\n\n /**\n * The height. Defaults to background image height or 380.\n */\n height?: number\n}\n\nexport interface DmgContent {\n /**\n * The device-independent pixel offset from the left of the window to the **center** of the icon.\n */\n x: number\n /**\n * The device-independent pixel offset from the top of the window to the **center** of the icon.\n */\n y: number\n type?: \"link\" | \"file\" | \"dir\" | \"position\"\n\n /**\n * The name of the file within the DMG. Defaults to basename of `path`.\n */\n name?: string\n\n /**\n * The path of the file within the DMG.\n */\n path?: string\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport interface MasConfiguration extends MacConfiguration {}\n"]}
1
+ {"version":3,"file":"macOptions.js","sourceRoot":"","sources":["../../src/options/macOptions.ts"],"names":[],"mappings":"","sourcesContent":["import { TargetConfiguration, TargetSpecificOptions } from \"../core.js\"\nimport { PlatformSpecificBuildOptions } from \"./PlatformSpecificBuildOptions.js\"\nimport { CustomMacSign } from \"../macPackager.js\"\nimport type { OnlySignOptions, SigningDistributionType } from \"@electron/osx-sign\"\nimport type { MakeUniversalOpts } from \"@electron/universal\"\n\n/**\n * Options forwarded to `@electron/universal`'s `makeUniversalApp`.\n * Electron-builder fills in the app paths and `force`; everything else is configurable here\n * and auto-tracks upstream additions to `MakeUniversalOpts`.\n *\n * @see https://github.com/electron/universal\n */\nexport interface ElectronUniversalOptions extends Omit<MakeUniversalOpts, \"x64AppPath\" | \"arm64AppPath\" | \"outAppPath\" | \"force\"> {\n /**\n * Whether to merge x64 and arm64 ASARs into one.\n *\n * @default true\n */\n mergeASARs?: boolean\n}\n\n/**\n * Signing options passed to `@electron/osx-sign`. Electron-builder owns the fields it must control\n * itself — `app`, `keychain`, `platform`, `version`, and `optionsForFile` — and forwards everything else.\n *\n * Additionally exposes a small set of per-file convenience fields that electron-builder maps\n * internally through `optionsForFile`.\n *\n * @see https://packages.electronjs.org/osx-sign\n */\nexport interface ElectronSignOptions extends Omit<OnlySignOptions, \"optionsForFile\" | \"version\"> {\n /**\n * The type of certificate to use when signing: `development` or `distribution`.\n *\n * Defaults to a value derived from the build flavor: `mas-dev` → `development`, otherwise `distribution`.\n * Set it explicitly to override — e.g. `development` on a darwin build signs with a `Mac Developer` or\n * `Apple Development` certificate instead of `Developer ID Application` and embeds a matching\n * development provisioning profile.\n *\n * Development-signed apps are blocked by Gatekeeper on other machines; users must use the\n * right-click → Open workaround documented at https://support.apple.com/en-us/guide/mac-help/mh40616/mac.\n * Such builds are not suitable for production distribution and cannot be notarized.\n */\n readonly type?: SigningDistributionType\n /**\n * The signing identity (certificate name or SHA-1 hash). Applies to both app signing and DMG signing.\n * Prefer the environment variables `CSC_LINK` / `CSC_NAME` over hardcoding this value.\n *\n * - **Not set** (default): electron-builder searches the keychain for a valid certificate.\n * - **`null`**: skip signing entirely.\n * - **`\"-\"`**: ad-hoc signing (requires disabling library validation — see `hardenedRuntime`).\n */\n readonly identity?: string | null\n /**\n * Path to the main app entitlements file. Resolved relative to the build resources directory, then the project directory.\n * Falls back to `build/entitlements.mac.plist` (or `build/entitlements.mas.plist` for MAS targets) if it exists.\n * Otherwise `mac` builds use the bundled default, which grants only `com.apple.security.cs.allow-jit`\n * (ad-hoc builds use a bundled ad-hoc template that also disables library validation), and MAS builds use\n * `@electron/osx-sign`'s built-in sandboxed `default.mas.plist`.\n */\n readonly entitlements?: string | null\n /**\n * Path to child entitlements inherited by embedded frameworks and bundles. Resolved relative to the build resources directory, then the project directory.\n * Falls back to `build/entitlements.mac.inherit.plist` (or `build/entitlements.mas.inherit.plist` for MAS targets) if it exists.\n * Otherwise nested binaries receive `@electron/osx-sign`'s per-file defaults (renderer/GPU helpers: `allow-jit`;\n * plugin helper: Chromium's looser set; everything else: `default.darwin.plist`); ad-hoc `mac` builds use the\n * bundled ad-hoc template instead.\n */\n readonly entitlementsInherit?: string | null\n /**\n * Path to entitlements for the Login Helper.\n * Required when using App Sandbox, because the Login Helper cannot inherit entitlements.\n * Defaults to the value of `entitlements`.\n */\n readonly entitlementsLoginHelper?: string | null\n /**\n * Whether to enable [Hardened Runtime](https://developer.apple.com/documentation/security/hardened_runtime).\n *\n * Hardened Runtime is a prerequisite for notarization (mandatory on macOS 10.15+).\n * Defaults to `true` for `darwin` builds and `false` for MAS builds (`mas` and `mas-dev`).\n */\n readonly hardenedRuntime?: boolean\n /**\n * Path to a [requirements file](https://developer.apple.com/library/mac/documentation/Security/Conceptual/CodeSigningGuide/RequirementLang/RequirementLang.html).\n * Not applicable for MAS.\n */\n readonly requirements?: string | null\n /**\n * URL of the timestamp authority server. Passed per-file to `codesign --timestamp=<url>`.\n */\n readonly timestamp?: string | null\n /**\n * Extra arguments passed to each `codesign` invocation.\n * @example [\"--deep\"]\n */\n readonly additionalArguments?: Array<string> | null\n}\n\nexport type MacOsTargetName = \"default\" | \"dmg\" | \"mas\" | \"mas-dev\" | \"pkg\" | \"7z\" | \"zip\" | \"tar.xz\" | \"tar.lz\" | \"tar.gz\" | \"tar.bz2\" | \"dir\"\n\nexport interface MacConfiguration extends PlatformSpecificBuildOptions {\n /**\n * The application category type, as shown in the Finder via *View -> Arrange by Application Category* when viewing the Applications directory.\n *\n * For example, `\"category\": \"public.app-category.developer-tools\"` will set the application category to *Developer Tools*.\n *\n * Valid values are listed in [Apple's documentation](https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/LaunchServicesKeys.html#//apple_ref/doc/uid/TP40009250-SW8).\n */\n readonly category?: string | null\n\n /**\n * The target package type: list of `default`, `dmg`, `mas`, `mas-dev`, `pkg`, `7z`, `zip`, `tar.xz`, `tar.lz`, `tar.gz`, `tar.bz2`, `dir`.\n * Note: Squirrel.Mac auto update mechanism requires both `dmg` and `zip` to be enabled, even when only `dmg` is used. Disabling `zip` will break auto update in `dmg` packages.\n * @default default (dmg and zip for Squirrel.Mac)\n */\n readonly target?: Array<MacOsTargetName | TargetConfiguration> | MacOsTargetName | TargetConfiguration | null\n\n /**\n * The path to application icon.\n * Accepts `.icns` (legacy) or `.icon` (Icon Composer asset).\n * If a `.icon` asset is provided, it will be preferred and compiled to an asset catalog.\n * @default build/icon.icns\n */\n readonly icon?: string | null\n\n /**\n * The `CFBundleVersion`. Do not use it unless [you need to](https://github.com/electron-userland/electron-builder/issues/565#issuecomment-230678643).\n */\n readonly bundleVersion?: string | null\n\n /**\n * The `CFBundleShortVersionString`. Do not use it unless you need to.\n */\n readonly bundleShortVersion?: string | null\n\n /**\n * Whether a dark mode is supported. If your app does have a dark mode, you can make your app follow the system-wide dark mode setting.\n * @default false\n */\n readonly darkModeSupport?: boolean\n\n /**\n * The bundle identifier to use in the application helper's plist.\n * @default ${appBundleIdentifier}.helper\n */\n readonly helperBundleId?: string | null\n\n /**\n * The bundle identifier to use in the Renderer helper's plist.\n * @default ${appBundleIdentifier}.helper.Renderer\n */\n readonly helperRendererBundleId?: string | null\n\n /**\n * The bundle identifier to use in the Plugin helper's plist.\n * @default ${appBundleIdentifier}.helper.Plugin\n */\n readonly helperPluginBundleId?: string | null\n\n /**\n * The bundle identifier to use in the GPU helper's plist.\n * @default ${appBundleIdentifier}.helper.GPU\n */\n readonly helperGPUBundleId?: string | null\n\n /**\n * The bundle identifier to use in the EH helper's plist.\n * @default ${appBundleIdentifier}.helper.EH\n */\n readonly helperEHBundleId?: string | null\n\n /**\n * The bundle identifier to use in the NP helper's plist.\n * @default ${appBundleIdentifier}.helper.NP\n */\n readonly helperNPBundleId?: string | null\n\n /**\n * The extra entries for `Info.plist`.\n */\n readonly extendInfo?: any\n\n /**\n * The minimum version of macOS required for the app to run. Corresponds to `LSMinimumSystemVersion`.\n */\n readonly minimumSystemVersion?: string | null\n\n /** @private */\n readonly cscInstallerLink?: string | null\n /** @private */\n readonly cscInstallerKeyPassword?: string | null\n\n /**\n * Extra files to put in archive. Not applicable for `tar.*`.\n */\n readonly extraDistFiles?: Array<string> | string | null\n\n /**\n * Codesigning configuration. The signing certificate is selected via `sign.identity` (or the\n * `CSC_LINK` / `CSC_NAME` environment variables).\n *\n * - **Not set** (default): electron-builder auto-discovers a valid certificate in the keychain. If none is found, signing is skipped.\n * - **`null`**: skip signing entirely.\n * - **`string`**: path or module ID of a file that exports a {@link CustomMacSign} function.\n * - **{@link CustomMacSign}**: inline custom signing function (JS/TS config only).\n * - **{@link ElectronSignOptions}**: options forwarded directly to `@electron/osx-sign`.\n *\n * @see {@link ElectronSignOptions}\n * @see https://www.electron.build/docs/features/code-signing\n */\n readonly sign?: CustomMacSign | ElectronSignOptions | string | null\n\n /**\n * Options forwarded to `@electron/universal` when building a universal (multi-arch) app.\n * Has no effect unless the target arch is `universal`.\n *\n * @see {@link ElectronUniversalOptions}\n * @see https://github.com/electron/universal\n */\n readonly universal?: ElectronUniversalOptions | null\n\n /**\n * Whether to notarize the app with [@electron/notarize](https://github.com/electron/notarize).\n *\n * - unset (the default): notarize when notarization credentials are set, otherwise skip it with a warning.\n * - `true`: notarization is required: the build fails when no credentials are set, wherever notarization would run (a macOS host,\n * outside a pull-request build, with signing not turned off), at build start and when notarizing.\n * - `false`: never notarize (for an ad-hoc or development-signed app, or one notarized in an `afterSign` hook).\n *\n * The credentials are one of the following sets of environment variables:\n *\n * 1. `APPLE_API_KEY` (path to the `.p8` file, or its contents base64-encoded), `APPLE_API_KEY_ID` and `APPLE_API_ISSUER`.\n * 2. `APPLE_ID`, `APPLE_APP_SPECIFIC_PASSWORD`, and `APPLE_TEAM_ID`\n * 3. `APPLE_KEYCHAIN` and `APPLE_KEYCHAIN_PROFILE`\n *\n * For security reasons it is recommended to use the first option (see https://github.com/electron-userland/electron-builder/issues/7859)\n */\n readonly notarize?: boolean\n\n /**\n * Whether to embed the [ASAR integrity](https://www.electronjs.org/docs/latest/tutorial/asar-integrity) digest into the Electron Framework binary.\n *\n * The digest covers the `ElectronAsarIntegrity` entries of `Info.plist`, so with the `enableEmbeddedAsarIntegrityValidation` fuse (see `electronFuses`) the app refuses to launch if those entries are changed, for example to match a modified `app.asar`. Embedding the digest modifies the Electron Framework, which is then signed again ad hoc; code signing the app replaces that signature.\n *\n * Applies only when:\n * - Electron is 41 or later\n * - the build runs on macOS (`codesign` signs the modified framework again)\n * - `asar` is enabled and `asar.disableIntegrity` is not `true`\n *\n * Set to `false` if you change `app.asar` or `Info.plist` after the `afterPack` hook, sign the app yourself in `afterPack`, or merge separately built `x64` and `arm64` apps with `@electron/universal` yourself (build the `universal` arch instead).\n * @default true\n */\n readonly asarIntegrityDigest?: boolean\n}\n\nexport interface DmgOptions extends TargetSpecificOptions {\n /**\n * The path to background image (default: `build/background.tiff` or `build/background.png` if exists). The resolution of this file determines the resolution of the installer window.\n * If background is not specified, use `window.size`. Default locations expected background size to be 540x380.\n * @see [DMG with Retina background support](http://stackoverflow.com/a/11204769/1910191).\n */\n background?: string | null\n\n /**\n * The background color (accepts css colors). Used when no background image is set.\n * @default #ffffff\n */\n backgroundColor?: string | null\n\n /**\n * The path to DMG icon (badge icon), which will be shown when mounted, relative to the [build resources](https://www.electron.build/contents#extraresources) or to the project directory.\n */\n badgeIcon?: string | null\n\n /**\n * The path to DMG icon (volume icon), which will be shown when mounted, relative to the [build resources](https://www.electron.build/contents#extraresources) or to the project directory.\n * Defaults to the application icon (`build/icon.icns`).\n */\n icon?: string | null\n\n /**\n * The size of all the icons inside the DMG.\n * @default 80\n */\n readonly iconSize?: number | null\n\n /**\n * The size of all the icon texts inside the DMG.\n * @default 12\n */\n readonly iconTextSize?: number | null\n\n /**\n * The title of the produced DMG, which will be shown when mounted (volume name).\n *\n * Macro `${productName}`, `${version}` and `${name}` are supported.\n * @default ${productName} ${version}\n */\n readonly title?: string | null\n\n /**\n * The content — to customize icon locations. The x and y coordinates refer to the position of the **center** of the icon (at 1x scale), and do not take the label into account.\n */\n contents?: Array<DmgContent>\n\n /**\n * The disk image format. `ULFO` (lzfse-compressed image (OS X 10.11+ only)). `ULMO` (lzma-compressed image (macOS 10.15+ only)).\n * @default UDZO\n */\n format?: \"UDRW\" | \"UDRO\" | \"UDCO\" | \"UDZO\" | \"UDBZ\" | \"ULFO\" | \"ULMO\"\n\n /**\n * The filesystem for the DMG volume (e.g. `\"APFS\"` or `\"HFS+\"`)\n * As of v27 this defaults to APFS. Set it explicitly to `\"HFS+\"` if you need compatibility with older macOS versions (pre-10.13 High Sierra cannot mount APFS volumes).\n * @default APFS\n */\n readonly filesystem?: \"HFS+\" | \"APFS\" | null\n\n /**\n * The initial size of the DMG filesystem. Accepts the same syntax as the `-size` argument to `hdiutil`, e.g. `\"150m\"`, `\"4g\"`.\n * If not specified, the size is calculated automatically.\n * Set this explicitly for large apps or apps with sparse files to avoid \"No space left on device\" errors.\n */\n readonly size?: string | null\n\n /**\n * Whether to shrink the DMG filesystem to the minimum size after copying files.\n * Set to `false` to preserve the explicit `size` you specified.\n * @default true\n */\n readonly shrink?: boolean\n\n /**\n * The DMG window position and size. With y co-ordinates running from bottom to top.\n *\n * The Finder makes sure that the window will be on the user’s display, so if you want your window at the top left of the display you could use `\"x\": 0, \"y\": 100000` as the x, y co-ordinates.\n * It is not to be possible to position the window relative to the [top left](https://github.com/electron-userland/electron-builder/issues/3990#issuecomment-512960957) or relative to the center of the user’s screen.\n */\n window?: DmgWindow\n\n /**\n * Whether to create internet-enabled disk image (when it is downloaded using a browser it will automatically decompress the image, put the application on the desktop, unmount and remove the disk image file).\n * @default false\n */\n readonly internetEnabled?: boolean\n\n /**\n * Whether to sign the DMG or not. Signing is not required and will lead to unwanted errors in combination with notarization requirements.\n * @default false\n */\n readonly sign?: boolean\n\n /**\n * License agreement to display when the DMG is mounted.\n *\n * Accepts a single file path (`.rtf`, `.txt`, or `.html`) used as the English/default license,\n * or a language-code → file-path map for multi-language builds.\n *\n * When set, this takes precedence over the file-naming convention\n * (`license_en.txt`, etc. in the build resources directory).\n * Paths are resolved relative to the build resources directory or project root.\n *\n * @example Single language\n * ```yaml\n * dmg:\n * license: \"build/license.rtf\"\n * ```\n *\n * @example Multi-language\n * ```yaml\n * dmg:\n * license:\n * en_US: \"build/license.rtf\"\n * de_DE: \"build/license_de.txt\"\n * ja_JP: \"build/license_ja.txt\"\n * ```\n *\n * If not set, electron-builder scans the build resources directory for\n * `license_LANG.{rtf,txt,html}` files automatically.\n */\n license?: string | Record<string, string> | null\n\n /**\n * @private\n * @default true\n */\n writeUpdateInfo?: boolean\n}\n\n/**\n * With a background image (the default), each unset value is derived from the image. With `backgroundColor`, the unset values of a set\n * `window` use fixed defaults; without `window`, dmgbuild's own window defaults apply.\n */\nexport interface DmgWindow {\n /**\n * The X position relative to left of the screen. Defaults to 400 with a background image, or 100 with `backgroundColor`.\n */\n x?: number\n\n /**\n * The Y position relative to bottom of the screen. Defaults to (1440 - background image height) / 2, rounded, with a background image,\n * or 400 with `backgroundColor`.\n */\n y?: number\n\n /**\n * The width. Defaults to the background image width (540 for the default background), or 540 with `backgroundColor`.\n */\n width?: number\n\n /**\n * The height. Defaults to the background image height (380 for the default background), or 300 with `backgroundColor`.\n */\n height?: number\n}\n\nexport interface DmgContent {\n /**\n * The device-independent pixel offset from the left of the window to the **center** of the icon.\n */\n x: number\n /**\n * The device-independent pixel offset from the top of the window to the **center** of the icon.\n */\n y: number\n type?: \"link\" | \"file\" | \"dir\" | \"position\"\n\n /**\n * The name of the file within the DMG. Defaults to basename of `path`.\n */\n name?: string\n\n /**\n * The path of the file within the DMG.\n */\n path?: string\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport interface MasConfiguration extends MacConfiguration {}\n"]}
@@ -178,7 +178,7 @@ interface WindowsSigningSharedOptions {
178
178
  * The URL of the [RFC 3161](https://www.ietf.org/rfc/rfc3161.txt) timestamp server, used for
179
179
  * SHA-256 and nested/appended signatures (signtool's `/tr` flag). Timestamping records *when*
180
180
  * the file was signed so the signature stays valid after the signing certificate expires.
181
- * Ignored when the build runs with `ELECTRON_BUILDER_OFFLINE=true`.
181
+ * Ignored when the build runs with `ELECTRON_BUILDER_OFFLINE` set to `true` or `1`.
182
182
  *
183
183
  * @default http://timestamp.digicert.com
184
184
  */
@@ -187,7 +187,7 @@ interface WindowsSigningSharedOptions {
187
187
  * The URL of the legacy Authenticode timestamp server, used for SHA-1 signatures (signtool's
188
188
  * `/t` flag). This is also the timestamp server used by `osslsigncode` (`-t`) when signing on
189
189
  * macOS/Linux. See [rfc3161TimeStampServer](#rfc3161TimeStampServer) for SHA-256 / nested
190
- * signatures. Ignored when the build runs with `ELECTRON_BUILDER_OFFLINE=true`.
190
+ * signatures. Ignored when the build runs with `ELECTRON_BUILDER_OFFLINE` set to `true` or `1`.
191
191
  *
192
192
  * @default http://timestamp.digicert.com
193
193
  */
@@ -1 +1 @@
1
- {"version":3,"file":"winOptions.js","sourceRoot":"","sources":["../../src/options/winOptions.ts"],"names":[],"mappings":"AAmdA;;;GAGG;AACH,MAAM,UAAU,kCAAkC,CAAC,MAA4B;IAC7E,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,CAAA;IACvB,OAAO,IAAI,IAAI,IAAI,IAAI,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAA;AACrD,CAAC;AAED,0FAA0F;AAC1F,MAAM,UAAU,wBAAwB,CAAC,MAA4B;IACnE,OAAO,MAAM,CAAC,IAAI,KAAK,KAAK,IAAI,MAAM,CAAC,IAAI,KAAK,IAAI,CAAA;AACtD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAC,IAAY,EAAE,QAAkD,EAAE,aAAa,GAAG,KAAK;IAC3H,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;IACnC,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,CAAC;QACtB,OAAO,KAAK,IAAI,aAAa,CAAA;IAC/B,CAAC;IACD,kEAAkE;IAClE,gGAAgG;IAChG,IAAI,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;QAC7C,OAAO,IAAI,CAAA;IACb,CAAC;IACD,4BAA4B;IAC5B,IAAI,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACjF,OAAO,KAAK,CAAA;IACd,CAAC;IACD,OAAO,KAAK,IAAI,aAAa,CAAA;AAC/B,CAAC","sourcesContent":["import { CustomWindowsSign } from \"../codeSign/win/windowsSignToolManager.js\"\nimport { TargetConfigType } from \"../core.js\"\nimport { PlatformSpecificBuildOptions } from \"./PlatformSpecificBuildOptions.js\"\n\nexport interface WindowsConfiguration extends PlatformSpecificBuildOptions {\n /**\n * The target package type: list of `nsis`, `nsis-web` (Web installer), `portable` ([portable app](https://www.electron.build/nsis#portable) without installation), `appx`, `msix`, `msi`, `msi-wrapped`, `squirrel`, `7z`, `zip`, `tar.xz`, `tar.lz`, `tar.gz`, `tar.bz2`, `dir`.\n * AppX and MSIX packages can be built on Windows 10 or Windows Server 2012 R2 (version 6.3+) or later, and on macOS via Parallels Desktop.\n *\n * To use Squirrel.Windows please install `electron-builder-squirrel-windows` dependency.\n *\n * @default nsis\n */\n readonly target?: TargetConfigType\n\n /**\n * The path to application icon.\n * @default build/icon.ico\n */\n readonly icon?: string | null\n\n /**\n * The trademarks and registered trademarks.\n */\n readonly legalTrademarks?: string | null\n\n /**\n * Code signing configuration. Code signing stamps every installer and executable\n * electron-builder produces with an Authenticode signature, so that Windows (SmartScreen / UAC)\n * and your auto-updater can verify the publisher and that the files were not tampered with.\n *\n * How this option behaves:\n * - Leave **unset** to sign using credentials discovered from the environment — primarily a\n * certificate supplied via `WIN_CSC_LINK` (or `CSC_LINK`) with its password in\n * `WIN_CSC_KEY_PASSWORD` (or `CSC_KEY_PASSWORD`). `WIN_CSC_LINK` accepts a file path, an\n * `https://` URL, or a base64-encoded certificate. This is the recommended setup for CI.\n * - Set to `false` or `null` to **disable** code signing entirely (executable resources such as\n * the icon and metadata are still edited). A build that writes `app-update.yml` then also needs\n * [verifyUpdateCodeSignature](#verifyUpdateCodeSignature) set to `false`, since no publisher\n * name is derived; if you sign outside electron-builder, use `{ type: \"signtool\", publisherName: [...] }`\n * instead.\n * - Set to an **object** to configure signing explicitly. The **required** `type` field selects the\n * signing backend (`signtool`, `hsm`, `pkcs11`, or `azure`) and dispatches to a dedicated sign\n * manager; provide exactly one of the modes below. When `win.sign` is left unset, the `signtool`\n * backend is used with env-discovered credentials. Each output artifact is signed individually,\n * and by default executables are dual-signed (see `signingHashAlgorithms`).\n *\n * - `{ type: \"signtool\", ... }` — Sign with a local certificate file (.pfx/.p12) or a\n * certificate from the Windows certificate store. Uses Microsoft `signtool.exe` on Windows and\n * `osslsigncode` on macOS/Linux.\n * - `{ type: \"hsm\", ... }` — Sign using a Hardware Security Module (HSM) or FIPS-compliant\n * hardware token via signtool's `/csp` (cryptographic service provider) and `/kc` (key\n * container) flags. Requires a modern `winCodeSign` toolset (the default — only the legacy\n * `\"0.0.0\"` pin is unsupported). Windows-only.\n * - `{ type: \"pkcs11\", ... }` — Sign using a PKCS#11 hardware token via osslsigncode.\n * Available on macOS and Linux CI without a Windows VM.\n * - `{ type: \"azure\", ... }` — Sign via Azure Trusted Signing (cloud service). Requires\n * Azure Entra ID environment variables for authentication.\n *\n * See [Code Signing](https://www.electron.build/docs/features/code-signing).\n */\n readonly sign?: WindowsSigningConfiguration | false | null\n\n /**\n * Whether the NSIS auto-updater should verify the Authenticode signature of a downloaded update\n * before installing it. The verification itself runs in your app, via electron-updater.\n *\n * When enabled (the default), the resolved [publisher name](#publisherName) is embedded into\n * `app-update.yml` at build time. At update time electron-updater inspects the certificate that\n * signed the downloaded installer and compares its subject (Distinguished Name) against that\n * publisher name, refusing to install on a mismatch or when the signature cannot be verified.\n * This prevents a tampered or maliciously substituted update from being installed.\n *\n * While enabled, electron-builder also checks at build time that the signed NSIS installer (or\n * nsis-web stub) is signed by a certificate matching that publisher name, using the same matching\n * rules, and fails the build otherwise.\n *\n * Since v27 a build that writes `app-update.yml` (an `nsis`, `nsis-web` or `electronUpdaterAware`\n * `appx` target with a publish configuration) fails while this is enabled and no publisher name\n * resolves (`sign: false` / `null`, no certificate, `publisherName: null`): electron-updater 7\n * rejects every update of an app whose `app-update.yml` has no publisher name. Sign the build, set\n * [publisherName](#publisherName), or set this to `false`.\n *\n * Set to `false` to skip verification explicitly — the publisher name is then **not** embedded, and\n * `app-update.yml` carries `verifyUpdateCodeSignature: false` instead, which tells electron-updater\n * to install updates without verifying their signature. This is the only opt-out.\n * Disable this only if your updates are not Authenticode-signed.\n *\n * @default true\n */\n readonly verifyUpdateCodeSignature?: boolean\n\n /**\n * Whether electron-updater accepts an update installer whose signature Windows reports from a security catalog (a signed list of\n * file hashes) instead of one embedded in the installer — for update installers that are catalog-signed on purpose, such as an\n * enterprise deployment that adds their hashes to a catalog. The catalog signer must still match the [publisher name](#publisherName).\n *\n * When `true`, the `latest.yml` written for the `nsis` and `nsis-web` targets carries `allowCatalogSignature: true`. electron-updater\n * honors it only when the [signature of that update manifest](https://www.electron.build/docs/features/signed-update-manifests)\n * was verified against a trusted key; in an unsigned manifest (or one signed by an untrusted key) it is ignored with a warning, and\n * catalog signatures stay rejected unless the app sets `autoUpdater.allowCatalogSignature = true`. Since it is covered by the manifest\n * signature, changing it for a published release means signing `latest.yml` again or republishing it.\n *\n * Installs running electron-updater 7.0.0-alpha.8 to alpha.11 with an update key configured reject a signed manifest that sets it\n * (`ERR_UPDATER_MANIFEST_SIGNATURE_INVALID`).\n * @default false\n */\n readonly allowCatalogSignature?: boolean\n\n /**\n * The [security level](https://msdn.microsoft.com/en-us/library/6ad1fshk.aspx#Anchor_9) at which the application requests to be executed.\n * Cannot be specified per target, allowed only in the `win`.\n * @default asInvoker\n */\n readonly requestedExecutionLevel?: RequestedExecutionLevel | null\n\n /**\n * Additional file name suffixes to code sign, beyond the default. By default electron-builder\n * only signs `.exe` files; list extra suffixes here to also sign e.g. `.dll`, `.node`, or\n * specific file names. Advanced option — most apps do not need it.\n *\n * Each entry is matched with `String.endsWith`, so both bare extensions (`\".dll\"`) and full file\n * names (`\"mybinary.dll\"`) work. Prefix a pattern with `!` to *exclude* a suffix that would\n * otherwise be signed. Positive patterns are evaluated first, then negative ones. For example,\n * `[\"somefilename\", \".dll\", \"!.appx\"]` signs `.dll` files (and anything ending in `somefilename`)\n * but never signs `.appx` files.\n *\n * @see https://github.com/electron-userland/electron-builder/issues/7329\n * @default null\n */\n readonly signExts?: string[] | null\n}\n\nexport type RequestedExecutionLevel = \"asInvoker\" | \"highestAvailable\" | \"requireAdministrator\"\n\n// ─── Shared base for signtool-family signing modes ───────────────────────────\n\n/**\n * Options shared by every certificate-based signing mode (`signtool`, `hsm`, `pkcs11`). These\n * control the signature itself — publisher identity, digest algorithms, timestamping, and the\n * extra certificates added to the signature block — independently of where the private key lives.\n */\ninterface WindowsSigningSharedOptions {\n /**\n * The publisher name(s) to associate with the signature: a Distinguished Name (DN) of your code\n * signing certificate's subject, written with the attribute names Windows uses (e.g.\n * `CN=My Company, O=My Company, C=US`). Every attribute you list must equal the certificate's;\n * attributes you leave out are not compared. A bare name (`My Company`) fails the build since v27,\n * because electron-updater 7 never matches it — see\n * [the migration guide](https://www.electron.build/docs/migration/v27-build-changes#windows-publishername-must-be-a-distinguished-name).\n * May be a single string or an array — an array is useful when rotating certificates, so updates\n * signed by either the old or the new certificate still verify.\n *\n * This value is not a `signtool` argument; it is consumed in two places:\n * - **Update verification** — when [verifyUpdateCodeSignature](#verifyUpdateCodeSignature) is\n * enabled, it is written into `app-update.yml` and electron-updater checks it against the\n * certificate that signed each downloaded update.\n * - **AppX / MSIX identity** — the package `Publisher` attribute must equal the certificate\n * subject, so electron-builder derives it from this value (or the certificate) to keep them\n * in sync; a mismatch makes packaging fail with `ERROR_BAD_FORMAT`.\n *\n * Defaults to `CN=<common name>` of your code signing certificate, so a renewed certificate with the\n * same common name keeps updates working even when its other subject attributes change. For a stricter\n * pin, set a fuller DN explicitly (a renewal that changes a configured attribute then needs a release,\n * signed with the old certificate, that lists both DNs).\n * **Required** (while `verifyUpdateCodeSignature` is enabled and `app-update.yml` is written) whenever\n * no certificate supplies it: with a custom [sign](#sign) hook, even if a certificate is configured,\n * for a certificate without a CN, and when no certificate is configured (e.g. the build is signed\n * outside electron-builder) — otherwise the build fails. `null` is no opt-out since v27: a build that\n * writes `app-update.yml` with it fails; set [verifyUpdateCodeSignature](#verifyUpdateCodeSignature)\n * to `false` instead.\n *\n * @see https://github.com/electron-userland/electron-builder/issues/1187#issuecomment-278972073\n */\n readonly publisherName?: string | Array<string> | null\n\n /**\n * The digest (hash) algorithms to sign with, applied via signtool's `/fd` flag (or\n * osslsigncode's `-h`). One signing pass runs per entry, in order; listing more than one\n * **dual-signs** the file, with each additional signature appended as a nested signature\n * (signtool `/as`). Signing with both `sha1` and `sha256` lets a single binary validate on\n * legacy (pre-SHA-2) Windows as well as modern Windows.\n *\n * Some targets override this: `.msi` cannot be dual-signed, so it is signed once, with `sha256`\n * unless `sha1` is the only algorithm listed, and AppX/MSIX is always `sha256` only.\n *\n * @default ['sha1', 'sha256']\n */\n readonly signingHashAlgorithms?: Array<\"sha1\" | \"sha256\"> | null\n\n /**\n * The URL of the [RFC 3161](https://www.ietf.org/rfc/rfc3161.txt) timestamp server, used for\n * SHA-256 and nested/appended signatures (signtool's `/tr` flag). Timestamping records *when*\n * the file was signed so the signature stays valid after the signing certificate expires.\n * Ignored when the build runs with `ELECTRON_BUILDER_OFFLINE=true`.\n *\n * @default http://timestamp.digicert.com\n */\n readonly rfc3161TimeStampServer?: string | null\n\n /**\n * The URL of the legacy Authenticode timestamp server, used for SHA-1 signatures (signtool's\n * `/t` flag). This is also the timestamp server used by `osslsigncode` (`-t`) when signing on\n * macOS/Linux. See [rfc3161TimeStampServer](#rfc3161TimeStampServer) for SHA-256 / nested\n * signatures. Ignored when the build runs with `ELECTRON_BUILDER_OFFLINE=true`.\n *\n * @default http://timestamp.digicert.com\n */\n readonly timeStampServer?: string | null\n\n /**\n * Path to an additional certificate file (typically an intermediate / cross-signing CA\n * certificate) whose contents are added to the signature block via signtool's `/ac` flag. Use\n * this when the signing certificate's full chain is not already present on target machines and\n * you want it embedded in the signature so the chain can be validated.\n */\n readonly additionalCertificateFile?: string | null\n\n /**\n * A custom signing hook that **replaces** electron-builder's built-in `signtool` /\n * `osslsigncode` invocation. Provide a function, or the path / module id of a file that exports\n * a `sign` function (resolved relative to the project, then as a module).\n *\n * The hook is invoked once per signing pass (i.e. once per entry in\n * [signingHashAlgorithms](#signingHashAlgorithms)) and receives a configuration object describing\n * the file to sign (`path`), the resolved certificate info (`cscInfo`), the current `hash`, and\n * whether this pass is a nested signature (`isNest`), plus a `computeSignToolArgs(isWin)` helper\n * that returns the default arguments electron-builder would otherwise have used. Use this to\n * integrate an external or cloud signing service. See\n * [Code Signing](https://www.electron.build/docs/features/code-signing).\n *\n * electron-builder cannot tell which certificate the hook signs with, so also set\n * [publisherName](#publisherName) to that certificate's subject: it is never derived from a\n * certificate for a hook (not even one in the config), and without it a build that writes\n * `app-update.yml` fails.\n */\n readonly sign?: CustomWindowsSign | string | null\n}\n\n// ─── Signing mode: signtool (file or Windows certificate store) ──────────────\n\n/**\n * Sign with a certificate file (`.pfx` / `.p12`) or with a certificate from the Windows\n * certificate store, using Microsoft `signtool.exe` on Windows and `osslsigncode` on macOS/Linux.\n * This is the default mode when `win.sign` is unset. Supply the certificate one of four ways:\n * a file via `certificateFile` (or the `WIN_CSC_LINK` env var), or a store lookup via\n * `certificateSubjectName` or `certificateSha1`.\n */\nexport interface WindowsSigntoolSigningConfig extends WindowsSigningSharedOptions {\n /** Discriminator selecting the default file/store signing mode. */\n readonly type: \"signtool\"\n\n /**\n * Path to the PKCS#12 certificate file (`.pfx` or `.p12`) holding both the signing certificate\n * and its private key. Passed to signtool via `/f` (or osslsigncode via `-pkcs12`).\n *\n * Prefer supplying this out-of-band via the `WIN_CSC_LINK` (or `CSC_LINK`) environment variable\n * instead of hardcoding a path — that variable also accepts an `https://` URL or a base64-encoded\n * certificate, which is safer and more convenient on CI. See\n * [Code Signing](https://www.electron.build/docs/features/code-signing).\n */\n readonly certificateFile?: string | null\n\n /**\n * The password protecting the private key in `certificateFile`. Passed to signtool via `/p`\n * (or osslsigncode via `-pass`).\n *\n * Prefer the `WIN_CSC_KEY_PASSWORD` (or `CSC_KEY_PASSWORD`) environment variable so the secret\n * never lands in your build configuration.\n */\n readonly certificatePassword?: string | null\n\n /**\n * Select the signing certificate from the Windows certificate store by (a substring of) its\n * subject name, instead of pointing at a `.pfx` file. electron-builder enumerates the installed\n * code-signing certificates, picks the match, and signs by its thumbprint\n * (`/sha1 <thumbprint> /s <store>`). **Required for EV (Extended Validation) certificates**,\n * whose private keys live on a hardware token and cannot be exported to a file.\n *\n * Works only on Windows (or macOS with Parallels Desktop, via the bundled Windows VM).\n */\n readonly certificateSubjectName?: string | null\n\n /**\n * Select the signing certificate from the Windows certificate store by its SHA-1 thumbprint,\n * instead of pointing at a `.pfx` file. electron-builder looks the certificate up in the store\n * and signs with `/sha1 <thumbprint> /s <store>`. Like\n * [certificateSubjectName](#certificateSubjectName), this suits EV certificates backed by a\n * hardware token; if both are set, both must resolve to the same certificate.\n *\n * Works only on Windows (or macOS with Parallels Desktop, via the bundled Windows VM).\n */\n readonly certificateSha1?: string | null\n}\n\n// ─── Signing mode: hsm (Hardware Security Module via signtool /csp /kc) ──────\n\n/**\n * @beta HSM signing is available in v27 as a beta feature. The interface is stable but\n * real-hardware test coverage is limited.\n */\nexport interface WindowsHsmSigningConfig extends WindowsSigningSharedOptions {\n /** Discriminator selecting HSM / hardware-token signing via signtool's `/csp` and `/kc` flags. */\n readonly type: \"hsm\"\n\n /**\n * The name of the cryptographic service provider (CSP) that holds the private key.\n * Maps to signtool's `/csp` flag. Examples:\n * - Google Cloud KMS: `\"Google Cloud KMS Provider\"`\n * - Smart card / FIPS token: `\"Microsoft Base Smart Card Crypto Provider\"`\n *\n * Requires a modern `winCodeSign` toolset (the default; only the legacy `\"0.0.0\"` pin is\n * unsupported). Windows-only — use `type: \"pkcs11\"` on macOS/Linux.\n */\n readonly cryptoServiceProvider: string\n\n /**\n * The key container name within the CSP. Maps to signtool's `/kc` flag.\n *\n * Example for Google Cloud KMS:\n * `\"projects/PROJECT_ID/locations/LOCATION/keyRings/KEY_RING/cryptoKeys/KEY_NAME/cryptoKeyVersions/1\"`\n */\n readonly keyContainer: string\n\n /**\n * Path to the certificate file containing the public certificate chain (.crt / .cer / .pfx).\n * The private key is NOT read from this file — it is provided by the HSM via `cryptoServiceProvider`.\n */\n readonly certificateFile?: string | null\n\n /**\n * Alternative to `certificateFile`: locate the public certificate in the Windows certificate\n * store by its SHA-1 thumbprint. The private key still comes from the HSM via\n * `cryptoServiceProvider` / `keyContainer`; this only identifies which public certificate to sign\n * with.\n */\n readonly certificateSha1?: string | null\n\n /**\n * Alternative to `certificateFile`: locate the public certificate in the Windows certificate\n * store by (a substring of) its subject name. The private key still comes from the HSM via\n * `cryptoServiceProvider` / `keyContainer`; this only identifies which public certificate to sign\n * with.\n */\n readonly certificateSubjectName?: string | null\n}\n\n// ─── Signing mode: pkcs11 (cross-platform PKCS#11 via osslsigncode) ──────────\n\n/**\n * Sign with a PKCS#11 hardware token (smart card, USB HSM, cloud KMS exposed via a PKCS#11\n * provider) using `osslsigncode`. Unlike `hsm`, this mode does **not** require Windows or a\n * Windows VM, so it can sign Windows binaries directly from macOS/Linux CI. The token PIN is read\n * from the `WIN_CSC_KEY_PASSWORD` (or `CSC_KEY_PASSWORD`) environment variable.\n *\n * @beta PKCS#11 signing is available in v27 as a beta feature. The interface is stable but\n * real-hardware test coverage is limited.\n */\nexport interface WindowsPkcs11SigningConfig extends WindowsSigningSharedOptions {\n /** Discriminator selecting cross-platform PKCS#11 token signing via `osslsigncode`. */\n readonly type: \"pkcs11\"\n\n /**\n * Path to the PKCS#11 shared library (`.so` on Linux, `.dylib` on macOS).\n * The library must be installed separately — electron-builder does not bundle it.\n *\n * Example: `\"/usr/lib/x86_64-linux-gnu/opensc-pkcs11.so\"`\n *\n * Must be paired with `pkcs11KeyUri`.\n */\n readonly pkcs11Module: string\n\n /**\n * RFC 7512 PKCS#11 URI identifying the private key within the module.\n * Maps to osslsigncode's `-key` parameter.\n *\n * Example: `\"pkcs11:token=MyToken;object=MyKey;type=private\"`\n *\n * Must be paired with `pkcs11Module`.\n */\n readonly pkcs11KeyUri: string\n\n /**\n * Optional path to a certificate chain file to accompany the PKCS#11 key.\n * If omitted the certificate embedded in the token is used.\n */\n readonly certificateFile?: string | null\n}\n\n// ─── Signing mode: azure (Azure Trusted Signing) ──────────────────────────────\n\n/**\n * The `signtool /dlib` Azure Trusted Signing integration was introduced in `toolsets.winCodeSign: 1.3.0`.\n * The legacy PowerShell integration is deprecated, but leverages the same underlying Azure APIs, so both interfaces share the same config shape.\n */\nexport interface WindowsAzureSigningConfig {\n /** Discriminator selecting Azure Trusted Signing (cloud signing — no local certificate). */\n readonly type: \"azure\"\n\n /**\n * The publisher name to associate with the signature: a Distinguished Name (DN) of the subject of\n * the certificate issued by your Trusted Signing certificate profile (e.g.\n * `CN=My Company, O=My Company, C=US`). Required. Used for\n * [update verification](#verifyUpdateCodeSignature) (embedded in `app-update.yml` and checked by\n * electron-updater) and must match the certificate subject. A bare name fails the build since\n * v27 — see\n * [the migration guide](https://www.electron.build/docs/migration/v27-build-changes#windows-publishername-must-be-a-distinguished-name).\n *\n * @see https://github.com/electron-userland/electron-builder/issues/1187#issuecomment-278972073\n */\n readonly publisherName: string\n\n /**\n * The Trusted Signing Account endpoint. The URI value must align to the region your Trusted\n * Signing Account and Certificate Profile were created in.\n *\n * Requires Azure Entra ID environment variables per\n * [Microsoft's documentation](https://learn.microsoft.com/en-us/dotnet/api/azure.identity.environmentcredential?view=azure-dotnet#definition).\n */\n readonly endpoint: string\n\n /**\n * The name of the Trusted Signing Certificate Profile to sign with, as created in your Azure\n * Code Signing Account. Maps to the DLib metadata field `CertificateProfileName`.\n */\n readonly certificateProfileName: string\n\n /**\n * The name of the Azure Trusted Signing (Code Signing) Account that owns the certificate profile.\n * Maps to the DLib metadata field `CodeSigningAccountName`.\n */\n readonly codeSigningAccountName: string\n\n /**\n * The digest algorithm used to hash the files being signed. Maps to the DLib metadata field\n * `FileDigest`.\n * @default SHA256\n */\n readonly fileDigest?: string\n\n /**\n * The RFC3161 timestamp server. Translates to field: TimestampRfc3161.\n * @default http://timestamp.acs.microsoft.com\n */\n readonly timestampRfc3161?: string\n\n /**\n * The timestamp digest algorithm. Translates to field: TimestampDigest.\n * @default SHA256\n */\n readonly timestampDigest?: string\n\n /**\n * Additional fields to include verbatim in the `metadata.json` file passed to\n * `Azure.CodeSigning.Dlib.dll` via `signtool /dmdf`. Use this for DLib-specific options\n * not covered by the typed fields above (e.g. `ExcludeCredentials`, `CorrelationId`).\n */\n readonly additionalMetadata?: Record<string, string>\n}\n\n// ─── Discriminated union ──────────────────────────────────────────────────────\n\nexport type WindowsSigningConfiguration = WindowsSigntoolSigningConfig | WindowsHsmSigningConfig | WindowsPkcs11SigningConfig | WindowsAzureSigningConfig\n\n/** Signing modes that use signtool.exe or osslsigncode (not Azure). */\nexport type WindowsSigntoolFamilyConfig = WindowsSigntoolSigningConfig | WindowsHsmSigningConfig | WindowsPkcs11SigningConfig\n\n/**\n * Resolves the active signing configuration object. `false`, `null`, and unset all mean\n * \"no explicit signing config object\" (env-based discovery still applies when unset).\n */\nexport function resolveWindowsSigningConfiguration(config: WindowsConfiguration): WindowsSigningConfiguration | null {\n const { sign } = config\n return sign == null || sign === false ? null : sign\n}\n\n/** Whether Windows code signing has been explicitly disabled via `sign: false | null`. */\nexport function isWindowsSigningDisabled(config: WindowsConfiguration): boolean {\n return config.sign === false || config.sign === null\n}\n\n/**\n * Whether `file` is signed according to `signExts`: a listed extension is signed, a `!`-negated one is not, and\n * otherwise `.exe` files (or every file, with `fallbackValue`) are.\n */\nexport function shouldSignWindowsFile(file: string, signExts: ReadonlyArray<string> | null | undefined, fallbackValue = false): boolean {\n const isExe = file.endsWith(\".exe\")\n if (!signExts?.length) {\n return isExe || fallbackValue\n }\n // process patterns ( !exe => exclude .exe, .dll => include .dll )\n // we process first to allow literal negatives in case a filename matches \"help!.txt\" or similar\n if (signExts.some(ext => file.endsWith(ext))) {\n return true\n }\n // process negative patterns\n if (signExts.some(ext => ext.startsWith(\"!\") && file.endsWith(ext.substring(1)))) {\n return false\n }\n return isExe || fallbackValue\n}\n"]}
1
+ {"version":3,"file":"winOptions.js","sourceRoot":"","sources":["../../src/options/winOptions.ts"],"names":[],"mappings":"AAmdA;;;GAGG;AACH,MAAM,UAAU,kCAAkC,CAAC,MAA4B;IAC7E,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,CAAA;IACvB,OAAO,IAAI,IAAI,IAAI,IAAI,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAA;AACrD,CAAC;AAED,0FAA0F;AAC1F,MAAM,UAAU,wBAAwB,CAAC,MAA4B;IACnE,OAAO,MAAM,CAAC,IAAI,KAAK,KAAK,IAAI,MAAM,CAAC,IAAI,KAAK,IAAI,CAAA;AACtD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAC,IAAY,EAAE,QAAkD,EAAE,aAAa,GAAG,KAAK;IAC3H,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;IACnC,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,CAAC;QACtB,OAAO,KAAK,IAAI,aAAa,CAAA;IAC/B,CAAC;IACD,kEAAkE;IAClE,gGAAgG;IAChG,IAAI,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;QAC7C,OAAO,IAAI,CAAA;IACb,CAAC;IACD,4BAA4B;IAC5B,IAAI,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACjF,OAAO,KAAK,CAAA;IACd,CAAC;IACD,OAAO,KAAK,IAAI,aAAa,CAAA;AAC/B,CAAC","sourcesContent":["import { CustomWindowsSign } from \"../codeSign/win/windowsSignToolManager.js\"\nimport { TargetConfigType } from \"../core.js\"\nimport { PlatformSpecificBuildOptions } from \"./PlatformSpecificBuildOptions.js\"\n\nexport interface WindowsConfiguration extends PlatformSpecificBuildOptions {\n /**\n * The target package type: list of `nsis`, `nsis-web` (Web installer), `portable` ([portable app](https://www.electron.build/nsis#portable) without installation), `appx`, `msix`, `msi`, `msi-wrapped`, `squirrel`, `7z`, `zip`, `tar.xz`, `tar.lz`, `tar.gz`, `tar.bz2`, `dir`.\n * AppX and MSIX packages can be built on Windows 10 or Windows Server 2012 R2 (version 6.3+) or later, and on macOS via Parallels Desktop.\n *\n * To use Squirrel.Windows please install `electron-builder-squirrel-windows` dependency.\n *\n * @default nsis\n */\n readonly target?: TargetConfigType\n\n /**\n * The path to application icon.\n * @default build/icon.ico\n */\n readonly icon?: string | null\n\n /**\n * The trademarks and registered trademarks.\n */\n readonly legalTrademarks?: string | null\n\n /**\n * Code signing configuration. Code signing stamps every installer and executable\n * electron-builder produces with an Authenticode signature, so that Windows (SmartScreen / UAC)\n * and your auto-updater can verify the publisher and that the files were not tampered with.\n *\n * How this option behaves:\n * - Leave **unset** to sign using credentials discovered from the environment — primarily a\n * certificate supplied via `WIN_CSC_LINK` (or `CSC_LINK`) with its password in\n * `WIN_CSC_KEY_PASSWORD` (or `CSC_KEY_PASSWORD`). `WIN_CSC_LINK` accepts a file path, an\n * `https://` URL, or a base64-encoded certificate. This is the recommended setup for CI.\n * - Set to `false` or `null` to **disable** code signing entirely (executable resources such as\n * the icon and metadata are still edited). A build that writes `app-update.yml` then also needs\n * [verifyUpdateCodeSignature](#verifyUpdateCodeSignature) set to `false`, since no publisher\n * name is derived; if you sign outside electron-builder, use `{ type: \"signtool\", publisherName: [...] }`\n * instead.\n * - Set to an **object** to configure signing explicitly. The **required** `type` field selects the\n * signing backend (`signtool`, `hsm`, `pkcs11`, or `azure`) and dispatches to a dedicated sign\n * manager; provide exactly one of the modes below. When `win.sign` is left unset, the `signtool`\n * backend is used with env-discovered credentials. Each output artifact is signed individually,\n * and by default executables are dual-signed (see `signingHashAlgorithms`).\n *\n * - `{ type: \"signtool\", ... }` — Sign with a local certificate file (.pfx/.p12) or a\n * certificate from the Windows certificate store. Uses Microsoft `signtool.exe` on Windows and\n * `osslsigncode` on macOS/Linux.\n * - `{ type: \"hsm\", ... }` — Sign using a Hardware Security Module (HSM) or FIPS-compliant\n * hardware token via signtool's `/csp` (cryptographic service provider) and `/kc` (key\n * container) flags. Requires a modern `winCodeSign` toolset (the default — only the legacy\n * `\"0.0.0\"` pin is unsupported). Windows-only.\n * - `{ type: \"pkcs11\", ... }` — Sign using a PKCS#11 hardware token via osslsigncode.\n * Available on macOS and Linux CI without a Windows VM.\n * - `{ type: \"azure\", ... }` — Sign via Azure Trusted Signing (cloud service). Requires\n * Azure Entra ID environment variables for authentication.\n *\n * See [Code Signing](https://www.electron.build/docs/features/code-signing).\n */\n readonly sign?: WindowsSigningConfiguration | false | null\n\n /**\n * Whether the NSIS auto-updater should verify the Authenticode signature of a downloaded update\n * before installing it. The verification itself runs in your app, via electron-updater.\n *\n * When enabled (the default), the resolved [publisher name](#publisherName) is embedded into\n * `app-update.yml` at build time. At update time electron-updater inspects the certificate that\n * signed the downloaded installer and compares its subject (Distinguished Name) against that\n * publisher name, refusing to install on a mismatch or when the signature cannot be verified.\n * This prevents a tampered or maliciously substituted update from being installed.\n *\n * While enabled, electron-builder also checks at build time that the signed NSIS installer (or\n * nsis-web stub) is signed by a certificate matching that publisher name, using the same matching\n * rules, and fails the build otherwise.\n *\n * Since v27 a build that writes `app-update.yml` (an `nsis`, `nsis-web` or `electronUpdaterAware`\n * `appx` target with a publish configuration) fails while this is enabled and no publisher name\n * resolves (`sign: false` / `null`, no certificate, `publisherName: null`): electron-updater 7\n * rejects every update of an app whose `app-update.yml` has no publisher name. Sign the build, set\n * [publisherName](#publisherName), or set this to `false`.\n *\n * Set to `false` to skip verification explicitly — the publisher name is then **not** embedded, and\n * `app-update.yml` carries `verifyUpdateCodeSignature: false` instead, which tells electron-updater\n * to install updates without verifying their signature. This is the only opt-out.\n * Disable this only if your updates are not Authenticode-signed.\n *\n * @default true\n */\n readonly verifyUpdateCodeSignature?: boolean\n\n /**\n * Whether electron-updater accepts an update installer whose signature Windows reports from a security catalog (a signed list of\n * file hashes) instead of one embedded in the installer — for update installers that are catalog-signed on purpose, such as an\n * enterprise deployment that adds their hashes to a catalog. The catalog signer must still match the [publisher name](#publisherName).\n *\n * When `true`, the `latest.yml` written for the `nsis` and `nsis-web` targets carries `allowCatalogSignature: true`. electron-updater\n * honors it only when the [signature of that update manifest](https://www.electron.build/docs/features/signed-update-manifests)\n * was verified against a trusted key; in an unsigned manifest (or one signed by an untrusted key) it is ignored with a warning, and\n * catalog signatures stay rejected unless the app sets `autoUpdater.allowCatalogSignature = true`. Since it is covered by the manifest\n * signature, changing it for a published release means signing `latest.yml` again or republishing it.\n *\n * Installs running electron-updater 7.0.0-alpha.8 to alpha.11 with an update key configured reject a signed manifest that sets it\n * (`ERR_UPDATER_MANIFEST_SIGNATURE_INVALID`).\n * @default false\n */\n readonly allowCatalogSignature?: boolean\n\n /**\n * The [security level](https://msdn.microsoft.com/en-us/library/6ad1fshk.aspx#Anchor_9) at which the application requests to be executed.\n * Cannot be specified per target, allowed only in the `win`.\n * @default asInvoker\n */\n readonly requestedExecutionLevel?: RequestedExecutionLevel | null\n\n /**\n * Additional file name suffixes to code sign, beyond the default. By default electron-builder\n * only signs `.exe` files; list extra suffixes here to also sign e.g. `.dll`, `.node`, or\n * specific file names. Advanced option — most apps do not need it.\n *\n * Each entry is matched with `String.endsWith`, so both bare extensions (`\".dll\"`) and full file\n * names (`\"mybinary.dll\"`) work. Prefix a pattern with `!` to *exclude* a suffix that would\n * otherwise be signed. Positive patterns are evaluated first, then negative ones. For example,\n * `[\"somefilename\", \".dll\", \"!.appx\"]` signs `.dll` files (and anything ending in `somefilename`)\n * but never signs `.appx` files.\n *\n * @see https://github.com/electron-userland/electron-builder/issues/7329\n * @default null\n */\n readonly signExts?: string[] | null\n}\n\nexport type RequestedExecutionLevel = \"asInvoker\" | \"highestAvailable\" | \"requireAdministrator\"\n\n// ─── Shared base for signtool-family signing modes ───────────────────────────\n\n/**\n * Options shared by every certificate-based signing mode (`signtool`, `hsm`, `pkcs11`). These\n * control the signature itself — publisher identity, digest algorithms, timestamping, and the\n * extra certificates added to the signature block — independently of where the private key lives.\n */\ninterface WindowsSigningSharedOptions {\n /**\n * The publisher name(s) to associate with the signature: a Distinguished Name (DN) of your code\n * signing certificate's subject, written with the attribute names Windows uses (e.g.\n * `CN=My Company, O=My Company, C=US`). Every attribute you list must equal the certificate's;\n * attributes you leave out are not compared. A bare name (`My Company`) fails the build since v27,\n * because electron-updater 7 never matches it — see\n * [the migration guide](https://www.electron.build/docs/migration/v27-build-changes#windows-publishername-must-be-a-distinguished-name).\n * May be a single string or an array — an array is useful when rotating certificates, so updates\n * signed by either the old or the new certificate still verify.\n *\n * This value is not a `signtool` argument; it is consumed in two places:\n * - **Update verification** — when [verifyUpdateCodeSignature](#verifyUpdateCodeSignature) is\n * enabled, it is written into `app-update.yml` and electron-updater checks it against the\n * certificate that signed each downloaded update.\n * - **AppX / MSIX identity** — the package `Publisher` attribute must equal the certificate\n * subject, so electron-builder derives it from this value (or the certificate) to keep them\n * in sync; a mismatch makes packaging fail with `ERROR_BAD_FORMAT`.\n *\n * Defaults to `CN=<common name>` of your code signing certificate, so a renewed certificate with the\n * same common name keeps updates working even when its other subject attributes change. For a stricter\n * pin, set a fuller DN explicitly (a renewal that changes a configured attribute then needs a release,\n * signed with the old certificate, that lists both DNs).\n * **Required** (while `verifyUpdateCodeSignature` is enabled and `app-update.yml` is written) whenever\n * no certificate supplies it: with a custom [sign](#sign) hook, even if a certificate is configured,\n * for a certificate without a CN, and when no certificate is configured (e.g. the build is signed\n * outside electron-builder) — otherwise the build fails. `null` is no opt-out since v27: a build that\n * writes `app-update.yml` with it fails; set [verifyUpdateCodeSignature](#verifyUpdateCodeSignature)\n * to `false` instead.\n *\n * @see https://github.com/electron-userland/electron-builder/issues/1187#issuecomment-278972073\n */\n readonly publisherName?: string | Array<string> | null\n\n /**\n * The digest (hash) algorithms to sign with, applied via signtool's `/fd` flag (or\n * osslsigncode's `-h`). One signing pass runs per entry, in order; listing more than one\n * **dual-signs** the file, with each additional signature appended as a nested signature\n * (signtool `/as`). Signing with both `sha1` and `sha256` lets a single binary validate on\n * legacy (pre-SHA-2) Windows as well as modern Windows.\n *\n * Some targets override this: `.msi` cannot be dual-signed, so it is signed once, with `sha256`\n * unless `sha1` is the only algorithm listed, and AppX/MSIX is always `sha256` only.\n *\n * @default ['sha1', 'sha256']\n */\n readonly signingHashAlgorithms?: Array<\"sha1\" | \"sha256\"> | null\n\n /**\n * The URL of the [RFC 3161](https://www.ietf.org/rfc/rfc3161.txt) timestamp server, used for\n * SHA-256 and nested/appended signatures (signtool's `/tr` flag). Timestamping records *when*\n * the file was signed so the signature stays valid after the signing certificate expires.\n * Ignored when the build runs with `ELECTRON_BUILDER_OFFLINE` set to `true` or `1`.\n *\n * @default http://timestamp.digicert.com\n */\n readonly rfc3161TimeStampServer?: string | null\n\n /**\n * The URL of the legacy Authenticode timestamp server, used for SHA-1 signatures (signtool's\n * `/t` flag). This is also the timestamp server used by `osslsigncode` (`-t`) when signing on\n * macOS/Linux. See [rfc3161TimeStampServer](#rfc3161TimeStampServer) for SHA-256 / nested\n * signatures. Ignored when the build runs with `ELECTRON_BUILDER_OFFLINE` set to `true` or `1`.\n *\n * @default http://timestamp.digicert.com\n */\n readonly timeStampServer?: string | null\n\n /**\n * Path to an additional certificate file (typically an intermediate / cross-signing CA\n * certificate) whose contents are added to the signature block via signtool's `/ac` flag. Use\n * this when the signing certificate's full chain is not already present on target machines and\n * you want it embedded in the signature so the chain can be validated.\n */\n readonly additionalCertificateFile?: string | null\n\n /**\n * A custom signing hook that **replaces** electron-builder's built-in `signtool` /\n * `osslsigncode` invocation. Provide a function, or the path / module id of a file that exports\n * a `sign` function (resolved relative to the project, then as a module).\n *\n * The hook is invoked once per signing pass (i.e. once per entry in\n * [signingHashAlgorithms](#signingHashAlgorithms)) and receives a configuration object describing\n * the file to sign (`path`), the resolved certificate info (`cscInfo`), the current `hash`, and\n * whether this pass is a nested signature (`isNest`), plus a `computeSignToolArgs(isWin)` helper\n * that returns the default arguments electron-builder would otherwise have used. Use this to\n * integrate an external or cloud signing service. See\n * [Code Signing](https://www.electron.build/docs/features/code-signing).\n *\n * electron-builder cannot tell which certificate the hook signs with, so also set\n * [publisherName](#publisherName) to that certificate's subject: it is never derived from a\n * certificate for a hook (not even one in the config), and without it a build that writes\n * `app-update.yml` fails.\n */\n readonly sign?: CustomWindowsSign | string | null\n}\n\n// ─── Signing mode: signtool (file or Windows certificate store) ──────────────\n\n/**\n * Sign with a certificate file (`.pfx` / `.p12`) or with a certificate from the Windows\n * certificate store, using Microsoft `signtool.exe` on Windows and `osslsigncode` on macOS/Linux.\n * This is the default mode when `win.sign` is unset. Supply the certificate one of four ways:\n * a file via `certificateFile` (or the `WIN_CSC_LINK` env var), or a store lookup via\n * `certificateSubjectName` or `certificateSha1`.\n */\nexport interface WindowsSigntoolSigningConfig extends WindowsSigningSharedOptions {\n /** Discriminator selecting the default file/store signing mode. */\n readonly type: \"signtool\"\n\n /**\n * Path to the PKCS#12 certificate file (`.pfx` or `.p12`) holding both the signing certificate\n * and its private key. Passed to signtool via `/f` (or osslsigncode via `-pkcs12`).\n *\n * Prefer supplying this out-of-band via the `WIN_CSC_LINK` (or `CSC_LINK`) environment variable\n * instead of hardcoding a path — that variable also accepts an `https://` URL or a base64-encoded\n * certificate, which is safer and more convenient on CI. See\n * [Code Signing](https://www.electron.build/docs/features/code-signing).\n */\n readonly certificateFile?: string | null\n\n /**\n * The password protecting the private key in `certificateFile`. Passed to signtool via `/p`\n * (or osslsigncode via `-pass`).\n *\n * Prefer the `WIN_CSC_KEY_PASSWORD` (or `CSC_KEY_PASSWORD`) environment variable so the secret\n * never lands in your build configuration.\n */\n readonly certificatePassword?: string | null\n\n /**\n * Select the signing certificate from the Windows certificate store by (a substring of) its\n * subject name, instead of pointing at a `.pfx` file. electron-builder enumerates the installed\n * code-signing certificates, picks the match, and signs by its thumbprint\n * (`/sha1 <thumbprint> /s <store>`). **Required for EV (Extended Validation) certificates**,\n * whose private keys live on a hardware token and cannot be exported to a file.\n *\n * Works only on Windows (or macOS with Parallels Desktop, via the bundled Windows VM).\n */\n readonly certificateSubjectName?: string | null\n\n /**\n * Select the signing certificate from the Windows certificate store by its SHA-1 thumbprint,\n * instead of pointing at a `.pfx` file. electron-builder looks the certificate up in the store\n * and signs with `/sha1 <thumbprint> /s <store>`. Like\n * [certificateSubjectName](#certificateSubjectName), this suits EV certificates backed by a\n * hardware token; if both are set, both must resolve to the same certificate.\n *\n * Works only on Windows (or macOS with Parallels Desktop, via the bundled Windows VM).\n */\n readonly certificateSha1?: string | null\n}\n\n// ─── Signing mode: hsm (Hardware Security Module via signtool /csp /kc) ──────\n\n/**\n * @beta HSM signing is available in v27 as a beta feature. The interface is stable but\n * real-hardware test coverage is limited.\n */\nexport interface WindowsHsmSigningConfig extends WindowsSigningSharedOptions {\n /** Discriminator selecting HSM / hardware-token signing via signtool's `/csp` and `/kc` flags. */\n readonly type: \"hsm\"\n\n /**\n * The name of the cryptographic service provider (CSP) that holds the private key.\n * Maps to signtool's `/csp` flag. Examples:\n * - Google Cloud KMS: `\"Google Cloud KMS Provider\"`\n * - Smart card / FIPS token: `\"Microsoft Base Smart Card Crypto Provider\"`\n *\n * Requires a modern `winCodeSign` toolset (the default; only the legacy `\"0.0.0\"` pin is\n * unsupported). Windows-only — use `type: \"pkcs11\"` on macOS/Linux.\n */\n readonly cryptoServiceProvider: string\n\n /**\n * The key container name within the CSP. Maps to signtool's `/kc` flag.\n *\n * Example for Google Cloud KMS:\n * `\"projects/PROJECT_ID/locations/LOCATION/keyRings/KEY_RING/cryptoKeys/KEY_NAME/cryptoKeyVersions/1\"`\n */\n readonly keyContainer: string\n\n /**\n * Path to the certificate file containing the public certificate chain (.crt / .cer / .pfx).\n * The private key is NOT read from this file — it is provided by the HSM via `cryptoServiceProvider`.\n */\n readonly certificateFile?: string | null\n\n /**\n * Alternative to `certificateFile`: locate the public certificate in the Windows certificate\n * store by its SHA-1 thumbprint. The private key still comes from the HSM via\n * `cryptoServiceProvider` / `keyContainer`; this only identifies which public certificate to sign\n * with.\n */\n readonly certificateSha1?: string | null\n\n /**\n * Alternative to `certificateFile`: locate the public certificate in the Windows certificate\n * store by (a substring of) its subject name. The private key still comes from the HSM via\n * `cryptoServiceProvider` / `keyContainer`; this only identifies which public certificate to sign\n * with.\n */\n readonly certificateSubjectName?: string | null\n}\n\n// ─── Signing mode: pkcs11 (cross-platform PKCS#11 via osslsigncode) ──────────\n\n/**\n * Sign with a PKCS#11 hardware token (smart card, USB HSM, cloud KMS exposed via a PKCS#11\n * provider) using `osslsigncode`. Unlike `hsm`, this mode does **not** require Windows or a\n * Windows VM, so it can sign Windows binaries directly from macOS/Linux CI. The token PIN is read\n * from the `WIN_CSC_KEY_PASSWORD` (or `CSC_KEY_PASSWORD`) environment variable.\n *\n * @beta PKCS#11 signing is available in v27 as a beta feature. The interface is stable but\n * real-hardware test coverage is limited.\n */\nexport interface WindowsPkcs11SigningConfig extends WindowsSigningSharedOptions {\n /** Discriminator selecting cross-platform PKCS#11 token signing via `osslsigncode`. */\n readonly type: \"pkcs11\"\n\n /**\n * Path to the PKCS#11 shared library (`.so` on Linux, `.dylib` on macOS).\n * The library must be installed separately — electron-builder does not bundle it.\n *\n * Example: `\"/usr/lib/x86_64-linux-gnu/opensc-pkcs11.so\"`\n *\n * Must be paired with `pkcs11KeyUri`.\n */\n readonly pkcs11Module: string\n\n /**\n * RFC 7512 PKCS#11 URI identifying the private key within the module.\n * Maps to osslsigncode's `-key` parameter.\n *\n * Example: `\"pkcs11:token=MyToken;object=MyKey;type=private\"`\n *\n * Must be paired with `pkcs11Module`.\n */\n readonly pkcs11KeyUri: string\n\n /**\n * Optional path to a certificate chain file to accompany the PKCS#11 key.\n * If omitted the certificate embedded in the token is used.\n */\n readonly certificateFile?: string | null\n}\n\n// ─── Signing mode: azure (Azure Trusted Signing) ──────────────────────────────\n\n/**\n * The `signtool /dlib` Azure Trusted Signing integration was introduced in `toolsets.winCodeSign: 1.3.0`.\n * The legacy PowerShell integration is deprecated, but leverages the same underlying Azure APIs, so both interfaces share the same config shape.\n */\nexport interface WindowsAzureSigningConfig {\n /** Discriminator selecting Azure Trusted Signing (cloud signing — no local certificate). */\n readonly type: \"azure\"\n\n /**\n * The publisher name to associate with the signature: a Distinguished Name (DN) of the subject of\n * the certificate issued by your Trusted Signing certificate profile (e.g.\n * `CN=My Company, O=My Company, C=US`). Required. Used for\n * [update verification](#verifyUpdateCodeSignature) (embedded in `app-update.yml` and checked by\n * electron-updater) and must match the certificate subject. A bare name fails the build since\n * v27 — see\n * [the migration guide](https://www.electron.build/docs/migration/v27-build-changes#windows-publishername-must-be-a-distinguished-name).\n *\n * @see https://github.com/electron-userland/electron-builder/issues/1187#issuecomment-278972073\n */\n readonly publisherName: string\n\n /**\n * The Trusted Signing Account endpoint. The URI value must align to the region your Trusted\n * Signing Account and Certificate Profile were created in.\n *\n * Requires Azure Entra ID environment variables per\n * [Microsoft's documentation](https://learn.microsoft.com/en-us/dotnet/api/azure.identity.environmentcredential?view=azure-dotnet#definition).\n */\n readonly endpoint: string\n\n /**\n * The name of the Trusted Signing Certificate Profile to sign with, as created in your Azure\n * Code Signing Account. Maps to the DLib metadata field `CertificateProfileName`.\n */\n readonly certificateProfileName: string\n\n /**\n * The name of the Azure Trusted Signing (Code Signing) Account that owns the certificate profile.\n * Maps to the DLib metadata field `CodeSigningAccountName`.\n */\n readonly codeSigningAccountName: string\n\n /**\n * The digest algorithm used to hash the files being signed. Maps to the DLib metadata field\n * `FileDigest`.\n * @default SHA256\n */\n readonly fileDigest?: string\n\n /**\n * The RFC3161 timestamp server. Translates to field: TimestampRfc3161.\n * @default http://timestamp.acs.microsoft.com\n */\n readonly timestampRfc3161?: string\n\n /**\n * The timestamp digest algorithm. Translates to field: TimestampDigest.\n * @default SHA256\n */\n readonly timestampDigest?: string\n\n /**\n * Additional fields to include verbatim in the `metadata.json` file passed to\n * `Azure.CodeSigning.Dlib.dll` via `signtool /dmdf`. Use this for DLib-specific options\n * not covered by the typed fields above (e.g. `ExcludeCredentials`, `CorrelationId`).\n */\n readonly additionalMetadata?: Record<string, string>\n}\n\n// ─── Discriminated union ──────────────────────────────────────────────────────\n\nexport type WindowsSigningConfiguration = WindowsSigntoolSigningConfig | WindowsHsmSigningConfig | WindowsPkcs11SigningConfig | WindowsAzureSigningConfig\n\n/** Signing modes that use signtool.exe or osslsigncode (not Azure). */\nexport type WindowsSigntoolFamilyConfig = WindowsSigntoolSigningConfig | WindowsHsmSigningConfig | WindowsPkcs11SigningConfig\n\n/**\n * Resolves the active signing configuration object. `false`, `null`, and unset all mean\n * \"no explicit signing config object\" (env-based discovery still applies when unset).\n */\nexport function resolveWindowsSigningConfiguration(config: WindowsConfiguration): WindowsSigningConfiguration | null {\n const { sign } = config\n return sign == null || sign === false ? null : sign\n}\n\n/** Whether Windows code signing has been explicitly disabled via `sign: false | null`. */\nexport function isWindowsSigningDisabled(config: WindowsConfiguration): boolean {\n return config.sign === false || config.sign === null\n}\n\n/**\n * Whether `file` is signed according to `signExts`: a listed extension is signed, a `!`-negated one is not, and\n * otherwise `.exe` files (or every file, with `fallbackValue`) are.\n */\nexport function shouldSignWindowsFile(file: string, signExts: ReadonlyArray<string> | null | undefined, fallbackValue = false): boolean {\n const isExe = file.endsWith(\".exe\")\n if (!signExts?.length) {\n return isExe || fallbackValue\n }\n // process patterns ( !exe => exclude .exe, .dll => include .dll )\n // we process first to allow literal negatives in case a filename matches \"help!.txt\" or similar\n if (signExts.some(ext => file.endsWith(ext))) {\n return true\n }\n // process negative patterns\n if (signExts.some(ext => ext.startsWith(\"!\") && file.endsWith(ext.substring(1)))) {\n return false\n }\n return isExe || fallbackValue\n}\n"]}
@@ -90,11 +90,33 @@ export declare class Packager {
90
90
  emitAfterPack(context: AfterPackContext): Promise<void>;
91
91
  emitAfterSign(context: AfterPackContext): Promise<void>;
92
92
  emitAfterExtract(context: AfterPackContext): Promise<void>;
93
+ /**
94
+ * Loads and validates the configuration. The app's electron-updater is checked against no platform's `electronUpdaterCompatibility`
95
+ * here: `build` checks it against the platforms it builds, while the CLI `publish` and `verify` commands write no update files.
96
+ */
93
97
  validateConfig(): Promise<void>;
98
+ /** `builtTargets`: the targets the build creates, whose update files the app's electron-updater has to read. */
99
+ private loadAndValidateConfig;
94
100
  build(repositoryInfo?: SourceRepositoryInfo): Promise<BuildResult>;
95
101
  private buildWithValidatedConfig;
96
102
  private readProjectMetadataIfTwoPackageStructureOrPrepacked;
97
103
  private doBuild;
104
+ private configureSevenZip;
105
+ /**
106
+ * Creates the platform packagers and the targets of each arch, recording each platform's targets in `platformToTarget`. Each platform's
107
+ * targets are resolved from its created packager's `platformOptions`, which a custom packager (`platformPackagerFactory`) may override.
108
+ */
109
+ private createPlannedTargets;
110
+ private createArchTargets;
111
+ private outputDirectoryPattern;
112
+ /**
113
+ * Packs the platforms one after another. The targets of a packed platform that support it start finishing right away, in the
114
+ * returned task manager; the others are returned to be finished once every platform is packed.
115
+ */
116
+ private packAll;
117
+ private packPlatform;
118
+ /** Waits for the targets that finish on their own, then finishes the others one after another. */
119
+ private finishTargets;
98
120
  private createHelper;
99
121
  installAppDependencies(platform: Platform, arch: Arch): Promise<any>;
100
122
  }
@@ -1 +1 @@
1
- {"version":3,"file":"packager.d.ts","sourceRoot":"","sources":["../src/packager.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EAGJ,WAAW,EAWX,MAAM,EACP,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,iBAAiB,EAAqB,MAAM,sBAAsB,CAAA;AAM3E,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,oBAAoB,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B,GAAG,OAAO,CAAC,WAAW,CAAC;YAY1D,wBAAwB;YAyExB,mDAAmD;YAenD,OAAO;YA6BP,iBAAiB;IAc/B;;;OAGG;YACW,oBAAoB;IAuBlC,OAAO,CAAC,iBAAiB;IAqBzB,OAAO,CAAC,sBAAsB;IAQ9B;;;OAGG;YACW,OAAO;YA2BP,YAAY;IAkC1B,kGAAkG;YACpF,aAAa;YAUb,YAAY;IAwBb,sBAAsB,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC;CAgDlF;AAiDD,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,aAAa,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;IACrC,QAAQ,CAAC,iBAAiB,EAAE,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;IAC9D,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAA;CACtC"}
package/dist/packager.js CHANGED
@@ -10,10 +10,11 @@ import { Platform } from "./core.js";
10
10
  import { createElectronFrameworkSupport } from "./electron/ElectronFramework.js";
11
11
  import { assertElectronArchSupported } from "./electron/electronArchSupport.js";
12
12
  import { isElectronBased } from "./Framework.js";
13
- import { addTargetsForPlatform, computeArchToTargetNamesMap, createTargets, NoOpTarget } from "./targets/targetFactory.js";
13
+ import { addTargetsForPlatform, createTargets, NoOpTarget, resolvePlatformBuildPlan, resolveTargetNames } from "./targets/targetFactory.js";
14
14
  import { computeDefaultAppDirectory, getConfig, validateConfiguration } from "./util/config/config.js";
15
15
  import { assertNoRemovedEnvVars } from "./util/flags.js";
16
16
  import { expandMacro } from "./util/macroExpander.js";
17
+ import { electronUpdaterRequirements } from "./util/electronUpdaterCompatibility.js";
17
18
  import { checkMetadata, readPackageJson } from "./util/packageMetadata.js";
18
19
  import { warnOnRemovedEnvVars } from "./util/removedEnvVars.js";
19
20
  import { getRepositoryInfo } from "./util/repositoryInfo.js";
@@ -258,7 +259,15 @@ export class Packager {
258
259
  async emitAfterExtract(context) {
259
260
  await this.eventEmitter.emit("afterExtract", context);
260
261
  }
262
+ /**
263
+ * Loads and validates the configuration. The app's electron-updater is checked against no platform's `electronUpdaterCompatibility`
264
+ * here: `build` checks it against the platforms it builds, while the CLI `publish` and `verify` commands write no update files.
265
+ */
261
266
  async validateConfig() {
267
+ await this.loadAndValidateConfig(new Map());
268
+ }
269
+ /** `builtTargets`: the targets the build creates, whose update files the app's electron-updater has to read. */
270
+ async loadAndValidateConfig(builtTargets) {
262
271
  let configPath = null;
263
272
  let configFromOptions = this.options.config;
264
273
  if (typeof configFromOptions === "string") {
@@ -291,7 +300,9 @@ export class Packager {
291
300
  if (this.isTwoPackageJsonProjectLayoutUsed) {
292
301
  log.debug({ devPackageFile, appPackageFile }, "two package.json structure is used");
293
302
  }
294
- checkMetadata(this.metadata, this.devMetadata, appPackageFile, devPackageFile, projectDir);
303
+ // per platform the build targets, which writes update files for its own range
304
+ const updaterRequirements = electronUpdaterRequirements(configuration, resolveTargetNames(builtTargets, configuration));
305
+ checkMetadata(this.metadata, this.devMetadata, appPackageFile, devPackageFile, projectDir, updaterRequirements);
295
306
  await validateConfiguration(configuration, this.debugLogger);
296
307
  this._configuration = configuration;
297
308
  this._devMetadata = devMetadata;
@@ -305,7 +316,7 @@ export class Packager {
305
316
  // Removed env vars are checked before anything else: nothing validates process.env, so a CI
306
317
  // image still exporting one silently gets a different toolchain than it asked for.
307
318
  assertNoRemovedEnvVars();
308
- await this.validateConfig();
319
+ await this.loadAndValidateConfig(this.options.targets ?? new Map());
309
320
  // every host program the build starts, also in its asynchronous work, comes from this build's toolsets.executables (or the
310
321
  // default install locations), whatever other builds in this process configure
311
322
  return await Executables.run(this.config.toolsets?.executables, () => this.buildWithValidatedConfig(repositoryInfo));
@@ -381,6 +392,27 @@ export class Packager {
381
392
  throw new Error(`Cannot find package.json in the ${path.dirname(appPackageFile)}`);
382
393
  }
383
394
  async doBuild() {
395
+ await this.configureSevenZip();
396
+ const platformToTarget = new Map();
397
+ // Every platform packager and target is created before the first pack, so listeners of `targetsCreated` (the
398
+ // publish preflight) see the whole build and can fail it before any artifact exists - let alone is uploaded.
399
+ const plans = await this.createPlannedTargets(this.options.targets ?? new Map(), platformToTarget);
400
+ // a cancelled build stops here rather than running the publish preflight on a partial plan
401
+ if (!this.cancellationToken.cancelled) {
402
+ await this.eventEmitter.emit("targetsCreated", plans.flatMap(it => it.archs));
403
+ }
404
+ await this.finishTargets(await this.packAll(plans));
405
+ // Every target has now finished reading the shared appOutDir(s), so finalize tasks may safely
406
+ // mutate them (e.g. NSIS copying elevate.exe into win-unpacked — see #9852).
407
+ for (const task of this.buildFinalizeTasks) {
408
+ if (this.cancellationToken.cancelled) {
409
+ break;
410
+ }
411
+ await task();
412
+ }
413
+ return platformToTarget;
414
+ }
415
+ async configureSevenZip() {
384
416
  const sevenZipConfig = this.config.toolsets?.sevenZip;
385
417
  if (typeof sevenZipConfig === "object" && sevenZipConfig != null) {
386
418
  const toolDir = await getCustomToolsetPath(sevenZipConfig, this.buildResourcesDir);
@@ -393,12 +425,14 @@ export class Packager {
393
425
  else {
394
426
  setSevenZipVersion(sevenZipConfig);
395
427
  }
396
- const taskManager = new AsyncTaskManager(this.cancellationToken);
397
- const syncTargetsIfAny = [];
398
- const platformToTarget = new Map();
399
- const createdOutDirs = new Set();
400
- const plans = [];
401
- for (const [platform, archToType] of this.options.targets) {
428
+ }
429
+ /**
430
+ * Creates the platform packagers and the targets of each arch, recording each platform's targets in `platformToTarget`. Each platform's
431
+ * targets are resolved from its created packager's `platformOptions`, which a custom packager (`platformPackagerFactory`) may override.
432
+ */
433
+ async createPlannedTargets(requested, platformToTarget) {
434
+ const result = [];
435
+ for (const [platform, archToType] of requested) {
402
436
  if (this.cancellationToken.cancelled) {
403
437
  break;
404
438
  }
@@ -408,63 +442,53 @@ export class Packager {
408
442
  const packager = await this.createHelper(platform);
409
443
  const nameToTarget = new Map();
410
444
  platformToTarget.set(platform, nameToTarget);
411
- const archs = [];
412
- for (const [arch, targetNames] of computeArchToTargetNamesMap(archToType, packager, platform)) {
413
- if (this.cancellationToken.cancelled) {
414
- break;
415
- }
416
- // fail fast when the requested arch has no official Electron build anymore (Electron 44 removed win32-ia32 and linux-armv7l);
417
- // skipped for prepackaged apps since nothing is downloaded then
418
- if (this.options.prepackaged == null && isElectronBased(this.framework)) {
419
- assertElectronArchSupported(platform, arch, this.framework.version, this.config);
420
- }
421
- // support os and arch macro in output value
422
- const outDir = path.resolve(this.projectDir, packager.expandMacro(this.config.directories.output, Arch[arch]));
423
- const targets = createTargets(nameToTarget, targetNames.length === 0 ? packager.defaultTarget : targetNames, outDir, packager);
424
- archs.push({ packager, arch, targets, outDir });
425
- }
426
- plans.push({ packager, nameToTarget, archs });
445
+ const platformPlan = resolvePlatformBuildPlan(platform, archToType, packager.platformOptions);
446
+ result.push({ packager, nameToTarget, archs: this.createArchTargets(platformPlan, packager, nameToTarget) });
427
447
  }
428
- // a cancelled build stops here rather than running the publish preflight on a partial plan
429
- if (!this.cancellationToken.cancelled) {
430
- await this.eventEmitter.emit("targetsCreated", plans.flatMap(it => it.archs));
431
- }
432
- for (const { packager, nameToTarget, archs } of plans) {
448
+ return result;
449
+ }
450
+ createArchTargets({ platform, archToTargetNames }, packager, nameToTarget) {
451
+ const result = [];
452
+ for (const [arch, targetNames] of archToTargetNames) {
433
453
  if (this.cancellationToken.cancelled) {
434
454
  break;
435
455
  }
436
- let poolCount = Math.floor(packager.config.concurrency?.jobs || 1);
437
- if (poolCount < 1) {
438
- log.warn({ concurrency: poolCount }, "concurrency is invalid, overriding with job count: 1");
439
- poolCount = 1;
456
+ // fail fast when the requested arch has no official Electron build anymore (Electron 44 removed win32-ia32 and linux-armv7l);
457
+ // skipped for prepackaged apps since nothing is downloaded then
458
+ if (this.options.prepackaged == null && isElectronBased(this.framework)) {
459
+ assertElectronArchSupported(platform, arch, this.framework.version, this.config);
440
460
  }
441
- else if (poolCount > MAX_FILE_REQUESTS) {
442
- log.warn({ concurrency: poolCount, MAX_FILE_REQUESTS }, `job concurrency is greater than recommended MAX_FILE_REQUESTS, this may lead to File Descriptor errors (too many files open). Proceed with caution (e.g. this is an experimental feature)`);
443
- }
444
- const packPromises = [];
445
- for (const { arch, targets: targetList, outDir } of archs) {
446
- if (this.cancellationToken.cancelled) {
447
- break;
448
- }
449
- await createOutDirIfNeed(targetList, createdOutDirs);
450
- const promise = packager.pack(outDir, arch, targetList, taskManager);
451
- if (poolCount < 2) {
452
- await promise;
453
- }
454
- else {
455
- packPromises.push(promise);
456
- }
461
+ // support os and arch macro in output value
462
+ const outDir = path.resolve(this.projectDir, packager.expandMacro(this.outputDirectoryPattern(), Arch[arch]));
463
+ const targets = createTargets(nameToTarget, targetNames.length === 0 ? packager.defaultTarget : targetNames, outDir, packager);
464
+ result.push({ packager, arch, targets, outDir });
465
+ }
466
+ return result;
467
+ }
468
+ outputDirectoryPattern() {
469
+ const output = this.config.directories?.output;
470
+ if (output == null) {
471
+ throw new Error("directories.output is not set: the configuration was not loaded");
472
+ }
473
+ return output;
474
+ }
475
+ /**
476
+ * Packs the platforms one after another. The targets of a packed platform that support it start finishing right away, in the
477
+ * returned task manager; the others are returned to be finished once every platform is packed.
478
+ */
479
+ async packAll(plans) {
480
+ const taskManager = new AsyncTaskManager(this.cancellationToken);
481
+ const syncTargets = [];
482
+ const createdOutDirs = new Set();
483
+ for (const plan of plans) {
484
+ if (this.cancellationToken.cancelled) {
485
+ break;
457
486
  }
458
- await asyncPool(poolCount, packPromises, async (it) => {
459
- if (this.cancellationToken.cancelled) {
460
- return;
461
- }
462
- await it;
463
- });
487
+ await this.packPlatform(plan, taskManager, createdOutDirs);
464
488
  if (this.cancellationToken.cancelled) {
465
489
  break;
466
490
  }
467
- for (const target of nameToTarget.values()) {
491
+ for (const target of plan.nameToTarget.values()) {
468
492
  if (this.targetsSkippedByTestHook.has(target) && !this.targetsBuiltAfterPack.has(target)) {
469
493
  continue;
470
494
  }
@@ -472,26 +496,51 @@ export class Packager {
472
496
  taskManager.addTask(target.finishBuild());
473
497
  }
474
498
  else {
475
- syncTargetsIfAny.push(target);
499
+ syncTargets.push(target);
476
500
  }
477
501
  }
478
502
  }
479
- await taskManager.awaitTasks();
480
- for (const target of syncTargetsIfAny) {
503
+ return { taskManager, syncTargets };
504
+ }
505
+ async packPlatform({ packager, archs }, taskManager, createdOutDirs) {
506
+ let poolCount = Math.floor(packager.config.concurrency?.jobs || 1);
507
+ if (poolCount < 1) {
508
+ log.warn({ concurrency: poolCount }, "concurrency is invalid, overriding with job count: 1");
509
+ poolCount = 1;
510
+ }
511
+ else if (poolCount > MAX_FILE_REQUESTS) {
512
+ log.warn({ concurrency: poolCount, MAX_FILE_REQUESTS }, `job concurrency is greater than recommended MAX_FILE_REQUESTS, this may lead to File Descriptor errors (too many files open). Proceed with caution (e.g. this is an experimental feature)`);
513
+ }
514
+ const packPromises = [];
515
+ for (const { arch, targets, outDir } of archs) {
481
516
  if (this.cancellationToken.cancelled) {
482
517
  break;
483
518
  }
484
- await target.finishBuild();
519
+ await createOutDirIfNeed(targets, createdOutDirs);
520
+ const promise = packager.pack(outDir, arch, targets, taskManager);
521
+ if (poolCount < 2) {
522
+ await promise;
523
+ }
524
+ else {
525
+ packPromises.push(promise);
526
+ }
485
527
  }
486
- // Every target has now finished reading the shared appOutDir(s), so finalize tasks may safely
487
- // mutate them (e.g. NSIS copying elevate.exe into win-unpacked — see #9852).
488
- for (const task of this.buildFinalizeTasks) {
528
+ await asyncPool(poolCount, packPromises, async (it) => {
529
+ if (this.cancellationToken.cancelled) {
530
+ return;
531
+ }
532
+ await it;
533
+ });
534
+ }
535
+ /** Waits for the targets that finish on their own, then finishes the others one after another. */
536
+ async finishTargets({ taskManager, syncTargets }) {
537
+ await taskManager.awaitTasks();
538
+ for (const target of syncTargets) {
489
539
  if (this.cancellationToken.cancelled) {
490
540
  break;
491
541
  }
492
- await task();
542
+ await target.finishBuild();
493
543
  }
494
- return platformToTarget;
495
544
  }
496
545
  async createHelper(platform) {
497
546
  if (this.options.platformPackagerFactory != null) {