aboutsummaryrefslogtreecommitdiffstats
path: root/packages/sol-resolver
diff options
context:
space:
mode:
authorHsuan Lee <boczeratul@gmail.com>2019-03-06 17:46:50 +0800
committerHsuan Lee <boczeratul@gmail.com>2019-03-06 17:46:50 +0800
commit35703539d0f2b4ddb3b11d0de8c9634af59ab71f (patch)
treeae3731221dbbb3a6fa40060a8d916cfd3f738289 /packages/sol-resolver
parent92a1fde5b1ecd81b07cdb5bf0c9c1cd3544799db (diff)
downloaddexon-0x-contracts-stable.tar
dexon-0x-contracts-stable.tar.gz
dexon-0x-contracts-stable.tar.bz2
dexon-0x-contracts-stable.tar.lz
dexon-0x-contracts-stable.tar.xz
dexon-0x-contracts-stable.tar.zst
dexon-0x-contracts-stable.zip
Deploy @dexon-foundation/0x.jsstable
Diffstat (limited to 'packages/sol-resolver')
-rw-r--r--packages/sol-resolver/CHANGELOG.json316
-rw-r--r--packages/sol-resolver/CHANGELOG.md141
-rw-r--r--packages/sol-resolver/README.md67
-rw-r--r--packages/sol-resolver/package.json40
-rw-r--r--packages/sol-resolver/src/globals.d.ts7
-rw-r--r--packages/sol-resolver/src/index.ts10
-rw-r--r--packages/sol-resolver/src/resolvers/enumerable_resolver.ts7
-rw-r--r--packages/sol-resolver/src/resolvers/fallthrough_resolver.ts21
-rw-r--r--packages/sol-resolver/src/resolvers/fs_resolver.ts18
-rw-r--r--packages/sol-resolver/src/resolvers/name_resolver.ts66
-rw-r--r--packages/sol-resolver/src/resolvers/npm_resolver.ts42
-rw-r--r--packages/sol-resolver/src/resolvers/relative_fs_resolver.ts23
-rw-r--r--packages/sol-resolver/src/resolvers/resolver.ts14
-rw-r--r--packages/sol-resolver/src/resolvers/spy_resolver.ts25
-rw-r--r--packages/sol-resolver/src/resolvers/url_resolver.ts18
-rw-r--r--packages/sol-resolver/src/types.ts9
-rw-r--r--packages/sol-resolver/tsconfig.json8
-rw-r--r--packages/sol-resolver/tslint.json3
18 files changed, 0 insertions, 835 deletions
diff --git a/packages/sol-resolver/CHANGELOG.json b/packages/sol-resolver/CHANGELOG.json
deleted file mode 100644
index 9c02b9148..000000000
--- a/packages/sol-resolver/CHANGELOG.json
+++ /dev/null
@@ -1,316 +0,0 @@
-[
- {
- "version": "2.0.2",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ],
- "timestamp": 1549547375
- },
- {
- "timestamp": 1549452781,
- "version": "2.0.1",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "version": "2.0.0",
- "changes": [
- {
- "note": "Upgrade the bignumber.js to v8.0.2",
- "pr": 1517
- }
- ],
- "timestamp": 1549373905
- },
- {
- "timestamp": 1547561734,
- "version": "1.2.3",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1547225310,
- "version": "1.2.2",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "version": "1.2.1",
- "changes": [
- {
- "note": "Add `absolutePath` to `ContractSource` type",
- "pr": 1461
- },
- {
- "note": "Add `SpyResolver` that records all resolved contracts data",
- "pr": 1461
- }
- ],
- "timestamp": 1547040760
- },
- {
- "version": "1.1.1",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ],
- "timestamp": 1544739608
- },
- {
- "version": "1.1.0",
- "changes": [
- {
- "note": "NPMResolver now supports scoped packages",
- "pr": 1311
- }
- ],
- "timestamp": 1544570656
- },
- {
- "timestamp": 1542821676,
- "version": "1.0.17",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "version": "1.0.16",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ],
- "timestamp": 1541740904
- },
- {
- "timestamp": 1539871071,
- "version": "1.0.15",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1538693146,
- "version": "1.0.14",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1538475601,
- "version": "1.0.13",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1538157789,
- "version": "1.0.12",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1537907159,
- "version": "1.0.11",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1537875740,
- "version": "1.0.10",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1537541580,
- "version": "1.0.9",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1536142250,
- "version": "1.0.8",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1535377027,
- "version": "1.0.7",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1535133899,
- "version": "1.0.6",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "version": "1.0.5",
- "changes": [
- {
- "note": "Fix a bug where RelativeFSResolver would crash when trying to read a directory",
- "pr": 909
- },
- {
- "note": "Fix a bug where NpmResolver would crash when trying to read a directory",
- "pr": 961
- }
- ],
- "timestamp": 1534210131
- },
- {
- "timestamp": 1532619515,
- "version": "1.0.4",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1532614997,
- "version": "1.0.3",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1532605697,
- "version": "1.0.2",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1532357734,
- "version": "1.0.1",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1532043000,
- "version": "1.0.0",
- "changes": [
- {
- "note": "Fix a bug in FsResolver where it tries to read directories as files",
- "pr": 589
- },
- {
- "note": "Fix a bug in NameResolver where it is not ignoring .sol files",
- "pr": 589
- }
- ]
- },
- {
- "timestamp": 1531149657,
- "version": "0.0.8",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1529397769,
- "version": "0.0.7",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "version": "0.0.6",
- "changes": [
- {
- "note": "Incorrect publish that was unpublished"
- }
- ],
- "timestamp": 1527810075
- },
- {
- "timestamp": 1527009133,
- "version": "0.0.5",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1525477860,
- "version": "0.0.4",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1525428773,
- "version": "0.0.3",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1524044013,
- "version": "0.0.2",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- }
-]
diff --git a/packages/sol-resolver/CHANGELOG.md b/packages/sol-resolver/CHANGELOG.md
deleted file mode 100644
index f23c55ea8..000000000
--- a/packages/sol-resolver/CHANGELOG.md
+++ /dev/null
@@ -1,141 +0,0 @@
-<!--
-changelogUtils.file is auto-generated using the monorepo-scripts package. Don't edit directly.
-Edit the package's CHANGELOG.json file only.
--->
-
-CHANGELOG
-
-## v2.0.2 - _February 7, 2019_
-
- * Dependencies updated
-
-## v2.0.1 - _February 6, 2019_
-
- * Dependencies updated
-
-## v2.0.0 - _February 5, 2019_
-
- * Upgrade the bignumber.js to v8.0.2 (#1517)
-
-## v1.2.3 - _January 15, 2019_
-
- * Dependencies updated
-
-## v1.2.2 - _January 11, 2019_
-
- * Dependencies updated
-
-## v1.2.1 - _January 9, 2019_
-
- * Add `absolutePath` to `ContractSource` type (#1461)
- * Add `SpyResolver` that records all resolved contracts data (#1461)
-
-## v1.1.1 - _December 13, 2018_
-
- * Dependencies updated
-
-## v1.1.0 - _December 11, 2018_
-
- * NPMResolver now supports scoped packages (#1311)
-
-## v1.0.17 - _November 21, 2018_
-
- * Dependencies updated
-
-## v1.0.16 - _November 9, 2018_
-
- * Dependencies updated
-
-## v1.0.15 - _October 18, 2018_
-
- * Dependencies updated
-
-## v1.0.14 - _October 4, 2018_
-
- * Dependencies updated
-
-## v1.0.13 - _October 2, 2018_
-
- * Dependencies updated
-
-## v1.0.12 - _September 28, 2018_
-
- * Dependencies updated
-
-## v1.0.11 - _September 25, 2018_
-
- * Dependencies updated
-
-## v1.0.10 - _September 25, 2018_
-
- * Dependencies updated
-
-## v1.0.9 - _September 21, 2018_
-
- * Dependencies updated
-
-## v1.0.8 - _September 5, 2018_
-
- * Dependencies updated
-
-## v1.0.7 - _August 27, 2018_
-
- * Dependencies updated
-
-## v1.0.6 - _August 24, 2018_
-
- * Dependencies updated
-
-## v1.0.5 - _August 14, 2018_
-
- * Fix a bug where RelativeFSResolver would crash when trying to read a directory (#909)
- * Fix a bug where NpmResolver would crash when trying to read a directory (#961)
-
-## v1.0.4 - _July 26, 2018_
-
- * Dependencies updated
-
-## v1.0.3 - _July 26, 2018_
-
- * Dependencies updated
-
-## v1.0.2 - _July 26, 2018_
-
- * Dependencies updated
-
-## v1.0.1 - _July 23, 2018_
-
- * Dependencies updated
-
-## v1.0.0 - _July 19, 2018_
-
- * Fix a bug in FsResolver where it tries to read directories as files (#589)
- * Fix a bug in NameResolver where it is not ignoring .sol files (#589)
-
-## v0.0.8 - _July 9, 2018_
-
- * Dependencies updated
-
-## v0.0.7 - _June 19, 2018_
-
- * Dependencies updated
-
-## v0.0.6 - _May 31, 2018_
-
- * Incorrect publish that was unpublished
-
-## v0.0.5 - _May 22, 2018_
-
- * Dependencies updated
-
-## v0.0.4 - _May 4, 2018_
-
- * Dependencies updated
-
-## v0.0.3 - _May 4, 2018_
-
- * Dependencies updated
-
-## v0.0.2 - _April 18, 2018_
-
- * Dependencies updated
diff --git a/packages/sol-resolver/README.md b/packages/sol-resolver/README.md
deleted file mode 100644
index 2ab336bc9..000000000
--- a/packages/sol-resolver/README.md
+++ /dev/null
@@ -1,67 +0,0 @@
-## @0x/sol-resolver
-
-A Solidity import resolver used by [sol-compiler](https://github.com/0xProject/0x-monorepo/tree/development/packages/sol-compiler).
-
-## Installation
-
-```bash
-yarn add @0x/sol-resolver
-```
-
-**Import**
-
-```javascript
-import { Resolver } from '@0x/sol-resolver';
-```
-
-or
-
-```javascript
-var Resolver = require('@0x/sol-resolver').Resolver;
-```
-
-## Contributing
-
-We welcome improvements and fixes from the wider community! To report bugs within this package, please create an issue in this repository.
-
-Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
-
-### Install dependencies
-
-If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
-
-```bash
-yarn config set workspaces-experimental true
-```
-
-Then install dependencies
-
-```bash
-yarn install
-```
-
-### Build
-
-To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
-
-```bash
-PKG=@0x/sol-resolver yarn build
-```
-
-Or continuously rebuild on change:
-
-```bash
-PKG=@0x/sol-resolver yarn watch
-```
-
-### Clean
-
-```bash
-yarn clean
-```
-
-### Lint
-
-```bash
-yarn lint
-```
diff --git a/packages/sol-resolver/package.json b/packages/sol-resolver/package.json
deleted file mode 100644
index aeb0c6bfc..000000000
--- a/packages/sol-resolver/package.json
+++ /dev/null
@@ -1,40 +0,0 @@
-{
- "name": "@0x/sol-resolver",
- "version": "2.0.2",
- "engines": {
- "node": ">=6.12"
- },
- "description": "Import resolver for smart contracts dependencies",
- "main": "lib/index.js",
- "types": "lib/index.d.ts",
- "scripts": {
- "build": "tsc -b",
- "build:ci": "yarn build",
- "clean": "shx rm -rf lib",
- "lint": "tslint --format stylish --project ."
- },
- "repository": {
- "type": "git",
- "url": "https://github.com/0xProject/0x-monorepo.git"
- },
- "license": "Apache-2.0",
- "bugs": {
- "url": "https://github.com/0xProject/0x-monorepo/issues"
- },
- "homepage": "https://github.com/0xProject/0x-monorepo/packages/resolver/README.md",
- "devDependencies": {
- "@0x/tslint-config": "^3.0.0",
- "make-promises-safe": "^1.1.0",
- "shx": "^0.2.2",
- "tslint": "5.11.0",
- "typescript": "3.0.1"
- },
- "dependencies": {
- "@0x/types": "^2.0.2",
- "@0x/typescript-typings": "^4.0.0",
- "lodash": "^4.17.11"
- },
- "publishConfig": {
- "access": "public"
- }
-}
diff --git a/packages/sol-resolver/src/globals.d.ts b/packages/sol-resolver/src/globals.d.ts
deleted file mode 100644
index e799b3529..000000000
--- a/packages/sol-resolver/src/globals.d.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-// tslint:disable:completed-docs
-declare module '*.json' {
- const json: any;
- /* tslint:disable */
- export default json;
- /* tslint:enable */
-}
diff --git a/packages/sol-resolver/src/index.ts b/packages/sol-resolver/src/index.ts
deleted file mode 100644
index f55aca070..000000000
--- a/packages/sol-resolver/src/index.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-export { ContractSource, ContractSources } from './types';
-export { FallthroughResolver } from './resolvers/fallthrough_resolver';
-export { URLResolver } from './resolvers/url_resolver';
-export { NPMResolver } from './resolvers/npm_resolver';
-export { FSResolver } from './resolvers/fs_resolver';
-export { RelativeFSResolver } from './resolvers/relative_fs_resolver';
-export { NameResolver } from './resolvers/name_resolver';
-export { SpyResolver } from './resolvers/spy_resolver';
-export { EnumerableResolver } from './resolvers/enumerable_resolver';
-export { Resolver } from './resolvers/resolver';
diff --git a/packages/sol-resolver/src/resolvers/enumerable_resolver.ts b/packages/sol-resolver/src/resolvers/enumerable_resolver.ts
deleted file mode 100644
index 0efa43e7c..000000000
--- a/packages/sol-resolver/src/resolvers/enumerable_resolver.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-import { ContractSource } from '../types';
-
-import { Resolver } from './resolver';
-
-export abstract class EnumerableResolver extends Resolver {
- public abstract getAll(): ContractSource[];
-}
diff --git a/packages/sol-resolver/src/resolvers/fallthrough_resolver.ts b/packages/sol-resolver/src/resolvers/fallthrough_resolver.ts
deleted file mode 100644
index 338f334f4..000000000
--- a/packages/sol-resolver/src/resolvers/fallthrough_resolver.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-import * as _ from 'lodash';
-
-import { ContractSource } from '../types';
-
-import { Resolver } from './resolver';
-
-export class FallthroughResolver extends Resolver {
- private readonly _resolvers: Resolver[] = [];
- public appendResolver(resolver: Resolver): void {
- this._resolvers.push(resolver);
- }
- public resolveIfExists(importPath: string): ContractSource | undefined {
- for (const resolver of this._resolvers) {
- const contractSourceIfExists = resolver.resolveIfExists(importPath);
- if (!_.isUndefined(contractSourceIfExists)) {
- return contractSourceIfExists;
- }
- }
- return undefined;
- }
-}
diff --git a/packages/sol-resolver/src/resolvers/fs_resolver.ts b/packages/sol-resolver/src/resolvers/fs_resolver.ts
deleted file mode 100644
index 248fa405e..000000000
--- a/packages/sol-resolver/src/resolvers/fs_resolver.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-import * as fs from 'fs';
-import * as path from 'path';
-
-import { ContractSource } from '../types';
-
-import { Resolver } from './resolver';
-
-export class FSResolver extends Resolver {
- // tslint:disable-next-line:prefer-function-over-method
- public resolveIfExists(importPath: string): ContractSource | undefined {
- if (fs.existsSync(importPath) && fs.lstatSync(importPath).isFile()) {
- const fileContent = fs.readFileSync(importPath).toString();
- const absolutePath = path.resolve(importPath);
- return { source: fileContent, path: importPath, absolutePath } as any;
- }
- return undefined;
- }
-}
diff --git a/packages/sol-resolver/src/resolvers/name_resolver.ts b/packages/sol-resolver/src/resolvers/name_resolver.ts
deleted file mode 100644
index aee326fb7..000000000
--- a/packages/sol-resolver/src/resolvers/name_resolver.ts
+++ /dev/null
@@ -1,66 +0,0 @@
-import * as fs from 'fs';
-import * as path from 'path';
-
-import { ContractSource } from '../types';
-
-import { EnumerableResolver } from './enumerable_resolver';
-
-const SOLIDITY_FILE_EXTENSION = '.sol';
-
-export class NameResolver extends EnumerableResolver {
- private readonly _contractsDir: string;
- constructor(contractsDir: string) {
- super();
- this._contractsDir = contractsDir;
- }
- public resolveIfExists(lookupContractName: string): ContractSource | undefined {
- let contractSource: ContractSource | undefined;
- const onFile = (filePath: string) => {
- const contractName = path.basename(filePath, SOLIDITY_FILE_EXTENSION);
- if (contractName === lookupContractName) {
- const absoluteContractPath = path.join(this._contractsDir, filePath);
- const source = fs.readFileSync(absoluteContractPath).toString();
- contractSource = { source, path: filePath, absolutePath: absoluteContractPath };
- return true;
- }
- return undefined;
- };
- this._traverseContractsDir(this._contractsDir, onFile);
- return contractSource;
- }
- public getAll(): ContractSource[] {
- const contractSources: ContractSource[] = [];
- const onFile = (filePath: string) => {
- const absoluteContractPath = path.join(this._contractsDir, filePath);
- const source = fs.readFileSync(absoluteContractPath).toString();
- const contractSource = { source, path: filePath, absolutePath: absoluteContractPath };
- contractSources.push(contractSource);
- };
- this._traverseContractsDir(this._contractsDir, onFile);
- return contractSources;
- }
- // tslint:disable-next-line:prefer-function-over-method
- private _traverseContractsDir(dirPath: string, onFile: (filePath: string) => true | void): boolean {
- let dirContents: string[] = [];
- try {
- dirContents = fs.readdirSync(dirPath);
- } catch (err) {
- throw new Error(`No directory found at ${dirPath}`);
- }
- for (const fileName of dirContents) {
- const absoluteEntryPath = path.join(dirPath, fileName);
- const isDirectory = fs.lstatSync(absoluteEntryPath).isDirectory();
- const entryPath = path.relative(this._contractsDir, absoluteEntryPath);
- let isComplete;
- if (isDirectory) {
- isComplete = this._traverseContractsDir(absoluteEntryPath, onFile);
- } else if (fileName.endsWith(SOLIDITY_FILE_EXTENSION)) {
- isComplete = onFile(entryPath);
- }
- if (isComplete) {
- return isComplete;
- }
- }
- return false;
- }
-}
diff --git a/packages/sol-resolver/src/resolvers/npm_resolver.ts b/packages/sol-resolver/src/resolvers/npm_resolver.ts
deleted file mode 100644
index 3c1d09557..000000000
--- a/packages/sol-resolver/src/resolvers/npm_resolver.ts
+++ /dev/null
@@ -1,42 +0,0 @@
-import * as fs from 'fs';
-import * as _ from 'lodash';
-import * as path from 'path';
-
-import { ContractSource } from '../types';
-
-import { Resolver } from './resolver';
-
-export class NPMResolver extends Resolver {
- private readonly _packagePath: string;
- constructor(packagePath: string) {
- super();
- this._packagePath = packagePath;
- }
- public resolveIfExists(importPath: string): ContractSource | undefined {
- if (!importPath.startsWith('/')) {
- let packageName;
- let packageScopeIfExists;
- let other;
- if (_.startsWith(importPath, '@')) {
- [packageScopeIfExists, packageName, ...other] = importPath.split('/');
- } else {
- [packageName, ...other] = importPath.split('/');
- }
- const pathWithinPackage = path.join(...other);
- let currentPath = this._packagePath;
- const ROOT_PATH = '/';
- while (currentPath !== ROOT_PATH) {
- const packagePath = _.isUndefined(packageScopeIfExists)
- ? packageName
- : path.join(packageScopeIfExists, packageName);
- const lookupPath = path.join(currentPath, 'node_modules', packagePath, pathWithinPackage);
- if (fs.existsSync(lookupPath) && fs.lstatSync(lookupPath).isFile()) {
- const fileContent = fs.readFileSync(lookupPath).toString();
- return { source: fileContent, path: importPath, absolutePath: lookupPath };
- }
- currentPath = path.dirname(currentPath);
- }
- }
- return undefined;
- }
-}
diff --git a/packages/sol-resolver/src/resolvers/relative_fs_resolver.ts b/packages/sol-resolver/src/resolvers/relative_fs_resolver.ts
deleted file mode 100644
index cfff145f9..000000000
--- a/packages/sol-resolver/src/resolvers/relative_fs_resolver.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-import * as fs from 'fs';
-import * as path from 'path';
-
-import { ContractSource } from '../types';
-
-import { Resolver } from './resolver';
-
-export class RelativeFSResolver extends Resolver {
- private readonly _contractsDir: string;
- constructor(contractsDir: string) {
- super();
- this._contractsDir = contractsDir;
- }
- // tslint:disable-next-line:prefer-function-over-method
- public resolveIfExists(importPath: string): ContractSource | undefined {
- const filePath = path.resolve(path.join(this._contractsDir, importPath));
- if (fs.existsSync(filePath) && !fs.lstatSync(filePath).isDirectory()) {
- const fileContent = fs.readFileSync(filePath).toString();
- return { source: fileContent, path: importPath, absolutePath: filePath };
- }
- return undefined;
- }
-}
diff --git a/packages/sol-resolver/src/resolvers/resolver.ts b/packages/sol-resolver/src/resolvers/resolver.ts
deleted file mode 100644
index 7edc9a85d..000000000
--- a/packages/sol-resolver/src/resolvers/resolver.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-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;
- }
-}
diff --git a/packages/sol-resolver/src/resolvers/spy_resolver.ts b/packages/sol-resolver/src/resolvers/spy_resolver.ts
deleted file mode 100644
index 5582d771a..000000000
--- a/packages/sol-resolver/src/resolvers/spy_resolver.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import * as _ from 'lodash';
-
-import { ContractSource } from '../types';
-
-import { Resolver } from './resolver';
-
-/**
- * This resolver is a passthrough proxy to any resolver that records all the resolved contracts sources.
- * You can access them later using the `resolvedContractSources` public field.
- */
-export class SpyResolver extends Resolver {
- public resolvedContractSources: ContractSource[] = [];
- private readonly _resolver: Resolver;
- constructor(resolver: Resolver) {
- super();
- this._resolver = resolver;
- }
- public resolveIfExists(importPath: string): ContractSource | undefined {
- const contractSourceIfExists = this._resolver.resolveIfExists(importPath);
- if (!_.isUndefined(contractSourceIfExists)) {
- this.resolvedContractSources.push(contractSourceIfExists);
- }
- return contractSourceIfExists;
- }
-}
diff --git a/packages/sol-resolver/src/resolvers/url_resolver.ts b/packages/sol-resolver/src/resolvers/url_resolver.ts
deleted file mode 100644
index ef300e6db..000000000
--- a/packages/sol-resolver/src/resolvers/url_resolver.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-import * as fs from 'fs';
-
-import { ContractSource } from '../types';
-
-import { Resolver } from './resolver';
-
-export class URLResolver extends Resolver {
- // tslint:disable-next-line:prefer-function-over-method
- public resolveIfExists(importPath: string): ContractSource | undefined {
- const FILE_URL_PREXIF = 'file://';
- if (importPath.startsWith(FILE_URL_PREXIF)) {
- const filePath = importPath.substr(FILE_URL_PREXIF.length);
- const fileContent = fs.readFileSync(filePath).toString();
- return { source: fileContent, path: importPath, absolutePath: filePath };
- }
- return undefined;
- }
-}
diff --git a/packages/sol-resolver/src/types.ts b/packages/sol-resolver/src/types.ts
deleted file mode 100644
index b4ba164c8..000000000
--- a/packages/sol-resolver/src/types.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-export interface ContractSource {
- source: string;
- path: string;
- absolutePath: string;
-}
-
-export interface ContractSources {
- [key: string]: ContractSource;
-}
diff --git a/packages/sol-resolver/tsconfig.json b/packages/sol-resolver/tsconfig.json
deleted file mode 100644
index 56689eaa3..000000000
--- a/packages/sol-resolver/tsconfig.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "extends": "../../tsconfig",
- "compilerOptions": {
- "outDir": "lib",
- "rootDir": "src"
- },
- "include": ["src/**/*"]
-}
diff --git a/packages/sol-resolver/tslint.json b/packages/sol-resolver/tslint.json
deleted file mode 100644
index dd9053357..000000000
--- a/packages/sol-resolver/tslint.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "extends": ["@0x/tslint-config"]
-}