import type { PackageURL } from './package-url.js'; /** @internal Register the PackageURL class for fromUrl construction. */ export declare function _registerPackageURLForUrlConverter(ctor: typeof PackageURL): void; /** * Repository URL conversion results. * * This interface represents the result of converting a PackageURL to a * repository URL where the source code can be found. */ export interface RepositoryUrl { /** The type of repository (version control system or web interface). */ type: 'git' | 'hg' | 'svn' | 'web'; /** The repository URL string. */ url: string; } /** * Download URL conversion results. * * This interface represents the result of converting a PackageURL to a * download URL where the package artifact can be obtained. */ export interface DownloadUrl { /** The type/format of the downloadable artifact. */ type: 'tarball' | 'zip' | 'exe' | 'wheel' | 'jar' | 'gem' | 'other'; /** The download URL string. */ url: string; } export declare class UrlConverter { /** * Convert a URL string to a PackageURL if the URL is recognized. * * Dispatches to type-specific parsers based on the URL hostname. * Returns undefined for unrecognized hosts, invalid URLs, or URLs * without enough path information to construct a valid PackageURL. * * @example * ```typescript * UrlConverter.fromUrl('https://www.npmjs.com/package/lodash') * // -> PackageURL for pkg:npm/lodash * * UrlConverter.fromUrl('https://github.com/lodash/lodash') * // -> PackageURL for pkg:github/lodash/lodash * ``` */ static fromUrl(urlStr: string): PackageURL | undefined; /** * Check if a URL string is recognized for conversion to a PackageURL. * * Returns true if the URL's hostname has a registered parser, * false for invalid URLs or unrecognized hosts. */ static supportsFromUrl(urlStr: string): boolean; /** * Get all available URLs for a PackageURL. * * This convenience method returns both repository and download URLs * in a single call, useful when you need to check all URL options. */ static getAllUrls(purl: PackageURL): { download: DownloadUrl | undefined; repository: RepositoryUrl | undefined; }; /** * Check if a PackageURL type supports download URL conversion. * * This method checks if the given package type has download URL * conversion logic implemented. */ static supportsDownloadUrl(type: string): boolean; /** * Check if a PackageURL type supports repository URL conversion. * * This method checks if the given package type has repository URL * conversion logic implemented. */ static supportsRepositoryUrl(type: string): boolean; /** * Convert a PackageURL to a download URL if possible. * * This method attempts to generate a download URL where the package's * artifact (binary, archive, etc.) can be obtained. Requires a version * to be present in the PackageURL. */ static toDownloadUrl(purl: PackageURL): DownloadUrl | undefined; /** * Convert a PackageURL to a repository URL if possible. * * This method attempts to generate a repository URL where the package's * source code can be found. Different package types use different URL * patterns and repository hosting services. */ static toRepositoryUrl(purl: PackageURL): RepositoryUrl | undefined; }