@mcuste/pi-diagram 0.0.0

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.
Files changed (73) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +240 -0
  3. package/dist/artifacts.d.ts +59 -0
  4. package/dist/artifacts.d.ts.map +1 -0
  5. package/dist/artifacts.js +274 -0
  6. package/dist/artifacts.js.map +1 -0
  7. package/dist/cache.d.ts +43 -0
  8. package/dist/cache.d.ts.map +1 -0
  9. package/dist/cache.js +0 -0
  10. package/dist/cache.js.map +1 -0
  11. package/dist/d2/diagnostics.d.ts +25 -0
  12. package/dist/d2/diagnostics.d.ts.map +1 -0
  13. package/dist/d2/diagnostics.js +77 -0
  14. package/dist/d2/diagnostics.js.map +1 -0
  15. package/dist/d2/fonts.d.ts +23 -0
  16. package/dist/d2/fonts.d.ts.map +1 -0
  17. package/dist/d2/fonts.js +255 -0
  18. package/dist/d2/fonts.js.map +1 -0
  19. package/dist/d2/preflight.d.ts +20 -0
  20. package/dist/d2/preflight.d.ts.map +1 -0
  21. package/dist/d2/preflight.js +217 -0
  22. package/dist/d2/preflight.js.map +1 -0
  23. package/dist/d2/profiles.d.ts +34 -0
  24. package/dist/d2/profiles.d.ts.map +1 -0
  25. package/dist/d2/profiles.js +118 -0
  26. package/dist/d2/profiles.js.map +1 -0
  27. package/dist/d2/runner.d.ts +95 -0
  28. package/dist/d2/runner.d.ts.map +1 -0
  29. package/dist/d2/runner.js +350 -0
  30. package/dist/d2/runner.js.map +1 -0
  31. package/dist/display.d.ts +48 -0
  32. package/dist/display.d.ts.map +1 -0
  33. package/dist/display.js +120 -0
  34. package/dist/display.js.map +1 -0
  35. package/dist/index.d.ts +3 -0
  36. package/dist/index.d.ts.map +1 -0
  37. package/dist/index.js +5 -0
  38. package/dist/index.js.map +1 -0
  39. package/dist/normalize.d.ts +23 -0
  40. package/dist/normalize.d.ts.map +1 -0
  41. package/dist/normalize.js +83 -0
  42. package/dist/normalize.js.map +1 -0
  43. package/dist/process.d.ts +38 -0
  44. package/dist/process.d.ts.map +1 -0
  45. package/dist/process.js +87 -0
  46. package/dist/process.js.map +1 -0
  47. package/dist/raster.d.ts +40 -0
  48. package/dist/raster.d.ts.map +1 -0
  49. package/dist/raster.js +193 -0
  50. package/dist/raster.js.map +1 -0
  51. package/dist/render.d.ts +55 -0
  52. package/dist/render.d.ts.map +1 -0
  53. package/dist/render.js +229 -0
  54. package/dist/render.js.map +1 -0
  55. package/dist/tools.d.ts +58 -0
  56. package/dist/tools.d.ts.map +1 -0
  57. package/dist/tools.js +284 -0
  58. package/dist/tools.js.map +1 -0
  59. package/package.json +101 -0
  60. package/src/artifacts.ts +418 -0
  61. package/src/cache.ts +0 -0
  62. package/src/d2/diagnostics.ts +114 -0
  63. package/src/d2/fonts.ts +289 -0
  64. package/src/d2/preflight.ts +270 -0
  65. package/src/d2/profiles.ts +157 -0
  66. package/src/d2/runner.ts +513 -0
  67. package/src/display.ts +201 -0
  68. package/src/index.ts +5 -0
  69. package/src/normalize.ts +119 -0
  70. package/src/process.ts +134 -0
  71. package/src/raster.ts +258 -0
  72. package/src/render.ts +338 -0
  73. package/src/tools.ts +455 -0
