app-builder-lib 27.0.0-alpha.0 → 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 (458) 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 +1 -1
  9. package/dist/asar/asar.js.map +1 -1
  10. package/dist/asar/asarFileChecker.d.ts +4 -2
  11. package/dist/asar/asarFileChecker.d.ts.map +1 -1
  12. package/dist/asar/asarFileChecker.js +2 -3
  13. package/dist/asar/asarFileChecker.js.map +1 -1
  14. package/dist/asar/asarUtil.js +21 -11
  15. package/dist/asar/asarUtil.js.map +1 -1
  16. package/dist/codeSign/certInfo.d.ts +14 -0
  17. package/dist/codeSign/certInfo.d.ts.map +1 -1
  18. package/dist/codeSign/certInfo.js +49 -0
  19. package/dist/codeSign/certInfo.js.map +1 -1
  20. package/dist/codeSign/mac/macCodeSign.d.ts +3 -3
  21. package/dist/codeSign/mac/macCodeSign.d.ts.map +1 -1
  22. package/dist/codeSign/mac/macCodeSign.js +50 -25
  23. package/dist/codeSign/mac/macCodeSign.js.map +1 -1
  24. package/dist/codeSign/signResult.d.ts +26 -0
  25. package/dist/codeSign/signResult.d.ts.map +1 -0
  26. package/dist/codeSign/signResult.js +12 -0
  27. package/dist/codeSign/signResult.js.map +1 -0
  28. package/dist/codeSign/win/hsmSignManager.d.ts +10 -0
  29. package/dist/codeSign/win/hsmSignManager.d.ts.map +1 -0
  30. package/dist/codeSign/win/hsmSignManager.js +50 -0
  31. package/dist/codeSign/win/hsmSignManager.js.map +1 -0
  32. package/dist/codeSign/win/pkcs11SignManager.d.ts +14 -0
  33. package/dist/codeSign/win/pkcs11SignManager.d.ts.map +1 -0
  34. package/dist/codeSign/win/pkcs11SignManager.js +82 -0
  35. package/dist/codeSign/win/pkcs11SignManager.js.map +1 -0
  36. package/dist/codeSign/win/signManager.d.ts +17 -0
  37. package/dist/codeSign/win/signManager.d.ts.map +1 -0
  38. package/dist/codeSign/win/signManager.js +19 -0
  39. package/dist/codeSign/win/signManager.js.map +1 -0
  40. package/dist/codeSign/win/signtoolBaseSignManager.d.ts +95 -0
  41. package/dist/codeSign/win/signtoolBaseSignManager.d.ts.map +1 -0
  42. package/dist/codeSign/win/signtoolBaseSignManager.js +507 -0
  43. package/dist/codeSign/win/signtoolBaseSignManager.js.map +1 -0
  44. package/dist/codeSign/win/windowsCodeSign.d.ts +2 -1
  45. package/dist/codeSign/win/windowsCodeSign.d.ts.map +1 -1
  46. package/dist/codeSign/win/windowsCodeSign.js +22 -8
  47. package/dist/codeSign/win/windowsCodeSign.js.map +1 -1
  48. package/dist/codeSign/win/windowsSignAzureManager.d.ts +11 -4
  49. package/dist/codeSign/win/windowsSignAzureManager.d.ts.map +1 -1
  50. package/dist/codeSign/win/windowsSignAzureManager.js +142 -37
  51. package/dist/codeSign/win/windowsSignAzureManager.js.map +1 -1
  52. package/dist/codeSign/win/windowsSignToolManager.d.ts +1 -58
  53. package/dist/codeSign/win/windowsSignToolManager.d.ts.map +1 -1
  54. package/dist/codeSign/win/windowsSignToolManager.js +3 -363
  55. package/dist/codeSign/win/windowsSignToolManager.js.map +1 -1
  56. package/dist/configuration.d.ts +228 -163
  57. package/dist/configuration.d.ts.map +1 -1
  58. package/dist/configuration.js +11 -1
  59. package/dist/configuration.js.map +1 -1
  60. package/dist/core.d.ts +14 -0
  61. package/dist/core.d.ts.map +1 -1
  62. package/dist/core.js +11 -0
  63. package/dist/core.js.map +1 -1
  64. package/dist/electron/ElectronFramework.d.ts +3 -3
  65. package/dist/electron/ElectronFramework.d.ts.map +1 -1
  66. package/dist/electron/ElectronFramework.js +60 -61
  67. package/dist/electron/ElectronFramework.js.map +1 -1
  68. package/dist/electron/electronArchSupport.d.ts +12 -0
  69. package/dist/electron/electronArchSupport.d.ts.map +1 -0
  70. package/dist/electron/electronArchSupport.js +58 -0
  71. package/dist/electron/electronArchSupport.js.map +1 -0
  72. package/dist/electron/electronVersion.d.ts.map +1 -1
  73. package/dist/electron/electronVersion.js +1 -11
  74. package/dist/electron/electronVersion.js.map +1 -1
  75. package/dist/electron/injectFFMPEG.js +2 -2
  76. package/dist/electron/injectFFMPEG.js.map +1 -1
  77. package/dist/electron/mac/electronMac.js +24 -35
  78. package/dist/electron/mac/electronMac.js.map +1 -1
  79. package/dist/electron/mac/electronMacUtils.d.ts +24 -0
  80. package/dist/electron/mac/electronMacUtils.d.ts.map +1 -0
  81. package/dist/electron/mac/electronMacUtils.js +42 -0
  82. package/dist/electron/mac/electronMacUtils.js.map +1 -0
  83. package/dist/electron/win/electronWin.js +2 -2
  84. package/dist/electron/win/electronWin.js.map +1 -1
  85. package/dist/fileMatcher.d.ts +42 -2
  86. package/dist/fileMatcher.d.ts.map +1 -1
  87. package/dist/fileMatcher.js +246 -18
  88. package/dist/fileMatcher.js.map +1 -1
  89. package/dist/index.d.ts +11 -5
  90. package/dist/index.d.ts.map +1 -1
  91. package/dist/index.js +17 -1
  92. package/dist/index.js.map +1 -1
  93. package/dist/indexInternal.d.ts +19 -8
  94. package/dist/indexInternal.d.ts.map +1 -1
  95. package/dist/indexInternal.js +18 -7
  96. package/dist/indexInternal.js.map +1 -1
  97. package/dist/linuxPackager.d.ts.map +1 -1
  98. package/dist/linuxPackager.js +19 -1
  99. package/dist/linuxPackager.js.map +1 -1
  100. package/dist/macPackager.d.ts +31 -14
  101. package/dist/macPackager.d.ts.map +1 -1
  102. package/dist/macPackager.js +236 -147
  103. package/dist/macPackager.js.map +1 -1
  104. package/dist/node-module-collector/index.d.ts.map +1 -1
  105. package/dist/node-module-collector/index.js +47 -16
  106. package/dist/node-module-collector/index.js.map +1 -1
  107. package/dist/node-module-collector/moduleManager.d.ts +11 -2
  108. package/dist/node-module-collector/moduleManager.d.ts.map +1 -1
  109. package/dist/node-module-collector/moduleManager.js +34 -14
  110. package/dist/node-module-collector/moduleManager.js.map +1 -1
  111. package/dist/node-module-collector/nodeModulesCollector.d.ts +47 -26
  112. package/dist/node-module-collector/nodeModulesCollector.d.ts.map +1 -1
  113. package/dist/node-module-collector/nodeModulesCollector.js +157 -142
  114. package/dist/node-module-collector/nodeModulesCollector.js.map +1 -1
  115. package/dist/node-module-collector/packageManager.js +1 -1
  116. package/dist/node-module-collector/packageManager.js.map +1 -1
  117. package/dist/node-module-collector/pnpmNodeModulesCollector.d.ts +90 -1
  118. package/dist/node-module-collector/pnpmNodeModulesCollector.d.ts.map +1 -1
  119. package/dist/node-module-collector/pnpmNodeModulesCollector.js +325 -25
  120. package/dist/node-module-collector/pnpmNodeModulesCollector.js.map +1 -1
  121. package/dist/node-module-collector/types.d.ts +4 -0
  122. package/dist/node-module-collector/types.d.ts.map +1 -1
  123. package/dist/node-module-collector/types.js.map +1 -1
  124. package/dist/options/FuseOptionsV1.d.ts +137 -0
  125. package/dist/options/FuseOptionsV1.d.ts.map +1 -0
  126. package/dist/options/FuseOptionsV1.js +2 -0
  127. package/dist/options/FuseOptionsV1.js.map +1 -0
  128. package/dist/options/MsixOptions.d.ts +126 -0
  129. package/dist/options/MsixOptions.d.ts.map +1 -0
  130. package/dist/options/MsixOptions.js +2 -0
  131. package/dist/options/MsixOptions.js.map +1 -0
  132. package/dist/options/PlatformSpecificBuildOptions.d.ts +55 -9
  133. package/dist/options/PlatformSpecificBuildOptions.d.ts.map +1 -1
  134. package/dist/options/PlatformSpecificBuildOptions.js.map +1 -1
  135. package/dist/options/SnapOptions.d.ts +23 -17
  136. package/dist/options/SnapOptions.d.ts.map +1 -1
  137. package/dist/options/SnapOptions.js.map +1 -1
  138. package/dist/options/SquirrelWindowsOptions.d.ts +0 -5
  139. package/dist/options/SquirrelWindowsOptions.d.ts.map +1 -1
  140. package/dist/options/SquirrelWindowsOptions.js.map +1 -1
  141. package/dist/options/linuxOptions.d.ts +8 -12
  142. package/dist/options/linuxOptions.d.ts.map +1 -1
  143. package/dist/options/linuxOptions.js.map +1 -1
  144. package/dist/options/macOptions.d.ts +113 -131
  145. package/dist/options/macOptions.d.ts.map +1 -1
  146. package/dist/options/macOptions.js.map +1 -1
  147. package/dist/options/pkgOptions.d.ts +1 -1
  148. package/dist/options/pkgOptions.js.map +1 -1
  149. package/dist/options/winOptions.d.ts +282 -70
  150. package/dist/options/winOptions.d.ts.map +1 -1
  151. package/dist/options/winOptions.js +12 -1
  152. package/dist/options/winOptions.js.map +1 -1
  153. package/dist/packager.d.ts +6 -1
  154. package/dist/packager.d.ts.map +1 -1
  155. package/dist/packager.js +121 -40
  156. package/dist/packager.js.map +1 -1
  157. package/dist/packagerApi.d.ts +10 -1
  158. package/dist/packagerApi.d.ts.map +1 -1
  159. package/dist/packagerApi.js.map +1 -1
  160. package/dist/platformPackager.d.ts +49 -3
  161. package/dist/platformPackager.d.ts.map +1 -1
  162. package/dist/platformPackager.js +130 -17
  163. package/dist/platformPackager.js.map +1 -1
  164. package/dist/publish/PublishManager.d.ts +36 -2
  165. package/dist/publish/PublishManager.d.ts.map +1 -1
  166. package/dist/publish/PublishManager.js +387 -23
  167. package/dist/publish/PublishManager.js.map +1 -1
  168. package/dist/publish/updateInfoBuilder.d.ts +1 -1
  169. package/dist/publish/updateInfoBuilder.d.ts.map +1 -1
  170. package/dist/publish/updateInfoBuilder.js +110 -32
  171. package/dist/publish/updateInfoBuilder.js.map +1 -1
  172. package/dist/targets/ArchiveTarget.d.ts +1 -0
  173. package/dist/targets/ArchiveTarget.d.ts.map +1 -1
  174. package/dist/targets/ArchiveTarget.js +6 -3
  175. package/dist/targets/ArchiveTarget.js.map +1 -1
  176. package/dist/targets/archive.d.ts +33 -2
  177. package/dist/targets/archive.d.ts.map +1 -1
  178. package/dist/targets/archive.js +109 -29
  179. package/dist/targets/archive.js.map +1 -1
  180. package/dist/targets/blockmap/blockmap.d.ts +43 -3
  181. package/dist/targets/blockmap/blockmap.d.ts.map +1 -1
  182. package/dist/targets/blockmap/blockmap.js +141 -15
  183. package/dist/targets/blockmap/blockmap.js.map +1 -1
  184. package/dist/targets/blockmap/verbatimRange.d.ts +44 -0
  185. package/dist/targets/blockmap/verbatimRange.d.ts.map +1 -0
  186. package/dist/targets/blockmap/verbatimRange.js +117 -0
  187. package/dist/targets/blockmap/verbatimRange.js.map +1 -0
  188. package/dist/targets/differentialUpdateInfoBuilder.d.ts +28 -2
  189. package/dist/targets/differentialUpdateInfoBuilder.d.ts.map +1 -1
  190. package/dist/targets/differentialUpdateInfoBuilder.js +75 -6
  191. package/dist/targets/differentialUpdateInfoBuilder.js.map +1 -1
  192. package/dist/targets/linux/FlatpakTarget.d.ts.map +1 -1
  193. package/dist/targets/linux/FlatpakTarget.js +13 -3
  194. package/dist/targets/linux/FlatpakTarget.js.map +1 -1
  195. package/dist/targets/linux/FpmTarget.d.ts +14 -0
  196. package/dist/targets/linux/FpmTarget.d.ts.map +1 -1
  197. package/dist/targets/linux/FpmTarget.js +86 -10
  198. package/dist/targets/linux/FpmTarget.js.map +1 -1
  199. package/dist/targets/linux/LinuxTargetHelper.d.ts +15 -0
  200. package/dist/targets/linux/LinuxTargetHelper.d.ts.map +1 -1
  201. package/dist/targets/linux/LinuxTargetHelper.js +54 -59
  202. package/dist/targets/linux/LinuxTargetHelper.js.map +1 -1
  203. package/dist/targets/linux/appimage/AppImageTarget.d.ts +2 -0
  204. package/dist/targets/linux/appimage/AppImageTarget.d.ts.map +1 -1
  205. package/dist/targets/linux/appimage/AppImageTarget.js +16 -15
  206. package/dist/targets/linux/appimage/AppImageTarget.js.map +1 -1
  207. package/dist/targets/linux/appimage/appImageUtil.d.ts +5 -1
  208. package/dist/targets/linux/appimage/appImageUtil.d.ts.map +1 -1
  209. package/dist/targets/linux/appimage/appImageUtil.js +14 -7
  210. package/dist/targets/linux/appimage/appImageUtil.js.map +1 -1
  211. package/dist/targets/linux/appimage/appLauncher.d.ts.map +1 -1
  212. package/dist/targets/linux/appimage/appLauncher.js +5 -11
  213. package/dist/targets/linux/appimage/appLauncher.js.map +1 -1
  214. package/dist/targets/linux/launcherScript.d.ts +32 -0
  215. package/dist/targets/linux/launcherScript.d.ts.map +1 -0
  216. package/dist/targets/linux/launcherScript.js +24 -0
  217. package/dist/targets/linux/launcherScript.js.map +1 -0
  218. package/dist/targets/linux/snap/SnapTarget.d.ts +1 -1
  219. package/dist/targets/linux/snap/SnapTarget.d.ts.map +1 -1
  220. package/dist/targets/linux/snap/SnapTarget.js +23 -1
  221. package/dist/targets/linux/snap/SnapTarget.js.map +1 -1
  222. package/dist/targets/linux/snap/core24.d.ts +30 -1
  223. package/dist/targets/linux/snap/core24.d.ts.map +1 -1
  224. package/dist/targets/linux/snap/core24.js +146 -70
  225. package/dist/targets/linux/snap/core24.js.map +1 -1
  226. package/dist/targets/linux/snap/coreCustom.d.ts +1 -1
  227. package/dist/targets/linux/snap/coreCustom.d.ts.map +1 -1
  228. package/dist/targets/linux/snap/coreCustom.js +2 -2
  229. package/dist/targets/linux/snap/coreCustom.js.map +1 -1
  230. package/dist/targets/linux/snap/coreLegacy.d.ts +3 -3
  231. package/dist/targets/linux/snap/coreLegacy.d.ts.map +1 -1
  232. package/dist/targets/linux/snap/coreLegacy.js +12 -12
  233. package/dist/targets/linux/snap/coreLegacy.js.map +1 -1
  234. package/dist/targets/linux/snap/snapCommand.d.ts +13 -0
  235. package/dist/targets/linux/snap/snapCommand.d.ts.map +1 -0
  236. package/dist/targets/linux/snap/snapCommand.js +21 -0
  237. package/dist/targets/linux/snap/snapCommand.js.map +1 -0
  238. package/dist/targets/linux/snap/snapcraft.d.ts +190 -0
  239. package/dist/targets/linux/snap/snapcraft.d.ts.map +1 -0
  240. package/dist/targets/linux/snap/snapcraft.js +11 -0
  241. package/dist/targets/linux/snap/snapcraft.js.map +1 -0
  242. package/dist/targets/linux/snap/snapcraftBuilder.d.ts +7 -1
  243. package/dist/targets/linux/snap/snapcraftBuilder.d.ts.map +1 -1
  244. package/dist/targets/linux/snap/snapcraftBuilder.js +57 -20
  245. package/dist/targets/linux/snap/snapcraftBuilder.js.map +1 -1
  246. package/dist/targets/mac/MacTargetHelper.d.ts +146 -14
  247. package/dist/targets/mac/MacTargetHelper.d.ts.map +1 -1
  248. package/dist/targets/mac/MacTargetHelper.js +485 -91
  249. package/dist/targets/mac/MacTargetHelper.js.map +1 -1
  250. package/dist/targets/mac/pkg.d.ts +16 -0
  251. package/dist/targets/mac/pkg.d.ts.map +1 -1
  252. package/dist/targets/mac/pkg.js +31 -5
  253. package/dist/targets/mac/pkg.js.map +1 -1
  254. package/dist/targets/targetFactory.d.ts +7 -0
  255. package/dist/targets/targetFactory.d.ts.map +1 -1
  256. package/dist/targets/targetFactory.js +28 -0
  257. package/dist/targets/targetFactory.js.map +1 -1
  258. package/dist/targets/win/AppxTarget.d.ts +1 -2
  259. package/dist/targets/win/AppxTarget.d.ts.map +1 -1
  260. package/dist/targets/win/AppxTarget.js +37 -314
  261. package/dist/targets/win/AppxTarget.js.map +1 -1
  262. package/dist/targets/win/MsiTarget.d.ts.map +1 -1
  263. package/dist/targets/win/MsiTarget.js +13 -13
  264. package/dist/targets/win/MsiTarget.js.map +1 -1
  265. package/dist/targets/win/MsixTarget.d.ts +22 -0
  266. package/dist/targets/win/MsixTarget.d.ts.map +1 -0
  267. package/dist/targets/win/MsixTarget.js +214 -0
  268. package/dist/targets/win/MsixTarget.js.map +1 -0
  269. package/dist/targets/win/nsis/Defines.d.ts +3 -0
  270. package/dist/targets/win/nsis/Defines.d.ts.map +1 -1
  271. package/dist/targets/win/nsis/Defines.js.map +1 -1
  272. package/dist/targets/win/nsis/NsisTarget.d.ts +57 -3
  273. package/dist/targets/win/nsis/NsisTarget.d.ts.map +1 -1
  274. package/dist/targets/win/nsis/NsisTarget.js +252 -113
  275. package/dist/targets/win/nsis/NsisTarget.js.map +1 -1
  276. package/dist/targets/win/nsis/WebInstallerTarget.d.ts.map +1 -1
  277. package/dist/targets/win/nsis/WebInstallerTarget.js +23 -12
  278. package/dist/targets/win/nsis/WebInstallerTarget.js.map +1 -1
  279. package/dist/targets/win/nsis/nsisOptions.d.ts +56 -48
  280. package/dist/targets/win/nsis/nsisOptions.d.ts.map +1 -1
  281. package/dist/targets/win/nsis/nsisOptions.js.map +1 -1
  282. package/dist/targets/win/nsis/nsisScriptGenerator.d.ts.map +1 -1
  283. package/dist/targets/win/nsis/nsisScriptGenerator.js +4 -3
  284. package/dist/targets/win/nsis/nsisScriptGenerator.js.map +1 -1
  285. package/dist/targets/win/nsis/nsisUtil.d.ts +17 -2
  286. package/dist/targets/win/nsis/nsisUtil.d.ts.map +1 -1
  287. package/dist/targets/win/nsis/nsisUtil.js +143 -41
  288. package/dist/targets/win/nsis/nsisUtil.js.map +1 -1
  289. package/dist/targets/win/nsis/progId.d.ts +21 -0
  290. package/dist/targets/win/nsis/progId.d.ts.map +1 -0
  291. package/dist/targets/win/nsis/progId.js +60 -0
  292. package/dist/targets/win/nsis/progId.js.map +1 -0
  293. package/dist/targets/win/winAppUtil.d.ts +115 -0
  294. package/dist/targets/win/winAppUtil.d.ts.map +1 -0
  295. package/dist/targets/win/winAppUtil.js +407 -0
  296. package/dist/targets/win/winAppUtil.js.map +1 -0
  297. package/dist/toolsets/7zip.d.ts +32 -0
  298. package/dist/toolsets/7zip.d.ts.map +1 -1
  299. package/dist/toolsets/7zip.js +39 -11
  300. package/dist/toolsets/7zip.js.map +1 -1
  301. package/dist/toolsets/appimage.d.ts +3 -3
  302. package/dist/toolsets/appimage.d.ts.map +1 -1
  303. package/dist/toolsets/appimage.js +9 -6
  304. package/dist/toolsets/appimage.js.map +1 -1
  305. package/dist/toolsets/custom.d.ts +2 -3
  306. package/dist/toolsets/custom.d.ts.map +1 -1
  307. package/dist/toolsets/custom.js +67 -149
  308. package/dist/toolsets/custom.js.map +1 -1
  309. package/dist/toolsets/fpm.d.ts.map +1 -1
  310. package/dist/toolsets/fpm.js +11 -5
  311. package/dist/toolsets/fpm.js.map +1 -1
  312. package/dist/toolsets/icons.d.ts.map +1 -1
  313. package/dist/toolsets/icons.js +17 -3
  314. package/dist/toolsets/icons.js.map +1 -1
  315. package/dist/toolsets/linuxToolsMac.d.ts.map +1 -1
  316. package/dist/toolsets/linuxToolsMac.js +17 -4
  317. package/dist/toolsets/linuxToolsMac.js.map +1 -1
  318. package/dist/toolsets/nsis.d.ts +5 -0
  319. package/dist/toolsets/nsis.d.ts.map +1 -1
  320. package/dist/toolsets/nsis.js +20 -4
  321. package/dist/toolsets/nsis.js.map +1 -1
  322. package/dist/toolsets/version.d.ts +12 -0
  323. package/dist/toolsets/version.d.ts.map +1 -0
  324. package/dist/toolsets/version.js +13 -0
  325. package/dist/toolsets/version.js.map +1 -0
  326. package/dist/toolsets/winCodeSign.d.ts +56 -3
  327. package/dist/toolsets/winCodeSign.d.ts.map +1 -1
  328. package/dist/toolsets/winCodeSign.js +125 -42
  329. package/dist/toolsets/winCodeSign.js.map +1 -1
  330. package/dist/toolsets/wine.d.ts +2 -1
  331. package/dist/toolsets/wine.d.ts.map +1 -1
  332. package/dist/toolsets/wine.js +31 -15
  333. package/dist/toolsets/wine.js.map +1 -1
  334. package/dist/util/NodeModuleCopyHelper.js +14 -6
  335. package/dist/util/NodeModuleCopyHelper.js.map +1 -1
  336. package/dist/util/appFileCopier.d.ts +52 -0
  337. package/dist/util/appFileCopier.d.ts.map +1 -1
  338. package/dist/util/appFileCopier.js +221 -21
  339. package/dist/util/appFileCopier.js.map +1 -1
  340. package/dist/util/archCompatibility.d.ts +42 -0
  341. package/dist/util/archCompatibility.d.ts.map +1 -0
  342. package/dist/util/archCompatibility.js +202 -0
  343. package/dist/util/archCompatibility.js.map +1 -0
  344. package/dist/util/checksum.d.ts +36 -0
  345. package/dist/util/checksum.d.ts.map +1 -0
  346. package/dist/util/checksum.js +48 -0
  347. package/dist/util/checksum.js.map +1 -0
  348. package/dist/util/config/config.d.ts +1 -0
  349. package/dist/util/config/config.d.ts.map +1 -1
  350. package/dist/util/config/config.js +8 -1
  351. package/dist/util/config/config.js.map +1 -1
  352. package/dist/util/config/legacyConfigGuard.d.ts +7 -0
  353. package/dist/util/config/legacyConfigGuard.d.ts.map +1 -0
  354. package/dist/util/config/legacyConfigGuard.js +187 -0
  355. package/dist/util/config/legacyConfigGuard.js.map +1 -0
  356. package/dist/util/config/legacyOptions.d.ts +75 -0
  357. package/dist/util/config/legacyOptions.d.ts.map +1 -0
  358. package/dist/util/config/legacyOptions.js +399 -0
  359. package/dist/util/config/legacyOptions.js.map +1 -0
  360. package/dist/util/config/load.d.ts +2 -2
  361. package/dist/util/config/load.d.ts.map +1 -1
  362. package/dist/util/config/load.js +3 -12
  363. package/dist/util/config/load.js.map +1 -1
  364. package/dist/util/config/schemaValidator.d.ts.map +1 -1
  365. package/dist/util/config/schemaValidator.js +26 -3
  366. package/dist/util/config/schemaValidator.js.map +1 -1
  367. package/dist/util/electronGet.d.ts +30 -32
  368. package/dist/util/electronGet.d.ts.map +1 -1
  369. package/dist/util/electronGet.js +359 -129
  370. package/dist/util/electronGet.js.map +1 -1
  371. package/dist/util/flags.d.ts +5 -5
  372. package/dist/util/flags.d.ts.map +1 -1
  373. package/dist/util/flags.js +124 -16
  374. package/dist/util/flags.js.map +1 -1
  375. package/dist/util/hash.d.ts +1 -1
  376. package/dist/util/hash.d.ts.map +1 -1
  377. package/dist/util/hash.js +1 -15
  378. package/dist/util/hash.js.map +1 -1
  379. package/dist/util/installOrRebuild.d.ts +44 -0
  380. package/dist/util/installOrRebuild.d.ts.map +1 -0
  381. package/dist/util/installOrRebuild.js +276 -0
  382. package/dist/util/installOrRebuild.js.map +1 -0
  383. package/dist/util/langs.d.ts.map +1 -1
  384. package/dist/util/langs.js +1 -0
  385. package/dist/util/langs.js.map +1 -1
  386. package/dist/util/license.d.ts.map +1 -1
  387. package/dist/util/license.js +4 -1
  388. package/dist/util/license.js.map +1 -1
  389. package/dist/util/mac/macosIconComposer.d.ts +2 -1
  390. package/dist/util/mac/macosIconComposer.d.ts.map +1 -1
  391. package/dist/util/mac/macosIconComposer.js +41 -59
  392. package/dist/util/mac/macosIconComposer.js.map +1 -1
  393. package/dist/util/mac/macosVersion.d.ts +0 -1
  394. package/dist/util/mac/macosVersion.d.ts.map +1 -1
  395. package/dist/util/mac/macosVersion.js +0 -3
  396. package/dist/util/mac/macosVersion.js.map +1 -1
  397. package/dist/util/mac/plist.d.ts +1 -1
  398. package/dist/util/mac/plist.d.ts.map +1 -1
  399. package/dist/util/mac/plist.js +6 -1
  400. package/dist/util/mac/plist.js.map +1 -1
  401. package/dist/util/nativeBinaryVerifier.d.ts +40 -0
  402. package/dist/util/nativeBinaryVerifier.d.ts.map +1 -0
  403. package/dist/util/nativeBinaryVerifier.js +381 -0
  404. package/dist/util/nativeBinaryVerifier.js.map +1 -0
  405. package/dist/util/packageMetadata.js +57 -31
  406. package/dist/util/packageMetadata.js.map +1 -1
  407. package/dist/util/repositoryInfo.js +6 -3
  408. package/dist/util/repositoryInfo.js.map +1 -1
  409. package/dist/util/resolve.js +1 -1
  410. package/dist/util/resolve.js.map +1 -1
  411. package/dist/util/streamSpawnToFile.d.ts +47 -0
  412. package/dist/util/streamSpawnToFile.d.ts.map +1 -0
  413. package/dist/util/streamSpawnToFile.js +110 -0
  414. package/dist/util/streamSpawnToFile.js.map +1 -0
  415. package/dist/util/toolsetLock.d.ts +2 -0
  416. package/dist/util/toolsetLock.d.ts.map +1 -1
  417. package/dist/util/toolsetLock.js +31 -5
  418. package/dist/util/toolsetLock.js.map +1 -1
  419. package/dist/version.d.ts +1 -1
  420. package/dist/version.d.ts.map +1 -1
  421. package/dist/version.js +1 -1
  422. package/dist/version.js.map +1 -1
  423. package/dist/vm/ParallelsVm.d.ts.map +1 -1
  424. package/dist/vm/ParallelsVm.js +29 -3
  425. package/dist/vm/ParallelsVm.js.map +1 -1
  426. package/dist/vm/vm.d.ts +2 -0
  427. package/dist/vm/vm.d.ts.map +1 -1
  428. package/dist/vm/vm.js +29 -6
  429. package/dist/vm/vm.js.map +1 -1
  430. package/dist/winPackager.d.ts +6 -5
  431. package/dist/winPackager.d.ts.map +1 -1
  432. package/dist/winPackager.js +45 -39
  433. package/dist/winPackager.js.map +1 -1
  434. package/package.json +19 -18
  435. package/scheme.json +1731 -961
  436. package/templates/appx/appxmanifest.xml +2 -3
  437. package/templates/entitlements.mac.adhoc.plist +15 -0
  438. package/templates/entitlements.mac.plist +9 -6
  439. package/templates/msix/appxmanifest.xml +45 -0
  440. package/templates/nsis/assistedMessages.yml +17 -0
  441. package/templates/nsis/common.nsh +2 -2
  442. package/templates/nsis/include/allowOnlyOneInstallerInstance.nsh +96 -13
  443. package/templates/nsis/include/extractAppPackage.nsh +5 -2
  444. package/templates/nsis/include/installUtil.nsh +2 -2
  445. package/templates/nsis/include/installer.nsh +88 -50
  446. package/templates/nsis/include/webPackage.nsh +52 -27
  447. package/templates/nsis/installSection.nsh +29 -0
  448. package/templates/nsis/installer.nsi +1 -1
  449. package/templates/nsis/messages.yml +5 -0
  450. package/templates/nsis/multiUserUi.nsh +1 -1
  451. package/dist/codeSign/signManager.d.ts +0 -14
  452. package/dist/codeSign/signManager.d.ts.map +0 -1
  453. package/dist/codeSign/signManager.js +0 -2
  454. package/dist/codeSign/signManager.js.map +0 -1
  455. package/dist/util/yarn.d.ts +0 -23
  456. package/dist/util/yarn.d.ts.map +0 -1
  457. package/dist/util/yarn.js +0 -153
  458. package/dist/util/yarn.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"packageManager.js","sourceRoot":"","sources":["../../src/node-module-collector/packageManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,EAAE,MAAM,UAAU,CAAA;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAC5B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,MAAM,CAAN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DAA0D;IAC1D,IAAI,UAAU,CAAC,QAAQ,CAAC,iCAAiC,CAAC,EAAE,CAAC;QAC3D,OAAO,EAAE,CAAC,IAAI,CAAA;IAChB,CAAC;IAED,OAAO,UAAU,EAAE,IAAI,EAAE,CAAC,IAAI,CAAA;AAChC,CAAC","sourcesContent":["import { exists, log } from \"builder-util\"\nimport fs from \"fs-extra\"\nimport * as path from \"path\"\nimport * as which from \"which\"\n\nexport enum PM {\n PNPM = \"pnpm\",\n YARN = \"yarn\",\n YARN_BERRY = \"yarn-berry\",\n BUN = \"bun\",\n NPM = \"npm\",\n TRAVERSAL = \"traversal\",\n}\n\n// Cache for resolved paths\nconst pmPathCache: Record<PM, string | null | undefined> = {\n [PM.NPM]: undefined,\n [PM.YARN]: undefined,\n [PM.PNPM]: undefined,\n [PM.YARN_BERRY]: undefined,\n [PM.BUN]: undefined,\n [PM.TRAVERSAL]: undefined,\n}\n\nfunction resolveCommand(pm: PM): string {\n const fallback = pm === PM.YARN_BERRY ? \"yarn\" : pm\n\n if (process.platform !== \"win32\") {\n return fallback\n }\n\n try {\n return which.sync(fallback)\n } catch {\n // If `which` fails (not found), still return the fallback string\n return fallback\n }\n}\n\nexport function getPackageManagerCommand(pm: PM) {\n if (pmPathCache[pm] !== undefined) {\n return pmPathCache[pm]!\n }\n\n const resolved = resolveCommand(pm)\n pmPathCache[pm] = resolved\n return resolved\n}\n\ntype PackageManagerSetup = {\n pm: PM\n corepackConfig: string | undefined\n resolvedDirectory: string | undefined\n detectionMethod: string\n}\n\nexport async function detectPackageManager(searchPaths: string[]): Promise<PackageManagerSetup> {\n let pm: PM | null = null\n const dedupedPaths = Array.from(new Set(searchPaths)) // reduce file operations, dedupe paths since primary use case has projectDir === appDir\n\n const resolveIfYarn = (pm: PM, version: string, cwd: string) => (pm === PM.YARN ? detectYarnBerry(cwd, version) : pm)\n\n for (const dir of dedupedPaths) {\n const packageJsonPath = path.join(dir, \"package.json\")\n const packageManager = (await exists(packageJsonPath)) ? (await fs.readJson(packageJsonPath, \"utf8\"))?.packageManager : undefined\n if (packageManager) {\n const [pm, version] = packageManager.split(\"@\")\n if (Object.values(PM).includes(pm as PM)) {\n const resolvedPackageManager = await resolveIfYarn(pm as PM, version, dir)\n return { pm: resolvedPackageManager, corepackConfig: packageManager, resolvedDirectory: dir, detectionMethod: \"packageManager field\" }\n }\n }\n\n pm = await detectPackageManagerByFile(dir)\n if (pm) {\n const resolvedPackageManager = await resolveIfYarn(pm, \"\", dir)\n return { pm: resolvedPackageManager, resolvedDirectory: dir, corepackConfig: undefined, detectionMethod: \"lock file\" }\n }\n }\n\n pm = detectPackageManagerByEnv() || PM.NPM\n const cwd = process.env.npm_package_json ? path.dirname(process.env.npm_package_json) : (process.env.INIT_CWD ?? process.cwd())\n const resolvedPackageManager = await resolveIfYarn(pm, \"\", cwd)\n log.info({ resolvedPackageManager, detected: cwd }, \"packageManager not detected by file, falling back to environment detection\")\n return { pm: resolvedPackageManager, resolvedDirectory: undefined, corepackConfig: undefined, detectionMethod: \"process environment\" }\n}\n\nfunction detectPackageManagerByEnv(): PM | null {\n const priorityChecklist = [(key: string) => process.env.npm_config_user_agent?.includes(key), (key: string) => process.env.npm_execpath?.includes(key)]\n\n const pms = Object.values(PM).filter(pm => pm !== PM.YARN_BERRY)\n for (const checker of priorityChecklist) {\n for (const pm of pms) {\n if (checker(pm)) {\n return pm\n }\n }\n }\n return null\n}\n\nasync function detectPackageManagerByFile(dir: string): Promise<PM | null> {\n const has = (file: string) => exists(path.join(dir, file))\n\n const detected: PM[] = []\n if (await has(\"yarn.lock\")) {\n detected.push(PM.YARN)\n }\n if (await has(\"pnpm-lock.yaml\")) {\n detected.push(PM.PNPM)\n }\n if (await has(\"package-lock.json\")) {\n detected.push(PM.NPM)\n }\n if ((await has(\"bun.lock\")) || (await has(\"bun.lockb\"))) {\n detected.push(PM.BUN)\n }\n\n if (detected.length === 1) {\n return detected[0]\n }\n\n return null\n}\n\nasync function detectYarnBerry(cwd: string, version: string): Promise<PM.YARN | PM.YARN_BERRY> {\n const checkBerry = () => {\n try {\n if (parseInt(version.split(\".\")[0]) > 1) {\n return PM.YARN_BERRY\n }\n } catch (_error) {\n log.debug({ error: _error }, \"cannot determine yarn version, assuming yarn v1\")\n // If `yarn` is not found or another error occurs, fall back to the regular Yarn since we're already determined in a Yarn project\n }\n return undefined\n }\n\n if (version === \"latest\" || version === \"berry\") {\n return PM.YARN_BERRY\n }\n\n if (version.length > 0) {\n return checkBerry() ?? PM.YARN\n }\n\n const lockPath = path.join(cwd, \"yarn.lock\")\n if (!(await exists(lockPath))) {\n return checkBerry() ?? PM.YARN\n }\n // Read the first few lines of yarn.lock to determine the version\n const firstBytes = (await fs.readFile(lockPath, \"utf8\")).split(\"\\n\").slice(0, 10).join(\"\\n\")\n\n // Yarn v2+ (Berry) has a \"__metadata:\" block near the top\n if (firstBytes.includes(\"__metadata:\")) {\n return PM.YARN_BERRY\n }\n\n // Yarn v1 format is classic semi-YAML with comment header\n if (firstBytes.includes(\"DO NOT EDIT THIS FILE DIRECTLY.\")) {\n return PM.YARN\n }\n\n return checkBerry() ?? PM.YARN\n}\n"]}
