@solhun/feedback-kit-web 0.2.2 → 0.2.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.
- package/dist/index.cjs +43 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.js +43 -3
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -188,10 +188,15 @@ declare const captureWebScreenshot: ScreenshotCapture;
|
|
|
188
188
|
declare const reencodeWebScreenshot: ScreenshotReencode;
|
|
189
189
|
|
|
190
190
|
/**
|
|
191
|
-
* 바깥 → 안쪽 순서의 컴포넌트 이름 목록.
|
|
191
|
+
* 바깥 → 안쪽 순서의 **앱** 컴포넌트 이름 목록.
|
|
192
192
|
* 예: `["App", "LoginPage", "LoginForm", "SubmitButton"]`
|
|
193
193
|
*
|
|
194
|
-
*
|
|
194
|
+
* 프레임워크가 만든 이름은 뺀다. 다 빼고 나면 빈 배열이고, 그게 정직한 답이다 —
|
|
195
|
+
* 서버 컴포넌트만 있는 화면에는 클라이언트 fiber 에 앱 이름이 애초에 없다.
|
|
196
|
+
*
|
|
197
|
+
* @param limit 안쪽에서부터 이만큼만 남긴다. 요소에 **가까운 쪽이 단서**라, 넘치면
|
|
198
|
+
* 바깥(앱 루트 쪽)을 버린다. 예전엔 20 이었는데 그 길이가 그대로 제보에 실려서
|
|
199
|
+
* 한 줄이 300자를 넘었다.
|
|
195
200
|
*/
|
|
196
201
|
declare function reactComponentPath(node: Element, limit?: number): string[];
|
|
197
202
|
/** 제보 본문에 실을 한 줄. 컴포넌트를 못 찾으면 null(빈 줄을 만들지 않는다). */
|
package/dist/index.d.ts
CHANGED
|
@@ -188,10 +188,15 @@ declare const captureWebScreenshot: ScreenshotCapture;
|
|
|
188
188
|
declare const reencodeWebScreenshot: ScreenshotReencode;
|
|
189
189
|
|
|
190
190
|
/**
|
|
191
|
-
* 바깥 → 안쪽 순서의 컴포넌트 이름 목록.
|
|
191
|
+
* 바깥 → 안쪽 순서의 **앱** 컴포넌트 이름 목록.
|
|
192
192
|
* 예: `["App", "LoginPage", "LoginForm", "SubmitButton"]`
|
|
193
193
|
*
|
|
194
|
-
*
|
|
194
|
+
* 프레임워크가 만든 이름은 뺀다. 다 빼고 나면 빈 배열이고, 그게 정직한 답이다 —
|
|
195
|
+
* 서버 컴포넌트만 있는 화면에는 클라이언트 fiber 에 앱 이름이 애초에 없다.
|
|
196
|
+
*
|
|
197
|
+
* @param limit 안쪽에서부터 이만큼만 남긴다. 요소에 **가까운 쪽이 단서**라, 넘치면
|
|
198
|
+
* 바깥(앱 루트 쪽)을 버린다. 예전엔 20 이었는데 그 길이가 그대로 제보에 실려서
|
|
199
|
+
* 한 줄이 300자를 넘었다.
|
|
195
200
|
*/
|
|
196
201
|
declare function reactComponentPath(node: Element, limit?: number): string[];
|
|
197
202
|
/** 제보 본문에 실을 한 줄. 컴포넌트를 못 찾으면 null(빈 줄을 만들지 않는다). */
|
package/dist/index.js
CHANGED
|
@@ -17,6 +17,44 @@ import {
|
|
|
17
17
|
} from "@solhun/feedback-kit-core";
|
|
18
18
|
|
|
19
19
|
// src/react-tree.ts
|
|
20
|
+
var FRAMEWORK_INTERNALS = /* @__PURE__ */ new Set([
|
|
21
|
+
// Next.js App Router
|
|
22
|
+
"AppRouter",
|
|
23
|
+
"InnerLayoutRouter",
|
|
24
|
+
"OuterLayoutRouter",
|
|
25
|
+
"LayoutRouterContext",
|
|
26
|
+
"RenderFromTemplateContext",
|
|
27
|
+
"TemplateContext",
|
|
28
|
+
"SegmentStateProvider",
|
|
29
|
+
"SegmentViewNode",
|
|
30
|
+
"ScrollAndMaybeFocusHandler",
|
|
31
|
+
"InnerScrollAndFocusHandler",
|
|
32
|
+
"InnerScrollAndFocusHandlerOld",
|
|
33
|
+
"RedirectBoundary",
|
|
34
|
+
"RedirectErrorBoundary",
|
|
35
|
+
"NotFoundBoundary",
|
|
36
|
+
"NotFoundErrorBoundary",
|
|
37
|
+
"HTTPAccessFallbackBoundary",
|
|
38
|
+
"HTTPAccessFallbackErrorBoundary",
|
|
39
|
+
"DevRootHTTPAccessFallbackBoundary",
|
|
40
|
+
"LoadingBoundary",
|
|
41
|
+
"ErrorBoundaryHandler",
|
|
42
|
+
"MetadataBoundary",
|
|
43
|
+
"ViewportBoundary",
|
|
44
|
+
"OutletBoundary",
|
|
45
|
+
// 개발 전용 오버레이 — 프로덕션엔 없지만 dev 제보에는 항상 낀다
|
|
46
|
+
"HotReload",
|
|
47
|
+
"AppDevOverlay",
|
|
48
|
+
"AppDevOverlayErrorBoundary",
|
|
49
|
+
"ReactDevOverlay",
|
|
50
|
+
"DevOverlay",
|
|
51
|
+
"Router",
|
|
52
|
+
"ServerRoot",
|
|
53
|
+
"RSCComponent"
|
|
54
|
+
]);
|
|
55
|
+
function isFrameworkName(name) {
|
|
56
|
+
return FRAMEWORK_INTERNALS.has(name) || name.startsWith("__next");
|
|
57
|
+
}
|
|
20
58
|
function componentName(type) {
|
|
21
59
|
if (typeof type === "function") {
|
|
22
60
|
const fn = type;
|
|
@@ -39,13 +77,15 @@ function fiberOf(node) {
|
|
|
39
77
|
}
|
|
40
78
|
return null;
|
|
41
79
|
}
|
|
42
|
-
function reactComponentPath(node, limit =
|
|
80
|
+
function reactComponentPath(node, limit = 5) {
|
|
43
81
|
try {
|
|
44
82
|
let fiber = fiberOf(node);
|
|
45
83
|
const names = [];
|
|
46
|
-
|
|
84
|
+
let depth = 0;
|
|
85
|
+
while (fiber && names.length < limit && depth < 200) {
|
|
86
|
+
depth += 1;
|
|
47
87
|
const name = componentName(fiber.elementType ?? fiber.type);
|
|
48
|
-
if (name && names[0] !== name) names.unshift(name);
|
|
88
|
+
if (name && !isFrameworkName(name) && names[0] !== name) names.unshift(name);
|
|
49
89
|
fiber = fiber.return ?? null;
|
|
50
90
|
}
|
|
51
91
|
return names;
|