aboutsummaryrefslogtreecommitdiffstats
path: root/packages/resolver/src/resolvers/resolver.ts
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-04-10 04:23:25 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-04-12 18:52:48 +0800
commiteb89926cee2c50ef657b3c033b5637f527d73c6a (patch)
tree6a4ece7902c860bfa48ac53033baf86ba25683d0 /packages/resolver/src/resolvers/resolver.ts
parent7923ff4ac6d03adf3787a2a3e6f7deb6aa38fc73 (diff)
downloaddexon-sol-tools-eb89926cee2c50ef657b3c033b5637f527d73c6a.tar
dexon-sol-tools-eb89926cee2c50ef657b3c033b5637f527d73c6a.tar.gz
dexon-sol-tools-eb89926cee2c50ef657b3c033b5637f527d73c6a.tar.bz2
dexon-sol-tools-eb89926cee2c50ef657b3c033b5637f527d73c6a.tar.lz
dexon-sol-tools-eb89926cee2c50ef657b3c033b5637f527d73c6a.tar.xz
dexon-sol-tools-eb89926cee2c50ef657b3c033b5637f527d73c6a.tar.zst
dexon-sol-tools-eb89926cee2c50ef657b3c033b5637f527d73c6a.zip
Implement the resolver
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;
+ }
+}