{"id":32475064,"url":"https://github.com/devhxj/jazor","last_synced_at":"2026-05-12T08:01:51.086Z","repository":{"id":320358088,"uuid":"910363929","full_name":"devhxj/Jazor","owner":"devhxj","description":"C# to Javascript Compiler implemented via Roslyn","archived":false,"fork":false,"pushed_at":"2026-04-26T12:42:26.000Z","size":9074,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-26T13:22:01.348Z","etag":null,"topics":["acornima","bunjs","compiler","csharp","ecmascript","esmodule","estree","javascript","razor","roslyn","roslyn-analyzer","source-generator","webidl"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devhxj.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":"NOTICE.txt","maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-12-31T04:48:01.000Z","updated_at":"2026-04-26T12:42:30.000Z","dependencies_parsed_at":null,"dependency_job_id":"a4e5f194-f804-44a8-a082-6517eeb99ef9","html_url":"https://github.com/devhxj/Jazor","commit_stats":null,"previous_names":["devhxj/jazor"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/devhxj/Jazor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devhxj%2FJazor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devhxj%2FJazor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devhxj%2FJazor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devhxj%2FJazor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devhxj","download_url":"https://codeload.github.com/devhxj/Jazor/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devhxj%2FJazor/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32600964,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-03T22:12:39.696Z","status":"online","status_checked_at":"2026-05-04T02:00:06.625Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["acornima","bunjs","compiler","csharp","ecmascript","esmodule","estree","javascript","razor","roslyn","roslyn-analyzer","source-generator","webidl"],"created_at":"2025-10-26T20:56:00.229Z","updated_at":"2026-05-12T08:01:51.078Z","avatar_url":"https://github.com/devhxj.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"**English** | [中文](README_CN.md)\n\n\u003cdiv align=\"center\"\u003e\n\n![Today's Verse](https://v2.jinrishici.com/one.svg?font-size=20\u0026spacing=2\u0026color=Chocolate)\n\u003c/div\u003e\n\n# Jazor - C# to JavaScript Compiler\n\n[![.NET](https://img.shields.io/badge/.NET-11.0-blue.svg)](https://dotnet.microsoft.com/)\n[![License](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE.txt)\n[![NuGet](https://img.shields.io/nuget/v/Jazor.svg)](https://www.nuget.org/packages/Jazor)\n\n\u003e Experimental. Public APIs, generated output shape, and tooling are still evolving. The compiler core and ECMAScript module emission are the most stable parts of the project.\n\nJazor is a Roslyn-based C# to JavaScript compiler centered on `IOperation` to ECMAScript AST lowering. Annotate C# classes with `[ECMAScriptModule]`, get `.mjs` files at build time. Includes typed Vue 3 `h()` render function bindings via `ECMAScript.Vue3`, Pinia store bindings via `ECMAScript.Pinia`, and Vue Router bindings via `ECMAScript.VueRoute`.\n\n## Features\n\n- **C# syntax coverage** — supports virtually all C# 15 language features: variable declarations, basic types, pattern matching, nullable types, async/await, string interpolation, object and collection initialization, tuples, deconstruction, switch statements/expressions, and loops (for/foreach/while/do-while)\n- **Roslyn `IOperation` lowering** — semantic-driven compilation via `IOperation` → ECMAScript AST, not syntax-level translation\n- **Static analysis safety** — `Jazor.Analyzer` enforces whitelist boundaries at compile time, diagnosing unsupported types and members before emission\n- **CLR runtime modules** — common BCL types (`string`, `int`, `double`, `List\u003cT\u003e`, `Dictionary\u003cTKey, TValue\u003e`, `Task\u003cT\u003e`, etc.) are mapped to JavaScript runtime implementations through `Jazor.CLR`\n- **ECMAScript module emission** — `[ECMAScriptModule]` annotated classes compile to `.mjs` files with automatic cross-module import resolution and source maps\n- **Vue 3 integration** — `ECMAScript.Vue3` provides typed C# bindings for Vue 3's Composition API and `h()` render function, enabling component authoring in pure C#\n- **Pinia integration** — `ECMAScript.Pinia` provides typed C# bindings for Pinia root/store authoring, including `createPinia()`, `defineStore()`, `storeToRefs()`, and common Options API helpers such as `mapState()` / `mapActions()`\n- **Vue Router integration** — `ECMAScript.VueRoute` provides typed C# bindings for Vue Router 4 authoring, including `createRouter()`, history creators, `useRouter()`, `useRoute()`, `RouterLink`, and `RouterView`\n- **Vuetify integration** — `ECMAScript.Vuetify` provides production-grade typed C# bindings for Vuetify 3 component authoring, with strongly typed props, named slots, event bindings, and full runtime export coverage\n- **MSBuild integration** — emit, bundle, and output path configuration through standard MSBuild properties\n\n## Status\n\n\u003ctable\u003e\n\u003ctr\u003e\u003cth nowrap\u003eTier\u003c/th\u003e\u003cth\u003eComponent\u003c/th\u003e\u003cth\u003eStatus\u003c/th\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd nowrap\u003e\u003cstrong\u003eWorking\u003c/strong\u003e\u003c/td\u003e\u003ctd\u003eCompiler core (SemanticWalker, AstConverter) — 1,848 tests\u003c/td\u003e\u003ctd\u003eStable — the most mature part\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd nowrap\u003e\u003cstrong\u003eWorking\u003c/strong\u003e\u003c/td\u003e\u003ctd\u003eECMAScript module emission (\u003ccode\u003e[ECMAScriptModule]\u003c/code\u003e → \u003ccode\u003e.mjs\u003c/code\u003e) — 84 tests\u003c/td\u003e\u003ctd\u003eStable\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd nowrap\u003e\u003cstrong\u003eWorking\u003c/strong\u003e\u003c/td\u003e\u003ctd\u003eECMAScript.Vue3 bindings (h, ref, reactive, lifecycle, createApp)\u003c/td\u003e\u003ctd\u003eStable\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd nowrap\u003e\u003cstrong\u003eWorking\u003c/strong\u003e\u003c/td\u003e\u003ctd\u003eMSBuild integration (JazorEmit, JazorBundle, JazorOutDir)\u003c/td\u003e\u003ctd\u003eStable\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd nowrap\u003e\u003cstrong\u003eWorking\u003c/strong\u003e\u003c/td\u003e\u003ctd\u003eJazor.Analyzer (whitelist compile-time validation)\u003c/td\u003e\u003ctd\u003eStable\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd nowrap\u003e\u003cstrong\u003eWorking\u003c/strong\u003e\u003c/td\u003e\u003ctd\u003eCLR runtime modules — 70 tests\u003c/td\u003e\u003ctd\u003eStable\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd nowrap\u003e\u003cstrong\u003eIn progress\u003c/strong\u003e\u003c/td\u003e\u003ctd\u003eRazorVue (SFC pipeline, canonical h() model, Vuetify production coverage) — 400+ tests\u003c/td\u003e\u003ctd\u003eProduction-grade Vuetify authoring, pipeline validation, slot/fallthrough support\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd nowrap\u003e\u003cstrong\u003eIn progress\u003c/strong\u003e\u003c/td\u003e\u003ctd\u003eECMAScript.Pinia + ECMAScript.VueRoute — 80 tests\u003c/td\u003e\u003ctd\u003eInitial landing, expanding API coverage\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd nowrap\u003e\u003cstrong\u003eIn progress\u003c/strong\u003e\u003c/td\u003e\u003ctd\u003eSourceMap\u003c/td\u003e\u003ctd\u003eNarrow lane — module-level \u003ccode\u003e.mjs.map\u003c/code\u003e, not full coverage yet\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd nowrap\u003e\u003cstrong\u003eIn progress\u003c/strong\u003e\u003c/td\u003e\u003ctd\u003eDeno bundling\u003c/td\u003e\u003ctd\u003e\u003ccode\u003eJazorBundle\u003c/code\u003e target works for basic cases\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd nowrap\u003e\u003cstrong\u003eIn progress\u003c/strong\u003e\u003c/td\u003e\u003ctd\u003eDebugging\u003c/td\u003e\u003ctd\u003eDesign and milestone code exist, not user-facing yet\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd nowrap\u003e\u003cstrong\u003eLong-term\u003c/strong\u003e\u003c/td\u003e\u003ctd\u003eJolt (LSP, HMR, DevServer, debug, build) — 800+ tests\u003c/td\u003e\u003ctd\u003ePhase 1–6 closing, \u003ca href=\"docs/01-目标/jolt/README.md\"\u003eDesign\u003c/a\u003e\u003c/td\u003e\u003c/tr\u003e\n\u003c/table\u003e\n\nUsers today should target the **Working** tier. 29 projects · ~130K production LoC · ~180K test LoC · ~3,500+ total tests.\n\n---\n\n## Getting Started\n\n### Install\n\n```\ndotnet add package Jazor\n```\n\nThe package includes runtime (`ECMAScript`, `ECMAScript.Vue3`, `ECMAScript.Pinia`, `ECMAScript.VueRoute`, `ECMAScript.Vuetify`), compiler (`Jazor.Compiler`), static analyzer (`Jazor.Analyzer`), emit tool (`Jazor.Emit`), and MSBuild props/targets.\n\n### Multi-project Setup\n\nJazor works best with a multi-project layout where library projects declare modules and a host project emits them.\n\n**Library project** — declares modules, no emit:\n\n```xml\n\u003cProject Sdk=\"Microsoft.NET.Sdk\"\u003e\n  \u003cPropertyGroup\u003e\n    \u003cTargetFramework\u003enet11.0\u003c/TargetFramework\u003e\n    \u003cJazorEmit\u003efalse\u003c/JazorEmit\u003e\n  \u003c/PropertyGroup\u003e\n  \u003cItemGroup\u003e\n    \u003cPackageReference Include=\"Jazor\" Version=\"*\" /\u003e\n  \u003c/ItemGroup\u003e\n\u003c/Project\u003e\n```\n\n**Host project** — triggers emit and writes `.mjs` files:\n\n```xml\n\u003cProject Sdk=\"Microsoft.NET.Sdk\"\u003e\n  \u003cPropertyGroup\u003e\n    \u003cOutputType\u003eExe\u003c/OutputType\u003e\n    \u003cTargetFramework\u003enet11.0\u003c/TargetFramework\u003e\n    \u003cJazorEmit\u003etrue\u003c/JazorEmit\u003e\n    \u003cJazorOutDir\u003e$(MSBuildProjectDirectory)\\wwwroot\\jazor\\\u003c/JazorOutDir\u003e\n  \u003c/PropertyGroup\u003e\n  \u003cItemGroup\u003e\n    \u003cPackageReference Include=\"Jazor\" Version=\"*\" /\u003e\n    \u003cProjectReference Include=\"..\\MyApp.Features\\MyApp.Features.csproj\" /\u003e\n  \u003c/ItemGroup\u003e\n\u003c/Project\u003e\n```\n\nThe host project scans its own assembly and all referenced assemblies for `[ECMAScriptModule]`-annotated types and emits `.mjs` files to `JazorOutDir`. See the [multi-project sample](samples/Jazor.MultiProject/) for the baseline emit layout, and [ECMAScript.Pinia.Counter](samples/ECMAScript.Pinia.Counter/) for a Vue 3 + Pinia consumption sample.\n\n### MSBuild Properties\n\n| Property | Default | Description |\n|----------|---------|-------------|\n| `JazorCompile` | `true` | Enables compilation of `[ECMAScriptModule]` types. |\n| `JazorEmit` | `true` for `Exe`, `false` for `Library` | Emits `.mjs` files after build. |\n| `JazorOutDir` | `$(IntermediateOutputPath)jazor\\$(TargetFramework)\\modules\\` | Output directory for emitted `.mjs` files. |\n| `JazorBundle` | `false` | Bundles all emitted modules into a single JS file (uses bundled Deno runtime). |\n| `JazorBundleOut` | `$(OutDir)jazor\\app.js` | Output path for the bundled JS file. |\n| `JazorCleanEmit` | `true` | Removes stale `.mjs` files from the output directory. |\n| `JazorFailOnPathConflict` | `true` | Fails the build if two modules claim the same output path. |\n\n---\n\n## Authoring Modules\n\n### Basic Module\n\n```csharp\nusing ECMAScript;\n\nnamespace MyApp;\n\n[ECMAScriptModule(\"shared/greetings.mjs\")]\npublic static class GreetingModule\n{\n    public static string Prefix() =\u003e \"Hello\";\n    public static string Compose(string name) =\u003e $\"{Prefix()}, {name}\";\n}\n```\n\nGenerates `shared/greetings.mjs`:\n\n```javascript\nexport function prefix() {\n  return \"Hello\";\n}\nexport function compose(name) {\n  return `${prefix()}, ${name}`;\n}\n```\n\nCross-module imports are resolved automatically — when another module calls `GreetingModule.Compose(name)`, the compiler generates the corresponding `import` statement.\n\n### Vue 3 h() Function Authoring\n\n`ECMAScript.Vue3` provides typed C# bindings for Vue 3's Composition API and `h()` render function:\n\n```csharp\nusing ECMAScript;\nusing static ECMAScript.Vue3;\n\nnamespace MyApp;\n\n[ECMAScriptModule(\"app/counter.mjs\")]\npublic static class CounterModule\n{\n    public static IVueComponent Counter\n        =\u003e DefineComponent(new VueComponentOptions\n        {\n            Setup = () =\u003e\n            {\n                var count = Ref(0);\n                return () =\u003e H(\"div\", new VueObject { Class = \"counter\" },\n                [\n                    H(\"p\", $\"Count: {count.Value}\"),\n                    H(\"button\", new VueObject\n                    {\n                        Events = new VueDictionary\n                        {\n                            [\"click\"] = (Action)(() =\u003e count.Value++)\n                        }\n                    }, \"Increment\")\n                ]);\n            }\n        });\n}\n```\n\n### Compilation Capabilities\n\nThe compiler supports variable declarations, basic types, pattern matching, nullable types, async/await, string interpolation, object and collection initialization, tuples, deconstruction, switch statements/expressions, and loops (for/foreach/while/do-while). See [Compiler Docs](src/Jazor.Compiler/README.md) for the full feature set.\n\n---\n\n## ECMAScript Attribute Conventions\n\n- `[ECMAScript(\"npm:vue@3\")]` — declares a **runtime import dependency**. The compiler generates `import { ... } from \"npm:vue@3\"`.\n- `[ECMAScript(\"jsr:@scope/pkg\")]` or `[ECMAScript(\"https://...\")]` — Deno-resolvable import addresses.\n- `[ECMAScriptModule(\"features/todo/index.mjs\")]` — declares the **output module path** after emission. Not a package resolution address.\n- `[Jazor(...)]` — CLR and host mapping producer-side declarations.\n\n---\n\n## Project Structure\n\n```\nJazor/\n├── src/\n│   ├── ECMAScript/                  # ECMAScript AST core types and attributes\n│   ├── ECMAScript.Contract/         # Minimal contract layer (JazorAttribute, Op)\n│   ├── ECMAScript.Pinia/            # Pinia runtime binding surface\n│   ├── ECMAScript.Pinia.Test/       # Pinia binding tests\n│   ├── ECMAScript.Vue3/             # Vue 3 runtime binding surface\n│   ├── ECMAScript.VueRoute/         # Vue Router runtime binding surface\n│   ├── ECMAScript.VueRoute.Test/    # Vue Router binding tests\n│   ├── ECMAScript.Vuetify/          # Vuetify bindings and component stubs\n│   ├── Jazor.Compiler/              # C# → JS compiler core\n│   ├── Jazor.Analyzer/              # Static analyzer (whitelist validation)\n│   ├── Jazor.CLR/                   # CLR runtime module support\n│   ├── Jazor.Emit/                  # Emit pipeline and bundle materialisation\n│   ├── Jazor.Common/                # Shared contracts and utilities\n│   ├── Jazor/                       # NuGet package (bundles everything above)\n│   ├── Jolt/                        # [Long-term] Dev toolchain\n│   ├── Wiki/                        # Docs site built with Jazor\n│   └── samples/                     # Working host/consumer samples\n├── docs/                            # Documentation hub\n└── scripts/                         # Build and tooling scripts\n```\n\n## Documentation\n\n| Audience | Entry |\n|----------|-------|\n| **New visitors** | [Docs Hub](docs/README.md) — project overview and navigation |\n| **Maintainers** | [Workstream Dashboard](docs/02-计划/workstream-dashboard.md) — resume work entry point |\n| **Architecture** | [Compiler Architecture](docs/01-目标/compiler/ArchitectureOverview.Simplified.md) · [ECMAScript.Vue3 Design](docs/01-目标/ecmascript.vue3/README.md) · [ECMAScript.Pinia Design](docs/01-目标/ecmascript.pinia/README.md) · [ECMAScript.VueRoute Design](docs/01-目标/ecmascript.vueroute/README.md) |\n\nDocs are organized into five categories: [Goals](docs/01-目标/README.md) · [Plans](docs/02-计划/README.md) · [Completed](docs/03-完成/README.md) · [Supplements](docs/04-补充/README.md) · [Retired](docs/05-遗弃/README.md)\n\n---\n\n## Development\n\n### Prerequisites\n- .NET 11 SDK (preview)\n- PowerShell 7+ (for test scripts)\n- Windows, Linux, or macOS\n\n### Build Steps\n\n```bash\ngit clone https://github.com/devhxj/Jazor.git\ncd Jazor\ndotnet restore\ndotnet build\n\n# Run all tests\npwsh ./scripts/test-dotnet.ps1\n\n# Run compiler tests only\npwsh ./scripts/test-dotnet.ps1 -Project compiler\n\n# Run Pinia binding tests only\npwsh ./scripts/test-dotnet.ps1 -Project pinia\n\n# Run Vue Router binding tests only\npwsh ./scripts/test-dotnet.ps1 -Project vueroute\n\n# Run a single test class\ndotnet test src/Jazor.CompilerTest/Jazor.CompilerTest.csproj --filter \"SemanticWalkerPatternTest\"\n```\n\n---\n\n## Contributing\n\nCommunity contributions are welcome. Please review the repository documentation and follow the conventions described in the codebase before submitting a Pull Request.\n\n## License\n\nThis project is licensed under the MIT License. See [LICENSE.txt](LICENSE.txt) for details.\n\n## Acknowledgements\n\n- [Roslyn](https://github.com/dotnet/roslyn) — C# compiler platform\n- [Acornima](https://github.com/adams85/acornima) — JavaScript parser and AST library\n- [WebRef](https://github.com/w3c/webref) — Web specification references\n- [WootzJs](https://github.com/kswoll/WootzJs) · [h5](https://github.com/curiosity-ai/h5) · [SharpKit](https://github.com/SharpKit/SharpKit) — C# to JavaScript compilers\n- [DenoHost](https://github.com/thomas3577/DenoHost) — Deno runtime host for .NET\n- [CSharpToJavaScript](https://github.com/TiLied/CSharpToJavaScript) — C# to JavaScript transpiler\n\n---\n\n## Security Policy\n\nIf you discover a security vulnerability, please report it privately via [GitHub Security Advisories](https://github.com/devhxj/Jazor/security/advisories/new). Do not file public issues for security concerns.\n\n## Feedback\n\n- [Report a bug](https://github.com/devhxj/Jazor/issues/new?template=bug_report.md)\n- [Request a feature](https://github.com/devhxj/Jazor/issues/new?template=feature_request.md)\n- [Discussions](https://github.com/devhxj/Jazor/discussions)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevhxj%2Fjazor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevhxj%2Fjazor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevhxj%2Fjazor/lists"}