This repository has been archived by the owner on Feb 5, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodule-ids.gen.js
121 lines (114 loc) · 3.86 KB
/
module-ids.gen.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/*********************************************************************
* This file is automatically generated by mmir-plugins-export tools *
* Do not modify: ANY CHANGES WILL GET DISCARDED *
*********************************************************************/
var _id = "mmir-plugin-asr-nuance-ws";
var _paths = {
"mmir-plugin-asr-nuance-ws/asrNuanceWs": "www/asrNuanceWs.js",
"mmir-plugin-asr-nuance-ws/asrNuanceWsCompat": "www/alt/asrNuanceWsCompat.js",
"mmir-plugin-asr-nuance-ws/asrNuanceWsWebpack": "www/alt/asrNuanceWsWebpack.js",
"mmir-plugin-asr-nuance-ws": "www/asrNuanceWs.js"
};
var _workers = [];
var _exportedModules = [
"mmir-plugin-asr-nuance-ws"
];
var _dependencies = [
"mmir-plugin-encoder-speex",
"mmir-plugin-encoder-core"
];
var _exportedFiles = [];
var _modes = {};
var _buildConfig = "module-config.gen.js";
function _join(source, target, dict){
source.forEach(function(item){
if(!dict[item]){
dict[item] = true;
target.push(item);
}
});
};
function _toDict(list){
var dict = {};
list.forEach(function(item){
dict[item] = true;
});
return dict;
};
function _getAll(type, mode, isResolve){
if(typeof mode === 'boolean'){
isResolve = mode;
mode = void(0);
}
var data = this[type];
var isArray = Array.isArray(data);
var result = isArray? [] : Object.assign({}, data);
var dupl = result;
var mod = mode && this.modes[mode];
if(isArray){
dupl = {};
if(mod && mod[type]){
_join(this.modes[mode][type], result, dupl);
}
_join(data, result, dupl);
} else if(isResolve){
var root = __dirname;
Object.keys(result).forEach(function(field){
var val = result[field];
if(mod && mod[field]){
val = _paths[mod[field]];
}
result[field] = root + '/' + val;
});
}
this.dependencies.forEach(function(dep){
var depExports = require(dep + '/module-ids.gen.js');
var depData = depExports.getAll(type, mode, isResolve);
if(isArray){
_join(depData, result, dupl);
} else {
Object.assign(result, depData)
}
});
return result;
};
function _getBuildConfig(pluginName, buildConfigsMap){
if(pluginName && typeof pluginName !== 'string'){
buildConfigsMap = pluginName;
pluginName = void(0);
}
var buildConfigs = [];
var dupl = Array.isArray(buildConfigsMap)? _toDict(buildConfigsMap) : buildConfigsMap || {};
if(_buildConfig){
var buildConfigMod = require(__dirname+'/'+_buildConfig);
var buildConfig = buildConfigMod.buildConfigs;
if(Array.isArray(buildConfig)){
_join(buildConfig, buildConfigs, dupl);
} else if(buildConfig && !dupl[buildConfig]){
dupl[buildConfig] = true;
buildConfigs.push(buildConfig);
}
if(Array.isArray(buildConfigMod.pluginName) && buildConfigMod.plugins){
buildConfigMod.pluginName.forEach(function(name){
if(!pluginName || pluginName === name){
var pluginBuildConfig = buildConfigMod.plugins[name].buildConfigs;
if(Array.isArray(pluginBuildConfig)){
_join(pluginBuildConfig, buildConfigs, dupl);
} else if(pluginBuildConfig && !dupl[pluginBuildConfig]){
dupl[pluginBuildConfig] = true;
buildConfigs.push(pluginBuildConfig);
}
}
});
}
}
this.dependencies.forEach(function(dep){
var depExports = require(dep + '/module-ids.gen.js');
if(depExports.buildConfig){
var depBuildConfigs = depExports.getBuildConfig(null, dupl);
_join(depBuildConfigs, buildConfigs, dupl);
}
});
return buildConfigs;
};
module.exports = {id: _id, paths: _paths, workers: _workers, modules: _exportedModules, files: _exportedFiles, dependencies: _dependencies, modes: _modes, buildConfig: _buildConfig, getAll: _getAll, getBuildConfig: _getBuildConfig};