@fragments-sdk/cli 0.7.1 → 0.7.3

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 (68) hide show
  1. package/LICENSE +77 -14
  2. package/dist/bin.js +22 -18
  3. package/dist/bin.js.map +1 -1
  4. package/dist/chunk-D34Q6A7S.js +266 -0
  5. package/dist/chunk-D34Q6A7S.js.map +1 -0
  6. package/dist/chunk-EKLMXTWU.js +80 -0
  7. package/dist/chunk-EKLMXTWU.js.map +1 -0
  8. package/dist/{chunk-GHYYFAQN.js → chunk-P33AKQJW.js} +1 -76
  9. package/dist/chunk-P33AKQJW.js.map +1 -0
  10. package/dist/{chunk-U6VTHBNI.js → chunk-QPY4DUFB.js} +177 -46
  11. package/dist/chunk-QPY4DUFB.js.map +1 -0
  12. package/dist/{chunk-32VIEOQY.js → chunk-R2YH7NLN.js} +9 -7
  13. package/dist/{chunk-32VIEOQY.js.map → chunk-R2YH7NLN.js.map} +1 -1
  14. package/dist/{chunk-5ITIP3ES.js → chunk-R6IZZSE7.js} +44 -278
  15. package/dist/chunk-R6IZZSE7.js.map +1 -0
  16. package/dist/{chunk-DQHWLAUV.js → chunk-TOIE7VXF.js} +2 -2
  17. package/dist/{chunk-GCZMFLDI.js → chunk-UXLGIGSX.js} +60 -3
  18. package/dist/chunk-UXLGIGSX.js.map +1 -0
  19. package/dist/{chunk-GKX2HPZ6.js → chunk-YMPGYEWK.js} +9 -3
  20. package/dist/chunk-YMPGYEWK.js.map +1 -0
  21. package/dist/chunk-Z7EY4VHE.js +50 -0
  22. package/dist/{core-SFHPYR5H.js → core-3NMNCLFW.js} +8 -5
  23. package/dist/discovery-AKGA6CJD.js +28 -0
  24. package/dist/{generate-54GJAWUY.js → generate-JAUEHKK7.js} +7 -4
  25. package/dist/{generate-54GJAWUY.js.map → generate-JAUEHKK7.js.map} +1 -1
  26. package/dist/index.js +15 -11
  27. package/dist/index.js.map +1 -1
  28. package/dist/{init-EIM5WNMP.js → init-DZQOT54X.js} +6 -4
  29. package/dist/{init-EIM5WNMP.js.map → init-DZQOT54X.js.map} +1 -1
  30. package/dist/mcp-bin.js +5 -3
  31. package/dist/mcp-bin.js.map +1 -1
  32. package/dist/sass.node-4XJK6YBF.js +130708 -0
  33. package/dist/sass.node-4XJK6YBF.js.map +1 -0
  34. package/dist/scan-OJRCVKK2.js +15 -0
  35. package/dist/{service-ED2LNCTU.js → service-CFFBHW4X.js} +6 -4
  36. package/dist/service-CFFBHW4X.js.map +1 -0
  37. package/dist/{static-viewer-Q4F4QP5M.js → static-viewer-VA2JXSCX.js} +6 -4
  38. package/dist/static-viewer-VA2JXSCX.js.map +1 -0
  39. package/dist/{test-6VN2DA3S.js → test-O7DZNKDC.js} +8 -4
  40. package/dist/{test-6VN2DA3S.js.map → test-O7DZNKDC.js.map} +1 -1
  41. package/dist/{tokens-P2B7ZAM3.js → tokens-N7THFD6J.js} +10 -7
  42. package/dist/{tokens-P2B7ZAM3.js.map → tokens-N7THFD6J.js.map} +1 -1
  43. package/dist/{viewer-GM7IQPPB.js → viewer-QTR7QJMM.js} +390 -25
  44. package/dist/viewer-QTR7QJMM.js.map +1 -0
  45. package/package.json +13 -2
  46. package/src/build.ts +60 -6
  47. package/src/commands/graph.ts +2 -2
  48. package/src/core/__tests__/token-resolver.test.ts +82 -0
  49. package/src/core/loader.ts +0 -3
  50. package/src/core/parser.ts +41 -1
  51. package/src/core/token-parser.ts +111 -1
  52. package/src/core/token-resolver.ts +155 -0
  53. package/src/service/__tests__/patch-generator.test.ts +2 -2
  54. package/src/service/patch-generator.ts +8 -1
  55. package/src/viewer/render-utils.ts +141 -0
  56. package/src/viewer/vite-plugin.ts +381 -23
  57. package/dist/chunk-5ITIP3ES.js.map +0 -1
  58. package/dist/chunk-GCZMFLDI.js.map +0 -1
  59. package/dist/chunk-GHYYFAQN.js.map +0 -1
  60. package/dist/chunk-GKX2HPZ6.js.map +0 -1
  61. package/dist/chunk-U6VTHBNI.js.map +0 -1
  62. package/dist/scan-KQBKUS64.js +0 -12
  63. package/dist/viewer-GM7IQPPB.js.map +0 -1
  64. /package/dist/{chunk-DQHWLAUV.js.map → chunk-TOIE7VXF.js.map} +0 -0
  65. /package/dist/{core-SFHPYR5H.js.map → chunk-Z7EY4VHE.js.map} +0 -0
  66. /package/dist/{scan-KQBKUS64.js.map → core-3NMNCLFW.js.map} +0 -0
  67. /package/dist/{service-ED2LNCTU.js.map → discovery-AKGA6CJD.js.map} +0 -0
  68. /package/dist/{static-viewer-Q4F4QP5M.js.map → scan-OJRCVKK2.js.map} +0 -0
