forked from adopted-ember-addons/ember-cli-chart
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
43 lines (39 loc) · 955 Bytes
/
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
'use strict';
const FastbootTransform = require('fastboot-transform');
module.exports = {
name: require('./package').name,
options: {
nodeAssets: {
'chart.js': {
vendor: {
srcDir: 'dist',
include: ['chart.js'],
processTree(input) {
return FastbootTransform(input);
}
}
}
}
},
included() {
this._super.included.apply(this, arguments);
this._ensureThisImport();
this.import('vendor/chart.js/chart.js');
},
_ensureThisImport() {
if (!this.import) {
this._findHost = function findHostShim() {
let current = this;
let app;
do {
app = current.app || app;
} while (current.parent.parent && (current = current.parent));
return app;
};
this.import = function importShim(asset, options) {
let app = this._findHost();
app.import(asset, options);
};
}
}
};