Dynamic Module Loading #13
Replies: 2 comments
-
|
My apologies for letting this proposal sit so long. Yes, this is interesting, and you're calling out a much-needed enhancement. My current approach of adding pure IL code for Node libraries is tedious. There are a couple of ways of getting shim code into SharpTS compiled/interpreted output: 1. Late binding .NET modules: Writing additional modules in separate C#/IL projects and linking to compiled assemblies would incur reflection overhead. It's a minor performance setback I was hoping to avoid. If we're talking about tens or hundreds of Node modules, SharpTS compilations would be faster, while runtime would have a minor overhead when invoking and marshaling code between these modules and the rest of a SharpTS project. 2. TypeScript modules: I'm planning an architecture update to support both methods of shim module support. |
Beta Was this translation helpful? Give feedback.
-
|
Nick, Thanks for getting back to me. I think separating the core of SharpTS and the library compatibility is the key feature. That way the core can remain pure, and the libraries can be extended at a faster cadence. The thing is there are so many little libraries out there that need other little libraries, the dependency graph is huge. I tried to get express running and quickly fell into this hole. Perhaps a combination of approaches is worth it, where late binding is a one off cost, like some kind of scanner (what about a source generator inside a package called Then Typescript modules could be an array of additional resolution paths provided. You could then maintain your own Typescript implementations of say Happy to discuss and tease this out some more. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Is there any plan to allow modules to be dynamically added to the build process?
For instance perhaps someone wants to maintain a compatibility module for a particular common node library. They can publish the module package as a "shim" to Nuget. It could then be restored and discovered by SharpTS.
Beta Was this translation helpful? Give feedback.
All reactions