@memlab/core 1.1.12 → 1.1.14
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.
- package/README.md +2 -2
- package/dist/__tests__/parser/HeapParser.test.d.ts +1 -1
- package/dist/__tests__/parser/HeapParser.test.js +2 -2
- package/dist/__tests__/parser/NodeHeap.test.d.ts +1 -1
- package/dist/__tests__/parser/NodeHeap.test.js +1 -1
- package/dist/__tests__/parser/StringNode.test.d.ts +1 -1
- package/dist/__tests__/parser/StringNode.test.js +1 -1
- package/dist/__tests__/parser/traverse/HeapNodeTraverse.test.d.ts +1 -1
- package/dist/__tests__/parser/traverse/HeapNodeTraverse.test.js +1 -1
- package/dist/__tests__/utils/utils.test.d.ts +1 -1
- package/dist/__tests__/utils/utils.test.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/lib/BaseOption.d.ts +1 -1
- package/dist/lib/BaseOption.js +1 -1
- package/dist/lib/BrowserInfo.d.ts +1 -1
- package/dist/lib/BrowserInfo.js +1 -1
- package/dist/lib/Config.d.ts +7 -2
- package/dist/lib/Config.js +27 -3
- package/dist/lib/Console.d.ts +1 -1
- package/dist/lib/Console.js +1 -1
- package/dist/lib/Constant.d.ts +1 -1
- package/dist/lib/Constant.js +1 -1
- package/dist/lib/FileManager.d.ts +5 -3
- package/dist/lib/FileManager.js +13 -5
- package/dist/lib/HeapAnalyzer.d.ts +1 -1
- package/dist/lib/HeapAnalyzer.js +1 -1
- package/dist/lib/HeapParser.d.ts +1 -1
- package/dist/lib/HeapParser.js +1 -1
- package/dist/lib/InternalValueSetter.d.ts +1 -1
- package/dist/lib/InternalValueSetter.js +1 -1
- package/dist/lib/NodeHeap.d.ts +1 -1
- package/dist/lib/NodeHeap.js +1 -1
- package/dist/lib/PackageInfoLoader.js +1 -1
- package/dist/lib/ProcessManager.d.ts +1 -1
- package/dist/lib/ProcessManager.js +1 -1
- package/dist/lib/Serializer.d.ts +1 -1
- package/dist/lib/Serializer.js +21 -6
- package/dist/lib/StringLoader.d.ts +1 -1
- package/dist/lib/StringLoader.js +1 -1
- package/dist/lib/Types.d.ts +33 -1
- package/dist/lib/Types.js +1 -1
- package/dist/lib/Utils.d.ts +3 -1
- package/dist/lib/Utils.js +53 -2
- package/dist/lib/heap-data/HeapEdge.d.ts +1 -1
- package/dist/lib/heap-data/HeapEdge.js +1 -1
- package/dist/lib/heap-data/HeapLocation.d.ts +3 -2
- package/dist/lib/heap-data/HeapLocation.js +8 -1
- package/dist/lib/heap-data/HeapNode.d.ts +1 -1
- package/dist/lib/heap-data/HeapNode.js +2 -2
- package/dist/lib/heap-data/HeapSnapshot.d.ts +1 -1
- package/dist/lib/heap-data/HeapSnapshot.js +1 -1
- package/dist/lib/heap-data/HeapStringNode.d.ts +1 -1
- package/dist/lib/heap-data/HeapStringNode.js +1 -1
- package/dist/lib/heap-data/HeapUtils.d.ts +1 -1
- package/dist/lib/heap-data/HeapUtils.js +1 -1
- package/dist/lib/heap-data/MemLabTagStore.d.ts +1 -1
- package/dist/lib/heap-data/MemLabTagStore.js +1 -1
- package/dist/lib/leak-filters/BaseLeakFilter.rule.d.ts +1 -1
- package/dist/lib/leak-filters/BaseLeakFilter.rule.js +1 -1
- package/dist/lib/leak-filters/LeakFilterRuleList.d.ts +1 -1
- package/dist/lib/leak-filters/LeakFilterRuleList.js +1 -1
- package/dist/lib/leak-filters/LeakObjectFilter.d.ts +1 -1
- package/dist/lib/leak-filters/LeakObjectFilter.js +1 -1
- package/dist/lib/leak-filters/rules/FilterByExternalFilter.rule.d.ts +1 -1
- package/dist/lib/leak-filters/rules/FilterByExternalFilter.rule.js +1 -1
- package/dist/lib/leak-filters/rules/FilterDetachedDOMElement.rule.d.ts +1 -1
- package/dist/lib/leak-filters/rules/FilterDetachedDOMElement.rule.js +1 -1
- package/dist/lib/leak-filters/rules/FilterHermesNode.rule.d.ts +1 -1
- package/dist/lib/leak-filters/rules/FilterHermesNode.rule.js +1 -1
- package/dist/lib/leak-filters/rules/FilterOverSizedNodeAsLeak.rule.d.ts +1 -1
- package/dist/lib/leak-filters/rules/FilterOverSizedNodeAsLeak.rule.js +1 -1
- package/dist/lib/leak-filters/rules/FilterStackTraceFrame.rule.d.ts +1 -1
- package/dist/lib/leak-filters/rules/FilterStackTraceFrame.rule.js +1 -1
- package/dist/lib/leak-filters/rules/FilterTrivialNode.rule.d.ts +1 -1
- package/dist/lib/leak-filters/rules/FilterTrivialNode.rule.js +1 -1
- package/dist/lib/leak-filters/rules/FilterUnmountedFiberNode.rule.d.ts +1 -1
- package/dist/lib/leak-filters/rules/FilterUnmountedFiberNode.rule.js +1 -1
- package/dist/logger/LeakClusterLogger.d.ts +1 -1
- package/dist/logger/LeakClusterLogger.js +1 -1
- package/dist/logger/LeakTraceDetailsLogger.d.ts +1 -1
- package/dist/logger/LeakTraceDetailsLogger.js +1 -1
- package/dist/modes/BaseMode.d.ts +1 -1
- package/dist/modes/BaseMode.js +1 -1
- package/dist/modes/InteractionTestMode.d.ts +1 -1
- package/dist/modes/InteractionTestMode.js +1 -1
- package/dist/modes/MeasureMode.d.ts +1 -1
- package/dist/modes/MeasureMode.js +1 -1
- package/dist/modes/RunningModes.d.ts +1 -1
- package/dist/modes/RunningModes.js +1 -1
- package/dist/paths/TraceFinder.d.ts +1 -1
- package/dist/paths/TraceFinder.js +1 -1
- package/dist/trace-cluster/ClusterUtils.d.ts +1 -1
- package/dist/trace-cluster/ClusterUtils.js +1 -1
- package/dist/trace-cluster/ClusterUtilsHelper.d.ts +1 -1
- package/dist/trace-cluster/ClusterUtilsHelper.js +1 -1
- package/dist/trace-cluster/ClusteringHeuristics.d.ts +1 -1
- package/dist/trace-cluster/ClusteringHeuristics.js +1 -1
- package/dist/trace-cluster/EvalutationMetric.d.ts +1 -1
- package/dist/trace-cluster/EvalutationMetric.js +1 -1
- package/dist/trace-cluster/SequentialClustering.d.ts +1 -1
- package/dist/trace-cluster/SequentialClustering.js +1 -1
- package/dist/trace-cluster/TraceBucket.d.ts +1 -1
- package/dist/trace-cluster/TraceBucket.js +1 -1
- package/dist/trace-cluster/TraceElement.d.ts +1 -1
- package/dist/trace-cluster/TraceElement.js +1 -1
- package/dist/trace-cluster/strategies/MLTraceSimilarityStrategy.d.ts +1 -1
- package/dist/trace-cluster/strategies/MLTraceSimilarityStrategy.js +1 -1
- package/dist/trace-cluster/strategies/TraceAsClusterStrategy.d.ts +1 -1
- package/dist/trace-cluster/strategies/TraceAsClusterStrategy.js +1 -1
- package/dist/trace-cluster/strategies/TraceSimilarityStrategy.d.ts +1 -1
- package/dist/trace-cluster/strategies/TraceSimilarityStrategy.js +1 -1
- package/dist/trace-cluster/strategies/machine-learning/DistanceMatrix.d.ts +1 -1
- package/dist/trace-cluster/strategies/machine-learning/DistanceMatrix.js +1 -1
- package/dist/trace-cluster/strategies/machine-learning/HAC.d.ts +1 -1
- package/dist/trace-cluster/strategies/machine-learning/HAC.js +1 -1
- package/dist/trace-cluster/strategies/machine-learning/Ngram.d.ts +1 -1
- package/dist/trace-cluster/strategies/machine-learning/Ngram.js +1 -1
- package/dist/trace-cluster/strategies/machine-learning/TfidfVectorizer.d.ts +1 -1
- package/dist/trace-cluster/strategies/machine-learning/TfidfVectorizer.js +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
This is the memlab core library. It contains V8/Hermes heap snapshot parser, core algorithms, leak trace clustering, utilities, and config.
|
|
4
4
|
|
|
5
5
|
## Online Resources
|
|
6
|
-
* [Official Website and Demo](https://
|
|
7
|
-
* [Documentation](https://
|
|
6
|
+
* [Official Website and Demo](https://facebook.github.io/memlab)
|
|
7
|
+
* [Documentation](https://facebook.github.io/memlab/docs/intro)
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*
|
|
8
8
|
* @format
|
|
9
|
-
* @oncall
|
|
9
|
+
* @oncall web_perf_infra
|
|
10
10
|
*/
|
|
11
11
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
12
12
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
@@ -39,7 +39,7 @@ test('Capture inserted object', () => __awaiter(void 0, void 0, void 0, function
|
|
|
39
39
|
const heap = yield (0, NodeHeap_1.takeNodeMinimalHeap)();
|
|
40
40
|
expect(heap.hasObjectWithClassName('TestObject')).toBe(true);
|
|
41
41
|
}), timeout);
|
|
42
|
-
test('Does not capture
|
|
42
|
+
test('Does not capture transient object', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
43
43
|
class TestObject {
|
|
44
44
|
constructor() {
|
|
45
45
|
this.arr1 = [1, 2, 3];
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*
|
|
8
8
|
* @format
|
|
9
|
-
* @oncall
|
|
9
|
+
* @oncall web_perf_infra
|
|
10
10
|
*/
|
|
11
11
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
12
12
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*
|
|
8
8
|
* @format
|
|
9
|
-
* @oncall
|
|
9
|
+
* @oncall web_perf_infra
|
|
10
10
|
*/
|
|
11
11
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
12
12
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*
|
|
8
8
|
* @format
|
|
9
|
-
* @oncall
|
|
9
|
+
* @oncall web_perf_infra
|
|
10
10
|
*/
|
|
11
11
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
12
12
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*
|
|
8
8
|
* @format
|
|
9
|
-
* @oncall
|
|
9
|
+
* @oncall web_perf_infra
|
|
10
10
|
*/
|
|
11
11
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
12
12
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/lib/BaseOption.d.ts
CHANGED
package/dist/lib/BaseOption.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*
|
|
8
8
|
* @format
|
|
9
|
-
* @oncall
|
|
9
|
+
* @oncall web_perf_infra
|
|
10
10
|
*/
|
|
11
11
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
12
12
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
package/dist/lib/BrowserInfo.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*
|
|
8
8
|
* @format
|
|
9
|
-
* @oncall
|
|
9
|
+
* @oncall web_perf_infra
|
|
10
10
|
*/
|
|
11
11
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
12
12
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
package/dist/lib/Config.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
* @format
|
|
8
|
-
* @oncall
|
|
8
|
+
* @oncall web_perf_infra
|
|
9
9
|
*/
|
|
10
10
|
import type { LaunchOptions, Permission } from 'puppeteer';
|
|
11
11
|
import type { AnyFunction, AnyValue, IClusterStrategy, IRunningMode, IScenario, Nullable, Optional, QuickExperiment, ILeakFilter, IPackageInfo } from './Types';
|
|
@@ -52,6 +52,7 @@ export declare class MemLabConfig {
|
|
|
52
52
|
_isFullRun: boolean;
|
|
53
53
|
_scenario: Optional<IScenario>;
|
|
54
54
|
_isHeadfulBrowser: boolean;
|
|
55
|
+
_disableWebSecurity: boolean;
|
|
55
56
|
_browser: string;
|
|
56
57
|
snapshotHasDetachedness: boolean;
|
|
57
58
|
specifiedEngine: boolean;
|
|
@@ -69,6 +70,7 @@ export declare class MemLabConfig {
|
|
|
69
70
|
dataBaseDir: string;
|
|
70
71
|
userDataDir: string;
|
|
71
72
|
curDataDir: string;
|
|
73
|
+
webSourceDir: string;
|
|
72
74
|
runMetaFile: string;
|
|
73
75
|
snapshotSequenceFile: string;
|
|
74
76
|
exploreResultFile: string;
|
|
@@ -188,13 +190,14 @@ export declare class MemLabConfig {
|
|
|
188
190
|
isSequentialClustering: boolean;
|
|
189
191
|
seqClusteringSplitCount: number;
|
|
190
192
|
seqClusteringIsRandomChunks: boolean;
|
|
193
|
+
instrumentJS: boolean;
|
|
191
194
|
constructor(options?: ConfigOption);
|
|
192
195
|
private initInternalConfigs;
|
|
193
196
|
private init;
|
|
194
197
|
getAdditionalConfigInContinuousTest(_app: string, _interaction: string): string[];
|
|
195
198
|
private static instance;
|
|
196
199
|
static getInstance(): MemLabConfig;
|
|
197
|
-
static
|
|
200
|
+
static resetConfigWithTransientDir(): MemLabConfig;
|
|
198
201
|
private haltOrThrow;
|
|
199
202
|
setTarget(app: string, tab: string): void;
|
|
200
203
|
set scenario(scenario: Optional<IScenario>);
|
|
@@ -205,6 +208,8 @@ export declare class MemLabConfig {
|
|
|
205
208
|
get browser(): string;
|
|
206
209
|
set isHeadfulBrowser(isHeadful: boolean);
|
|
207
210
|
get isHeadfulBrowser(): boolean;
|
|
211
|
+
set disableWebSecurity(disable: boolean);
|
|
212
|
+
get disableWebSecurity(): boolean;
|
|
208
213
|
get browserBinaryPath(): string;
|
|
209
214
|
set reportLeaksInTimers(shouldReport: boolean);
|
|
210
215
|
get reportLeaksInTimers(): boolean;
|
package/dist/lib/Config.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*
|
|
8
8
|
* @format
|
|
9
|
-
* @oncall
|
|
9
|
+
* @oncall web_perf_infra
|
|
10
10
|
*/
|
|
11
11
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
@@ -55,6 +55,7 @@ class MemLabConfig {
|
|
|
55
55
|
this._timerNodes = ['Pending activities'];
|
|
56
56
|
this._timerEdges = [];
|
|
57
57
|
this._isHeadfulBrowser = false;
|
|
58
|
+
this._disableWebSecurity = false;
|
|
58
59
|
this.targetApp = Constant_1.default.unset;
|
|
59
60
|
this.targetTab = Constant_1.default.unset;
|
|
60
61
|
this.analysisMode = Constant_1.default.unset;
|
|
@@ -115,6 +116,8 @@ class MemLabConfig {
|
|
|
115
116
|
this.snapshotHasDetachedness = false;
|
|
116
117
|
// by default running in regular mode
|
|
117
118
|
this.runningMode = RunningModes_1.default.get('regular', this);
|
|
119
|
+
// intercept and rewrite JavaScript Code in browser
|
|
120
|
+
this.instrumentJS = false;
|
|
118
121
|
// external heap snapshot paths, if enabled
|
|
119
122
|
this.externalSnapshotFilePaths = [];
|
|
120
123
|
// mute the console output, if enabled
|
|
@@ -322,9 +325,9 @@ class MemLabConfig {
|
|
|
322
325
|
}
|
|
323
326
|
return MemLabConfig.instance;
|
|
324
327
|
}
|
|
325
|
-
static
|
|
328
|
+
static resetConfigWithTransientDir() {
|
|
326
329
|
const config = MemLabConfig.getInstance();
|
|
327
|
-
FileManager_1.default.initDirs(config, {
|
|
330
|
+
FileManager_1.default.initDirs(config, { transient: true });
|
|
328
331
|
return config;
|
|
329
332
|
}
|
|
330
333
|
haltOrThrow(msg,
|
|
@@ -393,6 +396,27 @@ class MemLabConfig {
|
|
|
393
396
|
get isHeadfulBrowser() {
|
|
394
397
|
return this._isHeadfulBrowser;
|
|
395
398
|
}
|
|
399
|
+
set disableWebSecurity(disable) {
|
|
400
|
+
this._disableWebSecurity = disable;
|
|
401
|
+
const args = this.puppeteerConfig.args;
|
|
402
|
+
const flag = '--disable-web-security';
|
|
403
|
+
const index = args.indexOf(flag);
|
|
404
|
+
if (disable) {
|
|
405
|
+
// add the flag
|
|
406
|
+
if (index < 0) {
|
|
407
|
+
args.push(flag);
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
else {
|
|
411
|
+
// remove the flag
|
|
412
|
+
if (index >= 0) {
|
|
413
|
+
args.splice(index, 1);
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
get disableWebSecurity() {
|
|
418
|
+
return this._disableWebSecurity;
|
|
419
|
+
}
|
|
396
420
|
get browserBinaryPath() {
|
|
397
421
|
return path_1.default.join(this.browserDir, this.browser);
|
|
398
422
|
}
|
package/dist/lib/Console.d.ts
CHANGED
package/dist/lib/Console.js
CHANGED
package/dist/lib/Constant.d.ts
CHANGED
package/dist/lib/Constant.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
* @format
|
|
8
|
-
* @oncall
|
|
8
|
+
* @oncall web_perf_infra
|
|
9
9
|
*/
|
|
10
10
|
import type { MemLabConfig } from './Config';
|
|
11
11
|
import type { AnyValue, Optional } from './Types';
|
|
@@ -13,13 +13,13 @@ import type { AnyValue, Optional } from './Types';
|
|
|
13
13
|
export declare type FileOption = {
|
|
14
14
|
workDir?: Optional<string>;
|
|
15
15
|
clear?: boolean;
|
|
16
|
-
|
|
16
|
+
transient?: boolean;
|
|
17
17
|
};
|
|
18
18
|
/** @internal */
|
|
19
19
|
export declare class FileManager {
|
|
20
20
|
getDefaultWorkDir(): string;
|
|
21
21
|
generateTmpHeapDir(): string;
|
|
22
|
-
private static
|
|
22
|
+
private static transientInstanceIdx;
|
|
23
23
|
getWorkDir(options?: FileOption): string;
|
|
24
24
|
getChromeBinaryZipFile(): string;
|
|
25
25
|
getChromeBinaryTimeStampFile(): string;
|
|
@@ -30,6 +30,8 @@ export declare class FileManager {
|
|
|
30
30
|
getClusterSampleDataDir(): string;
|
|
31
31
|
getUserDataDir(options: FileOption): string;
|
|
32
32
|
getCurDataDir(options: FileOption): string;
|
|
33
|
+
getWebSourceDir(options?: FileOption): string;
|
|
34
|
+
getWebSourceMetaFile(options?: FileOption): string;
|
|
33
35
|
getPersistDataDir(options: FileOption): string;
|
|
34
36
|
getLoggerOutDir(options?: FileOption): string;
|
|
35
37
|
getTraceClustersDir(options?: FileOption): string;
|
package/dist/lib/FileManager.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*
|
|
8
8
|
* @format
|
|
9
|
-
* @oncall
|
|
9
|
+
* @oncall web_perf_infra
|
|
10
10
|
*/
|
|
11
11
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
@@ -52,9 +52,9 @@ class FileManager {
|
|
|
52
52
|
if (options.workDir) {
|
|
53
53
|
return path_1.default.resolve(options.workDir);
|
|
54
54
|
}
|
|
55
|
-
//
|
|
56
|
-
if (options.
|
|
57
|
-
const idx = ++FileManager.
|
|
55
|
+
// transient options supercedes other the CLI options
|
|
56
|
+
if (options.transient) {
|
|
57
|
+
const idx = ++FileManager.transientInstanceIdx;
|
|
58
58
|
const instanceId = `${process.pid}-${Date.now()}-${idx}`;
|
|
59
59
|
const workDir = path_1.default.join(this.getTmpDir(), `memlab-${instanceId}`);
|
|
60
60
|
return path_1.default.resolve(workDir);
|
|
@@ -92,6 +92,12 @@ class FileManager {
|
|
|
92
92
|
getCurDataDir(options) {
|
|
93
93
|
return path_1.default.join(this.getDataBaseDir(options), 'cur');
|
|
94
94
|
}
|
|
95
|
+
getWebSourceDir(options = {}) {
|
|
96
|
+
return path_1.default.join(this.getCurDataDir(options), 'code');
|
|
97
|
+
}
|
|
98
|
+
getWebSourceMetaFile(options = {}) {
|
|
99
|
+
return path_1.default.join(this.getWebSourceDir(options), 'files.json');
|
|
100
|
+
}
|
|
95
101
|
getPersistDataDir(options) {
|
|
96
102
|
return path_1.default.join(this.getDataBaseDir(options), 'persist');
|
|
97
103
|
}
|
|
@@ -205,6 +211,7 @@ class FileManager {
|
|
|
205
211
|
if (!fs_extra_1.default.existsSync(curDataDir)) {
|
|
206
212
|
return;
|
|
207
213
|
}
|
|
214
|
+
this.emptyDirIfExists(this.getWebSourceDir(options));
|
|
208
215
|
const dataSuffix = ['.heapsnapshot', '.json', '.png'];
|
|
209
216
|
const files = fs_extra_1.default.readdirSync(curDataDir);
|
|
210
217
|
for (const file of files) {
|
|
@@ -286,6 +293,7 @@ class FileManager {
|
|
|
286
293
|
config.userDataDir = joinAndProcessDir(options, this.getUserDataDir(options));
|
|
287
294
|
const outDir = joinAndProcessDir(options, this.getDataOutDir(options));
|
|
288
295
|
config.curDataDir = joinAndProcessDir(options, this.getCurDataDir(options));
|
|
296
|
+
config.webSourceDir = joinAndProcessDir(options, this.getWebSourceDir(options));
|
|
289
297
|
config.dataBuilderDataDir = joinAndProcessDir(options, config.dataBaseDir, 'dataBuilder');
|
|
290
298
|
config.persistentDataDir = joinAndProcessDir(options, this.getPersistDataDir(options));
|
|
291
299
|
config.consoleLogFile = path_1.default.join(config.curDataDir, 'console-log.txt');
|
|
@@ -320,5 +328,5 @@ class FileManager {
|
|
|
320
328
|
}
|
|
321
329
|
}
|
|
322
330
|
exports.FileManager = FileManager;
|
|
323
|
-
FileManager.
|
|
331
|
+
FileManager.transientInstanceIdx = 0;
|
|
324
332
|
exports.default = new FileManager();
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
* @format
|
|
8
|
-
* @oncall
|
|
8
|
+
* @oncall web_perf_infra
|
|
9
9
|
*/
|
|
10
10
|
import type { E2EStepInfo, HeapNodeIdSet, IHeapNode, IHeapSnapshot, IMemoryAnalystOptions, IMemoryAnalystSnapshotDiff, LeakTracePathItem, Optional, IOveralLeakInfo, TraceCluster, ISerializedInfo } from './Types';
|
|
11
11
|
import TraceFinder from '../paths/TraceFinder';
|
package/dist/lib/HeapAnalyzer.js
CHANGED
package/dist/lib/HeapParser.d.ts
CHANGED
package/dist/lib/HeapParser.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*
|
|
8
8
|
* @format
|
|
9
|
-
* @oncall
|
|
9
|
+
* @oncall web_perf_infra
|
|
10
10
|
*/
|
|
11
11
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
package/dist/lib/NodeHeap.d.ts
CHANGED
package/dist/lib/NodeHeap.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*
|
|
8
8
|
* @format
|
|
9
|
-
* @oncall
|
|
9
|
+
* @oncall web_perf_infra
|
|
10
10
|
*/
|
|
11
11
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
12
12
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
@@ -20,7 +20,7 @@ exports.PackageInfoLoader = void 0;
|
|
|
20
20
|
* LICENSE file in the root directory of this source tree.
|
|
21
21
|
*
|
|
22
22
|
* @format
|
|
23
|
-
* @oncall
|
|
23
|
+
* @oncall web_perf_infra
|
|
24
24
|
*/
|
|
25
25
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
26
26
|
const path_1 = __importDefault(require("path"));
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*
|
|
8
8
|
* @format
|
|
9
|
-
* @oncall
|
|
9
|
+
* @oncall web_perf_infra
|
|
10
10
|
*/
|
|
11
11
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
package/dist/lib/Serializer.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
* @format
|
|
8
|
-
* @oncall
|
|
8
|
+
* @oncall web_perf_infra
|
|
9
9
|
*/
|
|
10
10
|
import { E2EStepInfo, HeapNodeIdSet, IHeapEdge, IHeapNode, IHeapSnapshot, ISerializedInfo, LeakTracePathItem, Nullable } from './Types';
|
|
11
11
|
declare type JSONifyArgs = {
|
package/dist/lib/Serializer.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*
|
|
8
8
|
* @format
|
|
9
|
-
* @oncall
|
|
9
|
+
* @oncall web_perf_infra
|
|
10
10
|
*/
|
|
11
11
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
@@ -136,11 +136,18 @@ function JSONifyNodeOneLevel(node) {
|
|
|
136
136
|
});
|
|
137
137
|
return info;
|
|
138
138
|
}
|
|
139
|
-
|
|
139
|
+
// double check when you try to call JSONify methods
|
|
140
|
+
// other than JSONifyNodeShallow and JSONifyNodeInShort inside this method
|
|
141
|
+
// as it may trigger infinite recursion
|
|
142
|
+
function JSONifyNodeShallow(node, options = {}) {
|
|
140
143
|
const info = Object.create(null);
|
|
144
|
+
options.processedNodeId = options.processedNodeId || new Set();
|
|
145
|
+
options.processedNodeId.add(node.id);
|
|
141
146
|
iterateSelectedEdges(node, (edge) => {
|
|
147
|
+
var _a;
|
|
142
148
|
const key = JSONifyEdgeNameAndType(edge);
|
|
143
|
-
if (
|
|
149
|
+
if (!((_a = options.processedNodeId) === null || _a === void 0 ? void 0 : _a.has(edge.toNode.id)) &&
|
|
150
|
+
objectNodeUsefulProps.has(edge.name_or_index)) {
|
|
144
151
|
info[key] = JSONifyNodeShallow(edge.toNode);
|
|
145
152
|
}
|
|
146
153
|
else {
|
|
@@ -148,6 +155,7 @@ function JSONifyNodeShallow(node) {
|
|
|
148
155
|
}
|
|
149
156
|
return null;
|
|
150
157
|
});
|
|
158
|
+
options.processedNodeId.delete(node.id);
|
|
151
159
|
return info;
|
|
152
160
|
}
|
|
153
161
|
const fiberNodeUsefulProps = new Set([
|
|
@@ -324,9 +332,15 @@ function JSONifyNode(node, args, options) {
|
|
|
324
332
|
return {};
|
|
325
333
|
}
|
|
326
334
|
let info;
|
|
335
|
+
// defense against infinite recursion
|
|
336
|
+
if (options.processedNodeId.has(node.id)) {
|
|
337
|
+
info = JSONifyNodeShallow(node);
|
|
338
|
+
return info;
|
|
339
|
+
}
|
|
340
|
+
options.processedNodeId.add(node.id);
|
|
327
341
|
const depths = options.forceJSONifyDepth;
|
|
328
342
|
if (Utils_1.default.isDetachedDOMNode(node) && depths !== 0) {
|
|
329
|
-
info = JSONifyDetachedHTMLElement(node, args, EMPTY_JSONIFY_OPTIONS);
|
|
343
|
+
info = JSONifyDetachedHTMLElement(node, args, Object.assign(Object.assign({}, EMPTY_JSONIFY_OPTIONS), { processedNodeId: options.processedNodeId }));
|
|
330
344
|
}
|
|
331
345
|
else if (Utils_1.default.isFiberNode(node) && depths !== 0) {
|
|
332
346
|
info = JSONifyFiberNode(node, args, options);
|
|
@@ -349,6 +363,7 @@ function JSONifyNode(node, args, options) {
|
|
|
349
363
|
else {
|
|
350
364
|
info = JSONifyOrdinaryValue(node, args, options);
|
|
351
365
|
}
|
|
366
|
+
options.processedNodeId.delete(node.id);
|
|
352
367
|
if (node.location) {
|
|
353
368
|
info[`${filterJSONPropName('allocation location (extra)')}`] = {
|
|
354
369
|
script_id: node.location.script_id,
|
|
@@ -376,7 +391,7 @@ function JSONifyPath(path, _snapshot, args) {
|
|
|
376
391
|
let idx = 0;
|
|
377
392
|
let encounterDetachedNode = false;
|
|
378
393
|
ret['$tabsOrder:' + JSONifyTabsOrder()] = '';
|
|
379
|
-
ret[`${idx++}: ${getNodeNameInJSON(path.node, args)}`] = JSONifyNode(path.node, args, EMPTY_JSONIFY_OPTIONS);
|
|
394
|
+
ret[`${idx++}: ${getNodeNameInJSON(path.node, args)}`] = JSONifyNode(path.node, args, Object.assign(Object.assign({}, EMPTY_JSONIFY_OPTIONS), { processedNodeId: new Set() }));
|
|
380
395
|
let pathItem = path;
|
|
381
396
|
while (pathItem === null || pathItem === void 0 ? void 0 : pathItem.edge) {
|
|
382
397
|
const edge = pathItem.edge;
|
|
@@ -386,7 +401,7 @@ function JSONifyPath(path, _snapshot, args) {
|
|
|
386
401
|
nextNode.highlight = true;
|
|
387
402
|
}
|
|
388
403
|
const edgeRetainSize = pathItem.edgeRetainSize;
|
|
389
|
-
ret[`${idx++}: ${getEdgeNameInJSON(edge, edgeRetainSize)}${getNodeNameInJSON(nextNode, args)}`] = JSONifyNode(nextNode, args, EMPTY_JSONIFY_OPTIONS);
|
|
404
|
+
ret[`${idx++}: ${getEdgeNameInJSON(edge, edgeRetainSize)}${getNodeNameInJSON(nextNode, args)}`] = JSONifyNode(nextNode, args, Object.assign(Object.assign({}, EMPTY_JSONIFY_OPTIONS), { processedNodeId: new Set() }));
|
|
390
405
|
pathItem = pathItem.next;
|
|
391
406
|
}
|
|
392
407
|
return ret;
|