@diagrampilot/core 0.2.6 → 0.2.7-nightly.52.1.858a8d2

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 (50) hide show
  1. package/dist/index.d.ts +3 -1
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +2 -1
  4. package/dist/index.js.map +1 -1
  5. package/dist/repo-workflow-check.d.ts.map +1 -1
  6. package/dist/repo-workflow-check.js +25 -51
  7. package/dist/repo-workflow-check.js.map +1 -1
  8. package/dist/repo-workflow-config.d.ts +0 -1
  9. package/dist/repo-workflow-config.d.ts.map +1 -1
  10. package/dist/repo-workflow-config.js +1 -1
  11. package/dist/repo-workflow-config.js.map +1 -1
  12. package/dist/repo-workflow-configured-artifact-paths.d.ts +9 -0
  13. package/dist/repo-workflow-configured-artifact-paths.d.ts.map +1 -0
  14. package/dist/repo-workflow-configured-artifact-paths.js +129 -0
  15. package/dist/repo-workflow-configured-artifact-paths.js.map +1 -0
  16. package/dist/repo-workflow-configured-artifact-result.d.ts +15 -0
  17. package/dist/repo-workflow-configured-artifact-result.d.ts.map +1 -1
  18. package/dist/repo-workflow-configured-artifacts.d.ts +1 -4
  19. package/dist/repo-workflow-configured-artifacts.d.ts.map +1 -1
  20. package/dist/repo-workflow-configured-artifacts.js +144 -195
  21. package/dist/repo-workflow-configured-artifacts.js.map +1 -1
  22. package/dist/repo-workflow-generate.d.ts +84 -0
  23. package/dist/repo-workflow-generate.d.ts.map +1 -0
  24. package/dist/repo-workflow-generate.js +213 -0
  25. package/dist/repo-workflow-generate.js.map +1 -0
  26. package/dist/repo-workflow-loaded-source.d.ts +25 -0
  27. package/dist/repo-workflow-loaded-source.d.ts.map +1 -0
  28. package/dist/repo-workflow-loaded-source.js +21 -0
  29. package/dist/repo-workflow-loaded-source.js.map +1 -0
  30. package/dist/repo-workflow-markdown-embed-freshness.d.ts +4 -0
  31. package/dist/repo-workflow-markdown-embed-freshness.d.ts.map +1 -0
  32. package/dist/repo-workflow-markdown-embed-freshness.js +96 -0
  33. package/dist/repo-workflow-markdown-embed-freshness.js.map +1 -0
  34. package/dist/repo-workflow-markdown-embed.d.ts +16 -0
  35. package/dist/repo-workflow-markdown-embed.d.ts.map +1 -0
  36. package/dist/repo-workflow-markdown-embed.js +76 -0
  37. package/dist/repo-workflow-markdown-embed.js.map +1 -0
  38. package/dist/repo-workflow-paths.d.ts +6 -0
  39. package/dist/repo-workflow-paths.d.ts.map +1 -0
  40. package/dist/repo-workflow-paths.js +27 -0
  41. package/dist/repo-workflow-paths.js.map +1 -0
  42. package/dist/repo-workflow.d.ts +2 -0
  43. package/dist/repo-workflow.d.ts.map +1 -1
  44. package/dist/repo-workflow.js +10 -0
  45. package/dist/repo-workflow.js.map +1 -1
  46. package/dist/version.d.ts +1 -1
  47. package/dist/version.d.ts.map +1 -1
  48. package/dist/version.js +1 -1
  49. package/dist/version.js.map +1 -1
  50. package/package.json +2 -2
