导入资源
@param {Object} options
@param {String []} paths
@param {String} dist
546594
function importResources({ paths = [], dist = '', needDirPath = true } = {}, doneCallback) {
  try {
    if (dist.length === 0) {
      throw  'ERROR: [option.dist] is required';
    }
  } catch (e) {
    console.log(e.red);
    process.env.exit(0);
  }
  console.log('ImportResources ...');
  /**
   * 获取全部文件的路径
   * @param paths
   * @param callback
   */
  const getPathsAllFiles = (paths, callback) => {
    let allFiles = [];
    const absolutePaths = paths.map(path => Path.join(rootPath, path));
    async.eachLimit(absolutePaths, 1, (path, next) => {
      glob(path, {}, (err, files) => {
        if (err) {
          console.log(err);
        } else {
          allFiles = [...allFiles, ...files];
        }
        next();
      });
    }, () => callback && callback(allFiles));
  }

  /**
   * 复制文件
   * @param files
   * @param callback
   */
  const copyFiles = (files, callback) => {
    async.eachLimit(files, 1, (filePath, next) => {
      const outputPath = needDirPath ? Path.relative(rootPath, filePath) : Path.basename(filePath);
      console.log(`Copy ${outputPath}`);
      fse.copy(filePath, Path.join(dist, outputPath), function (err) {
        if (err) {
          console.error(err);
        }
        next();
      });
    }, () => {
      callback && callback();
      doneCallback && doneCallback();
    });
  }

  getPathsAllFiles(paths, file => copyFiles(file, () => {
    console.log('ImportResources ' + '[SUCCESS]'.green);
  }));

  return module.exports;
}
49301
public void setPaths(String paths) {
                if (paths != null && paths.trim().length() > 0) {
                        String[] pathArray = paths.split(",");
                        pathList.addAll(Arrays.asList(pathArray));
                }
        }
