@memlab/core 1.1.11 → 1.1.12

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) Meta Platforms, Inc. and affiliates.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/index.d.ts CHANGED
@@ -49,4 +49,6 @@ export { default as EvaluationMetric } from './trace-cluster/EvalutationMetric';
49
49
  export * from './lib/PackageInfoLoader';
50
50
  /** @internal */
51
51
  export { default as SequentialClustering } from './trace-cluster/SequentialClustering';
52
+ /** @internal */
53
+ export { default as TraceFinder } from './paths/TraceFinder';
52
54
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -35,7 +35,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
35
35
  return (mod && mod.__esModule) ? mod : { "default": mod };
36
36
  };
37
37
  Object.defineProperty(exports, "__esModule", { value: true });
38
- exports.SequentialClustering = exports.EvaluationMetric = exports.NormalizedTrace = exports.leakClusterLogger = exports.ProcessManager = exports.modes = exports.constant = exports.analysis = exports.browserInfo = exports.serializer = exports.fileManager = exports.utils = exports.BaseOption = exports.info = exports.config = exports.registerPackage = void 0;
38
+ exports.TraceFinder = exports.SequentialClustering = exports.EvaluationMetric = exports.NormalizedTrace = exports.leakClusterLogger = exports.ProcessManager = exports.modes = exports.constant = exports.analysis = exports.browserInfo = exports.serializer = exports.fileManager = exports.utils = exports.BaseOption = exports.info = exports.config = exports.registerPackage = void 0;
39
39
  const path_1 = __importDefault(require("path"));
40
40
  const PackageInfoLoader_1 = require("./lib/PackageInfoLoader");
41
41
  /** @internal */
@@ -100,3 +100,6 @@ __exportStar(require("./lib/PackageInfoLoader"), exports);
100
100
  /** @internal */
101
101
  var SequentialClustering_1 = require("./trace-cluster/SequentialClustering");
102
102
  Object.defineProperty(exports, "SequentialClustering", { enumerable: true, get: function () { return __importDefault(SequentialClustering_1).default; } });
103
+ /** @internal */
104
+ var TraceFinder_1 = require("./paths/TraceFinder");
105
+ Object.defineProperty(exports, "TraceFinder", { enumerable: true, get: function () { return __importDefault(TraceFinder_1).default; } });
@@ -18,8 +18,7 @@ const constants = {
18
18
  supportedBrowsers: Object.create(null),
19
19
  internalDir: 'fb-internal',
20
20
  monoRepoDir: '',
21
- defaultUserAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2)' +
22
- ' AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.0 Safari/537.36',
21
+ defaultUserAgent: 'default',
23
22
  V8SyntheticRoots: [
24
23
  '(GC roots)',
25
24
  '(Internalized strings)',
@@ -28,6 +28,7 @@ declare type UnboundedObjectInfo = {
28
28
  node: IHeapNode;
29
29
  type: string;
30
30
  history: number[];
31
+ historyNumberFormatter?: (n: number) => string;
31
32
  };
32
33
  declare function summarizeUnboundedObjects(unboundedObjects: UnboundedObjectInfo[], options?: SummarizeOptions): string;
33
34
  declare function summarizeUnboundedObjectsToCSV(unboundedObjects: UnboundedObjectInfo[]): string;
@@ -553,15 +553,17 @@ function summarizeNodeShape(node, options = {}) {
553
553
  return summarizeObjectShape(node, options);
554
554
  }
555
555
  function summarizeUnboundedObjects(unboundedObjects, options = {}) {
556
- const sizeSep = options.color ? chalk_1.default.grey(' > ') : ' > ';
556
+ const historySeparator = options.color ? chalk_1.default.grey(' > ') : ' > ';
557
557
  const prefix = options.color ? chalk_1.default.grey('· ') : '· ';
558
558
  const opt = Object.assign({ compact: true }, options);
559
559
  return unboundedObjects
560
560
  .map(item => {
561
+ var _a;
561
562
  const id = options.color ? chalk_1.default.grey(`@${item.id}`) : `@${item.id}`;
562
563
  const name = summarizeNodeShape(item.node, opt);
564
+ const formatter = (_a = item.historyNumberFormatter) !== null && _a !== void 0 ? _a : Utils_1.default.getReadableBytes.bind(Utils_1.default);
563
565
  return (`${prefix}${name} [${item.type}](${id}): ` +
564
- item.history.map(v => Utils_1.default.getReadableBytes(v)).join(sizeSep));
566
+ item.history.map(v => formatter(v)).join(historySeparator));
565
567
  })
566
568
  .join('\n');
567
569
  }
@@ -361,7 +361,7 @@ export declare type InteractionsCallback = (page: Page, args?: OperationArgs) =>
361
361
  * ```
362
362
  *
363
363
  * The test scenario instance can also be passed to the
364
- * [`run` API](../modules/api_src#run) exported by `@memlab/api`.
364
+ * {@link run} API exported by `@memlab/api`.
365
365
  * ```typescript
366
366
  * const {run} = require('@memlab/api');
367
367
  *
@@ -924,7 +924,7 @@ export interface IHeapSnapshot {
924
924
  /**
925
925
  * Search for the heap and check if there is any JS object instance with
926
926
  * a specified constructor name.
927
- * @param className The contructor name of the object instance
927
+ * @param className The constructor name of the object instance
928
928
  * @returns `true` if there is at least one such object in the heap
929
929
  *
930
930
  * * **Examples**: you can write a jest unit test with memory assertions:
@@ -963,7 +963,7 @@ export interface IHeapSnapshot {
963
963
  /**
964
964
  * Search for the heap and get one of the JS object instances with
965
965
  * a specified constructor name (if there is any).
966
- * @param className The contructor name of the object instance
966
+ * @param className The constructor name of the object instance
967
967
  * @returns a handle pointing to any one of the object instances, returns
968
968
  * `null` if no such object exists in the heap.
969
969
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memlab/core",
3
- "version": "1.1.11",
3
+ "version": "1.1.12",
4
4
  "license": "MIT",
5
5
  "description": "memlab core libraries",
6
6
  "author": "Liang Gong <lgong@fb.com>",
@@ -24,7 +24,8 @@
24
24
  },
25
25
  "files": [
26
26
  "dist",
27
- "static"
27
+ "static",
28
+ "LICENSE"
28
29
  ],
29
30
  "engines": {
30
31
  "node": ">= 12.6.0"