import type { Lockfile, PackageSnapshot, ProjectSnapshot } from '@pnpm/lockfile.types-900';
import { type ITerminal } from '@rushstack/terminal';
import { BaseShrinkwrapFile } from '../base/BaseShrinkwrapFile';
import { DependencySpecifier } from '../DependencySpecifier';
import type { RushConfiguration } from '../../api/RushConfiguration';
import type { IShrinkwrapFilePolicyValidatorOptions } from '../policy/ShrinkwrapFilePolicy';
import type { IExperimentsJson } from '../../api/ExperimentsConfiguration';
import type { RushConfigurationProject } from '../../api/RushConfigurationProject';
import { PnpmProjectShrinkwrapFile } from './PnpmProjectShrinkwrapFile';
import type { PackageManagerOptionsConfigurationBase } from '../base/BasePackageManagerOptionsConfiguration';
import type { Subspace } from '../../api/Subspace';
export declare enum ShrinkwrapFileMajorVersion {
    V6 = 6,
    V9 = 9
}
export interface IPeerDependenciesMetaYaml {
    optional?: boolean;
}
export interface IDependenciesMetaYaml {
    injected?: boolean;
}
export type IPnpmV7VersionSpecifier = string;
export interface IPnpmV8VersionSpecifier {
    version: string;
    specifier: string;
}
export type IPnpmV9VersionSpecifier = string;
export type IPnpmVersionSpecifier = IPnpmV7VersionSpecifier | IPnpmV8VersionSpecifier | IPnpmV9VersionSpecifier;
export interface IPnpmShrinkwrapDependencyYaml extends Omit<PackageSnapshot, 'resolution'> {
    resolution: {
        /** The directory this package should clone, for injected dependencies */
        directory?: string;
        /** The hash of the tarball, to ensure archive integrity */
        integrity?: string;
        /** The name of the tarball, if this was from a TGZ file */
        tarball?: string;
    };
}
export type IPnpmShrinkwrapImporterYaml = ProjectSnapshot;
export interface IPnpmShrinkwrapYaml extends Lockfile {
    /**
     * This interface represents the raw pnpm-lock.YAML file
     * Example:
     *  {
     *    "dependencies": {
     *      "@rush-temp/project1": "file:./projects/project1.tgz"
     *    },
     *    "packages": {
     *      "file:projects/library1.tgz": {
     *        "dependencies: {
     *          "markdown": "0.5.0"
     *        },
     *        "name": "@rush-temp/library1",
     *        "resolution": {
     *          "tarball": "file:projects/library1.tgz"
     *        },
     *        "version": "0.0.0"
     *      },
     *      "markdown/0.5.0": {
     *        "resolution": {
     *          "integrity": "sha1-KCBbVlqK51kt4gdGPWY33BgnIrI="
     *        }
     *      }
     *    },
     *    "registry": "http://localhost:4873/",
     *    "shrinkwrapVersion": 3,
     *    "specifiers": {
     *      "@rush-temp/project1": "file:./projects/project1.tgz"
     *    }
     *  }
     */
    /** The list of resolved version numbers for direct dependencies */
    dependencies?: Record<string, string>;
    /** The list of specifiers used to resolve direct dependency versions */
    specifiers?: Record<string, string>;
    /** URL of the registry which was used */
    registry?: string;
}
export interface ILoadFromStringOptions {
    subspaceHasNoProjects: boolean;
}
export interface ILoadFromFileOptions extends ILoadFromStringOptions {
    withCaching?: boolean;
}
export declare function parsePnpm9DependencyKey(dependencyName: string, versionSpecifier: IPnpmVersionSpecifier): DependencySpecifier | undefined;
/**
 * Given an encoded "dependency key" from the PNPM shrinkwrap file, this parses it into an equivalent
 * DependencySpecifier.
 *
 * @returns a SemVer string, or undefined if the version specifier cannot be parsed
 */
