fix(sol-compiler, sol-resolver): Bug where sol-resolver tried to read a directory (#961)
fix(sol-compiler, sol-resolver): Fix bug where sol-resolver tried to read a directory
This commit is contained in:
parent
cd76c129da
commit
25a8554be1
@ -92,6 +92,7 @@
|
|||||||
"require-from-string": "^2.0.1",
|
"require-from-string": "^2.0.1",
|
||||||
"semver": "5.5.0",
|
"semver": "5.5.0",
|
||||||
"solc": "^0.4.23",
|
"solc": "^0.4.23",
|
||||||
|
"source-map-support": "^0.5.0",
|
||||||
"web3-eth-abi": "^1.0.0-beta.24",
|
"web3-eth-abi": "^1.0.0-beta.24",
|
||||||
"yargs": "^10.0.3"
|
"yargs": "^10.0.3"
|
||||||
},
|
},
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
import { logUtils } from '@0xproject/utils';
|
import { logUtils } from '@0xproject/utils';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
|
import 'source-map-support/register';
|
||||||
import * as yargs from 'yargs';
|
import * as yargs from 'yargs';
|
||||||
|
|
||||||
import { Compiler } from './compiler';
|
import { Compiler } from './compiler';
|
||||||
|
@ -5,6 +5,10 @@
|
|||||||
{
|
{
|
||||||
"note": "Fix a bug where RelativeFSResolver would crash when trying to read a directory",
|
"note": "Fix a bug where RelativeFSResolver would crash when trying to read a directory",
|
||||||
"pr": 909
|
"pr": 909
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"note": "Fix a bug where NpmResolver would crash when trying to read a directory",
|
||||||
|
"pr": 961
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -19,7 +19,7 @@ export class NPMResolver extends Resolver {
|
|||||||
const ROOT_PATH = '/';
|
const ROOT_PATH = '/';
|
||||||
while (currentPath !== ROOT_PATH) {
|
while (currentPath !== ROOT_PATH) {
|
||||||
const lookupPath = path.join(currentPath, 'node_modules', packageName, pathWithinPackage);
|
const lookupPath = path.join(currentPath, 'node_modules', packageName, pathWithinPackage);
|
||||||
if (fs.existsSync(lookupPath)) {
|
if (fs.existsSync(lookupPath) && fs.lstatSync(lookupPath).isFile()) {
|
||||||
const fileContent = fs.readFileSync(lookupPath).toString();
|
const fileContent = fs.readFileSync(lookupPath).toString();
|
||||||
return {
|
return {
|
||||||
source: fileContent,
|
source: fileContent,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user