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

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 (489) 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/asarAlign.d.ts +35 -0
  10. package/dist/asar/asarAlign.d.ts.map +1 -0
  11. package/dist/asar/asarAlign.js +149 -0
  12. package/dist/asar/asarAlign.js.map +1 -0
  13. package/dist/asar/asarFileChecker.d.ts +4 -2
  14. package/dist/asar/asarFileChecker.d.ts.map +1 -1
  15. package/dist/asar/asarFileChecker.js +2 -3
  16. package/dist/asar/asarFileChecker.js.map +1 -1
  17. package/dist/asar/asarUtil.d.ts +15 -1
  18. package/dist/asar/asarUtil.d.ts.map +1 -1
  19. package/dist/asar/asarUtil.js +132 -72
  20. package/dist/asar/asarUtil.js.map +1 -1
  21. package/dist/codeSign/certInfo.d.ts +14 -0
  22. package/dist/codeSign/certInfo.d.ts.map +1 -1
  23. package/dist/codeSign/certInfo.js +49 -0
  24. package/dist/codeSign/certInfo.js.map +1 -1
  25. package/dist/codeSign/mac/macCodeSign.d.ts +3 -3
  26. package/dist/codeSign/mac/macCodeSign.d.ts.map +1 -1
  27. package/dist/codeSign/mac/macCodeSign.js +50 -25
  28. package/dist/codeSign/mac/macCodeSign.js.map +1 -1
  29. package/dist/codeSign/signResult.d.ts +26 -0
  30. package/dist/codeSign/signResult.d.ts.map +1 -0
  31. package/dist/codeSign/signResult.js +12 -0
  32. package/dist/codeSign/signResult.js.map +1 -0
  33. package/dist/codeSign/win/hsmSignManager.d.ts +10 -0
  34. package/dist/codeSign/win/hsmSignManager.d.ts.map +1 -0
  35. package/dist/codeSign/win/hsmSignManager.js +50 -0
  36. package/dist/codeSign/win/hsmSignManager.js.map +1 -0
  37. package/dist/codeSign/win/pkcs11SignManager.d.ts +14 -0
  38. package/dist/codeSign/win/pkcs11SignManager.d.ts.map +1 -0
  39. package/dist/codeSign/win/pkcs11SignManager.js +82 -0
  40. package/dist/codeSign/win/pkcs11SignManager.js.map +1 -0
  41. package/dist/codeSign/win/signManager.d.ts +17 -0
  42. package/dist/codeSign/win/signManager.d.ts.map +1 -0
  43. package/dist/codeSign/win/signManager.js +19 -0
  44. package/dist/codeSign/win/signManager.js.map +1 -0
  45. package/dist/codeSign/win/signtoolBaseSignManager.d.ts +95 -0
  46. package/dist/codeSign/win/signtoolBaseSignManager.d.ts.map +1 -0
  47. package/dist/codeSign/win/signtoolBaseSignManager.js +507 -0
  48. package/dist/codeSign/win/signtoolBaseSignManager.js.map +1 -0
  49. package/dist/codeSign/win/windowsCodeSign.d.ts +2 -1
  50. package/dist/codeSign/win/windowsCodeSign.d.ts.map +1 -1
  51. package/dist/codeSign/win/windowsCodeSign.js +22 -8
  52. package/dist/codeSign/win/windowsCodeSign.js.map +1 -1
  53. package/dist/codeSign/win/windowsSignAzureManager.d.ts +11 -4
  54. package/dist/codeSign/win/windowsSignAzureManager.d.ts.map +1 -1
  55. package/dist/codeSign/win/windowsSignAzureManager.js +142 -37
  56. package/dist/codeSign/win/windowsSignAzureManager.js.map +1 -1
  57. package/dist/codeSign/win/windowsSignToolManager.d.ts +1 -58
  58. package/dist/codeSign/win/windowsSignToolManager.d.ts.map +1 -1
  59. package/dist/codeSign/win/windowsSignToolManager.js +3 -363
  60. package/dist/codeSign/win/windowsSignToolManager.js.map +1 -1
  61. package/dist/configuration.d.ts +233 -166
  62. package/dist/configuration.d.ts.map +1 -1
  63. package/dist/configuration.js +11 -1
  64. package/dist/configuration.js.map +1 -1
  65. package/dist/core.d.ts +14 -0
  66. package/dist/core.d.ts.map +1 -1
  67. package/dist/core.js +11 -0
  68. package/dist/core.js.map +1 -1
  69. package/dist/electron/ElectronFramework.d.ts +3 -3
  70. package/dist/electron/ElectronFramework.d.ts.map +1 -1
  71. package/dist/electron/ElectronFramework.js +60 -61
  72. package/dist/electron/ElectronFramework.js.map +1 -1
  73. package/dist/electron/electronArchSupport.d.ts +12 -0
  74. package/dist/electron/electronArchSupport.d.ts.map +1 -0
  75. package/dist/electron/electronArchSupport.js +58 -0
  76. package/dist/electron/electronArchSupport.js.map +1 -0
  77. package/dist/electron/electronVersion.d.ts.map +1 -1
  78. package/dist/electron/electronVersion.js +1 -11
  79. package/dist/electron/electronVersion.js.map +1 -1
  80. package/dist/electron/injectFFMPEG.js +2 -2
  81. package/dist/electron/injectFFMPEG.js.map +1 -1
  82. package/dist/electron/mac/electronMac.js +24 -35
  83. package/dist/electron/mac/electronMac.js.map +1 -1
  84. package/dist/electron/mac/electronMacUtils.d.ts +24 -0
  85. package/dist/electron/mac/electronMacUtils.d.ts.map +1 -0
  86. package/dist/electron/mac/electronMacUtils.js +42 -0
  87. package/dist/electron/mac/electronMacUtils.js.map +1 -0
  88. package/dist/electron/win/electronWin.js +2 -2
  89. package/dist/electron/win/electronWin.js.map +1 -1
  90. package/dist/fileMatcher.d.ts +55 -3
  91. package/dist/fileMatcher.d.ts.map +1 -1
  92. package/dist/fileMatcher.js +274 -28
  93. package/dist/fileMatcher.js.map +1 -1
  94. package/dist/index.d.ts +13 -7
  95. package/dist/index.d.ts.map +1 -1
  96. package/dist/index.js +17 -1
  97. package/dist/index.js.map +1 -1
  98. package/dist/indexInternal.d.ts +20 -8
  99. package/dist/indexInternal.d.ts.map +1 -1
  100. package/dist/indexInternal.js +19 -7
  101. package/dist/indexInternal.js.map +1 -1
  102. package/dist/linuxPackager.d.ts.map +1 -1
  103. package/dist/linuxPackager.js +19 -1
  104. package/dist/linuxPackager.js.map +1 -1
  105. package/dist/macPackager.d.ts +31 -14
  106. package/dist/macPackager.d.ts.map +1 -1
  107. package/dist/macPackager.js +236 -147
  108. package/dist/macPackager.js.map +1 -1
  109. package/dist/node-module-collector/index.d.ts.map +1 -1
  110. package/dist/node-module-collector/index.js +47 -16
  111. package/dist/node-module-collector/index.js.map +1 -1
  112. package/dist/node-module-collector/moduleManager.d.ts +11 -2
  113. package/dist/node-module-collector/moduleManager.d.ts.map +1 -1
  114. package/dist/node-module-collector/moduleManager.js +34 -14
  115. package/dist/node-module-collector/moduleManager.js.map +1 -1
  116. package/dist/node-module-collector/nodeModulesCollector.d.ts +47 -26
  117. package/dist/node-module-collector/nodeModulesCollector.d.ts.map +1 -1
  118. package/dist/node-module-collector/nodeModulesCollector.js +157 -142
  119. package/dist/node-module-collector/nodeModulesCollector.js.map +1 -1
  120. package/dist/node-module-collector/packageManager.js +1 -1
  121. package/dist/node-module-collector/packageManager.js.map +1 -1
  122. package/dist/node-module-collector/pnpmNodeModulesCollector.d.ts +90 -1
  123. package/dist/node-module-collector/pnpmNodeModulesCollector.d.ts.map +1 -1
  124. package/dist/node-module-collector/pnpmNodeModulesCollector.js +325 -25
  125. package/dist/node-module-collector/pnpmNodeModulesCollector.js.map +1 -1
  126. package/dist/node-module-collector/types.d.ts +4 -0
  127. package/dist/node-module-collector/types.d.ts.map +1 -1
  128. package/dist/node-module-collector/types.js.map +1 -1
  129. package/dist/options/FuseOptionsV1.d.ts +137 -0
  130. package/dist/options/FuseOptionsV1.d.ts.map +1 -0
  131. package/dist/options/FuseOptionsV1.js +2 -0
  132. package/dist/options/FuseOptionsV1.js.map +1 -0
  133. package/dist/options/MsixOptions.d.ts +126 -0
  134. package/dist/options/MsixOptions.d.ts.map +1 -0
  135. package/dist/options/MsixOptions.js +2 -0
  136. package/dist/options/MsixOptions.js.map +1 -0
  137. package/dist/options/PlatformSpecificBuildOptions.d.ts +147 -12
  138. package/dist/options/PlatformSpecificBuildOptions.d.ts.map +1 -1
  139. package/dist/options/PlatformSpecificBuildOptions.js.map +1 -1
  140. package/dist/options/SnapOptions.d.ts +59 -32
  141. package/dist/options/SnapOptions.d.ts.map +1 -1
  142. package/dist/options/SnapOptions.js.map +1 -1
  143. package/dist/options/SquirrelWindowsOptions.d.ts +0 -5
  144. package/dist/options/SquirrelWindowsOptions.d.ts.map +1 -1
  145. package/dist/options/SquirrelWindowsOptions.js.map +1 -1
  146. package/dist/options/linuxOptions.d.ts +61 -30
  147. package/dist/options/linuxOptions.d.ts.map +1 -1
  148. package/dist/options/linuxOptions.js.map +1 -1
  149. package/dist/options/macOptions.d.ts +113 -131
  150. package/dist/options/macOptions.d.ts.map +1 -1
  151. package/dist/options/macOptions.js.map +1 -1
  152. package/dist/options/pkgOptions.d.ts +1 -1
  153. package/dist/options/pkgOptions.js.map +1 -1
  154. package/dist/options/winOptions.d.ts +282 -70
  155. package/dist/options/winOptions.d.ts.map +1 -1
  156. package/dist/options/winOptions.js +12 -1
  157. package/dist/options/winOptions.js.map +1 -1
  158. package/dist/packager.d.ts +6 -1
  159. package/dist/packager.d.ts.map +1 -1
  160. package/dist/packager.js +123 -40
  161. package/dist/packager.js.map +1 -1
  162. package/dist/packagerApi.d.ts +10 -1
  163. package/dist/packagerApi.d.ts.map +1 -1
  164. package/dist/packagerApi.js.map +1 -1
  165. package/dist/platformPackager.d.ts +55 -4
  166. package/dist/platformPackager.d.ts.map +1 -1
  167. package/dist/platformPackager.js +160 -22
  168. package/dist/platformPackager.js.map +1 -1
  169. package/dist/presets/rectCra.js +3 -1
  170. package/dist/presets/rectCra.js.map +1 -1
  171. package/dist/publish/PublishManager.d.ts +40 -2
  172. package/dist/publish/PublishManager.d.ts.map +1 -1
  173. package/dist/publish/PublishManager.js +365 -23
  174. package/dist/publish/PublishManager.js.map +1 -1
  175. package/dist/publish/updateInfoBuilder.d.ts +1 -1
  176. package/dist/publish/updateInfoBuilder.d.ts.map +1 -1
  177. package/dist/publish/updateInfoBuilder.js +108 -32
  178. package/dist/publish/updateInfoBuilder.js.map +1 -1
  179. package/dist/targets/ArchiveTarget.d.ts +1 -0
  180. package/dist/targets/ArchiveTarget.d.ts.map +1 -1
  181. package/dist/targets/ArchiveTarget.js +13 -4
  182. package/dist/targets/ArchiveTarget.js.map +1 -1
  183. package/dist/targets/archive.d.ts +39 -2
  184. package/dist/targets/archive.d.ts.map +1 -1
  185. package/dist/targets/archive.js +114 -30
  186. package/dist/targets/archive.js.map +1 -1
  187. package/dist/targets/blockmap/blockmap.d.ts +44 -3
  188. package/dist/targets/blockmap/blockmap.d.ts.map +1 -1
  189. package/dist/targets/blockmap/blockmap.js +142 -15
  190. package/dist/targets/blockmap/blockmap.js.map +1 -1
  191. package/dist/targets/blockmap/verbatimRange.d.ts +44 -0
  192. package/dist/targets/blockmap/verbatimRange.d.ts.map +1 -0
  193. package/dist/targets/blockmap/verbatimRange.js +117 -0
  194. package/dist/targets/blockmap/verbatimRange.js.map +1 -0
  195. package/dist/targets/differentialUpdateInfoBuilder.d.ts +28 -2
  196. package/dist/targets/differentialUpdateInfoBuilder.d.ts.map +1 -1
  197. package/dist/targets/differentialUpdateInfoBuilder.js +75 -6
  198. package/dist/targets/differentialUpdateInfoBuilder.js.map +1 -1
  199. package/dist/targets/linux/FlatpakTarget.d.ts +17 -0
  200. package/dist/targets/linux/FlatpakTarget.d.ts.map +1 -1
  201. package/dist/targets/linux/FlatpakTarget.js +245 -45
  202. package/dist/targets/linux/FlatpakTarget.js.map +1 -1
  203. package/dist/targets/linux/FpmTarget.d.ts +14 -0
  204. package/dist/targets/linux/FpmTarget.d.ts.map +1 -1
  205. package/dist/targets/linux/FpmTarget.js +92 -12
  206. package/dist/targets/linux/FpmTarget.js.map +1 -1
  207. package/dist/targets/linux/LinuxTargetHelper.d.ts +13 -0
  208. package/dist/targets/linux/LinuxTargetHelper.d.ts.map +1 -1
  209. package/dist/targets/linux/LinuxTargetHelper.js +81 -61
  210. package/dist/targets/linux/LinuxTargetHelper.js.map +1 -1
  211. package/dist/targets/linux/appimage/AppImageTarget.d.ts +2 -0
  212. package/dist/targets/linux/appimage/AppImageTarget.d.ts.map +1 -1
  213. package/dist/targets/linux/appimage/AppImageTarget.js +20 -15
  214. package/dist/targets/linux/appimage/AppImageTarget.js.map +1 -1
  215. package/dist/targets/linux/appimage/appImageUtil.d.ts +8 -2
  216. package/dist/targets/linux/appimage/appImageUtil.d.ts.map +1 -1
  217. package/dist/targets/linux/appimage/appImageUtil.js +16 -9
  218. package/dist/targets/linux/appimage/appImageUtil.js.map +1 -1
  219. package/dist/targets/linux/appimage/appLauncher.d.ts +6 -0
  220. package/dist/targets/linux/appimage/appLauncher.d.ts.map +1 -1
  221. package/dist/targets/linux/appimage/appLauncher.js +18 -20
  222. package/dist/targets/linux/appimage/appLauncher.js.map +1 -1
  223. package/dist/targets/linux/flatpakBundle.d.ts +43 -0
  224. package/dist/targets/linux/flatpakBundle.d.ts.map +1 -0
  225. package/dist/targets/linux/flatpakBundle.js +210 -0
  226. package/dist/targets/linux/flatpakBundle.js.map +1 -0
  227. package/dist/targets/linux/launcherScript.d.ts +32 -0
  228. package/dist/targets/linux/launcherScript.d.ts.map +1 -0
  229. package/dist/targets/linux/launcherScript.js +24 -0
  230. package/dist/targets/linux/launcherScript.js.map +1 -0
  231. package/dist/targets/linux/snap/SnapTarget.d.ts +1 -1
  232. package/dist/targets/linux/snap/SnapTarget.d.ts.map +1 -1
  233. package/dist/targets/linux/snap/SnapTarget.js +23 -1
  234. package/dist/targets/linux/snap/SnapTarget.js.map +1 -1
  235. package/dist/targets/linux/snap/core24.d.ts +13 -2
  236. package/dist/targets/linux/snap/core24.d.ts.map +1 -1
  237. package/dist/targets/linux/snap/core24.js +107 -95
  238. package/dist/targets/linux/snap/core24.js.map +1 -1
  239. package/dist/targets/linux/snap/coreCustom.d.ts +1 -1
  240. package/dist/targets/linux/snap/coreCustom.d.ts.map +1 -1
  241. package/dist/targets/linux/snap/coreCustom.js +2 -2
  242. package/dist/targets/linux/snap/coreCustom.js.map +1 -1
  243. package/dist/targets/linux/snap/coreLegacy.d.ts +10 -3
  244. package/dist/targets/linux/snap/coreLegacy.d.ts.map +1 -1
  245. package/dist/targets/linux/snap/coreLegacy.js +37 -18
  246. package/dist/targets/linux/snap/coreLegacy.js.map +1 -1
  247. package/dist/targets/linux/snap/snapCommand.d.ts +13 -0
  248. package/dist/targets/linux/snap/snapCommand.d.ts.map +1 -0
  249. package/dist/targets/linux/snap/snapCommand.js +21 -0
  250. package/dist/targets/linux/snap/snapCommand.js.map +1 -0
  251. package/dist/targets/linux/snap/snapPlugs.d.ts +76 -0
  252. package/dist/targets/linux/snap/snapPlugs.d.ts.map +1 -0
  253. package/dist/targets/linux/snap/snapPlugs.js +242 -0
  254. package/dist/targets/linux/snap/snapPlugs.js.map +1 -0
  255. package/dist/targets/linux/snap/snapcraft.d.ts +190 -0
  256. package/dist/targets/linux/snap/snapcraft.d.ts.map +1 -0
  257. package/dist/targets/linux/snap/snapcraft.js +11 -0
  258. package/dist/targets/linux/snap/snapcraft.js.map +1 -0
  259. package/dist/targets/linux/snap/snapcraftBuilder.d.ts +7 -1
  260. package/dist/targets/linux/snap/snapcraftBuilder.d.ts.map +1 -1
  261. package/dist/targets/linux/snap/snapcraftBuilder.js +57 -20
  262. package/dist/targets/linux/snap/snapcraftBuilder.js.map +1 -1
  263. package/dist/targets/mac/MacTargetHelper.d.ts +146 -14
  264. package/dist/targets/mac/MacTargetHelper.d.ts.map +1 -1
  265. package/dist/targets/mac/MacTargetHelper.js +485 -91
  266. package/dist/targets/mac/MacTargetHelper.js.map +1 -1
  267. package/dist/targets/mac/pkg.d.ts +16 -0
  268. package/dist/targets/mac/pkg.d.ts.map +1 -1
  269. package/dist/targets/mac/pkg.js +31 -5
  270. package/dist/targets/mac/pkg.js.map +1 -1
  271. package/dist/targets/targetFactory.d.ts +7 -0
  272. package/dist/targets/targetFactory.d.ts.map +1 -1
  273. package/dist/targets/targetFactory.js +28 -0
  274. package/dist/targets/targetFactory.js.map +1 -1
  275. package/dist/targets/win/AppxTarget.d.ts +1 -2
  276. package/dist/targets/win/AppxTarget.d.ts.map +1 -1
  277. package/dist/targets/win/AppxTarget.js +37 -314
  278. package/dist/targets/win/AppxTarget.js.map +1 -1
  279. package/dist/targets/win/MsiTarget.d.ts.map +1 -1
  280. package/dist/targets/win/MsiTarget.js +13 -13
  281. package/dist/targets/win/MsiTarget.js.map +1 -1
  282. package/dist/targets/win/MsixTarget.d.ts +22 -0
  283. package/dist/targets/win/MsixTarget.d.ts.map +1 -0
  284. package/dist/targets/win/MsixTarget.js +214 -0
  285. package/dist/targets/win/MsixTarget.js.map +1 -0
  286. package/dist/targets/win/nsis/Defines.d.ts +4 -0
  287. package/dist/targets/win/nsis/Defines.d.ts.map +1 -1
  288. package/dist/targets/win/nsis/Defines.js.map +1 -1
  289. package/dist/targets/win/nsis/NsisTarget.d.ts +64 -3
  290. package/dist/targets/win/nsis/NsisTarget.d.ts.map +1 -1
  291. package/dist/targets/win/nsis/NsisTarget.js +277 -113
  292. package/dist/targets/win/nsis/NsisTarget.js.map +1 -1
  293. package/dist/targets/win/nsis/WebInstallerTarget.d.ts.map +1 -1
  294. package/dist/targets/win/nsis/WebInstallerTarget.js +23 -12
  295. package/dist/targets/win/nsis/WebInstallerTarget.js.map +1 -1
  296. package/dist/targets/win/nsis/nsisOptions.d.ts +58 -48
  297. package/dist/targets/win/nsis/nsisOptions.d.ts.map +1 -1
  298. package/dist/targets/win/nsis/nsisOptions.js.map +1 -1
  299. package/dist/targets/win/nsis/nsisScriptGenerator.d.ts.map +1 -1
  300. package/dist/targets/win/nsis/nsisScriptGenerator.js +4 -3
  301. package/dist/targets/win/nsis/nsisScriptGenerator.js.map +1 -1
  302. package/dist/targets/win/nsis/nsisUtil.d.ts +17 -2
  303. package/dist/targets/win/nsis/nsisUtil.d.ts.map +1 -1
  304. package/dist/targets/win/nsis/nsisUtil.js +148 -41
  305. package/dist/targets/win/nsis/nsisUtil.js.map +1 -1
  306. package/dist/targets/win/nsis/progId.d.ts +21 -0
  307. package/dist/targets/win/nsis/progId.d.ts.map +1 -0
  308. package/dist/targets/win/nsis/progId.js +60 -0
  309. package/dist/targets/win/nsis/progId.js.map +1 -0
  310. package/dist/targets/win/winAppUtil.d.ts +115 -0
  311. package/dist/targets/win/winAppUtil.d.ts.map +1 -0
  312. package/dist/targets/win/winAppUtil.js +409 -0
  313. package/dist/targets/win/winAppUtil.js.map +1 -0
  314. package/dist/toolsets/7zip.d.ts +32 -0
  315. package/dist/toolsets/7zip.d.ts.map +1 -1
  316. package/dist/toolsets/7zip.js +39 -11
  317. package/dist/toolsets/7zip.js.map +1 -1
  318. package/dist/toolsets/appimage.d.ts +3 -3
  319. package/dist/toolsets/appimage.d.ts.map +1 -1
  320. package/dist/toolsets/appimage.js +24 -21
  321. package/dist/toolsets/appimage.js.map +1 -1
  322. package/dist/toolsets/custom.d.ts +2 -3
  323. package/dist/toolsets/custom.d.ts.map +1 -1
  324. package/dist/toolsets/custom.js +67 -149
  325. package/dist/toolsets/custom.js.map +1 -1
  326. package/dist/toolsets/fpm.d.ts.map +1 -1
  327. package/dist/toolsets/fpm.js +11 -5
  328. package/dist/toolsets/fpm.js.map +1 -1
  329. package/dist/toolsets/icons.d.ts.map +1 -1
  330. package/dist/toolsets/icons.js +17 -3
  331. package/dist/toolsets/icons.js.map +1 -1
  332. package/dist/toolsets/linuxToolsMac.d.ts.map +1 -1
  333. package/dist/toolsets/linuxToolsMac.js +17 -4
  334. package/dist/toolsets/linuxToolsMac.js.map +1 -1
  335. package/dist/toolsets/nsis.d.ts +5 -0
  336. package/dist/toolsets/nsis.d.ts.map +1 -1
  337. package/dist/toolsets/nsis.js +20 -4
  338. package/dist/toolsets/nsis.js.map +1 -1
  339. package/dist/toolsets/version.d.ts +12 -0
  340. package/dist/toolsets/version.d.ts.map +1 -0
  341. package/dist/toolsets/version.js +13 -0
  342. package/dist/toolsets/version.js.map +1 -0
  343. package/dist/toolsets/winCodeSign.d.ts +56 -3
  344. package/dist/toolsets/winCodeSign.d.ts.map +1 -1
  345. package/dist/toolsets/winCodeSign.js +125 -42
  346. package/dist/toolsets/winCodeSign.js.map +1 -1
  347. package/dist/toolsets/wine.d.ts +2 -1
  348. package/dist/toolsets/wine.d.ts.map +1 -1
  349. package/dist/toolsets/wine.js +31 -15
  350. package/dist/toolsets/wine.js.map +1 -1
  351. package/dist/util/AppFileWalker.js +9 -1
  352. package/dist/util/AppFileWalker.js.map +1 -1
  353. package/dist/util/NodeModuleCopyHelper.js +14 -6
  354. package/dist/util/NodeModuleCopyHelper.js.map +1 -1
  355. package/dist/util/appFileCopier.d.ts +67 -2
  356. package/dist/util/appFileCopier.d.ts.map +1 -1
  357. package/dist/util/appFileCopier.js +244 -32
  358. package/dist/util/appFileCopier.js.map +1 -1
  359. package/dist/util/archCompatibility.d.ts +42 -0
  360. package/dist/util/archCompatibility.d.ts.map +1 -0
  361. package/dist/util/archCompatibility.js +202 -0
  362. package/dist/util/archCompatibility.js.map +1 -0
  363. package/dist/util/checksum.d.ts +36 -0
  364. package/dist/util/checksum.d.ts.map +1 -0
  365. package/dist/util/checksum.js +48 -0
  366. package/dist/util/checksum.js.map +1 -0
  367. package/dist/util/config/config.d.ts +2 -1
  368. package/dist/util/config/config.d.ts.map +1 -1
  369. package/dist/util/config/config.js +42 -20
  370. package/dist/util/config/config.js.map +1 -1
  371. package/dist/util/config/fileOptions.d.ts +30 -0
  372. package/dist/util/config/fileOptions.d.ts.map +1 -0
  373. package/dist/util/config/fileOptions.js +120 -0
  374. package/dist/util/config/fileOptions.js.map +1 -0
  375. package/dist/util/config/legacyConfigGuard.d.ts +7 -0
  376. package/dist/util/config/legacyConfigGuard.d.ts.map +1 -0
  377. package/dist/util/config/legacyConfigGuard.js +214 -0
  378. package/dist/util/config/legacyConfigGuard.js.map +1 -0
  379. package/dist/util/config/legacyOptions.d.ts +86 -0
  380. package/dist/util/config/legacyOptions.d.ts.map +1 -0
  381. package/dist/util/config/legacyOptions.js +413 -0
  382. package/dist/util/config/legacyOptions.js.map +1 -0
  383. package/dist/util/config/load.d.ts +2 -2
  384. package/dist/util/config/load.d.ts.map +1 -1
  385. package/dist/util/config/load.js +3 -12
  386. package/dist/util/config/load.js.map +1 -1
  387. package/dist/util/config/schemaValidator.d.ts.map +1 -1
  388. package/dist/util/config/schemaValidator.js +26 -3
  389. package/dist/util/config/schemaValidator.js.map +1 -1
  390. package/dist/util/electronGet.d.ts +43 -32
  391. package/dist/util/electronGet.d.ts.map +1 -1
  392. package/dist/util/electronGet.js +390 -137
  393. package/dist/util/electronGet.js.map +1 -1
  394. package/dist/util/flags.d.ts +5 -5
  395. package/dist/util/flags.d.ts.map +1 -1
  396. package/dist/util/flags.js +124 -16
  397. package/dist/util/flags.js.map +1 -1
  398. package/dist/util/hash.d.ts +1 -1
  399. package/dist/util/hash.d.ts.map +1 -1
  400. package/dist/util/hash.js +1 -15
  401. package/dist/util/hash.js.map +1 -1
  402. package/dist/util/installOrRebuild.d.ts +44 -0
  403. package/dist/util/installOrRebuild.d.ts.map +1 -0
  404. package/dist/util/installOrRebuild.js +276 -0
  405. package/dist/util/installOrRebuild.js.map +1 -0
  406. package/dist/util/langs.d.ts.map +1 -1
  407. package/dist/util/langs.js +1 -0
  408. package/dist/util/langs.js.map +1 -1
  409. package/dist/util/license.d.ts.map +1 -1
  410. package/dist/util/license.js +4 -1
  411. package/dist/util/license.js.map +1 -1
  412. package/dist/util/mac/macosIconComposer.d.ts +2 -1
  413. package/dist/util/mac/macosIconComposer.d.ts.map +1 -1
  414. package/dist/util/mac/macosIconComposer.js +40 -58
  415. package/dist/util/mac/macosIconComposer.js.map +1 -1
  416. package/dist/util/mac/macosVersion.d.ts +0 -1
  417. package/dist/util/mac/macosVersion.d.ts.map +1 -1
  418. package/dist/util/mac/macosVersion.js +0 -3
  419. package/dist/util/mac/macosVersion.js.map +1 -1
  420. package/dist/util/mac/plist.d.ts +1 -1
  421. package/dist/util/mac/plist.d.ts.map +1 -1
  422. package/dist/util/mac/plist.js +5 -0
  423. package/dist/util/mac/plist.js.map +1 -1
  424. package/dist/util/nativeBinaryVerifier.d.ts +40 -0
  425. package/dist/util/nativeBinaryVerifier.d.ts.map +1 -0
  426. package/dist/util/nativeBinaryVerifier.js +381 -0
  427. package/dist/util/nativeBinaryVerifier.js.map +1 -0
  428. package/dist/util/packageMetadata.js +57 -31
  429. package/dist/util/packageMetadata.js.map +1 -1
  430. package/dist/util/removedEnvVars.d.ts +25 -0
  431. package/dist/util/removedEnvVars.d.ts.map +1 -0
  432. package/dist/util/removedEnvVars.js +54 -0
  433. package/dist/util/removedEnvVars.js.map +1 -0
  434. package/dist/util/repositoryInfo.js +6 -3
  435. package/dist/util/repositoryInfo.js.map +1 -1
  436. package/dist/util/resolve.js +1 -1
  437. package/dist/util/resolve.js.map +1 -1
  438. package/dist/util/streamSpawnToFile.d.ts +47 -0
  439. package/dist/util/streamSpawnToFile.d.ts.map +1 -0
  440. package/dist/util/streamSpawnToFile.js +110 -0
  441. package/dist/util/streamSpawnToFile.js.map +1 -0
  442. package/dist/util/toolsetLock.d.ts +2 -0
  443. package/dist/util/toolsetLock.d.ts.map +1 -1
  444. package/dist/util/toolsetLock.js +31 -5
  445. package/dist/util/toolsetLock.js.map +1 -1
  446. package/dist/util/trustedSourceRoots.d.ts +59 -0
  447. package/dist/util/trustedSourceRoots.d.ts.map +1 -0
  448. package/dist/util/trustedSourceRoots.js +127 -0
  449. package/dist/util/trustedSourceRoots.js.map +1 -0
  450. package/dist/version.d.ts +1 -1
  451. package/dist/version.d.ts.map +1 -1
  452. package/dist/version.js +1 -1
  453. package/dist/version.js.map +1 -1
  454. package/dist/vm/ParallelsVm.d.ts.map +1 -1
  455. package/dist/vm/ParallelsVm.js +29 -3
  456. package/dist/vm/ParallelsVm.js.map +1 -1
  457. package/dist/vm/vm.d.ts +2 -0
  458. package/dist/vm/vm.d.ts.map +1 -1
  459. package/dist/vm/vm.js +29 -6
  460. package/dist/vm/vm.js.map +1 -1
  461. package/dist/winPackager.d.ts +6 -5
  462. package/dist/winPackager.d.ts.map +1 -1
  463. package/dist/winPackager.js +45 -39
  464. package/dist/winPackager.js.map +1 -1
  465. package/package.json +20 -20
  466. package/scheme.json +2112 -1495
  467. package/templates/appx/appxmanifest.xml +2 -3
  468. package/templates/entitlements.mac.adhoc.plist +15 -0
  469. package/templates/entitlements.mac.plist +9 -6
  470. package/templates/msix/appxmanifest.xml +45 -0
  471. package/templates/nsis/assistedMessages.yml +17 -0
  472. package/templates/nsis/common.nsh +2 -2
  473. package/templates/nsis/include/allowOnlyOneInstallerInstance.nsh +96 -13
  474. package/templates/nsis/include/extractAppPackage.nsh +5 -2
  475. package/templates/nsis/include/installUtil.nsh +2 -2
  476. package/templates/nsis/include/installer.nsh +94 -53
  477. package/templates/nsis/include/webPackage.nsh +52 -27
  478. package/templates/nsis/installSection.nsh +29 -0
  479. package/templates/nsis/installer.nsi +1 -1
  480. package/templates/nsis/messages.yml +5 -0
  481. package/templates/nsis/multiUserUi.nsh +1 -1
  482. package/dist/codeSign/signManager.d.ts +0 -14
  483. package/dist/codeSign/signManager.d.ts.map +0 -1
  484. package/dist/codeSign/signManager.js +0 -2
  485. package/dist/codeSign/signManager.js.map +0 -1
  486. package/dist/util/yarn.d.ts +0 -23
  487. package/dist/util/yarn.d.ts.map +0 -1
  488. package/dist/util/yarn.js +0 -153
  489. package/dist/util/yarn.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"NodeModuleCopyHelper.js","sourceRoot":"","sources":["../../src/util/NodeModuleCopyHelper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAA;AACjC,OAAO,OAAO,MAAM,UAAU,CAAA;AAC9B,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAC5B,OAAO,SAAS,MAAM,iBAAiB,CAAA;AACvC,OAAO,EAAE,aAAa,EAAe,MAAM,mBAAmB,CAAA;AAE9D,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAEnD,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3B,CAAC;QACH,CAAC;QACD,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,EAAgB,EAAE,CAAC,EAAE,KAAK,SAAS,CAAC,CAAA;IAC9D,CAAC;CACF","sourcesContent":["import { FilterStats, MAX_FILE_REQUESTS } from \"builder-util\"\nimport { realpathSync } from \"fs\"\nimport fsExtra from \"fs-extra\"\nimport * as path from \"path\"\nimport asyncPool from \"tiny-async-pool\"\nimport { excludedNames, FileMatcher } from \"../fileMatcher.js\"\nimport { PlatformPackager } from \"../platformPackager.js\"\nimport { FileCopyHelper } from \"./AppFileWalker.js\"\nimport { NodeModuleInfo } from \"../node-module-collector/types.js\"\nimport { resolveFunction } from \"./resolve.js\"\n\nconst excludedFiles = new Set(\n [\n \".DS_Store\",\n \"node_modules\" /* already in the queue */,\n \"CHANGELOG.md\",\n \"ChangeLog\",\n \"changelog.md\",\n \"Changelog.md\",\n \"Changelog\",\n \"binding.gyp\",\n \".npmignore\",\n \"node_gyp_bins\",\n ].concat(excludedNames.split(\",\"))\n)\n\nconst topLevelExcludedFiles = new Set([\n \"karma.conf.js\",\n \".coveralls.yml\",\n \"README.md\",\n \"readme.markdown\",\n \"README\",\n \"readme.md\",\n \"Readme.md\",\n \"Readme\",\n \"readme\",\n \"test\",\n \"tests\",\n \"__tests__\",\n \"powered-test\",\n \"example\",\n \"examples\",\n \".bin\",\n])\n\n/** @internal */\nexport class NodeModuleCopyHelper extends FileCopyHelper {\n constructor(matcher: FileMatcher, packager: PlatformPackager<any>) {\n super(matcher, matcher.isEmpty() ? null : matcher.createFilter(), packager)\n }\n\n async collectNodeModules(moduleInfo: NodeModuleInfo, nodeModuleExcludedExts: Array<string>, destination: string): Promise<Array<string>> {\n const filter = this.filter\n const metadata = this.metadata\n\n const onNodeModuleFile = await resolveFunction(this.packager.appInfo.type, this.packager.config.onNodeModuleFile, \"onNodeModuleFile\", await this.packager.getWorkspaceRoot())\n\n const result: Array<string | undefined> = []\n const queue: Array<string> = []\n const emptyDirs: Set<string> = new Set()\n const symlinkFiles: Map<string, number> = new Map()\n const tmpPath = moduleInfo.dir\n const moduleName = moduleInfo.name\n queue.length = 1\n // The path should be corrected in Windows that when the moduleName is Scoped packages named.\n const depPath = path.normalize(tmpPath)\n queue[0] = depPath\n\n while (queue.length > 0) {\n const dirPath = queue.pop()!\n\n const childNames = await fsExtra.readdir(dirPath)\n childNames.sort()\n\n const isTopLevel = dirPath === depPath\n const dirs: Array<string> = []\n // our handler is async, but we should add sorted files, so, we add file to result not in the mapper, but after map\n const sortedFilePaths = await asyncPool(MAX_FILE_REQUESTS, childNames, async name => {\n const filePath = path.join(dirPath, name)\n\n const forceIncluded = onNodeModuleFile != null && !!onNodeModuleFile(filePath)\n\n if (excludedFiles.has(name) || name.startsWith(\"._\")) {\n return null\n }\n\n // check if filematcher matches the files array as more important than the default excluded files.\n const fileMatched = filter != null && filter(dirPath, fsExtra.lstatSync(dirPath))\n if (!fileMatched || !forceIncluded || !!this.packager.config.disableDefaultIgnoredFiles) {\n for (const ext of nodeModuleExcludedExts) {\n if (name.endsWith(ext)) {\n return null\n }\n }\n\n // noinspection SpellCheckingInspection\n if (isTopLevel && (topLevelExcludedFiles.has(name) || (moduleName === \"libui-node\" && (name === \"build\" || name === \"docs\" || name === \"src\")))) {\n return null\n }\n\n if (dirPath.endsWith(\"build\")) {\n if (name === \"gyp-mac-tool\" || name === \"Makefile\" || name.endsWith(\".mk\") || name.endsWith(\".gypi\") || name.endsWith(\".Makefile\")) {\n return null\n }\n } else if (dirPath.endsWith(\"Release\") && (name === \".deps\" || name === \"obj.target\")) {\n return null\n } else if (name === \"src\" && (dirPath.endsWith(\"keytar\") || dirPath.endsWith(\"keytar-prebuild\"))) {\n return null\n } else if (dirPath.endsWith(\"lzma-native\") && (name === \"build\" || name === \"deps\")) {\n return null\n }\n }\n\n return fsExtra.lstat(filePath).then((stat: FilterStats) => {\n stat.moduleName = moduleName\n stat.moduleRootPath = destination\n stat.moduleFullFilePath = path.join(destination, path.relative(depPath, filePath))\n if (filter != null && !filter(filePath, stat)) {\n return null\n }\n\n if (!stat.isDirectory()) {\n metadata.set(filePath, stat)\n }\n const consumerResult = this.handleFile(filePath, dirPath, stat)\n if (consumerResult == null) {\n if (stat.isDirectory()) {\n dirs.push(name)\n return null\n } else {\n return filePath\n }\n } else {\n return consumerResult.then(it => {\n // asarUtil can return modified stat (symlink handling)\n if ((it == null ? stat : it).isDirectory()) {\n dirs.push(name)\n return null\n } else {\n return filePath\n }\n })\n }\n })\n })\n\n let isEmpty = true\n for (const child of sortedFilePaths) {\n if (child != null) {\n result.push(child)\n if (this.metadata.get(child)?.isSymbolicLink()) {\n symlinkFiles.set(child, result.length - 1)\n }\n isEmpty = false\n }\n }\n\n if (isEmpty) {\n emptyDirs.add(dirPath)\n }\n\n dirs.sort()\n for (const child of dirs) {\n queue.push(dirPath + path.sep + child)\n }\n }\n\n for (const [file, index] of symlinkFiles) {\n const resolvedPath = realpathSync(file)\n if (emptyDirs.has(resolvedPath)) {\n // delete symlink file if target is a empty dir\n result[index] = undefined\n }\n }\n return result.filter((it): it is string => it !== undefined)\n }\n}\n"]}
