Skip to content

Commit 0e07e21

Browse files
authored
fix(async): revert Promise.all refactor (#515)
1 parent acab67e commit 0e07e21

File tree

2 files changed

+23
-13
lines changed

2 files changed

+23
-13
lines changed

src/generators/ast-js/index.mjs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,17 @@ export default {
3636
async processChunk(inputSlice, itemIndices) {
3737
const filePaths = itemIndices.map(idx => inputSlice[idx]);
3838

39-
return Promise.all(
40-
filePaths.map(async path => parseJsSource(await read(path, 'utf-8')))
41-
);
39+
const results = [];
40+
41+
for (const path of filePaths) {
42+
const vfile = await read(path, 'utf-8');
43+
44+
const parsedJS = await parseJsSource(vfile);
45+
46+
results.push(parsedJS);
47+
}
48+
49+
return results;
4250
},
4351

4452
/**

src/generators/ast/index.mjs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,20 @@ export default {
3838
async processChunk(inputSlice, itemIndices) {
3939
const filePaths = itemIndices.map(idx => inputSlice[idx]);
4040

41-
return Promise.all(
42-
filePaths.map(async path => {
43-
const vfile = await read(path, 'utf-8');
41+
const results = [];
4442

45-
updateStabilityPrefixToLink(vfile);
43+
for (const path of filePaths) {
44+
const vfile = await read(path, 'utf-8');
4645

47-
return {
48-
tree: remarkProcessor.parse(vfile),
49-
file: { stem: vfile.stem, basename: vfile.basename },
50-
};
51-
})
52-
);
46+
updateStabilityPrefixToLink(vfile);
47+
48+
results.push({
49+
tree: remarkProcessor.parse(vfile),
50+
file: { stem: vfile.stem, basename: vfile.basename },
51+
});
52+
}
53+
54+
return results;
5355
},
5456

5557
/**

0 commit comments

Comments
 (0)