diff --git a/apps/circuit-compiler/src/app/services/circomPluginClient.ts b/apps/circuit-compiler/src/app/services/circomPluginClient.ts index 312e489efd..0c22068125 100644 --- a/apps/circuit-compiler/src/app/services/circomPluginClient.ts +++ b/apps/circuit-compiler/src/app/services/circomPluginClient.ts @@ -130,11 +130,11 @@ export class CircomPluginClient extends PluginClient { if (parseErrors && (parseErrors.length > 0)) { if (parseErrors[0].type === 'Error') { this.internalEvents.emit('circuit_parsing_errored', parseErrors, filePathToId) - // @ts-ignore - this.call('terminal', 'log', { type: 'error', value: 'previous errors were found' }) + this.logCompilerReport(parseErrors) return } else if (parseErrors[0].type === 'Warning') { this.internalEvents.emit('circuit_parsing_warning', parseErrors, filePathToId) + this.logCompilerReport(parseErrors) } } else { this.internalEvents.emit('circuit_parsing_done', parseErrors, filePathToId) @@ -151,8 +151,7 @@ export class CircomPluginClient extends PluginClient { if (circuitProgram.length < 1) { const circuitErrors = circuitApi.report() - // @ts-ignore - this.call('terminal', 'log', { type: 'error', value: 'previous errors were found' }) + this.logCompilerReport(circuitErrors) throw new Error(circuitErrors) } else { this.lastCompiledFile = path @@ -189,11 +188,11 @@ export class CircomPluginClient extends PluginClient { if (parseErrors && (parseErrors.length > 0)) { if (parseErrors[0].type === 'Error') { this.internalEvents.emit('circuit_parsing_errored', parseErrors) - // @ts-ignore - this.call('terminal', 'log', { type: 'error', value: 'previous errors were found' }) + this.logCompilerReport(parseErrors) return } else if (parseErrors[0].type === 'Warning') { this.internalEvents.emit('circuit_parsing_warning', parseErrors) + this.logCompilerReport(parseErrors) } } else { this.internalEvents.emit('circuit_parsing_done', parseErrors, filePathToId) @@ -210,8 +209,7 @@ export class CircomPluginClient extends PluginClient { if (r1csProgram.length < 1) { const r1csErrors = r1csApi.report() - // @ts-ignore - this.call('terminal', 'log', { type: 'error', value: 'previous errors were found' }) + this.logCompilerReport(r1csErrors) throw new Error(r1csErrors) } else { this.internalEvents.emit('circuit_generating_r1cs_done') @@ -395,4 +393,10 @@ export class CircomPluginClient extends PluginClient { } } } + + async logCompilerReport (report: CompilerReport[]): Promise { + this.call('terminal', 'log', { type: 'log', value: JSON.stringify(report, null, 2) }) + if (report[0].type === 'Error') this.call('terminal', 'log', { type: 'error', value: 'previous errors were found' }) + if (report[0].type === 'Warning') this.call('terminal', 'log', { type: 'log', value: 'previous warnings were found' }) + } } diff --git a/package.json b/package.json index ea8cd762c1..887f70c51a 100644 --- a/package.json +++ b/package.json @@ -164,7 +164,7 @@ "brace": "^0.8.0", "change-case": "^4.1.1", "chokidar": "^2.1.8", - "circom_wasm": "https://github.com/ioedeveloper/circom_wasm.git", + "circom_wasm": "^0.2.1", "color-support": "^1.1.3", "commander": "^9.4.1", "core-js": "^3.6.5", diff --git a/yarn.lock b/yarn.lock index 3d4421f1bd..80e97b8efc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10537,9 +10537,10 @@ circom_runtime@0.1.22: dependencies: ffjavascript "0.2.57" -"circom_wasm@https://github.com/ioedeveloper/circom_wasm.git": - version "0.2.0" - resolved "https://github.com/ioedeveloper/circom_wasm.git#e558f8a449ac12151e735c6923c65f33b9b953ff" +circom_wasm@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/circom_wasm/-/circom_wasm-0.2.1.tgz#11eeceb497c03461676b3bc21d7d71ac3310dd58" + integrity sha512-57Xhg3nUcQX+aMr+sH8XyxklpPgAWohjGkaEbiJDv3UiUveFAB2pOFOOE4whoMm7mjxKbO4n4mVs1oC031ApQQ== circular-json@^0.3.0: version "0.3.3"