open-index/open-npm huggingface dataset:
npm package: @ponticus/ast-walker
Description: Provides a simple Javascript AST traversal utility that traverses all nodes / children regardless of type.
Latest version: 0.0.1

# @ponticus/ast-walker

Provides a simple Javascript AST traversal utility that traverses all nodes / children regardless of type.

A single method `traverse` takes an AST object or array of nodes and a callback object which may contain two methods `enterNode` and `exitNode` which are invoked with the current node and the parent node respectively when entering and exiting a given node during traversal.

`enterNode` may return a array of strings which provide a set of children keys to ignore or `null` to skip traversing children keys entirely.

To install `@ponticus/ast-walker` provide this entry in `package.json`:

```json
{
  ...
  "dependencies": {
    "@ponticus/ast-walker": "^0.2.0"
  }
}
```  

A simple example follows:

```js
import walker from '@ponticus/ast-walker';

const ast = .... // An AST tree.

walker.traverse(ast, {
   enterNode: (node, parent) => {
      console.log(`walker - enterNode: ${node.type}`);

      // Optional return statement to ignore specific children keys.
      // return node.type === 'ClassBody' ? ['body'] : undefined;

      // Optional return statement to ignore specific children keys or skip traversal entirely.
      // return node.type === 'ClassBody' ? null : undefined;
   },
   
   exitNode: (node, parent) => {
      console.log(`walker - exitNode: ${node.type}`);
   }
});
 
```

