Skip to content

Repository files navigation

Today's Verse

Jazor

A typed .NET toolchain for compiling supported C# semantics into deterministic ECMAScript modules.

.NET 11 Preview NuGet GitHub release Razor-to-Vue CI MIT License

At least 10,000 compiler tests pass At least 98 percent compiler line coverage At least 96 percent compiler branch coverage

English · 简体中文

Jazor is experimental. Public APIs and generated artifact shapes may evolve.

Jazor is a typed .NET toolchain for compiling supported C# semantics into deterministic ECMAScript modules. It is framework-neutral at its core: Roslyn supplies the semantic model, Jazor.Compiler lowers it to ESTree, and Jazor.Emit materializes browser artifacts.

Razor-to-Vue is a separate application direction built on that core. Jazor.RazorVue binds the final output of the official Razor Source Generator, then delegates all C# expression and member semantics to the same Jazor compiler before it frames Vue render-function modules.

Latest Update

2026-08-14

  • RazorVue direct render modules now use Vue child block trees and TEXT patching for proven dynamic string text, mixed static/dynamic text, and nested stable elements. Conditional content, slots, raw markup, and unproven children retain the normal Vue diff path.
  • The production Vue browser/SSR gate now verifies mount and reactive DOM patching for those child block shapes alongside static markup and hydration.
  • Proven simple Razor foreach loops now lower through Vue renderList: explicit @key uses keyed fragments, unkeyed loops use conservative unkeyed fragments, and the production Vue gate verifies DOM identity across keyed reorders.
  • Fixed authored, named, and scoped slots now use Vue withCtx with the stable _: 1 marker. Conditional, forwarded, and non-stable-scope slots use createSlots with DYNAMIC_SLOTS; the production gate verifies both parent updates and branch replacement.
  • Proven direct string/bool DOM binds now bypass the generic event/value adapter while retaining compiler-owned assignment semantics. Parameter lifecycle watches use a shallow declared-prop projection: scalar and reference replacement trigger callbacks, while nested mutation of the same reference does not.
  • ASP.NET Core SSR now reuses a bounded generation-aware Deno worker pool instead of starting a process and writing a temporary request file for every render. Artifact changes rotate the ESM generation; cancellation, crash recovery, concurrency limits, and graceful application disposal are covered by real-process tests.
  • Independent RazorVue artifacts now build with bounded concurrency while retaining deterministic module text, source maps, diagnostics, and HMR ordering.
  • Release artifacts now include only the referenced package-runtime closure. Browser output excludes unused Vue SSR/devtools files, SSR explicitly receives its Vue/server-renderer graph, and unreachable Jazor CLR runtime modules are omitted from release output.

See the changelog for the full release history.

Acknowledgements

Jazor builds on Roslyn, Acornima, Netpack, DenoHost, WebRef, and earlier C#-to-JavaScript projects including WootzJs, h5, and SharpKit.

Core Model

flowchart LR
    subgraph Core["Jazor core platform: C# -> ECMAScript"]
        CSharp["C# modules"] --> Roslyn["Roslyn semantic model"]
        Roslyn --> Compiler["Jazor.Compiler"]
        Bindings["CLR and ECMAScript bindings"] --> Compiler
        Compiler --> Ast["ESTree"] --> Emit["Jazor.Emit"]
        Emit --> Artifacts[".mjs, source maps, manifest, bundle"]
    end

    subgraph Integrations["Framework integration layer"]
        Razor["Razor components"] --> RazorSG["Official Razor SG"] --> Compilation["Final Compilation"]
        Compilation --> RazorVue["Jazor.RazorVue"]
        RazorVue -. uses core translation hooks .-> Compiler
        RazorVue --> Emit
    end
Loading

Jazor.RazorVue is the current framework integration. Future directions such as Jazor.React or Jazor.RazorReact may reuse the same core, but they are not current supported APIs.

Quality Gates

