-
Notifications
You must be signed in to change notification settings - Fork 10
/
index.js
35 lines (31 loc) · 880 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
'use strict';
const VersionChecker = require('ember-cli-version-checker');
const buildAstTransform = require('./lib/ast-transform')
module.exports = {
name: require('./package').name,
setupPreprocessorRegistry(type, registry) {
if (type !== 'parent') {
return;
}
let checker = new VersionChecker(this.project);
let dep = checker.for('ember-source');
let version = dep.gte('3.17.0');
const options = { version };
const plugin = this._buildPlugin(options);
plugin.parallelBabel = {
requireFile: __filename,
buildUsing: '_buildPlugin',
params: options,
};
registry.add('htmlbars-ast-plugin', plugin);
},
_buildPlugin(options) {
return {
name: 'ember-maybe-in-element-transform',
plugin: buildAstTransform(options.version),
baseDir() {
return __dirname;
},
};
},
};