app-builder-lib 27.0.0-alpha.7 → 27.0.0-alpha.9

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 (217) hide show
  1. package/dist/asar/asarUtil.js +21 -11
  2. package/dist/asar/asarUtil.js.map +1 -1
  3. package/dist/codeSign/mac/macCodeSign.d.ts.map +1 -1
  4. package/dist/codeSign/mac/macCodeSign.js +6 -4
  5. package/dist/codeSign/mac/macCodeSign.js.map +1 -1
  6. package/dist/codeSign/signResult.d.ts +26 -0
  7. package/dist/codeSign/signResult.d.ts.map +1 -0
  8. package/dist/codeSign/signResult.js +12 -0
  9. package/dist/codeSign/signResult.js.map +1 -0
  10. package/dist/codeSign/win/signManager.d.ts +2 -1
  11. package/dist/codeSign/win/signManager.d.ts.map +1 -1
  12. package/dist/codeSign/win/signManager.js.map +1 -1
  13. package/dist/codeSign/win/signtoolBaseSignManager.d.ts +2 -1
  14. package/dist/codeSign/win/signtoolBaseSignManager.d.ts.map +1 -1
  15. package/dist/codeSign/win/signtoolBaseSignManager.js +3 -3
  16. package/dist/codeSign/win/signtoolBaseSignManager.js.map +1 -1
  17. package/dist/codeSign/win/windowsCodeSign.d.ts +2 -1
  18. package/dist/codeSign/win/windowsCodeSign.d.ts.map +1 -1
  19. package/dist/codeSign/win/windowsCodeSign.js +16 -7
  20. package/dist/codeSign/win/windowsCodeSign.js.map +1 -1
  21. package/dist/codeSign/win/windowsSignAzureManager.d.ts +2 -1
  22. package/dist/codeSign/win/windowsSignAzureManager.d.ts.map +1 -1
  23. package/dist/codeSign/win/windowsSignAzureManager.js +2 -2
  24. package/dist/codeSign/win/windowsSignAzureManager.js.map +1 -1
  25. package/dist/configuration.d.ts +45 -4
  26. package/dist/configuration.d.ts.map +1 -1
  27. package/dist/configuration.js.map +1 -1
  28. package/dist/core.d.ts +5 -0
  29. package/dist/core.d.ts.map +1 -1
  30. package/dist/core.js.map +1 -1
  31. package/dist/electron/ElectronFramework.d.ts +2 -1
  32. package/dist/electron/ElectronFramework.d.ts.map +1 -1
  33. package/dist/electron/ElectronFramework.js +14 -7
  34. package/dist/electron/ElectronFramework.js.map +1 -1
  35. package/dist/electron/mac/electronMac.js +2 -6
  36. package/dist/electron/mac/electronMac.js.map +1 -1
  37. package/dist/fileMatcher.d.ts.map +1 -1
  38. package/dist/fileMatcher.js +1 -0
  39. package/dist/fileMatcher.js.map +1 -1
  40. package/dist/index.d.ts +1 -0
  41. package/dist/index.d.ts.map +1 -1
  42. package/dist/index.js +14 -1
  43. package/dist/index.js.map +1 -1
  44. package/dist/indexInternal.d.ts +9 -2
  45. package/dist/indexInternal.d.ts.map +1 -1
  46. package/dist/indexInternal.js +8 -2
  47. package/dist/indexInternal.js.map +1 -1
  48. package/dist/linuxPackager.d.ts.map +1 -1
  49. package/dist/linuxPackager.js +19 -1
  50. package/dist/linuxPackager.js.map +1 -1
  51. package/dist/macPackager.d.ts +16 -8
  52. package/dist/macPackager.d.ts.map +1 -1
  53. package/dist/macPackager.js +78 -30
  54. package/dist/macPackager.js.map +1 -1
  55. package/dist/node-module-collector/index.d.ts.map +1 -1
  56. package/dist/node-module-collector/index.js +47 -16
  57. package/dist/node-module-collector/index.js.map +1 -1
  58. package/dist/node-module-collector/moduleManager.d.ts.map +1 -1
  59. package/dist/node-module-collector/moduleManager.js +16 -8
  60. package/dist/node-module-collector/moduleManager.js.map +1 -1
  61. package/dist/node-module-collector/nodeModulesCollector.d.ts +7 -2
  62. package/dist/node-module-collector/nodeModulesCollector.d.ts.map +1 -1
  63. package/dist/node-module-collector/nodeModulesCollector.js +13 -17
  64. package/dist/node-module-collector/nodeModulesCollector.js.map +1 -1
  65. package/dist/node-module-collector/pnpmNodeModulesCollector.d.ts +44 -4
  66. package/dist/node-module-collector/pnpmNodeModulesCollector.d.ts.map +1 -1
  67. package/dist/node-module-collector/pnpmNodeModulesCollector.js +130 -34
  68. package/dist/node-module-collector/pnpmNodeModulesCollector.js.map +1 -1
  69. package/dist/options/PlatformSpecificBuildOptions.d.ts +31 -2
  70. package/dist/options/PlatformSpecificBuildOptions.d.ts.map +1 -1
  71. package/dist/options/PlatformSpecificBuildOptions.js.map +1 -1
  72. package/dist/options/SquirrelWindowsOptions.d.ts +0 -5
  73. package/dist/options/SquirrelWindowsOptions.d.ts.map +1 -1
  74. package/dist/options/SquirrelWindowsOptions.js.map +1 -1
  75. package/dist/options/linuxOptions.d.ts +8 -2
  76. package/dist/options/linuxOptions.d.ts.map +1 -1
  77. package/dist/options/linuxOptions.js.map +1 -1
  78. package/dist/options/macOptions.d.ts +12 -7
  79. package/dist/options/macOptions.d.ts.map +1 -1
  80. package/dist/options/macOptions.js.map +1 -1
  81. package/dist/options/pkgOptions.d.ts +1 -1
  82. package/dist/options/pkgOptions.js.map +1 -1
  83. package/dist/options/winOptions.d.ts +3 -3
  84. package/dist/options/winOptions.js.map +1 -1
  85. package/dist/packager.d.ts +2 -0
  86. package/dist/packager.d.ts.map +1 -1
  87. package/dist/packager.js +52 -2
  88. package/dist/packager.js.map +1 -1
  89. package/dist/packagerApi.d.ts +1 -1
  90. package/dist/packagerApi.d.ts.map +1 -1
  91. package/dist/packagerApi.js.map +1 -1
  92. package/dist/platformPackager.d.ts +15 -2
  93. package/dist/platformPackager.d.ts.map +1 -1
  94. package/dist/platformPackager.js +31 -5
  95. package/dist/platformPackager.js.map +1 -1
  96. package/dist/publish/PublishManager.d.ts.map +1 -1
  97. package/dist/publish/PublishManager.js +126 -7
  98. package/dist/publish/PublishManager.js.map +1 -1
  99. package/dist/publish/updateInfoBuilder.d.ts.map +1 -1
  100. package/dist/publish/updateInfoBuilder.js +61 -6
  101. package/dist/publish/updateInfoBuilder.js.map +1 -1
  102. package/dist/targets/ArchiveTarget.js +1 -1
  103. package/dist/targets/ArchiveTarget.js.map +1 -1
  104. package/dist/targets/archive.d.ts +12 -0
  105. package/dist/targets/archive.d.ts.map +1 -1
  106. package/dist/targets/archive.js +44 -1
  107. package/dist/targets/archive.js.map +1 -1
  108. package/dist/targets/differentialUpdateInfoBuilder.d.ts +2 -1
  109. package/dist/targets/differentialUpdateInfoBuilder.d.ts.map +1 -1
  110. package/dist/targets/differentialUpdateInfoBuilder.js +2 -2
  111. package/dist/targets/differentialUpdateInfoBuilder.js.map +1 -1
  112. package/dist/targets/linux/FlatpakTarget.d.ts.map +1 -1
  113. package/dist/targets/linux/FlatpakTarget.js +5 -1
  114. package/dist/targets/linux/FlatpakTarget.js.map +1 -1
  115. package/dist/targets/linux/FpmTarget.d.ts +7 -0
  116. package/dist/targets/linux/FpmTarget.d.ts.map +1 -1
  117. package/dist/targets/linux/FpmTarget.js +45 -4
  118. package/dist/targets/linux/FpmTarget.js.map +1 -1
  119. package/dist/targets/linux/LinuxTargetHelper.d.ts +1 -0
  120. package/dist/targets/linux/LinuxTargetHelper.d.ts.map +1 -1
  121. package/dist/targets/linux/LinuxTargetHelper.js +17 -1
  122. package/dist/targets/linux/LinuxTargetHelper.js.map +1 -1
  123. package/dist/targets/linux/snap/core24.js +3 -3
  124. package/dist/targets/linux/snap/core24.js.map +1 -1
  125. package/dist/targets/linux/snap/coreLegacy.js +1 -1
  126. package/dist/targets/linux/snap/coreLegacy.js.map +1 -1
  127. package/dist/targets/mac/MacTargetHelper.d.ts +75 -7
  128. package/dist/targets/mac/MacTargetHelper.d.ts.map +1 -1
  129. package/dist/targets/mac/MacTargetHelper.js +296 -38
  130. package/dist/targets/mac/MacTargetHelper.js.map +1 -1
  131. package/dist/targets/mac/pkg.d.ts +16 -0
  132. package/dist/targets/mac/pkg.d.ts.map +1 -1
  133. package/dist/targets/mac/pkg.js +27 -1
  134. package/dist/targets/mac/pkg.js.map +1 -1
  135. package/dist/targets/win/MsiTarget.d.ts.map +1 -1
  136. package/dist/targets/win/MsiTarget.js +6 -3
  137. package/dist/targets/win/MsiTarget.js.map +1 -1
  138. package/dist/targets/win/nsis/Defines.d.ts +2 -0
  139. package/dist/targets/win/nsis/Defines.d.ts.map +1 -1
  140. package/dist/targets/win/nsis/Defines.js.map +1 -1
  141. package/dist/targets/win/nsis/NsisTarget.d.ts +18 -0
  142. package/dist/targets/win/nsis/NsisTarget.d.ts.map +1 -1
  143. package/dist/targets/win/nsis/NsisTarget.js +79 -19
  144. package/dist/targets/win/nsis/NsisTarget.js.map +1 -1
  145. package/dist/targets/win/nsis/WebInstallerTarget.d.ts.map +1 -1
  146. package/dist/targets/win/nsis/WebInstallerTarget.js +19 -12
  147. package/dist/targets/win/nsis/WebInstallerTarget.js.map +1 -1
  148. package/dist/targets/win/nsis/nsisOptions.d.ts +29 -4
  149. package/dist/targets/win/nsis/nsisOptions.d.ts.map +1 -1
  150. package/dist/targets/win/nsis/nsisOptions.js.map +1 -1
  151. package/dist/toolsets/7zip.d.ts +32 -0
  152. package/dist/toolsets/7zip.d.ts.map +1 -1
  153. package/dist/toolsets/7zip.js +39 -13
  154. package/dist/toolsets/7zip.js.map +1 -1
  155. package/dist/toolsets/linuxToolsMac.d.ts.map +1 -1
  156. package/dist/toolsets/linuxToolsMac.js +15 -5
  157. package/dist/toolsets/linuxToolsMac.js.map +1 -1
  158. package/dist/toolsets/wine.d.ts.map +1 -1
  159. package/dist/toolsets/wine.js +17 -12
  160. package/dist/toolsets/wine.js.map +1 -1
  161. package/dist/util/NodeModuleCopyHelper.js +12 -4
  162. package/dist/util/NodeModuleCopyHelper.js.map +1 -1
  163. package/dist/util/appFileCopier.d.ts +5 -0
  164. package/dist/util/appFileCopier.d.ts.map +1 -1
  165. package/dist/util/appFileCopier.js +39 -1
  166. package/dist/util/appFileCopier.js.map +1 -1
  167. package/dist/util/config/config.d.ts.map +1 -1
  168. package/dist/util/config/config.js +4 -0
  169. package/dist/util/config/config.js.map +1 -1
  170. package/dist/util/config/legacyConfigGuard.d.ts +7 -0
  171. package/dist/util/config/legacyConfigGuard.d.ts.map +1 -0
  172. package/dist/util/config/legacyConfigGuard.js +187 -0
  173. package/dist/util/config/legacyConfigGuard.js.map +1 -0
  174. package/dist/util/config/legacyOptions.d.ts +73 -0
  175. package/dist/util/config/legacyOptions.d.ts.map +1 -0
  176. package/dist/util/config/legacyOptions.js +369 -0
  177. package/dist/util/config/legacyOptions.js.map +1 -0
  178. package/dist/util/config/schemaValidator.d.ts.map +1 -1
  179. package/dist/util/config/schemaValidator.js +16 -0
  180. package/dist/util/config/schemaValidator.js.map +1 -1
  181. package/dist/util/electronGet.d.ts +11 -4
  182. package/dist/util/electronGet.d.ts.map +1 -1
  183. package/dist/util/electronGet.js +63 -3
  184. package/dist/util/electronGet.js.map +1 -1
  185. package/dist/util/flags.d.ts +5 -0
  186. package/dist/util/flags.d.ts.map +1 -1
  187. package/dist/util/flags.js +124 -1
  188. package/dist/util/flags.js.map +1 -1
  189. package/dist/util/installOrRebuild.d.ts +6 -0
  190. package/dist/util/installOrRebuild.d.ts.map +1 -1
  191. package/dist/util/installOrRebuild.js +47 -0
  192. package/dist/util/installOrRebuild.js.map +1 -1
  193. package/dist/util/packageMetadata.js +11 -0
  194. package/dist/util/packageMetadata.js.map +1 -1
  195. package/dist/util/repositoryInfo.js +6 -3
  196. package/dist/util/repositoryInfo.js.map +1 -1
  197. package/dist/util/resolve.js +1 -1
  198. package/dist/util/resolve.js.map +1 -1
  199. package/dist/version.d.ts +1 -1
  200. package/dist/version.js +1 -1
  201. package/dist/version.js.map +1 -1
  202. package/dist/winPackager.d.ts +4 -3
  203. package/dist/winPackager.d.ts.map +1 -1
  204. package/dist/winPackager.js +22 -16
  205. package/dist/winPackager.js.map +1 -1
  206. package/package.json +12 -12
  207. package/scheme.json +396 -49
  208. package/templates/entitlements.mac.adhoc.plist +15 -0
  209. package/templates/entitlements.mac.plist +9 -6
  210. package/templates/nsis/common.nsh +2 -2
  211. package/templates/nsis/include/allowOnlyOneInstallerInstance.nsh +68 -4
  212. package/templates/nsis/include/extractAppPackage.nsh +1 -1
  213. package/templates/nsis/include/installUtil.nsh +2 -2
  214. package/templates/nsis/include/installer.nsh +2 -31
  215. package/templates/nsis/include/webPackage.nsh +33 -23
  216. package/templates/nsis/installer.nsi +1 -1
  217. package/templates/nsis/multiUserUi.nsh +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"nodeModulesCollector.js","sourceRoot":"","sources":["../../src/node-module-collector/nodeModulesCollector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,qBAAqB,EAAU,MAAM,cAAc,CAAA;AAChF,OAAO,QAAQ,MAAM,UAAU,CAAA;AAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAC/B,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAC5B,OAAO,EAAE,KAAK,EAAwC,MAAM,YAAY,CAAA;AACxE,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AACnE,OAAO,EAAE,wBAAwB,EAAM,MAAM,qBAAqB,CAAA;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAA;AAEhE,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAA;AAQlE,MAAM,OAAgB,oBAAoB;IAsBxC,YACqB,OAAe,EACjB,cAAsB;QADpB,YAAO,GAAP,OAAO,CAAQ;QACjB,mBAAc,GAAd,cAAc,CAAQ;QAvBxB,gBAAW,GAAqB,EAAE,CAAA;QAChC,oBAAe,GAA6B,IAAI,GAAG,EAAE,CAAA;QACrD,oBAAe,GAAoB,EAAE,CAAA;QACrC,UAAK,GAAkB,IAAI,aAAa,EAAE,CAAA;QAEnD,cAAS,GAAG,IAAI,IAAI,CAAU,KAAK,IAAI,EAAE;YACjD,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,cAAc,CAAA;YACvC,MAAM,OAAO,GAAG,wBAAwB,CAAC,OAAO,CAAC,CAAA;YACjD,MAAM,MAAM,GAAG,CAAC,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAA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CAAC,CAAA;QAC5F,IAAI,YAAY,EAAE,CAAC;YACjB,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,uIAAuI,CAAC,CAAA;QAC1J,CAAC;QACD,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACtB,GAAG,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,EAAE,wDAAwD,CAAC,CAAA;YAC/E,yFAAyF;YACzF,qFAAqF;YACrF,uFAAuF;YACvF,yEAAyE;YACzE,IAAI,CAAC,YAAY,EAAE,CAAC;gBAClB,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,eAAe,CAAC,oBAAoB,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;YAC1E,CAAC;QACH,CAAC;QACD,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;YAChC,MAAM,IAAI,KAAK,CAAC,kDAAkD,IAAI,MAAM,MAAM,EAAE,CAAC,CAAA;QACvF,CAAC;IACH,CAAC;CACF","sourcesContent":["import { exists, log, retry, stripSensitiveEnvVars, TmpDir } from \"builder-util\"\nimport _fsExtra from \"fs-extra\"\nimport { Lazy } from \"lazy-val\"\nimport * as path from \"path\"\nimport { hoist, type HoisterResult, type HoisterTree } from \"./hoist.js\"\nimport { LogMessageByKey, ModuleManager } from \"./moduleManager.js\"\nimport { getPackageManagerCommand, PM } from \"./packageManager.js\"\nimport { streamSpawnToFile } from \"../util/streamSpawnToFile.js\"\nimport type { Dependency, DependencyGraph, NodeModuleInfo, PackageJson } from \"./types.js\"\nimport { isPackageCompatible } from \"../util/archCompatibility.js\"\n\n/** Target arch/platform used to drop `cpu`/`os`-incompatible packages while collecting. */\nexport interface ArchFilter {\n cpu: string | null\n os: string\n}\n\nexport abstract class NodeModulesCollector<ProdDepType extends Dependency<ProdDepType, OptionalDepType>, OptionalDepType> {\n private readonly nodeModules: NodeModuleInfo[] = []\n protected readonly allDependencies: Map<string, ProdDepType> = new Map()\n protected readonly productionGraph: DependencyGraph = {}\n protected readonly cache: ModuleManager = new ModuleManager()\n\n protected isHoisted = new Lazy<boolean>(async () => {\n const { manager } = this.installOptions\n const command = getPackageManagerCommand(manager)\n const config = (await this.asyncExec(command, [\"config\", \"list\"])).stdout\n if (config == null) {\n log.debug({ manager }, \"unable to determine node-linker setting; assuming non-hoisted (virtual store) layout\")\n return false\n }\n const lines = Object.fromEntries(config.split(\"\\n\").map(line => line.split(\"=\").map(s => s.trim())))\n if (lines[\"node-linker\"] === \"hoisted\") {\n log.debug({ manager }, \"node_modules are hoisted\")\n return true\n }\n return false\n })\n\n constructor(\n protected readonly rootDir: string,\n private readonly tempDirManager: TmpDir\n ) {}\n\n /**\n * Retrieves and collects all Node.js modules for a given package.\n *\n * This method orchestrates the entire module collection process by:\n * 1. Fetching the dependency tree from the package manager\n * 2. Collecting all dependencies recursively\n * 3. Extracting workspace references if applicable\n * 4. Building a production dependency graph\n * 5. Hoisting the dependencies to their final locations\n * 6. Resolving and returning module information\n */\n public async getNodeModules({\n packageName,\n archFilter,\n ignoredDependencies,\n }: {\n packageName: string\n archFilter?: ArchFilter\n ignoredDependencies?: ReadonlyArray<string>\n }): Promise<{\n nodeModules: NodeModuleInfo[]\n logSummary: ModuleManager[\"logSummary\"]\n }> {\n const tree: ProdDepType = await this.getDependenciesTree(this.installOptions.manager)\n\n await this.collectAllDependencies(tree, packageName)\n const realTree: ProdDepType = this.getTreeFromWorkspaces(tree, packageName)\n await this.extractProductionDependencyGraph(realTree, packageName)\n\n this.markExcludedModules(this.productionGraph, packageName, ignoredDependencies ?? [])\n\n const hoisterResult: HoisterResult = hoist(this.transformToHoisterTree(this.productionGraph, packageName), {\n check: log.isDebugEnabled,\n })\n\n await this._getNodeModules(hoisterResult.dependencies, this.nodeModules, archFilter)\n\n log.debug({ packageName, depCount: this.nodeModules.length }, \"node modules collection complete\")\n\n return { nodeModules: this.nodeModules, logSummary: this.cache.logSummary }\n }\n\n public abstract readonly installOptions: {\n manager: PM\n lockfile: string\n }\n\n protected abstract getArgs(): string[]\n protected abstract extractProductionDependencyGraph(tree: Dependency<ProdDepType, OptionalDepType>, dependencyId: string): Promise<void>\n protected abstract collectAllDependencies(tree: Dependency<ProdDepType, OptionalDepType>, appPackageName: string): Promise<void>\n\n /**\n * Retrieves the dependency tree from the package manager.\n *\n * Executes the appropriate package manager command to fetch the dependency tree and writes\n * the output to a temporary file. Includes retry logic to handle transient failures such as\n * incomplete JSON output or missing files. Will retry up to 1 time with exponential backoff.\n */\n protected async getDependenciesTree(pm: PM): Promise<ProdDepType> {\n const command = getPackageManagerCommand(pm)\n const args = this.getArgs()\n\n const tempOutputFile = await this.tempDirManager.getTempFile({\n prefix: path.basename(command, path.extname(command)),\n suffix: \"output.json\",\n })\n\n return retry(\n async () => {\n await this.streamCollectorCommandToFile(command, args, this.rootDir, tempOutputFile)\n const shellOutput = await _fsExtra.readFile(tempOutputFile, { encoding: \"utf8\" })\n const result = await Promise.resolve(this.parseDependenciesTree(shellOutput))\n return result\n },\n {\n retries: 1,\n interval: 2000,\n backoff: 2000,\n shouldRetry: async (error: any) => {\n const fields: Record<string, string> = { error: error.message, tempOutputFile, cwd: this.rootDir, packageManager: pm }\n\n if (!(await exists(tempOutputFile))) {\n log.debug(fields, \"dependency tree output file missing, retrying\")\n return true\n }\n\n const fileContent = await _fsExtra.readFile(tempOutputFile, { encoding: \"utf8\" })\n fields.fileContentLength = fileContent.length.toString()\n\n if (fileContent.trim().length === 0) {\n log.debug(fields, \"dependency tree output file empty, retrying\")\n return true\n }\n\n // extract small start/end sample for debugging purposes (e.g. polluted console output)\n const lines = fileContent.split(\"\\n\")\n const lineSampleSize = Math.min(5, lines.length / 2)\n if (2 * lineSampleSize > 5) {\n fields.sampleStart = lines.slice(0, lineSampleSize).join(\"\\n\")\n fields.sampleEnd = lines.slice(-lineSampleSize).join(\"\\n\")\n } else {\n fields.content = fileContent\n }\n\n // Both indicate truncated/polluted PM output (a transient that re-running the command clears).\n if (error.message?.includes(\"Unexpected end of JSON input\") || error.message?.includes(\"No JSON content found in output\")) {\n log.debug(fields, \"JSON parse error in dependency tree, retrying\")\n return true\n }\n\n log.error(fields, \"error parsing dependencies tree\")\n return false\n },\n }\n )\n }\n\n /**\n * Parses the dependencies tree from shell command output.\n *\n **/\n protected parseDependenciesTree(shellOutput: string): ProdDepType | Promise<ProdDepType> {\n return this.extractJsonFromPollutedOutput<ProdDepType>(shellOutput)\n }\n\n protected extractJsonFromPollutedOutput<T>(shellOutput: string): T {\n const consoleOutput = shellOutput.trim()\n try {\n // Please for the love of all that is holy, this should cover 99% of cases where npm/pnpm/yarn output is clean JSON\n return JSON.parse(consoleOutput)\n } catch {\n // ignore\n }\n\n // DEDICATED FALLBACK FOR POLLUTED OUTPUT, non-trivial to implement correctly, not needed in most cases, and highly inefficient\n\n // Find the first index that starts with { or [\n const bracketOpen = Math.max(consoleOutput.indexOf(\"{\"), 0)\n const bracketOpenSquare = Math.max(consoleOutput.indexOf(\"[\"), 0)\n const start = Math.min(bracketOpen, bracketOpenSquare) // always non-negative due to Math.max above\n\n for (let i = start; i < consoleOutput.length; i++) {\n const slice = consoleOutput.slice(start, i + 1)\n try {\n return JSON.parse(slice)\n } catch {\n // ignore, try next\n }\n }\n throw new Error(\"No JSON content found in output\")\n }\n\n protected cacheKey(pkg: Pick<ProdDepType, \"name\" | \"version\" | \"path\">): string {\n const rel = path.relative(this.rootDir, pkg.path)\n return `${pkg.name}::${pkg.version}::${rel ?? \".\"}`\n }\n\n // We use the key (alias name) instead of value.name for npm aliased packages\n // e.g., { \"foo\": { name: \"@scope/bar\", ... } } should be stored as \"foo@version\"\n protected normalizePackageVersion(key: string, pkg: ProdDepType) {\n return { id: `${key}@${pkg.version}`, pkgOverride: { ...pkg, name: key } }\n }\n\n /**\n * Determines if a given dependency is a production dependency of a package.\n *\n * Checks both the dependencies and optionalDependencies of a package to see if\n * the specified dependency name is listed.\n *\n * @param depName - The name of the dependency to check\n * @param pkg - The package to search for the dependency in\n * @returns True if the dependency is found in either dependencies or optionalDependencies, false otherwise\n */\n protected isProdDependency(depName: string, pkg: ProdDepType): boolean {\n const prodDeps = { ...pkg.dependencies, ...pkg.optionalDependencies }\n return prodDeps[depName] != null\n }\n\n protected async locatePackageWithVersion(depTree: Pick<ProdDepType, \"name\" | \"version\" | \"path\">): Promise<{ packageDir: string; packageJson: PackageJson } | null> {\n const result = await this.cache.locatePackageVersion({\n parentDir: depTree.path,\n pkgName: depTree.name,\n requiredRange: depTree.version,\n })\n return result\n }\n /**\n * Parses a dependency identifier string into name and version components.\n *\n * Handles both scoped packages (e.g., \"@scope/pkg@1.2.3\") and regular packages (e.g., \"pkg@1.2.3\").\n * If the identifier is malformed or cannot be parsed, defaults to treating the entire string as\n * the package name with an \"unknown\" version.\n */\n protected parseNameVersion(identifier: string): { name: string; version: string } {\n let at: number\n if (identifier.startsWith(\"@\")) {\n // Scoped package: find the version separator after the scope (e.g. \"@scope/pkg@1.2.3\")\n const slashIndex = identifier.indexOf(\"/\")\n if (slashIndex === -1) {\n return { name: identifier, version: \"unknown\" }\n }\n at = identifier.indexOf(\"@\", slashIndex + 1)\n } else {\n at = identifier.indexOf(\"@\")\n }\n if (at <= 0) {\n return { name: identifier, version: \"unknown\" }\n }\n return { name: identifier.slice(0, at), version: identifier.slice(at + 1) }\n }\n\n /**\n * Retrieves the dependency tree and handles workspace package self-references.\n *\n * If the project is a workspace project, this method removes the root package's self-reference\n * from the dependency tree to avoid circular dependencies. It promotes the root package's\n * direct dependencies to the top level of the tree.\n *\n * @param tree - The original dependency tree\n * @param packageName - The name of the package to check for and remove from the tree\n * @returns The extracted dependency subtree\n */\n protected getTreeFromWorkspaces(tree: ProdDepType, packageName: string): ProdDepType {\n if (tree.workspaces && tree.dependencies) {\n for (const [key, value] of Object.entries(tree.dependencies)) {\n if (key === packageName) {\n return value\n }\n }\n }\n\n return tree\n }\n\n /**\n * Flags which modules must be omitted from the *copied* app output for the given `ignoredNames` by\n * setting an `excluded` marker on the pre-hoist graph nodes.\n *\n * Only a *top-level* production dependency (one the app itself declares) can be excluded, together\n * with its exclusively-owned transitive subtree. A package that is merely a transitive dependency of\n * a non-excluded production dependency is never excluded, even if its name is in `ignoredNames`:\n * only the root's own edges to ignored names are severed, so anything still reachable through another\n * production dependency stays reachable and is kept.\n *\n * Runs on the pre-hoist graph, where the true parent->child edges still exist, so a shared (deduped)\n * transitive dependency remains reachable and is kept while an ignored package's exclusive subtree\n * becomes unreachable and is flagged.\n */\n private markExcludedModules(graph: DependencyGraph, rootId: string, ignoredNames: ReadonlyArray<string>): void {\n const ignored = new Set(ignoredNames)\n if (ignored.size === 0) {\n return\n }\n\n const rootDeps = graph[rootId]?.dependencies ?? []\n const ignoredRootEdges = new Set(rootDeps.filter(dep => ignored.has(this.parseNameVersion(dep).name)))\n if (ignoredRootEdges.size === 0) {\n return\n }\n\n const reachable = new Set<string>()\n const stack: string[] = [rootId]\n while (stack.length > 0) {\n const id = stack.pop()!\n if (reachable.has(id)) {\n continue\n }\n reachable.add(id)\n const node = graph[id]\n if (node != null) {\n for (const dep of node.dependencies) {\n if (id === rootId && ignoredRootEdges?.has(dep)) {\n continue\n }\n if (!reachable.has(dep)) {\n stack.push(dep)\n }\n }\n }\n }\n for (const id of Object.keys(graph)) {\n if (!reachable.has(id)) {\n graph[id].excluded = true\n }\n }\n\n // Only directly-declared deps that actually ended up excluded (i.e. not still reachable via a kept\n // dependency) are surfaced to the user; their exclusive transitive subtree is omitted from the log.\n // Report the full `name@version` graph id — like the other logSummary buckets — so the log stays\n // truthful when another version of the same name still ships via a kept dependency (e.g. `debug@4`\n // excluded while `debug@3` remains bundled).\n const topLevelExcluded = new Set<string>()\n for (const dep of ignoredRootEdges) {\n if (!reachable.has(dep)) {\n topLevelExcluded.add(dep)\n }\n }\n if (topLevelExcluded.size > 0) {\n this.cache.logSummary[LogMessageByKey.PKG_EXCLUDED_IGNORED].push(...Array.from(topLevelExcluded).sort())\n }\n }\n\n private transformToHoisterTree(obj: DependencyGraph, key: string, nodes: Map<string, HoisterTree> = new Map()): HoisterTree {\n let node = nodes.get(key)\n const { name, version } = this.parseNameVersion(key)\n\n if (!node) {\n node = {\n name,\n identName: name,\n reference: version,\n dependencies: new Set<HoisterTree>(),\n peerNames: new Set<string>(),\n }\n\n nodes.set(key, node)\n\n const deps = (obj[key] || {}).dependencies || []\n for (const dep of deps) {\n const child = this.transformToHoisterTree(obj, dep, nodes)\n // a package that declares itself as a dependency (e.g. libsql) must not produce a self-edge\n if (child !== node) {\n node.dependencies.add(child)\n }\n }\n }\n\n return node\n }\n\n private async _getNodeModules(dependencies: Set<HoisterResult>, result: NodeModuleInfo[], archFilter?: ArchFilter, ancestors: Set<HoisterResult> = new Set()) {\n if (dependencies.size === 0) {\n return\n }\n\n for (const d of dependencies.values()) {\n // dependency cycles (including self-references) must not recurse\n if (ancestors.has(d)) {\n continue\n }\n const reference = [...d.references][0]\n const key = `${d.name}@${reference}`\n // Normalize the path to handle mixed separators from pnpm JSON output on Windows\n const rawPath = this.allDependencies.get(key)?.path\n const p = rawPath != null ? path.normalize(rawPath) : undefined\n if (p === undefined) {\n this.cache.logSummary[LogMessageByKey.PKG_NOT_FOUND].push(key)\n continue\n }\n\n // fix npm list issue\n // https://github.com/npm/cli/issues/8535\n if (!(await this.cache.exists[p])) {\n this.logMissingDependency(key)\n continue\n }\n\n const dir = await this.cache.realPath[p]\n\n // Drop packages whose declared `cpu`/`os` is incompatible with the target arch/platform (and their\n // subtree). npm/pnpm install only the host's platform-specific optional packages, so without this an\n // arm64-only binary (e.g. `@esbuild/darwin-arm64`) would be bundled into the x64 build too — and into\n // both slices of a universal build, which `@electron/universal` then refuses to merge. Reuses the\n // memoized `package.json` cache populated during collection.\n if (archFilter != null) {\n const pkgJson = await this.cache.json[path.join(dir, \"package.json\")]\n if (pkgJson != null && !isPackageCompatible(pkgJson, archFilter.cpu, archFilter.os)) {\n this.cache.logSummary[LogMessageByKey.PKG_INCOMPATIBLE_PLATFORM].push(key)\n continue\n }\n }\n\n const node: NodeModuleInfo = {\n name: d.name,\n version: reference,\n dir,\n excluded: this.productionGraph[key]?.excluded,\n }\n result.push(node)\n if (d.dependencies.size > 0) {\n node.dependencies = []\n ancestors.add(d)\n await this._getNodeModules(d.dependencies, node.dependencies, archFilter, ancestors)\n ancestors.delete(d)\n }\n }\n result.sort((a, b) => a.name.localeCompare(b.name))\n }\n\n /**\n * Records a dependency that could not be resolved on disk in the log summary.\n *\n * A platform-specific package name (e.g. `sass-embedded-linux-x64`) is always classified as a\n * platform-specific optional dependency. Otherwise, `isDeclaredOptional` decides the bucket: a\n * caller that *knows* the dependency was declared in `optionalDependencies` (e.g. the pnpm\n * collector's optional-dependency check) reports a missing *optional* dependency — an expected\n * condition — rather than the `PKG_NOT_ON_DISK` warning reserved for genuinely missing\n * production dependencies.\n */\n protected logMissingDependency(pkgName: string, isDeclaredOptional = false) {\n const PLATFORM_PACKAGE_RE = /(linux|win32|darwin|freebsd|android)[-_](x64|arm64|ia32|arm|ppc64|s390x|loong64|riscv64|universal)/\n const diskLogKey = PLATFORM_PACKAGE_RE.test(pkgName)\n ? LogMessageByKey.PKG_OPTIONAL_PLATFORM_NOT_INSTALLED\n : isDeclaredOptional\n ? LogMessageByKey.PKG_OPTIONAL_NOT_INSTALLED\n : LogMessageByKey.PKG_NOT_ON_DISK\n this.cache.logSummary[diskLogKey].push(pkgName)\n }\n\n protected async asyncExec(command: string, args: string[], cwd: string = this.rootDir): Promise<{ stdout: string | undefined; stderr: string | undefined }> {\n const file = await this.tempDirManager.getTempFile({ prefix: \"exec-\", suffix: \".txt\" })\n try {\n await this.streamCollectorCommandToFile(command, args, cwd, file)\n const result = await _fsExtra.readFile(file, { encoding: \"utf8\" })\n return { stdout: result?.trim(), stderr: undefined }\n } catch (error: any) {\n log.debug({ error: error.message }, \"failed to execute command\")\n return { stdout: undefined, stderr: error.message }\n }\n }\n\n /**\n * Executes a package-manager command and streams its stdout to a file.\n *\n * Delegates the spawn/stream/flush mechanics (including the Windows `powershell.exe -EncodedCommand`\n * wrapping) to {@link streamSpawnToFile}, and layers on the collector-specific interpretation of the\n * result: corepack is silenced for these invocations, `npm list` exit code 1 is tolerated, and any\n * stderr is surfaced as a collector warning only when the exit code is genuinely unexpected.\n *\n * @param command - The command to execute\n * @param args - Array of command-line arguments\n * @param cwd - The working directory to execute the command in\n * @param tempOutputFile - The path to the temporary file where stdout will be written\n * @returns Promise that resolves when the command completes successfully or rejects if it fails\n * @throws {Error} If the child process spawn fails or exits with a non-zero, unexpected code\n */\n protected async streamCollectorCommandToFile(command: string, args: string[], cwd: string, tempOutputFile: string) {\n // Derive execName from the original command so the npm-list shouldIgnore check below keys off the\n // real invocation (e.g. \"npm\"), not the \"powershell\" wrapper streamSpawnToFile uses on Windows.\n const execName = path.basename(command, path.extname(command))\n\n const { code, stderr } = await streamSpawnToFile(command, args, cwd, tempOutputFile, {\n // Package manager invocations do not need signing/publishing credentials. Silence corepack:\n // strict=0 so a project's `packageManager` pin can't abort our read-only queries, and the\n // download prompt/notice off so corepack doesn't flood stdout/stderr with activation chatter.\n ...stripSensitiveEnvVars(process.env),\n COREPACK_ENABLE_STRICT: \"0\",\n COREPACK_ENABLE_DOWNLOAD_PROMPT: \"0\",\n })\n\n // https://github.com/npm/npm/issues/17624\n const shouldIgnore = code === 1 && \"npm\" === execName.toLowerCase() && args.includes(\"list\")\n if (shouldIgnore) {\n log.debug(null, \"`npm list` returned non-zero exit code, but it MIGHT be expected (https://github.com/npm/npm/issues/17624). Check stderr for details.\")\n }\n if (stderr.length > 0) {\n log.debug({ stderr }, \"note: there was node module collector output on stderr\")\n // Only surface stderr as a user-visible warning when the exit code itself is unexpected.\n // When shouldIgnore is true (npm list exit code 1) the stderr is an anticipated side\n // effect of package-manager features like yarn resolutions or npm overrides that cause\n // npm to report ELSPROBLEMS for aliased packages it considers \"invalid\".\n if (!shouldIgnore) {\n this.cache.logSummary[LogMessageByKey.PKG_COLLECTOR_OUTPUT].push(stderr)\n }\n }\n if (code !== 0 && !shouldIgnore) {\n throw new Error(`Node module collector process exited with code ${code}:\\n${stderr}`)\n }\n }\n}\n"]}
