@verbx/localize-scanner
v0.2.0
Published
VerbX Localize — AST string extraction for JS/TS/JSX. Shared by the CLI and the GitHub agent.
Downloads
244
Readme
@verbx/localize-scanner
AST-based string extraction for VerbX Localize, shared by the CLI and the GitHub agent.
You do not install this directly — @verbx/localize-cli depends on it. It is documented here
for people building their own integration.
What it does
Parses JavaScript, TypeScript and JSX/TSX with @babel/parser and extracts the user-visible text:
JSX text, translatable JSX attributes, and t(...) / <T> calls. It distinguishes copy from code —
identifiers, enum values and numeric literals are skipped, with a reason — so the catalogue does not
fill up with things no one should translate.
Each extracted string carries a stable context key derived with the same function the SDK uses, so the same string in two different components is two entries rather than one, and keys match across the client and the server.
import { scanSource, summarize } from "@verbx/localize-scanner";
const result = scanSource(code, { filename: "src/Cart.tsx" });
// result.strings → [{ source, contextKey, context, file, line, column, kind }, …]
// result.skipped → what was left out, and why
console.log(summarize([result]));Pure: source text in, results out. No filesystem, no globbing, no network.
Docs
License
Proprietary. See LICENSE.md and the VerbX terms of service.
