Jroc.Core
0.9.32
See the version list below for details.
dotnet add package Jroc.Core --version 0.9.32
NuGet\Install-Package Jroc.Core -Version 0.9.32
<PackageReference Include="Jroc.Core" Version="0.9.32" />
<PackageVersion Include="Jroc.Core" Version="0.9.32" />
<PackageReference Include="Jroc.Core" />
paket add Jroc.Core --version 0.9.32
#r "nuget: Jroc.Core, 0.9.32"
#:package Jroc.Core@0.9.32
#addin nuget:?package=Jroc.Core&version=0.9.32
#tool nuget:?package=Jroc.Core&version=0.9.32
Jroc.Core
Jroc.Core is the referenceable NuGet package for the reusable jroc compiler library.
It ships the Jroc.Compiler.dll assembly and compiler dependencies so custom .NET tools, build tasks, test harnesses, and hosts can compile JavaScript to .NET assemblies without shelling out to the jroc CLI tool.
The primary entry points are the existing Jroc.Compiler, Jroc.CompilerOptions, and Jroc.CompilerServices types in the Jroc namespace.
Which package should I use?
Jroc.Core- Use this when you want to embed the compiler directly in your own .NET code.
Jroc.SDK- Use this when your project should compile JavaScript during
dotnet build.
- Use this when your project should compile JavaScript during
jroc- Use this when you want the command-line tool for manual or ad-hoc compilation.
Jroc.Runtime- Use this when your host application needs the runtime support library used by generated assemblies.
Official releases publish Jroc.Runtime, jroc, Jroc.Core, and Jroc.SDK together at the same version. Keep the versions aligned when you mix them in one workflow.
Install
<ItemGroup>
<PackageReference Include="Jroc.Core" Version="VERSION" />
</ItemGroup>
Basic usage
using Jroc;
using Microsoft.Extensions.DependencyInjection;
var options = new CompilerOptions
{
OutputDirectory = @"C:\code\out",
Verbose = true,
EmitPdb = true
};
using var services = CompilerServices.BuildServiceProvider(options);
var compiler = services.GetRequiredService<Compiler>();
if (!compiler.Compile(@"C:\code\sample.js"))
{
throw new InvalidOperationException("Compilation failed.");
}
Compiler.Compile(...) returns true on success and writes the generated files to CompilerOptions.OutputDirectory. If OutputDirectory is omitted, JROC writes next to the input file.
What gets generated?
Given an input like C:\code\sample.js, JROC emits the following into the output directory:
sample.dll- The compiled .NET assembly for your JavaScript.
sample.runtimeconfig.json- Runtime configuration for the
dotnethost.
- Runtime configuration for the
JavaScriptRuntime.dll(+ optionalJavaScriptRuntime.pdb)- The runtime support library required to execute the generated assembly.
Useful options
OutputDirectory- Where generated files are written. If omitted, output is written next to the input file.
Verbose- Enables compiler progress logging.
DiagnosticFilePath- Writes compiler diagnostics to a text file.
AnalyzeUnused- Reports unused functions, properties, and variables.
StrictMode- Controls how missing
"use strict"directive prologues are reported.
- Controls how missing
EmitPdb- Emits Portable PDB symbols next to the generated assembly, mapping both plain scripts and rewritten
import/exportmodules back to the original source path for breakpoints and stack traces. - Uncaptured locals emit debugger local names; captured closure variables currently remain visible through generated scope types instead of ordinary local slots.
- Emits Portable PDB symbols next to the generated assembly, mapping both plain scripts and rewritten
GenerateModuleExportContracts- Emits typed CommonJS export contracts for .NET hosting scenarios.
Links
- Hosting docs: https://github.com/tomacox74/jroc/blob/master/docs/hosting/Index.md
- Source, issues, docs: https://github.com/tomacox74/jroc
- License: Apache-2.0
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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. |
-
net10.0
- Acornima (>= 1.1.1)
- Jroc.Runtime (>= 0.9.32)
- Microsoft.Extensions.DependencyInjection (>= 10.0.1)
- Microsoft.Extensions.Logging (>= 10.0.1)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Jroc.Core:
| Package | Downloads |
|---|---|
|
Jroc.SDK
MSBuild SDK package for compiling JavaScript sources into .NET assemblies during dotnet build. |
GitHub repositories
This package is not used by any popular GitHub repositories.