openpencil/packages/core/tsdown.config.ts
Danila Poyarkov 7f91594d0c refactor: standardize acronym casing
- Rename first-party API, RPC, JSON, CORS, SVG, JSX, and related identifiers to preserve acronym casing
- Keep upstream and serialized boundary names unchanged
- Add a lint guardrail and migration notes for exported APIs
2026-08-10 15:48:16 +03:00

42 lines
1,021 B
TypeScript

import { readFileSync } from 'node:fs'
import { defineConfig } from 'tsdown'
import type { Rolldown } from 'tsdown'
const packageJSON = JSON.parse(readFileSync(new URL('./package.json', import.meta.url), 'utf8')) as {
dependencies?: Record<string, string>
}
function rawText(): Rolldown.Plugin {
return {
name: 'raw-text',
load(id) {
if (id.endsWith('?raw')) {
const path = id.slice(0, -'?raw'.length)
return `export default ${JSON.stringify(readFileSync(path, 'utf8'))}`
}
},
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: [rawText()],
unbundle: true,
platform: 'neutral',
format: ['esm'],
dts: true,
sourcemap: true,
clean: true,
outDir: './dist',
deps: {
neverBundle: [...Object.keys(packageJSON.dependencies ?? {}), /^node:/],
onlyBundle: false
}
})