From e1244648e06faee44fd030f8a1323ab649cb6443 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Wed, 30 Jan 2019 13:08:00 +0100 Subject: Rename dependencyNameToPackagePath to dependencyNameToPath --- packages/sol-compiler/src/compiler.ts | 8 ++++---- packages/sol-compiler/src/utils/compiler.ts | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) (limited to 'packages/sol-compiler') 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; } -- cgit v1.2.3