rune-grab 0.1.2 → 0.1.4
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.d.cts +0 -8
- package/dist/index.d.ts +0 -8
- package/dist/react.cjs +19 -11
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +19 -11
- package/dist/react.js.map +1 -1
- package/dist/rune-grab.cjs +19 -11
- package/dist/rune-grab.cjs.map +1 -1
- package/dist/rune-grab.iife.global.js +18 -18
- package/dist/rune-grab.iife.global.js.map +1 -1
- package/dist/rune-grab.js +19 -11
- package/dist/rune-grab.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -67,15 +67,7 @@ declare function resolveElementMeta(meta: ElementMeta): Promise<void>;
|
|
|
67
67
|
|
|
68
68
|
declare function detectComponent(el: Element, customSkip?: Set<string>): ComponentInfo | null;
|
|
69
69
|
declare function detectComponentStack(el: Element, maxDepth?: number, customSkip?: Set<string>): ComponentFrame[];
|
|
70
|
-
/**
|
|
71
|
-
* Resolve source-mapped line numbers for a ComponentInfo that was detected
|
|
72
|
-
* from a _debugStack (React 19+). If the info already has a line number
|
|
73
|
-
* (from _debugSource) or has no pending resolution, this is a no-op.
|
|
74
|
-
*/
|
|
75
70
|
declare function resolveComponentInfo(info: ComponentInfo): Promise<void>;
|
|
76
|
-
/**
|
|
77
|
-
* Resolve source-mapped line numbers for a ComponentFrame.
|
|
78
|
-
*/
|
|
79
71
|
declare function resolveComponentFrame(frame: ComponentFrame): Promise<void>;
|
|
80
72
|
|
|
81
73
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -67,15 +67,7 @@ declare function resolveElementMeta(meta: ElementMeta): Promise<void>;
|
|
|
67
67
|
|
|
68
68
|
declare function detectComponent(el: Element, customSkip?: Set<string>): ComponentInfo | null;
|
|
69
69
|
declare function detectComponentStack(el: Element, maxDepth?: number, customSkip?: Set<string>): ComponentFrame[];
|
|
70
|
-
/**
|
|
71
|
-
* Resolve source-mapped line numbers for a ComponentInfo that was detected
|
|
72
|
-
* from a _debugStack (React 19+). If the info already has a line number
|
|
73
|
-
* (from _debugSource) or has no pending resolution, this is a no-op.
|
|
74
|
-
*/
|
|
75
70
|
declare function resolveComponentInfo(info: ComponentInfo): Promise<void>;
|
|
76
|
-
/**
|
|
77
|
-
* Resolve source-mapped line numbers for a ComponentFrame.
|
|
78
|
-
*/
|
|
79
71
|
declare function resolveComponentFrame(frame: ComponentFrame): Promise<void>;
|
|
80
72
|
|
|
81
73
|
/**
|
package/dist/react.cjs
CHANGED
|
@@ -1040,9 +1040,9 @@ function parseStackForSource(stack) {
|
|
|
1040
1040
|
if (!stack) return null;
|
|
1041
1041
|
const lines = stack.split("\n");
|
|
1042
1042
|
for (const line of lines) {
|
|
1043
|
-
const match = line.match(/\((
|
|
1043
|
+
const match = line.match(/\((.+):(\d+):(\d+)\)/) || line.match(/at\s+(.+):(\d+):(\d+)/);
|
|
1044
1044
|
if (match) {
|
|
1045
|
-
const rawUrl = match[1];
|
|
1045
|
+
const rawUrl = match[1].trim();
|
|
1046
1046
|
const cleaned = cleanFilePath(rawUrl);
|
|
1047
1047
|
if (isSourceFile(cleaned)) {
|
|
1048
1048
|
const bundledLine = parseInt(match[2], 10);
|
|
@@ -1073,14 +1073,22 @@ function getSourceFromFiber(fiber) {
|
|
|
1073
1073
|
const raw = typeof debugStack === "string" ? debugStack : debugStack?.stack;
|
|
1074
1074
|
const loc = parseStackForSource(raw);
|
|
1075
1075
|
if (loc) {
|
|
1076
|
-
|
|
1076
|
+
const canFetchMap = loc._bundledUrl?.startsWith("http");
|
|
1077
|
+
if (canFetchMap) {
|
|
1078
|
+
prewarmSourceMap(loc._bundledUrl);
|
|
1079
|
+
return {
|
|
1080
|
+
fileName: loc.fileName,
|
|
1081
|
+
lineNumber: null,
|
|
1082
|
+
columnNumber: null,
|
|
1083
|
+
_bundledUrl: loc._bundledUrl,
|
|
1084
|
+
_bundledLine: loc._bundledLine,
|
|
1085
|
+
_bundledCol: loc._bundledCol
|
|
1086
|
+
};
|
|
1087
|
+
}
|
|
1077
1088
|
return {
|
|
1078
1089
|
fileName: loc.fileName,
|
|
1079
|
-
lineNumber: null,
|
|
1080
|
-
columnNumber: null
|
|
1081
|
-
_bundledUrl: loc._bundledUrl,
|
|
1082
|
-
_bundledLine: loc._bundledLine,
|
|
1083
|
-
_bundledCol: loc._bundledCol
|
|
1090
|
+
lineNumber: loc._bundledLine ?? null,
|
|
1091
|
+
columnNumber: loc._bundledCol ?? null
|
|
1084
1092
|
};
|
|
1085
1093
|
}
|
|
1086
1094
|
}
|
|
@@ -1115,7 +1123,7 @@ function getReactComponentInfo(el, customSkip) {
|
|
|
1115
1123
|
const name = cur.type.displayName || cur.type.name;
|
|
1116
1124
|
const src = isFirst && elementSrc ? elementSrc : getSourceFromFiber(cur);
|
|
1117
1125
|
const filePath = src?.fileName ? cleanFilePath(src.fileName) : null;
|
|
1118
|
-
if (name && isUsefulName(name, filePath, customSkip)) {
|
|
1126
|
+
if (name && filePath && isUsefulName(name, filePath, customSkip)) {
|
|
1119
1127
|
const info = {
|
|
1120
1128
|
name,
|
|
1121
1129
|
filePath,
|
|
@@ -1133,7 +1141,7 @@ function getReactComponentInfo(el, customSkip) {
|
|
|
1133
1141
|
const name = inner.displayName || inner.name;
|
|
1134
1142
|
const src = isFirst && elementSrc ? elementSrc : getSourceFromFiber(cur);
|
|
1135
1143
|
const filePath = src?.fileName ? cleanFilePath(src.fileName) : null;
|
|
1136
|
-
if (name && isUsefulName(name, filePath, customSkip)) {
|
|
1144
|
+
if (name && filePath && isUsefulName(name, filePath, customSkip)) {
|
|
1137
1145
|
const info = {
|
|
1138
1146
|
name,
|
|
1139
1147
|
filePath,
|
|
@@ -1172,7 +1180,7 @@ function getReactComponentStack(el, maxDepth = 6, customSkip) {
|
|
|
1172
1180
|
}
|
|
1173
1181
|
}
|
|
1174
1182
|
let filePath = src?.fileName ? cleanFilePath(src.fileName) : null;
|
|
1175
|
-
if (name && isUsefulName(name, filePath, customSkip) && !seen.has(name)) {
|
|
1183
|
+
if (name && filePath && isUsefulName(name, filePath, customSkip) && !seen.has(name)) {
|
|
1176
1184
|
seen.add(name);
|
|
1177
1185
|
const frame = { name, filePath, line: src?.lineNumber ?? null };
|
|
1178
1186
|
if (src) storePendingResolution(frame, src);
|