This repository has been archived by the owner on Mar 27, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
57 lines (47 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 p = require('path');
var templatePath = p.resolve(__dirname + '/assets/module-template.js.t');
var stew = require('broccoli-stew');
var rename = stew.rename;
var find = stew.find;
var Template = require('broccoli-templater');
var mergeTrees = require('broccoli-merge-trees');
function expand(input) {
var path = p.dirname(input);
var file = p.basename(input);
return path + '/{' + file + '}';
}
module.exports = {
name: 'ember-seamless-immutable',
// This follows @stefanpenner import strategy from ember-fetch
// @link https://github.com/stefanpenner/ember-fetch/blob/master/index.js
treeForVendor: function(tree) {
var seamlessImmutablePath = require.resolve('seamless-immutable');
var expandedSeamlessImmutablePath = expand(seamlessImmutablePath);
var seamlessImmutable = rename(find(expandedSeamlessImmutablePath), function(path) {
return 'seamless-immutable/src/seamless-immutable.js'
});
var app = this.app;
return mergeTrees([
new Template(seamlessImmutable, templatePath, function variables(content) {
return {
environment: app.env,
moduleBody: content
};
})
]);
},
included: function(app) {
this.app = app;
this._super.included(app);
app.import('vendor/seamless-immutable/src/seamless-immutable.js', {
exports: {
default: [
'default',
'Immutable'
]
}
});
}
};