Remove Fibers for Meteor Tools:

- Removing Promise.await usage on caching-compiler.js.
This commit is contained in:
Matheus Castro
2022-12-16 12:13:59 -03:00
parent aeb84793ee
commit 30b18260e9
2 changed files with 12 additions and 12 deletions

View File

@@ -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(() => {

View File

@@ -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(() => {