app-builder-lib 27.0.0-alpha.1 → 27.0.0-alpha.10

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 (457) hide show
  1. package/dist/Framework.d.ts +2 -0
  2. package/dist/Framework.d.ts.map +1 -1
  3. package/dist/Framework.js.map +1 -1
  4. package/dist/appInfo.d.ts +1 -1
  5. package/dist/appInfo.d.ts.map +1 -1
  6. package/dist/appInfo.js +3 -3
  7. package/dist/appInfo.js.map +1 -1
  8. package/dist/asar/asar.js.map +1 -1
  9. package/dist/asar/asarFileChecker.d.ts +4 -2
  10. package/dist/asar/asarFileChecker.d.ts.map +1 -1
  11. package/dist/asar/asarFileChecker.js +2 -3
  12. package/dist/asar/asarFileChecker.js.map +1 -1
  13. package/dist/asar/asarUtil.js +21 -11
  14. package/dist/asar/asarUtil.js.map +1 -1
  15. package/dist/codeSign/certInfo.d.ts +14 -0
  16. package/dist/codeSign/certInfo.d.ts.map +1 -1
  17. package/dist/codeSign/certInfo.js +49 -0
  18. package/dist/codeSign/certInfo.js.map +1 -1
  19. package/dist/codeSign/mac/macCodeSign.d.ts +3 -3
  20. package/dist/codeSign/mac/macCodeSign.d.ts.map +1 -1
  21. package/dist/codeSign/mac/macCodeSign.js +50 -25
  22. package/dist/codeSign/mac/macCodeSign.js.map +1 -1
  23. package/dist/codeSign/signResult.d.ts +26 -0
  24. package/dist/codeSign/signResult.d.ts.map +1 -0
  25. package/dist/codeSign/signResult.js +12 -0
  26. package/dist/codeSign/signResult.js.map +1 -0
  27. package/dist/codeSign/win/hsmSignManager.d.ts +10 -0
  28. package/dist/codeSign/win/hsmSignManager.d.ts.map +1 -0
  29. package/dist/codeSign/win/hsmSignManager.js +50 -0
  30. package/dist/codeSign/win/hsmSignManager.js.map +1 -0
  31. package/dist/codeSign/win/pkcs11SignManager.d.ts +14 -0
  32. package/dist/codeSign/win/pkcs11SignManager.d.ts.map +1 -0
  33. package/dist/codeSign/win/pkcs11SignManager.js +82 -0
  34. package/dist/codeSign/win/pkcs11SignManager.js.map +1 -0
  35. package/dist/codeSign/win/signManager.d.ts +17 -0
  36. package/dist/codeSign/win/signManager.d.ts.map +1 -0
  37. package/dist/codeSign/win/signManager.js +19 -0
  38. package/dist/codeSign/win/signManager.js.map +1 -0
  39. package/dist/codeSign/win/signtoolBaseSignManager.d.ts +95 -0
  40. package/dist/codeSign/win/signtoolBaseSignManager.d.ts.map +1 -0
  41. package/dist/codeSign/win/signtoolBaseSignManager.js +507 -0
  42. package/dist/codeSign/win/signtoolBaseSignManager.js.map +1 -0
  43. package/dist/codeSign/win/windowsCodeSign.d.ts +2 -1
  44. package/dist/codeSign/win/windowsCodeSign.d.ts.map +1 -1
  45. package/dist/codeSign/win/windowsCodeSign.js +22 -8
  46. package/dist/codeSign/win/windowsCodeSign.js.map +1 -1
  47. package/dist/codeSign/win/windowsSignAzureManager.d.ts +11 -4
  48. package/dist/codeSign/win/windowsSignAzureManager.d.ts.map +1 -1
  49. package/dist/codeSign/win/windowsSignAzureManager.js +142 -37
  50. package/dist/codeSign/win/windowsSignAzureManager.js.map +1 -1
  51. package/dist/codeSign/win/windowsSignToolManager.d.ts +1 -58
  52. package/dist/codeSign/win/windowsSignToolManager.d.ts.map +1 -1
  53. package/dist/codeSign/win/windowsSignToolManager.js +3 -363
  54. package/dist/codeSign/win/windowsSignToolManager.js.map +1 -1
  55. package/dist/configuration.d.ts +228 -163
  56. package/dist/configuration.d.ts.map +1 -1
  57. package/dist/configuration.js +11 -1
  58. package/dist/configuration.js.map +1 -1
  59. package/dist/core.d.ts +14 -0
  60. package/dist/core.d.ts.map +1 -1
  61. package/dist/core.js +11 -0
  62. package/dist/core.js.map +1 -1
  63. package/dist/electron/ElectronFramework.d.ts +3 -3
  64. package/dist/electron/ElectronFramework.d.ts.map +1 -1
  65. package/dist/electron/ElectronFramework.js +60 -61
  66. package/dist/electron/ElectronFramework.js.map +1 -1
  67. package/dist/electron/electronArchSupport.d.ts +12 -0
  68. package/dist/electron/electronArchSupport.d.ts.map +1 -0
  69. package/dist/electron/electronArchSupport.js +58 -0
  70. package/dist/electron/electronArchSupport.js.map +1 -0
  71. package/dist/electron/electronVersion.d.ts.map +1 -1
  72. package/dist/electron/electronVersion.js +1 -11
  73. package/dist/electron/electronVersion.js.map +1 -1
  74. package/dist/electron/injectFFMPEG.js +2 -2
  75. package/dist/electron/injectFFMPEG.js.map +1 -1
  76. package/dist/electron/mac/electronMac.js +24 -35
  77. package/dist/electron/mac/electronMac.js.map +1 -1
  78. package/dist/electron/mac/electronMacUtils.d.ts +24 -0
  79. package/dist/electron/mac/electronMacUtils.d.ts.map +1 -0
  80. package/dist/electron/mac/electronMacUtils.js +42 -0
  81. package/dist/electron/mac/electronMacUtils.js.map +1 -0
  82. package/dist/electron/win/electronWin.js +2 -2
  83. package/dist/electron/win/electronWin.js.map +1 -1
  84. package/dist/fileMatcher.d.ts +42 -2
  85. package/dist/fileMatcher.d.ts.map +1 -1
  86. package/dist/fileMatcher.js +246 -18
  87. package/dist/fileMatcher.js.map +1 -1
  88. package/dist/index.d.ts +11 -5
  89. package/dist/index.d.ts.map +1 -1
  90. package/dist/index.js +17 -1
  91. package/dist/index.js.map +1 -1
  92. package/dist/indexInternal.d.ts +19 -8
  93. package/dist/indexInternal.d.ts.map +1 -1
  94. package/dist/indexInternal.js +18 -7
  95. package/dist/indexInternal.js.map +1 -1
  96. package/dist/linuxPackager.d.ts.map +1 -1
  97. package/dist/linuxPackager.js +19 -1
  98. package/dist/linuxPackager.js.map +1 -1
  99. package/dist/macPackager.d.ts +31 -14
  100. package/dist/macPackager.d.ts.map +1 -1
  101. package/dist/macPackager.js +236 -147
  102. package/dist/macPackager.js.map +1 -1
  103. package/dist/node-module-collector/index.d.ts.map +1 -1
  104. package/dist/node-module-collector/index.js +47 -16
  105. package/dist/node-module-collector/index.js.map +1 -1
  106. package/dist/node-module-collector/moduleManager.d.ts +11 -2
  107. package/dist/node-module-collector/moduleManager.d.ts.map +1 -1
  108. package/dist/node-module-collector/moduleManager.js +34 -14
  109. package/dist/node-module-collector/moduleManager.js.map +1 -1
  110. package/dist/node-module-collector/nodeModulesCollector.d.ts +47 -26
  111. package/dist/node-module-collector/nodeModulesCollector.d.ts.map +1 -1
  112. package/dist/node-module-collector/nodeModulesCollector.js +157 -142
  113. package/dist/node-module-collector/nodeModulesCollector.js.map +1 -1
  114. package/dist/node-module-collector/packageManager.js +1 -1
  115. package/dist/node-module-collector/packageManager.js.map +1 -1
  116. package/dist/node-module-collector/pnpmNodeModulesCollector.d.ts +90 -1
  117. package/dist/node-module-collector/pnpmNodeModulesCollector.d.ts.map +1 -1
  118. package/dist/node-module-collector/pnpmNodeModulesCollector.js +325 -25
  119. package/dist/node-module-collector/pnpmNodeModulesCollector.js.map +1 -1
  120. package/dist/node-module-collector/types.d.ts +4 -0
  121. package/dist/node-module-collector/types.d.ts.map +1 -1
  122. package/dist/node-module-collector/types.js.map +1 -1
  123. package/dist/options/FuseOptionsV1.d.ts +137 -0
  124. package/dist/options/FuseOptionsV1.d.ts.map +1 -0
  125. package/dist/options/FuseOptionsV1.js +2 -0
  126. package/dist/options/FuseOptionsV1.js.map +1 -0
  127. package/dist/options/MsixOptions.d.ts +126 -0
  128. package/dist/options/MsixOptions.d.ts.map +1 -0
  129. package/dist/options/MsixOptions.js +2 -0
  130. package/dist/options/MsixOptions.js.map +1 -0
  131. package/dist/options/PlatformSpecificBuildOptions.d.ts +55 -9
  132. package/dist/options/PlatformSpecificBuildOptions.d.ts.map +1 -1
  133. package/dist/options/PlatformSpecificBuildOptions.js.map +1 -1
  134. package/dist/options/SnapOptions.d.ts +23 -17
  135. package/dist/options/SnapOptions.d.ts.map +1 -1
  136. package/dist/options/SnapOptions.js.map +1 -1
  137. package/dist/options/SquirrelWindowsOptions.d.ts +0 -5
  138. package/dist/options/SquirrelWindowsOptions.d.ts.map +1 -1
  139. package/dist/options/SquirrelWindowsOptions.js.map +1 -1
  140. package/dist/options/linuxOptions.d.ts +8 -12
  141. package/dist/options/linuxOptions.d.ts.map +1 -1
  142. package/dist/options/linuxOptions.js.map +1 -1
  143. package/dist/options/macOptions.d.ts +113 -131
  144. package/dist/options/macOptions.d.ts.map +1 -1
  145. package/dist/options/macOptions.js.map +1 -1
  146. package/dist/options/pkgOptions.d.ts +1 -1
  147. package/dist/options/pkgOptions.js.map +1 -1
  148. package/dist/options/winOptions.d.ts +282 -70
  149. package/dist/options/winOptions.d.ts.map +1 -1
  150. package/dist/options/winOptions.js +12 -1
  151. package/dist/options/winOptions.js.map +1 -1
  152. package/dist/packager.d.ts +6 -1
  153. package/dist/packager.d.ts.map +1 -1
  154. package/dist/packager.js +121 -40
  155. package/dist/packager.js.map +1 -1
  156. package/dist/packagerApi.d.ts +10 -1
  157. package/dist/packagerApi.d.ts.map +1 -1
  158. package/dist/packagerApi.js.map +1 -1
  159. package/dist/platformPackager.d.ts +49 -3
  160. package/dist/platformPackager.d.ts.map +1 -1
  161. package/dist/platformPackager.js +130 -17
  162. package/dist/platformPackager.js.map +1 -1
  163. package/dist/publish/PublishManager.d.ts +36 -2
  164. package/dist/publish/PublishManager.d.ts.map +1 -1
  165. package/dist/publish/PublishManager.js +387 -23
  166. package/dist/publish/PublishManager.js.map +1 -1
  167. package/dist/publish/updateInfoBuilder.d.ts +1 -1
  168. package/dist/publish/updateInfoBuilder.d.ts.map +1 -1
  169. package/dist/publish/updateInfoBuilder.js +110 -32
  170. package/dist/publish/updateInfoBuilder.js.map +1 -1
  171. package/dist/targets/ArchiveTarget.d.ts +1 -0
  172. package/dist/targets/ArchiveTarget.d.ts.map +1 -1
  173. package/dist/targets/ArchiveTarget.js +6 -3
  174. package/dist/targets/ArchiveTarget.js.map +1 -1
  175. package/dist/targets/archive.d.ts +33 -2
  176. package/dist/targets/archive.d.ts.map +1 -1
  177. package/dist/targets/archive.js +109 -29
  178. package/dist/targets/archive.js.map +1 -1
  179. package/dist/targets/blockmap/blockmap.d.ts +43 -3
  180. package/dist/targets/blockmap/blockmap.d.ts.map +1 -1
  181. package/dist/targets/blockmap/blockmap.js +141 -15
  182. package/dist/targets/blockmap/blockmap.js.map +1 -1
  183. package/dist/targets/blockmap/verbatimRange.d.ts +44 -0
  184. package/dist/targets/blockmap/verbatimRange.d.ts.map +1 -0
  185. package/dist/targets/blockmap/verbatimRange.js +117 -0
  186. package/dist/targets/blockmap/verbatimRange.js.map +1 -0
  187. package/dist/targets/differentialUpdateInfoBuilder.d.ts +28 -2
  188. package/dist/targets/differentialUpdateInfoBuilder.d.ts.map +1 -1
  189. package/dist/targets/differentialUpdateInfoBuilder.js +75 -6
  190. package/dist/targets/differentialUpdateInfoBuilder.js.map +1 -1
  191. package/dist/targets/linux/FlatpakTarget.d.ts.map +1 -1
  192. package/dist/targets/linux/FlatpakTarget.js +13 -3
  193. package/dist/targets/linux/FlatpakTarget.js.map +1 -1
  194. package/dist/targets/linux/FpmTarget.d.ts +14 -0
  195. package/dist/targets/linux/FpmTarget.d.ts.map +1 -1
  196. package/dist/targets/linux/FpmTarget.js +86 -10
  197. package/dist/targets/linux/FpmTarget.js.map +1 -1
  198. package/dist/targets/linux/LinuxTargetHelper.d.ts +15 -0
  199. package/dist/targets/linux/LinuxTargetHelper.d.ts.map +1 -1
  200. package/dist/targets/linux/LinuxTargetHelper.js +54 -59
  201. package/dist/targets/linux/LinuxTargetHelper.js.map +1 -1
  202. package/dist/targets/linux/appimage/AppImageTarget.d.ts +2 -0
  203. package/dist/targets/linux/appimage/AppImageTarget.d.ts.map +1 -1
  204. package/dist/targets/linux/appimage/AppImageTarget.js +16 -15
  205. package/dist/targets/linux/appimage/AppImageTarget.js.map +1 -1
  206. package/dist/targets/linux/appimage/appImageUtil.d.ts +5 -1
  207. package/dist/targets/linux/appimage/appImageUtil.d.ts.map +1 -1
  208. package/dist/targets/linux/appimage/appImageUtil.js +14 -7
  209. package/dist/targets/linux/appimage/appImageUtil.js.map +1 -1
  210. package/dist/targets/linux/appimage/appLauncher.d.ts.map +1 -1
  211. package/dist/targets/linux/appimage/appLauncher.js +5 -11
  212. package/dist/targets/linux/appimage/appLauncher.js.map +1 -1
  213. package/dist/targets/linux/launcherScript.d.ts +32 -0
  214. package/dist/targets/linux/launcherScript.d.ts.map +1 -0
  215. package/dist/targets/linux/launcherScript.js +24 -0
  216. package/dist/targets/linux/launcherScript.js.map +1 -0
  217. package/dist/targets/linux/snap/SnapTarget.d.ts +1 -1
  218. package/dist/targets/linux/snap/SnapTarget.d.ts.map +1 -1
  219. package/dist/targets/linux/snap/SnapTarget.js +23 -1
  220. package/dist/targets/linux/snap/SnapTarget.js.map +1 -1
  221. package/dist/targets/linux/snap/core24.d.ts +30 -1
  222. package/dist/targets/linux/snap/core24.d.ts.map +1 -1
  223. package/dist/targets/linux/snap/core24.js +146 -70
  224. package/dist/targets/linux/snap/core24.js.map +1 -1
  225. package/dist/targets/linux/snap/coreCustom.d.ts +1 -1
  226. package/dist/targets/linux/snap/coreCustom.d.ts.map +1 -1
  227. package/dist/targets/linux/snap/coreCustom.js +2 -2
  228. package/dist/targets/linux/snap/coreCustom.js.map +1 -1
  229. package/dist/targets/linux/snap/coreLegacy.d.ts +3 -3
  230. package/dist/targets/linux/snap/coreLegacy.d.ts.map +1 -1
  231. package/dist/targets/linux/snap/coreLegacy.js +12 -12
  232. package/dist/targets/linux/snap/coreLegacy.js.map +1 -1
  233. package/dist/targets/linux/snap/snapCommand.d.ts +13 -0
  234. package/dist/targets/linux/snap/snapCommand.d.ts.map +1 -0
  235. package/dist/targets/linux/snap/snapCommand.js +21 -0
  236. package/dist/targets/linux/snap/snapCommand.js.map +1 -0
  237. package/dist/targets/linux/snap/snapcraft.d.ts +190 -0
  238. package/dist/targets/linux/snap/snapcraft.d.ts.map +1 -0
  239. package/dist/targets/linux/snap/snapcraft.js +11 -0
  240. package/dist/targets/linux/snap/snapcraft.js.map +1 -0
  241. package/dist/targets/linux/snap/snapcraftBuilder.d.ts +7 -1
  242. package/dist/targets/linux/snap/snapcraftBuilder.d.ts.map +1 -1
  243. package/dist/targets/linux/snap/snapcraftBuilder.js +57 -20
  244. package/dist/targets/linux/snap/snapcraftBuilder.js.map +1 -1
  245. package/dist/targets/mac/MacTargetHelper.d.ts +146 -14
  246. package/dist/targets/mac/MacTargetHelper.d.ts.map +1 -1
  247. package/dist/targets/mac/MacTargetHelper.js +485 -91
  248. package/dist/targets/mac/MacTargetHelper.js.map +1 -1
  249. package/dist/targets/mac/pkg.d.ts +16 -0
  250. package/dist/targets/mac/pkg.d.ts.map +1 -1
  251. package/dist/targets/mac/pkg.js +31 -5
  252. package/dist/targets/mac/pkg.js.map +1 -1
  253. package/dist/targets/targetFactory.d.ts +7 -0
  254. package/dist/targets/targetFactory.d.ts.map +1 -1
  255. package/dist/targets/targetFactory.js +28 -0
  256. package/dist/targets/targetFactory.js.map +1 -1
  257. package/dist/targets/win/AppxTarget.d.ts +1 -2
  258. package/dist/targets/win/AppxTarget.d.ts.map +1 -1
  259. package/dist/targets/win/AppxTarget.js +37 -314
  260. package/dist/targets/win/AppxTarget.js.map +1 -1
  261. package/dist/targets/win/MsiTarget.d.ts.map +1 -1
  262. package/dist/targets/win/MsiTarget.js +13 -13
  263. package/dist/targets/win/MsiTarget.js.map +1 -1
  264. package/dist/targets/win/MsixTarget.d.ts +22 -0
  265. package/dist/targets/win/MsixTarget.d.ts.map +1 -0
  266. package/dist/targets/win/MsixTarget.js +214 -0
  267. package/dist/targets/win/MsixTarget.js.map +1 -0
  268. package/dist/targets/win/nsis/Defines.d.ts +3 -0
  269. package/dist/targets/win/nsis/Defines.d.ts.map +1 -1
  270. package/dist/targets/win/nsis/Defines.js.map +1 -1
  271. package/dist/targets/win/nsis/NsisTarget.d.ts +57 -3
  272. package/dist/targets/win/nsis/NsisTarget.d.ts.map +1 -1
  273. package/dist/targets/win/nsis/NsisTarget.js +252 -113
  274. package/dist/targets/win/nsis/NsisTarget.js.map +1 -1
  275. package/dist/targets/win/nsis/WebInstallerTarget.d.ts.map +1 -1
  276. package/dist/targets/win/nsis/WebInstallerTarget.js +23 -12
  277. package/dist/targets/win/nsis/WebInstallerTarget.js.map +1 -1
  278. package/dist/targets/win/nsis/nsisOptions.d.ts +56 -48
  279. package/dist/targets/win/nsis/nsisOptions.d.ts.map +1 -1
  280. package/dist/targets/win/nsis/nsisOptions.js.map +1 -1
  281. package/dist/targets/win/nsis/nsisScriptGenerator.d.ts.map +1 -1
  282. package/dist/targets/win/nsis/nsisScriptGenerator.js +4 -3
  283. package/dist/targets/win/nsis/nsisScriptGenerator.js.map +1 -1
  284. package/dist/targets/win/nsis/nsisUtil.d.ts +17 -2
  285. package/dist/targets/win/nsis/nsisUtil.d.ts.map +1 -1
  286. package/dist/targets/win/nsis/nsisUtil.js +143 -41
  287. package/dist/targets/win/nsis/nsisUtil.js.map +1 -1
  288. package/dist/targets/win/nsis/progId.d.ts +21 -0
  289. package/dist/targets/win/nsis/progId.d.ts.map +1 -0
  290. package/dist/targets/win/nsis/progId.js +60 -0
  291. package/dist/targets/win/nsis/progId.js.map +1 -0
  292. package/dist/targets/win/winAppUtil.d.ts +115 -0
  293. package/dist/targets/win/winAppUtil.d.ts.map +1 -0
  294. package/dist/targets/win/winAppUtil.js +407 -0
  295. package/dist/targets/win/winAppUtil.js.map +1 -0
  296. package/dist/toolsets/7zip.d.ts +32 -0
  297. package/dist/toolsets/7zip.d.ts.map +1 -1
  298. package/dist/toolsets/7zip.js +39 -11
  299. package/dist/toolsets/7zip.js.map +1 -1
  300. package/dist/toolsets/appimage.d.ts +3 -3
  301. package/dist/toolsets/appimage.d.ts.map +1 -1
  302. package/dist/toolsets/appimage.js +9 -6
  303. package/dist/toolsets/appimage.js.map +1 -1
  304. package/dist/toolsets/custom.d.ts +2 -3
  305. package/dist/toolsets/custom.d.ts.map +1 -1
  306. package/dist/toolsets/custom.js +67 -149
  307. package/dist/toolsets/custom.js.map +1 -1
  308. package/dist/toolsets/fpm.d.ts.map +1 -1
  309. package/dist/toolsets/fpm.js +11 -5
  310. package/dist/toolsets/fpm.js.map +1 -1
  311. package/dist/toolsets/icons.d.ts.map +1 -1
  312. package/dist/toolsets/icons.js +17 -3
  313. package/dist/toolsets/icons.js.map +1 -1
  314. package/dist/toolsets/linuxToolsMac.d.ts.map +1 -1
  315. package/dist/toolsets/linuxToolsMac.js +17 -4
  316. package/dist/toolsets/linuxToolsMac.js.map +1 -1
  317. package/dist/toolsets/nsis.d.ts +5 -0
  318. package/dist/toolsets/nsis.d.ts.map +1 -1
  319. package/dist/toolsets/nsis.js +20 -4
  320. package/dist/toolsets/nsis.js.map +1 -1
  321. package/dist/toolsets/version.d.ts +12 -0
  322. package/dist/toolsets/version.d.ts.map +1 -0
  323. package/dist/toolsets/version.js +13 -0
  324. package/dist/toolsets/version.js.map +1 -0
  325. package/dist/toolsets/winCodeSign.d.ts +56 -3
  326. package/dist/toolsets/winCodeSign.d.ts.map +1 -1
  327. package/dist/toolsets/winCodeSign.js +125 -42
  328. package/dist/toolsets/winCodeSign.js.map +1 -1
  329. package/dist/toolsets/wine.d.ts +2 -1
  330. package/dist/toolsets/wine.d.ts.map +1 -1
  331. package/dist/toolsets/wine.js +31 -15
  332. package/dist/toolsets/wine.js.map +1 -1
  333. package/dist/util/NodeModuleCopyHelper.js +14 -6
  334. package/dist/util/NodeModuleCopyHelper.js.map +1 -1
  335. package/dist/util/appFileCopier.d.ts +52 -0
  336. package/dist/util/appFileCopier.d.ts.map +1 -1
  337. package/dist/util/appFileCopier.js +221 -21
  338. package/dist/util/appFileCopier.js.map +1 -1
  339. package/dist/util/archCompatibility.d.ts +42 -0
  340. package/dist/util/archCompatibility.d.ts.map +1 -0
  341. package/dist/util/archCompatibility.js +202 -0
  342. package/dist/util/archCompatibility.js.map +1 -0
  343. package/dist/util/checksum.d.ts +36 -0
  344. package/dist/util/checksum.d.ts.map +1 -0
  345. package/dist/util/checksum.js +48 -0
  346. package/dist/util/checksum.js.map +1 -0
  347. package/dist/util/config/config.d.ts +1 -0
  348. package/dist/util/config/config.d.ts.map +1 -1
  349. package/dist/util/config/config.js +8 -1
  350. package/dist/util/config/config.js.map +1 -1
  351. package/dist/util/config/legacyConfigGuard.d.ts +7 -0
  352. package/dist/util/config/legacyConfigGuard.d.ts.map +1 -0
  353. package/dist/util/config/legacyConfigGuard.js +187 -0
  354. package/dist/util/config/legacyConfigGuard.js.map +1 -0
  355. package/dist/util/config/legacyOptions.d.ts +75 -0
  356. package/dist/util/config/legacyOptions.d.ts.map +1 -0
  357. package/dist/util/config/legacyOptions.js +399 -0
  358. package/dist/util/config/legacyOptions.js.map +1 -0
  359. package/dist/util/config/load.d.ts +2 -2
  360. package/dist/util/config/load.d.ts.map +1 -1
  361. package/dist/util/config/load.js +3 -12
  362. package/dist/util/config/load.js.map +1 -1
  363. package/dist/util/config/schemaValidator.d.ts.map +1 -1
  364. package/dist/util/config/schemaValidator.js +26 -3
  365. package/dist/util/config/schemaValidator.js.map +1 -1
  366. package/dist/util/electronGet.d.ts +30 -32
  367. package/dist/util/electronGet.d.ts.map +1 -1
  368. package/dist/util/electronGet.js +359 -129
  369. package/dist/util/electronGet.js.map +1 -1
  370. package/dist/util/flags.d.ts +5 -5
  371. package/dist/util/flags.d.ts.map +1 -1
  372. package/dist/util/flags.js +124 -16
  373. package/dist/util/flags.js.map +1 -1
  374. package/dist/util/hash.d.ts +1 -1
  375. package/dist/util/hash.d.ts.map +1 -1
  376. package/dist/util/hash.js +1 -15
  377. package/dist/util/hash.js.map +1 -1
  378. package/dist/util/installOrRebuild.d.ts +44 -0
  379. package/dist/util/installOrRebuild.d.ts.map +1 -0
  380. package/dist/util/installOrRebuild.js +276 -0
  381. package/dist/util/installOrRebuild.js.map +1 -0
  382. package/dist/util/langs.d.ts.map +1 -1
  383. package/dist/util/langs.js +1 -0
  384. package/dist/util/langs.js.map +1 -1
  385. package/dist/util/license.d.ts.map +1 -1
  386. package/dist/util/license.js +4 -1
  387. package/dist/util/license.js.map +1 -1
  388. package/dist/util/mac/macosIconComposer.d.ts +2 -1
  389. package/dist/util/mac/macosIconComposer.d.ts.map +1 -1
  390. package/dist/util/mac/macosIconComposer.js +40 -58
  391. package/dist/util/mac/macosIconComposer.js.map +1 -1
  392. package/dist/util/mac/macosVersion.d.ts +0 -1
  393. package/dist/util/mac/macosVersion.d.ts.map +1 -1
  394. package/dist/util/mac/macosVersion.js +0 -3
  395. package/dist/util/mac/macosVersion.js.map +1 -1
  396. package/dist/util/mac/plist.d.ts +1 -1
  397. package/dist/util/mac/plist.d.ts.map +1 -1
  398. package/dist/util/mac/plist.js +5 -0
  399. package/dist/util/mac/plist.js.map +1 -1
  400. package/dist/util/nativeBinaryVerifier.d.ts +40 -0
  401. package/dist/util/nativeBinaryVerifier.d.ts.map +1 -0
  402. package/dist/util/nativeBinaryVerifier.js +381 -0
  403. package/dist/util/nativeBinaryVerifier.js.map +1 -0
  404. package/dist/util/packageMetadata.js +57 -31
  405. package/dist/util/packageMetadata.js.map +1 -1
  406. package/dist/util/repositoryInfo.js +6 -3
  407. package/dist/util/repositoryInfo.js.map +1 -1
  408. package/dist/util/resolve.js +1 -1
  409. package/dist/util/resolve.js.map +1 -1
  410. package/dist/util/streamSpawnToFile.d.ts +47 -0
  411. package/dist/util/streamSpawnToFile.d.ts.map +1 -0
  412. package/dist/util/streamSpawnToFile.js +110 -0
  413. package/dist/util/streamSpawnToFile.js.map +1 -0
  414. package/dist/util/toolsetLock.d.ts +2 -0
  415. package/dist/util/toolsetLock.d.ts.map +1 -1
  416. package/dist/util/toolsetLock.js +31 -5
  417. package/dist/util/toolsetLock.js.map +1 -1
  418. package/dist/version.d.ts +1 -1
  419. package/dist/version.d.ts.map +1 -1
  420. package/dist/version.js +1 -1
  421. package/dist/version.js.map +1 -1
  422. package/dist/vm/ParallelsVm.d.ts.map +1 -1
  423. package/dist/vm/ParallelsVm.js +29 -3
  424. package/dist/vm/ParallelsVm.js.map +1 -1
  425. package/dist/vm/vm.d.ts +2 -0
  426. package/dist/vm/vm.d.ts.map +1 -1
  427. package/dist/vm/vm.js +29 -6
  428. package/dist/vm/vm.js.map +1 -1
  429. package/dist/winPackager.d.ts +6 -5
  430. package/dist/winPackager.d.ts.map +1 -1
  431. package/dist/winPackager.js +45 -39
  432. package/dist/winPackager.js.map +1 -1
  433. package/package.json +19 -18
  434. package/scheme.json +1731 -961
  435. package/templates/appx/appxmanifest.xml +2 -3
  436. package/templates/entitlements.mac.adhoc.plist +15 -0
  437. package/templates/entitlements.mac.plist +9 -6
  438. package/templates/msix/appxmanifest.xml +45 -0
  439. package/templates/nsis/assistedMessages.yml +17 -0
  440. package/templates/nsis/common.nsh +2 -2
  441. package/templates/nsis/include/allowOnlyOneInstallerInstance.nsh +96 -13
  442. package/templates/nsis/include/extractAppPackage.nsh +5 -2
  443. package/templates/nsis/include/installUtil.nsh +2 -2
  444. package/templates/nsis/include/installer.nsh +88 -50
  445. package/templates/nsis/include/webPackage.nsh +52 -27
  446. package/templates/nsis/installSection.nsh +29 -0
  447. package/templates/nsis/installer.nsi +1 -1
  448. package/templates/nsis/messages.yml +5 -0
  449. package/templates/nsis/multiUserUi.nsh +1 -1
  450. package/dist/codeSign/signManager.d.ts +0 -14
  451. package/dist/codeSign/signManager.d.ts.map +0 -1
  452. package/dist/codeSign/signManager.js +0 -2
  453. package/dist/codeSign/signManager.js.map +0 -1
  454. package/dist/util/yarn.d.ts +0 -23
  455. package/dist/util/yarn.d.ts.map +0 -1
  456. package/dist/util/yarn.js +0 -153
  457. package/dist/util/yarn.js.map +0 -1
