Improve module typedefs and loader generation #265
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes: #239
Fixes: #260
This has a lot of improvements related to generating the
.d.ts
and.js
files for the .NET node module scenario, including ES and AOT.[JSExport]
attributes, export items directly from the module rather than augmenting thenode-api-dotnet
module. (The augmentation is only when dynamically loading pre-existing assemblies.).cjs
and.mjs
loader scripts, or just one of them (as.js
).package.json
. This is the new default behavior, hooked up automatically inNodeApi.Generator.targets
, and eliminates the need to specify the module type via an MSBuild property in the project most of the time.ModuleGenerator
andTypeDefinitionsGenerator
related to un-namespaced types. (Does not fully resolve Add full support for types/interfaces/delegates without namespaces #262.)0.7
.The overall effect of these changes is that the generated typedefs and loader scripts now work correctly and automatically in many scenarios where they were broken before or required some workarounds to consume.