1
+ {"version":3,"file":"nodeModulesCollector.js","sourceRoot":"","sources":["../../src/node-module-collector/nodeModulesCollector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,qBAAqB,EAAU,MAAM,cAAc,CAAA;AAChF,OAAO,QAAQ,MAAM,UAAU,CAAA;AAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAC/B,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAC5B,OAAO,EAAE,KAAK,EAAwC,MAAM,YAAY,CAAA;AACxE,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AACnE,OAAO,EAAE,wBAAwB,EAAM,MAAM,qBAAqB,CAAA;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAA;AAEhE,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAA;AAQlE,MAAM,OAAgB,oBAAoB;IASxC,YACqB,OAAe,EACjB,cAAsB;QADpB,YAAO,GAAP,OAAO,CAAQ;QACjB,mBAAc,GAAd,cAAc,CAAQ;QAVxB,gBAAW,GAAqB,EAAE,CAAA;QAChC,oBAAe,GAA6B,IAAI,GAAG,EAAE,CAAA;QACrD,oBAAe,GAAoB,EAAE,CAAA;QACrC,UAAK,GAAkB,IAAI,aAAa,EAAE,CAAA;QAE7D,wHAAwH;QAC9G,cAAS,GAAG,IAAI,IAAI,CAAU,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAA;IAKlE,CAAC;IAEJ;;;;;;;;;;OAUG;IACI,KAAK,CAAC,cAAc,CAAC,EAC1B,WAAW,EACX,UAAU,EACV,mBAAmB,GAKpB;QAIC,MAAM,IAAI,GAAgB,MAAM,IAAI,CAAC,mBAAmB,CAAC,IA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,IAAI,CAAC,YAAY,EAAE,CAAC;gBAClB,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,eAAe,CAAC,oBAAoB,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;YAC1E,CAAC;QACH,CAAC;QACD,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;YAChC,MAAM,IAAI,KAAK,CAAC,kDAAkD,IAAI,MAAM,MAAM,EAAE,CAAC,CAAA;QACvF,CAAC;QACD,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAA;IACzB,CAAC;CACF","sourcesContent":["import { exists, log, retry, stripSensitiveEnvVars, TmpDir } from \"builder-util\"\nimport _fsExtra from \"fs-extra\"\nimport { Lazy } from \"lazy-val\"\nimport * as path from \"path\"\nimport { hoist, type HoisterResult, type HoisterTree } from \"./hoist.js\"\nimport { LogMessageByKey, ModuleManager } from \"./moduleManager.js\"\nimport { getPackageManagerCommand, PM } from \"./packageManager.js\"\nimport { streamSpawnToFile } from \"../util/streamSpawnToFile.js\"\nimport type { Dependency, DependencyGraph, NodeModuleInfo, PackageJson } from \"./types.js\"\nimport { isPackageCompatible } from \"../util/archCompatibility.js\"\n\n/** Target arch/platform used to drop `cpu`/`os`-incompatible packages while collecting. */\nexport interface ArchFilter {\n cpu: string | null\n os: string\n}\n\nexport abstract class NodeModulesCollector<ProdDepType extends Dependency<ProdDepType, OptionalDepType>, OptionalDepType> {\n private readonly nodeModules: NodeModuleInfo[] = []\n protected readonly allDependencies: Map<string, ProdDepType> = new Map()\n protected readonly productionGraph: DependencyGraph = {}\n protected readonly cache: ModuleManager = new ModuleManager()\n\n /** Whether `node_modules` uses a hoisted (flat) layout. Overridden by collectors that detect it from disk or config. */\n protected isHoisted = new Lazy<boolean>(() => Promise.resolve(false))\n\n constructor(\n protected readonly rootDir: string,\n private readonly tempDirManager: TmpDir\n ) {}\n\n /**\n * Retrieves and collects all Node.js modules for a given package.\n *\n * This method orchestrates the entire module collection process by:\n * 1. Fetching the dependency tree from the package manager\n * 2. Collecting all dependencies recursively\n * 3. Extracting workspace references if applicable\n * 4. Building a production dependency graph\n * 5. Hoisting the dependencies to their final locations\n * 6. Resolving and returning module information\n */\n public async getNodeModules({\n packageName,\n archFilter,\n ignoredDependencies,\n }: {\n packageName: string\n archFilter?: ArchFilter\n ignoredDependencies?: ReadonlyArray<string>\n }): Promise<{\n nodeModules: NodeModuleInfo[]\n logSummary: ModuleManager[\"logSummary\"]\n }> {\n const tree: ProdDepType = await this.getDependenciesTree(this.installOptions.manager)\n\n await this.collectAllDependencies(tree, packageName)\n const realTree: ProdDepType = this.getTreeFromWorkspaces(tree, packageName)\n await this.extractProductionDependencyGraph(realTree, packageName)\n\n this.markExcludedModules(this.productionGraph, packageName, ignoredDependencies ?? [])\n\n const hoisterResult: HoisterResult = hoist(this.transformToHoisterTree(this.productionGraph, packageName), {\n check: log.isDebugEnabled,\n })\n\n await this._getNodeModules(hoisterResult.dependencies, this.nodeModules, archFilter)\n\n log.debug({ packageName, depCount: this.nodeModules.length }, \"node modules collection complete\")\n\n return { nodeModules: this.nodeModules, logSummary: this.cache.logSummary }\n }\n\n public abstract readonly installOptions: {\n manager: PM\n lockfile: string\n }\n\n protected abstract getArgs(): string[]\n protected abstract extractProductionDependencyGraph(tree: Dependency<ProdDepType, OptionalDepType>, dependencyId: string): Promise<void>\n protected abstract collectAllDependencies(tree: Dependency<ProdDepType, OptionalDepType>, appPackageName: string): Promise<void>\n\n /**\n * Retrieves the dependency tree from the package manager.\n *\n * Executes the appropriate package manager command to fetch the dependency tree and writes\n * the output to a temporary file. Includes retry logic to handle transient failures such as\n * incomplete JSON output or missing files. Will retry up to 1 time with exponential backoff.\n */\n protected async getDependenciesTree(pm: PM): Promise<ProdDepType> {\n const command = getPackageManagerCommand(pm)\n const args = this.getArgs()\n\n const tempOutputFile = await this.tempDirManager.getTempFile({\n prefix: path.basename(command, path.extname(command)),\n suffix: \"output.json\",\n })\n\n return retry(\n async () => {\n const { code, stderr } = await this.streamCollectorCommandToFile(command, args, this.rootDir, tempOutputFile)\n const shellOutput = await _fsExtra.readFile(tempOutputFile, { encoding: \"utf8\" })\n if (shellOutput.trim().length === 0) {\n // Parsing an empty string would only yield a misleading \"No JSON content found in output\" (#10208).\n // With npm this usually means npm itself threw while writing its buffered JSON tree at exit: npm's exit\n // handler swallows that exception and exits 1 with nothing on stdout and only `verbose exit 1` in its log.\n throw new Error(\n `\\`${[path.basename(command), ...args].join(\" \")}\\` (cwd: ${this.rootDir}) exited with code ${code} and produced no output on stdout; ` +\n `with npm this usually means npm itself failed while writing its JSON dependency tree. stderr: ${stderr.trim().length > 0 ? stderr.trim() : \"(empty)\"}`\n )\n }\n const result = await Promise.resolve(this.parseDependenciesTree(shellOutput))\n return result\n },\n {\n retries: 1,\n interval: 2000,\n backoff: 2000,\n shouldRetry: async (error: any) => {\n const fields: Record<string, string> = { error: error.message, tempOutputFile, cwd: this.rootDir, packageManager: pm }\n\n if (!(await exists(tempOutputFile))) {\n log.debug(fields, \"dependency tree output file missing, retrying\")\n return true\n }\n\n const fileContent = await _fsExtra.readFile(tempOutputFile, { encoding: \"utf8\" })\n fields.fileContentLength = fileContent.length.toString()\n\n if (fileContent.trim().length === 0) {\n log.debug(fields, \"dependency tree output file empty, retrying\")\n return true\n }\n\n // extract small start/end sample for debugging purposes (e.g. polluted console output)\n const lines = fileContent.split(\"\\n\")\n const lineSampleSize = Math.min(5, lines.length / 2)\n if (2 * lineSampleSize > 5) {\n fields.sampleStart = lines.slice(0, lineSampleSize).join(\"\\n\")\n fields.sampleEnd = lines.slice(-lineSampleSize).join(\"\\n\")\n } else {\n fields.content = fileContent\n }\n\n // Both indicate truncated/polluted PM output (a transient that re-running the command clears).\n if (error.message?.includes(\"Unexpected end of JSON input\") || error.message?.includes(\"No JSON content found in output\")) {\n log.debug(fields, \"JSON parse error in dependency tree, retrying\")\n return true\n }\n\n log.error(fields, \"error parsing dependencies tree\")\n return false\n },\n }\n )\n }\n\n /**\n * Parses the dependencies tree from shell command output.\n *\n **/\n protected parseDependenciesTree(shellOutput: string): ProdDepType | Promise<ProdDepType> {\n return this.extractJsonFromPollutedOutput<ProdDepType>(shellOutput)\n }\n\n protected extractJsonFromPollutedOutput<T>(shellOutput: string): T {\n const consoleOutput = shellOutput.trim()\n try {\n // Please for the love of all that is holy, this should cover 99% of cases where npm/pnpm/yarn output is clean JSON\n return JSON.parse(consoleOutput)\n } catch {\n // ignore\n }\n\n // DEDICATED FALLBACK FOR POLLUTED OUTPUT, non-trivial to implement correctly, not needed in most cases, and highly inefficient\n\n // Find the first index that starts with { or [\n const bracketOpen = Math.max(consoleOutput.indexOf(\"{\"), 0)\n const bracketOpenSquare = Math.max(consoleOutput.indexOf(\"[\"), 0)\n const start = Math.min(bracketOpen, bracketOpenSquare) // always non-negative due to Math.max above\n\n for (let i = start; i < consoleOutput.length; i++) {\n const slice = consoleOutput.slice(start, i + 1)\n try {\n return JSON.parse(slice)\n } catch {\n // ignore, try next\n }\n }\n throw new Error(\"No JSON content found in output\")\n }\n\n protected cacheKey(pkg: Pick<ProdDepType, \"name\" | \"version\" | \"path\">): string {\n const rel = path.relative(this.rootDir, pkg.path)\n return `${pkg.name}::${pkg.version}::${rel ?? \".\"}`\n }\n\n // We use the key (alias name) instead of value.name for npm aliased packages\n // e.g., { \"foo\": { name: \"@scope/bar\", ... } } should be stored as \"foo@version\"\n protected normalizePackageVersion(key: string, pkg: ProdDepType) {\n return { id: `${key}@${pkg.version}`, pkgOverride: { ...pkg, name: key } }\n }\n\n /**\n * Determines if a given dependency is a production dependency of a package.\n *\n * Checks both the dependencies and optionalDependencies of a package to see if\n * the specified dependency name is listed.\n *\n * @param depName - The name of the dependency to check\n * @param pkg - The package to search for the dependency in\n * @returns True if the dependency is found in either dependencies or optionalDependencies, false otherwise\n */\n protected isProdDependency(depName: string, pkg: ProdDepType): boolean {\n const prodDeps = { ...pkg.dependencies, ...pkg.optionalDependencies }\n return prodDeps[depName] != null\n }\n\n protected async locatePackageWithVersion(depTree: Pick<ProdDepType, \"name\" | \"version\" | \"path\">): Promise<{ packageDir: string; packageJson: PackageJson } | null> {\n const result = await this.cache.locatePackageVersion({\n parentDir: depTree.path,\n pkgName: depTree.name,\n requiredRange: depTree.version,\n })\n return result\n }\n /**\n * Parses a dependency identifier string into name and version components.\n *\n * Handles both scoped packages (e.g., \"@scope/pkg@1.2.3\") and regular packages (e.g., \"pkg@1.2.3\").\n * If the identifier is malformed or cannot be parsed, defaults to treating the entire string as\n * the package name with an \"unknown\" version.\n */\n protected parseNameVersion(identifier: string): { name: string; version: string } {\n let at: number\n if (identifier.startsWith(\"@\")) {\n // Scoped package: find the version separator after the scope (e.g. \"@scope/pkg@1.2.3\")\n const slashIndex = identifier.indexOf(\"/\")\n if (slashIndex === -1) {\n return { name: identifier, version: \"unknown\" }\n }\n at = identifier.indexOf(\"@\", slashIndex + 1)\n } else {\n at = identifier.indexOf(\"@\")\n }\n if (at <= 0) {\n return { name: identifier, version: \"unknown\" }\n }\n return { name: identifier.slice(0, at), version: identifier.slice(at + 1) }\n }\n\n /**\n * Retrieves the dependency tree and handles workspace package self-references.\n *\n * If the project is a workspace project, this method removes the root package's self-reference\n * from the dependency tree to avoid circular dependencies. It promotes the root package's\n * direct dependencies to the top level of the tree.\n *\n * @param tree - The original dependency tree\n * @param packageName - The name of the package to check for and remove from the tree\n * @returns The extracted dependency subtree\n */\n protected getTreeFromWorkspaces(tree: ProdDepType, packageName: string): ProdDepType {\n if (tree.workspaces && tree.dependencies) {\n for (const [key, value] of Object.entries(tree.dependencies)) {\n if (key === packageName) {\n return value\n }\n }\n }\n\n return tree\n }\n\n /**\n * Flags which modules must be omitted from the *copied* app output for the given `ignoredNames` by\n * setting an `excluded` marker on the pre-hoist graph nodes.\n *\n * Only a *top-level* production dependency (one the app itself declares) can be excluded, together\n * with its exclusively-owned transitive subtree. A package that is merely a transitive dependency of\n * a non-excluded production dependency is never excluded, even if its name is in `ignoredNames`:\n * only the root's own edges to ignored names are severed, so anything still reachable through another\n * production dependency stays reachable and is kept.\n *\n * Runs on the pre-hoist graph, where the true parent->child edges still exist, so a shared (deduped)\n * transitive dependency remains reachable and is kept while an ignored package's exclusive subtree\n * becomes unreachable and is flagged.\n */\n private markExcludedModules(graph: DependencyGraph, rootId: string, ignoredNames: ReadonlyArray<string>): void {\n const ignored = new Set(ignoredNames)\n if (ignored.size === 0) {\n return\n }\n\n const rootDeps = graph[rootId]?.dependencies ?? []\n const ignoredRootEdges = new Set(rootDeps.filter(dep => ignored.has(this.parseNameVersion(dep).name)))\n if (ignoredRootEdges.size === 0) {\n return\n }\n\n const reachable = new Set<string>()\n const stack: string[] = [rootId]\n while (stack.length > 0) {\n const id = stack.pop()!\n if (reachable.has(id)) {\n continue\n }\n reachable.add(id)\n const node = graph[id]\n if (node != null) {\n for (const dep of node.dependencies) {\n if (id === rootId && ignoredRootEdges?.has(dep)) {\n continue\n }\n if (!reachable.has(dep)) {\n stack.push(dep)\n }\n }\n }\n }\n for (const id of Object.keys(graph)) {\n if (!reachable.has(id)) {\n graph[id].excluded = true\n }\n }\n\n // Only directly-declared deps that actually ended up excluded (i.e. not still reachable via a kept\n // dependency) are surfaced to the user; their exclusive transitive subtree is omitted from the log.\n // Report the full `name@version` graph id — like the other logSummary buckets — so the log stays\n // truthful when another version of the same name still ships via a kept dependency (e.g. `debug@4`\n // excluded while `debug@3` remains bundled).\n const topLevelExcluded = new Set<string>()\n for (const dep of ignoredRootEdges) {\n if (!reachable.has(dep)) {\n topLevelExcluded.add(dep)\n }\n }\n if (topLevelExcluded.size > 0) {\n this.cache.logSummary[LogMessageByKey.PKG_EXCLUDED_IGNORED].push(...Array.from(topLevelExcluded).sort())\n }\n }\n\n private transformToHoisterTree(obj: DependencyGraph, key: string, nodes: Map<string, HoisterTree> = new Map()): HoisterTree {\n let node = nodes.get(key)\n const { name, version } = this.parseNameVersion(key)\n\n if (!node) {\n node = {\n name,\n identName: name,\n reference: version,\n dependencies: new Set<HoisterTree>(),\n peerNames: new Set<string>(),\n }\n\n nodes.set(key, node)\n\n const deps = (obj[key] || {}).dependencies || []\n for (const dep of deps) {\n const child = this.transformToHoisterTree(obj, dep, nodes)\n // a package that declares itself as a dependency (e.g. libsql) must not produce a self-edge\n if (child !== node) {\n node.dependencies.add(child)\n }\n }\n }\n\n return node\n }\n\n private async _getNodeModules(dependencies: Set<HoisterResult>, result: NodeModuleInfo[], archFilter?: ArchFilter, ancestors: Set<HoisterResult> = new Set()) {\n if (dependencies.size === 0) {\n return\n }\n\n for (const d of dependencies.values()) {\n // dependency cycles (including self-references) must not recurse\n if (ancestors.has(d)) {\n continue\n }\n const reference = [...d.references][0]\n const key = `${d.name}@${reference}`\n // Normalize the path to handle mixed separators from pnpm JSON output on Windows\n const rawPath = this.allDependencies.get(key)?.path\n const p = rawPath != null ? path.normalize(rawPath) : undefined\n if (p === undefined) {\n this.cache.logSummary[LogMessageByKey.PKG_NOT_FOUND].push(key)\n continue\n }\n\n // fix npm list issue\n // https://github.com/npm/cli/issues/8535\n if (!(await this.cache.exists[p])) {\n this.logMissingDependency(key)\n continue\n }\n\n const dir = await this.cache.realPath[p]\n\n // Drop packages whose declared `cpu`/`os` is incompatible with the target arch/platform (and their\n // subtree). npm/pnpm install only the host's platform-specific optional packages, so without this an\n // arm64-only binary (e.g. `@esbuild/darwin-arm64`) would be bundled into the x64 build too — and into\n // both slices of a universal build, which `@electron/universal` then refuses to merge. Reuses the\n // memoized `package.json` cache populated during collection.\n if (archFilter != null) {\n const pkgJson = await this.cache.json[path.join(dir, \"package.json\")]\n if (pkgJson != null && !isPackageCompatible(pkgJson, archFilter.cpu, archFilter.os)) {\n this.cache.logSummary[LogMessageByKey.PKG_INCOMPATIBLE_PLATFORM].push(key)\n continue\n }\n }\n\n const node: NodeModuleInfo = {\n name: d.name,\n version: reference,\n dir,\n excluded: this.productionGraph[key]?.excluded,\n }\n result.push(node)\n if (d.dependencies.size > 0) {\n node.dependencies = []\n ancestors.add(d)\n await this._getNodeModules(d.dependencies, node.dependencies, archFilter, ancestors)\n ancestors.delete(d)\n }\n }\n result.sort((a, b) => a.name.localeCompare(b.name))\n }\n\n /**\n * Records a dependency that could not be resolved on disk in the log summary.\n *\n * A platform-specific package name (e.g. `sass-embedded-linux-x64`) is always classified as a\n * platform-specific optional dependency. Otherwise, `isDeclaredOptional` decides the bucket: a\n * caller that *knows* the dependency was declared in `optionalDependencies` (e.g. the pnpm\n * collector's optional-dependency check) reports a missing *optional* dependency — an expected\n * condition — rather than the `PKG_NOT_ON_DISK` warning reserved for genuinely missing\n * production dependencies.\n */\n protected logMissingDependency(pkgName: string, isDeclaredOptional = false) {\n const PLATFORM_PACKAGE_RE = /(linux|win32|darwin|freebsd|android)[-_](x64|arm64|ia32|arm|ppc64|s390x|loong64|riscv64|universal)/\n const diskLogKey = PLATFORM_PACKAGE_RE.test(pkgName)\n ? LogMessageByKey.PKG_OPTIONAL_PLATFORM_NOT_INSTALLED\n : isDeclaredOptional\n ? LogMessageByKey.PKG_OPTIONAL_NOT_INSTALLED\n : LogMessageByKey.PKG_NOT_ON_DISK\n this.cache.logSummary[diskLogKey].push(pkgName)\n }\n\n protected async asyncExec(command: string, args: string[], cwd: string = this.rootDir): Promise<{ stdout: string | undefined; stderr: string | undefined }> {\n const file = await this.tempDirManager.getTempFile({ prefix: \"exec-\", suffix: \".txt\" })\n try {\n await this.streamCollectorCommandToFile(command, args, cwd, file)\n const result = await _fsExtra.readFile(file, { encoding: \"utf8\" })\n return { stdout: result?.trim(), stderr: undefined }\n } catch (error: any) {\n log.debug({ error: error.message }, \"failed to execute command\")\n return { stdout: undefined, stderr: error.message }\n }\n }\n\n /**\n * Executes a package-manager command and streams its stdout to a file.\n *\n * Delegates the spawn/stream/flush mechanics (including the Windows `powershell.exe -EncodedCommand`\n * wrapping) to {@link streamSpawnToFile}, and layers on the collector-specific interpretation of the\n * result: corepack is silenced for these invocations, `npm list` exit code 1 is tolerated, and any\n * stderr is surfaced as a collector warning only when the exit code is genuinely unexpected.\n *\n * @param command - The command to execute\n * @param args - Array of command-line arguments\n * @param cwd - The working directory to execute the command in\n * @param tempOutputFile - The path to the temporary file where stdout will be written\n * @returns Promise that resolves with the exit code and captured stderr when the command completes\n * successfully (or with a tolerated exit code), or rejects if it fails\n * @throws {Error} If the child process spawn fails or exits with a non-zero, unexpected code\n */\n protected async streamCollectorCommandToFile(command: string, args: string[], cwd: string, tempOutputFile: string): Promise<{ code: number; stderr: string }> {\n // Derive execName from the original command so the npm-list shouldIgnore check below keys off the\n // real invocation (e.g. \"npm\"), not the \"powershell\" wrapper streamSpawnToFile uses on Windows.\n const execName = path.basename(command, path.extname(command))\n\n const { code, stderr } = await streamSpawnToFile(command, args, cwd, tempOutputFile, {\n // Package manager invocations do not need signing/publishing credentials. Silence corepack:\n // strict=0 so a project's `packageManager` pin can't abort our read-only queries, and the\n // download prompt/notice off so corepack doesn't flood stdout/stderr with activation chatter.\n ...stripSensitiveEnvVars(process.env),\n COREPACK_ENABLE_STRICT: \"0\",\n COREPACK_ENABLE_DOWNLOAD_PROMPT: \"0\",\n })\n\n // https://github.com/npm/npm/issues/17624\n const shouldIgnore = code === 1 && \"npm\" === execName.toLowerCase() && args.includes(\"list\")\n if (shouldIgnore) {\n log.debug(null, \"`npm list` returned non-zero exit code, but it MIGHT be expected (https://github.com/npm/npm/issues/17624). Check stderr for details.\")\n }\n if (stderr.length > 0) {\n log.debug({ stderr }, \"note: there was node module collector output on stderr\")\n // Only surface stderr as a user-visible warning when the exit code itself is unexpected.\n // When shouldIgnore is true (npm list exit code 1) the stderr is an anticipated side\n // effect of package-manager features like yarn resolutions or npm overrides that cause\n // npm to report ELSPROBLEMS for aliased packages it considers \"invalid\".\n if (!shouldIgnore) {\n this.cache.logSummary[LogMessageByKey.PKG_COLLECTOR_OUTPUT].push(stderr)\n }\n }\n if (code !== 0 && !shouldIgnore) {\n throw new Error(`Node module collector process exited with code ${code}:\\n${stderr}`)\n }\n return { code, stderr }\n }\n}\n"]}
@@ -11,10 +11,10 @@ export declare class PnpmNodeModulesCollector extends NodeModulesCollector<PnpmD
11
11
  private _pnpmMajorVersion;
12
12
  private readonly pnpmVersion;
13
13
  /**
14
- * Detect pnpm's installed layout from the on-disk structure rather than `pnpm config list`.
15
- * pnpm 11 no longer echoes `node-linker` (from `.npmrc`) in `config list`, so the base-class
16
- * config-parsing detection silently reports "not hoisted" for a hoisted install, which would
17
- * disable the downward search needed to find version-conflicted nested deps.
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
18
  *
19
19
  * In the default isolated store every regular top-level package resolves — through a symlink
20
20
  * on POSIX, a junction on Windows — into `node_modules/.pnpm/<name>@<ver>/node_modules/<name>`.
@@ -25,6 +25,15 @@ export declare class PnpmNodeModulesCollector extends NodeModulesCollector<PnpmD
25
25
  * otherwise mask an isolated store.
26
26
  */
27
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;
28
37
  /**
29
38
  * Memo for `locateFromDepOrRoot`, keyed by `name@version`. pnpm's content-addressed virtual
30
39
  * store guarantees that any given `name@version` resolves to a single location on disk, so
@@ -56,7 +65,38 @@ export declare class PnpmNodeModulesCollector extends NodeModulesCollector<PnpmD
56
65
  * versions of a dep exist in the workspace.
57
66
  */
58
67
  private locateFromDepOrRoot;
68
+ /**
69
+ * Resolve a located package to its real directory (the symlink target), leaving a non-symlinked
70
+ * hit untouched.
71
+ *
72
+ * `locatePackageVersion` returns the path it *walked*, which in pnpm's isolated store is the
73
+ * `node_modules/<name>` symlink rather than `.pnpm/<name>@<ver>/node_modules/<name>`. That
74
+ * distinction matters because the store keeps a package's dependencies as SIBLINGS inside
75
+ * `.pnpm/<name>@<ver>/node_modules/`, reachable only from the real path: searching upward from
76
+ * the symlink walks the *linking* project instead of the store and finds nothing. That is how
77
+ * `fs-extra`'s `universalify`/`jsonfile` (and `js-yaml`'s `argparse`) were silently dropped from
78
+ * the asar of an app whose `electron-updater` came from a `link:`ed checkout — pnpm reports such
79
+ * packages with no dependency tree, so `visitDep` resolves their deps from disk through here.
80
+ *
81
+ * Resolving the link is what Node itself does (`--preserve-symlinks` is off by default), which is
82
+ * why the same require works before packaging. `ModuleManager.locatePackageVersionFromCacheKey`
83
+ * and `TraversalNodeModulesCollector` already normalize this way.
84
+ */
85
+ private toRealPackage;
59
86
  protected extractProductionDependencyGraph(tree: PnpmDependency, dependencyId: string): Promise<void>;
87
+ /**
88
+ * Resolve a dependency that `pnpm list` left out of a package's tree to its `allDependencies` entry.
89
+ * The lookup goes through the copy node itself would load from `parentPath` (the package's real store
90
+ * directory), filtered by the declared range, and falls back to a name-only match only when nothing on
91
+ * disk resolves to a collected entry (a `link:` dep, whose entry is keyed by its `link:` version).
92
+ *
93
+ * A name-only lookup returns whichever version was collected first, which is wrong as soon as two
94
+ * versions of the package are installed: with the app pinning es5-ext@0.10.53 while its transitive
95
+ * 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
96
+ * esniff / event-emitter / next-tick@1.1.0 closure) vanished from the asar (#8493). pnpm 10.29.3+
97
+ * made this common, because its deduped output routes every repeated package through this recovery.
98
+ */
99
+ private resolveOmittedDependency;
60
100
  protected collectAllDependencies(_tree: PnpmDependency, _appPackageName: string): Promise<void>;
61
101
  /**
62
102
  * Resolve a `link:` dependency to its real on-disk source directory — never the `node_modules`
@@ -1 +1 @@
1
- {"version":3,"file":"pnpmNodeModulesCollector.d.ts","sourceRoot":"","sources":["../../src/node-module-collector/pnpmNodeModulesCollector.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAG/B,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAChE,OAAO,EAA4B,EAAE,EAAE,MAAM,qBAAqB,CAAA;AAClE,OAAO,KAAK,EAAe,cAAc,EAAE,MAAM,YAAY,CAAA;AAG7D,qBAAa,wBAAyB,SAAQ,oBAAoB,CAAC,cAAc,EAAE,cAAc,CAAC;IAChG,SAAgB,cAAc;;;MAG7B;IAGD,OAAO,CAAC,qBAAqB,CAAuB;IAEpD,OAAO,CAAC,iBAAiB,CAAI;IAE7B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAI1B;IAEF;;;;;;;;;;;;;OAaG;IACH,UAAmB,SAAS,gBAwB1B;IAEF;;;;;;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;;;;OAIG;IACH,OAAO,KAAK,oBAAoB,GAK/B;IAED,SAAS,CAAC,OAAO,IAAI,MAAM,EAAE;IAI7B,OAAO,CAAC,gBAAgB;IAaxB;;;;;OAKG;YACW,mBAAmB;cAwDjB,gCAAgC,CAAC,IAAI,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM;cA2E3E,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;YA+CR,sBAAsB;IASpC;;;;OAIG;YACW,0BAA0B;cA+BrB,qBA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,gCAAgC,CAAC,IAAI,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM;IA4E3F;;;;;;;;;;;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;cAYnF,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;CAMjF"}
@@ -4,7 +4,7 @@ import * as path from "path";
4
4
  import { LogMessageByKey, readJsonOrNull } from "./moduleManager.js";
5
5
  import { NodeModulesCollector } from "./nodeModulesCollector.js";
6
6
  import { getPackageManagerCommand, PM } from "./packageManager.js";
7
- import { isValidKey } from "builder-util";
7
+ import { exists, isValidKey } from "builder-util";
8
8
  export class PnpmNodeModulesCollector extends NodeModulesCollector {
9
9
  constructor() {
10
10
  super(...arguments);
@@ -23,10 +23,10 @@ export class PnpmNodeModulesCollector extends NodeModulesCollector {
23
23
  return isNaN(major) ? 0 : major;
24
24
  });
25
25
  /**
26
- * Detect pnpm's installed layout from the on-disk structure rather than `pnpm config list`.
27
- * pnpm 11 no longer echoes `node-linker` (from `.npmrc`) in `config list`, so the base-class
28
- * config-parsing detection silently reports "not hoisted" for a hoisted install, which would
29
- * disable the downward search needed to find version-conflicted nested deps.
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
30
  *
31
31
  * In the default isolated store every regular top-level package resolves — through a symlink
32
32
  * on POSIX, a junction on Windows — into `node_modules/.pnpm/<name>@<ver>/node_modules/<name>`.
@@ -37,30 +37,43 @@ export class PnpmNodeModulesCollector extends NodeModulesCollector {
37
37
  * otherwise mask an isolated store.
38
38
  */
39
39
  this.isHoisted = new Lazy(async () => {
40
- const nmDir = path.join(this.rootDir, "node_modules");
41
- const entries = await _fsExtra.readdir(nmDir).catch(() => []);
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
42
  let sawPackage = false;
43
- for (const name of entries) {
44
- if (name.startsWith(".")) {
45
- continue; // .pnpm, .bin, .modules.yaml
46
- }
47
- const entryPath = path.join(nmDir, name);
48
- // A scoped dir (@scope) is not a package itself; descend to its packages.
49
- const candidates = name.startsWith("@") ? (await _fsExtra.readdir(entryPath).catch(() => [])).map(s => path.join(entryPath, s)) : [entryPath];
50
- for (const candidate of candidates) {
51
- const real = await _fsExtra.realpath(candidate).catch(() => null);
52
- if (real == null) {
53
- continue;
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;
54
48
  }
55
49
  sawPackage = true;
56
- if (real.split(path.sep).includes(".pnpm")) {
57
- return false; // isolated store: a package routes through the virtual store
58
- }
59
50
  }
60
51
  }
61
52
  // Packages exist and none route through `.pnpm` → hoisted. No packages → flat default.
62
53
  return sawPackage;
63
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
+ });
64
77
  /**
65
78
  * Memo for `locateFromDepOrRoot`, keyed by `name@version`. pnpm's content-addressed virtual
66
79
  * store guarantees that any given `name@version` resolves to a single location on disk, so
@@ -78,6 +91,30 @@ export class PnpmNodeModulesCollector extends NodeModulesCollector {
78
91
  * first access inside `extractProductionDependencyGraph`, after `allDependencies` is settled. */
79
92
  this._allDepsByName = null;
80
93
  }
