From 811564e69ba1ccfaa8bc6efdf374e264fcfbd67e Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 19 Jan 2022 12:38:08 +0100 Subject: [PATCH 1/2] Fix loading import (remix-tests) --- libs/remix-tests/src/compiler.ts | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/libs/remix-tests/src/compiler.ts b/libs/remix-tests/src/compiler.ts index 740a306931..94e37a43e3 100644 --- a/libs/remix-tests/src/compiler.ts +++ b/libs/remix-tests/src/compiler.ts @@ -62,14 +62,6 @@ function processFile (filePath: string, sources: SrcIfc, isRoot = false) { content = includeTestLibs.concat(content) } sources[filePath] = { content } - importRegEx.exec('') // Resetting state of RegEx - - // Process each 'import' in file content - while ((group = importRegEx.exec(content))) { - const importedFile: string = group[1] - const importedFilePath: string = path.join(path.dirname(filePath), importedFile) - processFile(importedFilePath, sources) - } } const userAgent = (typeof (navigator) !== 'undefined') && navigator.userAgent ? navigator.userAgent.toLowerCase() : '-' @@ -123,7 +115,13 @@ export function compileFileOrFiles (filename: string, isDirectory: boolean, opts } finally { async.waterfall([ function loadCompiler (next) { - compiler = new RemixCompiler() + compiler = new RemixCompiler((url, cb) => { + try { + cb(null, fs.readFileSync(url, 'utf-8')) + } catch (e) { + cb(e.message) + } + }) if (compilerConfig) { const { currentCompilerUrl, evmVersion, optimize, runs } = compilerConfig if (evmVersion) compiler.set('evmVersion', evmVersion) From 32098ec3cf6634653895c24dec5146e5c7833720 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 19 Jan 2022 12:44:03 +0100 Subject: [PATCH 2/2] fix linting --- libs/remix-tests/src/compiler.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/libs/remix-tests/src/compiler.ts b/libs/remix-tests/src/compiler.ts index 94e37a43e3..b8fd320f00 100644 --- a/libs/remix-tests/src/compiler.ts +++ b/libs/remix-tests/src/compiler.ts @@ -47,7 +47,6 @@ function isRemixTestFile (path: string) { function processFile (filePath: string, sources: SrcIfc, isRoot = false) { const importRegEx = /import ['"](.+?)['"];/g - let group: RegExpExecArray| null = null const isFileAlreadyInSources: boolean = Object.keys(sources).includes(filePath) // Return if file is a remix test file or already processed