Problem
packages/backend — the actual conversion logic (auto-layout → CSS/gradients/etc. across HTML, Tailwind, Flutter, SwiftUI, Compose) — currently only runs inside a live Figma plugin sandbox. Several core builders read the figma global directly (figma.mixed, figma.getNodeByIdAsync()/exportAsync(), figma.variables.getVariableByIdAsync()), not just the plugin-messaging bridge.
That means the conversion engine can't be reused outside the plugin — e.g. server-side, converting a node tree already fetched via the Figma REST API, with no live document connection available.
Use case
Running this conversion logic headlessly on a server, on top of REST API data, instead of re-implementing equivalent auto-layout/CSS/gradient resolution by hand.
Proposed fix
#258 adds a small injectable seam (setBackendHost() / getBackendHost() in packages/backend/src/host.ts) so a caller can supply a REST-backed (or otherwise non-plugin) implementation of the handful of figma.* calls the conversion path needs. Left unset, it falls back to wrapping the real figma global, so the plugin app's behavior is unchanged.
Problem
packages/backend— the actual conversion logic (auto-layout → CSS/gradients/etc. across HTML, Tailwind, Flutter, SwiftUI, Compose) — currently only runs inside a live Figma plugin sandbox. Several core builders read thefigmaglobal directly (figma.mixed,figma.getNodeByIdAsync()/exportAsync(),figma.variables.getVariableByIdAsync()), not just the plugin-messaging bridge.That means the conversion engine can't be reused outside the plugin — e.g. server-side, converting a node tree already fetched via the Figma REST API, with no live document connection available.
Use case
Running this conversion logic headlessly on a server, on top of REST API data, instead of re-implementing equivalent auto-layout/CSS/gradient resolution by hand.
Proposed fix
#258 adds a small injectable seam (
setBackendHost()/getBackendHost()inpackages/backend/src/host.ts) so a caller can supply a REST-backed (or otherwise non-plugin) implementation of the handful offigma.*calls the conversion path needs. Left unset, it falls back to wrapping the realfigmaglobal, so the plugin app's behavior is unchanged.