94
+ /** Returns true if `nmDir` is an isolated (`.pnpm`) store, false if hoisted, null if it holds no packages. */
95
+ async scanNodeModulesLayout(nmDir) {
96
+ const entries = await _fsExtra.readdir(nmDir).catch(() => []);
97
+ let sawPackage = false;
98
+ for (const name of entries) {
99
+ if (name.startsWith(".")) {
100
+ continue; // .pnpm, .bin, .modules.yaml
101
+ }
102
+ const entryPath = path.join(nmDir, name);
103
+ // A scoped dir (@scope) is not a package itself; descend to its packages.
104
+ const candidates = name.startsWith("@") ? (await _fsExtra.readdir(entryPath).catch(() => [])).map(s => path.join(entryPath, s)) : [entryPath];
105
+ for (const candidate of candidates) {
106
+ const real = await _fsExtra.realpath(candidate).catch(() => null);
107
+ if (real == null) {
108
+ continue;
109
+ }
110
+ sawPackage = true;
111
+ if (real.split(path.sep).includes(".pnpm")) {
112
+ return true; // isolated store: a package routes through the virtual store
113
+ }
114
+ }
115
+ }
116
+ return sawPackage ? false : null;
117
+ }
81
118
  /**
82
119
  * Returns the workspace packages to iterate over, gated by detected pnpm version:
83
120
  * - pnpm v11+: multi-entry workspace output → return the full parsed array
@@ -140,8 +177,15 @@ export class PnpmNodeModulesCollector extends NodeModulesCollector {
140
177
  // `.pnpm` virtual store it stays true (forcing it on there would burn thousands of
141
178
  // readdir/lstat calls — and on Windows, where pnpm uses junctions that `lstat` reports as
142
179
  // directories, the BFS walks the entire store and resolves the wrong paths).
143
- const satisfying = (parentPath ? await this.cache.locatePackageVersion({ pkgName, parentDir: parentPath, requiredRange, skipDownwardSearch, skipOverrideFallback: true }) : null) ??
144
- (await this.cache.locatePackageVersion({ pkgName, parentDir: this.rootDir, requiredRange, skipDownwardSearch, skipOverrideFallback: true }));
180
+ //
181
+ // When `rootDir` is a workspace package, a hoisted install keeps the tree — including the
182
+ // nested `<workspaceRoot>/node_modules/A/node_modules/B` copies — under the workspace root,
183
+ // which the downward BFS from `rootDir` never reaches (its `node_modules` is often absent),
184
+ // so search the workspace root last.
185
+ let satisfying = parentPath ? await this.cache.locatePackageVersion({ pkgName, parentDir: parentPath, requiredRange, skipDownwardSearch, skipOverrideFallback: true }) : null;
186
+ for (const dir of await this.layoutRoots.value) {
187
+ satisfying ??= await this.cache.locatePackageVersion({ pkgName, parentDir: dir, requiredRange, skipDownwardSearch, skipOverrideFallback: true });
188
+ }
145
189
  if (satisfying) {
146
190
  return satisfying;
147
191
  }
@@ -152,12 +196,36 @@ export class PnpmNodeModulesCollector extends NodeModulesCollector {
152
196
  return fromDep;
153
197
  }
154
198
  return this.cache.locatePackageVersion({ pkgName, parentDir: this.rootDir, requiredRange, skipDownwardSearch });
155
- })();
199
+ })().then(pkg => this.toRealPackage(pkg));
156
200
  if (memoKey != null) {
157
201
  this.locateMemo.set(memoKey, promise);
158
202
  }
159
203
  return promise;
160
204
  }
205
+ /**
206
+ * Resolve a located package to its real directory (the symlink target), leaving a non-symlinked
207
+ * hit untouched.
208
+ *
209
+ * `locatePackageVersion` returns the path it *walked*, which in pnpm's isolated store is the
210
+ * `node_modules/<name>` symlink rather than `.pnpm/<name>@<ver>/node_modules/<name>`. That
211
+ * distinction matters because the store keeps a package's dependencies as SIBLINGS inside
212
+ * `.pnpm/<name>@<ver>/node_modules/`, reachable only from the real path: searching upward from
213
+ * the symlink walks the *linking* project instead of the store and finds nothing. That is how
214
+ * `fs-extra`'s `universalify`/`jsonfile` (and `js-yaml`'s `argparse`) were silently dropped from
215
+ * the asar of an app whose `electron-updater` came from a `link:`ed checkout — pnpm reports such
216
+ * packages with no dependency tree, so `visitDep` resolves their deps from disk through here.
217
+ *
218
+ * Resolving the link is what Node itself does (`--preserve-symlinks` is off by default), which is
219
+ * why the same require works before packaging. `ModuleManager.locatePackageVersionFromCacheKey`
220
+ * and `TraversalNodeModulesCollector` already normalize this way.
221
+ */
222
+ async toRealPackage(pkg) {
223
+ if (pkg == null) {
224
+ return null;
225
+ }
226
+ const packageDir = await this.cache.realPath[pkg.packageDir];
227
+ return packageDir === pkg.packageDir ? pkg : { ...pkg, packageDir };
228
+ }
161
229
  // pnpm 10+ does not automatically preserve transitive optional platform-specific