@@ -0,0 +1,217 @@
1
+ import { DiagramSourceError } from "./diagnostics.js";
2
+ /** D2's documented shapes, less `image`, which loads a file or a URL. */
3
+ const ALLOWED_SHAPES = new Set([
4
+ "rectangle",
5
+ "square",
6
+ "page",
7
+ "parallelogram",
8
+ "document",
9
+ "cylinder",
10
+ "queue",
11
+ "package",
12
+ "step",
13
+ "callout",
14
+ "stored_data",
15
+ "person",
16
+ "diamond",
17
+ "oval",
18
+ "circle",
19
+ "hexagon",
20
+ "cloud",
21
+ "text",
22
+ "code",
23
+ "class",
24
+ "sql_table",
25
+ "sequence_diagram",
26
+ "c4-person",
27
+ ]);
28
+ /** D2 treats `user@example.com` as label text, so only a token-initial `@` is an import. */
29
+ const IMPORT = /(?:^|[\s:{};,])@|\.\.\.[ \t]*@/gu;
30
+ const ASSET_KEY = /(?:^|[\s{};,.])(icon|link)[ \t]*:/gu;
31
+ const SHAPE_KEY = /(?:^|[\s{};,.])shape[ \t]*:[ \t]*(\S*)/gu;
32
+ const CONFIG_KEY = /(?:^|[\s{};,.])(d2-config|layout-engine)[ \t]*:/gu;
33
+ /** Throws with one diagnostic per problem found, rather than at the first. */
34
+ export function parseSafeSource(source) {
35
+ const diagnostics = inspect(source);
36
+ if (diagnostics.length > 0) {
37
+ throw new DiagramSourceError("Diagram source uses D2 features this tool does not allow.", diagnostics);
38
+ }
39
+ return source;
40
+ }
41
+ /** Exported so tests can read the diagnostics without catching the error. */
42
+ export function inspect(source) {
43
+ const lineStarts = buildLineStarts(source);
44
+ const locate = (offset) => locateOffset(lineStarts, offset);
45
+ const { masked, diagnostics } = mask(source, locate);
46
+ if (diagnostics.length > 0) {
47
+ // Masking stopped early, so the rest of the source cannot be read reliably.
48
+ return diagnostics;
49
+ }
50
+ return scan(masked, locate);
51
+ }
52
+ /**
53
+ * Blanks the inside of comments and quoted strings, keeping delimiters and every offset so
54
+ * diagnostics can carry a real line and column. Stops at a block string, where code and content
55
+ * can no longer be told apart, and at an unterminated string, which D2 also rejects.
56
+ */
57
+ function mask(source, locate) {
58
+ const out = [];
59
+ let index = 0;
60
+ while (index < source.length) {
61
+ const char = source[index];
62
+ if (char === "#") {
63
+ out.push("#");
64
+ index += 1;
65
+ while (index < source.length && source[index] !== "\n") {
66
+ out.push(" ");
67
+ index += 1;
68
+ }
69
+ continue;
70
+ }
71
+ if (char === "|") {
72
+ return {
73
+ masked: out.join(""),
74
+ diagnostics: [
75
+ {
76
+ code: "D2_BLOCK_STRING",
77
+ message: "Block strings and Markdown, LaTeX, or code labels are not allowed.",
78
+ hint: "Use a plain quoted label. They also render as an empty box in text output.",
79
+ ...locate(index),
80
+ },
81
+ ],
82
+ };
83
+ }
84
+ if (char === '"' || char === "'") {
85
+ const closed = maskString(source, index, char, out);
86
+ if (closed === undefined) {
87
+ return {
88
+ masked: out.join(""),
89
+ diagnostics: [
90
+ {
91
+ code: "D2_UNTERMINATED",
92
+ message: `Unterminated ${char === '"' ? "double" : "single"}-quoted string.`,
93
+ hint: "Close the quote. D2 rejects strings that span lines.",
94
+ ...locate(index),
95
+ },
96
+ ],
97
+ };
98
+ }
99
+ index = closed;
100
+ continue;
101
+ }
102
+ out.push(char);
103
+ index += 1;
104
+ }
105
+ return { masked: out.join(""), diagnostics: [] };
106
+ }
107
+ /**
108
+ * Returns the offset past the closing quote, or `undefined` if it never closes on its line.
109
+ * Double quotes honour backslash escapes; single quotes are raw.
110
+ */
111
+ function maskString(source, start, quote, out) {
112
+ out.push(quote);
113
+ let index = start + 1;
114
+ while (index < source.length) {
115
+ const char = source[index];
116
+ if (char === "\n") {
117
+ return undefined;
118
+ }
119
+ if (quote === '"' && char === "\\" && index + 1 < source.length) {
120
+ out.push(" ", " ");
121
+ index += 2;
122
+ continue;
123
+ }
124
+ if (char === quote) {
125
+ out.push(quote);
126
+ return index + 1;
127
+ }
128
+ out.push(" ");
129
+ index += 1;
130
+ }
131
+ return undefined;
132
+ }
133
+ function scan(masked, locate) {
134
+ const diagnostics = [];
135
+ for (const match of masked.matchAll(IMPORT)) {
136
+ const offset = match.index + match[0].indexOf("@");
137
+ diagnostics.push({
138
+ code: "D2_IMPORT",
139
+ message: "Imports are not allowed. They can read any file on this machine.",
140
+ hint: "Write the whole diagram in this call, and quote the label if you meant text.",
141
+ ...locate(offset),
142
+ });
143
+ }
144
+ for (const match of masked.matchAll(ASSET_KEY)) {
145
+ const key = match[1];
146
+ diagnostics.push(key === "icon"
147
+ ? {
148
+ code: "D2_ICON",
149
+ message: "Icons are not allowed. They load local files or remote URLs.",
150
+ hint: "Use a built-in shape and a label instead.",
151
+ ...locate(match.index + match[0].indexOf(key)),
152
+ }
153
+ : {
154
+ code: "D2_LINK",
155
+ message: "Links are not allowed.",
156
+ hint: "Put the destination in the label text if it matters.",
157
+ ...locate(match.index + match[0].indexOf(key)),
158
+ });
159
+ }
160
+ for (const match of masked.matchAll(SHAPE_KEY)) {
161
+ const value = (match[1] ?? "").replace(/[{};,]+$/u, "");
162
+ if (ALLOWED_SHAPES.has(value)) {
163
+ continue;
164
+ }
165
+ const offset = match.index + match[0].indexOf("shape");
166
+ diagnostics.push(value === "image"
167
+ ? {
168
+ code: "D2_IMAGE_SHAPE",
169
+ message: "`shape: image` is not allowed. It loads a local file or a remote URL.",
170
+ hint: "Use a built-in shape such as `rectangle` or `cylinder`.",
171
+ ...locate(offset),
172
+ }
173
+ : {
174
+ code: "D2_UNKNOWN_SHAPE",
175
+ message: `Unsupported shape ${JSON.stringify(value)}.`,
176
+ hint: `Allowed shapes: ${[...ALLOWED_SHAPES].join(", ")}.`,
177
+ ...locate(offset),
178
+ });
179
+ }
180
+ for (const match of masked.matchAll(CONFIG_KEY)) {
181
+ const key = match[1];
182
+ diagnostics.push({
183
+ code: "D2_CONFIG",
184
+ message: `Renderer configuration (${key}) cannot be set from diagram source.`,
185
+ hint: "Layout and theme are chosen by this tool.",
186
+ ...locate(match.index + match[0].indexOf(key)),
187
+ });
188
+ }
189
+ return diagnostics.sort(byPosition);
190
+ }
191
+ function byPosition(left, right) {
192
+ return (left.line ?? 0) - (right.line ?? 0) || (left.column ?? 0) - (right.column ?? 0);
193
+ }
194
+ function buildLineStarts(source) {
195
+ const starts = [0];
196
+ for (let index = 0; index < source.length; index += 1) {
197
+ if (source[index] === "\n") {
198
+ starts.push(index + 1);
199
+ }
200
+ }
201
+ return starts;
202
+ }
203
+ function locateOffset(lineStarts, offset) {
204
+ let low = 0;
205
+ let high = lineStarts.length - 1;
206
+ while (low < high) {
207
+ const middle = Math.ceil((low + high) / 2);
208
+ if (lineStarts[middle] <= offset) {
209
+ low = middle;
210
+ }
211
+ else {
212
+ high = middle - 1;
213
+ }
214
+ }
215
+ return { line: low + 1, column: offset - lineStarts[low] + 1 };
216
+ }
217
+ //# sourceMappingURL=preflight.js.map
@@ -0,0 +1 @@
1
+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AAC,GAAG,CAAY,GAAG,CAAC,EAAE,CAAC;AAC7E,CAAC"}
@@ -0,0 +1,34 @@
1
+ export declare const PROFILE_NAMES: readonly ["explain", "architecture", "data", "docs", "tree", "c4", "dependency"];
2
+ export type ProfileName = (typeof PROFILE_NAMES)[number];
3
+ /** The engines expose different spacing options, so a profile states only its own engine's. */
4
+ export type LayoutPolicy = {
5
+ readonly engine: "elk";
6
+ /** Pixels between one row of nodes and the next. */
7
+ readonly layerGapPx: number;
8
+ /** Pixels between a node and an edge routed past it. */
9
+ readonly edgeGapPx: number;
10
+ /** Pixels between a container's border and what it holds. */
11
+ readonly containerPadPx: number;
12
+ } | {
13
+ readonly engine: "dagre";
14
+ /** Pixels between one node and the next across a row. */
15
+ readonly nodeGapPx: number;
16
+ /** Pixels between two edges running side by side. */
17
+ readonly edgeGapPx: number;
18
+ };
19
+ export interface RenderProfile {
20
+ readonly name: ProfileName;
21
+ /** D2 theme id used in light mode. */
22
+ readonly theme: number;
23
+ /** D2 theme id a viewer in dark mode gets instead. */
24
+ readonly darkTheme: number;
25
+ /** Pixels around the whole drawing. */
26
+ readonly padPx: number;
27
+ /** Hand-drawn strokes and a handwriting font. */
28
+ readonly sketch: boolean;
29
+ readonly layout: LayoutPolicy;
30
+ }
31
+ /** Diagrams that explain something in passing, which is most of them. */
32
+ export declare const DEFAULT_PROFILE: RenderProfile;
33
+ export declare function parseProfile(raw: unknown): RenderProfile;
34
+ //# sourceMappingURL=profiles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profiles.d.ts","sourceRoot":"","sources":["../../src/d2/profiles.ts"],"names":[],"mappings":"AAkBA,eAAO,MAAM,aAAa,YACxB,SAAS,EACT,cAAc,EACd,MAAM,EACN,MAAM,EACN,MAAM,EACN,IAAI,EACJ,YAAY,CACJ,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzD,+FAA+F;AAC/F,MAAM,MAAM,YAAY,GACpB;IACE,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC;IACvB,oDAAoD;IACpD,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,wDAAwD;IACxD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,6DAA6D;IAC7D,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;CACjC,GACD;IACE,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,yDAAyD;IACzD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,qDAAqD;IACrD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEN,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,sCAAsC;IACtC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,sDAAsD;IACtD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,uCAAuC;IACvC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,iDAAiD;IACjD,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;CAC/B;AA6ED,yEAAyE;AACzE,eAAO,MAAM,eAAe,EAAE,aAAgC,CAAC;AAE/D,wBAAgB,YAAY,CAAC,GAAG,EAAE,OAAO,GAAG,aAAa,CAgBxD"}
@@ -0,0 +1,118 @@
1
+ import { DiagramSourceError } from "./diagnostics.js";
2
+ /**
3
+ * What a diagram is for decides how it looks. The model names the purpose, this table sets the
4
+ * engine, the theme, and the spacing, so diagrams stay consistent between calls.
5
+ *
6
+ * The policy reaches D2 as CLI flags, which take precedence over anything the source sets.
7
+ */
8
+ /** Neutral Default: light containers under near-white nodes, which keeps the nesting readable. */
9
+ const NEUTRAL_THEME = 0;
10
+ /** Neutral Grey: no colour to lose, so it still reads when a document is printed. */
11
+ const GREY_THEME = 1;
12
+ /** C4, so a diagram drawn in that convention is coloured the way its readers expect. */
13
+ const C4_THEME = 303;
14
+ /** Dark Mauve, D2's neutral dark theme, so a saved SVG follows the reader into dark mode. */
15
+ const DARK_THEME = 200;
16
+ export const PROFILE_NAMES = [
17
+ "explain",
18
+ "architecture",
19
+ "data",
20
+ "docs",
21
+ "tree",
22
+ "c4",
23
+ "dependency",
24
+ ];
25
+ const PROFILES = {
26
+ /**
27
+ * The default. Drawn by hand because an answer in a conversation is a rough model, and a crisp
28
+ * diagram claims more precision than the explanation has.
29
+ */
30
+ explain: {
31
+ name: "explain",
32
+ theme: NEUTRAL_THEME,
33
+ darkTheme: DARK_THEME,
34
+ padPx: 30,
35
+ sketch: true,
36
+ layout: { engine: "elk", layerGapPx: 60, edgeGapPx: 40, containerPadPx: 40 },
37
+ },
38
+ // Room between the ranks, so the edges crossing between containers stay separable.
39
+ architecture: {
40
+ name: "architecture",
41
+ theme: NEUTRAL_THEME,
42
+ darkTheme: DARK_THEME,
43
+ padPx: 60,
44
+ sketch: false,
45
+ layout: { engine: "elk", layerGapPx: 90, edgeGapPx: 50, containerPadPx: 60 },
46
+ },
47
+ // Tables and classes are tall already, so the space around them is kept tight.
48
+ data: {
49
+ name: "data",
50
+ theme: NEUTRAL_THEME,
51
+ darkTheme: DARK_THEME,
52
+ padPx: 30,
53
+ sketch: false,
54
+ layout: { engine: "elk", layerGapPx: 50, edgeGapPx: 30, containerPadPx: 30 },
55
+ },
56
+ // Sized for a page rather than a transcript row, with a theme that survives greyscale.
57
+ docs: {
58
+ name: "docs",
59
+ theme: GREY_THEME,
60
+ darkTheme: DARK_THEME,
61
+ padPx: 100,
62
+ sketch: false,
63
+ layout: { engine: "elk", layerGapPx: 80, edgeGapPx: 40, containerPadPx: 50 },
64
+ },
65
+ /**
66
+ * The one profile that changes engine: dagre fans children out under their parent, which is how
67
+ * a hierarchy is normally drawn.
68
+ */
69
+ tree: {
70
+ name: "tree",
71
+ theme: NEUTRAL_THEME,
72
+ darkTheme: DARK_THEME,
73
+ padPx: 40,
74
+ sketch: false,
75
+ layout: { engine: "dagre", nodeGapPx: 40, edgeGapPx: 20 },
76
+ },
77
+ // Architecture spacing. The palette is the whole difference.
78
+ c4: {
79
+ name: "c4",
80
+ theme: C4_THEME,
81
+ darkTheme: DARK_THEME,
82
+ padPx: 60,
83
+ sketch: false,
84
+ layout: { engine: "elk", layerGapPx: 90, edgeGapPx: 50, containerPadPx: 60 },
85
+ },
86
+ /**
87
+ * For a graph with more nodes than usual. Edges routed past nodes fill most of a large graph, so
88
+ * that gap is cut first.
89
+ */
90
+ dependency: {
91
+ name: "dependency",
92
+ theme: NEUTRAL_THEME,
93
+ darkTheme: DARK_THEME,
94
+ padPx: 20,
95
+ sketch: false,
96
+ layout: { engine: "elk", layerGapPx: 40, edgeGapPx: 20, containerPadPx: 20 },
97
+ },
98
+ };
99
+ /** Diagrams that explain something in passing, which is most of them. */
100
+ export const DEFAULT_PROFILE = PROFILES.explain;
101
+ export function parseProfile(raw) {
102
+ if (raw === undefined) {
103
+ return DEFAULT_PROFILE;
104
+ }
105
+ // Matched against the names, not looked up on the table, so `toString` cannot become a profile.
106
+ const name = PROFILE_NAMES.find((candidate) => candidate === raw);
107
+ if (name === undefined) {
108
+ throw new DiagramSourceError("Unsupported diagram profile.", [
109
+ {
110
+ code: "D2_SOURCE",
111
+ message: `${JSON.stringify(raw)} is not a profile.`,
112
+ hint: `Use ${PROFILE_NAMES.join(", ")}.`,
113
+ },
114
+ ]);
115
+ }
116
+ return PROFILES[name];
117
+ }
118
+ //# sourceMappingURL=profiles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profiles.js","sourceRoot":"","sources":["../../src/d2/profiles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEtD;;;;;GAKG;AAEH,kGAAkG;AAClG,MAAM,aAAa,GAAG,CAAC,CAAC;AACxB,qFAAqF;AACrF,MAAM,UAAU,GAAG,CA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AE,CAAC,SAAS,KAAK,GAAG,CAAC,CAAC;IAClE,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,MAAM,IAAI,kBAAkB,CAAC,8BAA8B,EAAE;YAC3D;gBACE,IAAI,EAAE,WAAW;gBACjB,OAAO,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,oBAAoB;gBACnD,IAAI,EAAE,OAAO,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG;aACzC;SACF,CAAC,CAAC;IACL,CAAC;IACD,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC;AACxB,CAAC"}
@@ -0,0 +1,95 @@
1
+ import { type RenderCache } from "../cache.js";
2
+ import { type CommandResult, type CommandRunner } from "../process.js";
3
+ import { type Diagnostic } from "./diagnostics.js";
4
+ import type { SafeD2Source } from "./preflight.js";
5
+ import type { RenderProfile } from "./profiles.js";
6
+ export type AsciiMode = "extended" | "standard";
7
+ declare const supportedVersionBrand: unique symbol;
8
+ declare const renderedTextBrand: unique symbol;
9
+ declare const renderedSvgBrand: unique symbol;
10
+ /** Confirmed at or above `MINIMUM_D2_VERSION`. */
11
+ export type SupportedD2Version = string & {
12
+ readonly [supportedVersionBrand]: true;
13
+ };
14
+ /** Output that passed `parseRenderedText`, so it is safe to print. */
15
+ export type RenderedDiagramText = string & {
16
+ readonly [renderedTextBrand]: true;
17
+ };
18
+ /** Output that passed `parseRenderedSvg`, so it is safe to write into the workspace. */
19
+ export type RenderedSvg = string & {
20
+ readonly [renderedSvgBrand]: true;
21
+ };
22
+ export interface D2TextRequest {
23
+ readonly source: SafeD2Source;
24
+ readonly asciiMode: AsciiMode;
25
+ readonly signal: AbortSignal | undefined;
26
+ }
27
+ export interface D2Text {
28
+ readonly text: RenderedDiagramText;
29
+ readonly version: SupportedD2Version;
30
+ }
31
+ export interface D2SvgRequest {
32
+ readonly source: SafeD2Source;
33
+ readonly profile: RenderProfile;
34
+ readonly signal: AbortSignal | undefined;
35
+ }
36
+ export interface D2Svg {
37
+ readonly svg: RenderedSvg;
38
+ readonly version: SupportedD2Version;
39
+ }
40
+ export interface D2FormatRequest {
41
+ readonly source: SafeD2Source;
42
+ readonly signal: AbortSignal | undefined;
43
+ }
44
+ export interface D2Renderer {
45
+ renderText(request: D2TextRequest): Promise<D2Text>;
46
+ renderSvg(request: D2SvgRequest): Promise<D2Svg>;
47
+ /** The same source as `d2 fmt` writes it. Throws when D2 will not format it. */
48
+ formatSource(request: D2FormatRequest): Promise<string>;
49
+ }
50
+ /** D2 accepted the source but drew nothing usable. Not the model's mistake to correct. */
51
+ export declare class TextRenderUnavailableError extends Error {
52
+ readonly diagnostics: readonly Diagnostic[];
53
+ constructor(message: string, diagnostics?: readonly Diagnostic[]);
54
+ }
55
+ /** D2 reports strings such as `v0.8.1-HEAD`, so only the three numbers are compared. */
56
+ export declare function parseD2Version(result: CommandResult): SupportedD2Version;
57
+ /**
58
+ * D2 exiting zero does not mean the output is usable: the beta text renderer returns blank
59
+ * drawings, and a silently ignored mode flag would otherwise reach the terminal unnoticed.
60
+ */
61
+ export declare function parseRenderedText(raw: string, mode: AsciiMode): RenderedDiagramText;
62
+ /**
63
+ * D2 documents exported SVG as web content. The safe subset already rules out icons, images, and
64
+ * Markdown labels, so anything active or externally referenced here means it was bypassed.
65
+ */
66
+ export declare function parseRenderedSvg(raw: string): RenderedSvg;
67
+ export declare class D2Cli implements D2Renderer {
68
+ private readonly runner;
69
+ private readonly binary;
70
+ private readonly cache;
71
+ private version;
72
+ /** Cache keys of sources this process has compiled, so one call validates them once. */
73
+ private readonly validated;
74
+ constructor(dependencies?: {
75
+ runner?: CommandRunner;
76
+ binary?: string;
77
+ cache?: RenderCache;
78
+ });
79
+ renderText(request: D2TextRequest): Promise<D2Text>;
80
+ renderSvg(request: D2SvgRequest): Promise<D2Svg>;
81
+ /** The formatted source is read back from the temp directory, since `fmt` writes no stdout. */
82
+ formatSource(request: D2FormatRequest): Promise<string>;
83
+ private compile;
84
+ private remember;
85
+ private validate;
86
+ private ensureVersion;
87
+ private run;
88
+ }
89
+ /**
90
+ * `D2_BIN` is not model input, but it still lands in an exec call, so anything that could read
91
+ * as an option or split into extra arguments is refused.
92
+ */
93
+ export declare function parseBinaryName(value: string | undefined): string;
94
+ export {};
95
+ //# sourceMappingURL=runner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/d2/runner.ts"],"names":[],"mappings":"AAGA,OAAO,EAAuB,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EAIL,KAAK,aAAa,EAClB,KAAK,aAAa,EAGnB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,KAAK,UAAU,EAA0C,MAAM,kBAAkB,CAAC;AAC3F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAgB,aAAa,EAAE,MAAM,eAAe,CAAC;AAuBjE,MAAM,MAAM,SAAS,GAAG,UAAU,GAAG,UAAU,CAAC;AAGhD,OAAO,CAAC,MAAM,qBAAqB,EAAE,OAAO,MAAM,CAAC;AACnD,OAAO,CAAC,MAAM,iBAAiB,EAAE,OAAO,MAAM,CAAC;AAC/C,OAAO,CAAC,MAAM,gBAAgB,EAAE,OAAO,MAAM,CAAC;AAK9C,kDAAkD;AAClD,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,CAAC,qBAAqB,CAAC,EAAE,IAAI,CAAA;CAAE,CAAC;AAErF,sEAAsE;AACtE,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,CAAC,iBAAiB,CAAC,EAAE,IAAI,CAAA;CAAE,CAAC;AAElF,wFAAwF;AACxF,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,CAAC,gBAAgB,CAAC,EAAE,IAAI,CAAA;CAAE,CAAC;AAEzE,MAAM,WAAW,aAAa;IAC5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