tree()#
获取当前任务依赖树 - 在极少数需要的情况下。
¥Fetches the current task dependency tree - in the rare case that it is needed.
一般来说,tree() 不会被 gulp 使用者使用,但它被公开,以便 CLI 可以显示 gulpfile 中定义的任务的依赖图。
¥Generally, tree() won't be used by gulp consumers, but it is exposed so the CLI can show the dependency graph of the tasks defined in a gulpfile.
用法#
¥Usage
示例 gulp 文件:
¥Example gulpfile:
tree() 的输出:
¥Output for tree():
tree({ deep: true }) 的输出:
¥Output for tree({ deep: true }):
签名#
¥Signature
参数#
¥Parameters
| 参数 | type | note |
|---|---|---|
| options | object | 详细见下文 选项。 |
返回#
¥Returns
详细说明已注册任务树的对象 - 包含具有 'label' 和 'nodes' 属性的嵌套对象(与 archy 兼容)。
¥An object detailing the tree of registered tasks - containing nested objects with 'label' and 'nodes' properties (which is archy compatible).
每个对象可能有一个 type 属性,可用于确定该节点是 task 还是 function。
¥Each object may have a type property that can be used to determine if the node is a task or function.
每个对象可能有一个 branch 属性,当 true 时,表明该节点是使用 series() 或 parallel() 创建的。
¥Each object may have a branch property that, when true, indicates the node was created using series() or parallel().
选项#
¥Options
| name | type | default | note |
|---|---|---|---|
| deep | boolean | false | 如果为 true,则将返回整棵树。如果为 false,则仅返回顶层任务。 |