node-api-dotnet-generator 0.3.1 → 0.4.4

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 CHANGED
@@ -48,6 +48,7 @@ For more examples, see the [examples](./examples/) directory.
48
48
  - [Stream across .NET and JS](#stream-across-net-and-js)
49
49
  - [Optional .NET native AOT compilation](#optional-net-native-aot-compilation)
50
50
  - [High performance](#high-performance)
51
+ - [Work with .NET generic APIs in JS](#generics)
51
52
 
52
53
  ### Load and call .NET assemblies from JS
53
54
  The `node-api-dotnet` package manages hosting the .NET runtime in the JS process
@@ -257,6 +258,17 @@ Thanks to these design choices, JS to .NET calls are [more than twice as fast](
257
258
  https://github.com/jasongin/napi-dotnet/pull/23) when compared to `edge-js` using
258
259
  [that project's benchmark](https://github.com/tjanczuk/edge/wiki/Performance).
259
260
 
261
+ ### Generics
262
+ Even though the JavaScript runtime type system lacks generics, it is possible to work with .NET
263
+ generic types and methods from JavaScript:
264
+
265
+ ```JavaScript
266
+ // JavaScript
267
+ System.Enum.Parse$(System.DayOfWeek)('Tuesday');
268
+ ```
269
+
270
+ For details, see [Using .NET Generics in JavaScript](./docs/generics.md).
271
+
260
272
  ## Getting Started
261
273
  #### Requirements
262
274
  - .NET 6 or later
package/index.js CHANGED
@@ -11,8 +11,8 @@ const dotnet = require('node-api-dotnet');
11
11
  // The generator depends on these assemblies; for now they have to be loaded explicitly.
12
12
  dotnet.load(path.join(assemblyDir, 'System.Reflection.MetadataLoadContext.dll'));
13
13
  dotnet.load(path.join(assemblyDir, 'Microsoft.CodeAnalysis.dll'));
14
-
15
- const Generator = dotnet.load(path.join(assemblyDir, 'Microsoft.JavaScript.NodeApi.Generator.dll'));
14
+ dotnet.load(path.join(assemblyDir, 'Microsoft.JavaScript.NodeApi.Generator.dll'));
15
+ const Generator = dotnet.Microsoft.JavaScript.NodeApi.Generator;
16
16
 
17
17
  const args = process.argv.slice(2);
18
18
  Generator.Program.Main(args);
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "node-api-dotnet-generator",
3
- "version": "0.3.1",
3
+ "version": "0.4.4",
4
4
  "description": "Node-API for .Net code generator",
5
5
  "main": "index.js",
6
6
  "bin": "index.js",
7
7
  "license": "MIT",
8
8
  "author": "Microsoft",
9
9
  "dependencies": {
10
- "node-api-dotnet": "0.3.1"
10
+ "node-api-dotnet": "0.4.4"
11
11
  },
12
12
  "keywords": [
13
13
  "Node-API",