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

Add unstable manual shared bundles #9251

Merged
merged 27 commits into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
7d9485b
add initial unstable MSB config and test cases, rename to unstable later
AGawrys Sep 8, 2023
2ab2b4a
add basic functionality and skip unsupported test cases for now
AGawrys Sep 18, 2023
d40c482
add it splitting for manual bundles and unskip test
AGawrys Sep 18, 2023
17c0091
Merge branch 'v2' into unstable_manual_bundles
AGawrys Sep 18, 2023
78f5473
invariants
AGawrys Sep 18, 2023
7c3a1c4
Merge branch 'v2' into unstable_manual_bundles
mattcompiles Sep 27, 2023
4793cc1
Add inlinbe constant support, fix types
mattcompiles Sep 27, 2023
cfb8356
Update tests
mattcompiles Sep 28, 2023
537e7ab
Remove .only
mattcompiles Sep 28, 2023
9b22f78
Add mode specific config to the bundler
mattcompiles Sep 28, 2023
997f507
Update to unstable_manualSharedBundles
mattcompiles Sep 28, 2023
26c881f
Merge branch 'v2' into unstable_manual_bundles
mattcompiles Sep 28, 2023
4eee077
Fix config diagnostics
mattcompiles Sep 28, 2023
b9f299e
Pre-compile globs for perf
mattcompiles Sep 28, 2023
1a5d1fb
invariant that msbs cannot be bundlegroups
AGawrys Sep 28, 2023
c6f8c8e
Merge remote-tracking branch 'origin/v2' into unstable_manual_bundles
mattcompiles Oct 2, 2023
4a2621c
Clean up
mattcompiles Oct 2, 2023
f0ebfc1
Add empty test
mattcompiles Oct 2, 2023
f4703be
Fix bundler tests
mattcompiles Oct 2, 2023
e0994be
Early exit manual shared config when not required
mattcompiles Oct 2, 2023
16cdb99
added test for internalized asset in msb and constants module inside …
AGawrys Oct 3, 2023
ed51233
Merge branch 'v2' into unstable_manual_bundles
mattcompiles Oct 3, 2023
c1b0466
Merge branch 'v2' into unstable_manual_bundles
mattcompiles Oct 3, 2023
9ef3d80
Fix asset references
mattcompiles Oct 3, 2023
32ee1cb
add name prop to manual bundles
AGawrys Oct 3, 2023
d05c975
Add isBundleSplittable MSB test case
mattcompiles Oct 4, 2023
ec94d24
Merge branch 'v2' into unstable_manual_bundles
mattcompiles Oct 4, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
515 changes: 491 additions & 24 deletions packages/bundlers/default/src/DefaultBundler.js

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions packages/core/core/src/public/Bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ export class Bundle implements IBundle {
return this.#bundle.isSplittable;
}

get manualSharedBundle(): ?string {
return this.#bundle.manualSharedBundle;
}

get target(): ITarget {
return new Target(this.#bundle.target, this.#options);
}
Expand Down
19 changes: 17 additions & 2 deletions packages/core/core/src/public/MutableBundleGraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ import type {
MutableBundleGraph as IMutableBundleGraph,
Target,
} from '@parcel/types';
import type {ParcelOptions, BundleGroup as InternalBundleGroup} from '../types';
import type {
ParcelOptions,
BundleGroup as InternalBundleGroup,
BundleNode,
} from '../types';

import invariant from 'assert';
import nullthrows from 'nullthrows';
Expand Down Expand Up @@ -76,6 +80,16 @@ export default class MutableBundleGraph
);
}

getResolvedAsset(dependency: IDependency): ?IAsset {
let internalAsset = this.#graph.getResolvedAsset(
dependencyToInternalDependency(dependency),
);

if (internalAsset) {
return assetFromValue(internalAsset, this.#options);
}
}

createBundleGroup(dependency: IDependency, target: Target): IBundleGroup {
let dependencyNode = this.#graph._graph.getNodeByContentKey(dependency.id);
if (!dependencyNode) {
Expand Down Expand Up @@ -204,7 +218,7 @@ export default class MutableBundleGraph
isPlaceholder = entryAssetNode.requested === false;
}

let bundleNode = {
let bundleNode: BundleNode = {
type: 'bundle',
id: bundleId,
value: {
Expand Down Expand Up @@ -232,6 +246,7 @@ export default class MutableBundleGraph
name: null,
displayName: null,
publicId,
manualSharedBundle: opts.manualSharedBundle,
},
};

Expand Down
1 change: 1 addition & 0 deletions packages/core/core/src/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,7 @@ export type Bundle = {|
name: ?string,
displayName: ?string,
pipeline: ?string,
manualSharedBundle?: ?string,
|};

export type BundleNode = {|
Expand Down
Loading