-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.js
57 lines (46 loc) · 1.45 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
57
/* jshint node: true */
'use strict';
var stew = require('broccoli-stew');
var path = require('path');
var mergeTrees = require('broccoli-merge-trees');
var Filter = require('broccoli-filter');
/**
A broccoli filter to get around what appears to be a
babel bug. The following is not parsed properly
let Scheduler = {
asap,
async,
queue,
animationFrame
};
So we transform it to the non-enhanced object literal form
let Scheduler = {
asap: asap,
async: async,
queue: queue,
animationFrame: animationFrame
};
*/
RxHack.prototype = Object.create(Filter.prototype);
RxHack.prototype.constructor = RxHack;
function RxHack(inputNode) {
Filter.call(this, inputNode);
}
RxHack.prototype.extensions = ['js'];
RxHack.prototype.targetExtension = 'js';
RxHack.prototype.processString = function(content, relativePath) {
return content.replace("let Scheduler = {\n asap,\n async,\n queue,\n animationFrame\n};",
"let Scheduler = {\n asap: asap,\n async: async,\n queue: queue,\n animationFrame: animationFrame\n};");
};
module.exports = {
name: 'rxjs',
treeForAddon: function(tree) {
var rxPath = path.dirname(require.resolve('rxjs-es'));
var rxTree = stew.find(rxPath, {
include: ['**/*.js']
});
var rxHackTree = new RxHack(rxTree);
var trees = tree ? mergeTrees([tree, rxHackTree]) : rxHackTree;
return this._super.treeForAddon.call(this, trees);
}
};