309886
function elint (files, options) {
  co(function * () {
    const fileList = yield walker(files, options)

    // 没有匹配到任何文件，直接退出
    if (!fileList.es.length && !fileList.style.length) {
      process.exit()
    }

    // linters 对象，方便后续操作
    const linters = {
      es: eslint,
      style: stylelint
    }

    // 处理 fix 和 forceFix
    const isGit = yield isGitHooks()

    if (isGit) {
      options.fix = false
    }
    if (options.forceFix) {
      options.fix = true
    }

    debug('parsed options: %o', options)

    const { type } = options
    const argus = JSON.stringify(options)
    let workers = []

    if (type) {
      // 明确指定 type，例如 elint lint es "*.js"
      workers.push(linters[type](argus, ...fileList[type]))
    } else {
      /**
       * 没有明确指定 type，根据文件类型判断支持哪些 linter
       * 使用 _.toPairs 兼容 node v6
       */
      _.toPairs(linters).forEach(([linterType, linter]) => {
        if (!fileList[linterType].length) {
          return
        }

        workers.push(linter(argus, ...fileList[linterType]))
      })
    }

    // 添加 notifier
    workers.push(notifier.notify())

    Promise.all(workers).then(results => {
      const notifierResult = results.pop()
      const lintResults = results

      const outputs = []
      let success = true

      lintResults.forEach(result => {
        const output = JSON.parse(result.stdout)
        outputs.push(output)
        success = success && output.success
      })

      console.log(report(outputs))

      if (notifierResult) {
        console.log(notifierResult)
      }

      process.exit(success ? 0 : 1)
    })
  })
}
591473
function palette({ baseColor: themeColor = baseColor, src = 'css/rsuite.min.css', dist } = {}, doneCallback) {

  try {
    if (!dist) {
      throw  `ERROR: [option.dist] is required`;
    }
  } catch (e) {
    console.log(e.red);
    return;
  }

  const originColors = color.calcColors(baseColor);
  const themeColors = color.calcColors(themeColor);
  const distPath = Path.dirname(dist);

  const ensureDir = path => new Promise((resolve) => {
    fse.ensureDir(path, () => resolve());
  });

  const readData = path => new Promise(resolve => {
    fs.readFile(path, 'utf-8', (err, data) => {
      resolve(data || '');
    });
  });

  const writeData = (path, data) => new Promise((resolve, reject) => {
    fs.writeFile(path, data, (err) => {
      if (err) {
        reject(err);
      }
      resolve();
    });
  });

  const handleCallback = (...args) => doneCallback && doneCallback(args);

  const generateThemes = async function () {
    try {
      await ensureDir(distPath);
      let data = await readData(Path.join(rootPath, src));
      originColors.forEach((color, index) => {
        data = data.replace(new RegExp(color, 'g'), themeColors[index]);
      });
      await  writeData(dist, data);
      console.log(`Palette ${dist}` + '[SUCCESS]'.green);
      handleCallback();
    } catch (e) {
      console.log(`Palette ${dist}` + '[FAILD]'.red);
      handleCallback(e);
    }
  };

  generateThemes();

  return module.exports;
}
443753
function sassTranspiler(path) {
    return function () {
        return gulp.src(path)
            .pipe(sass({outputStyle: 'compressed'}))
            .pipe(autoprefixer({
                browsers: ['last 2 versions']
            }))
            .pipe(gulp.dest('dist'));
    }
}
548905
function write(destPath, options) {
  var debug = require('../debug').spawn('write');

  debug(function() { return 'destPath'; });
  debug(function() { return destPath; });

  debug(function() { return 'original options';});
  debug(function() { return options; });

  if (options === undefined && typeof destPath !== 'string') {
    options = destPath;
    destPath = undefined;
  }
  options = options || {};

  // set defaults for options if unset
  if (options.includeContent === undefined) {
    options.includeContent = true;
  }
  if (options.addComment === undefined) {
    options.addComment = true;
  }
  if (options.charset === undefined) {
    options.charset = 'utf8';
  }

  debug(function() { return 'derrived options'; });
  debug(function() { return options; });

  var internals = internalsInit(destPath, options);

  function sourceMapWrite(file, encoding, callback) {
    if (file.isNull() || !file.sourceMap) {
      this.push(file);
      return callback();
    }

    if (file.isStream()) {
      return callback(new Error(utils.PLUGIN_NAME + '-write: Streaming not supported'));
    }

    // fix paths if Windows style paths
    file.sourceMap.file = unixStylePath(file.relative);

    internals.setSourceRoot(file);
    internals.loadContent(file);
    internals.mapSources(file);
    internals.mapDestPath(file, this);

    this.push(file);
    callback();
  }

  return through.obj(sourceMapWrite);
}
507879
function eslint(options) {
  if (typeof options === 'boolean') {
    options = { fail: options }
  }
  options = { ...new ESLintOptions(), ...options }

  return new Promise((resolve, reject) => {
    const args = generateArguments(options)
    const child = spawn('node', args, { stdio: options.stdio, cwd: path.resolve(options.appRootPath || getRootPath()) })

    function handleError(error) {
      if (options.fail === false) {
        resolve(false)
      } else {
        reject(cleanupError(error))
      }
    }

    child.on('error', handleError)

    child.on('exit', error => {
      if (error) {
        handleError(error)
      } else {
        resolve(true)
      }
    })
  })
}
1178972
function(/**Array*/ path) {
		if (path.constructor != Array) path = path.split(/[\\\/]/);
		var make = "";
		for (var i = 0, l = path.length; i < l; i++) {
			make += path[i] + SYS.slash;
			if (! IO.exists(make)) {
				IO.makeDir(make);
			}
		}
	}
421207
function distinguishPaths(paths) {
    paths = Array.isArray(paths) ? paths : [paths];
    var result = {
      directories: [],
      files: []
    };
    paths.forEach(function(name) {
      if (fs.statSync(name).isDirectory()) {
        result.directories.push(name);
      } else {
        result.files.push(name);
      }
    });
    return result;
  }
968111
async function copy(src, dist, options = {}) {
    let [from, to] = await Promise.all([stat(src), stat(dist)]);

    // 判断源文件是否存在
    if (!from) {
        throw new Error(`Error: '${src}' is not exists!`);
    }

    // 判断目标文件是否存在
    if (to) {
        throw new Error(`Error: '${dist}' is exists!`);
    }

    // 复制文件
    if (from.isDirectory()) {
        let files = await readdir(src);

        // 创建目标文件夹
        await mkdir(dist);

        // 拷贝下级文件
        await Promise.all(files.map(file => {
            let dir = path.join(src, file);

            // 处理排队文件
            if (options.exclude && options.exclude.test(dir)) {
                return Promise.resolve();
            }

            // 复制文件
            return copy(dir, path.join(dist, file), options);
        }));
    } else {
        await copyFile(src, dist);
    }
}
820249
void dfsPathSplit(String path, String[] result)
    {
        int ri = 0, rlast = result.length - 1;
        int i = 0, b = 0, len = path.length();

        do {
            if (ri == rlast) {
                result[rlast] = path.substring(b);
                return;
            }
            if (i == len || path.charAt(i) == '\\') {
                result[ri++] = path.substring(b, i);
                b = i + 1;
            }
        } while (i++ < len);

        while (ri < result.length) {
            result[ri++] = "";
        }
    }
