codebaseImports
The #codebase names a file imports, as paths (import { tally } from "#codebase/polls" → polls.tally).
export function codebaseImports(text: string): string[] { const out: string[] = []; for (const m of text.matchAll(/import\s+(?:type\s+)?\{([^}]*)\}\s*from\s*["']#codebase(?:\/([^"']+))?["']/g)) { const ns = (m[2] ?? "").replaceAll("/", "."); for (const part of m[1]!.split(",")) { const name = part.trim().replace(/^type\s+/, "").split(/\s+as\s+/)[0]!.trim(); if (name) out.push(ns ? `${ns}.${name}` : name); } } return out; }