import { PackageURL } from 'packageurl-js'; export type GraphEntry = { name: string; version: string; children: string[]; hashes?: Array<{ alg: string; content: string; }>; }; export type DepTreeEntry = { name: string; version: string; dependencies: DepTreeEntry[]; }; export type DependencyData = { directDeps: string[]; graph: Map; }; export type Provided = { ecosystem: string; content: string; contentType: string; }; /** @typedef {{name: string, version: string, children: string[], hashes?: Array<{alg: string, content: string}>}} GraphEntry */ /** @typedef {{name: string, version: string, dependencies: DepTreeEntry[]}} DepTreeEntry */ /** @typedef {{directDeps: string[], graph: Map}} DependencyData */ /** @typedef {{ecosystem: string, content: string, contentType: string}} Provided */ export default class Base_pyproject { /** * @param {string} manifestName * @returns {boolean} */ isSupported(manifestName: string): boolean; /** * @param {string} manifestDir * @param {Object} [opts={}] * @returns {boolean} */ validateLockFile(manifestDir: string, opts?: Object): boolean; /** * Walk up from manifestDir to find the directory containing the lock file. * Follows the same pattern as Base_javascript._findLockFileDir(). * @param {string} manifestDir * @param {Object} [opts={}] * @returns {string|null} * @protected */ protected _findLockFileDir(manifestDir: string, opts?: Object): string | null; /** * Detect workspace root boundaries. * Currently only uv has native workspace support ([tool.uv.workspace] in pyproject.toml). * Poetry has no workspace/monorepo support (python-poetry/poetry#2270), so each * poetry project is treated independently — see Python_poetry._findLockFileDir(). * @param {string} dir * @returns {boolean} * @protected */ protected _isWorkspaceRoot(dir: string): boolean; /** * Read project license from pyproject.toml, with fallback to LICENSE file. * @param {string} manifestPath * @returns {string|null} */ readLicenseFromManifest(manifestPath: string): string | null; /** * @param {string} manifest - path to pyproject.toml * @param {Object} [opts={}] * @returns {Promise} */ provideStack(manifest: string, opts?: Object): Promise; /** * @param {string} manifest - path to pyproject.toml * @param {Object} [opts={}] * @returns {Promise} */ provideComponent(manifest: string, opts?: Object): Promise; /** * @returns {string} * @protected */ protected _lockFileName(): string; /** * @returns {string} * @protected */ protected _cmdName(): string; /** * Returns the package manager name (e.g. pip, poetry, uv) * @returns {string} */ packageManagerName(): string; /** * Resolve dependencies using the tool-specific command and parser. * * @param {string} manifestDir - directory containing the target pyproject.toml * @param {string} workspaceDir - workspace root (where the lock file lives); * only used by providers that need workspace-level resolution (e.g. uv) * @param {object} parsed - parsed pyproject.toml * @param {Object} opts * @returns {Promise} * @protected */ protected _getDependencyData(manifestDir: string, workspaceDir: string, parsed: object, opts: Object): Promise; /** * Canonicalize a Python package name per PEP 503. * @param {string} name * @returns {string} * @protected */ protected _canonicalize(name: string): string; /** * Get the project name from pyproject.toml. * @param {object} parsed * @returns {string|null} * @protected */ protected _getProjectName(parsed: object): string | null; /** * Get the project version from pyproject.toml. * @param {object} parsed * @returns {string|null} * @protected */ protected _getProjectVersion(parsed: object): string | null; /** * Scan raw pyproject.toml text for dependencies with ignore markers. * @param {string} manifestPath * @returns {Set} * @protected */ protected _getIgnoredDeps(manifestPath: string): Set; /** * Compute the set of graph nodes reachable from direct deps, excluding ignored. * @param {Map} graph * @param {string[]} directDeps * @param {Set} ignoredDeps * @returns {Set} * @protected */ protected _reachableNodes(graph: Map, directDeps: string[], ignoredDeps: Set): Set; /** * @param {string} name * @param {string} version * @returns {PackageURL} * @protected */ protected _toPurl(name: string, version: string): PackageURL; /** * Create SBOM json string for a pyproject.toml project. * @param {string} manifest - path to pyproject.toml * @param {Object} opts * @param {boolean} includeTransitive * @returns {Promise} * @private */ private _createSbom; }