fix(bundle): don’t bundle traceur/reflect into benchpress

Don’t need to bundle them as they are already
present in G3.
This commit is contained in:
Tobias Bosch 2015-06-29 11:28:23 -07:00
parent eb0fd7967c
commit da4de21f28
2 changed files with 6 additions and 29 deletions

View File

@ -133,11 +133,11 @@ var BENCHPRESS_BUNDLE_CONFIG = {
entries: ['./dist/js/cjs/benchpress/index.js'],
packageJson: './dist/js/cjs/benchpress/package.json',
includes: [
'angular2',
'traceur',
'reflect-metadata'
'angular2'
],
excludes: [
'traceur',
'reflect-metadata',
'selenium-webdriver',
'rtts_assert',
'zone.js'

View File

@ -18,29 +18,17 @@ module.exports.bundle = function(buildConfig, moduleName, outputFile, outputConf
} else {
return builder.build(moduleName, outputFile, outputConfig);
}
}
};
module.exports.modify = function(srcs, concatName) {
return gulp.src(srcs)
.pipe(concat(concatName))
.pipe(replace('sourceMappingURL', 'sourceMappingURLDisabled')) // TODO: add concat for sourceMaps
}
};
module.exports.benchpressBundle = function(entries, packageJsonPath, includes, excludes, ignore, dest, cb) {
/*
we need a script in dist/js/cjs so we
can find node modules the same way benchpress does.
This allows us to extract the LICENSE files from each
module included in the bundle, through:
helper(moduleName)
*/
var helperScript = 'module.exports = function(moduleName){return require.resolve(moduleName)}';
var helperPath = path.resolve('./dist/js/cjs/_module_resolver.js');
fs.writeFileSync(helperPath, helperScript);
var helper = require(helperPath);
var b = browserify({
entries: entries,
builtins: [],
@ -70,19 +58,8 @@ module.exports.benchpressBundle = function(entries, packageJsonPath, includes, e
}
var contents = buf.toString();
var licenses = "/*\n";
//for packaged dependencies, the license must also be included
for (var i = 0; i < includes.length; i++) {
var licensePath = helper(includes[i] + "/LICENSE");
var licenseContent = fs.readFileSync(licensePath);
licenses += "======================== BEGIN LICENSE FOR BUNDLED MODULE: " + includes[i] + " ========================\n";
licenses += licenseContent;
licenses += "======================== END LICENSE FOR BUNDLED MODULE: " + includes[i] + " ========================\n";
}
licenses += "*/\n";
contents = licenses + contents;
contents += 'module.exports = global.__benchpressExports;\n';
fs.writeFileSync(dest + '/index.js', contents);
cb(null);
});
}
};