UNPKG

hardhat

Version:

Hardhat is an extensible developer tool that helps smart contract developers increase productivity by reliably bringing together the tools they want.

50 lines 2.78 kB
import type { InstallationName, RemappedNpmPackagesGraph, Remapping, ResolvedUserRemapping, RemappedNpmPackagesGraphJson } from "./types.js"; import type { ResolvedFile, ResolvedNpmPackage, UserRemappingError } from "../../../../../types/solidity.js"; import type { Result } from "../../../../../types/utils.js"; /** * Returns a normalized version of the path if it refers to a node_modules in * the root directory (i.e. node_modules/...), or a `node_modules` directory * in a parent directory (i.e. ../../node_modules/...). * * Otherwise returns `undefined`. * * @param pathToNormalize The path to normalize. * @returns The normalized path (node_modules/...), or `undefined`. */ export declare function getNormalizeNodeModulesPath(pathToNormalize: string): string | undefined; export type RemappingsReaderFunction = (packageName: string, packageVersion: string, packagePath: string, defaultBehavior: (name: string, version: string, path: string) => Promise<Array<{ remappings: string[]; source: string; }>>) => Promise<Array<{ remappings: string[]; source: string; }>>; export declare function isResolvedUserRemapping(remapping: Remapping | ResolvedUserRemapping): remapping is ResolvedUserRemapping; export declare class RemappedNpmPackagesGraphImplementation implements RemappedNpmPackagesGraph { #private; static create(projectRootPath: string, remappingsReader?: RemappingsReaderFunction): Promise<RemappedNpmPackagesGraphImplementation>; private constructor(); getHardhatProjectPackage(): ResolvedNpmPackage; /** * Resolves a dependency of the package `from` by its installation name. * * This method modifies the graph, potentially loading new packages, but it * doesn't read its remappings, and it doesn't take user remappings into * account. * * This method is pretty complex, so read the comments carefully. * * @param from The package from which the dependency is being resolved. * @param installationName The installation name of the dependency. * @returns The package and generated remappings, or undefined if the * dependency could not be resolved. */ resolveDependencyByInstallationName(from: ResolvedNpmPackage, installationName: InstallationName): Promise<{ package: ResolvedNpmPackage; generatedRemapping: Remapping; } | undefined>; selectBestUserRemapping(from: ResolvedFile, directImport: string): Promise<Result<ResolvedUserRemapping | undefined, UserRemappingError[]>>; generateRemappingIntoNpmFile(fromNpmPackage: ResolvedNpmPackage, directImport: string, targetInputSourceName: string): Promise<Remapping>; toJSON(): RemappedNpmPackagesGraphJson; } //# sourceMappingURL=remapped-npm-packages-graph.d.ts.map