react-perfscope 0.4.0 → 0.6.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/dist/auto.cjs CHANGED
@@ -1,9 +1,34 @@
1
1
  "use strict";
2
2
 
3
3
  // src/auto.ts
4
+ var import_core2 = require("@react-perfscope/core");
5
+ var import_react2 = require("@react-perfscope/react");
6
+ var import_ui = require("@react-perfscope/ui");
7
+
8
+ // src/bootstrap.ts
4
9
  var import_core = require("@react-perfscope/core");
5
10
  var import_react = require("@react-perfscope/react");
6
- var import_ui = require("@react-perfscope/ui");
11
+ function createConfiguredRecorder() {
12
+ const recorder = (0, import_core.createRecorder)();
13
+ recorder.use((0, import_core.createForcedReflowCollector)());
14
+ recorder.use((0, import_core.createLongTasksCollector)());
15
+ recorder.use((0, import_core.createLayoutShiftCollector)());
16
+ recorder.use((0, import_core.createNetworkCollector)());
17
+ recorder.use((0, import_core.createWebVitalsCollector)());
18
+ recorder.use((0, import_react.createRenderCollector)());
19
+ const selfProfiler = (0, import_core.createSelfProfilingCollector)();
20
+ recorder.use(selfProfiler);
21
+ const heap = (0, import_core.createHeapCollector)();
22
+ recorder.use(heap);
23
+ const interaction = (0, import_core.createInteractionCollector)();
24
+ recorder.use(interaction);
25
+ const frame = (0, import_core.createFrameCollector)();
26
+ recorder.use(frame);
27
+ const finalize = (result) => Promise.resolve(interaction.finalize(result)).then((r) => selfProfiler.finalize(r)).then((r) => heap.finalize(r)).then((r) => frame.finalize(r));
28
+ return { recorder, finalize };
29
+ }
30
+
31
+ // src/auto.ts
7
32
  function bootstrap() {
8
33
  if (typeof globalThis === "undefined") return;
9
34
  const g = globalThis;
@@ -12,30 +37,14 @@ function bootstrap() {
12
37
  if (env === "production") return;
13
38
  if (typeof document === "undefined") return;
14
39
  try {
15
- (0, import_react.installDevToolsHook)(() => {
40
+ (0, import_react2.installDevToolsHook)(() => {
16
41
  });
17
- const recorder = (0, import_core.createRecorder)();
18
- recorder.use((0, import_core.createForcedReflowCollector)());
19
- recorder.use((0, import_core.createLongTasksCollector)());
20
- recorder.use((0, import_core.createLayoutShiftCollector)());
21
- recorder.use((0, import_core.createNetworkCollector)());
22
- recorder.use((0, import_core.createWebVitalsCollector)());
23
- recorder.use((0, import_react.createRenderCollector)());
24
- const selfProfiler = (0, import_core.createSelfProfilingCollector)();
25
- recorder.use(selfProfiler);
26
- const heap = (0, import_core.createHeapCollector)();
27
- recorder.use(heap);
28
- const interaction = (0, import_core.createInteractionCollector)();
29
- recorder.use(interaction);
30
- const frame = (0, import_core.createFrameCollector)();
31
- recorder.use(frame);
32
- const resolver = (0, import_core.createSourceMapResolver)();
42
+ const { recorder, finalize } = createConfiguredRecorder();
43
+ const resolver = (0, import_core2.createSourceMapResolver)();
33
44
  (0, import_ui.mount)({
34
45
  recorder,
35
46
  resolveFrame: (f) => resolver.resolve(f),
36
- // Assemble interactions first so self-profiling can attribute their
37
- // processing windows, then attach the heap series and frame timestamps.
38
- finalize: (result) => Promise.resolve(interaction.finalize(result)).then((r) => selfProfiler.finalize(r)).then((r) => heap.finalize(r)).then((r) => frame.finalize(r))
47
+ finalize
39
48
  });
40
49
  g.__REACT_PERFSCOPE_AUTO_MOUNTED__ = true;
41
50
  } catch (err) {
package/dist/auto.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/auto.ts"],"sourcesContent":["import {\n createRecorder,\n createForcedReflowCollector,\n createLongTasksCollector,\n createLayoutShiftCollector,\n createNetworkCollector,\n createWebVitalsCollector,\n createSelfProfilingCollector,\n createHeapCollector,\n createInteractionCollector,\n createFrameCollector,\n createSourceMapResolver,\n} from '@react-perfscope/core'\nimport { createRenderCollector, installDevToolsHook } from '@react-perfscope/react'\nimport { mount } from '@react-perfscope/ui'\n\n/**\n * Side-effect entry. Importing `react-perfscope/auto` bootstraps a Recorder\n * with the render collector and mounts the UI. Idempotent — importing twice\n * is a no-op (the first import wins).\n *\n * Bails when `process.env.NODE_ENV === 'production'` (build plugins also\n * guard against prod, but this is defense-in-depth).\n */\nfunction bootstrap(): void {\n if (typeof globalThis === 'undefined') return\n const g = globalThis as { __REACT_PERFSCOPE_AUTO_MOUNTED__?: boolean }\n if (g.__REACT_PERFSCOPE_AUTO_MOUNTED__) return\n\n const env = (globalThis as { process?: { env?: { NODE_ENV?: string } } }).process?.env?.NODE_ENV\n if (env === 'production') return\n\n if (typeof document === 'undefined') return\n\n try {\n // Install the React DevTools hook SYNCHRONOUSLY before react-dom is\n // evaluated. react-dom captures `__REACT_DEVTOOLS_GLOBAL_HOOK__` exactly\n // once at module-load time, so the hook must exist by the time the user\n // bundle imports react-dom. A no-op listener is enough to register the\n // hook — when the render collector later activates, it adds the real\n // commit handler to the same global hook.\n installDevToolsHook(() => {})\n\n const recorder = createRecorder()\n recorder.use(createForcedReflowCollector())\n recorder.use(createLongTasksCollector())\n recorder.use(createLayoutShiftCollector())\n recorder.use(createNetworkCollector())\n recorder.use(createWebVitalsCollector())\n recorder.use(createRenderCollector())\n const selfProfiler = createSelfProfilingCollector()\n recorder.use(selfProfiler)\n const heap = createHeapCollector()\n recorder.use(heap)\n const interaction = createInteractionCollector()\n recorder.use(interaction)\n const frame = createFrameCollector()\n recorder.use(frame)\n const resolver = createSourceMapResolver()\n mount({\n recorder,\n resolveFrame: (f) => resolver.resolve(f),\n // Assemble interactions first so self-profiling can attribute their\n // processing windows, then attach the heap series and frame timestamps.\n finalize: (result) =>\n Promise.resolve(interaction.finalize(result))\n .then((r) => selfProfiler.finalize(r))\n .then((r) => heap.finalize(r))\n .then((r) => frame.finalize(r)),\n })\n g.__REACT_PERFSCOPE_AUTO_MOUNTED__ = true\n } catch (err) {\n console.warn('[react-perfscope] auto bootstrap failed:', err)\n }\n}\n\nbootstrap()\n"],"mappings":";;;AAAA,kBAYO;AACP,mBAA2D;AAC3D,gBAAsB;AAUtB,SAAS,YAAkB;AACzB,MAAI,OAAO,eAAe,YAAa;AACvC,QAAM,IAAI;AACV,MAAI,EAAE,iCAAkC;AAExC,QAAM,MAAO,WAA6D,SAAS,KAAK;AACxF,MAAI,QAAQ,aAAc;AAE1B,MAAI,OAAO,aAAa,YAAa;AAErC,MAAI;AAOF,0CAAoB,MAAM;AAAA,IAAC,CAAC;AAE5B,UAAM,eAAW,4BAAe;AAChC,aAAS,QAAI,yCAA4B,CAAC;AAC1C,aAAS,QAAI,sCAAyB,CAAC;AACvC,aAAS,QAAI,wCAA2B,CAAC;AACzC,aAAS,QAAI,oCAAuB,CAAC;AACrC,aAAS,QAAI,sCAAyB,CAAC;AACvC,aAAS,QAAI,oCAAsB,CAAC;AACpC,UAAM,mBAAe,0CAA6B;AAClD,aAAS,IAAI,YAAY;AACzB,UAAM,WAAO,iCAAoB;AACjC,aAAS,IAAI,IAAI;AACjB,UAAM,kBAAc,wCAA2B;AAC/C,aAAS,IAAI,WAAW;AACxB,UAAM,YAAQ,kCAAqB;AACnC,aAAS,IAAI,KAAK;AAClB,UAAM,eAAW,qCAAwB;AACzC,yBAAM;AAAA,MACJ;AAAA,MACA,cAAc,CAAC,MAAM,SAAS,QAAQ,CAAC;AAAA;AAAA;AAAA,MAGvC,UAAU,CAAC,WACT,QAAQ,QAAQ,YAAY,SAAS,MAAM,CAAC,EACzC,KAAK,CAAC,MAAM,aAAa,SAAS,CAAC,CAAC,EACpC,KAAK,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,EAC5B,KAAK,CAAC,MAAM,MAAM,SAAS,CAAC,CAAC;AAAA,IACpC,CAAC;AACD,MAAE,mCAAmC;AAAA,EACvC,SAAS,KAAK;AACZ,YAAQ,KAAK,4CAA4C,GAAG;AAAA,EAC9D;AACF;AAEA,UAAU;","names":[]}
1
+ {"version":3,"sources":["../src/auto.ts","../src/bootstrap.ts"],"sourcesContent":["import { createSourceMapResolver } from '@react-perfscope/core'\nimport { installDevToolsHook } from '@react-perfscope/react'\nimport { mount } from '@react-perfscope/ui'\nimport { createConfiguredRecorder } from './bootstrap'\n\n/**\n * Side-effect entry. Importing `react-perfscope/auto` bootstraps a Recorder\n * with the render collector and mounts the UI. Idempotent — importing twice\n * is a no-op (the first import wins).\n *\n * Bails when `process.env.NODE_ENV === 'production'` (build plugins also\n * guard against prod, but this is defense-in-depth).\n */\nfunction bootstrap(): void {\n if (typeof globalThis === 'undefined') return\n const g = globalThis as { __REACT_PERFSCOPE_AUTO_MOUNTED__?: boolean }\n if (g.__REACT_PERFSCOPE_AUTO_MOUNTED__) return\n\n const env = (globalThis as { process?: { env?: { NODE_ENV?: string } } }).process?.env?.NODE_ENV\n if (env === 'production') return\n\n if (typeof document === 'undefined') return\n\n try {\n // Install the React DevTools hook SYNCHRONOUSLY before react-dom is\n // evaluated. react-dom captures `__REACT_DEVTOOLS_GLOBAL_HOOK__` exactly\n // once at module-load time, so the hook must exist by the time the user\n // bundle imports react-dom. A no-op listener is enough to register the\n // hook — when the render collector later activates, it adds the real\n // commit handler to the same global hook.\n installDevToolsHook(() => {})\n\n const { recorder, finalize } = createConfiguredRecorder()\n const resolver = createSourceMapResolver()\n mount({\n recorder,\n resolveFrame: (f) => resolver.resolve(f),\n finalize,\n })\n g.__REACT_PERFSCOPE_AUTO_MOUNTED__ = true\n } catch (err) {\n console.warn('[react-perfscope] auto bootstrap failed:', err)\n }\n}\n\nbootstrap()\n","import {\n createRecorder,\n createForcedReflowCollector,\n createLongTasksCollector,\n createLayoutShiftCollector,\n createNetworkCollector,\n createWebVitalsCollector,\n createSelfProfilingCollector,\n createHeapCollector,\n createInteractionCollector,\n createFrameCollector,\n} from '@react-perfscope/core'\nimport type { Recorder, RecordingResult } from '@react-perfscope/core'\nimport { createRenderCollector } from '@react-perfscope/react'\n\nexport interface ConfiguredRecorder {\n recorder: Recorder\n /** Runs the post-recording finalize chain (interaction → self-profiling →\n * heap → frame) in the order each collector depends on the previous one. */\n finalize: (result: RecordingResult) => Promise<RecordingResult>\n}\n\n/**\n * Assembles the recorder + full collector set that react-perfscope ships,\n * minus the UI. The single source of truth for what gets recorded: both the\n * `/auto` bootstrap and the E2E verification harness call this, so the harness\n * can never validate a collector set that differs from what users get.\n *\n * The caller is responsible for installing the React DevTools hook BEFORE\n * react-dom evaluates (it is timing-sensitive) and for mounting any UI.\n */\nexport function createConfiguredRecorder(): ConfiguredRecorder {\n const recorder = createRecorder()\n recorder.use(createForcedReflowCollector())\n recorder.use(createLongTasksCollector())\n recorder.use(createLayoutShiftCollector())\n recorder.use(createNetworkCollector())\n recorder.use(createWebVitalsCollector())\n recorder.use(createRenderCollector())\n const selfProfiler = createSelfProfilingCollector()\n recorder.use(selfProfiler)\n const heap = createHeapCollector()\n recorder.use(heap)\n const interaction = createInteractionCollector()\n recorder.use(interaction)\n const frame = createFrameCollector()\n recorder.use(frame)\n\n // Assemble interactions first so self-profiling can attribute their\n // processing windows, then attach the heap series and frame timestamps.\n const finalize = (result: RecordingResult): Promise<RecordingResult> =>\n Promise.resolve(interaction.finalize(result))\n .then((r) => selfProfiler.finalize(r))\n .then((r) => heap.finalize(r))\n .then((r) => frame.finalize(r))\n\n return { recorder, finalize }\n}\n"],"mappings":";;;AAAA,IAAAA,eAAwC;AACxC,IAAAC,gBAAoC;AACpC,gBAAsB;;;ACFtB,kBAWO;AAEP,mBAAsC;AAkB/B,SAAS,2BAA+C;AAC7D,QAAM,eAAW,4BAAe;AAChC,WAAS,QAAI,yCAA4B,CAAC;AAC1C,WAAS,QAAI,sCAAyB,CAAC;AACvC,WAAS,QAAI,wCAA2B,CAAC;AACzC,WAAS,QAAI,oCAAuB,CAAC;AACrC,WAAS,QAAI,sCAAyB,CAAC;AACvC,WAAS,QAAI,oCAAsB,CAAC;AACpC,QAAM,mBAAe,0CAA6B;AAClD,WAAS,IAAI,YAAY;AACzB,QAAM,WAAO,iCAAoB;AACjC,WAAS,IAAI,IAAI;AACjB,QAAM,kBAAc,wCAA2B;AAC/C,WAAS,IAAI,WAAW;AACxB,QAAM,YAAQ,kCAAqB;AACnC,WAAS,IAAI,KAAK;AAIlB,QAAM,WAAW,CAAC,WAChB,QAAQ,QAAQ,YAAY,SAAS,MAAM,CAAC,EACzC,KAAK,CAAC,MAAM,aAAa,SAAS,CAAC,CAAC,EACpC,KAAK,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,EAC5B,KAAK,CAAC,MAAM,MAAM,SAAS,CAAC,CAAC;AAElC,SAAO,EAAE,UAAU,SAAS;AAC9B;;;AD5CA,SAAS,YAAkB;AACzB,MAAI,OAAO,eAAe,YAAa;AACvC,QAAM,IAAI;AACV,MAAI,EAAE,iCAAkC;AAExC,QAAM,MAAO,WAA6D,SAAS,KAAK;AACxF,MAAI,QAAQ,aAAc;AAE1B,MAAI,OAAO,aAAa,YAAa;AAErC,MAAI;AAOF,2CAAoB,MAAM;AAAA,IAAC,CAAC;AAE5B,UAAM,EAAE,UAAU,SAAS,IAAI,yBAAyB;AACxD,UAAM,eAAW,sCAAwB;AACzC,yBAAM;AAAA,MACJ;AAAA,MACA,cAAc,CAAC,MAAM,SAAS,QAAQ,CAAC;AAAA,MACvC;AAAA,IACF,CAAC;AACD,MAAE,mCAAmC;AAAA,EACvC,SAAS,KAAK;AACZ,YAAQ,KAAK,4CAA4C,GAAG;AAAA,EAC9D;AACF;AAEA,UAAU;","names":["import_core","import_react"]}
package/dist/auto.d.cts CHANGED
@@ -1,6 +1,5 @@
1
1
  /// <reference lib="es2015" />
2
2
  /// <reference lib="dom" />
3
3
 
4
- import '@react-perfscope/core';
5
- import '@react-perfscope/react';
6
- import '@react-perfscope/ui';
4
+
5
+ export { }
package/dist/auto.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  /// <reference lib="es2015" />
2
2
  /// <reference lib="dom" />
3
3
 
4
- import '@react-perfscope/core';
5
- import '@react-perfscope/react';
6
- import '@react-perfscope/ui';
4
+
5
+ export { }
package/dist/auto.js CHANGED
@@ -1,18 +1,10 @@
1
- // src/auto.ts
2
1
  import {
3
- createRecorder,
4
- createForcedReflowCollector,
5
- createLongTasksCollector,
6
- createLayoutShiftCollector,
7
- createNetworkCollector,
8
- createWebVitalsCollector,
9
- createSelfProfilingCollector,
10
- createHeapCollector,
11
- createInteractionCollector,
12
- createFrameCollector,
13
- createSourceMapResolver
14
- } from "@react-perfscope/core";
15
- import { createRenderCollector, installDevToolsHook } from "@react-perfscope/react";
2
+ createConfiguredRecorder
3
+ } from "./chunk-HQT4LEXO.js";
4
+
5
+ // src/auto.ts
6
+ import { createSourceMapResolver } from "@react-perfscope/core";
7
+ import { installDevToolsHook } from "@react-perfscope/react";
16
8
  import { mount } from "@react-perfscope/ui";
17
9
  function bootstrap() {
18
10
  if (typeof globalThis === "undefined") return;
@@ -24,28 +16,12 @@ function bootstrap() {
24
16
  try {
25
17
  installDevToolsHook(() => {
26
18
  });
27
- const recorder = createRecorder();
28
- recorder.use(createForcedReflowCollector());
29
- recorder.use(createLongTasksCollector());
30
- recorder.use(createLayoutShiftCollector());
31
- recorder.use(createNetworkCollector());
32
- recorder.use(createWebVitalsCollector());
33
- recorder.use(createRenderCollector());
34
- const selfProfiler = createSelfProfilingCollector();
35
- recorder.use(selfProfiler);
36
- const heap = createHeapCollector();
37
- recorder.use(heap);
38
- const interaction = createInteractionCollector();
39
- recorder.use(interaction);
40
- const frame = createFrameCollector();
41
- recorder.use(frame);
19
+ const { recorder, finalize } = createConfiguredRecorder();
42
20
  const resolver = createSourceMapResolver();
43
21
  mount({
44
22
  recorder,
45
23
  resolveFrame: (f) => resolver.resolve(f),
46
- // Assemble interactions first so self-profiling can attribute their
47
- // processing windows, then attach the heap series and frame timestamps.
48
- finalize: (result) => Promise.resolve(interaction.finalize(result)).then((r) => selfProfiler.finalize(r)).then((r) => heap.finalize(r)).then((r) => frame.finalize(r))
24
+ finalize
49
25
  });
50
26
  g.__REACT_PERFSCOPE_AUTO_MOUNTED__ = true;
51
27
  } catch (err) {
package/dist/auto.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/auto.ts"],"sourcesContent":["import {\n createRecorder,\n createForcedReflowCollector,\n createLongTasksCollector,\n createLayoutShiftCollector,\n createNetworkCollector,\n createWebVitalsCollector,\n createSelfProfilingCollector,\n createHeapCollector,\n createInteractionCollector,\n createFrameCollector,\n createSourceMapResolver,\n} from '@react-perfscope/core'\nimport { createRenderCollector, installDevToolsHook } from '@react-perfscope/react'\nimport { mount } from '@react-perfscope/ui'\n\n/**\n * Side-effect entry. Importing `react-perfscope/auto` bootstraps a Recorder\n * with the render collector and mounts the UI. Idempotent — importing twice\n * is a no-op (the first import wins).\n *\n * Bails when `process.env.NODE_ENV === 'production'` (build plugins also\n * guard against prod, but this is defense-in-depth).\n */\nfunction bootstrap(): void {\n if (typeof globalThis === 'undefined') return\n const g = globalThis as { __REACT_PERFSCOPE_AUTO_MOUNTED__?: boolean }\n if (g.__REACT_PERFSCOPE_AUTO_MOUNTED__) return\n\n const env = (globalThis as { process?: { env?: { NODE_ENV?: string } } }).process?.env?.NODE_ENV\n if (env === 'production') return\n\n if (typeof document === 'undefined') return\n\n try {\n // Install the React DevTools hook SYNCHRONOUSLY before react-dom is\n // evaluated. react-dom captures `__REACT_DEVTOOLS_GLOBAL_HOOK__` exactly\n // once at module-load time, so the hook must exist by the time the user\n // bundle imports react-dom. A no-op listener is enough to register the\n // hook — when the render collector later activates, it adds the real\n // commit handler to the same global hook.\n installDevToolsHook(() => {})\n\n const recorder = createRecorder()\n recorder.use(createForcedReflowCollector())\n recorder.use(createLongTasksCollector())\n recorder.use(createLayoutShiftCollector())\n recorder.use(createNetworkCollector())\n recorder.use(createWebVitalsCollector())\n recorder.use(createRenderCollector())\n const selfProfiler = createSelfProfilingCollector()\n recorder.use(selfProfiler)\n const heap = createHeapCollector()\n recorder.use(heap)\n const interaction = createInteractionCollector()\n recorder.use(interaction)\n const frame = createFrameCollector()\n recorder.use(frame)\n const resolver = createSourceMapResolver()\n mount({\n recorder,\n resolveFrame: (f) => resolver.resolve(f),\n // Assemble interactions first so self-profiling can attribute their\n // processing windows, then attach the heap series and frame timestamps.\n finalize: (result) =>\n Promise.resolve(interaction.finalize(result))\n .then((r) => selfProfiler.finalize(r))\n .then((r) => heap.finalize(r))\n .then((r) => frame.finalize(r)),\n })\n g.__REACT_PERFSCOPE_AUTO_MOUNTED__ = true\n } catch (err) {\n console.warn('[react-perfscope] auto bootstrap failed:', err)\n }\n}\n\nbootstrap()\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,uBAAuB,2BAA2B;AAC3D,SAAS,aAAa;AAUtB,SAAS,YAAkB;AACzB,MAAI,OAAO,eAAe,YAAa;AACvC,QAAM,IAAI;AACV,MAAI,EAAE,iCAAkC;AAExC,QAAM,MAAO,WAA6D,SAAS,KAAK;AACxF,MAAI,QAAQ,aAAc;AAE1B,MAAI,OAAO,aAAa,YAAa;AAErC,MAAI;AAOF,wBAAoB,MAAM;AAAA,IAAC,CAAC;AAE5B,UAAM,WAAW,eAAe;AAChC,aAAS,IAAI,4BAA4B,CAAC;AAC1C,aAAS,IAAI,yBAAyB,CAAC;AACvC,aAAS,IAAI,2BAA2B,CAAC;AACzC,aAAS,IAAI,uBAAuB,CAAC;AACrC,aAAS,IAAI,yBAAyB,CAAC;AACvC,aAAS,IAAI,sBAAsB,CAAC;AACpC,UAAM,eAAe,6BAA6B;AAClD,aAAS,IAAI,YAAY;AACzB,UAAM,OAAO,oBAAoB;AACjC,aAAS,IAAI,IAAI;AACjB,UAAM,cAAc,2BAA2B;AAC/C,aAAS,IAAI,WAAW;AACxB,UAAM,QAAQ,qBAAqB;AACnC,aAAS,IAAI,KAAK;AAClB,UAAM,WAAW,wBAAwB;AACzC,UAAM;AAAA,MACJ;AAAA,MACA,cAAc,CAAC,MAAM,SAAS,QAAQ,CAAC;AAAA;AAAA;AAAA,MAGvC,UAAU,CAAC,WACT,QAAQ,QAAQ,YAAY,SAAS,MAAM,CAAC,EACzC,KAAK,CAAC,MAAM,aAAa,SAAS,CAAC,CAAC,EACpC,KAAK,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,EAC5B,KAAK,CAAC,MAAM,MAAM,SAAS,CAAC,CAAC;AAAA,IACpC,CAAC;AACD,MAAE,mCAAmC;AAAA,EACvC,SAAS,KAAK;AACZ,YAAQ,KAAK,4CAA4C,GAAG;AAAA,EAC9D;AACF;AAEA,UAAU;","names":[]}
1
+ {"version":3,"sources":["../src/auto.ts"],"sourcesContent":["import { createSourceMapResolver } from '@react-perfscope/core'\nimport { installDevToolsHook } from '@react-perfscope/react'\nimport { mount } from '@react-perfscope/ui'\nimport { createConfiguredRecorder } from './bootstrap'\n\n/**\n * Side-effect entry. Importing `react-perfscope/auto` bootstraps a Recorder\n * with the render collector and mounts the UI. Idempotent — importing twice\n * is a no-op (the first import wins).\n *\n * Bails when `process.env.NODE_ENV === 'production'` (build plugins also\n * guard against prod, but this is defense-in-depth).\n */\nfunction bootstrap(): void {\n if (typeof globalThis === 'undefined') return\n const g = globalThis as { __REACT_PERFSCOPE_AUTO_MOUNTED__?: boolean }\n if (g.__REACT_PERFSCOPE_AUTO_MOUNTED__) return\n\n const env = (globalThis as { process?: { env?: { NODE_ENV?: string } } }).process?.env?.NODE_ENV\n if (env === 'production') return\n\n if (typeof document === 'undefined') return\n\n try {\n // Install the React DevTools hook SYNCHRONOUSLY before react-dom is\n // evaluated. react-dom captures `__REACT_DEVTOOLS_GLOBAL_HOOK__` exactly\n // once at module-load time, so the hook must exist by the time the user\n // bundle imports react-dom. A no-op listener is enough to register the\n // hook — when the render collector later activates, it adds the real\n // commit handler to the same global hook.\n installDevToolsHook(() => {})\n\n const { recorder, finalize } = createConfiguredRecorder()\n const resolver = createSourceMapResolver()\n mount({\n recorder,\n resolveFrame: (f) => resolver.resolve(f),\n finalize,\n })\n g.__REACT_PERFSCOPE_AUTO_MOUNTED__ = true\n } catch (err) {\n console.warn('[react-perfscope] auto bootstrap failed:', err)\n }\n}\n\nbootstrap()\n"],"mappings":";;;;;AAAA,SAAS,+BAA+B;AACxC,SAAS,2BAA2B;AACpC,SAAS,aAAa;AAWtB,SAAS,YAAkB;AACzB,MAAI,OAAO,eAAe,YAAa;AACvC,QAAM,IAAI;AACV,MAAI,EAAE,iCAAkC;AAExC,QAAM,MAAO,WAA6D,SAAS,KAAK;AACxF,MAAI,QAAQ,aAAc;AAE1B,MAAI,OAAO,aAAa,YAAa;AAErC,MAAI;AAOF,wBAAoB,MAAM;AAAA,IAAC,CAAC;AAE5B,UAAM,EAAE,UAAU,SAAS,IAAI,yBAAyB;AACxD,UAAM,WAAW,wBAAwB;AACzC,UAAM;AAAA,MACJ;AAAA,MACA,cAAc,CAAC,MAAM,SAAS,QAAQ,CAAC;AAAA,MACvC;AAAA,IACF,CAAC;AACD,MAAE,mCAAmC;AAAA,EACvC,SAAS,KAAK;AACZ,YAAQ,KAAK,4CAA4C,GAAG;AAAA,EAC9D;AACF;AAEA,UAAU;","names":[]}
@@ -0,0 +1,38 @@
1
+ // src/bootstrap.ts
2
+ import {
3
+ createRecorder,
4
+ createForcedReflowCollector,
5
+ createLongTasksCollector,
6
+ createLayoutShiftCollector,
7
+ createNetworkCollector,
8
+ createWebVitalsCollector,
9
+ createSelfProfilingCollector,
10
+ createHeapCollector,
11
+ createInteractionCollector,
12
+ createFrameCollector
13
+ } from "@react-perfscope/core";
14
+ import { createRenderCollector } from "@react-perfscope/react";
15
+ function createConfiguredRecorder() {
16
+ const recorder = createRecorder();
17
+ recorder.use(createForcedReflowCollector());
18
+ recorder.use(createLongTasksCollector());
19
+ recorder.use(createLayoutShiftCollector());
20
+ recorder.use(createNetworkCollector());
21
+ recorder.use(createWebVitalsCollector());
22
+ recorder.use(createRenderCollector());
23
+ const selfProfiler = createSelfProfilingCollector();
24
+ recorder.use(selfProfiler);
25
+ const heap = createHeapCollector();
26
+ recorder.use(heap);
27
+ const interaction = createInteractionCollector();
28
+ recorder.use(interaction);
29
+ const frame = createFrameCollector();
30
+ recorder.use(frame);
31
+ const finalize = (result) => Promise.resolve(interaction.finalize(result)).then((r) => selfProfiler.finalize(r)).then((r) => heap.finalize(r)).then((r) => frame.finalize(r));
32
+ return { recorder, finalize };
33
+ }
34
+
35
+ export {
36
+ createConfiguredRecorder
37
+ };
38
+ //# sourceMappingURL=chunk-HQT4LEXO.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/bootstrap.ts"],"sourcesContent":["import {\n createRecorder,\n createForcedReflowCollector,\n createLongTasksCollector,\n createLayoutShiftCollector,\n createNetworkCollector,\n createWebVitalsCollector,\n createSelfProfilingCollector,\n createHeapCollector,\n createInteractionCollector,\n createFrameCollector,\n} from '@react-perfscope/core'\nimport type { Recorder, RecordingResult } from '@react-perfscope/core'\nimport { createRenderCollector } from '@react-perfscope/react'\n\nexport interface ConfiguredRecorder {\n recorder: Recorder\n /** Runs the post-recording finalize chain (interaction → self-profiling →\n * heap → frame) in the order each collector depends on the previous one. */\n finalize: (result: RecordingResult) => Promise<RecordingResult>\n}\n\n/**\n * Assembles the recorder + full collector set that react-perfscope ships,\n * minus the UI. The single source of truth for what gets recorded: both the\n * `/auto` bootstrap and the E2E verification harness call this, so the harness\n * can never validate a collector set that differs from what users get.\n *\n * The caller is responsible for installing the React DevTools hook BEFORE\n * react-dom evaluates (it is timing-sensitive) and for mounting any UI.\n */\nexport function createConfiguredRecorder(): ConfiguredRecorder {\n const recorder = createRecorder()\n recorder.use(createForcedReflowCollector())\n recorder.use(createLongTasksCollector())\n recorder.use(createLayoutShiftCollector())\n recorder.use(createNetworkCollector())\n recorder.use(createWebVitalsCollector())\n recorder.use(createRenderCollector())\n const selfProfiler = createSelfProfilingCollector()\n recorder.use(selfProfiler)\n const heap = createHeapCollector()\n recorder.use(heap)\n const interaction = createInteractionCollector()\n recorder.use(interaction)\n const frame = createFrameCollector()\n recorder.use(frame)\n\n // Assemble interactions first so self-profiling can attribute their\n // processing windows, then attach the heap series and frame timestamps.\n const finalize = (result: RecordingResult): Promise<RecordingResult> =>\n Promise.resolve(interaction.finalize(result))\n .then((r) => selfProfiler.finalize(r))\n .then((r) => heap.finalize(r))\n .then((r) => frame.finalize(r))\n\n return { recorder, finalize }\n}\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,6BAA6B;AAkB/B,SAAS,2BAA+C;AAC7D,QAAM,WAAW,eAAe;AAChC,WAAS,IAAI,4BAA4B,CAAC;AAC1C,WAAS,IAAI,yBAAyB,CAAC;AACvC,WAAS,IAAI,2BAA2B,CAAC;AACzC,WAAS,IAAI,uBAAuB,CAAC;AACrC,WAAS,IAAI,yBAAyB,CAAC;AACvC,WAAS,IAAI,sBAAsB,CAAC;AACpC,QAAM,eAAe,6BAA6B;AAClD,WAAS,IAAI,YAAY;AACzB,QAAM,OAAO,oBAAoB;AACjC,WAAS,IAAI,IAAI;AACjB,QAAM,cAAc,2BAA2B;AAC/C,WAAS,IAAI,WAAW;AACxB,QAAM,QAAQ,qBAAqB;AACnC,WAAS,IAAI,KAAK;AAIlB,QAAM,WAAW,CAAC,WAChB,QAAQ,QAAQ,YAAY,SAAS,MAAM,CAAC,EACzC,KAAK,CAAC,MAAM,aAAa,SAAS,CAAC,CAAC,EACpC,KAAK,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,EAC5B,KAAK,CAAC,MAAM,MAAM,SAAS,CAAC,CAAC;AAElC,SAAO,EAAE,UAAU,SAAS;AAC9B;","names":[]}
package/dist/index.cjs CHANGED
@@ -3,6 +3,10 @@ var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
6
10
  var __copyProps = (to, from, except, desc) => {
7
11
  if (from && typeof from === "object" || typeof from === "function") {
8
12
  for (let key of __getOwnPropNames(from))
@@ -16,12 +20,39 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
16
20
 
17
21
  // src/index.ts
18
22
  var index_exports = {};
23
+ __export(index_exports, {
24
+ createConfiguredRecorder: () => createConfiguredRecorder
25
+ });
19
26
  module.exports = __toCommonJS(index_exports);
20
27
  __reExport(index_exports, require("@react-perfscope/core"), module.exports);
21
28
  __reExport(index_exports, require("@react-perfscope/react"), module.exports);
22
29
  __reExport(index_exports, require("@react-perfscope/ui"), module.exports);
30
+
31
+ // src/bootstrap.ts
32
+ var import_core = require("@react-perfscope/core");
33
+ var import_react = require("@react-perfscope/react");
34
+ function createConfiguredRecorder() {
35
+ const recorder = (0, import_core.createRecorder)();
36
+ recorder.use((0, import_core.createForcedReflowCollector)());
37
+ recorder.use((0, import_core.createLongTasksCollector)());
38
+ recorder.use((0, import_core.createLayoutShiftCollector)());
39
+ recorder.use((0, import_core.createNetworkCollector)());
40
+ recorder.use((0, import_core.createWebVitalsCollector)());
41
+ recorder.use((0, import_react.createRenderCollector)());
42
+ const selfProfiler = (0, import_core.createSelfProfilingCollector)();
43
+ recorder.use(selfProfiler);
44
+ const heap = (0, import_core.createHeapCollector)();
45
+ recorder.use(heap);
46
+ const interaction = (0, import_core.createInteractionCollector)();
47
+ recorder.use(interaction);
48
+ const frame = (0, import_core.createFrameCollector)();
49
+ recorder.use(frame);
50
+ const finalize = (result) => Promise.resolve(interaction.finalize(result)).then((r) => selfProfiler.finalize(r)).then((r) => heap.finalize(r)).then((r) => frame.finalize(r));
51
+ return { recorder, finalize };
52
+ }
23
53
  // Annotate the CommonJS export names for ESM import in node:
24
54
  0 && (module.exports = {
55
+ createConfiguredRecorder,
25
56
  ...require("@react-perfscope/core"),
26
57
  ...require("@react-perfscope/react"),
27
58
  ...require("@react-perfscope/ui")
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from '@react-perfscope/core'\nexport * from '@react-perfscope/react'\nexport * from '@react-perfscope/ui'\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,0BAAc,kCAAd;AACA,0BAAc,mCADd;AAEA,0BAAc,gCAFd;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts","../src/bootstrap.ts"],"sourcesContent":["export * from '@react-perfscope/core'\nexport * from '@react-perfscope/react'\nexport * from '@react-perfscope/ui'\nexport { createConfiguredRecorder } from './bootstrap'\nexport type { ConfiguredRecorder } from './bootstrap'\n","import {\n createRecorder,\n createForcedReflowCollector,\n createLongTasksCollector,\n createLayoutShiftCollector,\n createNetworkCollector,\n createWebVitalsCollector,\n createSelfProfilingCollector,\n createHeapCollector,\n createInteractionCollector,\n createFrameCollector,\n} from '@react-perfscope/core'\nimport type { Recorder, RecordingResult } from '@react-perfscope/core'\nimport { createRenderCollector } from '@react-perfscope/react'\n\nexport interface ConfiguredRecorder {\n recorder: Recorder\n /** Runs the post-recording finalize chain (interaction → self-profiling →\n * heap → frame) in the order each collector depends on the previous one. */\n finalize: (result: RecordingResult) => Promise<RecordingResult>\n}\n\n/**\n * Assembles the recorder + full collector set that react-perfscope ships,\n * minus the UI. The single source of truth for what gets recorded: both the\n * `/auto` bootstrap and the E2E verification harness call this, so the harness\n * can never validate a collector set that differs from what users get.\n *\n * The caller is responsible for installing the React DevTools hook BEFORE\n * react-dom evaluates (it is timing-sensitive) and for mounting any UI.\n */\nexport function createConfiguredRecorder(): ConfiguredRecorder {\n const recorder = createRecorder()\n recorder.use(createForcedReflowCollector())\n recorder.use(createLongTasksCollector())\n recorder.use(createLayoutShiftCollector())\n recorder.use(createNetworkCollector())\n recorder.use(createWebVitalsCollector())\n recorder.use(createRenderCollector())\n const selfProfiler = createSelfProfilingCollector()\n recorder.use(selfProfiler)\n const heap = createHeapCollector()\n recorder.use(heap)\n const interaction = createInteractionCollector()\n recorder.use(interaction)\n const frame = createFrameCollector()\n recorder.use(frame)\n\n // Assemble interactions first so self-profiling can attribute their\n // processing windows, then attach the heap series and frame timestamps.\n const finalize = (result: RecordingResult): Promise<RecordingResult> =>\n Promise.resolve(interaction.finalize(result))\n .then((r) => selfProfiler.finalize(r))\n .then((r) => heap.finalize(r))\n .then((r) => frame.finalize(r))\n\n return { recorder, finalize }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAAc,kCAAd;AACA,0BAAc,mCADd;AAEA,0BAAc,gCAFd;;;ACAA,kBAWO;AAEP,mBAAsC;AAkB/B,SAAS,2BAA+C;AAC7D,QAAM,eAAW,4BAAe;AAChC,WAAS,QAAI,yCAA4B,CAAC;AAC1C,WAAS,QAAI,sCAAyB,CAAC;AACvC,WAAS,QAAI,wCAA2B,CAAC;AACzC,WAAS,QAAI,oCAAuB,CAAC;AACrC,WAAS,QAAI,sCAAyB,CAAC;AACvC,WAAS,QAAI,oCAAsB,CAAC;AACpC,QAAM,mBAAe,0CAA6B;AAClD,WAAS,IAAI,YAAY;AACzB,QAAM,WAAO,iCAAoB;AACjC,WAAS,IAAI,IAAI;AACjB,QAAM,kBAAc,wCAA2B;AAC/C,WAAS,IAAI,WAAW;AACxB,QAAM,YAAQ,kCAAqB;AACnC,WAAS,IAAI,KAAK;AAIlB,QAAM,WAAW,CAAC,WAChB,QAAQ,QAAQ,YAAY,SAAS,MAAM,CAAC,EACzC,KAAK,CAAC,MAAM,aAAa,SAAS,CAAC,CAAC,EACpC,KAAK,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,EAC5B,KAAK,CAAC,MAAM,MAAM,SAAS,CAAC,CAAC;AAElC,SAAO,EAAE,UAAU,SAAS;AAC9B;","names":[]}
package/dist/index.d.cts CHANGED
@@ -1,6 +1,26 @@
1
1
  /// <reference lib="es2015" />
2
2
  /// <reference lib="dom" />
3
3
 
4
+ import { Recorder, RecordingResult } from '@react-perfscope/core';
4
5
  export * from '@react-perfscope/core';
5
6
  export * from '@react-perfscope/react';
6
7
  export * from '@react-perfscope/ui';
8
+
9
+ interface ConfiguredRecorder {
10
+ recorder: Recorder;
11
+ /** Runs the post-recording finalize chain (interaction → self-profiling →
12
+ * heap → frame) in the order each collector depends on the previous one. */
13
+ finalize: (result: RecordingResult) => Promise<RecordingResult>;
14
+ }
15
+ /**
16
+ * Assembles the recorder + full collector set that react-perfscope ships,
17
+ * minus the UI. The single source of truth for what gets recorded: both the
18
+ * `/auto` bootstrap and the E2E verification harness call this, so the harness
19
+ * can never validate a collector set that differs from what users get.
20
+ *
21
+ * The caller is responsible for installing the React DevTools hook BEFORE
22
+ * react-dom evaluates (it is timing-sensitive) and for mounting any UI.
23
+ */
24
+ declare function createConfiguredRecorder(): ConfiguredRecorder;
25
+
26
+ export { type ConfiguredRecorder, createConfiguredRecorder };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,26 @@
1
1
  /// <reference lib="es2015" />
2
2
  /// <reference lib="dom" />
3
3
 
4
+ import { Recorder, RecordingResult } from '@react-perfscope/core';
4
5
  export * from '@react-perfscope/core';
5
6
  export * from '@react-perfscope/react';
6
7
  export * from '@react-perfscope/ui';
8
+
9
+ interface ConfiguredRecorder {
10
+ recorder: Recorder;
11
+ /** Runs the post-recording finalize chain (interaction → self-profiling →
12
+ * heap → frame) in the order each collector depends on the previous one. */
13
+ finalize: (result: RecordingResult) => Promise<RecordingResult>;
14
+ }
15
+ /**
16
+ * Assembles the recorder + full collector set that react-perfscope ships,
17
+ * minus the UI. The single source of truth for what gets recorded: both the
18
+ * `/auto` bootstrap and the E2E verification harness call this, so the harness
19
+ * can never validate a collector set that differs from what users get.
20
+ *
21
+ * The caller is responsible for installing the React DevTools hook BEFORE
22
+ * react-dom evaluates (it is timing-sensitive) and for mounting any UI.
23
+ */
24
+ declare function createConfiguredRecorder(): ConfiguredRecorder;
25
+
26
+ export { type ConfiguredRecorder, createConfiguredRecorder };
package/dist/index.js CHANGED
@@ -1,5 +1,12 @@
1
+ import {
2
+ createConfiguredRecorder
3
+ } from "./chunk-HQT4LEXO.js";
4
+
1
5
  // src/index.ts
2
6
  export * from "@react-perfscope/core";
3
7
  export * from "@react-perfscope/react";
4
8
  export * from "@react-perfscope/ui";
9
+ export {
10
+ createConfiguredRecorder
11
+ };
5
12
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from '@react-perfscope/core'\nexport * from '@react-perfscope/react'\nexport * from '@react-perfscope/ui'\n"],"mappings":";AAAA,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from '@react-perfscope/core'\nexport * from '@react-perfscope/react'\nexport * from '@react-perfscope/ui'\nexport { createConfiguredRecorder } from './bootstrap'\nexport type { ConfiguredRecorder } from './bootstrap'\n"],"mappings":";;;;;AAAA,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-perfscope",
3
- "version": "0.4.0",
3
+ "version": "0.6.0",
4
4
  "description": "Zero-config React performance profiler with an in-app panel.",
5
5
  "keywords": [
6
6
  "react",
@@ -39,9 +39,9 @@
39
39
  "./dist/auto.cjs"
40
40
  ],
41
41
  "dependencies": {
42
- "@react-perfscope/core": "0.4.0",
43
- "@react-perfscope/react": "0.4.0",
44
- "@react-perfscope/ui": "0.4.0"
42
+ "@react-perfscope/core": "0.6.0",
43
+ "@react-perfscope/ui": "0.6.0",
44
+ "@react-perfscope/react": "0.6.0"
45
45
  },
46
46
  "license": "MIT",
47
47
  "author": "rayforvideos",