You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description:"The project name of the Assembly that will be generated"
44
46
),
45
47
newOption<string>(
@@ -57,12 +59,17 @@ static int Main(string[] args)
57
59
getDefaultValue:()=>"dotnet",
58
60
description:"The type of TypeScript parser to use, 'dotnet' will use the embedded .NET parser. 'nodejs' will use the TypeScript compiler through NodeJS (requires NodeJS installed)."
59
61
),
62
+
newOption<string>(
63
+
newstring[]{"--host-type","-h"},
64
+
getDefaultValue:()=>"wasm",
65
+
description:"The host type the source should be generator for. Is 'wasm' by default, will only work for Wasm hosted Blazor projects. Supports 'server' to generate a async first interop layer that works in both Blazor Server and Wasm hosted models."
66
+
),
60
67
};
61
68
62
-
rootCommand.Description="Generate a Blazor Wasm project from a TypeScript definition file.";
69
+
rootCommand.Description="Generate a Blazor Wasm or Server project from TypeScript definition files.";
63
70
64
71
// Note that the parameters of the handler method are matched according to the names of the options
-l, --project-generation-location <project-generation-location> | The directory where the Generated Project assembly will be saved | Default: "_generated"
21
21
-f, --force | This will force generation, by deleting --project-generation-location | Default: (False)
22
22
-p, --parser | The type of TypeScript parser to use, Supported values: ("dotnet","nodejs") | Default: ("dotnet")
23
+
-h, --host-type | The host type the source should be generator for, Supported values: ("wasm","server"). | Default: ("wasm")
23
24
24
25
## Parsers
25
26
@@ -32,6 +33,17 @@ Type | Details
32
33
dotnet | Has no external dependencies, and on average 3x faster than the nodejs parser. A con is that it does not support modern TypeScript syntax, but should coverage 90% of use-cases.
33
34
nodejs | Requires NodeJS to function, supports modern TypeScript syntax. A con is that it is very slow relative to the dotnet parser.
34
35
36
+
## Host Types
37
+
38
+
This tool supports two types of Hosting models, the standard Blazor Server and Wasm hosting models. The main reason for this is the Wasm generated source will create an interop layer that has a speed benefit but does not work outside of the Wasm hosting model.
39
+
40
+
Below is a table listing the pro/con of each hosting type.
41
+
42
+
Type | Details
43
+
--- | ---
44
+
wasm | Uses the unmarshaller to move data between the .NET and JavaScript layers. The con is that it only works in a Blazor WebAssembly hosted model, and will not function when used from Blazor Server.
45
+
server | Uses the IJSRuntime for moving data between the .NET and JavaScript layers. A pro is that it allows it to work in both Blazor Server and WebAssembly, but with a con that it has to go through the async layer adding a performance overhead to each request.
0 commit comments