diff --git a/package.json b/package.json index b73a51dc..49751039 100644 --- a/package.json +++ b/package.json @@ -44,6 +44,7 @@ "rollup-plugin-bundle-size": "^1.0.1", "rollup-plugin-commonjs": "^8.2.6", "rollup-plugin-es3": "^1.1.0", + "rollup-plugin-flow": "^1.1.1", "rollup-plugin-node-resolve": "^3.0.0", "rollup-plugin-nodent": "^0.1.3", "rollup-plugin-post-replace": "^1.0.0", diff --git a/src/index.js b/src/index.js index add863ec..589bae1a 100644 --- a/src/index.js +++ b/src/index.js @@ -14,6 +14,7 @@ import es3 from 'rollup-plugin-es3'; import gzipSize from 'gzip-size'; import prettyBytes from 'pretty-bytes'; import shebangPlugin from 'rollup-plugin-preserve-shebang'; +import flow from 'rollup-plugin-flow'; const readFile = promisify(fs.readFile); const stat = promisify(fs.stat); @@ -43,7 +44,7 @@ export default async function microbundle(options) { options.input = [].concat( options.entries && options.entries.length ? options.entries : options.pkg.source || (await isDir(resolve(cwd, 'src')) && 'src/index.js') || (await isFile(resolve(cwd, 'index.js')) && 'index.js') || options.pkg.module ).map( file => resolve(cwd, file) ); - + let main = resolve(cwd, options.output || options.pkg.main || 'dist'); if (!main.match(/\.[a-z]+$/) || await isDir(main)) { main = resolve(main, `${options.pkg.name}.js`); @@ -163,6 +164,7 @@ function createConfig(options, entry, format) { input: entry, external, plugins: [ + flow({ all: true }), nodent({ exclude: 'node_modules/**', noRuntime: true, @@ -225,4 +227,4 @@ function createConfig(options, entry, format) { }; return config; -} \ No newline at end of file +}