Merge branch 'master' into targets2

pull/1213/head
bunsenstraat 4 years ago committed by GitHub
commit 41f5b0da28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 26
      apps/remix-ide/src/app/tabs/compileTab/compileTab.js
  2. 16
      libs/remixd/src/bin/remixd.ts
  3. 9
      libs/remixd/src/services/hardhatClient.ts
  4. 8
      libs/remixd/src/websocket.ts
  5. 145
      package-lock.json
  6. 15
      package.json

@ -97,19 +97,25 @@ class CompileTab extends Plugin {
try { try {
if (this.fileManager.mode === 'localhost' && hhCompilation) { if (this.fileManager.mode === 'localhost' && hhCompilation) {
const { currentVersion, optimize, runs } = this.compiler.state const { currentVersion, optimize, runs } = this.compiler.state
const fileContent = `module.exports = { if (currentVersion) {
solidity: '${currentVersion.substring(0, currentVersion.indexOf('+commit'))}', const fileContent = `module.exports = {
settings: { solidity: '${currentVersion.substring(0, currentVersion.indexOf('+commit'))}',
optimizer: { settings: {
enabled: ${optimize}, optimizer: {
runs: ${runs} enabled: ${optimize},
runs: ${runs}
}
} }
} }
`
const configFilePath = 'remix-compiler.config.js'
this.fileManager.setFileContent(configFilePath, fileContent)
this.call('hardhat', 'compile', configFilePath).then((result) => {
this.call('terminal', 'log', { type: 'info', value: result })
}).catch((error) => {
this.call('terminal', 'log', { type: 'error', value: error })
})
} }
`
const configFilePath = 'remix-compiler.config.js'
this.fileManager.setFileContent(configFilePath, fileContent)
this.call('hardhat', 'compile', configFilePath)
} }
this.fileManager.saveCurrentFile() this.fileManager.saveCurrentFile()
this.call('editor', 'clearAnnotations') this.call('editor', 'clearAnnotations')

@ -4,7 +4,7 @@ import * as semver from 'semver'
import WebSocket from '../websocket' import WebSocket from '../websocket'
import * as servicesList from '../serviceList' import * as servicesList from '../serviceList'
import * as WS from 'ws' // eslint-disable-line import * as WS from 'ws' // eslint-disable-line
import { getDomain } from '../utils' import { getDomain, absolutePath } from '../utils'
import Axios from 'axios' import Axios from 'axios'
import * as fs from 'fs-extra' import * as fs from 'fs-extra'
import * as path from 'path' import * as path from 'path'
@ -28,6 +28,7 @@ const services = {
folder: (readOnly: boolean) => new servicesList.Sharedfolder(readOnly) folder: (readOnly: boolean) => new servicesList.Sharedfolder(readOnly)
} }
// Similar object is also defined in websocket.ts
const ports = { const ports = {
git: 65521, git: 65521,
hardhat: 65522, hardhat: 65522,
@ -80,10 +81,15 @@ function startService<S extends 'git' | 'hardhat' | 'folder'> (service: S, callb
sharedFolderClient.setupNotifications(program.sharedFolder) sharedFolderClient.setupNotifications(program.sharedFolder)
sharedFolderClient.sharedFolder(program.sharedFolder) sharedFolderClient.sharedFolder(program.sharedFolder)
}) })
startService('hardhat', (ws: WS, sharedFolderClient: servicesList.Sharedfolder) => { // Run hardhat service if a hardhat project is shared as folder
sharedFolderClient.setWebSocket(ws) const hardhatConfigFilePath = absolutePath('./', program.sharedFolder) + '/hardhat.config.js'
sharedFolderClient.sharedFolder(program.sharedFolder) const isHardhatProject = fs.existsSync(hardhatConfigFilePath)
}) if (isHardhatProject) {
startService('hardhat', (ws: WS, sharedFolderClient: servicesList.Sharedfolder) => {
sharedFolderClient.setWebSocket(ws)
sharedFolderClient.sharedFolder(program.sharedFolder)
})
}
/* /*
startService('git', (ws: WS, sharedFolderClient: servicesList.Sharedfolder) => { startService('git', (ws: WS, sharedFolderClient: servicesList.Sharedfolder) => {
sharedFolderClient.setWebSocket(ws) sharedFolderClient.setWebSocket(ws)

@ -24,7 +24,6 @@ export class HardhatClient extends PluginClient {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (this.readOnly) { if (this.readOnly) {
const errMsg = '[Hardhat Compilation]: Cannot compile in read-only mode' const errMsg = '[Hardhat Compilation]: Cannot compile in read-only mode'
console.log('\x1b[31m%s\x1b[0m', `${errMsg}`)
return reject(new Error(errMsg)) return reject(new Error(errMsg))
} }
const cmd = `npx hardhat compile --config ${configPath}` const cmd = `npx hardhat compile --config ${configPath}`
@ -33,12 +32,12 @@ export class HardhatClient extends PluginClient {
let result = '' let result = ''
let error = '' let error = ''
child.stdout.on('data', (data) => { child.stdout.on('data', (data) => {
console.log('\x1b[32m%s\x1b[0m', `[Hardhat Compilation]: ${data.toString()}`) const msg = `[Hardhat Compilation]: ${data.toString()}`
result += data.toString() console.log('\x1b[32m%s\x1b[0m', msg)
result += msg + '\n'
}) })
child.stderr.on('data', (err) => { child.stderr.on('data', (err) => {
console.log('\x1b[31m%s\x1b[0m', `[Hardhat Compilation]: ${err.toString()}`) error += `[Hardhat Compilation]: ${err.toString()}`
error += err.toString()
}) })
child.on('close', () => { child.on('close', () => {
if (error) reject(error) if (error) reject(error)

@ -16,9 +16,13 @@ export default class WebSocket {
response.end() response.end()
}) })
const loopback = '127.0.0.1' const loopback = '127.0.0.1'
const listeners = {
65520: 'remixd',
65521: 'git',
65522: 'hardhat'
}
this.server.listen(this.port, loopback, () => { this.server.listen(this.port, loopback, () => {
console.log(`${new Date()} remixd is listening on ${loopback}:${this.port}`) console.log('\x1b[32m%s\x1b[0m', `[INFO] ${new Date()} ${listeners[this.port]} is listening on ${loopback}:${this.port}`)
}) })
this.wsServer = new WS.Server({ this.wsServer = new WS.Server({
server: this.server, server: this.server,

145
package-lock.json generated

@ -7638,53 +7638,112 @@
"integrity": "sha512-tVkIU9JQw5fYPxLQgok/a7I6J1eEZ79svwQGpe2mb3jlVsPADOleefOnQBiS/takK7jQuNeswCUicMH1VWVziA==" "integrity": "sha512-tVkIU9JQw5fYPxLQgok/a7I6J1eEZ79svwQGpe2mb3jlVsPADOleefOnQBiS/takK7jQuNeswCUicMH1VWVziA=="
}, },
"@remixproject/engine": { "@remixproject/engine": {
"version": "0.3.11", "version": "0.3.16",
"resolved": "https://registry.npmjs.org/@remixproject/engine/-/engine-0.3.11.tgz", "resolved": "https://registry.npmjs.org/@remixproject/engine/-/engine-0.3.16.tgz",
"integrity": "sha512-gRTOM4WolVuECOxeMcTD30iCZ4TJTZE+osYyNFnypgHQECcMtibATnulFc0zx+RtGm17KPEk5dW865fG01q+IA==", "integrity": "sha512-UI8Hg4l8oxaaBYNMcUI59C2terQL2Of4Bf9/AVETy67EFxwi3U8dHqSjkVJHz+rRYBSMSVnjcw3jaO1+0C3K4g==",
"requires": { "requires": {
"@remixproject/plugin-api": "0.3.11", "@remixproject/plugin-api": "0.3.16",
"@remixproject/plugin-utils": "0.3.11" "@remixproject/plugin-utils": "0.3.16"
},
"dependencies": {
"@remixproject/plugin-api": {
"version": "0.3.16",
"resolved": "https://registry.npmjs.org/@remixproject/plugin-api/-/plugin-api-0.3.16.tgz",
"integrity": "sha512-PuSo6GGjKXwCZr3KjCrqGxLF2sZJFpueb9cjwLeAi1y9C4VoPRjWFIC6bESn1EVL9DyqcET7a8IwuqhHVGOGSQ==",
"requires": {
"@remixproject/plugin-utils": "0.3.16"
}
},
"@remixproject/plugin-utils": {
"version": "0.3.16",
"resolved": "https://registry.npmjs.org/@remixproject/plugin-utils/-/plugin-utils-0.3.16.tgz",
"integrity": "sha512-3zV1zdpkdgT4/fa4s4a3KdcZFpHR0a2ye5BMDRZZr0fZeGBaL9B7Lh52wvQuRJ384E60xwqjMytZLmi3qvL5SA==",
"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/engine-web": { "@remixproject/engine-web": {
"version": "0.3.11", "version": "0.3.16",
"resolved": "https://registry.npmjs.org/@remixproject/engine-web/-/engine-web-0.3.11.tgz", "resolved": "https://registry.npmjs.org/@remixproject/engine-web/-/engine-web-0.3.16.tgz",
"integrity": "sha512-oM4kRKQ6R5ZWT6Ih542XtvFBLx9E5kUHU7H1t0DlI2A/w6arP4cC7WQwNK8TsnysVSjoJ5kveHb6tVntxhBGSg==", "integrity": "sha512-eZPs/cofoyZQWMcr4ukhn36IWi52m24LIj+GqUEfdcVpdXO4wkM0ATt4Wrk1WeOcNhlld3G27VfSS2jn2k0BnA==",
"requires": { "requires": {
"@remixproject/engine": "0.3.11", "@remixproject/engine": "0.3.16",
"@remixproject/plugin-api": "0.3.11", "@remixproject/plugin-api": "0.3.16",
"@remixproject/plugin-utils": "0.3.11" "@remixproject/plugin-utils": "0.3.16"
} }
}, },
"@remixproject/plugin": { "@remixproject/plugin": {
"version": "0.3.11", "version": "0.3.16",
"resolved": "https://registry.npmjs.org/@remixproject/plugin/-/plugin-0.3.11.tgz", "resolved": "https://registry.npmjs.org/@remixproject/plugin/-/plugin-0.3.16.tgz",
"integrity": "sha512-GbZV9KjZoALYUCEXDIhDWQFR3hi3m3R03WDm/i/XSIaJRkyya2WU6IzmqkvCT7TuTR+VfdJoWnflZTQWesLB1A==", "integrity": "sha512-UAtv3Te/jCZ4V30QSSNbudLhMS45zA97XIzcg894milJZm7E+rg+YUP2RQn88sqSBPbETPFF5LT93KgP1+IIzw==",
"requires": { "requires": {
"@remixproject/plugin-api": "0.3.11", "@remixproject/plugin-api": "0.3.16",
"@remixproject/plugin-utils": "0.3.11", "@remixproject/plugin-utils": "0.3.16",
"events": "3.2.0" "events": "3.2.0"
}, },
"dependencies": { "dependencies": {
"@remixproject/plugin-api": {
"version": "0.3.16",
"resolved": "https://registry.npmjs.org/@remixproject/plugin-api/-/plugin-api-0.3.16.tgz",
"integrity": "sha512-PuSo6GGjKXwCZr3KjCrqGxLF2sZJFpueb9cjwLeAi1y9C4VoPRjWFIC6bESn1EVL9DyqcET7a8IwuqhHVGOGSQ==",
"requires": {
"@remixproject/plugin-utils": "0.3.16"
}
},
"@remixproject/plugin-utils": {
"version": "0.3.16",
"resolved": "https://registry.npmjs.org/@remixproject/plugin-utils/-/plugin-utils-0.3.16.tgz",
"integrity": "sha512-3zV1zdpkdgT4/fa4s4a3KdcZFpHR0a2ye5BMDRZZr0fZeGBaL9B7Lh52wvQuRJ384E60xwqjMytZLmi3qvL5SA==",
"requires": {
"tslib": "2.0.1"
}
},
"events": { "events": {
"version": "3.2.0", "version": "3.2.0",
"resolved": "https://registry.npmjs.org/events/-/events-3.2.0.tgz", "resolved": "https://registry.npmjs.org/events/-/events-3.2.0.tgz",
"integrity": "sha512-/46HWwbfCX2xTawVfkKLGxMifJYQBWMwY1mjywRtb4c9x8l5NP3KoJtnIOiL1hfdRkIuYhETxQlo62IF8tcnlg==" "integrity": "sha512-/46HWwbfCX2xTawVfkKLGxMifJYQBWMwY1mjywRtb4c9x8l5NP3KoJtnIOiL1hfdRkIuYhETxQlo62IF8tcnlg=="
},
"tslib": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.0.1.tgz",
"integrity": "sha512-SgIkNheinmEBgx1IUNirK0TUD4X9yjjBRTqqjggWCU3pUEqIk3/Uwl3yRixYKT6WjQuGiwDv4NomL3wqRCj+CQ=="
} }
} }
}, },
"@remixproject/plugin-api": { "@remixproject/plugin-api": {
"version": "0.3.11", "version": "0.3.16",
"resolved": "https://registry.npmjs.org/@remixproject/plugin-api/-/plugin-api-0.3.11.tgz", "resolved": "https://registry.npmjs.org/@remixproject/plugin-api/-/plugin-api-0.3.16.tgz",
"integrity": "sha512-hH9XJVkpqWAST4iVbm5erWOW6pxt70fbhY/kkcC6DuGO4wmcN16bwhIUDenMEOyTQiuHIM98kEZMiacKtPKmzg==", "integrity": "sha512-PuSo6GGjKXwCZr3KjCrqGxLF2sZJFpueb9cjwLeAi1y9C4VoPRjWFIC6bESn1EVL9DyqcET7a8IwuqhHVGOGSQ==",
"requires": { "requires": {
"@remixproject/plugin-utils": "0.3.11" "@remixproject/plugin-utils": "0.3.16"
},
"dependencies": {
"@remixproject/plugin-utils": {
"version": "0.3.16",
"resolved": "https://registry.npmjs.org/@remixproject/plugin-utils/-/plugin-utils-0.3.16.tgz",
"integrity": "sha512-3zV1zdpkdgT4/fa4s4a3KdcZFpHR0a2ye5BMDRZZr0fZeGBaL9B7Lh52wvQuRJ384E60xwqjMytZLmi3qvL5SA==",
"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-utils": { "@remixproject/plugin-utils": {
"version": "0.3.11", "version": "0.3.16",
"resolved": "https://registry.npmjs.org/@remixproject/plugin-utils/-/plugin-utils-0.3.11.tgz", "resolved": "https://registry.npmjs.org/@remixproject/plugin-utils/-/plugin-utils-0.3.16.tgz",
"integrity": "sha512-dSO/WV1zJOXsbGiY99Hx8ewh5Whhul+Z2KyI2xFPCJTKkYLXntgFv7CuHvY2c7X2SBLDenqp6dh3yDGQcTlbxQ==", "integrity": "sha512-3zV1zdpkdgT4/fa4s4a3KdcZFpHR0a2ye5BMDRZZr0fZeGBaL9B7Lh52wvQuRJ384E60xwqjMytZLmi3qvL5SA==",
"requires": { "requires": {
"tslib": "2.0.1" "tslib": "2.0.1"
}, },
@ -7697,23 +7756,39 @@
} }
}, },
"@remixproject/plugin-webview": { "@remixproject/plugin-webview": {
"version": "0.3.11", "version": "0.3.16",
"resolved": "https://registry.npmjs.org/@remixproject/plugin-webview/-/plugin-webview-0.3.11.tgz", "resolved": "https://registry.npmjs.org/@remixproject/plugin-webview/-/plugin-webview-0.3.16.tgz",
"integrity": "sha512-lrZNtH1MCshF3wMU997Xn6UNWkIgmmZaXhxgxlB7S2S01IWlWd+5z6fZBmXcWGJwld424gRzbNm3IkPwAml9yw==", "integrity": "sha512-k//rLFsmDTiDCWzXsxGFBXE+KFDMdZtITQMCsf6sARfSc1SWLZ8+iwFCg9zve10lUEyc0CASdzpaWfITxw2ajQ==",
"requires": { "requires": {
"@remixproject/plugin": "0.3.11", "@remixproject/plugin": "0.3.16",
"@remixproject/plugin-api": "0.3.11", "@remixproject/plugin-api": "0.3.16",
"@remixproject/plugin-utils": "0.3.11" "@remixproject/plugin-utils": "0.3.16",
"axios": "^0.21.1"
},
"dependencies": {
"@remixproject/plugin-utils": {
"version": "0.3.16",
"resolved": "https://registry.npmjs.org/@remixproject/plugin-utils/-/plugin-utils-0.3.16.tgz",
"integrity": "sha512-3zV1zdpkdgT4/fa4s4a3KdcZFpHR0a2ye5BMDRZZr0fZeGBaL9B7Lh52wvQuRJ384E60xwqjMytZLmi3qvL5SA==",
"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-ws": { "@remixproject/plugin-ws": {
"version": "0.3.11", "version": "0.3.16",
"resolved": "https://registry.npmjs.org/@remixproject/plugin-ws/-/plugin-ws-0.3.11.tgz", "resolved": "https://registry.npmjs.org/@remixproject/plugin-ws/-/plugin-ws-0.3.16.tgz",
"integrity": "sha512-0b4tDisv8zBRS1vdTsr2Jm04xIXeofmCB63iknLa7nf9oG9SizQbxP6V3AhVnVTU91r+YvoBI7B6a3KP7G1UuQ==", "integrity": "sha512-J8B21v5rRIGCY/KjuJzYQEtMUSCQhWDVlUrqWlqIAIJp+4+E8lNuPycMXhOXSCEJfgVaGvjxb/AmJMH4Jmqw/w==",
"requires": { "requires": {
"@remixproject/plugin": "0.3.11", "@remixproject/plugin": "0.3.16",
"@remixproject/plugin-api": "0.3.11", "@remixproject/plugin-api": "0.3.16",
"@remixproject/plugin-utils": "0.3.11" "@remixproject/plugin-utils": "0.3.16"
} }
}, },
"@restart/context": { "@restart/context": {

@ -134,13 +134,13 @@
"@ethereumjs/common": "^2.2.0", "@ethereumjs/common": "^2.2.0",
"@ethereumjs/tx": "^3.1.3", "@ethereumjs/tx": "^3.1.3",
"@ethereumjs/vm": "^5.3.2", "@ethereumjs/vm": "^5.3.2",
"@remixproject/engine": "^0.3.11", "@remixproject/engine": "^0.3.16",
"@remixproject/engine-web": "^0.3.11", "@remixproject/engine-web": "^0.3.16",
"@remixproject/plugin": "^0.3.11", "@remixproject/plugin": "^0.3.16",
"@remixproject/plugin-api": "^0.3.11", "@remixproject/plugin-api": "^0.3.16",
"@remixproject/plugin-utils": "^0.3.11", "@remixproject/plugin-utils": "^0.3.16",
"@remixproject/plugin-webview": "^0.3.11", "@remixproject/plugin-webview": "^0.3.16",
"@remixproject/plugin-ws": "^0.3.11", "@remixproject/plugin-ws": "^0.3.16",
"ansi-gray": "^0.1.1", "ansi-gray": "^0.1.1",
"async": "^2.6.2", "async": "^2.6.2",
"axios": ">=0.21.1", "axios": ">=0.21.1",
@ -159,7 +159,6 @@
"isbinaryfile": "^3.0.2", "isbinaryfile": "^3.0.2",
"jquery": "^3.3.1", "jquery": "^3.3.1",
"jszip": "^3.6.0", "jszip": "^3.6.0",
"lodash": "^4.17.21",
"latest-version": "^5.1.0", "latest-version": "^5.1.0",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"merge": "^1.2.0", "merge": "^1.2.0",

Loading…
Cancel
Save