@atlaspack/reporter-cli 2.15.1-canary.31 → 2.15.1-canary.310

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,317 @@
1
1
  # @atlaspack/reporter-cli
2
2
 
3
+ ## 2.17.22
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies []:
8
+ - @atlaspack/utils@3.2.1
9
+ - @atlaspack/plugin@2.14.40
10
+ - @atlaspack/types@2.15.30
11
+
12
+ ## 2.17.21
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies [[`73168c2`](https://github.com/atlassian-labs/atlaspack/commit/73168c275a5d9abff9907bcf536b340bca1ed5f0), [`617a318`](https://github.com/atlassian-labs/atlaspack/commit/617a318ddc9419b38360257353fec50b9051ee13)]:
17
+ - @atlaspack/utils@3.2.0
18
+ - @atlaspack/plugin@2.14.39
19
+ - @atlaspack/types@2.15.29
20
+
21
+ ## 2.17.20
22
+
23
+ ### Patch Changes
24
+
25
+ - Updated dependencies [[`7d7a55d`](https://github.com/atlassian-labs/atlaspack/commit/7d7a55dd6395ec391a2e4c33b3dec0d1ea477d4c)]:
26
+ - @atlaspack/utils@3.1.2
27
+ - @atlaspack/plugin@2.14.38
28
+ - @atlaspack/types@2.15.28
29
+
30
+ ## 2.17.19
31
+
32
+ ### Patch Changes
33
+
34
+ - Updated dependencies []:
35
+ - @atlaspack/utils@3.1.1
36
+ - @atlaspack/plugin@2.14.37
37
+ - @atlaspack/types@2.15.27
38
+
39
+ ## 2.17.18
40
+
41
+ ### Patch Changes
42
+
43
+ - Updated dependencies [[`5776be2`](https://github.com/atlassian-labs/atlaspack/commit/5776be21f70a3f2b9471ba33da3ba1a883f21f1a)]:
44
+ - @atlaspack/utils@3.1.0
45
+ - @atlaspack/plugin@2.14.36
46
+ - @atlaspack/types@2.15.26
47
+
48
+ ## 2.17.17
49
+
50
+ ### Patch Changes
51
+
52
+ - [#810](https://github.com/atlassian-labs/atlaspack/pull/810) [`c372f3f`](https://github.com/atlassian-labs/atlaspack/commit/c372f3fd6fce8200d5cf47f41bc7895c6cbb5558) Thanks [@benjervis](https://github.com/benjervis)! - Add the `scope-hosting-stats` debug tool to report on the percentage of assets that were able to be scope hoisted during the build.
53
+
54
+ - Updated dependencies [[`c372f3f`](https://github.com/atlassian-labs/atlaspack/commit/c372f3fd6fce8200d5cf47f41bc7895c6cbb5558), [`17dfea9`](https://github.com/atlassian-labs/atlaspack/commit/17dfea9e9f3169807808520df9c09ebf70dc8b10)]:
55
+ - @atlaspack/utils@3.0.3
56
+ - @atlaspack/plugin@2.14.35
57
+ - @atlaspack/types@2.15.25
58
+
59
+ ## 2.17.16
60
+
61
+ ### Patch Changes
62
+
63
+ - Updated dependencies []:
64
+ - @atlaspack/types@2.15.24
65
+ - @atlaspack/utils@3.0.2
66
+ - @atlaspack/plugin@2.14.34
67
+
68
+ ## 2.17.15
69
+
70
+ ### Patch Changes
71
+
72
+ - Updated dependencies [[`236e546`](https://github.com/atlassian-labs/atlaspack/commit/236e5465863dca6044a7191e05260a5b924c342e)]:
73
+ - @atlaspack/utils@3.0.1
74
+ - @atlaspack/types@2.15.23
75
+ - @atlaspack/plugin@2.14.33
76
+
77
+ ## 2.17.14
78
+
79
+ ### Patch Changes
80
+
81
+ - [#793](https://github.com/atlassian-labs/atlaspack/pull/793) [`a4f887b`](https://github.com/atlassian-labs/atlaspack/commit/a4f887b8c45386b058650c41ad38ac675deee27d) Thanks [@benjervis](https://github.com/benjervis)! - Fixes the cliProgressReportingImprovements, which were previously being overwritten by the existing packaging messaging. With this fix, now only the progress messages are shown during packaging.
82
+
83
+ - Updated dependencies [[`1180103`](https://github.com/atlassian-labs/atlaspack/commit/118010351ed444f8178988afb3f77807154dd933)]:
84
+ - @atlaspack/utils@3.0.0
85
+ - @atlaspack/plugin@2.14.32
86
+ - @atlaspack/types@2.15.22
87
+
88
+ ## 2.17.13
89
+
90
+ ### Patch Changes
91
+
92
+ - [#785](https://github.com/atlassian-labs/atlaspack/pull/785) [`0e7dd5e`](https://github.com/atlassian-labs/atlaspack/commit/0e7dd5ec6fbe05aa9e0bb5775a9d0975f206a922) Thanks [@matt-koko](https://github.com/matt-koko)! - We need to re-publish every package in Atlaspack with the corrected types field.
93
+
94
+ - Updated dependencies [[`0e7dd5e`](https://github.com/atlassian-labs/atlaspack/commit/0e7dd5ec6fbe05aa9e0bb5775a9d0975f206a922)]:
95
+ - @atlaspack/plugin@2.14.31
96
+ - @atlaspack/types@2.15.21
97
+ - @atlaspack/utils@2.19.3
98
+
99
+ ## 2.17.12
100
+
101
+ ### Patch Changes
102
+
103
+ - Updated dependencies []:
104
+ - @atlaspack/utils@2.19.2
105
+ - @atlaspack/plugin@2.14.30
106
+ - @atlaspack/types@2.15.20
107
+
108
+ ## 2.17.11
109
+
110
+ ### Patch Changes
111
+
112
+ - Updated dependencies []:
113
+ - @atlaspack/utils@2.19.1
114
+ - @atlaspack/plugin@2.14.29
115
+ - @atlaspack/types@2.15.19
116
+
117
+ ## 2.17.10
118
+
119
+ ### Patch Changes
120
+
121
+ - Updated dependencies [[`f0349a6`](https://github.com/atlassian-labs/atlaspack/commit/f0349a6b9b04755088f121095ca6301a2ada3767)]:
122
+ - @atlaspack/utils@2.19.0
123
+ - @atlaspack/plugin@2.14.28
124
+ - @atlaspack/types@2.15.18
125
+
126
+ ## 2.17.9
127
+
128
+ ### Patch Changes
129
+
130
+ - Updated dependencies []:
131
+ - @atlaspack/utils@2.18.4
132
+ - @atlaspack/plugin@2.14.27
133
+ - @atlaspack/types@2.15.17
134
+
135
+ ## 2.17.8
136
+
137
+ ### Patch Changes
138
+
139
+ - [#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
140
+
141
+ - Updated dependencies [[`ee040bb`](https://github.com/atlassian-labs/atlaspack/commit/ee040bb6428f29b57d892ddd8107e29077d08ffd), [`889c65c`](https://github.com/atlassian-labs/atlaspack/commit/889c65cd25b811045e26a117e7404f694dde77a2)]:
142
+ - @atlaspack/plugin@2.14.26
143
+ - @atlaspack/types@2.15.16
144
+ - @atlaspack/utils@2.18.3
145
+
146
+ ## 2.17.7
147
+
148
+ ### Patch Changes
149
+
150
+ - Updated dependencies []:
151
+ - @atlaspack/utils@2.18.2
152
+ - @atlaspack/plugin@2.14.25
153
+ - @atlaspack/types@2.15.15
154
+
155
+ ## 2.17.6
156
+
157
+ ### Patch Changes
158
+
159
+ - Updated dependencies []:
160
+ - @atlaspack/utils@2.18.1
161
+ - @atlaspack/plugin@2.14.24
162
+ - @atlaspack/types@2.15.14
163
+
164
+ ## 2.17.5
165
+
166
+ ### Patch Changes
167
+
168
+ - Updated dependencies [[`23d561e`](https://github.com/atlassian-labs/atlaspack/commit/23d561e51e68b0c38fd1ff4e4fb173e5e7b01cf2)]:
169
+ - @atlaspack/utils@2.18.0
170
+ - @atlaspack/types@2.15.13
171
+ - @atlaspack/plugin@2.14.23
172
+
173
+ ## 2.17.4
174
+
175
+ ### Patch Changes
176
+
177
+ - [#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
178
+
179
+ - Updated dependencies [[`d2fd849`](https://github.com/atlassian-labs/atlaspack/commit/d2fd849770fe6305e9c694bd97b1bd905abd9d94)]:
180
+ - @atlaspack/plugin@2.14.22
181
+ - @atlaspack/types@2.15.12
182
+ - @atlaspack/utils@2.17.4
183
+
184
+ ## 2.17.3
185
+
186
+ ### Patch Changes
187
+
188
+ - Updated dependencies []:
189
+ - @atlaspack/types@2.15.11
190
+ - @atlaspack/utils@2.17.3
191
+ - @atlaspack/plugin@2.14.21
192
+
193
+ ## 2.17.2
194
+
195
+ ### Patch Changes
196
+
197
+ - Updated dependencies [[`daaa768`](https://github.com/atlassian-labs/atlaspack/commit/daaa7688786772d7e3713b71c5bba6b89ec704aa)]:
198
+ - @atlaspack/plugin@2.14.20
199
+ - @atlaspack/utils@2.17.2
200
+ - @atlaspack/types@2.15.10
201
+
202
+ ## 2.17.1
203
+
204
+ ### Patch Changes
205
+
206
+ - Updated dependencies []:
207
+ - @atlaspack/utils@2.17.1
208
+ - @atlaspack/types@2.15.9
209
+ - @atlaspack/plugin@2.14.19
210
+
211
+ ## 2.17.0
212
+
213
+ ### Minor Changes
214
+
215
+ - [#693](https://github.com/atlassian-labs/atlaspack/pull/693) [`18a57cf`](https://github.com/atlassian-labs/atlaspack/commit/18a57cf8a4789b2de5ad8e2676f317a26cc91417) Thanks [@mattcompiles](https://github.com/mattcompiles)! - These packages should have been bumped in [pull request 691](https://github.com/atlassian-labs/atlaspack/pull/691).
216
+
217
+ Rectifying by creating a new changeset now.
218
+
219
+ ### Patch Changes
220
+
221
+ - [#645](https://github.com/atlassian-labs/atlaspack/pull/645) [`de23e0c`](https://github.com/atlassian-labs/atlaspack/commit/de23e0ce49d5504fe3947ac26640a3d951087da3) Thanks [@alshdavid](https://github.com/alshdavid)! - Updated build system and added some extra test-specific code
222
+
223
+ - [#682](https://github.com/atlassian-labs/atlaspack/pull/682) [`a5ed1b4`](https://github.com/atlassian-labs/atlaspack/commit/a5ed1b414498560f393ff491af4da25b6e8dde56) Thanks [@alshdavid](https://github.com/alshdavid)! - Updating build system
224
+
225
+ - Updated dependencies [[`dbb4072`](https://github.com/atlassian-labs/atlaspack/commit/dbb40721ebeb45990a14ba04e6b44e7f836fb32d), [`de23e0c`](https://github.com/atlassian-labs/atlaspack/commit/de23e0ce49d5504fe3947ac26640a3d951087da3), [`18a57cf`](https://github.com/atlassian-labs/atlaspack/commit/18a57cf8a4789b2de5ad8e2676f317a26cc91417), [`a5ed1b4`](https://github.com/atlassian-labs/atlaspack/commit/a5ed1b414498560f393ff491af4da25b6e8dde56)]:
226
+ - @atlaspack/utils@2.17.0
227
+ - @atlaspack/types@2.15.8
228
+ - @atlaspack/plugin@2.14.18
229
+
230
+ ## 2.16.1
231
+
232
+ ### Patch Changes
233
+
234
+ - Updated dependencies []:
235
+ - @atlaspack/utils@2.16.1
236
+ - @atlaspack/types@2.15.7
237
+ - @atlaspack/plugin@2.14.17
238
+
239
+ ## 2.16.0
240
+
241
+ ### Minor Changes
242
+
243
+ - [#659](https://github.com/atlassian-labs/atlaspack/pull/659) [`30ee2cf`](https://github.com/atlassian-labs/atlaspack/commit/30ee2cfcd34cf2646ded0eda13fdb80a2a5de529) Thanks [@benjervis](https://github.com/benjervis)! - Add the `simple-cli-reporter` debug tool, which turns off the "print every bundle" output of the CLI reporter.
244
+
245
+ ### Patch Changes
246
+
247
+ - Updated dependencies [[`30ee2cf`](https://github.com/atlassian-labs/atlaspack/commit/30ee2cfcd34cf2646ded0eda13fdb80a2a5de529)]:
248
+ - @atlaspack/utils@2.16.0
249
+ - @atlaspack/types@2.15.6
250
+ - @atlaspack/plugin@2.14.16
251
+
252
+ ## 2.15.11
253
+
254
+ ### Patch Changes
255
+
256
+ - Updated dependencies []:
257
+ - @atlaspack/utils@2.15.3
258
+ - @atlaspack/types@2.15.5
259
+ - @atlaspack/plugin@2.14.15
260
+
261
+ ## 2.15.10
262
+
263
+ ### Patch Changes
264
+
265
+ - Updated dependencies []:
266
+ - @atlaspack/utils@2.15.2
267
+ - @atlaspack/types@2.15.4
268
+ - @atlaspack/plugin@2.14.14
269
+
270
+ ## 2.15.9
271
+
272
+ ### Patch Changes
273
+
274
+ - Updated dependencies []:
275
+ - @atlaspack/types@2.15.3
276
+ - @atlaspack/utils@2.15.1
277
+ - @atlaspack/plugin@2.14.13
278
+
279
+ ## 2.15.8
280
+
281
+ ### Patch Changes
282
+
283
+ - Updated dependencies [[`e39c6cf`](https://github.com/atlassian-labs/atlaspack/commit/e39c6cf05f7e95ce5420dbcea66f401b1cbd397c)]:
284
+ - @atlaspack/utils@2.15.0
285
+ - @atlaspack/types@2.15.2
286
+ - @atlaspack/plugin@2.14.12
287
+
288
+ ## 2.15.7
289
+
290
+ ### Patch Changes
291
+
292
+ - Updated dependencies []:
293
+ - @atlaspack/utils@2.14.11
294
+ - @atlaspack/types@2.15.1
295
+ - @atlaspack/plugin@2.14.11
296
+
297
+ ## 2.15.6
298
+
299
+ ### Patch Changes
300
+
301
+ - Updated dependencies [[`51aba5f`](https://github.com/atlassian-labs/atlaspack/commit/51aba5fc0e49235ee06bbc3c376f48c3e7da5c4b), [`1e32d4e`](https://github.com/atlassian-labs/atlaspack/commit/1e32d4eae6b3af3968e8a0ef97d35b4347fd4196)]:
302
+ - @atlaspack/types@2.15.0
303
+ - @atlaspack/plugin@2.14.10
304
+ - @atlaspack/utils@2.14.10
305
+
306
+ ## 2.15.5
307
+
308
+ ### Patch Changes
309
+
310
+ - Updated dependencies []:
311
+ - @atlaspack/utils@2.14.9
312
+ - @atlaspack/types@2.14.9
313
+ - @atlaspack/plugin@2.14.9
314
+
3
315
  ## 2.15.4
4
316
 
5
317
  ### Patch Changes
@@ -0,0 +1,304 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports._report = _report;
40
+ const feature_flags_1 = require("@atlaspack/feature-flags");
41
+ const plugin_1 = require("@atlaspack/plugin");
42
+ const utils_1 = require("@atlaspack/utils");
43
+ const chalk_1 = __importDefault(require("chalk"));
44
+ const utils_2 = require("./utils");
45
+ const logLevels_1 = __importDefault(require("./logLevels"));
46
+ const bundleReport_1 = __importDefault(require("./bundleReport"));
47
+ const phaseReport_1 = __importDefault(require("./phaseReport"));
48
+ const render_1 = require("./render");
49
+ const emoji = __importStar(require("./emoji"));
50
+ // @ts-expect-error TS7016
51
+ const wrap_ansi_1 = __importDefault(require("wrap-ansi"));
52
+ const THROTTLE_DELAY = 100;
53
+ const seenWarnings = new Set();
54
+ const seenPhases = new Set();
55
+ const seenPhasesGen = new Set();
56
+ let phaseStartTimes = {};
57
+ let pendingIncrementalBuild = false;
58
+ let packagingProgress = 0;
59
+ let updatePackageProgress = (completeBundles, totalBundles) => {
60
+ let updateThreshold = 0;
61
+ if (totalBundles > 5000) {
62
+ // If more than 5000 bundles, update every 5%
63
+ updateThreshold = 5;
64
+ }
65
+ else if (totalBundles > 1000) {
66
+ // If more than 1000 bundles, update every 10%
67
+ updateThreshold = 10;
68
+ }
69
+ else {
70
+ // othewise update every 25%
71
+ updateThreshold = 25;
72
+ }
73
+ let percent = Math.floor((completeBundles / totalBundles) * 100);
74
+ if (percent - packagingProgress >= updateThreshold) {
75
+ packagingProgress = percent;
76
+ (0, render_1.updateSpinner)((0, utils_1.getPackageProgressMessage)(completeBundles, totalBundles));
77
+ }
78
+ };
79
+ let statusThrottle = (0, utils_1.throttle)((message) => {
80
+ (0, render_1.updateSpinner)(message);
81
+ }, THROTTLE_DELAY);
82
+ const cacheWriteState = {
83
+ startTime: null,
84
+ };
85
+ function calculateWrappingStats(scopeHoistingStats, logger) {
86
+ if (!scopeHoistingStats) {
87
+ logger.info({
88
+ message: 'No scope hoisting data collected.',
89
+ origin: '@atlaspack/reporter-cli',
90
+ });
91
+ return;
92
+ }
93
+ let { totalAssets, wrappedAssets } = scopeHoistingStats;
94
+ let hoistedAssets = totalAssets - wrappedAssets;
95
+ let percentage = totalAssets > 0 ? (hoistedAssets / totalAssets) * 100 : 0;
96
+ (0, render_1.table)([{ align: 'left' }, { align: 'right' }], [
97
+ ['Wrapped Assets', wrappedAssets.toString()],
98
+ ['Total Assets', totalAssets.toString()],
99
+ ['Hoisted Assets', hoistedAssets.toString()],
100
+ ['Percentage Hoisted', `${percentage.toFixed(3)}%`],
101
+ ]);
102
+ }
103
+ // Exported only for test
104
+ async function _report(event, options, logger) {
105
+ let logLevelFilter = logLevels_1.default[options.logLevel || 'info'];
106
+ switch (event.type) {
107
+ case 'buildStart': {
108
+ seenWarnings.clear();
109
+ seenPhases.clear();
110
+ if (logLevelFilter < logLevels_1.default.info) {
111
+ break;
112
+ }
113
+ // Clear any previous output
114
+ (0, render_1.resetWindow)();
115
+ if (options.serveOptions) {
116
+ (0, render_1.persistMessage)(chalk_1.default.blue.bold(`Server running at ${options.serveOptions.https ? 'https' : 'http'}://${options.serveOptions.host ?? 'localhost'}:${options.serveOptions.port}`));
117
+ }
118
+ break;
119
+ }
120
+ case 'buildProgress': {
121
+ if (logLevelFilter < logLevels_1.default.info) {
122
+ break;
123
+ }
124
+ if (pendingIncrementalBuild) {
125
+ pendingIncrementalBuild = false;
126
+ phaseStartTimes = {};
127
+ seenPhasesGen.clear();
128
+ seenPhases.clear();
129
+ }
130
+ if (!seenPhasesGen.has(event.phase)) {
131
+ phaseStartTimes[event.phase] = Date.now();
132
+ seenPhasesGen.add(event.phase);
133
+ }
134
+ if ((0, feature_flags_1.getFeatureFlag)('cliProgressReportingImprovements') &&
135
+ (event.phase === 'packaging' || event.phase === 'optimizing')) {
136
+ // If the flag is turned on, we ignore the old `packaging` and
137
+ // `optimizing` event types, and only consider `packagingAndOptimizing`
138
+ // events
139
+ break;
140
+ }
141
+ if (!render_1.isTTY && logLevelFilter != logLevels_1.default.verbose) {
142
+ if (event.phase == 'transforming' && !seenPhases.has('transforming')) {
143
+ (0, render_1.updateSpinner)('Building...');
144
+ }
145
+ else if (event.phase == 'bundling' && !seenPhases.has('bundling')) {
146
+ (0, render_1.updateSpinner)('Bundling...');
147
+ }
148
+ else if (event.phase === 'packagingAndOptimizing') {
149
+ updatePackageProgress(event.completeBundles, event.totalBundles);
150
+ }
151
+ else if ((event.phase == 'packaging' || event.phase == 'optimizing') &&
152
+ !seenPhases.has('packaging') &&
153
+ !seenPhases.has('optimizing')) {
154
+ (0, render_1.updateSpinner)('Packaging & Optimizing...');
155
+ }
156
+ seenPhases.add(event.phase);
157
+ break;
158
+ }
159
+ let message = (0, utils_1.getProgressMessage)(event);
160
+ if (message != null) {
161
+ if (render_1.isTTY) {
162
+ statusThrottle(chalk_1.default.gray.bold(message));
163
+ }
164
+ else {
165
+ (0, render_1.updateSpinner)(message);
166
+ }
167
+ }
168
+ break;
169
+ }
170
+ case 'buildSuccess':
171
+ if (logLevelFilter < logLevels_1.default.info) {
172
+ break;
173
+ }
174
+ phaseStartTimes['buildSuccess'] = Date.now();
175
+ (0, render_1.persistSpinner)('buildProgress', 'success', chalk_1.default.green.bold(`Built in ${(0, utils_1.prettifyTime)(event.buildTime)}`));
176
+ if (options.mode === 'production') {
177
+ if (utils_1.debugTools['scope-hoisting-stats']) {
178
+ calculateWrappingStats(event.scopeHoistingStats, logger);
179
+ }
180
+ if (utils_1.debugTools['simple-cli-reporter']) {
181
+ (0, render_1.writeOut)(`🛠️ Built ${event.bundleGraph.getBundles().length} bundles.`);
182
+ }
183
+ else {
184
+ await (0, bundleReport_1.default)(event.bundleGraph, options.outputFS, options.projectRoot, options.detailedReport?.assetsPerBundle);
185
+ }
186
+ }
187
+ else {
188
+ pendingIncrementalBuild = true;
189
+ }
190
+ if (process.env.ATLASPACK_SHOW_PHASE_TIMES) {
191
+ (0, phaseReport_1.default)(phaseStartTimes);
192
+ }
193
+ break;
194
+ case 'buildFailure':
195
+ if (logLevelFilter < logLevels_1.default.error) {
196
+ break;
197
+ }
198
+ (0, render_1.resetWindow)();
199
+ (0, render_1.persistSpinner)('buildProgress', 'error', chalk_1.default.red.bold('Build failed.'));
200
+ await writeDiagnostic(options, event.diagnostics, 'red', true);
201
+ break;
202
+ case 'cache':
203
+ if (event.size > 500000) {
204
+ switch (event.phase) {
205
+ case 'start':
206
+ (0, render_1.updateSpinner)('Writing cache to disk');
207
+ cacheWriteState.startTime = Date.now();
208
+ break;
209
+ case 'end':
210
+ (0, render_1.persistSpinner)('cache', 'success', chalk_1.default.grey.bold(`Cache written to disk in ${(0, utils_1.prettifyTime)(Date.now() - (cacheWriteState.startTime ?? 0))}`));
211
+ cacheWriteState.startTime = null;
212
+ break;
213
+ }
214
+ }
215
+ break;
216
+ case 'log': {
217
+ if (logLevelFilter < logLevels_1.default[event.level]) {
218
+ break;
219
+ }
220
+ switch (event.level) {
221
+ case 'success':
222
+ (0, render_1.writeOut)(chalk_1.default.green(event.message));
223
+ break;
224
+ case 'progress':
225
+ (0, render_1.writeOut)(event.message);
226
+ break;
227
+ case 'verbose':
228
+ case 'info':
229
+ await writeDiagnostic(options, event.diagnostics, 'blue');
230
+ break;
231
+ case 'warn':
232
+ if (event.diagnostics.some((diagnostic) => !seenWarnings.has(diagnostic.message))) {
233
+ await writeDiagnostic(options, event.diagnostics, 'yellow', true);
234
+ for (let diagnostic of event.diagnostics) {
235
+ seenWarnings.add(diagnostic.message);
236
+ }
237
+ }
238
+ break;
239
+ case 'error':
240
+ await writeDiagnostic(options, event.diagnostics, 'red', true);
241
+ break;
242
+ default:
243
+ // @ts-expect-error TS2339
244
+ throw new Error('Unknown log level ' + event.level);
245
+ }
246
+ }
247
+ }
248
+ }
249
+ async function writeDiagnostic(options, diagnostics,
250
+ // @ts-expect-error TS2749
251
+ color, isError = false) {
252
+ let columns = (0, utils_2.getTerminalWidth)().columns;
253
+ let indent = 2;
254
+ let spaceAfter = isError;
255
+ for (let diagnostic of diagnostics) {
256
+ let { message, stack, codeframe, hints, documentation } = await (0, utils_1.prettyDiagnostic)(diagnostic, options, columns - indent);
257
+ // @ts-expect-error TS7053
258
+ message = chalk_1.default[color](message);
259
+ if (spaceAfter) {
260
+ (0, render_1.writeOut)('');
261
+ }
262
+ if (message) {
263
+ (0, render_1.writeOut)(wrapWithIndent(message), isError);
264
+ }
265
+ if (stack || codeframe) {
266
+ (0, render_1.writeOut)('');
267
+ }
268
+ if (stack) {
269
+ (0, render_1.writeOut)(chalk_1.default.gray(wrapWithIndent(stack, indent)), isError);
270
+ }
271
+ if (codeframe) {
272
+ (0, render_1.writeOut)(indentString(codeframe, indent), isError);
273
+ }
274
+ if ((stack || codeframe) && (hints.length > 0 || documentation)) {
275
+ (0, render_1.writeOut)('');
276
+ }
277
+ // Write hints
278
+ let hintIndent = stack || codeframe ? indent : 0;
279
+ for (let hint of hints) {
280
+ (0, render_1.writeOut)(wrapWithIndent(`${emoji.hint} ${chalk_1.default.blue.bold(hint)}`, hintIndent + 3, hintIndent));
281
+ }
282
+ if (documentation) {
283
+ (0, render_1.writeOut)(wrapWithIndent(`${emoji.docs} ${chalk_1.default.magenta.bold(documentation)}`, hintIndent + 3, hintIndent));
284
+ }
285
+ // @ts-expect-error TS2322
286
+ spaceAfter = stack || codeframe || hints.length > 0 || documentation;
287
+ }
288
+ if (spaceAfter) {
289
+ (0, render_1.writeOut)('');
290
+ }
291
+ }
292
+ function wrapWithIndent(string, indent = 0, initialIndent = indent) {
293
+ let width = (0, utils_2.getTerminalWidth)().columns;
294
+ return indentString((0, wrap_ansi_1.default)(string.trimEnd(), width - indent, { trim: false }), indent, initialIndent);
295
+ }
296
+ // @ts-expect-error TS7006
297
+ function indentString(string, indent = 0, initialIndent = indent) {
298
+ return (' '.repeat(initialIndent) + string.replace(/\n/g, '\n' + ' '.repeat(indent)));
299
+ }
300
+ exports.default = new plugin_1.Reporter({
301
+ report({ event, options, logger }) {
302
+ return _report(event, options, logger);
303
+ },
304
+ });