All Projects → buntis → Buntis

buntis / Buntis

Licence: isc
A 100% compliant, self-hosted typescript parser that emits an ESTree-compatible AST

Programming Languages

javascript
184084 projects - #8 most used programming language
typescript
32286 projects
ecmascript
72 projects

Projects that are alternatives of or similar to Buntis

Cherow
Very fast and lightweight, standards-compliant, self-hosted javascript parser with high focus on both performance and stability
Stars: ✭ 1,539 (+1610%)
Mutual labels:  tc39, parsing, performance
Meriyah
A 100% compliant, self-hosted javascript parser - https://meriyah.github.io/meriyah
Stars: ✭ 690 (+666.67%)
Mutual labels:  tc39, parsing, performance
Escaya
An blazing fast 100% spec compliant, incremental javascript parser written in Typescript
Stars: ✭ 217 (+141.11%)
Mutual labels:  tc39, parsing, performance
Binjs Ref
Reference implementation for the JavaScript Binary AST format
Stars: ✭ 399 (+343.33%)
Mutual labels:  parsing, performance
Seafox
A blazing fast 100% spec compliant, self-hosted javascript parser written in Typescript
Stars: ✭ 425 (+372.22%)
Mutual labels:  tc39, parsing
Lightkeeper
Run Lighthouse tests in Pull Requests for multiple URLs with custom budgets
Stars: ✭ 83 (-7.78%)
Mutual labels:  performance
Uaiso
A multi-language parsing infrastructure with an unified AST
Stars: ✭ 86 (-4.44%)
Mutual labels:  parsing
Pwmetrics
Progressive web metrics at your fingertipz
Stars: ✭ 1,243 (+1281.11%)
Mutual labels:  performance
Lodestone Nodejs
Character tracking and parser library for nodejs
Stars: ✭ 81 (-10%)
Mutual labels:  parsing
Xpedite
A non-sampling profiler purpose built to measure and optimize performance of ultra low latency/real time systems
Stars: ✭ 89 (-1.11%)
Mutual labels:  performance
Karma Benchmark
A Karma plugin to run Benchmark.js over multiple browsers with CI compatible output.
Stars: ✭ 88 (-2.22%)
Mutual labels:  performance
Doom Nano
A 3d raycast engine for Arduino
Stars: ✭ 86 (-4.44%)
Mutual labels:  performance
Quicklink
⚡️Faster subsequent page-loads by prefetching in-viewport links during idle time
Stars: ✭ 9,176 (+10095.56%)
Mutual labels:  performance
Streaming Benchmarks
Benchmarks to compare Haskell streaming library performance
Stars: ✭ 87 (-3.33%)
Mutual labels:  performance
Torchlambda
Lightweight tool to deploy PyTorch models to AWS Lambda
Stars: ✭ 83 (-7.78%)
Mutual labels:  performance
Rubberduck
Every programmer needs a rubberduck. COM add-in for the VBA & VB6 IDE (VBE).
Stars: ✭ 1,287 (+1330%)
Mutual labels:  parsing
Lighthouse Keeper
Keep an eye on Google Lighthouse score changes directly on GitHub 💡👀
Stars: ✭ 82 (-8.89%)
Mutual labels:  performance
Imtools
Fast and memory-efficient immutable collections and helper data structures
Stars: ✭ 85 (-5.56%)
Mutual labels:  performance
Hibernate Performance
Samples for "Hibernate performance tuning" talk
Stars: ✭ 87 (-3.33%)
Mutual labels:  performance
Methodtraceman
用于快速找到高耗时方法,定位解决Android App卡顿问题。通过gradle plugin+ASM实现可配置范围的方法插桩来统计所有方法的耗时,并提供友好的界面展示,支持耗时筛选、线程筛选、方法名筛选等。(A Tool for Discovering High Time-consuming Methods for Android App)
Stars: ✭ 1,258 (+1297.78%)
Mutual labels:  performance

Buntis

A 100% compliant, self-hosted Typescript parser that emits an ESTree-compatible abstract syntax tree

Azure Pipelines GitHub license Total alerts Circle Circle


Features

  • Conforms to the standard ECMAScript® 2020 (ECMA-262 10th Edition) language specification
  • Conforms to the latest Typescript language specification
  • Support TC39 proposals via option (wip)
  • Support for additional ECMAScript features for Web Browsers
  • JSX / TSX support via option
  • Optionally track syntactic node locations (wip)
  • Emits an ESTree-compatible abstract syntax tree
  • No backtracking
  • Low memory usage
  • Very well tested (~16 000 unit tests with full code coverage)
  • Lightweight - ~85 KB minified

Installation

npm install buntis --save-dev

API

Buntis generates AST according to ESTree AST format, and can be used to perform syntactic analysis (parsing) of a Javascript or Typescript program, and with ES2015 and later a JavaScript program can be either a script or a module. The same methods are used when parsing in Typescript mode - parseTSModule and parseTSScript.

The parse methods exposed by Buntis takes an optional options object which allows you to specify whether to parse in script mode (the default) or in module mode or Typescript mode.

This is the available options:

{

  // Enabled directives
  directives: false;

  // Disable web compability
  disableWebCompat: false;

  // Enable React JSX parsing when set to `true`
  jsx: false

  // The flag to enable stage 3 support (ESNext)
  next: false;

  // The flag to enable line/column location information to each node
  loc: false;

  // The flag to attach raw property to each literal and identifier node
  raw: false;

  // The flag to allow return in the global scope
  globalReturn: false;

  // The flag to enable implied strict mode
  impliedStrict: false;

  // Enable comment extraction. Accepts **only** a function
  onComment: function() {}

  // Enable Typescript parsing
  ts: false

  // Adds a source attribute in every node’s loc object when the locations option is `true`
  source: false;
}

Example usage:

import { parseTSScript } from './buntis';

parseTSScript('const f = function<T>(x?: T): T {}');

This will return when serialized in json:

   {
    "type": "Program",
    "sourceType": "script",
    "body": [
        {
            "type": "VariableDeclaration",
            "kind": "const",
            "declarations": [
                {
                    "type": "VariableDeclarator",
                    "init": {
                        "type": "FunctionExpression",
                        "params": [
                            {
                                "type": "Identifier",
                                "name": "x",
                                "optional": true,
                                "typeAnnotation": {
                                    "type": "TypeAnnotation",
                                    "typeAnnotation": {
                                        "type": "TypeReference",
                                        "typeName": {
                                            "type": "Identifier",
                                            "name": "T"
                                        },
                                        "typeParameters": []
                                    }
                                }
                            }
                        ],
                        "body": {
                            "type": "BlockStatement",
                            "body": []
                        },
                        "async": false,
                        "generator": false,
                        "id": null,
                        "typeParameters": {
                            "type": "TypeParameterDeclaration",
                            "params": [
                                {
                                    "type": "TypeParameter",
                                    "name": {
                                        "type": "Identifier",
                                        "name": "T",
                                        "optional": 0,
                                        "typeAnnotation": []
                                    },
                                    "constraint": null,
                                    "default": null
                                }
                            ]
                        },
                        "returnType": {
                            "type": "TypeAnnotation",
                            "typeAnnotation": {
                                "type": "TypeReference",
                                "typeName": {
                                    "type": "Identifier",
                                    "name": "T",
                                    "optional": false,
                                    "typeAnnotation": []
                                },
                                "typeParameters": []
                            }
                        },
                        "declare": false
                    },
                    "id": {
                        "type": "Identifier",
                        "name": "f",
                        "optional": false,
                        "typeAnnotation": []
                    },
                    "definite": false
                }
            ]
        }
    ]
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].