@vizejs/vite-plugin-musea 0.730.0 → 0.732.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/dist/a11y/index.d.mts +1 -1
- package/dist/a11y/index.mjs +200 -1
- package/dist/a11y/index.mjs.map +1 -0
- package/dist/apply-DIAnotZa.mjs +8 -0
- package/dist/apply-DIAnotZa.mjs.map +1 -0
- package/dist/autogen/index.mjs +1 -1
- package/dist/{autogen-B-N0cJbZ.mjs → autogen-D9K1av3V.mjs} +2 -2
- package/dist/{autogen-B-N0cJbZ.mjs.map → autogen-D9K1av3V.mjs.map} +1 -1
- package/dist/browser-launch-DCUbOf0d.mjs +29 -0
- package/dist/browser-launch-DCUbOf0d.mjs.map +1 -0
- package/dist/cli/index.mjs +9 -7
- package/dist/cli/index.mjs.map +1 -1
- package/dist/{gallery-DLl3pMOF.mjs → gallery-DNxzJA4V.mjs} +2 -2
- package/dist/{gallery-DLl3pMOF.mjs.map → gallery-DNxzJA4V.mjs.map} +1 -1
- package/dist/{browser-launch-L43ulIaZ.mjs → html-BW9Z7gL3.mjs} +5 -26
- package/dist/html-BW9Z7gL3.mjs.map +1 -0
- package/dist/{index-Dh4IXacU.d.mts → index-ELy0IbiZ.d.mts} +2 -2
- package/dist/{index-Dh4IXacU.d.mts.map → index-ELy0IbiZ.d.mts.map} +1 -1
- package/dist/index.d.mts +67 -3
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +505 -2232
- package/dist/index.mjs.map +1 -1
- package/dist/{template-D12HYJCn.mjs → module-BaxIBS_8.mjs} +39 -39
- package/dist/module-BaxIBS_8.mjs.map +1 -0
- package/dist/plugin-D2KEfrj1.mjs +2285 -0
- package/dist/plugin-D2KEfrj1.mjs.map +1 -0
- package/dist/{a11y-CR7bHK1d.mjs → report-CHUEZNZA.mjs} +3 -199
- package/dist/report-CHUEZNZA.mjs.map +1 -0
- package/dist/report-ZbXgDiN_.mjs +300 -0
- package/dist/report-ZbXgDiN_.mjs.map +1 -0
- package/dist/{options-DLFcpXwQ.mjs → report-identity-dHHBq0Ne.mjs} +502 -956
- package/dist/report-identity-dHHBq0Ne.mjs.map +1 -0
- package/dist/resolver-D8_4jxfT.mjs +812 -0
- package/dist/resolver-D8_4jxfT.mjs.map +1 -0
- package/dist/snapshot-identity-Cm-t65Kl.mjs +63 -0
- package/dist/snapshot-identity-Cm-t65Kl.mjs.map +1 -0
- package/dist/{vrt-CUz4NxKK.mjs → vrt-B8j2yfiN.mjs} +8 -363
- package/dist/vrt-B8j2yfiN.mjs.map +1 -0
- package/dist/{vrt-JoCQcFDG.d.mts → vrt-CuAg5Eow.d.mts} +2 -3
- package/dist/vrt-CuAg5Eow.d.mts.map +1 -0
- package/dist/vrt.d.mts +1 -1
- package/dist/vrt.mjs +3 -2
- package/package.json +5 -5
- package/dist/a11y-CR7bHK1d.mjs.map +0 -1
- package/dist/browser-launch-L43ulIaZ.mjs.map +0 -1
- package/dist/options-DLFcpXwQ.mjs.map +0 -1
- package/dist/template-D12HYJCn.mjs.map +0 -1
- package/dist/utils-BQi1club.mjs +0 -654
- package/dist/utils-BQi1club.mjs.map +0 -1
- package/dist/vrt-CUz4NxKK.mjs.map +0 -1
- package/dist/vrt-JoCQcFDG.d.mts.map +0 -1
|
@@ -1,10 +1,232 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import fs from "node:fs";
|
|
1
|
+
import { a as resolveReferences, c as writeRawTokenFile, f as analyzeSfcFallback, i as readRawTokenFile, l as scanTokenUsage, n as deleteTokenAtPath, o as setTokenAtPath, p as loadNative, r as findDependentTokens, s as validateSemanticReference, t as buildTokenMap, u as parseTokens } from "./resolver-D8_4jxfT.mjs";
|
|
2
|
+
import { r as resolveSnapshotIdentity } from "./snapshot-identity-Cm-t65Kl.mjs";
|
|
4
3
|
import path from "node:path";
|
|
5
|
-
import
|
|
6
|
-
import crypto, { createHash } from "node:crypto";
|
|
4
|
+
import fs from "node:fs";
|
|
5
|
+
import crypto, { createHash, randomBytes, timingSafeEqual } from "node:crypto";
|
|
7
6
|
import { lstat, readFile, readdir } from "node:fs/promises";
|
|
7
|
+
import ts from "typescript";
|
|
8
|
+
//#region src/http-error.ts
|
|
9
|
+
var HttpError = class extends Error {
|
|
10
|
+
status;
|
|
11
|
+
constructor(message, status) {
|
|
12
|
+
super(message);
|
|
13
|
+
this.name = "HttpError";
|
|
14
|
+
this.status = status;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region src/trusted-path.ts
|
|
19
|
+
function realpathNearest(targetPath) {
|
|
20
|
+
let current = path.resolve(targetPath);
|
|
21
|
+
const missingParts = [];
|
|
22
|
+
while (true) try {
|
|
23
|
+
const real = fs.realpathSync.native(current);
|
|
24
|
+
return missingParts.length > 0 ? path.join(real, ...missingParts.reverse()) : real;
|
|
25
|
+
} catch {
|
|
26
|
+
const parent = path.dirname(current);
|
|
27
|
+
if (parent === current) return path.resolve(targetPath);
|
|
28
|
+
missingParts.push(path.basename(current));
|
|
29
|
+
current = parent;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function isResolvedPathInside(parentDir, candidatePath) {
|
|
33
|
+
const parent = path.resolve(parentDir);
|
|
34
|
+
const candidate = path.resolve(candidatePath);
|
|
35
|
+
const relative = path.relative(parent, candidate);
|
|
36
|
+
return relative === "" || !relative.startsWith("..") && !path.isAbsolute(relative);
|
|
37
|
+
}
|
|
38
|
+
function isPathInsideAny(parentDirs, candidatePath) {
|
|
39
|
+
const candidate = realpathNearest(candidatePath);
|
|
40
|
+
return parentDirs.some((parentDir) => isResolvedPathInside(realpathNearest(parentDir), candidate));
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* True when `candidatePath` stays inside the project, or inside an extra root
|
|
44
|
+
* that was configured to live outside the project.
|
|
45
|
+
*
|
|
46
|
+
* Extra roots whose lexical path is still inside the project are not trusted
|
|
47
|
+
* after realpath — a planted `src` → `/etc` symlink must not widen the
|
|
48
|
+
* readable boundary.
|
|
49
|
+
*/
|
|
50
|
+
function isTrustedSourcePath(projectRoot, extraLexicalRoots, candidatePath) {
|
|
51
|
+
const lexicalProject = path.resolve(projectRoot);
|
|
52
|
+
const realProject = realpathNearest(projectRoot);
|
|
53
|
+
const realCandidate = realpathNearest(candidatePath);
|
|
54
|
+
if (isResolvedPathInside(realProject, realCandidate)) return true;
|
|
55
|
+
for (const lexicalRoot of extraLexicalRoots) {
|
|
56
|
+
const resolvedLexical = path.resolve(lexicalRoot);
|
|
57
|
+
if (isResolvedPathInside(lexicalProject, resolvedLexical)) continue;
|
|
58
|
+
if (isResolvedPathInside(realpathNearest(resolvedLexical), realCandidate)) return true;
|
|
59
|
+
}
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
function resolveTrustedSourcePath(projectRoot, extraLexicalRoots, candidatePath, label = "path") {
|
|
63
|
+
if (candidatePath.includes("\0")) throw new HttpError(`${label} contains an invalid character`, 400);
|
|
64
|
+
const resolved = path.isAbsolute(candidatePath) ? path.resolve(candidatePath) : path.resolve(path.resolve(projectRoot), candidatePath);
|
|
65
|
+
if (!isTrustedSourcePath(projectRoot, extraLexicalRoots, resolved)) throw new HttpError(`${label} escapes the allowed directory`, 400);
|
|
66
|
+
return resolved;
|
|
67
|
+
}
|
|
68
|
+
function resolveInside(parentDir, candidatePath, label = "path") {
|
|
69
|
+
return resolveInsideAny([parentDir], candidatePath, label);
|
|
70
|
+
}
|
|
71
|
+
function resolveInsideAny(parentDirs, candidatePath, label = "path") {
|
|
72
|
+
if (candidatePath.includes("\0")) throw new HttpError(`${label} contains an invalid character`, 400);
|
|
73
|
+
if (parentDirs.length === 0) throw new HttpError(`No allowed directories configured for ${label}`, 500);
|
|
74
|
+
const parent = path.resolve(parentDirs[0] ?? ".");
|
|
75
|
+
const resolved = path.isAbsolute(candidatePath) ? path.resolve(candidatePath) : path.resolve(parent, candidatePath);
|
|
76
|
+
if (!isPathInsideAny(parentDirs, resolved)) throw new HttpError(`${label} escapes the allowed directory`, 400);
|
|
77
|
+
return resolved;
|
|
78
|
+
}
|
|
79
|
+
function resolveUrlPathInside(parentDir, requestUrl, label = "path") {
|
|
80
|
+
let pathname = decodeUrlComponent(requestUrl.split(/[?#]/, 1)[0] || "/", label);
|
|
81
|
+
pathname = pathname.replaceAll("\\", "/");
|
|
82
|
+
if (pathname.split("/").includes("..")) throw new HttpError(`${label} must not contain parent directory segments`, 400);
|
|
83
|
+
return resolveInside(parentDir, `.${pathname}`, label);
|
|
84
|
+
}
|
|
85
|
+
function decodeUrlComponent(value, label = "path") {
|
|
86
|
+
try {
|
|
87
|
+
return decodeURIComponent(value);
|
|
88
|
+
} catch {
|
|
89
|
+
throw new HttpError(`${label} is not valid URL encoding`, 400);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
function hasSuffix(candidatePath, suffix) {
|
|
93
|
+
return realpathNearest(candidatePath).toLowerCase().endsWith(suffix);
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* True when the realpath still looks like a Vue SFC. A planted
|
|
97
|
+
* `Evil.vue` → `.env` symlink must not be treated as component source.
|
|
98
|
+
*/
|
|
99
|
+
function isVueSourcePath(candidatePath) {
|
|
100
|
+
return hasSuffix(candidatePath, ".vue");
|
|
101
|
+
}
|
|
102
|
+
function assertVueSourcePath(candidatePath, label = "path") {
|
|
103
|
+
if (!isVueSourcePath(candidatePath)) throw new HttpError(`${label} must be a .vue file`, 400);
|
|
104
|
+
}
|
|
105
|
+
/** Accept Vue SFCs and script modules while validating the resolved realpath. */
|
|
106
|
+
function assertComponentSourcePath(candidatePath, label = "path") {
|
|
107
|
+
const realPath = realpathNearest(candidatePath).toLowerCase();
|
|
108
|
+
if (!/\.(?:vue|ts|tsx|js|jsx)$/.test(realPath)) throw new HttpError(`${label} must be a .vue, .ts, .tsx, .js, or .jsx file`, 400);
|
|
109
|
+
}
|
|
110
|
+
function isArtVueSourcePath(candidatePath) {
|
|
111
|
+
return hasSuffix(candidatePath, ".art.vue");
|
|
112
|
+
}
|
|
113
|
+
function assertArtVueSourcePath(candidatePath, label = "art path") {
|
|
114
|
+
if (!isArtVueSourcePath(candidatePath)) throw new HttpError(`${label} must be a .art.vue file`, 400);
|
|
115
|
+
}
|
|
116
|
+
//#endregion
|
|
117
|
+
//#region src/security.ts
|
|
118
|
+
const DEFAULT_API_BODY_LIMIT_BYTES = 1024 * 1024;
|
|
119
|
+
function createDevSessionToken() {
|
|
120
|
+
return randomBytes(32).toString("base64url");
|
|
121
|
+
}
|
|
122
|
+
function collectRequestBody(req, limit = DEFAULT_API_BODY_LIMIT_BYTES) {
|
|
123
|
+
return new Promise((resolve, reject) => {
|
|
124
|
+
let body = "";
|
|
125
|
+
let size = 0;
|
|
126
|
+
let completed = false;
|
|
127
|
+
req.on("data", (chunk) => {
|
|
128
|
+
if (completed) return;
|
|
129
|
+
const buffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
|
|
130
|
+
size += buffer.byteLength;
|
|
131
|
+
if (size > limit) {
|
|
132
|
+
completed = true;
|
|
133
|
+
reject(new HttpError(`Request body exceeds ${limit} bytes`, 413));
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
body += buffer.toString("utf-8");
|
|
137
|
+
});
|
|
138
|
+
req.on("end", () => {
|
|
139
|
+
if (!completed) {
|
|
140
|
+
completed = true;
|
|
141
|
+
resolve(body);
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
req.on("error", (error) => {
|
|
145
|
+
if (!completed) {
|
|
146
|
+
completed = true;
|
|
147
|
+
reject(error);
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
function parseJsonBody(body) {
|
|
153
|
+
try {
|
|
154
|
+
return JSON.parse(body);
|
|
155
|
+
} catch (error) {
|
|
156
|
+
if (error instanceof SyntaxError) throw new HttpError("Malformed JSON body", 400);
|
|
157
|
+
throw error;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
function isLoopbackAddress(address) {
|
|
161
|
+
const value = address.trim().toLowerCase().replace(/^\[|\]$/g, "");
|
|
162
|
+
if (value === "localhost" || value === "::1") return true;
|
|
163
|
+
if (value.startsWith("::ffff:") || value.startsWith(":ffff:")) return isLoopbackAddress(value.slice(value.indexOf("ffff:") + 5));
|
|
164
|
+
const parts = value.split(".");
|
|
165
|
+
if (parts.length !== 4 || parts[0] !== "127") return false;
|
|
166
|
+
return parts.every((part, index) => {
|
|
167
|
+
if (index === 0) return true;
|
|
168
|
+
const octet = Number(part);
|
|
169
|
+
return Number.isInteger(octet) && octet >= 0 && octet <= 255;
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
function isLoopbackRequest(req) {
|
|
173
|
+
const remote = req.socket?.remoteAddress;
|
|
174
|
+
if (!remote) return false;
|
|
175
|
+
return isLoopbackAddress(remote);
|
|
176
|
+
}
|
|
177
|
+
function validateDevApiRequest(req, sessionToken) {
|
|
178
|
+
const originError = validateOrigin(req);
|
|
179
|
+
if (originError) return originError;
|
|
180
|
+
if (!isUnsafeMethod(req.method)) return null;
|
|
181
|
+
if (!isLoopbackRequest(req)) return new HttpError("Musea write APIs are limited to loopback clients", 403);
|
|
182
|
+
if (!hasValidSessionToken(req, sessionToken)) return new HttpError("Invalid Musea dev session token", 403);
|
|
183
|
+
if (!isJsonRequest(req)) return new HttpError("Content-Type must be application/json", 415);
|
|
184
|
+
return null;
|
|
185
|
+
}
|
|
186
|
+
function serializeScriptValue(value) {
|
|
187
|
+
return (JSON.stringify(value) ?? "undefined").replace(/[<>&\u2028\u2029]/g, (char) => {
|
|
188
|
+
switch (char) {
|
|
189
|
+
case "<": return "\\u003C";
|
|
190
|
+
case ">": return "\\u003E";
|
|
191
|
+
case "&": return "\\u0026";
|
|
192
|
+
case "\u2028": return "\\u2028";
|
|
193
|
+
case "\u2029": return "\\u2029";
|
|
194
|
+
default: return char;
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
function isUnsafeMethod(method) {
|
|
199
|
+
return method === "POST" || method === "PUT" || method === "PATCH" || method === "DELETE";
|
|
200
|
+
}
|
|
201
|
+
function isJsonRequest(req) {
|
|
202
|
+
return getHeader(req, "content-type")?.split(";")[0]?.trim().toLowerCase() === "application/json";
|
|
203
|
+
}
|
|
204
|
+
function validateOrigin(req) {
|
|
205
|
+
if (getHeader(req, "sec-fetch-site") === "cross-site") return new HttpError("Cross-origin Musea API requests are not allowed", 403);
|
|
206
|
+
const origin = getHeader(req, "origin");
|
|
207
|
+
if (!origin) return null;
|
|
208
|
+
const host = getHeader(req, "host");
|
|
209
|
+
if (!host) return new HttpError("Missing Host header", 400);
|
|
210
|
+
try {
|
|
211
|
+
if (new URL(origin).host !== host) return new HttpError("Cross-origin Musea API requests are not allowed", 403);
|
|
212
|
+
} catch {
|
|
213
|
+
return new HttpError("Invalid Origin header", 400);
|
|
214
|
+
}
|
|
215
|
+
return null;
|
|
216
|
+
}
|
|
217
|
+
function hasValidSessionToken(req, expectedToken) {
|
|
218
|
+
const actualToken = getHeader(req, "x-musea-session");
|
|
219
|
+
if (!actualToken) return false;
|
|
220
|
+
const actual = Buffer.from(actualToken);
|
|
221
|
+
const expected = Buffer.from(expectedToken);
|
|
222
|
+
return actual.length === expected.length && timingSafeEqual(actual, expected);
|
|
223
|
+
}
|
|
224
|
+
function getHeader(req, name) {
|
|
225
|
+
const value = req.headers[name];
|
|
226
|
+
if (Array.isArray(value)) return value[0];
|
|
227
|
+
return value;
|
|
228
|
+
}
|
|
229
|
+
//#endregion
|
|
8
230
|
//#region src/component-source.ts
|
|
9
231
|
function allowedSourceRoots(root, scanRoots = []) {
|
|
10
232
|
return [...new Set([root, ...scanRoots].map((sourceRoot) => path.resolve(sourceRoot)))];
|
|
@@ -21,6 +243,187 @@ function resolveComponentSourcePath(art, artPath, sourceRoots) {
|
|
|
21
243
|
return resolved;
|
|
22
244
|
}
|
|
23
245
|
//#endregion
|
|
246
|
+
//#region src/theme-config.ts
|
|
247
|
+
/**
|
|
248
|
+
* Build the theme config object from plugin options for runtime injection.
|
|
249
|
+
*/
|
|
250
|
+
function buildThemeConfig(theme) {
|
|
251
|
+
if (!theme) return void 0;
|
|
252
|
+
if (typeof theme === "string") return { default: theme };
|
|
253
|
+
const themes = Array.isArray(theme) ? theme : [theme];
|
|
254
|
+
const custom = {};
|
|
255
|
+
for (const t of themes) custom[t.name] = {
|
|
256
|
+
base: t.base,
|
|
257
|
+
colors: t.colors
|
|
258
|
+
};
|
|
259
|
+
return {
|
|
260
|
+
default: themes[0].name,
|
|
261
|
+
custom
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
//#endregion
|
|
265
|
+
//#region src/utils.ts
|
|
266
|
+
/**
|
|
267
|
+
* Shared utility functions for the Musea Vite plugin.
|
|
268
|
+
*/
|
|
269
|
+
function normalizeGlobPath(filepath) {
|
|
270
|
+
return filepath.split(path.sep).join("/");
|
|
271
|
+
}
|
|
272
|
+
function matchesPattern(file, pattern, root) {
|
|
273
|
+
const normalizedPattern = normalizeGlobPath(pattern);
|
|
274
|
+
return matchGlob(path.isAbsolute(pattern) ? path.resolve(file) : path.relative(root, file), normalizedPattern);
|
|
275
|
+
}
|
|
276
|
+
function shouldProcess(file, include, exclude, root) {
|
|
277
|
+
for (const pattern of exclude) if (matchesPattern(file, pattern, root)) return false;
|
|
278
|
+
for (const pattern of include) if (matchesPattern(file, pattern, root)) return true;
|
|
279
|
+
return false;
|
|
280
|
+
}
|
|
281
|
+
function matchGlob(filepath, pattern) {
|
|
282
|
+
const normalizedFilepath = normalizeGlobPath(filepath);
|
|
283
|
+
const normalizedPattern = normalizeGlobPath(pattern);
|
|
284
|
+
const PLACEHOLDER = "<<GLOBSTAR>>";
|
|
285
|
+
const SEGMENT_PLACEHOLDER = "<<GLOBSTAR_SEGMENT>>";
|
|
286
|
+
const regex = normalizedPattern.replaceAll("**/", SEGMENT_PLACEHOLDER).replaceAll("**", PLACEHOLDER).replace(/[|\\{}()[\]^$+?.]/g, "\\$&").replace(/\*/g, "[^/]*").replaceAll(SEGMENT_PLACEHOLDER, "(?:.*/)?").replaceAll(PLACEHOLDER, ".*");
|
|
287
|
+
return new RegExp(`^${regex}$`).test(normalizedFilepath);
|
|
288
|
+
}
|
|
289
|
+
async function readGitignoreDirectoryNames(bases) {
|
|
290
|
+
const names = /* @__PURE__ */ new Set();
|
|
291
|
+
for (const base of bases) {
|
|
292
|
+
let text = "";
|
|
293
|
+
try {
|
|
294
|
+
text = await fs.promises.readFile(path.join(base, ".gitignore"), "utf8");
|
|
295
|
+
} catch {
|
|
296
|
+
continue;
|
|
297
|
+
}
|
|
298
|
+
for (const line of text.split("\n")) {
|
|
299
|
+
const trimmed = line.trim();
|
|
300
|
+
if (!trimmed || trimmed.startsWith("#") || trimmed.startsWith("!")) continue;
|
|
301
|
+
const cleaned = trimmed.replace(/^\//, "").replace(/\/$/, "");
|
|
302
|
+
if (!cleaned || cleaned.includes("*") || cleaned.includes("/")) continue;
|
|
303
|
+
names.add(cleaned);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
return names;
|
|
307
|
+
}
|
|
308
|
+
async function shouldSkipScanDirectory(name, fullPath, scanRoots, ignoredDirNames) {
|
|
309
|
+
if (scanRoots.some((scanRoot) => path.resolve(scanRoot) === path.resolve(fullPath))) return false;
|
|
310
|
+
if (name.startsWith(".") || ignoredDirNames.has(name)) return true;
|
|
311
|
+
try {
|
|
312
|
+
await fs.promises.lstat(path.join(fullPath, ".git"));
|
|
313
|
+
return true;
|
|
314
|
+
} catch {
|
|
315
|
+
return false;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
function resolveScanRoot(root, pattern) {
|
|
319
|
+
const absolutePattern = path.isAbsolute(pattern) ? pattern : path.resolve(root, pattern);
|
|
320
|
+
const normalizedPattern = normalizeGlobPath(absolutePattern);
|
|
321
|
+
const globIndex = normalizedPattern.search(/[*[{]/);
|
|
322
|
+
if (globIndex === -1) return path.dirname(absolutePattern);
|
|
323
|
+
const staticPrefix = normalizedPattern.slice(0, globIndex);
|
|
324
|
+
if (!staticPrefix) return root;
|
|
325
|
+
if (staticPrefix.endsWith("/")) return path.resolve(staticPrefix.slice(0, -1));
|
|
326
|
+
return path.resolve(path.dirname(staticPrefix));
|
|
327
|
+
}
|
|
328
|
+
function resolveScanRoots(root, include) {
|
|
329
|
+
const roots = /* @__PURE__ */ new Set();
|
|
330
|
+
for (const pattern of include) roots.add(resolveScanRoot(root, pattern));
|
|
331
|
+
if (roots.size === 0) roots.add(root);
|
|
332
|
+
return [...roots];
|
|
333
|
+
}
|
|
334
|
+
async function scanArtFiles(root, include, exclude, scanInlineArt = false) {
|
|
335
|
+
const files = /* @__PURE__ */ new Set();
|
|
336
|
+
const scanRoots = resolveScanRoots(root, include);
|
|
337
|
+
const visitedDirs = /* @__PURE__ */ new Set();
|
|
338
|
+
const ignoredDirNames = await readGitignoreDirectoryNames([root, ...scanRoots]);
|
|
339
|
+
async function scan(dir) {
|
|
340
|
+
const resolvedDir = path.resolve(dir);
|
|
341
|
+
if (visitedDirs.has(resolvedDir)) return;
|
|
342
|
+
visitedDirs.add(resolvedDir);
|
|
343
|
+
let entries;
|
|
344
|
+
try {
|
|
345
|
+
entries = await fs.promises.readdir(resolvedDir, { withFileTypes: true });
|
|
346
|
+
} catch {
|
|
347
|
+
return;
|
|
348
|
+
}
|
|
349
|
+
for (const entry of entries) {
|
|
350
|
+
const fullPath = path.join(resolvedDir, entry.name);
|
|
351
|
+
let excluded = false;
|
|
352
|
+
for (const pattern of exclude) if (matchesPattern(fullPath, pattern, root) || matchGlob(entry.name, pattern)) {
|
|
353
|
+
excluded = true;
|
|
354
|
+
break;
|
|
355
|
+
}
|
|
356
|
+
if (excluded) continue;
|
|
357
|
+
if (entry.isSymbolicLink()) continue;
|
|
358
|
+
if (entry.isDirectory()) {
|
|
359
|
+
if (await shouldSkipScanDirectory(entry.name, fullPath, scanRoots, ignoredDirNames)) continue;
|
|
360
|
+
await scan(fullPath);
|
|
361
|
+
} else if (entry.isFile() && entry.name.endsWith(".art.vue")) {
|
|
362
|
+
if (shouldProcess(fullPath, include, exclude, root) && isTrustedSourcePath(root, scanRoots, fullPath)) files.add(fullPath);
|
|
363
|
+
} else if (scanInlineArt && entry.isFile() && entry.name.endsWith(".vue") && !entry.name.endsWith(".art.vue")) {
|
|
364
|
+
if (!isTrustedSourcePath(root, scanRoots, fullPath)) continue;
|
|
365
|
+
if ((await fs.promises.readFile(fullPath, "utf-8")).includes("<art")) files.add(fullPath);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
for (const scanRoot of scanRoots) await scan(scanRoot);
|
|
370
|
+
return [...files];
|
|
371
|
+
}
|
|
372
|
+
async function generateStorybookFiles(artFiles, root, outDir) {
|
|
373
|
+
const binding = loadNative();
|
|
374
|
+
const outputDir = path.resolve(root, outDir);
|
|
375
|
+
await fs.promises.mkdir(outputDir, { recursive: true });
|
|
376
|
+
for (const [filePath, art] of artFiles) try {
|
|
377
|
+
const source = await fs.promises.readFile(filePath, "utf-8");
|
|
378
|
+
const csf = binding.artToCsf(source, { filename: filePath });
|
|
379
|
+
const outputPath = path.join(outputDir, csf.filename);
|
|
380
|
+
const code = rewriteStorybookScriptImports(rewriteStorybookComponentImport(csf.code, art, filePath, outputPath), filePath, outputPath);
|
|
381
|
+
await fs.promises.writeFile(outputPath, code, "utf-8");
|
|
382
|
+
console.log(`[musea] Generated: ${path.relative(root, outputPath)}`);
|
|
383
|
+
} catch (e) {
|
|
384
|
+
console.error(`[musea] Failed to generate CSF for ${filePath}:`, e);
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
function rewriteStorybookComponentImport(code, art, artPath, outputPath) {
|
|
388
|
+
const component = art.isInline && art.componentPath ? art.componentPath : art.metadata.component;
|
|
389
|
+
if (!component || isBareImport(component)) return code;
|
|
390
|
+
const resolvedComponent = path.isAbsolute(component) ? component : path.resolve(path.dirname(artPath), component);
|
|
391
|
+
let relativeComponent = normalizeGlobPath(path.relative(path.dirname(outputPath), resolvedComponent));
|
|
392
|
+
if (!relativeComponent.startsWith(".")) relativeComponent = `./${relativeComponent}`;
|
|
393
|
+
return code.replace(/import\s+(__museaComponent)\s+from\s+(['"])([^'"]+)\2;/, `import $1 from $2${relativeComponent}$2;`);
|
|
394
|
+
}
|
|
395
|
+
function isBareImport(source) {
|
|
396
|
+
return !source.startsWith(".") && !path.isAbsolute(source);
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* Rewrite relative import specifiers in the generated Storybook CSF file so that
|
|
400
|
+
* imports lifted verbatim from the art file's `<script setup>` resolve against
|
|
401
|
+
* the generated file's location instead of the original art file's directory.
|
|
402
|
+
*
|
|
403
|
+
* The `__museaComponent` import is already rebased by
|
|
404
|
+
* `rewriteStorybookComponentImport` and is skipped here.
|
|
405
|
+
*/
|
|
406
|
+
function rewriteStorybookScriptImports(code, artPath, outputPath) {
|
|
407
|
+
const artDir = path.dirname(artPath);
|
|
408
|
+
const outDir = path.dirname(outputPath);
|
|
409
|
+
return code.replace(/(import\s+(?:[\s\S]*?)\s+from\s+)(['"])([^'"]+)\2(\s*;?)/g, (match, head, quote, specifier, tail) => {
|
|
410
|
+
if (!specifier.startsWith(".")) return match;
|
|
411
|
+
if (/\b__museaComponent\b/.test(head)) return match;
|
|
412
|
+
const resolved = path.resolve(artDir, specifier);
|
|
413
|
+
let rebased = normalizeGlobPath(path.relative(outDir, resolved));
|
|
414
|
+
if (!rebased.startsWith(".")) rebased = `./${rebased}`;
|
|
415
|
+
return `${head}${quote}${rebased}${quote}${tail}`;
|
|
416
|
+
});
|
|
417
|
+
}
|
|
418
|
+
function toPascalCase(str) {
|
|
419
|
+
const pascal = str.normalize("NFKD").replace(/[^\p{L}\p{N}]+/gu, " ").trim().split(/\s+/).filter(Boolean).map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join("");
|
|
420
|
+
if (!pascal) return "Variant";
|
|
421
|
+
return /^[\p{L}_$]/u.test(pascal) ? pascal : `Variant${pascal}`;
|
|
422
|
+
}
|
|
423
|
+
function escapeHtml(str) {
|
|
424
|
+
return str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
425
|
+
}
|
|
426
|
+
//#endregion
|
|
24
427
|
//#region src/variant-bindings.ts
|
|
25
428
|
/** Preserve ordinary bindings and disambiguate every normalized collision. */
|
|
26
429
|
function variantComponentNames(variants) {
|
|
@@ -598,845 +1001,112 @@ export default ${bindings.get(defaultVariant.name)};
|
|
|
598
1001
|
return code;
|
|
599
1002
|
}
|
|
600
1003
|
//#endregion
|
|
601
|
-
//#region src/
|
|
602
|
-
function
|
|
603
|
-
const
|
|
604
|
-
return {
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
},
|
|
611
|
-
resolveDesignTokenReferences(categories) {
|
|
612
|
-
const resolved = parseJsonResult(native.resolveDesignTokenReferences(JSON.stringify(categories)));
|
|
613
|
-
return {
|
|
614
|
-
...resolved,
|
|
615
|
-
categories: normalizeCategories(resolved.categories),
|
|
616
|
-
tokenMap: nullRecord(resolved.tokenMap)
|
|
617
|
-
};
|
|
618
|
-
},
|
|
619
|
-
flattenDesignTokenCategories(categories) {
|
|
620
|
-
return parseJsonResult(native.flattenDesignTokenCategories(JSON.stringify(categories)));
|
|
621
|
-
},
|
|
622
|
-
generateDesignTokensMarkdown(categories, generatedAt) {
|
|
623
|
-
return native.generateDesignTokensMarkdown(JSON.stringify(categories), generatedAt);
|
|
624
|
-
},
|
|
625
|
-
validateDesignTokenReference(tokenMap, reference, selfPath) {
|
|
626
|
-
return parseJsonResult(native.validateDesignTokenReference(JSON.stringify(tokenMap), reference, selfPath));
|
|
627
|
-
},
|
|
628
|
-
findDependentDesignTokens(tokenMap, targetPath) {
|
|
629
|
-
return native.findDependentDesignTokens(JSON.stringify(tokenMap), targetPath);
|
|
630
|
-
}
|
|
631
|
-
};
|
|
632
|
-
}
|
|
633
|
-
function parseJsonResult(value) {
|
|
634
|
-
if (typeof value === "string") return JSON.parse(value);
|
|
635
|
-
return value;
|
|
636
|
-
}
|
|
637
|
-
function normalizeCategories(categories) {
|
|
638
|
-
for (const category of categories) {
|
|
639
|
-
category.tokens = nullRecord(Object.fromEntries(sortTokenEntries(category.tokens)));
|
|
640
|
-
if (category.subcategories) normalizeCategories(category.subcategories);
|
|
1004
|
+
//#region src/plugin/art-processing.ts
|
|
1005
|
+
function extractArtTagAttributes(source) {
|
|
1006
|
+
const artTagMatch = source.match(/<art\b((?:[^>"']|"[^"]*"|'[^']*')*)>/i);
|
|
1007
|
+
if (!artTagMatch) return {};
|
|
1008
|
+
const attributes = {};
|
|
1009
|
+
for (const match of artTagMatch[1].matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'))?/g)) {
|
|
1010
|
+
const name = match[1];
|
|
1011
|
+
if (!name || name === "/") continue;
|
|
1012
|
+
attributes[name] = match[2] ?? match[3] ?? true;
|
|
641
1013
|
}
|
|
642
|
-
return
|
|
643
|
-
}
|
|
644
|
-
function sortTokenEntries(tokens) {
|
|
645
|
-
return Object.entries(tokens).sort((a, b) => {
|
|
646
|
-
const order = compareTokenOrder(a[1], b[1]);
|
|
647
|
-
if (order !== 0) return order;
|
|
648
|
-
return a[0].localeCompare(b[0], void 0, { numeric: true });
|
|
649
|
-
});
|
|
650
|
-
}
|
|
651
|
-
function compareTokenOrder(a, b) {
|
|
652
|
-
const aOrder = tokenOrder(a);
|
|
653
|
-
const bOrder = tokenOrder(b);
|
|
654
|
-
if (aOrder === void 0 && bOrder === void 0) return 0;
|
|
655
|
-
if (aOrder === void 0) return 1;
|
|
656
|
-
if (bOrder === void 0) return -1;
|
|
657
|
-
return aOrder - bOrder;
|
|
1014
|
+
return attributes;
|
|
658
1015
|
}
|
|
659
|
-
function
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
const parsed = Number(order);
|
|
664
|
-
if (Number.isFinite(parsed)) return parsed;
|
|
665
|
-
}
|
|
1016
|
+
function parseActionEvents(value) {
|
|
1017
|
+
if (typeof value !== "string") return void 0;
|
|
1018
|
+
const events = value.split(",").map((eventName) => eventName.trim().toLowerCase()).filter(Boolean);
|
|
1019
|
+
return events.length > 0 ? [...new Set(events)] : void 0;
|
|
666
1020
|
}
|
|
667
|
-
function
|
|
668
|
-
|
|
1021
|
+
function extractCustomArtMetadata(source) {
|
|
1022
|
+
const attrs = extractArtTagAttributes(source);
|
|
1023
|
+
const actionEvents = new Set(parseActionEvents(attrs["action-events"]) ?? []);
|
|
1024
|
+
const captureMousemove = attrs["capture-mousemove"];
|
|
1025
|
+
if (captureMousemove === true || captureMousemove === "true") actionEvents.add("mousemove");
|
|
1026
|
+
return { actionEvents: actionEvents.size > 0 ? [...actionEvents] : void 0 };
|
|
669
1027
|
}
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
const
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
prefix: "inset-shadow",
|
|
682
|
-
category: "shadow",
|
|
683
|
-
pathPrefix: ["inset"],
|
|
684
|
-
type: "shadow"
|
|
685
|
-
},
|
|
686
|
-
{
|
|
687
|
-
prefix: "drop-shadow",
|
|
688
|
-
category: "shadow",
|
|
689
|
-
pathPrefix: ["drop"],
|
|
690
|
-
type: "shadow"
|
|
691
|
-
},
|
|
692
|
-
{
|
|
693
|
-
prefix: "font-weight",
|
|
694
|
-
category: "typography",
|
|
695
|
-
pathPrefix: ["fontWeight"],
|
|
696
|
-
type: "fontWeight"
|
|
697
|
-
},
|
|
698
|
-
{
|
|
699
|
-
prefix: "color",
|
|
700
|
-
category: "color",
|
|
701
|
-
type: "color"
|
|
702
|
-
},
|
|
703
|
-
{
|
|
704
|
-
prefix: "spacing",
|
|
705
|
-
category: "spacing",
|
|
706
|
-
type: "dimension"
|
|
707
|
-
},
|
|
708
|
-
{
|
|
709
|
-
prefix: "font",
|
|
710
|
-
category: "typography",
|
|
711
|
-
pathPrefix: ["font"],
|
|
712
|
-
type: "fontFamily"
|
|
713
|
-
},
|
|
714
|
-
{
|
|
715
|
-
prefix: "text",
|
|
716
|
-
category: "typography",
|
|
717
|
-
pathPrefix: ["fontSize"],
|
|
718
|
-
type: "dimension"
|
|
719
|
-
},
|
|
720
|
-
{
|
|
721
|
-
prefix: "leading",
|
|
722
|
-
category: "typography",
|
|
723
|
-
pathPrefix: ["lineHeight"],
|
|
724
|
-
type: "number"
|
|
725
|
-
},
|
|
726
|
-
{
|
|
727
|
-
prefix: "tracking",
|
|
728
|
-
category: "typography",
|
|
729
|
-
pathPrefix: ["letterSpacing"],
|
|
730
|
-
type: "dimension"
|
|
731
|
-
},
|
|
732
|
-
{
|
|
733
|
-
prefix: "radius",
|
|
734
|
-
category: "radius",
|
|
735
|
-
type: "dimension"
|
|
736
|
-
},
|
|
737
|
-
{
|
|
738
|
-
prefix: "shadow",
|
|
739
|
-
category: "shadow",
|
|
740
|
-
type: "shadow"
|
|
741
|
-
},
|
|
742
|
-
{
|
|
743
|
-
prefix: "breakpoint",
|
|
744
|
-
category: "breakpoint",
|
|
745
|
-
type: "dimension"
|
|
746
|
-
},
|
|
747
|
-
{
|
|
748
|
-
prefix: "container",
|
|
749
|
-
category: "container",
|
|
750
|
-
type: "dimension"
|
|
751
|
-
},
|
|
752
|
-
{
|
|
753
|
-
prefix: "ease",
|
|
754
|
-
category: "easing",
|
|
755
|
-
type: "cubicBezier"
|
|
756
|
-
},
|
|
757
|
-
{
|
|
758
|
-
prefix: "animate",
|
|
759
|
-
category: "animation",
|
|
760
|
-
type: "transition"
|
|
761
|
-
},
|
|
762
|
-
{
|
|
763
|
-
prefix: "blur",
|
|
764
|
-
category: "blur",
|
|
765
|
-
type: "dimension"
|
|
766
|
-
},
|
|
767
|
-
{
|
|
768
|
-
prefix: "perspective",
|
|
769
|
-
category: "perspective",
|
|
770
|
-
type: "dimension"
|
|
771
|
-
},
|
|
772
|
-
{
|
|
773
|
-
prefix: "aspect",
|
|
774
|
-
category: "aspectRatio",
|
|
775
|
-
type: "number"
|
|
776
|
-
}
|
|
777
|
-
];
|
|
778
|
-
async function isTailwindTokenPath(tokensPath) {
|
|
779
|
-
const stat = await fs.promises.stat(tokensPath).catch(() => null);
|
|
780
|
-
if (!stat) return false;
|
|
781
|
-
if (stat.isFile()) return TAILWIND_TOKEN_EXTENSIONS.has(path.extname(tokensPath));
|
|
782
|
-
if (!stat.isDirectory()) return false;
|
|
783
|
-
return (await fs.promises.readdir(tokensPath, { withFileTypes: true })).some((entry) => entry.isFile() && TAILWIND_TOKEN_EXTENSIONS.has(path.extname(entry.name)));
|
|
784
|
-
}
|
|
785
|
-
async function parseTailwindTokens(tokensPath) {
|
|
786
|
-
const files = await collectTailwindTokenFiles(tokensPath);
|
|
787
|
-
const candidates = [];
|
|
788
|
-
for (const file of files) {
|
|
789
|
-
const css = await fs.promises.readFile(file, "utf-8");
|
|
790
|
-
candidates.push(...extractTailwindTokenCandidates(css));
|
|
791
|
-
}
|
|
792
|
-
return normalizeCategories(buildCategories(candidates));
|
|
793
|
-
}
|
|
794
|
-
async function collectTailwindTokenFiles(tokensPath) {
|
|
795
|
-
if ((await fs.promises.stat(tokensPath)).isFile()) return [tokensPath];
|
|
796
|
-
return (await fs.promises.readdir(tokensPath, { withFileTypes: true })).filter((entry) => entry.isFile() && TAILWIND_TOKEN_EXTENSIONS.has(path.extname(entry.name))).map((entry) => path.join(tokensPath, entry.name)).sort();
|
|
797
|
-
}
|
|
798
|
-
function extractTailwindTokenCandidates(css) {
|
|
799
|
-
const source = css.replace(CSS_COMMENT_RE, "");
|
|
800
|
-
const candidates = [];
|
|
801
|
-
let match;
|
|
802
|
-
VARIABLE_DECLARATION_RE.lastIndex = 0;
|
|
803
|
-
while ((match = VARIABLE_DECLARATION_RE.exec(source)) !== null) {
|
|
804
|
-
const variable = match[1];
|
|
805
|
-
const value = match[2].trim();
|
|
806
|
-
const mapped = mapTokenVariable(variable, value);
|
|
807
|
-
if (!mapped || !value) continue;
|
|
808
|
-
candidates.push({
|
|
809
|
-
variable,
|
|
810
|
-
value,
|
|
811
|
-
...mapped
|
|
1028
|
+
function extractStyleBlocks(source, filePath) {
|
|
1029
|
+
const styles = [];
|
|
1030
|
+
for (const match of source.matchAll(/<style\b((?:[^>"']|"[^"]*"|'[^']*')*)>([\s\S]*?)<\/style>/gi)) {
|
|
1031
|
+
const attrs = match[1] ?? "";
|
|
1032
|
+
const content = match[2]?.trim();
|
|
1033
|
+
const lang = attrs.match(/\blang\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase();
|
|
1034
|
+
if (!content) continue;
|
|
1035
|
+
styles.push({
|
|
1036
|
+
content,
|
|
1037
|
+
lang: lang ?? "css",
|
|
1038
|
+
scoped: /\bscoped\b/i.test(attrs)
|
|
812
1039
|
});
|
|
813
1040
|
}
|
|
814
|
-
return
|
|
815
|
-
}
|
|
816
|
-
function mapTokenVariable(variable, value) {
|
|
817
|
-
const tailwind = mapTailwindVariable(variable);
|
|
818
|
-
if (tailwind) return {
|
|
819
|
-
...tailwind,
|
|
820
|
-
description: `Tailwind theme variable ${variable}`
|
|
821
|
-
};
|
|
822
|
-
const segments = variable.replace(/^--/, "").split("-").filter(Boolean);
|
|
823
|
-
const category = segments[0];
|
|
824
|
-
if (!category) return null;
|
|
825
|
-
const rest = segments.slice(1).join("-");
|
|
826
|
-
return {
|
|
827
|
-
category,
|
|
828
|
-
path: rest ? [rest] : ["DEFAULT"],
|
|
829
|
-
type: inferCustomPropertyType(value),
|
|
830
|
-
description: `Custom property ${variable}`
|
|
831
|
-
};
|
|
832
|
-
}
|
|
833
|
-
function mapTailwindVariable(variable) {
|
|
834
|
-
const name = variable.replace(/^--/, "");
|
|
835
|
-
const mapping = NAMESPACE_MAPPINGS.find((candidate) => name === candidate.prefix || name.startsWith(`${candidate.prefix}-`));
|
|
836
|
-
if (!mapping) return null;
|
|
837
|
-
const rest = name === mapping.prefix ? "DEFAULT" : name.slice(mapping.prefix.length + 1);
|
|
838
|
-
const pathParts = [...mapping.pathPrefix ?? [], ...tailwindNameToPath(rest)];
|
|
839
|
-
if (pathParts.length === 0) return null;
|
|
1041
|
+
if (!styles.some((style) => style.scoped)) return { blocks: styles };
|
|
840
1042
|
return {
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
type: mapping.type
|
|
1043
|
+
scopeAttr: artScopeAttribute(filePath),
|
|
1044
|
+
blocks: styles
|
|
844
1045
|
};
|
|
845
1046
|
}
|
|
846
|
-
function
|
|
847
|
-
const
|
|
848
|
-
|
|
849
|
-
if (/^-?(?:\d+\.\d+|\d+)(?:px|rem|em|vh|vw|vmin|vmax|%)$/i.test(trimmed)) return "dimension";
|
|
850
|
-
if (/^-?(?:\d+\.\d+|\d+)$/.test(trimmed)) return "number";
|
|
851
|
-
return "other";
|
|
852
|
-
}
|
|
853
|
-
function tailwindNameToPath(name) {
|
|
854
|
-
if (!name || name === "DEFAULT") return ["DEFAULT"];
|
|
855
|
-
const parts = name.split("-").filter(Boolean);
|
|
856
|
-
if (parts.length <= 1) return parts;
|
|
857
|
-
const last = parts[parts.length - 1];
|
|
858
|
-
if (/^\d+$/.test(last)) return [...parts.slice(0, -1), last];
|
|
859
|
-
return [parts.join("-")];
|
|
860
|
-
}
|
|
861
|
-
function buildCategories(candidates) {
|
|
862
|
-
const variableToPath = /* @__PURE__ */ new Map();
|
|
863
|
-
for (const candidate of candidates) variableToPath.set(candidate.variable, [candidate.category, ...candidate.path].join("."));
|
|
864
|
-
const categoryMap = /* @__PURE__ */ new Map();
|
|
865
|
-
for (const candidate of candidates) {
|
|
866
|
-
const category = categoryMap.get(candidate.category) ?? {
|
|
867
|
-
name: candidate.category,
|
|
868
|
-
tokens: nullRecord({})
|
|
869
|
-
};
|
|
870
|
-
categoryMap.set(candidate.category, category);
|
|
871
|
-
const valueReference = parseTailwindVariableReference(candidate.value);
|
|
872
|
-
const referencedPath = valueReference ? variableToPath.get(valueReference) : void 0;
|
|
873
|
-
const token = {
|
|
874
|
-
value: referencedPath ? `{${referencedPath}}` : candidate.value,
|
|
875
|
-
type: candidate.type,
|
|
876
|
-
description: candidate.description,
|
|
877
|
-
attributes: { tailwindVariable: candidate.variable },
|
|
878
|
-
$tier: referencedPath ? "semantic" : "primitive",
|
|
879
|
-
...referencedPath ? { $reference: referencedPath } : {}
|
|
880
|
-
};
|
|
881
|
-
setCategoryToken(category, candidate.path, token);
|
|
882
|
-
}
|
|
883
|
-
return [...categoryMap.values()];
|
|
884
|
-
}
|
|
885
|
-
function parseTailwindVariableReference(value) {
|
|
886
|
-
return value.match(/^var\(\s*(--[A-Za-z0-9_-]+)\s*(?:,[^)]+)?\)$/)?.[1];
|
|
887
|
-
}
|
|
888
|
-
function setCategoryToken(category, pathParts, token) {
|
|
889
|
-
if (pathParts.length === 1) {
|
|
890
|
-
category.tokens[pathParts[0]] = token;
|
|
891
|
-
return;
|
|
892
|
-
}
|
|
893
|
-
let current = category;
|
|
894
|
-
for (const part of pathParts.slice(0, -1)) {
|
|
895
|
-
current.subcategories ??= [];
|
|
896
|
-
let next = current.subcategories.find((subcategory) => subcategory.name === part);
|
|
897
|
-
if (!next) {
|
|
898
|
-
next = {
|
|
899
|
-
name: part,
|
|
900
|
-
tokens: nullRecord({})
|
|
901
|
-
};
|
|
902
|
-
current.subcategories.push(next);
|
|
903
|
-
}
|
|
904
|
-
current = next;
|
|
905
|
-
}
|
|
906
|
-
current.tokens[pathParts[pathParts.length - 1]] = token;
|
|
907
|
-
}
|
|
908
|
-
//#endregion
|
|
909
|
-
//#region src/tokens/parser.ts
|
|
910
|
-
/**
|
|
911
|
-
* Token parsing utilities for Style Dictionary integration.
|
|
912
|
-
*
|
|
913
|
-
* Thin native binding for design token files (JSON) and directories.
|
|
914
|
-
*/
|
|
915
|
-
/**
|
|
916
|
-
* Parse Style Dictionary tokens file/directory or Tailwind CSS theme variables.
|
|
917
|
-
*/
|
|
918
|
-
async function parseTokens(tokensPath) {
|
|
919
|
-
if (await isTailwindTokenPath(tokensPath)) return parseTailwindTokens(tokensPath);
|
|
920
|
-
return normalizeCategories(tokenNative().parseDesignTokensFromPath(tokensPath));
|
|
921
|
-
}
|
|
922
|
-
//#endregion
|
|
923
|
-
//#region src/tokens/usage.ts
|
|
924
|
-
/**
|
|
925
|
-
* Token usage scanning and value normalization.
|
|
926
|
-
*
|
|
927
|
-
* Scans art file `<style>` blocks for CSS property values that match
|
|
928
|
-
* design token values, and provides value normalization utilities.
|
|
929
|
-
*/
|
|
930
|
-
/**
|
|
931
|
-
* Normalize a token value for comparison.
|
|
932
|
-
* - Lowercase, trim
|
|
933
|
-
* - Leading-zero: `.5rem` -> `0.5rem`
|
|
934
|
-
* - Short hex: `#fff` -> `#ffffff`
|
|
935
|
-
*/
|
|
936
|
-
function normalizeTokenValue(value) {
|
|
937
|
-
let v = String(value).trim().toLowerCase();
|
|
938
|
-
const shortHex = v.match(/^#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])?$/);
|
|
939
|
-
if (shortHex) {
|
|
940
|
-
const [, r, g, b, a] = shortHex;
|
|
941
|
-
v = a ? `#${r}${r}${g}${g}${b}${b}${a}${a}` : `#${r}${r}${g}${g}${b}${b}`;
|
|
942
|
-
}
|
|
943
|
-
v = v.replace(/(?<![0-9])\.(\d)/g, "0.$1");
|
|
944
|
-
return v;
|
|
945
|
-
}
|
|
946
|
-
const STYLE_BLOCK_RE = /<style[^>]*>([\s\S]*?)<\/style>/g;
|
|
947
|
-
const CSS_PROPERTY_RE = /^\s*([\w-]+)\s*:\s*(.+?)\s*;?\s*$/;
|
|
948
|
-
/**
|
|
949
|
-
* Scan art file sources for token value matches in `<style>` blocks.
|
|
950
|
-
*/
|
|
951
|
-
function scanTokenUsage(artFiles, tokenMap) {
|
|
952
|
-
const valueLookup = /* @__PURE__ */ new Map();
|
|
953
|
-
for (const [tokenPath, token] of Object.entries(tokenMap)) {
|
|
954
|
-
const normalized = normalizeTokenValue(token.$resolvedValue ?? token.value);
|
|
955
|
-
if (!normalized) continue;
|
|
956
|
-
const existing = valueLookup.get(normalized);
|
|
957
|
-
if (existing) existing.push(tokenPath);
|
|
958
|
-
else valueLookup.set(normalized, [tokenPath]);
|
|
959
|
-
const tailwindVariable = token.attributes?.tailwindVariable;
|
|
960
|
-
if (typeof tailwindVariable === "string") {
|
|
961
|
-
const normalizedVariable = normalizeTokenValue(`var(${tailwindVariable})`);
|
|
962
|
-
const variableMatches = valueLookup.get(normalizedVariable);
|
|
963
|
-
if (variableMatches) variableMatches.push(tokenPath);
|
|
964
|
-
else valueLookup.set(normalizedVariable, [tokenPath]);
|
|
965
|
-
}
|
|
966
|
-
}
|
|
967
|
-
const usageMap = {};
|
|
968
|
-
for (const [artPath, artInfo] of artFiles) {
|
|
969
|
-
let source;
|
|
970
|
-
try {
|
|
971
|
-
source = fs.readFileSync(artPath, "utf-8");
|
|
972
|
-
} catch {
|
|
973
|
-
continue;
|
|
974
|
-
}
|
|
975
|
-
const allLines = source.split("\n");
|
|
976
|
-
const styleRegions = [];
|
|
977
|
-
let match;
|
|
978
|
-
STYLE_BLOCK_RE.lastIndex = 0;
|
|
979
|
-
while ((match = STYLE_BLOCK_RE.exec(source)) !== null) {
|
|
980
|
-
const beforeMatch = source.slice(0, match.index);
|
|
981
|
-
const startTag = source.slice(match.index, match.index + match[0].indexOf(match[1]));
|
|
982
|
-
const startLine = beforeMatch.split("\n").length + startTag.split("\n").length - 1;
|
|
983
|
-
styleRegions.push({
|
|
984
|
-
startLine,
|
|
985
|
-
content: match[1]
|
|
986
|
-
});
|
|
987
|
-
}
|
|
988
|
-
for (const region of styleRegions) {
|
|
989
|
-
const lines = region.content.split("\n");
|
|
990
|
-
for (let i = 0; i < lines.length; i++) {
|
|
991
|
-
const line = lines[i];
|
|
992
|
-
const propMatch = line.match(CSS_PROPERTY_RE);
|
|
993
|
-
if (!propMatch) continue;
|
|
994
|
-
const property = propMatch[1];
|
|
995
|
-
const valueParts = propMatch[2].split(/\s+/);
|
|
996
|
-
for (const part of valueParts) {
|
|
997
|
-
const normalizedPart = normalizeTokenValue(part);
|
|
998
|
-
const matchingTokens = valueLookup.get(normalizedPart);
|
|
999
|
-
if (!matchingTokens) continue;
|
|
1000
|
-
const lineNumber = region.startLine + i;
|
|
1001
|
-
const lineContent = allLines[lineNumber - 1]?.trim() ?? line.trim();
|
|
1002
|
-
for (const tokenPath of matchingTokens) {
|
|
1003
|
-
if (!usageMap[tokenPath]) usageMap[tokenPath] = [];
|
|
1004
|
-
let entry = usageMap[tokenPath].find((e) => e.artPath === artPath);
|
|
1005
|
-
if (!entry) {
|
|
1006
|
-
entry = {
|
|
1007
|
-
artPath,
|
|
1008
|
-
artTitle: artInfo.metadata.title,
|
|
1009
|
-
artCategory: artInfo.metadata.category,
|
|
1010
|
-
matches: []
|
|
1011
|
-
};
|
|
1012
|
-
usageMap[tokenPath].push(entry);
|
|
1013
|
-
}
|
|
1014
|
-
if (!entry.matches.some((m) => m.line === lineNumber && m.property === property)) entry.matches.push({
|
|
1015
|
-
line: lineNumber,
|
|
1016
|
-
lineContent,
|
|
1017
|
-
property
|
|
1018
|
-
});
|
|
1019
|
-
}
|
|
1020
|
-
}
|
|
1021
|
-
}
|
|
1022
|
-
}
|
|
1023
|
-
}
|
|
1024
|
-
return usageMap;
|
|
1025
|
-
}
|
|
1026
|
-
//#endregion
|
|
1027
|
-
//#region src/tokens/resolver.ts
|
|
1028
|
-
/**
|
|
1029
|
-
* Token resolution, CRUD operations, and validation.
|
|
1030
|
-
*
|
|
1031
|
-
* Handles building flat token maps from categories, resolving reference chains,
|
|
1032
|
-
* reading/writing raw token files, and validating semantic references.
|
|
1033
|
-
*/
|
|
1034
|
-
const JSON_TOKEN_EXTENSIONS = new Set([".json", ".tokens.json"]);
|
|
1035
|
-
const UNSAFE_TOKEN_PATH_SEGMENTS = new Set([
|
|
1036
|
-
"__proto__",
|
|
1037
|
-
"prototype",
|
|
1038
|
-
"constructor"
|
|
1039
|
-
]);
|
|
1040
|
-
function parseTokenPath(dotPath) {
|
|
1041
|
-
const parts = dotPath.split(".");
|
|
1042
|
-
if (parts.length === 0 || parts.some((part) => part.trim() === "")) throw new Error(`Invalid token path "${dotPath}"`);
|
|
1043
|
-
const unsafeSegment = parts.find((part) => UNSAFE_TOKEN_PATH_SEGMENTS.has(part));
|
|
1044
|
-
if (unsafeSegment) throw new Error(`Token path segment "${unsafeSegment}" is not allowed`);
|
|
1045
|
-
return parts;
|
|
1046
|
-
}
|
|
1047
|
-
/**
|
|
1048
|
-
* Flatten nested categories into a flat map keyed by dot-path.
|
|
1049
|
-
*/
|
|
1050
|
-
function buildTokenMap(categories) {
|
|
1051
|
-
return nullRecord(tokenNative().buildDesignTokenMap(categories));
|
|
1052
|
-
}
|
|
1053
|
-
/**
|
|
1054
|
-
* Resolve references in categories, setting $tier, $reference, and $resolvedValue.
|
|
1055
|
-
*/
|
|
1056
|
-
function resolveReferences(categories, _tokenMap) {
|
|
1057
|
-
const resolved = tokenNative().resolveDesignTokenReferences(categories);
|
|
1058
|
-
categories.splice(0, categories.length, ...normalizeCategories(resolved.categories));
|
|
1059
|
-
}
|
|
1060
|
-
/**
|
|
1061
|
-
* Read raw JSON token file.
|
|
1062
|
-
*/
|
|
1063
|
-
async function readRawTokenFile(tokensPath) {
|
|
1064
|
-
if (!isJsonTokenPath(tokensPath)) throw new Error("Token editing is only supported for JSON token files");
|
|
1065
|
-
const content = await fs.promises.readFile(tokensPath, "utf-8");
|
|
1066
|
-
return JSON.parse(content);
|
|
1067
|
-
}
|
|
1068
|
-
/**
|
|
1069
|
-
* Write raw JSON token file atomically (write tmp, rename).
|
|
1070
|
-
*/
|
|
1071
|
-
async function writeRawTokenFile(tokensPath, data) {
|
|
1072
|
-
if (!isJsonTokenPath(tokensPath)) throw new Error("Token editing is only supported for JSON token files");
|
|
1073
|
-
const tmpPath = tokensPath + ".tmp";
|
|
1074
|
-
await fs.promises.writeFile(tmpPath, JSON.stringify(data, null, 2) + "\n", "utf-8");
|
|
1075
|
-
await fs.promises.rename(tmpPath, tokensPath);
|
|
1076
|
-
}
|
|
1077
|
-
function isJsonTokenPath(tokensPath) {
|
|
1078
|
-
return JSON_TOKEN_EXTENSIONS.has(path.extname(tokensPath)) || tokensPath.endsWith(".tokens.json");
|
|
1079
|
-
}
|
|
1080
|
-
/**
|
|
1081
|
-
* Set a token at a dot-separated path in the raw JSON structure.
|
|
1082
|
-
*/
|
|
1083
|
-
function setTokenAtPath(data, dotPath, token) {
|
|
1084
|
-
const parts = parseTokenPath(dotPath);
|
|
1085
|
-
let current = data;
|
|
1086
|
-
for (let i = 0; i < parts.length - 1; i++) {
|
|
1087
|
-
const key = parts[i];
|
|
1088
|
-
if (typeof current[key] !== "object" || current[key] === null) current[key] = {};
|
|
1089
|
-
current = current[key];
|
|
1090
|
-
}
|
|
1091
|
-
const leafKey = parts[parts.length - 1];
|
|
1092
|
-
const raw = { value: token.value };
|
|
1093
|
-
if (token.type) raw.type = token.type;
|
|
1094
|
-
if (token.description) raw.description = token.description;
|
|
1095
|
-
if (token.$tier) raw.$tier = token.$tier;
|
|
1096
|
-
if (token.$reference) raw.$reference = token.$reference;
|
|
1097
|
-
if (token.attributes) raw.attributes = token.attributes;
|
|
1098
|
-
current[leafKey] = raw;
|
|
1047
|
+
function formatArtProcessingError(root, filePath, error) {
|
|
1048
|
+
const detail = error instanceof Error ? error.message || error.name : error == null ? "unknown error" : stringifyUnknown(error);
|
|
1049
|
+
return `[musea] Failed to process ${path.relative(root, filePath) || filePath}: ${detail}`;
|
|
1099
1050
|
}
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
for (let i = 0; i < parts.length - 1; i++) {
|
|
1108
|
-
const key = parts[i];
|
|
1109
|
-
if (typeof current[key] !== "object" || current[key] === null) return false;
|
|
1110
|
-
parents.push({
|
|
1111
|
-
obj: current,
|
|
1112
|
-
key
|
|
1113
|
-
});
|
|
1114
|
-
current = current[key];
|
|
1115
|
-
}
|
|
1116
|
-
const leafKey = parts[parts.length - 1];
|
|
1117
|
-
if (!(leafKey in current)) return false;
|
|
1118
|
-
delete current[leafKey];
|
|
1119
|
-
for (let i = parents.length - 1; i >= 0; i--) {
|
|
1120
|
-
const { obj, key } = parents[i];
|
|
1121
|
-
const child = obj[key];
|
|
1122
|
-
if (Object.keys(child).length === 0) delete obj[key];
|
|
1123
|
-
else break;
|
|
1051
|
+
function stringifyUnknown(value) {
|
|
1052
|
+
if (typeof value === "string") return value;
|
|
1053
|
+
if (typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") return value.toString();
|
|
1054
|
+
try {
|
|
1055
|
+
return JSON.stringify(value) ?? "unknown error";
|
|
1056
|
+
} catch {
|
|
1057
|
+
return "unknown error";
|
|
1124
1058
|
}
|
|
1125
|
-
return true;
|
|
1126
|
-
}
|
|
1127
|
-
/**
|
|
1128
|
-
* Validate that a semantic reference points to an existing token and has no cycles.
|
|
1129
|
-
*/
|
|
1130
|
-
function validateSemanticReference(tokenMap, reference, selfPath) {
|
|
1131
|
-
return tokenNative().validateDesignTokenReference(tokenMap, reference, selfPath);
|
|
1132
|
-
}
|
|
1133
|
-
/**
|
|
1134
|
-
* Find all tokens that reference the given path.
|
|
1135
|
-
*/
|
|
1136
|
-
function findDependentTokens(tokenMap, targetPath) {
|
|
1137
|
-
return tokenNative().findDependentDesignTokens(tokenMap, targetPath);
|
|
1138
|
-
}
|
|
1139
|
-
//#endregion
|
|
1140
|
-
//#region src/tokens/generator.ts
|
|
1141
|
-
/**
|
|
1142
|
-
* Token documentation generators for Style Dictionary integration.
|
|
1143
|
-
*
|
|
1144
|
-
* Generates HTML, Markdown, and JSON documentation from parsed token categories,
|
|
1145
|
-
* and provides the main processStyleDictionary orchestrator function.
|
|
1146
|
-
*/
|
|
1147
|
-
const SAFE_CSS_COLOR_PATTERN = /^(?:#[0-9a-fA-F]{3,8}|(?:rgb|hsl)a?\(\s*[-+.\d,%\s/]+\)|(?:oklch|oklab|lab|lch)\(\s*[-+.\d,%\s/]+\))$/;
|
|
1148
|
-
const DANGEROUS_PROTOCOL_PATTERN = /\b(javascript|vbscript):/gi;
|
|
1149
|
-
function escapeTokenText(value) {
|
|
1150
|
-
return escapeHtml(value).replace(DANGEROUS_PROTOCOL_PATTERN, "$1:");
|
|
1151
|
-
}
|
|
1152
|
-
function safeCssColor(value, type) {
|
|
1153
|
-
if (typeof value !== "string") return null;
|
|
1154
|
-
const trimmed = value.trim();
|
|
1155
|
-
return (type === "color" || trimmed.startsWith("#") || trimmed.startsWith("rgb") || trimmed.startsWith("hsl")) && SAFE_CSS_COLOR_PATTERN.test(trimmed) ? trimmed : null;
|
|
1156
|
-
}
|
|
1157
|
-
/**
|
|
1158
|
-
* Generate HTML documentation for tokens.
|
|
1159
|
-
*/
|
|
1160
|
-
function generateTokensHtml(categories) {
|
|
1161
|
-
const renderToken = (name, token) => {
|
|
1162
|
-
const color = safeCssColor(token.value, token.type);
|
|
1163
|
-
return `
|
|
1164
|
-
<div class="token">
|
|
1165
|
-
<div class="token-preview">
|
|
1166
|
-
${color ? `<div class="color-swatch" style="background: ${color}"></div>` : ""}
|
|
1167
|
-
</div>
|
|
1168
|
-
<div class="token-info">
|
|
1169
|
-
<div class="token-name">${escapeTokenText(name)}</div>
|
|
1170
|
-
<div class="token-value">${escapeTokenText(String(token.value))}</div>
|
|
1171
|
-
${token.description ? `<div class="token-description">${escapeTokenText(token.description)}</div>` : ""}
|
|
1172
|
-
</div>
|
|
1173
|
-
</div>
|
|
1174
|
-
`;
|
|
1175
|
-
};
|
|
1176
|
-
const renderCategory = (category, level = 2) => {
|
|
1177
|
-
const heading = `h${Math.min(level, 6)}`;
|
|
1178
|
-
let html = `<${heading}>${escapeTokenText(category.name)}</${heading}>`;
|
|
1179
|
-
html += "<div class=\"tokens-grid\">";
|
|
1180
|
-
for (const [name, token] of Object.entries(category.tokens)) html += renderToken(name, token);
|
|
1181
|
-
html += "</div>";
|
|
1182
|
-
if (category.subcategories) for (const sub of category.subcategories) html += renderCategory(sub, level + 1);
|
|
1183
|
-
return html;
|
|
1184
|
-
};
|
|
1185
|
-
return `<!DOCTYPE html>
|
|
1186
|
-
<html lang="en">
|
|
1187
|
-
<head>
|
|
1188
|
-
<meta charset="UTF-8">
|
|
1189
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
1190
|
-
<title>Design Tokens - Musea</title>
|
|
1191
|
-
<style>
|
|
1192
|
-
:root {
|
|
1193
|
-
--musea-bg: #0d0d0d;
|
|
1194
|
-
--musea-bg-secondary: #1a1815;
|
|
1195
|
-
--musea-text: #e6e9f0;
|
|
1196
|
-
--musea-text-muted: #7b8494;
|
|
1197
|
-
--musea-accent: #a34828;
|
|
1198
|
-
--musea-border: #3a3530;
|
|
1199
|
-
}
|
|
1200
|
-
* { box-sizing: border-box; margin: 0; padding: 0; }
|
|
1201
|
-
body {
|
|
1202
|
-
font-family: 'Inter', -apple-system, sans-serif;
|
|
1203
|
-
background: var(--musea-bg);
|
|
1204
|
-
color: var(--musea-text);
|
|
1205
|
-
line-height: 1.6;
|
|
1206
|
-
padding: 2rem;
|
|
1207
|
-
}
|
|
1208
|
-
h1 { margin-bottom: 2rem; color: var(--musea-accent); }
|
|
1209
|
-
h2 { margin: 2rem 0 1rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--musea-border); }
|
|
1210
|
-
h3, h4, h5, h6 { margin: 1.5rem 0 0.75rem; }
|
|
1211
|
-
.tokens-grid {
|
|
1212
|
-
display: grid;
|
|
1213
|
-
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
|
|
1214
|
-
gap: 1rem;
|
|
1215
|
-
margin-bottom: 1.5rem;
|
|
1216
|
-
}
|
|
1217
|
-
.token {
|
|
1218
|
-
background: var(--musea-bg-secondary);
|
|
1219
|
-
border: 1px solid var(--musea-border);
|
|
1220
|
-
border-radius: 8px;
|
|
1221
|
-
padding: 1rem;
|
|
1222
|
-
display: flex;
|
|
1223
|
-
gap: 1rem;
|
|
1224
|
-
align-items: center;
|
|
1225
|
-
}
|
|
1226
|
-
.token-preview {
|
|
1227
|
-
flex-shrink: 0;
|
|
1228
|
-
width: 48px;
|
|
1229
|
-
height: 48px;
|
|
1230
|
-
display: flex;
|
|
1231
|
-
align-items: center;
|
|
1232
|
-
justify-content: center;
|
|
1233
|
-
}
|
|
1234
|
-
.color-swatch {
|
|
1235
|
-
width: 48px;
|
|
1236
|
-
height: 48px;
|
|
1237
|
-
border-radius: 8px;
|
|
1238
|
-
border: 1px solid var(--musea-border);
|
|
1239
|
-
}
|
|
1240
|
-
.token-info {
|
|
1241
|
-
flex: 1;
|
|
1242
|
-
min-width: 0;
|
|
1243
|
-
}
|
|
1244
|
-
.token-name {
|
|
1245
|
-
font-weight: 600;
|
|
1246
|
-
font-family: 'JetBrains Mono', monospace;
|
|
1247
|
-
font-size: 0.875rem;
|
|
1248
|
-
}
|
|
1249
|
-
.token-value {
|
|
1250
|
-
color: var(--musea-text-muted);
|
|
1251
|
-
font-family: 'JetBrains Mono', monospace;
|
|
1252
|
-
font-size: 0.75rem;
|
|
1253
|
-
word-break: break-all;
|
|
1254
|
-
}
|
|
1255
|
-
.token-description {
|
|
1256
|
-
color: var(--musea-text-muted);
|
|
1257
|
-
font-size: 0.75rem;
|
|
1258
|
-
margin-top: 0.25rem;
|
|
1259
|
-
}
|
|
1260
|
-
</style>
|
|
1261
|
-
</head>
|
|
1262
|
-
<body>
|
|
1263
|
-
<h1>Design Tokens</h1>
|
|
1264
|
-
${categories.map((cat) => renderCategory(cat)).join("")}
|
|
1265
|
-
</body>
|
|
1266
|
-
</html>`;
|
|
1267
1059
|
}
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
return tokenNative().generateDesignTokensMarkdown(categories, (/* @__PURE__ */ new Date()).toISOString());
|
|
1060
|
+
function reportArtStatusWarnings(binding, source, filename, warn = console.warn) {
|
|
1061
|
+
const warnings = binding.parseArtStatusWarnings?.(source, { filename });
|
|
1062
|
+
if (warnings == null) return;
|
|
1063
|
+
for (const warning of warnings) warn(`[musea] ${warning}`);
|
|
1273
1064
|
}
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1065
|
+
async function processMuseaArtFile(filePath, ctx) {
|
|
1066
|
+
try {
|
|
1067
|
+
const source = await fs.promises.readFile(filePath, "utf-8");
|
|
1068
|
+
const binding = loadNative();
|
|
1069
|
+
const parsed = binding.parseArt(source, { filename: filePath });
|
|
1070
|
+
reportArtStatusWarnings(binding, source, filePath);
|
|
1071
|
+
const customMetadata = extractCustomArtMetadata(source);
|
|
1072
|
+
if (!parsed.variants || parsed.variants.length === 0) return null;
|
|
1073
|
+
const isInline = !filePath.endsWith(".art.vue");
|
|
1074
|
+
const styles = isInline ? { blocks: [] } : extractStyleBlocks(source, filePath);
|
|
1075
|
+
return {
|
|
1076
|
+
path: filePath,
|
|
1077
|
+
metadata: {
|
|
1078
|
+
title: parsed.metadata.title || (isInline ? path.basename(filePath, ".vue") : ""),
|
|
1079
|
+
description: parsed.metadata.description,
|
|
1080
|
+
component: isInline ? void 0 : parsed.metadata.component,
|
|
1081
|
+
category: parsed.metadata.category,
|
|
1082
|
+
tags: parsed.metadata.tags,
|
|
1083
|
+
status: parsed.metadata.status,
|
|
1084
|
+
order: parsed.metadata.order,
|
|
1085
|
+
actionEvents: customMetadata.actionEvents ?? parsed.metadata.actionEvents
|
|
1086
|
+
},
|
|
1087
|
+
variants: parsed.variants.map((v) => ({
|
|
1088
|
+
name: v.name,
|
|
1089
|
+
template: styles.scopeAttr ? stampScopeAttribute(v.template, styles.scopeAttr) : v.template,
|
|
1090
|
+
isDefault: v.isDefault,
|
|
1091
|
+
skipVrt: v.skipVrt
|
|
1092
|
+
})),
|
|
1093
|
+
hasScriptSetup: isInline ? false : parsed.hasScriptSetup,
|
|
1094
|
+
scriptSetupContent: !isInline && parsed.hasScriptSetup ? extractScriptSetupContent(source) : void 0,
|
|
1095
|
+
scriptSetupIsolated: !isInline && parsed.hasScriptSetup ? extractScriptSetupIsolated(source) : true,
|
|
1096
|
+
hasScript: parsed.hasScript,
|
|
1097
|
+
styleCount: parsed.styleCount,
|
|
1098
|
+
styleBlocks: styles.blocks.map((style) => style.content),
|
|
1099
|
+
styleBlockDetails: styles.blocks,
|
|
1100
|
+
isInline,
|
|
1101
|
+
componentPath: isInline ? filePath : void 0,
|
|
1102
|
+
inlineArtBlockIndex: isInline ? binding.parseSfc(source, { filename: filePath }).customBlocks.findIndex((block) => block.type === "art") : void 0
|
|
1103
|
+
};
|
|
1104
|
+
} catch (error) {
|
|
1105
|
+
const message = formatArtProcessingError(ctx.root, filePath, error);
|
|
1106
|
+
if (ctx.command === "build") throw new Error(message);
|
|
1107
|
+
(ctx.onError ?? console.error)(message);
|
|
1108
|
+
return null;
|
|
1297
1109
|
}
|
|
1298
|
-
const outputPath = path.join(outputDir, filename);
|
|
1299
|
-
await fs.promises.writeFile(outputPath, content, "utf-8");
|
|
1300
|
-
console.log(`[musea] Generated token documentation: ${outputPath}`);
|
|
1301
|
-
return {
|
|
1302
|
-
categories,
|
|
1303
|
-
metadata: {
|
|
1304
|
-
name: path.basename(config.tokensPath),
|
|
1305
|
-
generatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
1306
|
-
}
|
|
1307
|
-
};
|
|
1308
|
-
}
|
|
1309
|
-
//#endregion
|
|
1310
|
-
//#region src/tokens/preview.ts
|
|
1311
|
-
function resolveTokenPreview(input) {
|
|
1312
|
-
const reference = resolveReference(input.token, input.tokenMap);
|
|
1313
|
-
const value = input.token.$resolvedValue ?? reference?.value ?? input.token.value;
|
|
1314
|
-
const candidates = buildCandidates(input.tokenPath, input.token, reference);
|
|
1315
|
-
const kind = resolveCustomKind(candidates, reference?.path, input.config?.rules) ?? inferPreviewKind(candidates, value);
|
|
1316
|
-
return {
|
|
1317
|
-
kind: new Set(input.config?.disabledKinds ?? []).has(kind) ? "generic" : kind,
|
|
1318
|
-
value,
|
|
1319
|
-
tokenPath: input.tokenPath,
|
|
1320
|
-
reference
|
|
1321
|
-
};
|
|
1322
|
-
}
|
|
1323
|
-
function resolveReference(token, tokenMap) {
|
|
1324
|
-
if (!token.$reference) return void 0;
|
|
1325
|
-
const referencedToken = tokenMap?.[token.$reference];
|
|
1326
|
-
return {
|
|
1327
|
-
path: token.$reference,
|
|
1328
|
-
token: referencedToken,
|
|
1329
|
-
value: referencedToken ? referencedToken.$resolvedValue ?? referencedToken.value : void 0
|
|
1330
|
-
};
|
|
1331
|
-
}
|
|
1332
|
-
function buildCandidates(tokenPath, token, reference) {
|
|
1333
|
-
const candidates = [{
|
|
1334
|
-
tokenPath,
|
|
1335
|
-
name: pathName(tokenPath),
|
|
1336
|
-
token
|
|
1337
|
-
}];
|
|
1338
|
-
if (reference?.token) candidates.push({
|
|
1339
|
-
tokenPath: reference.path,
|
|
1340
|
-
name: pathName(reference.path),
|
|
1341
|
-
token: reference.token
|
|
1342
|
-
});
|
|
1343
|
-
return candidates;
|
|
1344
|
-
}
|
|
1345
|
-
function resolveCustomKind(candidates, referencePath, rules) {
|
|
1346
|
-
for (const rule of rules ?? []) if (matchesRule(rule, candidates, referencePath)) return rule.kind;
|
|
1347
|
-
}
|
|
1348
|
-
function matchesRule(rule, candidates, referencePath) {
|
|
1349
|
-
const checks = [];
|
|
1350
|
-
if (rule.type !== void 0) checks.push(candidates.some((candidate) => typeMatches(candidate, rule.type)));
|
|
1351
|
-
if (rule.pathIncludes !== void 0) checks.push(candidates.some((candidate) => includesAny(candidate.tokenPath, rule.pathIncludes)));
|
|
1352
|
-
if (rule.nameIncludes !== void 0) checks.push(candidates.some((candidate) => includesAny(candidate.name, rule.nameIncludes)));
|
|
1353
|
-
if (rule.referencePathIncludes !== void 0) checks.push(referencePath !== void 0 && includesAny(referencePath, rule.referencePathIncludes));
|
|
1354
|
-
return checks.length > 0 && checks.every(Boolean);
|
|
1355
|
-
}
|
|
1356
|
-
function inferPreviewKind(candidates, value) {
|
|
1357
|
-
if (hasType(candidates, ["color"]) || isColorValue(value)) return "color";
|
|
1358
|
-
if (hasType(candidates, ["shadow", "box-shadow"]) || hasSignal(candidates, ["shadow", "box-shadow"])) return "shadow";
|
|
1359
|
-
if (hasType(candidates, [
|
|
1360
|
-
"z-index",
|
|
1361
|
-
"zindex",
|
|
1362
|
-
"zIndex"
|
|
1363
|
-
]) || hasSignal(candidates, [
|
|
1364
|
-
"z-index",
|
|
1365
|
-
"zindex",
|
|
1366
|
-
"stacking-order"
|
|
1367
|
-
])) return "zIndex";
|
|
1368
|
-
if (hasType(candidates, ["opacity"]) || hasSignal(candidates, ["opacity", "alpha"])) return "opacity";
|
|
1369
|
-
if (hasType(candidates, [
|
|
1370
|
-
"border-radius",
|
|
1371
|
-
"borderradius",
|
|
1372
|
-
"radius"
|
|
1373
|
-
]) || hasSignal(candidates, [
|
|
1374
|
-
"border-radius",
|
|
1375
|
-
"borderradius",
|
|
1376
|
-
"radius",
|
|
1377
|
-
"round",
|
|
1378
|
-
"rounded"
|
|
1379
|
-
])) return "radius";
|
|
1380
|
-
if (hasType(candidates, ["letterspacing", "letter-spacing"]) || hasSignal(candidates, [
|
|
1381
|
-
"letter-spacing",
|
|
1382
|
-
"letterspacing",
|
|
1383
|
-
"tracking"
|
|
1384
|
-
])) return "letterSpacing";
|
|
1385
|
-
if (hasType(candidates, ["spacing", "space"]) || hasSignal(candidates, [
|
|
1386
|
-
"spacing",
|
|
1387
|
-
"spasing",
|
|
1388
|
-
"space",
|
|
1389
|
-
"gap",
|
|
1390
|
-
"padding",
|
|
1391
|
-
"margin",
|
|
1392
|
-
"inset"
|
|
1393
|
-
])) return "spacing";
|
|
1394
|
-
if (hasSignal(candidates, [
|
|
1395
|
-
"font-size",
|
|
1396
|
-
"fontsize",
|
|
1397
|
-
"text-size"
|
|
1398
|
-
])) return "fontSize";
|
|
1399
|
-
if (hasType(candidates, ["fontweight", "font-weight"]) || hasSignal(candidates, [
|
|
1400
|
-
"font-weight",
|
|
1401
|
-
"fontweight",
|
|
1402
|
-
"weight"
|
|
1403
|
-
])) return "fontWeight";
|
|
1404
|
-
if (hasType(candidates, ["lineheight", "line-height"]) || hasSignal(candidates, ["line-height", "lineheight"])) return "lineHeight";
|
|
1405
|
-
return "generic";
|
|
1406
|
-
}
|
|
1407
|
-
function hasType(candidates, terms) {
|
|
1408
|
-
return candidates.some((candidate) => typeMatches(candidate, terms));
|
|
1409
|
-
}
|
|
1410
|
-
function hasSignal(candidates, terms) {
|
|
1411
|
-
return candidates.some((candidate) => includesAny(candidate.tokenPath, terms) || includesAny(candidate.name, terms) || candidate.token.type !== void 0 && includesAny(candidate.token.type, terms));
|
|
1412
|
-
}
|
|
1413
|
-
function typeMatches(candidate, expected) {
|
|
1414
|
-
if (!candidate.token.type) return false;
|
|
1415
|
-
return toArray(expected).some((term) => normalize(candidate.token.type) === normalize(term));
|
|
1416
|
-
}
|
|
1417
|
-
function includesAny(value, expected) {
|
|
1418
|
-
const normalizedValue = normalize(value);
|
|
1419
|
-
const compactValue = compact(normalizedValue);
|
|
1420
|
-
return toArray(expected).some((term) => {
|
|
1421
|
-
const normalizedTerm = normalize(term);
|
|
1422
|
-
return normalizedValue.includes(normalizedTerm) || compactValue.includes(compact(normalizedTerm));
|
|
1423
|
-
});
|
|
1424
|
-
}
|
|
1425
|
-
function isColorValue(value) {
|
|
1426
|
-
if (typeof value !== "string") return false;
|
|
1427
|
-
return /^(#|rgb\(|rgba\(|hsl\(|hsla\(|oklch\(|oklab\(|lab\(|lch\(|color\()/i.test(value.trim());
|
|
1428
|
-
}
|
|
1429
|
-
function pathName(tokenPath) {
|
|
1430
|
-
return tokenPath.split(".").at(-1) ?? tokenPath;
|
|
1431
|
-
}
|
|
1432
|
-
function normalize(value) {
|
|
1433
|
-
return value.trim().toLowerCase().replace(/[_\s]+/g, "-");
|
|
1434
|
-
}
|
|
1435
|
-
function compact(value) {
|
|
1436
|
-
return value.replace(/[-.]/g, "");
|
|
1437
|
-
}
|
|
1438
|
-
function toArray(value) {
|
|
1439
|
-
return Array.isArray(value) ? value : [value];
|
|
1440
1110
|
}
|
|
1441
1111
|
//#endregion
|
|
1442
1112
|
//#region src/api-tokens.ts
|
|
@@ -2330,130 +2000,6 @@ function attachArtReportOwner(json, target) {
|
|
|
2330
2000
|
}, null, 2);
|
|
2331
2001
|
}
|
|
2332
2002
|
//#endregion
|
|
2333
|
-
|
|
2334
|
-
function extractArtTagAttributes(source) {
|
|
2335
|
-
const artTagMatch = source.match(/<art\b((?:[^>"']|"[^"]*"|'[^']*')*)>/i);
|
|
2336
|
-
if (!artTagMatch) return {};
|
|
2337
|
-
const attributes = {};
|
|
2338
|
-
for (const match of artTagMatch[1].matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'))?/g)) {
|
|
2339
|
-
const name = match[1];
|
|
2340
|
-
if (!name || name === "/") continue;
|
|
2341
|
-
attributes[name] = match[2] ?? match[3] ?? true;
|
|
2342
|
-
}
|
|
2343
|
-
return attributes;
|
|
2344
|
-
}
|
|
2345
|
-
function parseActionEvents(value) {
|
|
2346
|
-
if (typeof value !== "string") return void 0;
|
|
2347
|
-
const events = value.split(",").map((eventName) => eventName.trim().toLowerCase()).filter(Boolean);
|
|
2348
|
-
return events.length > 0 ? [...new Set(events)] : void 0;
|
|
2349
|
-
}
|
|
2350
|
-
function extractCustomArtMetadata(source) {
|
|
2351
|
-
const attrs = extractArtTagAttributes(source);
|
|
2352
|
-
const actionEvents = new Set(parseActionEvents(attrs["action-events"]) ?? []);
|
|
2353
|
-
const captureMousemove = attrs["capture-mousemove"];
|
|
2354
|
-
if (captureMousemove === true || captureMousemove === "true") actionEvents.add("mousemove");
|
|
2355
|
-
return { actionEvents: actionEvents.size > 0 ? [...actionEvents] : void 0 };
|
|
2356
|
-
}
|
|
2357
|
-
function extractStyleBlocks(source, filePath) {
|
|
2358
|
-
const styles = [];
|
|
2359
|
-
for (const match of source.matchAll(/<style\b((?:[^>"']|"[^"]*"|'[^']*')*)>([\s\S]*?)<\/style>/gi)) {
|
|
2360
|
-
const attrs = match[1] ?? "";
|
|
2361
|
-
const content = match[2]?.trim();
|
|
2362
|
-
const lang = attrs.match(/\blang\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase();
|
|
2363
|
-
if (!content) continue;
|
|
2364
|
-
styles.push({
|
|
2365
|
-
content,
|
|
2366
|
-
lang: lang ?? "css",
|
|
2367
|
-
scoped: /\bscoped\b/i.test(attrs)
|
|
2368
|
-
});
|
|
2369
|
-
}
|
|
2370
|
-
if (!styles.some((style) => style.scoped)) return { blocks: styles };
|
|
2371
|
-
return {
|
|
2372
|
-
scopeAttr: artScopeAttribute(filePath),
|
|
2373
|
-
blocks: styles
|
|
2374
|
-
};
|
|
2375
|
-
}
|
|
2376
|
-
function formatArtProcessingError(root, filePath, error) {
|
|
2377
|
-
const detail = error instanceof Error ? error.message || error.name : error == null ? "unknown error" : stringifyUnknown(error);
|
|
2378
|
-
return `[musea] Failed to process ${path.relative(root, filePath) || filePath}: ${detail}`;
|
|
2379
|
-
}
|
|
2380
|
-
function stringifyUnknown(value) {
|
|
2381
|
-
if (typeof value === "string") return value;
|
|
2382
|
-
if (typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") return value.toString();
|
|
2383
|
-
try {
|
|
2384
|
-
return JSON.stringify(value) ?? "unknown error";
|
|
2385
|
-
} catch {
|
|
2386
|
-
return "unknown error";
|
|
2387
|
-
}
|
|
2388
|
-
}
|
|
2389
|
-
function reportArtStatusWarnings(binding, source, filename, warn = console.warn) {
|
|
2390
|
-
const warnings = binding.parseArtStatusWarnings?.(source, { filename });
|
|
2391
|
-
if (warnings == null) return;
|
|
2392
|
-
for (const warning of warnings) warn(`[musea] ${warning}`);
|
|
2393
|
-
}
|
|
2394
|
-
async function processMuseaArtFile(filePath, ctx) {
|
|
2395
|
-
try {
|
|
2396
|
-
const source = await fs.promises.readFile(filePath, "utf-8");
|
|
2397
|
-
const binding = loadNative();
|
|
2398
|
-
const parsed = binding.parseArt(source, { filename: filePath });
|
|
2399
|
-
reportArtStatusWarnings(binding, source, filePath);
|
|
2400
|
-
const customMetadata = extractCustomArtMetadata(source);
|
|
2401
|
-
if (!parsed.variants || parsed.variants.length === 0) return null;
|
|
2402
|
-
const isInline = !filePath.endsWith(".art.vue");
|
|
2403
|
-
const styles = isInline ? { blocks: [] } : extractStyleBlocks(source, filePath);
|
|
2404
|
-
return {
|
|
2405
|
-
path: filePath,
|
|
2406
|
-
metadata: {
|
|
2407
|
-
title: parsed.metadata.title || (isInline ? path.basename(filePath, ".vue") : ""),
|
|
2408
|
-
description: parsed.metadata.description,
|
|
2409
|
-
component: isInline ? void 0 : parsed.metadata.component,
|
|
2410
|
-
category: parsed.metadata.category,
|
|
2411
|
-
tags: parsed.metadata.tags,
|
|
2412
|
-
status: parsed.metadata.status,
|
|
2413
|
-
order: parsed.metadata.order,
|
|
2414
|
-
actionEvents: customMetadata.actionEvents ?? parsed.metadata.actionEvents
|
|
2415
|
-
},
|
|
2416
|
-
variants: parsed.variants.map((v) => ({
|
|
2417
|
-
name: v.name,
|
|
2418
|
-
template: styles.scopeAttr ? stampScopeAttribute(v.template, styles.scopeAttr) : v.template,
|
|
2419
|
-
isDefault: v.isDefault,
|
|
2420
|
-
skipVrt: v.skipVrt
|
|
2421
|
-
})),
|
|
2422
|
-
hasScriptSetup: isInline ? false : parsed.hasScriptSetup,
|
|
2423
|
-
scriptSetupContent: !isInline && parsed.hasScriptSetup ? extractScriptSetupContent(source) : void 0,
|
|
2424
|
-
scriptSetupIsolated: !isInline && parsed.hasScriptSetup ? extractScriptSetupIsolated(source) : true,
|
|
2425
|
-
hasScript: parsed.hasScript,
|
|
2426
|
-
styleCount: parsed.styleCount,
|
|
2427
|
-
styleBlocks: styles.blocks.map((style) => style.content),
|
|
2428
|
-
styleBlockDetails: styles.blocks,
|
|
2429
|
-
isInline,
|
|
2430
|
-
componentPath: isInline ? filePath : void 0,
|
|
2431
|
-
inlineArtBlockIndex: isInline ? binding.parseSfc(source, { filename: filePath }).customBlocks.findIndex((block) => block.type === "art") : void 0
|
|
2432
|
-
};
|
|
2433
|
-
} catch (error) {
|
|
2434
|
-
const message = formatArtProcessingError(ctx.root, filePath, error);
|
|
2435
|
-
if (ctx.command === "build") throw new Error(message);
|
|
2436
|
-
(ctx.onError ?? console.error)(message);
|
|
2437
|
-
return null;
|
|
2438
|
-
}
|
|
2439
|
-
}
|
|
2440
|
-
//#endregion
|
|
2441
|
-
//#region src/plugin/options.ts
|
|
2442
|
-
const MUSEA_OPTIONS_KEY = "__vizeMuseaOptions";
|
|
2443
|
-
function attachMuseaOptions(plugin, options) {
|
|
2444
|
-
Object.defineProperty(plugin, MUSEA_OPTIONS_KEY, {
|
|
2445
|
-
configurable: false,
|
|
2446
|
-
enumerable: false,
|
|
2447
|
-
value: options,
|
|
2448
|
-
writable: false
|
|
2449
|
-
});
|
|
2450
|
-
return plugin;
|
|
2451
|
-
}
|
|
2452
|
-
function readMuseaOptions(plugin) {
|
|
2453
|
-
if (!plugin || typeof plugin !== "object") return void 0;
|
|
2454
|
-
return plugin[MUSEA_OPTIONS_KEY];
|
|
2455
|
-
}
|
|
2456
|
-
//#endregion
|
|
2457
|
-
export { buildTokenMap as A, expandSelfTag as B, handleTokensGet as C, generateTokensHtml as D, resolveTokenPreview as E, parseScriptSetupForArt as F, variantComponentNames as H, rewriteRelativeImportStatement as I, loadArtStyle as L, scanTokenUsage as M, parseTokens as N, generateTokensMarkdown as O, generateArtModule as P, parseArtStyleRequest as R, handleTokensDelete as S, handleTokensUsage as T, resolveArtComponent as V, handleArtAnalysis as _, attachArtReportOwner as a, handleArtPalette as b, rewriteDevGalleryAsset as c, createStaticGalleryPayload as d, joinUrlPath as f, sortedArts as g, staticPreviewId as h, assertArtReportOwnership as i, resolveReferences as j, processStyleDictionary as k, rewriteGalleryBase as l, resolveStaticIdentityRoot as m, readMuseaOptions as n, resolveArtReportTarget as o, resolveStaticArtIdentity as p, processMuseaArtFile as r, publicBasePathFromViteBase as s, attachMuseaOptions as t, rewriteGalleryTextAssetBase as u, handleArtDocs as v, handleTokensUpdate as w, handleTokensCreate as x, handleArtSource as y, transformPreprocessedArtStyle as z };
|
|
2003
|
+
export { HttpError as $, expandSelfTag as A, DEFAULT_API_BODY_LIMIT_BYTES as B, processMuseaArtFile as C, loadArtStyle as D, rewriteRelativeImportStatement as E, matchGlob as F, validateDevApiRequest as G, createDevSessionToken as H, resolveScanRoots as I, decodeUrlComponent as J, assertArtVueSourcePath as K, scanArtFiles as L, variantComponentNames as M, escapeHtml as N, parseArtStyleRequest as O, generateStorybookFiles as P, resolveUrlPathInside as Q, shouldProcess as R, handleTokensUsage as S, parseScriptSetupForArt as T, parseJsonBody as U, collectRequestBody as V, serializeScriptValue as W, resolveInside as X, isTrustedSourcePath as Y, resolveTrustedSourcePath as Z, handleArtPalette as _, rewriteDevGalleryAsset as a, handleTokensGet as b, createStaticGalleryPayload as c, resolveStaticIdentityRoot as d, staticPreviewId as f, handleArtSource as g, handleArtDocs as h, publicBasePathFromViteBase as i, resolveArtComponent as j, transformPreprocessedArtStyle as k, joinUrlPath as l, handleArtAnalysis as m, attachArtReportOwner as n, rewriteGalleryBase as o, sortedArts as p, assertVueSourcePath as q, resolveArtReportTarget as r, rewriteGalleryTextAssetBase as s, assertArtReportOwnership as t, resolveStaticArtIdentity as u, handleTokensCreate as v, generateArtModule as w, handleTokensUpdate as x, handleTokensDelete as y, buildThemeConfig as z };
|
|
2458
2004
|
|
|
2459
|
-
//# sourceMappingURL=
|
|
2005
|
+
//# sourceMappingURL=report-identity-dHHBq0Ne.mjs.map
|