From 30b18260e9fbd10661ebede84b3fc28b3fb48eae Mon Sep 17 00:00:00 2001 From: Matheus Castro Date: Fri, 16 Dec 2022 12:13:59 -0300 Subject: [PATCH] Remove Fibers for Meteor Tools: - Removing Promise.await usage on caching-compiler.js. --- packages/caching-compiler/caching-compiler.js | 12 ++++++------ .../caching-compiler/multi-file-caching-compiler.js | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/caching-compiler/caching-compiler.js b/packages/caching-compiler/caching-compiler.js index d0c3fe36a8..80ea35f5e8 100644 --- a/packages/caching-compiler/caching-compiler.js +++ b/packages/caching-compiler/caching-compiler.js @@ -284,12 +284,12 @@ CachingCompiler = class CachingCompiler extends CachingCompilerBase { const cacheMisses = []; const arches = this._cacheDebugEnabled && Object.create(null); - inputFiles.forEach(inputFile => { + for (const inputFile of inputFiles) { if (arches) { arches[inputFile.getArch()] = 1; } - const getResult = () => { + const getResult = async () => { const cacheKey = this._deepHash(this.getCacheKey(inputFile)); let compileResult = this._cache.get(cacheKey); @@ -302,7 +302,7 @@ CachingCompiler = class CachingCompiler extends CachingCompilerBase { if (! compileResult) { cacheMisses.push(inputFile.getDisplayPath()); - compileResult = Promise.await(this.compileOneFile(inputFile)); + compileResult = await this.compileOneFile(inputFile); if (! compileResult) { // compileOneFile should have called inputFile.error. @@ -320,14 +320,14 @@ CachingCompiler = class CachingCompiler extends CachingCompilerBase { if (this.compileOneFileLater && inputFile.supportsLazyCompilation) { - this.compileOneFileLater(inputFile, getResult); + await this.compileOneFileLater(inputFile, getResult); } else { - const result = getResult(); + const result = await getResult(); if (result) { this.addCompileResult(inputFile, result); } } - }); + } if (this._cacheDebugEnabled) { this._afterLinkCallbacks.push(() => { diff --git a/packages/caching-compiler/multi-file-caching-compiler.js b/packages/caching-compiler/multi-file-caching-compiler.js index a180de2bba..86bfef44fd 100644 --- a/packages/caching-compiler/multi-file-caching-compiler.js +++ b/packages/caching-compiler/multi-file-caching-compiler.js @@ -90,12 +90,12 @@ extends CachingCompilerBase { cacheKeyMap.set(importPath, this._getCacheKeyWithPath(inputFile)); }); - inputFiles.forEach(inputFile => { + for (const inputFile of inputFiles) { if (arches) { arches[inputFile.getArch()] = 1; } - const getResult = () => { + const getResult = async () => { const absoluteImportPath = this.getAbsoluteImportPath(inputFile); const cacheKey = cacheKeyMap.get(absoluteImportPath); let cacheEntry = this._cache.get(cacheKey); @@ -110,7 +110,7 @@ extends CachingCompilerBase { cacheMisses.push(inputFile.getDisplayPath()); const compileOneFileReturn = - Promise.await(this.compileOneFile(inputFile, allFiles)); + await this.compileOneFile(inputFile, allFiles); if (! compileOneFileReturn) { // compileOneFile should have called inputFile.error. @@ -162,14 +162,14 @@ extends CachingCompilerBase { // that might be roots to this.compileOneFileLater. inputFile.getFileOptions().lazy = true; } - this.compileOneFileLater(inputFile, getResult); + await this.compileOneFileLater(inputFile, getResult); } else if (this.isRoot(inputFile)) { - const result = getResult(); + const result = await getResult(); if (result) { this.addCompileResult(inputFile, result); } } - }); + } if (this._cacheDebugEnabled) { this._afterLinkCallbacks.push(() => {