npm / @figma/code-connect
@figma/code-connect
What changed in @figma/code-connect 1 to 2, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-23.
15 breaking2 deprecations33 new APIs and options1 performance11 behavior and defaults8 tooling39 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli init@figma/code-connect 222 changes
Breaking changes 9
Running the command now shows available commands instead of the interactive setup wizard.
When more than one layer matches, nestedProps now returns the first match in layer order.
With traverseInstances: true, layers are returned in layer order instead of sibling layers being returned in reverse order.
When more than one layer matches, traverseInstances: true now returns the first match in layer order.
The interactive setup wizard was removed; the notes recommend the figma-code-connect skill as its replacement.
The command always generates a parserless template file, including in projects configured for a framework-specific parser.
Unsupported output filenames are rejected with guidance to use
.figma.tsor.figma.js.Framework-specific parsers can now be used only with migrate and unpublish; other commands exit with guidance to migrate to template files.
Framework-specific parsers will no longer receive updates or support; template files are the only actively maintained way to use Code Connect.
New APIs and options 3
Set this environment variable to 1 to disable telemetry of preflight validation failure counts sent by
figma connect publish.Running a command with this flag shows the stack trace for a network request failure.
The command now accepts a component template file declared in a .figma.batch.json file, allowing that component to be previewed individually.
Performance 1
Performance optimizations were made for the preview command.
Behavior and default changes 4
Requests consistently identify the Code Connect package and installed version, making them easier to recognize in network logs.
JSON output now includes each connection's source file.
Publishing now sends preflight validation failure counts to Figma; set DO_NOT_TRACK=1 to disable this telemetry.
On Professional plans, publishing now confirms the active library and framework when they are first selected, and explains how to change the selection or upgrade if the limit is exceeded.
Fixes and other changes 5
Errors now list matched files that were not recognized as templates and separately explain when no files matched the configuration.
File discovery now works in project folders with special characters while preserving configured exclusions and project-relative includes with a leading slash.
The command leaves existing template files unchanged and reports success when no components need migrating.
Filtering text layers by parent path no longer crashes, including when the text is inside nested instances.
Network request failures now show the underlying reason, such as a timeout or connection error, instead of only “fetch failed.”
@figma/code-connect 187 changes
Breaking changes 6
The migrate-only positional glob argument has been removed.
The migrate command now removes __props metadata blocks by default; pass --include-props to preserve them.
When using --typescript, the migrate command now outputs ESM syntax with
import figma from "figma".The migrate command now outputs TypeScript (.figma.ts) files by default; use --javascript to output JavaScript (.figma.js) files instead.
The migrate command now outputs JavaScript files by default.
The flag is removed because detected template files are now always included.
Deprecations 2
Legacy parsers for React, iOS, Android, and Web Components will no longer be updated or actively maintained after August 17, 2026; new users should use the template format.
The flag now shows a deprecation warning instead of causing an error; template files are included automatically by default.
New APIs and options 30
Adds --unique to hide duplicate outputs, similar to --all.
Adds id to expose the instance's Figma node ID, matching Plugin API SceneNode.id, including stable paths for nested instance sublayers.
The --delete option deletes source Code Connect files after they are successfully migrated.
Renders every combination of a component's variant and boolean properties and requires a specific component file argument.
Prints a component's properties and variants without rendering a snippet.
Limits how many combinations are rendered when using --all.
Renders a component for a specified property combination; unspecified properties keep their defaults, and invalid variant values are reported with valid options.
TypeScript and JavaScript template files can import local helper modules using relative import syntax; helper code is bundled for standalone use, while external packages are unsupported.
A template type-definition entry for projects with
@types/nodeavoids overriding Node'srequiretype and can be added to the maintsconfig.jsontypes array.Slot values can expose their code-connected instances through
connectedInstancesin apropsobject, allowing them to be rendered inline.The value returned by
getSlotnow exposes the connected instances directly in the slot, allowing their templates to be rendered inline.Compatible large source files with 10 or more Code Connect docs are attempted automatically; --batch all forces a batch attempt and --batch none disables it.
Preview a Code Connect file locally without publishing it using
npx figma connect preview {fileUrl}.Publishing warns when Figma has UI-created mappings for nodes; use --force to overwrite them with Code Connect files from your codebase.
Batch templates use a shared template and an array of component entries to Code Connect many similar components without individual template files;
.figma.batch.tsis also supported, with per-entry data available viafigma.batch.Added an option to process a single Code Connect file instead of the entire project.
Added an option to process a single Code Connect file instead of the entire project.
Added an option to process a single Code Connect file instead of the entire project.
Set this in figma.config.json when the default branch cannot be detected automatically, including when its name is not master or main.
Add this entry to the types array in tsconfig.json to enable types for the figma API.
Raw template files can now use TypeScript.
The Figma API now supports ESM import syntax.
Pass this option to the migrate command to output TypeScript (.figma.ts) files.
Parserless templates support an optional
componentcomment field.Add support for mapping Figma slot layer properties in Code Connect files.
Templates can use
instance.getSlot(name)to reference slot properties.Parserless templates support an optional
sourcecomment field.Use a different Code Connect API endpoint.
Configure a different Code Connect API endpoint in figma.config.json.
Override the syntax highlighting language in figma.config.json.
Behavior and default changes 7
When every Code Connect file is a parserless template, the CLI no longer invokes the Swift or Compose parser; projects with native source files still run the parser.
When the CLI cannot infer a React, HTML, Swift, or Compose parser, it proceeds without one and uses the default template-file globs.
The --file (-f) option on publish, unpublish, and parse accepts multiple files, allowing several Code Connect files to be targeted in one command.
The command can now generate template files.
Publishing with this option retries automatically on rate-limit and server errors, respecting Retry-After when present.
Parserless/template files now use
.figma.jsby default;.figma.template.jsremains supported for backwards compatibility.The publish command now displays succeeded and failed nodes in its response.
Tooling 8
Migrated template files no longer include unused generated prop constants.
The CLI now discovers Storybook files with .ts, .jsx, and .js extensions, in addition to .stories.tsx files.
The template migration script can now migrate Storybook connections.
Type-only imports are now supported in raw template files.
The script handles variant restrictions by inlining them into one template file with if/else blocks.
A beta migration script migrates parser-based Code Connect files to parserless templates.
Parserless templates receive syntax highlighting and formatting when published with a known label, such as React.
A new Compose plugin version works with JDK 17.
Fixes and other changes 34
Rendering of nested arrow function callbacks is fixed.
JavaScript template files authored with
import figma from 'figma'no longer publish an unexecutable import.Nested rendered examples are no longer dropped or incorrectly formatted when interpolated directly or passed to child-rendering helpers.
Parser invocation no longer fails when a path or argument contains a space, including for Swift, Compose, and custom parsers.
The supported upper bound now allows the 603.x release, preventing silent downgrades in projects using Swift 6.3; older toolchains remain supported.
Node.js-only modules are imported dynamically only when needed by CLI commands, preventing browser-environment import failures in Storybook or webpack.
The migrate command now applies the same --dir and --file filtering behavior as publish, parse, and unpublish.
Migration preserves text-layer rendering when the layer is found and shows a clear error when it is missing.
A missing instance-swap property now renders an inline error instead of causing the template to fail.
Kotlin source parsing runs in an isolated worker process, fixing crashes with Kotlin 2.3 or newer and avoiding conflicts with the host project's Kotlin Gradle Plugin.
Code Connect Gradle tasks now work with Gradle's configuration cache enabled and reuse the configuration cache entry.
Retry behavior was adjusted to reduce 429 errors when publishing.
Shared flags now work before or after the subcommand name, so placing them before the subcommand no longer silently ignores them.
In multi-module Gradle projects, task arguments are resolved against the root project so subprojects can find CLI inputs written at the build root.
Prints a clearer single-line message when the preview service is temporarily unavailable, instead of repeating a per-file error.
Splits requests into smaller chunks when previewing many components, preventing “Payload Too Large” errors for large component libraries.
Batch data is now picked up when rendering Code Connect snippets.
This option is now respected for template files (.figma.ts / .figma.js).
Fixed some TypeScript discrepancies in the figma.* API in template files.
In template files, getBoolean() now returns false when a boolean property is set to false instead of returning undefined.
Fixed inconsistent arguments that could cause errors during template rendering.
The CLI processes longer substitution keys first, fixing incorrect substitutions when one key is a prefix of another.
Files with this extension are no longer incorrectly treated as template files.
Fixed publishing template files that do not have a source value.
Fixes a crash when the provided Figma file has no components.
Fixed parsing failure for Compose in Windows.
Fixed path alias imports incorrectly importing index files.
Fixed a corner case where the Swift parser generated invalid Code Connect code.
Fixed a parsing failure in the create command.
The parser now recognizes multiple modules/files connecting to the same FigmaNode instead of only the first one.
Path alias imports are now resolved.
The parser now escapes special characters properly, preventing snippets from failing to evaluate.
The dependency now includes support for 602.0.0.
The command no longer reports success in cases where the action did not complete properly.