pertain
Version:
Automated pub/sub across project dependencies. Run code from any installed package based on declarative rules in package.json
28 lines (27 loc) • 1.09 kB
TypeScript
import ExplicitDependency from './ExplicitDependency';
import { Resolver } from './resolverFactory';
/**
* A set of modules that can be queried for pertaining to a given subject.
*/
export default class ExplicitDependencySet {
private resolve;
private dependencies;
/**
* Cache storage to prevent unnecessary recalculation of the same list.
* The same subject should result in the same list while this object exists.
*/
private sortedBySubject;
constructor(resolve: Resolver, names: string[]);
/**
* Gets a list of ExplicitDependencies in this set which pertain to the
* subject (that is, their `package.json` has a valid key for the subject
* that indicates a requireable file). Detects dependencies between the
* packages that pertain and sorts the list in dependency order.
*/
pertaining(subject: string): ExplicitDependency[];
/**
* Only add dependencies which can be resolved in the first place. If there
* is a problem finding them, just skip them; they don't pertain!
*/
private add;
}