Skip to content

Commit

Permalink
use bundle Builder class
Browse files Browse the repository at this point in the history
  • Loading branch information
guybedford committed Jan 12, 2016
1 parent 2484820 commit be34ee2
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 46 deletions.
47 changes: 1 addition & 46 deletions api.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
37 changes: 37 additions & 0 deletions lib/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit be34ee2

Please sign in to comment.