@@ -0,0 +1,213 @@
1
+ import { configuredExplicitSourcesForScope, configuredOutputsForSource, configuredSourceDiscoveryOptions, deriveConfiguredArtifactDisplayPath, mergeDiscoveredAndConfiguredSources, resolveConfiguredOutputPath, } from "./repo-workflow-configured-artifacts.js";
2
+ import { createMarkdownEmbedContent, createMarkdownEmbedReferences, } from "./repo-workflow-markdown-embed.js";
3
+ import { loadRepoWorkflowSource } from "./repo-workflow-loaded-source.js";
4
+ import { deriveDefaultArtifactDisplayPath, deriveRepoWorkflowConfigDisplayPath, normalizePathForDisplay, } from "./repo-workflow-paths.js";
5
+ import { deriveExpectedSvgArtifactPath, } from "./svg-artifact-freshness.js";
6
+ function emptySummary() {
7
+ return {
8
+ checkedSourceCount: 0,
9
+ writtenArtifactCount: 0,
10
+ skippedArtifactCount: 0,
11
+ failureCount: 0,
12
+ };
13
+ }
14
+ function summarize(options) {
15
+ return {
16
+ checkedSourceCount: options.checkedSourceCount,
17
+ writtenArtifactCount: options.writtenCount,
18
+ skippedArtifactCount: options.skippedCount,
19
+ failureCount: options.failureCount,
20
+ };
21
+ }
22
+ function isConfiguredTextArtifactFormat(format) {
23
+ return format === "mermaid" || format === "d2" || format === "dot";
24
+ }
25
+ async function generateOutputContent(options, source, output, absolutePath, references) {
26
+ if (output.format === "markdown") {
27
+ return createMarkdownEmbedContent({
28
+ spec: source.spec,
29
+ embedPath: absolutePath,
30
+ references,
31
+ });
32
+ }
33
+ if (output.format === "svg" || output.format === "png") {
34
+ const svg = await options.renderSvgArtifact({
35
+ source: source.source,
36
+ provenanceSourcePath: source.sourcePath,
37
+ spec: source.spec,
38
+ diagramPilotVersion: options.diagramPilotVersion,
39
+ renderer: options.renderer,
40
+ });
41
+ return output.format === "png" ? options.rasterizeSvgArtifact(svg) : svg;
42
+ }
43
+ if (isConfiguredTextArtifactFormat(output.format)) {
44
+ return options.exportTextArtifact({
45
+ format: output.format,
46
+ spec: source.spec,
47
+ });
48
+ }
49
+ throw new Error(`Unsupported configured output format: ${output.format}`);
50
+ }
51
+ function defaultSvgOutput(source) {
52
+ return {
53
+ format: "svg",
54
+ path: deriveExpectedSvgArtifactPath(source.sourceAbsolutePath),
55
+ };
56
+ }
57
+ function outputsInWriteOrder(outputs) {
58
+ return [
59
+ ...outputs.filter((output) => output.format !== "markdown"),
60
+ ...outputs.filter((output) => output.format === "markdown"),
61
+ ];
62
+ }
63
+ export async function generateDiagramPilotRepoWorkflowWithDependencies(options, dependencies) {
64
+ const configResult = dependencies.discoverRepoWorkflowConfig === undefined
65
+ ? { ok: true }
66
+ : await dependencies.discoverRepoWorkflowConfig(options.scopePath);
67
+ if (!configResult.ok) {
68
+ return {
69
+ ok: false,
70
+ summary: emptySummary(),
71
+ written: [],
72
+ skipped: [],
73
+ failures: [],
74
+ failure: configResult.failure,
75
+ };
76
+ }
77
+ const discoveryResult = await dependencies.discoverDiagramPilotSourceFiles(options.scopePath, configuredSourceDiscoveryOptions(configResult.config));
78
+ if (!discoveryResult.ok) {
79
+ return {
80
+ ok: false,
81
+ ...(configResult.config === undefined
82
+ ? {}
83
+ : {
84
+ config: {
85
+ path: deriveRepoWorkflowConfigDisplayPath(configResult.config.path, dependencies.getCurrentWorkingDirectory()),
86
+ },
87
+ }),
88
+ summary: emptySummary(),
89
+ written: [],
90
+ skipped: [],
91
+ failures: [],
92
+ failure: discoveryResult.failure,
93
+ };
94
+ }
95
+ const currentWorkingDirectory = dependencies.getCurrentWorkingDirectory();
96
+ const configuredSources = configuredExplicitSourcesForScope(configResult.config, discoveryResult.scope);
97
+ const discoveredSources = mergeDiscoveredAndConfiguredSources(discoveryResult.sources, configuredSources);
98
+ const validSources = [];
99
+ const failures = [];
100
+ for (const source of discoveredSources) {
101
+ const loadedSource = loadRepoWorkflowSource({
102
+ source,
103
+ scope: discoveryResult.scope,
104
+ currentWorkingDirectory,
105
+ dependencies,
106
+ });
107
+ if (!loadedSource.ok) {
108
+ failures.push({
109
+ sourcePath: loadedSource.sourcePath,
110
+ errors: loadedSource.errors,
111
+ });
112
+ continue;
113
+ }
114
+ validSources.push({
115
+ sourcePath: loadedSource.sourcePath,
116
+ sourceAbsolutePath: loadedSource.sourceAbsolutePath,
117
+ source: loadedSource.source,
118
+ spec: loadedSource.spec,
119
+ outputs: configuredOutputsForSource(configResult.config, loadedSource.sourceAbsolutePath),
120
+ });
121
+ }
122
+ const config = configResult.config === undefined
123
+ ? undefined
124
+ : {
125
+ path: deriveRepoWorkflowConfigDisplayPath(configResult.config.path, currentWorkingDirectory),
126
+ };
127
+ if (failures.length > 0) {
128
+ return {
129
+ ok: false,
130
+ ...(config === undefined ? {} : { config }),
131
+ scope: discoveryResult.scope,
132
+ summary: summarize({
133
+ checkedSourceCount: discoveredSources.length,
134
+ writtenCount: 0,
135
+ skippedCount: 0,
136
+ failureCount: failures.length,
137
+ }),
138
+ written: [],
139
+ skipped: [],
140
+ failures,
141
+ };
142
+ }
143
+ const written = [];
144
+ const skipped = [];
145
+ for (const source of validSources) {
146
+ const sourceConfig = configResult.config;
147
+ const outputs = source.outputs.length > 0 ? source.outputs : [defaultSvgOutput(source)];
148
+ const orderedOutputs = outputsInWriteOrder(outputs);
149
+ const references = source.outputs.length > 0 && sourceConfig !== undefined
150
+ ? createMarkdownEmbedReferences({
151
+ outputs,
152
+ resolvePath: (output) => resolveConfiguredOutputPath(sourceConfig, source.sourceAbsolutePath, output),
153
+ })
154
+ : [];
155
+ for (const output of orderedOutputs) {
156
+ const absolutePath = source.outputs.length > 0 && configResult.config !== undefined
157
+ ? resolveConfiguredOutputPath(configResult.config, source.sourceAbsolutePath, output)
158
+ : output.path;
159
+ const displayPath = source.outputs.length > 0 && configResult.config !== undefined
160
+ ? normalizePathForDisplay(deriveConfiguredArtifactDisplayPath(configResult.config.directory, absolutePath, currentWorkingDirectory))
161
+ : deriveDefaultArtifactDisplayPath(source.sourcePath, absolutePath, currentWorkingDirectory);
162
+ try {
163
+ const content = await generateOutputContent(options, source, output, absolutePath, references);
164
+ written.push({
165
+ sourcePath: source.sourcePath,
166
+ format: output.format,
167
+ path: displayPath,
168
+ absolutePath,
169
+ content,
170
+ });
171
+ }
172
+ catch (error) {
173
+ const message = error instanceof Error
174
+ ? error.message
175
+ : `Unable to generate ${displayPath}.`;
176
+ return {
177
+ ok: false,
178
+ ...(config === undefined ? {} : { config }),
179
+ scope: discoveryResult.scope,
180
+ summary: summarize({
181
+ checkedSourceCount: discoveredSources.length,
182
+ writtenCount: 0,
183
+ skippedCount: 0,
184
+ failureCount: 1,
185
+ }),
186
+ written: [],
187
+ skipped: [],
188
+ failures: [],
189
+ failure: {
190
+ kind: "generation-failed",
191
+ path: displayPath,
192
+ message: `Unable to generate ${displayPath}: ${message}`,
193
+ },
194
+ };
195
+ }
196
+ }
197
+ }
198
+ return {
199
+ ok: true,
200
+ ...(config === undefined ? {} : { config }),
201
+ scope: discoveryResult.scope,
202
+ summary: summarize({
203
+ checkedSourceCount: discoveredSources.length,
204
+ writtenCount: written.length,
205
+ skippedCount: skipped.length,
206
+ failureCount: 0,
207
+ }),
208
+ written,
209
+ skipped,
210
+ failures: [],
211
+ };
212
+ }
213
+ //# sourceMappingURL=repo-workflow-generate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repo-workflow-generate.js","sourceRoot":"","sources":["../src/repo-workflow-generate.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,iCAAiC,EACjC,0BAA0B,EAC1B,gCAAgC,EAChC,mCAAmC,EACnC,mCAAmC,EACnC,2BAA2B,GAC5B,MAAM,yCAAyC,CAAC;AAEjD,OAAO,EACL,0BAA0B,EAC1B,6BAA6B,GAE9B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,EACL,gCAAgC,EAChC,mCAAmC,EACnC,uBAAuB,GACxB,MAAM,0BAA0B,CAAC;AAclC,OAAO,EACL,6BAA6B,GAE9B,MAAM,6BAA6B,CAAC;AA2GrC,SAAS,YAAY;IACnB,OAAO;QACL,kBAAkB,EAAE,CAAC;QACrB,oBAAoB,EAAE,CAAC;QACvB,oBAAoB,EAAE,CAAC;QACvB,YAAY,EAAE,CAAC;KAChB,CAAC;AACJ,CAAC;AAED,SAAS,SAAS,CAAC,OAKlB;IACC,OAAO;QACL,kBAAkB,EAAE,OAAO,CAAC,kBAAkB;QAC9C,oBAAoB,EAAE,OAAO,CAAC,YAAY;QAC1C,oBAAoB,EAAE,OAAO,CAAC,YAAY;QAC1C,YAAY,EAAE,OAAO,CAAC,YAAY;KACnC,CAAC;AACJ,CAAC;AAED,SAAS,8BAA8B,CACrC,MAAwC;IAExC,OAAO,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,IAAI,IAAI,MAAM,KAAK,KAAK,CAAC;AACrE,CAAC;AAED,KAAK,UAAU,qBAAqB,CAClC,OAAoC,EACpC,MAA2B,EAC3B,MAAkC,EAClC,YAAoB,EACpB,UAAsD;IAEtD,IAAI,MAAM,CAAC,MAAM,KAAK,UAAU,EAAE,CAAC;QACjC,OAAO,0BA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ACF,OAAO,EAAE,EAAE;oBACX,OAAO,EAAE,EAAE;oBACX,QAAQ,EAAE,EAAE;oBACZ,OAAO,EAAE;wBACP,IAAI,EAAE,mBAAmB;wBACzB,IAAI,EAAE,WAAW;wBACjB,OAAO,EAAE,sBAAsB,WAAW,KAAK,OAAO,EAAE;qBACzD;iBACF,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO;QACL,EAAE,EAAE,IAAI;QACR,GAAG,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC;QAC3C,KAAK,EAAE,eAAe,CAAC,KAAK;QAC5B,OAAO,EAAE,SAAS,CAAC;YACjB,kBAAkB,EAAE,iBAAiB,CAAC,MAAM;YAC5C,YAAY,EAAE,OAAO,CAAC,MAAM;YAC5B,YAAY,EAAE,OAAO,CAAC,MAAM;YAC5B,YAAY,EAAE,CAAC;SAChB,CAAC;QACF,OAAO;QACP,OAAO;QACP,QAAQ,EAAE,EAAE;KACb,CAAC;AACJ,CAAC"}
@@ -0,0 +1,25 @@
1
+ import type { DiagramSpec } from "./diagramspec-topology.js";
2
+ import type { DiagramPilotSourceDiscoveryScope, DiscoveredDiagramPilotSourceFile } from "./source-discovery.js";
3
+ import type { DiagramPilotSourceFile, RepairableDiagnosticReport, ValidatedDiagramSpecLoadFailure, ValidatedDiagramSpecLoadResult } from "./source-loading.js";
4
+ export interface RepoWorkflowSourceLoadDependencies {
5
+ loadValidatedDiagramSpec(path: string): ValidatedDiagramSpecLoadResult;
6
+ createRepairableDiagnosticReport(failure: ValidatedDiagramSpecLoadFailure): RepairableDiagnosticReport;
7
+ }
8
+ export type LoadedRepoWorkflowSource = {
9
+ ok: true;
10
+ sourcePath: string;
11
+ sourceAbsolutePath: string;
12
+ source: DiagramPilotSourceFile;
13
+ spec: DiagramSpec;
14
+ } | {
15
+ ok: false;
16
+ sourcePath: string;
17
+ errors: RepairableDiagnosticReport["errors"];
18
+ };
19
+ export declare function loadRepoWorkflowSource(options: {
20
+ source: DiscoveredDiagramPilotSourceFile;
21
+ scope: DiagramPilotSourceDiscoveryScope;
22
+ currentWorkingDirectory: string;
23
+ dependencies: RepoWorkflowSourceLoadDependencies;
24
+ }): LoadedRepoWorkflowSource;
25
+ //# sourceMappingURL=repo-workflow-loaded-source.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repo-workflow-loaded-source.d.ts","sourceRoot":"","sources":["../src/repo-workflow-loaded-source.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAE7D,OAAO,KAAK,EACV,gCAAgC,EAChC,gCAAgC,EACjC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EACV,sBAAsB,EACtB,0BAA0B,EAC1B,+BAA+B,EAC/B,8BAA8B,EAC/B,MAAM,qBAAqB,CAAC;AAE7B,MAAM,WAAW,kCAAkC;IACjD,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,8BAA8B,CAAC;IACvE,gCAAgC,CAC9B,OAAO,EAAE,+BAA+B,GACvC,0BAA0B,CAAC;CAC/B;AAED,MAAM,MAAM,wBAAwB,GAChC;IACE,EAAE,EAAE,IAAI,CAAC;IACT,UAAU,EAAE,MAAM,CAAC;IACnB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,MAAM,EAAE,sBAAsB,CAAC;IAC/B,IAAI,EAAE,WAAW,CAAC;CACnB,GACD;IACE,EAAE,EAAE,KAAK,CAAC;IACV,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,0BAA0B,CAAC,QAAQ,CAAC,CAAC;CAC9C,CAAC;AAEN,wBAAgB,sBAAsB,CAAC,OAAO,EAAE;IAC9C,MAAM,EAAE,gCAAgC,CAAC;IACzC,KAAK,EAAE,gCAAgC,CAAC;IACxC,uBAAuB,EAAE,MAAM,CAAC;IAChC,YAAY,EAAE,kCAAkC,CAAC;CAClD,GAAG,wBAAwB,CA8B3B"}
@@ -0,0 +1,21 @@
1
+ import { deriveRepoWorkflowSourceDisplayPath } from "./repo-workflow-paths.js";
2
+ export function loadRepoWorkflowSource(options) {
3
+ const sourcePath = deriveRepoWorkflowSourceDisplayPath(options.scope, options.source.absolutePath, options.source.relativePath, options.currentWorkingDirectory);
4
+ const loadResult = options.dependencies.loadValidatedDiagramSpec(options.source.absolutePath);
5
+ if (!loadResult.ok) {
6
+ const report = options.dependencies.createRepairableDiagnosticReport(loadResult.failure);
7
+ return {
8
+ ok: false,
9
+ sourcePath,
10
+ errors: report.errors,
11
+ };
12
+ }
13
+ return {
14
+ ok: true,
15
+ sourcePath,
16
+ sourceAbsolutePath: options.source.absolutePath,
17
+ source: loadResult.source,
18
+ spec: loadResult.spec,
19
+ };
20
+ }
21
+ //# sourceMappingURL=repo-workflow-loaded-source.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repo-workflow-loaded-source.js","sourceRoot":"","sources":["../src/repo-workflow-loaded-source.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mCAAmC,EAAE,MAAM,0BAA0B,CAAC;AAiC/E,MAAM,UAAU,sBAAsB,CAAC,OAKtC;IACC,MAAM,UAAU,GAAG,mCAAmC,CACpD,OAAO,CAAC,KAAK,EACb,OAAO,CAAC,MAAM,CAAC,YAAY,EAC3B,OAAO,CAAC,MAAM,CAAC,YAAY,EAC3B,OAAO,CAAC,uBAAuB,CAChC,CAAC;IACF,MAAM,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC,wBAAwB,CAC9D,OAAO,CAAC,MAAM,CAAC,YAAY,CAC5B,CAAC;IAEF,IAAI,CAAC,UAAU,CAAC,EAAE,EAAE,CAAC;QACnB,MAAM,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,gCAAgC,CAClE,UAAU,CAAC,OAAO,CACnB,CAAC;QAEF,OAAO;YACL,EAAE,EAAE,KAAK;YACT,UAAU;YACV,MAAM,EAAE,MAAM,CAAC,MAAM;SACtB,CAAC;IACJ,CAAC;IAED,OAAO;QACL,EAAE,EAAE,IAAI;QACR,UAAU;QACV,kBAAkB,EAAE,OAAO,CAAC,MAAM,CAAC,YAAY;QAC/C,MAAM,EAAE,UAAU,CAAC,MAAM;QACzB,IAAI,EAAE,UAAU,CAAC,IAAI;KACtB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { MarkdownEmbedReferencedArtifactIssue, RepoWorkflowCheckConfiguredArtifactResult } from "./repo-workflow-configured-artifact-result.js";
2
+ export declare function referencedArtifactIssue(artifact: RepoWorkflowCheckConfiguredArtifactResult): MarkdownEmbedReferencedArtifactIssue | undefined;
3
+ export declare function markdownResultWithReferencedArtifactIssues(contentResult: RepoWorkflowCheckConfiguredArtifactResult, referenceIssues: readonly MarkdownEmbedReferencedArtifactIssue[]): RepoWorkflowCheckConfiguredArtifactResult;
4
+ //# sourceMappingURL=repo-workflow-markdown-embed-freshness.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repo-workflow-markdown-embed-freshness.d.ts","sourceRoot":"","sources":["../src/repo-workflow-markdown-embed-freshness.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oCAAoC,EAEpC,yCAAyC,EAC1C,MAAM,+CAA+C,CAAC;AAEvD,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,yCAAyC,GAClD,oCAAoC,GAAG,SAAS,CAUlD;AA0GD,wBAAgB,0CAA0C,CACxD,aAAa,EAAE,yCAAyC,EACxD,eAAe,EAAE,SAAS,oCAAoC,EAAE,GAC/D,yCAAyC,CAyB3C"}
@@ -0,0 +1,96 @@
1
+ export function referencedArtifactIssue(artifact) {
2
+ if (artifact.format === "markdown" || artifact.status === "fresh") {
3
+ return undefined;
4
+ }
5
+ return {
6
+ format: artifact.format,
7
+ path: artifact.path,
8
+ status: artifact.status,
9
+ };
10
+ }
11
+ function referencedArtifactStaleReason(issue) {
12
+ if (issue.status === "missing-artifact") {
13
+ return "referenced-artifact-missing";
14
+ }
15
+ if (issue.status === "unreadable-artifact") {
16
+ return "referenced-artifact-unreadable";
17
+ }
18
+ if (issue.status === "unchecked") {
19
+ return "referenced-artifact-unchecked";
20
+ }
21
+ return "referenced-artifact-stale";
22
+ }
23
+ function uniqueMarkdownStaleReasons(reasons) {
24
+ return [...new Set(reasons)];
25
+ }
26
+ function optionalString(value) {
27
+ return typeof value === "string" ? value : undefined;
28
+ }
29
+ function expectedContentHashValue(result) {
30
+ if ("expectedSha256" in result) {
31
+ return optionalString(result.expectedSha256);
32
+ }
33
+ return undefined;
34
+ }
35
+ function actualContentHashValue(result) {
36
+ if ("actualSha256" in result) {
37
+ return optionalString(result.actualSha256);
38
+ }
39
+ return undefined;
40
+ }
41
+ function contentHashValue(result, key) {
42
+ return key === "expectedSha256"
43
+ ? expectedContentHashValue(result)
44
+ : actualContentHashValue(result);
45
+ }
46
+ function completeContentMismatchHashes(hashes) {
47
+ if (hashes.expectedSha256 === undefined) {
48
+ return undefined;
49
+ }
50
+ if (hashes.actualSha256 === undefined) {
51
+ return undefined;
52
+ }
53
+ return {
54
+ expectedSha256: hashes.expectedSha256,
55
+ actualSha256: hashes.actualSha256,
56
+ };
57
+ }
58
+ function contentMismatchHashes(result) {
59
+ if (result.status !== "stale") {
60
+ return undefined;
61
+ }
62
+ return completeContentMismatchHashes({
63
+ expectedSha256: contentHashValue(result, "expectedSha256"),
64
+ actualSha256: contentHashValue(result, "actualSha256"),
65
+ });
66
+ }
67
+ function markdownContentStaleReasons(result) {
68
+ return contentMismatchHashes(result) === undefined ? [] : ["content-mismatch"];
69
+ }
70
+ function acceptsReferencedArtifactIssues(result) {
71
+ return (result.format === "markdown" &&
72
+ result.status !== "missing-artifact" &&
73
+ result.status !== "unreadable-artifact");
74
+ }
75
+ export function markdownResultWithReferencedArtifactIssues(contentResult, referenceIssues) {
76
+ if (referenceIssues.length === 0 ||
77
+ !acceptsReferencedArtifactIssues(contentResult)) {
78
+ return contentResult;
79
+ }
80
+ const reasons = uniqueMarkdownStaleReasons([
81
+ ...markdownContentStaleReasons(contentResult),
82
+ ...referenceIssues.map(referencedArtifactStaleReason),
83
+ ]);
84
+ if (reasons.length === 0) {
85
+ return contentResult;
86
+ }
87
+ return {
88
+ format: "markdown",
89
+ status: "stale",
90
+ path: contentResult.path,
91
+ reasons,
92
+ ...contentMismatchHashes(contentResult),
93
+ references: referenceIssues,
94
+ };
95
+ }
96
+ //# sourceMappingURL=repo-workflow-markdown-embed-freshness.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repo-workflow-markdown-embed-freshness.js","sourceRoot":"","sources":["../src/repo-workflow-markdown-embed-freshness.ts"],"names":[],"mappings":"AAMA,MAAM,UAAU,uBAAuB,CACrC,QAAmD;IAEnD,IAAI,QAAQ,CAAC,MAAM,KAAK,UAAU,IAAI,QAAQ,CAAC,MAAM,KAAK,OAAO,EAAE,CAAC;QAClE,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO;QACL,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,IAAI,EAAE,QAAQ,CAAC,IAAI;QACnB,MAAM,EAAE,QAAQ,CAAC,MAAM;KACxB,CAAC;AACJ,CAAC;AAED,SAAS,6BAA6B,CACpC,KAA2C;IAE3C,IAAI,KAAK,CAAC,MAAM,KAAK,kBAAkB,EAAE,CAAC;QACxC,OAAO,6BAA6B,CAAC;IACvC,CAAC;IAED,IAAI,KAAK,CAAC,MAAM,KAAK,qBAAqB,EAAE,CAAC;QAC3C,OAAO,gCAAgC,CAAC;IAC1C,CAAC;IAED,IAAI,KAAK,CAAC,MAAM,KAAK,WAAW,EAAE,CAAC;QACjC,OAAO,+BAA+B,CAAC;IACzC,CAAC;IAED,OAAO,2BAA2B,CAAC;AACrC,CAAC;AAED,SAAS,0BAA0B,CACjC,OAA4C;IAE5C,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;AAC/B,CAAC;AAED,SAAS,cAAc,CAAC,KAAc;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,CAAC;KACvD,CAAC,CAAC;AACL,CAAC;AAED,SAAS,2BAA2B,CAClC,MAAiD;IAEjD,OAAO,qBAAqB,CAAC,MAAM,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC;AACjF,CAAC;AAED,SAAS,+BAA+B,CACtC,MAAiD;IAEjD,OAAO,CACL,MAAM,CAAC,MAAM,KAAK,UAAU;QAC5B,MAAM,CAAC,MAAM,KAAK,kBAAkB;QACpC,MAAM,CAAC,MAAM,KAAK,qBAAqB,CACxC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,0CAA0C,CACxD,aAAwD,EACxD,eAAgE;IAEhE,IACE,eAAe,CAAC,MAAM,KAAK,CAAC;QAC5B,CAAC,+BAA+B,CAAC,aAAa,CAAC,EAC/C,CAAC;QACD,OAAO,aAAa,CAAC;IACvB,CAAC;IAED,MAAM,OAAO,GAAG,0BAA0B,CAAC;QACzC,GAAG,2BAA2B,CAAC,aAAa,CAAC;QAC7C,GAAG,eAAe,CAAC,GAAG,CAAC,6BAA6B,CAAC;KACtD,CAAC,CAAC;IAEH,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,aAAa,CAAC;IACvB,CAAC;IAED,OAAO;QACL,MAAM,EAAE,UAAU;QAClB,MAAM,EAAE,OAAO;QACf,IAAI,EAAE,aAAa,CAAC,IAAI;QACxB,OAAO;QACP,GAAG,qBAAqB,CAAC,aAAa,CAAC;QACvC,UAAU,EAAE,eAAe;KAC5B,CAAC;AACJ,CAAC"}
@@ -0,0 +1,16 @@
1
+ import type { DiagramSpec } from "./diagramspec-topology.js";
2
+ import type { RepoWorkflowArtifactOutput, RepoWorkflowArtifactOutputFormat } from "./repo-workflow-config.js";
3
+ export interface MarkdownEmbedReferencedArtifact {
4
+ format: RepoWorkflowArtifactOutputFormat;
5
+ path: string;
6
+ }
7
+ export declare function createMarkdownEmbedReferences(options: {
8
+ outputs: readonly RepoWorkflowArtifactOutput[];
9
+ resolvePath(output: RepoWorkflowArtifactOutput): string;
10
+ }): MarkdownEmbedReferencedArtifact[];
11
+ export declare function createMarkdownEmbedContent(options: {
12
+ spec: DiagramSpec;
13
+ embedPath: string;
14
+ references: readonly MarkdownEmbedReferencedArtifact[];
15
+ }): string;
16
+ //# sourceMappingURL=repo-workflow-markdown-embed.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repo-workflow-markdown-embed.d.ts","sourceRoot":"","sources":["../src/repo-workflow-markdown-embed.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,KAAK,EACV,0BAA0B,EAC1B,gCAAgC,EACjC,MAAM,2BAA2B,CAAC;AAEnC,MAAM,WAAW,+BAA+B;IAC9C,MAAM,EAAE,gCAAgC,CAAC;IACzC,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,6BAA6B,CAAC,OAAO,EAAE;IACrD,OAAO,EAAE,SAAS,0BAA0B,EAAE,CAAC;IAC/C,WAAW,CAAC,MAAM,EAAE,0BAA0B,GAAG,MAAM,CAAC;CACzD,GAAG,+BAA+B,EAAE,CAOpC;AAiFD,wBAAgB,0BAA0B,CAAC,OAAO,EAAE;IAClD,IAAI,EAAE,WAAW,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,SAAS,+BAA+B,EAAE,CAAC;CACxD,GAAG,MAAM,CA0BT"}
@@ -0,0 +1,76 @@
1
+ import path from "node:path";
2
+ export function createMarkdownEmbedReferences(options) {
3
+ return options.outputs
4
+ .filter((output) => output.format !== "markdown")
5
+ .map((output) => ({
6
+ format: output.format,
7
+ path: options.resolvePath(output),
8
+ }));
9
+ }
10
+ function normalizePathForMarkdown(filePath) {
11
+ return filePath.split(path.sep).join("/");
12
+ }
13
+ function markdownRelativePath(fromPath, toPath) {
14
+ const relativePath = normalizePathForMarkdown(path.relative(path.dirname(fromPath), toPath));
15
+ return relativePath === "" ? path.basename(toPath) : relativePath;
16
+ }
17
+ function markdownText(value) {
18
+ return value.replace(/\\/gu, "\\\\").replace(/\[/gu, "\\[").replace(/\]/gu, "\\]");
19
+ }
20
+ const artifactLabels = {
21
+ d2: "D2",
22
+ dot: "DOT",
23
+ markdown: "Markdown",
24
+ mermaid: "Mermaid",
25
+ png: "PNG",
26
+ svg: "SVG",
27
+ };
28
+ function artifactLabel(format) {
29
+ return artifactLabels[format];
30
+ }
31
+ function primaryImageReference(references) {
32
+ return (references.find((reference) => reference.format === "svg") ??
33
+ references.find((reference) => reference.format === "png"));
34
+ }
35
+ function imageLines(options) {
36
+ if (options.reference === undefined) {
37
+ return [];
38
+ }
39
+ return [
40
+ `![${options.title}](${markdownRelativePath(options.embedPath, options.reference.path)})`,
41
+ ];
42
+ }
43
+ function linkLines(options) {
44
+ return options.references.map((reference) => `- [${artifactLabel(reference.format)} artifact](${markdownRelativePath(options.embedPath, reference.path)})`);
45
+ }
46
+ function imageLinkSeparator(imageLines, linkedReferences) {
47
+ if (imageLines.length === 0 || linkedReferences.length === 0) {
48
+ return [];
49
+ }
50
+ return [""];
51
+ }
52
+ export function createMarkdownEmbedContent(options) {
53
+ const title = markdownText(options.spec.title);
54
+ const imageReference = primaryImageReference(options.references);
55
+ const embeddedImageLines = imageLines({
56
+ title,
57
+ embedPath: options.embedPath,
58
+ reference: imageReference,
59
+ });
60
+ const linkedReferences = options.references.filter((reference) => reference !== imageReference);
61
+ const lines = [
62
+ "<!-- Generated by DiagramPilot. Do not edit by hand. -->",
63
+ "",
64
+ `# ${title}`,
65
+ "",
66
+ ...embeddedImageLines,
67
+ ...imageLinkSeparator(embeddedImageLines, linkedReferences),
68
+ ...linkLines({
69
+ embedPath: options.embedPath,
70
+ references: linkedReferences,
71
+ }),
72
+ "",
73
+ ];
74
+ return lines.join("\n");
75
+ }
76
+ //# sourceMappingURL=repo-workflow-markdown-embed.js.map
@@ -0,0 +1 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AAC,KAAK,CAAC,CAAC;IAC/C,MAAM,cAAc,GAAG,qBAAqB,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACjE,MAAM,kBAAkB,GAAG,UAAU,CAAC;QACpC,KAAK;QACL,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,SAAS,EAAE,cAAc;KAC1B,CAAC,CAAC;IACH,MAAM,gBAAgB,GAAG,OAAO,CAAC,UAAU,CAAC,MAAM,CAChD,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,KAAK,cAAc,CAC5C,CAAC;IACF,MAAM,KAAK,GAAG;QACZ,0DAA0D;QAC1D,EAAE;QACF,KAAK,KAAK,EAAE;QACZ,EAAE;QACF,GAAG,kBAAkB;QACrB,GAAG,kBAAkB,CAAC,kBAAkB,EAAE,gBAAgB,CAAC;QAC3D,GAAG,SAAS,CAAC;YACX,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,UAAU,EAAE,gBAAgB;SAC7B,CAAC;QACF,EAAE;KACH,CAAC;IAEF,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { DiagramPilotSourceDiscoveryScope } from "./source-discovery.js";
2
+ export declare function normalizePathForDisplay(filePath: string): string;
3
+ export declare function deriveRepoWorkflowSourceDisplayPath(scope: DiagramPilotSourceDiscoveryScope, absolutePath: string, relativePath: string, currentWorkingDirectory: string): string;
4
+ export declare function deriveDefaultArtifactDisplayPath(sourcePath: string, artifactPath: string, currentWorkingDirectory: string): string;
5
+ export declare function deriveRepoWorkflowConfigDisplayPath(configPath: string, currentWorkingDirectory: string): string;
6
+ //# sourceMappingURL=repo-workflow-paths.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repo-workflow-paths.d.ts","sourceRoot":"","sources":["../src/repo-workflow-paths.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,uBAAuB,CAAC;AAE9E,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEhE;AAED,wBAAgB,mCAAmC,CACjD,KAAK,EAAE,gCAAgC,EACvC,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,MAAM,EACpB,uBAAuB,EAAE,MAAM,GAC9B,MAAM,CAQR;AAED,wBAAgB,gCAAgC,CAC9C,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,EACpB,uBAAuB,EAAE,MAAM,GAC9B,MAAM,CAUR;AAED,wBAAgB,mCAAmC,CACjD,UAAU,EAAE,MAAM,EAClB,uBAAuB,EAAE,MAAM,GAC9B,MAAM,CAYR"}
@@ -0,0 +1,27 @@
1
+ import path from "node:path";
2
+ export function normalizePathForDisplay(filePath) {
3
+ return filePath.split(path.sep).join("/");
4
+ }
5
+ export function deriveRepoWorkflowSourceDisplayPath(scope, absolutePath, relativePath, currentWorkingDirectory) {
6
+ if (scope.kind === "directory") {
7
+ return relativePath;
8
+ }
9
+ return normalizePathForDisplay(path.relative(currentWorkingDirectory, absolutePath));
10
+ }
11
+ export function deriveDefaultArtifactDisplayPath(sourcePath, artifactPath, currentWorkingDirectory) {
12
+ const relativeArtifactPath = normalizePathForDisplay(path.relative(currentWorkingDirectory, artifactPath));
13
+ if (!relativeArtifactPath.startsWith("..")) {
14
+ return relativeArtifactPath;
15
+ }
16
+ return sourcePath.replace(/\.dp\.(yaml|json)$/iu, ".svg");
17
+ }
18
+ export function deriveRepoWorkflowConfigDisplayPath(configPath, currentWorkingDirectory) {
19
+ const relativeConfigPath = path.relative(currentWorkingDirectory, configPath);
20
+ if (relativeConfigPath !== "" &&
21
+ !relativeConfigPath.startsWith("..") &&
22
+ !path.isAbsolute(relativeConfigPath)) {
23
+ return normalizePathForDisplay(relativeConfigPath);
24
+ }
25
+ return normalizePathForDisplay(configPath);
26
+ }
27
+ //# sourceMappingURL=repo-workflow-paths.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repo-workflow-paths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BAAuB,CAAC,UAAU,CAAC,CAAC;AAC7C,CAAC"}
@@ -1,3 +1,5 @@
1
1
  import { type RepoWorkflowCheckOptions, type RepoWorkflowCheckResult } from "./repo-workflow-check.js";
