Unverified Commit 3bd52b9f authored by yann300's avatar yann300 Committed by GitHub

Merge pull request #511 from ethereum/remixplugin0.3

Use remix plugin 0.3
parents 566d35fd 76818ec2
...@@ -12,7 +12,7 @@ module.exports = { ...@@ -12,7 +12,7 @@ module.exports = {
browser browser
.addFile('file.js', { content: executeFile }) .addFile('file.js', { content: executeFile })
.executeScript(`remix.exeCurrent()`) .executeScript(`remix.exeCurrent()`)
.pause(2000) .pause(5000)
.journalLastChildIncludes('browser/file.js') .journalLastChildIncludes('browser/file.js')
}, },
......
...@@ -6,7 +6,7 @@ import sauce from './sauce' ...@@ -6,7 +6,7 @@ import sauce from './sauce'
const testData = { const testData = {
pluginName: 'remixIde', pluginName: 'remixIde',
pluginDisplayName: 'Remix IDE', pluginDisplayName: 'Remix IDE',
pluginUrl: 'https://remix-project.org/' pluginUrl: 'https://zokrates-remix-plugin.netlify.app/'
} }
module.exports = { module.exports = {
...@@ -44,6 +44,7 @@ module.exports = { ...@@ -44,6 +44,7 @@ module.exports = {
browser.waitForElementVisible('*[data-id="pluginManagerComponentPluginManager"]') browser.waitForElementVisible('*[data-id="pluginManagerComponentPluginManager"]')
.click('*[data-id="pluginManagerComponentPluginManager"]') .click('*[data-id="pluginManagerComponentPluginManager"]')
.scrollAndClick('*[data-id="pluginManagerComponentActivateButtondebugger"]') .scrollAndClick('*[data-id="pluginManagerComponentActivateButtondebugger"]')
.pause(2000)
.waitForElementVisible('*[data-id="pluginManagerComponentDeactivateButtondebugger"]') .waitForElementVisible('*[data-id="pluginManagerComponentDeactivateButtondebugger"]')
.scrollAndClick('*[data-id="pluginManagerComponentActivateButtonvyper"]') .scrollAndClick('*[data-id="pluginManagerComponentActivateButtonvyper"]')
.waitForElementVisible('*[data-id="pluginManagerComponentDeactivateButtonvyper"]') .waitForElementVisible('*[data-id="pluginManagerComponentDeactivateButtonvyper"]')
...@@ -54,8 +55,11 @@ module.exports = { ...@@ -54,8 +55,11 @@ module.exports = {
'Should deactivate plugins': function (browser: NightwatchBrowser) { 'Should deactivate plugins': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('*[data-id="pluginManagerComponentPluginManager"]') browser.waitForElementVisible('*[data-id="pluginManagerComponentPluginManager"]')
.click('*[data-id="pluginManagerComponentPluginManager"]') .click('*[data-id="pluginManagerComponentPluginManager"]')
.waitForElementVisible('*[data-id="pluginManagerComponentDeactivateButtondebugger"]')
.pause(2000)
.scrollAndClick('*[data-id="pluginManagerComponentDeactivateButtondebugger"]') .scrollAndClick('*[data-id="pluginManagerComponentDeactivateButtondebugger"]')
.waitForElementVisible('*[data-id="pluginManagerComponentActivateButtondebugger"]') .waitForElementVisible('*[data-id="pluginManagerComponentActivateButtondebugger"]')
.waitForElementVisible('*[data-id="pluginManagerComponentDeactivateButtonvyper"]')
.scrollAndClick('*[data-id="pluginManagerComponentDeactivateButtonvyper"]') .scrollAndClick('*[data-id="pluginManagerComponentDeactivateButtonvyper"]')
.waitForElementVisible('*[data-id="pluginManagerComponentActivateButtonvyper"]') .waitForElementVisible('*[data-id="pluginManagerComponentActivateButtonvyper"]')
}, },
......
...@@ -4,7 +4,7 @@ import { basicLogo } from './app/ui/svgLogo' ...@@ -4,7 +4,7 @@ import { basicLogo } from './app/ui/svgLogo'
import { RunTab, makeUdapp } from './app/udapp' import { RunTab, makeUdapp } from './app/udapp'
import PanelsResize from './lib/panels-resize' import PanelsResize from './lib/panels-resize'
import { Engine } from '@remixproject/engine' import { RemixEngine } from './remixEngine'
import { RemixAppManager } from './remixAppManager' import { RemixAppManager } from './remixAppManager'
import { FramingService } from './framingService' import { FramingService } from './framingService'
import { MainView } from './app/panels/main-view' import { MainView } from './app/panels/main-view'
...@@ -231,13 +231,8 @@ Please make a backup of your contracts and start using http://remix.ethereum.org ...@@ -231,13 +231,8 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
const appManager = self.appManager const appManager = self.appManager
const pluginLoader = appManager.pluginLoader const pluginLoader = appManager.pluginLoader
const workspace = pluginLoader.get() const workspace = pluginLoader.get()
const engine = new Engine(appManager) const engine = new RemixEngine()
engine.setPluginOption = ({ name, kind }) => { engine.register(appManager)
if (kind === 'provider') return { queueTimeout: 60000 * 2 }
if (name === 'LearnEth') return { queueTimeout: 60000 }
return { queueTimeout: 10000 }
}
await engine.onload()
// SERVICES // SERVICES
// ----------------- import content servive ------------------------ // ----------------- import content servive ------------------------
...@@ -401,17 +396,17 @@ Please make a backup of your contracts and start using http://remix.ethereum.org ...@@ -401,17 +396,17 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
await appManager.activatePlugin(['contentImport', 'theme', 'editor', 'fileManager', 'compilerMetadata', 'compilerArtefacts', 'network', 'web3Provider', 'offsetToLineColumnConverter']) await appManager.activatePlugin(['contentImport', 'theme', 'editor', 'fileManager', 'compilerMetadata', 'compilerArtefacts', 'network', 'web3Provider', 'offsetToLineColumnConverter'])
await appManager.activatePlugin(['mainPanel', 'menuicons']) await appManager.activatePlugin(['mainPanel', 'menuicons'])
await appManager.activatePlugin(['sidePanel']) // activating host plugin separately await appManager.activatePlugin(['sidePanel']) // activating host plugin separately
await appManager.activatePlugin(['home', 'hiddenPanel', 'pluginManager', 'fileExplorers', 'settings', 'contextualListener', 'scriptRunner', 'terminal', 'fetchAndCompile']) await appManager.activatePlugin(['home', 'hiddenPanel', 'pluginManager', 'fileExplorers', 'settings', 'contextualListener', 'terminal', 'fetchAndCompile'])
const queryParams = new QueryParams() const queryParams = new QueryParams()
const params = queryParams.get() const params = queryParams.get()
// Set workspace after initial activation // Set workspace after initial activation
if (Array.isArray(workspace)) { if (Array.isArray(workspace)) {
appManager.activatePlugin(workspace).then(() => { appManager.activatePlugin(workspace).then(async () => {
try { try {
if (params.deactivate) { if (params.deactivate) {
appManager.deactivatePlugin(params.deactivate.split(',')) await appManager.deactivatePlugin(params.deactivate.split(','))
} }
} catch (e) { } catch (e) {
console.log(e) console.log(e)
...@@ -425,9 +420,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org ...@@ -425,9 +420,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
if (callDetails.length > 1) { if (callDetails.length > 1) {
toolTip(`initiating ${callDetails[0]} ...`) toolTip(`initiating ${callDetails[0]} ...`)
// @todo(remove the timeout when activatePlugin is on 0.3.0) // @todo(remove the timeout when activatePlugin is on 0.3.0)
setTimeout(() => {
appManager.call(...callDetails).catch(console.error) appManager.call(...callDetails).catch(console.error)
}, 5000)
} }
} }
}).catch(console.error) }).catch(console.error)
......
import { EventEmitter } from 'events' import { EventEmitter } from 'events'
import { HostPlugin } from '@remixproject/engine' import { HostPlugin } from '@remixproject/engine-web'
const csjs = require('csjs-inject') const csjs = require('csjs-inject')
const yo = require('yo-yo') const yo = require('yo-yo')
......
import { ViewPlugin, IframePlugin, WebsocketPlugin } from '@remixproject/engine' import { IframePlugin, ViewPlugin, WebsocketPlugin } from '@remixproject/engine-web'
import { PluginManagerSettings } from './plugin-manager-settings' import { PluginManagerSettings } from './plugin-manager-settings'
import * as packageJson from '../../../../../package.json' import * as packageJson from '../../../../../package.json'
const yo = require('yo-yo') const yo = require('yo-yo')
...@@ -83,8 +83,8 @@ class PluginManagerComponent extends ViewPlugin { ...@@ -83,8 +83,8 @@ class PluginManagerComponent extends ViewPlugin {
this.filter = '' this.filter = ''
this.appManager.event.on('activate', () => { this.reRender() }) this.appManager.event.on('activate', () => { this.reRender() })
this.appManager.event.on('deactivate', () => { this.reRender() }) this.appManager.event.on('deactivate', () => { this.reRender() })
this.appManager.event.on('added', () => { this.reRender() })
this.engine = engine this.engine = engine
this.engine.event.on('onRegistration', () => { this.reRender() })
} }
isActive (name) { isActive (name) {
...@@ -151,7 +151,7 @@ class PluginManagerComponent extends ViewPlugin { ...@@ -151,7 +151,7 @@ class PluginManagerComponent extends ViewPlugin {
} }
const plugin = profile.type === 'iframe' ? new IframePlugin(profile) : new WebsocketPlugin(profile) const plugin = profile.type === 'iframe' ? new IframePlugin(profile) : new WebsocketPlugin(profile)
this.engine.register(plugin) this.engine.register(plugin)
this.appManager.activatePlugin(plugin.name) await this.appManager.activatePlugin(plugin.name)
} catch (err) { } catch (err) {
// TODO : Use an alert to handle this error instead of a console.log // TODO : Use an alert to handle this error instead of a console.log
console.log(`Cannot create Plugin : ${err.message}`) console.log(`Cannot create Plugin : ${err.message}`)
......
import isElectron from 'is-electron' import isElectron from 'is-electron'
import { WebsocketPlugin } from '@remixproject/engine' import { WebsocketPlugin } from '@remixproject/engine-web'
import * as packageJson from '../../../../../package.json' import * as packageJson from '../../../../../package.json'
var yo = require('yo-yo') var yo = require('yo-yo')
var modalDialog = require('../ui/modaldialog') var modalDialog = require('../ui/modaldialog')
......
import { ViewPlugin } from '@remixproject/engine' import { ViewPlugin } from '@remixproject/engine-web'
import * as packageJson from '../../../../../package.json' import * as packageJson from '../../../../../package.json'
var yo = require('yo-yo') var yo = require('yo-yo')
......
import { ViewPlugin } from '@remixproject/engine' import { ViewPlugin } from '@remixproject/engine-web'
import { EventEmitter } from 'events' import { EventEmitter } from 'events'
import * as packageJson from '../../../../../package.json' import * as packageJson from '../../../../../package.json'
......
/* global */ /* global */
import { ViewPlugin } from '@remixproject/engine' import { ViewPlugin } from '@remixproject/engine-web'
import * as packageJson from '../../../../../package.json' import * as packageJson from '../../../../../package.json'
import publishToStorage from '../../publishToStorage' import publishToStorage from '../../publishToStorage'
import { compile } from '../compiler/compiler-helpers' import { compile } from '../compiler/compiler-helpers'
......
import toaster from '../ui/tooltip' import toaster from '../ui/tooltip'
import { DebuggerUI } from '@remix-ui/debugger-ui' // eslint-disable-line import { DebuggerUI } from '@remix-ui/debugger-ui' // eslint-disable-line
import { ViewPlugin } from '@remixproject/engine' import { ViewPlugin } from '@remixproject/engine-web'
import remixDebug, { TransactionDebugger as Debugger } from '@remix-project/remix-debug' import remixDebug, { TransactionDebugger as Debugger } from '@remix-project/remix-debug'
import * as packageJson from '../../../../../package.json' import * as packageJson from '../../../../../package.json'
import React from 'react' // eslint-disable-line import React from 'react' // eslint-disable-line
...@@ -63,7 +63,6 @@ class DebuggerTab extends ViewPlugin { ...@@ -63,7 +63,6 @@ class DebuggerTab extends ViewPlugin {
this.renderComponent() this.renderComponent()
this.call('manager', 'activatePlugin', 'source-verification').catch(e => console.log(e.message))
// this.call('manager', 'activatePlugin', 'udapp') // this.call('manager', 'activatePlugin', 'udapp')
return this.el return this.el
......
import { ViewPlugin } from '@remixproject/engine' import { ViewPlugin } from '@remixproject/engine-web'
import * as packageJson from '../../../../../package.json' import * as packageJson from '../../../../../package.json'
const yo = require('yo-yo') const yo = require('yo-yo')
const globalRegistry = require('../../global/registry') const globalRegistry = require('../../global/registry')
......
import { ViewPlugin } from '@remixproject/engine' import { ViewPlugin } from '@remixproject/engine-web'
import { canUseWorker, urlFromVersion } from '../compiler/compiler-utils' import { canUseWorker, urlFromVersion } from '../compiler/compiler-utils'
var yo = require('yo-yo') var yo = require('yo-yo')
var async = require('async') var async = require('async')
......
import * as packageJson from '../../../../../../package.json' import * as packageJson from '../../../../../../package.json'
import { ViewPlugin } from '@remixproject/engine' import { ViewPlugin } from '@remixproject/engine-web'
const yo = require('yo-yo') const yo = require('yo-yo')
const csjs = require('csjs-inject') const csjs = require('csjs-inject')
......
/* global localStorage, fetch */ /* global localStorage, fetch */
import { PluginManager, IframePlugin } from '@remixproject/engine' import { PluginManager } from '@remixproject/engine'
import { IframePlugin } from '@remixproject/engine-web'
import { EventEmitter } from 'events' import { EventEmitter } from 'events'
import QueryParams from './lib/query-params' import QueryParams from './lib/query-params'
import { PermissionHandler } from './app/ui/persmission-handler' import { PermissionHandler } from './app/ui/persmission-handler'
...@@ -15,7 +16,7 @@ export function isNative (name) { ...@@ -15,7 +16,7 @@ export function isNative (name) {
} }
export function canActivate (name) { export function canActivate (name) {
return ['manager', 'debugger', 'ethdoc'].includes(name) return ['ethdoc'].includes(name) || isNative(name)
} }
export class RemixAppManager extends PluginManager { export class RemixAppManager extends PluginManager {
...@@ -27,11 +28,12 @@ export class RemixAppManager extends PluginManager { ...@@ -27,11 +28,12 @@ export class RemixAppManager extends PluginManager {
this.permissionHandler = new PermissionHandler() this.permissionHandler = new PermissionHandler()
} }
async canActivate (from, to) { async canActivatePlugin (from, to) {
return canActivate(from.name) return canActivate(from.name)
} }
async canDeactivate (from, to) { async canDeactivatePlugin (from, to) {
if (requiredModules.includes(to.name)) return false
return from.name === 'manager' return from.name === 'manager'
} }
...@@ -68,9 +70,7 @@ export class RemixAppManager extends PluginManager { ...@@ -68,9 +70,7 @@ export class RemixAppManager extends PluginManager {
this.event.emit('deactivate', plugin) this.event.emit('deactivate', plugin)
} }
onRegistration (plugin) { onRegistration () {}
this.event.emit('added', plugin.name)
}
async ensureActivated (apiName) { async ensureActivated (apiName) {
await this.activatePlugin(apiName) await this.activatePlugin(apiName)
...@@ -82,11 +82,6 @@ export class RemixAppManager extends PluginManager { ...@@ -82,11 +82,6 @@ export class RemixAppManager extends PluginManager {
this.event.emit('ensureDeactivated', apiName) this.event.emit('ensureDeactivated', apiName)
} }
deactivatePlugin (name) {
if (requiredModules.includes(name)) return
super.deactivatePlugin(name)
}
isRequired (name) { isRequired (name) {
return requiredModules.includes(name) return requiredModules.includes(name)
} }
......
import { Engine } from '@remixproject/engine'
import { EventEmitter } from 'events'
export class RemixEngine extends Engine {
constructor () {
super()
this.event = new EventEmitter()
}
setPluginOption ({ name, kind }) {
if (kind === 'provider') return { queueTimeout: 60000 * 2 }
if (name === 'LearnEth') return { queueTimeout: 60000 }
return { queueTimeout: 10000 }
}
onRegistration (plugin) {
this.event.emit('onRegistration', plugin)
}
}
...@@ -35,10 +35,10 @@ ...@@ -35,10 +35,10 @@
}, },
"homepage": "https://github.com/ethereum/remix-project#readme", "homepage": "https://github.com/ethereum/remix-project#readme",
"dependencies": { "dependencies": {
"@remixproject/plugin": "0.3.0-beta.5", "@remixproject/plugin": "^0.3.3",
"@remixproject/plugin-api": "0.3.0-beta.5", "@remixproject/plugin-api": "^0.3.3",
"@remixproject/plugin-utils": "0.3.0-beta.5", "@remixproject/plugin-utils": "^0.3.3",
"@remixproject/plugin-ws": "^0.3.0-beta.8", "@remixproject/plugin-ws": "^0.3.3",
"axios": "^0.20.0", "axios": "^0.20.0",
"chokidar": "^2.1.8", "chokidar": "^2.1.8",
"commander": "^2.20.3", "commander": "^2.20.3",
......
This diff is collapsed.
...@@ -127,16 +127,27 @@ ...@@ -127,16 +127,27 @@
] ]
}, },
"dependencies": { "dependencies": {
"@remixproject/engine": "^0.2.3", "@remixproject/engine": "^0.3.3",
"@remixproject/engine-web": "^0.3.3",
"@remixproject/plugin": "^0.3.3",
"@remixproject/plugin-api": "^0.3.2",
"@remixproject/plugin-utils": "^0.3.2",
"@remixproject/plugin-webview": "^0.3.3",
"@remixproject/plugin-ws": "^0.3.3",
"@types/jest": "^26.0.5", "@types/jest": "^26.0.5",
"@types/tape": "^4.2.33", "@types/tape": "^4.2.33",
"ansi-gray": "^0.1.1", "ansi-gray": "^0.1.1",
"axios": "^0.20.0",
"change-case": "^4.1.1", "change-case": "^4.1.1",
"chokidar": "^2.1.8",
"color-support": "^1.1.3", "color-support": "^1.1.3",
"commander": "^2.20.3",
"ethereumjs-block": "^2.2.2", "ethereumjs-block": "^2.2.2",
"ethereumjs-tx": "^2.1.2", "ethereumjs-tx": "^2.1.2",
"ethereumjs-vm": "4.1.3", "ethereumjs-vm": "4.1.3",
"fs-extra": "^3.0.1",
"http-server": "^0.11.1", "http-server": "^0.11.1",
"isbinaryfile": "^3.0.2",
"merge": "^1.2.0", "merge": "^1.2.0",
"npm-install-version": "^6.0.2", "npm-install-version": "^6.0.2",
"react": "16.13.1", "react": "16.13.1",
...@@ -145,15 +156,6 @@ ...@@ -145,15 +156,6 @@
"signale": "^1.4.0", "signale": "^1.4.0",
"time-stamp": "^2.2.0", "time-stamp": "^2.2.0",
"winston": "^3.3.3", "winston": "^3.3.3",
"@remixproject/plugin": "0.3.0-beta.5",
"@remixproject/plugin-api": "0.3.0-beta.5",
"@remixproject/plugin-utils": "0.3.0-beta.5",
"@remixproject/plugin-ws": "^0.3.0-beta.8",
"axios": "^0.20.0",
"chokidar": "^2.1.8",
"commander": "^2.20.3",
"fs-extra": "^3.0.1",
"isbinaryfile": "^3.0.2",
"ws": "^7.3.0" "ws": "^7.3.0"
}, },
"devDependencies": { "devDependencies": {
......
...@@ -104,7 +104,7 @@ ...@@ -104,7 +104,7 @@
"builder": "@nrwl/workspace:run-commands", "builder": "@nrwl/workspace:run-commands",
"options": { "options": {
"commands": [ "commands": [
"node_modules/.bin/tsc -p apps/remix-ide-e2e/tsconfig.e2e.json" "tsc -p apps/remix-ide-e2e/tsconfig.e2e.json"
] ]
} }
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment