UNPKG

@socketsecurity/lib

Version:

Core utilities and infrastructure for Socket.dev security tools

55 lines (54 loc) 1.99 kB
import type { ExtractOptions, NormalizeOptions, PackageJson, PacoteOptions, ReadPackageJsonOptions } from '../packages'; /** * Extract a package to a destination directory. */ /*@__NO_SIDE_EFFECTS__*/ export declare function extractPackage(pkgNameOrId: string, options?: ExtractOptions, callback?: (destPath: string) => Promise<unknown>): Promise<void>; /** * Find package extensions for a given package. */ /*@__NO_SIDE_EFFECTS__*/ export declare function findPackageExtensions(pkgName: string, pkgVer: string): unknown; /** * Get the release tag for a version. */ /*@__NO_SIDE_EFFECTS__*/ export declare function getReleaseTag(spec: string): string; /** * Pack a package tarball using pacote. */ /*@__NO_SIDE_EFFECTS__*/ export declare function packPackage(spec: string, options?: PacoteOptions): Promise<unknown>; /** * Read and parse a package.json file asynchronously. */ /*@__NO_SIDE_EFFECTS__*/ export declare function readPackageJson(filepath: string, options?: ReadPackageJsonOptions): Promise<PackageJson | undefined>; /** * Read and parse package.json from a file path synchronously. */ /*@__NO_SIDE_EFFECTS__*/ export declare function readPackageJsonSync(filepath: string, options?: NormalizeOptions & { editable?: boolean; throws?: boolean; }): PackageJson | undefined; /** * Resolve GitHub tarball URL for a package specifier. */ /*@__NO_SIDE_EFFECTS__*/ export declare function resolveGitHubTgzUrl(pkgNameOrId: string, where?: unknown): Promise<string>; /** * Resolve full package name from a PURL object with custom delimiter. */ /*@__NO_SIDE_EFFECTS__*/ export declare function resolvePackageName(purlObj: { name: string; namespace?: string; }, delimiter?: string): string; /** * Convert npm package name to Socket registry format with delimiter. */ /*@__NO_SIDE_EFFECTS__*/ export declare function resolveRegistryPackageName(pkgName: string): string; // Re-export types from lib/packages. export type { PackageJson } from '../packages';