VOOZH about

URL: https://www.nuget.org/packages/Esprima/

⇱ NuGet Gallery | Esprima 3.0.6




Esprima 3.0.6

dotnet add package Esprima --version 3.0.6
 
 
NuGet\Install-Package Esprima -Version 3.0.6
 
 
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="Esprima" Version="3.0.6" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Esprima" Version="3.0.6" />
 
Directory.Packages.props
<PackageReference Include="Esprima" />
 
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 Esprima --version 3.0.6
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Esprima, 3.0.6"
 
 
#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 Esprima@3.0.6
 
 
#: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=Esprima&version=3.0.6
 
Install as a Cake Addin
#tool nuget:?package=Esprima&version=3.0.6
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
📣 Important notices
If you are upgrading from an older version, please note that version 3 ships with numerous breaking changes to the public API because virtually all areas of the library have been revised.<br />Documentation of the previous major version is available here.

👁 Build
👁 NuGet
👁 MyGet

Esprima .NET (BSD license) is a .NET port of the esprima.org project. It is a standard-compliant ECMAScript parser (also popularly known as JavaScript).

Features

API

Esprima can be used to perform lexical analysis (tokenization) or syntactic analysis (parsing) of a JavaScript program.

A simple C# example:

var parser = new JavaScriptParser();
var program = parser.ParseScript("const answer = 42");

You can control the behavior of the parser by initializing and passing a ParserOptions to the parser's constructor. (For the available options, see the XML documentation of the ParserOptions class.)

Instead of ParseScript, you may use ParseModule or ParseExpression to make the parser treat the input as an ES6 module or as a plain JavaScript expression respectively.

In case the input is syntactically correct, each of these methods returns the root node of the resulting abstract syntax tree (AST), which you can freely analyze or transform. The library provides the AstVisitor and AstRewriter visitor classes to help you with such tasks.

When the input contains a severe syntax error, a ParserException is thrown. By catching it you can get details about the error. There are syntax errors though which can be tolerated by the parser. Such errors are ignored by default. You can record them by setting ParserOptions.ErrorHandler to an instance of CollectingErrorHandler. Alternatively, you can set ParserOptions.Tolerant to false to make the parser throw exceptions also in the case of tolerable syntax errors.

The library is able to write the AST (except for comments) back to JavaScript code:

var code = program.ToJavaScriptString(format: true);

It is also possible to serialize the AST into a JSON representation:

var astJson = program.ToJsonString(indent: " ");

Considering the example above this call will return the following JSON:

{
 "type": "Program",
 "body": [
 {
 "type": "VariableDeclaration",
 "declarations": [
 {
 "type": "VariableDeclarator",
 "id": {
 "type": "Identifier",
 "name": "answer"
 },
 "init": {
 "type": "Literal",
 "value": 42,
 "raw": "42"
 }
 }
 ],
 "kind": "const"
 }
 ],
 "sourceType": "script",
 "strict": false
}

Benchmarks

Here is a list of common JavaScript libraries and the time it takes to parse them, compared to the time it took for the same script using the original Esprima in Chrome.

