testValueImports
A type-only import of what code now uses as a value becomes a value import: the whole of it, one specifier of
several, or an inline type.
import { valueImports } from "#codebase/tcmts/cli/mirror"; import assert from "node:assert/strict"; export const testValueImports = () => { const names = new Set(["Placement"]); assert.equal(valueImports("a.ts", `import type { Placement } from "./placement.ts";\n`, names), `import { Placement } from "./placement.ts";\n`); assert.equal(valueImports("a.ts", `import type { Placement, View } from "./p.ts";\n`, names), `import type { View } from "./p.ts";\nimport { Placement } from "./p.ts";\n`); assert.equal(valueImports("a.ts", `import { type Placement, x } from "./p.ts";\n`, names), `import { Placement, x } from "./p.ts";\n`); assert.equal(valueImports("a.ts", `import type { View } from "./p.ts";\n`, names), `import type { View } from "./p.ts";\n`); }