import type { CategoryString } from '../index';
// Type for package.json exports field.
type PackageExports = {
    [path: string]: unknown;
};
export type PackageJson = {
    [key: string]: unknown;
    name?: string | undefined;
    version?: string | undefined;
    dependencies?: Record<string, string> | undefined;
    devDependencies?: Record<string, string> | undefined;
    peerDependencies?: Record<string, string> | undefined;
    optionalDependencies?: Record<string, string> | undefined;
    overrides?: Record<string, string> | undefined;
    resolutions?: Record<string, string> | undefined;
    exports?: PackageExports | string | string[] | undefined;
    socket?: {
        categories?: CategoryString;
    } | undefined;
};
export type SaveOptions = {
    ignoreWhitespace?: boolean | undefined;
    sort?: boolean | undefined;
};
export type EditablePackageJsonOptions = {
    normalize?: boolean | undefined;
    path?: string | undefined;
    preserve?: string[] | readonly string[] | undefined;
    create?: boolean | undefined;
    data?: PackageJson | undefined;
};
export type ExtractOptions = {
    dest?: string | undefined;
    tmpPrefix?: string | undefined;
    signal?: AbortSignal | undefined;
    packumentCache?: Map<string, unknown> | undefined;
    preferOffline?: boolean | undefined;
};
export type NormalizeOptions = {
    preserve?: string[] | readonly string[] | undefined;
};
export type ReadPackageJsonOptions = NormalizeOptions & {
    editable?: boolean | undefined;
    normalize?: boolean | undefined;
    throws?: boolean | undefined;
};
export type ProvenanceOptions = {
    signal?: AbortSignal | undefined;
    timeout?: number | undefined;
};
export type LicenseNode = {
    license: string;
    exception?: string | undefined;
    inFile?: string | undefined;
    plus?: boolean | undefined;
};
export type PacoteOptions = {
    signal?: AbortSignal | undefined;
    packumentCache?: Map<string, any> | undefined;
    preferOffline?: boolean | undefined;
    fullMetadata?: boolean | undefined;
};
// Define the interface for the dynamic class
interface EditablePackageJsonConstructor {
    new (): EditablePackageJsonInstance;
    fixSteps: unknown[];
    normalizeSteps: unknown[];
    prepareSteps: unknown[];
    create(path: string, opts?: EditablePackageJsonOptions): Promise<EditablePackageJsonInstance>;
    fix(path: string, opts?: unknown): Promise<EditablePackageJsonInstance>;
    load(path: string, opts?: EditablePackageJsonOptions): Promise<EditablePackageJsonInstance>;
    normalize(path: string, opts?: NormalizeOptions): Promise<EditablePackageJsonInstance>;
    prepare(path: string, opts?: unknown): Promise<EditablePackageJsonInstance>;
}
interface EditablePackageJsonInstance {
    content: Readonly<PackageJson>;
    create(path: string): this;
    fix(opts?: unknown | undefined): Promise<this>;
    fromContent(content: any): this;
    fromJSON(json: string): this;
    load(path: string, create?: boolean): Promise<this>;
    normalize(opts?: NormalizeOptions): Promise<this>;
    prepare(opts?: unknown): Promise<this>;
    update(content: Partial<PackageJson>): this;
    save(options?: SaveOptions | undefined): Promise<boolean>;
    saveSync(options?: SaveOptions | undefined): boolean;
    willSave(options?: SaveOptions | undefined): boolean;
}
/**
 * Get the EditablePackageJson class for package.json manipulation.
 */
/*@__NO_SIDE_EFFECTS__*/
export declare function getEditablePackageJsonClass(): EditablePackageJsonConstructor;
/**
 * Collect licenses that are incompatible (copyleft).
 */
/*@__NO_SIDE_EFFECTS__*/
export declare function collectIncompatibleLicenses(licenseNodes: LicenseNode[]): LicenseNode[];
/**
 * Collect warnings from license nodes.
 */
/*@__NO_SIDE_EFFECTS__*/
export declare function collectLicenseWarnings(licenseNodes: LicenseNode[]): string[];
/**
 * Create an AST node from a raw node.
 */
/*@__NO_SIDE_EFFECTS__*/
export declare function createAstNode(rawNode: SpdxAstNode): InternalAstNode;
/**
 * Create a binary operation AST node.
 */
/*@__NO_SIDE_EFFECTS__*/
export declare function createBinaryOperationNode(rawNodeParam: SpdxBinaryOperationNode): InternalBinaryOperationNode;
/**
 * Create a license AST node.
 */
