code: async function flowBuildPlugin(pkg, options) {
    const buildOutputRoot = path.resolve(
      pkg.paths.root,
      options.outputDir || './build',
    )
    const patterns = (
      options.inputs || ['**/*.js', '!__tests__', '!test.js']
    ).concat(['!node_modules/**/*', `!${path.basename(buildOutputRoot)}/**/*`])
    const sourceRoot =
      options.sourceDir != null
        ? path.resolve(pkg.paths.root, options.sourceDir)
        : pkg.paths.root
  
    // :: string -> Array<string>
    const getJsFilePaths = () =>
      globby(patterns, {
        cwd: sourceRoot,
      })
  
    const filePaths = await getJsFilePaths()
  
    // :: string -> Promise<void>
    const transpileFile = filePath =>
      new Promise(resolve => {
        const module = path.resolve(sourceRoot, filePath)
        const input = fs.readFileSync(module, 'utf8')
        const output = flowRemoveTypes(input)
        const outFile = path.resolve(buildOutputRoot, filePath)
        ensureParentDirectoryExists(outFile)
        fs.writeFileSync(outFile, output.toString(), { encoding: 'utf8' })
        fs.writeFileSync(`${outFile}.flow`, input, { encoding: 'utf8' })
        resolve()
      })
  
    const limit = pLimit(maxConcurrentTranspiles)
    const queueTranspile = filePath => limit(() => transpileFile(filePath))
    await Promise.all(R.map(queueTranspile, filePaths))
  }
docs: :: Package, Options -> DevelopAPI