Skip to content

Commit

Permalink
Merge pull request #30 from mourner/smaller-blob
Browse files Browse the repository at this point in the history
Resolve deps for smaller worker blob
  • Loading branch information
anandthakker authored Sep 7, 2016
2 parents aa591d7 + 2efe0d3 commit 02ae06d
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,22 @@ module.exports = function (fn, options) {
scache
];

var workerSources = {};
resolveSources(skey);

function resolveSources(key) {
workerSources[key] = true;

for (var depPath in sources[key][1]) {
var depKey = sources[key][1][depPath];
if (!workerSources[depKey]) {
resolveSources(depKey);
}
}
}

var src = '(' + bundleFn + ')({'
+ Object.keys(sources).map(function (key) {
+ Object.keys(workerSources).map(function (key) {
return stringify(key) + ':['
+ sources[key][0]
+ ',' + stringify(sources[key][1]) + ']'
Expand Down

0 comments on commit 02ae06d

Please sign in to comment.