Script Size Esprima .NET (.NET 6) Esprima (Chrome 116)
underscore-1.5.2 43 KB 1.0 ms 1.4 ms
backbone-1.1.0 59 KB 1.2 ms 1.6 ms
mootools-1.4.5 157 KB 5.2 ms 7.1 ms
jquery-1.9.1 262 KB 6.6 ms 7.9 ms
yui-3.12.0 330 KB 4.6 ms 6.9 ms
jquery.mobile-1.4.2 442 KB 10.0 ms 17.7 ms
angular-1.2.5 702 KB 8.5 ms 15.1 ms
Product Versions Compatible and additional computed target framework versions.
.NET net5.0 net5.0 was computed.  net5.0-windows net5.0-windows was computed.  net6.0 net6.0 was computed.  net6.0-android net6.0-android was computed.  net6.0-ios net6.0-ios was computed.  net6.0-maccatalyst net6.0-maccatalyst was computed.  net6.0-macos net6.0-macos was computed.  net6.0-tvos net6.0-tvos was computed.  net6.0-windows net6.0-windows was computed.  net7.0 net7.0 was computed.  net7.0-android net7.0-android was computed.  net7.0-ios net7.0-ios was computed.  net7.0-maccatalyst net7.0-maccatalyst was computed.  net7.0-macos net7.0-macos was computed.  net7.0-tvos net7.0-tvos was computed.  net7.0-windows net7.0-windows was computed.  net8.0 net8.0 was computed.  net8.0-android net8.0-android was computed.  net8.0-browser net8.0-browser was computed.  net8.0-ios net8.0-ios was computed.  net8.0-maccatalyst net8.0-maccatalyst was computed.  net8.0-macos net8.0-macos was computed.  net8.0-tvos net8.0-tvos was computed.  net8.0-windows net8.0-windows was computed.  net9.0 net9.0 was computed.  net9.0-android net9.0-android was computed.  net9.0-browser net9.0-browser was computed.  net9.0-ios net9.0-ios was computed.  net9.0-maccatalyst net9.0-maccatalyst was computed.  net9.0-macos net9.0-macos was computed.  net9.0-tvos net9.0-tvos was computed.  net9.0-windows net9.0-windows was computed.  net10.0 net10.0 was computed.  net10.0-android net10.0-android was computed.  net10.0-browser net10.0-browser was computed.  net10.0-ios net10.0-ios was computed.  net10.0-maccatalyst net10.0-maccatalyst was computed.  net10.0-macos net10.0-macos was computed.  net10.0-tvos net10.0-tvos was computed.  net10.0-windows net10.0-windows was computed. 
.NET Core netcoreapp2.0 netcoreapp2.0 was computed.  netcoreapp2.1 netcoreapp2.1 was computed.  netcoreapp2.2 netcoreapp2.2 was computed.  netcoreapp3.0 netcoreapp3.0 was computed.  netcoreapp3.1 netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 netstandard2.0 is compatible.  netstandard2.1 netstandard2.1 is compatible. 
.NET Framework net461 net461 was computed.  net462 net462 is compatible.  net463 net463 was computed.  net47 net47 was computed.  net471 net471 was computed.  net472 net472 was computed.  net48 net48 was computed.  net481 net481 was computed. 
MonoAndroid monoandroid monoandroid was computed. 
MonoMac monomac monomac was computed. 
MonoTouch monotouch monotouch was computed. 
Tizen tizen40 tizen40 was computed.  tizen60 tizen60 was computed. 
Xamarin.iOS xamarinios xamarinios was computed. 
Xamarin.Mac xamarinmac xamarinmac was computed. 
Xamarin.TVOS xamarintvos xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (11)

Showing the top 5 NuGet packages that depend on Esprima:

Package Downloads
cloudscribe.SimpleContent.Web

A simple, yet flexible content and blog engine for ASP.NET Core that can work with or without a database

PlaywrightSharp

PlaywrightSharp is a .NET library to automate Chromium, Firefox and WebKit with a single API. Playwright is built to enable cross-browser web automation that is ever-green, capable, reliable and fast.

AcmUtilities

Package Description

BlendedJint

Javascript interpreter for .NET which provides full ECMA 5.1 compliance.

Demego.Headless.Api.Core

Package Description

GitHub repositories (4)

Showing the top 4 popular GitHub repositories that depend on Esprima:

Repository Stars
openbullet/openbullet
The OpenBullet web testing application.
ape-byte/DouyinBarrageGrab
基于系统代理的抖音弹幕wss抓取程序,能够获取所有数据来源,包括chrome,抖音直播伴侣等,可进行进程过滤
FortuneN/FineCodeCoverage
Visualize unit test code coverage easily for free in Visual Studio Community Edition (and other editions too)
TeslaFly01/SmartSqlT
🔥🔥🔥 SmartSQL 是一款方便、快捷的数据库文档查询、导出工具!该工具从最初支持CHM文档格式开始,通过不断地探索开发、集思广益和不断改进,又陆续支持Word、Excel、PDF、Html、Xml、Json、MarkDown等文档格式的导出。同时支持SqlServer、MySql、PostgreSQL、SQLite等多种数据库的文档查询和导出功能。
Version Downloads Last Updated
3.0.6 19,905 4/25/2026
3.0.5 1,711,369 4/9/2024
3.0.4 1,013,266 12/31/2023
3.0.3 1,039 12/30/2023
3.0.2 165,876 11/4/2023
3.0.1 426,085 9/10/2023
3.0.0 1,865 9/3/2023
Loading failed