A typed .NET toolchain for compiling supported C# semantics into deterministic ECMAScript modules.
Quick start · Documentation · Changelog
English · 简体中文
Jazor 1.0.0-preview.3 is the current preview release.
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.
The initial implementations of Jazor's core compiler, RazorVue, and CLR support, together with the first 500 tests, were written by hand over nearly two years. This work established the project's technical foundation.
AI assistance has primarily helped advance documentation, test coverage, external library bindings, iterative improvements, CI, and version management. The Zhipu GLM-5 and GPT-5 series have been the main AI collaborators in this subsequent work; maintainers continue to guide the project, review changes, and make release decisions.
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. Run dotnet run --file scripts/csharp/verify-binding-documentation.cs -- --no-build --baseline HEAD to verify that public ECMAScript and binding declarations retain XML documentation, upstream source metadata, and package XML delivery. 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 and ECMAScript.VueContract payload |
ECMAScript.* |
Framework-neutral ECMAScript bindings plus optional Vue ecosystem bindings and CSS-in-JS libraries |
ECMAScript.VueDataUi |
Typed Vd* RazorVue charts with per-component local ESM materialization; prefix migration |
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 1.0.0-preview.3For a Razor SDK project that authors RazorVue components, add both packages directly and keep their versions aligned:
<ItemGroup>
<PackageReference Include="Jazor" Version="1.0.0-preview.3" />
<PackageReference Include="Jazor.Vue" Version="1.0.0-preview.3" 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.
- Vue Data UI components and supporting public types now use the
Vdprefix. MigrateVueUi*/VueDataUi*references toVd*. - The empty ECMAScript.Blazor assembly has been removed; RazorVue CLR mappings remain available.
- Analyzer pre-diagnostics cover additional unsupported usages; ASP.NET Core APIs now ship XML documentation and SPA/SSR/HMR guides.
- This is a preview release; stable 1.0 has not been published. See Current Status for supported scope and quality gates.
Use the official release page and matching Git tag as the version reference. Mirrors may lag behind or show an older stable release when previews are hidden. Keep all Jazor/ECMAScript packages on the same version and explicitly select 1.0.0-preview.3.
The main branch may contain unreleased changes. Read Unreleased and version history before applying main-branch examples to an installed package.
Jazor is licensed under the MIT License. Report security issues privately through GitHub Security Advisories; use issues and discussions for other feedback.