fixing merge conflicts

pull/1342/head
davidzagi93@gmail.com 3 years ago
commit fc705f3a85
  1. 36
      apps/solidity-compiler/src/app/compiler-api.ts
  2. 3
      nx.json

@ -1,12 +1,13 @@
import { compile } from '@remix-project/remix-solidity' import { compile } from '@remix-project/remix-solidity'
import { CompileTabLogic, parseContracts } from '@remix-ui/solidity-compiler' // eslint-disable-line import { CompileTabLogic, parseContracts } from '@remix-ui/solidity-compiler' // eslint-disable-line
import type { ConfigurationSettings } from '@remix-project/remix-lib-ts' import type { ConfigurationSettings } from '@remix-project/remix-lib-ts' // eslint-disable-line
export const CompilerApiMixin = (Base) => class extends Base { export const CompilerApiMixin = (Base) => class extends Base {
currentFile: string currentFile: string
contractMap: { contractMap: {
file: string file: string
} | Record<string, any> } | Record<string, any>
compileErrors: any compileErrors: any
compileTabLogic: CompileTabLogic compileTabLogic: CompileTabLogic
contractsDetails: Record<string, any> contractsDetails: Record<string, any>
@ -29,7 +30,7 @@ export const CompilerApiMixin = (Base) => class extends Base {
errorContainer: null, errorContainer: null,
contractEl: null contractEl: null
} }
this.contractsDetails = {} this.contractsDetails = {}
this.data = { this.data = {
eventHandlers: {}, eventHandlers: {},
@ -54,7 +55,7 @@ export const CompilerApiMixin = (Base) => class extends Base {
if (this.data.eventHandlers.onLoadingCompiler) { if (this.data.eventHandlers.onLoadingCompiler) {
this.compiler.event.unregister('loadingCompiler', this.data.eventHandlers.onLoadingCompiler) this.compiler.event.unregister('loadingCompiler', this.data.eventHandlers.onLoadingCompiler)
} }
if (this.data.eventHandlers.onCompilerLoaded) { if (this.data.eventHandlers.onCompilerLoaded) {
this.compiler.event.unregister('compilerLoaded', this.data.eventHandlers.onCompilerLoaded) this.compiler.event.unregister('compilerLoaded', this.data.eventHandlers.onCompilerLoaded)
} }
@ -62,7 +63,7 @@ export const CompilerApiMixin = (Base) => class extends Base {
if (this.data.eventHandlers.onCompilationFinished) { if (this.data.eventHandlers.onCompilationFinished) {
this.compiler.event.unregister('compilationFinished', this.data.eventHandlers.onCompilationFinished) this.compiler.event.unregister('compilationFinished', this.data.eventHandlers.onCompilationFinished)
} }
this.off('filePanel', 'setWorkspace') this.off('filePanel', 'setWorkspace')
this.off('remixd', 'rootFolderChanged') this.off('remixd', 'rootFolderChanged')
@ -72,19 +73,19 @@ export const CompilerApiMixin = (Base) => class extends Base {
if (this.data.eventHandlers.onStartingCompilation) { if (this.data.eventHandlers.onStartingCompilation) {
this.compileTabLogic.event.off('startingCompilation', this.data.eventHandlers.onStartingCompilation) this.compileTabLogic.event.off('startingCompilation', this.data.eventHandlers.onStartingCompilation)
} }
if (this.data.eventHandlers.onRemoveAnnotations) { if (this.data.eventHandlers.onRemoveAnnotations) {
this.compileTabLogic.event.off('removeAnnotations', this.data.eventHandlers.onRemoveAnnotations) this.compileTabLogic.event.off('removeAnnotations', this.data.eventHandlers.onRemoveAnnotations)
} }
this.off('fileManager', 'currentFileChanged') this.off('fileManager', 'currentFileChanged')
this.off('fileManager', 'noFileSelected') this.off('fileManager', 'noFileSelected')
this.off('themeModule', 'themeChanged') this.off('themeModule', 'themeChanged')
if (this.data.eventHandlers.onKeyDown) { if (this.data.eventHandlers.onKeyDown) {
window.document.removeEventListener('keydown', this.data.eventHandlers.onKeyDown) window.document.removeEventListener('keydown', this.data.eventHandlers.onKeyDown)
} }
} }
@ -99,7 +100,7 @@ export const CompilerApiMixin = (Base) => class extends Base {
logToTerminal (content) { logToTerminal (content) {
return this.call('terminal', 'log', content) return this.call('terminal', 'log', content)
} }
getCompilationResult () { getCompilationResult () {
return this.compileTabLogic.compiler.state.lastCompilationResult return this.compileTabLogic.compiler.state.lastCompilationResult
} }
@ -157,8 +158,8 @@ export const CompilerApiMixin = (Base) => class extends Base {
* @param {object} settings {evmVersion, optimize, runs, version, language} * @param {object} settings {evmVersion, optimize, runs, version, language}
*/ */
setCompilerConfig (settings) { setCompilerConfig (settings) {
this.configurationSettings = settings this.configurationSettings = settings
} }
fileExists (fileName) { fileExists (fileName) {
return this.call('fileManager', 'exists', fileName) return this.call('fileManager', 'exists', fileName)
@ -225,7 +226,7 @@ export const CompilerApiMixin = (Base) => class extends Base {
this.on('editor', 'sessionSwitched', () => { this.on('editor', 'sessionSwitched', () => {
if (this.onSessionSwitched) this.onSessionSwitched() if (this.onSessionSwitched) this.onSessionSwitched()
}) })
this.compileTabLogic.event.on('startingCompilation', this.data.eventHandlers.onStartingCompilation) this.compileTabLogic.event.on('startingCompilation', this.data.eventHandlers.onStartingCompilation)
this.compileTabLogic.event.on('removeAnnotations', this.data.eventHandlers.onRemoveAnnotations) this.compileTabLogic.event.on('removeAnnotations', this.data.eventHandlers.onRemoveAnnotations)
@ -235,13 +236,13 @@ export const CompilerApiMixin = (Base) => class extends Base {
if (this.onCurrentFileChanged) this.onCurrentFileChanged(name) if (this.onCurrentFileChanged) this.onCurrentFileChanged(name)
} }
this.on('fileManager', 'currentFileChanged', this.data.eventHandlers.onCurrentFileChanged) this.on('fileManager', 'currentFileChanged', this.data.eventHandlers.onCurrentFileChanged)
this.data.eventHandlers.onNoFileSelected = () => { this.data.eventHandlers.onNoFileSelected = () => {
this.currentFile = '' this.currentFile = ''
if (this.onNoFileSelected) this.onNoFileSelected() if (this.onNoFileSelected) this.onNoFileSelected()
} }
this.on('fileManager', 'noFileSelected', this.data.eventHandlers.onNoFileSelected) this.on('fileManager', 'noFileSelected', this.data.eventHandlers.onNoFileSelected)
this.data.eventHandlers.onCompilationFinished = (success, data, source) => { this.data.eventHandlers.onCompilationFinished = (success, data, source) => {
this.compileErrors = data this.compileErrors = data
if (success) { if (success) {
@ -282,7 +283,6 @@ export const CompilerApiMixin = (Base) => class extends Base {
} }
} }
this.on('themeModule', 'themeChanged', this.data.eventHandlers.onThemeChanged) this.on('themeModule', 'themeChanged', this.data.eventHandlers.onThemeChanged)
// Run the compiler instead of trying to save the website // Run the compiler instead of trying to save the website
this.data.eventHandlers.onKeyDown = (e) => { this.data.eventHandlers.onKeyDown = (e) => {
// ctrl+s or command+s // ctrl+s or command+s

@ -122,6 +122,9 @@
"tags": [] "tags": []
}, },
"remix-ui-terminal": { "remix-ui-terminal": {
"tags": []
},
"solidity-compiler": {
"tags": [] "tags": []
}, },
"solidity-compiler": { "solidity-compiler": {

Loading…
Cancel
Save