@reporters/web 1.4.0 → 1.4.1

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,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.4.1](https://github.com/MoLow/reporters/compare/web-v1.4.0...web-v1.4.1) (2026-07-06)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **web:** true live durations via writer stamps on the wire ([#237](https://github.com/MoLow/reporters/issues/237)) ([42d5478](https://github.com/MoLow/reporters/commit/42d5478d153de83d8f457fb8783794a5aed54408))
9
+
3
10
  ## [1.4.0](https://github.com/MoLow/reporters/compare/web-v1.3.0...web-v1.4.0) (2026-07-06)
4
11
 
5
12
 
package/dist/index.d.ts CHANGED
@@ -27,6 +27,8 @@ interface TestEventData {
27
27
  }
28
28
  interface TestEvent {
29
29
  type: string;
30
+ /** Writer wall-clock (epoch ms), stamped when the event is serialized. */
31
+ t?: number;
30
32
  data: TestEventData;
31
33
  }
32
34
 
package/dist/index.js CHANGED
@@ -16,6 +16,7 @@ function flattenError(raw) {
16
16
  function toWireEvent(event) {
17
17
  const d = event.data ?? {};
18
18
  const data = {};
19
+ const t = event.t;
19
20
  if (d.name != null) data.name = d.name;
20
21
  if (d.nesting != null) data.nesting = d.nesting;
21
22
  if (d.file != null) data.file = d.file;
@@ -41,10 +42,11 @@ function toWireEvent(event) {
41
42
  error: flattenError(d.details.error)
42
43
  };
43
44
  }
44
- return { type: event.type, data };
45
+ return t != null ? { type: event.type, t, data } : { type: event.type, data };
45
46
  }
46
47
  function serializeWireLine(event) {
47
- return `${JSON.stringify(toWireEvent(event))}
48
+ const stamped = event.t != null ? event : { ...event, t: Date.now() };
49
+ return `${JSON.stringify(toWireEvent(stamped))}
48
50
  `;
49
51
  }
50
52