@fragments-sdk/cli 0.4.0 → 0.4.2

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 (56) hide show
  1. package/dist/bin.js +11 -11
  2. package/dist/{chunk-OZQ7Z6C3.js → chunk-5CKYLCJH.js} +28 -1
  3. package/dist/{chunk-OZQ7Z6C3.js.map → chunk-5CKYLCJH.js.map} +1 -1
  4. package/dist/{chunk-5JNME72P.js → chunk-5ZYEOHYK.js} +11 -9
  5. package/dist/chunk-5ZYEOHYK.js.map +1 -0
  6. package/dist/{chunk-FYIYMXGA.js → chunk-G3M3MPQ6.js} +13 -2
  7. package/dist/chunk-G3M3MPQ6.js.map +1 -0
  8. package/dist/{chunk-LDKNZ55O.js → chunk-J4SI5RIH.js} +3 -3
  9. package/dist/{chunk-ODXQAQQX.js → chunk-ZFKGX3QK.js} +4 -4
  10. package/dist/{core-F3VT277E.js → core-LNXDLXDP.js} +2 -2
  11. package/dist/{generate-PNIUR75D.js → generate-OIXXHOWR.js} +3 -3
  12. package/dist/index.js +4 -4
  13. package/dist/{init-ON6WYG66.js → init-EVPXIDW4.js} +3 -3
  14. package/dist/mcp-bin.js +44 -43
  15. package/dist/mcp-bin.js.map +1 -1
  16. package/dist/scan-YVYD64GD.js +12 -0
  17. package/dist/{service-U7AR2PC2.js → service-K52ORLCJ.js} +3 -3
  18. package/dist/{static-viewer-QL2SCWYB.js → static-viewer-JNQIHA4B.js} +2 -2
  19. package/dist/{test-PBPKJ4WJ.js → test-USARUEFW.js} +8 -4
  20. package/dist/test-USARUEFW.js.map +1 -0
  21. package/dist/{tokens-4J4PRIGT.js → tokens-C6YHBOQE.js} +4 -4
  22. package/dist/{viewer-6VCZMA3T.js → viewer-H7TVFT4E.js} +14 -14
  23. package/dist/{viewer-6VCZMA3T.js.map → viewer-H7TVFT4E.js.map} +1 -1
  24. package/package.json +2 -1
  25. package/src/core/parser.ts +48 -0
  26. package/src/core/storyAdapter.ts +1 -1
  27. package/src/core/storybook-csf.ts +11 -0
  28. package/src/core/types.ts +1 -1
  29. package/src/mcp/__tests__/findFragmentsJson.test.ts +308 -0
  30. package/src/mcp/server.ts +59 -55
  31. package/src/service/enhance/doc-extractor.ts +2 -2
  32. package/src/service/enhance/props-extractor.ts +1 -1
  33. package/src/service/enhance/storybook-parser.ts +1 -1
  34. package/src/service/figma.ts +2 -2
  35. package/src/service/metrics-store.ts +2 -1
  36. package/src/service/patch-generator.ts +2 -1
  37. package/src/test/reporters/junit.ts +7 -3
  38. package/src/test/runner.ts +4 -4
  39. package/src/test/watch.ts +2 -2
  40. package/src/viewer/components/CodePanel.tsx +1 -1
  41. package/src/viewer/components/FigmaEmbed.tsx +1 -1
  42. package/src/viewer/jsx-parser.ts +2 -1
  43. package/src/viewer/utils/colorSchemes.ts +3 -3
  44. package/dist/chunk-5JNME72P.js.map +0 -1
  45. package/dist/chunk-FYIYMXGA.js.map +0 -1
  46. package/dist/scan-E6U644RS.js +0 -12
  47. package/dist/test-PBPKJ4WJ.js.map +0 -1
  48. /package/dist/{chunk-LDKNZ55O.js.map → chunk-J4SI5RIH.js.map} +0 -0
  49. /package/dist/{chunk-ODXQAQQX.js.map → chunk-ZFKGX3QK.js.map} +0 -0
  50. /package/dist/{core-F3VT277E.js.map → core-LNXDLXDP.js.map} +0 -0
  51. /package/dist/{generate-PNIUR75D.js.map → generate-OIXXHOWR.js.map} +0 -0
  52. /package/dist/{init-ON6WYG66.js.map → init-EVPXIDW4.js.map} +0 -0
  53. /package/dist/{scan-E6U644RS.js.map → scan-YVYD64GD.js.map} +0 -0
  54. /package/dist/{service-U7AR2PC2.js.map → service-K52ORLCJ.js.map} +0 -0
  55. /package/dist/{static-viewer-QL2SCWYB.js.map → static-viewer-JNQIHA4B.js.map} +0 -0
  56. /package/dist/{tokens-4J4PRIGT.js.map → tokens-C6YHBOQE.js.map} +0 -0
