@memlab/core 1.1.31 → 1.1.32
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LeakTraceDetailsLogger.d.ts","sourceRoot":"","sources":["../../src/logger/LeakTraceDetailsLogger.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,QAAQ,EACT,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"LeakTraceDetailsLogger.d.ts","sourceRoot":"","sources":["../../src/logger/LeakTraceDetailsLogger.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,QAAQ,EACT,MAAM,cAAc,CAAC;AAQtB,cAAM,sBAAsB;IAC1B,qBAAqB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM;IAIlD,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAOzC,QAAQ,CACN,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,EACxB,QAAQ,EAAE,aAAa,EACvB,kBAAkB,EAAE,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,EACtC,KAAK,EAAE,iBAAiB,EACxB,QAAQ,EAAE,MAAM,GACf,QAAQ,CAAC,eAAe,CAAC;IAsB5B,SAAS,CACP,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,EACxB,QAAQ,EAAE,aAAa,EACvB,kBAAkB,EAAE,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,EACtC,MAAM,EAAE,iBAAiB,EAAE,EAC3B,MAAM,EAAE,MAAM,GACb,KAAK,CAAC,eAAe,CAAC;CAkB1B;;AAED,wBAA4C"}
|
|
@@ -16,6 +16,7 @@ const Serializer_1 = __importDefault(require("../lib/Serializer"));
|
|
|
16
16
|
const Utils_1 = __importDefault(require("../lib/Utils"));
|
|
17
17
|
const fs_1 = __importDefault(require("fs"));
|
|
18
18
|
const path_1 = __importDefault(require("path"));
|
|
19
|
+
const Console_1 = __importDefault(require("../lib/Console"));
|
|
19
20
|
class LeakTraceDetailsLogger {
|
|
20
21
|
_wrapPathJSONInLoader(jsonContent) {
|
|
21
22
|
return `window.gcPath = ${jsonContent};`;
|
|
@@ -29,11 +30,22 @@ class LeakTraceDetailsLogger {
|
|
|
29
30
|
logTrace(leakedIdSet, snapshot, nodeIdsInSnapshots, trace, filepath) {
|
|
30
31
|
const options = { leakedIdSet, nodeIdsInSnapshots };
|
|
31
32
|
const gcTrace = Serializer_1.default.JSONifyPath(trace, snapshot, options);
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
try {
|
|
34
|
+
const traceJSON = JSON.stringify(gcTrace, null, 2);
|
|
35
|
+
const content = this._wrapPathJSONInLoader(traceJSON);
|
|
36
|
+
fs_1.default.writeFile(filepath, content, 'UTF-8', () => {
|
|
37
|
+
// noop
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
catch (ex) {
|
|
41
|
+
const error = Utils_1.default.getError(ex);
|
|
42
|
+
if (error.message.includes('Invalid string length')) {
|
|
43
|
+
Console_1.default.warning('Trace details JSON not saved because it exceeded the size limit.');
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
Utils_1.default.haltOrThrow(error);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
37
49
|
return gcTrace;
|
|
38
50
|
}
|
|
39
51
|
logTraces(leakedIdSet, snapshot, nodeIdsInSnapshots, traces, outDir) {
|