750809
async function copyOthers(dirPath, options) {
  const override = options.override || []
  let config = []
  let testUtils = []
  let otherTools = []
  let otherTestTools = []
  let otherConfig = []
  let demo = []
  let ignore = []

  // 构建配置文件
  if (options.force || checkOverride('tools/config.js', override)) {
    config = await _.globSync('tools/config.js', globOptions)
  }

  // 测试框架工具包
  if (options.force || checkOverride('test/utils.js', override)) {
    testUtils = await _.globSync('test/utils.js', globOptions)
  }

  // 其他构建相关文件
  if (options.force || checkOverride('other tools files', override)) {
    otherTools = await _.globSync('tools/*', globOptions)
    otherTestTools = await _.globSync('tools/test/*', globOptions)

    otherTools = otherTools.filter(otherTool => otherTool.slice(-9) !== 'config.js')
  }

  // 其他构建相关配置文件
  if (options.force || checkOverride('other config files', override)) {
    const babel = await _.globSync('./.babelrc', globOptions)
    const eslint = await _.globSync('./.eslintrc.js', globOptions)

    otherConfig = [babel[0], eslint[0]]
  }

  // demo
  if (options.force || checkOverride('tools/demo', override)) {
    demo = await _.globSync('tools/demo/**/*', globOptions)
  }

  // ignore 相关配置文件
  if (options.force || checkOverride('ignore config', override)) {
    const gitignore = await _.globSync('./.gitignore', globOptions)
    const npmignore = await _.globSync('./.npmignore', globOptions)

    ignore = [gitignore[0], npmignore[0]]
  }

  // eslint-disable-next-line max-len
  const allFiles = [].concat(config, testUtils, otherTools, otherTestTools, otherConfig, demo, ignore)
  for (let i = 0, len = allFiles.length; i < len; i++) {
    const filePath = allFiles[i]

    // eslint-disable-next-line no-await-in-loop
    if (filePath) await _.copyFile(path.join(templateProject, filePath), path.join(dirPath, filePath))
  }
}
52142
function loadConfigFile(dist, paths, options, callback) {
        if (options.config) {
            fs.readFile(options.config, {encoding: 'utf8'}, function(err, contents) {
                if (err) {
                    callback(err);
                    return;
                }
                
                var config = ini.parse(contents);

                if (config && config.default) {
                    options.accessKeyId = config.default.access_key;
                    options.secretAccessKey = config.default.secret_key;
                }
                if (!options.secretAccessKey || !options.accessKeyId) {
                    callback("Config file missing access_key or secret_key");
                    return;
                }

                invalidate(dist, paths, options, callback);
            });
        } else {
            invalidate(dist, paths, options, callback);
        }
    }
145752
function paths(dir) {
	var paths = [];

	try {
		fs.statSync(dir);
	}
	catch (e) {
		return e;
	}

	(function traverse(dir, stack) {
		stack.push(dir);
		fs.readdirSync(stack.join('/')).forEach(function(file) {
			var path = stack.concat([file]).join('/'),
				stat = fs.statSync(path);

			if (file[0] == '.' || file === 'vendor') {
				return;
			} else if (stat.isFile() && /\.js$/.test(file)) {
				paths.push(path);
			} else if (stat.isDirectory()) {
				paths.push(path);
				traverse(file, stack);
			}
		});
		stack.pop();
	})(dir || '.', []);

	return paths;
}
1243088
function fixPaths(paths) {
    return paths.map(path => {
        if (_.startsWith(path, '!./')) {
            return `!${path.substr(3)}`;
        } else if (_.startsWith(path, './')) {
            return path.substr(2);
        } else {
            return path;
        }
    });
}
613000
function (paths) {
        let scope = function (path) {
            return process.cwd() + '/' + path;
        };
        if (typeof paths === 'string') {
            return scope(paths);
        } else {
            return paths.map(function (path) {
                return scope(path);
            });
        }
    }
1291682
function normalizePaths(opts) {
  for (var srcKey in opts.src) {
    if (!path.isAbsolute(opts.src[srcKey].glob)) {
      opts.src[srcKey].glob = path.resolve(opts.src[srcKey].glob);
    }
    if (!path.isAbsolute(opts.src[srcKey].basedir)) {
      opts.src[srcKey].basedir = path.resolve(opts.src[srcKey].basedir);
    }
  }
}