@react-perfscope/core 0.1.0 → 0.2.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.
Files changed (2) hide show
  1. package/README.md +31 -43
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,31 +1,14 @@
1
1
  # @react-perfscope/core
2
2
 
3
- Core recording engine for `react-perfscope`. Provides a `Recorder` and pluggable `Collector`s that emit normalized performance signals.
3
+ Core recording engine for `react-perfscope`. Provides a `Recorder` and pluggable `Collector`s that emit normalized performance signals (forced-reflow, long-tasks, layout-shift, network, web-vitals, paint).
4
4
 
5
- ## Status
5
+ ## Install
6
6
 
7
- Phase 2 complete — `@react-perfscope/core` ships all 6 core collectors (forced-reflow, long-tasks, layout-shift, network, web-vitals, paint) with deferred stack parsing and synchronous dirty tracking on forced-reflow.
8
-
9
- **Forced-reflow note:** Synchronous dirty tracking via `MutationObserver.takeRecords()` ensures the collector only emits when DOM mutated since the last layout read. Stack parsing is deferred until `signal.stack` is accessed.
10
-
11
- **Paint collector note:** Phase 2 emits paint entries with a zero-sized `rect` placeholder. Real mutated-region geometry arrives with the UI package in Phase 3.
12
-
13
- The `render` signal is owned by the upcoming `@react-perfscope/react` package (Phase 3) and not yet emitted.
14
-
15
- ## Source-map resolution
16
-
17
- `createSourceMapResolver()` returns an async resolver that follows `//# sourceMappingURL=` references (including inline `data:` URIs), caches the parsed source map per source URL, and resolves a `StackFrame` to its original source position. The UI uses this to make bundled stack traces readable.
18
-
19
- ```ts
20
- import { createSourceMapResolver } from '@react-perfscope/core'
21
-
22
- const resolver = createSourceMapResolver()
23
- const original = await resolver.resolve(parsedFrame)
7
+ ```sh
8
+ npm install @react-perfscope/core
24
9
  ```
25
10
 
26
- Falls back to the input frame on any failure (missing source map, network error, etc.).
27
-
28
- ## Example
11
+ ## Usage
29
12
 
30
13
  ```ts
31
14
  import {
@@ -53,38 +36,32 @@ const result = recorder.stop()
53
36
  console.log(result.signals)
54
37
  ```
55
38
 
56
- ---
57
-
58
- <a id="한국어"></a>
59
-
60
- # 한국어
61
-
62
- `react-perfscope`의 핵심 레코딩 엔진. `Recorder`와 플러그인 방식의 `Collector`를 제공해서 정규화된 성능 신호를 내보낸다.
39
+ ## Source-map resolution
63
40
 
64
- ## 상태
41
+ `createSourceMapResolver()` returns an async resolver that follows `//# sourceMappingURL=` references (including inline `data:` URIs) and resolves a `StackFrame` to its original source position, so bundled stack traces become readable. Falls back to the input frame on any failure.
65
42
 
66
- Phase 2 완료 — `@react-perfscope/core`에 6개 collector가 전부 포함됐다 (forced-reflow, long-tasks, layout-shift, network, web-vitals, paint). 스택 파싱은 지연 처리되고, forced-reflow는 동기적으로 dirty 추적을 한다.
43
+ ```ts
44
+ import { createSourceMapResolver } from '@react-perfscope/core'
67
45
 
68
- **forced-reflow 참고:** `MutationObserver.takeRecords()`를 이용한 동기 dirty 추적으로, 마지막 레이아웃 읽기 이후 DOM이 실제로 변경됐을 때만 신호를 내보낸다. 스택 파싱은 `signal.stack`에 접근할 때까지 미뤄진다.
46
+ const resolver = createSourceMapResolver()
47
+ const original = await resolver.resolve(parsedFrame)
48
+ ```
69
49
 
70
- **paint collector 참고:** Phase 2에서는 paint 항목을 크기가 0인 `rect` 플레이스홀더와 함께 내보낸다. 실제 변경 영역 geometry는 Phase 3에서 UI 패키지와 함께 들어온다.
50
+ ---
71
51
 
72
- `render` 신호는 곧 나올 `@react-perfscope/react` 패키지(Phase 3)가 담당하고, 아직 내보내지 않는다.
52
+ <a id="한국어"></a>
73
53
 
74
- ## Source-map 해석
54
+ # 한국어
75
55
 
76
- `createSourceMapResolver()`는 `//# sourceMappingURL=` 참조 (inline `data:` URI 포함)를 따라가서 source map을 가져오고, 파싱된 결과를 소스 URL 단위로 캐시한 다음, `StackFrame`을 원본 소스 위치로 해석해주는 async resolver반환한다. UI에서 번들된 스택 트레이스를 읽을 수 있게 해주는 데 쓰인다.
56
+ `react-perfscope`의 핵심 레코딩 엔진. `Recorder`와 플러그인 방식의 `Collector`를 제공해서 정규화된 성능 신호(forced-reflow, long-tasks, layout-shift, network, web-vitals, paint)내보낸다.
77
57
 
78
- ```ts
79
- import { createSourceMapResolver } from '@react-perfscope/core'
58
+ ## 설치
80
59
 
81
- const resolver = createSourceMapResolver()
82
- const original = await resolver.resolve(parsedFrame)
60
+ ```sh
61
+ npm install @react-perfscope/core
83
62
  ```
84
63
 
85
- source map이 없거나 네트워크 에러 등 어떤 이유로든 실패하면 원본 frame을 그대로 반환한다.
86
-
87
- ## 예제
64
+ ## 사용법
88
65
 
89
66
  ```ts
90
67
  import {
@@ -111,3 +88,14 @@ const result = recorder.stop()
111
88
 
112
89
  console.log(result.signals)
113
90
  ```
91
+
92
+ ## Source-map 해석
93
+
94
+ `createSourceMapResolver()`는 `//# sourceMappingURL=` 참조(inline `data:` URI 포함)를 따라가서 `StackFrame`을 원본 소스 위치로 해석해주는 async resolver를 반환한다. 덕분에 번들된 스택 트레이스를 읽을 수 있다. 실패하면 원본 frame을 그대로 반환한다.
95
+
96
+ ```ts
97
+ import { createSourceMapResolver } from '@react-perfscope/core'
98
+
99
+ const resolver = createSourceMapResolver()
100
+ const original = await resolver.resolve(parsedFrame)
101
+ ```
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@react-perfscope/core",
3
- "version": "0.1.0",
4
- "description": "Signal collectors and recorder powering react-perfscope — a zero-config React runtime performance profiler.",
3
+ "version": "0.2.0",
4
+ "description": "Recorder and signal collectors for react-perfscope.",
5
5
  "keywords": [
6
6
  "react",
7
7
  "performance",