package/LICENSE CHANGED
@@ -1,21 +1,84 @@
1
- MIT License
1
+ Functional Source License, Version 1.1, MIT Future License
2
2
 
3
- Copyright (c) 2024 Conan McNicholl
3
+ Licensor: Conan McNicholl
4
+ Software: Fragments SDK (@fragments-sdk/cli, @fragments-sdk/mcp, @fragments-sdk/context)
4
5
 
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
6
+ IMPORTANT: The @fragments-sdk/ui package is licensed separately under the MIT License.
7
+ See libs/ui/LICENSE for details.
11
8
 
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
9
+ ---
10
+
11
+ ## Terms and Conditions
12
+
13
+ ### Licensor ("We")
14
+
15
+ The individual or entity listed above.
16
+
17
+ ### The Software
18
+
19
+ The software identified above, including all source code, object code,
20
+ documentation, and other files provided by the Licensor.
21
+
22
+ ### Grant of Rights
23
+
24
+ Subject to the conditions below, the Licensor grants you a non-exclusive,
25
+ worldwide, royalty-free license to use, copy, modify, create derivative works,
26
+ and redistribute the Software, in each case subject to the limitations below.
27
+
28
+ ### Limitation — Competing Use
29
+
30
+ You may not use the Software in, or to provide, a Commercial Product or Service
31
+ that competes with the Software or with any product or service that the Licensor
32
+ provides using the Software. A "Commercial Product or Service" is any product or
33
+ service offered to third parties for a fee or other consideration.
34
+
35
+ For clarity, the following uses are always permitted regardless of this limitation:
36
+
37
+ - Using the Software for your own internal business purposes
38
+ - Using the Software to build and deploy your own applications
39
+ - Using the Software for personal, educational, or evaluation purposes
40
+ - Providing professional services (consulting, integration) to your clients
41
+ that involve configuring or extending the Software
42
+
43
+ The following are examples of Competing Use that are NOT permitted:
44
+
45
+ - Offering a hosted developer tools service that repackages or exposes
46
+ the functionality of the Software
47
+ - Selling or distributing a product that is a substitute for any product
48
+ or service offered by the Licensor
49
+ - Building and offering an MCP server, CLI tool, or code intelligence
50
+ platform that is substantially derived from the Software
51
+
52
+ ### Change Date and License
53
+
54
+ On the second anniversary of each version's release date, the Licensor grants
55
+ you the rights under the terms of the MIT License for that version.
56
+ The "MIT License" means the license identified by SPDX as "MIT" and published
57
+ at https://opensource.org/licenses/MIT.
58
+
59
+ ### No Warranties
14
60
 
