forked from lutzroeder/netron
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwrapperLoader.js
More file actions
33 lines (28 loc) · 790 Bytes
/
wrapperLoader.js
File metadata and controls
33 lines (28 loc) · 790 Bytes
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
/*
* @File: wrapper-loader.js
* @Desc: wrapper netron source
* @Author: JingyuanZhang
* @Date: 2021-11-16 23:43:22
* @LastEditTime: 2021-11-16 23:43:22
*/
module.exports = function(source) {
const fileNPathArr = this.resourcePath.split('.')[0].split('/');
const fileName = fileNPathArr.pop();
const localDir = fileNPathArr.pop();
if (localDir === 'source' && fileName === 'index') {
return `
${source}
if (typeof module !== 'undefined' && typeof module.exports === 'object') {
module.exports.BrowserHost = host.BrowserHost;
}
`;
}
else if (fileName === 'paddle') {
return `
(function(protobuf, flatbuffers) {
${source}
})(protobuf, flatbuffers);
`;
}
return source;
}