UNPKG

1.18 kBPlain TextView Raw
1import AutoImport from './auto-import';
2import { Tree } from 'broccoli-plugin';
3
4module.exports = {
5 name: 'ember-auto-import',
6
7 setupPreprocessorRegistry(type: string, registry: any) {
8 // we register on our parent registry (so we will process code
9 // from the app or addon that chose to include us) rather than our
10 // own registry (which would cause us to process our own code)
11 if (type !== 'parent') {
12 return;
13 }
14
15 // This is where we hook our analyzer into the build pipeline so
16 // it will see all the consumer app or addon's javascript
17 registry.add('js', {
18 name: 'ember-auto-import-analyzer',
19 toTree: (tree: Tree) => {
20 return AutoImport.lookup(this).analyze(tree, this);
21 }
22 });
23 },
24
25 included() {
26 let autoImport = AutoImport.lookup(this);
27 this._super.included.apply(this, arguments);
28 if (autoImport.isPrimary(this)) {
29 autoImport.included(this);
30 }
31 },
32
33 updateFastBootManifest(manifest: { vendorFiles: string[] }) {
34 let autoImport = AutoImport.lookup(this);
35 if (autoImport.isPrimary(this)) {
36 autoImport.updateFastBootManifest(manifest);
37 }
38 return manifest;
39 }
40};