JavaScript Engine for .NET Standard
Yantra (Machine in Sanskrit) is a Managed JavaScript Engine for .NET (Core and Standard 2) written completely in C#.
Node and V8’s tight C++ intgration makes it difficult to write plugins, resulting in unresolved bugs and very complicated source code structure.
C# offers platform independent near native performance, so YantraJS is designed to replace parts of Node that requires high performance.
Multi threaded shared object cache are difficult to achieve in Node, but YantraJS offers smooth connectivity between C# and JavaScript as both objects live under same runtime.
Name | Package |
---|---|
YantraJS (With CSX Module Support) | |
YantraJS.Core (Compiler) | |
YantraJS.ExpressionCompiler (IL Compiler) | |
Yantra JS.ModuleExtensions (Fluent interface for module registration) |
let
const
identifier?.[]
, identifier?.(
, identifier?.identifier
require
and import
.using
and await using
keywords.*
Most JavaScript today is available in strict mode, we do not feel any need to support non strict mode as modules are strict by default.
Currently YantraJS supports Both CommonJS and ES modules without any extra work, with little trick, module resolution is node like
. Module loader loads module asynchronously, so import
will work without any extra effort. However, require
will run AsyncPump
to wait till the module is loaded correctly. Unless you do some multithreading, mixed modules will not lead to any deadlocks.
${name}.csx
file, if it exists it will load the module.${name}.js
file, if it exits it will load the module.node_modules
folder in exact same order defined earlier.As we often have difficulty in writing cross environment scripts (browser and process such as node), we want to first implement basic common features on both.
fetch
is available in YantraContext
, we will focus on adding Stream API.We recommend using Github Discussion on this repository for any question regarding this product.