Skip to content

curiosity-ai/transpose

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1,258 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Transpose πŸš€ - C# to JavaScript compiler

Transpose is a modern C# β†’ JavaScript compiler built entirely on Roslyn. It is the next generation of the h5 project (itself a fork of the original Bridge compiler), rebranded and rebuilt around a clean-room Roslyn translator. The legacy Bridge/NRefactory pipeline has been removed β€” Transpose is solely the Roslyn-based translator and its CLI compiler (tps).

The compiler runs on .NET 10.0; Transpose projects target .NET Standard 2.0/2.1. Transpose targets a fast, integrated development experience for C# web developers.

Coming from h5? See MIGRATION.md for a step-by-step guide to porting an existing h5 project.

Package NuGet
Base Library Nuget
Core Library Nuget
SDK Target Nuget
Json Library Nuget
Template Nuget
UI Toolkit Nuget

The base library's package id is Transpose.BCL, but its assembly is Transpose (so the DLL stays Transpose.dll and the runtime global in generated JS is Transpose).

Getting Started ⚑

A Transpose project references the Transpose.Build.Target SDK, which runs the tps compiler as part of a normal dotnet build β€” there is no global-tool compiler to install and no compilation server. Start from this project shape (replace * with the latest published versions):

<Project Sdk="Transpose.Build.Target/*">
  <PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Transpose.BCL" Version="*" />
    <PackageReference Include="Transpose.Core" Version="*" />
  </ItemGroup>
</Project>

Build it with a plain:

dotnet build

The output (the tps.js runtime, your app.js bundle, resources, and index.html) lands under bin/<Configuration>/<tfm>/tps/. Serve it locally:

cd bin/Debug/netstandard2.0/tps/
dotnet serve --port 5000

You can also install the dotnet new template and scaffold a project:

dotnet new install Transpose.Template
dotnet new transpose

How a build works

tps reads the .csproj directly (no MSBuild evaluation), globs **/*.cs, resolves PackageReferences from the NuGet cache, transpiles, and writes either a runnable site or β€” for a library β€” a .NET DLL with the compiled JS embedded. Behavior is configured per project by a tps.json file (output path, fileName, html, reflection, resources, outputFormatting).

When a project references another project, the site build consumes the referenced project's already-built package DLL (extracting its compiled JS) instead of recompiling its sources β€” so a dependency is compiled once and reused.

Samples

The Tesserae UI toolkit and its sample app are built with Transpose and are a good end-to-end reference.

Relationship to h5 πŸ“œ

Transpose is the evolution of h5, with two large changes:

  • Roslyn rebuild. The translator was rewritten as a clean-room Roslyn compiler. The emitter walks Roslyn syntax trees guided by the semantic model and emits JavaScript directly β€” there is no NRefactory and no SharpSixRewriter lowering pass.
  • Rebrand. H5 β†’ Transpose (namespaces, runtime global, assembly names) and h5 β†’ tps (runtime file, config file, module name, compiler command). A handful of non-library tokens are deliberately preserved β€” the <h5> HTML tag binding and hash locals h1..h5 β€” so they are not renamed.

The compiler is a plain CLI: caching and the hosted compilation server are out of scope by design. Retyped/Bridge packages are not supported.

Package/SDK renames (h5 β†’ Transpose):

  • h5 β†’ Transpose.BCL (assembly stays Transpose)
  • h5.Core β†’ Transpose.Core
  • h5.Target (SDK) β†’ Transpose.Build.Target
  • h5.Newtonsoft.Json β†’ Transpose.Newtonsoft.Json
  • h5.WebGL2 β†’ Transpose.WebGL2
  • h5.template β†’ Transpose.Template

See MIGRATION.md for the full porting guide.

About

πŸš€ The next gen C# to JavaScript compiler

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages