99re热这里只有精品视频,7777色鬼xxxx欧美色妇,国产成人精品一区二三区在线观看,内射爽无广熟女亚洲,精品人妻av一区二区三区

gulp.tree()

2020-09-30 18:07 更新

gulp.tree()介紹

獲取當(dāng)前任務(wù)依賴關(guān)系樹(shù)——在極少數(shù)情況下需要它。

通常,gulp 使用者不會(huì)使用 tree(),但它是公開(kāi)的,因此 CLI 可以顯示在 gulpfile 中定義的任務(wù)的依賴關(guān)系圖。

gulp.tree()用法

Example gulpfile:


const { series, parallel } = require('gulp');

function one(cb) {
  // body omitted
  cb();
}

function two(cb) {
  // body omitted
  cb();
}

function three(cb) {
  // body omitted
  cb();
}

const four = series(one, two);

const five = series(four,
  parallel(three, function(cb) {
    // Body omitted
    cb();
  })
);

module.exports = { one, two, three, four, five };

tree() 的輸出:

{
  label: 'Tasks',
  nodes: [ 'one', 'two', 'three', 'four', 'five' ]
}

tree({ deep: true }) 的輸出:

{
  label: "Tasks",
  nodes: [
    {
      label: "one",
      type: "task",
      nodes: []
    },
    {
      label: "two",
      type: "task",
      nodes: []
    },
    {
      label: "three",
      type: "task",
      nodes: []
    },
    {
      label: "four",
      type: "task",
      nodes: [
        {
          label: "<series>",
          type: "function",
          branch: true,
          nodes: [
            {
              label: "one",
              type: "function",
              nodes: []
            },
            {
              label: "two",
              type: "function",
              nodes: []
            }
          ]
        }
      ]
    },
    {
      label: "five",
      type: "task",
      nodes: [
        {
          label: "<series>",
          type: "function",
          branch: true,
          nodes: [
            {
              label: "<series>",
              type: "function",
              branch: true,
              nodes: [
                {
                  label: "one",
                  type: "function",
                  nodes: []
                },
                {
                  label: "two",
                  type: "function",
                  nodes: []
                }
              ]
            },
            {
              label: "<parallel>",
              type: "function",
              branch: true,
              nodes: [
                {
                  label: "three",
                  type: "function",
                  nodes: []
                },
                {
                  label: "<anonymous>",
                  type: "function",
                  nodes: []
                }
              ]
            }
          ]
        }
      ]
    }
  ]
} 

gulp.tree()函數(shù)原型

tree([options])

參數(shù)

參數(shù)類型描述
optionsobject詳情請(qǐng)見(jiàn)下文 選項(xiàng) 。

返回值

返回一個(gè)詳細(xì)描述已注冊(cè)的任務(wù)樹(shù)的對(duì)象——包含具有 'label' 和 'nodes' 屬性的嵌套對(duì)象(與 archy 兼容)。

每個(gè)對(duì)象可能有一個(gè) type 屬性,用于確定節(jié)點(diǎn)是 task 還是 function。

每個(gè)對(duì)象可能有一個(gè) branch 屬性,當(dāng) true 時(shí),該屬性指示節(jié)點(diǎn)是使用 series() 還是 parallel() 創(chuàng)建的。

選項(xiàng)

nametypedefaultnote
deepbooleanfalse如果為 true,則返回整個(gè)樹(shù)。如果為 false,則只返回頂級(jí)任務(wù)。


以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)