-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.js
47 lines (34 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
'use strict';
const VersionChecker = require('ember-cli-version-checker');
module.exports = {
name: require('./package').name,
init() {
this._super.init && this._super.init.apply(this, arguments);
let checker = new VersionChecker(this.project);
let emberVersion = checker.forEmber();
this.shouldPolyfillManager = emberVersion.lt('3.8.0-alpha.1');
this.shouldPolyfillCapabilities = emberVersion.lt('3.13.0-beta.3');
},
included() {
this._super.included.apply(this, arguments);
if (this.shouldPolyfillManager) {
this.import('vendor/ember-modifier-manager-polyfill.js');
}
if (this.shouldPolyfillCapabilities) {
this.import('vendor/ember-modifier-capabilities-polyfill.js');
}
},
treeForVendor(rawVendorTree) {
if (!this.shouldPolyfillManager && !this.shouldPolyfillCapabilities) {
return;
}
let babelAddon = this.addons.find(addon => addon.name === 'ember-cli-babel');
let transpiledVendorTree = babelAddon.transpileTree(rawVendorTree, {
babel: this.options.babel,
'ember-cli-babel': {
compileModules: false,
},
});
return transpiledVendorTree;
},
};