import Yarn_processor from "./yarn_processor.js"; /** * Processor for Yarn Berry package manager * Handles parsing and processing of dependencies for Yarn Berry projects */ export default class Yarn_berry_processor extends Yarn_processor { #private; static LOCATOR_PATTERN: RegExp; static VIRTUAL_LOCATOR_PATTERN: RegExp; /** * Returns the command arguments for listing dependencies * @param {boolean} includeTransitive - Whether to include transitive dependencies * @returns {string[]} Command arguments for listing dependencies */ listCmdArgs(includeTransitive: boolean): string[]; /** * Returns the command arguments for updating the lock file * @param {string} - Directory containing the manifest file * @returns {string[]} Command arguments for updating the lock file */ updateLockFileCmdArgs(): string[]; /** * Parses the dependency tree output from Yarn Berry * Converts multiple JSON objects into a valid JSON array * @param {string} output - The raw command output * @returns {string} Properly formatted JSON string */ parseDepTreeOutput(output: string): string; /** * Extracts root dependencies from the dependency tree * @param {Object} depTree - The dependency tree object * @returns {Map} Map of dependency names to their PackageURL objects */ getRootDependencies(depTree: Object): Map; /** * Checks if a dependency is the root package * @param {string} name - Name of the dependency * @returns {boolean} True if the dependency is the root package * @private */ private #isRoot; /** * Adds dependencies to the SBOM * @param {Sbom} sbom - The SBOM object to add dependencies to * @param {Object} depTree - The dependency tree object * @param {function(PackageURL): (Array<{alg: string, content: string}>|undefined)} [hashesForPurl] - Resolves lock-file hashes for a purl */ addDependenciesToSbom(sbom: Sbom, depTree: Object, hashesForPurl?: Function): void; /** * Converts a locator to the node value format used in yarn info output * @param {string} locator - e.g. "express@npm:4.17.1" * @returns {string} The node value, same as locator for non-virtual * @private */ private #nodeValueFromLocator; /** * Checks if a node is in the reachable set by matching its value against reachable locators * @param {string} depName - The node value (e.g. "express@npm:4.17.1") * @param {Set} reachable - Set of reachable locators * @returns {boolean} * @private */ private #isReachableNode; /** * Creates a PackageURL from a dependency locator * @param {string} locator - The dependency locator * @returns {PackageURL|undefined} The PackageURL or undefined if not valid * @private */ private #purlFromLocator; /** * Creates a PackageURL from a dependency node * @param {string} depName - The dependency name * @param {Object} node - The dependency node object * @returns {PackageURL|undefined} The PackageURL or undefined if not valid * @private */ private #purlFromNode; }