-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
44 lines (37 loc) · 1.13 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
var amdTreeBuilder = require('./lib/broccoli/amd-tree-builder');
var cjsTreeBuilder = require('./lib/broccoli/cjs-tree-builder');
var defaults = require('lodash/object/defaults');
var defaultBaseOptions = {
libDirName: 'lib',
vendoredModules: [],
outputFileName: null,
packageName: null
};
var defaultAMDOptions = defaults({
loader: false
}, defaultBaseOptions);
var defaultGlobalOptions = defaults({
isGlobal: true,
loader: true,
registerGlobalExport: 'registerGlobal',
}, defaultBaseOptions);
var defaultCommonJSOptions = defaults({}, defaultBaseOptions);
function build(treeType, options) {
options = options || {};
switch (treeType) {
case 'amd':
options = defaults({}, options, defaultAMDOptions);
return amdTreeBuilder.build(options);
case 'global':
options = defaults({}, options, defaultGlobalOptions);
return amdTreeBuilder.build(options);
case 'commonjs':
options = defaults({}, options, defaultCommonJSOptions);
return cjsTreeBuilder.build(options);
default:
throw new Error('Tree type "' + treeType + '" is unknown');
}
}
module.exports = {
build: build
};