Merge pull request #1745 from ethereum/urlresolver

Use @resolver-engine/imports
pull/3094/head
yann300 6 years ago committed by GitHub
commit c94e99cee1
  1. 1
      package.json
  2. 19
      src/app/compiler/compiler-imports.js
  3. 2
      src/app/components/plugin-manager-proxy.js
  4. 1
      src/app/tabs/compile-tab.js
  5. 2
      src/app/ui/landing-page/generate.js

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

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

@ -27,7 +27,7 @@ class PluginManagerProxy {
unregister (name, instance) { unregister (name, instance) {
if (this._listeners[name]) { if (this._listeners[name]) {
instance.events.off('compilationFinished', this._listeners[name]) instance.events.removeListener('compilationFinished', this._listeners[name])
} }
} }

@ -28,7 +28,6 @@ class CompileTab extends ApiFactory {
el: null, el: null,
warnCompilationSlow: null, warnCompilationSlow: null,
errorContainer: null, errorContainer: null,
contractNames: null,
contractEl: null contractEl: null
} }
this.queryParams = new QueryParams() this.queryParams = new QueryParams()

@ -63,7 +63,7 @@ export function generateHomePage (appManager, appStore) {
payload: () => { payload: () => {
appStore.getActives() appStore.getActives()
.filter(({profile}) => !profile.required) .filter(({profile}) => !profile.required)
.forEach((profile) => { appManager.deactivateOne(profile.name) }) .forEach(({profile}) => { appManager.deactivateOne(profile.name) })
}}) }})
defaultWorkspaces(appManager).forEach((workspace) => { defaultWorkspaces(appManager).forEach((workspace) => {
sectionsWorkspaces.push({ sectionsWorkspaces.push({

Loading…
Cancel
Save