npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

buntis

v0.2.1

Published

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

Downloads

42,187

Readme

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
                }
            ]
        }
    ]
}