( style: Record<string, string>, component: DesignComponent | null, options: SerializeOptions, pluginCode?: string, returnDevComponent?: boolean, pluginVariableStyle?: Record<string, string>, variableSyntax?: Record<string, string> )
| 14 | import { validateCodegenBatchResponse, validateCodegenResponse } from '@/plugin-sandbox/validation' |
| 15 | |
| 16 | import { getDesignComponent } from './component' |
| 17 | import { resolveStylesFromNode } from './figma-style/style-resolver' |
| 18 | import { formatNodeStyleForPluginVariables, formatNodeStyleForUi } from './variable-output' |
| 19 | |
| 20 | const CODEGEN_PREPARE_CONCURRENCY = 4 |
| 21 | const CODEGEN_BATCH_CONCURRENCY = 4 |
| 22 | const CODEGEN_BATCH_MAX_JOBS = 32 |
| 23 | const CODEGEN_JOB_WINDOW = CODEGEN_BATCH_CONCURRENCY * CODEGEN_BATCH_MAX_JOBS |
| 24 | |
| 25 | export async function codegen( |
| 26 | style: Record<string, string>, |
| 27 | component: DesignComponent | null, |
| 28 | options: SerializeOptions, |
| 29 | pluginCode?: string, |
| 30 | returnDevComponent?: boolean, |
| 31 | pluginVariableStyle?: Record<string, string>, |
| 32 | variableSyntax?: Record<string, string> |
| 33 | ): Promise<ResponsePayload> { |
| 34 | return requestCodegen( |
| 35 | { |
| 36 | style, |
| 37 | ...(pluginVariableStyle ? { pluginVariableStyle } : {}), |
| 38 | ...(variableSyntax && Object.keys(variableSyntax).length ? { variableSyntax } : {}), |
| 39 | component: component ?? undefined, |
no test coverage detected