2
+ import { type RepoWorkflowGenerateOptions, type RepoWorkflowGenerateResult } from "./repo-workflow-generate.js";
2
3
  export declare function checkDiagramPilotRepoWorkflow(options: RepoWorkflowCheckOptions): Promise<RepoWorkflowCheckResult>;
4
+ export declare function generateDiagramPilotRepoWorkflow(options: RepoWorkflowGenerateOptions): Promise<RepoWorkflowGenerateResult>;
3
5
  //# sourceMappingURL=repo-workflow.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"repo-workflow.d.ts","sourceRoot":"","sources":["../src/repo-workflow.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAC7B,MAAM,0BAA0B,CAAC;AAMlC,wBAAsB,6BAA6B,CACjD,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,uBAAuB,CAAC,CAUlC"}
1
+ {"version":3,"file":"repo-workflow.d.ts","sourceRoot":"","sources":["../src/repo-workflow.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAC7B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAEL,KAAK,2BAA2B,EAChC,KAAK,0BAA0B,EAChC,MAAM,6BAA6B,CAAC;AAMrC,wBAAsB,6BAA6B,CACjD,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,uBAAuB,CAAC,CAUlC;AAED,wBAAsB,gCAAgC,CACpD,OAAO,EAAE,2BAA2B,GACnC,OAAO,CAAC,0BAA0B,CAAC,CAQrC"}
@@ -1,4 +1,5 @@
1
1
  import { checkDiagramPilotRepoWorkflowWithDependencies, } from "./repo-workflow-check.js";
2
+ import { generateDiagramPilotRepoWorkflowWithDependencies, } from "./repo-workflow-generate.js";
2
3
  import { discoverRepoWorkflowConfig } from "./repo-workflow-config.js";
3
4
  import { createRepairableDiagnosticReport, loadValidatedDiagramSpec } from "./source-loading.js";
4
5
  import { discoverDiagramPilotSourceFiles } from "./source-discovery.js";
@@ -14,4 +15,13 @@ export async function checkDiagramPilotRepoWorkflow(options) {
14
15
  getCurrentWorkingDirectory: () => process.cwd(),
15
16
  });
