GithubHelp home page GithubHelp logo

sparshithnr / broccoli-node-info Goto Github PK

View Code? Open in Web Editor NEW

This project forked from broccolijs/broccoli-node-info

0.0 1.0 0.0 30 KB

Inspect Broccoli nodes; thin wrapper around node.__broccoliGetInfo__()

License: MIT License

JavaScript 100.00%

broccoli-node-info's Introduction

broccoli-node-info

Build Status

This is a low-level package used to communicate with Broccoli nodes (that is, plugin instances). It provides a thin wrapper around node.__broccoliGetInfo__(), normalizing different versions of the node API to the newest version.

This package is mainly used by the Broccoli Builder class, but it can also be used for inspecting nodes for testing, wrapping, diagnostics, or similar purposes. If you are tempted to call node.__broccoliGetInfo__() or access private variables on broccoli-plugin instances, such as node._name or node._inputNodes, then use this package instead!

For background on the Broccoli node API, see docs/node-api.md.

Usage

var broccoliNodeInfo = require('broccoli-node-info');

node = new SomeBroccoliPlugin();

var nodeInfo = broccoliNodeInfo.getNodeInfo(node);
// Now we can use nodeInfo.name, nodeInfo.annotation, etc.

getNodeInfo(node)

This function calls node.__broccoliGetInfo__(broccoliNodeInfo.features).

For node objects conforming to the most recent node API, it simply returns the resulting nodeInfo object.

For node object conforming to an older version of the node API, it provides compatibility code to normalize the nodeInfo object.

As a result, regardless of the API version used by the node object, we obtain a nodeInfo object conforming to the current specification in docs/node-api.md

This function throws a broccoliNodeInfo.InvalidNodeError when called with

  • a plain string node (while still supported by the Broccoli Builder, they are deprecated in favor of broccoli-source),
  • a node using the old .read/.rebuild API (see docs/broccoli-1-0-plugin-api.md), or
  • some other object that isn't a node.

InvalidNodeError

Error subclass, potentially thrown by getNodeInfo().

features

A hash of all supported feature flags. This hash acts like a version number for the node API. In the current version, its value is

{
  persistentOutputFlag: true,
  sourceDirectories: true
}

broccoli-node-info's People

Contributors

joliss avatar rwjblue avatar thoov avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.