resolve via callback

pull/7/head
0mkar 6 years ago
parent 4074eb754e
commit 5293a48d7c
  1. 3
      remix-resolve/src/combineSource.js
  2. 1
      remix-resolve/src/getFile.js
  3. 2
      remix-resolve/tests/test.js

@ -28,7 +28,8 @@ const combineSource = async function (rootpath, sources) {
let subSorce = {} let subSorce = {}
const response = await resolve(rootpath, fn) const response = await resolve(rootpath, fn)
// sources[fileName].content = sources[fileName].content.replace(importLine, 'import' + extra + ' \'' + response.filename + '\';') // 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) sources = Object.assign(await combineSource(response.rootpath, subSorce), sources)
} }
} catch (e) { } catch (e) {

@ -1,4 +1,5 @@
const getFile = function (path, sources) { const getFile = function (path, sources) {
// return sources[path].content
return sources[path].content return sources[path].content
} }

@ -165,7 +165,7 @@ describe('testRunner', function () {
const findImportsSync = function (path) { const findImportsSync = function (path) {
console.log(path) console.log(path)
console.log(sources) console.log(sources)
// return rr.getFile(path, sources) return rr.getFile(path, combinedSources)
} }
try { try {
results = solc.compile(JSON.stringify(input), findImportsSync) results = solc.compile(JSON.stringify(input), findImportsSync)

Loading…
Cancel
Save