A typed .NET toolchain for compiling supported C# semantics into deterministic ECMAScript modules.
Quick start · Documentation · Changelog
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.
Jazor.Adminpublic components now all provide a.razortemplate paired with a.razor.cscode-behind file; existing parameters, slots, and generated artifact contracts remain unchanged.- Sidebar rendering reuses one normalized navigation snapshot per render, keeping visibility checks and displayed items aligned.
Read the release notes for the complete history.
Jazor builds on Roslyn, Acornima, Netpack, DenoHost, WebRef, and earlier C#-to-JavaScript projects including WootzJs, h5, and SharpKit.
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
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.
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
IOperationscenarios, 98% line coverage, and 97% branch coverage. - Current Razor-to-Vue integration: at least 4,000 passing scenarios, 90% line coverage, and 94% branch coverage while the integration work continues.
- 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.
| Package | Responsibility |
|---|---|
Jazor |
Framework-neutral compiler, CLR contracts, analyzer, emit tooling, MSBuild and ASP.NET Core integration; suitable for ordinary ECMAScript libraries |
Jazor.Vue |
Vue authoring, Razor-to-Vue opt-in, Vue runtime assets, ECMAScript.Vue, ECMAScript.VueContract, and ECMAScript.Blazor payload |
ECMAScript.* |
Framework-neutral ECMAScript bindings plus optional Vue ecosystem bindings and CSS-in-JS libraries |
ECMAScript.VueDataUi |
Typed vue-data-ui RazorVue charts with per-component local ESM materialization |
ECMAScript.VuIcons |
Typed vu-icons RazorVue icons with static per-icon and dynamic catalog paths |
Jazor.Admin |
UI-library-neutral admin-shell library and RazorVue components |
samples/JazorAdmin is the production-grade admin reference application that consumes Jazor.Admin; it is not part of the library's public contract.
A library has exactly one of these two JavaScript carriers. RazorVue is an authoring mode of the pure Jazor form, not a third carrier.
| Library form | Carrier | Direct reference rule |
|---|---|---|
JS resource library (ECMAScript, Vue, Vuetify, Pinia, and other libraries that already own .mjs/.js) |
Package-local manifest.json + dist/** |
The package declares its resource dependencies. A consumer does not acquire Jazor tooling transitively. |
Pure Jazor library (ECMAScript.Style, Jazor.Admin, or other developer-authored C# and RazorVue) |
Assembly Jazor.Generated.ModuleCatalog (ECMAScriptCode) |
A pure Jazor authoring project directly references Jazor; a RazorVue authoring project directly references both Jazor and Jazor.Vue. |
The final executable or web host directly references Jazor when it runs Emit. It collects the
selected ModuleCatalog modules and manifest resources once; Debug, Release, SSR, and HMR are
output projections of that same closure, not additional library forms.
ModuleCatalog is the standard assembly output for pure Jazor because the analysis/source-generator
pipeline emits C#; it is not a legacy compatibility carrier.
For a pure Jazor library (C# compiled to ECMAScript) or the final host, add the core package directly:
dotnet add package Jazor --version 0.34.1For a Razor SDK project that authors RazorVue components, add both packages directly and keep their versions aligned:
<ItemGroup>
<PackageReference Include="Jazor" Version="0.34.1" />
<PackageReference Include="Jazor.Vue" Version="0.34.1" PrivateAssets="all" />
</ItemGroup>Detailed package selection, output settings, SSR configuration, and ecosystem bindings are in Installation and Configuration.
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.
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.
| 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 |
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.csFocused 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.csprojRepository automation uses single-file C# entry points under scripts/csharp/. See Development and Testing for the full workflow.
Jazor is licensed under the MIT License. Report security issues privately through GitHub Security Advisories; use issues and discussions for other feedback.