Skip to content

Commit

Permalink
Use traverseAssets in packager (#8592)
Browse files Browse the repository at this point in the history
  • Loading branch information
mischnic committed Oct 31, 2022
1 parent 0759d1b commit 4c273c3
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions packages/packagers/js/src/DevPackager.js
Expand Up @@ -39,16 +39,14 @@ export class DevPackager {
async package(): Promise<{|contents: string, map: ?SourceMap|}> {
// Load assets
let queue = new PromiseQueue({maxConcurrent: 32});
this.bundle.traverse(node => {
if (node.type === 'asset') {
queue.add(async () => {
let [code, mapBuffer] = await Promise.all([
node.value.getCode(),
this.bundle.env.sourceMap && node.value.getMapBuffer(),
]);
return {code, mapBuffer};
});
}
this.bundle.traverseAssets(asset => {
queue.add(async () => {
let [code, mapBuffer] = await Promise.all([
asset.getCode(),
this.bundle.env.sourceMap && asset.getMapBuffer(),
]);
return {code, mapBuffer};
});
});

let results = await queue.run();
Expand Down

0 comments on commit 4c273c3

Please sign in to comment.