TypeScript types for the Broccoli Node Api
type Node = TransformNode | SourceNode;
type InputNode = Node | string;
interface NodeCommon<T extends NodeInfo> {
__broccoliFeatures__: FeatureSet;
__broccoliGetInfo__: (builderFeatures: FeatureSet) => T;
}
interface NodeMap = {
transform: TransformNode;
source: SourceNode;
};
interface TransformNode extends NodeCommon<TransformNodeInfo> {}
interface SourceNode extends NodeCommon<SourceNodeInfo> {}
interface FeatureSet {
[feature: string]: boolean;
}
type NodeInfo = TransformNodeInfo | SourceNodeInfo;
type NodeType = "transform" | "source";
interface NodeInfoMap = {
transform: TransformNodeInfo;
source: SourceNodeInfo;
};
interface NodeInfoCommon<T extends NodeType> {
nodeType: T;
name: string;
annotation: string | null | undefined;
instantiationStack: string;
}
interface TransformNodeInfo extends NodeInfoCommon<"transform"> {
inputNodes: Node[];
setup(
features: FeatureSet,
options: { inputPaths: string[]; outputPath: string; cachePath: string }
): void;
getCallbackObject(): CallbackObject;
persistentOutput: boolean;
needsCache: boolean;
volatile: boolean;
trackInputChanges: boolean;
}
TransformNodeInfo Documentation
interface CallbackObject {
build(buildChangeObject?: BuildChangeObject): Promise<void> | void;
}
interface BuildChangeObject {
changedNodes: boolean[];
}
interface SourceNodeInfo extends NodeInfoCommon<"source"> {
sourceDirectory: string;
watched: boolean;
}