app-builder-lib 26.9.1 → 26.11.0
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.
- package/out/ProtonFramework.d.ts +1 -1
- package/out/ProtonFramework.js +2 -2
- package/out/ProtonFramework.js.map +1 -1
- package/out/binDownload.d.ts +2 -18
- package/out/binDownload.js +33 -185
- package/out/binDownload.js.map +1 -1
- package/out/codeSign/windowsSignToolManager.js +1 -1
- package/out/codeSign/windowsSignToolManager.js.map +1 -1
- package/out/configuration.d.ts +100 -68
- package/out/configuration.js.map +1 -1
- package/out/core.d.ts +2 -2
- package/out/core.js.map +1 -1
- package/out/electron/ElectronFramework.d.ts +2 -19
- package/out/electron/ElectronFramework.js +47 -40
- package/out/electron/ElectronFramework.js.map +1 -1
- package/out/electron/injectFFMPEG.d.ts +10 -1
- package/out/electron/injectFFMPEG.js +48 -34
- package/out/electron/injectFFMPEG.js.map +1 -1
- package/out/frameworks/LibUiFramework.d.ts +3 -2
- package/out/frameworks/LibUiFramework.js +5 -2
- package/out/frameworks/LibUiFramework.js.map +1 -1
- package/out/index.d.ts +3 -2
- package/out/index.js +1 -1
- package/out/index.js.map +1 -1
- package/out/macPackager.js +24 -3
- package/out/macPackager.js.map +1 -1
- package/out/node-module-collector/moduleManager.d.ts +7 -1
- package/out/node-module-collector/moduleManager.js +9 -2
- package/out/node-module-collector/moduleManager.js.map +1 -1
- package/out/node-module-collector/nodeModulesCollector.js +5 -3
- package/out/node-module-collector/nodeModulesCollector.js.map +1 -1
- package/out/node-module-collector/pnpmNodeModulesCollector.d.ts +26 -2
- package/out/node-module-collector/pnpmNodeModulesCollector.js +98 -18
- package/out/node-module-collector/pnpmNodeModulesCollector.js.map +1 -1
- package/out/options/AppXOptions.d.ts +1 -1
- package/out/options/AppXOptions.js.map +1 -1
- package/out/options/PlatformSpecificBuildOptions.d.ts +31 -11
- package/out/options/PlatformSpecificBuildOptions.js.map +1 -1
- package/out/options/SnapOptions.d.ts +1 -1
- package/out/options/SnapOptions.js.map +1 -1
- package/out/options/linuxOptions.d.ts +38 -12
- package/out/options/linuxOptions.js.map +1 -1
- package/out/options/macOptions.d.ts +10 -7
- package/out/options/macOptions.js.map +1 -1
- package/out/options/metadata.d.ts +1 -2
- package/out/options/metadata.js.map +1 -1
- package/out/options/pkgOptions.d.ts +1 -1
- package/out/options/pkgOptions.js.map +1 -1
- package/out/options/winOptions.d.ts +15 -5
- package/out/options/winOptions.js.map +1 -1
- package/out/packager.js +12 -12
- package/out/packager.js.map +1 -1
- package/out/platformPackager.js +2 -5
- package/out/platformPackager.js.map +1 -1
- package/out/targets/FpmTarget.js +3 -2
- package/out/targets/FpmTarget.js.map +1 -1
- package/out/targets/LinuxTargetHelper.d.ts +4 -4
- package/out/targets/LinuxTargetHelper.js.map +1 -1
- package/out/targets/MsiTarget.js +1 -1
- package/out/targets/MsiTarget.js.map +1 -1
- package/out/targets/appimage/AppImageTarget.d.ts +1 -0
- package/out/targets/appimage/AppImageTarget.js +30 -10
- package/out/targets/appimage/AppImageTarget.js.map +1 -1
- package/out/targets/appimage/appImageUtil.d.ts +30 -2
- package/out/targets/appimage/appImageUtil.js +26 -24
- package/out/targets/appimage/appImageUtil.js.map +1 -1
- package/out/targets/appimage/appLauncher.d.ts +1 -1
- package/out/targets/appimage/appLauncher.js +7 -3
- package/out/targets/appimage/appLauncher.js.map +1 -1
- package/out/targets/archive.js +20 -6
- package/out/targets/archive.js.map +1 -1
- package/out/targets/nsis/NsisTarget.js +11 -11
- package/out/targets/nsis/NsisTarget.js.map +1 -1
- package/out/targets/nsis/nsisOptions.d.ts +20 -16
- package/out/targets/nsis/nsisOptions.js.map +1 -1
- package/out/targets/nsis/nsisScriptGenerator.d.ts +1 -0
- package/out/targets/nsis/nsisScriptGenerator.js +14 -1
- package/out/targets/nsis/nsisScriptGenerator.js.map +1 -1
- package/out/targets/nsis/nsisUtil.js +4 -3
- package/out/targets/nsis/nsisUtil.js.map +1 -1
- package/out/toolsets/linux.js +8 -8
- package/out/toolsets/linux.js.map +1 -1
- package/out/toolsets/windows.d.ts +16 -16
- package/out/toolsets/windows.js +29 -21
- package/out/toolsets/windows.js.map +1 -1
- package/out/util/NodeModuleCopyHelper.js +1 -1
- package/out/util/NodeModuleCopyHelper.js.map +1 -1
- package/out/util/appBuilder.js +1 -1
- package/out/util/appBuilder.js.map +1 -1
- package/out/util/cacheState.d.ts +28 -0
- package/out/util/cacheState.js +143 -0
- package/out/util/cacheState.js.map +1 -0
- package/out/util/electronGet.d.ts +56 -0
- package/out/util/electronGet.js +388 -0
- package/out/util/electronGet.js.map +1 -0
- package/out/util/macroExpander.js +3 -0
- package/out/util/macroExpander.js.map +1 -1
- package/out/util/resEdit.d.ts +10 -0
- package/out/util/resEdit.js +48 -0
- package/out/util/resEdit.js.map +1 -0
- package/out/util/resolve.d.ts +1 -1
- package/out/util/resolve.js +16 -1
- package/out/util/resolve.js.map +1 -1
- package/out/version.d.ts +1 -1
- package/out/version.js +1 -1
- package/out/version.js.map +1 -1
- package/out/vm/ParallelsVm.d.ts +16 -0
- package/out/vm/ParallelsVm.js +0 -1
- package/out/vm/ParallelsVm.js.map +1 -1
- package/out/winPackager.js +44 -42
- package/out/winPackager.js.map +1 -1
- package/package.json +11 -9
- package/scheme.json +672 -135
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodeModulesCollector.js","sourceRoot":"","sources":["../../src/node-module-collector/nodeModulesCollector.ts"],"names":[],"mappings":";;;AAAA,+CAAyD;AACzD,8CAA6C;AAC7C,+BAA8B;AAC9B,uCAA4C;AAC5C,uCAA+B;AAC/B,6BAA4B;AAC5B,mCAAqE;AACrE,mDAAgE;AAChE,qDAA+D;AAG/D,MAAsB,oBAAoB;IAsBxC,YACqB,OAAe,EACjB,cAAsB;QADpB,YAAO,GAAP,OAAO,CAAQ;QACjB,mBAAc,GAAd,cAAc,CAAQ;QAvBxB,gBAAW,GAAqB,EAAE,CAAA;QAChC,oBAAe,GAA6B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AAC,IAAI,KAAK,CAAC,kDAAkD,IAAI,MAAM,MAAM,EAAE,CAAC,CAAC,CAAA;YAC5H,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;IACJ,CAAC;CACF;AA7YD,oDA6YC","sourcesContent":["import { exists, log, retry, TmpDir } from \"builder-util\"\nimport * as childProcess from \"child_process\"\nimport * as fs from \"fs-extra\"\nimport { createWriteStream } from \"fs-extra\"\nimport { Lazy } from \"lazy-val\"\nimport * as path from \"path\"\nimport { hoist, type HoisterResult, type HoisterTree } from \"./hoist\"\nimport { LogMessageByKey, ModuleManager } from \"./moduleManager\"\nimport { getPackageManagerCommand, PM } from \"./packageManager\"\nimport type { Dependency, DependencyGraph, NodeModuleInfo, PackageJson } from \"./types\"\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 if node_modules are hoisted: no config output. falling back to hoisted mode\")\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({ packageName }: { packageName: string }): 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 const hoisterResult: HoisterResult = hoist(this.transformToHoisterTree(this.productionGraph, packageName), {\n check: log.isDebugEnabled,\n })\n\n await this._getNodeModules(hoisterResult.dependencies, this.nodeModules)\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 fs.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 fs.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 if (error.message?.includes(\"Unexpected end of JSON input\")) {\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 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 node.dependencies.add(child)\n }\n }\n\n return node\n }\n\n private async _getNodeModules(dependencies: Set<HoisterResult>, result: NodeModuleInfo[]) {\n if (dependencies.size === 0) {\n return\n }\n\n for (const d of dependencies.values()) {\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.cache.logSummary[LogMessageByKey.PKG_NOT_ON_DISK].push(key)\n continue\n }\n\n const node: NodeModuleInfo = {\n name: d.name,\n version: reference,\n dir: await this.cache.realPath[p],\n }\n result.push(node)\n if (d.dependencies.size > 0) {\n node.dependencies = []\n await this._getNodeModules(d.dependencies, node.dependencies)\n }\n }\n result.sort((a, b) => a.name.localeCompare(b.name))\n }\n\n 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 fs.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 command and streams its output to a file.\n *\n * Spawns a child process to execute the specified command with arguments, capturing stdout\n * to a file. Handles Windows-specific quirks by wrapping .cmd files in a temporary .bat file\n * when necessary. Enables corepack strict mode by default but allows process.env overrides.\n *\n * Special handling for `npm list` exit code 1, which is expected in certain scenarios.\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 code\n */\n async streamCollectorCommandToFile(command: string, args: string[], cwd: string, tempOutputFile: string) {\n const execName = path.basename(command, path.extname(command))\n const ext = path.extname(command).toLowerCase()\n // Wrap .cmd files in a .bat file for correct cmd.exe execution.\n // Also wrap any Windows executable path that contains spaces (e.g. extensionless shims\n // from tools like Volta installed at \"C:\\Program Files\\Volta\\\") to ensure the path is\n // quoted correctly when passed to `spawn(..., { shell: true })`.\n const isWindowsScriptFile = process.platform === \"win32\" && (ext === \".cmd\" || (command.includes(\" \") && ext !== \".exe\"))\n if (isWindowsScriptFile) {\n // We need to wrap it in a .bat file to ensure it runs correctly with cmd.exe\n // This is necessary because some files (like .cmd) are not directly executable in the same way as .bat files.\n // We create a temporary .bat file that calls the script-like file with the provided arguments. The .bat file will be executed by cmd.exe.\n // Note: This is a workaround for Windows command execution quirks when using `shell: true`\n const tempBatFile = await this.tempDirManager.getTempFile({\n prefix: execName,\n suffix: \".bat\",\n })\n const batScript = `@echo off\\r\\n\"${command}\" %*\\r\\n` // <-- CRLF required for .bat\n await fs.writeFile(tempBatFile, batScript, { encoding: \"utf8\" })\n command = \"cmd.exe\"\n args = [\"/c\", `\"${tempBatFile}\"`, ...args]\n }\n\n await new Promise<void>((resolve, reject) => {\n const outStream = createWriteStream(tempOutputFile)\n\n const child = childProcess.spawn(command, args, {\n cwd,\n env: { COREPACK_ENABLE_STRICT: \"0\", ...process.env }, // allow `process.env` overrides\n shell: true, // `true`` is required: https://github.com/electron-userland/electron-builder/issues/9488\n })\n\n let stderr = \"\"\n child.stdout.pipe(outStream)\n child.stderr.on(\"data\", chunk => {\n stderr += chunk.toString()\n })\n child.on(\"error\", err => {\n reject(new Error(`Node module collector spawn failed: ${err.message}`))\n })\n\n child.on(\"close\", code => {\n outStream.close()\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 this.cache.logSummary[LogMessageByKey.PKG_COLLECTOR_OUTPUT].push(stderr)\n }\n const shouldResolve = code === 0 || shouldIgnore\n return shouldResolve ? resolve() : reject(new Error(`Node module collector process exited with code ${code}:\\n${stderr}`))\n })\n })\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"nodeModulesCollector.js","sourceRoot":"","sources":["../../src/node-module-collector/nodeModulesCollector.ts"],"names":[],"mappings":";;;AAAA,+CAAyD;AACzD,8CAA6C;AAC7C,mCAAoC;AACpC,+BAA8B;AAC9B,uCAA4C;AAC5C,uCAA+B;AAC/B,6BAA4B;AAC5B,mCAAqE;AACrE,mDAAgE;AAChE,qDAA+D;AAG/D,MAAsB,oBAAoB;IAsBxC,YACqB,OA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AAC,KAAK,CAAC,EAAE,MAAM,EAAE,EAAE,wDAAwD,CAAC,CAAA;oBAC/E,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,+BAAe,CAAC,oBAAoB,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;gBAC1E,CAAC;gBACD,MAAM,aAAa,GAAG,IAAI,KAAK,CAAC,IAAI,YAAY,CAAA;gBAChD,OAAO,aAAa,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,kDAAkD,IAAI,MAAM,MAAM,EAAE,CAAC,CAAC,CAAA;YAC5H,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;IACJ,CAAC;CACF;AA9YD,oDA8YC","sourcesContent":["import { exists, log, retry, TmpDir } from \"builder-util\"\nimport * as childProcess from \"child_process\"\nimport { randomBytes } from \"crypto\"\nimport * as fs from \"fs-extra\"\nimport { createWriteStream } from \"fs-extra\"\nimport { Lazy } from \"lazy-val\"\nimport * as path from \"path\"\nimport { hoist, type HoisterResult, type HoisterTree } from \"./hoist\"\nimport { LogMessageByKey, ModuleManager } from \"./moduleManager\"\nimport { getPackageManagerCommand, PM } from \"./packageManager\"\nimport type { Dependency, DependencyGraph, NodeModuleInfo, PackageJson } from \"./types\"\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 if node_modules are hoisted: no config output. falling back to hoisted mode\")\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({ packageName }: { packageName: string }): 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 const hoisterResult: HoisterResult = hoist(this.transformToHoisterTree(this.productionGraph, packageName), {\n check: log.isDebugEnabled,\n })\n\n await this._getNodeModules(hoisterResult.dependencies, this.nodeModules)\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 fs.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 fs.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 if (error.message?.includes(\"Unexpected end of JSON input\")) {\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 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 node.dependencies.add(child)\n }\n }\n\n return node\n }\n\n private async _getNodeModules(dependencies: Set<HoisterResult>, result: NodeModuleInfo[]) {\n if (dependencies.size === 0) {\n return\n }\n\n for (const d of dependencies.values()) {\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.cache.logSummary[LogMessageByKey.PKG_NOT_ON_DISK].push(key)\n continue\n }\n\n const node: NodeModuleInfo = {\n name: d.name,\n version: reference,\n dir: await this.cache.realPath[p],\n }\n result.push(node)\n if (d.dependencies.size > 0) {\n node.dependencies = []\n await this._getNodeModules(d.dependencies, node.dependencies)\n }\n }\n result.sort((a, b) => a.name.localeCompare(b.name))\n }\n\n 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 fs.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 command and streams its output to a file.\n *\n * Spawns a child process to execute the specified command with arguments, capturing stdout\n * to a file. Handles Windows-specific quirks by wrapping .cmd files in a temporary .bat file\n * when necessary. Enables corepack strict mode by default but allows process.env overrides.\n *\n * Special handling for `npm list` exit code 1, which is expected in certain scenarios.\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 code\n */\n async streamCollectorCommandToFile(command: string, args: string[], cwd: string, tempOutputFile: string) {\n const execName = path.basename(command, path.extname(command))\n const ext = path.extname(command).toLowerCase()\n // Wrap .cmd files in a .bat file for correct cmd.exe execution.\n // Also wrap any Windows executable path that contains spaces (e.g. extensionless shims\n // from tools like Volta installed at \"C:\\Program Files\\Volta\\\") to ensure the path is\n // quoted correctly when passed to `spawn(..., { shell: true })`.\n const isWindowsScriptFile = process.platform === \"win32\" && (ext === \".cmd\" || (command.includes(\" \") && ext !== \".exe\"))\n if (isWindowsScriptFile) {\n // We need to wrap it in a .bat file to ensure it runs correctly with cmd.exe\n // This is necessary because some files (like .cmd) are not directly executable in the same way as .bat files.\n // We create a temporary .bat file that calls the script-like file with the provided arguments. The .bat file will be executed by cmd.exe.\n // Note: This is a workaround for Windows command execution quirks when using `shell: true`\n const tempBatFile = await this.tempDirManager.getTempFile({\n prefix: execName + \"-\" + randomBytes(8).toString(\"hex\"),\n suffix: \".bat\",\n })\n const escapedCommand = command.replace(/\"/g, `\"\"`)\n const batScript = `@echo off\\r\\n\"${escapedCommand}\" %*\\r\\n` // <-- CRLF required for .bat\n await fs.writeFile(tempBatFile, batScript, { encoding: \"utf8\", mode: 0o600 })\n command = \"cmd.exe\"\n args = [\"/c\", `\"${tempBatFile}\"`, ...args]\n }\n\n await new Promise<void>((resolve, reject) => {\n const outStream = createWriteStream(tempOutputFile)\n\n const child = childProcess.spawn(command, args, {\n cwd,\n env: { COREPACK_ENABLE_STRICT: \"0\", ...process.env }, // allow `process.env` overrides\n shell: true, // `true`` is required: https://github.com/electron-userland/electron-builder/issues/9488\n })\n\n let stderr = \"\"\n child.stdout.pipe(outStream)\n child.stderr.on(\"data\", chunk => {\n stderr += chunk.toString()\n })\n child.on(\"error\", err => {\n reject(new Error(`Node module collector spawn failed: ${err.message}`))\n })\n\n child.on(\"close\", code => {\n outStream.close()\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 this.cache.logSummary[LogMessageByKey.PKG_COLLECTOR_OUTPUT].push(stderr)\n }\n const shouldResolve = code === 0 || shouldIgnore\n return shouldResolve ? resolve() : reject(new Error(`Node module collector process exited with code ${code}:\\n${stderr}`))\n })\n })\n }\n}\n"]}
|
|
@@ -6,6 +6,28 @@ export declare class PnpmNodeModulesCollector extends NodeModulesCollector<PnpmD
|
|
|
6
6
|
manager: PM;
|
|
7
7
|
lockfile: string;
|
|
8
8
|
};
|
|
9
|
+
private _allWorkspacePackages;
|
|
10
|
+
private _pnpmMajorVersion;
|
|
11
|
+
private readonly pnpmVersion;
|
|
12
|
+
/**
|
|
13
|
+
* Memo for `locateFromDepOrRoot`, keyed by `name@version`. pnpm's content-addressed virtual
|
|
14
|
+
* store guarantees that any given `name@version` resolves to a single location on disk, so
|
|
15
|
+
* once we've resolved a package we can short-circuit every subsequent lookup. This is the
|
|
16
|
+
* dominant speedup for large workspaces where the `pnpm list --json` tree contains the same
|
|
17
|
+
* `name@version` thousands of times (one entry per dependent).
|
|
18
|
+
*/
|
|
19
|
+
private readonly locateMemo;
|
|
20
|
+
/**
|
|
21
|
+
* Visited set for `collectDepsRecursively`, keyed by `name@version`. Without this we re-walk
|
|
22
|
+
* every shared subtree of the pnpm list output, exploding work in deep workspaces.
|
|
23
|
+
*/
|
|
24
|
+
private readonly collectedDeps;
|
|
25
|
+
/**
|
|
26
|
+
* Returns the workspace packages to iterate over, gated by detected pnpm version:
|
|
27
|
+
* - pnpm v11+: multi-entry workspace output → return the full parsed array
|
|
28
|
+
* - pnpm < v11 / non-workspace / detection failure: single-tree behavior → return only [0]
|
|
29
|
+
*/
|
|
30
|
+
private get allWorkspacePackages();
|
|
9
31
|
protected getArgs(): string[];
|
|
10
32
|
/**
|
|
11
33
|
* Locate a package version, preferring the dep's own reported path before falling back to rootDir.
|
|
@@ -15,6 +37,8 @@ export declare class PnpmNodeModulesCollector extends NodeModulesCollector<PnpmD
|
|
|
15
37
|
*/
|
|
16
38
|
private locateFromDepOrRoot;
|
|
17
39
|
protected extractProductionDependencyGraph(tree: PnpmDependency, dependencyId: string): Promise<void>;
|
|
18
|
-
protected collectAllDependencies(
|
|
19
|
-
|
|
40
|
+
protected collectAllDependencies(_tree: PnpmDependency, _appPackageName: string): Promise<void>;
|
|
41
|
+
private collectDepsRecursively;
|
|
42
|
+
protected getTreeFromWorkspaces(tree: PnpmDependency, packageName: string): PnpmDependency;
|
|
43
|
+
protected parseDependenciesTree(jsonBlob: string): Promise<PnpmDependency>;
|
|
20
44
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PnpmNodeModulesCollector = void 0;
|
|
4
|
+
const lazy_val_1 = require("lazy-val");
|
|
4
5
|
const moduleManager_1 = require("./moduleManager");
|
|
5
6
|
const nodeModulesCollector_1 = require("./nodeModulesCollector");
|
|
6
7
|
const packageManager_1 = require("./packageManager");
|
|
@@ -11,6 +12,41 @@ class PnpmNodeModulesCollector extends nodeModulesCollector_1.NodeModulesCollect
|
|
|
11
12
|
manager: packageManager_1.PM.PNPM,
|
|
12
13
|
lockfile: "pnpm-lock.yaml",
|
|
13
14
|
};
|
|
15
|
+
// Raw backing field — all entries from `pnpm list --json`
|
|
16
|
+
this._allWorkspacePackages = [];
|
|
17
|
+
// Cached after parseDependenciesTree resolves the Lazy; 0 = safe default (treated as < v11)
|
|
18
|
+
this._pnpmMajorVersion = 0;
|
|
19
|
+
// Runs `pnpm --version` once and caches the major version number
|
|
20
|
+
this.pnpmVersion = new lazy_val_1.Lazy(async () => {
|
|
21
|
+
var _a;
|
|
22
|
+
const result = await this.asyncExec((0, packageManager_1.getPackageManagerCommand)(packageManager_1.PM.PNPM), ["--version"]);
|
|
23
|
+
const major = parseInt(((_a = result.stdout) !== null && _a !== void 0 ? _a : "0").split(".")[0], 10);
|
|
24
|
+
return isNaN(major) ? 0 : major;
|
|
25
|
+
});
|
|
26
|
+
/**
|
|
27
|
+
* Memo for `locateFromDepOrRoot`, keyed by `name@version`. pnpm's content-addressed virtual
|
|
28
|
+
* store guarantees that any given `name@version` resolves to a single location on disk, so
|
|
29
|
+
* once we've resolved a package we can short-circuit every subsequent lookup. This is the
|
|
30
|
+
* dominant speedup for large workspaces where the `pnpm list --json` tree contains the same
|
|
31
|
+
* `name@version` thousands of times (one entry per dependent).
|
|
32
|
+
*/
|
|
33
|
+
this.locateMemo = new Map();
|
|
34
|
+
/**
|
|
35
|
+
* Visited set for `collectDepsRecursively`, keyed by `name@version`. Without this we re-walk
|
|
36
|
+
* every shared subtree of the pnpm list output, exploding work in deep workspaces.
|
|
37
|
+
*/
|
|
38
|
+
this.collectedDeps = new Set();
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Returns the workspace packages to iterate over, gated by detected pnpm version:
|
|
42
|
+
* - pnpm v11+: multi-entry workspace output → return the full parsed array
|
|
43
|
+
* - pnpm < v11 / non-workspace / detection failure: single-tree behavior → return only [0]
|
|
44
|
+
*/
|
|
45
|
+
get allWorkspacePackages() {
|
|
46
|
+
if (this._pnpmMajorVersion >= 11) {
|
|
47
|
+
return this._allWorkspacePackages;
|
|
48
|
+
}
|
|
49
|
+
return this._allWorkspacePackages.slice(0, 1);
|
|
14
50
|
}
|
|
15
51
|
getArgs() {
|
|
16
52
|
return ["list", "--prod", "--json", "--depth", "Infinity", "--silent", "--loglevel=error"];
|
|
@@ -22,8 +58,32 @@ class PnpmNodeModulesCollector extends nodeModulesCollector_1.NodeModulesCollect
|
|
|
22
58
|
* versions of a dep exist in the workspace.
|
|
23
59
|
*/
|
|
24
60
|
async locateFromDepOrRoot(pkgName, parentPath, requiredRange) {
|
|
25
|
-
|
|
26
|
-
|
|
61
|
+
// pnpm's virtual store is content-addressed: every `name@version` lookup is deterministic,
|
|
62
|
+
// so memoize on the exact version. `requiredRange` is normally an exact version coming from
|
|
63
|
+
// the pnpm list output (e.g. `value.version`), which makes this cache hit on duplicates.
|
|
64
|
+
// Only memoize when we have a concrete version — semver ranges could resolve differently
|
|
65
|
+
// depending on what's installed at `parentPath` vs root, so skip the cache for those.
|
|
66
|
+
const memoKey = requiredRange && /^\d/.test(requiredRange) ? `${pkgName}@${requiredRange}` : null;
|
|
67
|
+
if (memoKey != null) {
|
|
68
|
+
const cached = this.locateMemo.get(memoKey);
|
|
69
|
+
if (cached != null) {
|
|
70
|
+
return cached;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
// pnpm's `.pnpm` virtual store is flat — no nested `node_modules/<a>/node_modules/<b>`
|
|
74
|
+
// structure exists. `downwardSearch` would burn thousands of `readdir`/`lstat` calls
|
|
75
|
+
// finding nothing, so skip it.
|
|
76
|
+
const promise = (async () => {
|
|
77
|
+
const fromDep = parentPath ? await this.cache.locatePackageVersion({ pkgName, parentDir: parentPath, requiredRange, skipDownwardSearch: true }) : null;
|
|
78
|
+
if (fromDep) {
|
|
79
|
+
return fromDep;
|
|
80
|
+
}
|
|
81
|
+
return this.cache.locatePackageVersion({ pkgName, parentDir: this.rootDir, requiredRange, skipDownwardSearch: true });
|
|
82
|
+
})();
|
|
83
|
+
if (memoKey != null) {
|
|
84
|
+
this.locateMemo.set(memoKey, promise);
|
|
85
|
+
}
|
|
86
|
+
return promise;
|
|
27
87
|
}
|
|
28
88
|
async extractProductionDependencyGraph(tree, dependencyId) {
|
|
29
89
|
var _a;
|
|
@@ -74,30 +134,50 @@ class PnpmNodeModulesCollector extends nodeModulesCollector_1.NodeModulesCollect
|
|
|
74
134
|
}
|
|
75
135
|
this.productionGraph[dependencyId] = { dependencies: collectedDependencies };
|
|
76
136
|
}
|
|
77
|
-
async collectAllDependencies(
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
137
|
+
async collectAllDependencies(_tree, _appPackageName) {
|
|
138
|
+
for (const root of this.allWorkspacePackages) {
|
|
139
|
+
await this.collectDepsRecursively(root);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
async collectDepsRecursively(tree) {
|
|
143
|
+
const visit = async (key, value) => {
|
|
144
|
+
var _a, _b;
|
|
81
145
|
if (((_a = value === null || value === void 0 ? void 0 : value.dedupedDependenciesCount) !== null && _a !== void 0 ? _a : 0) > 0) {
|
|
82
|
-
|
|
146
|
+
return;
|
|
83
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;
|
|
153
|
+
}
|
|
154
|
+
this.collectedDeps.add(id);
|
|
84
155
|
const pkg = await this.locateFromDepOrRoot(key, value.path, value.version);
|
|
85
|
-
this.allDependencies.set(
|
|
86
|
-
await this.
|
|
156
|
+
this.allDependencies.set(id, { ...value, path: (_b = pkg === null || pkg === void 0 ? void 0 : pkg.packageDir) !== null && _b !== void 0 ? _b : value.path });
|
|
157
|
+
await this.collectDepsRecursively(value);
|
|
158
|
+
};
|
|
159
|
+
for (const [key, value] of Object.entries(tree.dependencies || {})) {
|
|
160
|
+
await visit(key, value);
|
|
87
161
|
}
|
|
88
|
-
// Collect optional dependencies if they exist
|
|
89
162
|
for (const [key, value] of Object.entries(tree.optionalDependencies || {})) {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
163
|
+
await visit(key, value);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
getTreeFromWorkspaces(tree, packageName) {
|
|
167
|
+
// pnpm v10 workspace: app is nested as a dependency of root — handled by base class
|
|
168
|
+
const result = super.getTreeFromWorkspaces(tree, packageName);
|
|
169
|
+
if (result !== tree) {
|
|
170
|
+
return result;
|
|
96
171
|
}
|
|
172
|
+
// pnpm v11 workspace: each workspace package is a separate top-level array entry;
|
|
173
|
+
// 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 !== null && match !== void 0 ? match : tree;
|
|
97
176
|
}
|
|
98
|
-
parseDependenciesTree(jsonBlob) {
|
|
99
|
-
// pnpm returns an array of dependency trees
|
|
177
|
+
async parseDependenciesTree(jsonBlob) {
|
|
100
178
|
const dependencyTree = this.extractJsonFromPollutedOutput(jsonBlob);
|
|
179
|
+
this._allWorkspacePackages = dependencyTree;
|
|
180
|
+
this._pnpmMajorVersion = await this.pnpmVersion.value;
|
|
101
181
|
return dependencyTree[0];
|
|
102
182
|
}
|
|
103
183
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pnpmNodeModulesCollector.js","sourceRoot":"","sources":["../../src/node-module-collector/pnpmNodeModulesCollector.ts"],"names":[],"mappings":";;;AAAA,mDAAiD;AACjD,iEAA6D;AAC7D,qDAAqC;AAGrC,MAAa,wBAAyB,SAAQ,2CAAoD;IAAlG;;QACkB,mBAAc,GAAG;YAC/B,OAAO,EAAE,mBAAE,CAAC,IAAI;YAChB,QAAQ,EAAE,gBAAgB;SAC3B,CAAA;IAoGH,CAAC;IAlGW,OAAO;QACf,OAAO,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,kBAAkB,CAAC,CAAA;IAC5F,CAAC;IAED;;;;;OAKG;IACK,KAAK,CAAC,mBAAmB,CAAC,OAAe,EAAE,UAA8B,EAAE,aAAsB;QACvG,OAAO,CACL,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;YAC9G,CAAC,MAAM,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,CAAC,OAAO,EAAE,aAAa,EAAE,CAAC,CAAC,CAC7F,CAAA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AAL,KAAK,CAAE,wBAAwB,mCAAI,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;gBAC/C,SAAQ;YACV,CAAC;YACD,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,CAAA;YAC1E,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,GAAG,GAAG,IAAI,KAAK,CAAC,OAAO,EAAE,EAAE,EAAE,GAAG,KAAK,EAAE,IAAI,EAAE,MAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,UAAU,mCAAI,KAAK,CAAC,IAAI,EAAE,CAAC,CAAA;YACtG,MAAM,IAAI,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAA;QAC1C,CAAC;IACH,CAAC;IAES,qBAAqB,CAAC,QAAgB;QAC9C,4CAA4C;QAC5C,MAAM,cAAc,GAAqB,IAAI,CAAC,6BAA6B,CAAmB,QAAQ,CAAC,CAAA;QACvG,OAAO,cAAc,CAAC,CAAC,CAAC,CAAA;IAC1B,CAAC;CACF;AAxGD,4DAwGC","sourcesContent":["import { LogMessageByKey } from \"./moduleManager\"\nimport { NodeModulesCollector } from \"./nodeModulesCollector\"\nimport { PM } from \"./packageManager\"\nimport { PnpmDependency } from \"./types\"\n\nexport class PnpmNodeModulesCollector extends NodeModulesCollector<PnpmDependency, PnpmDependency> {\n public readonly installOptions = {\n manager: PM.PNPM,\n lockfile: \"pnpm-lock.yaml\",\n }\n\n protected getArgs(): string[] {\n return [\"list\", \"--prod\", \"--json\", \"--depth\", \"Infinity\", \"--silent\", \"--loglevel=error\"]\n }\n\n /**\n * Locate a package version, preferring the dep's own reported path before falling back to rootDir.\n * This is critical for pnpm non-hoisted (virtual store) setups where each package has its own\n * nested node_modules. Searching only from rootDir can resolve the wrong version when multiple\n * versions of a dep exist in the workspace.\n */\n private async locateFromDepOrRoot(pkgName: string, parentPath: string | undefined, requiredRange?: string) {\n return (\n (parentPath ? await this.cache.locatePackageVersion({ pkgName, parentDir: parentPath, requiredRange }) : null) ||\n (await this.cache.locatePackageVersion({ pkgName, parentDir: this.rootDir, requiredRange }))\n )\n }\n\n protected async extractProductionDependencyGraph(tree: PnpmDependency, dependencyId: string) {\n if (this.productionGraph[dependencyId]) {\n return\n }\n this.productionGraph[dependencyId] = { dependencies: [] }\n\n if ((tree.dedupedDependenciesCount ?? 0) > 0) {\n const realDep = this.allDependencies.get(dependencyId)\n if (realDep) {\n this.cache.logSummary[LogMessageByKey.PKG_DUPLICATE_REF].push(dependencyId)\n tree = realDep\n } else {\n this.cache.logSummary[LogMessageByKey.PKG_DUPLICATE_REF_UNRESOLVED].push(dependencyId)\n return\n }\n }\n\n const packageName = tree.name || tree.from\n const { packageJson } = (await this.locateFromDepOrRoot(packageName, tree.path, tree.version)) || {}\n\n const all = packageJson ? { ...packageJson.dependencies, ...packageJson.optionalDependencies } : { ...tree.dependencies, ...tree.optionalDependencies }\n const optional = packageJson ? { ...packageJson.optionalDependencies } : {}\n\n const deps = { ...(tree.dependencies || {}), ...(tree.optionalDependencies || {}) }\n this.productionGraph[dependencyId] = { dependencies: [] }\n const depPromises = Object.entries(deps).map(async ([packageName, dependency]) => {\n // First check if it's in production dependencies\n if (!all[packageName]) {\n return undefined\n }\n\n // Then check if optional dependency path exists (using actual resolved path)\n if (optional[packageName]) {\n const pkg = await this.locateFromDepOrRoot(packageName, tree.path, dependency.version)\n if (!pkg) {\n this.cache.logSummary[LogMessageByKey.PKG_OPTIONAL_NOT_INSTALLED].push(`${packageName}@${dependency.version}`)\n return undefined\n }\n }\n const { id: childDependencyId, pkgOverride } = this.normalizePackageVersion(packageName, dependency)\n await this.extractProductionDependencyGraph(pkgOverride, childDependencyId)\n return childDependencyId\n })\n\n const collectedDependencies: string[] = []\n for (const dep of depPromises) {\n const result = await dep\n if (result !== undefined) {\n collectedDependencies.push(result)\n }\n }\n this.productionGraph[dependencyId] = { dependencies: collectedDependencies }\n }\n\n protected async collectAllDependencies(tree: PnpmDependency) {\n // Collect regular dependencies\n for (const [key, value] of Object.entries(tree.dependencies || {})) {\n if ((value?.dedupedDependenciesCount ?? 0) > 0) {\n continue\n }\n const pkg = await this.locateFromDepOrRoot(key, value.path, value.version)\n this.allDependencies.set(`${key}@${value.version}`, { ...value, path: pkg?.packageDir ?? value.path })\n await this.collectAllDependencies(value)\n }\n\n // Collect optional dependencies if they exist\n for (const [key, value] of Object.entries(tree.optionalDependencies || {})) {\n if ((value?.dedupedDependenciesCount ?? 0) > 0) {\n continue\n }\n const pkg = await this.locateFromDepOrRoot(key, value.path, value.version)\n this.allDependencies.set(`${key}@${value.version}`, { ...value, path: pkg?.packageDir ?? value.path })\n await this.collectAllDependencies(value)\n }\n }\n\n protected parseDependenciesTree(jsonBlob: string): PnpmDependency {\n // pnpm returns an array of dependency trees\n const dependencyTree: PnpmDependency[] = this.extractJsonFromPollutedOutput<PnpmDependency[]>(jsonBlob)\n return dependencyTree[0]\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"pnpmNodeModulesCollector.js","sourceRoot":"","sources":["../../src/node-module-collector/pnpmNodeModulesCollector.ts"],"names":[],"mappings":";;;AAAA,uCAA+B;AAC/B,mDAA+D;AAC/D,iEAA6D;AAC7D,qDAA+D;AAG/D,MAAa,wBAAyB,SAAQ,2CAAoD;IAAlG;;QACkB,mBAAc,GAAG;YAC/B,OAAO,EAAE,mBAAE,CAAC,IAAI;YAChB,QAAQ,EAAE,gBAAgB;SAC3B,CAAA;QAED,0DAA0D;QAClD,0BAAqB,GAAqB,EAAE,CAAA;QACpD,4FAA4F;QACpF,sBAAiB,GAAG,CAAC,CAAA;QAC7B,iEAAiE;QAChD,gBAAW,GAAG,IAAI,eAAI,CAAS,KAAK,IAAI,EAAE;;YACzD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,IAAA,yCAAwB,EAAC,mBAAE,CAAC,IAAI,CAAC,EAAE,CAAC,WAAW,C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B,IAAI,EAAE,CAAC,EAAE,CAAC;YAC3E,MAAM,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;QACzB,CAAC;IACH,CAAC;IAEkB,qBAAqB,CAAC,IAAoB,EAAE,WAAmB;QAChF,oFAAoF;QACpF,MAAM,MAAM,GAAG,KAAK,CAAC,qBAAqB,CAAC,IAAI,EAAE,WAAW,CAAC,CAAA;QAC7D,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;YACpB,OAAO,MAAM,CAAA;QACf,CAAC;QACD,kFAAkF;QAClF,4FAA4F;QAC5F,MAAM,KAAK,GAAG,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,WAAW,IAAI,GAAG,CAAC,IAAI,KAAK,WAAW,CAAC,CAAA;QACzG,OAAO,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,IAAI,CAAA;IACtB,CAAC;IAES,KAAK,CAAC,qBAAqB,CAAC,QAAgB;QACpD,MAAM,cAAc,GAAG,IAAI,CAAC,6BAA6B,CAAmB,QAAQ,CAAC,CAAA;QACrF,IAAI,CAAC,qBAAqB,GAAG,cAAc,CAAA;QAC3C,IAAI,CAAC,iBAAiB,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,KAAK,CAAA;QACrD,OAAO,cAAc,CAAC,CAAC,CAAC,CAAA;IAC1B,CAAC;CACF;AA5LD,4DA4LC","sourcesContent":["import { Lazy } from \"lazy-val\"\nimport { LogMessageByKey, type Package } from \"./moduleManager\"\nimport { NodeModulesCollector } from \"./nodeModulesCollector\"\nimport { getPackageManagerCommand, PM } from \"./packageManager\"\nimport { PnpmDependency } from \"./types\"\n\nexport class PnpmNodeModulesCollector extends NodeModulesCollector<PnpmDependency, PnpmDependency> {\n public readonly installOptions = {\n manager: PM.PNPM,\n lockfile: \"pnpm-lock.yaml\",\n }\n\n // Raw backing field — all entries from `pnpm list --json`\n private _allWorkspacePackages: PnpmDependency[] = []\n // Cached after parseDependenciesTree resolves the Lazy; 0 = safe default (treated as < v11)\n private _pnpmMajorVersion = 0\n // Runs `pnpm --version` once and caches the major version number\n private readonly pnpmVersion = new Lazy<number>(async () => {\n const result = await this.asyncExec(getPackageManagerCommand(PM.PNPM), [\"--version\"])\n const major = parseInt((result.stdout ?? \"0\").split(\".\")[0], 10)\n return isNaN(major) ? 0 : major\n })\n\n /**\n * Memo for `locateFromDepOrRoot`, keyed by `name@version`. pnpm's content-addressed virtual\n * store guarantees that any given `name@version` resolves to a single location on disk, so\n * once we've resolved a package we can short-circuit every subsequent lookup. This is the\n * dominant speedup for large workspaces where the `pnpm list --json` tree contains the same\n * `name@version` thousands of times (one entry per dependent).\n */\n private readonly locateMemo: Map<string, Promise<Package | null>> = new Map()\n\n /**\n * Visited set for `collectDepsRecursively`, keyed by `name@version`. Without this we re-walk\n * every shared subtree of the pnpm list output, exploding work in deep workspaces.\n */\n private readonly collectedDeps: Set<string> = new Set()\n\n /**\n * Returns the workspace packages to iterate over, gated by detected pnpm version:\n * - pnpm v11+: multi-entry workspace output → return the full parsed array\n * - pnpm < v11 / non-workspace / detection failure: single-tree behavior → return only [0]\n */\n private get allWorkspacePackages(): PnpmDependency[] {\n if (this._pnpmMajorVersion >= 11) {\n return this._allWorkspacePackages\n }\n return this._allWorkspacePackages.slice(0, 1)\n }\n\n protected getArgs(): string[] {\n return [\"list\", \"--prod\", \"--json\", \"--depth\", \"Infinity\", \"--silent\", \"--loglevel=error\"]\n }\n\n /**\n * Locate a package version, preferring the dep's own reported path before falling back to rootDir.\n * This is critical for pnpm non-hoisted (virtual store) setups where each package has its own\n * nested node_modules. Searching only from rootDir can resolve the wrong version when multiple\n * versions of a dep exist in the workspace.\n */\n private async locateFromDepOrRoot(pkgName: string, parentPath: string | undefined, requiredRange?: string) {\n // pnpm's virtual store is content-addressed: every `name@version` lookup is deterministic,\n // so memoize on the exact version. `requiredRange` is normally an exact version coming from\n // the pnpm list output (e.g. `value.version`), which makes this cache hit on duplicates.\n // Only memoize when we have a concrete version — semver ranges could resolve differently\n // depending on what's installed at `parentPath` vs root, so skip the cache for those.\n const memoKey = requiredRange && /^\\d/.test(requiredRange) ? `${pkgName}@${requiredRange}` : null\n if (memoKey != null) {\n const cached = this.locateMemo.get(memoKey)\n if (cached != null) {\n return cached\n }\n }\n\n // pnpm's `.pnpm` virtual store is flat — no nested `node_modules/<a>/node_modules/<b>`\n // structure exists. `downwardSearch` would burn thousands of `readdir`/`lstat` calls\n // finding nothing, so skip it.\n const promise = (async (): Promise<Package | null> => {\n const fromDep = parentPath ? await this.cache.locatePackageVersion({ pkgName, parentDir: parentPath, requiredRange, skipDownwardSearch: true }) : null\n if (fromDep) {\n return fromDep\n }\n return this.cache.locatePackageVersion({ pkgName, parentDir: this.rootDir, requiredRange, skipDownwardSearch: true })\n })()\n\n if (memoKey != null) {\n this.locateMemo.set(memoKey, promise)\n }\n return promise\n }\n\n protected async extractProductionDependencyGraph(tree: PnpmDependency, dependencyId: string) {\n if (this.productionGraph[dependencyId]) {\n return\n }\n this.productionGraph[dependencyId] = { dependencies: [] }\n\n if ((tree.dedupedDependenciesCount ?? 0) > 0) {\n const realDep = this.allDependencies.get(dependencyId)\n if (realDep) {\n this.cache.logSummary[LogMessageByKey.PKG_DUPLICATE_REF].push(dependencyId)\n tree = realDep\n } else {\n this.cache.logSummary[LogMessageByKey.PKG_DUPLICATE_REF_UNRESOLVED].push(dependencyId)\n return\n }\n }\n\n const packageName = tree.name || tree.from\n const { packageJson } = (await this.locateFromDepOrRoot(packageName, tree.path, tree.version)) || {}\n\n const all = packageJson ? { ...packageJson.dependencies, ...packageJson.optionalDependencies } : { ...tree.dependencies, ...tree.optionalDependencies }\n const optional = packageJson ? { ...packageJson.optionalDependencies } : {}\n\n const deps = { ...(tree.dependencies || {}), ...(tree.optionalDependencies || {}) }\n this.productionGraph[dependencyId] = { dependencies: [] }\n const depPromises = Object.entries(deps).map(async ([packageName, dependency]) => {\n // First check if it's in production dependencies\n if (!all[packageName]) {\n return undefined\n }\n\n // Then check if optional dependency path exists (using actual resolved path)\n if (optional[packageName]) {\n const pkg = await this.locateFromDepOrRoot(packageName, tree.path, dependency.version)\n if (!pkg) {\n this.cache.logSummary[LogMessageByKey.PKG_OPTIONAL_NOT_INSTALLED].push(`${packageName}@${dependency.version}`)\n return undefined\n }\n }\n const { id: childDependencyId, pkgOverride } = this.normalizePackageVersion(packageName, dependency)\n await this.extractProductionDependencyGraph(pkgOverride, childDependencyId)\n return childDependencyId\n })\n\n const collectedDependencies: string[] = []\n for (const dep of depPromises) {\n const result = await dep\n if (result !== undefined) {\n collectedDependencies.push(result)\n }\n }\n this.productionGraph[dependencyId] = { dependencies: collectedDependencies }\n }\n\n protected async collectAllDependencies(_tree: PnpmDependency, _appPackageName: string): Promise<void> {\n for (const root of this.allWorkspacePackages) {\n await this.collectDepsRecursively(root)\n }\n }\n\n private async collectDepsRecursively(tree: PnpmDependency): Promise<void> {\n const visit = async (key: string, value: PnpmDependency) => {\n if ((value?.dedupedDependenciesCount ?? 0) > 0) {\n return\n }\n const id = `${key}@${value.version}`\n // The pnpm list output can include the same `name@version` thousands of times across a\n // deep workspace; without this guard we re-resolve and re-recurse each occurrence.\n if (this.collectedDeps.has(id)) {\n return\n }\n this.collectedDeps.add(id)\n const pkg = await this.locateFromDepOrRoot(key, value.path, value.version)\n this.allDependencies.set(id, { ...value, path: pkg?.packageDir ?? value.path })\n await this.collectDepsRecursively(value)\n }\n\n for (const [key, value] of Object.entries(tree.dependencies || {})) {\n await visit(key, value)\n }\n for (const [key, value] of Object.entries(tree.optionalDependencies || {})) {\n await visit(key, value)\n }\n }\n\n protected override getTreeFromWorkspaces(tree: PnpmDependency, packageName: string): PnpmDependency {\n // pnpm v10 workspace: app is nested as a dependency of root — handled by base class\n const result = super.getTreeFromWorkspaces(tree, packageName)\n if (result !== tree) {\n return result\n }\n // pnpm v11 workspace: each workspace package is a separate top-level array entry;\n // non-workspace (single-tree): find returns the one entry or undefined → falls back to tree\n const match = this.allWorkspacePackages.find(pkg => pkg.name === packageName || pkg.from === packageName)\n return match ?? tree\n }\n\n protected async parseDependenciesTree(jsonBlob: string): Promise<PnpmDependency> {\n const dependencyTree = this.extractJsonFromPollutedOutput<PnpmDependency[]>(jsonBlob)\n this._allWorkspacePackages = dependencyTree\n this._pnpmMajorVersion = await this.pnpmVersion.value\n return dependencyTree[0]\n }\n}\n"]}
|
|
@@ -15,7 +15,7 @@ export interface AppXOptions extends TargetSpecificOptions {
|
|
|
15
15
|
*/
|
|
16
16
|
readonly displayName?: string | null;
|
|
17
17
|
/**
|
|
18
|
-
* The name. Corresponds to [Identity.Name](https://msdn.microsoft.com/en-us/library/windows/apps/br211441.aspx). Defaults to the [application name](
|
|
18
|
+
* The name. Corresponds to [Identity.Name](https://msdn.microsoft.com/en-us/library/windows/apps/br211441.aspx). Defaults to the [application name](https://www.electron.build/configuration#metadata).
|
|
19
19
|
*/
|
|
20
20
|
readonly identityName?: string | null;
|
|
21
21
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppXOptions.js","sourceRoot":"","sources":["../../src/options/AppXOptions.ts"],"names":[],"mappings":"","sourcesContent":["import { TargetSpecificOptions } from \"../core\"\n\nexport interface AppXOptions extends TargetSpecificOptions {\n /**\n * The application id. Defaults to `identityName`. This string contains alpha-numeric fields separated by periods. Each field must begin with an ASCII alphabetic character.\n */\n readonly applicationId?: string\n\n /**\n * The background color of the app tile. See [Visual Elements](https://msdn.microsoft.com/en-us/library/windows/apps/br211471.aspx).\n * @default #464646\n */\n readonly backgroundColor?: string | null\n\n /**\n * A friendly name that can be displayed to users. Corresponds to [Properties.DisplayName](https://msdn.microsoft.com/en-us/library/windows/apps/br211432.aspx).\n * Defaults to the application product name.\n */\n readonly displayName?: string | null\n\n /**\n * The name. Corresponds to [Identity.Name](https://msdn.microsoft.com/en-us/library/windows/apps/br211441.aspx). Defaults to the [application name](
|
|
1
|
+
{"version":3,"file":"AppXOptions.js","sourceRoot":"","sources":["../../src/options/AppXOptions.ts"],"names":[],"mappings":"","sourcesContent":["import { TargetSpecificOptions } from \"../core\"\n\nexport interface AppXOptions extends TargetSpecificOptions {\n /**\n * The application id. Defaults to `identityName`. This string contains alpha-numeric fields separated by periods. Each field must begin with an ASCII alphabetic character.\n */\n readonly applicationId?: string\n\n /**\n * The background color of the app tile. See [Visual Elements](https://msdn.microsoft.com/en-us/library/windows/apps/br211471.aspx).\n * @default #464646\n */\n readonly backgroundColor?: string | null\n\n /**\n * A friendly name that can be displayed to users. Corresponds to [Properties.DisplayName](https://msdn.microsoft.com/en-us/library/windows/apps/br211432.aspx).\n * Defaults to the application product name.\n */\n readonly displayName?: string | null\n\n /**\n * The name. Corresponds to [Identity.Name](https://msdn.microsoft.com/en-us/library/windows/apps/br211441.aspx). Defaults to the [application name](https://www.electron.build/configuration#metadata).\n */\n readonly identityName?: string | null\n\n /**\n * The Windows Store publisher. Not used if AppX is build for testing. See [AppX Package Code Signing](#appx-package-code-signing) below.\n */\n readonly publisher?: string | null\n\n /**\n * A friendly name for the publisher that can be displayed to users. Corresponds to [Properties.PublisherDisplayName](https://msdn.microsoft.com/en-us/library/windows/apps/br211460.aspx).\n * Defaults to company name from the application metadata.\n */\n readonly publisherDisplayName?: string | null\n\n /**\n * The list of [supported languages](https://docs.microsoft.com/en-us/windows/uwp/globalizing/manage-language-and-region#specify-the-supported-languages-in-the-apps-manifest) that will be listed in the Windows Store.\n * The first entry (index 0) will be the default language.\n * Defaults to en-US if omitted.\n */\n readonly languages?: Array<string> | string | null\n\n /**\n * Whether to add auto launch extension. Defaults to `true` if [electron-winstore-auto-launch](https://github.com/felixrieseberg/electron-winstore-auto-launch) in the dependencies.\n */\n readonly addAutoLaunchExtension?: boolean\n\n /**\n * Relative path to custom extensions xml to be included in an `appmanifest.xml`.\n */\n readonly customExtensionsPath?: string\n\n /**\n * The list of [capabilities](https://learn.microsoft.com/en-us/windows/uwp/packaging/app-capability-declarations) to be added to an `appmanifest.xml`.\n * The `runFullTrust` capability is obligatory for electron apps and will be auto added if not specified here.\n * Defaults to `['runFullTrust']` if omitted\n * Example: `['runFullTrust', 'privateNetworkClientServer', 'webcam']`\n */\n readonly capabilities?: Array<string> | null\n\n /**\n * (Advanced Option) Relative path to custom `appmanifest.xml` (file name doesn't matter, it'll be renamed) located in build resources directory.\n * Supports the following template macros:\n *\n * - ${publisher}\n * - ${publisherDisplayName}\n * - ${version}\n * - ${applicationId}\n * - ${identityName}\n * - ${executable}\n * - ${displayName}\n * - ${description}\n * - ${backgroundColor}\n * - ${logo}\n * - ${square150x150Logo}\n * - ${square44x44Logo}\n * - ${lockScreen}\n * - ${defaultTile}\n * - ${splashScreen}\n * - ${arch}\n * - ${resourceLanguages}\n * - ${capabilities}\n * - ${extensions}\n * - ${minVersion}\n * - ${maxVersionTested}\n */\n readonly customManifestPath?: string\n\n /**\n * Whether to overlay the app's name on top of tile images on the Start screen. Defaults to `false`. (https://docs.microsoft.com/en-us/uwp/schemas/appxpackage/uapmanifestschema/element-uap-shownameontiles) in the dependencies.\n * @default false\n */\n readonly showNameOnTiles?: boolean\n\n /**\n * @private\n * @default false\n */\n readonly electronUpdaterAware?: boolean\n\n /**\n * Whether to set build number. See https://github.com/electron-userland/electron-builder/issues/3875\n * @default false\n */\n readonly setBuildNumber?: boolean\n\n /**\n * Set the MinVersion field in the appx manifest.xml\n * @default arch === Arch.arm64 ? \"10.0.16299.0\" : \"10.0.14316.0\"\n */\n readonly minVersion?: string | null\n\n /**\n * Set the `MaxVersionTested` field in the appx manifest.xml\n * @default arch === Arch.arm64 ? \"10.0.16299.0\" : \"10.0.14316.0\"\n */\n readonly maxVersionTested?: string | null\n\n /** @private */\n readonly makeappxArgs?: Array<string> | null\n}\n"]}
|
|
@@ -4,7 +4,7 @@ export interface FileSet {
|
|
|
4
4
|
/**
|
|
5
5
|
* The source path relative to and defaults to:
|
|
6
6
|
*
|
|
7
|
-
* - the [app directory](configuration
|
|
7
|
+
* - the [app directory](https://www.electron.build/configuration#directories) for `files`,
|
|
8
8
|
* - the project directory for `extraResources` and `extraFiles`.
|
|
9
9
|
* If you don't use two-package.json structure and don't set custom app directory, app directory equals to project directory.
|
|
10
10
|
*/
|
|
@@ -18,7 +18,7 @@ export interface FileSet {
|
|
|
18
18
|
*/
|
|
19
19
|
to?: string;
|
|
20
20
|
/**
|
|
21
|
-
* The [glob patterns](
|
|
21
|
+
* The [glob patterns](https://www.electron.build/file-patterns). Defaults to "**\/*"
|
|
22
22
|
*/
|
|
23
23
|
filter?: Array<string> | string;
|
|
24
24
|
}
|
|
@@ -28,11 +28,17 @@ export interface AsarOptions {
|
|
|
28
28
|
* @default true
|
|
29
29
|
*/
|
|
30
30
|
smartUnpack?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Path to a file containing the order in which files should be packed into the asar archive.
|
|
33
|
+
* Each line of the file is a relative path from the app directory. Files listed first are
|
|
34
|
+
* packed first, which can improve app startup time by front-loading frequently accessed modules.
|
|
35
|
+
* See the [asar documentation](https://github.com/electron/asar) for details.
|
|
36
|
+
*/
|
|
31
37
|
ordering?: string | null;
|
|
32
38
|
}
|
|
33
39
|
export interface FilesBuildOptions {
|
|
34
40
|
/**
|
|
35
|
-
* A [glob patterns](
|
|
41
|
+
* A [glob patterns](https://www.electron.build/file-patterns) relative to the [app directory](https://www.electron.build/configuration#directories), which specifies which files to include when copying files to create the package.
|
|
36
42
|
|
|
37
43
|
Defaults to:
|
|
38
44
|
```json
|
|
@@ -56,7 +62,7 @@ export interface FilesBuildOptions {
|
|
|
56
62
|
|
|
57
63
|
Default pattern \`**\/*\` **is not added to your custom** if some of your patterns is not ignore (i.e. not starts with `!`). `package.json` and \`**\/node_modules/**\/*` (only production dependencies will be copied) is added to your custom in any case. All default ignores are added in any case — you don't need to repeat it if you configure own patterns.
|
|
58
64
|
|
|
59
|
-
May be specified in the platform options (e.g. in the [mac](mac
|
|
65
|
+
May be specified in the platform options (e.g. in the [mac](https://www.electron.build/mac)).
|
|
60
66
|
|
|
61
67
|
You may also specify custom source and destination directories by using `FileSet` objects instead of simple glob patterns.
|
|
62
68
|
|
|
@@ -70,11 +76,11 @@ export interface FilesBuildOptions {
|
|
|
70
76
|
]
|
|
71
77
|
```
|
|
72
78
|
|
|
73
|
-
You can use [file macros](
|
|
79
|
+
You can use [file macros](https://www.electron.build/file-patterns#file-macros) in the `from` and `to` fields as well. `from` and `to` can be files and you can use this to [rename](https://github.com/electron-userland/electron-builder/issues/1119) a file while packaging.
|
|
74
80
|
*/
|
|
75
81
|
files?: Array<FileSet | string> | FileSet | string | null;
|
|
76
82
|
/**
|
|
77
|
-
* A [glob patterns](
|
|
83
|
+
* A [glob patterns](https://www.electron.build/file-patterns) relative to the project directory, when specified, copy the file or directory with matching names directly into the app's resources directory (`Contents/Resources` for MacOS, `resources` for Linux and Windows).
|
|
78
84
|
*
|
|
79
85
|
* File patterns (and support for `from` and `to` fields) the same as for [files](#files).
|
|
80
86
|
*
|
|
@@ -93,7 +99,7 @@ export interface PlatformSpecificBuildOptions extends TargetSpecificOptions, Fil
|
|
|
93
99
|
*/
|
|
94
100
|
readonly appId?: string | null;
|
|
95
101
|
/**
|
|
96
|
-
* The [artifact file name template](
|
|
102
|
+
* The [artifact file name template](https://www.electron.build/configuration#artifact-file-name-template). Defaults to `${productName}-${version}.${ext}` (some target can have other defaults, see corresponding options).
|
|
97
103
|
*/
|
|
98
104
|
readonly artifactName?: string | null;
|
|
99
105
|
/**
|
|
@@ -120,9 +126,10 @@ export interface PlatformSpecificBuildOptions extends TargetSpecificOptions, Fil
|
|
|
120
126
|
*/
|
|
121
127
|
readonly asar?: AsarOptions | boolean | null;
|
|
122
128
|
/**
|
|
123
|
-
* A [glob patterns](
|
|
129
|
+
* A [glob patterns](https://www.electron.build/file-patterns) relative to the [app directory](#directories), which specifies which files to unpack when creating the [asar](http://electron.atom.io/docs/tutorial/application-packaging/) archive.
|
|
124
130
|
*/
|
|
125
131
|
readonly asarUnpack?: Array<string> | string | null;
|
|
132
|
+
/** @private */
|
|
126
133
|
readonly icon?: string | null;
|
|
127
134
|
/**
|
|
128
135
|
* The file associations.
|
|
@@ -138,14 +145,15 @@ export interface PlatformSpecificBuildOptions extends TargetSpecificOptions, Fil
|
|
|
138
145
|
readonly electronLanguages?: Array<string> | string;
|
|
139
146
|
/**
|
|
140
147
|
* Whether to fail if app will be not code signed.
|
|
148
|
+
* @default false
|
|
141
149
|
*/
|
|
142
150
|
readonly forceCodeSigning?: boolean;
|
|
143
151
|
/**
|
|
144
|
-
* The [electron-updater compatibility](
|
|
152
|
+
* The [electron-updater compatibility](https://www.electron.build/auto-update#compatibility) semver range.
|
|
145
153
|
*/
|
|
146
154
|
readonly electronUpdaterCompatibility?: string | null;
|
|
147
155
|
/**
|
|
148
|
-
* Publisher configuration. See [Auto Update](
|
|
156
|
+
* Publisher configuration. See [Auto Update](https://www.electron.build/publish) for more information.
|
|
149
157
|
*/
|
|
150
158
|
publish?: Publish;
|
|
151
159
|
/**
|
|
@@ -167,9 +175,21 @@ export interface PlatformSpecificBuildOptions extends TargetSpecificOptions, Fil
|
|
|
167
175
|
* ```
|
|
168
176
|
*/
|
|
169
177
|
readonly releaseInfo?: ReleaseInfo;
|
|
178
|
+
/**
|
|
179
|
+
* The build target(s) for this platform. Can be a target name string, a {@link TargetConfiguration}
|
|
180
|
+
* object, or an array of either. Available targets depend on the platform — see platform-specific
|
|
181
|
+
* options (e.g. {@link MacConfiguration.target}, {@link WindowsConfiguration.target},
|
|
182
|
+
* {@link LinuxConfiguration.target}).
|
|
183
|
+
*/
|
|
170
184
|
readonly target?: Array<string | TargetConfiguration> | string | TargetConfiguration | null;
|
|
185
|
+
/** @private */
|
|
171
186
|
cscLink?: string | null;
|
|
187
|
+
/** @private */
|
|
172
188
|
cscKeyPassword?: string | null;
|
|
189
|
+
/**
|
|
190
|
+
* The default architecture to build for when no `--arch` flag is specified.
|
|
191
|
+
* Defaults to the current machine's architecture.
|
|
192
|
+
*/
|
|
173
193
|
readonly defaultArch?: string;
|
|
174
194
|
}
|
|
175
195
|
export interface ReleaseInfo {
|
|
@@ -182,7 +202,7 @@ export interface ReleaseInfo {
|
|
|
182
202
|
*/
|
|
183
203
|
releaseNotes?: string | null;
|
|
184
204
|
/**
|
|
185
|
-
* The path to release notes file. Defaults to `release-notes-${platform}.md` (where `platform` it is current platform — `mac`, `linux` or `windows`) or `release-notes.md` in the [build resources](
|
|
205
|
+
* The path to release notes file. Defaults to `release-notes-${platform}.md` (where `platform` it is current platform — `mac`, `linux` or `windows`) or `release-notes.md` in the [build resources](https://www.electron.build/contents#extraresources).
|
|
186
206
|
*/
|
|
187
207
|
releaseNotesFile?: string | null;
|
|
188
208
|
/**
|