Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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 = [];