A typed .NET toolchain for compiling supported C# semantics into deterministic ECMAScript modules.
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 0.18.0 adds RazorVue browser navigation support for
NavigationManager.Refresh(false)and reliable query-parameter replacement. - Browser
FileandWindowbindings use the clear C# authoring namesJazorFileandJazorWindow, while retaining their standard JavaScript ABI names. Global.IsUndefined(value)distinguishes JavaScriptundefinedfromnull; RazorVue's active integration gate currently requires 94% branch coverage while the remaining work continues.
See the changelog for the full release 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 |
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 |
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.
Install the core package in every project that declares ECMAScript modules:
dotnet add package Jazor --version 0.18.0For 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.18.0" />
<PackageReference Include="Jazor.Vue" Version="0.18.0" 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.