162
230
  // packages (e.g. sass-embedded-linux-x64) across lock file regeneration. Users
163
231
  // must list them as direct optionalDependencies. Missing ones are emitted as
@@ -188,13 +256,14 @@ export class PnpmNodeModulesCollector extends NodeModulesCollector {
188
256
  const all = packageJson ? { ...packageJson.dependencies, ...packageJson.optionalDependencies } : { ...tree.dependencies, ...tree.optionalDependencies };
189
257
  const optional = packageJson ? { ...packageJson.optionalDependencies } : {};
190
258
  const deps = { ...(tree.dependencies || {}), ...(tree.optionalDependencies || {}) };
191
- // pnpm --prod omits sub-deps for link: packages (and synthetic entries derived from them).
192
- // For any dep declared in the package.json (all) that pnpm left out of the tree, recover
193
- // the resolved entry from allDependencies so it lands in the production graph.
194
- const byName = this.getAllDepsByName();
195
- for (const depName of Object.keys(all)) {
259
+ // pnpm --prod omits sub-deps for link: packages (and synthetic entries derived from them), and pnpm
260
+ // 10.29.3+ prints a repeated subtree only once, so every later occurrence is a childless `deduped`
261
+ // stub (which is what `tree` is when the stub was the first occurrence collected). For any dep
262
+ // declared in the package.json (all) that pnpm left out of the tree, recover the resolved entry
263
+ // from allDependencies so it lands in the production graph.
264
+ for (const [depName, declaredRange] of Object.entries(all)) {
196
265
  if (!deps[depName]) {
197
- const dep = byName.get(depName);
266
+ const dep = await this.resolveOmittedDependency(depName, declaredRange, tree.path);
198
267
  if (dep && isValidKey(depName)) {
199
268
  deps[depName] = dep;
200
269
  }
@@ -229,6 +298,24 @@ export class PnpmNodeModulesCollector extends NodeModulesCollector {
229
298
  }
230
299
  this.productionGraph[dependencyId] = { dependencies: collectedDependencies };
231
300
  }
301
+ /**
302
+ * Resolve a dependency that `pnpm list` left out of a package's tree to its `allDependencies` entry.
303
+ * The lookup goes through the copy node itself would load from `parentPath` (the package's real store
304
+ * directory), filtered by the declared range, and falls back to a name-only match only when nothing on
305
+ * disk resolves to a collected entry (a `link:` dep, whose entry is keyed by its `link:` version).
306
+ *
307
+ * A name-only lookup returns whichever version was collected first, which is wrong as soon as two
308
+ * versions of the package are installed: with the app pinning es5-ext@0.10.53 while its transitive
309
+ * 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
310
+ * esniff / event-emitter / next-tick@1.1.0 closure) vanished from the asar (#8493). pnpm 10.29.3+
311
+ * made this common, because its deduped output routes every repeated package through this recovery.
312
+ */
313
+ async resolveOmittedDependency(depName, declaredRange, parentPath) {
314
+ const range = typeof declaredRange === "string" ? declaredRange : undefined;
315
+ const located = await this.locateFromDepOrRoot(depName, parentPath, range);
316
+ const exact = located ? this.allDependencies.get(`${depName}@${located.packageJson.version}`) : undefined;
317
+ return exact ?? this.getAllDepsByName().get(depName);
318
+ }
232
319
  async collectAllDependencies(_tree, _appPackageName) {
233
320
  for (const root of this.allWorkspacePackages) {
234
321
  await this.collectDepsRecursively(root);
@@ -292,19 +379,28 @@ export class PnpmNodeModulesCollector extends NodeModulesCollector {
292
379
  const resolvedPath = linkTarget ?? located?.packageDir ?? value.path;
293
380
  this.allDependencies.set(id, { ...value, path: resolvedPath });
294
381
  // For transitive-dep discovery of entries pnpm did not expand (link: packages), use the
295
- // located package.json; fall back to the link target's own package.json when the junction
296
- // could not be resolved (again, the cross-drive case).
297
- const pkg = located ?? (linkTarget != null ? await this.readPackageJsonAt(linkTarget) : null);
382
+ // located package.json; fall back to reading it straight from the resolved directory when the
383
+ // by-name lookup came up empty. That happens whenever the package does not sit inside a
384
+ // `node_modules/<name>` directory it can find itself in: a cross-drive link target whose
385
+ // junction is unreadable, and a workspace package such as `packages/builder-util-runtime`,
386
+ // which nothing above it exposes under `node_modules/`. Without this fallback such a package
387
+ // contributes no dependencies at all (its `debug`/`sax` would vanish from the asar).
388
+ const pkg = located ?? (resolvedPath != null ? await this.readPackageJsonAt(resolvedPath) : null);
298
389
  const hasTreeDeps = Object.keys(value.dependencies ?? {}).length > 0 || Object.keys(value.optionalDependencies ?? {}).length > 0;
299
390
  if (!hasTreeDeps && pkg?.packageJson) {
300
391
  // pnpm list omits sub-deps for link: packages and for entries where the reported path
301
392
  // doesn't expand transitive deps (e.g. a link: package's nested dep). Use the on-disk
302
393
  // package.json to discover what to include, and pass the declared version range so that
303
394
  // resolution skips wrong-version hoisted packages and finds the correct nested copy.
304
- const pkgDepsDecl = { ...(pkg.packageJson.dependencies || {}), ...(pkg.packageJson.optionalDependencies || {}) };
395
+ const pkgOptionalDecl = pkg.packageJson.optionalDependencies || {};
396
+ const pkgDepsDecl = { ...(pkg.packageJson.dependencies || {}), ...pkgOptionalDecl };
305
397
  for (const [depName, depRange] of Object.entries(pkgDepsDecl)) {
306
398
  const resolved = await this.locateFromDepOrRoot(depName, pkg.packageDir, typeof depRange === "string" ? depRange : undefined);
307
399
  if (!resolved) {
400
+ // A miss here silently ships a broken app (the dependency is simply absent from the
401
+ // asar and only fails at runtime with MODULE_NOT_FOUND), so surface it in the log
402
+ // summary. Optional deps are an expected miss and get the quieter bucket.
403
+ this.logMissingDependency(`${depName}@${depRange}`, pkgOptionalDecl[depName] != null);
308
404
  continue;
309
405
  }
310
406
  await this.visitDep(depName, {