feat(i18n): expand catalog runtime and developer tooling

- add Intl-backed locale definitions, formatters, catalog loaders, and runtime hooks\n- compile hashed production catalogs from package-scoped catalog sources\n- drive Lingui extraction and compilation directly from project JSON config\n- redesign the devtool with localized controls, draggable persistence, settings, navigation, copy actions, ANSI output, and fullscreen support\n- extend repository APIs, CLI coverage, documentation, and runtime tests
This commit is contained in:
Maofeng
2026-07-30 14:47:42 +08:00
parent 0d0aad1d47
commit 0768e8fa29
55 changed files with 7553 additions and 495 deletions
@@ -0,0 +1,29 @@
import * as React from "react"
import { renderToStaticMarkup } from "react-dom/server"
import { describe, expect, it } from "vitest"
import { AnsiText, resolveAnsiComponent } from "./ansi-text"
describe("AnsiText", () => {
it("resolves direct, CommonJS, and nested default exports", () => {
const Component = ({ children }: { children?: string }) => (
<code>{children}</code>
)
expect(resolveAnsiComponent(Component)).toBe(Component)
expect(resolveAnsiComponent({ default: Component })).toBe(Component)
expect(resolveAnsiComponent({ default: { default: Component } })).toBe(
Component
)
})
it("renders ANSI SGR output during server rendering", () => {
const markup = renderToStaticMarkup(
<AnsiText>{"\u001b[32mDone\u001b[39m"}</AnsiText>
)
expect(markup).toContain("Done")
expect(markup).toContain("color:")
expect(markup).not.toContain("\u001b")
})
})