Puerts.QuickJS.Complete
3.0.1
Prefix Reserved
dotnet add package Puerts.QuickJS.Complete --version 3.0.1
NuGet\Install-Package Puerts.QuickJS.Complete -Version 3.0.1
<PackageReference Include="Puerts.QuickJS.Complete" Version="3.0.1" />
<PackageVersion Include="Puerts.QuickJS.Complete" Version="3.0.1" />
<PackageReference Include="Puerts.QuickJS.Complete" />
paket add Puerts.QuickJS.Complete --version 3.0.1
#r "nuget: Puerts.QuickJS.Complete, 3.0.1"
#:package Puerts.QuickJS.Complete@3.0.1
#addin nuget:?package=Puerts.QuickJS.Complete&version=3.0.1
#tool nuget:?package=Puerts.QuickJS.Complete&version=3.0.1
PuerTS — JavaScript/TypeScript for .NET
PuerTS is a scripting solution that brings JavaScript / TypeScript to your .NET applications. It provides high-performance script runtimes with seamless C# interop.
Features
- 🚀 High Performance — Execute JavaScript/TypeScript with V8, Node.js, or QuickJS engines.
- 🔗 Seamless C# Interop — Call any .NET type directly from JavaScript, and invoke JS functions from C#.
- 📝 TypeScript Support — Type-safe scripting with full TypeScript declaration generation.
- 🌍 Cross-Platform — Supports Windows, macOS, and Linux.
JavaScript Backend Comparison
| Backend | Node API | Performance | Binary Size | Debugging |
|---|---|---|---|---|
| V8 | ❌ | ★★★★★ | ★★★ | ✔️ |
| QuickJS | ❌ | ★★ | ★ | ❌ |
| Node.js | ✔️ | ★★★★★ | ★★★★★ | ✔️ |
- V8 (recommended): Best overall performance, moderate binary size, ECMAScript spec only.
- QuickJS: Smallest binary size, suitable for size-sensitive scenarios.
- Node.js: Full Node.js API support, largest binary size.
Installation
Install via NuGet. Choose one of the following Complete packages (includes core + native assets for all desktop platforms):
# V8 backend (recommended)
dotnet add package Puerts.V8.Complete
# Or Node.js backend (with Node API support)
dotnet add package Puerts.NodeJS.Complete
# Or QuickJS backend (minimal size)
dotnet add package Puerts.QuickJS.Complete
Or install components separately for finer control:
# Core library (required)
dotnet add package Puerts.Core
# Backend (choose one)
dotnet add package Puerts.V8
dotnet add package Puerts.NodeJS
dotnet add package Puerts.QuickJS
# Native assets per platform (choose what you need)
dotnet add package Puerts.V8.NativeAssets.Win32
dotnet add package Puerts.V8.NativeAssets.Linux
dotnet add package Puerts.V8.NativeAssets.macOS
Supported Platforms
.net8.0+, .netstandard2.1
| Windows (x64) | Linux (x64) | macOS (Universal) | |
|---|---|---|---|
| V8 | ✔️ | ✔️ | ✔️ |
| Node.js | ✔️ | ✔️ | ✔️ |
| QuickJS | ✔️ | ✔️ | ✔️ |
Note: AOT compilation is not currently supported.
Quick Start
Create a ScriptEnv with the backend matching your installed package:
| Installed Package | Backend Class |
|---|---|
Puerts.V8 / Puerts.V8.Complete |
new BackendV8() |
Puerts.NodeJS / Puerts.NodeJS.Complete |
new BackendNodeJS() |
Puerts.QuickJS / Puerts.QuickJS.Complete |
new BackendQuickJS() |
using Puerts;
// Use the backend that matches your installed package:
// V8 → new BackendV8()
// Node.js → new BackendNodeJS()
// QuickJS → new BackendQuickJS()
var env = new ScriptEnv(new BackendV8());
// Execute JavaScript
env.Eval(@"
const Console = CS.System.Console;
Console.WriteLine('Hello from JavaScript!');
");
// Eval with return value
int result = env.Eval<int>("1 + 2");
Console.WriteLine($"JS result: {result}"); // output: 3
env.Dispose();
Calling C# from JavaScript
Access any .NET type via the CS namespace:
// Access C# types
const Console = CS.System.Console;
const DateTime = CS.System.DateTime;
const List = CS.System.Collections.Generic.List$1(CS.System.String);
// Create instances and call methods
let now = DateTime.Now;
Console.WriteLine('Current time: ' + now.ToString());
let list = new List();
list.Add('hello');
list.Add('world');
Console.WriteLine('Count: ' + list.Count);
Calling JavaScript from C#
using Puerts;
using System;
// Use the backend that matches your installed package
var env = new ScriptEnv(new BackendV8());
// Get a JS function as a C# delegate
var add = env.Eval<Func<int, int, int>>("(a, b) => a + b");
Console.WriteLine(add(10, 20)); // output: 30
// Get a JS action
var greet = env.Eval<Action<string>>(@"
(name) => {
const Console = CS.System.Console;
Console.WriteLine('Hello, ' + name + '!');
}
");
greet("PuerTS");
env.Dispose();
Documentation
For full documentation, tutorials and API reference, visit: https://puerts.github.io/en
License
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.1
- Puerts.Core.Complete (>= 3.0.1)
- Puerts.QuickJS (>= 3.0.1)
- Puerts.QuickJS.NativeAssets.Linux (>= 3.0.1)
- Puerts.QuickJS.NativeAssets.macOS (>= 3.0.1)
- Puerts.QuickJS.NativeAssets.Win32 (>= 3.0.1)
-
net10.0
- Puerts.Core.Complete (>= 3.0.1)
- Puerts.QuickJS (>= 3.0.1)
- Puerts.QuickJS.NativeAssets.Linux (>= 3.0.1)
- Puerts.QuickJS.NativeAssets.macOS (>= 3.0.1)
- Puerts.QuickJS.NativeAssets.Win32 (>= 3.0.1)
-
net8.0
- Puerts.Core.Complete (>= 3.0.1)
- Puerts.QuickJS (>= 3.0.1)
- Puerts.QuickJS.NativeAssets.Linux (>= 3.0.1)
- Puerts.QuickJS.NativeAssets.macOS (>= 3.0.1)
- Puerts.QuickJS.NativeAssets.Win32 (>= 3.0.1)
-
net9.0
- Puerts.Core.Complete (>= 3.0.1)
- Puerts.QuickJS (>= 3.0.1)
- Puerts.QuickJS.NativeAssets.Linux (>= 3.0.1)
- Puerts.QuickJS.NativeAssets.macOS (>= 3.0.1)
- Puerts.QuickJS.NativeAssets.Win32 (>= 3.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.