aboutsummaryrefslogtreecommitdiffstats
path: root/packages/resolver/src/resolvers/resolver.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/resolver/src/resolvers/resolver.ts')
-rw-r--r--packages/resolver/src/resolvers/resolver.ts14
1 files changed, 14 insertions, 0 deletions
diff --git a/packages/resolver/src/resolvers/resolver.ts b/packages/resolver/src/resolvers/resolver.ts
new file mode 100644
index 000000000..7edc9a85d
--- /dev/null
+++ b/packages/resolver/src/resolvers/resolver.ts
@@ -0,0 +1,14 @@
+import * as _ from 'lodash';
+
+import { ContractSource } from '../types';
+
+export abstract class Resolver {
+ public abstract resolveIfExists(importPath: string): ContractSource | undefined;
+ public resolve(importPath: string): ContractSource {
+ const contractSourceIfExists = this.resolveIfExists(importPath);
+ if (_.isUndefined(contractSourceIfExists)) {
+ throw new Error(`Failed to resolve ${importPath}`);
+ }
+ return contractSourceIfExists;
+ }
+}