Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve performance of incremental bundling #8583

Merged
merged 2 commits into from Oct 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 4 additions & 12 deletions packages/core/core/src/requests/AssetGraphRequest.js
Expand Up @@ -49,11 +49,7 @@ type AssetGraphRequestInput = {|
requestedAssetIds?: Set<string>,
|};

type AssetGraphRequestResult = AssetGraphBuilderResult & {|
previousAssetGraphHash: ?string,
|};

type AssetGraphBuilderResult = {|
type AssetGraphRequestResult = {|
assetGraph: AssetGraph,
changedAssets: Map<string, Asset>,
assetRequests: Array<AssetGroup>,
Expand All @@ -80,7 +76,6 @@ export default function createAssetGraphRequest(
run: async input => {
let prevResult =
await input.api.getPreviousResult<AssetGraphRequestResult>();
let previousAssetGraphHash = prevResult?.assetGraph.getHash();

let builder = new AssetGraphBuilder(input, prevResult);
let assetGraphRequest = await await builder.build();
Expand All @@ -93,10 +88,7 @@ export default function createAssetGraphRequest(
assetGraphRequest.assetGraph.safeToIncrementallyBundle = false;
}

return {
...assetGraphRequest,
previousAssetGraphHash,
};
return assetGraphRequest;
},
input,
};
Expand Down Expand Up @@ -124,7 +116,7 @@ export class AssetGraphBuilder {

constructor(
{input, api, options}: RunInput,
prevResult: ?AssetGraphBuilderResult,
prevResult: ?AssetGraphRequestResult,
) {
let {
entries,
Expand Down Expand Up @@ -154,7 +146,7 @@ export class AssetGraphBuilder {
this.queue = new PromiseQueue();
}

async build(): Promise<AssetGraphBuilderResult> {
async build(): Promise<AssetGraphRequestResult> {
let errors = [];
let rootNodeId = nullthrows(
this.assetGraph.rootNodeId,
Expand Down