This repository has been archived on 2021-05-23. You can view files and clone it, but cannot push or open issues or pull requests.
simpledash/bulma/node_modules/postcss-cli/lib/depGraph.js

23 lines
520 B
JavaScript

'use strict'
const path = require('path')
const DepGraph = require('dependency-graph').DepGraph
const graph = new DepGraph()
exports.add = (message) => {
message.parent = path.resolve(message.parent)
message.file = path.resolve(message.file)
graph.addNode(message.parent)
graph.addNode(message.file)
graph.addDependency(message.parent, message.file)
return message
}
exports.dependantsOf = (node) => {
node = path.resolve(node)
if (graph.hasNode(node)) return graph.dependantsOf(node)
return []
}