broccoli-node-api
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -17,2 +17,12 @@ /** | ||
export type Node = NodeMap[NodeType]; | ||
export interface TransformNode extends NodeCommon<TransformNodeInfo> {} | ||
export interface SourceNode extends NodeCommon<SourceNodeInfo> {} | ||
export interface NodeMap { | ||
transform: TransformNode; | ||
source: SourceNode; | ||
} | ||
/** | ||
@@ -23,3 +33,3 @@ The Broccoli Node API | ||
*/ | ||
export interface Node { | ||
export interface NodeCommon<T extends NodeInfo> { | ||
/** | ||
@@ -34,3 +44,3 @@ The node's feature set, indicating the API version | ||
*/ | ||
__broccoliGetInfo__: (builderFeatures: FeatureSet) => NodeInfo; | ||
__broccoliGetInfo__: (builderFeatures: FeatureSet) => T; | ||
} | ||
@@ -42,8 +52,13 @@ | ||
*/ | ||
export type NodeInfo = SourceNodeInfo | TransformNodeInfo; | ||
export type NodeInfo = NodeInfoMap[NodeType]; | ||
export interface NodeInfoMap { | ||
source: SourceNodeInfo; | ||
transform: TransformNodeInfo; | ||
} | ||
/** | ||
Either `'transform'` or `'source'`, indicating the node type. | ||
*/ | ||
export type NodeType = NodeInfo["nodeType"]; | ||
export type NodeType = keyof NodeInfoMap; | ||
@@ -69,7 +84,8 @@ /** | ||
@param inputPaths An array of paths corresponding to `NodeInfo.inputNodes`. When building, | ||
@param features builder features | ||
@param options.inputPaths An array of paths corresponding to `NodeInfo.inputNodes`. When building, | ||
the node may read from these paths, but must never write to them. | ||
@param outputPath A path to an empty directory for the node to write its output to when | ||
@param options.outputPath A path to an empty directory for the node to write its output to when | ||
building. | ||
@param cachePath A path to an empty directory for the node to store files it wants to | ||
@param options.cachePath A path to an empty directory for the node to store files it wants to | ||
keep around between builds. This directory will only be deleted when the | ||
@@ -82,3 +98,6 @@ Broccoli process terminates (for example, when the Broccoli server is | ||
*/ | ||
setup(inputPaths: string[], outputPath: string, cachePath: string): void; | ||
setup( | ||
features: FeatureSet, | ||
options: { inputPaths: string[]; outputPath: string; cachePath: string } | ||
): void; | ||
@@ -85,0 +104,0 @@ /** |
{ | ||
"name": "broccoli-node-api", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Broccoli Plugin API Types", | ||
@@ -5,0 +5,0 @@ "repository": "github:broccolijs/broccoli-node-api", |
@@ -8,5 +8,10 @@ # `broccoli-node-api` | ||
- [Node](#node) | ||
- [NodeCommon](#nodecommon) | ||
- [NodeMap](#nodemap) | ||
- [TransformNode](#transformnode) | ||
- [SourceNode](#sourcenode) | ||
- [FeatureSet](#featureset) | ||
- [NodeInfo](#nodeinfo) | ||
- [NodeType](#nodetype) | ||
- [NodeInfoMap](#nodeinfomap) | ||
- [NodeInfoCommon](#nodeinfocommon) | ||
@@ -22,12 +27,47 @@ - [TransformNodeInfo](#transformnodeinfo) | ||
```ts | ||
interface Node { | ||
type Node = TransformNode | SourceNode; | ||
``` | ||
[Node Documentation](https://github.com/broccolijs/broccoli/blob/master/docs/node-api.md#part-2-node-api-specification) | ||
--- | ||
### NodeCommon | ||
```ts | ||
interface NodeCommon<T extends NodeInfo> { | ||
__broccoliFeatures__: FeatureSet; | ||
__broccoliGetInfo__: (builderFeatures: FeatureSet) => NodeInfo; | ||
__broccoliGetInfo__: (builderFeatures: FeatureSet) => T; | ||
} | ||
``` | ||
[Node Documentation](https://github.com/broccolijs/broccoli/blob/master/docs/node-api.md#part-2-node-api-specification) | ||
--- | ||
### NodeMap | ||
```ts | ||
interface NodeMap = { | ||
transform: TransformNode; | ||
source: SourceNode; | ||
}; | ||
``` | ||
--- | ||
### TransformNode | ||
```ts | ||
interface TransformNode extends NodeCommon<TransformNodeInfo> {} | ||
``` | ||
--- | ||
### SourceNode | ||
```ts | ||
interface SourceNode extends NodeCommon<SourceNodeInfo> {} | ||
``` | ||
--- | ||
### FeatureSet | ||
@@ -46,3 +86,3 @@ | ||
```ts | ||
type NodeInfo = SourceNodeInfo | TransformNodeInfo; | ||
type NodeInfo = TransformNodeInfo | SourceNodeInfo; | ||
``` | ||
@@ -57,3 +97,3 @@ | ||
```ts | ||
type NodeType = "source" | "transform"; | ||
type NodeType = "transform" | "source"; | ||
``` | ||
@@ -63,2 +103,13 @@ | ||
### NodeInfoMap | ||
```ts | ||
interface NodeInfoMap = { | ||
transform: TransformNodeInfo; | ||
source: SourceNodeInfo; | ||
}; | ||
``` | ||
--- | ||
### NodeInfoCommon | ||
@@ -82,3 +133,6 @@ | ||
inputNodes: Node[]; | ||
setup(inputPaths: string[], outputPath: string, cachePath: string): void; | ||
setup( | ||
features: FeatureSet, | ||
options: { inputPaths: string[]; outputPath: string; cachePath: string } | ||
): void; | ||
getCallbackObject(): CallbackObject; | ||
@@ -85,0 +139,0 @@ persistentOutput: boolean; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10779
161
162