From 5293a48d7c93e857df6269a3bf170193832fbd31 Mon Sep 17 00:00:00 2001 From: 0mkar <0mkar@protonmail.com> Date: Tue, 4 Dec 2018 19:30:26 +0530 Subject: [PATCH] resolve via callback --- remix-resolve/src/combineSource.js | 3 ++- remix-resolve/src/getFile.js | 1 + remix-resolve/tests/test.js | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/remix-resolve/src/combineSource.js b/remix-resolve/src/combineSource.js index f08b8b2ee4..b8b451cb42 100644 --- a/remix-resolve/src/combineSource.js +++ b/remix-resolve/src/combineSource.js @@ -28,7 +28,8 @@ const combineSource = async function (rootpath, sources) { let subSorce = {} const response = await resolve(rootpath, fn) // sources[fileName].content = sources[fileName].content.replace(importLine, 'import' + extra + ' \'' + response.filename + '\';') - subSorce[fn] = { content: response.content } + const regex = /(\.+\/)/g + subSorce[fn.replace(regex, '')] = { content: response.content } sources = Object.assign(await combineSource(response.rootpath, subSorce), sources) } } catch (e) { diff --git a/remix-resolve/src/getFile.js b/remix-resolve/src/getFile.js index 92cf8f1d6e..fba0c1345f 100644 --- a/remix-resolve/src/getFile.js +++ b/remix-resolve/src/getFile.js @@ -1,4 +1,5 @@ const getFile = function (path, sources) { + // return sources[path].content return sources[path].content } diff --git a/remix-resolve/tests/test.js b/remix-resolve/tests/test.js index 7ea08b2111..e329e5e3c3 100644 --- a/remix-resolve/tests/test.js +++ b/remix-resolve/tests/test.js @@ -165,7 +165,7 @@ describe('testRunner', function () { const findImportsSync = function (path) { console.log(path) console.log(sources) - // return rr.getFile(path, sources) + return rr.getFile(path, combinedSources) } try { results = solc.compile(JSON.stringify(input), findImportsSync)