/** * synap cell define * synap cell build * * Define and bundle frame cells for the Synap runtime. * * Usage: * synap cell define --name "My Chart" --file ./chart.js [--type-key my-chart] [--deps '{"recharts":"2.12.0"}'] [--workspace ] [--open] * cat chart.js | synap cell define --name "My Chart" * * synap cell build ./src/chart.tsx --out ./dist/chart.js * synap cell build ./src/chart.tsx --out ./dist/chart.js --define # bundle then define * * API: * POST /api/hub/cells/define — { name, rendererSource, workspaceId?, typeKey?, description?, defaultSize? } * * NOTE on deps: The /cells/define endpoint currently ignores the `deps` field in * the Zod schema (parsed but not persisted — the INSERT always uses `deps: {}`). * We send it anyway so the payload is ready when the backend adds support. * Track: cells.ts upsert sets `deps: {} as Record` unconditionally. * * cell build runtime contract: * - esbuild bundles to a single ESM file (format: esm, bundle: true) * - bare imports (react, react-dom, any non-relative) are externalized * - externalized modules become the deps map (version from package.json if present, else "latest") * - the output module default-exports a React component (or plain module) * - at runtime Synap resolves bare imports via esm.sh importmap */ export interface CellDefineOpts { name: string; file?: string; typeKey?: string; deps?: string; workspace?: string; description?: string; open?: boolean; json?: boolean; podUrl?: string; apiKey?: string; } export interface CellBuildOpts { out?: string; define?: boolean; name?: string; typeKey?: string; deps?: string; workspace?: string; description?: string; open?: boolean; json?: boolean; podUrl?: string; apiKey?: string; } export declare function cellDefine(opts: CellDefineOpts): Promise; export declare function cellBuild(entry: string, opts: CellBuildOpts): Promise;