How to use the broccoli-node-info.getNodeInfo function in broccoli-node-info

To help you get started, we’ve selected a few broccoli-node-info examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github broccolijs / broccoli / lib / builder.ts View on Github external
makeNodeWrapper(node: Node, _stack: any = []) {
    let wrapper = this._nodeWrappers.get(node);
    if (wrapper !== undefined) {
      return wrapper;
    }

    // Turn string nodes into WatchedDir nodes
    const originalNode = node; // keep original (possibly string) node around for deduping
    if (typeof node === 'string') {
      node = new WatchedDir(node, { annotation: 'string node' });
    }

    // Call node.__broccoliGetInfo__()
    let nodeInfo;
    try {
      nodeInfo = broccoliNodeInfo.getNodeInfo(node);
    } catch (e) {
      if (!(e instanceof broccoliNodeInfo.InvalidNodeError)) throw e;
      // We don't have the instantiation stack of an invalid node, so to aid
      // debugging, we instead report its parent node
      const messageSuffix =
        _stack.length > 0
          ? '\nused as input node to ' +
            _stack[_stack.length - 1].label +
            _stack[_stack.length - 1].formatInstantiationStackForTerminal()
          : '\nused as output node';
      throw new broccoliNodeInfo.InvalidNodeError(e.message + messageSuffix);
    }

    // Compute label, like "Funnel (test suite)"
    let label = nodeInfo.name;
    const labelExtras = [];

broccoli-node-info

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

MIT
Latest version published 3 years ago

Package Health Score

53 / 100
Full package analysis