JSS 24.6.25.142417

dotnet add package JSS --version 24.6.25.142417
                    
NuGet\Install-Package JSS -Version 24.6.25.142417
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="JSS" Version="24.6.25.142417" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="JSS" Version="24.6.25.142417" />
                    
Directory.Packages.props
<PackageReference Include="JSS" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add JSS --version 24.6.25.142417
                    
#r "nuget: JSS, 24.6.25.142417"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package JSS@24.6.25.142417
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=JSS&version=24.6.25.142417
                    
Install as a Cake Addin
#tool nuget:?package=JSS&version=24.6.25.142417
                    
Install as a Cake Tool

JSS (JavaScript Sharp)

Build and Test JSS

JavaScript Sharp is an in-progress C# JavaScript parser, runtime engine and REPL.

Table of contents

Screenshots

Screenshot of the JSS CLI

Screenshot of the JSS Test262 runner

Usage

CLI

The CLI is used to use the JSS JavaScript engine from your terminal.

There are two modes for the CLI; the REPL and the file executor.

To use the repl you execute the JSS executable with no extra command line arguments:

JSS.CLI.exe

To use the file execute you execute the JSS repl with the the -s/--script argument with the path to the file you wish to execute:

JSS.CLI.exe -s ./path/to/script.js

Library

JSS also exposes a library that can be used to execute JavaScript code using the JSS engine.

To execute a script using the JSS engine inside of C#:

var initializeResult = JSS.Lib.Realm.InitializeHostDefinedRealm(out VM vm); // Initializes the realm to execute JavaScript inside of
var parser = new JSS.Lib.Parser(SCRIPT_CODE); // Creates a new parser for the script provided
var script = parser.Parse(vm); // Returns a script object from the parsed script using the provided vm
var scriptResult = script.ScriptEvaluation(CancellationToken.None); // Executes the script

The VM created by the InitializeHostDefinedRealm contains all the variables and functions defined when executing a script. This VM can be used multiple times by different scripts.

The result returned from ScriptEvalaution is a "Completion". A completion holds a javascript value and the type of completion it is.

scriptResult.Value would be the JavaScript value from executing the script.

Building

Building JSS is simple, you can do it within Visual Studio or by simply executing in the root of the solution:

dotnet build (-c Release or Debug)

The executables will be located in the bin folders for each project (e.g. JSS/bin/Debug/net7.0/JSS.CLI.exe).

Testing

Unit Tests

Our unit test suite comprises of C# unit tests that mainly focus on the the lexing, parsing etc. rather than the runtime. There are a few runtime tests, however, we should ideally move them to their own runtime test suite and use JavaScript files.

To run these tests simply execute in the root of the solution:

dotnet test

Test262 Runner

Our test262 runner is for running the Official ECMAScript Conformance Test Suite. This gives us access to a comprehensive set of JavaScript test files to test JSS with.

We also have a CI job for running these tests.

Our test262 runner has two modes, the runner itself and a test run "differ"

The runner executes tests from the test262 test suite and prints its output to the console and to a file in the same directory.

To execute the runner:

JSS.Test262Runner.exe

The runner can also filter the tests to execute based on the file path by using the -f flag.

For example, if you wanted to only run the tests for undefined where the '*' represents a wildcard:

JSS.Test262Runner.exe -f "./built-ins/undefined/*.js"

The differ performs a visual difference between two test run file outputs.

To execute the differ:

JSS.Test262Runner.exe diff --from "/path/to/from-test-run.txt" --to "/path/to/to-test-run.txt"

This will output all the tests that changed between the two test runs. For example, if a test passed and now fails that will show up on the differ.

License

This project is licensed under the MIT License.

Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net7.0

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
24.6.25.142417 199 6/25/2024
24.6.11.193858 282 6/11/2024
24.6.10.160120 175 6/10/2024
24.6.4.182229 204 6/4/2024
24.6.4.172858 158 6/4/2024
24.6.4.164325 167 6/4/2024
24.6.4.162706 174 6/4/2024
24.6.4.154551 160 6/4/2024
24.6.4.154323 166 6/4/2024
24.6.4.141935 158 6/4/2024
24.6.4.133549 166 6/4/2024
24.6.4.3935 169 6/4/2024
24.6.4.2642 161 6/4/2024
24.5.28.184356 233 5/28/2024
24.5.28.173818 155 5/28/2024
24.5.28.171343 168 5/28/2024
24.5.23.180801 258 5/23/2024
24.5.21.230858 167 5/21/2024
24.5.20.133513 168 5/20/2024
24.5.20.131023 167 5/20/2024
Loading failed