svelte-sharp 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +128 -30
- package/compiler/win-x64/Microsoft.CSharp.dll +0 -0
- package/compiler/win-x64/Microsoft.CodeAnalysis.CSharp.dll +0 -0
- package/compiler/win-x64/Microsoft.CodeAnalysis.dll +0 -0
- package/compiler/win-x64/Microsoft.DiaSymReader.Native.amd64.dll +0 -0
- package/compiler/win-x64/Microsoft.VisualBasic.Core.dll +0 -0
- package/compiler/win-x64/Microsoft.VisualBasic.dll +0 -0
- package/compiler/win-x64/Microsoft.Win32.Primitives.dll +0 -0
- package/compiler/win-x64/Microsoft.Win32.Registry.dll +0 -0
- package/compiler/win-x64/SvelteSharp.Compiler.deps.json +882 -0
- package/compiler/win-x64/SvelteSharp.Compiler.dll +0 -0
- package/compiler/win-x64/SvelteSharp.Compiler.exe +0 -0
- package/compiler/win-x64/SvelteSharp.Compiler.runtimeconfig.json +15 -0
- package/compiler/win-x64/System.AppContext.dll +0 -0
- package/compiler/win-x64/System.Buffers.dll +0 -0
- package/compiler/win-x64/System.Collections.Concurrent.dll +0 -0
- package/compiler/win-x64/System.Collections.Immutable.dll +0 -0
- package/compiler/win-x64/System.Collections.NonGeneric.dll +0 -0
- package/compiler/win-x64/System.Collections.Specialized.dll +0 -0
- package/compiler/win-x64/System.Collections.dll +0 -0
- package/compiler/win-x64/System.ComponentModel.Annotations.dll +0 -0
- package/compiler/win-x64/System.ComponentModel.DataAnnotations.dll +0 -0
- package/compiler/win-x64/System.ComponentModel.EventBasedAsync.dll +0 -0
- package/compiler/win-x64/System.ComponentModel.Primitives.dll +0 -0
- package/compiler/win-x64/System.ComponentModel.TypeConverter.dll +0 -0
- package/compiler/win-x64/System.ComponentModel.dll +0 -0
- package/compiler/win-x64/System.Configuration.dll +0 -0
- package/compiler/win-x64/System.Console.dll +0 -0
- package/compiler/win-x64/System.Core.dll +0 -0
- package/compiler/win-x64/System.Data.Common.dll +0 -0
- package/compiler/win-x64/System.Data.DataSetExtensions.dll +0 -0
- package/compiler/win-x64/System.Data.dll +0 -0
- package/compiler/win-x64/System.Diagnostics.Contracts.dll +0 -0
- package/compiler/win-x64/System.Diagnostics.Debug.dll +0 -0
- package/compiler/win-x64/System.Diagnostics.DiagnosticSource.dll +0 -0
- package/compiler/win-x64/System.Diagnostics.FileVersionInfo.dll +0 -0
- package/compiler/win-x64/System.Diagnostics.Process.dll +0 -0
- package/compiler/win-x64/System.Diagnostics.StackTrace.dll +0 -0
- package/compiler/win-x64/System.Diagnostics.TextWriterTraceListener.dll +0 -0
- package/compiler/win-x64/System.Diagnostics.Tools.dll +0 -0
- package/compiler/win-x64/System.Diagnostics.TraceSource.dll +0 -0
- package/compiler/win-x64/System.Diagnostics.Tracing.dll +0 -0
- package/compiler/win-x64/System.Drawing.Primitives.dll +0 -0
- package/compiler/win-x64/System.Drawing.dll +0 -0
- package/compiler/win-x64/System.Dynamic.Runtime.dll +0 -0
- package/compiler/win-x64/System.Formats.Asn1.dll +0 -0
- package/compiler/win-x64/System.Formats.Tar.dll +0 -0
- package/compiler/win-x64/System.Globalization.Calendars.dll +0 -0
- package/compiler/win-x64/System.Globalization.Extensions.dll +0 -0
- package/compiler/win-x64/System.Globalization.dll +0 -0
- package/compiler/win-x64/System.IO.Compression.Brotli.dll +0 -0
- package/compiler/win-x64/System.IO.Compression.FileSystem.dll +0 -0
- package/compiler/win-x64/System.IO.Compression.Native.dll +0 -0
- package/compiler/win-x64/System.IO.Compression.ZipFile.dll +0 -0
- package/compiler/win-x64/System.IO.Compression.dll +0 -0
- package/compiler/win-x64/System.IO.FileSystem.AccessControl.dll +0 -0
- package/compiler/win-x64/System.IO.FileSystem.DriveInfo.dll +0 -0
- package/compiler/win-x64/System.IO.FileSystem.Primitives.dll +0 -0
- package/compiler/win-x64/System.IO.FileSystem.Watcher.dll +0 -0
- package/compiler/win-x64/System.IO.FileSystem.dll +0 -0
- package/compiler/win-x64/System.IO.IsolatedStorage.dll +0 -0
- package/compiler/win-x64/System.IO.MemoryMappedFiles.dll +0 -0
- package/compiler/win-x64/System.IO.Pipelines.dll +0 -0
- package/compiler/win-x64/System.IO.Pipes.AccessControl.dll +0 -0
- package/compiler/win-x64/System.IO.Pipes.dll +0 -0
- package/compiler/win-x64/System.IO.UnmanagedMemoryStream.dll +0 -0
- package/compiler/win-x64/System.IO.dll +0 -0
- package/compiler/win-x64/System.Linq.Expressions.dll +0 -0
- package/compiler/win-x64/System.Linq.Parallel.dll +0 -0
- package/compiler/win-x64/System.Linq.Queryable.dll +0 -0
- package/compiler/win-x64/System.Linq.dll +0 -0
- package/compiler/win-x64/System.Memory.dll +0 -0
- package/compiler/win-x64/System.Net.Http.Json.dll +0 -0
- package/compiler/win-x64/System.Net.Http.dll +0 -0
- package/compiler/win-x64/System.Net.HttpListener.dll +0 -0
- package/compiler/win-x64/System.Net.Mail.dll +0 -0
- package/compiler/win-x64/System.Net.NameResolution.dll +0 -0
- package/compiler/win-x64/System.Net.NetworkInformation.dll +0 -0
- package/compiler/win-x64/System.Net.Ping.dll +0 -0
- package/compiler/win-x64/System.Net.Primitives.dll +0 -0
- package/compiler/win-x64/System.Net.Quic.dll +0 -0
- package/compiler/win-x64/System.Net.Requests.dll +0 -0
- package/compiler/win-x64/System.Net.Security.dll +0 -0
- package/compiler/win-x64/System.Net.ServicePoint.dll +0 -0
- package/compiler/win-x64/System.Net.Sockets.dll +0 -0
- package/compiler/win-x64/System.Net.WebClient.dll +0 -0
- package/compiler/win-x64/System.Net.WebHeaderCollection.dll +0 -0
- package/compiler/win-x64/System.Net.WebProxy.dll +0 -0
- package/compiler/win-x64/System.Net.WebSockets.Client.dll +0 -0
- package/compiler/win-x64/System.Net.WebSockets.dll +0 -0
- package/compiler/win-x64/System.Net.dll +0 -0
- package/compiler/win-x64/System.Numerics.Vectors.dll +0 -0
- package/compiler/win-x64/System.Numerics.dll +0 -0
- package/compiler/win-x64/System.ObjectModel.dll +0 -0
- package/compiler/win-x64/System.Private.CoreLib.dll +0 -0
- package/compiler/win-x64/System.Private.DataContractSerialization.dll +0 -0
- package/compiler/win-x64/System.Private.Uri.dll +0 -0
- package/compiler/win-x64/System.Private.Xml.Linq.dll +0 -0
- package/compiler/win-x64/System.Private.Xml.dll +0 -0
- package/compiler/win-x64/System.Reflection.DispatchProxy.dll +0 -0
- package/compiler/win-x64/System.Reflection.Emit.ILGeneration.dll +0 -0
- package/compiler/win-x64/System.Reflection.Emit.Lightweight.dll +0 -0
- package/compiler/win-x64/System.Reflection.Emit.dll +0 -0
- package/compiler/win-x64/System.Reflection.Extensions.dll +0 -0
- package/compiler/win-x64/System.Reflection.Metadata.dll +0 -0
- package/compiler/win-x64/System.Reflection.Primitives.dll +0 -0
- package/compiler/win-x64/System.Reflection.TypeExtensions.dll +0 -0
- package/compiler/win-x64/System.Reflection.dll +0 -0
- package/compiler/win-x64/System.Resources.Reader.dll +0 -0
- package/compiler/win-x64/System.Resources.ResourceManager.dll +0 -0
- package/compiler/win-x64/System.Resources.Writer.dll +0 -0
- package/compiler/win-x64/System.Runtime.CompilerServices.Unsafe.dll +0 -0
- package/compiler/win-x64/System.Runtime.CompilerServices.VisualC.dll +0 -0
- package/compiler/win-x64/System.Runtime.Extensions.dll +0 -0
- package/compiler/win-x64/System.Runtime.Handles.dll +0 -0
- package/compiler/win-x64/System.Runtime.InteropServices.JavaScript.dll +0 -0
- package/compiler/win-x64/System.Runtime.InteropServices.RuntimeInformation.dll +0 -0
- package/compiler/win-x64/System.Runtime.InteropServices.dll +0 -0
- package/compiler/win-x64/System.Runtime.Intrinsics.dll +0 -0
- package/compiler/win-x64/System.Runtime.Loader.dll +0 -0
- package/compiler/win-x64/System.Runtime.Numerics.dll +0 -0
- package/compiler/win-x64/System.Runtime.Serialization.Formatters.dll +0 -0
- package/compiler/win-x64/System.Runtime.Serialization.Json.dll +0 -0
- package/compiler/win-x64/System.Runtime.Serialization.Primitives.dll +0 -0
- package/compiler/win-x64/System.Runtime.Serialization.Xml.dll +0 -0
- package/compiler/win-x64/System.Runtime.Serialization.dll +0 -0
- package/compiler/win-x64/System.Runtime.dll +0 -0
- package/compiler/win-x64/System.Security.AccessControl.dll +0 -0
- package/compiler/win-x64/System.Security.Claims.dll +0 -0
- package/compiler/win-x64/System.Security.Cryptography.Algorithms.dll +0 -0
- package/compiler/win-x64/System.Security.Cryptography.Cng.dll +0 -0
- package/compiler/win-x64/System.Security.Cryptography.Csp.dll +0 -0
- package/compiler/win-x64/System.Security.Cryptography.Encoding.dll +0 -0
- package/compiler/win-x64/System.Security.Cryptography.OpenSsl.dll +0 -0
- package/compiler/win-x64/System.Security.Cryptography.Primitives.dll +0 -0
- package/compiler/win-x64/System.Security.Cryptography.X509Certificates.dll +0 -0
- package/compiler/win-x64/System.Security.Cryptography.dll +0 -0
- package/compiler/win-x64/System.Security.Principal.Windows.dll +0 -0
- package/compiler/win-x64/System.Security.Principal.dll +0 -0
- package/compiler/win-x64/System.Security.SecureString.dll +0 -0
- package/compiler/win-x64/System.Security.dll +0 -0
- package/compiler/win-x64/System.ServiceModel.Web.dll +0 -0
- package/compiler/win-x64/System.ServiceProcess.dll +0 -0
- package/compiler/win-x64/System.Text.Encoding.CodePages.dll +0 -0
- package/compiler/win-x64/System.Text.Encoding.Extensions.dll +0 -0
- package/compiler/win-x64/System.Text.Encoding.dll +0 -0
- package/compiler/win-x64/System.Text.Encodings.Web.dll +0 -0
- package/compiler/win-x64/System.Text.Json.dll +0 -0
- package/compiler/win-x64/System.Text.RegularExpressions.dll +0 -0
- package/compiler/win-x64/System.Threading.Channels.dll +0 -0
- package/compiler/win-x64/System.Threading.Overlapped.dll +0 -0
- package/compiler/win-x64/System.Threading.Tasks.Dataflow.dll +0 -0
- package/compiler/win-x64/System.Threading.Tasks.Extensions.dll +0 -0
- package/compiler/win-x64/System.Threading.Tasks.Parallel.dll +0 -0
- package/compiler/win-x64/System.Threading.Tasks.dll +0 -0
- package/compiler/win-x64/System.Threading.Thread.dll +0 -0
- package/compiler/win-x64/System.Threading.ThreadPool.dll +0 -0
- package/compiler/win-x64/System.Threading.Timer.dll +0 -0
- package/compiler/win-x64/System.Threading.dll +0 -0
- package/compiler/win-x64/System.Transactions.Local.dll +0 -0
- package/compiler/win-x64/System.Transactions.dll +0 -0
- package/compiler/win-x64/System.ValueTuple.dll +0 -0
- package/compiler/win-x64/System.Web.HttpUtility.dll +0 -0
- package/compiler/win-x64/System.Web.dll +0 -0
- package/compiler/win-x64/System.Windows.dll +0 -0
- package/compiler/win-x64/System.Xml.Linq.dll +0 -0
- package/compiler/win-x64/System.Xml.ReaderWriter.dll +0 -0
- package/compiler/win-x64/System.Xml.Serialization.dll +0 -0
- package/compiler/win-x64/System.Xml.XDocument.dll +0 -0
- package/compiler/win-x64/System.Xml.XPath.XDocument.dll +0 -0
- package/compiler/win-x64/System.Xml.XPath.dll +0 -0
- package/compiler/win-x64/System.Xml.XmlDocument.dll +0 -0
- package/compiler/win-x64/System.Xml.XmlSerializer.dll +0 -0
- package/compiler/win-x64/System.Xml.dll +0 -0
- package/compiler/win-x64/System.dll +0 -0
- package/compiler/win-x64/WindowsBase.dll +0 -0
- package/compiler/win-x64/clretwrc.dll +0 -0
- package/compiler/win-x64/clrgc.dll +0 -0
- package/compiler/win-x64/clrgcexp.dll +0 -0
- package/compiler/win-x64/clrjit.dll +0 -0
- package/compiler/win-x64/coreclr.dll +0 -0
- package/compiler/win-x64/createdump.exe +0 -0
- package/compiler/win-x64/cs/Microsoft.CodeAnalysis.CSharp.resources.dll +0 -0
- package/compiler/win-x64/cs/Microsoft.CodeAnalysis.resources.dll +0 -0
- package/compiler/win-x64/de/Microsoft.CodeAnalysis.CSharp.resources.dll +0 -0
- package/compiler/win-x64/de/Microsoft.CodeAnalysis.resources.dll +0 -0
- package/compiler/win-x64/es/Microsoft.CodeAnalysis.CSharp.resources.dll +0 -0
- package/compiler/win-x64/es/Microsoft.CodeAnalysis.resources.dll +0 -0
- package/compiler/win-x64/fr/Microsoft.CodeAnalysis.CSharp.resources.dll +0 -0
- package/compiler/win-x64/fr/Microsoft.CodeAnalysis.resources.dll +0 -0
- package/compiler/win-x64/hostfxr.dll +0 -0
- package/compiler/win-x64/hostpolicy.dll +0 -0
- package/compiler/win-x64/it/Microsoft.CodeAnalysis.CSharp.resources.dll +0 -0
- package/compiler/win-x64/it/Microsoft.CodeAnalysis.resources.dll +0 -0
- package/compiler/win-x64/ja/Microsoft.CodeAnalysis.CSharp.resources.dll +0 -0
- package/compiler/win-x64/ja/Microsoft.CodeAnalysis.resources.dll +0 -0
- package/compiler/win-x64/ko/Microsoft.CodeAnalysis.CSharp.resources.dll +0 -0
- package/compiler/win-x64/ko/Microsoft.CodeAnalysis.resources.dll +0 -0
- package/compiler/win-x64/mscordaccore.dll +0 -0
- package/compiler/win-x64/mscordaccore_amd64_amd64_9.0.2026.41315.dll +0 -0
- package/compiler/win-x64/mscordbi.dll +0 -0
- package/compiler/win-x64/mscorlib.dll +0 -0
- package/compiler/win-x64/mscorrc.dll +0 -0
- package/compiler/win-x64/msquic.dll +0 -0
- package/compiler/win-x64/netstandard.dll +0 -0
- package/compiler/win-x64/pl/Microsoft.CodeAnalysis.CSharp.resources.dll +0 -0
- package/compiler/win-x64/pl/Microsoft.CodeAnalysis.resources.dll +0 -0
- package/compiler/win-x64/pt-BR/Microsoft.CodeAnalysis.CSharp.resources.dll +0 -0
- package/compiler/win-x64/pt-BR/Microsoft.CodeAnalysis.resources.dll +0 -0
- package/compiler/win-x64/ru/Microsoft.CodeAnalysis.CSharp.resources.dll +0 -0
- package/compiler/win-x64/ru/Microsoft.CodeAnalysis.resources.dll +0 -0
- package/compiler/win-x64/tr/Microsoft.CodeAnalysis.CSharp.resources.dll +0 -0
- package/compiler/win-x64/tr/Microsoft.CodeAnalysis.resources.dll +0 -0
- package/compiler/win-x64/zh-Hans/Microsoft.CodeAnalysis.CSharp.resources.dll +0 -0
- package/compiler/win-x64/zh-Hans/Microsoft.CodeAnalysis.resources.dll +0 -0
- package/compiler/win-x64/zh-Hant/Microsoft.CodeAnalysis.CSharp.resources.dll +0 -0
- package/compiler/win-x64/zh-Hant/Microsoft.CodeAnalysis.resources.dll +0 -0
- package/dist/compiler-runner.d.ts +1 -1
- package/dist/compiler-runner.js +17 -9
- package/dist/preprocessor.js +15 -5
- package/package.json +1 -1
- package/compiler/win-x64/SvelteSharp.Compiler.pdb +0 -0
package/README.md
CHANGED
|
@@ -2,15 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
**Write C#. Build with Svelte.**
|
|
4
4
|
|
|
5
|
-
SvelteSharp is an experimental C# component authoring toolkit for
|
|
5
|
+
SvelteSharp is an experimental C# component authoring toolkit for **Svelte 5 and SvelteKit**.
|
|
6
6
|
|
|
7
|
-
It allows developers to write component logic
|
|
7
|
+
It allows developers to write component logic using familiar C# syntax while using Svelte for rendering, reactivity, and DOM updates.
|
|
8
8
|
|
|
9
|
-
The goal is to bring
|
|
9
|
+
The goal is to bring a C# and Blazor-inspired development experience to the Svelte ecosystem without requiring developers to manually write component logic in JavaScript or TypeScript.
|
|
10
10
|
|
|
11
11
|
## Features
|
|
12
12
|
|
|
13
13
|
- Write component logic in C#.
|
|
14
|
+
- Use separate `.svelte.cs` files or inline `@code` blocks.
|
|
14
15
|
- Keep markup in native `.svelte` files.
|
|
15
16
|
- Automatic reactive state generation using Svelte 5 `$state`.
|
|
16
17
|
- Computed properties using `$derived`.
|
|
@@ -18,6 +19,9 @@ The goal is to bring the C# and Blazor developer experience into the Svelte ecos
|
|
|
18
19
|
- Native Svelte two-way binding.
|
|
19
20
|
- Component parameters.
|
|
20
21
|
- Independent state for multiple component instances.
|
|
22
|
+
- C# syntax and semantic validation.
|
|
23
|
+
- Compile-time diagnostics for supported C# code.
|
|
24
|
+
- Compilation caching.
|
|
21
25
|
- Vite development integration.
|
|
22
26
|
- Local C# compiler execution.
|
|
23
27
|
|
|
@@ -30,7 +34,7 @@ The goal is to bring the C# and Blazor developer experience into the Svelte ecos
|
|
|
30
34
|
- Vite 6 or newer
|
|
31
35
|
- Windows x64 (current compiler distribution)
|
|
32
36
|
|
|
33
|
-
**Note:** The current compiler is distributed as a self-contained executable
|
|
37
|
+
**Note:** The current compiler is distributed as a self-contained executable with its required .NET runtime files. Users do not need to install .NET separately.
|
|
34
38
|
|
|
35
39
|
## Installation
|
|
36
40
|
|
|
@@ -70,9 +74,13 @@ export default defineConfig({
|
|
|
70
74
|
|
|
71
75
|
## Your First C# Component
|
|
72
76
|
|
|
77
|
+
SvelteSharp supports two ways to write C# component logic.
|
|
78
|
+
|
|
79
|
+
### Option 1: Separate C# File
|
|
80
|
+
|
|
73
81
|
Create two files next to each other.
|
|
74
82
|
|
|
75
|
-
|
|
83
|
+
**1. Counter.svelte.cs**
|
|
76
84
|
|
|
77
85
|
Write your component logic in C#:
|
|
78
86
|
|
|
@@ -96,9 +104,9 @@ public partial class Counter
|
|
|
96
104
|
}
|
|
97
105
|
```
|
|
98
106
|
|
|
99
|
-
|
|
107
|
+
**2. Counter.svelte**
|
|
100
108
|
|
|
101
|
-
Write your
|
|
109
|
+
Write your markup using native Svelte syntax:
|
|
102
110
|
|
|
103
111
|
```svelte
|
|
104
112
|
<div class="counter">
|
|
@@ -113,9 +121,47 @@ Write your component markup using native Svelte syntax:
|
|
|
113
121
|
</div>
|
|
114
122
|
```
|
|
115
123
|
|
|
116
|
-
###
|
|
124
|
+
### Option 2: Inline C# Code
|
|
117
125
|
|
|
118
|
-
|
|
126
|
+
You can also write C# directly inside your `.svelte` component using `@code`.
|
|
127
|
+
|
|
128
|
+
**Counter.svelte**
|
|
129
|
+
|
|
130
|
+
```svelte
|
|
131
|
+
<div class="counter">
|
|
132
|
+
<h2>My C# Counter</h2>
|
|
133
|
+
|
|
134
|
+
<h3>Count: {count}</h3>
|
|
135
|
+
|
|
136
|
+
<p>{Message}</p>
|
|
137
|
+
|
|
138
|
+
<button onclick={Increment}>+</button>
|
|
139
|
+
<button onclick={Decrement}>-</button>
|
|
140
|
+
</div>
|
|
141
|
+
|
|
142
|
+
@code {
|
|
143
|
+
private int count = 0;
|
|
144
|
+
|
|
145
|
+
private string Message =>
|
|
146
|
+
$"You clicked {count} times";
|
|
147
|
+
|
|
148
|
+
private void Increment()
|
|
149
|
+
{
|
|
150
|
+
count++;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
private void Decrement()
|
|
154
|
+
{
|
|
155
|
+
count--;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Both approaches are supported. Choose whichever fits your project.
|
|
161
|
+
|
|
162
|
+
## Use Your Component
|
|
163
|
+
|
|
164
|
+
Import your component into a SvelteKit page:
|
|
119
165
|
|
|
120
166
|
```svelte
|
|
121
167
|
<script lang="ts">
|
|
@@ -127,17 +173,17 @@ Import it into your SvelteKit page:
|
|
|
127
173
|
<Counter />
|
|
128
174
|
```
|
|
129
175
|
|
|
130
|
-
|
|
176
|
+
## Run the Application
|
|
131
177
|
|
|
132
178
|
```bash
|
|
133
179
|
npm run dev
|
|
134
180
|
```
|
|
135
181
|
|
|
136
|
-
|
|
182
|
+
SvelteSharp translates your C# component logic into Svelte-compatible JavaScript during compilation. Svelte then handles rendering and reactive updates.
|
|
137
183
|
|
|
138
184
|
## Two-Way Binding
|
|
139
185
|
|
|
140
|
-
SvelteSharp
|
|
186
|
+
SvelteSharp works with Svelte's native binding system.
|
|
141
187
|
|
|
142
188
|
**Counter.svelte.cs**
|
|
143
189
|
|
|
@@ -158,29 +204,72 @@ public partial class Counter
|
|
|
158
204
|
|
|
159
205
|
You don't need to write a separate input event handler. Svelte handles the binding and reactive updates.
|
|
160
206
|
|
|
207
|
+
## Compile-Time Validation
|
|
208
|
+
|
|
209
|
+
SvelteSharp validates supported C# code before translating it.
|
|
210
|
+
|
|
211
|
+
For example, this component contains an undefined variable:
|
|
212
|
+
|
|
213
|
+
```csharp
|
|
214
|
+
@code {
|
|
215
|
+
private int count = ss0;
|
|
216
|
+
}
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
Instead of allowing the generated JavaScript to fail later in the browser, SvelteSharp reports a compiler diagnostic:
|
|
220
|
+
|
|
221
|
+
```text
|
|
222
|
+
Counter.svelte(2,25):
|
|
223
|
+
SSW004: The name 'ss0' does not exist in the current context
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
Compilation stops when an error is detected.
|
|
227
|
+
|
|
228
|
+
SvelteSharp also provides a diagnostics mode for inspecting compiler diagnostics:
|
|
229
|
+
|
|
230
|
+
```powershell
|
|
231
|
+
SvelteSharp.Compiler.exe --diagnostics Counter.svelte
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
Semantic validation currently focuses on supported C# component members and expressions. It does not yet provide complete C# language validation or validate every Svelte markup reference.
|
|
235
|
+
|
|
161
236
|
## How It Works
|
|
162
237
|
|
|
163
238
|
```text
|
|
164
|
-
.svelte.cs
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
SvelteSharp
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
239
|
+
.svelte file + optional .svelte.cs file
|
|
240
|
+
|
|
|
241
|
+
v
|
|
242
|
+
SvelteSharp Preprocessor
|
|
243
|
+
|
|
|
244
|
+
v
|
|
245
|
+
C# Source Processing
|
|
246
|
+
|
|
|
247
|
+
v
|
|
248
|
+
Syntax Validation
|
|
249
|
+
|
|
|
250
|
+
v
|
|
251
|
+
Semantic Validation
|
|
252
|
+
|
|
|
253
|
+
v
|
|
254
|
+
C# Code Translation
|
|
255
|
+
|
|
|
256
|
+
v
|
|
257
|
+
Generated Svelte-Compatible Code
|
|
258
|
+
|
|
|
259
|
+
v
|
|
260
|
+
Svelte 5 Compiler
|
|
261
|
+
|
|
|
262
|
+
v
|
|
263
|
+
Browser
|
|
177
264
|
```
|
|
178
265
|
|
|
179
|
-
SvelteSharp
|
|
266
|
+
SvelteSharp handles C# source processing, validation, and translation.
|
|
267
|
+
|
|
268
|
+
Svelte remains responsible for rendering, reactivity, and DOM updates.
|
|
180
269
|
|
|
181
270
|
## Current Limitations
|
|
182
271
|
|
|
183
|
-
SvelteSharp is an experimental project
|
|
272
|
+
SvelteSharp is an experimental project. It does not support the complete C# language or the entire .NET platform.
|
|
184
273
|
|
|
185
274
|
Current limitations include:
|
|
186
275
|
|
|
@@ -189,12 +278,21 @@ Current limitations include:
|
|
|
189
278
|
- Not a replacement for the .NET runtime.
|
|
190
279
|
- Not a drop-in replacement for Blazor.
|
|
191
280
|
- Some advanced C# and Blazor features are not implemented.
|
|
281
|
+
- Semantic validation is limited to supported C# constructs.
|
|
282
|
+
- Complete validation of C# members referenced from Svelte markup is not yet implemented.
|
|
192
283
|
|
|
193
284
|
## Roadmap
|
|
194
285
|
|
|
286
|
+
- [x] Separate `.svelte.cs` component files.
|
|
287
|
+
- [x] Inline `@code` blocks.
|
|
288
|
+
- [x] Automatic reactive state generation.
|
|
289
|
+
- [x] Computed properties.
|
|
290
|
+
- [x] C# methods.
|
|
291
|
+
- [x] Basic syntax validation.
|
|
292
|
+
- [x] Semantic validation for supported C# constructs.
|
|
293
|
+
- [x] Compilation caching.
|
|
294
|
+
- [ ] Complete markup-to-C# member validation.
|
|
195
295
|
- [ ] Simplified project initialization.
|
|
196
|
-
- [ ] Better compiler diagnostics.
|
|
197
|
-
- [ ] Improved compilation caching.
|
|
198
296
|
- [ ] More C# language features.
|
|
199
297
|
- [ ] Component lifecycle integration.
|
|
200
298
|
- [ ] Dependency injection.
|
|
@@ -207,7 +305,7 @@ Current limitations include:
|
|
|
207
305
|
|
|
208
306
|
GitHub: https://github.com/theahsanbuilds/svelte-sharp
|
|
209
307
|
|
|
210
|
-
Bug reports, suggestions and contributions are welcome.
|
|
308
|
+
Bug reports, suggestions, and contributions are welcome.
|
|
211
309
|
|
|
212
310
|
## License
|
|
213
311
|
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|