@bunchtogether/vite-plugin-flow

中文文档
1.0.2发布于 2022/02/17CommonJS近 30 天下载 46.5万
原始使用文档
文档目录5 节
  1. Install
  2. Usage
  3. API
  4. flowPlugin
  5. esbuildFlowPlugin

vite-plugin-flow

Support Flow static type checking in Vite

Install

npm install @bunchtogether/vite-plugin-flow --save-dev

or

yarn add @bunchtogether/vite-plugin-flow --dev

Usage

import { flowPlugin, esbuildFlowPlugin } from '@bunchtogether/vite-plugin-flow';

export default {
  optimizeDeps: {
    esbuildOptions: {
      plugins: [esbuildFlowPlugin()]
    }
  },
  plugins: [
    flowPlugin()
  ]
}

API

Table of Contents

flowPlugin

Create a Vite plugin object

Parameters

  • options Object? Filter options (optional, default {include:/\.(flow|jsx?)$/,exclude:/node_modules/,flow:{all:false,pretty:false,ignoreUninitializedFields:false}})

    • options.include (string | Regexp | Array<(string | Regexp)>) Strings and/or regular expressions matching file paths to include (optional, default /\.(flow|jsx?)$/)
    • options.exclude (string | Regexp | Array<(string | Regexp)>) Strings and/or regular expressions matching file paths to exclude (optional, default /node_modules/)

Returns VitePlugin Returns esbuild plugin object

esbuildFlowPlugin

Create an esbuild plugin object

Parameters

  • filter RegExp Regular expression matching the path a files to be processed (optional, default /\.(flow|jsx?)$/)

  • loaderFunction Function Function that accepts the file path and returns the esbuild loader type (optional, default (path)=>(/\.jsx$/.test(path)?'jsx':'js'))

  • flowOptions Object Options to pass to flow-remove-types (optional, default {all:false,pretty:false,ignoreUninitializedFields:false})

    • flowOptions.all boolean If true, bypasses looking for an @flow pragma comment before parsing. (optional, default false)
    • flowOptions.pretty boolean If true, removes types completely rather than replacing with spaces. (optional, default false)
    • flowOptions.ignoreUninitializedFields boolean If true, removes uninitialized class fields (foo;, foo: string;) completely rather than only removing the type. THIS IS NOT SPEC COMPLIANT! Instead, use declare foo: string; for type-only fields. (optional, default false)

Returns EsbuildPlugin Returns esbuild plugin object

版本与发布记录

@bunchtogether/vite-plugin-flow 共发布 3 个版本,首次发布于 2021/06/18;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.0.2latest2022/02/174 年前
1.0.12021/09/095 年前
1.0.02021/06/185 年前

关于 @bunchtogether/vite-plugin-flow 的常见问题

@bunchtogether/vite-plugin-flow 是什么?

Support Flow static type checking in Vite

如何安装 @bunchtogether/vite-plugin-flow?

在项目目录运行 npm install @bunchtogether/vite-plugin-flow,或使用 pnpm add / yarn add / bun add。

@bunchtogether/vite-plugin-flow 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/bunchtogether__vite-plugin-flow 是否存在。

@bunchtogether/vite-plugin-flow 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@bunchtogether/vite-plugin-flow 可以商用吗?

@bunchtogether/vite-plugin-flow 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

@bunchtogether/vite-plugin-flow 的下载量有多少?

根据 npm 官方下载统计,@bunchtogether/vite-plugin-flow 在 2026/10/09 – 2026/11/07 这 30 天内被下载 464,881 次,日均约 15,496 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@bunchtogether/vite-plugin-flow 还在维护吗?

最新版本 1.0.2 发布于 2022/02/17(4 年前);至今共发布 3 个版本,其中过去 12 个月发布了 0 个;首次发布于 2021/06/18。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。