@@ -1,21 +1,38 @@
1
- import { Arch, InvalidConfigurationError, log, statOrNull } from "builder-util";
2
- import { dynamicImport } from "../../util/dynamicImport.js";
1
+ import { notarize } from "@electron/notarize";
2
+ import { Arch, InvalidConfigurationError, log, MAX_FILE_REQUESTS, spawnAndWriteWithOutput, statOrNull, walk } from "builder-util";
3
+ import { open } from "fs/promises";
3
4
  import * as path from "path";
4
- import { findIdentity, reportError } from "../../codeSign/mac/macCodeSign.js";
5
+ import { findIdentity, Identity, reportError } from "../../codeSign/mac/macCodeSign.js";
6
+ import { parsePlistFile, savePlistFile } from "../../util/mac/plist.js";
5
7
  import { getTemplatePath } from "../../util/pathManager.js";
8
+ import asyncPool from "tiny-async-pool";
9
+ const DISABLE_LIBRARY_VALIDATION = "com.apple.security.cs.disable-library-validation";
10
+ const APP_SANDBOX = "com.apple.security.app-sandbox";
6
11
  export class MacTargetHelper {
7
12
  constructor(packager) {
8
13
  this.packager = packager;
9
14
  }
15
+ /** Ad-hoc signing (`sign.identity: "-"`) produces a signature with no Team ID. */
16
+ static isAdHocIdentity(identity) {
17
+ return identity?.name === "-";
18
+ }
10
19
  handleNullIdentity() {
11
20
  if (this.packager.forceCodeSigning) {
12
21
  throw new InvalidConfigurationError("identity explicitly is set to null, but forceCodeSigning is set to true");
13
22
  }
14
- log.info({ reason: "identity explicitly is set to null" }, "skipped macOS code signing");
15
- return false;
23
+ // The meaning of `mac.sign: null` flipped in v27. In v26 `sign` was only a custom-signer hook, so
24
+ // null meant "no custom signer" and the app was still signed normally; now it means "do not sign".
25
+ // A v26 config carried over unchanged therefore ships an UNSIGNED app with no other signal.
26
+ log.warn({
27
+ reason: "identity explicitly is set to null",
28
+ solution: "remove `sign: null` to sign normally, or set `mac.sign.identity` — keep it only if you intend to ship an unsigned app",
29
+ }, 'skipped macOS code signing. Note this changed in v27: `mac.sign: null` now means "do not sign", whereas in v26 it only meant "no custom signer" and the app was still signed. ' +
30
+ "See https://www.electron.build/docs/migration/v27-breaking-changes#macos-signing-macsign");
31
+ return "skipped:disabled";
16
32
  }
17
- async findSigningIdentity(isMas, isDevelopment, qualifier, keychainFile, config) {
18
- const certificateTypes = MacTargetHelper.getCertificateTypes(isMas, isDevelopment);
33
+ async findSigningIdentity(targetPlatform, qualifier, keychainFile, hasCustomSign, signOpts) {
34
+ const isMas = MacTargetHelper.isMasTarget(targetPlatform);
35
+ const certificateTypes = MacTargetHelper.getCertificateTypes(targetPlatform, MacTargetHelper.resolveSigningType(targetPlatform, signOpts?.type));
19
36
  let identity = null;
20
37
  for (const certificateType of certificateTypes) {
21
38
  identity = await findIdentity(certificateType, qualifier, keychainFile);
@@ -24,20 +41,16 @@ export class MacTargetHelper {
24
41
  }
25
42
  }
26
43
  if (identity == null) {
27
- if (!isMas && !isDevelopment && config.type !== "distribution") {
28
- identity = await findIdentity("Mac Developer", qualifier, keychainFile);
29
- if (identity != null) {
30
- log.warn("Mac Developer is used to sign app — it is only for development and testing, not for production");
31
- }
32
- }
33
- const noIdentity = !config.sign && identity == null;
44
+ const noIdentity = !hasCustomSign;
34
45
  if (qualifier === "-") {
35
- if (MacTargetHelper.isHardenedRuntimeEnabledForSigning(isMas, config)) {
36
- log.warn(null, "ad-hoc signing with hardenedRuntime enabled requires the com.apple.security.cs.disable-library-validation entitlement " +
37
- "to prevent app launch failures due to library validation. See https://electron.build/code-signing for details.");
46
+ if (MacTargetHelper.isHardenedRuntimeEnabledForSigning(targetPlatform, signOpts?.hardenedRuntime) && !(await this.isLibraryValidationDisabled(targetPlatform, signOpts))) {
47
+ log.warn(null, `ad-hoc signing with hardenedRuntime enabled requires the ${DISABLE_LIBRARY_VALIDATION} entitlement ` +
48
+ "in both the app entitlements (build/entitlements.mac.plist or mac.sign.entitlements) and the inherit entitlements " +
49
+ "(build/entitlements.mac.inherit.plist or mac.sign.entitlementsInherit) to prevent app launch failures due to library validation, " +
50
+ "but at least one of your entitlements files does not grant it. " +
51
+ "See https://electron.build/docs/features/code-signing for details.");
38
52
  }
39
- const { Identity: IdentityClass } = await dynamicImport("@electron/osx-sign/dist/cjs/util-identities");
40
- identity = new IdentityClass("-", undefined);
53
+ identity = new Identity("-", undefined);
41
54
  }
42
55
  else if (noIdentity) {
43
56
  await reportError(isMas, certificateTypes, qualifier, keychainFile, this.packager.forceCodeSigning);
@@ -46,27 +59,193 @@ export class MacTargetHelper {
46
59
  }
47
60
  return identity;
48
61
  }
49
- async buildSignOptions(appPath, identity, type, isMas, config, keychainFile, arch) {
50
- let filter = config.signIgnore;
51
- if (Array.isArray(filter)) {
52
- if (filter.length == 0) {
53
- filter = null;
62
+ /**
63
+ * Resolves the app and inherit entitlements files for an ad-hoc build — same precedence as `getAppEntitlements()` and
64
+ * `getInheritEntitlements()` — and returns whether both grant `com.apple.security.cs.disable-library-validation`.
65
+ *
66
+ * An ad-hoc signature carries no Team ID, so every process in the bundle — the app and each helper — fails library
67
+ * validation when it loads the Electron framework unless its own entitlements disable it. A user-supplied inherit
68
+ * plist (e.g. a production `build/entitlements.mac.inherit.plist`) without the key therefore breaks the helpers even
69
+ * when the app entitlements grant it, which is why both files are checked.
70
+ *
71
+ * Fails open: returns false (so callers still warn) when either file cannot be read or parsed, or when no file
72
+ * resolves at all (`@electron/osx-sign`'s defaults never grant the key). An explicit `sign.entitlements` /
73
+ * `sign.entitlementsInherit` path that does not exist is a configuration error and throws, like any other missing
74
+ * build resource.
75
+ */
76
+ async isLibraryValidationDisabled(targetPlatform, signOpts) {
77
+ const [appEntitlements, inheritEntitlements] = await Promise.all([
78
+ this.getAppEntitlements(targetPlatform, signOpts, true /* adHoc */),
79
+ this.getInheritEntitlements(targetPlatform, signOpts, true /* adHoc */),
80
+ ]);
81
+ return (await this.grantsDisableLibraryValidation(appEntitlements)) && (await this.grantsDisableLibraryValidation(inheritEntitlements));
82
+ }
83
+ async grantsDisableLibraryValidation(file) {
84
+ return (await this.entitlementsValue(file, DISABLE_LIBRARY_VALIDATION)) === true;
85
+ }
86
+ /**
87
+ * The value the entitlements file assigns to `key`, or `undefined` when the key is absent or the file cannot be
88
+ * read or parsed. Returns the raw value rather than a boolean because callers disagree on the predicate: an
89
+ * opt-out we act on ourselves is required to be literally `true`, while a key we are predicting
90
+ * `@electron/osx-sign` will act on has to use osx-sign's own truthiness test.
91
+ */
92
+ async entitlementsValue(file, key) {
93
+ if (file == null) {
94
+ // no user-supplied file and no bundled default — @electron/osx-sign's defaults never grant the key
95
+ return undefined;
96
+ }
97
+ try {
98
+ const entitlements = await parsePlistFile(file);
99
+ return entitlements[key];
100
+ }
101
+ catch (e) {
102
+ log.debug({ file, key, error: e.message }, "cannot read entitlements");
103
+ return undefined;
104
+ }
105
+ }
106
+ /**
107
+ * Resolves the entitlements file for the app bundle itself.
108
+ *
109
+ * Precedence: explicit `sign.entitlements` → `build/entitlements.{mac,mas}.plist` → a bundled default.
110
+ * The explicit path is resolved like every other build resource (build resources dir, then project dir) and
111
+ * must exist. Returns `null` when no default applies, which lets `@electron/osx-sign` fall back to its own
112
+ * Chromium-derived defaults (`default.mas.plist` for MAS).
113
+ */
114
+ async getAppEntitlements(targetPlatform, signOpts, adHoc) {
115
+ const isMas = MacTargetHelper.isMasTarget(targetPlatform);
116
+ // an explicit `sign.entitlements` resolves like every other build resource (build resources dir, then project dir);
117
+ // `null`/empty behave like unset so the `build/entitlements.{mac,mas}.plist` convention still applies
118
+ const entitlements = await this.packager.getResource(signOpts?.entitlements || undefined, `entitlements.${isMas ? "mas" : "mac"}.plist`);
119
+ if (entitlements != null) {
120
+ return entitlements;
121
+ }
122
+ if (isMas) {
123
+ // @electron/osx-sign's default.mas.plist enables the App Sandbox, which a MAS build cannot ship without
124
+ return null;
125
+ }
126
+ return getTemplatePath(adHoc ? "entitlements.mac.adhoc.plist" : "entitlements.mac.plist");
127
+ }
128
+ /**
129
+ * Resolves the entitlements file for the nested binaries (helpers, frameworks, unpacked executables) that
130
+ * inherit the app's signature.
131
+ *
132
+ * Precedence: explicit `sign.entitlementsInherit` → `build/entitlements.{mac,mas}.inherit.plist` → `null`,
133
+ * which hands the file to `@electron/osx-sign`'s per-file defaults, modelled on Chromium's own entitlements
134
+ * (the explicit path is resolved like every other build resource — build resources dir, then project dir — and must exist):
135
+ * - renderer and GPU helpers: `allow-jit` only
136
+ * - plugin helper: `allow-jit`, `allow-unsigned-executable-memory`, `disable-library-validation`
137
+ * - everything else (frameworks, `.node` modules, unpacked executables): `default.darwin.plist`, i.e. `allow-jit`
138
+ * plus Chromium's `device.*` / `personal-information.*` entitlements
139
+ * Nested binaries therefore do not inherit the app's entitlements, and apart from the plugin helper none of these
140
+ * defaults grant `disable-library-validation` or `allow-unsigned-executable-memory`.
141
+ */
142
+ async getInheritEntitlements(targetPlatform, signOpts, adHoc) {
143
+ const isMas = MacTargetHelper.isMasTarget(targetPlatform);
144
+ // an explicit `sign.entitlementsInherit` resolves like every other build resource (build resources dir, then project dir);
145
+ // `null`/empty behave like unset so the `build/entitlements.{mac,mas}.inherit.plist` convention still applies
146
+ const entitlements = await this.packager.getResource(signOpts?.entitlementsInherit || undefined, `entitlements.${isMas ? "mas" : "mac"}.inherit.plist`);
147
+ if (entitlements != null) {
148
+ return entitlements;
149
+ }
150
+ // an ad-hoc signature has no Team ID, so every process in the bundle — not just the main one — needs
151
+ // library validation disabled or it cannot load the Electron framework
152
+ return adHoc && !isMas ? getTemplatePath("entitlements.mac.adhoc.plist") : null;
153
+ }
154
+ /**
155
+ * Picks the string handed to `@electron/osx-sign` as `identity`. Two consumers inside osx-sign want different
156
+ * forms of the same certificate, which is why this line has flipped twice before:
157
+ *
158
+ * - `codesign --sign <identity>` needs a *unique* reference. A common name can match several valid certificates
159
+ * (the same name issued twice with different expiry dates), and `codesign` then fails with
160
+ * `... : ambiguous (matches "X" and "X" ...)` — `--keychain` does not disambiguate it. Only the SHA-1 hash is
161
+ * unique. https://github.com/electron-userland/electron-builder/issues/10237
162
+ * - osx-sign's entitlements automation scrapes the Team ID out of the identity *name* with `/^.+\((.+?)\)$/` to
163
+ * fill in `ElectronTeamID`, and throws `Could not automatically determine ElectronTeamID from identity` when
164
+ * that fails. A bare hash has no `(TEAMID)` suffix.
165
+ * https://github.com/electron-userland/electron-builder/issues/7995
166
+ *
167
+ * So we pass the hash and, when that automation is going to run, hand it the Team ID through the one channel it
168
+ * already prefers over the identity name: `ElectronTeamID` in the app's `Info.plist`. Writing that key is exactly
169
+ * what osx-sign would have done itself, from the same source. It reaches the regex only when the App Sandbox is
170
+ * enabled (see `isSandboxed`), no `provisioningProfile` is configured, and `Info.plist` carries no
171
+ * `ElectronTeamID` — so those cases skip the write and pass the hash straight through.
172
+ *
173
+ * Falls back to the name whenever the hash cannot be made to work (no hash at all, ad-hoc, a self-signed name
174
+ * with no `(TEAMID)`, an unreadable `Info.plist`), which leaves the previous behavior — and the previous error
175
+ * message — untouched for those cases.
176
+ *
177
+ * All of this is osx-sign-specific, so a custom signer (`sign` as a function or module path) gets the bare hash
178
+ * and an untouched `Info.plist`: `@electron/osx-sign` never runs, so there is no automation to feed.
179
+ */
180
+ async resolveSignIdentity(appPath, identity, signOpts, targetPlatform, hasCustomSign = false) {
181
+ // ad-hoc ("-") and any name-only identity have nothing to disambiguate with
182
+ if (!identity.hash || MacTargetHelper.isAdHocIdentity(identity)) {
183
+ return identity.name;
184
+ }
185
+ // a custom signer replaces @electron/osx-sign entirely. Hand over the unique hash — the form `codesign`
186
+ // needs — and mutate nothing on its behalf. This must stay above every branch below, so a delegated signer
187
+ // never lands in one of their `identity.name` fallbacks.
188
+ if (hasCustomSign) {
189
+ return identity.hash;
190
+ }
191
+ // osx-sign's entitlements automation is off, or it takes the Team ID from the profile instead of the identity
192
+ if (signOpts?.preAutoEntitlements === false || signOpts?.provisioningProfile) {
193
+ return identity.hash;
194
+ }
195
+ if (!(await this.isSandboxed(appPath, signOpts, targetPlatform))) {
196
+ return identity.hash;
197
+ }
198
+ const infoPlistFile = path.join(appPath, "Contents", "Info.plist");
199
+ try {
200
+ const info = await parsePlistFile(infoPlistFile);
201
+ if (info.ElectronTeamID) {
202
+ // osx-sign prefers this over parsing the identity, so the hash never reaches its regex
203
+ return identity.hash;
204
+ }
205
+ // the same pattern osx-sign uses, so we never derive a Team ID it would have rejected
206
+ const teamId = /^.+\((.+?)\)\s*$/.exec(identity.name)?.[1];
207
+ if (teamId == null) {
208
+ log.debug({ identityName: identity.name }, "cannot parse Team ID from identity name, signing with the identity name");
209
+ return identity.name;
54
210
  }
211
+ await savePlistFile(infoPlistFile, { ...info, ElectronTeamID: teamId });
212
+ log.debug({ file: log.filePath(infoPlistFile), teamId }, "ElectronTeamID set from the signing identity name");
213
+ return identity.hash;
55
214
  }
56
- else if (filter != null) {
57
- filter = filter.length === 0 ? null : [filter];
215
+ catch (e) {
216
+ log.debug({ file: log.filePath(infoPlistFile), error: e.message }, "cannot read or update Info.plist, signing with the identity name");
217
+ return identity.name;
58
218
  }
59
- const filterRe = filter == null
60
- ? null
61
- : filter.map(it => {
62
- try {
63
- return new RegExp(it);
64
- }
65
- catch (e) {
66
- throw new InvalidConfigurationError(`Invalid regex filter pattern: ${it}. ${e.message}`);
67
- }
68
- });
69
- let binaries = config.binaries || undefined;
219
+ }
220
+ /**
221
+ * Whether `@electron/osx-sign`'s entitlements automation can reach the `ElectronTeamID`-from-identity-name step
222
+ * that a bare hash cannot satisfy.
223
+ *
224
+ * osx-sign gates the automation on `!filePath.includes('.app/')` and runs it with that path's own entitlements.
225
+ * The app bundle itself always qualifies, under the app entitlements. Two further cases qualify under the
226
+ * inherit entitlements, and only then is that file worth reading: a `sign.binaries` entry (signed alongside the
227
+ * bundle rather than within it), and — when the signed bundle is not named `*.app`, which `--prepackaged`
228
+ * allows — every file inside it, since none of their paths contain `.app/` either.
229
+ *
230
+ * A `null` file means osx-sign falls back to its own default, and only the MAS defaults enable the App Sandbox.
231
+ * Truthiness, not `=== true`, because that is the test osx-sign itself applies.
232
+ */
233
+ async isSandboxed(appPath, signOpts, targetPlatform) {
234
+ const isMas = MacTargetHelper.isMasTarget(targetPlatform);
235
+ const grants = async (file) => (file == null ? isMas : !!(await this.entitlementsValue(file, APP_SANDBOX)));
236
+ if (await grants(await this.getAppEntitlements(targetPlatform, signOpts, false))) {
237
+ return true;
238
+ }
239
+ if (!signOpts?.binaries?.length && path.basename(appPath).endsWith(".app")) {
240
+ // nothing but the bundle itself is signed outside a `.app/` path, so the inherit entitlements never apply
241
+ return false;
242
+ }
243
+ return await grants(await this.getInheritEntitlements(targetPlatform, signOpts, false));
244
+ }
245
+ async buildSignOptions(appPath, identity, config, keychainFile, arch, targetPlatform, hasCustomSign = false) {
246
+ const isMas = MacTargetHelper.isMasTarget(targetPlatform);
247
+ const type = MacTargetHelper.resolveSigningType(targetPlatform, config?.type);
248
+ let binaries = config?.binaries || undefined;
70
249
  if (binaries) {
71
250
  // Accept absolute paths for external binaries, else resolve relative paths from the artifact's app Contents path.
72
251
  binaries = (await Promise.all(binaries.flatMap(async (destination) => {
@@ -80,6 +259,25 @@ export class MacTargetHelper {
80
259
  }))).flat();
81
260
  log.info({ binaries, arch: arch == null ? null : Arch[arch] }, "signing additional user-defined binaries for arch");
82
261
  }
262
+ let filter = config?.ignore;
263
+ if (Array.isArray(filter)) {
264
+ if (filter.length == 0) {
265
+ filter = undefined;
266
+ }
267
+ }
268
+ else if (typeof filter === "string") {
269
+ filter = filter.length === 0 ? undefined : [filter];
270
+ }
271
+ const filterRe = typeof filter === "function"
272
+ ? null
273
+ : filter?.map(it => {
274
+ try {
275
+ return new RegExp(it);
276
+ }
277
+ catch (e) {
278
+ throw new InvalidConfigurationError(`Invalid regex filter pattern: ${it}. ${e.message}`);
279
+ }
280
+ });
83
281
  return {
84
282
  identityValidation: false,
85
283
  // https://github.com/electron-userland/electron-builder/issues/1699
@@ -92,6 +290,9 @@ export class MacTargetHelper {
92
290
  }
93
291
  }
94
292
  }
293
+ if (typeof filter === "function" && filter(file)) {
294
+ return true;
295
+ }
95
296
  return (file.endsWith(".kext") ||
96
297
  file.startsWith("/Contents/PlugIns", appPath.length) ||
97
298
  file.includes("/node_modules/puppeteer/.local-chromium") ||
@@ -102,7 +303,7 @@ export class MacTargetHelper {
102
303
  https://github.com/electron-userland/electron-builder/issues/5383
103
304
  */
104
305
  },
105
- identity: identity ? identity.hash || identity.name : undefined,
306
+ identity: identity ? await this.resolveSignIdentity(appPath, identity, config, targetPlatform, hasCustomSign) : undefined,
106
307
  type,
107
308
  platform: isMas ? "mas" : "darwin",
108
309
  version: this.packager.config.electronVersion || undefined,
@@ -110,17 +311,109 @@ export class MacTargetHelper {
110
311
  keychain: keychainFile || undefined,
111
312
  binaries,
112
313
  // https://github.com/electron-userland/electron-builder/issues/1480
113
- strictVerify: config.strictVerify,
114
- preAutoEntitlements: config.preAutoEntitlements,
115
- optionsForFile: await this.getOptionsForFile(appPath, isMas, config),
116
- provisioningProfile: config.provisioningProfile || undefined,
314
+ strictVerify: config?.strictVerify,
315
+ preAutoEntitlements: config?.preAutoEntitlements,
316
+ optionsForFile: await this.getOptionsForFile(appPath, targetPlatform, config, identity),
317
+ provisioningProfile: config?.provisioningProfile || undefined,
117
318
  };
118
319
  }
119
- async createMasInstaller(appPath, outDir, masOptions, keychainFile, isDevelopment, arch) {
120
- const certType = isDevelopment ? "Mac Developer" : "3rd Party Mac Developer Installer";
121
- const masInstallerIdentity = await findIdentity(certType, masOptions.identity, keychainFile);
320
+ /**
321
+ * Post-sign diagnostic replacing the blanket `com.apple.security.cs.disable-library-validation` default.
322
+ *
323
+ * Walks the Mach-O libraries and bundles (`MH_DYLIB` / `MH_BUNDLE`) under `Contents/Resources/app.asar.unpacked` and
324
+ * `Contents/PlugIns` and reports the ones whose signature does not carry the Team ID `codesign` reports for the
325
+ * freshly signed app bundle — typically excluded via `sign.ignore`, or fetched at build time already signed by a
326
+ * third party. Only loadable code is checked because library validation applies to what a process loads;
327
+ * executables (`MH_EXECUTE`, e.g. a bundled ffmpeg) are spawned rather than loaded, so a foreign signature on them is
328
+ * not a launch failure and reporting them would be a false positive. `Contents/PlugIns` is covered because
329
+ * `buildSignOptions` never re-signs it, so a bundle there keeps whatever signature it shipped with. Under the
330
+ * hardened runtime those fail library validation when loaded, which is precisely the failure the old default hid
331
+ * from every user instead of only the affected ones.
332
+ *
333
+ * The opt-out is read from the app entitlements (not the inherit ones) because library validation is enforced by
334
+ * the loading process under its own entitlements — the main process, governed by the app plist, is the usual loader
335
+ * of these modules, while the inherit plist only governs loads performed by helper processes.
336
+ *
337
+ * Best-effort: never fails the build, and skips the scan when the app bundle itself has no Team ID (e.g. a
338
+ * self-signed certificate).
339
+ */
340
+ async warnAboutForeignSignedBinaries(appPath, identity, targetPlatform, signOpts) {
341
+ if (MacTargetHelper.isMasTarget(targetPlatform) ||
342
+ MacTargetHelper.isAdHocIdentity(identity) ||
343
+ !MacTargetHelper.isHardenedRuntimeEnabledForSigning(targetPlatform, signOpts?.hardenedRuntime)) {
344
+ return;
345
+ }
346
+ if (await this.grantsDisableLibraryValidation(await this.getAppEntitlements(targetPlatform, signOpts, false))) {
347
+ // the app already opted out of library validation
348
+ return;
349
+ }
350
+ // `Contents/PlugIns` is scanned too: `buildSignOptions` unconditionally excludes it from re-signing, so anything
351
+ // there keeps whatever third-party signature it shipped with — exactly what fails library validation
352
+ const candidateDirs = [path.join(appPath, "Contents", "Resources", "app.asar.unpacked"), path.join(appPath, "Contents", "PlugIns")];
353
+ try {
354
+ const dirs = [];
355
+ for (const dir of candidateDirs) {
356
+ if ((await statOrNull(dir)) != null) {
357
+ dirs.push(dir);
358
+ }
359
+ }
360
+ if (dirs.length === 0) {
361
+ return;
362
+ }
363
+ // the Team ID is read from the signed bundle rather than parsed out of the identity's common name: not every
364
+ // identity carries a "(TEAMID)" suffix, and a self-signed one can carry it without codesign ever recording it
365
+ const teamId = await this.readSigningTeamId(appPath);
366
+ if (teamId == null) {
367
+ // no Team ID to compare against (unsigned, or signed without one)
368
+ return;
369
+ }
370
+ let files = [];
371
+ for (const dir of dirs) {
372
+ files = files.concat(await walk(dir));
373
+ }
374
+ // bounded concurrency: each check spawns `codesign -d`; results are sorted afterwards so the warning is deterministic
375
+ const checked = await asyncPool(MAX_FILE_REQUESTS, files, async (file) => {
376
+ // only dylibs and bundles get loaded into a process; executables are spawned and never face library validation
377
+ if (!isLoadableMachOFileType(await readMachOFileType(file))) {
378
+ return null;
379
+ }
380
+ return (await this.readSigningTeamId(file)) === teamId ? null : path.relative(appPath, file);
381
+ });
382
+ const foreign = checked.filter((it) => it != null).sort();
383
+ if (foreign.length > 0) {
384
+ log.warn({ files: foreign.join(", "), teamId }, `libraries in app.asar.unpacked or Contents/PlugIns are unsigned or signed by another team — under the hardened runtime they will fail library validation when loaded. ` +
385
+ `Sign them with the same identity, or grant ${DISABLE_LIBRARY_VALIDATION} in build/entitlements.mac.plist ` +
386
+ `(and in build/entitlements.mac.inherit.plist if a helper process such as a utilityProcess or a nodeIntegration renderer loads them)`);
387
+ }
388
+ }
389
+ catch (e) {
390
+ log.debug({ error: e.message }, "cannot inspect app.asar.unpacked and Contents/PlugIns for foreign-signed binaries");
391
+ }
392
+ }
393
+ /**
394
+ * The `TeamIdentifier` of a file's existing code signature as reported by `codesign -d`, or `null` when there is none:
395
+ * `codesign` fails (e.g. the file is unsigned), the field is absent, or it is the literal `not set` that ad-hoc and
396
+ * self-signed signatures report.
397
+ *
398
+ * @internal An instance method rather than a module-level function so tests can stub the `codesign` invocation, which
399
+ * only exists on macOS.
400
+ */
401
+ async readSigningTeamId(file) {
402
+ try {
403
+ // `codesign -d` reports on stderr, so stdout alone (as `exec` returns) is not enough
404
+ const { stderr } = await spawnAndWriteWithOutput("/usr/bin/codesign", ["-d", "--verbose=4", file], "");
405
+ return parseSigningTeamId(stderr);
406
+ }
407
+ catch {
408
+ // unsigned binaries make `codesign -d` exit non-zero
409
+ return null;
410
+ }
411
+ }
412
+ async createMasInstaller(appPath, outDir, masOptions, keychainFile, targetPlatform, arch, identityQualifier) {
413
+ const certType = MacTargetHelper.isMasDevelopment(targetPlatform) ? "Mac Developer" : "3rd Party Mac Developer Installer";
414
+ const masInstallerIdentity = await findIdentity(certType, identityQualifier, keychainFile);
122
415
  if (masInstallerIdentity == null) {
123
- throw new InvalidConfigurationError(`Cannot find valid "${certType}" identity to sign MAS installer, please see https://electron.build/code-signing`);
416
+ throw new InvalidConfigurationError(`Cannot find valid "${certType}" identity to sign MAS installer, please see https://electron.build/docs/features/code-signing`);
124
417
  }
125
418
  MacTargetHelper.assertSafePathForCommandUsage(outDir, "output directory");
126
419
  // mas uploaded to AppStore, so, use "-" instead of space for name
@@ -137,74 +430,75 @@ export class MacTargetHelper {
137
430
  packager: this.packager,
138
431
  });
139
432
  }
140
- async getOptionsForFile(appPath, isMas, customSignOptions) {
141
- const resourceList = await this.packager.resourceList;
142
- const entitlementsSuffix = isMas ? "mas" : "mac";
433
+ async getOptionsForFile(appPath, targetPlatform, customSignOptions, identity) {
434
+ const isMas = MacTargetHelper.isMasTarget(targetPlatform);
435
+ const adHoc = MacTargetHelper.isAdHocIdentity(identity);
436
+ const appEntitlements = await this.getAppEntitlements(targetPlatform, customSignOptions, adHoc);
437
+ const inheritEntitlements = await this.getInheritEntitlements(targetPlatform, customSignOptions, adHoc);
143
438
  const getEntitlements = (filePath) => {
144
439
  if (filePath === appPath) {
145
- if (customSignOptions.entitlements) {
146
- return customSignOptions.entitlements;
147
- }
148
- const p = `entitlements.${entitlementsSuffix}.plist`;
149
- if (resourceList.includes(p)) {
150
- return path.join(this.packager.buildResourcesDir, p);
151
- }
152
- else {
153
- return getTemplatePath("entitlements.mac.plist");
154
- }
440
+ return appEntitlements;
155
441
  }
156
442
  if (filePath.includes("Library/LoginItems")) {
157
- return customSignOptions.entitlementsLoginHelper;
158
- }
159
- if (customSignOptions.entitlementsInherit) {
160
- return customSignOptions.entitlementsInherit;
161
- }
162
- const p = `entitlements.${entitlementsSuffix}.inherit.plist`;
163
- if (resourceList.includes(p)) {
164
- return path.join(this.packager.buildResourcesDir, p);
165
- }
166
- else {
167
- return getTemplatePath("entitlements.mac.plist");
443
+ return customSignOptions?.entitlementsLoginHelper;
168
444
  }
445
+ // `null` leaves the file to @electron/osx-sign's per-file defaults, which are tighter than one blanket plist
446
+ return inheritEntitlements;
169
447
  };
170
- const requirements = isMas || this.packager.platformOptions.requirements == null ? undefined : await this.packager.getResource(this.packager.platformOptions.requirements);
171
- // harden by default for mac builds. Only harden mas builds if explicitly true (backward compatibility)
172
- const hardenedRuntime = isMas ? customSignOptions.hardenedRuntime === true : customSignOptions.hardenedRuntime !== false;
448
+ const requirements = isMas || customSignOptions?.requirements == null ? undefined : await this.packager.getResource(customSignOptions.requirements);
173
449
  return (filePath) => {
174
450
  const entitlements = getEntitlements(filePath);
175
451
  return {
176
452
  entitlements: entitlements || undefined,
177
- hardenedRuntime: hardenedRuntime ?? undefined,
178
- timestamp: customSignOptions.timestamp || undefined,
453
+ hardenedRuntime: MacTargetHelper.isHardenedRuntimeEnabledForSigning(targetPlatform, customSignOptions?.hardenedRuntime) ?? undefined,
454
+ timestamp: customSignOptions?.timestamp || undefined,
179
455
  requirements: requirements || undefined,
180
- additionalArguments: customSignOptions.additionalArguments || [],
456
+ additionalArguments: customSignOptions?.additionalArguments || undefined,
181
457
  };
182
458
  };
183
459
  }
184
- static getCertificateTypes(isMas, isDevelopment) {
185
- if (isDevelopment) {
186
- return isMas ? ["Mac Developer", "Apple Development"] : ["Mac Developer", "Developer ID Application"];
460
+ /**
461
+ * The effective signing type: an explicit `sign.type` wins, otherwise derived from the build flavor
462
+ * (`mas-dev` → `development`, otherwise `distribution`).
463
+ */
464
+ static resolveSigningType(targetPlatform, configType) {
465
+ return configType ?? (MacTargetHelper.isMasDevelopment(targetPlatform) ? "development" : "distribution");
466
+ }
467
+ static getCertificateTypes(targetPlatform, type) {
468
+ if (type === "development") {
469
+ return ["Mac Developer", "Apple Development"];
187
470
  }
188
- return isMas ? ["Apple Distribution", "3rd Party Mac Developer Application"] : ["Developer ID Application"];
471
+ return MacTargetHelper.isMasTarget(targetPlatform) ? ["Apple Distribution", "3rd Party Mac Developer Application"] : ["Developer ID Application"];
472
+ }
473
+ /**
474
+ * The MAS `.pkg` installer is only built for distribution signing — a development-signed build
475
+ * (`mas-dev`, or an explicit `sign.type: "development"` on a `mas` build) is installed directly.
476
+ */
477
+ static shouldCreateMasInstaller(targetPlatform, configType) {
478
+ return MacTargetHelper.isMasTarget(targetPlatform) && MacTargetHelper.resolveSigningType(targetPlatform, configType) !== "development";
189
479
  }
190
480
  static isMasTarget(targetName) {
191
481
  return targetName === "mas" || targetName === "mas-dev";
192
482
  }
483
+ static isMasDevelopment(targetName) {
484
+ return targetName === "mas-dev";
485
+ }
193
486
  static getPlatformTypeFromTarget(targetName) {
194
- if (targetName === "mas") {
195
- return "mas";
196
- }
197
- if (targetName === "mas-dev") {
487
+ // must check for mas-dev first
488
+ if (MacTargetHelper.isMasDevelopment(targetName)) {
198
489
  return "mas-dev";
199
490
  }
491
+ if (MacTargetHelper.isMasTarget(targetName)) {
492
+ return "mas";
493
+ }
200
494
  return "mac";
201
495
  }
202
496
  /**
203
497
  * Returns true when hardened runtime will be active for signing.
204
498
  * For non-MAS builds it defaults to on; for MAS it defaults to off.
205
499
  */
206
- static isHardenedRuntimeEnabledForSigning(isMas, config) {
207
- return isMas ? config.hardenedRuntime === true : config.hardenedRuntime !== false;
500
+ static isHardenedRuntimeEnabledForSigning(targetPlatform, hardenedRuntime) {
501
+ return MacTargetHelper.isMasTarget(targetPlatform) ? hardenedRuntime === true : hardenedRuntime !== false;
208
502
  }
209
503
  static assertSafePathForCommandUsage(pathValue, description) {
210
504
  if (/[\0\r\n"'`$;&|<>]/.test(pathValue)) {
@@ -212,7 +506,6 @@ export class MacTargetHelper {
212
506
  }
213
507
  }
214
508
  static getNotarizeOptions(appPath) {
215
- const tool = "notarytool";
216
509
  const teamId = process.env.APPLE_TEAM_ID;
217
510
  const appleId = process.env.APPLE_ID;
218
511
  const appleIdPassword = process.env.APPLE_APP_SPECIFIC_PASSWORD;
@@ -226,7 +519,7 @@ export class MacTargetHelper {
226
519
  if (!teamId) {
227
520
  throw new InvalidConfigurationError(`APPLE_TEAM_ID env var needs to be set`);
228
521
  }
229
- return { tool, appPath, appleId, appleIdPassword, teamId };
522
+ return { appPath, appleId, appleIdPassword, teamId };
230
523
  }
231
524
  const appleApiKey = process.env.APPLE_API_KEY;
232
525
  const appleApiKeyId = process.env.APPLE_API_KEY_ID;
@@ -235,7 +528,7 @@ export class MacTargetHelper {
235
528
  if (!appleApiKey || !appleApiKeyId || !appleApiIssuer) {
236
529
  throw new InvalidConfigurationError(`Env vars APPLE_API_KEY, APPLE_API_KEY_ID and APPLE_API_ISSUER need to be set`);
237
530
  }
238
- return { tool, appPath, appleApiKey, appleApiKeyId, appleApiIssuer };
531
+ return { appPath, appleApiKey, appleApiKeyId, appleApiIssuer };
239
532
  }
240
533
  const keychain = process.env.APPLE_KEYCHAIN;
241
534
  const keychainProfile = process.env.APPLE_KEYCHAIN_PROFILE;
@@ -244,7 +537,7 @@ export class MacTargetHelper {
244
537
  if (keychain) {
245
538
  args = { ...args, keychain };
246
539
  }
247
- return { tool, appPath, ...args };
540
+ return { appPath, ...args };
248
541
  }
249
542
  return undefined;
250
543
  }
@@ -259,9 +552,110 @@ export class MacTargetHelper {
259
552
  log.warn({ reason: "`notarize` options were unable to be generated" }, "skipped macOS notarization");
260
553
  return;
261
554
  }
262
- const { notarize } = await dynamicImport("@electron/notarize");
263
555
  await notarize(options);
264
556
  log.info(null, "notarization successful");
265
557
  }
266
558
  }
559
+ /** Big-endian fat/universal magic — the same bytes open a Java class file, so `nfat_arch` has to disambiguate. */
560
+ const FAT_MAGIC = 0xcafebabe;
561
+ /** libmagic's heuristic: a fat header has fewer than 30 slices, whereas a Java class file's `major_version` (in the same bytes) is at least 45. */
562
+ const FAT_MAX_ARCH_COUNT = 30;
563
+ /** Thin magics as read big-endian: the file is big-endian when the bytes spell the magic out, little-endian when they are byte-swapped. */
564
+ const THIN_MAGIC_BE = new Set([0xfeedface, 0xfeedfacf]);
565
+ const THIN_MAGIC_LE = new Set([0xcefaedfe, 0xcffaedfe]);
566
+ /** `mach_header.filetype` follows `magic`, `cputype` and `cpusubtype` in both the 32- and 64-bit header. */
567
+ const MACH_HEADER_FILETYPE_OFFSET = 12;
568
+ const MACH_HEADER_MIN_LENGTH = 16;
569
+ /** The first `fat_arch` (`cputype`, `cpusubtype`, `offset`, `size`, `align` — five big-endian uint32s) follows the 8-byte fat header. */
570
+ const FAT_ARCH_OFFSET = 8;
571
+ const FAT_ARCH_LENGTH = 20;
572
+ const FAT_ARCH_SLICE_OFFSET_FIELD = FAT_ARCH_OFFSET + 8;
573
+ const HEAD_READ_LENGTH = 4096;
574
+ /** The `mach_header.filetype` values the foreign-signature scan tells apart (see `<mach-o/loader.h>`). */
575
+ export const MachOFileType = {
576
+ /** Executable — spawned as its own process, never loaded into another one. */
577
+ MH_EXECUTE: 2,
578
+ /** Dynamically bound shared library (`.dylib`). */
579
+ MH_DYLIB: 6,
580
+ /** Dynamically bound bundle (`.node` native addons, plug-ins). */
581
+ MH_BUNDLE: 8,
582
+ };
583
+ /**
584
+ * The `filetype` field of a Mach-O header, or `null` when the file is not Mach-O, too short, or unreadable. Endianness
585
+ * follows the magic. A fat/universal binary reports the filetype of its first slice (all slices share one filetype);
586
+ * the fat magic `0xcafebabe` is shared with Java class files, so `nfat_arch` must also be a plausible slice count.
587
+ *
588
+ * @internal Exported for tests only.
589
+ */
590
+ export async function readMachOFileType(file) {
591
+ let handle = null;
592
+ try {
593
+ handle = await open(file, "r");
594
+ const head = Buffer.alloc(HEAD_READ_LENGTH);
595
+ const { bytesRead } = await handle.read(head, 0, HEAD_READ_LENGTH, 0);
596
+ if (bytesRead < 4) {
597
+ return null;
598
+ }
599
+ if (head.readUInt32BE(0) !== FAT_MAGIC) {
600
+ return readThinMachOFileType(head.subarray(0, bytesRead));
601
+ }
602
+ if (bytesRead < FAT_ARCH_OFFSET + FAT_ARCH_LENGTH) {
603
+ return null;
604
+ }
605
+ const archCount = head.readUInt32BE(4);
606
+ if (archCount === 0 || archCount >= FAT_MAX_ARCH_COUNT) {
607
+ return null;
608
+ }
609
+ const sliceOffset = head.readUInt32BE(FAT_ARCH_SLICE_OFFSET_FIELD);
610
+ const sliceHeader = Buffer.alloc(MACH_HEADER_MIN_LENGTH);
611
+ const slice = await handle.read(sliceHeader, 0, MACH_HEADER_MIN_LENGTH, sliceOffset);
612
+ return readThinMachOFileType(sliceHeader.subarray(0, slice.bytesRead));
613
+ }
614
+ catch {
615
+ return null;
616
+ }
617
+ finally {
618
+ await handle?.close();
619
+ }
620
+ }
621
+ function readThinMachOFileType(header) {
622
+ if (header.length < MACH_HEADER_MIN_LENGTH) {
623
+ return null;
624
+ }
625
+ const magic = header.readUInt32BE(0);
626
+ if (THIN_MAGIC_BE.has(magic)) {
627
+ return header.readUInt32BE(MACH_HEADER_FILETYPE_OFFSET);
628
+ }
629
+ if (THIN_MAGIC_LE.has(magic)) {
630
+ return header.readUInt32LE(MACH_HEADER_FILETYPE_OFFSET);
631
+ }
632
+ return null;
633
+ }
634
+ /**
635
+ * Whether a Mach-O filetype is loaded into a process — a dylib or a bundle — and is therefore subject to library
636
+ * validation. Executables are spawned, not loaded, so they are not.
637
+ *
638
+ * @internal Exported for tests only.
639
+ */
640
+ export function isLoadableMachOFileType(type) {
641
+ return type === MachOFileType.MH_DYLIB || type === MachOFileType.MH_BUNDLE;
642
+ }
643
+ /**
644
+ * Whether the file starts with a Mach-O header (thin or fat), regardless of filetype.
645
+ *
646
+ * @internal Exported for tests only.
647
+ */
648
+ export async function isMachOFile(file) {
649
+ return (await readMachOFileType(file)) != null;
650
+ }
651
+ /**
652
+ * Extracts the `TeamIdentifier` from `codesign -d --verbose=4` output, or `null` when the field is absent or the
653
+ * literal `not set` that ad-hoc and self-signed signatures report.
654
+ *
655
+ * @internal Exported for tests only.
656
+ */
657
+ export function parseSigningTeamId(codesignOutput) {
658
+ const teamId = /^TeamIdentifier=(.+)$/m.exec(codesignOutput)?.[1].trim();
659
+ return teamId == null || teamId === "not set" ? null : teamId;
660
+ }
267
661
  //# sourceMappingURL=MacTargetHelper.js.map