From be34ee28b3f0fa8f7bd304421bfa71bceff0774b Mon Sep 17 00:00:00 2001 From: guybedford Date: Tue, 12 Jan 2016 10:50:41 +0200 Subject: [PATCH] use bundle Builder class --- api.js | 47 +---------------------------------------------- lib/bundle.js | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 46 deletions(-) diff --git a/api.js b/api.js index 74769cc59..971d6e4bf 100644 --- a/api.js +++ b/api.js @@ -88,52 +88,7 @@ API.Loader = function() { /* * Builder API */ - -/* - * Returns a jspm-configured SystemJS Builder class - */ -API.Builder = function() { - bundle.Builder.apply(this, arguments); -}; - -API.Builder.prototype = Object.create(bundle.Builder); - - -// extend build functions with jspm 0.16 compatibility options -API.Builder.prototype.bundle = function(expressionOrTree, outFile, opts) { - if (outFile && typeof outFile === 'object') { - opts = outFile; - outFile = undefined; - } - - opts = opts || {}; - - if (outFile) - opts.outFile = outFile; - - if (!('normalize' in opts)) - opts.normalize = true; - - return bundle.Builder.prototype.bundle.call(this, expressionOrTree, opts); -}; - -API.Builder.prototype.buildStatic = function(expressionOrTree, outFile, opts) { - if (outFile && typeof outFile === 'object') { - opts = outFile; - outFile = undefined; - } - - opts = opts || {}; - - if (outFile) - opts.outFile = outFile; - - if (!('format' in opts)) - opts.format = 'global'; - - return bundle.Builder.prototype.buildStatic.call(this, expressionOrTree, opts); -}; - +API.Builder = bundle.Builder; // options.inject // options.sourceMaps diff --git a/lib/bundle.js b/lib/bundle.js index c29384441..53d2fcca7 100644 --- a/lib/bundle.js +++ b/lib/bundle.js @@ -44,6 +44,43 @@ function Builder(_config) { this.config(_config, true); } Builder.prototype = Object.create(SystemJSBuilder.prototype); + +// extend build functions with jspm 0.16 compatibility options +Builder.prototype.bundle = function(expressionOrTree, outFile, opts) { + if (outFile && typeof outFile === 'object') { + opts = outFile; + outFile = undefined; + } + + opts = opts || {}; + + if (outFile) + opts.outFile = outFile; + + if (!('normalize' in opts)) + opts.normalize = true; + + return SystemJSBuilder.prototype.bundle.call(this, expressionOrTree, opts); +}; + +Builder.prototype.buildStatic = function(expressionOrTree, outFile, opts) { + if (outFile && typeof outFile === 'object') { + opts = outFile; + outFile = undefined; + } + + opts = opts || {}; + + if (outFile) + opts.outFile = outFile; + + if (!('format' in opts)) + opts.format = 'global'; + + return SystemJSBuilder.prototype.buildStatic.call(this, expressionOrTree, opts); +}; + + exports.Builder = Builder; exports.depCache = function(expression) {