@fragments-sdk/cli 0.15.0 → 0.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/dist/{ai-client-I6MDWNYA.js → ai-client-LSLQGOMM.js} +1 -2
  2. package/dist/bin.js +463 -71
  3. package/dist/bin.js.map +1 -1
  4. package/dist/chunk-5JF26E55.js +1255 -0
  5. package/dist/chunk-5JF26E55.js.map +1 -0
  6. package/dist/{chunk-XJQ5BIWI.js → chunk-6SQPP47U.js} +30 -314
  7. package/dist/chunk-6SQPP47U.js.map +1 -0
  8. package/dist/{chunk-65WSVDV5.js → chunk-HQ6A6DTV.js} +1386 -1097
  9. package/dist/chunk-HQ6A6DTV.js.map +1 -0
  10. package/dist/chunk-MHIBEEW4.js +511 -0
  11. package/dist/chunk-MHIBEEW4.js.map +1 -0
  12. package/dist/{chunk-CZD3AD4Q.js → chunk-ONUP6Z4W.js} +17 -6
  13. package/dist/chunk-ONUP6Z4W.js.map +1 -0
  14. package/dist/{codebase-scanner-VOTPXRYW.js → codebase-scanner-MQHUZC2G.js} +1 -2
  15. package/dist/{converter-JLINP7CJ.js → converter-7XM3Y6NJ.js} +1 -2
  16. package/dist/{converter-JLINP7CJ.js.map → converter-7XM3Y6NJ.js.map} +1 -1
  17. package/dist/core/index.js +0 -1
  18. package/dist/create-IH4R45GE.js +806 -0
  19. package/dist/create-IH4R45GE.js.map +1 -0
  20. package/dist/{generate-A4FP5426.js → generate-PVOLUAAC.js} +3 -4
  21. package/dist/{generate-A4FP5426.js.map → generate-PVOLUAAC.js.map} +1 -1
  22. package/dist/{govern-scan-UCBZR6D6.js → govern-scan-OYFZYOQW.js} +142 -9
  23. package/dist/govern-scan-OYFZYOQW.js.map +1 -0
  24. package/dist/index.d.ts +2 -22
  25. package/dist/index.js +8 -7
  26. package/dist/index.js.map +1 -1
  27. package/dist/{init-HGSM35XA.js → init-SSGUSP7Z.js} +3 -4
  28. package/dist/{init-HGSM35XA.js.map → init-SSGUSP7Z.js.map} +1 -1
  29. package/dist/{init-cloud-MQ6GRJAZ.js → init-cloud-3DNKPWFB.js} +29 -4
  30. package/dist/{init-cloud-MQ6GRJAZ.js.map → init-cloud-3DNKPWFB.js.map} +1 -1
  31. package/dist/mcp-bin.js +1 -2
  32. package/dist/mcp-bin.js.map +1 -1
  33. package/dist/node-37AUE74M.js +65 -0
  34. package/dist/push-contracts-WY32TFP6.js +84 -0
  35. package/dist/push-contracts-WY32TFP6.js.map +1 -0
  36. package/dist/{scan-VNNKACG2.js → scan-PKSYSTRR.js} +5 -5
  37. package/dist/{scan-generate-TWRHNU5M.js → scan-generate-VY27PIOX.js} +8 -9
  38. package/dist/scan-generate-VY27PIOX.js.map +1 -0
  39. package/dist/{scanner-7LAZYPWZ.js → scanner-4KZNOXAK.js} +1 -2
  40. package/dist/{service-FHQU7YS7.js → service-QJGWUIVL.js} +16 -9
  41. package/dist/{snapshot-KQEQ6XHL.js → snapshot-WIJMEIFT.js} +1 -2
  42. package/dist/{snapshot-KQEQ6XHL.js.map → snapshot-WIJMEIFT.js.map} +1 -1
  43. package/dist/{static-viewer-63PG6FWY.js → static-viewer-7QIBQZRC.js} +1 -2
  44. package/dist/{test-UQYUCZIS.js → test-64Z5BKBA.js} +2 -3
  45. package/dist/{test-UQYUCZIS.js.map → test-64Z5BKBA.js.map} +1 -1
  46. package/dist/token-normalizer-TEPOVBPV.js +312 -0
  47. package/dist/token-normalizer-TEPOVBPV.js.map +1 -0
  48. package/dist/token-parser-32KOIOFN.js +22 -0
  49. package/dist/token-parser-32KOIOFN.js.map +1 -0
  50. package/dist/{tokens-6GYKDV6U.js → tokens-NZWFQIAB.js} +7 -7
  51. package/dist/{tokens-generate-VTZV5EEW.js → tokens-generate-5JQSJ27E.js} +1 -2
  52. package/dist/{tokens-generate-VTZV5EEW.js.map → tokens-generate-5JQSJ27E.js.map} +1 -1
  53. package/dist/tokens-push-HY3KO36V.js +148 -0
  54. package/dist/tokens-push-HY3KO36V.js.map +1 -0
  55. package/package.json +5 -3
  56. package/src/bin.ts +90 -0
  57. package/src/commands/__fixtures__/shadcn-label-wrapper/src/components/ui/label.contract.json +1 -1
  58. package/src/commands/__fixtures__/shadcn-label-wrapper/src/components/ui/primitive.contract.json +1 -1
  59. package/src/commands/__tests__/build-freshness.test.ts +231 -0
  60. package/src/commands/__tests__/create.test.ts +71 -0
  61. package/src/commands/__tests__/drift-sync.test.ts +1 -1
  62. package/src/commands/__tests__/govern.test.ts +258 -0
  63. package/src/commands/__tests__/init.test.ts +1 -1
  64. package/src/commands/__tests__/scan-generate.test.ts +1 -1
  65. package/src/commands/build.ts +54 -1
  66. package/src/commands/context.ts +1 -1
  67. package/src/commands/create.ts +536 -0
  68. package/src/commands/doctor.ts +3 -2
  69. package/src/commands/govern-scan.ts +187 -8
  70. package/src/commands/govern.ts +65 -2
  71. package/src/commands/init-cloud.ts +32 -4
  72. package/src/commands/push-contracts.ts +112 -0
  73. package/src/commands/scan-generate.ts +1 -1
  74. package/src/commands/scan.ts +13 -0
  75. package/src/commands/sync.ts +2 -2
  76. package/src/commands/tokens-push.ts +199 -0
  77. package/src/core/__tests__/token-resolver.test.ts +1 -1
  78. package/src/core/component-extractor.test.ts +1 -1
  79. package/src/core/drift-verifier.ts +1 -1
  80. package/src/core/extractor-adapter.ts +1 -1
  81. package/src/index.ts +3 -3
  82. package/src/migrate/fragment-to-contract.ts +2 -2
  83. package/src/service/index.ts +8 -0
  84. package/src/service/tailwind-v4-parser.ts +314 -0
  85. package/src/service/token-parser.ts +56 -0
  86. package/src/setup.ts +10 -39
  87. package/src/theme/__tests__/component-contrast.test.ts +2 -2
  88. package/src/theme/__tests__/serializer.test.ts +1 -1
  89. package/src/theme/generator.ts +16 -1
  90. package/src/theme/schema.ts +8 -0
  91. package/src/theme/serializer.ts +13 -9
  92. package/src/theme/types.ts +8 -0
  93. package/src/validators.ts +1 -2
  94. package/dist/chunk-65WSVDV5.js.map +0 -1
  95. package/dist/chunk-7WHVW72L.js +0 -2664
  96. package/dist/chunk-7WHVW72L.js.map +0 -1
  97. package/dist/chunk-CZD3AD4Q.js.map +0 -1
  98. package/dist/chunk-MN3TJ3D5.js +0 -695
  99. package/dist/chunk-MN3TJ3D5.js.map +0 -1
  100. package/dist/chunk-XJQ5BIWI.js.map +0 -1
  101. package/dist/chunk-Z7EY4VHE.js +0 -50
  102. package/dist/govern-scan-UCBZR6D6.js.map +0 -1
  103. package/dist/sass.node-4XJK6YBF.js +0 -130708
  104. package/dist/sass.node-4XJK6YBF.js.map +0 -1
  105. package/dist/scan-generate-TWRHNU5M.js.map +0 -1
  106. package/src/build.ts +0 -736
  107. package/src/core/auto-props.ts +0 -464
  108. package/src/core/component-extractor.ts +0 -1121
  109. package/src/core/token-resolver.ts +0 -155
  110. package/src/viewer/preview-adapter.ts +0 -116
  111. /package/dist/{ai-client-I6MDWNYA.js.map → ai-client-LSLQGOMM.js.map} +0 -0
  112. /package/dist/{chunk-Z7EY4VHE.js.map → codebase-scanner-MQHUZC2G.js.map} +0 -0
  113. /package/dist/{codebase-scanner-VOTPXRYW.js.map → node-37AUE74M.js.map} +0 -0
  114. /package/dist/{scan-VNNKACG2.js.map → scan-PKSYSTRR.js.map} +0 -0
  115. /package/dist/{scanner-7LAZYPWZ.js.map → scanner-4KZNOXAK.js.map} +0 -0
  116. /package/dist/{service-FHQU7YS7.js.map → service-QJGWUIVL.js.map} +0 -0
  117. /package/dist/{static-viewer-63PG6FWY.js.map → static-viewer-7QIBQZRC.js.map} +0 -0
  118. /package/dist/{tokens-6GYKDV6U.js.map → tokens-NZWFQIAB.js.map} +0 -0