export declare function parsePnpmDependencyKey(dependencyName: string, versionSpecifier: IPnpmVersionSpecifier): DependencySpecifier | undefined;
export declare function normalizePnpmVersionSpecifier(versionSpecifier: IPnpmVersionSpecifier): string;
export declare class PnpmShrinkwrapFile extends BaseShrinkwrapFile {
    readonly shrinkwrapFileMajorVersion: number;
    readonly isWorkspaceCompatible: boolean;
    readonly registry: string;
    readonly dependencies: ReadonlyMap<string, IPnpmVersionSpecifier>;
    readonly importers: ReadonlyMap<string, IPnpmShrinkwrapImporterYaml>;
    readonly specifiers: ReadonlyMap<string, string>;
    readonly packages: ReadonlyMap<string, IPnpmShrinkwrapDependencyYaml>;
    readonly overrides: ReadonlyMap<string, string>;
    readonly packageExtensionsChecksum: undefined | string;
    readonly hash: string;
    private readonly _shrinkwrapJson;
    private readonly _integrities;
    private _pnpmfileConfiguration;
    private constructor();
    static getLockfileV9PackageId(name: string, version: string): string;
    /**
     * Clears the cache of PnpmShrinkwrapFile instances to free up memory.
     */
    static clearCache(): void;
    static loadFromFile(shrinkwrapYamlFilePath: string, options: ILoadFromFileOptions): PnpmShrinkwrapFile | undefined;
    static loadFromString(shrinkwrapContent: string, options: ILoadFromStringOptions): PnpmShrinkwrapFile;
    getShrinkwrapHash(experimentsConfig?: IExperimentsJson): string;
    /**
     * Determine whether `pnpm-lock.yaml` contains insecure sha1 hashes.
     * @internal
     */
    private _disallowInsecureSha1;
    /** @override */
    validateShrinkwrapAfterUpdate(rushConfiguration: RushConfiguration, subspace: Subspace, terminal: ITerminal): void;
    /** @override */
    validate(packageManagerOptionsConfig: PackageManagerOptionsConfigurationBase, policyOptions: IShrinkwrapFilePolicyValidatorOptions, experimentsConfig?: IExperimentsJson): void;
    /**
     * This operation exactly mirrors the behavior of PNPM's own implementation:
     * https://github.com/pnpm/pnpm/blob/73ebfc94e06d783449579cda0c30a40694d210e4/lockfile/lockfile-file/src/experiments/inlineSpecifiersLockfileConverters.ts#L162
     */
    private _convertLockfileV6DepPathToV5DepPath;
    /**
     * Normalize dependency paths for PNPM shrinkwrap files.
     * Example: "/eslint-utils@3.0.0(eslint@8.23.1)" --> "/eslint-utils@3.0.0"
     * Example: "/@typescript-eslint/experimental-utils/5.9.1_eslint@8.6.0+typescript@4.4.4" --> "/@typescript-eslint/experimental-utils/5.9.1"
     */
    private _parseDependencyPath;
    /** @override */
    getTempProjectNames(): ReadonlyArray<string>;
    /**
     * Gets the path to the tarball file if the package is a tarball.
     * Returns undefined if the package entry doesn't exist or the package isn't a tarball.
     * Example of return value: file:projects/build-tools.tgz
     */
    getTarballPath(packageName: string): string | undefined;
    getTopLevelDependencyKey(dependencyName: string): IPnpmVersionSpecifier | undefined;
    /**
     * Gets the version number from the list of top-level dependencies in the "dependencies" section
     * of the shrinkwrap file. Sample return values:
     *   '2.1.113'
     *   '1.9.0-dev.27'
     *   'file:projects/empty-webpart-project.tgz'
     *   undefined
     *
     * @override
     */
    getTopLevelDependencyVersion(dependencyName: string): DependencySpecifier | undefined;
    /**
     * The PNPM shrinkwrap file has top-level dependencies on the temp projects like this (version 5.x):
     *
     * ```
     * dependencies:
     *   '@rush-temp/my-app': 'file:projects/my-app.tgz_25c559a5921686293a001a397be4dce0'
     * packages:
     *   /@types/node/10.14.15:
     *     dev: false
     *   'file:projects/my-app.tgz_25c559a5921686293a001a397be4dce0':
     *     dev: false
     *     name: '@rush-temp/my-app'
     *     version: 0.0.0
     * ```
     *
     * or in version 6.1, like this:
     * ```
     * dependencies:
     *  '@rush-temp/my-app':
     *    specifier: file:./projects/my-app.tgz
     *    version: file:projects/my-app.tgz
     *  packages:
     *    /@types/node@10.14.15:
     *      resolution: {integrity: sha512-iAB+**==}
     *      dev: false
     *    file:projects/my-app.tgz
     *      resolution: {integrity: sha512-guuoFIc**==, tarball: file:projects/sp-filepicker.tgz}
     *      name: '@rush-temp/my-app'
     *      version: 0.0.0
     *      dependencies:
     *        '@microsoft/load-themed-styles': 1.10.7
     *        ...
     *      dev: false
     * ```
     *
     * We refer to 'file:projects/my-app.tgz_25c559a5921686293a001a397be4dce0' or 'file:projects/my-app.tgz' as
     * the temp project dependency key of the temp project '@rush-temp/my-app'.
     */
    getTempProjectDependencyKey(tempProjectName: string): string | undefined;
    getShrinkwrapEntryFromTempProjectDependencyKey(tempProjectDependencyKey: string): IPnpmShrinkwrapDependencyYaml | undefined;
    getShrinkwrapEntry(name: string, version: IPnpmVersionSpecifier): IPnpmShrinkwrapDependencyYaml | undefined;
    /**
     * Serializes the PNPM Shrinkwrap file
     *
     * @override
     */
    protected serialize(): string;
    /**
     * Gets the resolved version number of a dependency for a specific temp project.
     * For PNPM, we can reuse the version that another project is using.
     * Note that this function modifies the shrinkwrap data if tryReusingPackageVersionsFromShrinkwrap is set to true.
     *
     * @override
     */
    protected tryEnsureDependencyVersion(dependencySpecifier: DependencySpecifier, tempProjectName: string): DependencySpecifier | undefined;
    /** @override */
    findOrphanedProjects(rushConfiguration: RushConfiguration, subspace: Subspace): ReadonlyArray<string>;
    /** @override */
    getProjectShrinkwrap(project: RushConfigurationProject): PnpmProjectShrinkwrapFile;
    getImporterKeys(): Iterable<string>;
    getImporterKeyByPath(workspaceRoot: string, projectFolder: string): string;
    getImporter(importerKey: string): IPnpmShrinkwrapImporterYaml | undefined;
    getIntegrityForImporter(importerKey: string): Map<string, string> | undefined;
    /** @override */
    isWorkspaceProjectModifiedAsync(project: RushConfigurationProject, subspace: Subspace, variant: string | undefined): Promise<boolean>;
    private _getIntegrityForPackage;
    private _addIntegrities;
    /**
     * Gets the package description for a tempProject from the shrinkwrap file.
     */
    private _getPackageDescription;
    private _getPackageId;
    private _parsePnpmDependencyKey;
    private _serializeInternal;
}
//# sourceMappingURL=PnpmShrinkwrapFile.d.ts.map