import { type IReadonlyLookupByPath } from '@rushstack/lookup-by-path';
import type { RushConfigurationProject } from '../../api/RushConfigurationProject';
import type { RushProjectConfiguration } from '../../api/RushProjectConfiguration';
/**
 * @beta
 */
export type IRushConfigurationProjectForSnapshot = Pick<RushConfigurationProject, 'projectFolder' | 'projectRelativeFolder'>;
/**
 * @internal
 */
export interface IInputsSnapshotProjectMetadata {
    /**
     * The contents of rush-project.json for the project, if available
     */
    projectConfig?: RushProjectConfiguration;
    /**
     * A map of operation name to additional files that should be included in the hash for that operation.
     */
    additionalFilesByOperationName?: ReadonlyMap<string, ReadonlySet<string>>;
}
export type IRushSnapshotProjectMetadataMap = ReadonlyMap<IRushConfigurationProjectForSnapshot, IInputsSnapshotProjectMetadata>;
/**
 * Function that computes a new snapshot of the current state of the repository as of the current moment.
 * Rush-level configuration state will have been bound during creation of the function.
 * Captures the state of the environment, tracked files, and additional files.
 *
 * @beta
 */
export type GetInputsSnapshotAsyncFn = () => Promise<IInputsSnapshot | undefined>;
/**
 * The parameters for constructing an {@link InputsSnapshot}.
 * @internal
 */
export interface IInputsSnapshotParameters {
    /**
     * Hashes for files selected by `dependsOnAdditionalFiles`.
     * Separated out to prevent being auto-assigned to a project.
     */
    additionalHashes?: ReadonlyMap<string, string>;
    /**
     * The environment to use for `dependsOnEnvVars`. By default performs a snapshot of process.env upon construction.
     * @defaultValue \{ ...process.env \}
     */
    environment?: Record<string, string | undefined>;
    /**
     * The Node.js version string to use for `dependsOnNodeVersion`. Defaults to `process.version`.
     * @defaultValue process.version
     */
    nodeVersion?: string;
    /**
     * File paths (keys into additionalHashes or hashes) to be included as part of every operation's dependencies.
     */
    globalAdditionalFiles?: Iterable<string>;
    /**
     * The hashes of all tracked files in the repository.
     */
    hashes: ReadonlyMap<string, string>;
    /**
     * Whether or not the repository has uncommitted changes.
     */
    hasUncommittedChanges: boolean;
    /**
     * Optimized lookup engine used to route `hashes` to individual projects.
     */
    lookupByPath: IReadonlyLookupByPath<IRushConfigurationProjectForSnapshot>;
    /**
     * Metadata for each project.
     */
    projectMap: IRushSnapshotProjectMetadataMap;
    /**
     * The directory that all relative paths are relative to.
     */
    rootDir: string;
}
/**
 * Represents a synchronously-queryable in-memory snapshot of the state of the inputs to a Rush repository.
 *
 * The methods on this interface are idempotent and will return the same result regardless of when they are executed.
 * @beta
 */
export interface IInputsSnapshot {
    /**
     * The raw hashes of all tracked files in the repository.
     */
    readonly hashes: ReadonlyMap<string, string>;
    /**
     * The directory that all paths in `hashes` are relative to.
     */
    readonly rootDirectory: string;
    /**
     * Whether or not the repository has uncommitted changes.
     */
    readonly hasUncommittedChanges: boolean;
    /**
     * Gets the map of file paths to Git hashes that will be used to compute the local state hash of the operation.
     * Exposed separately from the final state hash to facilitate detailed change detection.
     *
     * @param project - The Rush project to get hashes for
     * @param operationName - The name of the operation (phase) to get hashes for. If omitted, returns a default set for the project, as used for bulk commands.
     * @returns A map of file name to Git hash. For local files paths will be relative. Configured additional files may be absolute paths.
     */
    getTrackedFileHashesForOperation(project: IRushConfigurationProjectForSnapshot, operationName?: string): ReadonlyMap<string, string>;
    /**
     * Gets the state hash for the files owned by this operation, including the resolutions of package.json dependencies. This will later be combined with the hash of
     * the command being executed and the final hashes of the operation's dependencies to compute the final hash for the operation.
     * @param project - The Rush project to compute the state hash for
     * @param operationName - The name of the operation (phase) to get hashes for. If omitted, returns a generic hash for the whole project, as used for bulk commands.
     * @returns The local state hash for the project. This is a hash of the environment, the project's tracked files, and any additional files.
     */
    getOperationOwnStateHash(project: IRushConfigurationProjectForSnapshot, operationName?: string): string;
}
/**
 * Represents a synchronously-queryable in-memory snapshot of the state of the inputs to a Rush repository.
 * Any asynchronous work needs to be performed by the caller and the results passed to the constructor.
 *
 * @remarks
 * All operations on this class will return the same result regardless of when they are executed.
 *
 * @internal
 */
export declare class InputsSnapshot implements IInputsSnapshot {
    /**
     * {@inheritdoc IInputsSnapshot.hashes}
     */
    readonly hashes: ReadonlyMap<string, string>;
    /**
     * {@inheritdoc IInputsSnapshot.hasUncommittedChanges}
     */
    readonly hasUncommittedChanges: boolean;
    /**
     * {@inheritdoc IInputsSnapshot.rootDirectory}
     */
    readonly rootDirectory: string;
    /**
     * The metadata for each project. This is a superset of the information in `projectMap` and includes caching of queries.
     */
    private readonly _projectMetadataMap;
    /**
     * Hashes of files to be included in all result sets.
     */
    private readonly _globalAdditionalHashes;
    /**
     * Hashes for files selected by `dependsOnAdditionalFiles`.
     */
    private readonly _additionalHashes;
    /**
     * The environment to use for `dependsOnEnvVars`.
     */
    private readonly _environment;
    /**
     * Pre-computed Node.js version strings at each granularity level for `dependsOnNodeVersion`.
     */
    private readonly _nodeVersionByGranularity;
    /**
     *
     * @param params - The parameters for the snapshot
     * @internal
     */
    constructor(params: IInputsSnapshotParameters);
    /**
     * {@inheritdoc}
     */
    getTrackedFileHashesForOperation(project: IRushConfigurationProjectForSnapshot, operationName?: string): ReadonlyMap<string, string>;
    /**
     * {@inheritdoc}
     */
    getOperationOwnStateHash(project: IRushConfigurationProjectForSnapshot, operationName?: string): string;
    private _resolveHashes;
}
//# sourceMappingURL=InputsSnapshot.d.ts.map