@figma/code-connect 1.5.2 → 2.0.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/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Code Connect
2
2
 
3
3
  > [!WARNING]
4
- > Framework-specific parsers will no longer receive updates or support from August 17th, 2026. Template files will be the only actively maintained way of using Code Connect. See our migration guide for more information and instructions on migrating parser-based Code Connect:
4
+ > Framework-specific parsers will no longer receive updates or support. Template files are now the only actively maintained way of using Code Connect. See our migration guide for more information and instructions on migrating parser-based Code Connect:
5
5
  > https://developers.figma.com/docs/code-connect/templates-migration-guide/
6
6
 
7
7
  Code Connect is a tool for connecting your design system components in code with your design system in Figma. When using Code Connect, Figma's Dev Mode will display true-to-production code snippets from your design system instead of autogenerated code examples. In addition to connecting component definitions, Code Connect also supports mapping properties from code to Figma enabling dynamic and correct examples. This can be useful for when you have an existing design system and are looking to drive consistent and correct adoption of that design system across design and engineering.
@@ -21,6 +21,7 @@ export type BaseCommand = commander.Command & {
21
21
  maxCombinations?: string;
22
22
  props?: string[];
23
23
  inspect?: boolean;
24
+ unique?: boolean;
24
25
  };
25
26
  type BatchMigrationMode = 'auto' | 'all' | 'none';
26
27
  export declare function addConnectCommandToProgram(program: commander.Command): void;
@@ -28,8 +29,12 @@ export declare function getAccessToken(cmd: BaseCommand): string;
28
29
  export declare function getAccessTokenOrExit(cmd: BaseCommand): string;
29
30
  export declare function getDir(cmd: BaseCommand): string;
30
31
  export declare function setupHandler(cmd: BaseCommand): void;
32
+ type GetCodeConnectObjectsOptions = {
33
+ silent?: boolean;
34
+ parserMode?: 'forbid' | 'migration' | 'exempt';
35
+ };
31
36
  export declare function getCodeConnectObjects(cmd: BaseCommand & {
32
37
  label?: string;
33
- }, projectInfo: ProjectInfo, silent?: boolean, isForMigration?: boolean): Promise<CodeConnectJSON[]>;
38
+ }, projectInfo: ProjectInfo, { silent, parserMode }?: GetCodeConnectObjectsOptions): Promise<CodeConnectJSON[]>;
34
39
  export {};
35
40
  //# sourceMappingURL=connect.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"connect.d.ts","sourceRoot":"","sources":["../../src/commands/connect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,WAAW,CAAA;AAMtC,OAAO,EAKL,WAAW,EAKZ,MAAM,oBAAoB,CAAA;AAE3B,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAqC1D,MAAM,MAAM,WAAW,GAAG,SAAS,CAAC,OAAO,GAAG;IAC5C,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,OAAO,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,OAAO,CAAA;IACf,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,EAAE,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,eAAe,EAAE,OAAO,CAAA;IACxB,qBAAqB,EAAE,OAAO,CAAA;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,KAAK,CAAC,EAAE,kBAAkB,CAAA;IAC1B,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,GAAG,CAAC,EAAE,OAAO,CAAA;IACb,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;IAChB,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAED,KAAK,kBAAkB,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,CAAA;AA8BjD,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,SAAS,CAAC,OAAO,QA0HpE;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,WAAW,UAE9C;AAED,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,WAAW,UAUpD;AAED,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AAO,CAAA;CACjB,CAAA;AAED,KAAK,kBAAkB,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,CAAA;AAiCjD,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,SAAS,CAAC,OAAO,QAmIpE;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,WAAW,UAE9C;AAED,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,WAAW,UAUpD;AAED,wBAAgB,MAAM,CAAC,GAAG,EAAE,WAAW,UAEtC;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,WAAW,QAI5C;AAkCD,KAAK,4BAA4B,GAAG;IAClC,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,UAAU,CAAC,EAAE,QAAQ,GAAG,WAAW,GAAG,QAAQ,CAAA;CAC/C,CAAA;AAED,wBAAsB,qBAAqB,CACzC,GAAG,EAAE,WAAW,GAAG;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,EACrC,WAAW,EAAE,WAAW,EACxB,EAAE,MAAc,EAAE,UAAqB,EAAE,GAAE,4BAAiC,GAC3E,OAAO,CAAC,eAAe,EAAE,CAAC,CAqO5B"}
@@ -71,7 +71,7 @@ const batch_templates_1 = require("../connect/batch_templates");
71
71
  const run_wizard_2 = require("../connect/wizard/run_wizard");
72
72
  const project_2 = require("../connect/project");
