webpack-bundle-analyzer
Version:
Webpack plugin and CLI utility that represents bundle content as convenient interactive zoomable treemap
33 lines (32 loc) • 652 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
class Node {
/**
* @param {string} name name
* @param {Node=} parent parent
*/
constructor(name, parent) {
/** @type {string} */
this.name = name;
/** @type {Node | undefined} */
this.parent = parent;
}
get path() {
/** @type {string[]} */
const path = [];
/** @type {Node | undefined} */
let node = this;
while (node) {
path.push(node.name);
node = node.parent;
}
return path.reverse().join("/");
}
get isRoot() {
return !this.parent;
}
}
exports.default = Node;