@memlab/lens 1.0.1 → 1.0.3

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,3 +1,28 @@
1
+ /**
2
+ * @license MemLab
3
+ * MIT License
4
+ *
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in all
15
+ * copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ *
25
+ */
1
26
  (function webpackUniversalModuleDefinition(root, factory) {
2
27
  if(typeof exports === 'object' && typeof module === 'object')
3
28
  module.exports = factory();
@@ -107,7 +132,7 @@ class DOMObserver {
107
132
  if (document.body) {
108
133
  // observe changes in DOM tree
109
134
  (_a = __classPrivateFieldGet(this, _DOMObserver_mutationObserver, "f")) === null || _a === void 0 ? void 0 : _a.observe(document.body, {
110
- childList: true, // Detect direct additions/removals
135
+ childList: true,
111
136
  subtree: true, // Observe all descendants
112
137
  });
113
138
  }
@@ -215,7 +240,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
215
240
  return (mod && mod.__esModule) ? mod : { "default": mod };
216
241
  };
217
242
  Object.defineProperty(exports, "__esModule", ({ value: true }));
218
- exports.createReactMemoryScan = createReactMemoryScan;
243
+ exports.createReactMemoryScan = void 0;
219
244
  /**
220
245
  * Copyright (c) Meta Platforms, Inc. and affiliates.
221
246
  *
@@ -234,6 +259,7 @@ function createReactMemoryScan(options = {}) {
234
259
  // memoryScan.registerExtension(domVisualizer);
235
260
  // return memoryScan;
236
261
  }
262
+ exports.createReactMemoryScan = createReactMemoryScan;
237
263
 
238
264
 
239
265
  /***/ }),
@@ -258,23 +284,13 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
258
284
  }) : function(o, v) {
259
285
  o["default"] = v;
260
286
  });
261
- var __importStar = (this && this.__importStar) || (function () {
262
- var ownKeys = function(o) {
263
- ownKeys = Object.getOwnPropertyNames || function (o) {
264
- var ar = [];
265
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
266
- return ar;
267
- };
268
- return ownKeys(o);
269
- };
270
- return function (mod) {
271
- if (mod && mod.__esModule) return mod;
272
- var result = {};
273
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
274
- __setModuleDefault(result, mod);
275
- return result;
276
- };
277
- })();
287
+ var __importStar = (this && this.__importStar) || function (mod) {
288
+ if (mod && mod.__esModule) return mod;
289
+ var result = {};
290
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
291
+ __setModuleDefault(result, mod);
292
+ return result;
293
+ };
278
294
  var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
279
295
  if (kind === "m") throw new TypeError("Private method is not writable");
