aboutsummaryrefslogtreecommitdiffstats
path: root/packages/sol-resolver
diff options
context:
space:
mode:
authorBrandon Millman <brandon.millman@gmail.com>2018-05-24 05:16:32 +0800
committerBrandon Millman <brandon.millman@gmail.com>2018-05-24 05:16:32 +0800
commit3fe94891d3569a4615f4aa32d47f0065b5957fe9 (patch)
tree83d4e4ccf7748d2100aa935c457de0a893eaec9c /packages/sol-resolver
parentd0abc60176dba3116cb3986d298ab5164c1fe49c (diff)
parentf6b81f588d98e09e7a5806902d94e2892d029481 (diff)
downloaddexon-sol-tools-3fe94891d3569a4615f4aa32d47f0065b5957fe9.tar
dexon-sol-tools-3fe94891d3569a4615f4aa32d47f0065b5957fe9.tar.gz
dexon-sol-tools-3fe94891d3569a4615f4aa32d47f0065b5957fe9.tar.bz2
dexon-sol-tools-3fe94891d3569a4615f4aa32d47f0065b5957fe9.tar.lz
dexon-sol-tools-3fe94891d3569a4615f4aa32d47f0065b5957fe9.tar.xz
dexon-sol-tools-3fe94891d3569a4615f4aa32d47f0065b5957fe9.tar.zst
dexon-sol-tools-3fe94891d3569a4615f4aa32d47f0065b5957fe9.zip
Merge branch 'v2-prototype' into feature/website/wallet-flex-box
* v2-prototype: (95 commits) Add missing dep to website Upgrade solidity parser Fix trace test Fix linter issues Move contract utils Fix prettier Fix NameResolver Fix prettier Remove 0x.js as a dependency from website Enable 0x.js tests Fix small bug in order-utils Address feedback Fix Tslint error caused by "PromiseLike" value Fix Tslint error caused by "PromiseLike" value Update dogfood url fix contract-wrappers version Parse compiler.json in SolCompilerArtifactsAdapter Fix TokenTransferProxy artifact name since it's now suffixed with _v1 Update yarn.lock Fix signature verification test ...
Diffstat (limited to 'packages/sol-resolver')
-rw-r--r--packages/sol-resolver/CHANGELOG.json22
-rw-r--r--packages/sol-resolver/CHANGELOG.md6
-rw-r--r--packages/sol-resolver/package.json8
-rw-r--r--packages/sol-resolver/src/resolvers/fs_resolver.ts2
-rw-r--r--packages/sol-resolver/src/resolvers/name_resolver.ts11
5 files changed, 40 insertions, 9 deletions
diff --git a/packages/sol-resolver/CHANGELOG.json b/packages/sol-resolver/CHANGELOG.json
index 0126fa170..895bd2104 100644
--- a/packages/sol-resolver/CHANGELOG.json
+++ b/packages/sol-resolver/CHANGELOG.json
@@ -1,5 +1,27 @@
[
{
+ "version": "0.0.5",
+ "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": 1527009133,
+ "version": "0.0.5",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
"timestamp": 1525477860,
"version": "0.0.4",
"changes": [
diff --git a/packages/sol-resolver/CHANGELOG.md b/packages/sol-resolver/CHANGELOG.md
index 4780544fa..bd94b1b41 100644
--- a/packages/sol-resolver/CHANGELOG.md
+++ b/packages/sol-resolver/CHANGELOG.md
@@ -5,7 +5,11 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
-## v0.0.4 - _May 5, 2018_
+## v0.0.5 - _May 22, 2018_
+
+ * Dependencies updated
+
+## v0.0.4 - _May 4, 2018_
* Dependencies updated
diff --git a/packages/sol-resolver/package.json b/packages/sol-resolver/package.json
index 54d8308de..64a0f19ab 100644
--- a/packages/sol-resolver/package.json
+++ b/packages/sol-resolver/package.json
@@ -1,6 +1,6 @@
{
"name": "@0xproject/sol-resolver",
- "version": "0.0.4",
+ "version": "0.0.5",
"engines": {
"node": ">=6.12"
},
@@ -24,8 +24,8 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/resolver/README.md",
"devDependencies": {
- "@0xproject/monorepo-scripts": "^0.1.19",
- "@0xproject/tslint-config": "^0.4.17",
+ "@0xproject/monorepo-scripts": "^0.1.20",
+ "@0xproject/tslint-config": "^0.4.18",
"copyfiles": "^1.2.0",
"make-promises-safe": "^1.1.0",
"shx": "^0.2.2",
@@ -33,7 +33,7 @@
"typescript": "2.7.1"
},
"dependencies": {
- "@0xproject/types": "^0.6.3",
+ "@0xproject/types": "^0.7.0",
"@0xproject/typescript-typings": "^0.0.3",
"lodash": "^4.17.4"
},
diff --git a/packages/sol-resolver/src/resolvers/fs_resolver.ts b/packages/sol-resolver/src/resolvers/fs_resolver.ts
index 4f05fba88..63fc3448e 100644
--- a/packages/sol-resolver/src/resolvers/fs_resolver.ts
+++ b/packages/sol-resolver/src/resolvers/fs_resolver.ts
@@ -7,7 +7,7 @@ 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)) {
+ if (fs.existsSync(importPath) && fs.lstatSync(importPath).isFile()) {
const fileContent = fs.readFileSync(importPath).toString();
return {
source: fileContent,
diff --git a/packages/sol-resolver/src/resolvers/name_resolver.ts b/packages/sol-resolver/src/resolvers/name_resolver.ts
index 76bed802e..e489c70a7 100644
--- a/packages/sol-resolver/src/resolvers/name_resolver.ts
+++ b/packages/sol-resolver/src/resolvers/name_resolver.ts
@@ -6,6 +6,8 @@ import { ContractSource } from '../types';
import { EnumerableResolver } from './enumerable_resolver';
+const SOLIDITY_FILE_EXTENSION = '.sol';
+
export class NameResolver extends EnumerableResolver {
private _contractsDir: string;
constructor(contractsDir: string) {
@@ -13,7 +15,6 @@ export class NameResolver extends EnumerableResolver {
this._contractsDir = contractsDir;
}
public resolveIfExists(lookupContractName: string): ContractSource | undefined {
- const SOLIDITY_FILE_EXTENSION = '.sol';
let contractSource: ContractSource | undefined;
const onFile = (filePath: string) => {
const contractName = path.basename(filePath, SOLIDITY_FILE_EXTENSION);
@@ -32,7 +33,6 @@ export class NameResolver extends EnumerableResolver {
return contractSource;
}
public getAll(): ContractSource[] {
- const SOLIDITY_FILE_EXTENSION = '.sol';
const contractSources: ContractSource[] = [];
const onFile = (filePath: string) => {
const contractName = path.basename(filePath, SOLIDITY_FILE_EXTENSION);
@@ -59,7 +59,12 @@ export class NameResolver extends EnumerableResolver {
const absoluteEntryPath = path.join(dirPath, fileName);
const isDirectory = fs.lstatSync(absoluteEntryPath).isDirectory();
const entryPath = path.relative(this._contractsDir, absoluteEntryPath);
- const isComplete = isDirectory ? this._traverseContractsDir(absoluteEntryPath, onFile) : onFile(entryPath);
+ let isComplete;
+ if (isDirectory) {
+ isComplete = this._traverseContractsDir(absoluteEntryPath, onFile);
+ } else if (fileName.endsWith(SOLIDITY_FILE_EXTENSION)) {
+ isComplete = onFile(entryPath);
+ }
if (isComplete) {
return isComplete;
}