rune-grab 0.1.1 → 0.1.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.d.cts +0 -8
- package/dist/index.d.ts +0 -8
- package/dist/react.cjs +17 -9
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +17 -9
- package/dist/react.js.map +1 -1
- package/dist/rune-grab.cjs +17 -9
- 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 +17 -9
- 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
|
@@ -1034,15 +1034,15 @@ function isUsefulName(name, filePath, customSkip) {
|
|
|
1034
1034
|
return true;
|
|
1035
1035
|
}
|
|
1036
1036
|
function cleanFilePath(raw) {
|
|
1037
|
-
return raw.replace(/^https?:\/\/[^/]+\//, "").replace(
|
|
1037
|
+
return raw.replace(/^https?:\/\/[^/]+\//, "").replace(/^rsc:\/\/[^/]+\/[^/]+\//, "").replace(/^webpack-internal:\/\/\//, "").replace(/^\([\w-]+\)\//, "").replace(/\?.*$/, "").replace(/^\/app\//, "").replace(/^\.\//, "");
|
|
1038
1038
|
}
|
|
1039
1039
|
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
|
}
|