15
61
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
62
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
63
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
64
+
65
+ ### Limitation of Liability
66
+
67
+ IN NO EVENT SHALL THE LICENSOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
68
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
69
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
70
+ THE SOFTWARE.
71
+
72
+ ### General
73
+
74
+ If any provision of this License is held to be unenforceable, that provision
75
+ shall be reformed only to the extent necessary to make it enforceable, and the
76
+ remaining provisions shall continue in full force and effect.
77
+
78
+ This License does not grant permission to use the trade names, trademarks,
79
+ service marks, or product names of the Licensor, except as required for
80
+ reasonable and customary use in describing the origin of the Software.
81
+
82
+ ---
83
+
84
+ For more information about the Functional Source License, see https://fsl.software/
package/dist/bin.js CHANGED
@@ -9,10 +9,17 @@ import {
9
9
  validateAll,
10
10
  validateCoverage,
11
11
  validateSchema
12
- } from "./chunk-U6VTHBNI.js";
12
+ } from "./chunk-QPY4DUFB.js";
13
13
  import {
14
14
  scan
15
- } from "./chunk-32VIEOQY.js";
15
+ } from "./chunk-R2YH7NLN.js";
16
+ import {
17
+ loadConfig,
18
+ loadFragmentFile
19
+ } from "./chunk-R6IZZSE7.js";
20
+ import {
21
+ discoverFragmentFiles
22
+ } from "./chunk-D34Q6A7S.js";
16
23
  import {
17
24
  FigmaClient,
18
25
  StorageManager,
@@ -28,18 +35,15 @@ import {
28
35
  renderAllComponentVariants,
29
36
  scanCodebase,
30
37
  shutdownSharedPool
31
- } from "./chunk-GKX2HPZ6.js";
32
- import {
33
- discoverFragmentFiles,
34
- loadConfig,
35
- loadFragmentFile
36
- } from "./chunk-5ITIP3ES.js";
38
+ } from "./chunk-YMPGYEWK.js";
37
39
  import {
38
40
  generateContext
39
- } from "./chunk-GCZMFLDI.js";
41
+ } from "./chunk-UXLGIGSX.js";
42
+ import "./chunk-P33AKQJW.js";
40
43
  import {
41
44
  BRAND
42
- } from "./chunk-GHYYFAQN.js";
45
+ } from "./chunk-EKLMXTWU.js";
46
+ import "./chunk-Z7EY4VHE.js";
43
47
 
44
48
  // src/bin.ts
45
49
  import { Command } from "commander";
@@ -1785,7 +1789,7 @@ ${BRAND.name} Dev Server
1785
1789
  }
1786
1790
  }
1787
1791
  }
1788
- const { createDevServer } = await import("./viewer-GM7IQPPB.js");
1792
+ const { createDevServer } = await import("./viewer-QTR7QJMM.js");
1789
1793
  console.log(pc7.dim("\nStarting dev server..."));
1790
1794
  const parsedPort = typeof port === "string" ? parseInt(port, 10) : port;
