openpencil/packages/core/tsdown.config.ts
Danila Poyarkov 1d5558ddc3 feat: JSX reference, multi-root JSX, prompts as markdown files
- Move CODEGEN_PROMPT to codegen.md, loaded via raw-md bundler plugin
- Add JSX_REFERENCE as jsx-reference.md with full prop/tag/example docs
- Copy JSX Reference button (book icon) in Code panel header
- Multi-root JSX: try parsing as-is, wrap in fragment on failure
- Component and Instance tag aliases in JSX renderer
- renderJSX returns RenderResult[] to support fragments
- raw-md plugin for both tsdown and Vite

Co-authored-by: sld0Ant <sld0Ant@users.noreply.github.com>
2026-04-22 17:51:41 +03:00

42 lines
767 B
TypeScript

import { defineConfig } from 'tsdown'
import type { Plugin } from 'rolldown'
function rawMd(): Plugin {
return {
name: 'raw-md',
transform(code, id) {
if (id.endsWith('.md')) {
return { code: `export default ${JSON.stringify(code)}`, map: null }
}
}
}
}
export default defineConfig({
entry: ['src/**/*.ts', '!src/**/*.d.ts'],
plugins: [rawMd()],
unbundle: true,
platform: 'neutral',
format: ['esm'],
dts: true,
sourcemap: true,
clean: true,
outDir: './dist',
external: [
'@iconify/utils',
'canvaskit-wasm',
'culori',
'diff',
'expr-eval',
'fflate',
'fontoxpath',
'fzstd',
'nanoevents',
'opentype.js',
'sucrase',
'svgpath',
'yoga-layout',
/^node:/
]
})