Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions lib/bundle/bundler.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
let rollup = require("rollup");
let rollupAnalyzer = require("rollup-analyzer");

let report = msg => void console.error(msg);

module.exports = function generateBundle(entryPoint, target, config, cache) {
let { readConfig, writeConfig } = config;
let options = Object.assign({}, readConfig, {
input: entryPoint,
cache
});
let analyzer = rollupAnalyzer({ // TODO: configurable
//root // TODO: pass through `configDir`
limit: 5
});
return rollup.rollup(options).
then(bundle => {
return analyzer.formatted(bundle).
then(report, report).
then(_ => bundle);
}).
then(bundle => {
let modules = bundle.modules.reduce(collectModulePaths, new Set());
return bundle.generate(writeConfig).
Expand Down
2 changes: 1 addition & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module.exports = (config, assetManager, { watcher, browsers, compact } = {}) =>
watcher.on("edit", filepaths => {
bundles.forEach(bundle => {
let res = bundle.recompile(...filepaths);
res && // guards against irrelevant changes
res && // disregard irrelevant changes
res.then(makeWriter(bundle, assetManager));
});
});
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"faucet-pipeline": "~1.0.0-rc.3",
"rollup": "^0.56.5",
"rollup-plugin-cleanup": "^2.0.0",
"rollup-plugin-commonjs": "^9.0.0",
"rollup-plugin-commonjs": "^9.1.0",
"rollup-plugin-node-resolve": "^3.2.0"
},
"devDependencies": {
Expand All @@ -38,8 +38,9 @@
"faucet-pipeline-jsx": "file:pkg/faucet-pipeline-jsx",
"faucet-pipeline-typescript": "file:pkg/faucet-pipeline-typescript",
"json-diff": "^0.5.2",
"mocha": "^5.0.3",
"mocha": "^5.0.4",
"npm-run-all": "^4.1.2",
"release-util-fnd": "^1.1.0"
"release-util-fnd": "^1.1.0",
"rollup-analyzer": "^1.1.0"
}
}