@ui5/logger 5.0.0-alpha.1 → 5.0.0-alpha.11

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
@@ -4,6 +4,86 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html
4
4
 
5
5
  A list of unreleased changes can be found [here](https://github.com/SAP/ui5-logger/compare/v4.0.2...HEAD).
6
6
 
7
+ ## [5.0.0-alpha.11](https://github.com/UI5/cli/compare/logger-v5.0.0-alpha.10...logger-v5.0.0-alpha.11) (2026-09-25)
8
+
9
+
10
+ ### Features
11
+
12
+ * **logger:** Add written resource paths to task-end build-status event ([982ee59](https://github.com/UI5/cli/commit/982ee5914bd694da9d8a91ae23d4e7d4264647d9))
13
+
14
+ ## [5.0.0-alpha.10](https://github.com/UI5/cli/compare/logger-v5.0.0-alpha.9...logger-v5.0.0-alpha.10) (2026-09-14)
15
+
16
+
17
+ ### chore
18
+
19
+ * **logger:** Synchronize ui5-cli-packages versions
20
+
21
+ ## [5.0.0-alpha.9](https://github.com/UI5/cli/compare/logger-v5.0.0-alpha.8...logger-v5.0.0-alpha.9) (2026-09-02)
22
+
23
+
24
+ ### Dependencies
25
+
26
+ * Bump chalk from 5.6.2 to 6.0.0 ([62a3e39](https://github.com/UI5/cli/commit/62a3e3971ca3079b7cbfb6cfd4c28bd2e902e767))
27
+
28
+ ## [5.0.0-alpha.8](https://github.com/UI5/cli/compare/logger-v5.0.0-alpha.7...logger-v5.0.0-alpha.8) (2026-08-14)
29
+
30
+
31
+ ### ⚠ BREAKING CHANGES
32
+
33
+ * Require Node.js ^22.22.2 || ^24.15.0 || >=26.0.0 ([#1522](https://github.com/UI5/cli/issues/1522))
34
+
35
+ ### Dependencies
36
+
37
+ * Require Node.js ^22.22.2 || ^24.15.0 || >=26.0.0 ([#1522](https://github.com/UI5/cli/issues/1522)) ([f02105e](https://github.com/UI5/cli/commit/f02105e9a75a6c82526343dc47c4aaf9bccdc6ae))
38
+
39
+ ## [5.0.0-alpha.7](https://github.com/UI5/cli/compare/logger-v5.0.0-alpha.6...logger-v5.0.0-alpha.7) (2026-08-05)
40
+
41
+
42
+ ### Bug Fixes
43
+
44
+ * Refine interactive serve logging and warning messaging ([#1483](https://github.com/UI5/cli/issues/1483)) ([acd707b](https://github.com/UI5/cli/commit/acd707b18ec7c8453b9210307574e837a19cca4d))
45
+ * Show resolved framework version in serve console output ([3210e8b](https://github.com/UI5/cli/commit/3210e8b4f1e212621b03afb6f0b888a32aa19f3e))
46
+
47
+ ## [5.0.0-alpha.6](https://github.com/UI5/cli/compare/logger-v5.0.0-alpha.5...logger-v5.0.0-alpha.6) (2026-07-10)
48
+
49
+
50
+ ### Features
51
+
52
+ * Add live status banner to ui5 serve ([#1439](https://github.com/UI5/cli/issues/1439)) ([2a46c8b](https://github.com/UI5/cli/commit/2a46c8b97f3613314cd61507417f97b079943bce))
53
+
54
+ ## [5.0.0-alpha.5](https://github.com/UI5/cli/compare/logger-v5.0.0-alpha.4...logger-v5.0.0-alpha.5) (2026-06-24)
55
+
56
+
57
+ ### Features
58
+
59
+ * **logger:** Add differential build logging support ([0c06880](https://github.com/UI5/cli/commit/0c0688047e699330b1a98a5845dc04b25db3db6c))
60
+
61
+
62
+ ### Dependencies
63
+
64
+ * Update npm dependencies ([0ac8ebb](https://github.com/UI5/cli/commit/0ac8ebbb5ffe9fc6e4455244cf5da50e4c540c5c))
65
+
66
+ ## [5.0.0-alpha.4](https://github.com/UI5/cli/compare/logger-v5.0.0-alpha.3...logger-v5.0.0-alpha.4) (2026-03-24)
67
+
68
+
69
+ ### chore
70
+
71
+ * **logger:** Synchronize ui5-cli-packages versions
72
+
73
+ ## [5.0.0-alpha.3](https://github.com/UI5/cli/compare/logger-v5.0.0-alpha.2...logger-v5.0.0-alpha.3) (2026-02-13)
74
+
75
+
76
+ ### chore
77
+
78
+ * **logger:** Synchronize ui5-cli-packages versions
79
+
80
+ ## [5.0.0-alpha.2](https://github.com/UI5/cli/compare/logger-v5.0.0-alpha.1...logger-v5.0.0-alpha.2) (2025-12-15)
81
+
82
+
83
+ ### chore
84
+
85
+ * **logger:** Synchronize ui5-cli-packages versions
86
+
7
87
  <a name="5.0.0-alpha.1"></a>
8
88
  ## [5.0.0-alpha.1](https://github.com/UI5/cli/compare/logger-v5.0.0-alpha.0...logger-v5.0.0-alpha.1) (2025-12-10)
9
89
 
@@ -48,7 +48,7 @@ class ProjectBuild extends Logger {
48
48
  });
49
49
  }
50
50
 
51
- startTask(taskName) {
51
+ startTask(taskName, isDifferentialBuild) {
52
52
  if (!this.#tasksToRun || !this.#tasksToRun.includes(taskName)) {
53
53
  throw new Error(`loggers/ProjectBuild#startTask: Unknown task ${taskName}`);
54
54
  }
@@ -59,6 +59,7 @@ class ProjectBuild extends Logger {
59
59
  projectType: this.#projectType,
60
60
  taskName,
61
61
  status: "task-start",
62
+ isDifferentialBuild,
62
63
  });
63
64
 
64
65
  if (!hasListeners) {
@@ -66,7 +67,7 @@ class ProjectBuild extends Logger {
66
67
  }
67
68
  }
68
69
 
69
- endTask(taskName) {
70
+ endTask(taskName, isDifferentialBuild, writtenResourcePaths) {
70
71
  if (!this.#tasksToRun || !this.#tasksToRun.includes(taskName)) {
71
72
  throw new Error(`loggers/ProjectBuild#endTask: Unknown task ${taskName}`);
72
73
  }
@@ -77,6 +78,8 @@ class ProjectBuild extends Logger {
77
78
  projectType: this.#projectType,
78
79
  taskName,
79
80
  status: "task-end",
81
+ isDifferentialBuild,
82
+ writtenResourcePaths,
80
83
  });
81
84
 
82
85
  if (!hasListeners) {
@@ -0,0 +1,92 @@
1
+ import prettyHrtime from "pretty-hrtime";
2
+ import Logger from "./Logger.js";
3
+
4
+ /**
5
+ * Logger for emitting status events on the lifecycle of a UI5 development server
6
+ * (idle / stale / settling / building / build-done / error).
7
+ * <br><br>
8
+ * Emits <code>ui5.log</code> and <code>ui5.serve-status</code> events on the
9
+ * [<code>process</code>]{@link https://nodejs.org/api/process.html} object, which can be handled
10
+ * by dedicated writers, like [@ui5/logger/writers/Console]{@link @ui5/logger/writers/Console}
11
+ * or the live banner shipped by <code>@ui5/cli</code>.
12
+ * <br><br>
13
+ * If no listener is attached to the event, messages are written directly to the <code>process.stderr</code> stream.
14
+ *
15
+ * @private
16
+ * @class
17
+ * @alias @ui5/logger/loggers/Serve
18
+ */
19
+ class Serve extends Logger {
20
+ static SERVE_STATUS_EVENT_NAME = "ui5.serve-status";
21
+
22
+ // Emit a `ui5.serve-status` event; if no listener is attached, fall back to
23
+ // a plain log line at the same level. All public status methods route
24
+ // through here so the event payload shape (`{level, status, ...}`) and the
25
+ // no-listener fallback stay in sync across states.
26
+ #emitStatus(status, payload, fallbackMessage, {level = "info"} = {}) {
27
+ const hasListeners = this._emit(Serve.SERVE_STATUS_EVENT_NAME, {
28
+ level,
29
+ status,
30
+ ...payload,
31
+ });
32
+ if (!hasListeners) {
33
+ this._log(level, fallbackMessage);
34
+ }
35
+ }
36
+
37
+ ready() {
38
+ this.#emitStatus("serve-ready", {}, `Server ready`);
39
+ }
40
+
41
+ // Emits the current stale-project set. An empty list means every project is up-to-date.
42
+ stale(staleProjects) {
43
+ if (!staleProjects || !Array.isArray(staleProjects)) {
44
+ throw new Error("loggers/Serve#stale: Missing or incorrect staleProjects parameter");
45
+ }
46
+ this.#emitStatus("serve-stale", {staleProjects},
47
+ staleProjects.length ?
48
+ `Stale projects: ${staleProjects.join(", ")}` :
49
+ `All projects up-to-date`);
50
+ }
51
+
52
+ settling(pendingProjects) {
53
+ if (!pendingProjects || !Array.isArray(pendingProjects)) {
54
+ throw new Error("loggers/Serve#settling: Missing or incorrect pendingProjects parameter");
55
+ }
56
+ this.#emitStatus("serve-settling", {pendingProjects},
57
+ `Waiting for changes to settle in: ${pendingProjects.join(", ")}`);
58
+ }
59
+
60
+ validating(validatingProjects) {
61
+ if (!validatingProjects || !Array.isArray(validatingProjects)) {
62
+ throw new Error(
63
+ "loggers/Serve#validating: Missing or incorrect validatingProjects parameter");
64
+ }
65
+ this.#emitStatus("serve-validating", {validatingProjects},
66
+ `Validating caches for: ${validatingProjects.join(", ")}`);
67
+ }
68
+
69
+ building() {
70
+ this.#emitStatus("serve-building", {}, `Building...`);
71
+ }
72
+
73
+ buildDone(hrtime) {
74
+ if (!Array.isArray(hrtime) || hrtime.length !== 2 ||
75
+ typeof hrtime[0] !== "number" || typeof hrtime[1] !== "number") {
76
+ throw new Error("loggers/Serve#buildDone: Missing or incorrect hrtime parameter");
77
+ }
78
+ this.#emitStatus("serve-build-done", {hrtime},
79
+ `Build finished in ${prettyHrtime(hrtime)}`);
80
+ }
81
+
82
+ // Named serveError rather than error to avoid shadowing Logger.prototype.error
83
+ serveError(error) {
84
+ if (!error) {
85
+ throw new Error("loggers/Serve#serveError: Missing error parameter");
86
+ }
87
+ this.#emitStatus("serve-error", {error},
88
+ `Server error: ${error.message || error}`, {level: "error"});
89
+ }
90
+ }
91
+
92
+ export default Serve;
@@ -3,6 +3,8 @@ import {chalkStderr as chalk} from "chalk";
3
3
  import figures from "figures";
4
4
  import {MultiBar} from "cli-progress";
5
5
  import Logger from "../loggers/Logger.js";
6
+ import {formatLogLine, prefixModuleName} from "./internal/format.js";
7
+ import {REMOTE_CONNECTIONS_WARNING_LINES} from "./interactiveConsole/remoteConnectionsWarning.js";
6
8
 
7
9
  /**
8
10
  * Standard handler for events emitted by @ui5/logger modules. Writes messages to
@@ -29,6 +31,8 @@ class Console {
29
31
  this._handleProjectBuildStatusEvent = this.#handleProjectBuildStatusEvent.bind(this);
30
32
  this._handleBuildMetadataEvent = this.#handleBuildMetadataEvent.bind(this);
31
33
  this._handleProjectBuildMetadataEvent = this.#handleProjectBuildMetadataEvent.bind(this);
34
+ this._handleProjectResolvedEvent = this.#handleProjectResolvedEvent.bind(this);
35
+ this._handleServerListeningEvent = this.#handleServerListeningEvent.bind(this);
32
36
  this._handleStop = this.disable.bind(this);
33
37
  this.#initFiters();
34
38
  }
@@ -109,6 +113,8 @@ class Console {
109
113
  process.on("ui5.project-build-metadata", this._handleProjectBuildMetadataEvent);
110
114
  process.on("ui5.build-status", this._handleBuildStatusEvent);
111
115
  process.on("ui5.project-build-status", this._handleProjectBuildStatusEvent);
116
+ process.on("ui5.project-resolve-succeeded", this._handleProjectResolvedEvent);
117
+ process.on("ui5.server-listening", this._handleServerListeningEvent);
112
118
  process.on("ui5.log.stop-console", this._handleStop);
113
119
  }
114
120
 
@@ -123,6 +129,8 @@ class Console {
123
129
  process.off("ui5.project-build-metadata", this._handleProjectBuildMetadataEvent);
124
130
  process.off("ui5.build-status", this._handleBuildStatusEvent);
125
131
  process.off("ui5.project-build-status", this._handleProjectBuildStatusEvent);
132
+ process.off("ui5.project-resolve-succeeded", this._handleProjectResolvedEvent);
133
+ process.off("ui5.server-listening", this._handleServerListeningEvent);
126
134
  process.off("ui5.log.stop-console", this._handleStop);
127
135
  if (this.#progressBarContainer) {
128
136
  this.#progressBar.stop();
@@ -191,8 +199,7 @@ class Console {
191
199
  if (!Logger.isLevelEnabled(level)) {
192
200
  return;
193
201
  }
194
- const levelPrefix = this.#getLevelPrefix(level);
195
- const msg = `${levelPrefix} ${message}\n`;
202
+ const msg = formatLogLine(level, message) + "\n";
196
203
 
197
204
  if (this.#progressBarContainer) {
198
205
  // If a progress bar is in use, we have to log through it's API
@@ -205,7 +212,7 @@ class Console {
205
212
 
206
213
  #handleLogEvent({level, message, moduleName}) {
207
214
  if (this.#filterModule(moduleName)) {
208
- this.#writeMessage(level, `${chalk.blue(moduleName)} ${message}`);
215
+ this.#writeMessage(level, prefixModuleName(message, moduleName));
209
216
  }
210
217
  }
211
218
 
@@ -334,7 +341,7 @@ class Console {
334
341
  }
335
342
  projectMetadata.buildSkipped = true;
336
343
  message = `${chalk.yellow(figures.tick)} ` +
337
- `Skipping build of ${projectType} project ${chalk.bold(projectName)}`;
344
+ chalk.grey(`Skipping build of ${projectType} project ${chalk.bold(projectName)}`);
338
345
 
339
346
  // Update progress bar (if used)
340
347
  // All tasks of this projects are completed
@@ -349,7 +356,7 @@ class Console {
349
356
  this.#writeMessage(level, `${chalk.grey(buildIndex)}: ${message}`);
350
357
  }
351
358
 
352
- #handleProjectBuildStatusEvent({level, projectName, projectType, taskName, status}) {
359
+ #handleProjectBuildStatusEvent({level, projectName, projectType, taskName, status, isDifferentialBuild}) {
353
360
  const {projectTasks} = this.#getProjectMetadata(projectName);
354
361
  const taskMetadata = projectTasks.get(taskName);
355
362
  if (!taskMetadata) {
@@ -382,7 +389,8 @@ class Console {
382
389
  `for project ${projectName}, task ${taskName}`);
383
390
  }
384
391
  taskMetadata.executionStarted = true;
385
- message = `${chalk.blue(figures.pointerSmall)} Running task ${chalk.bold(taskName)}...`;
392
+ message = (isDifferentialBuild ? chalk.grey(figures.lozengeOutline) : chalk.blue(figures.pointerSmall)) +
393
+ ` Running task ${chalk.bold(taskName)}...`;
386
394
  break;
387
395
  case "task-end":
388
396
  if (taskMetadata.executionEnded) {
@@ -412,7 +420,7 @@ class Console {
412
420
  `Task execution already started`);
413
421
  }
414
422
  taskMetadata.executionEnded = true;
415
- message = `${chalk.green(figures.tick)} Skipping task ${chalk.bold(taskName)}`;
423
+ message = chalk.yellow(figures.tick) + chalk.grey(` Skipping task ${chalk.bold(taskName)}`);
416
424
 
417
425
  // Update progress bar (if used)
418
426
  this._getProgressBar()?.increment(1);
@@ -426,32 +434,49 @@ class Console {
426
434
  this.#writeMessage(level, `${chalk.blue(`${(projectName)}`)} ${taskIndex}${message}`);
427
435
  }
428
436
 
429
- #getLevelPrefix(level) {
430
- switch (level) {
431
- case "silly":
432
- return chalk.inverse(level);
433
- case "verbose":
434
- return chalk.cyan("verb");
435
- case "perf":
436
- return chalk.bgYellow.red(level);
437
- case "info":
438
- return chalk.green(level);
439
- case "warn":
440
- return chalk.yellow(level);
441
- case "error":
442
- return chalk.bgRed.white(level);
443
- // Log level silent does not produce messages
444
- default:
445
- return level;
437
+ #handleProjectResolvedEvent({name, type, version}) {
438
+ // One-line summary of the root project, mirroring the header region of
439
+ // the interactive writer. Kept as an info line so `ui5 build` and
440
+ // non-TTY `ui5 serve` still record the project identity in scrollback.
441
+ const versionSuffix = version ? ` (${version})` : "";
442
+ const typeLabel = type ? `${type} project ` : "";
443
+ this.#writeMessage("info", `Root project: ${typeLabel}${chalk.bold(name)}${chalk.dim(versionSuffix)}`);
444
+ }
445
+
446
+ #handleServerListeningEvent({urls, acceptRemoteConnections}) {
447
+ if (acceptRemoteConnections) {
448
+ // Emit the warning as chalk-formatted lines on stderr, surrounded
449
+ // by blank lines and without a `warn` level prefix. The interactive
450
+ // writer renders the same lines inside its server region.
451
+ process.stderr.write("\n");
452
+ for (const line of REMOTE_CONNECTIONS_WARNING_LINES) {
453
+ process.stderr.write(line);
454
+ process.stderr.write("\n");
455
+ }
456
+ process.stderr.write("\n");
457
+ }
458
+ // Emit `Server started` and the local URL on stdout without a level
459
+ // prefix — this exact shape is a contract for scripts and users
460
+ // parsing the non-interactive log lines. Network URLs listed under
461
+ // `--accept-remote-connections` are intentionally omitted; the
462
+ // interactive writer is responsible for showing them.
463
+ if (Array.isArray(urls)) {
464
+ const localEntry = urls.find((entry) => entry?.label === "Local") ?? urls[0];
465
+ if (localEntry?.url) {
466
+ process.stdout.write(`Server started\nURL: ${localEntry.url}\n`);
467
+ }
446
468
  }
447
469
  }
448
470
 
449
471
  /**
450
- * Creates a new instance and subscribes it to all events
472
+ * Creates a new instance and subscribes it to all events. Any currently-
473
+ * active console-writing writer is displaced by the `ui5.log.stop-console`
474
+ * event emitted here.
451
475
  *
452
476
  * @public
453
477
  */
454
478
  static init() {
479
+ process.emit("ui5.log.stop-console");
455
480
  const cH = new Console();
456
481
  cH.enable();
457
482
  return cH;