@vizejs/vite-plugin-musea 0.0.1-alpha.11
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/README.md +56 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +222 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +95 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1512 -0
- package/dist/index.js.map +1 -0
- package/dist/vrt-BfuTRv-J.d.ts +217 -0
- package/dist/vrt-BfuTRv-J.d.ts.map +1 -0
- package/dist/vrt-DRwtnkE5.js +773 -0
- package/dist/vrt-DRwtnkE5.js.map +1 -0
- package/dist/vrt.d.ts +2 -0
- package/dist/vrt.js +3 -0
- package/package.json +76 -0
package/README.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# @vizejs/vite-plugin-musea
|
|
2
|
+
|
|
3
|
+
Vite plugin for Musea - Vue component gallery and documentation.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @vizejs/vite-plugin-musea
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
// vite.config.ts
|
|
15
|
+
import { defineConfig } from 'vite'
|
|
16
|
+
import { musea } from '@vizejs/vite-plugin-musea'
|
|
17
|
+
|
|
18
|
+
export default defineConfig({
|
|
19
|
+
plugins: [
|
|
20
|
+
musea({
|
|
21
|
+
// Art files pattern
|
|
22
|
+
include: '**/*.art.vue',
|
|
23
|
+
// Output directory
|
|
24
|
+
outDir: '.musea'
|
|
25
|
+
})
|
|
26
|
+
]
|
|
27
|
+
})
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Art File Format
|
|
31
|
+
|
|
32
|
+
```vue
|
|
33
|
+
<!-- Button.art.vue -->
|
|
34
|
+
<art title="Button" component="./Button.vue">
|
|
35
|
+
<variant name="Primary" default>
|
|
36
|
+
<Button variant="primary">Click me</Button>
|
|
37
|
+
</variant>
|
|
38
|
+
<variant name="Disabled">
|
|
39
|
+
<Button disabled>Disabled</Button>
|
|
40
|
+
</variant>
|
|
41
|
+
</art>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Commands
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
# Start dev server
|
|
48
|
+
vite dev
|
|
49
|
+
|
|
50
|
+
# Build gallery
|
|
51
|
+
vite build
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## License
|
|
55
|
+
|
|
56
|
+
MIT
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { MuseaVrtRunner, generateVrtJsonReport, generateVrtReport } from "./vrt-DRwtnkE5.js";
|
|
3
|
+
import fs from "node:fs";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
|
|
6
|
+
//#region src/cli.ts
|
|
7
|
+
function parseArgs(args) {
|
|
8
|
+
const options = {
|
|
9
|
+
update: false,
|
|
10
|
+
config: "vite.config.ts",
|
|
11
|
+
output: ".vize",
|
|
12
|
+
threshold: .1,
|
|
13
|
+
json: false,
|
|
14
|
+
ci: false,
|
|
15
|
+
help: false,
|
|
16
|
+
baseUrl: "http://localhost:5173"
|
|
17
|
+
};
|
|
18
|
+
for (let i = 0; i < args.length; i++) {
|
|
19
|
+
const arg = args[i];
|
|
20
|
+
switch (arg) {
|
|
21
|
+
case "-u":
|
|
22
|
+
case "--update":
|
|
23
|
+
options.update = true;
|
|
24
|
+
break;
|
|
25
|
+
case "-c":
|
|
26
|
+
case "--config":
|
|
27
|
+
options.config = args[++i] || "vite.config.ts";
|
|
28
|
+
break;
|
|
29
|
+
case "-o":
|
|
30
|
+
case "--output":
|
|
31
|
+
options.output = args[++i] || ".vize";
|
|
32
|
+
break;
|
|
33
|
+
case "-t":
|
|
34
|
+
case "--threshold":
|
|
35
|
+
options.threshold = parseFloat(args[++i]) || .1;
|
|
36
|
+
break;
|
|
37
|
+
case "--json":
|
|
38
|
+
options.json = true;
|
|
39
|
+
break;
|
|
40
|
+
case "--ci":
|
|
41
|
+
options.ci = true;
|
|
42
|
+
break;
|
|
43
|
+
case "-b":
|
|
44
|
+
case "--base-url":
|
|
45
|
+
options.baseUrl = args[++i] || "http://localhost:5173";
|
|
46
|
+
break;
|
|
47
|
+
case "-h":
|
|
48
|
+
case "--help":
|
|
49
|
+
options.help = true;
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return options;
|
|
54
|
+
}
|
|
55
|
+
function printHelp() {
|
|
56
|
+
console.log(`
|
|
57
|
+
Musea VRT - Visual Regression Testing for Component Gallery
|
|
58
|
+
|
|
59
|
+
Usage:
|
|
60
|
+
musea-vrt [options]
|
|
61
|
+
|
|
62
|
+
Options:
|
|
63
|
+
-u, --update Update baseline snapshots with current screenshots
|
|
64
|
+
-c, --config <path> Path to vite config file (default: vite.config.ts)
|
|
65
|
+
-o, --output <dir> Output directory for reports (default: .vize)
|
|
66
|
+
-t, --threshold <n> Diff threshold percentage (default: 0.1)
|
|
67
|
+
-b, --base-url <url> Base URL for dev server (default: http://localhost:5173)
|
|
68
|
+
--json Output JSON report instead of HTML
|
|
69
|
+
--ci CI mode - exit with non-zero code on failures
|
|
70
|
+
-h, --help Show this help message
|
|
71
|
+
|
|
72
|
+
Examples:
|
|
73
|
+
# Run VRT tests
|
|
74
|
+
musea-vrt
|
|
75
|
+
|
|
76
|
+
# Update baseline snapshots
|
|
77
|
+
musea-vrt -u
|
|
78
|
+
|
|
79
|
+
# Run with custom threshold
|
|
80
|
+
musea-vrt -t 0.5
|
|
81
|
+
|
|
82
|
+
# CI mode with JSON output
|
|
83
|
+
musea-vrt --ci --json
|
|
84
|
+
|
|
85
|
+
# Custom base URL
|
|
86
|
+
musea-vrt -b http://localhost:3000
|
|
87
|
+
`);
|
|
88
|
+
}
|
|
89
|
+
async function scanArtFiles(root) {
|
|
90
|
+
const files = [];
|
|
91
|
+
async function scan(dir) {
|
|
92
|
+
const entries = await fs.promises.readdir(dir, { withFileTypes: true });
|
|
93
|
+
for (const entry of entries) {
|
|
94
|
+
const fullPath = path.join(dir, entry.name);
|
|
95
|
+
if (entry.name === "node_modules" || entry.name === "dist") continue;
|
|
96
|
+
if (entry.isDirectory()) await scan(fullPath);
|
|
97
|
+
else if (entry.isFile() && entry.name.endsWith(".art.vue")) files.push(fullPath);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
await scan(root);
|
|
101
|
+
return files;
|
|
102
|
+
}
|
|
103
|
+
async function parseArtFile(filePath) {
|
|
104
|
+
try {
|
|
105
|
+
const source = await fs.promises.readFile(filePath, "utf-8");
|
|
106
|
+
const titleMatch = source.match(/<art[^>]*\stitle=["']([^"']+)["']/);
|
|
107
|
+
const componentMatch = source.match(/<art[^>]*\scomponent=["']([^"']+)["']/);
|
|
108
|
+
const categoryMatch = source.match(/<art[^>]*\scategory=["']([^"']+)["']/);
|
|
109
|
+
const variants = [];
|
|
110
|
+
const variantRegex = /<variant\s+([^>]*)>([\s\S]*?)<\/variant>/g;
|
|
111
|
+
let match;
|
|
112
|
+
while ((match = variantRegex.exec(source)) !== null) {
|
|
113
|
+
const attrs = match[1];
|
|
114
|
+
const template = match[2].trim();
|
|
115
|
+
const nameMatch = attrs.match(/name=["']([^"']+)["']/);
|
|
116
|
+
const isDefault = /\bdefault\b/.test(attrs);
|
|
117
|
+
const skipVrt = /\bskip-vrt\b/.test(attrs);
|
|
118
|
+
if (nameMatch) variants.push({
|
|
119
|
+
name: nameMatch[1],
|
|
120
|
+
template,
|
|
121
|
+
isDefault,
|
|
122
|
+
skipVrt
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
return {
|
|
126
|
+
path: filePath,
|
|
127
|
+
metadata: {
|
|
128
|
+
title: titleMatch?.[1] || path.basename(filePath, ".art.vue"),
|
|
129
|
+
component: componentMatch?.[1],
|
|
130
|
+
category: categoryMatch?.[1],
|
|
131
|
+
tags: [],
|
|
132
|
+
status: "ready"
|
|
133
|
+
},
|
|
134
|
+
variants,
|
|
135
|
+
hasScriptSetup: /<script\s+setup/.test(source),
|
|
136
|
+
hasScript: /<script(?!\s+setup)/.test(source),
|
|
137
|
+
styleCount: (source.match(/<style/g) || []).length
|
|
138
|
+
};
|
|
139
|
+
} catch (error) {
|
|
140
|
+
console.error(`Failed to parse ${filePath}:`, error);
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
async function main() {
|
|
145
|
+
const args = process.argv.slice(2);
|
|
146
|
+
const options = parseArgs(args);
|
|
147
|
+
if (options.help) {
|
|
148
|
+
printHelp();
|
|
149
|
+
process.exit(0);
|
|
150
|
+
}
|
|
151
|
+
const cwd = process.cwd();
|
|
152
|
+
console.log("\n Musea VRT");
|
|
153
|
+
console.log(" =========\n");
|
|
154
|
+
console.log(" Scanning for art files...");
|
|
155
|
+
const artFilePaths = await scanArtFiles(cwd);
|
|
156
|
+
if (artFilePaths.length === 0) {
|
|
157
|
+
console.log(" No art files found.\n");
|
|
158
|
+
process.exit(0);
|
|
159
|
+
}
|
|
160
|
+
console.log(` Found ${artFilePaths.length} art file(s)\n`);
|
|
161
|
+
const artFiles = [];
|
|
162
|
+
for (const filePath of artFilePaths) {
|
|
163
|
+
const art = await parseArtFile(filePath);
|
|
164
|
+
if (art) artFiles.push(art);
|
|
165
|
+
}
|
|
166
|
+
const totalVariants = artFiles.reduce((sum, art) => sum + art.variants.filter((v) => !v.skipVrt).length, 0);
|
|
167
|
+
console.log(` Testing ${totalVariants} variant(s) across ${artFiles.length} art file(s)\n`);
|
|
168
|
+
const vrtOptions = {
|
|
169
|
+
snapshotDir: path.join(options.output, "snapshots"),
|
|
170
|
+
threshold: options.threshold
|
|
171
|
+
};
|
|
172
|
+
const runner = new MuseaVrtRunner(vrtOptions);
|
|
173
|
+
try {
|
|
174
|
+
console.log(" Launching browser...");
|
|
175
|
+
await runner.init();
|
|
176
|
+
console.log(" Running visual regression tests...\n");
|
|
177
|
+
const results = await runner.runAllTests(artFiles, options.baseUrl);
|
|
178
|
+
const summary = runner.getSummary(results);
|
|
179
|
+
console.log(" Results:");
|
|
180
|
+
console.log(` ---------`);
|
|
181
|
+
console.log(` Passed: ${summary.passed}`);
|
|
182
|
+
console.log(` Failed: ${summary.failed}`);
|
|
183
|
+
console.log(` New: ${summary.new}`);
|
|
184
|
+
console.log(` Skipped: ${summary.skipped}`);
|
|
185
|
+
console.log(` Total: ${summary.total}`);
|
|
186
|
+
console.log(` Duration: ${(summary.duration / 1e3).toFixed(2)}s\n`);
|
|
187
|
+
if (options.update) {
|
|
188
|
+
console.log(" Updating baselines...");
|
|
189
|
+
const updated = await runner.updateBaselines(results);
|
|
190
|
+
console.log(` Updated ${updated} baseline(s)\n`);
|
|
191
|
+
}
|
|
192
|
+
const reportDir = options.output;
|
|
193
|
+
await fs.promises.mkdir(reportDir, { recursive: true });
|
|
194
|
+
if (options.json) {
|
|
195
|
+
const jsonReport = generateVrtJsonReport(results, summary);
|
|
196
|
+
const jsonPath = path.join(reportDir, "vrt-report.json");
|
|
197
|
+
await fs.promises.writeFile(jsonPath, jsonReport);
|
|
198
|
+
console.log(` JSON report: ${jsonPath}\n`);
|
|
199
|
+
} else {
|
|
200
|
+
const htmlReport = generateVrtReport(results, summary);
|
|
201
|
+
const htmlPath = path.join(reportDir, "vrt-report.html");
|
|
202
|
+
await fs.promises.writeFile(htmlPath, htmlReport);
|
|
203
|
+
console.log(` HTML report: ${htmlPath}\n`);
|
|
204
|
+
}
|
|
205
|
+
if (options.ci && summary.failed > 0) {
|
|
206
|
+
console.log(" CI mode: Exiting with error due to failures\n");
|
|
207
|
+
process.exit(1);
|
|
208
|
+
}
|
|
209
|
+
} catch (error) {
|
|
210
|
+
console.error("\n Error:", error);
|
|
211
|
+
process.exit(1);
|
|
212
|
+
} finally {
|
|
213
|
+
await runner.close();
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
main().catch((error) => {
|
|
217
|
+
console.error("Fatal error:", error);
|
|
218
|
+
process.exit(1);
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
//#endregion
|
|
222
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","names":["args: string[]","options: CliOptions","root: string","files: string[]","dir: string","filePath: string","variants: ArtFileInfo[\"variants\"]","artFiles: ArtFileInfo[]","vrtOptions: VrtOptions"],"sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\n/**\n * Musea VRT CLI\n *\n * Usage:\n * musea-vrt [options]\n *\n * Options:\n * -u, --update Update baseline snapshots\n * -c, --config Path to vite config (default: vite.config.ts)\n * -o, --output Output directory for reports (default: .vize)\n * -t, --threshold Diff threshold percentage (default: 0.1)\n * --json Output JSON report instead of HTML\n * --ci CI mode - exit with non-zero code on failures\n * -h, --help Show help\n */\n\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { MuseaVrtRunner, generateVrtReport, generateVrtJsonReport } from \"./vrt.js\";\nimport type { ArtFileInfo, VrtOptions } from \"./types.js\";\n\ninterface CliOptions {\n update: boolean;\n config: string;\n output: string;\n threshold: number;\n json: boolean;\n ci: boolean;\n help: boolean;\n baseUrl: string;\n}\n\nfunction parseArgs(args: string[]): CliOptions {\n const options: CliOptions = {\n update: false,\n config: \"vite.config.ts\",\n output: \".vize\",\n threshold: 0.1,\n json: false,\n ci: false,\n help: false,\n baseUrl: \"http://localhost:5173\",\n };\n\n for (let i = 0; i < args.length; i++) {\n const arg = args[i];\n switch (arg) {\n case \"-u\":\n case \"--update\":\n options.update = true;\n break;\n case \"-c\":\n case \"--config\":\n options.config = args[++i] || \"vite.config.ts\";\n break;\n case \"-o\":\n case \"--output\":\n options.output = args[++i] || \".vize\";\n break;\n case \"-t\":\n case \"--threshold\":\n options.threshold = parseFloat(args[++i]) || 0.1;\n break;\n case \"--json\":\n options.json = true;\n break;\n case \"--ci\":\n options.ci = true;\n break;\n case \"-b\":\n case \"--base-url\":\n options.baseUrl = args[++i] || \"http://localhost:5173\";\n break;\n case \"-h\":\n case \"--help\":\n options.help = true;\n break;\n }\n }\n\n return options;\n}\n\nfunction printHelp(): void {\n console.log(`\nMusea VRT - Visual Regression Testing for Component Gallery\n\nUsage:\n musea-vrt [options]\n\nOptions:\n -u, --update Update baseline snapshots with current screenshots\n -c, --config <path> Path to vite config file (default: vite.config.ts)\n -o, --output <dir> Output directory for reports (default: .vize)\n -t, --threshold <n> Diff threshold percentage (default: 0.1)\n -b, --base-url <url> Base URL for dev server (default: http://localhost:5173)\n --json Output JSON report instead of HTML\n --ci CI mode - exit with non-zero code on failures\n -h, --help Show this help message\n\nExamples:\n # Run VRT tests\n musea-vrt\n\n # Update baseline snapshots\n musea-vrt -u\n\n # Run with custom threshold\n musea-vrt -t 0.5\n\n # CI mode with JSON output\n musea-vrt --ci --json\n\n # Custom base URL\n musea-vrt -b http://localhost:3000\n`);\n}\n\nasync function scanArtFiles(root: string): Promise<string[]> {\n const files: string[] = [];\n\n async function scan(dir: string): Promise<void> {\n const entries = await fs.promises.readdir(dir, { withFileTypes: true });\n\n for (const entry of entries) {\n const fullPath = path.join(dir, entry.name);\n\n // Skip node_modules and dist\n if (entry.name === \"node_modules\" || entry.name === \"dist\") {\n continue;\n }\n\n if (entry.isDirectory()) {\n await scan(fullPath);\n } else if (entry.isFile() && entry.name.endsWith(\".art.vue\")) {\n files.push(fullPath);\n }\n }\n }\n\n await scan(root);\n return files;\n}\n\nasync function parseArtFile(filePath: string): Promise<ArtFileInfo | null> {\n try {\n const source = await fs.promises.readFile(filePath, \"utf-8\");\n\n // Simple parsing - in production, use @vizejs/native\n const titleMatch = source.match(/<art[^>]*\\stitle=[\"']([^\"']+)[\"']/);\n const componentMatch = source.match(/<art[^>]*\\scomponent=[\"']([^\"']+)[\"']/);\n const categoryMatch = source.match(/<art[^>]*\\scategory=[\"']([^\"']+)[\"']/);\n\n const variants: ArtFileInfo[\"variants\"] = [];\n const variantRegex = /<variant\\s+([^>]*)>([\\s\\S]*?)<\\/variant>/g;\n let match;\n\n while ((match = variantRegex.exec(source)) !== null) {\n const attrs = match[1];\n const template = match[2].trim();\n\n const nameMatch = attrs.match(/name=[\"']([^\"']+)[\"']/);\n const isDefault = /\\bdefault\\b/.test(attrs);\n const skipVrt = /\\bskip-vrt\\b/.test(attrs);\n\n if (nameMatch) {\n variants.push({\n name: nameMatch[1],\n template,\n isDefault,\n skipVrt,\n });\n }\n }\n\n return {\n path: filePath,\n metadata: {\n title: titleMatch?.[1] || path.basename(filePath, \".art.vue\"),\n component: componentMatch?.[1],\n category: categoryMatch?.[1],\n tags: [],\n status: \"ready\",\n },\n variants,\n hasScriptSetup: /<script\\s+setup/.test(source),\n hasScript: /<script(?!\\s+setup)/.test(source),\n styleCount: (source.match(/<style/g) || []).length,\n };\n } catch (error) {\n console.error(`Failed to parse ${filePath}:`, error);\n return null;\n }\n}\n\nasync function main(): Promise<void> {\n const args = process.argv.slice(2);\n const options = parseArgs(args);\n\n if (options.help) {\n printHelp();\n process.exit(0);\n }\n\n const cwd = process.cwd();\n\n console.log(\"\\n Musea VRT\");\n console.log(\" =========\\n\");\n\n // Scan for art files\n console.log(\" Scanning for art files...\");\n const artFilePaths = await scanArtFiles(cwd);\n\n if (artFilePaths.length === 0) {\n console.log(\" No art files found.\\n\");\n process.exit(0);\n }\n\n console.log(` Found ${artFilePaths.length} art file(s)\\n`);\n\n // Parse art files\n const artFiles: ArtFileInfo[] = [];\n for (const filePath of artFilePaths) {\n const art = await parseArtFile(filePath);\n if (art) {\n artFiles.push(art);\n }\n }\n\n // Count total variants\n const totalVariants = artFiles.reduce(\n (sum, art) => sum + art.variants.filter((v) => !v.skipVrt).length,\n 0,\n );\n\n console.log(` Testing ${totalVariants} variant(s) across ${artFiles.length} art file(s)\\n`);\n\n // Initialize VRT runner\n const vrtOptions: VrtOptions = {\n snapshotDir: path.join(options.output, \"snapshots\"),\n threshold: options.threshold,\n };\n\n const runner = new MuseaVrtRunner(vrtOptions);\n\n try {\n console.log(\" Launching browser...\");\n await runner.init();\n\n console.log(\" Running visual regression tests...\\n\");\n\n // Run tests\n const results = await runner.runAllTests(artFiles, options.baseUrl);\n const summary = runner.getSummary(results);\n\n // Print results\n console.log(\" Results:\");\n console.log(` ---------`);\n console.log(` Passed: ${summary.passed}`);\n console.log(` Failed: ${summary.failed}`);\n console.log(` New: ${summary.new}`);\n console.log(` Skipped: ${summary.skipped}`);\n console.log(` Total: ${summary.total}`);\n console.log(` Duration: ${(summary.duration / 1000).toFixed(2)}s\\n`);\n\n // Update baselines if requested\n if (options.update) {\n console.log(\" Updating baselines...\");\n const updated = await runner.updateBaselines(results);\n console.log(` Updated ${updated} baseline(s)\\n`);\n }\n\n // Generate report\n const reportDir = options.output;\n await fs.promises.mkdir(reportDir, { recursive: true });\n\n if (options.json) {\n const jsonReport = generateVrtJsonReport(results, summary);\n const jsonPath = path.join(reportDir, \"vrt-report.json\");\n await fs.promises.writeFile(jsonPath, jsonReport);\n console.log(` JSON report: ${jsonPath}\\n`);\n } else {\n const htmlReport = generateVrtReport(results, summary);\n const htmlPath = path.join(reportDir, \"vrt-report.html\");\n await fs.promises.writeFile(htmlPath, htmlReport);\n console.log(` HTML report: ${htmlPath}\\n`);\n }\n\n // CI mode - exit with error if failures\n if (options.ci && summary.failed > 0) {\n console.log(\" CI mode: Exiting with error due to failures\\n\");\n process.exit(1);\n }\n } catch (error) {\n console.error(\"\\n Error:\", error);\n process.exit(1);\n } finally {\n await runner.close();\n }\n}\n\nmain().catch((error) => {\n console.error(\"Fatal error:\", error);\n process.exit(1);\n});\n"],"mappings":";;;;;;AAiCA,SAAS,UAAUA,MAA4B;CAC7C,MAAMC,UAAsB;EAC1B,QAAQ;EACR,QAAQ;EACR,QAAQ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GD,MAAM,YAAY,QAAQ;AAC1B,QAAM,GAAG,SAAS,MAAM,WAAW,EAAE,WAAW,KAAM,EAAC;AAEvD,MAAI,QAAQ,MAAM;GAChB,MAAM,aAAa,sBAAsB,SAAS,QAAQ;GAC1D,MAAM,WAAW,KAAK,KAAK,WAAW,kBAAkB;AACxD,SAAM,GAAG,SAAS,UAAU,UAAU,WAAW;AACjD,WAAQ,KAAK,iBAAiB,SAAS,IAAI;EAC5C,OAAM;GACL,MAAM,aAAa,kBAAkB,SAAS,QAAQ;GACtD,MAAM,WAAW,KAAK,KAAK,WAAW,kBAAkB;AACxD,SAAM,GAAG,SAAS,UAAU,UAAU,WAAW;AACjD,WAAQ,KAAK,iBAAiB,SAAS,IAAI;EAC5C;AAGD,MAAI,QAAQ,MAAM,QAAQ,SAAS,GAAG;AACpC,WAAQ,IAAI,kDAAkD;AAC9D,WAAQ,KAAK,EAAE;EAChB;CACF,SAAQ,OAAO;AACd,UAAQ,MAAM,cAAc,MAAM;AAClC,UAAQ,KAAK,EAAE;CAChB,UAAS;AACR,QAAM,OAAO,OAAO;CACrB;AACF;AAED,MAAM,CAAC,MAAM,CAAC,UAAU;AACtB,SAAQ,MAAM,gBAAgB,MAAM;AACpC,SAAQ,KAAK,EAAE;AAChB,EAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { ArtFileInfo, ArtMetadata, ArtVariant, CsfOutput, MuseaOptions, MuseaVrtRunner$1 as MuseaVrtRunner, ViewportConfig, VrtOptions, VrtResult, VrtSummary, generateVrtJsonReport$1 as generateVrtJsonReport, generateVrtReport$1 as generateVrtReport } from "./vrt-BfuTRv-J.js";
|
|
2
|
+
import { Plugin } from "vite";
|
|
3
|
+
|
|
4
|
+
//#region src/style-dictionary.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Style Dictionary integration for Musea.
|
|
7
|
+
* Generates design token documentation from Style Dictionary format.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Design token value.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Style Dictionary integration for Musea.
|
|
14
|
+
* Generates design token documentation from Style Dictionary format.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Design token value.
|
|
18
|
+
*/
|
|
19
|
+
interface DesignToken {
|
|
20
|
+
value: string | number;
|
|
21
|
+
type?: string;
|
|
22
|
+
description?: string;
|
|
23
|
+
attributes?: Record<string, unknown>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Token category (e.g., colors, spacing, typography).
|
|
27
|
+
*/
|
|
28
|
+
interface TokenCategory {
|
|
29
|
+
name: string;
|
|
30
|
+
tokens: Record<string, DesignToken>;
|
|
31
|
+
subcategories?: TokenCategory[];
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Style Dictionary output format.
|
|
35
|
+
*/
|
|
36
|
+
interface StyleDictionaryOutput {
|
|
37
|
+
categories: TokenCategory[];
|
|
38
|
+
metadata: {
|
|
39
|
+
name: string;
|
|
40
|
+
version?: string;
|
|
41
|
+
generatedAt: string;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Configuration for Style Dictionary integration.
|
|
46
|
+
*/
|
|
47
|
+
interface StyleDictionaryConfig {
|
|
48
|
+
/**
|
|
49
|
+
* Path to tokens JSON/JS file or directory.
|
|
50
|
+
*/
|
|
51
|
+
tokensPath: string;
|
|
52
|
+
/**
|
|
53
|
+
* Output format for documentation.
|
|
54
|
+
* @default 'html'
|
|
55
|
+
*/
|
|
56
|
+
outputFormat?: "html" | "json" | "markdown";
|
|
57
|
+
/**
|
|
58
|
+
* Output directory for generated documentation.
|
|
59
|
+
* @default '.vize/tokens'
|
|
60
|
+
*/
|
|
61
|
+
outputDir?: string;
|
|
62
|
+
/**
|
|
63
|
+
* Custom token transformations.
|
|
64
|
+
*/
|
|
65
|
+
transforms?: TokenTransform[];
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Token transformation function.
|
|
69
|
+
*/
|
|
70
|
+
type TokenTransform = (token: DesignToken, path: string[]) => DesignToken;
|
|
71
|
+
/**
|
|
72
|
+
* Parse Style Dictionary tokens file.
|
|
73
|
+
*/
|
|
74
|
+
declare function parseTokens(tokensPath: string): Promise<TokenCategory[]>;
|
|
75
|
+
/**
|
|
76
|
+
* Generate HTML documentation for tokens.
|
|
77
|
+
*/
|
|
78
|
+
declare function generateTokensHtml(categories: TokenCategory[]): string;
|
|
79
|
+
/**
|
|
80
|
+
* Generate Markdown documentation for tokens.
|
|
81
|
+
*/
|
|
82
|
+
declare function generateTokensMarkdown(categories: TokenCategory[]): string;
|
|
83
|
+
/**
|
|
84
|
+
* Style Dictionary plugin for Musea.
|
|
85
|
+
*/
|
|
86
|
+
declare function processStyleDictionary(config: StyleDictionaryConfig): Promise<StyleDictionaryOutput>; //#endregion
|
|
87
|
+
//#region src/index.d.ts
|
|
88
|
+
/**
|
|
89
|
+
* Create Musea Vite plugin.
|
|
90
|
+
*/
|
|
91
|
+
declare function musea(options?: MuseaOptions): Plugin[];
|
|
92
|
+
|
|
93
|
+
//#endregion
|
|
94
|
+
export { ArtFileInfo, ArtMetadata, ArtVariant, CsfOutput, DesignToken, MuseaOptions, MuseaVrtRunner, StyleDictionaryConfig, StyleDictionaryOutput, TokenCategory, ViewportConfig, VrtOptions, VrtResult, VrtSummary, musea as default, generateTokensHtml, generateTokensMarkdown, generateVrtJsonReport, generateVrtReport, musea, parseTokens, processStyleDictionary };
|
|
95
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/style-dictionary.ts","../src/index.ts"],"sourcesContent":null,"mappings":";;;;;;;;;;;;;;;;;;UAWiB,WAAA;;;;EAAA,UAAA,CAAA,EAIF,MAJa,CAAA,MAIb,EAAA,OAAM,CAAA;;;;AAMrB;AAA8B,UAAb,aAAA,CAAa;EAAA,IAEL,EAAA,MAAA;EAAW,MAA1B,EAAA,MAAA,CAAA,MAAA,EAAe,WAAf,CAAA;EAAM,aACE,CAAA,EAAA,aAAA,EAAA;AAAa;;;;AAMd,UAAA,qBAAA,CACH;cAAA;;;IAWG,OAAA,CAAA,EAAA,MAAA;;;;AA2BjB;;;AAAqE,UA3BpD,qBAAA,CA2BoD;EAAW;;;;EAK1D;;;;EAAwC,YAAA,CAAA,EAAA,MAAA,GAAA,MAAA,GAAA,UAAA;;;;AAgJ9D;;;;AAkIA;eA7Re;;;AAmUf;;AACU,KA9TE,cAAA,GA8TF,CAAA,KAAA,EA9T2B,WA8T3B,EAAA,IAAA,EAAA,MAAA,EAAA,EAAA,GA9T2D,WA8T3D;;;AACA;iBA1TY,WAAA,sBAAiC,QAAQ;;;;iBAgJ/C,kBAAA,aAA+B;;AC3G/C;;AAA+B,iBD6Of,sBAAA,CC7Oe,UAAA,ED6OoB,aC7OpB,EAAA,CAAA,EAAA,MAAA;;AAA0B;;iBDmRnC,sBAAA,SACZ,wBACP,QAAQ;;;AA5WoB;;iBCuFf,KAAA,WAAe,eAAoB"}
|