-
Notifications
You must be signed in to change notification settings - Fork 82
/
index.js
56 lines (47 loc) · 1.16 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
'use strict';
const DEFAULT_OPTIONS = {
includeStyles: true,
};
module.exports = {
name: require('./package').name,
isDevelopingAddon() {
return false;
},
included: function (app, parentAddon) {
this._super.included.apply(this, arguments);
// support for nested addon
// see: https://github.com/ember-cli/ember-cli/issues/3718
const target = parentAddon || app;
if (!this.app && target.app) {
this.app = target.app;
}
const options = {
...DEFAULT_OPTIONS,
...this.app.options[this.name],
};
if (options.includeStyles === true) {
this.app.import('vendor/ember-freestyle.css');
}
},
setupPreprocessorRegistry(type, registry) {
if (type !== 'parent') {
return;
}
let pluginObj = this._buildPlugin();
pluginObj.parallelBabel = {
requireFile: __filename,
buildUsing: '_buildPlugin',
params: {},
};
registry.add('htmlbars-ast-plugin', pluginObj);
},
_buildPlugin() {
return {
name: 'component-freestyle-source-extracter',
plugin: require('./lib/ast-transform'),
baseDir() {
return __dirname;
},
};
},
};