yann300 6 years ago
parent bd5c16aeb4
commit 29690661fe
  1. 1
      package.json
  2. 19
      src/app/compiler/compiler-imports.js

@ -48,6 +48,7 @@
"remix-tests": "0.1.1",
"remixd": "0.1.8-alpha.6",
"request": "^2.83.0",
"@resolver-engine/imports": "^0.3.0",
"rimraf": "^2.6.1",
"selenium-standalone": "^6.0.1",
"solc": "^0.5.0",

@ -1,6 +1,7 @@
'use strict'
var base64 = require('js-base64').Base64
var swarmgw = require('swarmgw')()
var resolver = require('@resolver-engine/imports').ImportsEngine()
var request = require('request')
module.exports = class CompilerImports {
@ -112,13 +113,19 @@ module.exports = class CompilerImports {
})
}
})
if (found) return
if (found) {
return
} else if (/^[^:]*:\/\//.exec(url)) {
cb('Unable to import "' + url + '": Unsupported URL schema')
} else {
resolver
.resolve(url)
.then(result => {
return resolver.require(url)
})
.then(result => {
cb(null, result.source, url, result.provider, result.url)
})
.catch(err => {
err
cb('Unable to import "' + url + '": File not found')
}
})
}
}

Loading…
Cancel
Save