The badges above show maintained acceptance thresholds rather than a stale one-off result. The repository verifies the following minimums through repeatable scripts:

  • Core compiler: at least 10,000 passing IOperation scenarios, 98% line coverage, and 96% branch coverage.
  • Current Razor-to-Vue integration: at least 4,000 passing scenarios, 90% line coverage, and 96% branch coverage.
  • Vue ecosystem bindings: at least 90% audited public binding-contract coverage per target.

Run verify-compiler-coverage.cs, verify-razorvue-coverage.cs, or verify-vue-binding-coverage.cs under scripts/csharp/ to reproduce the relevant gate. The active scope and test entry points are listed in Current Status.

Packages

Package Responsibility
Jazor Core compiler, CLR contracts, analyzer, emit tooling, MSBuild and ASP.NET Core integration, and baseline Vue 3 authoring types
Jazor.Vue Explicit Razor-to-Vue opt-in for Razor SDK projects
ECMAScript.* ECMAScript, Vue, Router, Pinia, UI-library, and CSS-in-JS bindings
Jazor.Admin UI-library-neutral admin-shell library and RazorVue components

samples/JazorAdmin is an example application that consumes Jazor.Admin; it is not part of the library's public contract.

Install

Install the core package in every project that declares ECMAScript modules:

dotnet add package Jazor --version 0.14.0

For a Razor SDK project using the current Razor-to-Vue integration, add the opt-in package explicitly and keep package versions aligned:

<ItemGroup>
  <PackageReference Include="Jazor" Version="0.14.0" />
  <PackageReference Include="Jazor.Vue" Version="0.14.0" PrivateAssets="all" />
</ItemGroup>

Detailed package selection, output settings, SSR configuration, and ecosystem bindings are in Installation and Configuration.

First Module

Use [ECMAScriptModule] to make a C# module eligible for JavaScript emission:

using ECMAScript;

namespace MyApp;

[ECMAScriptModule("shared/greetings.mjs")]
public static class GreetingModule
{
    public static string Compose(string name) => $"Hello, {name}";
}

The core compiler emits a standard named-export ECMAScript module. Cross-module calls are resolved through compiler-owned imports rather than hand-written JavaScript.

For a complete runnable path, see Quick Start.

Output Modes

The executable or web host selects its artifact mode through MSBuild:

<PropertyGroup>
  <JazorMode>debug</JazorMode>
  <JazorDir>$(MSBuildProjectDirectory)\jazor\</JazorDir>
</PropertyGroup>
Mode Result
none Default; no Jazor artifacts are written
debug Inspectable modules, external source maps, and jazor-manifest.json
release Production browser bundle through the packaged Netpack lane

Set JazorSSR=true with the supported SSR setup when an ASP.NET Core application needs Vue server rendering and hydration. See Artifact Pipeline.

Documentation

Need Entry
Product overview docs/README.md
Core compiler architecture Compiler
Framework integration rules Framework Integrations
Current Razor-to-Vue implementation Razor-to-Vue
Install, configure, and author Guides
Examples Examples
Current scope Roadmap
Historical context Evolution
Release history CHANGELOG.md

Development

Use the .NET 11 SDK preview selected by global.json. From the repository root:

dotnet restore Jazor.slnx
dotnet build Jazor.slnx
dotnet run --file scripts/csharp/test-dotnet.cs

Focused suites include:

dotnet test src/Jazor.CompilerTest/Jazor.CompilerTest.csproj
dotnet test src/Jazor.RazorVue.Sg.Test/Jazor.RazorVue.Sg.Test.csproj
dotnet test src/Jazor.EmitTest/Jazor.EmitTest.csproj

Repository automation uses single-file C# entry points under scripts/csharp/. See Development and Testing for the full workflow.

License and Feedback

Jazor is licensed under the MIT License. Report security issues privately through GitHub Security Advisories; use issues and discussions for other feedback.

About

C# to Javascript Compiler implemented via Roslyn

Topics

Resources

Stars

8 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages