@atlaspack/reporter-conditional-manifest 2.14.5-canary.19 → 2.14.5-canary.191
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 +184 -0
- package/lib/ConditionalManifestReporter.js +10 -23
- package/lib/types/ConditionalManifestReporter.d.ts +12 -0
- package/lib/types/Config.d.ts +6 -0
- package/package.json +12 -7
- package/src/{ConditionalManifestReporter.js → ConditionalManifestReporter.ts} +33 -38
- package/src/{Config.js → Config.ts} +3 -4
- package/test/{ConditionalManifestReporter.test.js → ConditionalManifestReporter.test.ts} +0 -1
- package/test/{Config.test.js → Config.test.ts} +1 -2
- package/tsconfig.json +4 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,189 @@
|
|
|
1
1
|
# @atlaspack/reporter-conditional-manifest
|
|
2
2
|
|
|
3
|
+
## 2.15.11
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`830261d`](https://github.com/atlassian-labs/atlaspack/commit/830261dcf4a40293090b61cab52fd75d5683c73f)]:
|
|
8
|
+
- @atlaspack/feature-flags@2.24.1
|
|
9
|
+
- @atlaspack/plugin@2.14.29
|
|
10
|
+
|
|
11
|
+
## 2.15.10
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [[`f0349a6`](https://github.com/atlassian-labs/atlaspack/commit/f0349a6b9b04755088f121095ca6301a2ada3767), [`a5081c3`](https://github.com/atlassian-labs/atlaspack/commit/a5081c3f9207d28716ee4edd3841de1830ea4b80), [`f930003`](https://github.com/atlassian-labs/atlaspack/commit/f930003364fdc31e5487520ebe256f1a9389f579), [`f930003`](https://github.com/atlassian-labs/atlaspack/commit/f930003364fdc31e5487520ebe256f1a9389f579), [`8843980`](https://github.com/atlassian-labs/atlaspack/commit/88439807be20025fd3433380204ff1205079729e)]:
|
|
16
|
+
- @atlaspack/feature-flags@2.24.0
|
|
17
|
+
- @atlaspack/plugin@2.14.28
|
|
18
|
+
|
|
19
|
+
## 2.15.9
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- Updated dependencies [[`3cfb7cf`](https://github.com/atlassian-labs/atlaspack/commit/3cfb7cfd90b78a5c48ce717e779ff789769825a3)]:
|
|
24
|
+
- @atlaspack/feature-flags@2.23.2
|
|
25
|
+
- @atlaspack/plugin@2.14.27
|
|
26
|
+
|
|
27
|
+
## 2.15.8
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- [#742](https://github.com/atlassian-labs/atlaspack/pull/742) [`ee040bb`](https://github.com/atlassian-labs/atlaspack/commit/ee040bb6428f29b57d892ddd8107e29077d08ffd) Thanks [@yamadapc](https://github.com/yamadapc)! - Internal changes and bug fixes to environmentDeduplication flag
|
|
32
|
+
|
|
33
|
+
- Updated dependencies [[`ee040bb`](https://github.com/atlassian-labs/atlaspack/commit/ee040bb6428f29b57d892ddd8107e29077d08ffd)]:
|
|
34
|
+
- @atlaspack/feature-flags@2.23.1
|
|
35
|
+
- @atlaspack/plugin@2.14.26
|
|
36
|
+
|
|
37
|
+
## 2.15.7
|
|
38
|
+
|
|
39
|
+
### Patch Changes
|
|
40
|
+
|
|
41
|
+
- Updated dependencies [[`f6b3f22`](https://github.com/atlassian-labs/atlaspack/commit/f6b3f2276c7e417580b49c4879563aab51f156b1)]:
|
|
42
|
+
- @atlaspack/feature-flags@2.23.0
|
|
43
|
+
- @atlaspack/plugin@2.14.25
|
|
44
|
+
|
|
45
|
+
## 2.15.6
|
|
46
|
+
|
|
47
|
+
### Patch Changes
|
|
48
|
+
|
|
49
|
+
- Updated dependencies [[`73dd7ba`](https://github.com/atlassian-labs/atlaspack/commit/73dd7baab69456ef2f6e4a0cc7dbb04f407eb148)]:
|
|
50
|
+
- @atlaspack/feature-flags@2.22.0
|
|
51
|
+
- @atlaspack/plugin@2.14.24
|
|
52
|
+
|
|
53
|
+
## 2.15.5
|
|
54
|
+
|
|
55
|
+
### Patch Changes
|
|
56
|
+
|
|
57
|
+
- Updated dependencies [[`23d561e`](https://github.com/atlassian-labs/atlaspack/commit/23d561e51e68b0c38fd1ff4e4fb173e5e7b01cf2)]:
|
|
58
|
+
- @atlaspack/feature-flags@2.21.0
|
|
59
|
+
- @atlaspack/plugin@2.14.23
|
|
60
|
+
|
|
61
|
+
## 2.15.4
|
|
62
|
+
|
|
63
|
+
### Patch Changes
|
|
64
|
+
|
|
65
|
+
- [#720](https://github.com/atlassian-labs/atlaspack/pull/720) [`d2fd849`](https://github.com/atlassian-labs/atlaspack/commit/d2fd849770fe6305e9c694bd97b1bd905abd9d94) Thanks [@alshdavid](https://github.com/alshdavid)! - Migrate to TypeScript
|
|
66
|
+
|
|
67
|
+
- Updated dependencies [[`d2fd849`](https://github.com/atlassian-labs/atlaspack/commit/d2fd849770fe6305e9c694bd97b1bd905abd9d94), [`12bee0e`](https://github.com/atlassian-labs/atlaspack/commit/12bee0e23f0464d7f6bd3e24fbe0d19c126d587d)]:
|
|
68
|
+
- @atlaspack/feature-flags@2.20.1
|
|
69
|
+
- @atlaspack/plugin@2.14.22
|
|
70
|
+
|
|
71
|
+
## 2.15.3
|
|
72
|
+
|
|
73
|
+
### Patch Changes
|
|
74
|
+
|
|
75
|
+
- Updated dependencies [[`069de47`](https://github.com/atlassian-labs/atlaspack/commit/069de478e64fb5889f6f2ce023eb510782767fbd)]:
|
|
76
|
+
- @atlaspack/feature-flags@2.20.0
|
|
77
|
+
- @atlaspack/plugin@2.14.21
|
|
78
|
+
|
|
79
|
+
## 2.15.2
|
|
80
|
+
|
|
81
|
+
### Patch Changes
|
|
82
|
+
|
|
83
|
+
- Updated dependencies [[`daaa768`](https://github.com/atlassian-labs/atlaspack/commit/daaa7688786772d7e3713b71c5bba6b89ec704aa), [`1c7865a`](https://github.com/atlassian-labs/atlaspack/commit/1c7865a64451116d94015e248302435839d347c0), [`a0b959f`](https://github.com/atlassian-labs/atlaspack/commit/a0b959fbf61fc3f820ff03c7e8988945fe40a91a)]:
|
|
84
|
+
- @atlaspack/plugin@2.14.20
|
|
85
|
+
- @atlaspack/feature-flags@2.19.2
|
|
86
|
+
|
|
87
|
+
## 2.15.1
|
|
88
|
+
|
|
89
|
+
### Patch Changes
|
|
90
|
+
|
|
91
|
+
- Updated dependencies [[`13aef17`](https://github.com/atlassian-labs/atlaspack/commit/13aef177eea289a6e40d2113b5ec1ac9be18a33d)]:
|
|
92
|
+
- @atlaspack/feature-flags@2.19.1
|
|
93
|
+
- @atlaspack/plugin@2.14.19
|
|
94
|
+
|
|
95
|
+
## 2.15.0
|
|
96
|
+
|
|
97
|
+
### Minor Changes
|
|
98
|
+
|
|
99
|
+
- [#640](https://github.com/atlassian-labs/atlaspack/pull/640) [`dbb4072`](https://github.com/atlassian-labs/atlaspack/commit/dbb40721ebeb45990a14ba04e6b44e7f836fb32d) Thanks [@JakeLane](https://github.com/JakeLane)! - Clean up conditional bundling feature flags
|
|
100
|
+
|
|
101
|
+
### Patch Changes
|
|
102
|
+
|
|
103
|
+
- Updated dependencies [[`dbb4072`](https://github.com/atlassian-labs/atlaspack/commit/dbb40721ebeb45990a14ba04e6b44e7f836fb32d), [`becf977`](https://github.com/atlassian-labs/atlaspack/commit/becf977f625d5ee46dae3d4c679f173bf5f40cc0), [`c4415a4`](https://github.com/atlassian-labs/atlaspack/commit/c4415a455543d984ca28452c2cb87a794d22497c), [`f0f7c71`](https://github.com/atlassian-labs/atlaspack/commit/f0f7c7168a1d3d18c6f30d2daed611275692b7c5), [`18a57cf`](https://github.com/atlassian-labs/atlaspack/commit/18a57cf8a4789b2de5ad8e2676f317a26cc91417)]:
|
|
104
|
+
- @atlaspack/feature-flags@2.19.0
|
|
105
|
+
- @atlaspack/plugin@2.14.18
|
|
106
|
+
|
|
107
|
+
## 2.14.17
|
|
108
|
+
|
|
109
|
+
### Patch Changes
|
|
110
|
+
|
|
111
|
+
- Updated dependencies []:
|
|
112
|
+
- @atlaspack/plugin@2.14.17
|
|
113
|
+
|
|
114
|
+
## 2.14.16
|
|
115
|
+
|
|
116
|
+
### Patch Changes
|
|
117
|
+
|
|
118
|
+
- Updated dependencies [[`e8a60ff`](https://github.com/atlassian-labs/atlaspack/commit/e8a60ffbea41caef265786bbf73349771760081c)]:
|
|
119
|
+
- @atlaspack/feature-flags@2.18.4
|
|
120
|
+
- @atlaspack/plugin@2.14.16
|
|
121
|
+
|
|
122
|
+
## 2.14.15
|
|
123
|
+
|
|
124
|
+
### Patch Changes
|
|
125
|
+
|
|
126
|
+
- Updated dependencies [[`5ded263`](https://github.com/atlassian-labs/atlaspack/commit/5ded263c7f11b866e8885b81c73e20dd060b25be)]:
|
|
127
|
+
- @atlaspack/feature-flags@2.18.3
|
|
128
|
+
- @atlaspack/plugin@2.14.15
|
|
129
|
+
|
|
130
|
+
## 2.14.14
|
|
131
|
+
|
|
132
|
+
### Patch Changes
|
|
133
|
+
|
|
134
|
+
- Updated dependencies [[`644b157`](https://github.com/atlassian-labs/atlaspack/commit/644b157dee72a871acc2d0facf0b87b8eea51956)]:
|
|
135
|
+
- @atlaspack/feature-flags@2.18.2
|
|
136
|
+
- @atlaspack/plugin@2.14.14
|
|
137
|
+
|
|
138
|
+
## 2.14.13
|
|
139
|
+
|
|
140
|
+
### Patch Changes
|
|
141
|
+
|
|
142
|
+
- Updated dependencies [[`26aa9c5`](https://github.com/atlassian-labs/atlaspack/commit/26aa9c599d2be45ce1438a74c5fa22f39b9b554b), [`0501255`](https://github.com/atlassian-labs/atlaspack/commit/05012550da35b05ce7d356a8cc29311e7f9afdca)]:
|
|
143
|
+
- @atlaspack/feature-flags@2.18.1
|
|
144
|
+
- @atlaspack/plugin@2.14.13
|
|
145
|
+
|
|
146
|
+
## 2.14.12
|
|
147
|
+
|
|
148
|
+
### Patch Changes
|
|
149
|
+
|
|
150
|
+
- Updated dependencies [[`10fbcfb`](https://github.com/atlassian-labs/atlaspack/commit/10fbcfbfa49c7a83da5d7c40983e36e87f524a75), [`85c52d3`](https://github.com/atlassian-labs/atlaspack/commit/85c52d3f7717b3c84a118d18ab98cfbfd71dcbd2)]:
|
|
151
|
+
- @atlaspack/feature-flags@2.18.0
|
|
152
|
+
- @atlaspack/plugin@2.14.12
|
|
153
|
+
|
|
154
|
+
## 2.14.11
|
|
155
|
+
|
|
156
|
+
### Patch Changes
|
|
157
|
+
|
|
158
|
+
- Updated dependencies [[`73ea3c4`](https://github.com/atlassian-labs/atlaspack/commit/73ea3c4d85d4401fdd15abcbf988237e890e7ad3), [`b1b3693`](https://github.com/atlassian-labs/atlaspack/commit/b1b369317c66f8a431c170df2ebba4fa5b2e38ef)]:
|
|
159
|
+
- @atlaspack/feature-flags@2.17.0
|
|
160
|
+
- @atlaspack/plugin@2.14.11
|
|
161
|
+
|
|
162
|
+
## 2.14.10
|
|
163
|
+
|
|
164
|
+
### Patch Changes
|
|
165
|
+
|
|
166
|
+
- Updated dependencies []:
|
|
167
|
+
- @atlaspack/plugin@2.14.10
|
|
168
|
+
|
|
169
|
+
## 2.14.9
|
|
170
|
+
|
|
171
|
+
### Patch Changes
|
|
172
|
+
|
|
173
|
+
- [#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
|
|
174
|
+
|
|
175
|
+
- Updated dependencies [[`209692f`](https://github.com/atlassian-labs/atlaspack/commit/209692ffb11eae103a0d65c5e1118a5aa1625818), [`f4da1e1`](https://github.com/atlassian-labs/atlaspack/commit/f4da1e120e73eeb5e8b8927f05e88f04d6148c7b)]:
|
|
176
|
+
- @atlaspack/feature-flags@2.16.0
|
|
177
|
+
- @atlaspack/plugin@2.14.9
|
|
178
|
+
|
|
179
|
+
## 2.14.8
|
|
180
|
+
|
|
181
|
+
### Patch Changes
|
|
182
|
+
|
|
183
|
+
- Updated dependencies [[`30f6017`](https://github.com/atlassian-labs/atlaspack/commit/30f60175ba4d272c5fc193973c63bc298584775b)]:
|
|
184
|
+
- @atlaspack/feature-flags@2.15.1
|
|
185
|
+
- @atlaspack/plugin@2.14.8
|
|
186
|
+
|
|
3
187
|
## 2.14.7
|
|
4
188
|
|
|
5
189
|
### Patch Changes
|
|
@@ -28,13 +28,6 @@ function _plugin() {
|
|
|
28
28
|
return data;
|
|
29
29
|
}
|
|
30
30
|
var _Config = require("./Config");
|
|
31
|
-
function _featureFlags() {
|
|
32
|
-
const data = require("@atlaspack/feature-flags");
|
|
33
|
-
_featureFlags = function () {
|
|
34
|
-
return data;
|
|
35
|
-
};
|
|
36
|
-
return data;
|
|
37
|
-
}
|
|
38
31
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
39
32
|
const manifestHashes = exports.manifestHashes = new Map();
|
|
40
33
|
const updateManifest = async (outputFS, logger, conditionalManifestFilename, conditionalManifest) => {
|
|
@@ -60,19 +53,21 @@ async function report({
|
|
|
60
53
|
const bundles = event.bundleGraph.getConditionalBundleMapping();
|
|
61
54
|
|
|
62
55
|
// Replace bundles with file paths
|
|
56
|
+
// @ts-expect-error TS2304
|
|
63
57
|
const mapBundles = bundles => bundles.map(bundle => (0, _path().relative)(bundle.target.distDir, bundle.filePath));
|
|
64
58
|
const manifest = {};
|
|
65
59
|
for (const conditions of bundles.values()) {
|
|
66
|
-
const bundleInfo = {};
|
|
67
60
|
for (const [key, cond] of conditions) {
|
|
61
|
+
var _manifest$bundle$targ, _bundleInfo$key, _bundleInfo$key2;
|
|
68
62
|
const bundle = cond.bundle;
|
|
63
|
+
const relativeBundlePath = (0, _path().relative)(bundle.target.distDir, bundle.filePath);
|
|
64
|
+
const bundleInfo = ((_manifest$bundle$targ = manifest[bundle.target.name]) === null || _manifest$bundle$targ === void 0 ? void 0 : _manifest$bundle$targ[relativeBundlePath]) ?? {};
|
|
69
65
|
bundleInfo[key] = {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
ifFalseBundles: mapBundles(cond.ifFalseBundles).reverse()
|
|
66
|
+
ifTrueBundles: mapBundles(cond.ifTrueBundles).concat(((_bundleInfo$key = bundleInfo[key]) === null || _bundleInfo$key === void 0 ? void 0 : _bundleInfo$key.ifTrueBundles) ?? []).sort(),
|
|
67
|
+
ifFalseBundles: mapBundles(cond.ifFalseBundles).concat(((_bundleInfo$key2 = bundleInfo[key]) === null || _bundleInfo$key2 === void 0 ? void 0 : _bundleInfo$key2.ifFalseBundles) ?? []).sort()
|
|
73
68
|
};
|
|
74
69
|
manifest[bundle.target.name] ??= {};
|
|
75
|
-
manifest[bundle.target.name][
|
|
70
|
+
manifest[bundle.target.name][relativeBundlePath] = bundleInfo;
|
|
76
71
|
}
|
|
77
72
|
}
|
|
78
73
|
const targets = new Set(event.bundleGraph.getBundles().map(bundle => bundle.target));
|
|
@@ -84,20 +79,12 @@ async function report({
|
|
|
84
79
|
const conditionalManifest = JSON.stringify(
|
|
85
80
|
// If there's no content, send an empty manifest so we can still map from it safely
|
|
86
81
|
manifest[target.name] ?? {}, null, 2);
|
|
87
|
-
|
|
88
|
-
await updateManifest(options.outputFS, logger, conditionalManifestFilename, conditionalManifest);
|
|
89
|
-
} else {
|
|
90
|
-
await options.outputFS.mkdirp((0, _path().dirname)(conditionalManifestFilename));
|
|
91
|
-
await options.outputFS.writeFile(conditionalManifestFilename, conditionalManifest, {
|
|
92
|
-
mode: 0o666
|
|
93
|
-
});
|
|
94
|
-
logger.info({
|
|
95
|
-
message: 'Wrote conditional manifest to ' + conditionalManifestFilename
|
|
96
|
-
});
|
|
97
|
-
}
|
|
82
|
+
await updateManifest(options.outputFS, logger, conditionalManifestFilename, conditionalManifest);
|
|
98
83
|
}
|
|
99
84
|
}
|
|
100
85
|
}
|
|
86
|
+
|
|
87
|
+
// @ts-expect-error TS2322
|
|
101
88
|
var _default = exports.default = new (_plugin().Reporter)({
|
|
102
89
|
report
|
|
103
90
|
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Reporter } from '@atlaspack/plugin';
|
|
2
|
+
import type { Async, PluginLogger, PluginOptions, PluginTracer, ReporterEvent, FileSystem, FilePath } from '@atlaspack/types-internal';
|
|
3
|
+
export declare const manifestHashes: Map<FilePath, string>;
|
|
4
|
+
export declare const updateManifest: (outputFS: FileSystem, logger: PluginLogger, conditionalManifestFilename: FilePath, conditionalManifest: string) => Promise<void>;
|
|
5
|
+
export declare function report({ event, options, logger, }: {
|
|
6
|
+
event: ReporterEvent;
|
|
7
|
+
options: PluginOptions;
|
|
8
|
+
logger: PluginLogger;
|
|
9
|
+
tracer: PluginTracer;
|
|
10
|
+
}): Promise<Async<void>>;
|
|
11
|
+
declare const _default: Reporter;
|
|
12
|
+
export default _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaspack/reporter-conditional-manifest",
|
|
3
|
-
"version": "2.14.5-canary.
|
|
3
|
+
"version": "2.14.5-canary.191+eedcbc408",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -9,16 +9,21 @@
|
|
|
9
9
|
"type": "git",
|
|
10
10
|
"url": "https://github.com/atlassian-labs/atlaspack.git"
|
|
11
11
|
},
|
|
12
|
-
"main": "lib/ConditionalManifestReporter.js",
|
|
13
|
-
"source": "src/ConditionalManifestReporter.
|
|
12
|
+
"main": "./lib/ConditionalManifestReporter.js",
|
|
13
|
+
"source": "./src/ConditionalManifestReporter.ts",
|
|
14
|
+
"types": "./lib/ConditionalManifestReporter.d.ts",
|
|
14
15
|
"engines": {
|
|
15
16
|
"node": ">= 16.0.0"
|
|
16
17
|
},
|
|
17
18
|
"dependencies": {
|
|
18
|
-
"@atlaspack/feature-flags": "2.14.1-canary.
|
|
19
|
-
"@atlaspack/plugin": "2.14.5-canary.
|
|
19
|
+
"@atlaspack/feature-flags": "2.14.1-canary.259+eedcbc408",
|
|
20
|
+
"@atlaspack/plugin": "2.14.5-canary.191+eedcbc408",
|
|
20
21
|
"nullthrows": "^1.1.1"
|
|
21
22
|
},
|
|
22
23
|
"type": "commonjs",
|
|
23
|
-
"
|
|
24
|
-
|
|
24
|
+
"scripts": {
|
|
25
|
+
"check-ts": "tsc --emitDeclarationOnly --rootDir src",
|
|
26
|
+
"build:lib": "gulp build --gulpfile ../../../gulpfile.js --cwd ."
|
|
27
|
+
},
|
|
28
|
+
"gitHead": "eedcbc408fc1e86a2a8e25f1a41c57146d8529e1"
|
|
29
|
+
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// @flow strict-local
|
|
2
1
|
import {relative, join, dirname} from 'path';
|
|
3
2
|
import crypto from 'crypto';
|
|
4
3
|
import {Reporter} from '@atlaspack/plugin';
|
|
@@ -12,7 +11,6 @@ import type {
|
|
|
12
11
|
FilePath,
|
|
13
12
|
} from '@atlaspack/types-internal';
|
|
14
13
|
import {getConfig} from './Config';
|
|
15
|
-
import {getFeatureFlag} from '@atlaspack/feature-flags';
|
|
16
14
|
|
|
17
15
|
export const manifestHashes: Map<FilePath, string> = new Map();
|
|
18
16
|
|
|
@@ -45,33 +43,43 @@ export async function report({
|
|
|
45
43
|
event,
|
|
46
44
|
options,
|
|
47
45
|
logger,
|
|
48
|
-
}: {
|
|
49
|
-
event: ReporterEvent
|
|
50
|
-
options: PluginOptions
|
|
51
|
-
logger: PluginLogger
|
|
52
|
-
tracer: PluginTracer
|
|
53
|
-
|
|
46
|
+
}: {
|
|
47
|
+
event: ReporterEvent;
|
|
48
|
+
options: PluginOptions;
|
|
49
|
+
logger: PluginLogger;
|
|
50
|
+
tracer: PluginTracer;
|
|
51
|
+
}): Promise<Async<void>> {
|
|
54
52
|
if (event.type === 'buildSuccess') {
|
|
55
53
|
const bundles = event.bundleGraph.getConditionalBundleMapping();
|
|
56
54
|
|
|
57
55
|
// Replace bundles with file paths
|
|
58
|
-
|
|
56
|
+
// @ts-expect-error TS2304
|
|
57
|
+
const mapBundles = (bundles: Array<PackagedBundle>) =>
|
|
59
58
|
bundles.map((bundle) => relative(bundle.target.distDir, bundle.filePath));
|
|
60
59
|
|
|
61
|
-
const manifest = {};
|
|
60
|
+
const manifest: Record<string, any> = {};
|
|
62
61
|
for (const conditions of bundles.values()) {
|
|
63
|
-
const bundleInfo = {};
|
|
64
62
|
for (const [key, cond] of conditions) {
|
|
65
63
|
const bundle = cond.bundle;
|
|
64
|
+
const relativeBundlePath = relative(
|
|
65
|
+
bundle.target.distDir,
|
|
66
|
+
bundle.filePath,
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
const bundleInfo =
|
|
70
|
+
manifest[bundle.target.name]?.[relativeBundlePath] ?? {};
|
|
71
|
+
|
|
66
72
|
bundleInfo[key] = {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
73
|
+
ifTrueBundles: mapBundles(cond.ifTrueBundles)
|
|
74
|
+
.concat(bundleInfo[key]?.ifTrueBundles ?? [])
|
|
75
|
+
.sort(),
|
|
76
|
+
ifFalseBundles: mapBundles(cond.ifFalseBundles)
|
|
77
|
+
.concat(bundleInfo[key]?.ifFalseBundles ?? [])
|
|
78
|
+
.sort(),
|
|
70
79
|
};
|
|
80
|
+
|
|
71
81
|
manifest[bundle.target.name] ??= {};
|
|
72
|
-
manifest[bundle.target.name][
|
|
73
|
-
relative(bundle.target.distDir, bundle.filePath)
|
|
74
|
-
] = bundleInfo;
|
|
82
|
+
manifest[bundle.target.name][relativeBundlePath] = bundleInfo;
|
|
75
83
|
}
|
|
76
84
|
}
|
|
77
85
|
|
|
@@ -90,28 +98,15 @@ export async function report({
|
|
|
90
98
|
2,
|
|
91
99
|
);
|
|
92
100
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
);
|
|
100
|
-
} else {
|
|
101
|
-
await options.outputFS.mkdirp(dirname(conditionalManifestFilename));
|
|
102
|
-
await options.outputFS.writeFile(
|
|
103
|
-
conditionalManifestFilename,
|
|
104
|
-
conditionalManifest,
|
|
105
|
-
{mode: 0o666},
|
|
106
|
-
);
|
|
107
|
-
|
|
108
|
-
logger.info({
|
|
109
|
-
message:
|
|
110
|
-
'Wrote conditional manifest to ' + conditionalManifestFilename,
|
|
111
|
-
});
|
|
112
|
-
}
|
|
101
|
+
await updateManifest(
|
|
102
|
+
options.outputFS,
|
|
103
|
+
logger,
|
|
104
|
+
conditionalManifestFilename,
|
|
105
|
+
conditionalManifest,
|
|
106
|
+
);
|
|
113
107
|
}
|
|
114
108
|
}
|
|
115
109
|
}
|
|
116
110
|
|
|
117
|
-
|
|
111
|
+
// @ts-expect-error TS2322
|
|
112
|
+
export default new Reporter({report}) as Reporter;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// @flow strict-local
|
|
2
1
|
import type {PluginOptions, EnvMap} from '@atlaspack/types-internal';
|
|
3
2
|
|
|
4
3
|
import {NodePackageManager} from '@atlaspack/package-manager';
|
|
@@ -7,7 +6,7 @@ import {overlayFS, fsFixture} from '@atlaspack/test-utils';
|
|
|
7
6
|
import assert from 'assert';
|
|
8
7
|
import {DEFAULT_FEATURE_FLAGS} from '@atlaspack/feature-flags';
|
|
9
8
|
|
|
10
|
-
function getPluginOptions({env}: {env?: EnvMap
|
|
9
|
+
function getPluginOptions({env}: {env?: EnvMap}): PluginOptions {
|
|
11
10
|
return {
|
|
12
11
|
mode: 'development',
|
|
13
12
|
parcelVersion: 'version',
|
package/tsconfig.json
ADDED