@memlab/lens 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.
- package/README.md +63 -0
- package/dist/index.js +112 -0
- package/explainer.md +54 -0
- package/package.json +34 -0
- package/playwright.config.ts +21 -0
- package/src/config/config.ts +32 -0
- package/src/core/dom-observer.ts +189 -0
- package/src/core/event-listener-tracker.ts +171 -0
- package/src/core/react-fiber-analysis.ts +123 -0
- package/src/core/react-memory-scan.ts +366 -0
- package/src/core/types.ts +180 -0
- package/src/core/valid-component-name.ts +17 -0
- package/src/extensions/basic-extension.ts +41 -0
- package/src/extensions/dom-visualization-extension.ts +42 -0
- package/src/index.ts +16 -0
- package/src/memlens.lib.js.flow +75 -0
- package/src/memlens.lib.ts +22 -0
- package/src/memlens.run.ts +21 -0
- package/src/tests/bundle/lib.bundle.test.ts +31 -0
- package/src/tests/bundle/run.bundle.start.head.test.ts +48 -0
- package/src/tests/bundle/run.bundle.start.test.ts +48 -0
- package/src/tests/bundle/run.bundle.test.ts +51 -0
- package/src/tests/fiber/dev.fiber.complex.dev.test.ts +92 -0
- package/src/tests/fiber/dev.fiber.complex.list.dev.test.ts +118 -0
- package/src/tests/fiber/dev.fiber.complex.prod.test.ts +92 -0
- package/src/tests/fiber/dev.fiber.name.dev.test.ts +77 -0
- package/src/tests/fiber/dev.fiber.name.prod.test.ts +79 -0
- package/src/tests/lib/babel.prod.js +4 -0
- package/src/tests/lib/react-dom-v18.dev.js +29926 -0
- package/src/tests/lib/react-dom-v18.prod.js +269 -0
- package/src/tests/lib/react-v18.dev.js +3345 -0
- package/src/tests/lib/react-v18.prod.js +33 -0
- package/src/tests/manual/playwright-open-manual.js +40 -0
- package/src/tests/manual/todo-list/todo-with-run.bundle.html +80 -0
- package/src/tests/utils/test-utils.ts +28 -0
- package/src/utils/intersection-observer.ts +65 -0
- package/src/utils/react-fiber-utils.ts +212 -0
- package/src/utils/utils.ts +201 -0
- package/src/utils/weak-ref-utils.ts +308 -0
- package/src/visual/components/component-stack-panel.ts +85 -0
- package/src/visual/components/control-widget.ts +96 -0
- package/src/visual/components/overlay-rectangle.ts +167 -0
- package/src/visual/components/status-text.ts +53 -0
- package/src/visual/components/toggle-button.ts +57 -0
- package/src/visual/components/visual-overlay.ts +19 -0
- package/src/visual/dom-element-visualizer-interactive.ts +358 -0
- package/src/visual/dom-element-visualizer.ts +130 -0
- package/src/visual/visual-utils.ts +89 -0
- package/tsconfig.json +18 -0
- package/webpack.config.js +105 -0
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @format
|
|
8
|
+
* @oncall memory_lab
|
|
9
|
+
*/
|
|
10
|
+
const path = require('path');
|
|
11
|
+
|
|
12
|
+
const createConfig = ({entry, filename, minimize}) => ({
|
|
13
|
+
entry,
|
|
14
|
+
output: {
|
|
15
|
+
filename,
|
|
16
|
+
path: path.resolve(__dirname, 'dist'),
|
|
17
|
+
library: entry.lib
|
|
18
|
+
? {
|
|
19
|
+
name: 'MemLens',
|
|
20
|
+
type: 'umd',
|
|
21
|
+
}
|
|
22
|
+
: undefined,
|
|
23
|
+
},
|
|
24
|
+
resolve: {
|
|
25
|
+
extensions: ['.ts', '.js'],
|
|
26
|
+
},
|
|
27
|
+
module: {
|
|
28
|
+
rules: [
|
|
29
|
+
{
|
|
30
|
+
test: /\.ts$/,
|
|
31
|
+
use: 'ts-loader',
|
|
32
|
+
exclude: /node_modules/,
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
mode: 'production',
|
|
37
|
+
optimization: {
|
|
38
|
+
minimize,
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
const createNodeConfig = ({entry, filename, minimize}) => ({
|
|
43
|
+
entry,
|
|
44
|
+
output: {
|
|
45
|
+
filename,
|
|
46
|
+
path: path.resolve(__dirname, 'dist'),
|
|
47
|
+
library: {
|
|
48
|
+
type: 'commonjs2',
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
target: 'node',
|
|
52
|
+
resolve: {
|
|
53
|
+
extensions: ['.ts', '.js'],
|
|
54
|
+
},
|
|
55
|
+
module: {
|
|
56
|
+
rules: [
|
|
57
|
+
{
|
|
58
|
+
test: /\.ts$/,
|
|
59
|
+
use: 'ts-loader',
|
|
60
|
+
exclude: /node_modules/,
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
},
|
|
64
|
+
mode: 'production',
|
|
65
|
+
optimization: {
|
|
66
|
+
minimize,
|
|
67
|
+
},
|
|
68
|
+
externals: {
|
|
69
|
+
fs: 'commonjs fs',
|
|
70
|
+
path: 'commonjs path',
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
/** Export 4 builds: lib (min/non-min), run (min/non-min) */
|
|
75
|
+
module.exports = [
|
|
76
|
+
createConfig({
|
|
77
|
+
entry: {lib: './src/memlens.lib.ts'},
|
|
78
|
+
filename: 'memlens.lib.bundle.js', // non-minified
|
|
79
|
+
mode: 'production',
|
|
80
|
+
minimize: false,
|
|
81
|
+
}),
|
|
82
|
+
createConfig({
|
|
83
|
+
entry: {lib: './src/memlens.lib.ts'},
|
|
84
|
+
filename: 'memlens.lib.bundle.min.js', // minified
|
|
85
|
+
mode: 'production',
|
|
86
|
+
minimize: true,
|
|
87
|
+
}),
|
|
88
|
+
createConfig({
|
|
89
|
+
entry: {run: './src/memlens.run.ts'},
|
|
90
|
+
filename: 'memlens.run.bundle.js', // non-minified
|
|
91
|
+
mode: 'production',
|
|
92
|
+
minimize: false,
|
|
93
|
+
}),
|
|
94
|
+
createConfig({
|
|
95
|
+
entry: {run: './src/memlens.run.ts'},
|
|
96
|
+
filename: 'memlens.run.bundle.min.js', // minified
|
|
97
|
+
mode: 'production',
|
|
98
|
+
minimize: true,
|
|
99
|
+
}),
|
|
100
|
+
createNodeConfig({
|
|
101
|
+
entry: {index: './src/index.ts'},
|
|
102
|
+
filename: 'index.js',
|
|
103
|
+
minimize: false,
|
|
104
|
+
}),
|
|
105
|
+
];
|