Skip to content

Commit

Permalink
Merge branch 'master' into snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
developit committed Jan 24, 2018
2 parents c2627c7 + f42f4b2 commit e8cb46f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 8 deletions.
13 changes: 7 additions & 6 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "microbundle",
"version": "0.4.0",
"version": "0.4.1",
"description": "Zero-configuration bundler for tiny JS libs, powered by Rollup.",
"main": "dist/microbundle.js",
"source": "src/index.js",
Expand Down Expand Up @@ -43,23 +43,24 @@
"camelcase": "^4.1.0",
"chalk": "^2.3.0",
"es6-promisify": "^5.0.0",
"exorcist": "^1.0.0",
"glob": "^7.1.2",
"gzip-size": "^4.1.0",
"pretty-bytes": "^4.0.2",
"regenerator-runtime": "^0.11.1",
"rollup": "^0.54.0",
"rollup": "^0.55.0",
"rollup-plugin-buble": "^0.18.0",
"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.2",
"rollup-plugin-nodent": "^0.1.3",
"rollup-plugin-postcss": "^1.1.0",
"rollup-plugin-preserve-shebang": "^0.1.4",
"rollup-plugin-postcss": "^1.2.6",
"rollup-plugin-preserve-shebang": "^0.1.6",
"rollup-plugin-sizes": "^0.4.2",
"rollup-plugin-typescript": "^0.8.1",
"rollup-plugin-strict-alias": "^1.0.0",
"rollup-plugin-typescript": "^0.8.1",
"rollup-plugin-uglify": "^2.0.1",
"sade": "^1.3.1",
"typescript": "^2.6.2",
Expand All @@ -69,7 +70,7 @@
"babel-cli": "^6.26.0",
"babel-preset-env": "^1.6.1",
"directory-tree": "^2.0.0",
"eslint": "^4.15.0",
"eslint": "^4.16.0",
"eslint-config-developit": "^1.1.1",
"fs-extra": "^5.0.0",
"jest": "^22.1.4",
Expand Down
6 changes: 4 additions & 2 deletions src/index.js
Expand Up @@ -17,12 +17,14 @@ import alias from 'rollup-plugin-strict-alias';
import gzipSize from 'gzip-size';
import prettyBytes from 'pretty-bytes';
import shebangPlugin from 'rollup-plugin-preserve-shebang';
import flow from 'rollup-plugin-flow';
import typescript from 'rollup-plugin-typescript';
import flow from './lib/flow-plugin';
// import exorcist from 'exorcist';
import camelCase from 'camelcase';

const interopRequire = m => m.default || m;
const readFile = promisify(fs.readFile);
// const writeFile = promisify(fs.writeFile);
const stat = promisify(fs.stat);
const isDir = name => stat(name).then( stats => stats.isDirectory() ).catch( () => false );
const isFile = name => stat(name).then( stats => stats.isFile() ).catch( () => false );
Expand Down Expand Up @@ -214,7 +216,7 @@ function createConfig(options, entry, format, writeMeta) {
extract: !!writeMeta
}),
useTypescript && typescript(),
!useTypescript && flow({ all: true }),
!useTypescript && flow({ all: true, pretty: true }),
nodent({
exclude: 'node_modules/**',
noRuntime: true,
Expand Down
12 changes: 12 additions & 0 deletions src/lib/flow-plugin.js
@@ -0,0 +1,12 @@
import flow from 'rollup-plugin-flow';

export default function fixedFlow(options) {
let plugin = flow(options);
return Object.assign({}, plugin, {
transform(code, id) {
let ret = plugin.transform(code, id);
if (ret.code===code) return null;
return ret;
}
});
}

0 comments on commit e8cb46f

Please sign in to comment.