280
296
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
@@ -300,7 +316,7 @@ var __rest = (this && this.__rest) || function (s, e) {
300
316
  var __importDefault = (this && this.__importDefault) || function (mod) {
301
317
  return (mod && mod.__esModule) ? mod : { "default": mod };
302
318
  };
303
- var _ReactMemoryScan_instances, _ReactMemoryScan_elementWeakRefs, _ReactMemoryScan_isActivated, _ReactMemoryScan_intervalId, _ReactMemoryScan_elementToBoundingRects, _ReactMemoryScan_elementToComponentStack, _ReactMemoryScan_knownFiberNodes, _ReactMemoryScan_fiberAnalyzer, _ReactMemoryScan_isDevMode, _ReactMemoryScan_subscribers, _ReactMemoryScan_extensions, _ReactMemoryScan_scanIntervalMs, _ReactMemoryScan_domObserver, _ReactMemoryScan_eventListenerTracker, _ReactMemoryScan_log, _ReactMemoryScan_notifySubscribers, _ReactMemoryScan_notifyExtensionsBeforeScan, _ReactMemoryScan_notifyExtensionsAfterScan, _ReactMemoryScan_scanCycle, _ReactMemoryScan_updateElementToComponentInfo, _ReactMemoryScan_getTrackedDOMRefs, _ReactMemoryScan_runGC, _ReactMemoryScan_scanEventListenerLeaks;
319
+ var _ReactMemoryScan_instances, _ReactMemoryScan_elementWeakRefs, _ReactMemoryScan_isActivated, _ReactMemoryScan_intervalId, _ReactMemoryScan_elementToBoundingRects, _ReactMemoryScan_elementToComponentStack, _ReactMemoryScan_knownFiberNodes, _ReactMemoryScan_fiberAnalyzer, _ReactMemoryScan_isDevMode, _ReactMemoryScan_subscribers, _ReactMemoryScan_extensions, _ReactMemoryScan_scanIntervalMs, _ReactMemoryScan_domObserver, _ReactMemoryScan_eventListenerTracker, _ReactMemoryScan_isDisposed, _ReactMemoryScan_log, _ReactMemoryScan_notifySubscribers, _ReactMemoryScan_notifyExtensionsBeforeScan, _ReactMemoryScan_notifyExtensionsAfterScan, _ReactMemoryScan_scanCycle, _ReactMemoryScan_updateElementToComponentInfo, _ReactMemoryScan_getTrackedDOMRefs, _ReactMemoryScan_runGC, _ReactMemoryScan_scanEventListenerLeaks;
304
320
  Object.defineProperty(exports, "__esModule", ({ value: true }));
305
321
  const utils = __importStar(__webpack_require__(476));
306
322
  const react_fiber_analysis_1 = __importDefault(__webpack_require__(302));
@@ -325,6 +341,7 @@ class ReactMemoryScan {
325
341
  _ReactMemoryScan_scanIntervalMs.set(this, void 0);
326
342
  _ReactMemoryScan_domObserver.set(this, void 0);
327
343
  _ReactMemoryScan_eventListenerTracker.set(this, void 0);
344
+ _ReactMemoryScan_isDisposed.set(this, void 0);
328
345
  __classPrivateFieldSet(this, _ReactMemoryScan_elementWeakRefs, [], "f");
329
346
  __classPrivateFieldSet(this, _ReactMemoryScan_isActivated, false, "f");
330
347
  __classPrivateFieldSet(this, _ReactMemoryScan_elementToBoundingRects, new WeakMap(), "f");
@@ -333,8 +350,9 @@ class ReactMemoryScan {
333
350
  __classPrivateFieldSet(this, _ReactMemoryScan_eventListenerTracker, options.trackEventListenerLeaks
334
351
  ? event_listener_tracker_1.EventListenerTracker.getInstance()
335
352
  : null, "f");
353
+ __classPrivateFieldSet(this, _ReactMemoryScan_intervalId, null, "f");
354
+ __classPrivateFieldSet(this, _ReactMemoryScan_isDisposed, false, "f");
336
355
  __classPrivateFieldSet(this, _ReactMemoryScan_fiberAnalyzer, new react_fiber_analysis_1.default(), "f");
337
- __classPrivateFieldSet(this, _ReactMemoryScan_intervalId, 0, "f");
338
356
  __classPrivateFieldSet(this, _ReactMemoryScan_isDevMode, (_a = options.isDevMode) !== null && _a !== void 0 ? _a : false, "f");
339
357
  __classPrivateFieldSet(this, _ReactMemoryScan_subscribers, (_b = options.subscribers) !== null && _b !== void 0 ? _b : [], "f");
340
358
  __classPrivateFieldSet(this, _ReactMemoryScan_extensions, (_c = options.extensions) !== null && _c !== void 0 ? _c : [], "f");
@@ -355,6 +373,10 @@ class ReactMemoryScan {
355
373
  __classPrivateFieldSet(this, _ReactMemoryScan_extensions, __classPrivateFieldGet(this, _ReactMemoryScan_extensions, "f").filter(e => e !== extension), "f");
356
374
  }
357
375
  start() {
376
+ if (__classPrivateFieldGet(this, _ReactMemoryScan_isDisposed, "f")) {
377
+ console.warn('[Memory] ReactMemoryScan has been disposed and cannot be started again');
378
+ return;
379
+ }
358
380
  __classPrivateFieldSet(this, _ReactMemoryScan_isActivated, true, "f");
359
381
  __classPrivateFieldSet(this, _ReactMemoryScan_intervalId, setInterval(__classPrivateFieldGet(this, _ReactMemoryScan_instances, "m", _ReactMemoryScan_scanCycle).bind(this), __classPrivateFieldGet(this, _ReactMemoryScan_scanIntervalMs, "f")), "f");
360
382
  if (config_1.config.features.enableMutationObserver) {
@@ -373,11 +395,45 @@ class ReactMemoryScan {
373
395
  __classPrivateFieldSet(this, _ReactMemoryScan_isActivated, false, "f");
374
396
  }
375
397
  stop() {
376
- var _a;
377
398
  __classPrivateFieldSet(this, _ReactMemoryScan_isActivated, false, "f");
378
- clearInterval(__classPrivateFieldGet(this, _ReactMemoryScan_intervalId, "f"));
399
+ // Clear the interval
400
+ if (__classPrivateFieldGet(this, _ReactMemoryScan_intervalId, "f") !== null) {
401
+ clearInterval(__classPrivateFieldGet(this, _ReactMemoryScan_intervalId, "f"));
402
+ __classPrivateFieldSet(this, _ReactMemoryScan_intervalId, null, "f");
403
+ }
404
+ // Clear element references to allow garbage collection
379
405
  __classPrivateFieldSet(this, _ReactMemoryScan_elementWeakRefs, [], "f");
380
- (_a = __classPrivateFieldGet(this, _ReactMemoryScan_domObserver, "f")) === null || _a === void 0 ? void 0 : _a.stopMonitoring();
406
+ __classPrivateFieldSet(this, _ReactMemoryScan_knownFiberNodes, [], "f");
407
+ // Stop DOM observer
408
+ if (__classPrivateFieldGet(this, _ReactMemoryScan_domObserver, "f")) {
409
+ __classPrivateFieldGet(this, _ReactMemoryScan_domObserver, "f").stopMonitoring();
410
+ __classPrivateFieldSet(this, _ReactMemoryScan_domObserver, null, "f");
411
+ }
412
+ // Clear WeakMaps to allow garbage collection
413
+ __classPrivateFieldSet(this, _ReactMemoryScan_elementToBoundingRects, new WeakMap(), "f");
414
+ __classPrivateFieldSet(this, _ReactMemoryScan_elementToComponentStack, new WeakMap(), "f");
415
+ console.log('[Memory] ReactMemoryScan stopped');
416
+ }
417
+ dispose() {
418
+ // Stop all monitoring
419
+ this.stop();
420
+ // Clear all subscribers
421
+ __classPrivateFieldSet(this, _ReactMemoryScan_subscribers, [], "f");
422
+ // Clean up all extensions
423
+ for (const extension of __classPrivateFieldGet(this, _ReactMemoryScan_extensions, "f")) {
424
+ if (extension && typeof extension.cleanup === 'function') {
425
+ extension.cleanup();
426
+ }
427
+ }
428
+ __classPrivateFieldSet(this, _ReactMemoryScan_extensions, [], "f");
429
+ // Dispose event listener tracker if it exists
430
+ if (__classPrivateFieldGet(this, _ReactMemoryScan_eventListenerTracker, "f")) {
431
+ __classPrivateFieldGet(this, _ReactMemoryScan_eventListenerTracker, "f").destroy();
432
+ __classPrivateFieldSet(this, _ReactMemoryScan_eventListenerTracker, null, "f");
433
+ }
434
+ // Mark as disposed to prevent reuse
435
+ __classPrivateFieldSet(this, _ReactMemoryScan_isDisposed, true, "f");
436
+ console.log('[Memory] ReactMemoryScan disposed');
381
437
  }
382
438
  recordBoundingRectangles(elementRefs) {
383
439
  for (const elemRef of elementRefs) {
@@ -507,7 +563,8 @@ class ReactMemoryScan {
507
563
  return scanResult;
508
564
  }
509
565
  }
510
- _ReactMemoryScan_elementWeakRefs = new WeakMap(), _ReactMemoryScan_isActivated = new WeakMap(), _ReactMemoryScan_intervalId = new WeakMap(), _ReactMemoryScan_elementToBoundingRects = new WeakMap(), _ReactMemoryScan_elementToComponentStack = new WeakMap(), _ReactMemoryScan_knownFiberNodes = new WeakMap(), _ReactMemoryScan_fiberAnalyzer = new WeakMap(), _ReactMemoryScan_isDevMode = new WeakMap(), _ReactMemoryScan_subscribers = new WeakMap(), _ReactMemoryScan_extensions = new WeakMap(), _ReactMemoryScan_scanIntervalMs = new WeakMap(), _ReactMemoryScan_domObserver = new WeakMap(), _ReactMemoryScan_eventListenerTracker = new WeakMap(), _ReactMemoryScan_instances = new WeakSet(), _ReactMemoryScan_log = function _ReactMemoryScan_log(...args) {
566
+ exports["default"] = ReactMemoryScan;
567
+ _ReactMemoryScan_elementWeakRefs = new WeakMap(), _ReactMemoryScan_isActivated = new WeakMap(), _ReactMemoryScan_intervalId = new WeakMap(), _ReactMemoryScan_elementToBoundingRects = new WeakMap(), _ReactMemoryScan_elementToComponentStack = new WeakMap(), _ReactMemoryScan_knownFiberNodes = new WeakMap(), _ReactMemoryScan_fiberAnalyzer = new WeakMap(), _ReactMemoryScan_isDevMode = new WeakMap(), _ReactMemoryScan_subscribers = new WeakMap(), _ReactMemoryScan_extensions = new WeakMap(), _ReactMemoryScan_scanIntervalMs = new WeakMap(), _ReactMemoryScan_domObserver = new WeakMap(), _ReactMemoryScan_eventListenerTracker = new WeakMap(), _ReactMemoryScan_isDisposed = new WeakMap(), _ReactMemoryScan_instances = new WeakSet(), _ReactMemoryScan_log = function _ReactMemoryScan_log(...args) {
511
568
  if (__classPrivateFieldGet(this, _ReactMemoryScan_isDevMode, "f") && config_1.config.features.enableConsoleLogs) {
512
569
  utils.consoleLog(...args);
513
570
  }
@@ -587,7 +644,6 @@ _ReactMemoryScan_elementWeakRefs = new WeakMap(), _ReactMemoryScan_isActivated =
587
644
  return eventListenerLeaks;
588
645
  };
589
646
  ReactMemoryScan.nextElementId = 0;
590
- exports["default"] = ReactMemoryScan;
591
647
  class LeakedFiber {
592
648
  constructor(fiber) {
593
649
  this.leakedFiber = fiber;
@@ -617,23 +673,13 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
617
673
  }) : function(o, v) {
618
674
  o["default"] = v;
619
675
  });
620
- var __importStar = (this && this.__importStar) || (function () {
621
- var ownKeys = function(o) {
622
- ownKeys = Object.getOwnPropertyNames || function (o) {
623
- var ar = [];
624
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
625
- return ar;
626
- };
627
- return ownKeys(o);
628
- };
629
- return function (mod) {
630
- if (mod && mod.__esModule) return mod;
631
- var result = {};
632
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
633
- __setModuleDefault(result, mod);
634
- return result;
635
- };
636
- })();
676
+ var __importStar = (this && this.__importStar) || function (mod) {
677
+ if (mod && mod.__esModule) return mod;
678
+ var result = {};
679
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
680
+ __setModuleDefault(result, mod);
681
+ return result;
682
+ };
637
683
  Object.defineProperty(exports, "__esModule", ({ value: true }));
638
684
  /**
639
685
  * Copyright (c) Meta Platforms, Inc. and affiliates.
@@ -752,17 +798,7 @@ exports["default"] = ReactFiberAnalyzer;
752
798
  */
753
799
  var _a, _b, _c;
754
800
  Object.defineProperty(exports, "__esModule", ({ value: true }));
755
- exports.WeakMapPlus = exports.WeakMapNoOp = exports.WeakSetNoOp = exports.WeakRefNoOp = void 0;
756
- exports.getNativeWeakMap = getNativeWeakMap;
757
- exports.getNativeWeakMapOrFallback = getNativeWeakMapOrFallback;
758
- exports.getNativeWeakSet = getNativeWeakSet;
759
- exports.getNativeWeakSetOrFallback = getNativeWeakSetOrFallback;
760
- exports.getNativeWeakRef = getNativeWeakRef;
761
- exports.getNativeWeakRefOrFallback = getNativeWeakRefOrFallback;
762
- exports.isWeakMapNative = isWeakMapNative;
763
- exports.isWeakSetNative = isWeakSetNative;
764
- exports.isWeakRefNative = isWeakRefNative;
765
- exports.isWeakAPINative = isWeakAPINative;
801
+ exports.WeakMapPlus = exports.isWeakAPINative = exports.isWeakRefNative = exports.isWeakSetNative = exports.isWeakMapNative = exports.getNativeWeakRefOrFallback = exports.getNativeWeakRef = exports.getNativeWeakSetOrFallback = exports.getNativeWeakSet = exports.getNativeWeakMapOrFallback = exports.getNativeWeakMap = exports.WeakMapNoOp = exports.WeakSetNoOp = exports.WeakRefNoOp = void 0;
766
802
  const globalScope = typeof window !== 'undefined' ? window : self;
767
803
  const _weakMap = (_a = globalScope.WeakMap) !== null && _a !== void 0 ? _a : null;
768
804
  const _weakMapIsNative = isWeakMapNative();
@@ -826,21 +862,27 @@ exports.WeakMapNoOp = WeakMapNoOp;
826
862
  function getNativeWeakMap() {
827
863
  return _weakMapIsNative ? _weakMap : null;
828
864
  }
865
+ exports.getNativeWeakMap = getNativeWeakMap;
829
866
  function getNativeWeakMapOrFallback() {
830
867
  return _weakMapIsNative && _weakMap ? _weakMap : WeakMapNoOp;
831
868
  }
869
+ exports.getNativeWeakMapOrFallback = getNativeWeakMapOrFallback;
832
870
  function getNativeWeakSet() {
833
871
  return _weakSetIsNative ? _weakSet : null;
834
872
  }
873
+ exports.getNativeWeakSet = getNativeWeakSet;
835
874
  function getNativeWeakSetOrFallback() {
836
875
  return _weakSetIsNative && _weakSet ? _weakSet : WeakSetNoOp;
837
876
  }
877
+ exports.getNativeWeakSetOrFallback = getNativeWeakSetOrFallback;
838
878
  function getNativeWeakRef() {
839
879
  return _weakRefIsNative ? _weakRef : null;
840
880
  }
881
+ exports.getNativeWeakRef = getNativeWeakRef;
841
882
  function getNativeWeakRefOrFallback() {
842
883
  return _weakRefIsNative && _weakRef ? _weakRef : WeakRefNoOp;
843
884
  }
885
+ exports.getNativeWeakRefOrFallback = getNativeWeakRefOrFallback;
844
886
  function normalize(input) {
845
887
  return typeof input.replace === 'function'
846
888
  ? input.replace(/\n/g, ' ').replace(/\s+/g, ' ')
@@ -851,19 +893,23 @@ function isWeakMapNative() {
851
893
  typeof _weakMap.toString === 'function' &&
852
894
  normalize(_weakMap.toString()) === 'function WeakMap() { [native code] }');
853
895
  }
896
+ exports.isWeakMapNative = isWeakMapNative;
854
897
  function isWeakSetNative() {
855
898
  return (_weakSet !== null &&
856
899
  typeof _weakSet.toString === 'function' &&
857
900
  normalize(_weakSet.toString()) === 'function WeakSet() { [native code] }');
858
901
  }
902
+ exports.isWeakSetNative = isWeakSetNative;
859
903
  function isWeakRefNative() {
860
904
  return (_weakRef !== null &&
861
905
  typeof _weakRef.toString === 'function' &&
862
906
  normalize(_weakRef.toString()) === 'function WeakRef() { [native code] }');
863
907
  }
908
+ exports.isWeakRefNative = isWeakRefNative;
864
909
  function isWeakAPINative() {
865
910
  return _weakAPIsAreNative;
866
911
  }
912
+ exports.isWeakAPINative = isWeakAPINative;
867
913
  class WeakMapPlus {
868
914
  constructor(options = {}) {
869
915
  this.strongMap = null;
@@ -1057,16 +1103,7 @@ exports.config = {
1057
1103
 
1058
1104
 
1059
1105
  Object.defineProperty(exports, "__esModule", ({ value: true }));
1060
- exports.getDOMElements = getDOMElements;
1061
- exports.getDOMElementCount = getDOMElementCount;
1062
- exports.getMeaningfulName = getMeaningfulName;
1063
- exports.isMinifiedName = isMinifiedName;
1064
- exports.addCountbyKey = addCountbyKey;
1065
- exports.updateWeakRefList = updateWeakRefList;
1066
- exports.getBoundingClientRect = getBoundingClientRect;
1067
- exports.consoleLog = consoleLog;
1068
- exports.hasRunInSession = hasRunInSession;
1069
- exports.setRunInSession = setRunInSession;
1106
+ exports.setRunInSession = exports.hasRunInSession = exports.consoleLog = exports.getBoundingClientRect = exports.updateWeakRefList = exports.addCountbyKey = exports.isMinifiedName = exports.getMeaningfulName = exports.getDOMElementCount = exports.getDOMElements = void 0;
1070
1107
  const visual_utils_1 = __webpack_require__(498);
1071
1108
  function getDOMElements() {
1072
1109
  const elements = Array.from(document.querySelectorAll('*'));
@@ -1079,6 +1116,7 @@ function getDOMElements() {
1079
1116
  }
1080
1117
  return ret;
1081
1118
  }
1119
+ exports.getDOMElements = getDOMElements;
1082
1120
  function getDOMElementCount() {
1083
1121
  const elements = Array.from(document.querySelectorAll('*'));
1084
1122
  let ret = 0;
@@ -1090,6 +1128,7 @@ function getDOMElementCount() {
1090
1128
  }
1091
1129
  return ret;
1092
1130
  }
1131
+ exports.getDOMElementCount = getDOMElementCount;
1093
1132
  function getMeaningfulName(name) {
1094
1133
  if (name == null) {
1095
1134
  return null;
@@ -1097,6 +1136,7 @@ function getMeaningfulName(name) {
1097
1136
  const isMinified = isMinifiedName(name);
1098
1137
  return isMinified ? null : name;
1099
1138
  }
1139
+ exports.getMeaningfulName = getMeaningfulName;
1100
1140
  /**
1101
1141
  * Determines if a given function or class name is minified.
1102
1142
  *
@@ -1119,10 +1159,12 @@ function isMinifiedName(name) {
1119
1159
  const hasMeaningfulPattern = /^[A-Z][a-z]+([A-Z][a-z]*)*$|^[a-z]+([A-Z][a-z]*)*$/.test(name);
1120
1160
  return !hasMeaningfulPattern;
1121
1161
  }
1162
+ exports.isMinifiedName = isMinifiedName;
1122
1163
  function addCountbyKey(map, key, count) {
1123
1164
  var _a;
1124
1165
  map.set(key, ((_a = map.get(key)) !== null && _a !== void 0 ? _a : 0) + count);
1125
1166
  }
1167
+ exports.addCountbyKey = addCountbyKey;
1126
1168
  function updateWeakRefList(weakRefList, elementRefs) {
1127
1169
  consolidateWeakRefList(weakRefList);
1128
1170
  const set = getElementsSet(weakRefList);
@@ -1136,6 +1178,7 @@ function updateWeakRefList(weakRefList, elementRefs) {
1136
1178
  }
1137
1179
  return weakRefList;
1138
1180
  }
1181
+ exports.updateWeakRefList = updateWeakRefList;
1139
1182
  function getElementsSet(weakRefList) {
1140
1183
  const set = new Set();
1141
1184
  for (const weakRef of weakRefList) {
@@ -1192,11 +1235,13 @@ function getBoundingClientRect(element) {
1192
1235
  ret.scrollTop = scrollTop;
1193
1236
  return ret;
1194
1237
  }
1238
+ exports.getBoundingClientRect = getBoundingClientRect;
1195
1239
  const _console = console;
1196
1240
  const _consoleLog = _console.log;
1197
1241
  function consoleLog(...args) {
1198
1242
  _consoleLog.apply(_console, args);
1199
1243
  }
1244
+ exports.consoleLog = consoleLog;
1200
1245
  const SESSION_STORAGE_KEY = 'memory_lens_session';
1201
1246
  function isSessionStorageAvailable() {
1202
1247
  try {
@@ -1220,6 +1265,7 @@ function hasRunInSession() {
1220
1265
  return false;
1221
1266
  }
1222
1267
  }
1268
+ exports.hasRunInSession = hasRunInSession;
1223
1269
  function setRunInSession() {
1224
1270
  if (!isSessionStorageAvailable()) {
1225
1271
  return;
@@ -1231,6 +1277,7 @@ function setRunInSession() {
1231
1277
  // do nothing
1232
1278
  }
1233
1279
  }
1280
+ exports.setRunInSession = setRunInSession;
1234
1281
 
1235
1282
 
1236
1283
  /***/ }),
@@ -1240,12 +1287,7 @@ function setRunInSession() {
1240
1287
 
1241
1288
 
1242
1289
  Object.defineProperty(exports, "__esModule", ({ value: true }));
1243
- exports.isVisualizerElement = isVisualizerElement;
1244
- exports.createVisualizerElement = createVisualizerElement;
1245
- exports.tryToAttachOverlay = tryToAttachOverlay;
1246
- exports.addTrackedListener = addTrackedListener;
1247
- exports.removeAllListeners = removeAllListeners;
1248
- exports.debounce = debounce;
1290
+ exports.debounce = exports.removeAllListeners = exports.addTrackedListener = exports.tryToAttachOverlay = exports.createVisualizerElement = exports.isVisualizerElement = void 0;
1249
1291
  const VISUALIZER_DATA_ATTR = 'data-visualizer';
1250
1292
  function setVisualizerElement(element) {
1251
1293
  element.setAttribute(VISUALIZER_DATA_ATTR, 'true');
@@ -1254,16 +1296,19 @@ function setVisualizerElement(element) {
1254
1296
  function isVisualizerElement(element) {
1255
1297
  return element.getAttribute(VISUALIZER_DATA_ATTR) === 'true';
1256
1298
  }
1299
+ exports.isVisualizerElement = isVisualizerElement;
1257
1300
  function createVisualizerElement(tag) {
1258
1301
  const element = document.createElement(tag);
1259
1302
  setVisualizerElement(element);
1260
1303
  return element;
1261
1304
  }
1305
+ exports.createVisualizerElement = createVisualizerElement;
1262
1306
  function tryToAttachOverlay(overlayDiv) {
1263
1307
  if (document.body) {
1264
1308
  document.body.appendChild(overlayDiv);
1265
1309
  }
1266
1310
  }
1311
+ exports.tryToAttachOverlay = tryToAttachOverlay;
1267
1312
  const listenerMap = new WeakMap();
1268
1313
  function addTrackedListener(elRef, type, cb, options) {
1269
1314
  var _a;
@@ -1276,6 +1321,7 @@ function addTrackedListener(elRef, type, cb, options) {
1276
1321
  }
1277
1322
  (_a = listenerMap.get(el)) === null || _a === void 0 ? void 0 : _a.push({ type, cb, options });
1278
1323
  }
1324
+ exports.addTrackedListener = addTrackedListener;
1279
1325
  function removeAllListeners(elRef) {
1280
1326
  const el = elRef.deref();
1281
1327
  if (!el)
@@ -1288,6 +1334,7 @@ function removeAllListeners(elRef) {
1288
1334
  }
1289
1335
  listenerMap.delete(el);
1290
1336
  }
1337
+ exports.removeAllListeners = removeAllListeners;
1291
1338
  function debounce(callback, delay) {
1292
1339
  let timer = null;
1293
1340
  return (...args) => {
@@ -1299,6 +1346,7 @@ function debounce(callback, delay) {
1299
1346
  }, delay);
1300
1347
  };
1301
1348
  }
1349
+ exports.debounce = debounce;
1302
1350
 
1303
1351
 
1304
1352
  /***/ }),
@@ -1308,12 +1356,7 @@ function debounce(callback, delay) {
1308
1356
 
1309
1357
 
1310
1358
  Object.defineProperty(exports, "__esModule", ({ value: true }));
1311
- exports.traverseFiber = exports.getTopMostFiberWithChild = exports.getTopMostHostFiber = exports.getNearestHostFiber = exports.isHostFiber = exports.MutationMask = exports.Visibility = exports.Snapshot = exports.Ref = exports.ContentReset = exports.ChildDeletion = exports.Cloned = exports.Update = exports.Hydrating = exports.DidCapture = exports.Placement = exports.PerformedWork = exports.DEPRECATED_ASYNC_MODE_SYMBOL_STRING = exports.CONCURRENT_MODE_SYMBOL_STRING = exports.CONCURRENT_MODE_NUMBER = exports.HostRoot = exports.OffscreenComponent = exports.LegacyHiddenComponent = exports.Fragment = exports.HostText = exports.DehydratedSuspenseComponent = exports.HostSingletonTag = exports.HostHoistableTag = exports.HostComponentTag = exports.SimpleMemoComponentTag = exports.MemoComponentTag = exports.ForwardRefTag = exports.OffscreenComponentTag = exports.SuspenseComponentTag = exports.ContextConsumerTag = exports.FunctionComponentTag = exports.ClassComponentTag = void 0;
1312
- exports.getFiberNodeFromElement = getFiberNodeFromElement;
1313
- exports.getReactComponentStack = getReactComponentStack;
1314
- exports.getDisplayNameOfFiberNode = getDisplayNameOfFiberNode;
1315
- exports.isFunctionalComponent = isFunctionalComponent;
1316
- exports.extractReactComponentName = extractReactComponentName;
1359
+ exports.extractReactComponentName = exports.isFunctionalComponent = exports.getDisplayNameOfFiberNode = exports.getReactComponentStack = exports.getFiberNodeFromElement = exports.traverseFiber = exports.getTopMostFiberWithChild = exports.getTopMostHostFiber = exports.getNearestHostFiber = exports.isHostFiber = exports.MutationMask = exports.Visibility = exports.Snapshot = exports.Ref = exports.ContentReset = exports.ChildDeletion = exports.Cloned = exports.Update = exports.Hydrating = exports.DidCapture = exports.Placement = exports.PerformedWork = exports.DEPRECATED_ASYNC_MODE_SYMBOL_STRING = exports.CONCURRENT_MODE_SYMBOL_STRING = exports.CONCURRENT_MODE_NUMBER = exports.HostRoot = exports.OffscreenComponent = exports.LegacyHiddenComponent = exports.Fragment = exports.HostText = exports.DehydratedSuspenseComponent = exports.HostSingletonTag = exports.HostHoistableTag = exports.HostComponentTag = exports.SimpleMemoComponentTag = exports.MemoComponentTag = exports.ForwardRefTag = exports.OffscreenComponentTag = exports.SuspenseComponentTag = exports.ContextConsumerTag = exports.FunctionComponentTag = exports.ClassComponentTag = void 0;
1317
1360
  const utils_1 = __webpack_require__(476);
1318
1361
  const valid_component_name_1 = __webpack_require__(847);
1319
1362
  exports.ClassComponentTag = 1;
@@ -1415,8 +1458,8 @@ const traverseFiber = (fiber, selector, ascending = false) => {
1415
1458
  exports.traverseFiber = traverseFiber;
1416
1459
  // React internal property keys
1417
1460
  const internalKeys = [
1418
- '__reactFiber$', // React 17+
1419
- '__reactInternalInstance$', // React 16
1461
+ '__reactFiber$',
1462
+ '__reactInternalInstance$',
1420
1463
  '_reactRootContainer', // React Root
1421
1464
  ];
1422
1465
  const getOwnPropertyNames = Object.getOwnPropertyNames.bind(Object);
@@ -1430,6 +1473,7 @@ function getFiberNodeFromElement(element) {
1430
1473
  }
1431
1474
  return null;
1432
1475
  }
1476
+ exports.getFiberNodeFromElement = getFiberNodeFromElement;
1433
1477
  function getReactComponentStack(node) {
1434
1478
  const stack = [];
1435
1479
  const visited = new Set();
@@ -1447,6 +1491,7 @@ function getReactComponentStack(node) {
1447
1491
  }
1448
1492
  return stack;
1449
1493
  }
1494
+ exports.getReactComponentStack = getReactComponentStack;
1450
1495
  function getDisplayNameOfFiberNode(node) {
1451
1496
  var _a, _b, _c, _d;
1452
1497
  const elementType = (_a = node.type) !== null && _a !== void 0 ? _a : node.elementType;
@@ -1471,10 +1516,12 @@ function getDisplayNameOfFiberNode(node) {
1471
1516
  const ret = (0, utils_1.getMeaningfulName)(extractReactComponentName(displayName));
1472
1517
  return (0, valid_component_name_1.isValidComponentName)(ret) ? ret : null;
1473
1518
  }
1519
+ exports.getDisplayNameOfFiberNode = getDisplayNameOfFiberNode;
1474
1520
  function isFunctionalComponent(node) {
1475
1521
  const elementType = node === null || node === void 0 ? void 0 : node.elementType;
1476
1522
  return typeof elementType === 'function';
1477
1523
  }
1524
+ exports.isFunctionalComponent = isFunctionalComponent;
1478
1525
  // dom-element [from component.react] --> component.react
1479
1526
  function extractReactComponentName(displayName) {
1480
1527
  if (typeof displayName !== 'string') {
@@ -1494,6 +1541,7 @@ function extractReactComponentName(displayName) {
1494
1541
  }
1495
1542
  return name;
1496
1543
  }
1544
+ exports.extractReactComponentName = extractReactComponentName;
1497
1545
 
1498
1546
 
1499
1547
  /***/ }),
@@ -1512,11 +1560,12 @@ function extractReactComponentName(displayName) {
1512
1560
  * @oncall memory_lab
1513
1561
  */
1514
1562
  Object.defineProperty(exports, "__esModule", ({ value: true }));
1515
- exports.isValidComponentName = isValidComponentName;
1563
+ exports.isValidComponentName = void 0;
1516
1564
  const displayNameBlockList = new Set();
1517
1565
  function isValidComponentName(name) {
1518
1566
  return name != null && !displayNameBlockList.has(name);
1519
1567
  }
1568
+ exports.isValidComponentName = isValidComponentName;
1520
1569
 
1521
1570
 
1522
1571
  /***/ }),