-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathindex.js
59 lines (46 loc) · 1.47 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
58
59
'use strict';
module.exports = {
name: require('./package').name,
included() {
let app = this.app;
if (app.options.fingerprint === undefined) {
app.options.fingerprint = {};
}
if (app.options.fingerprint.exclude === undefined) {
app.options.fingerprint.exclude = [];
}
app.options.fingerprint.exclude.push('embed.js');
// do not store config in meta tag
app.options.storeConfigInMeta = false;
// we start the app explicitly
app.options.autoRun = false;
},
config(env, baseConfig) {
this._rootURL = baseConfig.rootURL;
},
_process(appTree) {
const mergeTrees = require('broccoli-merge-trees');
const ProcessHtmlPlugin = require('./lib/process-html');
const processedTree = new ProcessHtmlPlugin(appTree, {
rootURL: this._rootURL,
ui: this.project.ui,
appName: this.app.name,
});
const babelAddon = this.app.project.findAddonByName('ember-cli-babel');
const compiledTree = babelAddon.transpileTree(processedTree, {
'ember-cli-babel': {
compileModules: false,
},
});
return mergeTrees([appTree, compiledTree], { overwrite: true });
},
process(app, appTree) {
let ownAddon = app.project.findAddonByName('ember-embedded-snippet');
if (!ownAddon) {
throw new Error(
"Could not find initialized ember-embedded-snippet addon. It must be part of your app's dependencies!"
);
}
return ownAddon._process(appTree);
},
};