@oxog/reactscope 1.0.0 → 1.1.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 +47 -15
- package/dist/{chunk-IFCS6ABF.cjs → chunk-33CBEAOF.cjs} +106 -32
- package/dist/chunk-33CBEAOF.cjs.map +1 -0
- package/dist/{chunk-JESQX3XO.js → chunk-3Q6YBIBW.js} +28 -2
- package/dist/chunk-3Q6YBIBW.js.map +1 -0
- package/dist/{chunk-6L3WUS6V.cjs → chunk-6ALDCO2Q.cjs} +28 -2
- package/dist/chunk-6ALDCO2Q.cjs.map +1 -0
- package/dist/{chunk-4TZAECHG.cjs → chunk-7MVKPUC4.cjs} +5 -21
- package/dist/chunk-7MVKPUC4.cjs.map +1 -0
- package/dist/chunk-ACLEEAEC.cjs +83 -0
- package/dist/chunk-ACLEEAEC.cjs.map +1 -0
- package/dist/{chunk-LZO35OCP.js → chunk-AZ6OARKV.js} +2 -2
- package/dist/{chunk-LZO35OCP.js.map → chunk-AZ6OARKV.js.map} +1 -1
- package/dist/{chunk-KCUWALXE.cjs → chunk-C3IBGU7L.cjs} +5 -2
- package/dist/chunk-C3IBGU7L.cjs.map +1 -0
- package/dist/{chunk-M65L55OT.js → chunk-C4LJVRF5.js} +11 -8
- package/dist/chunk-C4LJVRF5.js.map +1 -0
- package/dist/{chunk-MPOQNCGP.js → chunk-E4PZKXY7.js} +5 -21
- package/dist/chunk-E4PZKXY7.js.map +1 -0
- package/dist/chunk-E7W2FVWO.js +78 -0
- package/dist/chunk-E7W2FVWO.js.map +1 -0
- package/dist/{chunk-H4W4UBLZ.cjs → chunk-EUYOAT56.cjs} +11 -8
- package/dist/chunk-EUYOAT56.cjs.map +1 -0
- package/dist/{chunk-RYAIO3BO.js → chunk-F3KDHISM.js} +5 -4
- package/dist/chunk-F3KDHISM.js.map +1 -0
- package/dist/{chunk-I427KZYN.cjs → chunk-KRRXA4SI.cjs} +2 -2
- package/dist/{chunk-I427KZYN.cjs.map → chunk-KRRXA4SI.cjs.map} +1 -1
- package/dist/{chunk-U2OPUU5R.js → chunk-MBFJ6ULY.js} +40 -18
- package/dist/chunk-MBFJ6ULY.js.map +1 -0
- package/dist/chunk-OMETOKM7.cjs +86 -0
- package/dist/chunk-OMETOKM7.cjs.map +1 -0
- package/dist/chunk-QT2GSPHP.js +21 -0
- package/dist/chunk-QT2GSPHP.js.map +1 -0
- package/dist/{chunk-OJGWFS55.cjs → chunk-U3TL6KFZ.cjs} +41 -19
- package/dist/chunk-U3TL6KFZ.cjs.map +1 -0
- package/dist/chunk-UQFSIGZW.cjs +24 -0
- package/dist/chunk-UQFSIGZW.cjs.map +1 -0
- package/dist/{chunk-6LHJL6MV.js → chunk-W7SGZQRF.js} +106 -32
- package/dist/chunk-W7SGZQRF.js.map +1 -0
- package/dist/{chunk-ZTO5ZZVE.js → chunk-XWZXCGPY.js} +5 -2
- package/dist/chunk-XWZXCGPY.js.map +1 -0
- package/dist/chunk-YG5FHHRH.js +80 -0
- package/dist/chunk-YG5FHHRH.js.map +1 -0
- package/dist/{chunk-QYMRRTSN.cjs → chunk-YL2LJ27D.cjs} +6 -5
- package/dist/chunk-YL2LJ27D.cjs.map +1 -0
- package/dist/index.cjs +428 -369
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +33 -7
- package/dist/index.d.ts +33 -7
- package/dist/index.js +403 -343
- package/dist/index.js.map +1 -1
- package/dist/plugins/console-reporter/index.d.cts +1 -1
- package/dist/plugins/console-reporter/index.d.ts +1 -1
- package/dist/plugins/dashboard-ui/index.cjs +4 -3
- package/dist/plugins/dashboard-ui/index.d.cts +5 -1
- package/dist/plugins/dashboard-ui/index.d.ts +5 -1
- package/dist/plugins/dashboard-ui/index.js +2 -1
- package/dist/plugins/json-exporter/index.cjs +5 -3
- package/dist/plugins/json-exporter/index.d.cts +1 -1
- package/dist/plugins/json-exporter/index.d.ts +1 -1
- package/dist/plugins/json-exporter/index.js +3 -1
- package/dist/plugins/lifecycle-tracker/index.cjs +4 -3
- package/dist/plugins/lifecycle-tracker/index.d.cts +8 -1
- package/dist/plugins/lifecycle-tracker/index.d.ts +8 -1
- package/dist/plugins/lifecycle-tracker/index.js +2 -1
- package/dist/plugins/memory-tracker/index.d.cts +1 -1
- package/dist/plugins/memory-tracker/index.d.ts +1 -1
- package/dist/plugins/network-correlator/index.cjs +4 -4
- package/dist/plugins/network-correlator/index.d.cts +5 -1
- package/dist/plugins/network-correlator/index.d.ts +5 -1
- package/dist/plugins/network-correlator/index.js +2 -2
- package/dist/plugins/props-differ/index.cjs +4 -3
- package/dist/plugins/props-differ/index.d.cts +1 -1
- package/dist/plugins/props-differ/index.d.ts +1 -1
- package/dist/plugins/props-differ/index.js +2 -1
- package/dist/plugins/render-tracker/index.d.cts +1 -1
- package/dist/plugins/render-tracker/index.d.ts +1 -1
- package/dist/plugins/timeline-recorder/index.cjs +5 -4
- package/dist/plugins/timeline-recorder/index.d.cts +1 -1
- package/dist/plugins/timeline-recorder/index.d.ts +1 -1
- package/dist/plugins/timeline-recorder/index.js +3 -2
- package/dist/plugins/wasted-render-detector/index.cjs +4 -3
- package/dist/plugins/wasted-render-detector/index.d.cts +5 -8
- package/dist/plugins/wasted-render-detector/index.d.ts +5 -8
- package/dist/plugins/wasted-render-detector/index.js +2 -1
- package/dist/{types-DKPG_emi.d.ts → types-DNhmA1Tk.d.cts} +22 -1
- package/dist/{types-DKPG_emi.d.cts → types-DNhmA1Tk.d.ts} +22 -1
- package/package.json +20 -9
- package/dist/chunk-4TZAECHG.cjs.map +0 -1
- package/dist/chunk-6L3WUS6V.cjs.map +0 -1
- package/dist/chunk-6LHJL6MV.js.map +0 -1
- package/dist/chunk-H4W4UBLZ.cjs.map +0 -1
- package/dist/chunk-IFCS6ABF.cjs.map +0 -1
- package/dist/chunk-JESQX3XO.js.map +0 -1
- package/dist/chunk-KCUWALXE.cjs.map +0 -1
- package/dist/chunk-M65L55OT.js.map +0 -1
- package/dist/chunk-MPOQNCGP.js.map +0 -1
- package/dist/chunk-OJGWFS55.cjs.map +0 -1
- package/dist/chunk-QYMRRTSN.cjs.map +0 -1
- package/dist/chunk-RYAIO3BO.js.map +0 -1
- package/dist/chunk-U2OPUU5R.js.map +0 -1
- package/dist/chunk-ZTO5ZZVE.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { K as KernelOptions, a as Kernel, R as ReactScopeProviderProps, U as UseScopeOptions, S as ScopeHandle, C as ComponentMetrics, b as ScopeProps, W as WithScopeOptions, T as ThrottleOptions, D as DebounceOptions, P as PluginHooks, c as Plugin, M as MetricsStore } from './types-
|
|
2
|
-
export { I as ComponentSummary, f as ComponentTree, $ as ConsoleReporterOptions, A as Correlation, Y as DashboardOptions, V as DashboardPosition, Z as DashboardState, X as DashboardTheme, E as ErrorEvent, O as EventBus, H as ExportSummary, i as KernelEvent, h as KernelEventType, w as LifecycleEvent, L as LifecycleEventType, _ as LogLevel, x as MemorySnapshot, y as MemoryStats, e as MetricsStoreData, o as MetricsUpdateEvent, k as MountEvent, N as NetworkRequest, Q as PluginRegistry, z as PotentialLeak, s as PropChangeStats, m as PropsChangeEvent, q as PropsDiff, r as PropsSnapshot, j as RenderEvent, d as RenderRecord, B as RequestStats, a2 as ScopeError, J as SerializableMetrics, n as StateChangeEvent, p as TimelineEvent, a1 as TimelineOptions, G as TimelineRecording, F as TimestampedEvent, g as TreeNode, l as UnmountEvent, a0 as Unsubscribe, u as WastedRender, t as WastedRenderReason, v as WastedRenderStats } from './types-
|
|
1
|
+
import { K as KernelOptions, a as Kernel, R as ReactScopeProviderProps, U as UseScopeOptions, S as ScopeHandle, C as ComponentMetrics, b as ScopeProps, W as WithScopeOptions, T as ThrottleOptions, D as DebounceOptions, P as PluginHooks, c as Plugin, M as MetricsStore } from './types-DNhmA1Tk.js';
|
|
2
|
+
export { I as ComponentSummary, f as ComponentTree, $ as ConsoleReporterOptions, A as Correlation, Y as DashboardOptions, V as DashboardPosition, Z as DashboardState, X as DashboardTheme, E as ErrorEvent, O as EventBus, H as ExportSummary, i as KernelEvent, h as KernelEventType, w as LifecycleEvent, L as LifecycleEventType, _ as LogLevel, x as MemorySnapshot, y as MemoryStats, e as MetricsStoreData, o as MetricsUpdateEvent, k as MountEvent, N as NetworkRequest, Q as PluginRegistry, z as PotentialLeak, s as PropChangeStats, m as PropsChangeEvent, q as PropsDiff, r as PropsSnapshot, j as RenderEvent, d as RenderRecord, B as RequestStats, a2 as ScopeError, J as SerializableMetrics, n as StateChangeEvent, p as TimelineEvent, a1 as TimelineOptions, G as TimelineRecording, F as TimestampedEvent, g as TreeNode, l as UnmountEvent, a0 as Unsubscribe, u as WastedRender, t as WastedRenderReason, v as WastedRenderStats } from './types-DNhmA1Tk.js';
|
|
3
3
|
export { RenderTrackerAPI, RenderTrackerPlugin, createRenderTrackerPlugin } from './plugins/render-tracker/index.js';
|
|
4
4
|
export { PropsDifferAPI, PropsDifferPlugin, createPropsDifferPlugin } from './plugins/props-differ/index.js';
|
|
5
5
|
export { WastedRenderDetectorAPI, WastedRenderDetectorPlugin, createWastedRenderDetectorPlugin } from './plugins/wasted-render-detector/index.js';
|
|
@@ -47,7 +47,15 @@ declare function useScopeContextSafe(): Kernel | null;
|
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
49
|
* ReactScopeProvider component.
|
|
50
|
-
*
|
|
50
|
+
* Creates a kernel with the core plugins plus `plugins`, provides it to the tree
|
|
51
|
+
* and makes it the global kernel (`getKernel()`) while mounted.
|
|
52
|
+
*
|
|
53
|
+
* Plugins are installed before the children commit, so no event is missed, and
|
|
54
|
+
* uninstalled when the provider unmounts (removing the dashboard overlay, stopping
|
|
55
|
+
* timers and observers). The `plugins` list is read once, on mount.
|
|
56
|
+
*
|
|
57
|
+
* Rendering on the server has no side effects: the global kernel is only set in
|
|
58
|
+
* the browser, after mount.
|
|
51
59
|
*/
|
|
52
60
|
declare function ReactScopeProvider({ children, enabled, plugins, onReady, options, }: ReactScopeProviderProps): React__default.ReactElement;
|
|
53
61
|
declare namespace ReactScopeProvider {
|
|
@@ -56,18 +64,28 @@ declare namespace ReactScopeProvider {
|
|
|
56
64
|
|
|
57
65
|
/**
|
|
58
66
|
* Hook for profiling a component.
|
|
59
|
-
*
|
|
67
|
+
*
|
|
68
|
+
* Every committed render is reported once (StrictMode double rendering and
|
|
69
|
+
* discarded concurrent renders are not counted). The duration is the time from
|
|
70
|
+
* the hook call to the commit of the component's subtree.
|
|
71
|
+
*
|
|
72
|
+
* The returned handle reads metrics live from the kernel and never re-renders the
|
|
73
|
+
* component by itself: values read during render include all previously
|
|
74
|
+
* committed renders.
|
|
60
75
|
*/
|
|
61
76
|
declare function useScope(name: string, options?: UseScopeOptions): ScopeHandle;
|
|
62
77
|
|
|
63
78
|
/**
|
|
64
79
|
* Hook to read metrics for a specific component.
|
|
65
80
|
* Read-only - no tracking is performed.
|
|
81
|
+
*
|
|
82
|
+
* Re-renders at most every 100 ms while the component's metrics change, so it is
|
|
83
|
+
* safe to use inside the scope it observes.
|
|
66
84
|
*/
|
|
67
85
|
declare function useScopeMetrics(componentId: string): ComponentMetrics | undefined;
|
|
68
86
|
/**
|
|
69
87
|
* Hook to read all metrics.
|
|
70
|
-
* Returns a Map of all component metrics.
|
|
88
|
+
* Returns a Map of all component metrics, refreshed at most every 100 ms.
|
|
71
89
|
*/
|
|
72
90
|
declare function useAllScopeMetrics(): Map<string, ComponentMetrics>;
|
|
73
91
|
/**
|
|
@@ -82,15 +100,23 @@ declare function useScopeSummary(): {
|
|
|
82
100
|
|
|
83
101
|
/**
|
|
84
102
|
* Scope component.
|
|
85
|
-
* Wraps children and
|
|
103
|
+
* Wraps children in a React `<Profiler>` and reports their render timings.
|
|
104
|
+
*
|
|
105
|
+
* Note: React only calls `<Profiler>` callbacks in development and profiling
|
|
106
|
+
* builds, so in a production build `<Scope>` reports mounts/unmounts but no renders.
|
|
86
107
|
*/
|
|
87
|
-
declare function Scope({ children, name, onRender
|
|
108
|
+
declare function Scope({ children, name, onRender }: ScopeProps): React__default.ReactElement;
|
|
88
109
|
declare namespace Scope {
|
|
89
110
|
var displayName: string;
|
|
90
111
|
}
|
|
91
112
|
|
|
92
113
|
/**
|
|
93
114
|
* Higher-order component that adds profiling to a component.
|
|
115
|
+
*
|
|
116
|
+
* Each committed render is reported once. A re-render whose props are all
|
|
117
|
+
* identical (`Object.is`) to the previous render's props is reported to the
|
|
118
|
+
* `wasted-render-detector` plugin: wrapping the component in `React.memo` would
|
|
119
|
+
* have skipped it.
|
|
94
120
|
*/
|
|
95
121
|
declare function withScope<P extends object>(WrappedComponent: React__default.ComponentType<P>, options?: WithScopeOptions): React__default.ComponentType<P>;
|
|
96
122
|
|