1
+ {"version":3,"file":"packageManager.js","sourceRoot":"","sources":["../../src/node-module-collector/packageManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,EAAE,MAAM,UAAU,CAAA;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAC5B,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,MAAM,CAAN,IAAY,EAOX;AAPD,WAAY,EAAE;IACZ,mBAAa,CAAA;IACb,mBAAa,CAAA;IACb,+BAAyB,CAAA;IACzB,iBAAW,CAAA;IACX,iBAAW,CAAA;IACX,6BAAuB,CAAA;AACzB,CAAC,EAPW,EAAE,KAAF,EAAE,QAOb;AAED,2BAA2B;AAC3B,MAAM,WAAW,GAA0C;IACzD,CAAC,EAAE,CAAC,G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nimport which from \"which\"\n\nexport enum PM {\n PNPM = \"pnpm\",\n YARN = \"yarn\",\n YARN_BERRY = \"yarn-berry\",\n BUN = \"bun\",\n NPM = \"npm\",\n TRAVERSAL = \"traversal\",\n}\n\n// Cache for resolved paths\nconst pmPathCache: Record<PM, string | null | undefined> = {\n [PM.NPM]: undefined,\n [PM.YARN]: undefined,\n [PM.PNPM]: undefined,\n [PM.YARN_BERRY]: undefined,\n [PM.BUN]: undefined,\n [PM.TRAVERSAL]: undefined,\n}\n\nfunction resolveCommand(pm: PM): string {\n const fallback = pm === PM.YARN_BERRY ? \"yarn\" : pm\n\n if (process.platform !== \"win32\") {\n return fallback\n }\n\n try {\n return which.sync(fallback)\n } catch {\n // If `which` fails (not found), still return the fallback string\n return fallback\n }\n}\n\nexport function getPackageManagerCommand(pm: PM) {\n if (pmPathCache[pm] !== undefined) {\n return pmPathCache[pm]!\n }\n\n const resolved = resolveCommand(pm)\n pmPathCache[pm] = resolved\n return resolved\n}\n\ntype PackageManagerSetup = {\n pm: PM\n corepackConfig: string | undefined\n resolvedDirectory: string | undefined\n detectionMethod: string\n}\n\nexport async function detectPackageManager(searchPaths: string[]): Promise<PackageManagerSetup> {\n let pm: PM | null = null\n const dedupedPaths = Array.from(new Set(searchPaths)) // reduce file operations, dedupe paths since primary use case has projectDir === appDir\n\n const resolveIfYarn = (pm: PM, version: string, cwd: string) => (pm === PM.YARN ? detectYarnBerry(cwd, version) : pm)\n\n for (const dir of dedupedPaths) {\n const packageJsonPath = path.join(dir, \"package.json\")\n const packageManager = (await exists(packageJsonPath)) ? (await fs.readJson(packageJsonPath, \"utf8\"))?.packageManager : undefined\n if (packageManager) {\n const [pm, version] = packageManager.split(\"@\")\n if (Object.values(PM).includes(pm as PM)) {\n const resolvedPackageManager = await resolveIfYarn(pm as PM, version, dir)\n return { pm: resolvedPackageManager, corepackConfig: packageManager, resolvedDirectory: dir, detectionMethod: \"packageManager field\" }\n }\n }\n\n pm = await detectPackageManagerByFile(dir)\n if (pm) {\n const resolvedPackageManager = await resolveIfYarn(pm, \"\", dir)\n return { pm: resolvedPackageManager, resolvedDirectory: dir, corepackConfig: undefined, detectionMethod: \"lock file\" }\n }\n }\n\n pm = detectPackageManagerByEnv() || PM.NPM\n const cwd = process.env.npm_package_json ? path.dirname(process.env.npm_package_json) : (process.env.INIT_CWD ?? process.cwd())\n const resolvedPackageManager = await resolveIfYarn(pm, \"\", cwd)\n log.info({ resolvedPackageManager, detected: cwd }, \"packageManager not detected by file, falling back to environment detection\")\n return { pm: resolvedPackageManager, resolvedDirectory: undefined, corepackConfig: undefined, detectionMethod: \"process environment\" }\n}\n\nfunction detectPackageManagerByEnv(): PM | null {\n const priorityChecklist = [(key: string) => process.env.npm_config_user_agent?.includes(key), (key: string) => process.env.npm_execpath?.includes(key)]\n\n const pms = Object.values(PM).filter(pm => pm !== PM.YARN_BERRY)\n for (const checker of priorityChecklist) {\n for (const pm of pms) {\n if (checker(pm)) {\n return pm\n }\n }\n }\n return null\n}\n\nasync function detectPackageManagerByFile(dir: string): Promise<PM | null> {\n const has = (file: string) => exists(path.join(dir, file))\n\n const detected: PM[] = []\n if (await has(\"yarn.lock\")) {\n detected.push(PM.YARN)\n }\n if (await has(\"pnpm-lock.yaml\")) {\n detected.push(PM.PNPM)\n }\n if (await has(\"package-lock.json\")) {\n detected.push(PM.NPM)\n }\n if ((await has(\"bun.lock\")) || (await has(\"bun.lockb\"))) {\n detected.push(PM.BUN)\n }\n\n if (detected.length === 1) {\n return detected[0]\n }\n\n return null\n}\n\nasync function detectYarnBerry(cwd: string, version: string): Promise<PM.YARN | PM.YARN_BERRY> {\n const checkBerry = () => {\n try {\n if (parseInt(version.split(\".\")[0]) > 1) {\n return PM.YARN_BERRY\n }\n } catch (_error) {\n log.debug({ error: _error }, \"cannot determine yarn version, assuming yarn v1\")\n // If `yarn` is not found or another error occurs, fall back to the regular Yarn since we're already determined in a Yarn project\n }\n return undefined\n }\n\n if (version === \"latest\" || version === \"berry\") {\n return PM.YARN_BERRY\n }\n\n if (version.length > 0) {\n return checkBerry() ?? PM.YARN\n }\n\n const lockPath = path.join(cwd, \"yarn.lock\")\n if (!(await exists(lockPath))) {\n return checkBerry() ?? PM.YARN\n }\n // Read the first few lines of yarn.lock to determine the version\n const firstBytes = (await fs.readFile(lockPath, \"utf8\")).split(\"\\n\").slice(0, 10).join(\"\\n\")\n\n // Yarn v2+ (Berry) has a \"__metadata:\" block near the top\n if (firstBytes.includes(\"__metadata:\")) {\n return PM.YARN_BERRY\n }\n\n // Yarn v1 format is classic semi-YAML with comment header\n if (firstBytes.includes(\"DO NOT EDIT THIS FILE DIRECTLY.\")) {\n return PM.YARN\n }\n\n return checkBerry() ?? PM.YARN\n}\n"]}
@@ -1,6 +1,7 @@
1
+ import { Lazy } from "lazy-val";
1
2
  import { NodeModulesCollector } from "./nodeModulesCollector.js";
