@tanishqkancharla/diffmap 0.4.0 → 0.6.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.
@@ -6,6 +6,8 @@ import {
6
6
  flattenServices,
7
7
  type Service,
8
8
  type ServiceDiagram,
9
+ type ServiceEvent,
10
+ type Sign,
9
11
  } from "../services.js";
10
12
 
11
13
  export type Point = { x: number; y: number };
@@ -27,8 +29,18 @@ export type ServiceLink = {
27
29
  backward: boolean;
28
30
  /** The longest label on the link. */
29
31
  label: string | undefined;
32
+ /** In a diff, `+` or `-` when every event on the link has that sign. */
33
+ sign: Sign;
30
34
  };
31
35
 
36
+ /** An event's label as its pill shows it, or "" when it has none. */
37
+ export function pillText(event: ServiceEvent) {
38
+ if (event.label === "") return "";
39
+ const sign = { "+": "+ ", "-": "− ", " ": "" }[event.sign];
40
+ const link = event.annotation === undefined ? "" : " ↗";
41
+ return `${sign}${event.label}${link}`;
42
+ }
43
+
32
44
  export type ServiceLayout = {
33
45
  width: number;
34
46
  height: number;
@@ -58,14 +70,13 @@ export function serviceLinks(diagram: ServiceDiagram): ServiceLink[] {
58
70
  forward: false,
59
71
  backward: false,
60
72
  label: undefined,
73
+ sign: event.sign,
61
74
  };
62
75
  if (forward) link.forward = true;
63
76
  else link.backward = true;
64
- // Measure the pill as drawn: a linked event shows ↗.
65
- const shown =
66
- event.label !== "" && event.annotation !== undefined
67
- ? `${event.label} ↗`
68
- : event.label;
77
+ if (link.sign !== event.sign) link.sign = " ";
78
+ // Measure the pill as drawn.
79
+ const shown = pillText(event);
69
80
  if (shown.length > (link.label?.length ?? 0)) link.label = shown;
70
81
  links.set(id, link);
71
82
  }
package/vite.config.ts CHANGED
@@ -38,6 +38,10 @@ export default defineConfig(({ command }) => {
38
38
  server: {
39
39
  port: 0,
40
40
  strictPort: false,
41
+ // Vite turns this on when it detects a coding agent, and its plugin
42
+ // changes the prebundle hash. Pin it so agent and terminal runs share
43
+ // one prebundle instead of rebuilding each other's.
44
+ forwardConsole: false,
41
45
  },
42
46
  };
43
47
  });