Files
Yunfei He 3aadf55a3e docs(runtime): fix host-tag comment drift after tui- prefix rename
Adversarial review found stale bare-host-tag references the per-file sed couldn't
reach (they live in comments/docs). Code was clean — no contamination, no public
API leakage, root/text-leaf/comment asymmetry consistent. Updated:
- vite.config.ts isCustomElement comment (<box>/<text> -> <tui-box>/<tui-text>)
- component-authoring.md split-table Text row (virtual-text/text -> tui-*)
- box.vue / useBoxMetrics.ts / use-box-metrics.test.tsx "the real `box` host node"
  comments -> `tui-box`

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-14 15:49:08 +08:00

44 lines
1.5 KiB
TypeScript

import { defineConfig } from "vite-plus";
import vueJsx from "@vitejs/plugin-vue-jsx";
import Vue from "unplugin-vue/rolldown";
import VueVite from "unplugin-vue/vite";
// Host primitive tags carry a `tui-` prefix (mirroring Ink's `ink-box`/`ink-text`):
// it keeps the renderer's intrinsic elements out of the component namespace so a
// template `<tui-box>` never collides with the public `<Box>` component (no vue-tsc
// self-recursion). The hyphen also makes them valid custom-element names.
const HOST_TAGS = ["tui-box", "tui-text", "tui-virtual-text", "tui-static", "tui-transform"];
export default defineConfig({
// `VueVite` parses `.vue` SFCs in the TEST/dev graph (unit tests may import the
// .vue components directly, e.g. host/text-measure.test.ts). The `pack` build has
// its own `Vue` rolldown plugin below; both need `isCustomElement` so the host
// tags (`<tui-box>` / `<tui-text>` / …) inside SFC templates compile to raw element
// vnodes instead of being resolved as components.
plugins: [
vueJsx(),
VueVite({
template: {
compilerOptions: {
isCustomElement: (tag: string) => HOST_TAGS.includes(tag),
},
},
}),
],
pack: {
entry: ["src/index.ts", "src/internal.ts"],
plugins: [
Vue({
isProduction: true,
template: {
compilerOptions: {
isCustomElement: (tag: string) => HOST_TAGS.includes(tag),
},
},
}),
],
dts: { vue: true },
exports: true,
},
});