meminsight-core-publish 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/dist/Index.d.ts +21 -0
  2. package/dist/Index.d.ts.map +1 -0
  3. package/dist/Index.js +65 -0
  4. package/dist/analyzer/AnalysisInfo.d.ts +112 -0
  5. package/dist/analyzer/AnalysisInfo.d.ts.map +1 -0
  6. package/dist/analyzer/AnalysisInfo.js +217 -0
  7. package/dist/analyzer/ArkAnalyzer.d.ts +30 -0
  8. package/dist/analyzer/ArkAnalyzer.d.ts.map +1 -0
  9. package/dist/analyzer/ArkAnalyzer.js +52 -0
  10. package/dist/analyzer/ArkCmpCfg.d.ts +15 -0
  11. package/dist/analyzer/ArkCmpCfg.d.ts.map +1 -0
  12. package/dist/analyzer/ArkCmpCfg.js +15 -0
  13. package/dist/analyzer/ArkCompareAnalyzer.d.ts +52 -0
  14. package/dist/analyzer/ArkCompareAnalyzer.d.ts.map +1 -0
  15. package/dist/analyzer/ArkCompareAnalyzer.js +144 -0
  16. package/dist/analyzer/ArkLeakAnalyzer.d.ts +14 -0
  17. package/dist/analyzer/ArkLeakAnalyzer.d.ts.map +1 -0
  18. package/dist/analyzer/ArkLeakAnalyzer.js +18 -0
  19. package/dist/analyzer/ArkSerializer.d.ts +18 -0
  20. package/dist/analyzer/ArkSerializer.d.ts.map +1 -0
  21. package/dist/analyzer/ArkSerializer.js +155 -0
  22. package/dist/analyzer/ArkStatAnalyzer.d.ts +56 -0
  23. package/dist/analyzer/ArkStatAnalyzer.d.ts.map +1 -0
  24. package/dist/analyzer/ArkStatAnalyzer.js +224 -0
  25. package/dist/analyzer/ArkStatCfg.d.ts +42 -0
  26. package/dist/analyzer/ArkStatCfg.d.ts.map +1 -0
  27. package/dist/analyzer/ArkStatCfg.js +42 -0
  28. package/dist/analyzer/ArkTracePath.d.ts +90 -0
  29. package/dist/analyzer/ArkTracePath.d.ts.map +1 -0
  30. package/dist/analyzer/ArkTracePath.js +245 -0
  31. package/dist/analyzer/ArkTracer.d.ts +17 -0
  32. package/dist/analyzer/ArkTracer.d.ts.map +1 -0
  33. package/dist/analyzer/ArkTracer.js +27 -0
  34. package/dist/analyzer/ArkXAnalyzer.d.ts +69 -0
  35. package/dist/analyzer/ArkXAnalyzer.d.ts.map +1 -0
  36. package/dist/analyzer/ArkXAnalyzer.js +616 -0
  37. package/dist/analyzer/IAnalyzer.d.ts +25 -0
  38. package/dist/analyzer/IAnalyzer.d.ts.map +1 -0
  39. package/dist/analyzer/IAnalyzer.js +2 -0
  40. package/dist/file/FileReader.d.ts +51 -0
  41. package/dist/file/FileReader.d.ts.map +1 -0
  42. package/dist/file/FileReader.js +110 -0
  43. package/dist/file/FileService.d.ts +23 -0
  44. package/dist/file/FileService.d.ts.map +1 -0
  45. package/dist/file/FileService.js +65 -0
  46. package/dist/file/FileWriter.d.ts +82 -0
  47. package/dist/file/FileWriter.d.ts.map +1 -0
  48. package/dist/file/FileWriter.js +160 -0
  49. package/dist/report/Reporter.d.ts +27 -0
  50. package/dist/report/Reporter.d.ts.map +1 -0
  51. package/dist/report/Reporter.js +61 -0
  52. package/dist/report/templates/template.d.ts +3 -0
  53. package/dist/report/templates/template.d.ts.map +1 -0
  54. package/dist/report/templates/template.js +106 -0
  55. package/dist/shell/DeviceShell.d.ts +96 -0
  56. package/dist/shell/DeviceShell.d.ts.map +1 -0
  57. package/dist/shell/DeviceShell.js +180 -0
  58. package/dist/shell/Shell.d.ts +52 -0
  59. package/dist/shell/Shell.d.ts.map +1 -0
  60. package/dist/shell/Shell.js +79 -0
  61. package/dist/types/Constants.d.ts +15 -0
  62. package/dist/types/Constants.d.ts.map +1 -0
  63. package/dist/types/Constants.js +18 -0
  64. package/dist/types/LeakTypes.d.ts +18 -0
  65. package/dist/types/LeakTypes.d.ts.map +1 -0
  66. package/dist/types/LeakTypes.js +2 -0
  67. package/dist/types/OhosTypes.d.ts +74 -0
  68. package/dist/types/OhosTypes.d.ts.map +1 -0
  69. package/dist/types/OhosTypes.js +83 -0
  70. package/dist/utils/Common.d.ts +14 -0
  71. package/dist/utils/Common.d.ts.map +1 -0
  72. package/dist/utils/Common.js +38 -0
  73. package/dist/utils/Finder.d.ts +163 -0
  74. package/dist/utils/Finder.d.ts.map +1 -0
  75. package/dist/utils/Finder.js +355 -0
  76. package/dist/utils/Loader.d.ts +30 -0
  77. package/dist/utils/Loader.d.ts.map +1 -0
  78. package/dist/utils/Loader.js +71 -0
  79. package/dist/utils/Log.d.ts +140 -0
  80. package/dist/utils/Log.d.ts.map +1 -0
  81. package/dist/utils/Log.js +177 -0
  82. package/dist/utils/Output.d.ts +126 -0
  83. package/dist/utils/Output.d.ts.map +1 -0
  84. package/dist/utils/Output.js +225 -0
  85. package/package.json +61 -0
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TEMPLATE_CTX = void 0;
4
+ const TEMPLATE_CTX = `
5
+ <!DOCTYPE html>
6
+ <html>
7
+ <head>
8
+ <meta charset="UTF-8">
9
+ <title><%= title %></title>
10
+ <style>
11
+ body {
12
+ font-family: Arial, sans-serif;
13
+ margin: 20px;
14
+ line-height: 1.6;
15
+ }
16
+ h1 { color: #333; }
17
+ .info {
18
+ color: #666;
19
+ margin-bottom: 20px;
20
+ padding: 10px;
21
+ background: #f5f5f5;
22
+ border-radius: 5px;
23
+ display: flex;
24
+ flex-direction: column;
25
+ align-items: start;
26
+ }
27
+ table {
28
+ width: 100%;
29
+ border-collapse: collapse;
30
+ margin-top: 20px;
31
+ box-shadow: 0 2px 5px rgba(0,0,0,0.1);
32
+ font-size: 14px;
33
+ }
34
+ th {
35
+ background-color: #4CAF50;
36
+ color: white;
37
+ padding: 12px;
38
+ text-align: left;
39
+ }
40
+ td {
41
+ padding: 10px;
42
+ border-bottom: 1px solid #ddd;
43
+ max-width: 300px;
44
+ word-break: break-word;
45
+ }
46
+ tr:hover {
47
+ background-color: #f5f5f5;
48
+ }
49
+ tr:nth-child(even) {
50
+ background-color: #f9f9f9;
51
+ }
52
+ .empty {
53
+ text-align: center;
54
+ color: #999;
55
+ padding: 20px;
56
+ }
57
+ .analyze-container {
58
+ display: flex;
59
+ flex-direction: column;
60
+ align-items: start;
61
+ }
62
+ </style>
63
+ </head>
64
+ <body>
65
+ <h1><%= title %></h1>
66
+ <div class="info">
67
+ 生成时间: <%= time %> | 共 <%= data.length %> 个功能
68
+ </div>
69
+ <% if (data.length === 0) { %>
70
+ <div class="empty">暂无数据</div>
71
+ <% } else { %>
72
+ <% data.forEach(function(analyze) { %>
73
+ <div class="analyze-container">
74
+ <h2><%= analyze.feature %></h2>
75
+ <div class="info">
76
+ <% analyze.messages.forEach(function(mes) { %>
77
+ <div>
78
+ <%= mes %>
79
+ </div>
80
+ <% }) %>
81
+ </div>
82
+ <table>
83
+ <thead>
84
+ <tr>
85
+ <% analyze.columns.forEach(function(value, key) { %>
86
+ <th><%= value %></th>
87
+ <% }); %>
88
+ </tr>
89
+ </thead>
90
+ <tbody>
91
+ <% analyze.data.forEach(function(row, index) { %>
92
+ <tr>
93
+ <% analyze.columns.forEach(function(value, col) { %>
94
+ <td><%= row[col] !== undefined ? row[col] : '-' %></td>
95
+ <% }); %>
96
+ </tr>
97
+ <% }); %>
98
+ </tbody>
99
+ </table>
100
+ </div>
101
+ <% }) %>
102
+ <% } %>
103
+ </body>
104
+ </html>
105
+ `;
106
+ exports.TEMPLATE_CTX = TEMPLATE_CTX;
@@ -0,0 +1,96 @@
1
+ import { AppInfo, DeviceInfo } from "../types/OhosTypes";
2
+ /**
3
+ * DeviceShell
4
+ */
5
+ export declare class DeviceShell {
6
+ private static defaultInstance;
7
+ private static deviceMap;
8
+ private deviceInfo?;
9
+ constructor(deviceId?: string);
10
+ /**
11
+ * 获取DeviceShell实例
12
+ * @param deviceId device id
13
+ * @returns DeviceShell
14
+ */
15
+ static getDeviceShell(deviceId?: string): DeviceShell;
16
+ /**
17
+ * clear device shell instances
18
+ */
19
+ static clearDeviceShell(): void;
20
+ private getDeviceCmd;
21
+ /**
22
+ * 默认 DeviceShell 单例
23
+ * @returns device instance
24
+ */
25
+ static default(): DeviceShell;
26
+ /**
27
+ * 获取设备信息
28
+ * @returns device info
29
+ */
30
+ getDeviceInfo(): DeviceInfo | undefined;
31
+ /**
32
+ * 获取设备ID
33
+ * @returns device id
34
+ */
35
+ getDeviceId(): string;
36
+ /**
37
+ * 执行设备命令
38
+ * @param cmd command
39
+ * @param excludeEmptyLine 输出不包含空行
40
+ * @param trimLine 输出行去空格
41
+ * @returns 输出信息
42
+ */
43
+ execSync(cmd: string, excludeEmptyLine?: boolean, trimLine?: boolean): string[];
44
+ /**
45
+ * 接收文件到本地
46
+ * @param remoteFile 远程文件路径
47
+ * @param localFile 本地文件路径
48
+ */
49
+ recvFile(remoteFile: string, localFile: string): void;
50
+ /**
51
+ * 发送文件到设备
52
+ * @param localFile 本地文件路径
53
+ * @param remoteFile 远程文件路径
54
+ */
55
+ sendFile(localFile: string, remoteFile: string): void;
56
+ /**
57
+ * 通过应用名称获取app信息
58
+ * @param bundleName 应用名称
59
+ * @returns AppInfo
60
+ */
61
+ getAppInfoByName(bundleName: string): AppInfo;
62
+ /**
63
+ * 通过pid获取app信息
64
+ * @param pid pid
65
+ * @returns AppInfo
66
+ */
67
+ getAppInfoByPid(pid: number): AppInfo;
68
+ /**
69
+ * 应用进程PID
70
+ * @param bundleName 应用名称
71
+ * @returns pid | undefined
72
+ */
73
+ getAppPid(bundleName: string): number | undefined;
74
+ /**
75
+ * 获取应用名称
76
+ * @param pid 进程id
77
+ * @returns 进程名称
78
+ */
79
+ getAppName(pid: number): string;
80
+ /**
81
+ * 是否是Root镜像设备
82
+ * @returns true/false
83
+ */
84
+ isRootDevice(): boolean;
85
+ /**
86
+ * 指定pid GC
87
+ * @param pid 进程id
88
+ */
89
+ forceGC(pid: number): Promise<void>;
90
+ /**
91
+ * 指定包名 GC
92
+ * @param name 进程名
93
+ */
94
+ forceGCByName(app: string): Promise<void>;
95
+ }
96
+ //# sourceMappingURL=DeviceShell.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DeviceShell.d.ts","sourceRoot":"","sources":["../../src/shell/DeviceShell.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEzD;;GAEG;AACH,qBAAa,WAAW;IACpB,OAAO,CAAC,MAAM,CAAC,eAAe,CAAkC;IAChE,OAAO,CAAC,MAAM,CAAC,SAAS,CAAuC;IAC/D,OAAO,CAAC,UAAU,CAAC,CAAa;gBAEpB,QAAQ,CAAC,EAAE,MAAM;IAI7B;;;;OAIG;WACW,cAAc,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAI,WAAW;IAS7D;;OAEG;WACW,gBAAgB,IAAK,IAAI;IAIvC,OAAO,CAAC,YAAY;IAKpB;;;OAGG;WACW,OAAO,IAAI,WAAW;IAIpC;;;OAGG;IACI,aAAa,IAAI,UAAU,GAAG,SAAS;IAI9C;;;OAGG;IACI,WAAW,IAAK,MAAM;IAI7B;;;;;;OAMG;IACI,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,gBAAgB,GAAE,OAAc,EAAE,QAAQ,GAAE,OAAc,GAAG,MAAM,EAAE;IAOlG;;;;OAIG;IACI,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI;IAI5D;;;;OAIG;IACI,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI;IAI5D;;;;OAIG;IACI,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAI,OAAO;IAOrD;;;;OAIG;IACI,eAAe,CAAC,GAAG,EAAE,MAAM,GAAI,OAAO;IAO7C;;;;OAIG;IACI,SAAS,CAAC,UAAU,EAAE,MAAM,GAAI,MAAM,GAAG,SAAS;IASzD;;;;OAIG;IACI,UAAU,CAAC,GAAG,EAAE,MAAM,GAAI,MAAM;IAUvC;;;OAGG;IACI,YAAY,IAAK,OAAO;IAK/B;;;OAGG;IACU,OAAO,CAAC,GAAG,EAAE,MAAM,GAAI,OAAO,CAAC,IAAI,CAAC;IAKjD;;;OAGG;IACU,aAAa,CAAC,GAAG,EAAE,MAAM,GAAI,OAAO,CAAC,IAAI,CAAC;CAM1D"}
@@ -0,0 +1,180 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.DeviceShell = void 0;
13
+ const Shell_1 = require("./Shell");
14
+ const OhosTypes_1 = require("../types/OhosTypes");
15
+ /**
16
+ * DeviceShell
17
+ */
18
+ class DeviceShell {
19
+ constructor(deviceId) {
20
+ this.deviceInfo = new OhosTypes_1.DeviceInfo(deviceId);
21
+ }
22
+ /**
23
+ * 获取DeviceShell实例
24
+ * @param deviceId device id
25
+ * @returns DeviceShell
26
+ */
27
+ static getDeviceShell(deviceId) {
28
+ let shellInst = DeviceShell.deviceMap.get(deviceId || '');
29
+ if (!shellInst) {
30
+ shellInst = new DeviceShell(deviceId);
31
+ DeviceShell.deviceMap.set(deviceId || '', shellInst);
32
+ }
33
+ return shellInst;
34
+ }
35
+ /**
36
+ * clear device shell instances
37
+ */
38
+ static clearDeviceShell() {
39
+ DeviceShell.deviceMap.clear();
40
+ }
41
+ getDeviceCmd() {
42
+ let deviceId = this.getDeviceId();
43
+ return `${deviceId === '' ? '' : `-t ${deviceId}`}`;
44
+ }
45
+ /**
46
+ * 默认 DeviceShell 单例
47
+ * @returns device instance
48
+ */
49
+ static default() {
50
+ return this.defaultInstance;
51
+ }
52
+ /**
53
+ * 获取设备信息
54
+ * @returns device info
55
+ */
56
+ getDeviceInfo() {
57
+ return this.deviceInfo;
58
+ }
59
+ /**
60
+ * 获取设备ID
61
+ * @returns device id
62
+ */
63
+ getDeviceId() {
64
+ var _a;
65
+ return ((_a = this.deviceInfo) === null || _a === void 0 ? void 0 : _a.deviceId) || '';
66
+ }
67
+ /**
68
+ * 执行设备命令
69
+ * @param cmd command
70
+ * @param excludeEmptyLine 输出不包含空行
71
+ * @param trimLine 输出行去空格
72
+ * @returns 输出信息
73
+ */
74
+ execSync(cmd, excludeEmptyLine = true, trimLine = true) {
75
+ let args = {
76
+ excludeEmptyLine: excludeEmptyLine,
77
+ trimLine: trimLine
78
+ };
79
+ return Shell_1.Shell.execSync(`hdc ${this.getDeviceCmd()} shell "${cmd}"`, args);
80
+ }
81
+ /**
82
+ * 接收文件到本地
83
+ * @param remoteFile 远程文件路径
84
+ * @param localFile 本地文件路径
85
+ */
86
+ recvFile(remoteFile, localFile) {
87
+ Shell_1.Shell.execSync(`hdc ${this.getDeviceCmd()} file recv "${remoteFile}" "${localFile}"`);
88
+ }
89
+ /**
90
+ * 发送文件到设备
91
+ * @param localFile 本地文件路径
92
+ * @param remoteFile 远程文件路径
93
+ */
94
+ sendFile(localFile, remoteFile) {
95
+ Shell_1.Shell.execSync(`hdc ${this.getDeviceCmd()} file send "${localFile}" "${remoteFile}"`);
96
+ }
97
+ /**
98
+ * 通过应用名称获取app信息
99
+ * @param bundleName 应用名称
100
+ * @returns AppInfo
101
+ */
102
+ getAppInfoByName(bundleName) {
103
+ const appInfo = new OhosTypes_1.AppInfo();
104
+ appInfo.name = bundleName;
105
+ appInfo.pid = this.getAppPid(bundleName);
106
+ return appInfo;
107
+ }
108
+ /**
109
+ * 通过pid获取app信息
110
+ * @param pid pid
111
+ * @returns AppInfo
112
+ */
113
+ getAppInfoByPid(pid) {
114
+ const appInfo = new OhosTypes_1.AppInfo();
115
+ appInfo.pid = pid;
116
+ appInfo.name = this.getAppName(pid);
117
+ return appInfo;
118
+ }
119
+ /**
120
+ * 应用进程PID
121
+ * @param bundleName 应用名称
122
+ * @returns pid | undefined
123
+ */
124
+ getAppPid(bundleName) {
125
+ let strs = this.execSync(`pidof ${bundleName}`);
126
+ if (strs.length === 1) {
127
+ return parseInt(strs[0].trim().split(' ')[0]);
128
+ }
129
+ else {
130
+ return undefined;
131
+ }
132
+ }
133
+ /**
134
+ * 获取应用名称
135
+ * @param pid 进程id
136
+ * @returns 进程名称
137
+ */
138
+ getAppName(pid) {
139
+ // 20008 2940 674 0 12:35:30 ? 00:00:16 com.xxx.yyy.zzz
140
+ let strs = this.execSync(`ps -ef | grep ${pid} | grep -v grep`);
141
+ let appName;
142
+ if (strs.length === 1) {
143
+ appName = strs[0].split(/\s+/).pop();
144
+ }
145
+ return appName || '';
146
+ }
147
+ /**
148
+ * 是否是Root镜像设备
149
+ * @returns true/false
150
+ */
151
+ isRootDevice() {
152
+ let strs = this.execSync('ls /system');
153
+ return strs.findIndex(str => str.indexOf('ls: /system: Permission denied') >= 0) == -1;
154
+ }
155
+ /**
156
+ * 指定pid GC
157
+ * @param pid 进程id
158
+ */
159
+ forceGC(pid) {
160
+ return __awaiter(this, void 0, void 0, function* () {
161
+ let cmd = `hidumper --mem-jsheap ${pid} --gc`;
162
+ this.execSync(cmd);
163
+ });
164
+ }
165
+ /**
166
+ * 指定包名 GC
167
+ * @param name 进程名
168
+ */
169
+ forceGCByName(app) {
170
+ return __awaiter(this, void 0, void 0, function* () {
171
+ let pid = this.getAppPid(app);
172
+ if (pid) {
173
+ yield this.forceGC(pid);
174
+ }
175
+ });
176
+ }
177
+ }
178
+ exports.DeviceShell = DeviceShell;
179
+ DeviceShell.defaultInstance = new DeviceShell();
180
+ DeviceShell.deviceMap = new Map();
@@ -0,0 +1,52 @@
1
+ import { ExecFileSyncOptions } from 'child_process';
2
+ /**
3
+ * execute args
4
+ */
5
+ export declare class ShellArgs {
6
+ /**
7
+ * exclude empty line
8
+ */
9
+ excludeEmptyLine: boolean;
10
+ /**
11
+ * trim line start and end
12
+ */
13
+ trimLine: boolean;
14
+ }
15
+ /**
16
+ * shell interface
17
+ */
18
+ export interface IShell {
19
+ /**
20
+ * execute command
21
+ * @param command command
22
+ * @param ExecuteArgs execute args
23
+ */
24
+ execSync(command: string, args?: ShellArgs): string[];
25
+ /**
26
+ * execute target
27
+ * @param target target path
28
+ * @param ExecuteArgs execute args
29
+ * @param options options
30
+ */
31
+ execSyncTarget(target: string, args?: ShellArgs, options?: ExecFileSyncOptions): string[];
32
+ }
33
+ /**
34
+ * shell wrapper
35
+ */
36
+ export declare class Shell {
37
+ private static _impl;
38
+ /**
39
+ * execute command
40
+ * @param command commanda
41
+ * @param formatArgs output format args
42
+ */
43
+ static execSync(command: string, args?: ShellArgs): string[];
44
+ /**
45
+ * execute target
46
+ * @param target target path
47
+ * @param args args
48
+ * @param options options
49
+ */
50
+ static execSyncTarget(target: string, args?: ShellArgs, options?: ExecFileSyncOptions): string[];
51
+ }
52
+ //# sourceMappingURL=Shell.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Shell.d.ts","sourceRoot":"","sources":["../../src/shell/Shell.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAE5E;;GAEG;AACH,qBAAa,SAAS;IAClB;;OAEG;IACH,gBAAgB,EAAE,OAAO,CAAQ;IAEjC;;OAEG;IACH,QAAQ,EAAE,OAAO,CAAQ;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,MAAM;IACnB;;;;OAIG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,SAAS,GAAG,MAAM,EAAE,CAAC;IAEtD;;;;;OAKG;IACH,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,MAAM,EAAE,CAAC;CAC7F;AAuCD;;GAEG;AACH,qBAAa,KAAK;IACd,OAAO,CAAC,MAAM,CAAC,KAAK,CAA2B;IAE/C;;;;OAIG;WACW,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,SAAS,GAAG,MAAM,EAAE;IAInE;;;;;OAKG;WACW,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,MAAM,EAAE;CAG1G"}
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Shell = exports.ShellArgs = void 0;
4
+ const child_process_1 = require("child_process");
5
+ /**
6
+ * execute args
7
+ */
8
+ class ShellArgs {
9
+ constructor() {
10
+ /**
11
+ * exclude empty line
12
+ */
13
+ this.excludeEmptyLine = true;
14
+ /**
15
+ * trim line start and end
16
+ */
17
+ this.trimLine = true;
18
+ }
19
+ }
20
+ exports.ShellArgs = ShellArgs;
21
+ /**
22
+ * shell implementation
23
+ */
24
+ class ShellImpl {
25
+ /**
26
+ * 执行同步命令
27
+ * @param command 命令
28
+ * @param args 执行参数
29
+ * @returns 输出字符串数组
30
+ */
31
+ execSync(command, args) {
32
+ let lines = (0, child_process_1.execSync)(command).toString("utf-8").split(/\r?\n/);
33
+ if (args) {
34
+ if (args.excludeEmptyLine) {
35
+ lines = lines.filter(line => !!line);
36
+ }
37
+ if (args.trimLine) {
38
+ lines = lines.map(lines => lines.trim());
39
+ }
40
+ }
41
+ return lines;
42
+ }
43
+ execSyncTarget(target, args, options) {
44
+ let lines = (0, child_process_1.execFileSync)(target, options).toString('utf-8').split(/\r?\n/);
45
+ if (args) {
46
+ if (args.excludeEmptyLine) {
47
+ lines = lines.filter(line => !!line);
48
+ }
49
+ if (args.trimLine) {
50
+ lines = lines.map(lines => lines.trim());
51
+ }
52
+ }
53
+ return lines;
54
+ }
55
+ }
56
+ /**
57
+ * shell wrapper
58
+ */
59
+ class Shell {
60
+ /**
61
+ * execute command
62
+ * @param command commanda
63
+ * @param formatArgs output format args
64
+ */
65
+ static execSync(command, args) {
66
+ return this._impl.execSync(command, args);
67
+ }
68
+ /**
69
+ * execute target
70
+ * @param target target path
71
+ * @param args args
72
+ * @param options options
73
+ */
74
+ static execSyncTarget(target, args, options) {
75
+ return this._impl.execSyncTarget(target, args, options);
76
+ }
77
+ }
78
+ exports.Shell = Shell;
79
+ Shell._impl = new ShellImpl();
@@ -0,0 +1,15 @@
1
+ /**
2
+ * strings enum
3
+ */
4
+ export declare enum STRINGS {
5
+ IS_DELETING = "isDeleting_",
6
+ BOOLEAN_TRUE = "Boolean:true",
7
+ OBJECT = "(object)",
8
+ CLOSURE = "(closure)",
9
+ FUNCTION = "(function)",
10
+ ARRAY = "(array)",
11
+ STRING = "(string)",
12
+ CONSTRUCTOR = "constructor",
13
+ PROTO = "__proto__"
14
+ }
15
+ //# sourceMappingURL=Constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Constants.d.ts","sourceRoot":"","sources":["../../src/types/Constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,OAAO;IACf,WAAW,gBAAgB;IAC3B,YAAY,iBAAiB;IAE7B,MAAM,aAAa;IACnB,OAAO,cAAc;IACrB,QAAQ,eAAe;IACvB,KAAK,YAAY;IACjB,MAAM,aAAa;IAEnB,WAAW,gBAAgB;IAC3B,KAAK,cAAc;CACtB"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.STRINGS = void 0;
4
+ /**
5
+ * strings enum
6
+ */
7
+ var STRINGS;
8
+ (function (STRINGS) {
9
+ STRINGS["IS_DELETING"] = "isDeleting_";
10
+ STRINGS["BOOLEAN_TRUE"] = "Boolean:true";
11
+ STRINGS["OBJECT"] = "(object)";
12
+ STRINGS["CLOSURE"] = "(closure)";
13
+ STRINGS["FUNCTION"] = "(function)";
14
+ STRINGS["ARRAY"] = "(array)";
15
+ STRINGS["STRING"] = "(string)";
16
+ STRINGS["CONSTRUCTOR"] = "constructor";
17
+ STRINGS["PROTO"] = "__proto__";
18
+ })(STRINGS || (exports.STRINGS = STRINGS = {}));
@@ -0,0 +1,18 @@
1
+ import { LeakTracePathItem } from '@memlab/core';
2
+ export interface ILeakBase {
3
+ nodeId: number;
4
+ startTime: number;
5
+ endTime: number;
6
+ duration?: number;
7
+ }
8
+ export interface ILeakTrace extends ILeakBase {
9
+ trace: LeakTracePathItem;
10
+ }
11
+ export interface ILeakUnit extends ILeakBase {
12
+ trace: string[];
13
+ }
14
+ export interface ILeakResult {
15
+ related: Map<any, any>;
16
+ leaks: ILeakUnit[];
17
+ }
18
+ //# sourceMappingURL=LeakTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LeakTypes.d.ts","sourceRoot":"","sources":["../../src/types/LeakTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAEhD,MAAM,WAAW,SAAS;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,UAAW,SAAQ,SAAS;IACzC,KAAK,EAAE,iBAAiB,CAAC;CAC5B;AAED,MAAM,WAAW,SAAU,SAAQ,SAAS;IACxC,KAAK,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,MAAM,WAAW,WAAW;IACxB,OAAO,EAAE,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IACvB,KAAK,EAAE,SAAS,EAAE,CAAC;CACtB"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,74 @@
1
+ /**
2
+ * interface for data info
3
+ */
4
+ export interface IDataInfo {
5
+ type: string;
6
+ toString(): string;
7
+ }
8
+ /**
9
+ * os info
10
+ */
11
+ export declare class OsInfo implements IDataInfo {
12
+ type: string;
13
+ name: string;
14
+ version?: string;
15
+ constructor(name?: string, version?: string);
16
+ toString(): string;
17
+ }
18
+ /**
19
+ * device info
20
+ */
21
+ export declare class DeviceInfo implements IDataInfo {
22
+ type: string;
23
+ deviceId: string;
24
+ deviceName?: string;
25
+ version?: string;
26
+ constructor(deviceId?: string);
27
+ toString(): string;
28
+ }
29
+ /**
30
+ * app info
31
+ */
32
+ export declare class AppInfo implements IDataInfo {
33
+ type: string;
34
+ name: string;
35
+ pid?: number;
36
+ version?: string;
37
+ constructor(name?: string, pid?: number, version?: string);
38
+ toString(): string;
39
+ }
40
+ /**
41
+ * url info
42
+ */
43
+ export declare class UrlInfo implements IDataInfo {
44
+ type: string;
45
+ url: string;
46
+ mappingUrl?: string;
47
+ toString(): string;
48
+ }
49
+ /**
50
+ * heap file info
51
+ */
52
+ export declare class HeapFileInfo implements IDataInfo {
53
+ type: string;
54
+ name: string;
55
+ path: string;
56
+ size?: number;
57
+ region?: string;
58
+ scene?: string;
59
+ url?: UrlInfo;
60
+ createTime?: number;
61
+ constructor(path: string);
62
+ toString(): string;
63
+ }
64
+ /**
65
+ * heap infos
66
+ */
67
+ export declare class HeapInfos {
68
+ osInfo?: OsInfo;
69
+ deviceInfo?: DeviceInfo;
70
+ appInfo?: AppInfo;
71
+ heapFileInfo?: HeapFileInfo;
72
+ constructor(os?: OsInfo, device?: DeviceInfo, app?: AppInfo, heapFile?: HeapFileInfo);
73
+ }
74
+ //# sourceMappingURL=OhosTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OhosTypes.d.ts","sourceRoot":"","sources":["../../src/types/OhosTypes.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,SAAS;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,IAAI,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,qBAAa,MAAO,YAAW,SAAS;IAC7B,IAAI,EAAE,MAAM,CAAQ;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;gBAEZ,IAAI,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM;IAKpC,QAAQ,IAAI,MAAM;CAG5B;AAED;;GAEG;AACH,qBAAa,UAAW,YAAW,SAAS;IACjC,IAAI,EAAE,MAAM,CAAiB;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;gBAEZ,QAAQ,CAAC,EAAE,MAAM;IAItB,QAAQ,IAAI,MAAM;CAG5B;AAED;;GAEG;AACH,qBAAa,OAAQ,YAAW,SAAS;IAC9B,IAAI,EAAE,MAAM,CAAS;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;gBAEZ,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM;IAMlD,QAAQ,IAAI,MAAM;CAG5B;AAED;;GAEG;AACH,qBAAa,OAAQ,YAAW,SAAS;IAC9B,IAAI,EAAE,MAAM,CAAS;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,QAAQ,IAAI,MAAM;CAG5B;AAED;;GAEG;AACH,qBAAa,YAAa,YAAW,SAAS;IACnC,IAAI,EAAE,MAAM,CAAU;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAK;gBAEnB,IAAI,EAAE,MAAM;IAIjB,QAAQ,IAAI,MAAM;CAG5B;AAED;;GAEG;AACH,qBAAa,SAAS;IACX,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,YAAY,CAAC;gBAEvB,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,UAAU,EAAE,GAAG,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,YAAY;CAMvF"}