From 68850867289578e7a74aa276f510b4b0d16195b8 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 19 Oct 2020 17:23:46 +0200 Subject: [PATCH] use remix plugin 0.3 --- .../src/tests/pluginManager.test.ts | 6 +- apps/remix-ide/src/app.js | 18 ++- apps/remix-ide/src/app/files/remixd-handle.js | 2 +- apps/remix-ide/src/app/tabs/debugger-tab.js | 2 +- apps/remix-ide/src/remixAppManager.js | 14 +- libs/remixd/package.json | 8 +- package-lock.json | 131 ++++++++++++++---- package.json | 21 +-- 8 files changed, 139 insertions(+), 63 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/pluginManager.test.ts b/apps/remix-ide-e2e/src/tests/pluginManager.test.ts index 037b24e168..b1bf4be435 100644 --- a/apps/remix-ide-e2e/src/tests/pluginManager.test.ts +++ b/apps/remix-ide-e2e/src/tests/pluginManager.test.ts @@ -44,6 +44,7 @@ module.exports = { browser.waitForElementVisible('*[data-id="pluginManagerComponentPluginManager"]') .click('*[data-id="pluginManagerComponentPluginManager"]') .scrollAndClick('*[data-id="pluginManagerComponentActivateButtondebugger"]') + .pause(2000) .waitForElementVisible('*[data-id="pluginManagerComponentDeactivateButtondebugger"]') .scrollAndClick('*[data-id="pluginManagerComponentActivateButtonvyper"]') .waitForElementVisible('*[data-id="pluginManagerComponentDeactivateButtonvyper"]') @@ -54,8 +55,11 @@ module.exports = { 'Should deactivate plugins': function (browser: NightwatchBrowser) { browser.waitForElementVisible('*[data-id="pluginManagerComponentPluginManager"]') .click('*[data-id="pluginManagerComponentPluginManager"]') - .scrollAndClick('*[data-id="pluginManagerComponentDeactivateButtondebugger"]') + .waitForElementVisible('*[data-id="pluginManagerComponentDeactivateButtondebugger"]') + .pause(2000) + .scrollAndClick('*[data-id="pluginManagerComponentDeactivateButtondebugger"]') .waitForElementVisible('*[data-id="pluginManagerComponentActivateButtondebugger"]') + .waitForElementVisible('*[data-id="pluginManagerComponentDeactivateButtonvyper"]') .scrollAndClick('*[data-id="pluginManagerComponentDeactivateButtonvyper"]') .waitForElementVisible('*[data-id="pluginManagerComponentActivateButtonvyper"]') }, diff --git a/apps/remix-ide/src/app.js b/apps/remix-ide/src/app.js index be828f3c1d..3db0f42dfb 100644 --- a/apps/remix-ide/src/app.js +++ b/apps/remix-ide/src/app.js @@ -231,14 +231,14 @@ Please make a backup of your contracts and start using http://remix.ethereum.org const appManager = self.appManager const pluginLoader = appManager.pluginLoader const workspace = pluginLoader.get() - const engine = new Engine(appManager) + const engine = new Engine() engine.setPluginOption = ({ name, kind }) => { if (kind === 'provider') return { queueTimeout: 60000 * 2 } if (name === 'LearnEth') return { queueTimeout: 60000 } return { queueTimeout: 10000 } } - await engine.onload() - + engine.register(appManager) + // SERVICES // ----------------- import content servive ------------------------ const contentImport = new CompilerImport() @@ -401,17 +401,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(['mainPanel', 'menuicons']) 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 params = queryParams.get() // Set workspace after initial activation - if (Array.isArray(workspace)) { - appManager.activatePlugin(workspace).then(() => { + if (Array.isArray(workspace)) { + appManager.activatePlugin(workspace).then(async () => { try { if (params.deactivate) { - appManager.deactivatePlugin(params.deactivate.split(',')) + await appManager.deactivatePlugin(params.deactivate.split(',')) } } catch (e) { console.log(e) @@ -425,9 +425,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org if (callDetails.length > 1) { toolTip(`initiating ${callDetails[0]} ...`) // @todo(remove the timeout when activatePlugin is on 0.3.0) - setTimeout(() => { - appManager.call(...callDetails).catch(console.error) - }, 5000) + appManager.call(...callDetails).catch(console.error) } } }).catch(console.error) diff --git a/apps/remix-ide/src/app/files/remixd-handle.js b/apps/remix-ide/src/app/files/remixd-handle.js index cd16ea3b9c..1bfcb2cd17 100644 --- a/apps/remix-ide/src/app/files/remixd-handle.js +++ b/apps/remix-ide/src/app/files/remixd-handle.js @@ -1,5 +1,5 @@ import isElectron from 'is-electron' -import { WebsocketPlugin } from '@remixproject/engine' +import { WebsocketPlugin } from '@remixproject/engine-web' import * as packageJson from '../../../../../package.json' var yo = require('yo-yo') var modalDialog = require('../ui/modaldialog') diff --git a/apps/remix-ide/src/app/tabs/debugger-tab.js b/apps/remix-ide/src/app/tabs/debugger-tab.js index 13bd7fea3b..77a71d81fc 100644 --- a/apps/remix-ide/src/app/tabs/debugger-tab.js +++ b/apps/remix-ide/src/app/tabs/debugger-tab.js @@ -63,7 +63,7 @@ class DebuggerTab extends ViewPlugin { this.renderComponent() - this.call('manager', 'activatePlugin', 'source-verification').catch(e => console.log(e.message)) + this.call('manager', 'activatePlugin', 'source-verification').catch(e => console.error(e)) // this.call('manager', 'activatePlugin', 'udapp') return this.el diff --git a/apps/remix-ide/src/remixAppManager.js b/apps/remix-ide/src/remixAppManager.js index cff0b20919..884b625614 100644 --- a/apps/remix-ide/src/remixAppManager.js +++ b/apps/remix-ide/src/remixAppManager.js @@ -1,5 +1,6 @@ /* 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 QueryParams from './lib/query-params' import { PermissionHandler } from './app/ui/persmission-handler' @@ -27,11 +28,12 @@ export class RemixAppManager extends PluginManager { this.permissionHandler = new PermissionHandler() } - async canActivate (from, to) { - return canActivate(from.name) + async canActivatePlugin (from, to) { + return true // canActivate(from.name) } - async canDeactivate (from, to) { + async canDeactivatePlugin (from, to) { + console.log('canDeactivatePlugin', from, to) return from.name === 'manager' } @@ -68,8 +70,8 @@ export class RemixAppManager extends PluginManager { this.event.emit('deactivate', plugin) } - onRegistration (plugin) { - this.event.emit('added', plugin.name) + onRegistration () { + console.log('manager has been registered') } async ensureActivated (apiName) { diff --git a/libs/remixd/package.json b/libs/remixd/package.json index b80f142149..41e73def6a 100644 --- a/libs/remixd/package.json +++ b/libs/remixd/package.json @@ -35,10 +35,10 @@ }, "homepage": "https://github.com/ethereum/remix-project#readme", "dependencies": { - "@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", + "@remixproject/plugin": "^0.3.2", + "@remixproject/plugin-api": "^0.3.2", + "@remixproject/plugin-utils": "^0.3.2", + "@remixproject/plugin-ws": "^0.3.2", "axios": "^0.20.0", "chokidar": "^2.1.8", "commander": "^2.20.3", diff --git a/package-lock.json b/package-lock.json index 0241ba7429..3b04ba1708 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6880,57 +6880,128 @@ "integrity": "sha512-tVkIU9JQw5fYPxLQgok/a7I6J1eEZ79svwQGpe2mb3jlVsPADOleefOnQBiS/takK7jQuNeswCUicMH1VWVziA==" }, "@remixproject/engine": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/@remixproject/engine/-/engine-0.2.4.tgz", - "integrity": "sha512-rCekA2QZq5wbT7h9wqU+TDkRexUqhnMqcggmP+eG6ilowyZ4RhMsrrSl3fsZzd0rnp4w1LSmX0vCbuXfja3RqQ==" + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@remixproject/engine/-/engine-0.3.2.tgz", + "integrity": "sha512-kou/v2/EdB3H81vsFA/i//AEx2byVs1l0sdynoj+e7q8pGIMVFs7YCuXj+2DU+UDKUG3JGnyi4jKRygqBq0Wqw==", + "requires": { + "@remixproject/plugin-api": "0.3.2", + "@remixproject/plugin-utils": "0.3.2" + } + }, + "@remixproject/engine-web": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@remixproject/engine-web/-/engine-web-0.3.2.tgz", + "integrity": "sha512-52uehTVnJoNP3E0WarqItPTJrLEmvw4FHr8vp2Ww/zyyT9n4JPdmJamdPEI5Dszafp5TtMapQHGIPA0+GrMcYw==", + "requires": { + "@remixproject/engine": "0.3.2", + "@remixproject/plugin-api": "0.3.2", + "@remixproject/plugin-utils": "0.3.2" + }, + "dependencies": { + "@remixproject/engine": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@remixproject/engine/-/engine-0.3.2.tgz", + "integrity": "sha512-kou/v2/EdB3H81vsFA/i//AEx2byVs1l0sdynoj+e7q8pGIMVFs7YCuXj+2DU+UDKUG3JGnyi4jKRygqBq0Wqw==", + "requires": { + "@remixproject/plugin-api": "0.3.2", + "@remixproject/plugin-utils": "0.3.2" + } + }, + "@remixproject/plugin-api": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@remixproject/plugin-api/-/plugin-api-0.3.2.tgz", + "integrity": "sha512-SR9NPv7hstTorUkna1LjdF5bEclNk0ejzGKmkzO3khCvw/Mii1H8lXo1W9fX1tmqpVqWYCdV/0hY5rnFnQAlSw==", + "requires": { + "@remixproject/plugin-utils": "0.3.2" + } + }, + "@remixproject/plugin-utils": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@remixproject/plugin-utils/-/plugin-utils-0.3.2.tgz", + "integrity": "sha512-i7VQNU6XaigUgOoOHM0M379dAKLtKt83nHBSR2SZyt/397aQsBDuYg1Nwv4Y46S74FrZRKFRX9YGNZj1usB2IQ==", + "requires": { + "tslib": "2.0.1" + } + }, + "tslib": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.0.1.tgz", + "integrity": "sha512-SgIkNheinmEBgx1IUNirK0TUD4X9yjjBRTqqjggWCU3pUEqIk3/Uwl3yRixYKT6WjQuGiwDv4NomL3wqRCj+CQ==" + } + } }, "@remixproject/plugin": { - "version": "0.3.0-beta.5", - "resolved": "https://registry.npmjs.org/@remixproject/plugin/-/plugin-0.3.0-beta.5.tgz", - "integrity": "sha512-mQgXUhGNc+tQGIIFw7OaBaH7sZTBvDk8Gf4fS1NXhO5ilvykw9TXv5LXWoWkJCWQlKGuUTWd+U1XNpm5dPD3ag==" + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@remixproject/plugin/-/plugin-0.3.2.tgz", + "integrity": "sha512-WfTjlIL+MqWKnY2wl6t4/hmmq+H3TY+Mofl04AGYZwr1yKgG7csPJFgZZDq74biPXNhHb+9xS2S18ytzutjLYg==", + "requires": { + "@remixproject/plugin-api": "0.3.2", + "@remixproject/plugin-utils": "0.3.2", + "events": "3.2.0" + }, + "dependencies": { + "events": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/events/-/events-3.2.0.tgz", + "integrity": "sha512-/46HWwbfCX2xTawVfkKLGxMifJYQBWMwY1mjywRtb4c9x8l5NP3KoJtnIOiL1hfdRkIuYhETxQlo62IF8tcnlg==" + } + } }, "@remixproject/plugin-api": { - "version": "0.3.0-beta.5", - "resolved": "https://registry.npmjs.org/@remixproject/plugin-api/-/plugin-api-0.3.0-beta.5.tgz", - "integrity": "sha512-C1fuISsne3sfA61k1rx6qU9ZgubyP8SdNKinzeYvXg4XAm1DwoHQlzjq/WYmjOFx1NZhyMGK8ySBp0VcjAMc/Q==" + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@remixproject/plugin-api/-/plugin-api-0.3.2.tgz", + "integrity": "sha512-SR9NPv7hstTorUkna1LjdF5bEclNk0ejzGKmkzO3khCvw/Mii1H8lXo1W9fX1tmqpVqWYCdV/0hY5rnFnQAlSw==", + "requires": { + "@remixproject/plugin-utils": "0.3.2" + } }, "@remixproject/plugin-utils": { - "version": "0.3.0-beta.5", - "resolved": "https://registry.npmjs.org/@remixproject/plugin-utils/-/plugin-utils-0.3.0-beta.5.tgz", - "integrity": "sha512-+gnfuSUimCxUTRxfTGu+mwI5U6EPUx2A2ANObaZzX8f17nhSW5NWw2vWKauZPSv2PWQoIukYzrmG/kogEe3Cyw==" + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@remixproject/plugin-utils/-/plugin-utils-0.3.2.tgz", + "integrity": "sha512-i7VQNU6XaigUgOoOHM0M379dAKLtKt83nHBSR2SZyt/397aQsBDuYg1Nwv4Y46S74FrZRKFRX9YGNZj1usB2IQ==", + "requires": { + "tslib": "2.0.1" + }, + "dependencies": { + "tslib": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.0.1.tgz", + "integrity": "sha512-SgIkNheinmEBgx1IUNirK0TUD4X9yjjBRTqqjggWCU3pUEqIk3/Uwl3yRixYKT6WjQuGiwDv4NomL3wqRCj+CQ==" + } + } }, "@remixproject/plugin-ws": { - "version": "0.3.0-beta.11", - "resolved": "https://registry.npmjs.org/@remixproject/plugin-ws/-/plugin-ws-0.3.0-beta.11.tgz", - "integrity": "sha512-wQueX0k99S96G4/jDbCmAn7V4RxDQpaCjaHBkpdr6Oc1ErfUnkplzJLfGs1EgnxCrONnHxDz6YEdKEs/zaHkqw==", + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@remixproject/plugin-ws/-/plugin-ws-0.3.2.tgz", + "integrity": "sha512-maHL5mZDafELnnyPTO15Jy1y9lfZL0BBhzNqkSVwxtATakqPBLvoFoQpj5Co3xFaH3Kqb+Rb47VxaT415pPjeg==", "requires": { - "@remixproject/plugin": "0.3.0-beta.11", - "@remixproject/plugin-api": "0.3.0-beta.11", - "@remixproject/plugin-utils": "0.3.0-beta.11" + "@remixproject/plugin": "0.3.2", + "@remixproject/plugin-api": "0.3.2", + "@remixproject/plugin-utils": "0.3.2" }, "dependencies": { "@remixproject/plugin": { - "version": "0.3.0-beta.11", - "resolved": "https://registry.npmjs.org/@remixproject/plugin/-/plugin-0.3.0-beta.11.tgz", - "integrity": "sha512-/K7EJUXjSf5AqoPJAQ7VKQi7UTmPysHyV9hDLGPoe8tjl4s5ghjopiYLu6uM1WrR4Bz1DvU4hsRObe/PUAmprA==", + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@remixproject/plugin/-/plugin-0.3.2.tgz", + "integrity": "sha512-WfTjlIL+MqWKnY2wl6t4/hmmq+H3TY+Mofl04AGYZwr1yKgG7csPJFgZZDq74biPXNhHb+9xS2S18ytzutjLYg==", "requires": { - "@remixproject/plugin-api": "0.3.0-beta.11", - "@remixproject/plugin-utils": "0.3.0-beta.11", + "@remixproject/plugin-api": "0.3.2", + "@remixproject/plugin-utils": "0.3.2", "events": "3.2.0" } }, "@remixproject/plugin-api": { - "version": "0.3.0-beta.11", - "resolved": "https://registry.npmjs.org/@remixproject/plugin-api/-/plugin-api-0.3.0-beta.11.tgz", - "integrity": "sha512-qmIxfoFivQ6Dtz4RUEGSpSVW6TgcT5pwGuSOFBNm0LcYapqsoY4uWIfNpnP4odH4nVCBaFmARlveOf5magFxAw==", + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@remixproject/plugin-api/-/plugin-api-0.3.2.tgz", + "integrity": "sha512-SR9NPv7hstTorUkna1LjdF5bEclNk0ejzGKmkzO3khCvw/Mii1H8lXo1W9fX1tmqpVqWYCdV/0hY5rnFnQAlSw==", "requires": { - "@remixproject/plugin-utils": "0.3.0-beta.11" + "@remixproject/plugin-utils": "0.3.2" } }, "@remixproject/plugin-utils": { - "version": "0.3.0-beta.11", - "resolved": "https://registry.npmjs.org/@remixproject/plugin-utils/-/plugin-utils-0.3.0-beta.11.tgz", - "integrity": "sha512-M/ghKF75lLQX6sp993E+3DGtezgY5oCL8659pH2cRpK8MMFX5cJggBfK5Fil29FIdwNOSzXM+W0/JnxnRyQAZA==", + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@remixproject/plugin-utils/-/plugin-utils-0.3.2.tgz", + "integrity": "sha512-i7VQNU6XaigUgOoOHM0M379dAKLtKt83nHBSR2SZyt/397aQsBDuYg1Nwv4Y46S74FrZRKFRX9YGNZj1usB2IQ==", "requires": { "tslib": "2.0.1" } diff --git a/package.json b/package.json index 977a20160a..e4c7af1a22 100644 --- a/package.json +++ b/package.json @@ -127,16 +127,26 @@ ] }, "dependencies": { - "@remixproject/engine": "^0.2.3", + "@remixproject/engine": "^0.3.2", + "@remixproject/engine-web": "^0.3.2", + "@remixproject/plugin-ws": "^0.3.2", + "@remixproject/plugin": "^0.3.2", + "@remixproject/plugin-api": "^0.3.2", + "@remixproject/plugin-utils": "^0.3.2", "@types/jest": "^26.0.5", "@types/tape": "^4.2.33", "ansi-gray": "^0.1.1", + "axios": "^0.20.0", "change-case": "^4.1.1", + "chokidar": "^2.1.8", "color-support": "^1.1.3", + "commander": "^2.20.3", "ethereumjs-block": "^2.2.2", "ethereumjs-tx": "^2.1.2", "ethereumjs-vm": "4.1.3", + "fs-extra": "^3.0.1", "http-server": "^0.11.1", + "isbinaryfile": "^3.0.2", "merge": "^1.2.0", "npm-install-version": "^6.0.2", "react": "16.13.1", @@ -145,15 +155,6 @@ "signale": "^1.4.0", "time-stamp": "^2.2.0", "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" }, "devDependencies": {