-
-
Notifications
You must be signed in to change notification settings - Fork 14
/
index.js
48 lines (40 loc) · 1.53 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
/* jshint node: true */
'use strict';
var BabelTranspiler = require('broccoli-babel-transpiler');
var Funnel = require('broccoli-funnel');
var MergeTrees = require('broccoli-merge-trees');
var path = require('path');
module.exports = {
name: 'ember-impagination',
/**
* The addon tree is augmented with the impagination modules. This
* makes them available not only to `ember-impagination` as a whole,
* but also to the application if they want to embed it. It'll look
* like:
* ember-impagination/components/impagination-dataset.js
* ember-impagination/templates/components/impagination-dataset.js
* impagination/dataset.js
* impagination/record.js
* impagination/page.js
*/
treeForAddon: function() {
// get the base addon tree
var addonTree = this._super.treeForAddon.apply(this, arguments);
// transpile the impagination sources into ES5. However, we want
// to leave the ES6 module declaration in place because they'll be
// handled later by ember-cli.
var src = require.resolve('impagination');
src = path.join(src, '..', '..', 'src');
var transpiled = new BabelTranspiler(src, {
loose: true,
blacklist: ['es6.modules']
});
// take the transpiled impagination sources and put them into
// `modules/impagination/{dataset|record|page}.js` so that the
// ember-cli build will pick them up.
var impagination = new Funnel(transpiled, {
destDir: 'modules/impagination'
});
return new MergeTrees([addonTree, impagination]);
}
};