-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathindex.js
47 lines (36 loc) · 1.19 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';
var checker = require('ember-cli-version-checker');
var CoffeescriptEs6Filter = require('./filter');
//
// Ember-CLI Preprocessor Plugin
//
function CoffeeES6Preprocessor(project, options) {
this.project = project;
this.options = options || {};
this.name = 'ember-cli-coffees6';
}
CoffeeES6Preprocessor.prototype.ext = CoffeescriptEs6Filter.prototype.extensions;
CoffeeES6Preprocessor.prototype.toTree = function(tree, inputPath, outputPath) {
return new CoffeescriptEs6Filter(tree, this.options);
};
//
// Ember-CLI Addon
//
function CoffeescriptES6Addon(project) {
this.project = project;
this.name = 'Ember CLI Coffeescript ES6 Addon';
}
CoffeescriptES6Addon.prototype.shouldSetupRegistryInIncluded = function() {
return !checker.isAbove(this, '0.2.0');
}
CoffeescriptES6Addon.prototype.setupPreprocessorRegistry = function(type, registry) {
var plugin = new CoffeeES6Preprocessor(this.project, {/* config here */});
registry.add('js', plugin);
}
CoffeescriptES6Addon.prototype.included = function(app) {
this.app = app;
if (this.shouldSetupRegistryInIncluded()) {
this.setupPreprocessorRegistry('parent', app.registry);
}
};
module.exports = CoffeescriptES6Addon;