1
+ {"version":3,"file":"NodeModuleCopyHelper.js","sourceRoot":"","sources":["../../src/util/NodeModuleCopyHelper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAA;AACjC,OAAO,OAAO,MAAM,UAAU,CAAA;AAC9B,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAC5B,OAAO,SAAS,MAAM,iBAAiB,CAAA;AACvC,OAAO,EAAE,sBAAsB,EAAe,MAAM,mBAAmB,CAAA;AAEvE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAEnD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAE9C,MAAM,aAAa,GAAG,IAAI,GAAG,CAC3B;IACE,WAAW;IACX,cAAc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,MAAM,YAAY,GAAG,YAAY,CAAC,IAAI,CAAC,CAAA;YACvC,IAAI,SAAS,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC;gBAChC,+CAA+C;gBAC/C,MAAM,CAAC,KAAK,CAAC,GAAG,SAAS,CAAA;YAC3B,CAAC;QACH,CAAC;QACD,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,EAAgB,EAAE,CAAC,EAAE,KAAK,SAAS,CAAC,CAAA;IAC9D,CAAC;CACF","sourcesContent":["import { FilterStats, MAX_FILE_REQUESTS } from \"builder-util\"\nimport { realpathSync } from \"fs\"\nimport fsExtra from \"fs-extra\"\nimport * as path from \"path\"\nimport asyncPool from \"tiny-async-pool\"\nimport { DEFAULT_EXCLUDED_NAMES, FileMatcher } from \"../fileMatcher.js\"\nimport { PlatformPackager } from \"../platformPackager.js\"\nimport { FileCopyHelper } from \"./AppFileWalker.js\"\nimport { NodeModuleInfo } from \"../node-module-collector/types.js\"\nimport { resolveFunction } from \"./resolve.js\"\n\nconst excludedFiles = new Set(\n [\n \".DS_Store\",\n \"node_modules\" /* already in the queue */,\n \"CHANGELOG.md\",\n \"ChangeLog\",\n \"changelog.md\",\n \"Changelog.md\",\n \"Changelog\",\n \"binding.gyp\",\n \".npmignore\",\n \"node_gyp_bins\",\n ].concat(DEFAULT_EXCLUDED_NAMES)\n)\n\nconst topLevelExcludedFiles = new Set([\n \"karma.conf.js\",\n \".coveralls.yml\",\n \"README.md\",\n \"readme.markdown\",\n \"README\",\n \"readme.md\",\n \"Readme.md\",\n \"Readme\",\n \"readme\",\n \"test\",\n \"tests\",\n \"__tests__\",\n \"powered-test\",\n \"example\",\n \"examples\",\n \".bin\",\n])\n\n/** @internal */\nexport class NodeModuleCopyHelper extends FileCopyHelper {\n constructor(matcher: FileMatcher, packager: PlatformPackager<any>) {\n super(matcher, matcher.isEmpty() ? null : matcher.createFilter(), packager)\n }\n\n async collectNodeModules(moduleInfo: NodeModuleInfo, nodeModuleExcludedExts: Array<string>, destination: string): Promise<Array<string>> {\n const filter = this.filter\n const metadata = this.metadata\n\n const onNodeModuleFile = await resolveFunction(this.packager.appInfo.type, this.packager.config.onNodeModuleFile, \"onNodeModuleFile\", await this.packager.getWorkspaceRoot())\n\n const result: Array<string | undefined> = []\n const queue: Array<string> = []\n const emptyDirs: Set<string> = new Set()\n const symlinkFiles: Map<string, number> = new Map()\n const tmpPath = moduleInfo.dir\n const moduleName = moduleInfo.name\n queue.length = 1\n // The path should be corrected in Windows that when the moduleName is Scoped packages named.\n const depPath = path.normalize(tmpPath)\n queue[0] = depPath\n\n while (queue.length > 0) {\n const dirPath = queue.pop()!\n\n const childNames = await fsExtra.readdir(dirPath)\n childNames.sort()\n\n const isTopLevel = dirPath === depPath\n const dirs: Array<string> = []\n // check if filematcher matches the files array as more important than the default excluded files.\n // Evaluated lazily and at most once per directory (memoized promise shared by the concurrent pool callbacks):\n // it is only needed when a child is force-included by the `onNodeModuleFile` hook.\n let dirMatched: Promise<boolean> | undefined\n const isDirMatched = () => {\n if (dirMatched === undefined) {\n dirMatched = filter == null ? Promise.resolve(false) : fsExtra.lstat(dirPath).then(stat => filter(dirPath, stat))\n }\n return dirMatched\n }\n // our handler is async, but we should add sorted files, so, we add file to result not in the mapper, but after map\n const sortedFilePaths = await asyncPool(MAX_FILE_REQUESTS, childNames, async name => {\n const filePath = path.join(dirPath, name)\n\n const forceIncluded = onNodeModuleFile != null && !!(await Promise.resolve(onNodeModuleFile(filePath)))\n\n if (excludedFiles.has(name) || name.startsWith(\"._\")) {\n return null\n }\n\n if (!forceIncluded || !(await isDirMatched())) {\n for (const ext of nodeModuleExcludedExts) {\n if (name.endsWith(ext)) {\n return null\n }\n }\n\n // noinspection SpellCheckingInspection\n if (isTopLevel && (topLevelExcludedFiles.has(name) || (moduleName === \"libui-node\" && (name === \"build\" || name === \"docs\" || name === \"src\")))) {\n return null\n }\n\n if (dirPath.endsWith(\"build\")) {\n if (name === \"gyp-mac-tool\" || name === \"Makefile\" || name.endsWith(\".mk\") || name.endsWith(\".gypi\") || name.endsWith(\".Makefile\")) {\n return null\n }\n } else if (dirPath.endsWith(\"Release\") && (name === \".deps\" || name === \"obj.target\")) {\n return null\n } else if (name === \"src\" && (dirPath.endsWith(\"keytar\") || dirPath.endsWith(\"keytar-prebuild\"))) {\n return null\n } else if (dirPath.endsWith(\"lzma-native\") && (name === \"build\" || name === \"deps\")) {\n return null\n }\n }\n\n return fsExtra.lstat(filePath).then((stat: FilterStats) => {\n stat.moduleName = moduleName\n stat.moduleRootPath = destination\n stat.moduleFullFilePath = path.join(destination, path.relative(depPath, filePath))\n if (filter != null && !filter(filePath, stat)) {\n return null\n }\n\n if (!stat.isDirectory()) {\n metadata.set(filePath, stat)\n }\n const consumerResult = this.handleFile(filePath, dirPath, stat)\n if (consumerResult == null) {\n if (stat.isDirectory()) {\n dirs.push(name)\n return null\n } else {\n return filePath\n }\n } else {\n return consumerResult.then(it => {\n // asarUtil can return modified stat (symlink handling)\n if ((it == null ? stat : it).isDirectory()) {\n dirs.push(name)\n return null\n } else {\n return filePath\n }\n })\n }\n })\n })\n\n let isEmpty = true\n for (const child of sortedFilePaths) {\n if (child != null) {\n result.push(child)\n if (this.metadata.get(child)?.isSymbolicLink()) {\n symlinkFiles.set(child, result.length - 1)\n }\n isEmpty = false\n }\n }\n\n if (isEmpty) {\n emptyDirs.add(dirPath)\n }\n\n dirs.sort()\n for (const child of dirs) {\n queue.push(dirPath + path.sep + child)\n }\n }\n\n for (const [file, index] of symlinkFiles) {\n const resolvedPath = realpathSync(file)\n if (emptyDirs.has(resolvedPath)) {\n // delete symlink file if target is a empty dir\n result[index] = undefined\n }\n }\n return result.filter((it): it is string => it !== undefined)\n }\n}\n"]}
@@ -1,10 +1,26 @@
1
- import { FileTransformer } from "builder-util";
1
+ import { ExternalLinkPolicy, FileTransformer } from "builder-util";
2
2
  import { Stats } from "fs";
3
3
  import { FileMatcher } from "../fileMatcher.js";
4
+ import { PM } from "../node-module-collector/index.js";
5
+ import { ModuleManager } from "../node-module-collector/moduleManager.js";
4
6
  import { Packager } from "../packager.js";
5
7
  import { PlatformPackager } from "../platformPackager.js";
8
+ import { NodeModuleInfo } from "../node-module-collector/types.js";
6
9
  export declare function getDestinationPath(file: string, fileSet: ResolvedFileSet): string;
7
- export declare function copyAppFiles(fileSet: ResolvedFileSet, packager: Packager, transformer: FileTransformer): Promise<void>;
10
+ export interface CopyAppFilesOptions {
11
+ /** Every file, directory and symlink is written inside it, checked by its real path: the resources directory of the app. */
12
+ readonly containmentRoot: string;
13
+ /** The real paths files may be copied from, see `getTrustedSourceRoots`. Each file is checked when given. */
14
+ readonly trustedSourceRoots?: ReadonlyArray<string> | null;
15
+ /** The `fileOptions.allowExternalLinks` build option: allows a file outside the trusted source roots, or a kept symlink that leaves the containment root. */
16
+ readonly externalLinks?: ExternalLinkPolicy | null;
17
+ }
18
+ /**
19
+ * Copies the files of the app when they are not packed into an asar archive. Like the asar packer, it refuses a file whose real path is
20
+ * outside the trusted source roots, writes only inside the containment root, checked by real path, and recreates a symlink only when it
21
+ * stays inside the containment root.
22
+ */
23
+ export declare function copyAppFiles(fileSet: ResolvedFileSet, packager: Pick<Packager, "cancellationToken">, transformer: FileTransformer, options?: CopyAppFilesOptions | null): Promise<void>;
8
24
  export interface ResolvedFileSet {
9
25
  src: string;
10
26
  destination: string;
@@ -14,4 +30,53 @@ export interface ResolvedFileSet {
14
30
  }
15
31
  export declare function transformFiles(transformer: FileTransformer, fileSet: ResolvedFileSet): Promise<void>;
16
32
  export declare function computeFileSets(matchers: Array<FileMatcher>, transformer: FileTransformer | null, platformPackager: PlatformPackager<any>): Promise<Array<ResolvedFileSet>>;
33
+ type CollectedNodeModules = {
34
+ nodeModules: NodeModuleInfo[];
35
+ logSummary: ModuleManager["logSummary"];
36
+ };
37
+ /** Runs a single package-manager collector against a single directory. */
38
+ type CollectorRunner = (pm: PM, dir: string) => Promise<CollectedNodeModules>;
39
+ /**
40
+ * Determines whether a collected module tree actually describes the package being built.
41
+ *
42
+ * A package-manager `list` invocation can resolve to the wrong project root — most notably when
43
+ * electron-builder is run from a workspace sub-package whose dependencies are hoisted to the
44
+ * workspace root (#9945) — or a collector can resolve the root node to the wrong package (e.g. an
45
+ * app named like one of its own dependencies, #10277). In both cases the collector returns a
46
+ * non-empty but wrong tree. Accepting it would suppress the manual-traversal fallback that resolves
47
+ * the correct modules, so we need to tell a matching collection from a mismatched one.
48
+ *
49
+ * Only the package's declared external (registry-installed, non-`workspace:`/`file:`/`link:`/`portal:`)
50
+ * production `dependencies` are checked; they are always placed at the top level of a correct
51
+ * collection. A collection matches when:
52
+ * - at least one of them is present at the top level, and
53
+ * - every one of them is either present at the top level (including modules flagged `excluded` by
54
+ * `ignoredProductionDependencies`) or reported in the collection's own `logSummary` as
55
+ * legitimately absent: dropped by the arch/platform filter, missing on disk (enforced later by
56
+ * `allowMissingDependencies`), a missing optional/platform-specific package, excluded as ignored,
57
+ * or a self-reference.
58
+ *
59
+ * When the package declares no external production dependencies there is nothing to validate
60
+ * against, so any non-empty collection is accepted.
61
+ */
62
+ export declare function collectionMatchesAppDependencies(nodeModules: NodeModuleInfo[], dependencies: Record<string, string> | undefined, logSummary?: ModuleManager["logSummary"]): boolean;
63
+ /**
64
+ * Walks the candidate (package-manager, directory) combinations and returns the first collection
65
+ * that both contains modules and matches the package being built (see
66
+ * {@link collectionMatchesAppDependencies}). A non-empty collection that does NOT match — e.g. a
67
+ * workspace-root tree returned for a sub-package — is retained only as a last-resort fallback so a
68
+ * later approach (notably {@link PM.TRAVERSAL}) can supply the correct modules.
69
+ *
70
+ * An approach that throws (e.g. the package manager exited without producing its dependency tree,
71
+ * issue #10208) is logged as a warning and skipped so the remaining approaches still run. If every
72
+ * approach fails to produce a collection and at least one threw, the first error is rethrown rather
73
+ * than silently reporting "no node modules".
74
+ */
75
+ export declare function resolveFirstMatchingCollection(options: {
76
+ pmApproaches: PM[];
77
+ searchDirectories: string[];
78
+ dependencies: Record<string, string> | undefined;
79
+ run: CollectorRunner;
80
+ }): Promise<CollectedNodeModules | undefined>;
81
+ export {};
17
82
  //# sourceMappingURL=appFileCopier.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"appFileCopier.d.ts","sourceRoot":"","sources":["../../src/util/appFileCopier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgC,eAAe,EAAmE,MAAM,cAAc,CAAA;AAC7I,OAAO,EAAE,KAAK,EAAE,MAAM,IAAI,CAAA;AAO1B,OAAO,EAAgB,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAG7D,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAKzD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,UAYxE;AAED,wBAAsB,YAAY,CAAC,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,eAAe,iBAyC5G;AAGD,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAA;IACX,WAAW,EAAE,MAAM,CAAA;IAEnB,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;IACpB,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;IAC5B,gBAAgB,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,GAAG,IAAI,CAAA;CACvD;AAGD,wBAAsB,cAAc,CAAC,WAAW,EAAE,eAAe,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAoC1G;AAED,wBAAsB,eAAe,CAAC,QAAQ,EAAE,KAAK,CAAC,WAAW,CAAC,EAAE,WAAW,EAAE,eAAe,GAAG,IAAI,EAAE,gBAAgB,EAAE,gBAAgB,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,eAAe,CAAC,CA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@@
1
- import { AsyncTaskManager, FileCopier, isEmptyOrSpaces, log, MAX_FILE_REQUESTS, statOrNull, walk } from "builder-util";
1
+ import { assertCopiedSymlinksContained, AsyncTaskManager, FileCopier, InvalidConfigurationError, isEmptyOrSpaces, log, MAX_FILE_REQUESTS, rebaseCopiedSymlinkTarget, statOrNull, walk, WriteContainment, } from "builder-util";
2
+ import { DEFAULT_IGNORED_PRODUCTION_DEPENDENCIES } from "../configuration.js";
2
3
  import fsExtra from "fs-extra";
3
- import { mkdir, readlink } from "fs/promises";
4
+ import { readlink } from "fs/promises";
4
5
  import * as path from "path";
5
6
  import asyncPool from "tiny-async-pool";
6
7
  import { isLibOrExe } from "../asar/unpackDetector.js";
7
8
  import { Platform } from "../core.js";
8
- import { excludedExts, FileMatcher } from "../fileMatcher.js";
9
+ import { DEFAULT_EXCLUDED_EXTENSIONS, FileMatcher } from "../fileMatcher.js";
9
10
  import { getCollectorByPackageManager, PM } from "../node-module-collector/index.js";
10
- import { logMessageLevelByKey } from "../node-module-collector/moduleManager.js";
11
+ import { LogMessageByKey, logMessageLevelByKey } from "../node-module-collector/moduleManager.js";
11
12
  import { AppFileWalker } from "./AppFileWalker.js";
12
13
  import { NodeModuleCopyHelper } from "./NodeModuleCopyHelper.js";
14
+ import { archToNodeCpu } from "./archCompatibility.js";
15
+ import { assertSourceFileInTrustedRoots } from "./trustedSourceRoots.js";
13
16
  export function getDestinationPath(file, fileSet) {
14
17
  if (file === fileSet.src) {
15
18
  return fileSet.destination;
@@ -17,16 +20,22 @@ export function getDestinationPath(file, fileSet) {
17
20
  const src = fileSet.src;
18
21
  const dest = fileSet.destination;
19
22
  // get node_modules path relative to src and then append to dest
20
- if (file.startsWith(src)) {
23
+ if (file.startsWith(src + path.sep)) {
21
24
  return path.join(dest, path.relative(src, file));
22
25
  }
23
26
  return dest;
24
27
  }
25
- export async function copyAppFiles(fileSet, packager, transformer) {
28
+ /**
29
+ * Copies the files of the app when they are not packed into an asar archive. Like the asar packer, it refuses a file whose real path is
30
+ * outside the trusted source roots, writes only inside the containment root, checked by real path, and recreates a symlink only when it
31
+ * stays inside the containment root.
32
+ */
33
+ export async function copyAppFiles(fileSet, packager, transformer, options) {
26
34
  const metadata = fileSet.metadata;
27
35
  // search auto unpacked dir
28
36
  const taskManager = new AsyncTaskManager(packager.cancellationToken);
29
- const createdParentDirs = new Set();
37
+ const containment = new WriteContainment(options?.containmentRoot ?? fileSet.destination, "app file");
38
+ const trustedSourceRoots = options?.trustedSourceRoots;
30
39
  const fileCopier = new FileCopier(file => {
31
40
  return !isLibOrExe(file);
32
41
  }, transformer);
@@ -38,16 +47,16 @@ export async function copyAppFiles(fileSet, packager, transformer) {
38
47
  // dir
39
48
  continue;
40
49
  }
50
+ if (trustedSourceRoots != null) {
51
+ await assertSourceFileInTrustedRoots(sourceFile, trustedSourceRoots, options?.externalLinks);
52
+ }
41
53
  const destinationFile = getDestinationPath(sourceFile, fileSet);
42
54
  if (stat.isSymbolicLink()) {
43
- links.push({ file: destinationFile, link: await readlink(sourceFile) });
55
+ links.push({ file: destinationFile, link: rebaseCopiedSymlinkTarget(fileSet.src, sourceFile, await readlink(sourceFile)), source: sourceFile });
44
56
  continue;
45
57
  }
46
- const fileParent = path.dirname(destinationFile);
47
- if (!createdParentDirs.has(fileParent)) {
48
- createdParentDirs.add(fileParent);
49
- await mkdir(fileParent, { recursive: true });
50
- }
58
+ // creates the directory once, checked by its real path, and removes a symlink planted at the destination
59
+ await containment.prepareFile(destinationFile);
51
60
  taskManager.addTask(fileCopier.copy(sourceFile, destinationFile, stat));
52
61
  if (taskManager.tasks.length > MAX_FILE_REQUESTS) {
53
62
  await taskManager.awaitTasks();
@@ -56,7 +65,12 @@ export async function copyAppFiles(fileSet, packager, transformer) {
56
65
  if (taskManager.tasks.length > 0) {
57
66
  await taskManager.awaitTasks();
58
67
  }
59
- await asyncPool(MAX_FILE_REQUESTS, links, it => fsExtra.ensureSymlink(it.link, it.file));
68
+ await asyncPool(MAX_FILE_REQUESTS, links, async (it) => {
69
+ await containment.prepareFile(it.file);
70
+ await fsExtra.ensureSymlink(it.link, it.file);
71
+ });
72
+ // the walker follows a symlink that leaves the app directory and copies what it points to, so a symlink kept as it is has to stay inside
73
+ await assertCopiedSymlinksContained(containment, links, [], "app file", options?.externalLinks);
60
74
  }
61
75
  // used only for ASAR, if no asar, file transformed on the fly
62
76
  export async function transformFiles(transformer, fileSet) {
@@ -109,7 +123,7 @@ export async function computeFileSets(matchers, transformer, platformPackager) {
109
123
  }
110
124
  function getNodeModuleExcludedExts(platformPackager) {
111
125
  // do not exclude *.h files (https://github.com/electron-userland/electron-builder/issues/2852)
112
- const result = [".o", ".obj"].concat(excludedExts.split(",").map(it => `.${it}`));
126
+ const result = DEFAULT_EXCLUDED_EXTENSIONS.map(it => `.${it}`);
113
127
  if (platformPackager.config.includePdb !== true) {
114
128
  result.push(".pdb");
115
129
  }
@@ -127,14 +141,18 @@ function validateFileSet(fileSet) {
127
141
  return fileSet;
128
142
  }
129
143
  /** @internal */
130
- export async function computeNodeModuleFileSets(platformPackager, mainMatcher) {
131
- const deps = await collectNodeModulesWithLogging(platformPackager);
144
+ export async function computeNodeModuleFileSets(platformPackager, mainMatcher, arch, applyArchFilter = true) {
145
+ const deps = await collectNodeModulesWithLogging(platformPackager, applyArchFilter ? arch : null);
132
146
  const nodeModuleExcludedExts = getNodeModuleExcludedExts(platformPackager);
133
147
  // serial execution because copyNodeModules is concurrent and so, no need to increase queue/pressure
134
148
  const result = new Array();
135
149
  let index = 0;
136
150
  const NODE_MODULES = "node_modules";
137
151
  const collectNodeModules = async (dep, destination) => {
152
+ // Ignore excluded dependencies.
153
+ if (dep.excluded) {
154
+ return;
155
+ }
138
156
  const source = dep.dir;
139
157
  const matcher = new FileMatcher(source, destination, mainMatcher.macroExpander, mainMatcher.patterns);
140
158
  const copier = new NodeModuleCopyHelper(matcher, platformPackager);
@@ -153,29 +171,191 @@ export async function computeNodeModuleFileSets(platformPackager, mainMatcher) {
153
171
  }
154
172
  return result;
155
173
  }
156
- async function collectNodeModulesWithLogging(platformPackager) {
157
- const { tempDirManager, appDir, projectDir } = platformPackager;
158
- let deps = undefined;
159
- const searchDirectories = Array.from(new Set([appDir, projectDir, await platformPackager.getWorkspaceRoot()])).filter((it) => isEmptyOrSpaces(it) === false);
160
- const pmApproaches = [await platformPackager.getPackageManager(), PM.TRAVERSAL];
174
+ // `workspace:`/`file:`/`link:`/`portal:` dependencies are symlinked into place rather than
175
+ // installed as standalone, hoistable packages, so they may legitimately be absent from a
176
+ // collected tree and cannot be used to validate it.
177
+ const LOCAL_DEPENDENCY_SPEC = /^(?:workspace|file|link|portal):/;
178
+ // Log-summary buckets in which a collector reports a declared dependency it deliberately or
179
+ // unavoidably left out of the collected tree. A direct dependency recorded in one of these is
180
+ // accounted for even though it is absent from the top level of an otherwise correct collection.
181
+ const ACCOUNTED_ABSENT_DEPENDENCY_KEYS = [
182
+ // dropped by the target arch/platform filter (`archFilter`, package.json `cpu`/`os`)
183
+ LogMessageByKey.PKG_INCOMPATIBLE_PLATFORM,
184
+ // not installed / not resolvable on disk — whether that is fatal is decided afterwards by
185
+ // `allowMissingDependencies` (see enforceAllowMissingDependencies), not by collection matching
186
+ LogMessageByKey.PKG_NOT_FOUND,
187
+ LogMessageByKey.PKG_NOT_ON_DISK,
188
+ LogMessageByKey.PKG_OPTIONAL_NOT_INSTALLED,
189
+ LogMessageByKey.PKG_OPTIONAL_PLATFORM_NOT_INSTALLED,
190
+ // excluded via `ignoredProductionDependencies` (such modules normally stay in the tree flagged
191
+ // `excluded`, so this only matters if a collector ever drops them instead)
192
+ LogMessageByKey.PKG_EXCLUDED_IGNORED,
193
+ // a dependency that resolves to the package itself is skipped rather than collected
194
+ LogMessageByKey.PKG_SELF_REF,
195
+ ];
196
+ /**
197
+ * Determines whether a collected module tree actually describes the package being built.
198
+ *
199
+ * A package-manager `list` invocation can resolve to the wrong project root — most notably when
200
+ * electron-builder is run from a workspace sub-package whose dependencies are hoisted to the
201
+ * workspace root (#9945) — or a collector can resolve the root node to the wrong package (e.g. an
202
+ * app named like one of its own dependencies, #10277). In both cases the collector returns a
203
+ * non-empty but wrong tree. Accepting it would suppress the manual-traversal fallback that resolves
204
+ * the correct modules, so we need to tell a matching collection from a mismatched one.
205
+ *
206
+ * Only the package's declared external (registry-installed, non-`workspace:`/`file:`/`link:`/`portal:`)
207
+ * production `dependencies` are checked; they are always placed at the top level of a correct
208
+ * collection. A collection matches when:
209
+ * - at least one of them is present at the top level, and
210
+ * - every one of them is either present at the top level (including modules flagged `excluded` by
211
+ * `ignoredProductionDependencies`) or reported in the collection's own `logSummary` as
212
+ * legitimately absent: dropped by the arch/platform filter, missing on disk (enforced later by
213
+ * `allowMissingDependencies`), a missing optional/platform-specific package, excluded as ignored,
214
+ * or a self-reference.
215
+ *
216
+ * When the package declares no external production dependencies there is nothing to validate
217
+ * against, so any non-empty collection is accepted.
218
+ */
219
+ export function collectionMatchesAppDependencies(nodeModules, dependencies, logSummary) {
220
+ const requiredExternalDeps = Object.entries(dependencies ?? {})
221
+ .filter(([, spec]) => !LOCAL_DEPENDENCY_SPEC.test(spec))
222
+ .map(([name]) => name);
223
+ if (requiredExternalDeps.length === 0) {
224
+ return true;
225
+ }
226
+ const collected = new Set(nodeModules.map(it => it.name));
227
+ if (!requiredExternalDeps.some(name => collected.has(name))) {
228
+ return false;
229
+ }
230
+ const accountedAbsent = new Set(ACCOUNTED_ABSENT_DEPENDENCY_KEYS.flatMap(key => logSummary?.[key] ?? []).map(dependencyNameFromSummaryId));
231
+ return requiredExternalDeps.every(name => collected.has(name) || accountedAbsent.has(name));
232
+ }
233
+ /**
234
+ * Walks the candidate (package-manager, directory) combinations and returns the first collection
235
+ * that both contains modules and matches the package being built (see
236
+ * {@link collectionMatchesAppDependencies}). A non-empty collection that does NOT match — e.g. a
237
+ * workspace-root tree returned for a sub-package — is retained only as a last-resort fallback so a
238
+ * later approach (notably {@link PM.TRAVERSAL}) can supply the correct modules.
239
+ *
240
+ * An approach that throws (e.g. the package manager exited without producing its dependency tree,
241
+ * issue #10208) is logged as a warning and skipped so the remaining approaches still run. If every
242
+ * approach fails to produce a collection and at least one threw, the first error is rethrown rather
243
+ * than silently reporting "no node modules".
244
+ */
245
+ export async function resolveFirstMatchingCollection(options) {
246
+ const { pmApproaches, searchDirectories, dependencies, run } = options;
247
+ let fallback;
248
+ let firstError;
161
249
  for (const pm of pmApproaches) {
162
250
  for (const dir of searchDirectories) {
163
251
  log.info({ pm, searchDir: dir }, "searching for node modules");
164
- const collector = getCollectorByPackageManager(pm, dir, tempDirManager);
165
- deps = await collector.getNodeModules({ packageName: platformPackager.nodePackageName });
166
- if (deps.nodeModules.length > 0) {
167
- break;
252
+ let deps;
253
+ try {
254
+ deps = await run(pm, dir);
255
+ }
256
+ catch (error) {
257
+ log.warn({ pm, searchDir: dir, error: error?.message ?? String(error) }, "node module collection failed, trying next search directory/approach");
258
+ firstError ??= error instanceof Error ? error : new Error(String(error));
259
+ continue;
260
+ }
261
+ if (deps.nodeModules.length === 0) {
262
+ log.info({ pm, searchDir: dir }, "no node modules found in collection, trying next search directory");
263
+ continue;
168
264
  }
169
- const attempt = searchDirectories.indexOf(dir);
170
- if (attempt < searchDirectories.length - 1) {
171
- log.info({ searchDir: dir, attempt }, "no node modules found in collection, trying next search directory");
265
+ if (collectionMatchesAppDependencies(deps.nodeModules, dependencies, deps.logSummary)) {
266
+ log.debug({ pm, searchDir: dir, depCount: deps.nodeModules.length }, "collected node modules");
267
+ return deps;
172
268
  }
269
+ log.info({ pm, searchDir: dir }, "collected node modules do not match the target package, trying next search directory/approach");
270
+ fallback ??= deps;
173
271
  }
174
- if (deps?.nodeModules?.length) {
175
- log.debug({ pm, nodeModules: deps.nodeModules }, "collected node modules");
176
- break;
272
+ }
273
+ if (fallback == null && firstError != null) {
274
+ throw firstError;
275
+ }
276
+ return fallback;
277
+ }
278
+ /** Extracts the package name from a `name@version` log-summary entry, handling `@scope/name@version`. */
279
+ function dependencyNameFromSummaryId(id) {
280
+ let at;
281
+ if (id.startsWith("@")) {
282
+ // Scoped package: the version separator is the first `@` after the scope's `/`
283
+ const slashIndex = id.indexOf("/");
284
+ if (slashIndex === -1) {
285
+ return id;
177
286
  }
287
+ at = id.indexOf("@", slashIndex + 1);
288
+ }
289
+ else {
290
+ at = id.indexOf("@");
178
291
  }
292
+ return at > 0 ? id.slice(0, at) : id;
293
+ }
294
+ /**
295
+ * Enforces {@link CommonConfiguration.allowMissingDependencies} against the finished collection
296
+ * summary (issue #10058). Runs only after collection completes, so the error reports the COMPLETE
297
+ * set of missing production dependencies at once instead of failing on the first one.
298
+ *
299
+ * Fail-closed by default: `false`, `null` and omitted all fail the build when a production
300
+ * dependency is missing; `true` restores the historical warn-only behavior. When the option is a
301
+ * `string[]`, only the listed dependency names are allowed to be missing — matched against the
302
+ * package name parsed from the summary's `name@version` entries (scoped names included), with an
303
+ * exact-entry match accepted as well.
304
+ *
305
+ * Only genuinely missing production dependencies (`PKG_NOT_FOUND` / `PKG_NOT_ON_DISK`) are fatal;
306
+ * missing optional dependencies (`PKG_OPTIONAL_NOT_INSTALLED` / `PKG_OPTIONAL_PLATFORM_NOT_INSTALLED`)
307
+ * never fail the build.
308
+ *
309
+ * @internal exported for tests
310
+ */
311
+ export function enforceAllowMissingDependencies(allowMissingDependencies, logSummary) {
312
+ if (allowMissingDependencies === true) {
313
+ return;
314
+ }
315
+ const missing = new Set([...(logSummary?.[LogMessageByKey.PKG_NOT_FOUND] ?? []), ...(logSummary?.[LogMessageByKey.PKG_NOT_ON_DISK] ?? [])]);
316
+ const allowed = new Set(Array.isArray(allowMissingDependencies) ? allowMissingDependencies : []);
317
+ const fatal = Array.from(missing)
318
+ .filter(id => !allowed.has(dependencyNameFromSummaryId(id)) && !allowed.has(id))
319
+ .sort();
320
+ if (fatal.length === 0) {
321
+ return;
322
+ }
323
+ throw new InvalidConfigurationError(`The following production dependencies could not be resolved during node-module collection:\n` +
324
+ fatal.map(id => ` - ${id}`).join("\n") +
325
+ `\nInstall the missing dependencies, list names in \`allowMissingDependencies\` to allow specific ones to be missing, or set \`allowMissingDependencies\` to true to only warn (electron-builder <= 26 behavior).`);
326
+ }
327
+ /** @internal */
328
+ export async function collectNodeModulesWithLogging(platformPackager, arch) {
329
+ const { tempDirManager, appDir, projectDir } = platformPackager;
330
+ // Drop packages whose `package.json` `cpu`/`os` is incompatible with the target arch/platform while
331
+ // collecting (e.g. exclude `@esbuild/darwin-arm64` from the x64 slice). See NodeModulesCollector.
332
+ // `null` arch (universal slices) disables the filter so both slices stay symmetric for the merge.
333
+ const archFilter = arch == null ? undefined : { cpu: archToNodeCpu(arch), os: platformPackager.platform.nodeName };
334
+ const searchDirectories = Array.from(new Set([appDir, projectDir, await platformPackager.getWorkspaceRoot()])).filter((it) => isEmptyOrSpaces(it) === false);
335
+ const pmApproaches = [await platformPackager.getPackageManager(), PM.TRAVERSAL];
336
+ // The default-ignored packages are excluded from the copied `node_modules` — together with any
337
+ // transitive dependency they alone require — because electron-builder already provides them another
338
+ // way (the Electron runtime is embedded separately), so copying them would be redundant. They remain
339
+ // valid production dependencies for tooling such as SBOM generation. See NodeModulesCollector.getNodeModules.
340
+ const configuredIgnored = platformPackager.config.ignoredProductionDependencies;
341
+ const ignoredDependencies = configuredIgnored == null ? DEFAULT_IGNORED_PRODUCTION_DEPENDENCIES : configuredIgnored;
342
+ // An app that declares no production dependencies at all (neither as-installed nor via
343
+ // `extraMetadata`) has nothing to bundle. Without this guard the search would skip the app's
344
+ // empty `node_modules`, climb to the workspace root, and the vacuous match in
345
+ // `collectionMatchesAppDependencies` would accept the entire hoisted workspace tree (#10033).
346
+ const declaredDependencies = Object.keys({ ...platformPackager.originalMetadata.dependencies, ...platformPackager.metadata.dependencies });
347
+ if (declaredDependencies.length === 0) {
348
+ log.info(null, "app has no production dependencies, skipping node_modules bundling");
349
+ return [];
350
+ }
351
+ // Validate against the as-declared (pre-extraMetadata) production dependencies so a configured
352
+ // `extraMetadata.dependencies` entry that isn't installed cannot reject a correct collection.
353
+ const deps = await resolveFirstMatchingCollection({
354
+ pmApproaches,
355
+ searchDirectories,
356
+ dependencies: platformPackager.originalMetadata.dependencies,
357
+ run: (pm, dir) => getCollectorByPackageManager(pm, dir, tempDirManager).getNodeModules({ packageName: platformPackager.nodePackageName, archFilter, ignoredDependencies }),
358
+ });
179
359
  if (!deps?.nodeModules?.length) {
180
360
  log.warn({ searchDirectories: searchDirectories.map(it => log.filePath(it)) }, "no node modules returned while searching directories");
181
361
  return [];
@@ -185,6 +365,38 @@ async function collectNodeModulesWithLogging(platformPackager) {
185
365
  const logLevel = logMessageLevelByKey[errorMessage] || "debug";
186
366
  log[logLevel]({ dependencies }, errorMessage);
187
367
  }
368
+ // Fail-closed enforcement (issue #10058): collection is complete and the summary above has reached
369
+ // the log, so failing here reports every missing production dependency at once.
370
+ enforceAllowMissingDependencies(platformPackager.config.allowMissingDependencies, deps.logSummary);
371
+ // Tripwire: the default-ignored packages are excluded because electron-builder already provides them
372
+ // (e.g. the embedded Electron runtime), so a copy in `node_modules` is redundant. They only reach this
373
+ // point unflagged when a user has removed them from `ignoredProductionDependencies`; record any that
374
+ // are therefore about to be copied (present but not marked `excluded`) so the summary below warns.
375
+ const bundledDefaultIgnored = deps.nodeModules.filter(it => !it.excluded && DEFAULT_IGNORED_PRODUCTION_DEPENDENCIES.includes(it.name)).map(it => it.name);
376
+ if (bundledDefaultIgnored.length > 0) {
377
+ log.warn({ dependencies: bundledDefaultIgnored }, "copied dependencies that shouldn't be needed, see ignoredProductionDependencies");
378
+ }
379
+ warnAboutDeprecatedElectronPackages(deps.nodeModules);
188
380
  return deps.nodeModules;
189
381
  }
382
+ /**
383
+ * Long-deprecated Electron packages that v26 rejected outright as production dependencies.
384
+ *
385
+ * v27 dropped that guard without adding them to the default ignore list, so they are now copied into
386
+ * the app instead of failing the build — and `electron-prebuilt` drags a full second Electron binary
387
+ * (hundreds of MB) into app.asar with nothing in the log to explain the size jump.
388
+ */
389
+ const DEPRECATED_ELECTRON_PACKAGES = {
390
+ "electron-prebuilt": "renamed to `electron` in 2016 — replace it with `electron`",
391
+ "electron-rebuild": "moved to `@electron/rebuild` — replace it and move it to devDependencies",
392
+ "electron-nightly": "a full Electron distribution — move it to devDependencies if it is not meant to ship",
393
+ };
394
+ function warnAboutDeprecatedElectronPackages(nodeModules) {
395
+ const bundled = nodeModules.filter(it => !it.excluded && it.name in DEPRECATED_ELECTRON_PACKAGES);
396
+ for (const { name } of bundled) {
397
+ log.warn({ dependency: name, solution: `add "${name}" to ignoredProductionDependencies, or move it to devDependencies` }, `${name} is declared in dependencies and is being packaged into your app (${DEPRECATED_ELECTRON_PACKAGES[name]}). ` +
398
+ "electron-builder <= 26 rejected this outright; v27 removed that guard and does not exclude it by default. " +
399
+ "See https://www.electron.build/docs/migration/v27-breaking-changes#electron-prebuilt-electron-rebuild-no-longer-error-and-are-not-excluded");
400
+ }
401
+ }
190
402
  //# sourceMappingURL=appFileCopier.js.map