16
17
  }
18
+ export async function generateDiagramPilotRepoWorkflow(options) {
19
+ return generateDiagramPilotRepoWorkflowWithDependencies(options, {
20
+ discoverRepoWorkflowConfig,
21
+ discoverDiagramPilotSourceFiles,
22
+ loadValidatedDiagramSpec,
23
+ createRepairableDiagnosticReport,
24
+ getCurrentWorkingDirectory: () => process.cwd(),
25
+ });
26
+ }
17
27
  //# sourceMappingURL=repo-workflow.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"repo-workflow.js","sourceRoot":"","sources":["../src/repo-workflow.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,6CAA6C,GAG9C,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,EAAE,gCAAgC,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AACjG,OAAO,EAAE,+BAA+B,EAAE,MAAM,uBAAuB,CAAC;AACxE,OAAO,EAAE,mDAAmD,EAAE,MAAM,6BAA6B,CAAC;AAElG,MAAM,CAAC,KAAK,UAAU,6BAA6B,CACjD,OAAiC;IAEjC,OAAO,6CAA6C,CAAC,OAAO,EAAE;QAC5D,0BAA0B;QAC1B,+BAA+B;QAC/B,wBAAwB;QACxB,mDAAmD;QACnD,4BAA4B,EAAE,OAAO,CAAC,4BAA4B;QAClE,gCAAgC;QAChC,0BAA0B,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE;KAChD,CAAC,CAAC;AACL,CAAC"}
