@atlaspack/reporter-conditional-manifest 2.14.8 → 2.14.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @atlaspack/reporter-conditional-manifest
2
2
 
3
+ ## 2.14.10
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies []:
8
+ - @atlaspack/plugin@2.14.10
9
+
10
+ ## 2.14.9
11
+
12
+ ### Patch Changes
13
+
14
+ - [#503](https://github.com/atlassian-labs/atlaspack/pull/503) [`209692f`](https://github.com/atlassian-labs/atlaspack/commit/209692ffb11eae103a0d65c5e1118a5aa1625818) Thanks [@JakeLane](https://github.com/JakeLane)! - Fix conditional bundling reporter when condition is reused
15
+
16
+ - Updated dependencies [[`209692f`](https://github.com/atlassian-labs/atlaspack/commit/209692ffb11eae103a0d65c5e1118a5aa1625818), [`f4da1e1`](https://github.com/atlassian-labs/atlaspack/commit/f4da1e120e73eeb5e8b8927f05e88f04d6148c7b)]:
17
+ - @atlaspack/feature-flags@2.16.0
18
+ - @atlaspack/plugin@2.14.9
19
+
3
20
  ## 2.14.8
4
21
 
5
22
  ### Patch Changes
@@ -63,16 +63,29 @@ async function report({
63
63
  const mapBundles = bundles => bundles.map(bundle => (0, _path().relative)(bundle.target.distDir, bundle.filePath));
64
64
  const manifest = {};
65
65
  for (const conditions of bundles.values()) {
66
- const bundleInfo = {};
66
+ const oldBundleInfo = {};
67
67
  for (const [key, cond] of conditions) {
68
- const bundle = cond.bundle;
69
- bundleInfo[key] = {
70
- // Reverse bundles so we load children bundles first
71
- ifTrueBundles: mapBundles(cond.ifTrueBundles).reverse(),
72
- ifFalseBundles: mapBundles(cond.ifFalseBundles).reverse()
73
- };
74
- manifest[bundle.target.name] ??= {};
75
- manifest[bundle.target.name][(0, _path().relative)(bundle.target.distDir, bundle.filePath)] = bundleInfo;
68
+ if ((0, _featureFlags().getFeatureFlag)('conditionalBundlingReporterSameConditionFix')) {
69
+ var _manifest$bundle$targ, _bundleInfo$key, _bundleInfo$key2;
70
+ const bundle = cond.bundle;
71
+ const relativeBundlePath = (0, _path().relative)(bundle.target.distDir, bundle.filePath);
72
+ const bundleInfo = ((_manifest$bundle$targ = manifest[bundle.target.name]) === null || _manifest$bundle$targ === void 0 ? void 0 : _manifest$bundle$targ[relativeBundlePath]) ?? {};
73
+ bundleInfo[key] = {
74
+ ifTrueBundles: mapBundles(cond.ifTrueBundles).concat(((_bundleInfo$key = bundleInfo[key]) === null || _bundleInfo$key === void 0 ? void 0 : _bundleInfo$key.ifTrueBundles) ?? []).sort(),
75
+ ifFalseBundles: mapBundles(cond.ifFalseBundles).concat(((_bundleInfo$key2 = bundleInfo[key]) === null || _bundleInfo$key2 === void 0 ? void 0 : _bundleInfo$key2.ifFalseBundles) ?? []).sort()
76
+ };
77
+ manifest[bundle.target.name] ??= {};
78
+ manifest[bundle.target.name][relativeBundlePath] = bundleInfo;
79
+ } else {
80
+ const bundle = cond.bundle;
81
+ oldBundleInfo[key] = {
82
+ // Reverse bundles so we load children bundles first
83
+ ifTrueBundles: mapBundles(cond.ifTrueBundles).reverse(),
84
+ ifFalseBundles: mapBundles(cond.ifFalseBundles).reverse()
85
+ };
86
+ manifest[bundle.target.name] ??= {};
87
+ manifest[bundle.target.name][(0, _path().relative)(bundle.target.distDir, bundle.filePath)] = oldBundleInfo;
88
+ }
76
89
  }
77
90
  }
78
91
  const targets = new Set(event.bundleGraph.getBundles().map(bundle => bundle.target));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaspack/reporter-conditional-manifest",
3
- "version": "2.14.8",
3
+ "version": "2.14.10",
4
4
  "license": "MIT",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -15,8 +15,8 @@
15
15
  "node": ">= 16.0.0"
16
16
  },
17
17
  "dependencies": {
18
- "@atlaspack/plugin": "2.14.8",
19
- "@atlaspack/feature-flags": "2.15.1",
18
+ "@atlaspack/plugin": "2.14.10",
19
+ "@atlaspack/feature-flags": "2.16.0",
20
20
  "nullthrows": "^1.1.1"
21
21
  },
22
22
  "type": "commonjs"
@@ -60,18 +60,41 @@ export async function report({
60
60
 
61
61
  const manifest = {};
62
62
  for (const conditions of bundles.values()) {
63
- const bundleInfo = {};
63
+ const oldBundleInfo = {};
64
64
  for (const [key, cond] of conditions) {
65
- const bundle = cond.bundle;
66
- bundleInfo[key] = {
67
- // Reverse bundles so we load children bundles first
68
- ifTrueBundles: mapBundles(cond.ifTrueBundles).reverse(),
69
- ifFalseBundles: mapBundles(cond.ifFalseBundles).reverse(),
70
- };
71
- manifest[bundle.target.name] ??= {};
72
- manifest[bundle.target.name][
73
- relative(bundle.target.distDir, bundle.filePath)
74
- ] = bundleInfo;
65
+ if (getFeatureFlag('conditionalBundlingReporterSameConditionFix')) {
66
+ const bundle = cond.bundle;
67
+ const relativeBundlePath = relative(
68
+ bundle.target.distDir,
69
+ bundle.filePath,
70
+ );
71
+
72
+ const bundleInfo =
73
+ manifest[bundle.target.name]?.[relativeBundlePath] ?? {};
74
+
75
+ bundleInfo[key] = {
76
+ ifTrueBundles: mapBundles(cond.ifTrueBundles)
77
+ .concat(bundleInfo[key]?.ifTrueBundles ?? [])
78
+ .sort(),
79
+ ifFalseBundles: mapBundles(cond.ifFalseBundles)
80
+ .concat(bundleInfo[key]?.ifFalseBundles ?? [])
81
+ .sort(),
82
+ };
83
+
84
+ manifest[bundle.target.name] ??= {};
85
+ manifest[bundle.target.name][relativeBundlePath] = bundleInfo;
86
+ } else {
87
+ const bundle = cond.bundle;
88
+ oldBundleInfo[key] = {
89
+ // Reverse bundles so we load children bundles first
90
+ ifTrueBundles: mapBundles(cond.ifTrueBundles).reverse(),
91
+ ifFalseBundles: mapBundles(cond.ifFalseBundles).reverse(),
92
+ };
93
+ manifest[bundle.target.name] ??= {};
94
+ manifest[bundle.target.name][
95
+ relative(bundle.target.distDir, bundle.filePath)
96
+ ] = oldBundleInfo;
97
+ }
75
98
  }
76
99
  }
77
100