diff --git a/gulpfile.js b/gulpfile.js index dd7e1543f5..48540ddc72 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -124,10 +124,30 @@ var CONFIG = { }, dart: 'dist/dart', docs: 'dist/docs', - docs_angular_io: 'dist/angular.io' + docs_angular_io: 'dist/angular.io', + benchpress_bundle: 'dist/build/benchpress_bundle/' } }; +var BENCHPRESS_BUNDLE_CONFIG = { + entries: ['./dist/js/cjs/benchpress/index.js'], + packageJson: './dist/js/cjs/benchpress/package.json', + includes: [ + 'angular2', + 'traceur', + 'reflect-metadata' + ], + excludes: [ + 'selenium-webdriver', + 'rtts_assert', + 'zone.js' + ], + ignore: [ + 'rx' + ], + dest: CONFIG.dest.benchpress_bundle +} + // ------------ // clean @@ -151,6 +171,9 @@ gulp.task('build/clean.docs_angular_io', function(done) { del(CONFIG.dest.docs_angular_io, done); }); +gulp.task('build/clean.benchpress.bundle', function(done) { + del(CONFIG.dest.benchpress_bundle, done); +}); // ------------ // transpile @@ -888,9 +911,9 @@ gulp.task('bundle.js.sfx.dev.deps', ['bundle.js.sfx.dev'], function() { gulp.task('bundle.js.deps', ['bundle.js.prod.deps', 'bundle.js.dev.deps', 'bundle.js.min.deps', 'bundle.js.sfx.dev.deps', 'router.bundle.js.dev', 'mock.bundle.js.dev']); -gulp.task('build.js', ['build.js.dev', 'build.js.prod', 'build.js.cjs', 'bundle.js.deps']); +gulp.task('build.js', ['build.js.dev', 'build.js.prod', 'build.js.cjs', 'bundle.js.deps', 'benchpress.bundle']); -gulp.task('clean', ['build/clean.tools', 'build/clean.js', 'build/clean.dart', 'build/clean.docs']); +gulp.task('clean', ['build/clean.tools', 'build/clean.js', 'build/clean.dart', 'build/clean.docs', 'build/clean.benchpress.bundle']); gulp.task('build', ['build.js', 'build.dart']); @@ -959,6 +982,18 @@ gulp.task('cleanup.builder', function(done) { }); }); +gulp.task('benchpress.bundle', ['build/clean.benchpress.bundle', 'build.js.cjs'], function(cb) { + bundler.benchpressBundle( + BENCHPRESS_BUNDLE_CONFIG.entries, + BENCHPRESS_BUNDLE_CONFIG.packageJson, + BENCHPRESS_BUNDLE_CONFIG.includes, + BENCHPRESS_BUNDLE_CONFIG.excludes, + BENCHPRESS_BUNDLE_CONFIG.ignore, + BENCHPRESS_BUNDLE_CONFIG.dest, + cb + ); +}) + // register cleanup listener for ctrl+c/kill used to quit any persistent task (autotest or serve tasks) process.on('SIGINT', function() { diff --git a/modules/angular2/src/test_lib/perf_util.ts b/modules/angular2/src/test_lib/perf_util.ts index 10a45e3496..1433322d8a 100644 --- a/modules/angular2/src/test_lib/perf_util.ts +++ b/modules/angular2/src/test_lib/perf_util.ts @@ -1,6 +1,8 @@ export {verifyNoBrowserErrors} from './e2e_util'; -import {bind, Options} from 'benchpress/benchpress'; +var benchpress = global['benchpress']; +var bind = benchpress.bind; +var Options = benchpress.Options; export function runClickBenchmark(config) { var buttons = config.buttons.map(function(selector) { return $(selector); }); diff --git a/modules/benchpress/index.ts b/modules/benchpress/index.ts index c4dc17cbd6..ed8530f3fc 100644 --- a/modules/benchpress/index.ts +++ b/modules/benchpress/index.ts @@ -1,2 +1,6 @@ -require(require('traceur').RUNTIME_PATH); +require('reflect-metadata'); +require('traceur/bin/traceur-runtime'); module.exports = require('./benchpress.js'); +// when bundling benchpress to one file, this is used +// for getting exports out of browserify's scope. +global.__benchpressExports = module.exports; diff --git a/modules/benchpress/package.json b/modules/benchpress/package.json index 420ddfbe09..cefc0fa4f9 100644 --- a/modules/benchpress/package.json +++ b/modules/benchpress/package.json @@ -11,9 +11,9 @@ "angular2": "<%= packageJson.version %>", "firefox-profile": "<%= packageJson.devDependencies['firefox-profile'] %>", "jpm": "<%= packageJson.devDependencies.jpm %>", - "rtts_assert": "<%= packageJson.version %>", "traceur": "<%= packageJson.dependencies.traceur %>", - "selenium-webdriver": "<%= packageJson.dependencies['selenium-webdriver'] %>" + "selenium-webdriver": "<%= packageJson.dependencies['selenium-webdriver'] %>", + "reflect-metadata": "<%= packageJson.dependencies['reflect-metadata'] %>" }, "devDependencies": <%= JSON.stringify(packageJson.devDependencies) %> } diff --git a/npm-shrinkwrap.clean.json b/npm-shrinkwrap.clean.json index c82540c6e8..5d7cb778b9 100644 --- a/npm-shrinkwrap.clean.json +++ b/npm-shrinkwrap.clean.json @@ -1481,6 +1481,513 @@ } } }, + "browserify": { + "version": "10.2.4", + "dependencies": { + "JSONStream": { + "version": "1.0.4", + "dependencies": { + "jsonparse": { + "version": "1.0.0" + }, + "through": { + "version": "2.3.7" + } + } + }, + "assert": { + "version": "1.3.0" + }, + "browser-pack": { + "version": "5.0.1", + "dependencies": { + "combine-source-map": { + "version": "0.6.1", + "dependencies": { + "convert-source-map": { + "version": "1.1.1" + }, + "inline-source-map": { + "version": "0.5.0" + }, + "lodash.memoize": { + "version": "3.0.4" + }, + "source-map": { + "version": "0.4.2", + "dependencies": { + "amdefine": { + "version": "0.1.1" + } + } + } + } + }, + "umd": { + "version": "3.0.1" + } + } + }, + "browser-resolve": { + "version": "1.9.0" + }, + "browserify-zlib": { + "version": "0.1.4", + "dependencies": { + "pako": { + "version": "0.2.7" + } + } + }, + "buffer": { + "version": "3.2.2", + "dependencies": { + "base64-js": { + "version": "0.0.8" + }, + "ieee754": { + "version": "1.1.6" + }, + "is-array": { + "version": "1.0.1" + } + } + }, + "builtins": { + "version": "0.0.7" + }, + "commondir": { + "version": "0.0.1" + }, + "concat-stream": { + "version": "1.4.10", + "dependencies": { + "typedarray": { + "version": "0.0.6" + } + } + }, + "console-browserify": { + "version": "1.1.0", + "dependencies": { + "date-now": { + "version": "0.1.4" + } + } + }, + "constants-browserify": { + "version": "0.0.1" + }, + "crypto-browserify": { + "version": "3.9.14", + "dependencies": { + "browserify-aes": { + "version": "1.0.1" + }, + "browserify-sign": { + "version": "3.0.2", + "dependencies": { + "bn.js": { + "version": "2.1.0" + }, + "browserify-rsa": { + "version": "2.0.1" + }, + "elliptic": { + "version": "3.1.0", + "dependencies": { + "brorand": { + "version": "1.0.5" + }, + "hash.js": { + "version": "1.0.3" + } + } + }, + "parse-asn1": { + "version": "3.0.1", + "dependencies": { + "asn1.js": { + "version": "2.1.0", + "dependencies": { + "minimalistic-assert": { + "version": "1.0.0" + } + } + } + } + } + } + }, + "create-ecdh": { + "version": "2.0.1", + "dependencies": { + "bn.js": { + "version": "2.1.0" + }, + "elliptic": { + "version": "3.1.0", + "dependencies": { + "brorand": { + "version": "1.0.5" + }, + "hash.js": { + "version": "1.0.3" + } + } + } + } + }, + "create-hash": { + "version": "1.1.1", + "dependencies": { + "ripemd160": { + "version": "1.0.1" + }, + "sha.js": { + "version": "2.4.2" + } + } + }, + "create-hmac": { + "version": "1.1.3" + }, + "diffie-hellman": { + "version": "3.0.2", + "dependencies": { + "bn.js": { + "version": "2.1.0" + }, + "miller-rabin": { + "version": "2.0.1", + "dependencies": { + "brorand": { + "version": "1.0.5" + } + } + } + } + }, + "pbkdf2": { + "version": "3.0.4" + }, + "public-encrypt": { + "version": "2.0.1", + "dependencies": { + "bn.js": { + "version": "2.1.0" + }, + "browserify-rsa": { + "version": "2.0.1" + }, + "parse-asn1": { + "version": "3.0.1", + "dependencies": { + "asn1.js": { + "version": "2.1.0", + "dependencies": { + "minimalistic-assert": { + "version": "1.0.0" + } + } + } + } + } + } + }, + "randombytes": { + "version": "2.0.1" + } + } + }, + "defined": { + "version": "1.0.0" + }, + "deps-sort": { + "version": "1.3.9" + }, + "domain-browser": { + "version": "1.1.4" + }, + "duplexer2": { + "version": "0.0.2" + }, + "events": { + "version": "1.0.2" + }, + "has": { + "version": "1.0.0" + }, + "htmlescape": { + "version": "1.1.0" + }, + "http-browserify": { + "version": "1.7.0", + "dependencies": { + "Base64": { + "version": "0.2.1" + } + } + }, + "https-browserify": { + "version": "0.0.0" + }, + "inherits": { + "version": "2.0.1" + }, + "insert-module-globals": { + "version": "6.5.0", + "dependencies": { + "combine-source-map": { + "version": "0.3.0", + "dependencies": { + "inline-source-map": { + "version": "0.3.1", + "dependencies": { + "source-map": { + "version": "0.3.0", + "dependencies": { + "amdefine": { + "version": "0.1.1" + } + } + } + } + }, + "convert-source-map": { + "version": "0.3.5" + }, + "source-map": { + "version": "0.1.43", + "dependencies": { + "amdefine": { + "version": "0.1.1" + } + } + } + } + }, + "lexical-scope": { + "version": "1.1.1", + "dependencies": { + "astw": { + "version": "2.0.0", + "dependencies": { + "acorn": { + "version": "1.2.2" + } + } + } + } + } + } + }, + "isarray": { + "version": "0.0.1" + }, + "labeled-stream-splicer": { + "version": "1.0.2", + "dependencies": { + "stream-splicer": { + "version": "1.3.1", + "dependencies": { + "readable-wrap": { + "version": "1.0.0" + }, + "indexof": { + "version": "0.0.1" + } + } + } + } + }, + "module-deps": { + "version": "3.8.1", + "dependencies": { + "detective": { + "version": "4.1.0", + "dependencies": { + "acorn": { + "version": "1.2.2" + }, + "escodegen": { + "version": "1.6.1", + "dependencies": { + "estraverse": { + "version": "1.9.3" + }, + "esutils": { + "version": "1.1.6" + }, + "esprima": { + "version": "1.2.5" + }, + "optionator": { + "version": "0.5.0", + "dependencies": { + "prelude-ls": { + "version": "1.1.2" + }, + "deep-is": { + "version": "0.1.3" + }, + "wordwrap": { + "version": "0.0.3" + }, + "type-check": { + "version": "0.3.1" + }, + "levn": { + "version": "0.2.5" + }, + "fast-levenshtein": { + "version": "1.0.6" + } + } + }, + "source-map": { + "version": "0.1.43", + "dependencies": { + "amdefine": { + "version": "0.1.1" + } + } + } + } + } + } + }, + "stream-combiner2": { + "version": "1.0.2", + "dependencies": { + "through2": { + "version": "0.5.1", + "dependencies": { + "readable-stream": { + "version": "1.0.33", + "dependencies": { + "core-util-is": { + "version": "1.0.1" + } + } + }, + "xtend": { + "version": "3.0.0" + } + } + } + } + } + } + }, + "os-browserify": { + "version": "0.1.2" + }, + "parents": { + "version": "1.0.1", + "dependencies": { + "path-platform": { + "version": "0.11.15" + } + } + }, + "path-browserify": { + "version": "0.0.0" + }, + "process": { + "version": "0.11.1" + }, + "punycode": { + "version": "1.3.2" + }, + "querystring-es3": { + "version": "0.2.1" + }, + "read-only-stream": { + "version": "1.1.1", + "dependencies": { + "readable-wrap": { + "version": "1.0.0" + } + } + }, + "readable-stream": { + "version": "1.1.13", + "dependencies": { + "core-util-is": { + "version": "1.0.1" + } + } + }, + "resolve": { + "version": "1.1.6" + }, + "shasum": { + "version": "1.0.1", + "dependencies": { + "json-stable-stringify": { + "version": "0.0.1", + "dependencies": { + "jsonify": { + "version": "0.0.0" + } + } + }, + "sha.js": { + "version": "2.3.6" + } + } + }, + "shell-quote": { + "version": "0.0.1" + }, + "stream-browserify": { + "version": "1.0.0" + }, + "string_decoder": { + "version": "0.10.31" + }, + "subarg": { + "version": "1.0.0" + }, + "syntax-error": { + "version": "1.1.4", + "dependencies": { + "acorn": { + "version": "1.2.2" + } + } + }, + "through2": { + "version": "1.1.1" + }, + "timers-browserify": { + "version": "1.4.1" + }, + "tty-browserify": { + "version": "0.0.0" + }, + "url": { + "version": "0.10.3", + "dependencies": { + "querystring": { + "version": "0.2.0" + } + } + }, + "util": { + "version": "0.10.3" + }, + "vm-browserify": { + "version": "0.0.4", + "dependencies": { + "indexof": { + "version": "0.0.1" + } + } + } + } + }, "canonical-path": { "version": "0.0.2" }, diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 3135cb528f..76f5ce4f5a 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -2286,6 +2286,787 @@ } } }, + "browserify": { + "version": "10.2.4", + "from": "browserify@>=10.2.4 <11.0.0", + "resolved": "https://registry.npmjs.org/browserify/-/browserify-10.2.4.tgz", + "dependencies": { + "JSONStream": { + "version": "1.0.4", + "from": "JSONStream@>=1.0.3 <2.0.0", + "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.0.4.tgz", + "dependencies": { + "jsonparse": { + "version": "1.0.0", + "from": "jsonparse@>=1.0.0 <1.1.0", + "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.0.0.tgz" + }, + "through": { + "version": "2.3.7", + "from": "through@>=2.2.7 <3.0.0", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.7.tgz" + } + } + }, + "assert": { + "version": "1.3.0", + "from": "assert@>=1.3.0 <1.4.0", + "resolved": "https://registry.npmjs.org/assert/-/assert-1.3.0.tgz" + }, + "browser-pack": { + "version": "5.0.1", + "from": "browser-pack@>=5.0.0 <6.0.0", + "resolved": "https://registry.npmjs.org/browser-pack/-/browser-pack-5.0.1.tgz", + "dependencies": { + "combine-source-map": { + "version": "0.6.1", + "from": "combine-source-map@>=0.6.1 <0.7.0", + "resolved": "https://registry.npmjs.org/combine-source-map/-/combine-source-map-0.6.1.tgz", + "dependencies": { + "convert-source-map": { + "version": "1.1.1", + "from": "convert-source-map@>=1.1.0 <1.2.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.1.1.tgz" + }, + "inline-source-map": { + "version": "0.5.0", + "from": "inline-source-map@>=0.5.0 <0.6.0", + "resolved": "https://registry.npmjs.org/inline-source-map/-/inline-source-map-0.5.0.tgz" + }, + "lodash.memoize": { + "version": "3.0.4", + "from": "lodash.memoize@>=3.0.3 <3.1.0", + "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-3.0.4.tgz" + }, + "source-map": { + "version": "0.4.2", + "from": "source-map@>=0.4.2 <0.5.0", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.2.tgz", + "dependencies": { + "amdefine": { + "version": "0.1.1", + "from": "amdefine@>=0.0.4", + "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-0.1.1.tgz" + } + } + } + } + }, + "umd": { + "version": "3.0.1", + "from": "umd@>=3.0.0 <4.0.0", + "resolved": "https://registry.npmjs.org/umd/-/umd-3.0.1.tgz" + } + } + }, + "browser-resolve": { + "version": "1.9.0", + "from": "browser-resolve@>=1.7.1 <2.0.0", + "resolved": "https://registry.npmjs.org/browser-resolve/-/browser-resolve-1.9.0.tgz" + }, + "browserify-zlib": { + "version": "0.1.4", + "from": "browserify-zlib@>=0.1.2 <0.2.0", + "resolved": "https://registry.npmjs.org/browserify-zlib/-/browserify-zlib-0.1.4.tgz", + "dependencies": { + "pako": { + "version": "0.2.7", + "from": "pako@>=0.2.0 <0.3.0", + "resolved": "https://registry.npmjs.org/pako/-/pako-0.2.7.tgz" + } + } + }, + "buffer": { + "version": "3.2.2", + "from": "buffer@>=3.0.0 <4.0.0", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-3.2.2.tgz", + "dependencies": { + "base64-js": { + "version": "0.0.8", + "from": "base64-js@0.0.8", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-0.0.8.tgz" + }, + "ieee754": { + "version": "1.1.6", + "from": "ieee754@>=1.1.4 <2.0.0", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.6.tgz" + }, + "is-array": { + "version": "1.0.1", + "from": "is-array@>=1.0.1 <2.0.0", + "resolved": "https://registry.npmjs.org/is-array/-/is-array-1.0.1.tgz" + } + } + }, + "builtins": { + "version": "0.0.7", + "from": "builtins@>=0.0.3 <0.1.0", + "resolved": "https://registry.npmjs.org/builtins/-/builtins-0.0.7.tgz" + }, + "commondir": { + "version": "0.0.1", + "from": "commondir@0.0.1", + "resolved": "https://registry.npmjs.org/commondir/-/commondir-0.0.1.tgz" + }, + "concat-stream": { + "version": "1.4.10", + "from": "concat-stream@>=1.4.1 <1.5.0", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.4.10.tgz", + "dependencies": { + "typedarray": { + "version": "0.0.6", + "from": "typedarray@>=0.0.5 <0.1.0", + "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz" + } + } + }, + "console-browserify": { + "version": "1.1.0", + "from": "console-browserify@>=1.1.0 <2.0.0", + "resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.1.0.tgz", + "dependencies": { + "date-now": { + "version": "0.1.4", + "from": "date-now@>=0.1.4 <0.2.0", + "resolved": "https://registry.npmjs.org/date-now/-/date-now-0.1.4.tgz" + } + } + }, + "constants-browserify": { + "version": "0.0.1", + "from": "constants-browserify@>=0.0.1 <0.1.0", + "resolved": "https://registry.npmjs.org/constants-browserify/-/constants-browserify-0.0.1.tgz" + }, + "crypto-browserify": { + "version": "3.9.14", + "from": "crypto-browserify@>=3.0.0 <4.0.0", + "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.9.14.tgz", + "dependencies": { + "browserify-aes": { + "version": "1.0.1", + "from": "browserify-aes@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.0.1.tgz" + }, + "browserify-sign": { + "version": "3.0.2", + "from": "browserify-sign@>=3.0.1 <4.0.0", + "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-3.0.2.tgz", + "dependencies": { + "bn.js": { + "version": "2.1.0", + "from": "bn.js@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-2.1.0.tgz" + }, + "browserify-rsa": { + "version": "2.0.1", + "from": "browserify-rsa@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-2.0.1.tgz" + }, + "elliptic": { + "version": "3.1.0", + "from": "elliptic@>=3.0.0 <4.0.0", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-3.1.0.tgz", + "dependencies": { + "brorand": { + "version": "1.0.5", + "from": "brorand@>=1.0.1 <2.0.0", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.0.5.tgz" + }, + "hash.js": { + "version": "1.0.3", + "from": "hash.js@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.0.3.tgz" + } + } + }, + "parse-asn1": { + "version": "3.0.1", + "from": "parse-asn1@>=3.0.0 <4.0.0", + "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-3.0.1.tgz", + "dependencies": { + "asn1.js": { + "version": "2.1.0", + "from": "asn1.js@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-2.1.0.tgz", + "dependencies": { + "minimalistic-assert": { + "version": "1.0.0", + "from": "minimalistic-assert@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.0.tgz" + } + } + } + } + } + } + }, + "create-ecdh": { + "version": "2.0.1", + "from": "create-ecdh@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-2.0.1.tgz", + "dependencies": { + "bn.js": { + "version": "2.1.0", + "from": "bn.js@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-2.1.0.tgz" + }, + "elliptic": { + "version": "3.1.0", + "from": "elliptic@>=3.0.0 <4.0.0", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-3.1.0.tgz", + "dependencies": { + "brorand": { + "version": "1.0.5", + "from": "brorand@>=1.0.1 <2.0.0", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.0.5.tgz" + }, + "hash.js": { + "version": "1.0.3", + "from": "hash.js@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.0.3.tgz" + } + } + } + } + }, + "create-hash": { + "version": "1.1.1", + "from": "create-hash@>=1.1.0 <2.0.0", + "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.1.1.tgz", + "dependencies": { + "ripemd160": { + "version": "1.0.1", + "from": "ripemd160@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-1.0.1.tgz" + }, + "sha.js": { + "version": "2.4.2", + "from": "sha.js@>=2.3.6 <3.0.0", + "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.2.tgz" + } + } + }, + "create-hmac": { + "version": "1.1.3", + "from": "create-hmac@>=1.1.0 <2.0.0", + "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.3.tgz" + }, + "diffie-hellman": { + "version": "3.0.2", + "from": "diffie-hellman@>=3.0.1 <4.0.0", + "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-3.0.2.tgz", + "dependencies": { + "bn.js": { + "version": "2.1.0", + "from": "bn.js@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-2.1.0.tgz" + }, + "miller-rabin": { + "version": "2.0.1", + "from": "miller-rabin@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/miller-rabin/-/miller-rabin-2.0.1.tgz", + "dependencies": { + "brorand": { + "version": "1.0.5", + "from": "brorand@>=1.0.1 <2.0.0", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.0.5.tgz" + } + } + } + } + }, + "pbkdf2": { + "version": "3.0.4", + "from": "pbkdf2@>=3.0.3 <4.0.0", + "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.0.4.tgz" + }, + "public-encrypt": { + "version": "2.0.1", + "from": "public-encrypt@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-2.0.1.tgz", + "dependencies": { + "bn.js": { + "version": "2.1.0", + "from": "bn.js@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-2.1.0.tgz" + }, + "browserify-rsa": { + "version": "2.0.1", + "from": "browserify-rsa@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-2.0.1.tgz" + }, + "parse-asn1": { + "version": "3.0.1", + "from": "parse-asn1@>=3.0.0 <4.0.0", + "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-3.0.1.tgz", + "dependencies": { + "asn1.js": { + "version": "2.1.0", + "from": "asn1.js@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-2.1.0.tgz", + "dependencies": { + "minimalistic-assert": { + "version": "1.0.0", + "from": "minimalistic-assert@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.0.tgz" + } + } + } + } + } + } + }, + "randombytes": { + "version": "2.0.1", + "from": "randombytes@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.0.1.tgz" + } + } + }, + "defined": { + "version": "1.0.0", + "from": "defined@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/defined/-/defined-1.0.0.tgz" + }, + "deps-sort": { + "version": "1.3.9", + "from": "deps-sort@>=1.3.7 <2.0.0", + "resolved": "https://registry.npmjs.org/deps-sort/-/deps-sort-1.3.9.tgz" + }, + "domain-browser": { + "version": "1.1.4", + "from": "domain-browser@>=1.1.0 <1.2.0", + "resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-1.1.4.tgz" + }, + "duplexer2": { + "version": "0.0.2", + "from": "duplexer2@>=0.0.2 <0.1.0", + "resolved": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.0.2.tgz" + }, + "events": { + "version": "1.0.2", + "from": "events@>=1.0.0 <1.1.0", + "resolved": "https://registry.npmjs.org/events/-/events-1.0.2.tgz" + }, + "has": { + "version": "1.0.0", + "from": "has@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.0.tgz" + }, + "htmlescape": { + "version": "1.1.0", + "from": "htmlescape@>=1.1.0 <2.0.0", + "resolved": "https://registry.npmjs.org/htmlescape/-/htmlescape-1.1.0.tgz" + }, + "http-browserify": { + "version": "1.7.0", + "from": "http-browserify@>=1.4.0 <2.0.0", + "resolved": "https://registry.npmjs.org/http-browserify/-/http-browserify-1.7.0.tgz", + "dependencies": { + "Base64": { + "version": "0.2.1", + "from": "Base64@>=0.2.0 <0.3.0", + "resolved": "https://registry.npmjs.org/Base64/-/Base64-0.2.1.tgz" + } + } + }, + "https-browserify": { + "version": "0.0.0", + "from": "https-browserify@>=0.0.0 <0.1.0", + "resolved": "https://registry.npmjs.org/https-browserify/-/https-browserify-0.0.0.tgz" + }, + "inherits": { + "version": "2.0.1", + "from": "inherits@>=2.0.1 <2.1.0", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz" + }, + "insert-module-globals": { + "version": "6.5.0", + "from": "insert-module-globals@>=6.4.1 <7.0.0", + "resolved": "https://registry.npmjs.org/insert-module-globals/-/insert-module-globals-6.5.0.tgz", + "dependencies": { + "combine-source-map": { + "version": "0.3.0", + "from": "combine-source-map@>=0.3.0 <0.4.0", + "resolved": "https://registry.npmjs.org/combine-source-map/-/combine-source-map-0.3.0.tgz", + "dependencies": { + "inline-source-map": { + "version": "0.3.1", + "from": "inline-source-map@>=0.3.0 <0.4.0", + "resolved": "https://registry.npmjs.org/inline-source-map/-/inline-source-map-0.3.1.tgz", + "dependencies": { + "source-map": { + "version": "0.3.0", + "from": "source-map@>=0.3.0 <0.4.0", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.3.0.tgz", + "dependencies": { + "amdefine": { + "version": "0.1.1", + "from": "amdefine@>=0.0.4", + "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-0.1.1.tgz" + } + } + } + } + }, + "convert-source-map": { + "version": "0.3.5", + "from": "convert-source-map@>=0.3.0 <0.4.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-0.3.5.tgz" + }, + "source-map": { + "version": "0.1.43", + "from": "source-map@>=0.1.31 <0.2.0", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.1.43.tgz", + "dependencies": { + "amdefine": { + "version": "0.1.1", + "from": "amdefine@>=0.0.4", + "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-0.1.1.tgz" + } + } + } + } + }, + "lexical-scope": { + "version": "1.1.1", + "from": "lexical-scope@>=1.1.0 <1.2.0", + "resolved": "https://registry.npmjs.org/lexical-scope/-/lexical-scope-1.1.1.tgz", + "dependencies": { + "astw": { + "version": "2.0.0", + "from": "astw@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/astw/-/astw-2.0.0.tgz", + "dependencies": { + "acorn": { + "version": "1.2.2", + "from": "acorn@>=1.0.3 <2.0.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-1.2.2.tgz" + } + } + } + } + } + } + }, + "isarray": { + "version": "0.0.1", + "from": "isarray@0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz" + }, + "labeled-stream-splicer": { + "version": "1.0.2", + "from": "labeled-stream-splicer@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/labeled-stream-splicer/-/labeled-stream-splicer-1.0.2.tgz", + "dependencies": { + "stream-splicer": { + "version": "1.3.1", + "from": "stream-splicer@>=1.1.0 <2.0.0", + "resolved": "https://registry.npmjs.org/stream-splicer/-/stream-splicer-1.3.1.tgz", + "dependencies": { + "readable-wrap": { + "version": "1.0.0", + "from": "readable-wrap@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/readable-wrap/-/readable-wrap-1.0.0.tgz" + }, + "indexof": { + "version": "0.0.1", + "from": "indexof@0.0.1", + "resolved": "https://registry.npmjs.org/indexof/-/indexof-0.0.1.tgz" + } + } + } + } + }, + "module-deps": { + "version": "3.8.1", + "from": "module-deps@>=3.7.11 <4.0.0", + "resolved": "https://registry.npmjs.org/module-deps/-/module-deps-3.8.1.tgz", + "dependencies": { + "detective": { + "version": "4.1.0", + "from": "detective@>=4.0.0 <5.0.0", + "resolved": "https://registry.npmjs.org/detective/-/detective-4.1.0.tgz", + "dependencies": { + "acorn": { + "version": "1.2.2", + "from": "acorn@>=1.0.3 <2.0.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-1.2.2.tgz" + }, + "escodegen": { + "version": "1.6.1", + "from": "escodegen@>=1.4.1 <2.0.0", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.6.1.tgz", + "dependencies": { + "estraverse": { + "version": "1.9.3", + "from": "estraverse@>=1.9.1 <2.0.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-1.9.3.tgz" + }, + "esutils": { + "version": "1.1.6", + "from": "esutils@>=1.1.6 <2.0.0", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-1.1.6.tgz" + }, + "esprima": { + "version": "1.2.5", + "from": "esprima@>=1.2.2 <2.0.0", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-1.2.5.tgz" + }, + "optionator": { + "version": "0.5.0", + "from": "optionator@>=0.5.0 <0.6.0", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.5.0.tgz", + "dependencies": { + "prelude-ls": { + "version": "1.1.2", + "from": "prelude-ls@>=1.1.1 <1.2.0", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz" + }, + "deep-is": { + "version": "0.1.3", + "from": "deep-is@>=0.1.2 <0.2.0", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz" + }, + "wordwrap": { + "version": "0.0.3", + "from": "wordwrap@>=0.0.2 <0.1.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz" + }, + "type-check": { + "version": "0.3.1", + "from": "type-check@>=0.3.1 <0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.1.tgz" + }, + "levn": { + "version": "0.2.5", + "from": "levn@>=0.2.5 <0.3.0", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.2.5.tgz" + }, + "fast-levenshtein": { + "version": "1.0.6", + "from": "fast-levenshtein@>=1.0.0 <1.1.0", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-1.0.6.tgz" + } + } + }, + "source-map": { + "version": "0.1.43", + "from": "source-map@>=0.1.40 <0.2.0", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.1.43.tgz", + "dependencies": { + "amdefine": { + "version": "0.1.1", + "from": "amdefine@>=0.0.4", + "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-0.1.1.tgz" + } + } + } + } + } + } + }, + "stream-combiner2": { + "version": "1.0.2", + "from": "stream-combiner2@>=1.0.0 <1.1.0", + "resolved": "https://registry.npmjs.org/stream-combiner2/-/stream-combiner2-1.0.2.tgz", + "dependencies": { + "through2": { + "version": "0.5.1", + "from": "through2@>=0.5.1 <0.6.0", + "resolved": "https://registry.npmjs.org/through2/-/through2-0.5.1.tgz", + "dependencies": { + "readable-stream": { + "version": "1.0.33", + "from": "readable-stream@>=1.0.17 <1.1.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.33.tgz", + "dependencies": { + "core-util-is": { + "version": "1.0.1", + "from": "core-util-is@>=1.0.0 <1.1.0", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz" + } + } + }, + "xtend": { + "version": "3.0.0", + "from": "xtend@>=3.0.0 <3.1.0", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-3.0.0.tgz" + } + } + } + } + } + } + }, + "os-browserify": { + "version": "0.1.2", + "from": "os-browserify@>=0.1.1 <0.2.0", + "resolved": "https://registry.npmjs.org/os-browserify/-/os-browserify-0.1.2.tgz" + }, + "parents": { + "version": "1.0.1", + "from": "parents@>=1.0.1 <2.0.0", + "resolved": "https://registry.npmjs.org/parents/-/parents-1.0.1.tgz", + "dependencies": { + "path-platform": { + "version": "0.11.15", + "from": "path-platform@>=0.11.15 <0.12.0", + "resolved": "https://registry.npmjs.org/path-platform/-/path-platform-0.11.15.tgz" + } + } + }, + "path-browserify": { + "version": "0.0.0", + "from": "path-browserify@>=0.0.0 <0.1.0", + "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-0.0.0.tgz" + }, + "process": { + "version": "0.11.1", + "from": "process@>=0.11.0 <0.12.0", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.1.tgz" + }, + "punycode": { + "version": "1.3.2", + "from": "punycode@>=1.3.2 <2.0.0", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz" + }, + "querystring-es3": { + "version": "0.2.1", + "from": "querystring-es3@>=0.2.0 <0.3.0", + "resolved": "https://registry.npmjs.org/querystring-es3/-/querystring-es3-0.2.1.tgz" + }, + "read-only-stream": { + "version": "1.1.1", + "from": "read-only-stream@>=1.1.1 <2.0.0", + "resolved": "https://registry.npmjs.org/read-only-stream/-/read-only-stream-1.1.1.tgz", + "dependencies": { + "readable-wrap": { + "version": "1.0.0", + "from": "readable-wrap@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/readable-wrap/-/readable-wrap-1.0.0.tgz" + } + } + }, + "readable-stream": { + "version": "1.1.13", + "from": "readable-stream@>=1.1.13 <2.0.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.13.tgz", + "dependencies": { + "core-util-is": { + "version": "1.0.1", + "from": "core-util-is@>=1.0.0 <1.1.0", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz" + } + } + }, + "resolve": { + "version": "1.1.6", + "from": "resolve@>=1.1.4 <2.0.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.6.tgz" + }, + "shasum": { + "version": "1.0.1", + "from": "shasum@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/shasum/-/shasum-1.0.1.tgz", + "dependencies": { + "json-stable-stringify": { + "version": "0.0.1", + "from": "json-stable-stringify@>=0.0.0 <0.1.0", + "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-0.0.1.tgz", + "dependencies": { + "jsonify": { + "version": "0.0.0", + "from": "jsonify@>=0.0.0 <0.1.0", + "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz" + } + } + }, + "sha.js": { + "version": "2.3.6", + "from": "sha.js@>=2.3.0 <2.4.0", + "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.3.6.tgz" + } + } + }, + "shell-quote": { + "version": "0.0.1", + "from": "shell-quote@>=0.0.1 <0.1.0", + "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-0.0.1.tgz" + }, + "stream-browserify": { + "version": "1.0.0", + "from": "stream-browserify@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-1.0.0.tgz" + }, + "string_decoder": { + "version": "0.10.31", + "from": "string_decoder@>=0.10.0 <0.11.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz" + }, + "subarg": { + "version": "1.0.0", + "from": "subarg@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/subarg/-/subarg-1.0.0.tgz" + }, + "syntax-error": { + "version": "1.1.4", + "from": "syntax-error@>=1.1.1 <2.0.0", + "resolved": "https://registry.npmjs.org/syntax-error/-/syntax-error-1.1.4.tgz", + "dependencies": { + "acorn": { + "version": "1.2.2", + "from": "acorn@>=1.0.3 <2.0.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-1.2.2.tgz" + } + } + }, + "through2": { + "version": "1.1.1", + "from": "through2@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/through2/-/through2-1.1.1.tgz" + }, + "timers-browserify": { + "version": "1.4.1", + "from": "timers-browserify@>=1.0.1 <2.0.0", + "resolved": "https://registry.npmjs.org/timers-browserify/-/timers-browserify-1.4.1.tgz" + }, + "tty-browserify": { + "version": "0.0.0", + "from": "tty-browserify@>=0.0.0 <0.1.0", + "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz" + }, + "url": { + "version": "0.10.3", + "from": "url@>=0.10.1 <0.11.0", + "resolved": "https://registry.npmjs.org/url/-/url-0.10.3.tgz", + "dependencies": { + "querystring": { + "version": "0.2.0", + "from": "querystring@0.2.0", + "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz" + } + } + }, + "util": { + "version": "0.10.3", + "from": "util@>=0.10.1 <0.11.0", + "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz" + }, + "vm-browserify": { + "version": "0.0.4", + "from": "vm-browserify@>=0.0.1 <0.1.0", + "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-0.0.4.tgz", + "dependencies": { + "indexof": { + "version": "0.0.1", + "from": "indexof@0.0.1", + "resolved": "https://registry.npmjs.org/indexof/-/indexof-0.0.1.tgz" + } + } + } + } + }, "canonical-path": { "version": "0.0.2", "from": "https://registry.npmjs.org/canonical-path/-/canonical-path-0.0.2.tgz", diff --git a/package.json b/package.json index 569a13b29e..74bcd9fc2a 100644 --- a/package.json +++ b/package.json @@ -54,6 +54,7 @@ "broccoli-slow-trees": "^1.1.0", "broccoli-stew": "^0.2.1", "broccoli-writer": "^0.1.1", + "browserify": "^10.2.4", "canonical-path": "0.0.2", "chokidar": "^1.0.1", "clang-format": "^1.0.25", diff --git a/protractor-shared.js b/protractor-shared.js index 4cbccfc4fa..324d4eb6d5 100644 --- a/protractor-shared.js +++ b/protractor-shared.js @@ -1,6 +1,6 @@ -// load traceur runtime as our tests are written in es6 -require('traceur/bin/traceur-runtime.js'); -require('reflect-metadata'); +// benchpress will also load traceur runtime as our tests are written in es6 +var benchpress = require('./dist/build/benchpress_bundle'); +global.benchpress = benchpress; var fs = require('fs-extra'); var argv = require('yargs') @@ -202,7 +202,6 @@ function patchProtractorWait(browser) { exports.createBenchpressRunner = function(options) { var nodeUuid = require('node-uuid'); - var benchpress = require('./dist/js/cjs/benchpress/benchpress'); // TODO(tbosch): add cloud reporter again (only when !options.test) // var cloudReporterConfig; diff --git a/scripts/ci/build_dart.sh b/scripts/ci/build_dart.sh index 3e8500d5d6..9ab1cddf86 100755 --- a/scripts/ci/build_dart.sh +++ b/scripts/ci/build_dart.sh @@ -7,6 +7,6 @@ SCRIPT_DIR=$(dirname $0) source $SCRIPT_DIR/env_dart.sh cd $SCRIPT_DIR/../.. -./node_modules/.bin/gulp build.js.cjs build.dart +./node_modules/.bin/gulp build.js.cjs build.dart benchpress.bundle pub install diff --git a/scripts/publish/npm_publish.sh b/scripts/publish/npm_publish.sh index 5105042a80..d8fb2bbe1f 100755 --- a/scripts/publish/npm_publish.sh +++ b/scripts/publish/npm_publish.sh @@ -6,7 +6,7 @@ ROOT_DIR=$(cd $(dirname $0)/../..; pwd) cd $ROOT_DIR gulp clean -gulp build.js.prod build.js.dev build.js.cjs +gulp build.js.prod build.js.dev build.js.cjs benchpress.bundle NPM_DIR=$ROOT_DIR/dist/npm rm -fr $NPM_DIR @@ -38,7 +38,14 @@ function publishModule { mkdir -p $PUBLISH_DIR/ts cp -r $ROOT_DIR/modules/$NAME/$FILES $PUBLISH_DIR/ts - cp -r $ROOT_DIR/dist/js/cjs/$NAME/$FILES $PUBLISH_DIR + if [ $NAME = "benchpress" ]; then + cp -r $ROOT_DIR/dist/build/benchpress_bundle/$FILES $PUBLISH_DIR + cp -r $ROOT_DIR/dist/js/cjs/benchpress/README.md $PUBLISH_DIR + cp -r $ROOT_DIR/dist/js/cjs/benchpress/LICENSE $PUBLISH_DIR + cp -r $ROOT_DIR/dist/js/cjs/benchpress/docs $PUBLISH_DIR + else + cp -r $ROOT_DIR/dist/js/cjs/$NAME/$FILES $PUBLISH_DIR + fi npm publish $PUBLISH_DIR } diff --git a/tools/build/bundle.js b/tools/build/bundle.js index 6f2e4fccc7..9e7c0572d9 100644 --- a/tools/build/bundle.js +++ b/tools/build/bundle.js @@ -2,6 +2,9 @@ var gulp = require('gulp'); var concat = require('gulp-concat'); var replace = require('gulp-replace'); var insert = require('gulp-insert'); +var fs = require('fs-extra'); +var browserify = require('browserify'); +var path = require('path'); module.exports.bundle = function(buildConfig, moduleName, outputFile, outputConfig, sfx) { @@ -23,3 +26,63 @@ module.exports.modify = function(srcs, concatName) { .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: [], + insertGlobalVars: ['__filename','__dirname'], + detectGlobals: false + }); + for (var i = 0; i < excludes.length; i++) { + b.exclude(excludes[i]); + } + var packageJson = JSON.parse(fs.readFileSync(packageJsonPath)); + for (var dep in packageJson.dependencies) { + //remove deps from package that we want to include in the bundle + if (includes.indexOf(dep) > -1) { + delete packageJson.dependencies[dep]; + } else { + b.exclude(dep); + } + } + for (var i = 0; i < ignore.length; i++) { + b.ignore(ignore[i]); + } + fs.mkdirsSync(dest); + fs.writeFileSync(dest + '/package.json', JSON.stringify(packageJson, null, ' ')); + b.bundle(function(err, buf) { + if (err) { + return cb(err); + } + 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); + }); +}