forked from ahmadsoe/ember-highcharts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
83 lines (66 loc) · 2.27 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
'use strict';
var Funnel = require('broccoli-funnel');
var mergeTrees = require('broccoli-merge-trees');
var path = require('path');
module.exports = {
name: 'ember-highcharts',
included: function() {
this._super.included.apply(this, arguments);
var app;
// If the addon has the _findHost() method (in ember-cli >= 2.7.0), we'll just
// use that.
if (typeof this._findHost === 'function') {
app = this._findHost();
} else {
// Otherwise, we'll use this implementation borrowed from the _findHost()
// method in ember-cli.
var current = this;
do {
app = current.app || app;
} while (current.parent.parent && (current = current.parent));
}
var options = app.options.emberHighCharts || { includeHighCharts: true };
var highchartsPath = options.useStyledMode ? 'vendor/highcharts/js' : 'vendor/highcharts';
if (options.includeHighCharts) {
app.import(`${highchartsPath}/highcharts.src.js`);
}
if (options.includeHighStock) {
app.import(`${highchartsPath}/highstock.src.js`);
}
if (options.includeHighMaps) {
app.import(`${highchartsPath}/highmaps.src.js`);
}
if (options.includeHighChartsMore) {
app.import(`${highchartsPath}/highcharts-more.src.js`);
}
if (options.includeHighCharts3D) {
// boost module need to be imported before highcharts-3d
if (options.includeModules) {
var boostIndex = options.includeModules.indexOf('boost');
if (boostIndex !== -1) {
app.import(`${highchartsPath}/modules/boost.src.js`);
options.includeModules.splice(boostIndex, 1);
}
}
app.import(`${highchartsPath}/highcharts-3d.src.js`);
}
if (options.includeModules) {
var modules = options.includeModules;
for (var i = 0; i < modules.length; i++) {
var moduleFilename = modules[i] + '.src.js';
app.import(`${highchartsPath}/modules/${moduleFilename}`);
}
}
},
treeForVendor: function(vendorTree) {
var trees = [];
var highchartsPath = path.dirname(require.resolve('highcharts'));
if (vendorTree) {
trees.push(vendorTree);
}
trees.push(new Funnel(highchartsPath, {
destDir: 'highcharts'
}));
return mergeTrees(trees);
}
};