@atlaspack/reporter-cli 2.15.1-canary.36 → 2.15.1-canary.360

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,389 @@
1
1
  # @atlaspack/reporter-cli
2
2
 
3
+ ## 2.17.30
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`47aa84e`](https://github.com/atlassian-labs/atlaspack/commit/47aa84e44c61066072a5bf3d57678565b9d2c5a3)]:
8
+ - @atlaspack/utils@3.3.0
9
+ - @atlaspack/types@2.15.38
10
+ - @atlaspack/plugin@2.14.48
11
+
12
+ ## 2.17.29
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies []:
17
+ - @atlaspack/utils@3.2.8
18
+ - @atlaspack/types@2.15.37
19
+ - @atlaspack/plugin@2.14.47
20
+
21
+ ## 2.17.28
22
+
23
+ ### Patch Changes
24
+
25
+ - Updated dependencies []:
26
+ - @atlaspack/utils@3.2.7
27
+ - @atlaspack/plugin@2.14.46
28
+ - @atlaspack/types@2.15.36
29
+
30
+ ## 2.17.27
31
+
32
+ ### Patch Changes
33
+
34
+ - Updated dependencies []:
35
+ - @atlaspack/utils@3.2.6
36
+ - @atlaspack/plugin@2.14.45
37
+ - @atlaspack/types@2.15.35
38
+
39
+ ## 2.17.26
40
+
41
+ ### Patch Changes
42
+
43
+ - Updated dependencies []:
44
+ - @atlaspack/utils@3.2.5
45
+ - @atlaspack/plugin@2.14.44
46
+ - @atlaspack/types@2.15.34
47
+
48
+ ## 2.17.25
49
+
50
+ ### Patch Changes
51
+
52
+ - Updated dependencies []:
53
+ - @atlaspack/plugin@2.14.43
54
+ - @atlaspack/types@2.15.33
55
+ - @atlaspack/utils@3.2.4
56
+
57
+ ## 2.17.24
58
+
59
+ ### Patch Changes
60
+
61
+ - Updated dependencies []:
62
+ - @atlaspack/utils@3.2.3
63
+ - @atlaspack/plugin@2.14.42
64
+ - @atlaspack/types@2.15.32
65
+
66
+ ## 2.17.23
67
+
68
+ ### Patch Changes
69
+
70
+ - Updated dependencies []:
71
+ - @atlaspack/utils@3.2.2
72
+ - @atlaspack/plugin@2.14.41
73
+ - @atlaspack/types@2.15.31
74
+
75
+ ## 2.17.22
76
+
77
+ ### Patch Changes
78
+
79
+ - Updated dependencies []:
80
+ - @atlaspack/utils@3.2.1
81
+ - @atlaspack/plugin@2.14.40
82
+ - @atlaspack/types@2.15.30
83
+
84
+ ## 2.17.21
85
+
86
+ ### Patch Changes
87
+
88
+ - Updated dependencies [[`73168c2`](https://github.com/atlassian-labs/atlaspack/commit/73168c275a5d9abff9907bcf536b340bca1ed5f0), [`617a318`](https://github.com/atlassian-labs/atlaspack/commit/617a318ddc9419b38360257353fec50b9051ee13)]:
89
+ - @atlaspack/utils@3.2.0
90
+ - @atlaspack/plugin@2.14.39
91
+ - @atlaspack/types@2.15.29
92
+
93
+ ## 2.17.20
94
+
95
+ ### Patch Changes
96
+
97
+ - Updated dependencies [[`7d7a55d`](https://github.com/atlassian-labs/atlaspack/commit/7d7a55dd6395ec391a2e4c33b3dec0d1ea477d4c)]:
98
+ - @atlaspack/utils@3.1.2
99
+ - @atlaspack/plugin@2.14.38
100
+ - @atlaspack/types@2.15.28
101
+
102
+ ## 2.17.19
103
+
104
+ ### Patch Changes
105
+
106
+ - Updated dependencies []:
107
+ - @atlaspack/utils@3.1.1
108
+ - @atlaspack/plugin@2.14.37
109
+ - @atlaspack/types@2.15.27
110
+
111
+ ## 2.17.18
112
+
113
+ ### Patch Changes
114
+
115
+ - Updated dependencies [[`5776be2`](https://github.com/atlassian-labs/atlaspack/commit/5776be21f70a3f2b9471ba33da3ba1a883f21f1a)]:
116
+ - @atlaspack/utils@3.1.0
117
+ - @atlaspack/plugin@2.14.36
118
+ - @atlaspack/types@2.15.26
119
+
120
+ ## 2.17.17
121
+
122
+ ### Patch Changes
123
+
124
+ - [#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.
125
+
126
+ - Updated dependencies [[`c372f3f`](https://github.com/atlassian-labs/atlaspack/commit/c372f3fd6fce8200d5cf47f41bc7895c6cbb5558), [`17dfea9`](https://github.com/atlassian-labs/atlaspack/commit/17dfea9e9f3169807808520df9c09ebf70dc8b10)]:
127
+ - @atlaspack/utils@3.0.3
128
+ - @atlaspack/plugin@2.14.35
129
+ - @atlaspack/types@2.15.25
130
+
131
+ ## 2.17.16
132
+
133
+ ### Patch Changes
134
+
135
+ - Updated dependencies []:
136
+ - @atlaspack/types@2.15.24
137
+ - @atlaspack/utils@3.0.2
138
+ - @atlaspack/plugin@2.14.34
139
+
140
+ ## 2.17.15
141
+
142
+ ### Patch Changes
143
+
144
+ - Updated dependencies [[`236e546`](https://github.com/atlassian-labs/atlaspack/commit/236e5465863dca6044a7191e05260a5b924c342e)]:
145
+ - @atlaspack/utils@3.0.1
146
+ - @atlaspack/types@2.15.23
147
+ - @atlaspack/plugin@2.14.33
148
+
149
+ ## 2.17.14
150
+
151
+ ### Patch Changes
152
+
153
+ - [#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.
154
+
155
+ - Updated dependencies [[`1180103`](https://github.com/atlassian-labs/atlaspack/commit/118010351ed444f8178988afb3f77807154dd933)]:
156
+ - @atlaspack/utils@3.0.0
157
+ - @atlaspack/plugin@2.14.32
158
+ - @atlaspack/types@2.15.22
159
+
160
+ ## 2.17.13
161
+
162
+ ### Patch Changes
163
+
164
+ - [#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.
165
+
166
+ - Updated dependencies [[`0e7dd5e`](https://github.com/atlassian-labs/atlaspack/commit/0e7dd5ec6fbe05aa9e0bb5775a9d0975f206a922)]:
167
+ - @atlaspack/plugin@2.14.31
168
+ - @atlaspack/types@2.15.21
169
+ - @atlaspack/utils@2.19.3
170
+
171
+ ## 2.17.12
172
+
173
+ ### Patch Changes
174
+
175
+ - Updated dependencies []:
176
+ - @atlaspack/utils@2.19.2
177
+ - @atlaspack/plugin@2.14.30
178
+ - @atlaspack/types@2.15.20
179
+
180
+ ## 2.17.11
181
+
182
+ ### Patch Changes
183
+
184
+ - Updated dependencies []:
185
+ - @atlaspack/utils@2.19.1
186
+ - @atlaspack/plugin@2.14.29
187
+ - @atlaspack/types@2.15.19
188
+
189
+ ## 2.17.10
190
+
191
+ ### Patch Changes
192
+
193
+ - Updated dependencies [[`f0349a6`](https://github.com/atlassian-labs/atlaspack/commit/f0349a6b9b04755088f121095ca6301a2ada3767)]:
194
+ - @atlaspack/utils@2.19.0
195
+ - @atlaspack/plugin@2.14.28
196
+ - @atlaspack/types@2.15.18
197
+
198
+ ## 2.17.9
199
+
200
+ ### Patch Changes
201
+
202
+ - Updated dependencies []:
203
+ - @atlaspack/utils@2.18.4
204
+ - @atlaspack/plugin@2.14.27
205
+ - @atlaspack/types@2.15.17
206
+
207
+ ## 2.17.8
208
+
209
+ ### Patch Changes
210
+
211
+ - [#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
212
+
213
+ - Updated dependencies [[`ee040bb`](https://github.com/atlassian-labs/atlaspack/commit/ee040bb6428f29b57d892ddd8107e29077d08ffd), [`889c65c`](https://github.com/atlassian-labs/atlaspack/commit/889c65cd25b811045e26a117e7404f694dde77a2)]:
214
+ - @atlaspack/plugin@2.14.26
215
+ - @atlaspack/types@2.15.16
216
+ - @atlaspack/utils@2.18.3
217
+
218
+ ## 2.17.7
219
+
220
+ ### Patch Changes
221
+
222
+ - Updated dependencies []:
223
+ - @atlaspack/utils@2.18.2
224
+ - @atlaspack/plugin@2.14.25
225
+ - @atlaspack/types@2.15.15
226
+
227
+ ## 2.17.6
228
+
229
+ ### Patch Changes
230
+
231
+ - Updated dependencies []:
232
+ - @atlaspack/utils@2.18.1
233
+ - @atlaspack/plugin@2.14.24
234
+ - @atlaspack/types@2.15.14
235
+
236
+ ## 2.17.5
237
+
238
+ ### Patch Changes
239
+
240
+ - Updated dependencies [[`23d561e`](https://github.com/atlassian-labs/atlaspack/commit/23d561e51e68b0c38fd1ff4e4fb173e5e7b01cf2)]:
241
+ - @atlaspack/utils@2.18.0
242
+ - @atlaspack/types@2.15.13
243
+ - @atlaspack/plugin@2.14.23
244
+
245
+ ## 2.17.4
246
+
247
+ ### Patch Changes
248
+
249
+ - [#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
250
+
251
+ - Updated dependencies [[`d2fd849`](https://github.com/atlassian-labs/atlaspack/commit/d2fd849770fe6305e9c694bd97b1bd905abd9d94)]:
252
+ - @atlaspack/plugin@2.14.22
253
+ - @atlaspack/types@2.15.12
254
+ - @atlaspack/utils@2.17.4
255
+
256
+ ## 2.17.3
257
+
258
+ ### Patch Changes
259
+
260
+ - Updated dependencies []:
261
+ - @atlaspack/types@2.15.11
262
+ - @atlaspack/utils@2.17.3
263
+ - @atlaspack/plugin@2.14.21
264
+
265
+ ## 2.17.2
266
+
267
+ ### Patch Changes
268
+
269
+ - Updated dependencies [[`daaa768`](https://github.com/atlassian-labs/atlaspack/commit/daaa7688786772d7e3713b71c5bba6b89ec704aa)]:
270
+ - @atlaspack/plugin@2.14.20
271
+ - @atlaspack/utils@2.17.2
272
+ - @atlaspack/types@2.15.10
273
+
274
+ ## 2.17.1
275
+
276
+ ### Patch Changes
277
+
278
+ - Updated dependencies []:
279
+ - @atlaspack/utils@2.17.1
280
+ - @atlaspack/types@2.15.9
281
+ - @atlaspack/plugin@2.14.19
282
+
283
+ ## 2.17.0
284
+
285
+ ### Minor Changes
286
+
287
+ - [#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).
288
+
289
+ Rectifying by creating a new changeset now.
290
+
291
+ ### Patch Changes
292
+
293
+ - [#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
294
+
295
+ - [#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
296
+
297
+ - 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)]:
298
+ - @atlaspack/utils@2.17.0
299
+ - @atlaspack/types@2.15.8
300
+ - @atlaspack/plugin@2.14.18
301
+
302
+ ## 2.16.1
303
+
304
+ ### Patch Changes
305
+
306
+ - Updated dependencies []:
307
+ - @atlaspack/utils@2.16.1
308
+ - @atlaspack/types@2.15.7
309
+ - @atlaspack/plugin@2.14.17
310
+
311
+ ## 2.16.0
312
+
313
+ ### Minor Changes
314
+
315
+ - [#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.
316
+
317
+ ### Patch Changes
318
+
319
+ - Updated dependencies [[`30ee2cf`](https://github.com/atlassian-labs/atlaspack/commit/30ee2cfcd34cf2646ded0eda13fdb80a2a5de529)]:
320
+ - @atlaspack/utils@2.16.0
321
+ - @atlaspack/types@2.15.6
322
+ - @atlaspack/plugin@2.14.16
323
+
324
+ ## 2.15.11
325
+
326
+ ### Patch Changes
327
+
328
+ - Updated dependencies []:
329
+ - @atlaspack/utils@2.15.3
330
+ - @atlaspack/types@2.15.5
331
+ - @atlaspack/plugin@2.14.15
332
+
333
+ ## 2.15.10
334
+
335
+ ### Patch Changes
336
+
337
+ - Updated dependencies []:
338
+ - @atlaspack/utils@2.15.2
339
+ - @atlaspack/types@2.15.4
340
+ - @atlaspack/plugin@2.14.14
341
+
342
+ ## 2.15.9
343
+
344
+ ### Patch Changes
345
+
346
+ - Updated dependencies []:
347
+ - @atlaspack/types@2.15.3
348
+ - @atlaspack/utils@2.15.1
349
+ - @atlaspack/plugin@2.14.13
350
+
351
+ ## 2.15.8
352
+
353
+ ### Patch Changes
354
+
355
+ - Updated dependencies [[`e39c6cf`](https://github.com/atlassian-labs/atlaspack/commit/e39c6cf05f7e95ce5420dbcea66f401b1cbd397c)]:
356
+ - @atlaspack/utils@2.15.0
357
+ - @atlaspack/types@2.15.2
358
+ - @atlaspack/plugin@2.14.12
359
+
360
+ ## 2.15.7
361
+
362
+ ### Patch Changes
363
+
364
+ - Updated dependencies []:
365
+ - @atlaspack/utils@2.14.11
366
+ - @atlaspack/types@2.15.1
367
+ - @atlaspack/plugin@2.14.11
368
+
369
+ ## 2.15.6
370
+
371
+ ### Patch Changes
372
+
373
+ - Updated dependencies [[`51aba5f`](https://github.com/atlassian-labs/atlaspack/commit/51aba5fc0e49235ee06bbc3c376f48c3e7da5c4b), [`1e32d4e`](https://github.com/atlassian-labs/atlaspack/commit/1e32d4eae6b3af3968e8a0ef97d35b4347fd4196)]:
374
+ - @atlaspack/types@2.15.0
375
+ - @atlaspack/plugin@2.14.10
376
+ - @atlaspack/utils@2.14.10
377
+
378
+ ## 2.15.5
379
+
380
+ ### Patch Changes
381
+
382
+ - Updated dependencies []:
383
+ - @atlaspack/utils@2.14.9
384
+ - @atlaspack/types@2.14.9
385
+ - @atlaspack/plugin@2.14.9
386
+
3
387
  ## 2.15.4
4
388
 
5
389
  ### 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
+ });