Skip to content
This repository has been archived by the owner on Oct 9, 2020. It is now read-only.

Commit

Permalink
entry point build fix, array build fix
Browse files Browse the repository at this point in the history
  • Loading branch information
guybedford committed Feb 18, 2016
1 parent 0d4ddd7 commit 8e73240
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
11 changes: 8 additions & 3 deletions lib/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ Builder.prototype.bundle = function(expressionOrTree, outFile, opts) {
return Promise.resolve()
.then(function() {
if (expressionOrTree instanceof Array)
expressionOrTree = '[' + expressionOrTree.join('] [') + ']';
expressionOrTree = '[' + expressionOrTree.join('] + [') + ']';

if (typeof expressionOrTree != 'string')
return expressionOrTree;
Expand Down Expand Up @@ -571,9 +571,14 @@ Builder.prototype.buildStatic = function(expressionOrTree, outFile, opts) {
if (opts && opts.config)
this.config(opts.config);

// if only one module is provided, it is an entry point
var entryPoints;
if (typeof expressionOrTree == 'string' && expressionOrTree.indexOf(/ [\+\&\-] /) == -1)
entryPoints = [expressionOrTree];

var outputOpts = processOutputOpts(opts, { outFile: outFile });
var traceOpts = processTraceOpts(opts, { tracePackageConfig: false });
var compileOpts = processCompileOpts(opts, { static: true });
var compileOpts = processCompileOpts(opts, { static: true, entryPoints: entryPoints });
var inlineMap;

// override the fetch function if given
Expand All @@ -583,7 +588,7 @@ Builder.prototype.buildStatic = function(expressionOrTree, outFile, opts) {
return Promise.resolve()
.then(function() {
if (expressionOrTree instanceof Array)
expressionOrTree = '[' + expressionOrTree.join('] [') + ']';
expressionOrTree = '[' + expressionOrTree.join('] + [') + ']';

if (typeof expressionOrTree != 'string')
return expressionOrTree;
Expand Down
9 changes: 8 additions & 1 deletion lib/compile.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,15 @@ function compileTree(loader, tree, traceOpts, compileOpts, outputOpts, cache) {

var ordered = getTreeModulesPostOrder(tree, traceOpts);

// compileOpts.entryPoints can be unnormalized
var inputEntryPoints;
if (compileOpts.entryPoints)
inputEntryPoints = compileOpts.entryPoints.map(function(entryPoint) {
return loader.getCanonicalName(loader.normalizeSync(entryPoint));
});

// get entrypoints from graph algorithm
var entryPoints = compileOpts.entryPoints || [];
var entryPoints = inputEntryPoints || [];

ordered.entryPoints.forEach(function(entryPoint) {
if (entryPoints.indexOf(entryPoint == -1))
Expand Down

0 comments on commit 8e73240

Please sign in to comment.