@canonical/design-system 0.1.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.
- package/.mcp.json +8 -0
- package/README.md +438 -0
- package/biome.json +6 -0
- package/bun.lock +349 -0
- package/data/apps/component/file_tree.ttl +8 -0
- package/data/apps/component/key_value_pair.ttl +8 -0
- package/data/apps/component/navigation.ttl +8 -0
- package/data/apps/component/skeleton_loading.ttl +8 -0
- package/data/apps/component/status_bar.ttl +8 -0
- package/data/apps/component/toolbar.ttl +8 -0
- package/data/apps/layout/application_layout.ttl +8 -0
- package/data/apps/layout/empty_layout.ttl +8 -0
- package/data/apps/layout/list_page_layout.ttl +8 -0
- package/data/apps/layout/settings_page_layout.ttl +8 -0
- package/data/apps/pattern/code_diff.ttl +8 -0
- package/data/apps/pattern/data_table.ttl +8 -0
- package/data/apps/pattern/destructive_modal.ttl +8 -0
- package/data/apps/pattern/key_value_summary.ttl +8 -0
- package/data/apps/pattern/keyboard_shortcuts.ttl +8 -0
- package/data/apps/pattern/notification_center.ttl +8 -0
- package/data/apps/pattern/side_panel.ttl +8 -0
- package/data/apps/pattern/sidepanel_stacked.ttl +8 -0
- package/data/apps.ttl +5 -0
- package/data/apps_wpe.ttl +5 -0
- package/data/documentation/layout/documentation_layout.ttl +8 -0
- package/data/documentation.ttl +5 -0
- package/data/global/component/accordion.ttl +14 -0
- package/data/global/component/announcement.ttl +8 -0
- package/data/global/component/badge.ttl +9 -0
- package/data/global/component/button.ttl +20 -0
- package/data/global/component/card.ttl +8 -0
- package/data/global/component/chip.ttl +8 -0
- package/data/global/component/code_snippet.ttl +8 -0
- package/data/global/component/contextual_menu.ttl +8 -0
- package/data/global/component/heading.ttl +14 -0
- package/data/global/component/icon.ttl +14 -0
- package/data/global/component/icon_in_container.ttl +8 -0
- package/data/global/component/keyboard_key.ttl +8 -0
- package/data/global/component/label.ttl +15 -0
- package/data/global/component/link.ttl +8 -0
- package/data/global/component/notification_inline.ttl +8 -0
- package/data/global/component/notification_toast.ttl +8 -0
- package/data/global/component/pagination.ttl +8 -0
- package/data/global/component/popover.ttl +8 -0
- package/data/global/component/rich_text_editor.ttl +8 -0
- package/data/global/component/search_bar.ttl +8 -0
- package/data/global/component/table.ttl +8 -0
- package/data/global/component/tabs.ttl +8 -0
- package/data/global/component/theme_switcher.ttl +8 -0
- package/data/global/component/tile.ttl +14 -0
- package/data/global/component/tooltip.ttl +8 -0
- package/data/global/group/buttons.ttl +8 -0
- package/data/global/group/cards.ttl +8 -0
- package/data/global/group/tiles.ttl +8 -0
- package/data/global/layout/error_layout.ttl +8 -0
- package/data/global/layout/form_layout.ttl +8 -0
- package/data/global/layout/identity_page_form.ttl +8 -0
- package/data/global/modifier/alpha.ttl +6 -0
- package/data/global/modifier/beta.ttl +6 -0
- package/data/global/modifier/caution.ttl +6 -0
- package/data/global/modifier/comfortable.ttl +6 -0
- package/data/global/modifier/completed.ttl +6 -0
- package/data/global/modifier/constructive.ttl +6 -0
- package/data/global/modifier/dark.ttl +6 -0
- package/data/global/modifier/dense.ttl +6 -0
- package/data/global/modifier/destructive.ttl +6 -0
- package/data/global/modifier/editable.ttl +6 -0
- package/data/global/modifier/elevated.ttl +6 -0
- package/data/global/modifier/error.ttl +6 -0
- package/data/global/modifier/experimental.ttl +6 -0
- package/data/global/modifier/failed.ttl +6 -0
- package/data/global/modifier/focused.ttl +6 -0
- package/data/global/modifier/highlighted.ttl +6 -0
- package/data/global/modifier/in_progress.ttl +6 -0
- package/data/global/modifier/information.ttl +6 -0
- package/data/global/modifier/light.ttl +6 -0
- package/data/global/modifier/loading.ttl +6 -0
- package/data/global/modifier/muted.ttl +6 -0
- package/data/global/modifier/paper.ttl +6 -0
- package/data/global/modifier/planned.ttl +6 -0
- package/data/global/modifier/primary.ttl +6 -0
- package/data/global/modifier/secondary.ttl +6 -0
- package/data/global/modifier/stable.ttl +6 -0
- package/data/global/modifier/success.ttl +6 -0
- package/data/global/modifier/tertiary.ttl +6 -0
- package/data/global/modifier/warning.ttl +6 -0
- package/data/global/modifier/wireframe.ttl +6 -0
- package/data/global/modifier_family/_color_luminosity.ttl +7 -0
- package/data/global/modifier_family/_emphasis.ttl +7 -0
- package/data/global/modifier_family/_other.ttl +7 -0
- package/data/global/modifier_family/anticipation.ttl +7 -0
- package/data/global/modifier_family/criticality.ttl +7 -0
- package/data/global/modifier_family/density.ttl +7 -0
- package/data/global/modifier_family/importance.ttl +7 -0
- package/data/global/modifier_family/lifecycle.ttl +7 -0
- package/data/global/modifier_family/release.ttl +7 -0
- package/data/global/pattern/breadcrumbs.ttl +14 -0
- package/data/global/pattern/info_table.ttl +8 -0
- package/data/global/pattern/modal.ttl +8 -0
- package/data/global/pattern/navigation.ttl +8 -0
- package/data/global/pattern/select_button.ttl +8 -0
- package/data/global/pattern/stepper.ttl +8 -0
- package/data/global/pattern/table_of_contents.ttl +8 -0
- package/data/global/pattern/timeline.ttl +14 -0
- package/data/global/subcomponent/accordion-item.ttl +19 -0
- package/data/global/subcomponent/breadcrumbs-item.ttl +19 -0
- package/data/global/subcomponent/card-content.ttl +14 -0
- package/data/global/subcomponent/card-header.ttl +14 -0
- package/data/global/subcomponent/card-image.ttl +20 -0
- package/data/global/subcomponent/divider.ttl +8 -0
- package/data/global/subcomponent/modal-content.ttl +8 -0
- package/data/global/subcomponent/modal-footer.ttl +8 -0
- package/data/global/subcomponent/modal-header.ttl +8 -0
- package/data/global/subcomponent/spinner.ttl +8 -0
- package/data/global/subcomponent/table-cell.ttl +8 -0
- package/data/global/subcomponent/table-row.ttl +8 -0
- package/data/global/subcomponent/tile-content.ttl +14 -0
- package/data/global/subcomponent/tile-header.ttl +14 -0
- package/data/global/subcomponent/timeline-content.ttl +14 -0
- package/data/global/subcomponent/timeline-event.ttl +31 -0
- package/data/global/subcomponent/timeline-footer.ttl +8 -0
- package/data/global/subcomponent/timeline-header.ttl +8 -0
- package/data/global.ttl +5 -0
- package/data/global_form/component/checkbox_input.ttl +8 -0
- package/data/global_form/component/choices_input.ttl +8 -0
- package/data/global_form/component/combobox_input.ttl +8 -0
- package/data/global_form/component/custom_choices_input.ttl +8 -0
- package/data/global_form/component/datepicker_input.ttl +8 -0
- package/data/global_form/component/rating_input.ttl +8 -0
- package/data/global_form/component/segmented_control_input.ttl +8 -0
- package/data/global_form/component/slider_input.ttl +8 -0
- package/data/global_form/component/switch_input.ttl +8 -0
- package/data/global_form/component/text_input.ttl +8 -0
- package/data/global_form/component/textarea_input.ttl +8 -0
- package/data/global_form/component/wysiwginput.ttl +8 -0
- package/data/global_form/pattern/field.ttl +8 -0
- package/data/global_form/pattern/form.ttl +8 -0
- package/data/global_form/subcomponent/field-description.ttl +8 -0
- package/data/global_form/subcomponent/field-label.ttl +8 -0
- package/data/global_form.ttl +5 -0
- package/data/site/component/quote.ttl +8 -0
- package/data/site/component/rule.ttl +8 -0
- package/data/site/component/section.ttl +8 -0
- package/data/site/layout/site_layout.ttl +8 -0
- package/data/site/pattern/hero-github.ttl +8 -0
- package/data/site/pattern/hero.ttl +8 -0
- package/data/site/pattern/info_table.ttl +8 -0
- package/data/site/pattern/skip_link.ttl +8 -0
- package/data/site.ttl +5 -0
- package/data/stores.ttl +5 -0
- package/definitions/ontology.ttl +498 -0
- package/package.json +42 -0
- package/session/A.DSL.md +429 -0
- package/session/B.NOTES.md +84 -0
- package/session/global.component.accordion.yaml +13 -0
- package/session/global.component.button.yaml +26 -0
- package/session/global.component.card.yaml +24 -0
- package/session/global.component.icon.yaml +7 -0
- package/session/global.component.label.yaml +7 -0
- package/session/global.component.tile.yaml +21 -0
- package/session/global.component.timeline.yaml +20 -0
- package/session/global.pattern.breadcrumbs.yaml +13 -0
- package/session/global.subcomponent.accordion-item.yaml +37 -0
- package/session/global.subcomponent.breadcrumbs-item.yaml +21 -0
- package/session/global.subcomponent.card-content.yaml +7 -0
- package/session/global.subcomponent.card-header.yaml +22 -0
- package/session/global.subcomponent.card-image.yaml +7 -0
- package/session/global.subcomponent.tile-content.yaml +7 -0
- package/session/global.subcomponent.tile-header.yaml +8 -0
- package/session/global.subcomponent.timeline-content.yaml +13 -0
- package/session/global.subcomponent.timeline-event.yaml +20 -0
- package/session/global.subcomponent.timeline-footer.yaml +9 -0
- package/session/global.subcomponent.timeline-header.yaml +18 -0
- package/skills/anatomy-author/ANATOMY_DSL_SPEC.md +423 -0
- package/skills/anatomy-author/SKILL.md +911 -0
- package/skills/component-specifier/SKILL.md +413 -0
- package/skills/design-auditor/SKILL.md +428 -0
- package/source.json +101 -0
- package/src/cli.ts +45 -0
- package/src/collect/generateTurtle.tests.ts +200 -0
- package/src/collect/generateTurtle.ts +187 -0
- package/src/collect/index.ts +4 -0
- package/src/collect/scanAnnotations.tests.ts +138 -0
- package/src/collect/scanAnnotations.ts +78 -0
- package/src/collect/types.ts +57 -0
- package/src/collect/validateCollectConfig.tests.ts +116 -0
- package/src/collect/validateCollectConfig.ts +74 -0
- package/src/collect-implementations.ts +99 -0
- package/src/commands/extract.tests.ts +41 -0
- package/src/commands/extract.ts +48 -0
- package/src/commands/index.ts +3 -0
- package/src/commands/list.tests.ts +26 -0
- package/src/commands/list.ts +26 -0
- package/src/commands/transform.tests.ts +28 -0
- package/src/commands/transform.ts +133 -0
- package/src/config/index.ts +2 -0
- package/src/config/source.schema.json +110 -0
- package/src/config/types.ts +97 -0
- package/src/config/validateConfig.tests.ts +46 -0
- package/src/config/validateConfig.ts +21 -0
- package/src/constants.ts +20 -0
- package/src/graph/GraphStore.tests.ts +157 -0
- package/src/graph/GraphStore.ts +200 -0
- package/src/graph/PrefixMap.tests.ts +129 -0
- package/src/graph/PrefixMap.ts +95 -0
- package/src/graph/buildUri.tests.ts +158 -0
- package/src/graph/buildUri.ts +69 -0
- package/src/graph/index.ts +4 -0
- package/src/graph/types.ts +20 -0
- package/src/providers/CodaProvider.tests.ts +241 -0
- package/src/providers/CodaProvider.ts +174 -0
- package/src/providers/CodaProvider.types.generated.ts +12236 -0
- package/src/providers/index.ts +18 -0
- package/src/serializers/JSONSerializer.tests.ts +79 -0
- package/src/serializers/JSONSerializer.ts +87 -0
- package/src/serializers/TTLSerializer.tests.ts +75 -0
- package/src/serializers/TTLSerializer.ts +99 -0
- package/src/serializers/index.ts +3 -0
- package/src/serializers/types.ts +16 -0
- package/src/transform/resolveReferences.tests.ts +63 -0
- package/src/transform/resolveReferences.ts +36 -0
- package/src/transform/resolveValue.tests.ts +76 -0
- package/src/transform/resolveValue.ts +87 -0
- package/src/transform/transform.tests.ts +99 -0
- package/src/transform/transform.ts +109 -0
- package/src/transform/transformRow.tests.ts +269 -0
- package/src/transform/transformRow.ts +220 -0
- package/src/transform/types.ts +26 -0
- package/tsconfig.json +8 -0
- package/vite.config.ts +11 -0
- package/vitest.config.ts +21 -0
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import { generateLibraryTurtle, generateObjectsTurtle } from "./generateTurtle.js";
|
|
3
|
+
import type { CollectConfig, ImplementsAnnotation } from "./types.js";
|
|
4
|
+
|
|
5
|
+
describe("generateLibraryTurtle", () => {
|
|
6
|
+
const minimalConfig: CollectConfig = {
|
|
7
|
+
name: "Test Library",
|
|
8
|
+
platform: "react",
|
|
9
|
+
link: "https://github.com/example/test",
|
|
10
|
+
prefix: {
|
|
11
|
+
short: "ds",
|
|
12
|
+
namespace: "https://ds.canonical.com/data/",
|
|
13
|
+
},
|
|
14
|
+
pattern: "src/**/*.tsx",
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
it("should generate valid Turtle for minimal config", async () => {
|
|
18
|
+
const ttl = await generateLibraryTurtle(minimalConfig);
|
|
19
|
+
|
|
20
|
+
expect(ttl).toContain("@prefix dso: <https://ds.canonical.com/ontology#>");
|
|
21
|
+
expect(ttl).toContain("@prefix ds: <https://ds.canonical.com/data/>");
|
|
22
|
+
expect(ttl).toContain("ds:implementation.library.test-library");
|
|
23
|
+
expect(ttl).toContain("a dso:ImplementationLibrary");
|
|
24
|
+
expect(ttl).toContain('dso:libraryName "Test Library"');
|
|
25
|
+
expect(ttl).toContain('dso:platform "react"');
|
|
26
|
+
expect(ttl).toContain('dso:link "https://github.com/example/test"');
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it("should include optional properties when provided", async () => {
|
|
30
|
+
const fullConfig: CollectConfig = {
|
|
31
|
+
...minimalConfig,
|
|
32
|
+
description: "A test library",
|
|
33
|
+
documentation: "https://docs.example.com",
|
|
34
|
+
tier: "ds:global",
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const ttl = await generateLibraryTurtle(fullConfig);
|
|
38
|
+
|
|
39
|
+
expect(ttl).toContain('dso:libraryDescription "A test library"');
|
|
40
|
+
expect(ttl).toContain('dso:documentation "https://docs.example.com"');
|
|
41
|
+
expect(ttl).toContain("dso:libraryTier ds:global");
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it("should slugify library name for URI", async () => {
|
|
45
|
+
const config: CollectConfig = {
|
|
46
|
+
...minimalConfig,
|
|
47
|
+
name: "Pragma React Components",
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const ttl = await generateLibraryTurtle(config);
|
|
51
|
+
|
|
52
|
+
expect(ttl).toContain("ds:implementation.library.pragma-react-components");
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it("should throw error when using reserved prefix 'dso'", () => {
|
|
56
|
+
const config: CollectConfig = {
|
|
57
|
+
...minimalConfig,
|
|
58
|
+
prefix: {
|
|
59
|
+
short: "dso",
|
|
60
|
+
namespace: "https://example.com/data/",
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
expect(() => generateLibraryTurtle(config)).toThrow('Prefix "dso" is reserved');
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it("should throw error when using reserved prefix 'rdf'", () => {
|
|
68
|
+
const config: CollectConfig = {
|
|
69
|
+
...minimalConfig,
|
|
70
|
+
prefix: {
|
|
71
|
+
short: "rdf",
|
|
72
|
+
namespace: "https://example.com/data/",
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
expect(() => generateLibraryTurtle(config)).toThrow('Prefix "rdf" is reserved');
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it("should allow non-reserved prefixes", async () => {
|
|
80
|
+
const config: CollectConfig = {
|
|
81
|
+
...minimalConfig,
|
|
82
|
+
prefix: {
|
|
83
|
+
short: "myprefix",
|
|
84
|
+
namespace: "https://example.com/data/",
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
const ttl = await generateLibraryTurtle(config);
|
|
89
|
+
expect(ttl).toContain("@prefix myprefix: <https://example.com/data/>");
|
|
90
|
+
expect(ttl).toContain("@prefix dso: <https://ds.canonical.com/ontology#>");
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
describe("generateObjectsTurtle", () => {
|
|
95
|
+
const config: CollectConfig = {
|
|
96
|
+
name: "Test Library",
|
|
97
|
+
platform: "react",
|
|
98
|
+
link: "https://github.com/example/test",
|
|
99
|
+
prefix: {
|
|
100
|
+
short: "ds",
|
|
101
|
+
namespace: "https://ds.canonical.com/data/",
|
|
102
|
+
},
|
|
103
|
+
pattern: "src/**/*.tsx",
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
it("should return empty string for empty annotations", async () => {
|
|
107
|
+
const ttl = await generateObjectsTurtle(config, [], "/base");
|
|
108
|
+
expect(ttl).toBe("");
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
it("should generate valid Turtle for annotations", async () => {
|
|
112
|
+
const annotations: ImplementsAnnotation[] = [
|
|
113
|
+
{
|
|
114
|
+
filePath: "/base/src/components/Button.tsx",
|
|
115
|
+
blockUri: "ds:global.component.button",
|
|
116
|
+
},
|
|
117
|
+
];
|
|
118
|
+
|
|
119
|
+
const ttl = await generateObjectsTurtle(config, annotations, "/base");
|
|
120
|
+
|
|
121
|
+
expect(ttl).toContain("@prefix dso: <https://ds.canonical.com/ontology#>");
|
|
122
|
+
// URI is derived from file path, not block URI
|
|
123
|
+
expect(ttl).toContain("ds:implementation.object.test-library.button");
|
|
124
|
+
expect(ttl).toContain("a dso:ImplementationObject");
|
|
125
|
+
expect(ttl).toContain("dso:library ds:implementation.library.test-library");
|
|
126
|
+
expect(ttl).toContain("dso:implementsBlock ds:global.component.button");
|
|
127
|
+
expect(ttl).toContain('dso:headLink "src/components/Button.tsx"');
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
it("should include version when provided", async () => {
|
|
131
|
+
const annotations: ImplementsAnnotation[] = [
|
|
132
|
+
{
|
|
133
|
+
filePath: "/base/src/Card.tsx",
|
|
134
|
+
blockUri: "ds:global.component.card",
|
|
135
|
+
version: "1.2.3",
|
|
136
|
+
},
|
|
137
|
+
];
|
|
138
|
+
|
|
139
|
+
const ttl = await generateObjectsTurtle(config, annotations, "/base");
|
|
140
|
+
|
|
141
|
+
expect(ttl).toContain('dso:implementationVersion "1.2.3"');
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
it("should include isDraft when true", async () => {
|
|
145
|
+
const annotations: ImplementsAnnotation[] = [
|
|
146
|
+
{
|
|
147
|
+
filePath: "/base/src/Modal.tsx",
|
|
148
|
+
blockUri: "ds:global.pattern.modal",
|
|
149
|
+
isDraft: true,
|
|
150
|
+
},
|
|
151
|
+
];
|
|
152
|
+
|
|
153
|
+
const ttl = await generateObjectsTurtle(config, annotations, "/base");
|
|
154
|
+
|
|
155
|
+
expect(ttl).toContain('dso:isDraft "true"');
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
it("should generate multiple implementation objects", async () => {
|
|
159
|
+
const annotations: ImplementsAnnotation[] = [
|
|
160
|
+
{
|
|
161
|
+
filePath: "/base/src/Button.tsx",
|
|
162
|
+
blockUri: "ds:global.component.button",
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
filePath: "/base/src/Card.tsx",
|
|
166
|
+
blockUri: "ds:global.component.card",
|
|
167
|
+
version: "1.0.0",
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
filePath: "/base/src/Modal.tsx",
|
|
171
|
+
blockUri: "ds:global.pattern.modal",
|
|
172
|
+
isDraft: true,
|
|
173
|
+
},
|
|
174
|
+
];
|
|
175
|
+
|
|
176
|
+
const ttl = await generateObjectsTurtle(config, annotations, "/base");
|
|
177
|
+
|
|
178
|
+
// URIs are derived from file paths, not block URIs
|
|
179
|
+
expect(ttl).toContain("ds:implementation.object.test-library.button");
|
|
180
|
+
expect(ttl).toContain("ds:implementation.object.test-library.card");
|
|
181
|
+
expect(ttl).toContain("ds:implementation.object.test-library.modal");
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
it("should use relative paths for headLink", async () => {
|
|
185
|
+
const annotations: ImplementsAnnotation[] = [
|
|
186
|
+
{
|
|
187
|
+
filePath: "/project/packages/react/src/deep/nested/Component.tsx",
|
|
188
|
+
blockUri: "ds:component.test",
|
|
189
|
+
},
|
|
190
|
+
];
|
|
191
|
+
|
|
192
|
+
const ttl = await generateObjectsTurtle(
|
|
193
|
+
config,
|
|
194
|
+
annotations,
|
|
195
|
+
"/project/packages/react",
|
|
196
|
+
);
|
|
197
|
+
|
|
198
|
+
expect(ttl).toContain('dso:headLink "src/deep/nested/Component.tsx"');
|
|
199
|
+
});
|
|
200
|
+
});
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { relative } from "node:path";
|
|
2
|
+
import { GraphStore, PrefixMap } from "../graph/index.js";
|
|
3
|
+
import serializeToTurtle from "../serializers/TTLSerializer.js";
|
|
4
|
+
import type { CollectConfig, ImplementsAnnotation } from "./types.js";
|
|
5
|
+
|
|
6
|
+
/** Standard RDF/OWL namespaces - these are always included */
|
|
7
|
+
const STANDARD_PREFIXES: Record<string, string> = {
|
|
8
|
+
rdf: "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
|
|
9
|
+
rdfs: "http://www.w3.org/2000/01/rdf-schema#",
|
|
10
|
+
xsd: "http://www.w3.org/2001/XMLSchema#",
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
/** Reserved prefixes that cannot be overridden by user config */
|
|
14
|
+
const RESERVED_PREFIXES = new Set(["rdf", "rdfs", "xsd", "owl"]);
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Generate a slug from a string for URI
|
|
18
|
+
* e.g., "Pragma React" -> "pragma-react"
|
|
19
|
+
* e.g., "src/lib/Button/Button.tsx" -> "src-lib-button-button-tsx"
|
|
20
|
+
*/
|
|
21
|
+
function slugify(name: string): string {
|
|
22
|
+
return name
|
|
23
|
+
.toLowerCase()
|
|
24
|
+
.replace(/[^a-z0-9]+/g, "-")
|
|
25
|
+
.replace(/^-|-$/g, "");
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Generate a unique slug from a file path for URI
|
|
30
|
+
* Uses parent directory context to disambiguate common file names
|
|
31
|
+
* e.g., "src/lib/Button/Button.tsx" -> "button"
|
|
32
|
+
* e.g., "src/lib/Tile/common/Header/Header.tsx" -> "tile-header"
|
|
33
|
+
* e.g., "src/lib/Accordion/common/Item/Item.tsx" -> "accordion-item"
|
|
34
|
+
*/
|
|
35
|
+
function filePathSlug(filePath: string): string {
|
|
36
|
+
// Remove extension and get path parts
|
|
37
|
+
const withoutExt = filePath.replace(/\.[^.]+$/, "");
|
|
38
|
+
const parts = withoutExt.split("/").filter(Boolean);
|
|
39
|
+
|
|
40
|
+
// Skip common non-meaningful directory names
|
|
41
|
+
const skipDirs = new Set(["src", "lib", "common", "components", "index"]);
|
|
42
|
+
|
|
43
|
+
// Find meaningful parts (component names, not common dirs)
|
|
44
|
+
const meaningful: string[] = [];
|
|
45
|
+
for (const part of parts) {
|
|
46
|
+
if (!skipDirs.has(part.toLowerCase())) {
|
|
47
|
+
meaningful.push(part);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Deduplicate consecutive identical names (Button/Button.tsx -> [Button])
|
|
52
|
+
// This handles cases like Tile/common/Content/Content.tsx -> [Tile, Content]
|
|
53
|
+
const deduped: string[] = [];
|
|
54
|
+
for (const part of meaningful) {
|
|
55
|
+
if (deduped.length === 0 || deduped[deduped.length - 1].toLowerCase() !== part.toLowerCase()) {
|
|
56
|
+
deduped.push(part);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// If only one meaningful part (e.g., Button/Button.tsx -> [Button])
|
|
61
|
+
if (deduped.length === 1) {
|
|
62
|
+
return slugify(deduped[0]);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Multiple parts: combine main component with last part
|
|
66
|
+
// Tile/common/Content/Content.tsx -> [Tile, Content] -> tile-content
|
|
67
|
+
// Timeline/common/Content/Content.tsx -> [Timeline, Content] -> timeline-content
|
|
68
|
+
if (deduped.length >= 2) {
|
|
69
|
+
const mainComponent = deduped[0];
|
|
70
|
+
const lastPart = deduped[deduped.length - 1];
|
|
71
|
+
return slugify(`${mainComponent}-${lastPart}`);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Fallback: just use the last meaningful part
|
|
75
|
+
return slugify(meaningful[meaningful.length - 1] || "unknown");
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Build a PrefixMap with standard prefixes and user's data prefix
|
|
80
|
+
* Validates that user prefix doesn't conflict with reserved prefixes
|
|
81
|
+
*/
|
|
82
|
+
function buildPrefixMap(config: CollectConfig): PrefixMap {
|
|
83
|
+
const prefixes = new PrefixMap();
|
|
84
|
+
|
|
85
|
+
// Add standard prefixes
|
|
86
|
+
for (const [prefix, namespace] of Object.entries(STANDARD_PREFIXES)) {
|
|
87
|
+
prefixes.add(prefix, namespace);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// Validate and add user's data prefix
|
|
91
|
+
if (RESERVED_PREFIXES.has(config.prefix.short)) {
|
|
92
|
+
throw new Error(
|
|
93
|
+
`Prefix "${config.prefix.short}" is reserved. Use a different prefix for your data namespace.`,
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
prefixes.add(config.prefix.short, config.prefix.namespace);
|
|
97
|
+
|
|
98
|
+
return prefixes;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Generate the ImplementationLibrary .ttl content
|
|
103
|
+
*/
|
|
104
|
+
export function generateLibraryTurtle(config: CollectConfig): Promise<string> {
|
|
105
|
+
const store = new GraphStore();
|
|
106
|
+
const prefixes = buildPrefixMap(config);
|
|
107
|
+
const p = config.prefix.short;
|
|
108
|
+
|
|
109
|
+
// Library URI
|
|
110
|
+
const librarySlug = slugify(config.name);
|
|
111
|
+
const libraryUri = `${config.prefix.namespace}implementation.library.${librarySlug}`;
|
|
112
|
+
|
|
113
|
+
// Add type
|
|
114
|
+
store.addQuad(libraryUri, prefixes.expand("rdf:type"), prefixes.expand(`${p}:ImplementationLibrary`));
|
|
115
|
+
|
|
116
|
+
// Add required properties
|
|
117
|
+
store.addLiteral(libraryUri, prefixes.expand(`${p}:libraryName`), config.name);
|
|
118
|
+
store.addLiteral(libraryUri, prefixes.expand(`${p}:platform`), config.platform);
|
|
119
|
+
store.addLiteral(libraryUri, prefixes.expand(`${p}:link`), config.link);
|
|
120
|
+
|
|
121
|
+
// Add optional properties
|
|
122
|
+
if (config.description) {
|
|
123
|
+
store.addLiteral(libraryUri, prefixes.expand(`${p}:libraryDescription`), config.description);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
if (config.documentation) {
|
|
127
|
+
store.addLiteral(libraryUri, prefixes.expand(`${p}:documentation`), config.documentation);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (config.tier) {
|
|
131
|
+
store.addQuad(libraryUri, prefixes.expand(`${p}:libraryTier`), prefixes.expand(config.tier));
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return serializeToTurtle(store, { prefixes });
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Generate the ImplementationObject .ttl content from annotations
|
|
139
|
+
* ImplementationObjects are blank nodes attached to the library
|
|
140
|
+
*/
|
|
141
|
+
export function generateObjectsTurtle(
|
|
142
|
+
config: CollectConfig,
|
|
143
|
+
annotations: ImplementsAnnotation[],
|
|
144
|
+
basePath: string,
|
|
145
|
+
): Promise<string> {
|
|
146
|
+
if (annotations.length === 0) {
|
|
147
|
+
return Promise.resolve("");
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
const store = new GraphStore();
|
|
151
|
+
const prefixes = buildPrefixMap(config);
|
|
152
|
+
const p = config.prefix.short;
|
|
153
|
+
|
|
154
|
+
const librarySlug = slugify(config.name);
|
|
155
|
+
const libraryUri = `${config.prefix.namespace}implementation.library.${librarySlug}`;
|
|
156
|
+
|
|
157
|
+
for (const annotation of annotations) {
|
|
158
|
+
const relativePath = relative(basePath, annotation.filePath);
|
|
159
|
+
|
|
160
|
+
// Create a blank node for the ImplementationObject
|
|
161
|
+
const implNode = store.createBlankNode();
|
|
162
|
+
|
|
163
|
+
// Link library to implementation object
|
|
164
|
+
store.addBlankNodeQuad(libraryUri, prefixes.expand(`${p}:hasImplementation`), implNode);
|
|
165
|
+
|
|
166
|
+
// Add type
|
|
167
|
+
store.addQuadFromBlankNode(implNode, prefixes.expand("rdf:type"), prefixes.expand(`${p}:ImplementationObject`));
|
|
168
|
+
|
|
169
|
+
// Add implements block reference
|
|
170
|
+
store.addQuadFromBlankNode(implNode, prefixes.expand(`${p}:implementsBlock`), prefixes.expand(annotation.blockUri));
|
|
171
|
+
|
|
172
|
+
// Add head link (relative path to source file)
|
|
173
|
+
store.addLiteralFromBlankNode(implNode, prefixes.expand(`${p}:headLink`), relativePath);
|
|
174
|
+
|
|
175
|
+
// Add version if specified
|
|
176
|
+
if (annotation.version) {
|
|
177
|
+
store.addLiteralFromBlankNode(implNode, prefixes.expand(`${p}:implementationVersion`), annotation.version);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// Add draft status if true
|
|
181
|
+
if (annotation.isDraft) {
|
|
182
|
+
store.addLiteralFromBlankNode(implNode, prefixes.expand(`${p}:isDraft`), "true");
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
return serializeToTurtle(store, { prefixes });
|
|
187
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { default as scanAnnotations } from "./scanAnnotations.js";
|
|
2
|
+
export { default as validateCollectConfig } from "./validateCollectConfig.js";
|
|
3
|
+
export { generateLibraryTurtle, generateObjectsTurtle } from "./generateTurtle.js";
|
|
4
|
+
export type { CollectConfig, ImplementsAnnotation } from "./types.js";
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { describe, it, expect, beforeAll, afterAll } from "vitest";
|
|
2
|
+
import { mkdir, writeFile, rm } from "node:fs/promises";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import { tmpdir } from "node:os";
|
|
5
|
+
import scanAnnotations from "./scanAnnotations.js";
|
|
6
|
+
|
|
7
|
+
describe("scanAnnotations", () => {
|
|
8
|
+
const testDir = join(tmpdir(), `scan-annotations-test-${Date.now()}`);
|
|
9
|
+
|
|
10
|
+
beforeAll(async () => {
|
|
11
|
+
await mkdir(join(testDir, "src", "components"), { recursive: true });
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
afterAll(async () => {
|
|
15
|
+
await rm(testDir, { recursive: true, force: true });
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it("should find basic @implements annotation", async () => {
|
|
19
|
+
const filePath = join(testDir, "src", "components", "Button.tsx");
|
|
20
|
+
await writeFile(
|
|
21
|
+
filePath,
|
|
22
|
+
`
|
|
23
|
+
/**
|
|
24
|
+
* @implements ds:global.component.button
|
|
25
|
+
*/
|
|
26
|
+
export function Button() {}
|
|
27
|
+
`,
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
const annotations = await scanAnnotations("src/**/*.tsx", testDir);
|
|
31
|
+
expect(annotations).toHaveLength(1);
|
|
32
|
+
expect(annotations[0].blockUri).toBe("ds:global.component.button");
|
|
33
|
+
expect(annotations[0].version).toBeUndefined();
|
|
34
|
+
expect(annotations[0].isDraft).toBeFalsy();
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it("should find @implements annotation with version", async () => {
|
|
38
|
+
const filePath = join(testDir, "src", "components", "Card.tsx");
|
|
39
|
+
await writeFile(
|
|
40
|
+
filePath,
|
|
41
|
+
`
|
|
42
|
+
// @implements ds:global.component.card@1.2.3
|
|
43
|
+
export function Card() {}
|
|
44
|
+
`,
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
const annotations = await scanAnnotations("src/**/*.tsx", testDir);
|
|
48
|
+
const cardAnnotation = annotations.find((a) => a.blockUri === "ds:global.component.card");
|
|
49
|
+
expect(cardAnnotation).toBeDefined();
|
|
50
|
+
expect(cardAnnotation?.version).toBe("1.2.3");
|
|
51
|
+
expect(cardAnnotation?.isDraft).toBeFalsy();
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it("should find @implements annotation with [draft] marker", async () => {
|
|
55
|
+
const filePath = join(testDir, "src", "components", "Modal.tsx");
|
|
56
|
+
await writeFile(
|
|
57
|
+
filePath,
|
|
58
|
+
`
|
|
59
|
+
// @implements ds:global.pattern.modal [draft]
|
|
60
|
+
export function Modal() {}
|
|
61
|
+
`,
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
const annotations = await scanAnnotations("src/**/*.tsx", testDir);
|
|
65
|
+
const modalAnnotation = annotations.find((a) => a.blockUri === "ds:global.pattern.modal");
|
|
66
|
+
expect(modalAnnotation).toBeDefined();
|
|
67
|
+
expect(modalAnnotation?.isDraft).toBe(true);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it("should find @implements annotation with version and [draft]", async () => {
|
|
71
|
+
const filePath = join(testDir, "src", "components", "Tabs.tsx");
|
|
72
|
+
await writeFile(
|
|
73
|
+
filePath,
|
|
74
|
+
`
|
|
75
|
+
/**
|
|
76
|
+
* Work in progress
|
|
77
|
+
* @implements ds:global.component.tabs@0.1.0 [draft]
|
|
78
|
+
*/
|
|
79
|
+
export function Tabs() {}
|
|
80
|
+
`,
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
const annotations = await scanAnnotations("src/**/*.tsx", testDir);
|
|
84
|
+
const tabsAnnotation = annotations.find((a) => a.blockUri === "ds:global.component.tabs");
|
|
85
|
+
expect(tabsAnnotation).toBeDefined();
|
|
86
|
+
expect(tabsAnnotation?.version).toBe("0.1.0");
|
|
87
|
+
expect(tabsAnnotation?.isDraft).toBe(true);
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
it("should find multiple annotations in different files", async () => {
|
|
91
|
+
// Clean existing files and create new ones
|
|
92
|
+
const file1 = join(testDir, "src", "components", "A.tsx");
|
|
93
|
+
const file2 = join(testDir, "src", "components", "B.tsx");
|
|
94
|
+
|
|
95
|
+
await writeFile(file1, "// @implements prefix:one\nexport function A() {}");
|
|
96
|
+
await writeFile(file2, "// @implements prefix:two\nexport function B() {}");
|
|
97
|
+
|
|
98
|
+
const annotations = await scanAnnotations("src/**/*.tsx", testDir);
|
|
99
|
+
const uris = annotations.map((a) => a.blockUri);
|
|
100
|
+
expect(uris).toContain("prefix:one");
|
|
101
|
+
expect(uris).toContain("prefix:two");
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
it("should return empty array if no annotations found", async () => {
|
|
105
|
+
const emptyDir = join(testDir, "empty");
|
|
106
|
+
await mkdir(join(emptyDir, "src"), { recursive: true });
|
|
107
|
+
await writeFile(
|
|
108
|
+
join(emptyDir, "src", "NoAnnotation.tsx"),
|
|
109
|
+
"export function NoAnnotation() {}",
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
const annotations = await scanAnnotations("src/**/*.tsx", emptyDir);
|
|
113
|
+
expect(annotations).toHaveLength(0);
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
it("should return empty array if no files match pattern", async () => {
|
|
117
|
+
const annotations = await scanAnnotations("nonexistent/**/*.xyz", testDir);
|
|
118
|
+
expect(annotations).toHaveLength(0);
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
it("should support pre-release versions", async () => {
|
|
122
|
+
const filePath = join(testDir, "src", "components", "PreRelease.tsx");
|
|
123
|
+
await writeFile(
|
|
124
|
+
filePath,
|
|
125
|
+
`
|
|
126
|
+
// @implements ds:component.test@1.0.0-beta.1
|
|
127
|
+
export function PreRelease() {}
|
|
128
|
+
`,
|
|
129
|
+
);
|
|
130
|
+
|
|
131
|
+
const annotations = await scanAnnotations("src/**/*.tsx", testDir);
|
|
132
|
+
const preReleaseAnnotation = annotations.find(
|
|
133
|
+
(a) => a.blockUri === "ds:component.test",
|
|
134
|
+
);
|
|
135
|
+
expect(preReleaseAnnotation).toBeDefined();
|
|
136
|
+
expect(preReleaseAnnotation?.version).toBe("1.0.0-beta.1");
|
|
137
|
+
});
|
|
138
|
+
});
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import { glob } from "tinyglobby";
|
|
3
|
+
import type { ImplementsAnnotation } from "./types.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Regex to match @implements annotations in source files
|
|
7
|
+
* Supports formats:
|
|
8
|
+
* @implements ds:global.component.button
|
|
9
|
+
* @implements ds:global.component.button@1.0.0
|
|
10
|
+
* @implements ds:global.component.button [draft]
|
|
11
|
+
* @implements ds:global.component.button@1.0.0 [draft]
|
|
12
|
+
* @implements ds:global.subcomponent.tile-header (with hyphens)
|
|
13
|
+
*
|
|
14
|
+
* Captures:
|
|
15
|
+
* [1] full prefixed URI (e.g., "ds:global.component.button")
|
|
16
|
+
* [2] optional version suffix (e.g., "1.0.0")
|
|
17
|
+
*/
|
|
18
|
+
const IMPLEMENTS_REGEX = /@implements\s+([a-zA-Z_][a-zA-Z0-9_]*:[a-zA-Z0-9_.:-]+)(?:@(\d+\.\d+\.\d+(?:-[a-zA-Z0-9.-]+)?))?(?:\s+\[draft\])?/g;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Check if annotation line contains [draft] marker
|
|
22
|
+
*/
|
|
23
|
+
function isDraftAnnotation(line: string): boolean {
|
|
24
|
+
return /\[draft\]/i.test(line);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Scan a single file for @implements annotations
|
|
29
|
+
*/
|
|
30
|
+
async function scanFile(filePath: string): Promise<ImplementsAnnotation[]> {
|
|
31
|
+
const content = await readFile(filePath, "utf-8");
|
|
32
|
+
const annotations: ImplementsAnnotation[] = [];
|
|
33
|
+
|
|
34
|
+
let match: RegExpExecArray | null;
|
|
35
|
+
while ((match = IMPLEMENTS_REGEX.exec(content)) !== null) {
|
|
36
|
+
const fullMatch = match[0];
|
|
37
|
+
const blockUri = match[1];
|
|
38
|
+
const version = match[2];
|
|
39
|
+
const isDraft = isDraftAnnotation(fullMatch);
|
|
40
|
+
|
|
41
|
+
// Extract prefix from blockUri (e.g., "ds" from "ds:global.component.button")
|
|
42
|
+
const colonIndex = blockUri.indexOf(":");
|
|
43
|
+
const prefix = colonIndex > 0 ? blockUri.slice(0, colonIndex) : undefined;
|
|
44
|
+
|
|
45
|
+
annotations.push({
|
|
46
|
+
filePath,
|
|
47
|
+
blockUri,
|
|
48
|
+
version,
|
|
49
|
+
isDraft,
|
|
50
|
+
prefix,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Reset regex state
|
|
55
|
+
IMPLEMENTS_REGEX.lastIndex = 0;
|
|
56
|
+
|
|
57
|
+
return annotations;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Scan files matching a glob pattern for @implements annotations
|
|
62
|
+
* @param pattern - Glob pattern (e.g., "src/**\/*.tsx")
|
|
63
|
+
* @param cwd - Working directory for glob resolution
|
|
64
|
+
*/
|
|
65
|
+
export default async function scanAnnotations(
|
|
66
|
+
pattern: string,
|
|
67
|
+
cwd: string,
|
|
68
|
+
): Promise<ImplementsAnnotation[]> {
|
|
69
|
+
const files = await glob(pattern, { cwd, absolute: true });
|
|
70
|
+
const allAnnotations: ImplementsAnnotation[] = [];
|
|
71
|
+
|
|
72
|
+
for (const file of files) {
|
|
73
|
+
const annotations = await scanFile(file);
|
|
74
|
+
allAnnotations.push(...annotations);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return allAnnotations;
|
|
78
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration for collect-implementations command
|
|
3
|
+
* Loaded from design-system.json in the target package
|
|
4
|
+
*/
|
|
5
|
+
export interface CollectConfig {
|
|
6
|
+
/** Library name (e.g., "pragma-react") */
|
|
7
|
+
name: string;
|
|
8
|
+
|
|
9
|
+
/** Platform/framework (e.g., "react", "vue", "angular") */
|
|
10
|
+
platform: string;
|
|
11
|
+
|
|
12
|
+
/** Library description */
|
|
13
|
+
description?: string;
|
|
14
|
+
|
|
15
|
+
/** Main repository/package URL */
|
|
16
|
+
link: string;
|
|
17
|
+
|
|
18
|
+
/** Documentation URL if different from main link */
|
|
19
|
+
documentation?: string;
|
|
20
|
+
|
|
21
|
+
/** Design system tier reference (e.g., "ds:global") */
|
|
22
|
+
tier?: string;
|
|
23
|
+
|
|
24
|
+
/** Prefix configuration for the design system namespace */
|
|
25
|
+
prefix: {
|
|
26
|
+
/** Short prefix (e.g., "ds") */
|
|
27
|
+
short: string;
|
|
28
|
+
/** Full namespace URI (e.g., "https://ds.canonical.com/data/") */
|
|
29
|
+
namespace: string;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/** Glob pattern for files to scan (e.g., "src/**/*.tsx") */
|
|
33
|
+
pattern: string;
|
|
34
|
+
|
|
35
|
+
/** Output directory for generated .ttl files (default: "data") */
|
|
36
|
+
outputDir?: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Parsed annotation from a source file
|
|
41
|
+
*/
|
|
42
|
+
export interface ImplementsAnnotation {
|
|
43
|
+
/** Full path to the source file */
|
|
44
|
+
filePath: string;
|
|
45
|
+
|
|
46
|
+
/** The block URI being implemented (e.g., "ds:global.component.button") */
|
|
47
|
+
blockUri: string;
|
|
48
|
+
|
|
49
|
+
/** Optional version of the implementation */
|
|
50
|
+
version?: string;
|
|
51
|
+
|
|
52
|
+
/** Whether this is a draft implementation */
|
|
53
|
+
isDraft?: boolean;
|
|
54
|
+
|
|
55
|
+
/** The prefix used in the annotation (e.g., "ds" or "syntax") */
|
|
56
|
+
prefix?: string;
|
|
57
|
+
}
|