diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2019-01-30 20:08:00 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2019-01-30 20:11:18 +0800 |
commit | e1244648e06faee44fd030f8a1323ab649cb6443 (patch) | |
tree | ba08a1cba77fc8b21c9d2ded1d98629350f44d5f /packages/sol-compiler/src | |
parent | 8d72e253c8bbe371e091b1ea6d365af07fd2ed26 (diff) | |
download | dexon-0x-contracts-e1244648e06faee44fd030f8a1323ab649cb6443.tar.gz dexon-0x-contracts-e1244648e06faee44fd030f8a1323ab649cb6443.tar.zst dexon-0x-contracts-e1244648e06faee44fd030f8a1323ab649cb6443.zip |
Rename dependencyNameToPackagePath to dependencyNameToPath
Diffstat (limited to 'packages/sol-compiler/src')
-rw-r--r-- | packages/sol-compiler/src/compiler.ts | 8 | ||||
-rw-r--r-- | packages/sol-compiler/src/utils/compiler.ts | 16 |
2 files changed, 12 insertions, 12 deletions
diff --git a/packages/sol-compiler/src/compiler.ts b/packages/sol-compiler/src/compiler.ts index e0c092bc1..efee3eb8a 100644 --- a/packages/sol-compiler/src/compiler.ts +++ b/packages/sol-compiler/src/compiler.ts @@ -254,7 +254,7 @@ export class Compiler { versionToInputs[solcVersion].contractsToCompile.push(contractSource.path); } - const dependencyNameToPackagePath = getDependencyNameToPackagePath(resolvedContractSources); + const dependencyNameToPath = getDependencyNameToPackagePath(resolvedContractSources); const compilerOutputs: StandardOutput[] = []; for (const solcVersion of _.keys(versionToInputs)) { @@ -267,7 +267,7 @@ export class Compiler { let compilerOutput; let fullSolcVersion; input.standardInput.settings.remappings = _.map( - dependencyNameToPackagePath, + dependencyNameToPath, (dependencyPackagePath: string, dependencyName: string) => `${dependencyName}=${dependencyPackagePath}`, ); if (this._useDockerisedSolc) { @@ -286,12 +286,12 @@ export class Compiler { compilerOutput.sources = makeContractPathsRelative( compilerOutput.sources, this._contractsDir, - dependencyNameToPackagePath, + dependencyNameToPath, ); compilerOutput.contracts = makeContractPathsRelative( compilerOutput.contracts, this._contractsDir, - dependencyNameToPackagePath, + dependencyNameToPath, ); for (const contractPath of input.contractsToCompile) { diff --git a/packages/sol-compiler/src/utils/compiler.ts b/packages/sol-compiler/src/utils/compiler.ts index 77a969e1c..c75f76dac 100644 --- a/packages/sol-compiler/src/utils/compiler.ts +++ b/packages/sol-compiler/src/utils/compiler.ts @@ -156,10 +156,10 @@ export async function compileDockerAsync( function makeContractPathRelative( absolutePath: string, contractsDir: string, - dependencyNameToPackagePath: { [dependencyName: string]: string }, + dependencyNameToPath: { [dependencyName: string]: string }, ): string { let contractPath = absolutePath.replace(`${contractsDir}/`, ''); - _.map(dependencyNameToPackagePath, (packagePath: string, dependencyName: string) => { + _.map(dependencyNameToPath, (packagePath: string, dependencyName: string) => { contractPath = contractPath.replace(packagePath, dependencyName); }); return contractPath; @@ -169,15 +169,15 @@ function makeContractPathRelative( * Makes the path relative removing all system-dependent data. Converts absolute paths to a format suitable for artifacts. * @param absolutePathToSmth Absolute path to contract or source * @param contractsDir Current package contracts directory location - * @param dependencyNameToPackagePath Mapping of dependency name to package path + * @param dependencyNameToPath Mapping of dependency name to package path */ export function makeContractPathsRelative( absolutePathToSmth: { [absoluteContractPath: string]: any }, contractsDir: string, - dependencyNameToPackagePath: { [dependencyName: string]: string }, + dependencyNameToPath: { [dependencyName: string]: string }, ): { [contractPath: string]: any } { return _.mapKeys(absolutePathToSmth, (_val: any, absoluteContractPath: string) => - makeContractPathRelative(absoluteContractPath, contractsDir, dependencyNameToPackagePath), + makeContractPathRelative(absoluteContractPath, contractsDir, dependencyNameToPath), ); } @@ -373,7 +373,7 @@ export function getDependencyNameToPackagePath( const allTouchedFiles = contractSources.map(contractSource => `${contractSource.absolutePath}`); const NODE_MODULES = 'node_modules'; const allTouchedDependencies = _.filter(allTouchedFiles, filePath => filePath.includes(NODE_MODULES)); - const dependencyNameToPackagePath: { [dependencyName: string]: string } = {}; + const dependencyNameToPath: { [dependencyName: string]: string } = {}; _.map(allTouchedDependencies, dependencyFilePath => { const lastNodeModulesStart = dependencyFilePath.lastIndexOf(NODE_MODULES); const lastNodeModulesEnd = lastNodeModulesStart + NODE_MODULES.length; @@ -389,7 +389,7 @@ export function getDependencyNameToPackagePath( dependencyName = `${packageName}`; } const dependencyPackagePath = path.join(dependencyFilePath.substr(0, lastNodeModulesEnd), dependencyName); - dependencyNameToPackagePath[dependencyName] = dependencyPackagePath; + dependencyNameToPath[dependencyName] = dependencyPackagePath; }); - return dependencyNameToPackagePath; + return dependencyNameToPath; } |