diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-04-16 22:38:55 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-04-16 23:43:59 +0800 |
commit | d8ef76fd5efe63ec8f6205a73494ce388e64391f (patch) | |
tree | 22a5740584029830e37961136e229938b8f735f4 /packages/sol-resolver/src/resolvers/resolver.ts | |
parent | e5cf41b3134d6cd5fdda995aa81ec23e51bb5145 (diff) | |
download | dexon-sol-tools-d8ef76fd5efe63ec8f6205a73494ce388e64391f.tar dexon-sol-tools-d8ef76fd5efe63ec8f6205a73494ce388e64391f.tar.gz dexon-sol-tools-d8ef76fd5efe63ec8f6205a73494ce388e64391f.tar.bz2 dexon-sol-tools-d8ef76fd5efe63ec8f6205a73494ce388e64391f.tar.lz dexon-sol-tools-d8ef76fd5efe63ec8f6205a73494ce388e64391f.tar.xz dexon-sol-tools-d8ef76fd5efe63ec8f6205a73494ce388e64391f.tar.zst dexon-sol-tools-d8ef76fd5efe63ec8f6205a73494ce388e64391f.zip |
Rename resolver to sol-resolver
Diffstat (limited to 'packages/sol-resolver/src/resolvers/resolver.ts')
-rw-r--r-- | packages/sol-resolver/src/resolvers/resolver.ts | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/packages/sol-resolver/src/resolvers/resolver.ts b/packages/sol-resolver/src/resolvers/resolver.ts new file mode 100644 index 000000000..7edc9a85d --- /dev/null +++ b/packages/sol-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; + } +} |