@@ -3,6 +3,11 @@ import {
3
3
  BRAND,
4
4
  DEFAULTS
5
5
  } from "./chunk-32LIWN2P.js";
6
+ import {
7
+ hexToRgb,
8
+ parseRgb,
9
+ parseTokenFiles
10
+ } from "./chunk-MHIBEEW4.js";
6
11
  import {
7
12
  BABEL_PARSER_OPTIONS
8
13
  } from "./chunk-7DZC4YEV.js";
@@ -75,8 +80,8 @@ var BrowserPool = class {
75
80
  }
76
81
  await this.clearContext(context);
77
82
  if (this.waitingQueue.length > 0) {
78
- const resolve4 = this.waitingQueue.shift();
79
- resolve4(context);
83
+ const resolve3 = this.waitingQueue.shift();
84
+ resolve3(context);
80
85
  return;
81
86
  }
82
87
  this.available.push(context);
@@ -103,7 +108,7 @@ var BrowserPool = class {
103
108
  clearTimeout(this.idleTimeout);
104
109
  this.idleTimeout = null;
105
110
  }
106
- for (const resolve4 of this.waitingQueue) {
111
+ for (const resolve3 of this.waitingQueue) {
107
112
  }
108
113
  this.waitingQueue = [];
109
114
  for (const context of this.contexts) {
@@ -190,9 +195,9 @@ var BrowserPool = class {
190
195
  * Wait for an available context.
191
196
  */
192
197
  waitForAvailable() {
193
- return new Promise((resolve4, reject) => {
198
+ return new Promise((resolve3, reject) => {
194
199
  const timeout = setTimeout(() => {
195
- const index = this.waitingQueue.indexOf(resolve4);
200
+ const index = this.waitingQueue.indexOf(resolve3);
196
201
  if (index > -1) {
197
202
  this.waitingQueue.splice(index, 1);
198
203
  }
@@ -205,7 +210,7 @@ var BrowserPool = class {
205
210
  }, 3e4);
206
211
  const wrappedResolve = (ctx) => {
207
212
  clearTimeout(timeout);
208
- resolve4(ctx);
213
+ resolve3(ctx);
209
214
  };
210
215
  this.waitingQueue.push(wrappedResolve);
211
216
  });
@@ -288,16 +293,16 @@ var Timer = class {
288
293
  }
289
294
  };
290
295
  function createDeferred() {
291
- let resolve4;
296
+ let resolve3;
292
297
  let reject;
293
298
  const promise = new Promise((res, rej) => {
294
- resolve4 = res;
299
+ resolve3 = res;
295
300
  reject = rej;
296
301
  });
297
- return { promise, resolve: resolve4, reject };
302
+ return { promise, resolve: resolve3, reject };
298
303
  }
299
304
  function sleep(ms) {
300
- return new Promise((resolve4) => setTimeout(resolve4, ms));
305
+ return new Promise((resolve3) => setTimeout(resolve3, ms));
301
306
  }
302
307
  function bufferToBase64Url(buffer, mimeType = "image/png") {
303
308
  return `data:${mimeType};base64,${buffer.toString("base64")}`;
@@ -453,7 +458,7 @@ var CaptureEngine = class {
453
458
  await page.evaluate(async (timeoutMs) => {
454
459
  await Promise.race([
455
460
  document.fonts.ready,
456
- new Promise((resolve4) => setTimeout(resolve4, timeoutMs))
461
+ new Promise((resolve3) => setTimeout(resolve3, timeoutMs))
457
462
  ]);
458
463
  }, timeout);
459
464
  } catch {
@@ -2551,289 +2556,6 @@ function getScripts() {
2551
2556
  `;
2552
2557
  }
2553
2558
 
2554
- // src/service/token-parser.ts
2555
- import { readFile as readFile2 } from "fs/promises";
2556
- import { relative } from "path";
2557
- import fastGlob from "fast-glob";
2558
- var TOKEN_DECLARATION_PATTERN = /--([a-zA-Z0-9_-]+)\s*:\s*([^;]+);/g;
2559
- var CATEGORY_PATTERNS = [
2560
- { pattern: /color|bg|background|border-color|fill|stroke/i, category: "color" },
2561
- { pattern: /spacing|margin|padding|gap|space|inset/i, category: "spacing" },
2562
- { pattern: /font|text|line-height|letter-spacing|typography/i, category: "typography" },
2563
- { pattern: /radius|rounded|corner/i, category: "radius" },
2564
- { pattern: /shadow|elevation/i, category: "shadow" },
2565
- { pattern: /size|width|height|min|max/i, category: "sizing" },
2566
- { pattern: /border(?!-color)|stroke-width|outline/i, category: "border" },
2567
- { pattern: /animation|transition|duration|timing|delay/i, category: "animation" },
2568
- { pattern: /z-index|layer|stack/i, category: "z-index" }
2569
- ];
2570
- async function parseTokenFile(filePath, themeSelectors = { ":root": "default" }, projectRoot) {
2571
- const startTime = performance.now();
2572
- const tokens = [];
2573
- const errors = [];
2574
- const warnings = [];
2575
- try {
2576
- const content = await readFile2(filePath, "utf-8");
2577
- const relativePath = projectRoot ? relative(projectRoot, filePath) : filePath;
2578
- const tokensByName = /* @__PURE__ */ new Map();
2579
- let lineNumber = 1;
2580
- const lines = content.split("\n");
2581
- let currentSelector = ":root";
2582
- let braceDepth = 0;
2583
- const selectorStack = [];
2584
- for (let i = 0; i < lines.length; i++) {
2585
- const line = lines[i];
2586
- lineNumber = i + 1;
2587
- const openBraces = (line.match(/\{/g) || []).length;
2588
- const closeBraces = (line.match(/\}/g) || []).length;
2589
- if (openBraces > closeBraces) {
2590
- const selectorMatch = line.match(/^\s*([^{]+)\s*\{/);
2591
- if (selectorMatch) {
2592
- selectorStack.push(selectorMatch[1].trim());
2593
- currentSelector = selectorStack[selectorStack.length - 1];
2594
- }
2595
- braceDepth += openBraces - closeBraces;
2596
- } else if (closeBraces > openBraces) {
2597
- braceDepth -= closeBraces - openBraces;
2598
- if (braceDepth >= 0 && selectorStack.length > 0) {
2599
- selectorStack.pop();
2600
- currentSelector = selectorStack.length > 0 ? selectorStack[selectorStack.length - 1] : ":root";
2601
- }
2602
- }
2603
- const tokenMatches = [...line.matchAll(TOKEN_DECLARATION_PATTERN)];
2604
- for (const match of tokenMatches) {
2605
- const [, name, rawValue] = match;
2606
- const fullName = `--${name}`;
2607
- tokensByName.set(fullName, { rawValue: rawValue.trim(), line: lineNumber });
2608
- }
2609
- }
2610
- for (const [name, { rawValue, line }] of tokensByName) {
2611
- const selector = findSelectorForLine(content, line || 1);
2612
- const theme = themeSelectors[selector] || "default";
2613
- const { resolvedValue, chain, hasCircular, unresolvedRef } = resolveValue(
2614
- rawValue,
2615
- tokensByName
2616
- );
2617
- if (hasCircular) {
2618
- warnings.push(
2619
- `Circular reference detected for ${name} at line ${line}`
2620
- );
2621
- }
2622
- if (unresolvedRef) {
2623
- warnings.push(
2624
- `Unresolved reference in ${name}: ${unresolvedRef}`
2625
- );
2626
- }
2627
- const category = inferCategory(name);
2628
- const level = inferLevel(name, rawValue, chain);
2629
- const description = extractDescription(content, line || 1);
2630
- tokens.push({
2631
- name,
2632
- rawValue,
2633
- resolvedValue,
2634
- category,
2635
- level,
2636
- referenceChain: chain,
2637
- sourceFile: relativePath,
2638
- lineNumber: line,
2639
- theme,
2640
- selector,
2641
- description
2642
- });
2643
- }
2644
- } catch (error) {
2645
- errors.push({
2646
- message: error instanceof Error ? error.message : "Unknown error",
2647
- file: filePath
2648
- });
2649
- }
2650
- return {
2651
- tokens,
2652
- errors,
2653
- warnings,
2654
- parseTimeMs: performance.now() - startTime
2655
- };
2656
- }
2657
- async function parseTokenFiles(config, projectRoot) {
2658
- const startTime = performance.now();
2659
- const allTokens = [];
2660
- const allErrors = [];
2661
- const allWarnings = [];
2662
- const files = await fastGlob(config.include, {
2663
- cwd: projectRoot,
2664
- ignore: config.exclude || ["**/node_modules/**"],
2665
- absolute: true
2666
- });
2667
- if (files.length === 0) {
2668
- allWarnings.push(
2669
- `No token files found matching: ${config.include.join(", ")}`
2670
- );
2671
- }
2672
- for (const file of files) {
2673
- const result = await parseTokenFile(
2674
- file,
2675
- config.themeSelectors,
2676
- projectRoot
2677
- );
2678
- allTokens.push(...result.tokens);
2679
- allErrors.push(...result.errors);
2680
- allWarnings.push(...result.warnings);
2681
- }
2682
- return {
2683
- tokens: allTokens,
2684
- errors: allErrors,
2685
- warnings: allWarnings,
2686
- parseTimeMs: performance.now() - startTime
2687
- };
2688
- }
2689
- function resolveValue(rawValue, tokensByName, visited = /* @__PURE__ */ new Set()) {
2690
- const chain = [];
2691
- let current = rawValue;
2692
- let hasCircular = false;
2693
- let unresolvedRef;
2694
- const maxIterations = 20;
2695
- let iterations = 0;
2696
- while (iterations < maxIterations) {
2697
- iterations++;
2698
- const varMatch = current.match(/var\(\s*--([a-zA-Z0-9_-]+)(?:\s*,\s*([^)]+))?\s*\)/);
2699
- if (!varMatch) {
2700
- break;
2701
- }
2702
- const [, refName, fallback] = varMatch;
2703
- const fullRefName = `--${refName}`;
2704
- if (visited.has(fullRefName)) {
2705
- hasCircular = true;
2706
- break;
2707
- }
2708
- visited.add(fullRefName);
2709
- chain.push(fullRefName);
2710
- const refToken = tokensByName.get(fullRefName);
2711
- if (refToken) {
2712
- current = current.replace(
2713
- varMatch[0],
2714
- refToken.rawValue
2715
- );
2716
- } else if (fallback) {
2717
- current = current.replace(varMatch[0], fallback.trim());
2718
- } else {
2719
- unresolvedRef = fullRefName;
2720
- break;
2721
- }
2722
- }
2723
- return {
2724
- resolvedValue: normalizeValue(current.trim()),
2725
- chain,
2726
- hasCircular,
2727
- unresolvedRef
2728
- };
2729
- }
2730
- function normalizeValue(value) {
2731
- value = value.replace(/#[0-9a-fA-F]+/g, (match) => match.toLowerCase());
2732
- value = value.replace(/\s+/g, " ").trim();
2733
- value = value.replace(
2734
- /rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\s*\)/g,
2735
- (_, r, g, b, a) => a !== void 0 ? `rgba(${r}, ${g}, ${b}, ${a})` : `rgb(${r}, ${g}, ${b})`
2736
- );
2737
- return value;
2738
- }
2739
- function inferCategory(name) {
2740
- const lowerName = name.toLowerCase();
2741
- for (const { pattern, category } of CATEGORY_PATTERNS) {
2742
- if (pattern.test(lowerName)) {
2743
- return category;
2744
- }
2745
- }
2746
- return "other";
2747
- }
2748
- function inferLevel(name, rawValue, referenceChain) {
2749
- const lowerName = name.toLowerCase();
2750
- if (/btn|button|input|card|modal|dialog|menu|nav|header|footer|table|form/i.test(
2751
- lowerName
2752
- )) {
2753
- return 3;
2754
- }
2755
- if (referenceChain.length > 0) {
2756
- return 2;
2757
- }
2758
- if (rawValue.match(/^#[0-9a-fA-F]+$/) || rawValue.match(/^\d+(\.\d+)?(px|rem|em|%|vh|vw)?$/)) {
2759
- return 1;
2760
- }
2761
- return 2;
2762
- }
2763
- function findSelectorForLine(content, targetLine) {
2764
- const lines = content.split("\n");
2765
- let currentSelector = ":root";
2766
- let braceDepth = 0;
2767
- for (let i = 0; i < Math.min(targetLine, lines.length); i++) {
2768
- const line = lines[i];
2769
- const selectorMatch = line.match(/^\s*([^{]+)\s*\{/);
2770
- if (selectorMatch) {
2771
- const selector = selectorMatch[1].trim();
2772
- if ((line.match(/\{/g) || []).length > (line.match(/\}/g) || []).length) {
2773
- currentSelector = selector;
2774
- }
2775
- }
2776
- braceDepth += (line.match(/\{/g) || []).length;
2777
- braceDepth -= (line.match(/\}/g) || []).length;
2778
- if (braceDepth === 0) {
2779
- currentSelector = ":root";
2780
- }
2781
- }
2782
- return currentSelector;
2783
- }
2784
- function extractDescription(content, line) {
2785
- const lines = content.split("\n");
2786
- if (line <= 1) return void 0;
2787
- const prevLine = lines[line - 2]?.trim();
2788
- const singleLineMatch = prevLine?.match(/\/\/\s*(.+)$/);
2789
- if (singleLineMatch) {
2790
- return singleLineMatch[1].trim();
2791
- }
2792
- const multiLineMatch = prevLine?.match(/\*\s*(.+)\s*\*\//);
2793
- if (multiLineMatch) {
2794
- return multiLineMatch[1].trim();
2795
- }
2796
- const inlineMatch = prevLine?.match(/\/\*\s*(.+)\s*\*\//);
2797
- if (inlineMatch) {
2798
- return inlineMatch[1].trim();
2799
- }
2800
- return void 0;
2801
- }
2802
- function hexToRgb(hex) {
2803
- const match = hex.match(/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i);
2804
- if (!match) return null;
2805
- return {
2806
- r: parseInt(match[1], 16),
2807
- g: parseInt(match[2], 16),
2808
- b: parseInt(match[3], 16)
2809
- };
2810
- }
2811
- function rgbToHex(r, g, b) {
2812
- return `#${[r, g, b].map((x) => Math.round(x).toString(16).padStart(2, "0")).join("")}`;
2813
- }
2814
- function parseRgb(color) {
2815
- const match = color.match(
2816
- /rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\s*\)/
2817
- );
2818
- if (!match) return null;
2819
- return {
2820
- r: parseInt(match[1], 10),
2821
- g: parseInt(match[2], 10),
2822
- b: parseInt(match[3], 10),
2823
- a: match[4] ? parseFloat(match[4]) : void 0
2824
- };
2825
- }
2826
- function normalizeColor(color) {
2827
- if (color.startsWith("#")) {
2828
- return color.toLowerCase();
2829
- }
2830
- const rgb = parseRgb(color);
2831
- if (rgb) {
2832
- return rgbToHex(rgb.r, rgb.g, rgb.b);
2833
- }
2834
- return color.toLowerCase();
2835
- }
2836
-
2837
2559
  // src/service/token-registry.ts
2838
2560
  var TokenRegistryManager = class {
2839
2561
  registry = null;
@@ -3854,7 +3576,7 @@ function applyPatches(sourceCode, patches) {
3854
3576
  }
3855
3577
 
3856
3578
  // src/service/metrics-store.ts
3857
- import { readFile as readFile3, writeFile as writeFile2, mkdir as mkdir2, readdir as readdir2 } from "fs/promises";
3579
+ import { readFile as readFile2, writeFile as writeFile2, mkdir as mkdir2, readdir as readdir2 } from "fs/promises";
3858
3580
  import { join as join2 } from "path";
3859
3581
  var MetricsStore = class {
3860
3582
  projectRoot;
@@ -3874,7 +3596,7 @@ var MetricsStore = class {
3874
3596
  const filepath = join2(this.metricsDir, filename);
3875
3597
  let snapshots = [];
3876
3598
  try {
3877
- const existing = await readFile3(filepath, "utf-8");
3599
+ const existing = await readFile2(filepath, "utf-8");
3878
3600
  snapshots = JSON.parse(existing);
3879
3601
  } catch {
3880
3602
  }
@@ -3901,7 +3623,7 @@ var MetricsStore = class {
3901
3623
  continue;
3902
3624
  }
3903
3625
  try {
3904
- const content = await readFile3(join2(this.metricsDir, file), "utf-8");
3626
+ const content = await readFile2(join2(this.metricsDir, file), "utf-8");
3905
3627
  const fileSnapshots = JSON.parse(content);
3906
3628
  const matching = component === "all" ? fileSnapshots : fileSnapshots.filter((s) => s.component === component);
3907
3629
  snapshots.push(...matching);
@@ -4032,12 +3754,12 @@ function createMetricsStore(projectRoot) {
4032
3754
  import { parse as parse2 } from "@babel/parser";
4033
3755
  import _traverse from "@babel/traverse";
4034
3756
  import * as t2 from "@babel/types";
4035
- import { readFile as readFile4 } from "fs/promises";
3757
+ import { readFile as readFile3 } from "fs/promises";
4036
3758
  import { existsSync as existsSync2 } from "fs";
4037
3759
  import { basename, dirname as dirname3, join as join3 } from "path";
4038
3760
  var traverse2 = _traverse.default || _traverse;
4039
3761
  async function extractComponentDocs(filePath) {
4040
- const content = await readFile4(filePath, "utf-8");
3762
+ const content = await readFile3(filePath, "utf-8");
4041
3763
  return extractDocsFromSource(content, filePath);
4042
3764
  }
4043
3765
  function extractDocsFromSource(source, filePath) {
@@ -4379,12 +4101,12 @@ async function extractAllComponentDocs(componentFiles) {
4379
4101
  import { parse as parse3 } from "@babel/parser";
4380
4102
  import _traverse2 from "@babel/traverse";
4381
4103
  import * as t3 from "@babel/types";
4382
- import { readFile as readFile5 } from "fs/promises";
4104
+ import { readFile as readFile4 } from "fs/promises";
4383
4105
  import fg from "fast-glob";
4384
- import { basename as basename2, relative as relative2 } from "path";
4106
+ import { basename as basename2, relative } from "path";
4385
4107
  var traverse3 = _traverse2.default || _traverse2;
4386
4108
  async function parseStoryFile(filePath) {
4387
- const content = await readFile5(filePath, "utf-8");
4109
+ const content = await readFile4(filePath, "utf-8");
4388
4110
  return parseStorySource(content, filePath);
4389
4111
  }
4390
4112
  function parseStorySource(source, filePath) {
@@ -4681,7 +4403,7 @@ async function parseAllStories(rootDir) {
4681
4403
  results.set(parsed.meta.componentName, parsed);
4682
4404
  } catch (error) {
4683
4405
  console.warn(
4684
- `Failed to parse story file ${relative2(rootDir, filePath)}:`,
4406
+ `Failed to parse story file ${relative(rootDir, filePath)}:`,
4685
4407
  error.message
4686
4408
  );
4687
4409
  }
@@ -5019,11 +4741,11 @@ If there isn't enough usage data to make confident recommendations, indicate tha
5019
4741
 
5020
4742
  // src/service/enhance/props-extractor.ts
5021
4743
  import * as ts from "typescript";
5022
- import { readFile as readFile6 } from "fs/promises";
4744
+ import { readFile as readFile5 } from "fs/promises";
5023
4745
  import { existsSync as existsSync3 } from "fs";
5024
- import { basename as basename3, dirname as dirname5, join as join5, resolve as resolve3 } from "path";
4746
+ import { basename as basename3, dirname as dirname5, join as join5, resolve as resolve2 } from "path";
5025
4747
  async function extractPropsFromFile(filePath, options = {}) {
5026
- const absPath = resolve3(filePath);
4748
+ const absPath = resolve2(filePath);
5027
4749
  if (!existsSync3(absPath)) {
5028
4750
  return {
5029
4751
  filePath: absPath,
@@ -5033,7 +4755,7 @@ async function extractPropsFromFile(filePath, options = {}) {
5033
4755
  warnings: [`File not found: ${absPath}`]
5034
4756
  };
5035
4757
  }
5036
- const content = await readFile6(absPath, "utf-8");
4758
+ const content = await readFile5(absPath, "utf-8");
5037
4759
  return extractPropsFromSource(content, absPath, options);
5038
4760
  }
5039
4761
  function extractPropsFromSource(source, filePath, options = {}) {
@@ -5823,12 +5545,6 @@ export {
5823
5545
  getGrade,
5824
5546
  getScoreColor,
5825
5547
  generateHtmlReport,
5826
- parseTokenFile,
5827
- parseTokenFiles,
5828
- hexToRgb,
5829
- rgbToHex,
5830
- parseRgb,
5831
- normalizeColor,
5832
5548
  TokenRegistryManager,
5833
5549
  getSharedTokenRegistry,
5834
5550
  initializeSharedRegistry,
@@ -5871,4 +5587,4 @@ export {
5871
5587
  getStorybookStoryIds,
5872
5588
  renderAllComponentVariants
5873
5589
  };
5874
- //# sourceMappingURL=chunk-XJQ5BIWI.js.map
5590
+ //# sourceMappingURL=chunk-6SQPP47U.js.map