|
3 | 3 |
|
4 | 4 | const path = require('path'); |
5 | 5 | const resolve = require('resolve'); |
6 | | -const Rollup = require('broccoli-rollup'); |
7 | 6 | const Funnel = require('broccoli-funnel'); |
8 | 7 | const mergeTrees = require('broccoli-merge-trees'); |
9 | | -const transformer = require('ember-cli-es6-transform'); |
10 | 8 |
|
11 | 9 | module.exports = { |
12 | 10 | name: 'ember-cli-spinjs', |
13 | 11 |
|
14 | | - included(app) { |
15 | | - // this._super.included.apply(app, arguments); |
16 | | - this._super.included.apply(this, arguments); |
17 | | - this.app = this._findHost(); |
18 | | - |
19 | | - app.import('vendor/spin.js'); |
20 | | - }, |
21 | | - |
22 | | - treeForVendor(tree) { |
23 | | - const spinJsPath = path.join(resolve.sync('spin.js'), '..'); |
24 | | - |
25 | | - let allTrees = []; |
26 | | - |
27 | | - let rollupTree = new Rollup(spinJsPath, { |
28 | | - rollup: { |
29 | | - input: 'spin.js', |
30 | | - output: { |
31 | | - file: 'spin.js', |
32 | | - format: 'es' |
33 | | - }, |
34 | | - onwarn: function(warning) { |
35 | | - |
36 | | - // Suppress known error message caused by TypeScript compiled code with Rollup |
37 | | - // https://github.com/rollup/rollup/wiki/Troubleshooting#this-is-undefined |
38 | | - if (warning.code === 'THIS_IS_UNDEFINED') { |
39 | | - return; |
40 | | - } |
41 | | - |
42 | | - // eslint-disable-next-line no-console |
43 | | - console.log("Rollup warning: ", warning.message); |
44 | | - }, |
45 | | - } |
46 | | - }); |
47 | | - |
48 | | - const babel = this.app.project.findAddonByName('ember-cli-babel'); |
49 | | - const babelOptions = babel.buildBabelOptions(); |
50 | | - const es6Tree = transformer.es6Transform(rollupTree, babelOptions); |
51 | | - |
52 | | - allTrees.push(es6Tree); |
53 | | - |
54 | | - if (tree) { |
55 | | - allTrees.push(tree); |
56 | | - } |
57 | | - |
58 | | - return mergeTrees(allTrees); |
59 | | - }, |
60 | | - |
61 | 12 | treeForAddonStyles: function (tree) { |
62 | 13 | const spinJsPath = path.join(resolve.sync('spin.js'), '..'); |
63 | 14 |
|
|
0 commit comments