Support for [@ponticus/plugin-manager](https://www.npmjs.com/package/@ponticus/plugin-manager) is also available and
when loading `@ponticus/ast-walker` as a plugin it will automatically register event bindings on the plugin eventbus
with these event categories:

`ast:walker:traverse` - invokes `traverse` of the default walker.

Example `@ponticus/plugin-manager` usage:

```js
import PluginManager    from '@ponticus/plugin-manager';
import eventbus         from '@ponticus/backbone-esnext-eventbus';

const pluginManager = new PluginManager({ eventbus });

pluginManager.add({ name: @ponticus/ast-walker });

// This will automatically wire up @ponticus/ast-walker to the eventbus. 

eventbus.trigger('ast:walker:traverse', ast, {
   enterNode: (node, parent) => {
      console.log(`walker - enterNode: ${node.type}`);
   },
   exitNode: (node, parent) => {
      console.log(`walker - exitNode: ${node.type}`);
   }
});
```
npm package: @ponticus/backbone-esnext-events
Description: Separates 'events' support from Backbone in addition to adding TyphonJS extensions.
Latest version: 0.0.1

# @ponticus/backbone-esnext-events

For essential information pertaining to backbone-esnext please refer to [backbone-esnext](https://github.com/typhonjs-backbone-esnext/backbone-esnext) and the main [issues forum](https://github.com/typhonjs-backbone-esnext/backbone-esnext/issues).

`@ponticus/backbone-esnext-events` separates 'Events' support from [backbone-esnext](https://github.com/typhonjs-backbone-esnext) in addition to adding TyphonJS extensions found in [TyphonEvents](https://github.com/typhonjs-backbone-esnext/backbone-esnext-events/blob/master/src/TyphonEvents.js). The events dispatch functionality is useful well outside the context of Backbone and is utilized across several TyphonJS repos. It should be noted that there are no dependencies with backbone-esnext-events and it can be used independently in any project without pulling in Underscore like Backbone does. 

The default trigger mechanism work justs as it does with Backbone:
- `trigger` - Invokes all targets matched with a one way message. 

TyphonEvents adds new functionality for triggering events. The following are new trigger mechanisms:

- `triggerDefer` - Defers invoking `trigger` to the next clock tick.
- `triggerSync` - Synchronously invokes all targets matched and passes back a single value or an array of results to the callee.
- `triggerAsync` - Asynchronously invokes all targets matched and passes back a promise resolved with a single value or an array of results through `Promise.all` which returns a single promise to the callee.

To import TyphonEvents and create a new instance: 
```
import Events from 'backbone-esnext-events';

const eventbus = new Events();

// or extend a class to add event functionality
 
export default class MyThing extends Events {}
```

Please see [backbone-esnext-eventbus](https://www.npmjs.com/package/backbone-esnext-eventbus) for a module which provides a default main eventbus instance for ease of use across modules.
npm package: @ponticus/escomplex
Description: Next generation complexity reporting for Javascript & Typescript based on the Babel parser.
Latest version: 0.0.1

# @ponticus/escomplex

`@ponticus/escomplex` provides next generation Javascript and Typescript complexity reports by utilizing [babel parser](https://www.npmjs.com/package/@babel/parser) w/ all plugins enabled to parse JS / TS source code feeding the rest of the AST / processing modules which are available separately. Please review the [typhonjs-node-escomplex](https://github.com/typhonjs-node-escomplex) organization for all of the separate components which may be used independently if direct AST processing is required. `typhonjs-escomplex` simply provides a shim using `babel parser` to produce the AST.

Work is swiftly being finished.

More information forthcoming. This NPM module can be installed as a dependency in `package.json` as follows:

```json
"dependencies": {
  "@ponticus/escomplex": "^0.1.0"
}
```


An example follows:

```js
import escomplex from '@ponticus/escomplex';

const source = "<some JS source code>";

const report = escomplex.analyzeModule(source);
```
npm package: @ponticus/escomplex-module
Description: Provides module / individual file oriented AST processing for @ponticus/escomplex complexity reports.
Latest version: 0.0.1

# @ponticus/escomplex-module

Provides module / individual file oriented AST processing for typhonjs-escomplex complexity reports. The following JS AST generators are supported / tested: [acorn](https://www.npmjs.com/package/acorn), [babel parser](https://www.npmjs.com/package/@babel/parser), [babylon](https://www.npmjs.com/package/babylon), [espree](https://www.npmjs.com/package/espree), [esprima](https://www.npmjs.com/package/esprima). Any compliant JS parser that supports Babylon or ESTree AST should work as well.

More information forthcoming. This NPM module can be installed as a dependency in `package.json` as follows:

```json
"dependencies": {
  "@ponticus/escomplex-module": "^0.1.0"
}
```

An example follows:

```js
import escomplexModule from '@ponticus/escomplex-module';

const ast = "<some parsed AST>";

const report = escomplexModule.analyze(ast);
```
npm package: @ponticus/escomplex-plugin-syntax-babylon
Description: Provides a plugin for @ponticus/escomplex module processing which loads syntax definitions for trait resolution for Babylon AST.
Latest version: 0.0.1

# @ponticus/escomplex-plugin-syntax-babylon

Provides a plugin for `@ponticus/escomplex` module processing which loads syntax definitions for trait resolution for Babylon AST.
npm package: @ponticus/escomplex-plugin-syntax-estree
Description: Provides a plugin for @ponticus/escomplex module processing which loads syntax definitions for trait resolution for ESTree AST.
Latest version: 0.0.1

# @ponticus/escomplex-plugin-syntax-estree

Provides a plugin for `@ponticus/escomplex` module processing which loads syntax definitions for trait resolution for ESTree AST.
npm package: @ponticus/escomplex-project
Description: Provides project oriented AST processing for @ponticus/escomplex complexity reports.
Latest version: 0.0.1

# @ponticus/escomplex-project

Provides project oriented AST processing for typhonjs-escomplex complexity reports. The following JS AST generators are supported / tested: [acorn](https://www.npmjs.com/package/acorn), [babel parser](https://www.npmjs.com/package/@babel/parser), [babylon](https://www.npmjs.com/package/babylon), [espree](https://www.npmjs.com/package/espree), [esprima](https://www.npmjs.com/package/esprima). Any compliant JS parser that supports Babylon or ESTree AST should work as well.

More information forthcoming. This NPM module can be installed as a dependency in `package.json` as follows:

```json
"dependencies": {
  "@ponticus/escomplex-project": "^0.1.0"
}
```

An example follows:

```js
import escomplexProject from '@ponticus/escomplex-project';

const modules = [
   { ast: "<some parsed AST>", srcPath: 'a/file/path/1' },
   { ast: "<some parsed AST>", srcPath: 'a/file/path/2' }
];

const results = escomplexProject.analyze(modules);
```
npm package: @ponticus/escomplex-test-data
Description: Provides shared test data resources for all @ponticus/escomplex repos.
Latest version: 0.0.1

# @ponticus/escomplex-test-data

Provides shared test data resources for all typhonjs-escomplex repos.

This repo is included in devDependencies linked directly to GitHub such as:
```
  "devDependencies": {
    "@ponticus/escomplex-test-data": "git+https://git@github.com/gabrielcsapo/packages/@ponticus/escomplex-test-data.git"
  },
```

The following files are available:

`./files/large-project/results/results.json`: A serialized ProjectResult of @ponticus/escomplex-project and dependencies. 

`./files/large-project/results/results-no-reports.json`: A serialized ProjectResult of @ponticus/escomplex-project and dependencies without ModuleReports serialized. 

`./files/large-module/report/report.json`: A serialized ModuleReport of `backbone-es6`-> `Collection.js`. 

`./files/large-module/src/Collection.js`: The JS source that generated large-module `report.json`. 

An examples follows on how to load and parse files for use:

```js
import { ProjectResult } from '@ponticus/escomplex-commons';

// You can either use `fs`.
// const largeProjectJSON = 
//  JSON.parse(fs.readFileSync('./node_modules/@ponticus/escomplex-test-data/files/large-project/results/results.json', 'utf8'));

// Or for JSON files simply `require` it.
const largeProjectJSON = require('@ponticus/escomplex-test-data/files/large-project/results/results');

const projectResult = ProjectResult.parse(largeProjectJSON);

console.log(projectResult.toFormat('markdown'));
```