-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
56 lines (45 loc) · 947 Bytes
/
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
const path = require('path');
const Builder = require('./lib/builder');
const FileIndex = require('./lib/file-index');
const ImportType = require('./lib/datatype/import-type');
const {AbstractExtension} = require('zombiebox');
/**
*/
class Extension extends AbstractExtension {
/**
* @override
*/
getName() {
return 'dependency-injection';
}
/**
* @override
*/
getSourcesDir() {
return path.join(__dirname, 'lib');
}
/**
* @override
*/
getConfig() {
return {
templates: [
path.resolve(__dirname, 'templates')
]
};
}
/**
* @override
*/
generateCode(config) {
const fsSource = this._codeSource.fs;
const fileIndex = new FileIndex();
const builder = new Builder(this._templateHelper, config);
fileIndex.addSourceArray(fsSource.getJSFiles());
return {
'base-service-container.js': builder.build(fileIndex)
};
}
}
module.exports = Extension;
module.exports.types = {ImportType};