rune-grab 0.1.11 → 0.1.13
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/react.cjs +61 -32
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +61 -32
- package/dist/react.js.map +1 -1
- package/dist/rune-grab.cjs +61 -32
- package/dist/rune-grab.cjs.map +1 -1
- package/dist/rune-grab.iife.global.js +21 -21
- package/dist/rune-grab.iife.global.js.map +1 -1
- package/dist/rune-grab.js +61 -32
- package/dist/rune-grab.js.map +1 -1
- package/package.json +1 -1
package/dist/react.js
CHANGED
|
@@ -248,6 +248,9 @@ function isSourceFile(filePath) {
|
|
|
248
248
|
if (!filePath) return false;
|
|
249
249
|
if (isLibraryFile(filePath)) return false;
|
|
250
250
|
if (filePath.startsWith("webpack-internal:///node_modules/")) return false;
|
|
251
|
+
if (filePath.includes("_next/static/")) return false;
|
|
252
|
+
if (filePath.includes(".vite/deps/")) return false;
|
|
253
|
+
if (/^webpack[\w-]*\.js$/.test(filePath) || /[\\/]webpack[\w-]*\.js$/.test(filePath)) return false;
|
|
251
254
|
return true;
|
|
252
255
|
}
|
|
253
256
|
var SKIP_PREFIXES, STYLE_PROPS, STYLE_DEFAULTS, KEEP_ATTRS, Z_OVERLAY, Z_TOOLBAR, OWN_IDS, DRAG_THRESHOLD_PX, HELPER_PORT2, HEALTH_CHECK_TIMEOUT_MS, FLASH_VISIBLE_MS, FLASH_REMOVE_MS, LS_KEY;
|
|
@@ -1010,6 +1013,19 @@ function isUsefulName(name, filePath, customSkip) {
|
|
|
1010
1013
|
if (filePath && !isSourceFile(filePath)) return false;
|
|
1011
1014
|
return true;
|
|
1012
1015
|
}
|
|
1016
|
+
function isCleanComponentName(name, customSkip) {
|
|
1017
|
+
if (!name || name.length <= 1) return false;
|
|
1018
|
+
if (customSkip?.has(name)) return false;
|
|
1019
|
+
if (name[0] !== name[0].toUpperCase()) return false;
|
|
1020
|
+
for (const pfx of SKIP_PREFIXES) {
|
|
1021
|
+
if (name.startsWith(pfx)) return false;
|
|
1022
|
+
}
|
|
1023
|
+
if (/^[A-Z][a-zA-Z]+\d+$/.test(name)) return false;
|
|
1024
|
+
return true;
|
|
1025
|
+
}
|
|
1026
|
+
function isInfraName(name) {
|
|
1027
|
+
return /(?:Provider|Context|Consumer|Boundary|Wrapper|Root|Layout|Suspense)$/i.test(name);
|
|
1028
|
+
}
|
|
1013
1029
|
function cleanFilePath(raw) {
|
|
1014
1030
|
return raw.replace(/^https?:\/\/[^/]+\//, "").replace(/^rsc:\/\/[^/]+\/[^/]+\//, "").replace(/^webpack-internal:\/\/\//, "").replace(/^\([\w-]+\)\//, "").replace(/\?.*$/, "").replace(/^\/app\//, "").replace(/^\.\//, "");
|
|
1015
1031
|
}
|
|
@@ -1094,13 +1110,24 @@ function getReactComponentInfo(el, customSkip) {
|
|
|
1094
1110
|
if (!fiber) return null;
|
|
1095
1111
|
const elementSrc = getSourceFromFiber(fiber);
|
|
1096
1112
|
let isFirst = true;
|
|
1113
|
+
let fallback = null;
|
|
1097
1114
|
let cur = fiber;
|
|
1098
1115
|
while (cur) {
|
|
1116
|
+
let name = null;
|
|
1117
|
+
let src = null;
|
|
1099
1118
|
if (cur.type && typeof cur.type === "function") {
|
|
1100
|
-
|
|
1101
|
-
|
|
1119
|
+
name = cur.type.displayName || cur.type.name;
|
|
1120
|
+
src = isFirst && elementSrc ? elementSrc : getSourceFromFiber(cur);
|
|
1121
|
+
} else if (cur.type?.$$typeof) {
|
|
1122
|
+
const inner = cur.type.render || cur.type.type;
|
|
1123
|
+
name = cur.type.displayName || (inner && typeof inner === "function" ? inner.displayName || inner.name : null) || null;
|
|
1124
|
+
if (name) {
|
|
1125
|
+
src = isFirst && elementSrc ? elementSrc : getSourceFromFiber(cur);
|
|
1126
|
+
}
|
|
1127
|
+
}
|
|
1128
|
+
if (name) {
|
|
1102
1129
|
const filePath = src?.fileName ? cleanFilePath(src.fileName) : null;
|
|
1103
|
-
if (
|
|
1130
|
+
if (filePath && isUsefulName(name, filePath, customSkip)) {
|
|
1104
1131
|
const info = {
|
|
1105
1132
|
name,
|
|
1106
1133
|
filePath,
|
|
@@ -1110,29 +1137,21 @@ function getReactComponentInfo(el, customSkip) {
|
|
|
1110
1137
|
if (src) storePendingResolution(info, src);
|
|
1111
1138
|
return info;
|
|
1112
1139
|
}
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
const src = isFirst && elementSrc ? elementSrc : getSourceFromFiber(cur);
|
|
1120
|
-
const filePath = src?.fileName ? cleanFilePath(src.fileName) : null;
|
|
1121
|
-
if (name && filePath && isUsefulName(name, filePath, customSkip)) {
|
|
1122
|
-
const info = {
|
|
1123
|
-
name,
|
|
1124
|
-
filePath,
|
|
1125
|
-
line: src?.lineNumber ?? null,
|
|
1126
|
-
column: src?.columnNumber ?? null
|
|
1127
|
-
};
|
|
1128
|
-
if (src) storePendingResolution(info, src);
|
|
1129
|
-
return info;
|
|
1130
|
-
}
|
|
1131
|
-
isFirst = false;
|
|
1140
|
+
if (!fallback && isCleanComponentName(name, customSkip) && !isInfraName(name)) {
|
|
1141
|
+
const validPath = filePath && isSourceFile(filePath) ? filePath : null;
|
|
1142
|
+
fallback = {
|
|
1143
|
+
info: { name, filePath: validPath, line: validPath ? src?.lineNumber ?? null : null, column: validPath ? src?.columnNumber ?? null : null },
|
|
1144
|
+
src: src || null
|
|
1145
|
+
};
|
|
1132
1146
|
}
|
|
1147
|
+
isFirst = false;
|
|
1133
1148
|
}
|
|
1134
1149
|
cur = cur.return;
|
|
1135
1150
|
}
|
|
1151
|
+
if (fallback) {
|
|
1152
|
+
if (fallback.src) storePendingResolution(fallback.info, fallback.src);
|
|
1153
|
+
return fallback.info;
|
|
1154
|
+
}
|
|
1136
1155
|
return null;
|
|
1137
1156
|
}
|
|
1138
1157
|
function getReactComponentStack(el, maxDepth = 6, customSkip) {
|
|
@@ -1140,7 +1159,9 @@ function getReactComponentStack(el, maxDepth = 6, customSkip) {
|
|
|
1140
1159
|
if (!fiber) return [];
|
|
1141
1160
|
const elementSrc = getSourceFromFiber(fiber);
|
|
1142
1161
|
const stack = [];
|
|
1162
|
+
const fallbackStack = [];
|
|
1143
1163
|
const seen = /* @__PURE__ */ new Set();
|
|
1164
|
+
const fallbackSeen = /* @__PURE__ */ new Set();
|
|
1144
1165
|
let cur = fiber;
|
|
1145
1166
|
let isFirst = true;
|
|
1146
1167
|
while (cur && stack.length < maxDepth) {
|
|
@@ -1151,22 +1172,30 @@ function getReactComponentStack(el, maxDepth = 6, customSkip) {
|
|
|
1151
1172
|
src = isFirst && elementSrc ? elementSrc : getSourceFromFiber(cur);
|
|
1152
1173
|
} else if (cur.type?.$$typeof) {
|
|
1153
1174
|
const inner = cur.type.render || cur.type.type;
|
|
1154
|
-
|
|
1155
|
-
|
|
1175
|
+
name = cur.type.displayName || (inner && typeof inner === "function" ? inner.displayName || inner.name : null) || null;
|
|
1176
|
+
if (name) {
|
|
1156
1177
|
src = isFirst && elementSrc ? elementSrc : getSourceFromFiber(cur);
|
|
1157
1178
|
}
|
|
1158
1179
|
}
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
seen.
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1180
|
+
if (name) {
|
|
1181
|
+
let filePath = src?.fileName ? cleanFilePath(src.fileName) : null;
|
|
1182
|
+
if (filePath && isUsefulName(name, filePath, customSkip) && !seen.has(name)) {
|
|
1183
|
+
seen.add(name);
|
|
1184
|
+
const frame = { name, filePath, line: src?.lineNumber ?? null };
|
|
1185
|
+
if (src) storePendingResolution(frame, src);
|
|
1186
|
+
stack.push(frame);
|
|
1187
|
+
isFirst = false;
|
|
1188
|
+
} else if (fallbackStack.length < maxDepth && isCleanComponentName(name, customSkip) && !isInfraName(name) && !fallbackSeen.has(name)) {
|
|
1189
|
+
fallbackSeen.add(name);
|
|
1190
|
+
const validPath = filePath && isSourceFile(filePath) ? filePath : null;
|
|
1191
|
+
const frame = { name, filePath: validPath, line: validPath ? src?.lineNumber ?? null : null };
|
|
1192
|
+
if (src) storePendingResolution(frame, src);
|
|
1193
|
+
fallbackStack.push(frame);
|
|
1194
|
+
}
|
|
1166
1195
|
}
|
|
1167
1196
|
cur = cur.return;
|
|
1168
1197
|
}
|
|
1169
|
-
return stack;
|
|
1198
|
+
return stack.length > 0 ? stack : fallbackStack;
|
|
1170
1199
|
}
|
|
1171
1200
|
function getVueComponentInfo(el) {
|
|
1172
1201
|
let cur = el;
|