1791
1795
  try {
@@ -5115,8 +5119,8 @@ Composition: ${component}
5115
5119
  if (tree.subComponents.length > 0) {
5116
5120
  console.log(` ${pc20.cyan("Sub-components:")}`);
5117
5121
  for (const sub of tree.subComponents) {
5118
- const isRequired = tree.requiredChildren.includes(sub);
5119
- console.log(` ${pc20.yellow(sub)}${isRequired ? pc20.red(" (required)") : ""}`);
5122
+ const isChild = tree.children.includes(sub);
5123
+ console.log(` ${pc20.yellow(sub)}${isChild ? pc20.dim(" (child)") : ""}`);
5120
5124
  }
5121
5125
  }
5122
5126
  if (tree.siblings.length > 0) {
@@ -5550,7 +5554,7 @@ Make sure the dev server is running: ${BRAND.cliCommand} dev`));
5550
5554
  });
5551
5555
  program.command("view").description(`Generate a static HTML viewer for ${BRAND.outFile}`).option("-i, --input <path>", `Path to ${BRAND.outFile}`, BRAND.outFile).option("-o, --output <path>", "Output HTML file path", BRAND.viewerHtmlFile).option("--open", "Open in browser after generation").action(async (options) => {
5552
5556
  try {
5553
- const { generateViewerFromJson } = await import("./static-viewer-Q4F4QP5M.js");
5557
+ const { generateViewerFromJson } = await import("./static-viewer-VA2JXSCX.js");
5554
5558
  const fs2 = await import("fs/promises");
5555
5559
  const path = await import("path");
5556
5560
  const inputPath = path.resolve(process.cwd(), options.input);
@@ -5598,7 +5602,7 @@ program.command("add").argument("[name]", 'Component name (e.g., "Button", "Text
5598
5602
  });
5599
5603
  program.command("init").description("Initialize fragments in a project (interactive by default)").option("--force", "Overwrite existing config").option("-y, --yes", "Non-interactive mode - auto-detect and use defaults").action(async (options) => {
5600
5604
  try {
5601
- const { init } = await import("./init-EIM5WNMP.js");
5605
+ const { init } = await import("./init-DZQOT54X.js");
5602
5606
  const result = await init({
5603
5607
  projectRoot: process.cwd(),
5604
5608
  force: options.force,
@@ -5618,7 +5622,7 @@ program.command("init").description("Initialize fragments in a project (interact
5618
5622
  });
5619
5623
  program.command("tokens").description("Discover and list design tokens from CSS/SCSS files").option("-c, --config <path>", "Path to config file").option("--json", "Output as JSON").option("--categories", "Group tokens by category").option("--theme <theme>", "Filter by theme name").option("--category <category>", "Filter by category (color, spacing, typography, etc.)").option("--verbose", "Show all tokens (no truncation)").action(async (options) => {
5620
5624
  try {
5621
- const { tokens } = await import("./tokens-P2B7ZAM3.js");
5625
+ const { tokens } = await import("./tokens-N7THFD6J.js");
5622
5626
  const result = await tokens({
5623
5627
  config: options.config,
5624
5628
  json: options.json,
@@ -5637,7 +5641,7 @@ program.command("tokens").description("Discover and list design tokens from CSS/
5637
5641
  });
5638
5642
  program.command("generate").description("Generate fragment files from component source code").argument("[component]", "Specific component name to generate (optional)").option("--force", "Overwrite existing fragment files").option("--pattern <glob>", "Pattern for component files", "src/components/**/*.tsx").action(async (component, options) => {
5639
5643
  try {
5640
- const { generate } = await import("./generate-54GJAWUY.js");
5644
+ const { generate } = await import("./generate-JAUEHKK7.js");
5641
5645
  const result = await generate({
5642
5646
  projectRoot: process.cwd(),
5643
5647
  component,
@@ -5664,7 +5668,7 @@ program.command("graph").description("Query the component relationship graph").a
5664
5668
  program.command("test").description("Run interaction tests for fragments with play functions").option("-c, --config <path>", "Path to config file").option("--component <name>", "Filter by component name").option("--tags <tags>", "Filter by tags (comma-separated)").option("--grep <pattern>", "Filter by variant name pattern").option("--exclude <pattern>", "Exclude tests matching pattern").option("--parallel <count>", "Number of parallel browser contexts", parseInt, 4).option("--timeout <ms>", "Timeout per test in milliseconds", parseInt, 3e4).option("--retries <count>", "Number of retries for failed tests", parseInt, 0).option("--bail", "Stop on first failure").option("--browser <name>", "Browser to use (chromium, firefox, webkit)", "chromium").option("--headed", "Run in headed mode (show browser)").option("--a11y", "Run accessibility checks with axe-core").option("--visual", "Capture screenshots for visual regression").option("--update-snapshots", "Update visual snapshots").option("--watch", "Watch mode - re-run on file changes").option("--reporters <names>", "Reporters to use (console, junit, json)", "console").option("-o, --output <dir>", "Output directory for results", "./test-results").option("--server-url <url>", "URL of running dev server (skips starting server)").option("-p, --port <port>", "Port for dev server", parseInt, 6006).option("--ci", "CI mode - non-interactive, exit with code 1 on failure").option("--list", "List available tests without running them").action(async (options) => {
5665
5669
  try {
5666
5670
  const { config, configDir } = await loadConfig(options.config);
5667
- const { runTestCommand, listTests } = await import("./test-6VN2DA3S.js");
5671
+ const { runTestCommand, listTests } = await import("./test-O7DZNKDC.js");
5668
5672
  if (options.list) {
5669
5673
  await listTests(config, configDir, {
5670
5674
  component: options.component,