1
+ {"version":3,"file":"repo-workflow.js","sourceRoot":"","sources":["../src/repo-workflow.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,6CAA6C,GAG9C,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,gDAAgD,GAGjD,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,EAAE,gCAAgC,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AACjG,OAAO,EAAE,+BAA+B,EAAE,MAAM,uBAAuB,CAAC;AACxE,OAAO,EAAE,mDAAmD,EAAE,MAAM,6BAA6B,CAAC;AAElG,MAAM,CAAC,KAAK,UAAU,6BAA6B,CACjD,OAAiC;IAEjC,OAAO,6CAA6C,CAAC,OAAO,EAAE;QAC5D,0BAA0B;QAC1B,+BAA+B;QAC/B,wBAAwB;QACxB,mDAAmD;QACnD,4BAA4B,EAAE,OAAO,CAAC,4BAA4B;QAClE,gCAAgC;QAChC,0BAA0B,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE;KAChD,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gCAAgC,CACpD,OAAoC;IAEpC,OAAO,gDAAgD,CAAC,OAAO,EAAE;QAC/D,0BAA0B;QAC1B,+BAA+B;QAC/B,wBAAwB;QACxB,gCAAgC;QAChC,0BAA0B,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE;KAChD,CAAC,CAAC;AACL,CAAC"}
package/dist/version.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export declare const DIAGRAMPILOT_VERSION = "0.2.6";
1
+ export declare const DIAGRAMPILOT_VERSION = "0.2.7-nightly.52.1.858a8d2";
2
2
  export declare function getDiagramPilotVersion(): string;
3
3
  //# sourceMappingURL=version.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,UAAU,CAAC;AAE5C,wBAAgB,sBAAsB,IAAI,MAAM,CAE/C"}
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,+BAA+B,CAAC;AAEjE,wBAAgB,sBAAsB,IAAI,MAAM,CAE/C"}
package/dist/version.js CHANGED
@@ -1,4 +1,4 @@
1
- export const DIAGRAMPILOT_VERSION = "0.2.6";
1
+ export const DIAGRAMPILOT_VERSION = "0.2.7-nightly.52.1.858a8d2";
2
2
  export function getDiagramPilotVersion() {
3
3
  return DIAGRAMPILOT_VERSION;
4
4
  }
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,oBAAoB,GAAG,OAAO,CAAC;AAE5C,MAAM,UAAU,sBAAsB;IACpC,OAAO,oBAAoB,CAAC;AAC9B,CAAC"}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,oBAAoB,GAAG,4BAA4B,CAAC;AAEjE,MAAM,UAAU,sBAAsB;IACpC,OAAO,oBAAoB,CAAC;AAC9B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diagrampilot/core",
3
- "version": "0.2.6",
3
+ "version": "0.2.7-nightly.52.1.858a8d2",
4
4
  "description": "DiagramSpec types and core behavior for DiagramPilot.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -43,7 +43,7 @@
43
43
  "build": "tsc -b"
44
44
  },
45
45
  "dependencies": {
46
- "@diagrampilot/icons": "0.2.6",
46
+ "@diagrampilot/icons": "0.2.7-nightly.52.1.858a8d2",
47
47
  "yaml": "^2.9.0"
48
48
  }
49
49
  }