/*@__NO_SIDE_EFFECTS__*/
export declare function createLicenseNode(rawNode: SpdxLicenseNode): InternalLicenseNode;
/**
 * Create a package.json object for a Socket registry package.
 */
/*@__NO_SIDE_EFFECTS__*/
export declare function createPackageJson(sockRegPkgName: string, directory: string, options?: PackageJson | undefined): PackageJson;
/**
 * Extract a package to a destination directory.
 */
/*@__NO_SIDE_EFFECTS__*/
export declare function extractPackage(pkgNameOrId: string, options?: ExtractOptions, callback?: (destPath: string) => Promise<any>): Promise<void>;
/**
 * Fetch the manifest for a package.
 */
/*@__NO_SIDE_EFFECTS__*/
export declare function fetchPackageManifest(pkgNameOrId: string, options?: PacoteOptions): Promise<any>;
/**
 * Fetch the packument (package document) for a package.
 */
/*@__NO_SIDE_EFFECTS__*/
export declare function fetchPackagePackument(pkgNameOrId: string, options?: PacoteOptions): Promise<any>;
/**
 * Convert raw attestation data to user-friendly provenance details.
 */
export declare function getProvenanceDetails(attestationData: any): any;
/**
 * Fetch package provenance information from npm registry.
 */
/*@__NO_SIDE_EFFECTS__*/
export declare function fetchPackageProvenance(pkgName: string, pkgVersion: string, options?: ProvenanceOptions): Promise<any>;
/**
 * Find package extensions for a given package.
 */
/*@__NO_SIDE_EFFECTS__*/
export declare function findPackageExtensions(pkgName: string, pkgVer: string): any;
/**
 * Find types for a subpath in package exports.
 */
/*@__NO_SIDE_EFFECTS__*/
export declare function findTypesForSubpath(entryExports: any, subpath: string): any;
/**
 * Get the release tag for a version.
 */
/*@__NO_SIDE_EFFECTS__*/
export declare function getReleaseTag(spec: string): string;
/**
 * Extract details from a repository URL.
 */
/*@__NO_SIDE_EFFECTS__*/
export declare function getRepoUrlDetails(repoUrl?: string): {
    user: string;
    project: string;
};
/**
 * Get subpaths from package exports.
 */
/*@__NO_SIDE_EFFECTS__*/
export declare function getSubpaths(entryExports: any): string[];
/**
 * Get file paths from package exports.
 */
/*@__NO_SIDE_EFFECTS__*/
export declare function getExportFilePaths(entryExports: any): string[];
/**
 * Generate GitHub API URL for a tag reference.
 */
/*@__NO_SIDE_EFFECTS__*/
export declare function gitHubTagRefUrl(user: string, project: string, tag: string): string;
/**
 * Generate GitHub tarball download URL for a commit SHA.
 */
/*@__NO_SIDE_EFFECTS__*/
export declare function gitHubTgzUrl(user: string, project: string, sha: string): string;
/**
 * Check if a package name is blessed (allowed to bypass security checks).
 */
/*@__NO_SIDE_EFFECTS__*/
export declare function isBlessedPackageName(name: any): boolean;
/**
 * Check if package exports use conditional patterns (e.g., import/require).
 */
/*@__NO_SIDE_EFFECTS__*/
export declare function isConditionalExports(entryExports: any): boolean;
/**
 * Check if a package specifier is a GitHub tarball URL.
 */
/*@__NO_SIDE_EFFECTS__*/
export declare function isGitHubTgzSpec(spec: any, where?: string): boolean;
/**
 * Check if a package specifier is a GitHub URL with committish.
 */
/*@__NO_SIDE_EFFECTS__*/
export declare function isGitHubUrlSpec(spec: any, where?: string): boolean;
/**
 * Check if a fetcher type is for the npm registry.
 */
/*@__NO_SIDE_EFFECTS__*/
export declare function isRegistryFetcherType(type: string): boolean;
/**
 * Check if package exports use subpath patterns (keys starting with '.').
 */
/*@__NO_SIDE_EFFECTS__*/
export declare function isSubpathExports(entryExports: any): boolean;
/**
 * Validate a package name against npm naming rules.
 */
/*@__NO_SIDE_EFFECTS__*/
export declare function isValidPackageName(name: string): boolean;
/**
 * Convert a package.json object to an editable instance.
 */
/*@__NO_SIDE_EFFECTS__*/
export declare function pkgJsonToEditable(pkgJson: PackageJson, options?: EditablePackageJsonOptions): any;
/**
 * Normalize package.json data using npm's normalization rules.
 */
