Releases: figma/code-connect
Releases · figma/code-connect
Release list
v1.4.9
Fixed
General
- Fixed parser invocation failing when a path or argument contained a space. This affected the Swift parser (Xcode project / Swift package paths), the Compose parser (Gradle wrapper paths), and the custom parser (any user-provided
parserCommandreferencing a path with spaces).
Template files
- Fixed template-only projects unnecessarily building and running a native parser. When every Code Connect file is a parserless template (
.figma.ts/.figma.js), the CLI no longer invokes the Swift or Compose parser — which is slow at best and can fail outright (for example a Swift package targeting macOS 12 whoseFigmadependency requires macOS 13, producing "the library '...' requires macos 12.0, but depends on the product 'Figma' which requires macos 13.0"). Projects that also contain native source files are unaffected and still run the parser.
Swift
- Raised the supported
swift-syntaxupper bound to allow the 603.x release. Previously the cap below 603 could silently downgradeswift-syntaxin projects that depend on both Code Connect andswift-syntax(directly or transitively) on a Swift 6.3 toolchain. Older toolchains remain supported.
Features
General
- Added
@figma/code-connect/figma-types-no-require, a variant of the template type definitions for projects that have@types/nodeinstalled. The default@figma/code-connect/figma-typesentry declares a globalrequire(soconst figma = require('figma')works without@types/node), but that declaration overrides Node's ownrequiretype and causes errors likeProperty 'resolve' does not existonrequire.resolve(...)elsewhere in projects that use@types/node. Such projects can now use"@figma/code-connect/figma-types-no-require"in theirtypesarray instead, adding it to their maintsconfig.jsonwithout a separate config. The default entry is unchanged, so no existing setup needs to change.
Template files
- Augmented the
getSlotAPI:getSlot('SlotName')still renders the same way, and the returned value now also exposesconnectedInstances(the connected instances directly in the slot). This lets you render a slot's connected children inline. For examplegetSlot('body').connectedInstances.map((c) => c.executeTemplate().example).
React & HTML
- Augmented the
figma.slotAPI:figma.slot('SlotName')still maps the slot the same way, and you can now also writefigma.slot('SlotName').connectedInstancesin apropsobject to render the slot's code-connected instances inline. For exampleprops: { content: figma.slot('Content').connectedInstances }.
Code Connect 1.4.8
Fixed
General
- Fixed browser compatibility issues where importing
@figma/code-connectin Storybook or webpack environments would fail with "Can't resolve 'child_process'" or "Console is not a constructor" errors. Node.js-only modules (child_process,console) are now imported dynamically only when needed by CLI commands, making the package safe to use in browser environments.
Template files
- Fixed template projects failing to publish or parse when Code Connect could not infer a React, HTML, Swift, or Compose parser. The CLI now proceeds without a parser and uses the default template-file globs.
- Fixed a "
getInstanceSwap(...)?.executeTemplate is not a function" error that could break a template whengetInstanceSwap('prop')referenced an instance-swap property that isn't present on the selected node (for example a property that is conditionally hidden by a boolean). The missing property now renders an inline error, consistent with the other accessors, instead of failing the whole template. - Fixed migrated text-layer references (from the React/HTML
figma.textContent('...')helper) producing a TypeScript error and silently rendering nothing when the layer was missing. Migration now preserves the original behavior — the text renders when the layer is found, and a clear error is shown when it isn't.
Features
Template files
- The
figma connect migratecommand now uses the same--dirand--filefiltering behavior aspublish,parse, andunpublish. The migrate-only positional glob argument has been removed. - The
figma connect migratecommand can now migrate compatible large source files into batch template files. Files with 10 or more Code Connect docs are attempted automatically,--batch allforces a batch attempt, and--batch nonedisables batch migration.
Code Connect 1.4.7
Fixed
General
- The
--file(-f) option onfigma connect publish,unpublish, andparsenow accepts multiple files, so you can target several Code Connect files in one command (e.g.figma connect publish --file a.figma.ts b.figma.ts). Previously only a single file path was accepted. - Tweak retry behavior for
publishcommand to reduce 429s errors - Shared flags (
--verbose,--token,--config,--dir,--file,--out-file,--out-dir,--api-url,--skip-update-check,--exit-on-unreadable-files,--dry-run) now work whether you write them before or after the subcommand name. Previously, onlyfigma connect publish -vtoggled verbose mode;figma connect -v publishwas silently ignored.
Compose
- Fixed a crash that prevented the Code Connect Gradle plugin from being used with projects on Kotlin 2.3 or newer. The plugin now runs Kotlin source parsing in an isolated worker process, so it no longer ships an embedded Kotlin compiler in the consumer's build environment and cannot conflict with the host project's Kotlin Gradle Plugin across version upgrades.
- Fixed
parseCodeConnect/createCodeConnectfailing in multi-module Gradle projects when the plugin is applied to more than one subproject. The task now resolves the-PfilePath/-PoutputDirarguments against the root project so every subproject finds the input the CLI wrote at the build root. - The Code Connect Gradle tasks now work cleanly with Gradle's configuration cache enabled. Previously, enabling
--configuration-cachecaused an opaque serialization error; the tasks now store and reuse the configuration cache entry as expected.
Code Connect 1.4.5
Fixed
General
- The
previewcommand now prints a clearer single-line message if the preview service is temporarily unavailable, instead of repeating a per-file error. figma connect previewnow splits requests into smaller chunks when previewing many components at once, so previews of large component libraries no longer fail with “Payload Too Large” errors.
Code Connect 1.4.4
Fixed
General
- Bumped Lodash version from 4.17 to 4.18 to address vulnerability CVE-2021-23337
Storybook
- Storybook files with
.ts,.jsx, or.jsextensions (e.g.Button.stories.jsx) are now discovered by the CLI. Previously only.stories.tsxfiles were picked up.
Template files
--exit-on-unreadable-filesis now respected for template files (.figma.ts/.figma.js)- Fixed batch data not being picked up when rendering Code Connect snippets
Features
General
- Added
--forceflag tofigma connect publish. When Figma already has UI-created Code Connect mappings for one or more nodes, publishing will now show a warning instead of failing silently. Use--forceto overwrite those existing mappings with the Code Connect files from your codebase. - The
connect createcommand can now generates template files. - Added
previewcommand: you can now runnpx figma connect preview {fileUrl}to locally preview a Code Connect file without having to publish it.
Template files
- Added batch template support (
.figma.batch.json+.figma.batch.ts). A batch file defines a shared template and an array of component entries, allowing hundreds of similar components (e.g. icons) to be Code Connected without individual template files. Per-entry data is available in the template viafigma.batch.
Code Connect 1.4.3
Fixed
Template files
- Fixed
getBoolean()returningundefinedinstead offalsewhen a boolean property is set tofalsein a template file. - Fixed some TS discrepancies in the
figma.*API in template files - Some fixes for the migration script
Swift & Compose
- Fixed args inconsistency in Swift and Compose helpers that could cause errors during template rendering.
Features
CLI
- Added
--file(-f) option toparse,publish, andunpublishcommands to process a single Code Connect file instead of the entire project (e.g.figma connect parse --file=src/Button.figma.tsx).
Template files
- The
migratecommand now outputs TypeScript (.figma.ts) files by default. Pass--javascriptto output JavaScript (.figma.js) files instead. - The
migratecommand now outputsimport figma from "figma"(ESM syntax) when using the--typescriptflag - The
migratecommand now removes__propsmetadata blocks by default. Pass--include-propsto preserve them. - Storybook connections can now be migrated by the template migration script
Code Connect 1.4.2
Fixed
General
- Fixed incorrect
documentUrlSubstitutionswhen one key is a prefix of another (e.g.SearchInputandSearchInputMenu). The CLI now processes longer keys first so the correct substitution is applied. - Publishing with
--batch-sizenow retries automatically on rate-limit (429) and server error (5xx) responses, respecting theRetry-Afterheader when present, rather than failing immediately - Fixed an issue around
.figma.js/.figma.tsfiles being incorrectly treated as template files
CLI
- The
--include-template-filesflag now shows a deprecation warning instead of causing an error. The flag is no longer necessary as template files are automatically included by default.
Features
General
- Code Connect now supports default branch names other than
master/main. For cases where it can't be detected automatically, you can setdefaultBranchin yourfigma.config.json.
Template files
- Variant restrictions are now handled by the
migratescript. These are inlined into one template file with if/else blocks. - TypeScript is now supported for raw template files (
.figma.template.ts/.figma.ts).- ESM import syntax is now supported for the Figma API:
import figma from 'figma' - Type-only imports (
import type) are supported - Other module imports are not yet supported
- To enable types for the
figmaAPI, add"@figma/code-connect/figma-types"to thetypesarray in yourtsconfig.json. - JavaScript files are the default output of the
migratecommand. Can pass--typescriptto output TypeScript (.figma.ts) files instead.
- ESM import syntax is now supported for the Figma API:
Code Connect 1.4.1
Fixed
- Fixed issue with publishing template files without a
sourcevalue
Code Connect 1.4.0
Features
React
- Add support for
figma.slot()to map Figma slot layer properties in Code Connect files.
Parserless
- Added a beta migration script to migrate parser-based Code Connect files to parserless templates under
figma connect migrate. - The default extension for parserless/template files is now
.figma.jsinstead of.figma.template.js. The old.figma.template.jsextension is still fully supported for backwards compatibility. - Removed
--include-template-filesflag. Template files (.figma.jsand.figma.template.js) are now always included when detected. - Add support for
instance.getSlot(name)in templates to reference "slot" properties. - Parserless templates now support optional
componentandsourcecomment fields (e.g.,// component=Button)
Code Connect 1.3.13
Features
- Add --api-url option to use a different code-connect api endpoint. This option can also be configured in figma.config.json with the
apiUrlfield - Add
languageconfig option to override syntax highlighting language in figma.config.json
Parserless
- Syntax highlighting + formatting for parserless templates when publishing with a known label (e.g. React)
Fixed
- Fix crash that occurs when the provided Figma file has no components
- Set version number for annotations gradle plugin
- Security update: upgraded undici to fix CVE-2026-22036. Roll back and report if you encounter networking issues.
- Security update: upgraded lodash to fix CVE-2025-13465.