diff --git a/package.json b/package.json index a38f5c364b..9ba9270a65 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/app/compiler/compiler-imports.js b/src/app/compiler/compiler-imports.js index 386a3c2957..44d161cf02 100644 --- a/src/app/compiler/compiler-imports.js +++ b/src/app/compiler/compiler-imports.js @@ -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') - } + }) } } diff --git a/src/app/components/plugin-manager-proxy.js b/src/app/components/plugin-manager-proxy.js index 64c5cc9794..1b324718cf 100644 --- a/src/app/components/plugin-manager-proxy.js +++ b/src/app/components/plugin-manager-proxy.js @@ -27,7 +27,7 @@ class PluginManagerProxy { unregister (name, instance) { if (this._listeners[name]) { - instance.events.off('compilationFinished', this._listeners[name]) + instance.events.removeListener('compilationFinished', this._listeners[name]) } } diff --git a/src/app/tabs/compile-tab.js b/src/app/tabs/compile-tab.js index b3ce18b238..cf55d583e5 100644 --- a/src/app/tabs/compile-tab.js +++ b/src/app/tabs/compile-tab.js @@ -28,7 +28,6 @@ class CompileTab extends ApiFactory { el: null, warnCompilationSlow: null, errorContainer: null, - contractNames: null, contractEl: null } this.queryParams = new QueryParams() diff --git a/src/app/ui/landing-page/generate.js b/src/app/ui/landing-page/generate.js index 77fa223c81..98b3d6767a 100644 --- a/src/app/ui/landing-page/generate.js +++ b/src/app/ui/landing-page/generate.js @@ -63,7 +63,7 @@ export function generateHomePage (appManager, appStore) { payload: () => { appStore.getActives() .filter(({profile}) => !profile.required) - .forEach((profile) => { appManager.deactivateOne(profile.name) }) + .forEach(({profile}) => { appManager.deactivateOne(profile.name) }) }}) defaultWorkspaces(appManager).forEach((workspace) => { sectionsWorkspaces.push({