This repository has been archived on 2020-03-27. You can view files and clone it, but cannot push or open issues or pull requests.
Syllabus/themes/piratecare/node_modules/postcss-cli/lib/depGraph.js

23 lines
516 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 []
}