@@ -20,11 +20,11 @@ import type {
20
20
  import { groupTestsByComponent } from './discovery.js';
21
21
 
22
22
  // Dynamic playwright types (since it's optional)
23
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
23
+
24
24
  type Browser = any;
25
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
25
+
26
26
  type BrowserContext = any;
27
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
27
+
28
28
  type Page = any;
29
29
 
30
30
  /**
@@ -59,7 +59,7 @@ export async function runTests(
59
59
  }
60
60
 
61
61
  // Import Playwright dynamically (optional dependency)
62
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
62
+
63
63
  let playwright: any;
64
64
  try {
65
65
  playwright = await import('playwright');
package/src/test/watch.ts CHANGED
@@ -34,7 +34,7 @@ export async function startWatchMode(
34
34
 
35
35
  let debounceTimer: NodeJS.Timeout | null = null;
36
36
  let isRunning = false;
37
- let pendingFiles = new Set<string>();
37
+ const pendingFiles = new Set<string>();
38
38
 
39
39
  // Get files to watch
40
40
  const segmentFiles = await discoverSegmentFiles(config, configDir);
@@ -190,7 +190,7 @@ export async function startInteractiveWatchMode(
190
190
  runnerOptions: RunnerOptions,
191
191
  reporters: TestReporter[]
192
192
  ): Promise<void> {
193
- let lastFailedTests: TestCase[] = [];
193
+ const lastFailedTests: TestCase[] = [];
194
194
 
195
195
  // Start basic watch mode
196
196
  await startWatchMode(config, configDir, runnerOptions, reporters, {
@@ -112,7 +112,7 @@ function decompileJsxDev(code: string, indent = 0): string {
112
112
 
113
113
  for (const match of propMatches) {
114
114
  const key = match[1];
115
- let value = match[2];
115
+ const value = match[2];
116
116
 
117
117
  // Skip debug props
118
118
  if (debugProps.has(key)) continue;
@@ -22,7 +22,7 @@ interface ParsedFigmaUrl {
22
22
  */
23
23
  function parseFigmaUrl(figmaUrl: string): ParsedFigmaUrl | null {
24
24
  try {
25
- const urlPattern = /figma\.com\/(?:file|design)\/([^\/]+)\/[^?]*(?:\?.*node-id=([^&]+))?/i;
25
+ const urlPattern = /figma\.com\/(?:file|design)\/([^/]+)\/[^?]*(?:\?.*node-id=([^&]+))?/i;
26
26
  const match = figmaUrl.match(urlPattern);
27
27
 
28
28
  if (!match) return null;
@@ -323,7 +323,7 @@ function evaluateExpression(expr: Expression | Node): unknown {
323
323
  // For template literals with expressions, return a placeholder
324
324
  return "[Template Literal]";
325
325
 
326
- case "ObjectExpression":
326
+ case "ObjectExpression": {
327
327
  // Parse object literals like {{ key: 'value' }}
328
328
  const obj: Record<string, unknown> = {};
329
329
  for (const prop of expr.properties) {
@@ -338,6 +338,7 @@ function evaluateExpression(expr: Expression | Node): unknown {
338
338
  }
339
339
  }
340
340
  return obj;
341
+ }
341
342
 
342
343
  case "ArrayExpression":
343
344
  // Parse array literals like {[1, 2, 3]}
@@ -22,9 +22,9 @@ function hexToHsl(hex: string): [number, number, number] {
22
22
  const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
23
23
  if (!result) return [0, 0, 0];
24
24
 
25
- let r = parseInt(result[1], 16) / 255;
26
- let g = parseInt(result[2], 16) / 255;
27
- let b = parseInt(result[3], 16) / 255;
25
+ const r = parseInt(result[1], 16) / 255;
26
+ const g = parseInt(result[2], 16) / 255;
27
+ const b = parseInt(result[3], 16) / 255;
28
28
 
29
29
  const max = Math.max(r, g, b);
30
30
  const min = Math.min(r, g, b);