UNPKG

2.97 kBTypeScriptView Raw
1import { SolcConfig } from "../config";
2/**
3 * A Solidity file.
4 */
5export interface ResolvedFile {
6 library?: LibraryInfo;
7 sourceName: string;
8 absolutePath: string;
9 content: FileContent;
10 lastModificationDate: Date;
11 contentHash: string;
12 getVersionedName(): string;
13}
14export type ArtifactsEmittedPerFile = Array<{
15 file: ResolvedFile;
16 artifactsEmitted: string[];
17}>;
18/**
19 * Information about an npm library.
20 */
21export interface LibraryInfo {
22 name: string;
23 version: string;
24}
25/**
26 * The content of a Solidity file. Including its raw content, its imports and
27 * version pragma directives.
28 */
29export interface FileContent {
30 rawContent: string;
31 imports: string[];
32 versionPragmas: string[];
33}
34/**
35 * A CompilationJob includes all the necessary information to generate artifacts
36 * from a group of files. This includes those files, their dependencies, and the
37 * version and configuration of solc that should be used.
38 */
39export interface CompilationJob {
40 emitsArtifacts(file: ResolvedFile): boolean;
41 hasSolc9573Bug(): boolean;
42 merge(other: CompilationJob): CompilationJob;
43 getResolvedFiles(): ResolvedFile[];
44 getSolcConfig(): SolcConfig;
45}
46/**
47 * A DependencyGraph represents a group of files and how they depend on each
48 * other.
49 */
50export interface DependencyGraph {
51 getConnectedComponents(): DependencyGraph[];
52 getDependencies(file: ResolvedFile): ResolvedFile[];
53 getResolvedFiles(): ResolvedFile[];
54 getTransitiveDependencies(file: ResolvedFile): TransitiveDependency[];
55}
56/**
57 * Used as part of the return value of DependencyGraph.getTransitiveDependencies
58 */
59export interface TransitiveDependency {
60 dependency: ResolvedFile;
61 /**
62 * The list of intermediate files between the file and the dependency
63 * this is not guaranteed to be the shortest path
64 */
65 path: ResolvedFile[];
66}
67/**
68 * An object with a list of successfully created compilation jobs and a list of
69 * errors. The `errors` entry maps error codes (that come from the
70 * CompilationJobCreationError enum) to the source names of the files that
71 * caused that error.
72 */
73export interface CompilationJobsCreationResult {
74 jobs: CompilationJob[];
75 errors: CompilationJobCreationError[];
76}
77export interface CompilationJobCreationError {
78 reason: CompilationJobCreationErrorReason;
79 file: ResolvedFile;
80 extra?: any;
81}
82export declare enum CompilationJobCreationErrorReason {
83 OTHER_ERROR = "other",
84 NO_COMPATIBLE_SOLC_VERSION_FOUND = "no-compatible-solc-version-found",
85 INCOMPATIBLE_OVERRIDEN_SOLC_VERSION = "incompatible-overriden-solc-version",
86 DIRECTLY_IMPORTS_INCOMPATIBLE_FILE = "directly-imports-incompatible-file",
87 INDIRECTLY_IMPORTS_INCOMPATIBLE_FILE = "indirectly-imports-incompatible-file"
88}
89export interface SolcBuild {
90 version: string;
91 longVersion: string;
92 compilerPath: string;
93 isSolcJs: boolean;
94}
95//# sourceMappingURL=compile.d.ts.map
\No newline at end of file