73
73
  function addBaseCommand(command, name, description) {
74
- return command
74
+ const configuredCommand = command
75
75
  .command(name)
76
76
  .description(description)
77
77
  .usage('[options]')
@@ -87,10 +87,11 @@ function addBaseCommand(command, name, description) {
87
87
  .option('--exit-on-unreadable-files', 'exit if any Code Connect files cannot be parsed. We recommend using this option for CI/CD.')
88
88
  .option('--dry-run', 'tests publishing without actually publishing')
89
89
  .addHelpText('before', 'For feedback or bugs, please raise an issue: https://github.com/figma/code-connect/issues');
90
+ return configuredCommand;
90
91
  }
91
92
  function addConnectCommandToProgram(program) {
92
93
  // Main command, invoked with `figma connect`
93
- const connectCommand = addBaseCommand(program, 'connect', 'Figma Code Connect').action((0, updates_1.withVersionWarnings)(run_wizard_1.runWizard, { hideDeprecationWarning: true }));
94
+ const connectCommand = addBaseCommand(program, 'connect', 'Figma Code Connect').action((0, updates_1.withUpdateCheck)(run_wizard_1.runWizard));
94
95
  // Make shared base flags work on either side of the subcommand name —
95
96
  // `figma connect -v publish` and `figma connect publish -v` both honour -v.
96
97
  connectCommand.hook('preAction', (_thisCommand, actionCommand) => {
@@ -105,21 +106,21 @@ function addConnectCommandToProgram(program) {
105
106
  .option('-b --batch-size <batch_size>', 'optional batch size (in number of documents) to use when uploading. Use this if you hit "request too large" errors. See README for more information.')
106
107
  .option('--include-template-files', '(Deprecated) No longer needed - template files are included by default. Will be removed in a future version.')
107
108
  .option('--force', 'overwrite existing UI-created Code Connect mappings if they conflict with the files being published')
108
- .action((0, updates_1.withVersionWarnings)(handlePublish));
109
+ .action((0, updates_1.withUpdateCheck)(handlePublish));
109
110
  addBaseCommand(connectCommand, 'unpublish', 'Run to find any files that have figma connections and unpublish them from Figma. ' +
110
111
  'By default this looks for a config file named "figma.config.json", and uses the `include` and `exclude` fields to determine which files to parse. ' +
111
112
  'If no config file is found, this parses the current directory. An optional `--dir` flag can be used to specify a directory to parse. ' +
112
113
  'Alternatively, use `--node` and `--label` to unpublish a specific component.')
113
114
  .option('--node <link_to_node>', 'specify the node to unpublish. This will unpublish for the specified label.')
114
115
  .option('-l --label <label>', 'label to unpublish for')
115
- .action((0, updates_1.withVersionWarnings)(handleUnpublish));
116
+ .action((0, updates_1.withUpdateCheck)(handleUnpublish));
116
117
  addBaseCommand(connectCommand, 'parse', 'Run Code Connect locally to find any files that have figma connections, then converts them to JSON and outputs to stdout.')
117
118
  .option('-l --label <label>', 'label to apply to the parsed files')
118
119
  .option('--include-template-files', '(Deprecated) No longer needed - template files are included by default. Will be removed in a future version.')
119
- .action((0, updates_1.withVersionWarnings)(handleParse));
120
+ .action((0, updates_1.withUpdateCheck)(handleParse));
120
121
  addBaseCommand(connectCommand, 'create', 'Generate a Code Connect file with boilerplate in the current directory for a Figma node URL')
121
122
  .argument('<figma-node-url>', 'Figma node URL to create the Code Connect file from')
122
- .action((0, updates_1.withVersionWarnings)(handleCreate));
123
+ .action((0, updates_1.withUpdateCheck)(handleCreate));
123
124
  addBaseCommand(connectCommand, 'migrate', 'Parse Code Connect files and migrate their templates into .figma.ts or .figma.js files that can be published directly without parsing.')
124
125
  .option('--include-props', 'preserve __props metadata blocks in migrated templates (removed by default). Use if your templates use the React .getProps() or .render() modifiers, or read executeTemplate().metadata.__props from the migrated components')
125
126
  .option('--javascript', 'output migrated templates as JavaScript (.figma.js) instead of TypeScript (.figma.ts)')
@@ -127,15 +128,20 @@ function addConnectCommandToProgram(program) {
127
128
  .addOption(new commander.Option('--batch <mode>', 'batch migration mode: auto attempts files with 10 or more Code Connect docs; all attempts every source file; none disables batch migration')
128
129
  .choices(['auto', 'all', 'none'])
129
130
  .default('auto'))
130
- .action((0, updates_1.withVersionWarnings)(handleMigrate, { hideDeprecationWarning: true }));
131
+ .action((0, updates_1.withUpdateCheck)(handleMigrate));
131
132
  addBaseCommand(connectCommand, 'preview', 'Preview how Code Connect snippets will render in the Figma inspect panel')
132
133
  .argument('[files...]', 'Code Connect files to preview (e.g., Button.figma.tsx). Leave empty to preview all files.')
133
134
  .option('--output <format>', 'Output format: table (default) or json', 'table')
134
135
  .option('--all', "Render the snippet for every possible combination of the component's boolean and variant properties. Requires a single component file argument.")
135
- .option('--max-combinations <number>', 'Maximum number of property combinations to render with --all. Defaults to 500 and cannot exceed 500.')
136
+ .option('--max-combinations <number>', 'Maximum number of property combinations to render with --all or --unique. Defaults to 500 and cannot exceed 500.')
136
137
  .option('--props <pairs...>', 'Render a single property combination with the given property values, e.g. --props Variant=Primary "Has Icon Start=true". Each pair is a separate space-separated argument (quote a pair only if its name or value contains spaces). Prefix a pair with a type (BOOLEAN/TEXT/VARIANT/INSTANCE_SWAP) to disambiguate properties that share a name but differ in type, e.g. "BOOLEAN:textMsg=false" "TEXT:textMsg=Hello". Unspecified properties use their defaults. Cannot be combined with --all.')
137
138
  .option('--inspect', "List the component's properties/variants (name, type, options, default) without rendering. Respects --output.")
138
- .action((0, updates_1.withVersionWarnings)(preview_utils_1.handlePreview));
139
+ .addOption(
140
+ // Implies --all, so `--unique` is meaningful on its own and there is no
141
+ // way to ask for deduplication without asking for the combinations it
142
+ // dedupes. Downstream code only ever reads `all`.
143
+ new commander.Option('--unique', 'Implies --all, but folds property combinations that render identical output into a single result (reported with the count of combinations it covers). Useful when boolean/variant axes do not change the rendered snippet.').implies({ all: true }))
144
+ .action((0, updates_1.withUpdateCheck)(preview_utils_1.handlePreview));
139
145
  }
140
146
  function getAccessToken(cmd) {
141
147
  return cmd.token ?? process.env.FIGMA_ACCESS_TOKEN;
@@ -179,7 +185,12 @@ function transformDocFromParser(doc, remoteUrl, config) {
179
185
  figmaNode,
180
186
  };
181
187
  }
182
- async function getCodeConnectObjects(cmd, projectInfo, silent = false, isForMigration = false) {
188
+ async function getCodeConnectObjects(cmd, projectInfo, { silent = false, parserMode = 'forbid' } = {}) {
189
+ const isForMigration = parserMode === 'migration';
190
+ let isParserExempt = parserMode === 'exempt';
191
+ // Keep legacy parser coverage under Jest. Parser-removal tests explicitly disable this
192
+ // opt-in so they continue to exercise the public CLI behavior.
193
+ const isParserExemptForTests = process.env.NODE_ENV === 'test' && process.env.CODE_CONNECT_TEST_ALLOW_PARSERS === '1';
183
194
  if (cmd.jsonFile) {
184
195
  try {
185
196
  const docsFromJson = JSON.parse(fs_1.default.readFileSync(cmd.jsonFile, 'utf8'));
@@ -221,11 +232,27 @@ async function getCodeConnectObjects(cmd, projectInfo, silent = false, isForMigr
221
232
  // (.swift/.kt/.tsx etc.), which are disjoint from raw templates, so skipping it
222
233
  // here drops no docs.
223
234
  //
224
- // An empty file set is deliberately NOT treated as template-only: we leave the
225
- // existing behavior intact (the configured parser still runs), so e.g. a Swift
226
- // config that matches no files surfaces the same parser output as before.
227
- const rawTemplateFileSet = new Set(rawTemplateFiles);
228
- const isTemplateOnlyProject = rawTemplateFiles.length > 0 && projectInfo.files.every((f) => rawTemplateFileSet.has(f));
235
+ // An empty file set is deliberately NOT treated as template-only. Migration
236
+ // and exempt callers still invoke the configured parser, while other commands reject
237
+ // the parser configuration consistently even when its globs currently match no files.
238
+ const batchFiles = projectInfo.files.filter((f) => f.endsWith('.figma.batch.json'));
239
+ const parserlessFileSet = new Set([...rawTemplateFiles, ...batchFiles]);
240
+ const isTemplateOnlyProject = parserlessFileSet.size > 0 && projectInfo.files.every((f) => parserlessFileSet.has(f));
241
+ if (!isParserExempt &&
242
+ parserMode === 'forbid' &&
243
+ !isParserExemptForTests &&
244
+ !isTemplateOnlyProject &&
245
+ projectInfo.config.parser) {
246
+ (0, logging_1.exitWithError)(`Framework-specific parsers are no longer supported in Code Connect CLI v2.
247
+
248
+ Run \`figma connect migrate\` to convert parser-based Code Connect to template files:
249
+ https://developers.figma.com/docs/code-connect/templates-migration-guide/
250
+
251
+ Alternatively, if you're not able to migrate right now, continue using Code Connect v1:
252
+ npm install --save-dev @figma/code-connect@1
253
+
254
+ If this project has already been migrated, remove the \`parser\` setting from figma.config.json or update its \`include\` patterns to match only template files.`);
255
+ }
229
256
  if (isTemplateOnlyProject) {
230
257
  // Verbose-only: this is a diagnostic detail and must not alter normal output.
231
258
  if (projectInfo.config.parser && cmd.verbose) {
@@ -280,12 +307,6 @@ async function getCodeConnectObjects(cmd, projectInfo, silent = false, isForMigr
280
307
  }
281
308
  }
282
309
  }
283
- // At this point `codeConnectObjects` holds only docs produced by a native
284
- // parser (raw templates and batch files are appended below), so a non-empty
285
- // list is proof the project still relies on the deprecated parsers.
286
- if (codeConnectObjects.length > 0) {
287
- (0, updates_1.flagParserBasedCodeConnect)();
288
- }
289
310
  if (rawTemplateFiles.length > 0) {
290
311
  // Resolve the label before parsing so language inference works correctly
291
312
  const resolvedLabel = cmd.label || projectInfo.config.label;
@@ -328,7 +349,6 @@ async function getCodeConnectObjects(cmd, projectInfo, silent = false, isForMigr
328
349
  codeConnectObjects = codeConnectObjects.concat(rawTemplateDocs);
329
350
  }
330
351
  // Process batch files (.figma.batch.json)
331
- const batchFiles = projectInfo.files.filter((f) => f.endsWith('.figma.batch.json'));
332
352
  if (batchFiles.length > 0) {
333
353
  const resolvedLabel = cmd.label || projectInfo.config.label;
334
354
  for (const file of batchFiles) {
@@ -522,7 +542,9 @@ async function handleUnpublish(cmd) {
522
542
  nodesToDeleteRelevantInfo = [{ figmaNode: cmd.node, label: cmd.label }];
523
543
  }
524
544
  else {
525
- const codeConnectObjects = await getCodeConnectObjects(cmd, projectInfo);
545
+ const codeConnectObjects = await getCodeConnectObjects(cmd, projectInfo, {
546
+ parserMode: 'exempt',
547
+ });
526
548
  nodesToDeleteRelevantInfo = codeConnectObjects.map((doc) => ({
527
549
  figmaNode: doc.figmaNode,
528
550
  label: cmd.label || projectInfo.config.label || doc.label,
@@ -606,7 +628,9 @@ async function handleMigrate(cmd) {
606
628
  },
607
629
  };
608
630
  // Parse the files to get Code Connect objects
609
- const allCodeConnectObjects = await getCodeConnectObjects(cmd, projectInfo, false, true);
631
+ const allCodeConnectObjects = await getCodeConnectObjects(cmd, projectInfo, {
632
+ parserMode: 'migration',
633
+ });
610
634
  const allCodeConnectObjectsByFigmaUrl = (0, migration_helpers_1.groupCodeConnectObjectsByFigmaUrl)(allCodeConnectObjects);
611
635
  const groupCount = Object.keys(allCodeConnectObjectsByFigmaUrl).length;
612
636
  if (groupCount === 0) {
@@ -1 +1 @@
1
- {"version":3,"file":"connect.js","sourceRoot":"","sources":["../../src/commands/connect.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2GA,gEA0HC;AAED,wCAEC;AAED,oDAUC;AAED,wBAEC;AAED,oCAIC;AAkCD,sDA0NC;AA3fD,qDAAsC;AACtC,4CAAmB;AACnB,mDAA+C;AAC/C,8CAA0C;AAC1C,sDAAoD;AACpD,8CAA4D;AAC5D,gDA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AC,CAAA;AACJ,CAAC","sourcesContent":["import * as commander from 'commander'\nimport fs from 'fs'\nimport { handlePreview } from './preview_utils'\nimport { upload } from '../connect/upload'\nimport { validateDocs } from '../connect/validation'\nimport { createCodeConnectFromUrl } from '../connect/create'\nimport {\n CodeConnectConfig,\n CodeConnectExecutableParserConfig,\n CodeConnectParserlessConfig,\n CodeConnectReactConfig,\n ProjectInfo,\n getProjectInfo,\n getReactProjectInfo,\n getRemoteFileUrl,\n getTsProgram,\n} from '../connect/project'\nimport { LogLevel, error, exitWithError, highlight, logger, success } from '../common/logging'\nimport { CodeConnectJSON } from '../connect/figma_connect'\nimport { convertStorybookFiles } from '../storybook/convert'\nimport { delete_docs } from '../connect/delete_docs'\nimport { runWizard } from '../connect/wizard/run_wizard'\nimport { callParser, handleMessages } from '../connect/parser_executables'\nimport { fromError } from 'zod-validation-error'\nimport { ParseRequestPayload, ParseResponsePayload } from '../connect/parser_executable_types'\nimport z from 'zod'\nimport path from 'path'\nimport { flagParserBasedCodeConnect, withVersionWarnings } from '../common/updates'\nimport { applyDocumentUrlSubstitutions, exitWithFeedbackMessage } from '../connect/helpers'\nimport { filterProjectInfoByFile } from './filter_project_info'\nimport { parseHtmlDoc } from '../html/parser'\nimport {\n InternalError,\n isFigmaConnectFile,\n parseCodeConnect,\n ParseFn,\n ParserError,\n ResolveImportsFn,\n} from '../connect/parser_common'\nimport { findAndResolveImports, parseReactDoc } from '../react/parser'\nimport { getInferredLanguageForRaw } from '../connect/label_language_mapping'\nimport {\n groupCodeConnectObjectsByFigmaUrl,\n writeTemplateFile,\n writeVariantTemplateFile,\n} from '../connect/migration_helpers'\nimport {\n getBatchMigrationGroups,\n writeBatchTemplateFiles,\n} from '../connect/migration_batch_helpers'\nimport { CodePropertiesError, isRawTemplate, parseRawFile } from '../connect/raw_templates'\nimport { parseBatchFile } from '../connect/batch_templates'\nimport { convertRemoteFileUrlToRelativePath } from '../connect/wizard/run_wizard'\nimport { getGitRepoAbsolutePath } from '../connect/project'\n\nexport type BaseCommand = commander.Command & {\n token: string\n verbose: boolean\n outFile: string\n outDir: string\n config: string\n dryRun: boolean\n dir: string\n file: string[]\n jsonFile: string\n skipUpdateCheck: boolean\n exitOnUnreadableFiles: boolean\n apiUrl?: string\n includeProps?: boolean\n batch?: BatchMigrationMode\n delete?: boolean\n all?: boolean\n maxCombinations?: string\n props?: string[]\n inspect?: boolean\n}\n\ntype BatchMigrationMode = 'auto' | 'all' | 'none'\n\nfunction addBaseCommand(command: commander.Command, name: string, description: string) {\n return command\n .command(name)\n .description(description)\n .usage('[options]')\n .option('-r --dir <dir>', 'directory to parse')\n .option(\n '-f --file <file...>',\n 'paths to one or more Code Connect files to process (space-separated)',\n )\n .option('-t --token <token>', 'figma access token')\n .option('-v --verbose', 'enable verbose logging for debugging')\n .option('-o --outFile <file>', 'specify a file to output generated Code Connect')\n .option('-o --outDir <dir>', 'specify a directory to output generated Code Connect')\n .option('-c --config <path>', 'path to a figma config file')\n .option('-a --api-url <url>', 'custom Figma API URL to use instead of https://api.figma.com/v1')\n .option('--skip-update-check', 'skips checking for an updated version of the Figma CLI')\n .option(\n '--exit-on-unreadable-files',\n 'exit if any Code Connect files cannot be parsed. We recommend using this option for CI/CD.',\n )\n .option('--dry-run', 'tests publishing without actually publishing')\n .addHelpText(\n 'before',\n 'For feedback or bugs, please raise an issue: https://github.com/figma/code-connect/issues',\n )\n}\n\nexport function addConnectCommandToProgram(program: commander.Command) {\n // Main command, invoked with `figma connect`\n const connectCommand = addBaseCommand(program, 'connect', 'Figma Code Connect').action(\n withVersionWarnings(runWizard, { hideDeprecationWarning: true }),\n )\n\n // Make shared base flags work on either side of the subcommand name —\n // `figma connect -v publish` and `figma connect publish -v` both honour -v.\n connectCommand.hook('preAction', (_thisCommand, actionCommand) => {\n Object.assign(actionCommand.opts(), actionCommand.optsWithGlobals())\n })\n\n // Sub-commands, invoked with e.g. `figma connect publish`\n addBaseCommand(\n connectCommand,\n 'publish',\n 'Run Code Connect locally to find any files that have figma connections and publish them to Figma. ' +\n 'By default this looks for a config file named \"figma.config.json\", and uses the `include` and `exclude` fields to determine which files to parse. ' +\n 'If no config file is found, this parses the current directory. An optional `--dir` flag can be used to specify a directory to parse.',\n )\n .option('--skip-validation', 'skip validation of Code Connect docs')\n .option('-l --label <label>', 'label to apply to the published files')\n .option(\n '-b --batch-size <batch_size>',\n 'optional batch size (in number of documents) to use when uploading. Use this if you hit \"request too large\" errors. See README for more information.',\n )\n .option(\n '--include-template-files',\n '(Deprecated) No longer needed - template files are included by default. Will be removed in a future version.',\n )\n .option(\n '--force',\n 'overwrite existing UI-created Code Connect mappings if they conflict with the files being published',\n )\n .action(withVersionWarnings(handlePublish))\n\n addBaseCommand(\n connectCommand,\n 'unpublish',\n 'Run to find any files that have figma connections and unpublish them from Figma. ' +\n 'By default this looks for a config file named \"figma.config.json\", and uses the `include` and `exclude` fields to determine which files to parse. ' +\n 'If no config file is found, this parses the current directory. An optional `--dir` flag can be used to specify a directory to parse. ' +\n 'Alternatively, use `--node` and `--label` to unpublish a specific component.',\n )\n .option(\n '--node <link_to_node>',\n 'specify the node to unpublish. This will unpublish for the specified label.',\n )\n .option('-l --label <label>', 'label to unpublish for')\n .action(withVersionWarnings(handleUnpublish))\n\n addBaseCommand(\n connectCommand,\n 'parse',\n 'Run Code Connect locally to find any files that have figma connections, then converts them to JSON and outputs to stdout.',\n )\n .option('-l --label <label>', 'label to apply to the parsed files')\n .option(\n '--include-template-files',\n '(Deprecated) No longer needed - template files are included by default. Will be removed in a future version.',\n )\n .action(withVersionWarnings(handleParse))\n\n addBaseCommand(\n connectCommand,\n 'create',\n 'Generate a Code Connect file with boilerplate in the current directory for a Figma node URL',\n )\n .argument('<figma-node-url>', 'Figma node URL to create the Code Connect file from')\n .action(withVersionWarnings(handleCreate))\n\n addBaseCommand(\n connectCommand,\n 'migrate',\n 'Parse Code Connect files and migrate their templates into .figma.ts or .figma.js files that can be published directly without parsing.',\n )\n .option(\n '--include-props',\n 'preserve __props metadata blocks in migrated templates (removed by default). Use if your templates use the React .getProps() or .render() modifiers, or read executeTemplate().metadata.__props from the migrated components',\n )\n .option(\n '--javascript',\n 'output migrated templates as JavaScript (.figma.js) instead of TypeScript (.figma.ts)',\n )\n .option('--delete', 'delete source Code Connect files after they are successfully migrated')\n .addOption(\n new commander.Option(\n '--batch <mode>',\n 'batch migration mode: auto attempts files with 10 or more Code Connect docs; all attempts every source file; none disables batch migration',\n )\n .choices(['auto', 'all', 'none'])\n .default('auto'),\n )\n .action(withVersionWarnings(handleMigrate, { hideDeprecationWarning: true }))\n\n addBaseCommand(\n connectCommand,\n 'preview',\n 'Preview how Code Connect snippets will render in the Figma inspect panel',\n )\n .argument(\n '[files...]',\n 'Code Connect files to preview (e.g., Button.figma.tsx). Leave empty to preview all files.',\n )\n .option('--output <format>', 'Output format: table (default) or json', 'table')\n .option(\n '--all',\n \"Render the snippet for every possible combination of the component's boolean and variant properties. Requires a single component file argument.\",\n )\n .option(\n '--max-combinations <number>',\n 'Maximum number of property combinations to render with --all. Defaults to 500 and cannot exceed 500.',\n )\n .option(\n '--props <pairs...>',\n 'Render a single property combination with the given property values, e.g. --props Variant=Primary \"Has Icon Start=true\". Each pair is a separate space-separated argument (quote a pair only if its name or value contains spaces). Prefix a pair with a type (BOOLEAN/TEXT/VARIANT/INSTANCE_SWAP) to disambiguate properties that share a name but differ in type, e.g. \"BOOLEAN:textMsg=false\" \"TEXT:textMsg=Hello\". Unspecified properties use their defaults. Cannot be combined with --all.',\n )\n .option(\n '--inspect',\n \"List the component's properties/variants (name, type, options, default) without rendering. Respects --output.\",\n )\n .action(withVersionWarnings(handlePreview))\n}\n\nexport function getAccessToken(cmd: BaseCommand) {\n return cmd.token ?? process.env.FIGMA_ACCESS_TOKEN\n}\n\nexport function getAccessTokenOrExit(cmd: BaseCommand) {\n const token = getAccessToken(cmd)\n\n if (!token) {\n exitWithError(\n `Couldn't find a Figma access token. Please provide one with \\`--token <access_token>\\` or set the FIGMA_ACCESS_TOKEN environment variable`,\n )\n }\n\n return token\n}\n\nexport function getDir(cmd: BaseCommand) {\n return cmd.dir ?? process.cwd()\n}\n\nexport function setupHandler(cmd: BaseCommand) {\n if (cmd.verbose) {\n logger.setLogLevel(LogLevel.Debug)\n }\n}\n\ntype ParserDoc = z.infer<typeof ParseResponsePayload>['docs'][0]\n\nfunction transformDocFromParser(\n doc: ParserDoc,\n remoteUrl: string,\n config: CodeConnectConfig,\n): ParserDoc {\n let source = doc.source\n if (source) {\n try {\n const url = new URL(source)\n if (url.protocol !== 'http:' && url.protocol !== 'https:') {\n throw new Error('Invalid URL scheme')\n }\n } catch (e) {\n source = getRemoteFileUrl(source, remoteUrl, config.defaultBranch)\n }\n }\n\n // TODO This logic is duplicated in parser.ts parseDoc due to some type issues\n let figmaNode = doc.figmaNode\n if (config.documentUrlSubstitutions) {\n figmaNode = applyDocumentUrlSubstitutions(figmaNode, config.documentUrlSubstitutions)\n }\n\n return {\n ...doc,\n source,\n figmaNode,\n }\n}\n\nexport async function getCodeConnectObjects(\n cmd: BaseCommand & { label?: string },\n projectInfo: ProjectInfo,\n silent = false,\n isForMigration = false,\n): Promise<CodeConnectJSON[]> {\n if (cmd.jsonFile) {\n try {\n const docsFromJson = JSON.parse(fs.readFileSync(cmd.jsonFile, 'utf8'))\n // Strip internal fields from JSON input\n return docsFromJson.map((doc: CodeConnectJSON) => {\n const { _codeConnectFilePath, ...cleanDoc } = doc\n return cleanDoc as CodeConnectJSON\n })\n } catch (e) {\n logger.error('Failed to parse JSON file:', e)\n }\n }\n\n let codeConnectObjects: CodeConnectJSON[] = []\n\n // Parserless template files (.figma.ts/.figma.js with a leading url/component/source\n // directive) are handled directly below by parseRawFile and never need a native parser.\n // Identify them up front so we can decide whether the native parser is needed at all.\n const rawTemplateFiles = projectInfo.files.filter((f: string) => {\n // Suffix may be used by HTML / custom parsers\n const isPotentialRawTemplate =\n f.endsWith('.figma.js') ||\n f.endsWith('.figma.template.js') ||\n f.endsWith('.figma.ts') ||\n f.endsWith('.figma.template.ts')\n if (!isPotentialRawTemplate) return false\n try {\n return isRawTemplate(fs.readFileSync(f, 'utf-8'))\n } catch {\n return false\n }\n })\n\n // A project is \"template-only\" when it has at least one matched file and every\n // matched file is a parserless template. Such projects never need the native\n // parser, so skip invoking it. This avoids spawning a native build (e.g.\n // `swift run figma-swift`) that does no useful work and can fail outright — for\n // example a Swift package on macOS 12 whose `Figma` dependency requires macOS 13.\n // The native parser only ever produces docs from native source files\n // (.swift/.kt/.tsx etc.), which are disjoint from raw templates, so skipping it\n // here drops no docs.\n //\n // An empty file set is deliberately NOT treated as template-only: we leave the\n // existing behavior intact (the configured parser still runs), so e.g. a Swift\n // config that matches no files surfaces the same parser output as before.\n const rawTemplateFileSet = new Set(rawTemplateFiles)\n const isTemplateOnlyProject =\n rawTemplateFiles.length > 0 && projectInfo.files.every((f) => rawTemplateFileSet.has(f))\n\n if (isTemplateOnlyProject) {\n // Verbose-only: this is a diagnostic detail and must not alter normal output.\n if (projectInfo.config.parser && cmd.verbose) {\n logger.info('All Code Connect files are templates; skipping the native parser.')\n }\n } else if (projectInfo.config.parser === 'react') {\n codeConnectObjects = await getReactCodeConnectObjects(\n projectInfo as ProjectInfo<CodeConnectReactConfig>,\n cmd,\n silent,\n isForMigration,\n )\n } else if (projectInfo.config.parser === 'html') {\n codeConnectObjects = await getCodeConnectObjectsFromParseFn({\n parseFn: parseHtmlDoc,\n fileExtension: 'ts',\n projectInfo,\n cmd,\n silent,\n isForMigration,\n })\n } else if (projectInfo.config.parser) {\n const payload: ParseRequestPayload = {\n mode: 'PARSE',\n paths: projectInfo.files,\n config: { ...projectInfo.config, skipTemplateHelpers: isForMigration },\n verbose: cmd.verbose,\n }\n\n try {\n const stdout = await callParser(\n // We use `as` because the React parser makes the types difficult\n // TODO remove once React is an executable parser\n projectInfo.config as CodeConnectExecutableParserConfig,\n payload,\n projectInfo.absPath,\n )\n\n const parsed = ParseResponsePayload.parse(stdout)\n\n const { hasErrors } = handleMessages(parsed.messages)\n\n if (hasErrors) {\n exitWithError('Errors encountered calling parser, exiting')\n }\n\n codeConnectObjects = parsed.docs.map((doc) => ({\n ...transformDocFromParser(doc, projectInfo.remoteUrl, projectInfo.config),\n metadata: {\n cliVersion: require('../../package.json').version,\n },\n }))\n } catch (e) {\n if (cmd.verbose) {\n console.trace(e)\n\n // Don't say to enable verbose if the user has already enabled it.\n exitWithError(`Error calling parser: ${e}.`)\n } else {\n exitWithError(\n `Error returned from parser: ${fromError(\n e,\n )}. Try re-running the command with --verbose for more information.`,\n )\n }\n }\n }\n\n // At this point `codeConnectObjects` holds only docs produced by a native\n // parser (raw templates and batch files are appended below), so a non-empty\n // list is proof the project still relies on the deprecated parsers.\n if (codeConnectObjects.length > 0) {\n flagParserBasedCodeConnect()\n }\n\n if (rawTemplateFiles.length > 0) {\n // Resolve the label before parsing so language inference works correctly\n const resolvedLabel = cmd.label || projectInfo.config.label\n\n const rawTemplateDocs: CodeConnectJSON[] = []\n for (const file of rawTemplateFiles) {\n try {\n const doc = await parseRawFile(file, resolvedLabel, projectInfo.config, projectInfo.absPath)\n // Store the Code Connect file path for migration purposes\n doc._codeConnectFilePath = file\n\n if (!silent || cmd.verbose) {\n logger.info(success(file))\n }\n rawTemplateDocs.push(doc)\n } catch (e) {\n // A url-less file containing `codeProperties` is not Code Connect (e.g.\n // Make's code component property definitions). Log and skip it instead\n // of failing — never exit, not even with --exit-on-unreadable-files.\n if (e instanceof CodePropertiesError) {\n if (!silent || cmd.verbose) {\n logger.info(e.message)\n }\n continue\n }\n if (!silent || cmd.verbose) {\n logger.error(`❌ ${file}`)\n if (cmd.verbose) {\n console.trace(e)\n } else {\n logger.error(e instanceof Error ? e.message : String(e))\n }\n }\n if (cmd.exitOnUnreadableFiles) {\n logger.info('Exiting due to unreadable files')\n process.exit(1)\n }\n }\n }\n\n codeConnectObjects = codeConnectObjects.concat(rawTemplateDocs)\n }\n\n // Process batch files (.figma.batch.json)\n const batchFiles = projectInfo.files.filter((f: string) => f.endsWith('.figma.batch.json'))\n\n if (batchFiles.length > 0) {\n const resolvedLabel = cmd.label || projectInfo.config.label\n\n for (const file of batchFiles) {\n try {\n const docs = await parseBatchFile(\n file,\n resolvedLabel,\n projectInfo.config,\n projectInfo.absPath,\n )\n docs.forEach((doc) => {\n doc._codeConnectFilePath = file\n })\n codeConnectObjects = codeConnectObjects.concat(docs)\n if (!silent || cmd.verbose) {\n logger.info(success(`${file} (${docs.length} components)`))\n }\n } catch (e) {\n logger.error(`${file}: ${e}`)\n if (cmd.exitOnUnreadableFiles) {\n process.exit(1)\n }\n }\n }\n }\n\n if (cmd.label || projectInfo.config.label) {\n logger.info(`Using label \"${cmd.label || projectInfo.config.label}\"`)\n codeConnectObjects.forEach((doc) => {\n doc.label = cmd.label || projectInfo.config.label || doc.label\n })\n }\n\n if (projectInfo.config.language) {\n logger.info(`Using language \"${projectInfo.config.language}\"`)\n codeConnectObjects.forEach((doc) => {\n doc.language = projectInfo.config.language || doc.language\n })\n }\n\n return codeConnectObjects\n}\n\ntype GetCodeConnectObjectsArgs = {\n parseFn: ParseFn\n resolveImportsFn?: ResolveImportsFn\n fileExtension: string | string[]\n projectInfo: ProjectInfo<CodeConnectConfig>\n cmd: BaseCommand\n silent?: boolean\n isForMigration?: boolean\n}\n\n// React/Storybook and HTML parsers are handled as special cases for now, they\n// do not use the parser executable model but instead directly call a function\n// in the code base. We may want to transition them to that model in future.\nasync function getCodeConnectObjectsFromParseFn({\n /** The function used to parse a source file into a Code Connect object */\n parseFn,\n /** Optional function used to resolve imports in a source file */\n resolveImportsFn,\n /** The file extension to filter for when checking if files should be parsed */\n fileExtension,\n /** Project info */\n projectInfo,\n /** The commander command object */\n cmd,\n /** Silences console output */\n silent = false,\n /** Whether this parse is for the migrate command */\n isForMigration = false,\n}: GetCodeConnectObjectsArgs) {\n const codeConnectObjects: CodeConnectJSON[] = []\n\n const tsProgram = getTsProgram(projectInfo)\n const { files, remoteUrl, config, absPath } = projectInfo\n\n for (const file of files.filter((f: string) => isFigmaConnectFile(tsProgram, f, fileExtension))) {\n try {\n const docs = await parseCodeConnect({\n program: tsProgram,\n file,\n config,\n parseFn,\n resolveImportsFn,\n absPath,\n parseOptions: {\n repoUrl: remoteUrl,\n debug: cmd.verbose,\n silent,\n isForMigration,\n },\n })\n\n codeConnectObjects.push(...docs)\n if (!silent || cmd.verbose) {\n logger.info(success(file))\n }\n } catch (e) {\n if (!silent || cmd.verbose) {\n logger.error(`❌ ${file}`)\n if (e instanceof ParserError) {\n if (cmd.verbose) {\n console.trace(e)\n } else {\n logger.error(e.toString())\n }\n if (cmd.exitOnUnreadableFiles) {\n logger.info('Exiting due to unreadable files')\n process.exit(1)\n }\n } else {\n if (cmd.verbose) {\n console.trace(e)\n } else {\n logger.error(new InternalError(String(e)).toString())\n }\n }\n }\n }\n }\n\n return codeConnectObjects\n}\n\nasync function getReactCodeConnectObjects(\n projectInfo: ProjectInfo<CodeConnectReactConfig>,\n cmd: BaseCommand,\n silent = false,\n isForMigration = false,\n) {\n const codeConnectObjects = await getCodeConnectObjectsFromParseFn({\n parseFn: parseReactDoc,\n resolveImportsFn: findAndResolveImports,\n fileExtension: ['tsx', 'jsx'],\n projectInfo,\n cmd,\n silent,\n isForMigration,\n })\n\n const storybookCodeConnectObjects = await convertStorybookFiles({\n projectInfo: getReactProjectInfo(projectInfo),\n isForMigration,\n })\n\n const allCodeConnectObjects = codeConnectObjects.concat(storybookCodeConnectObjects)\n\n return allCodeConnectObjects\n}\n\nasync function handlePublish(\n cmd: BaseCommand & {\n skipValidation: boolean\n label: string\n batchSize: string\n includeTemplateFiles?: boolean\n force?: boolean\n },\n) {\n setupHandler(cmd)\n\n // Show deprecation warning if the flag is used\n if (cmd.includeTemplateFiles !== undefined) {\n logger.warn(\n '[Deprecated] The --include-template-files flag is no longer needed because template files are now included by default. ' +\n \"Please don't use this flag - it will be removed in a future version.\",\n )\n }\n\n let dir = getDir(cmd)\n const projectInfo = filterProjectInfoByFile(await getProjectInfo(dir, cmd.config), cmd.file)\n\n const codeConnectObjects = await getCodeConnectObjects(cmd, projectInfo)\n\n if (codeConnectObjects.length === 0) {\n logger.warn(\n `No Code Connect files found in ${dir} - Make sure you have configured \\`include\\` and \\`exclude\\` in your figma.config.json file correctly, or that you are running in a directory that contains Code Connect files.`,\n )\n process.exit(0)\n }\n\n if (cmd.dryRun) {\n logger.info(`Files that would be published:`)\n logger.info(codeConnectObjects.map((o) => `- ${o.component} (${o.figmaNode})`).join('\\n'))\n }\n\n const accessToken = getAccessTokenOrExit(cmd)\n\n if (cmd.skipValidation) {\n logger.info('Validation skipped')\n } else {\n logger.info('Validating Code Connect files...')\n var start = new Date().getTime()\n const valid = await validateDocs(\n cmd,\n accessToken,\n codeConnectObjects,\n cmd.apiUrl || projectInfo.config.apiUrl,\n )\n if (!valid) {\n exitWithFeedbackMessage(1)\n } else {\n var end = new Date().getTime()\n var time = end - start\n logger.info(`All Code Connect files are valid (${time}ms)`)\n }\n }\n\n if (cmd.dryRun) {\n logger.info(`Dry run complete`)\n process.exit(0)\n }\n\n let batchSize\n if (cmd.batchSize) {\n batchSize = parseInt(cmd.batchSize, 10)\n if (isNaN(batchSize)) {\n logger.error('Error: failed to parse batch-size. batch-size passed must be a number')\n exitWithFeedbackMessage(1)\n }\n }\n\n upload({\n accessToken,\n docs: codeConnectObjects,\n batchSize: batchSize,\n verbose: cmd.verbose,\n apiUrl: cmd.apiUrl || projectInfo.config.apiUrl,\n force: cmd.force,\n })\n}\n\nasync function handleUnpublish(cmd: BaseCommand & { node: string; label: string }) {\n setupHandler(cmd)\n\n let dir = getDir(cmd)\n\n if (cmd.dryRun) {\n logger.info(`Files that would be unpublished:`)\n }\n\n let nodesToDeleteRelevantInfo\n\n const projectInfo = filterProjectInfoByFile(await getProjectInfo(dir, cmd.config), cmd.file)\n\n if (cmd.node) {\n if (!cmd.label) {\n exitWithError('Label is required when specifying a node')\n }\n nodesToDeleteRelevantInfo = [{ figmaNode: cmd.node, label: cmd.label }]\n } else {\n const codeConnectObjects = await getCodeConnectObjects(cmd, projectInfo)\n\n nodesToDeleteRelevantInfo = codeConnectObjects.map((doc) => ({\n figmaNode: doc.figmaNode,\n label: cmd.label || projectInfo.config.label || doc.label,\n }))\n\n if (cmd.label || projectInfo.config.label) {\n logger.info(`Using label ${cmd.label || projectInfo.config.label}`)\n }\n\n if (cmd.dryRun) {\n logger.info(`Dry run complete`)\n process.exit(0)\n }\n }\n\n const accessToken = getAccessTokenOrExit(cmd)\n\n delete_docs({\n accessToken,\n docs: nodesToDeleteRelevantInfo,\n apiUrl: cmd.apiUrl || projectInfo.config.apiUrl,\n })\n}\n\nasync function handleParse(cmd: BaseCommand & { label: string; includeTemplateFiles?: boolean }) {\n setupHandler(cmd)\n\n // Show deprecation warning if the flag is used\n if (cmd.includeTemplateFiles !== undefined) {\n logger.warn(\n '[Deprecated] The --include-template-files flag is no longer needed because template files are now included by default. ' +\n \"Please don't use this flag - it will be removed in a future version.\",\n )\n }\n\n const dir = cmd.dir ?? process.cwd()\n const projectInfo = filterProjectInfoByFile(await getProjectInfo(dir, cmd.config), cmd.file)\n\n const codeConnectObjects = await getCodeConnectObjects(cmd, projectInfo)\n\n if (cmd.dryRun) {\n logger.info(`Dry run complete`)\n process.exit(0)\n }\n\n if (cmd.outFile) {\n fs.writeFileSync(cmd.outFile, JSON.stringify(codeConnectObjects, null, 2))\n logger.info(`Wrote Code Connect JSON to ${highlight(cmd.outFile)}`)\n } else {\n // don't format the output, so it can be piped to other commands\n console.log(JSON.stringify(codeConnectObjects, undefined, 2))\n }\n}\n\nasync function handleCreate(nodeUrl: string, cmd: BaseCommand) {\n setupHandler(cmd)\n\n const dir = cmd.dir ?? process.cwd()\n const projectInfo = await getProjectInfo(dir, cmd.config)\n\n if (cmd.dryRun) {\n process.exit(0)\n }\n\n const accessToken = getAccessTokenOrExit(cmd)\n\n return createCodeConnectFromUrl({\n accessToken,\n // We remove \\s to allow users to paste URLs inside quotes - the terminal\n // paste will add backslashes, which the quotes preserve, but expected user\n // behaviour would be to strip the quotes\n figmaNodeUrl: nodeUrl.replace(/\\\\/g, ''),\n outFile: cmd.outFile,\n outDir: cmd.outDir,\n projectInfo,\n cmd,\n })\n}\n/**\n * Migrate native parser Code Connect files to parserless. For each found doc:\n * - Replace helpers with figma.* versions\n * - Migrate v1 syntax to v2 (equivalent but more readable)\n * - Format as valid parserless file w/ url=\"\" comment\n * - Name collisions are skipped, unless file is from migration (in which case add \"_1\")\n */\nasync function handleMigrate(cmd: BaseCommand & { javascript?: boolean }) {\n setupHandler(cmd)\n\n const dir = cmd.dir ?? process.cwd()\n let projectInfo = filterProjectInfoByFile(await getProjectInfo(dir, cmd.config), cmd.file)\n const documentUrlSubstitutions = projectInfo.config.documentUrlSubstitutions\n\n // Clear documentUrlSubstitutions so we preserve original URLs in migrated templates\n projectInfo = {\n ...projectInfo,\n config: {\n ...projectInfo.config,\n documentUrlSubstitutions: {},\n },\n }\n\n // Parse the files to get Code Connect objects\n const allCodeConnectObjects = await getCodeConnectObjects(cmd, projectInfo, false, true)\n\n const allCodeConnectObjectsByFigmaUrl = groupCodeConnectObjectsByFigmaUrl(allCodeConnectObjects)\n const groupCount = Object.keys(allCodeConnectObjectsByFigmaUrl).length\n if (groupCount === 0) {\n exitWithError('No Code Connect objects found to migrate')\n }\n\n logger.info(`Found ${groupCount} component(s) to migrate`)\n let migratedCount = 0\n let batchMigratedCount = 0\n let skippedCount = 0\n const errors: string[] = []\n const batchMigrationWarnings: Array<{\n path: string\n connectionCount: number\n reason: string\n }> = []\n\n const filePathsCreated = new Set<string>()\n const gitRootPath = getGitRepoAbsolutePath(dir)\n const useTypeScript = !cmd.javascript\n const batchMigratedDocs = new Set<CodeConnectJSON>()\n const migratedDocs = new Set<CodeConnectJSON>()\n const batchDocsByPath = getBatchMigrationGroups(allCodeConnectObjects, {\n batchAll: cmd.batch === 'all',\n disabled: cmd.batch === 'none',\n })\n\n for (const [batchPath, docs] of batchDocsByPath) {\n const result = writeBatchTemplateFiles(docs, cmd.outDir, dir, {\n localSourcePath: batchPath,\n filePathsCreated,\n includeProps: cmd.includeProps,\n useTypeScript,\n })\n\n if (result.skipped) {\n batchMigrationWarnings.push({\n path: batchPath,\n connectionCount: docs.length,\n reason: result.reason || 'unable to create batch files',\n })\n } else {\n logger.info(\n `${success('✓')} Migrated ${result.componentCount} component(s) to batch ${highlight(\n result.batchPath || batchPath,\n )}`,\n )\n migratedCount += result.componentCount\n batchMigratedCount += result.componentCount\n docs.forEach((doc) => {\n batchMigratedDocs.add(doc)\n migratedDocs.add(doc)\n })\n }\n }\n\n const regularCodeConnectObjects = allCodeConnectObjects.filter(\n (doc) => !batchMigratedDocs.has(doc),\n )\n const codeConnectObjectsByFigmaUrl = groupCodeConnectObjectsByFigmaUrl(regularCodeConnectObjects)\n\n for (const [figmaUrl, group] of Object.entries(codeConnectObjectsByFigmaUrl)) {\n try {\n const hasVariants = group.variants.length > 0\n const representativeDoc = group.main ?? group.variants[0]\n if (!representativeDoc?.template) {\n logger.warn(`Skipping ${figmaUrl}: no template found`)\n skippedCount++\n continue\n }\n\n // Determine local source path for output location\n let localSourcePath: string | undefined\n\n if (representativeDoc._codeConnectFilePath) {\n // Use the Code Connect file path directly (preferred)\n localSourcePath = representativeDoc._codeConnectFilePath\n } else if (representativeDoc?.source && gitRootPath) {\n // Fallback: Convert remote file URL to local path\n const relativePath = convertRemoteFileUrlToRelativePath({\n remoteFileUrl: representativeDoc.source,\n gitRootPath,\n dir,\n })\n if (relativePath) {\n localSourcePath = path.resolve(dir, relativePath)\n }\n }\n\n const { outputPath, skipped } = hasVariants\n ? writeVariantTemplateFile(group, figmaUrl, cmd.outDir, dir, {\n localSourcePath,\n filePathsCreated,\n useTypeScript,\n includeProps: cmd.includeProps,\n })\n : writeTemplateFile(representativeDoc, cmd.outDir, dir, {\n localSourcePath,\n filePathsCreated,\n includeProps: cmd.includeProps,\n useTypeScript,\n })\n\n if (skipped) {\n logger.warn(`Skipping ${outputPath}: file already exists`)\n skippedCount++\n } else {\n logger.info(\n `${success('✓')} Migrated${hasVariants ? ' (with variants)' : ''} to ${highlight(\n outputPath,\n )}`,\n )\n migratedCount++\n if (group.main) migratedDocs.add(group.main)\n group.variants.forEach((doc) => migratedDocs.add(doc))\n }\n } catch (error) {\n const errorMsg = `Failed to migrate ${figmaUrl}: ${error}`\n logger.error(errorMsg)\n errors.push(errorMsg)\n }\n }\n\n if (migratedCount > 0) {\n if (cmd.outDir) {\n const configFilePath = path.join(cmd.outDir, 'figma.config.json')\n if (fs.existsSync(configFilePath)) {\n logger.warn(`Config file already exists at ${highlight(configFilePath)}`)\n } else {\n const { language: docLanguage, label } = allCodeConnectObjects[0]\n\n const language = getInferredLanguageForRaw(label, docLanguage)\n const config: CodeConnectParserlessConfig = {\n parser: undefined,\n include: [\n useTypeScript ? '**/*.figma.ts' : '**/*.figma.js',\n ...(batchMigratedCount > 0 ? ['**/*.figma.batch.json'] : []),\n ],\n language,\n label,\n ...(documentUrlSubstitutions && Object.keys(documentUrlSubstitutions).length > 0\n ? { documentUrlSubstitutions }\n : {}),\n }\n fs.writeFileSync(configFilePath, JSON.stringify({ codeConnect: config }, null, 2))\n logger.info(`${success('✓')} Wrote Figma config to ${highlight(configFilePath)}`)\n }\n }\n }\n\n if (batchMigrationWarnings.length > 0) {\n console.log('')\n logger.warn('Unable to migrate the following files to batch files:')\n batchMigrationWarnings.forEach((warning) => {\n logger.warn(\n `- ${highlight(warning.path)} (${\n warning.connectionCount\n } connections): ${formatBatchMigrationWarningReason(warning.reason)}`,\n )\n })\n console.log('')\n logger.warn(\n \"If you'd like to create batch files for these, we recommend using a coding agent. See example prompt: https://developers.figma.com/docs/code-connect/template-files/#migration-script\",\n )\n }\n\n if (cmd.delete) {\n const projectFilePaths = new Set(projectInfo.files.map((file) => path.resolve(file)))\n const docsBySourcePath = new Map<string, CodeConnectJSON[]>()\n\n for (const doc of allCodeConnectObjects) {\n if (!doc._codeConnectFilePath) continue\n\n const sourcePath = path.resolve(doc._codeConnectFilePath)\n if (!projectFilePaths.has(sourcePath)) continue\n\n const sourceDocs = docsBySourcePath.get(sourcePath) ?? []\n sourceDocs.push(doc)\n docsBySourcePath.set(sourcePath, sourceDocs)\n }\n\n for (const [sourcePath, sourceDocs] of docsBySourcePath) {\n if (!sourceDocs.every((doc) => migratedDocs.has(doc))) continue\n\n try {\n fs.unlinkSync(sourcePath)\n logger.info(`${success('✓')} Deleted ${highlight(sourcePath)}`)\n } catch (error) {\n const errorMsg = `Failed to delete ${sourcePath}: ${error}`\n logger.error(errorMsg)\n errors.push(errorMsg)\n }\n }\n }\n\n // Summary\n console.log('')\n logger.info(\n `Migration complete: ${success(`${migratedCount} migrated`)}, ${skippedCount} skipped`,\n )\n\n if (errors.length > 0) {\n console.log('')\n logger.error(`Encountered ${errors.length} error(s):`)\n errors.forEach((err) => logger.error(` ${err}`))\n process.exit(1)\n }\n\n if (migratedCount === 0) {\n exitWithError('No files were migrated')\n }\n}\n\nfunction formatBatchMigrationWarningReason(reason: string) {\n const strippedReason = reason.replace(/^Cannot batch:\\s*/i, '')\n return strippedReason.replace(/^(\\s*)(\\S)/, (_match, prefix: string, firstChar: string) => {\n return `${prefix}${firstChar.toUpperCase()}`\n })\n}\n"]}
1
+ {"version":3,"file":"connect.js","sourceRoot":"","sources":["../../src/commands/connect.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+GA,gEAmIC;AAED,wCAEC;AAED,oDAUC;AAED,wBAEC;AAED,oCAIC;AAuCD,sDAyOC;AA5hBD,qDAAsC;AACtC,4CAAmB;AACnB,mDAA+C;AAC/C,8CAA0C;AAC1C,sDAAoD;AACpD,8CAA4D;AAC5D,gDAU2B;AAC3B,+CAA8F;AAE9F,kDAA4D;AAC5D,wDAAoD;AACpD,6DAAwD;AACxD,sEAA0E;AAC1E,+DAAgD;AAChD,gFAA8F;AAE9F,gDAAuB;AACvB,+CAAmD;AACnD,gDAA2F;AAC3F,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Aa,KAAK,CAAC,EAAE,CAAC;QACxB,IAAA,uBAAa,EAAC,wBAAwB,CAAC,CAAA;IACzC,CAAC;AACH,CAAC;AAED,SAAS,iCAAiC,CAAC,MAAc;IACvD,MAAM,cAAc,GAAG,MAAM,CAAC,OAAO,CAAC,oBAAoB,EAAE,EAAE,CAAC,CAAA;IAC/D,OAAO,cAAc,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC,MAAM,EAAE,MAAc,EAAE,SAAiB,EAAE,EAAE;QACxF,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC,WAAW,EAAE,EAAE,CAAA;IAC9C,CAAC,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import * as commander from 'commander'\nimport fs from 'fs'\nimport { handlePreview } from './preview_utils'\nimport { upload } from '../connect/upload'\nimport { validateDocs } from '../connect/validation'\nimport { createCodeConnectFromUrl } from '../connect/create'\nimport {\n CodeConnectConfig,\n CodeConnectExecutableParserConfig,\n CodeConnectParserlessConfig,\n CodeConnectReactConfig,\n ProjectInfo,\n getProjectInfo,\n getReactProjectInfo,\n getRemoteFileUrl,\n getTsProgram,\n} from '../connect/project'\nimport { LogLevel, error, exitWithError, highlight, logger, success } from '../common/logging'\nimport { CodeConnectJSON } from '../connect/figma_connect'\nimport { convertStorybookFiles } from '../storybook/convert'\nimport { delete_docs } from '../connect/delete_docs'\nimport { runWizard } from '../connect/wizard/run_wizard'\nimport { callParser, handleMessages } from '../connect/parser_executables'\nimport { fromError } from 'zod-validation-error'\nimport { ParseRequestPayload, ParseResponsePayload } from '../connect/parser_executable_types'\nimport z from 'zod'\nimport path from 'path'\nimport { withUpdateCheck } from '../common/updates'\nimport { applyDocumentUrlSubstitutions, exitWithFeedbackMessage } from '../connect/helpers'\nimport { filterProjectInfoByFile } from './filter_project_info'\nimport { parseHtmlDoc } from '../html/parser'\nimport {\n InternalError,\n isFigmaConnectFile,\n parseCodeConnect,\n ParseFn,\n ParserError,\n ResolveImportsFn,\n} from '../connect/parser_common'\nimport { findAndResolveImports, parseReactDoc } from '../react/parser'\nimport { getInferredLanguageForRaw } from '../connect/label_language_mapping'\nimport {\n groupCodeConnectObjectsByFigmaUrl,\n writeTemplateFile,\n writeVariantTemplateFile,\n} from '../connect/migration_helpers'\nimport {\n getBatchMigrationGroups,\n writeBatchTemplateFiles,\n} from '../connect/migration_batch_helpers'\nimport { CodePropertiesError, isRawTemplate, parseRawFile } from '../connect/raw_templates'\nimport { parseBatchFile } from '../connect/batch_templates'\nimport { convertRemoteFileUrlToRelativePath } from '../connect/wizard/run_wizard'\nimport { getGitRepoAbsolutePath } from '../connect/project'\n\nexport type BaseCommand = commander.Command & {\n token: string\n verbose: boolean\n outFile: string\n outDir: string\n config: string\n dryRun: boolean\n dir: string\n file: string[]\n jsonFile: string\n skipUpdateCheck: boolean\n exitOnUnreadableFiles: boolean\n apiUrl?: string\n includeProps?: boolean\n batch?: BatchMigrationMode\n delete?: boolean\n all?: boolean\n maxCombinations?: string\n props?: string[]\n inspect?: boolean\n unique?: boolean\n}\n\ntype BatchMigrationMode = 'auto' | 'all' | 'none'\n\nfunction addBaseCommand(command: commander.Command, name: string, description: string) {\n const configuredCommand = command\n .command(name)\n .description(description)\n .usage('[options]')\n .option('-r --dir <dir>', 'directory to parse')\n .option(\n '-f --file <file...>',\n 'paths to one or more Code Connect files to process (space-separated)',\n )\n .option('-t --token <token>', 'figma access token')\n .option('-v --verbose', 'enable verbose logging for debugging')\n .option('-o --outFile <file>', 'specify a file to output generated Code Connect')\n .option('-o --outDir <dir>', 'specify a directory to output generated Code Connect')\n .option('-c --config <path>', 'path to a figma config file')\n .option('-a --api-url <url>', 'custom Figma API URL to use instead of https://api.figma.com/v1')\n .option('--skip-update-check', 'skips checking for an updated version of the Figma CLI')\n .option(\n '--exit-on-unreadable-files',\n 'exit if any Code Connect files cannot be parsed. We recommend using this option for CI/CD.',\n )\n .option('--dry-run', 'tests publishing without actually publishing')\n .addHelpText(\n 'before',\n 'For feedback or bugs, please raise an issue: https://github.com/figma/code-connect/issues',\n )\n\n\n return configuredCommand\n}\n\nexport function addConnectCommandToProgram(program: commander.Command) {\n // Main command, invoked with `figma connect`\n const connectCommand = addBaseCommand(program, 'connect', 'Figma Code Connect').action(\n withUpdateCheck(runWizard),\n )\n\n // Make shared base flags work on either side of the subcommand name —\n // `figma connect -v publish` and `figma connect publish -v` both honour -v.\n connectCommand.hook('preAction', (_thisCommand, actionCommand) => {\n Object.assign(actionCommand.opts(), actionCommand.optsWithGlobals())\n })\n\n // Sub-commands, invoked with e.g. `figma connect publish`\n addBaseCommand(\n connectCommand,\n 'publish',\n 'Run Code Connect locally to find any files that have figma connections and publish them to Figma. ' +\n 'By default this looks for a config file named \"figma.config.json\", and uses the `include` and `exclude` fields to determine which files to parse. ' +\n 'If no config file is found, this parses the current directory. An optional `--dir` flag can be used to specify a directory to parse.',\n )\n .option('--skip-validation', 'skip validation of Code Connect docs')\n .option('-l --label <label>', 'label to apply to the published files')\n .option(\n '-b --batch-size <batch_size>',\n 'optional batch size (in number of documents) to use when uploading. Use this if you hit \"request too large\" errors. See README for more information.',\n )\n .option(\n '--include-template-files',\n '(Deprecated) No longer needed - template files are included by default. Will be removed in a future version.',\n )\n .option(\n '--force',\n 'overwrite existing UI-created Code Connect mappings if they conflict with the files being published',\n )\n .action(withUpdateCheck(handlePublish))\n\n addBaseCommand(\n connectCommand,\n 'unpublish',\n 'Run to find any files that have figma connections and unpublish them from Figma. ' +\n 'By default this looks for a config file named \"figma.config.json\", and uses the `include` and `exclude` fields to determine which files to parse. ' +\n 'If no config file is found, this parses the current directory. An optional `--dir` flag can be used to specify a directory to parse. ' +\n 'Alternatively, use `--node` and `--label` to unpublish a specific component.',\n )\n .option(\n '--node <link_to_node>',\n 'specify the node to unpublish. This will unpublish for the specified label.',\n )\n .option('-l --label <label>', 'label to unpublish for')\n .action(withUpdateCheck(handleUnpublish))\n\n addBaseCommand(\n connectCommand,\n 'parse',\n 'Run Code Connect locally to find any files that have figma connections, then converts them to JSON and outputs to stdout.',\n )\n .option('-l --label <label>', 'label to apply to the parsed files')\n .option(\n '--include-template-files',\n '(Deprecated) No longer needed - template files are included by default. Will be removed in a future version.',\n )\n .action(withUpdateCheck(handleParse))\n\n addBaseCommand(\n connectCommand,\n 'create',\n 'Generate a Code Connect file with boilerplate in the current directory for a Figma node URL',\n )\n .argument('<figma-node-url>', 'Figma node URL to create the Code Connect file from')\n .action(withUpdateCheck(handleCreate))\n\n addBaseCommand(\n connectCommand,\n 'migrate',\n 'Parse Code Connect files and migrate their templates into .figma.ts or .figma.js files that can be published directly without parsing.',\n )\n .option(\n '--include-props',\n 'preserve __props metadata blocks in migrated templates (removed by default). Use if your templates use the React .getProps() or .render() modifiers, or read executeTemplate().metadata.__props from the migrated components',\n )\n .option(\n '--javascript',\n 'output migrated templates as JavaScript (.figma.js) instead of TypeScript (.figma.ts)',\n )\n .option('--delete', 'delete source Code Connect files after they are successfully migrated')\n .addOption(\n new commander.Option(\n '--batch <mode>',\n 'batch migration mode: auto attempts files with 10 or more Code Connect docs; all attempts every source file; none disables batch migration',\n )\n .choices(['auto', 'all', 'none'])\n .default('auto'),\n )\n .action(withUpdateCheck(handleMigrate))\n\n addBaseCommand(\n connectCommand,\n 'preview',\n 'Preview how Code Connect snippets will render in the Figma inspect panel',\n )\n .argument(\n '[files...]',\n 'Code Connect files to preview (e.g., Button.figma.tsx). Leave empty to preview all files.',\n )\n .option('--output <format>', 'Output format: table (default) or json', 'table')\n .option(\n '--all',\n \"Render the snippet for every possible combination of the component's boolean and variant properties. Requires a single component file argument.\",\n )\n .option(\n '--max-combinations <number>',\n 'Maximum number of property combinations to render with --all or --unique. Defaults to 500 and cannot exceed 500.',\n )\n .option(\n '--props <pairs...>',\n 'Render a single property combination with the given property values, e.g. --props Variant=Primary \"Has Icon Start=true\". Each pair is a separate space-separated argument (quote a pair only if its name or value contains spaces). Prefix a pair with a type (BOOLEAN/TEXT/VARIANT/INSTANCE_SWAP) to disambiguate properties that share a name but differ in type, e.g. \"BOOLEAN:textMsg=false\" \"TEXT:textMsg=Hello\". Unspecified properties use their defaults. Cannot be combined with --all.',\n )\n .option(\n '--inspect',\n \"List the component's properties/variants (name, type, options, default) without rendering. Respects --output.\",\n )\n .addOption(\n // Implies --all, so `--unique` is meaningful on its own and there is no\n // way to ask for deduplication without asking for the combinations it\n // dedupes. Downstream code only ever reads `all`.\n new commander.Option(\n '--unique',\n 'Implies --all, but folds property combinations that render identical output into a single result (reported with the count of combinations it covers). Useful when boolean/variant axes do not change the rendered snippet.',\n ).implies({ all: true }),\n )\n .action(withUpdateCheck(handlePreview))\n}\n\nexport function getAccessToken(cmd: BaseCommand) {\n return cmd.token ?? process.env.FIGMA_ACCESS_TOKEN\n}\n\nexport function getAccessTokenOrExit(cmd: BaseCommand) {\n const token = getAccessToken(cmd)\n\n if (!token) {\n exitWithError(\n `Couldn't find a Figma access token. Please provide one with \\`--token <access_token>\\` or set the FIGMA_ACCESS_TOKEN environment variable`,\n )\n }\n\n return token\n}\n\nexport function getDir(cmd: BaseCommand) {\n return cmd.dir ?? process.cwd()\n}\n\nexport function setupHandler(cmd: BaseCommand) {\n if (cmd.verbose) {\n logger.setLogLevel(LogLevel.Debug)\n }\n}\n\ntype ParserDoc = z.infer<typeof ParseResponsePayload>['docs'][0]\n\nfunction transformDocFromParser(\n doc: ParserDoc,\n remoteUrl: string,\n config: CodeConnectConfig,\n): ParserDoc {\n let source = doc.source\n if (source) {\n try {\n const url = new URL(source)\n if (url.protocol !== 'http:' && url.protocol !== 'https:') {\n throw new Error('Invalid URL scheme')\n }\n } catch (e) {\n source = getRemoteFileUrl(source, remoteUrl, config.defaultBranch)\n }\n }\n\n // TODO This logic is duplicated in parser.ts parseDoc due to some type issues\n let figmaNode = doc.figmaNode\n if (config.documentUrlSubstitutions) {\n figmaNode = applyDocumentUrlSubstitutions(figmaNode, config.documentUrlSubstitutions)\n }\n\n return {\n ...doc,\n source,\n figmaNode,\n }\n}\n\ntype GetCodeConnectObjectsOptions = {\n silent?: boolean\n parserMode?: 'forbid' | 'migration' | 'exempt'\n}\n\nexport async function getCodeConnectObjects(\n cmd: BaseCommand & { label?: string },\n projectInfo: ProjectInfo,\n { silent = false, parserMode = 'forbid' }: GetCodeConnectObjectsOptions = {},\n): Promise<CodeConnectJSON[]> {\n const isForMigration = parserMode === 'migration'\n let isParserExempt = parserMode === 'exempt'\n // Keep legacy parser coverage under Jest. Parser-removal tests explicitly disable this\n // opt-in so they continue to exercise the public CLI behavior.\n const isParserExemptForTests =\n process.env.NODE_ENV === 'test' && process.env.CODE_CONNECT_TEST_ALLOW_PARSERS === '1'\n if (cmd.jsonFile) {\n try {\n const docsFromJson = JSON.parse(fs.readFileSync(cmd.jsonFile, 'utf8'))\n // Strip internal fields from JSON input\n return docsFromJson.map((doc: CodeConnectJSON) => {\n const { _codeConnectFilePath, ...cleanDoc } = doc\n return cleanDoc as CodeConnectJSON\n })\n } catch (e) {\n logger.error('Failed to parse JSON file:', e)\n }\n }\n\n let codeConnectObjects: CodeConnectJSON[] = []\n\n // Parserless template files (.figma.ts/.figma.js with a leading url/component/source\n // directive) are handled directly below by parseRawFile and never need a native parser.\n // Identify them up front so we can decide whether the native parser is needed at all.\n const rawTemplateFiles = projectInfo.files.filter((f: string) => {\n // Suffix may be used by HTML / custom parsers\n const isPotentialRawTemplate =\n f.endsWith('.figma.js') ||\n f.endsWith('.figma.template.js') ||\n f.endsWith('.figma.ts') ||\n f.endsWith('.figma.template.ts')\n if (!isPotentialRawTemplate) return false\n try {\n return isRawTemplate(fs.readFileSync(f, 'utf-8'))\n } catch {\n return false\n }\n })\n\n // A project is \"template-only\" when it has at least one matched file and every\n // matched file is a parserless template. Such projects never need the native\n // parser, so skip invoking it. This avoids spawning a native build (e.g.\n // `swift run figma-swift`) that does no useful work and can fail outright — for\n // example a Swift package on macOS 12 whose `Figma` dependency requires macOS 13.\n // The native parser only ever produces docs from native source files\n // (.swift/.kt/.tsx etc.), which are disjoint from raw templates, so skipping it\n // here drops no docs.\n //\n // An empty file set is deliberately NOT treated as template-only. Migration\n // and exempt callers still invoke the configured parser, while other commands reject\n // the parser configuration consistently even when its globs currently match no files.\n const batchFiles = projectInfo.files.filter((f: string) => f.endsWith('.figma.batch.json'))\n const parserlessFileSet = new Set([...rawTemplateFiles, ...batchFiles])\n const isTemplateOnlyProject =\n parserlessFileSet.size > 0 && projectInfo.files.every((f) => parserlessFileSet.has(f))\n\n if (\n !isParserExempt &&\n parserMode === 'forbid' &&\n !isParserExemptForTests &&\n !isTemplateOnlyProject &&\n projectInfo.config.parser\n ) {\n exitWithError(`Framework-specific parsers are no longer supported in Code Connect CLI v2.\n\nRun \\`figma connect migrate\\` to convert parser-based Code Connect to template files:\nhttps://developers.figma.com/docs/code-connect/templates-migration-guide/\n\nAlternatively, if you're not able to migrate right now, continue using Code Connect v1:\nnpm install --save-dev @figma/code-connect@1\n\nIf this project has already been migrated, remove the \\`parser\\` setting from figma.config.json or update its \\`include\\` patterns to match only template files.`)\n }\n\n if (isTemplateOnlyProject) {\n // Verbose-only: this is a diagnostic detail and must not alter normal output.\n if (projectInfo.config.parser && cmd.verbose) {\n logger.info('All Code Connect files are templates; skipping the native parser.')\n }\n } else if (projectInfo.config.parser === 'react') {\n codeConnectObjects = await getReactCodeConnectObjects(\n projectInfo as ProjectInfo<CodeConnectReactConfig>,\n cmd,\n silent,\n isForMigration,\n )\n } else if (projectInfo.config.parser === 'html') {\n codeConnectObjects = await getCodeConnectObjectsFromParseFn({\n parseFn: parseHtmlDoc,\n fileExtension: 'ts',\n projectInfo,\n cmd,\n silent,\n isForMigration,\n })\n } else if (projectInfo.config.parser) {\n const payload: ParseRequestPayload = {\n mode: 'PARSE',\n paths: projectInfo.files,\n config: { ...projectInfo.config, skipTemplateHelpers: isForMigration },\n verbose: cmd.verbose,\n }\n\n try {\n const stdout = await callParser(\n // We use `as` because the React parser makes the types difficult\n // TODO remove once React is an executable parser\n projectInfo.config as CodeConnectExecutableParserConfig,\n payload,\n projectInfo.absPath,\n )\n\n const parsed = ParseResponsePayload.parse(stdout)\n\n const { hasErrors } = handleMessages(parsed.messages)\n\n if (hasErrors) {\n exitWithError('Errors encountered calling parser, exiting')\n }\n\n codeConnectObjects = parsed.docs.map((doc) => ({\n ...transformDocFromParser(doc, projectInfo.remoteUrl, projectInfo.config),\n metadata: {\n cliVersion: require('../../package.json').version,\n },\n }))\n } catch (e) {\n if (cmd.verbose) {\n console.trace(e)\n\n // Don't say to enable verbose if the user has already enabled it.\n exitWithError(`Error calling parser: ${e}.`)\n } else {\n exitWithError(\n `Error returned from parser: ${fromError(\n e,\n )}. Try re-running the command with --verbose for more information.`,\n )\n }\n }\n }\n\n if (rawTemplateFiles.length > 0) {\n // Resolve the label before parsing so language inference works correctly\n const resolvedLabel = cmd.label || projectInfo.config.label\n\n const rawTemplateDocs: CodeConnectJSON[] = []\n for (const file of rawTemplateFiles) {\n try {\n const doc = await parseRawFile(file, resolvedLabel, projectInfo.config, projectInfo.absPath)\n // Store the Code Connect file path for migration purposes\n doc._codeConnectFilePath = file\n\n if (!silent || cmd.verbose) {\n logger.info(success(file))\n }\n rawTemplateDocs.push(doc)\n } catch (e) {\n // A url-less file containing `codeProperties` is not Code Connect (e.g.\n // Make's code component property definitions). Log and skip it instead\n // of failing — never exit, not even with --exit-on-unreadable-files.\n if (e instanceof CodePropertiesError) {\n if (!silent || cmd.verbose) {\n logger.info(e.message)\n }\n continue\n }\n if (!silent || cmd.verbose) {\n logger.error(`❌ ${file}`)\n if (cmd.verbose) {\n console.trace(e)\n } else {\n logger.error(e instanceof Error ? e.message : String(e))\n }\n }\n if (cmd.exitOnUnreadableFiles) {\n logger.info('Exiting due to unreadable files')\n process.exit(1)\n }\n }\n }\n\n codeConnectObjects = codeConnectObjects.concat(rawTemplateDocs)\n }\n\n // Process batch files (.figma.batch.json)\n if (batchFiles.length > 0) {\n const resolvedLabel = cmd.label || projectInfo.config.label\n\n for (const file of batchFiles) {\n try {\n const docs = await parseBatchFile(\n file,\n resolvedLabel,\n projectInfo.config,\n projectInfo.absPath,\n )\n docs.forEach((doc) => {\n doc._codeConnectFilePath = file\n })\n codeConnectObjects = codeConnectObjects.concat(docs)\n if (!silent || cmd.verbose) {\n logger.info(success(`${file} (${docs.length} components)`))\n }\n } catch (e) {\n logger.error(`${file}: ${e}`)\n if (cmd.exitOnUnreadableFiles) {\n process.exit(1)\n }\n }\n }\n }\n\n if (cmd.label || projectInfo.config.label) {\n logger.info(`Using label \"${cmd.label || projectInfo.config.label}\"`)\n codeConnectObjects.forEach((doc) => {\n doc.label = cmd.label || projectInfo.config.label || doc.label\n })\n }\n\n if (projectInfo.config.language) {\n logger.info(`Using language \"${projectInfo.config.language}\"`)\n codeConnectObjects.forEach((doc) => {\n doc.language = projectInfo.config.language || doc.language\n })\n }\n\n return codeConnectObjects\n}\n\ntype GetCodeConnectObjectsArgs = {\n parseFn: ParseFn\n resolveImportsFn?: ResolveImportsFn\n fileExtension: string | string[]\n projectInfo: ProjectInfo<CodeConnectConfig>\n cmd: BaseCommand\n silent?: boolean\n isForMigration?: boolean\n}\n\n// React/Storybook and HTML parsers are handled as special cases for now, they\n// do not use the parser executable model but instead directly call a function\n// in the code base. We may want to transition them to that model in future.\nasync function getCodeConnectObjectsFromParseFn({\n /** The function used to parse a source file into a Code Connect object */\n parseFn,\n /** Optional function used to resolve imports in a source file */\n resolveImportsFn,\n /** The file extension to filter for when checking if files should be parsed */\n fileExtension,\n /** Project info */\n projectInfo,\n /** The commander command object */\n cmd,\n /** Silences console output */\n silent = false,\n /** Whether this parse is for the migrate command */\n isForMigration = false,\n}: GetCodeConnectObjectsArgs) {\n const codeConnectObjects: CodeConnectJSON[] = []\n\n const tsProgram = getTsProgram(projectInfo)\n const { files, remoteUrl, config, absPath } = projectInfo\n\n for (const file of files.filter((f: string) => isFigmaConnectFile(tsProgram, f, fileExtension))) {\n try {\n const docs = await parseCodeConnect({\n program: tsProgram,\n file,\n config,\n parseFn,\n resolveImportsFn,\n absPath,\n parseOptions: {\n repoUrl: remoteUrl,\n debug: cmd.verbose,\n silent,\n isForMigration,\n },\n })\n\n codeConnectObjects.push(...docs)\n if (!silent || cmd.verbose) {\n logger.info(success(file))\n }\n } catch (e) {\n if (!silent || cmd.verbose) {\n logger.error(`❌ ${file}`)\n if (e instanceof ParserError) {\n if (cmd.verbose) {\n console.trace(e)\n } else {\n logger.error(e.toString())\n }\n if (cmd.exitOnUnreadableFiles) {\n logger.info('Exiting due to unreadable files')\n process.exit(1)\n }\n } else {\n if (cmd.verbose) {\n console.trace(e)\n } else {\n logger.error(new InternalError(String(e)).toString())\n }\n }\n }\n }\n }\n\n return codeConnectObjects\n}\n\nasync function getReactCodeConnectObjects(\n projectInfo: ProjectInfo<CodeConnectReactConfig>,\n cmd: BaseCommand,\n silent = false,\n isForMigration = false,\n) {\n const codeConnectObjects = await getCodeConnectObjectsFromParseFn({\n parseFn: parseReactDoc,\n resolveImportsFn: findAndResolveImports,\n fileExtension: ['tsx', 'jsx'],\n projectInfo,\n cmd,\n silent,\n isForMigration,\n })\n\n const storybookCodeConnectObjects = await convertStorybookFiles({\n projectInfo: getReactProjectInfo(projectInfo),\n isForMigration,\n })\n\n const allCodeConnectObjects = codeConnectObjects.concat(storybookCodeConnectObjects)\n\n return allCodeConnectObjects\n}\n\nasync function handlePublish(\n cmd: BaseCommand & {\n skipValidation: boolean\n label: string\n batchSize: string\n includeTemplateFiles?: boolean\n force?: boolean\n },\n) {\n setupHandler(cmd)\n\n // Show deprecation warning if the flag is used\n if (cmd.includeTemplateFiles !== undefined) {\n logger.warn(\n '[Deprecated] The --include-template-files flag is no longer needed because template files are now included by default. ' +\n \"Please don't use this flag - it will be removed in a future version.\",\n )\n }\n\n let dir = getDir(cmd)\n const projectInfo = filterProjectInfoByFile(await getProjectInfo(dir, cmd.config), cmd.file)\n\n const codeConnectObjects = await getCodeConnectObjects(cmd, projectInfo)\n\n if (codeConnectObjects.length === 0) {\n logger.warn(\n `No Code Connect files found in ${dir} - Make sure you have configured \\`include\\` and \\`exclude\\` in your figma.config.json file correctly, or that you are running in a directory that contains Code Connect files.`,\n )\n process.exit(0)\n }\n\n if (cmd.dryRun) {\n logger.info(`Files that would be published:`)\n logger.info(codeConnectObjects.map((o) => `- ${o.component} (${o.figmaNode})`).join('\\n'))\n }\n\n const accessToken = getAccessTokenOrExit(cmd)\n\n if (cmd.skipValidation) {\n logger.info('Validation skipped')\n } else {\n logger.info('Validating Code Connect files...')\n var start = new Date().getTime()\n const valid = await validateDocs(\n cmd,\n accessToken,\n codeConnectObjects,\n cmd.apiUrl || projectInfo.config.apiUrl,\n )\n if (!valid) {\n exitWithFeedbackMessage(1)\n } else {\n var end = new Date().getTime()\n var time = end - start\n logger.info(`All Code Connect files are valid (${time}ms)`)\n }\n }\n\n if (cmd.dryRun) {\n logger.info(`Dry run complete`)\n process.exit(0)\n }\n\n let batchSize\n if (cmd.batchSize) {\n batchSize = parseInt(cmd.batchSize, 10)\n if (isNaN(batchSize)) {\n logger.error('Error: failed to parse batch-size. batch-size passed must be a number')\n exitWithFeedbackMessage(1)\n }\n }\n\n upload({\n accessToken,\n docs: codeConnectObjects,\n batchSize: batchSize,\n verbose: cmd.verbose,\n apiUrl: cmd.apiUrl || projectInfo.config.apiUrl,\n force: cmd.force,\n })\n}\n\nasync function handleUnpublish(cmd: BaseCommand & { node: string; label: string }) {\n setupHandler(cmd)\n\n let dir = getDir(cmd)\n\n if (cmd.dryRun) {\n logger.info(`Files that would be unpublished:`)\n }\n\n let nodesToDeleteRelevantInfo\n\n const projectInfo = filterProjectInfoByFile(await getProjectInfo(dir, cmd.config), cmd.file)\n\n if (cmd.node) {\n if (!cmd.label) {\n exitWithError('Label is required when specifying a node')\n }\n nodesToDeleteRelevantInfo = [{ figmaNode: cmd.node, label: cmd.label }]\n } else {\n const codeConnectObjects = await getCodeConnectObjects(cmd, projectInfo, {\n parserMode: 'exempt',\n })\n\n nodesToDeleteRelevantInfo = codeConnectObjects.map((doc) => ({\n figmaNode: doc.figmaNode,\n label: cmd.label || projectInfo.config.label || doc.label,\n }))\n\n if (cmd.label || projectInfo.config.label) {\n logger.info(`Using label ${cmd.label || projectInfo.config.label}`)\n }\n\n if (cmd.dryRun) {\n logger.info(`Dry run complete`)\n process.exit(0)\n }\n }\n\n const accessToken = getAccessTokenOrExit(cmd)\n\n delete_docs({\n accessToken,\n docs: nodesToDeleteRelevantInfo,\n apiUrl: cmd.apiUrl || projectInfo.config.apiUrl,\n })\n}\n\nasync function handleParse(cmd: BaseCommand & { label: string; includeTemplateFiles?: boolean }) {\n setupHandler(cmd)\n\n // Show deprecation warning if the flag is used\n if (cmd.includeTemplateFiles !== undefined) {\n logger.warn(\n '[Deprecated] The --include-template-files flag is no longer needed because template files are now included by default. ' +\n \"Please don't use this flag - it will be removed in a future version.\",\n )\n }\n\n const dir = cmd.dir ?? process.cwd()\n const projectInfo = filterProjectInfoByFile(await getProjectInfo(dir, cmd.config), cmd.file)\n\n const codeConnectObjects = await getCodeConnectObjects(cmd, projectInfo)\n\n if (cmd.dryRun) {\n logger.info(`Dry run complete`)\n process.exit(0)\n }\n\n if (cmd.outFile) {\n fs.writeFileSync(cmd.outFile, JSON.stringify(codeConnectObjects, null, 2))\n logger.info(`Wrote Code Connect JSON to ${highlight(cmd.outFile)}`)\n } else {\n // don't format the output, so it can be piped to other commands\n console.log(JSON.stringify(codeConnectObjects, undefined, 2))\n }\n}\n\nasync function handleCreate(nodeUrl: string, cmd: BaseCommand) {\n setupHandler(cmd)\n\n const dir = cmd.dir ?? process.cwd()\n const projectInfo = await getProjectInfo(dir, cmd.config)\n\n if (cmd.dryRun) {\n process.exit(0)\n }\n\n const accessToken = getAccessTokenOrExit(cmd)\n\n return createCodeConnectFromUrl({\n accessToken,\n // We remove \\s to allow users to paste URLs inside quotes - the terminal\n // paste will add backslashes, which the quotes preserve, but expected user\n // behaviour would be to strip the quotes\n figmaNodeUrl: nodeUrl.replace(/\\\\/g, ''),\n outFile: cmd.outFile,\n outDir: cmd.outDir,\n projectInfo,\n cmd,\n })\n}\n/**\n * Migrate native parser Code Connect files to parserless. For each found doc:\n * - Replace helpers with figma.* versions\n * - Migrate v1 syntax to v2 (equivalent but more readable)\n * - Format as valid parserless file w/ url=\"\" comment\n * - Name collisions are skipped, unless file is from migration (in which case add \"_1\")\n */\nasync function handleMigrate(cmd: BaseCommand & { javascript?: boolean }) {\n setupHandler(cmd)\n\n const dir = cmd.dir ?? process.cwd()\n let projectInfo = filterProjectInfoByFile(await getProjectInfo(dir, cmd.config), cmd.file)\n const documentUrlSubstitutions = projectInfo.config.documentUrlSubstitutions\n\n // Clear documentUrlSubstitutions so we preserve original URLs in migrated templates\n projectInfo = {\n ...projectInfo,\n config: {\n ...projectInfo.config,\n documentUrlSubstitutions: {},\n },\n }\n\n // Parse the files to get Code Connect objects\n const allCodeConnectObjects = await getCodeConnectObjects(cmd, projectInfo, {\n parserMode: 'migration',\n })\n\n const allCodeConnectObjectsByFigmaUrl = groupCodeConnectObjectsByFigmaUrl(allCodeConnectObjects)\n const groupCount = Object.keys(allCodeConnectObjectsByFigmaUrl).length\n if (groupCount === 0) {\n exitWithError('No Code Connect objects found to migrate')\n }\n\n logger.info(`Found ${groupCount} component(s) to migrate`)\n let migratedCount = 0\n let batchMigratedCount = 0\n let skippedCount = 0\n const errors: string[] = []\n const batchMigrationWarnings: Array<{\n path: string\n connectionCount: number\n reason: string\n }> = []\n\n const filePathsCreated = new Set<string>()\n const gitRootPath = getGitRepoAbsolutePath(dir)\n const useTypeScript = !cmd.javascript\n const batchMigratedDocs = new Set<CodeConnectJSON>()\n const migratedDocs = new Set<CodeConnectJSON>()\n const batchDocsByPath = getBatchMigrationGroups(allCodeConnectObjects, {\n batchAll: cmd.batch === 'all',\n disabled: cmd.batch === 'none',\n })\n\n for (const [batchPath, docs] of batchDocsByPath) {\n const result = writeBatchTemplateFiles(docs, cmd.outDir, dir, {\n localSourcePath: batchPath,\n filePathsCreated,\n includeProps: cmd.includeProps,\n useTypeScript,\n })\n\n if (result.skipped) {\n batchMigrationWarnings.push({\n path: batchPath,\n connectionCount: docs.length,\n reason: result.reason || 'unable to create batch files',\n })\n } else {\n logger.info(\n `${success('✓')} Migrated ${result.componentCount} component(s) to batch ${highlight(\n result.batchPath || batchPath,\n )}`,\n )\n migratedCount += result.componentCount\n batchMigratedCount += result.componentCount\n docs.forEach((doc) => {\n batchMigratedDocs.add(doc)\n migratedDocs.add(doc)\n })\n }\n }\n\n const regularCodeConnectObjects = allCodeConnectObjects.filter(\n (doc) => !batchMigratedDocs.has(doc),\n )\n const codeConnectObjectsByFigmaUrl = groupCodeConnectObjectsByFigmaUrl(regularCodeConnectObjects)\n\n for (const [figmaUrl, group] of Object.entries(codeConnectObjectsByFigmaUrl)) {\n try {\n const hasVariants = group.variants.length > 0\n const representativeDoc = group.main ?? group.variants[0]\n if (!representativeDoc?.template) {\n logger.warn(`Skipping ${figmaUrl}: no template found`)\n skippedCount++\n continue\n }\n\n // Determine local source path for output location\n let localSourcePath: string | undefined\n\n if (representativeDoc._codeConnectFilePath) {\n // Use the Code Connect file path directly (preferred)\n localSourcePath = representativeDoc._codeConnectFilePath\n } else if (representativeDoc?.source && gitRootPath) {\n // Fallback: Convert remote file URL to local path\n const relativePath = convertRemoteFileUrlToRelativePath({\n remoteFileUrl: representativeDoc.source,\n gitRootPath,\n dir,\n })\n if (relativePath) {\n localSourcePath = path.resolve(dir, relativePath)\n }\n }\n\n const { outputPath, skipped } = hasVariants\n ? writeVariantTemplateFile(group, figmaUrl, cmd.outDir, dir, {\n localSourcePath,\n filePathsCreated,\n useTypeScript,\n includeProps: cmd.includeProps,\n })\n : writeTemplateFile(representativeDoc, cmd.outDir, dir, {\n localSourcePath,\n filePathsCreated,\n includeProps: cmd.includeProps,\n useTypeScript,\n })\n\n if (skipped) {\n logger.warn(`Skipping ${outputPath}: file already exists`)\n skippedCount++\n } else {\n logger.info(\n `${success('✓')} Migrated${hasVariants ? ' (with variants)' : ''} to ${highlight(\n outputPath,\n )}`,\n )\n migratedCount++\n if (group.main) migratedDocs.add(group.main)\n group.variants.forEach((doc) => migratedDocs.add(doc))\n }\n } catch (error) {\n const errorMsg = `Failed to migrate ${figmaUrl}: ${error}`\n logger.error(errorMsg)\n errors.push(errorMsg)\n }\n }\n\n if (migratedCount > 0) {\n if (cmd.outDir) {\n const configFilePath = path.join(cmd.outDir, 'figma.config.json')\n if (fs.existsSync(configFilePath)) {\n logger.warn(`Config file already exists at ${highlight(configFilePath)}`)\n } else {\n const { language: docLanguage, label } = allCodeConnectObjects[0]\n\n const language = getInferredLanguageForRaw(label, docLanguage)\n const config: CodeConnectParserlessConfig = {\n parser: undefined,\n include: [\n useTypeScript ? '**/*.figma.ts' : '**/*.figma.js',\n ...(batchMigratedCount > 0 ? ['**/*.figma.batch.json'] : []),\n ],\n language,\n label,\n ...(documentUrlSubstitutions && Object.keys(documentUrlSubstitutions).length > 0\n ? { documentUrlSubstitutions }\n : {}),\n }\n fs.writeFileSync(configFilePath, JSON.stringify({ codeConnect: config }, null, 2))\n logger.info(`${success('✓')} Wrote Figma config to ${highlight(configFilePath)}`)\n }\n }\n }\n\n if (batchMigrationWarnings.length > 0) {\n console.log('')\n logger.warn('Unable to migrate the following files to batch files:')\n batchMigrationWarnings.forEach((warning) => {\n logger.warn(\n `- ${highlight(warning.path)} (${\n warning.connectionCount\n } connections): ${formatBatchMigrationWarningReason(warning.reason)}`,\n )\n })\n console.log('')\n logger.warn(\n \"If you'd like to create batch files for these, we recommend using a coding agent. See example prompt: https://developers.figma.com/docs/code-connect/template-files/#migration-script\",\n )\n }\n\n if (cmd.delete) {\n const projectFilePaths = new Set(projectInfo.files.map((file) => path.resolve(file)))\n const docsBySourcePath = new Map<string, CodeConnectJSON[]>()\n\n for (const doc of allCodeConnectObjects) {\n if (!doc._codeConnectFilePath) continue\n\n const sourcePath = path.resolve(doc._codeConnectFilePath)\n if (!projectFilePaths.has(sourcePath)) continue\n\n const sourceDocs = docsBySourcePath.get(sourcePath) ?? []\n sourceDocs.push(doc)\n docsBySourcePath.set(sourcePath, sourceDocs)\n }\n\n for (const [sourcePath, sourceDocs] of docsBySourcePath) {\n if (!sourceDocs.every((doc) => migratedDocs.has(doc))) continue\n\n try {\n fs.unlinkSync(sourcePath)\n logger.info(`${success('✓')} Deleted ${highlight(sourcePath)}`)\n } catch (error) {\n const errorMsg = `Failed to delete ${sourcePath}: ${error}`\n logger.error(errorMsg)\n errors.push(errorMsg)\n }\n }\n }\n\n // Summary\n console.log('')\n logger.info(\n `Migration complete: ${success(`${migratedCount} migrated`)}, ${skippedCount} skipped`,\n )\n\n if (errors.length > 0) {\n console.log('')\n logger.error(`Encountered ${errors.length} error(s):`)\n errors.forEach((err) => logger.error(` ${err}`))\n process.exit(1)\n }\n\n if (migratedCount === 0) {\n exitWithError('No files were migrated')\n }\n}\n\nfunction formatBatchMigrationWarningReason(reason: string) {\n const strippedReason = reason.replace(/^Cannot batch:\\s*/i, '')\n return strippedReason.replace(/^(\\s*)(\\S)/, (_match, prefix: string, firstChar: string) => {\n return `${prefix}${firstChar.toUpperCase()}`\n })\n}\n"]}
@@ -0,0 +1,7 @@
1
+ import type { PreviewResult } from './preview_utils';
2
+ /**
3
+ * Collapse property combinations that produced identical output into one result
4
+ * each. Backs the `--unique` preview option.
5
+ */
6
+ export declare function collapsePreviewResults(results: PreviewResult[]): PreviewResult[];
7
+ //# sourceMappingURL=preview_collapse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preview_collapse.d.ts","sourceRoot":"","sources":["../../src/commands/preview_collapse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAEpD;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,aAAa,EAAE,GAAG,aAAa,EAAE,CAqBhF"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.collapsePreviewResults = collapsePreviewResults;
4
+ /**
5
+ * Collapse property combinations that produced identical output into one result
6
+ * each. Backs the `--unique` preview option.
7
+ */
8
+ function collapsePreviewResults(results) {
9
+ const groups = new Map();
10
+ const order = [];
11
+ for (const result of results) {
12
+ const output = result.success ? `s:${result.snippet ?? ''}` : `e:${result.error ?? ''}`;
13
+ const key = `${result.nodeId} ${output}`;
14
+ const existing = groups.get(key);
15
+ if (!existing) {
16
+ const rep = { ...result, propertyCombinationCount: 1 };
17
+ rep.propertyCombinationLabels = result.propertyCombinationLabel
18
+ ? [result.propertyCombinationLabel]
19
+ : [];
20
+ groups.set(key, rep);
21
+ order.push(key);
22
+ }
23
+ else {
24
+ existing.propertyCombinationCount = (existing.propertyCombinationCount ?? 1) + 1;
25
+ if (result.propertyCombinationLabel)
26
+ (existing.propertyCombinationLabels ??= []).push(result.propertyCombinationLabel);
27
+ }
28
+ }
29
+ return order.map((key) => groups.get(key));
30
+ }
31
+ //# sourceMappingURL=preview_collapse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preview_collapse.js","sourceRoot":"","sources":["../../src/commands/preview_collapse.ts"],"names":[],"mappings":";;AAMA,wDAqBC;AAzBD;;;GAGG;AACH,SAAgB,sBAAsB,CAAC,OAAwB;IAC7D,MAAM,MAAM,GAAG,IAAI,GAAG,EAAyB,CAAA;IAC/C,MAAM,KAAK,GAAa,EAAE,CAAA;IAC1B,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,OAAO,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,KAAK,IAAI,EAAE,EAAE,CAAA;QACvF,MAAM,GAAG,GAAG,GAAG,MAAM,CAAC,MAAM,IAAI,MAAM,EAAE,CAAA;QACxC,MAAM,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;QAChC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,GAAG,GAAkB,EAAE,GAAG,MAAM,EAAE,wBAAwB,EAAE,CAAC,EAAE,CAAA;YACrE,GAAG,CAAC,yBAAyB,GAAG,MAAM,CAAC,wBAAwB;gBAC7D,CAAC,CAAC,CAAC,MAAM,CAAC,wBAAwB,CAAC;gBACnC,CAAC,CAAC,EAAE,CAAA;YACN,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;YACpB,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QACjB,CAAC;aAAM,CAAC;YACN,QAAQ,CAAC,wBAAwB,GAAG,CAAC,QAAQ,CAAC,wBAAwB,IAAI,CAAC,CAAC,GAAG,CAAC,CAAA;YAChF,IAAI,MAAM,CAAC,wBAAwB;gBACjC,CAAC,QAAQ,CAAC,yBAAyB,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,wBAAwB,CAAC,CAAA;QACrF,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAE,CAAC,CAAA;AAC7C,CAAC","sourcesContent":["import type { PreviewResult } from './preview_utils'\n\n/**\n * Collapse property combinations that produced identical output into one result\n * each. Backs the `--unique` preview option.\n */\nexport function collapsePreviewResults(results: PreviewResult[]): PreviewResult[] {\n const groups = new Map<string, PreviewResult>()\n const order: string[] = []\n for (const result of results) {\n const output = result.success ? `s:${result.snippet ?? ''}` : `e:${result.error ?? ''}`\n const key = `${result.nodeId} ${output}`\n const existing = groups.get(key)\n if (!existing) {\n const rep: PreviewResult = { ...result, propertyCombinationCount: 1 }\n rep.propertyCombinationLabels = result.propertyCombinationLabel\n ? [result.propertyCombinationLabel]\n : []\n groups.set(key, rep)\n order.push(key)\n } else {\n existing.propertyCombinationCount = (existing.propertyCombinationCount ?? 1) + 1\n if (result.propertyCombinationLabel)\n (existing.propertyCombinationLabels ??= []).push(result.propertyCombinationLabel)\n }\n }\n return order.map((key) => groups.get(key)!)\n}\n"]}
@@ -23,6 +23,14 @@ export interface PreviewResult {
23
23
  error?: string;
24
24
  /** Present when this result is one property combination of an expanded (--all) render. */
25
25
  propertyCombinationLabel?: string;
26
+ /**
27
+ * With `--unique`, the labels of all property combinations that produced this
28
+ * identical output (the full `--all` cartesian often collapses to far fewer
29
+ * distinct snippets).
30
+ */
31
+ propertyCombinationLabels?: string[];
32
+ /** With `--unique`, how many property combinations produced this identical output. */
33
+ propertyCombinationCount?: number;
26
34
  /** `kind: "transport"` marks a server/network failure, in which case no property vocabulary is attached. */
27
35
  errorDetails?: {
28
36
  kind?: string;
@@ -59,8 +67,11 @@ export type ComponentPropertyDefinitionsResult = {
59
67
  status: 'error';
60
68
  };
61
69
  /**
62
- * Fetch a component's property definitions from the REST `files/:key/nodes` endpoint.
70
+ * Fetch components' property definitions in batches: first the requested nodes, then
71
+ * any parent component sets discovered in those responses.
63
72
  */
73
+ export declare function fetchComponentPropertyDefinitionsBatch(baseApiUrl: string, fileKey: string, nodeIds: string[], accessToken: string): Promise<Record<string, ComponentPropertyDefinitionsResult>>;
74
+ /** Fetch one component's property definitions. */
64
75
  export declare function fetchComponentPropertyDefinitions(baseApiUrl: string, fileKey: string, nodeId: string, accessToken: string): Promise<ComponentPropertyDefinitionsResult>;
65
76
  type ParsedPropertyPair = {
66
77
  name: string;
@@ -139,6 +150,7 @@ export declare function chunkNodeIdsForPreview(nodeIds: string[], propertyCombin
139
150
  */
140
151
  export declare function parseMissingProperty(error?: string): string | undefined;
141
152
  export declare function chunkOutcomeToResults(outcome: ChunkOutcome, nodes: NodeToPreview[], fileKey: string, availablePropsByNodeId?: Record<string, AvailableProperty[]>): PreviewResult[];
153
+ export declare function validatePreviewOptions(cmd: PreviewCommand): void;
142
154
  /**
143
155
  * Handle the preview command
144
156
  */