2
3
  import { PM } from "./packageManager.js";
3
- import { PnpmDependency } from "./types.js";
4
+ import type { PnpmDependency } from "./types.js";
4
5
  export declare class PnpmNodeModulesCollector extends NodeModulesCollector<PnpmDependency, PnpmDependency> {
5
6
  readonly installOptions: {
6
7
  manager: PM;
@@ -9,6 +10,30 @@ export declare class PnpmNodeModulesCollector extends NodeModulesCollector<PnpmD
9
10
  private _allWorkspacePackages;
10
11
  private _pnpmMajorVersion;
11
12
  private readonly pnpmVersion;
13
+ /**
14
+ * Detect pnpm's installed layout from the on-disk structure rather than from config.
15
+ * pnpm 11 ignores `node-linker` in `.npmrc` (it moved to `nodeLinker` in `pnpm-workspace.yaml`),
16
+ * so config parsing can report "not hoisted" for a hoisted install, which would disable the
17
+ * downward search needed to find version-conflicted nested deps.
18
+ *
19
+ * In the default isolated store every regular top-level package resolves — through a symlink
20
+ * on POSIX, a junction on Windows — into `node_modules/.pnpm/<name>@<ver>/node_modules/<name>`.
21
+ * In a hoisted layout the same package is a real directory directly under `node_modules`.
22
+ * `realpath` transparently follows both symlinks and junctions, so a layout is isolated iff
23
+ * *any* top-level package's real path routes through `.pnpm`. We scan rather than sample the
24
+ * first entry because `link:` packages resolve to their source (never under `.pnpm`) and could
25
+ * otherwise mask an isolated store.
26
+ */
27
+ protected isHoisted: Lazy<boolean>;
28
+ /**
29
+ * The pnpm workspace root containing `rootDir` (nearest ancestor with `pnpm-workspace.yaml`, as pnpm
30
+ * itself resolves it), or null outside a workspace or when `rootDir` is the workspace root.
31
+ */
32
+ private readonly workspaceRoot;
33
+ /** `rootDir`, then the workspace root when `rootDir` is a workspace package. */
34
+ private readonly layoutRoots;
35
+ /** Returns true if `nmDir` is an isolated (`.pnpm`) store, false if hoisted, null if it holds no packages. */
36
+ private scanNodeModulesLayout;
12
37
  /**
13
38
  * Memo for `locateFromDepOrRoot`, keyed by `name@version`. pnpm's content-addressed virtual
14
39
  * store guarantees that any given `name@version` resolves to a single location on disk, so
@@ -22,6 +47,11 @@ export declare class PnpmNodeModulesCollector extends NodeModulesCollector<PnpmD
22
47
  * every shared subtree of the pnpm list output, exploding work in deep workspaces.
23
48
  */
24
49
  private readonly collectedDeps;
50
+ /** Reverse index of `allDependencies` keyed by package name (without version). Built once on
51
+ * first access inside `extractProductionDependencyGraph`, after `allDependencies` is settled. */
52
+ private _allDepsByName;
53
+ /** The app's own node of the `pnpm list` output (the root of the production graph), set by `getTreeFromWorkspaces`. */
54
+ private rootTree;
25
55
  /**
26
56
  * Returns the workspace packages to iterate over, gated by detected pnpm version:
27
57
  * - pnpm v11+: multi-entry workspace output → return the full parsed array
@@ -29,6 +59,7 @@ export declare class PnpmNodeModulesCollector extends NodeModulesCollector<PnpmD
29
59
  */
30
60
  private get allWorkspacePackages();
31
61
  protected getArgs(): string[];
62
+ private getAllDepsByName;
32
63
  /**
33
64
  * Locate a package version, preferring the dep's own reported path before falling back to rootDir.
34
65
  * This is critical for pnpm non-hoisted (virtual store) setups where each package has its own
@@ -36,9 +67,67 @@ export declare class PnpmNodeModulesCollector extends NodeModulesCollector<PnpmD
36
67
  * versions of a dep exist in the workspace.
37
68
  */
38
69
  private locateFromDepOrRoot;
70
+ /**
71
+ * Resolve a located package to its real directory (the symlink target), leaving a non-symlinked
72
+ * hit untouched.
73
+ *
74
+ * `locatePackageVersion` returns the path it *walked*, which in pnpm's isolated store is the
75
+ * `node_modules/<name>` symlink rather than `.pnpm/<name>@<ver>/node_modules/<name>`. That
76
+ * distinction matters because the store keeps a package's dependencies as SIBLINGS inside
77
+ * `.pnpm/<name>@<ver>/node_modules/`, reachable only from the real path: searching upward from
78
+ * the symlink walks the *linking* project instead of the store and finds nothing. That is how
79
+ * `fs-extra`'s `universalify`/`jsonfile` (and `js-yaml`'s `argparse`) were silently dropped from
80
+ * the asar of an app whose `electron-updater` came from a `link:`ed checkout — pnpm reports such
81
+ * packages with no dependency tree, so `visitDep` resolves their deps from disk through here.
82
+ *
83
+ * Resolving the link is what Node itself does (`--preserve-symlinks` is off by default), which is
84
+ * why the same require works before packaging. `ModuleManager.locatePackageVersionFromCacheKey`
85
+ * and `TraversalNodeModulesCollector` already normalize this way.
86
+ */
87
+ private toRealPackage;
39
88
  protected extractProductionDependencyGraph(tree: PnpmDependency, dependencyId: string): Promise<void>;
89
+ /**
90
+ * Resolve a dependency that `pnpm list` left out of a package's tree to its `allDependencies` entry.
91
+ * The lookup goes through the copy node itself would load from `parentPath` (the package's real store
92
+ * directory), filtered by the declared range, and falls back to a name-only match only when nothing on
93
+ * disk resolves to a collected entry (a `link:` dep, whose entry is keyed by its `link:` version).
94
+ *
95
+ * A name-only lookup returns whichever version was collected first, which is wrong as soon as two
96
+ * versions of the package are installed: with the app pinning es5-ext@0.10.53 while its transitive
97
+ * d@1.0.2 needs es5-ext ^0.10.64, `d` was wired to 0.10.53 and the nested 0.10.64 copy (with its own
98
+ * esniff / event-emitter / next-tick@1.1.0 closure) vanished from the asar (#8493). pnpm 10.29.3+
99
+ * made this common, because its deduped output routes every repeated package through this recovery.
100
+ */
101
+ private resolveOmittedDependency;
40
102
  protected collectAllDependencies(_tree: PnpmDependency, _appPackageName: string): Promise<void>;
103
+ /**
104
+ * Resolve a `link:` dependency to its real on-disk source directory — never the `node_modules`
105
+ * junction pnpm creates for it. Returns null for non-link deps.
106
+ *
107
+ * Why this matters: resolving a link: dep through `node_modules` (locateFromDepOrRoot) yields the
108
+ * junction, which CI cannot read across drives. CI checks out the repo on `D:` but installs the
109
+ * app under `C:\…\Temp`, so the junction is a cross-volume link that `realpath`/`stat` fail on,
110
+ * silently dropping the package from the asar. The link target is a plain directory that reads
111
+ * fine from any drive, so we resolve straight to it.
112
+ */
113
+ private resolveLinkTarget;
114
+ private readPackageJsonAt;
115
+ /**
116
+ * Visit a single dependency node, adding it and its transitive deps to allDependencies.
117
+ *
118
+ * For packages that pnpm list did NOT expand (link: packages and the synthetic entries
119
+ * derived from them), the tree has empty dependencies/optionalDependencies. In that case
120
+ * we fall back to the on-disk package.json to discover transitive deps, resolving each one
121
+ * from the package's own node_modules first (where pnpm placed them).
122
+ */
123
+ private visitDep;
41
124
  private collectDepsRecursively;
125
+ /**
126
+ * pnpm excludes link: packages from `pnpm list --prod` output. Read the app's package.json
127
+ * directly to find any link: deps that were silently omitted and visit them so their
128
+ * transitive deps end up in allDependencies.
129
+ */
130
+ private collectOmittedLinkPackages;
42
131
  protected getTreeFromWorkspaces(tree: PnpmDependency, packageName: string): PnpmDependency;
43
132
  protected parseDependenciesTree(jsonBlob: string): Promise<PnpmDependency>;
44
133
  }
@@ -1 +1 @@
1
- {"version":3,"file":"pnpmNodeModulesCollector.d.ts","sourceRoot":"","sources":["../../src/node-module-collector/pnpmNodeModulesCollector.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAChE,OAAO,EAA4B,EAAE,EAAE,MAAM,qBAAqB,CAAA;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAE3C,qBAAa,wBAAyB,SAAQ,oBAAoB,CAAC,cAAc,EAAE,cAAc,CAAC;IAChG,SAAgB,cAAc;;;MAG7B;IAG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IACH,UAAmB,SAAS,gBAe1B;IAEF;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAC,aAAa,CAY5B;IAEF,gFAAgF;IAChF,OAAO,CAAC,QAAQ,CAAC,WAAW,CAG1B;IAEF,8GAA8G;YAChG,qBAAqB;IAwBnC;;;;;;OAMG;IACH,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAkD;IAE7E;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAyB;IAEvD;sGACkG;IAClG,OAAO,CAAC,cAAc,CAA2C;IAEjE,uHAAuH;IACvH,OAAO,CAAC,QAAQ,CAA8B;IAE9C;;;;OAIG;IACH,OAAO,KAAK,oBAAoB,GAK/B;IAED,SAAS,CAAC,OAAO,IAAI,MAAM,EAAE;IAI7B,OAAO,CAAC,gBAAgB;IAaxB;;;;;OAKG;YACW,mBAAmB;IA0DjC;;;;;;;;;;;;;;;;OAgBG;YACW,aAAa;cAYX,gCAAgC,CAAC,IAAI,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM;IAgF3F;;;;;;;;;;;OAWG;YACW,wBAAwB;cAOtB,sBAAsB,CAAC,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IASrG;;;;;;;;;OASG;IACH,OAAO,CAAC,iBAAiB;YAkBX,iBAAiB;IAK/B;;;;;;;OAOG;YACW,QAAQ;YAwDR,sBAAsB;IASpC;;;;OAIG;YACW,0BAA0B;cA+BrB,qBAAqB,CAAC,IAAI,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,GAAG,cAAc;cASnF,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;CAMjF"}
@@ -1,7 +1,10 @@
1
+ import _fsExtra from "fs-extra";
1
2
  import { Lazy } from "lazy-val";
2
- import { LogMessageByKey } from "./moduleManager.js";
3
+ import * as path from "path";
4
+ import { LogMessageByKey, readJsonOrNull } from "./moduleManager.js";
3
5
  import { NodeModulesCollector } from "./nodeModulesCollector.js";
4
6
  import { getPackageManagerCommand, PM } from "./packageManager.js";
7
+ import { exists, isValidKey } from "builder-util";
5
8
  export class PnpmNodeModulesCollector extends NodeModulesCollector {
6
9
  constructor() {
7
10
  super(...arguments);
@@ -19,6 +22,58 @@ export class PnpmNodeModulesCollector extends NodeModulesCollector {
19
22
  const major = parseInt((result.stdout ?? "0").split(".")[0], 10);
20
23
  return isNaN(major) ? 0 : major;
21
24
  });
25
+ /**
26
+ * Detect pnpm's installed layout from the on-disk structure rather than from config.
27
+ * pnpm 11 ignores `node-linker` in `.npmrc` (it moved to `nodeLinker` in `pnpm-workspace.yaml`),
28
+ * so config parsing can report "not hoisted" for a hoisted install, which would disable the
29
+ * downward search needed to find version-conflicted nested deps.
30
+ *
31
+ * In the default isolated store every regular top-level package resolves — through a symlink
32
+ * on POSIX, a junction on Windows — into `node_modules/.pnpm/<name>@<ver>/node_modules/<name>`.
33
+ * In a hoisted layout the same package is a real directory directly under `node_modules`.
34
+ * `realpath` transparently follows both symlinks and junctions, so a layout is isolated iff
35
+ * *any* top-level package's real path routes through `.pnpm`. We scan rather than sample the
36
+ * first entry because `link:` packages resolve to their source (never under `.pnpm`) and could
37
+ * otherwise mask an isolated store.
38
+ */
39
+ this.isHoisted = new Lazy(async () => {
40
+ // A workspace package's own `node_modules` is often absent (or holds only its version
41
+ // conflicts) in a hoisted workspace, so fall back to the workspace root's `node_modules`.
42
+ let sawPackage = false;
43
+ for (const dir of await this.layoutRoots.value) {
44
+ const isolated = await this.scanNodeModulesLayout(path.join(dir, "node_modules"));
45
+ if (isolated != null) {
46
+ if (isolated) {
47
+ return false;
48
+ }
49
+ sawPackage = true;
50
+ }
51
+ }
52
+ // Packages exist and none route through `.pnpm` → hoisted. No packages → flat default.
53
+ return sawPackage;
54
+ });
55
+ /**
56
+ * The pnpm workspace root containing `rootDir` (nearest ancestor with `pnpm-workspace.yaml`, as pnpm
57
+ * itself resolves it), or null outside a workspace or when `rootDir` is the workspace root.
58
+ */
59
+ this.workspaceRoot = new Lazy(async () => {
60
+ let current = path.resolve(this.rootDir);
61
+ while (true) {
62
+ if (await exists(path.join(current, "pnpm-workspace.yaml"))) {
63
+ return current === path.resolve(this.rootDir) ? null : current;
64
+ }
65
+ const parent = path.dirname(current);
66
+ if (parent === current) {
67
+ return null;
68
+ }
69
+ current = parent;
70
+ }
71
+ });
72
+ /** `rootDir`, then the workspace root when `rootDir` is a workspace package. */
73
+ this.layoutRoots = new Lazy(async () => {
74
+ const workspaceRoot = await this.workspaceRoot.value;
75
+ return workspaceRoot == null ? [this.rootDir] : [this.rootDir, workspaceRoot];
76
+ });
22
77
  /**
23
78
  * Memo for `locateFromDepOrRoot`, keyed by `name@version`. pnpm's content-addressed virtual
24
79
  * store guarantees that any given `name@version` resolves to a single location on disk, so
@@ -32,6 +87,35 @@ export class PnpmNodeModulesCollector extends NodeModulesCollector {
32
87
  * every shared subtree of the pnpm list output, exploding work in deep workspaces.
33
88
  */
34
89
  this.collectedDeps = new Set();
90
+ /** Reverse index of `allDependencies` keyed by package name (without version). Built once on
91
+ * first access inside `extractProductionDependencyGraph`, after `allDependencies` is settled. */
92
+ this._allDepsByName = null;
93
+ /** The app's own node of the `pnpm list` output (the root of the production graph), set by `getTreeFromWorkspaces`. */
94
+ this.rootTree = null;
95
+ }
96
+ /** Returns true if `nmDir` is an isolated (`.pnpm`) store, false if hoisted, null if it holds no packages. */
97
+ async scanNodeModulesLayout(nmDir) {
98
+ const entries = await _fsExtra.readdir(nmDir).catch(() => []);
99
+ let sawPackage = false;
100
+ for (const name of entries) {
101
+ if (name.startsWith(".")) {
102
+ continue; // .pnpm, .bin, .modules.yaml
103
+ }
104
+ const entryPath = path.join(nmDir, name);
105
+ // A scoped dir (@scope) is not a package itself; descend to its packages.
106
+ const candidates = name.startsWith("@") ? (await _fsExtra.readdir(entryPath).catch(() => [])).map(s => path.join(entryPath, s)) : [entryPath];
107
+ for (const candidate of candidates) {
108
+ const real = await _fsExtra.realpath(candidate).catch(() => null);
109
+ if (real == null) {
110
+ continue;
111
+ }
112
+ sawPackage = true;
113
+ if (real.split(path.sep).includes(".pnpm")) {
114
+ return true; // isolated store: a package routes through the virtual store
115
+ }
116
+ }
117
+ }
118
+ return sawPackage ? false : null;
35
119
  }
36
120
  /**
37
121
  * Returns the workspace packages to iterate over, gated by detected pnpm version:
@@ -47,6 +131,18 @@ export class PnpmNodeModulesCollector extends NodeModulesCollector {
47
131
  getArgs() {
48
132
  return ["list", "--prod", "--json", "--depth", "Infinity", "--silent", "--loglevel=error"];
49
133
  }
134
+ getAllDepsByName() {
135
+ if (!this._allDepsByName) {
136
+ this._allDepsByName = new Map();
137
+ for (const [id, dep] of this.allDependencies.entries()) {
138
+ const { name } = this.parseNameVersion(id);
139
+ if (!this._allDepsByName.has(name)) {
140
+ this._allDepsByName.set(name, dep);
141
+ }
142
+ }
143
+ }
144
+ return this._allDepsByName;
145
+ }
50
146
  /**
51
147
  * Locate a package version, preferring the dep's own reported path before falling back to rootDir.
52
148
  * This is critical for pnpm non-hoisted (virtual store) setups where each package has its own
@@ -72,17 +168,66 @@ export class PnpmNodeModulesCollector extends NodeModulesCollector {
72
168
  // land at `<root>/node_modules/A/node_modules/B` — downward BFS is needed to find them.
73
169
  const skipDownwardSearch = !(await this.isHoisted.value);
74
170
  const promise = (async () => {
171
+ // Phase 1: find a version that SATISFIES requiredRange, trying the dep's own location
172
+ // first, then the workspace root. Crucially, neither pass accepts an out-of-range override
173
+ // here — so a wrong-version copy reachable via upward search from `parentPath` (e.g. a
174
+ // hoisted top-level dep) can't shadow the correct nested copy under root. Without this, a
175
+ // package that pnpm deduped to a peer's node_modules resolves its transitive deps to the
176
+ // wrong hoisted version (see jsonfile under two fs-extra majors). The root pass uses the
177
+ // same `skipDownwardSearch` as everywhere else: in a hoisted layout it is already false, so
178
+ // the nested `<root>/node_modules/A/node_modules/B` copy is found via BFS; in the flat
179
+ // `.pnpm` virtual store it stays true (forcing it on there would burn thousands of
180
+ // readdir/lstat calls — and on Windows, where pnpm uses junctions that `lstat` reports as
181
+ // directories, the BFS walks the entire store and resolves the wrong paths).
182
+ //
183
+ // When `rootDir` is a workspace package, a hoisted install keeps the tree — including the
184
+ // nested `<workspaceRoot>/node_modules/A/node_modules/B` copies — under the workspace root,
185
+ // which the downward BFS from `rootDir` never reaches (its `node_modules` is often absent),
186
+ // so search the workspace root last.
187
+ let satisfying = parentPath ? await this.cache.locatePackageVersion({ pkgName, parentDir: parentPath, requiredRange, skipDownwardSearch, skipOverrideFallback: true }) : null;
188
+ for (const dir of await this.layoutRoots.value) {
189
+ satisfying ??= await this.cache.locatePackageVersion({ pkgName, parentDir: dir, requiredRange, skipDownwardSearch, skipOverrideFallback: true });
190
+ }
191
+ if (satisfying) {
192
+ return satisfying;
193
+ }
194
+ // Phase 2: no version satisfies requiredRange (package-manager override, or no range
195
+ // given). Fall back to the original dep-then-root order, now allowing override versions.
75
196
  const fromDep = parentPath ? await this.cache.locatePackageVersion({ pkgName, parentDir: parentPath, requiredRange, skipDownwardSearch }) : null;
76
197
  if (fromDep) {
77
198
  return fromDep;
78
199
  }
79
200
  return this.cache.locatePackageVersion({ pkgName, parentDir: this.rootDir, requiredRange, skipDownwardSearch });
80
- })();
201
+ })().then(pkg => this.toRealPackage(pkg));
81
202
  if (memoKey != null) {
82
203
  this.locateMemo.set(memoKey, promise);
83
204
  }
84
205
  return promise;
85
206
  }
207
+ /**
208
+ * Resolve a located package to its real directory (the symlink target), leaving a non-symlinked
209
+ * hit untouched.
210
+ *
211
+ * `locatePackageVersion` returns the path it *walked*, which in pnpm's isolated store is the
212
+ * `node_modules/<name>` symlink rather than `.pnpm/<name>@<ver>/node_modules/<name>`. That
213
+ * distinction matters because the store keeps a package's dependencies as SIBLINGS inside
214
+ * `.pnpm/<name>@<ver>/node_modules/`, reachable only from the real path: searching upward from
215
+ * the symlink walks the *linking* project instead of the store and finds nothing. That is how
216
+ * `fs-extra`'s `universalify`/`jsonfile` (and `js-yaml`'s `argparse`) were silently dropped from
217
+ * the asar of an app whose `electron-updater` came from a `link:`ed checkout — pnpm reports such
218
+ * packages with no dependency tree, so `visitDep` resolves their deps from disk through here.
219
+ *
220
+ * Resolving the link is what Node itself does (`--preserve-symlinks` is off by default), which is
221
+ * why the same require works before packaging. `ModuleManager.locatePackageVersionFromCacheKey`
222
+ * and `TraversalNodeModulesCollector` already normalize this way.
223
+ */
224
+ async toRealPackage(pkg) {
225
+ if (pkg == null) {
226
+ return null;
227
+ }
228
+ const packageDir = await this.cache.realPath[pkg.packageDir];
229
+ return packageDir === pkg.packageDir ? pkg : { ...pkg, packageDir };
230
+ }
86
231
  // pnpm 10+ does not automatically preserve transitive optional platform-specific
87
232
  // packages (e.g. sass-embedded-linux-x64) across lock file regeneration. Users
88
233
  // must list them as direct optionalDependencies. Missing ones are emitted as
@@ -104,10 +249,32 @@ export class PnpmNodeModulesCollector extends NodeModulesCollector {
104
249
  }
105
250
  }
106
251
  const packageName = tree.name || tree.from;
107
- const { packageJson } = (await this.locateFromDepOrRoot(packageName, tree.path, tree.version)) || {};
252
+ // The app root is never installed inside a node_modules directory, so it is read from its own
253
+ // directory instead of being located by name. A by-name lookup finds a same-named dependency
254
+ // whenever the app shares its name with one (an app called `debug` depending on `debug`), and
255
+ // that dependency's package.json would then decide which of the app's dependencies are kept.
256
+ const isRoot = tree === this.rootTree;
257
+ const { packageJson: locatedJson } = (isRoot ? null : await this.locateFromDepOrRoot(packageName, tree.path, tree.version)) || {};
258
+ // Reading directly from tree.path for the root ensures that link: dependencies — which some
259
+ // pnpm versions omit from `pnpm list --prod` output — still appear in `all` and therefore
260
+ // reach the production graph.
261
+ const packageJson = locatedJson ?? (tree.path ? await readJsonOrNull(path.join(tree.path, "package.json")) : null);
108
262
  const all = packageJson ? { ...packageJson.dependencies, ...packageJson.optionalDependencies } : { ...tree.dependencies, ...tree.optionalDependencies };
109
263
  const optional = packageJson ? { ...packageJson.optionalDependencies } : {};
110
264
  const deps = { ...(tree.dependencies || {}), ...(tree.optionalDependencies || {}) };
265
+ // pnpm --prod omits sub-deps for link: packages (and synthetic entries derived from them), and pnpm
266
+ // 10.29.3+ prints a repeated subtree only once, so every later occurrence is a childless `deduped`
267
+ // stub (which is what `tree` is when the stub was the first occurrence collected). For any dep
268
+ // declared in the package.json (all) that pnpm left out of the tree, recover the resolved entry
269
+ // from allDependencies so it lands in the production graph.
270
+ for (const [depName, declaredRange] of Object.entries(all)) {
271
+ if (!deps[depName]) {
272
+ const dep = await this.resolveOmittedDependency(depName, declaredRange, tree.path);
273
+ if (dep && isValidKey(depName)) {
274
+ deps[depName] = dep;
275
+ }
276
+ }
277
+ }
111
278
  this.productionGraph[dependencyId] = { dependencies: [] };
112
279
  const depPromises = Object.entries(deps).map(async ([packageName, dependency]) => {
113
280
  // First check if it's in production dependencies
@@ -118,7 +285,9 @@ export class PnpmNodeModulesCollector extends NodeModulesCollector {
118
285
  if (optional[packageName]) {
119
286
  const pkg = await this.locateFromDepOrRoot(packageName, tree.path, dependency.version);
120
287
  if (!pkg) {
121
- this.logMissingDependency(`${packageName}@${dependency.version}`);
288
+ // Declared in `optionalDependencies`, so a miss is an expected condition (e.g. fsevents
289
+ // on Linux/Windows) — classify it as a missing optional dependency, not PKG_NOT_ON_DISK.
290
+ this.logMissingDependency(`${packageName}@${dependency.version}`, true);
122
291
  return undefined;
123
292
  }
124
293
  }
@@ -135,44 +304,175 @@ export class PnpmNodeModulesCollector extends NodeModulesCollector {
135
304
  }
136
305
  this.productionGraph[dependencyId] = { dependencies: collectedDependencies };
137
306
  }
307
+ /**
308
+ * Resolve a dependency that `pnpm list` left out of a package's tree to its `allDependencies` entry.
309
+ * The lookup goes through the copy node itself would load from `parentPath` (the package's real store
310
+ * directory), filtered by the declared range, and falls back to a name-only match only when nothing on
311
+ * disk resolves to a collected entry (a `link:` dep, whose entry is keyed by its `link:` version).
312
+ *
313
+ * A name-only lookup returns whichever version was collected first, which is wrong as soon as two
314
+ * versions of the package are installed: with the app pinning es5-ext@0.10.53 while its transitive
315
+ * d@1.0.2 needs es5-ext ^0.10.64, `d` was wired to 0.10.53 and the nested 0.10.64 copy (with its own
316
+ * esniff / event-emitter / next-tick@1.1.0 closure) vanished from the asar (#8493). pnpm 10.29.3+
317
+ * made this common, because its deduped output routes every repeated package through this recovery.
318
+ */
319
+ async resolveOmittedDependency(depName, declaredRange, parentPath) {
320
+ const range = typeof declaredRange === "string" ? declaredRange : undefined;
321
+ const located = await this.locateFromDepOrRoot(depName, parentPath, range);
322
+ const exact = located ? this.allDependencies.get(`${depName}@${located.packageJson.version}`) : undefined;
323
+ return exact ?? this.getAllDepsByName().get(depName);
324
+ }
138
325
  async collectAllDependencies(_tree, _appPackageName) {
139
326
  for (const root of this.allWorkspacePackages) {
140
327
  await this.collectDepsRecursively(root);
141
328
  }
329
+ // pnpm --prod omits link: packages from its JSON output entirely; pick them up from the
330
+ // app's package.json so their transitive deps are included in allDependencies.
331
+ await this.collectOmittedLinkPackages();
142
332
  }
143
- async collectDepsRecursively(tree) {
144
- const visit = async (key, value) => {
145
- if ((value?.dedupedDependenciesCount ?? 0) > 0) {
146
- return;
147
- }
148
- const id = `${key}@${value.version}`;
149
- // The pnpm list output can include the same `name@version` thousands of times across a
150
- // deep workspace; without this guard we re-resolve and re-recurse each occurrence.
151
- if (this.collectedDeps.has(id)) {
152
- return;
333
+ /**
334
+ * Resolve a `link:` dependency to its real on-disk source directory — never the `node_modules`
335
+ * junction pnpm creates for it. Returns null for non-link deps.
336
+ *
337
+ * Why this matters: resolving a link: dep through `node_modules` (locateFromDepOrRoot) yields the
338
+ * junction, which CI cannot read across drives. CI checks out the repo on `D:` but installs the
339
+ * app under `C:\…\Temp`, so the junction is a cross-volume link that `realpath`/`stat` fail on,
340
+ * silently dropping the package from the asar. The link target is a plain directory that reads
341
+ * fine from any drive, so we resolve straight to it.
342
+ */
343
+ resolveLinkTarget(value) {
344
+ const version = value.version;
345
+ if (typeof version !== "string" || !version.startsWith("link:")) {
346
+ return null;
347
+ }
348
+ const spec = version.slice("link:".length);
349
+ // A cross-drive link cannot be expressed relative, so pnpm reports it as an absolute path —
350
+ // use it directly. Otherwise prefer pnpm's already-resolved absolute `path` (the source dir,
351
+ // never the junction), falling back to resolving the relative spec against the workspace root.
352
+ if (path.isAbsolute(spec)) {
353
+ return path.normalize(spec);
354
+ }
355
+ if (value.path && path.isAbsolute(value.path)) {
356
+ return path.normalize(value.path);
357
+ }
358
+ return path.resolve(this.rootDir, spec);
359
+ }
360
+ async readPackageJsonAt(dir) {
361
+ const packageJson = await readJsonOrNull(path.join(dir, "package.json"));
362
+ return packageJson ? { packageDir: dir, packageJson } : null;
363
+ }
364
+ /**
365
+ * Visit a single dependency node, adding it and its transitive deps to allDependencies.
366
+ *
367
+ * For packages that pnpm list did NOT expand (link: packages and the synthetic entries
368
+ * derived from them), the tree has empty dependencies/optionalDependencies. In that case
369
+ * we fall back to the on-disk package.json to discover transitive deps, resolving each one
370
+ * from the package's own node_modules first (where pnpm placed them).
371
+ */
372
+ async visitDep(key, value) {
373
+ const id = `${key}@${value.version}`;
374
+ // The pnpm list output can include the same `name@version` thousands of times across a
375
+ // deep workspace; without this guard we re-resolve and re-recurse each occurrence.
376
+ if (this.collectedDeps.has(id)) {
377
+ return;
378
+ }
379
+ this.collectedDeps.add(id);
380
+ const located = await this.locateFromDepOrRoot(key, value.path, value.version);
381
+ // For a link: dep, store the real source dir (the link target) rather than the located path,
382
+ // which is the node_modules junction. Across drives that junction is unreadable (see
383
+ // resolveLinkTarget), so storing it makes the package vanish from the asar.
384
+ const linkTarget = this.resolveLinkTarget(value);
385
+ const resolvedPath = linkTarget ?? located?.packageDir ?? value.path;
386
+ this.allDependencies.set(id, { ...value, path: resolvedPath });
387
+ // For transitive-dep discovery of entries pnpm did not expand (link: packages), use the
388
+ // located package.json; fall back to reading it straight from the resolved directory when the
389
+ // by-name lookup came up empty. That happens whenever the package does not sit inside a
390
+ // `node_modules/<name>` directory it can find itself in: a cross-drive link target whose
391
+ // junction is unreadable, and a workspace package such as `packages/builder-util-runtime`,
392
+ // which nothing above it exposes under `node_modules/`. Without this fallback such a package
393
+ // contributes no dependencies at all (its `debug`/`sax` would vanish from the asar).
394
+ const pkg = located ?? (resolvedPath != null ? await this.readPackageJsonAt(resolvedPath) : null);
395
+ const hasTreeDeps = Object.keys(value.dependencies ?? {}).length > 0 || Object.keys(value.optionalDependencies ?? {}).length > 0;
396
+ if (!hasTreeDeps && pkg?.packageJson) {
397
+ // pnpm list omits sub-deps for link: packages and for entries where the reported path
398
+ // doesn't expand transitive deps (e.g. a link: package's nested dep). Use the on-disk
399
+ // package.json to discover what to include, and pass the declared version range so that
400
+ // resolution skips wrong-version hoisted packages and finds the correct nested copy.
401
+ const pkgOptionalDecl = pkg.packageJson.optionalDependencies || {};
402
+ const pkgDepsDecl = { ...(pkg.packageJson.dependencies || {}), ...pkgOptionalDecl };
403
+ for (const [depName, depRange] of Object.entries(pkgDepsDecl)) {
404
+ const resolved = await this.locateFromDepOrRoot(depName, pkg.packageDir, typeof depRange === "string" ? depRange : undefined);
405
+ if (!resolved) {
406
+ // A miss here silently ships a broken app (the dependency is simply absent from the
407
+ // asar and only fails at runtime with MODULE_NOT_FOUND), so surface it in the log
408
+ // summary. Optional deps are an expected miss and get the quieter bucket.
409
+ this.logMissingDependency(`${depName}@${depRange}`, pkgOptionalDecl[depName] != null);
410
+ continue;
411
+ }
412
+ await this.visitDep(depName, {
413
+ from: depName,
414
+ name: depName,
415
+ version: resolved.packageJson.version,
416
+ path: resolved.packageDir,
417
+ dependencies: {},
418
+ optionalDependencies: {},
419
+ });
153
420
  }
154
- this.collectedDeps.add(id);
155
- const pkg = await this.locateFromDepOrRoot(key, value.path, value.version);
156
- this.allDependencies.set(id, { ...value, path: pkg?.packageDir ?? value.path });
421
+ }
422
+ else {
157
423
  await this.collectDepsRecursively(value);
158
- };
424
+ }
425
+ }
426
+ async collectDepsRecursively(tree) {
159
427
  for (const [key, value] of Object.entries(tree.dependencies || {})) {
160
- await visit(key, value);
428
+ await this.visitDep(key, value);
161
429
  }
162
430
  for (const [key, value] of Object.entries(tree.optionalDependencies || {})) {
163
- await visit(key, value);
431
+ await this.visitDep(key, value);
432
+ }
433
+ }
434
+ /**
435
+ * pnpm excludes link: packages from `pnpm list --prod` output. Read the app's package.json
436
+ * directly to find any link: deps that were silently omitted and visit them so their
437
+ * transitive deps end up in allDependencies.
438
+ */
439
+ async collectOmittedLinkPackages() {
440
+ const appPkgJson = await readJsonOrNull(path.join(this.rootDir, "package.json"));
441
+ if (!appPkgJson) {
442
+ return;
443
+ }
444
+ const allDeps = { ...(appPkgJson.dependencies || {}), ...(appPkgJson.optionalDependencies || {}) };
445
+ for (const [name, version] of Object.entries(allDeps)) {
446
+ if (typeof version !== "string" || !version.startsWith("link:")) {
447
+ continue;
448
+ }
449
+ // Resolve the link: target path directly — bypasses potentially broken cross-drive
450
+ // Windows junctions (C:→D:) that locateFromDepOrRoot would traverse through
451
+ // node_modules and silently fail on (readJson returns null via .catch).
452
+ const linkRelPath = version.slice("link:".length);
453
+ const linkTarget = path.isAbsolute(linkRelPath) ? linkRelPath : path.resolve(this.rootDir, linkRelPath);
454
+ const directPkg = await readJsonOrNull(path.join(linkTarget, "package.json"));
455
+ const resolved = directPkg ? { packageDir: linkTarget, packageJson: directPkg } : await this.locateFromDepOrRoot(name, this.rootDir, undefined);
456
+ if (!resolved) {
457
+ continue;
458
+ }
459
+ await this.visitDep(name, {
460
+ from: name,
461
+ name,
462
+ version: resolved.packageJson.version,
463
+ path: resolved.packageDir,
464
+ dependencies: {},
465
+ optionalDependencies: {},
466
+ });
164
467
  }
165
468
  }
166
469
  getTreeFromWorkspaces(tree, packageName) {
167
470
  // pnpm v10 workspace: app is nested as a dependency of root — handled by base class
168
471
  const result = super.getTreeFromWorkspaces(tree, packageName);
169
- if (result !== tree) {
170
- return result;
171
- }
172
472
  // pnpm v11 workspace: each workspace package is a separate top-level array entry;
173
473
  // non-workspace (single-tree): find returns the one entry or undefined → falls back to tree
174
- const match = this.allWorkspacePackages.find(pkg => pkg.name === packageName || pkg.from === packageName);
175
- return match ?? tree;
474
+ this.rootTree = result !== tree ? result : (this.allWorkspacePackages.find(pkg => pkg.name === packageName || pkg.from === packageName) ?? tree);
475
+ return this.rootTree;
176
476
  }
177
477
  async parseDependenciesTree(jsonBlob) {
178
478
  const dependencyTree = this.extractJsonFromPollutedOutput(jsonBlob);