$ show curiosity-ai/h5
H5 is a C# to JavaScript/TypeScript transpiler that enables C# developers to target web platforms. The system consists of a compiler service (h5-compiler dotnet tool), a translator core that converts C# AST to JavaScript/TypeScript using visitor patterns and attribute-driven rules, and runtime libraries providing .NET-like functionality in JavaScript. Key features include SDK-style project integration, extensive globalization support through locale definitions, and support for JavaScript interop via attributes like [H5.External] and [H5.Template]. The toolchain processes C# source files through lexical analysis (using NRefactory), semantic analysis, translation to target language syntax, and emits JavaScript/TypeScript output with optional source maps and HTML wrappers.
The LLM identified 3 files worth highlighting for reuse:
Consistent locale definition pattern using H5.merge() to extend CultureInfo with numberFormat, dateTimeFormat, and TextInfo objects. All locale files follow identical structure, enabling reliable globalization in generated JavaScript applications. This pattern demonstrates skill in creating maintainable, standardized internationalization data that could be extracted for use in other .NET-to-JavaScript tools.
Thread-local StringBuilder implementation that caches instances per thread to reduce allocations. The component is self-contained, requires only System.Threading, and demonstrates non-obvious skill in high-frequency string manipulation optimization. Could be reused in any performance-sensitive .NET application with minimal modification.
Tracks type dependencies during the translation process to determine what needs to be included in output. Implements a clean resolver pattern that could be adapted for other code analysis or transformation tasks. Shows skill in managing complex translation dependencies without tight coupling to the rest of the translator.