/** * @file Package spec parsing, name resolution, and GitHub URL utilities. */ import type npmPackageArgFn from '../external/npm-package-arg.js'; /** * The vendored `npm-package-arg`. It resolves through the npm-pack bundle — * arborist, pacote, cacache, make-fetch-happen — so a static import at module * scope drags that whole multi-megabyte subgraph into any consumer bundling a * pure helper like `pkgNameToSlug`. Loaded lazily at first spec parse via * `requireFrom`, whose non-literal specifier keeps bundlers from walking the * edge, and memoized. Same relative shape in both trees: `src/packages` and * `dist/packages` each sit one level above their `external/` sibling. */ export declare function getNpmPackageArg(): typeof npmPackageArgFn; /** * Get the release tag for a version. * * @example * ;```typescript * getReleaseTag('lodash@latest') // 'latest' * getReleaseTag('@scope/pkg@beta') // 'beta' * getReleaseTag('lodash') // '' * ``` */ export declare function getReleaseTag(spec: string): string; /** * Extract user and project from GitHub repository URL. * * @example * ;```typescript * getRepoUrlDetails('https://github.com/lodash/lodash.git') * // { user: 'lodash', project: 'lodash' } * ``` */ export declare function getRepoUrlDetails(repoUrl?: string): { user: string; project: string; }; /** * Generate GitHub API URL for a tag reference. * * @example * ;```typescript * gitHubTagRefUrl('lodash', 'lodash', 'v4.17.21') * // 'https://api.github.com/repos/lodash/lodash/git/ref/tags/v4.17.21' * ``` */ export declare function gitHubTagRefUrl(user: string, project: string, tag: string): string; /** * Generate GitHub tarball download URL for a commit SHA. * * @example * ;```typescript * gitHubTgzUrl('lodash', 'lodash', 'abc123') * // 'https://github.com/lodash/lodash/archive/abc123.tar.gz' * ``` */ export declare function gitHubTgzUrl(user: string, project: string, sha: string): string; /** * Check if a package specifier is a GitHub tarball URL. * * @example * ;```typescript * isGitHubTgzSpec('https://github.com/user/repo/archive/abc123.tar.gz') // true * isGitHubTgzSpec('lodash@4.17.21') // false * ``` */ export declare function isGitHubTgzSpec(spec: unknown, where?: string | undefined): boolean; /** * Check if a package specifier is a GitHub URL with committish. * * @example * ;```typescript * isGitHubUrlSpec('github:user/repo#v1.0.0') // true * isGitHubUrlSpec('lodash@4.17.21') // false * ``` */ export declare function isGitHubUrlSpec(spec: unknown, where?: string | undefined): boolean; /** * Slugify an npm package name into a hyphenated identifier suitable for * User-Agent tokens, log namespaces, file paths, and other contexts where `@` * and `/` are not welcome. * * @example * ;```typescript * pkgNameToSlug('@socketsecurity/lib') // 'socketsecurity-lib' * pkgNameToSlug('@cyclonedx/cdxgen') // 'cyclonedx-cdxgen' * pkgNameToSlug('lodash') // 'lodash' * ``` */ export declare function pkgNameToSlug(pkgName: string): string; /** * Resolve full package name from a PURL object with custom delimiter. * * @example * ;```typescript * resolvePackageName({ name: 'core', namespace: '@babel' }) // '@babel/core' * resolvePackageName({ name: 'lodash' }) // 'lodash' * ``` */ export declare function resolvePackageName(purlObj: { name: string; namespace?: string | undefined; }, delimiter?: string): string; /** * Convert npm package name to Socket registry format with delimiter. * * @example * ;```typescript * resolveRegistryPackageName('@babel/core') // 'babel__core' * resolveRegistryPackageName('lodash') // 'lodash' * ``` */ export declare function resolveRegistryPackageName(pkgName: string): string;