/*@__NO_SIDE_EFFECTS__*/
export declare function normalizePackageJson(pkgJson: PackageJson, options?: NormalizeOptions): PackageJson;
/**
 * Pack a package tarball using pacote.
 */
/*@__NO_SIDE_EFFECTS__*/
export declare function packPackage(spec: string, options?: PacoteOptions): Promise<any>;
// Duplicated from spdx-expression-parse - AST node types.
export interface SpdxLicenseNode {
    license: string;
    plus?: boolean | undefined;
    exception?: string | undefined;
}
export interface SpdxBinaryOperationNode {
    left: SpdxLicenseNode | SpdxBinaryOperationNode;
    conjunction: 'and' | 'or';
    right: SpdxLicenseNode | SpdxBinaryOperationNode;
}
export type SpdxAstNode = SpdxLicenseNode | SpdxBinaryOperationNode;
// Internal AST node types with type discriminator.
export interface InternalLicenseNode extends SpdxLicenseNode {
    type: 'License';
}
export interface InternalBinaryOperationNode {
    type: 'BinaryOperation';
    left: InternalLicenseNode | InternalBinaryOperationNode;
    conjunction: 'and' | 'or';
    right: InternalLicenseNode | InternalBinaryOperationNode;
}
export type InternalAstNode = InternalLicenseNode | InternalBinaryOperationNode;
/**
 * Parse an SPDX license expression into an AST.
 */
/*@__NO_SIDE_EFFECTS__*/
export declare function parseSpdxExp(spdxExp: string): SpdxAstNode | undefined;
/**
 * 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;
/**
 * Extract escaped scope from a Socket registry package name.
 */
/*@__NO_SIDE_EFFECTS__*/
export declare function resolveEscapedScope(sockRegPkgName: string): string | undefined;
/**
 * Resolve GitHub tarball URL for a package specifier.
 */
/*@__NO_SIDE_EFFECTS__*/
export declare function resolveGitHubTgzUrl(pkgNameOrId: string, where?: any): Promise<string>;
/**
 * Convert Socket registry package name back to original npm package name.
 */
/*@__NO_SIDE_EFFECTS__*/
export declare function resolveOriginalPackageName(sockRegPkgName: string): string;
/**
 * Resolve directory path from a package.json file path.
 */
/*@__NO_SIDE_EFFECTS__*/
export declare function resolvePackageJsonDirname(filepath: string): string;
/**
 * Normalize package.json exports field to canonical format.
 */
/*@__NO_SIDE_EFFECTS__*/
export declare function resolvePackageJsonEntryExports(entryExports: any): any;
/**
 * Resolve full path to package.json from a directory or file path.
 */
/*@__NO_SIDE_EFFECTS__*/
export declare function resolvePackageJsonPath(filepath: string): string;
/**
 * Parse package license field into structured license nodes.
 */
/*@__NO_SIDE_EFFECTS__*/
export declare function resolvePackageLicenses(licenseFieldValue: string, where: string): LicenseNode[];
/**
 * Resolve full package name from a PURL object with custom delimiter.
 */
/*@__NO_SIDE_EFFECTS__*/
export declare function resolvePackageName(purlObj: any, delimiter?: string): string;
/**
 * Convert npm package name to Socket registry format with delimiter.
 */
/*@__NO_SIDE_EFFECTS__*/
export declare function resolveRegistryPackageName(pkgName: string): string;
/**
 * Convert package.json to editable instance with file persistence.
 */
/*@__NO_SIDE_EFFECTS__*/
export declare function toEditablePackageJson(pkgJson: PackageJson, options?: EditablePackageJsonOptions): Promise<any>;
/**
 * Convert package.json to editable instance with file persistence synchronously.
 */
/*@__NO_SIDE_EFFECTS__*/
export declare function toEditablePackageJsonSync(pkgJson: PackageJson, options?: EditablePackageJsonOptions): any;
/**
 * Convert escaped scope name back to npm scope format.
 */
/*@__NO_SIDE_EFFECTS__*/
export declare function unescapeScope(escapedScope: string): string;
export interface LicenseVisitor {
    License?: (node: InternalLicenseNode, parent?: InternalAstNode) => boolean | void;
    BinaryOperation?: (node: InternalBinaryOperationNode, parent?: InternalAstNode) => boolean | void;
}
/**
 * Traverse SPDX license AST and invoke visitor callbacks for each node.
 */
/*@__NO_SIDE_EFFECTS__*/
export declare function visitLicenses(ast: SpdxAstNode, visitor: LicenseVisitor): void;
export {};
