@impakers/debug 1.3.10 → 1.3.12
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.js +50 -29
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +50 -29
- package/dist/react.mjs.map +1 -1
- package/package.json +1 -1
package/dist/react.mjs
CHANGED
|
@@ -1354,6 +1354,8 @@ function parseComponentFrame(stack) {
|
|
|
1354
1354
|
/source-location/,
|
|
1355
1355
|
/\/dist\/index\./,
|
|
1356
1356
|
// Our bundled output (dist/index.mjs, dist/index.js)
|
|
1357
|
+
/\/dist\/react\./,
|
|
1358
|
+
// Our React bundled output
|
|
1357
1359
|
/node_modules\//,
|
|
1358
1360
|
// Any package in node_modules (dev mode)
|
|
1359
1361
|
/react-dom/,
|
|
@@ -1368,26 +1370,24 @@ function parseComponentFrame(stack) {
|
|
|
1368
1370
|
];
|
|
1369
1371
|
const v8Re = /^\s*at\s+(?:.*?\s+\()?(.+?):(\d+):(\d+)\)?$/;
|
|
1370
1372
|
const webkitRe = /^[^@]*@(.+?):(\d+):(\d+)$/;
|
|
1371
|
-
let
|
|
1373
|
+
let validCount = 0;
|
|
1372
1374
|
for (const line of lines) {
|
|
1373
1375
|
const trimmed = line.trim();
|
|
1374
1376
|
if (!trimmed) continue;
|
|
1375
|
-
if (skipPatterns.some((p) => p.test(trimmed)))
|
|
1376
|
-
if (/at <anonymous>:/.test(trimmed) && lastValid) {
|
|
1377
|
-
return lastValid;
|
|
1378
|
-
}
|
|
1379
|
-
continue;
|
|
1380
|
-
}
|
|
1377
|
+
if (skipPatterns.some((p) => p.test(trimmed))) continue;
|
|
1381
1378
|
const match = v8Re.exec(trimmed) || webkitRe.exec(trimmed);
|
|
1382
1379
|
if (match) {
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1380
|
+
validCount++;
|
|
1381
|
+
if (validCount >= 3) {
|
|
1382
|
+
return {
|
|
1383
|
+
fileName: match[1],
|
|
1384
|
+
line: parseInt(match[2], 10),
|
|
1385
|
+
column: parseInt(match[3], 10)
|
|
1386
|
+
};
|
|
1387
|
+
}
|
|
1388
1388
|
}
|
|
1389
1389
|
}
|
|
1390
|
-
return
|
|
1390
|
+
return null;
|
|
1391
1391
|
}
|
|
1392
1392
|
function cleanSourcePath(rawPath) {
|
|
1393
1393
|
let path = rawPath;
|
|
@@ -2087,30 +2087,51 @@ async function updateTaskStatus(endpoint, taskId, status) {
|
|
|
2087
2087
|
import { AnyMap, originalPositionFor } from "@jridgewell/trace-mapping";
|
|
2088
2088
|
var cache2 = /* @__PURE__ */ new Map();
|
|
2089
2089
|
var failedUrls = /* @__PURE__ */ new Set();
|
|
2090
|
-
function
|
|
2091
|
-
|
|
2092
|
-
|
|
2090
|
+
async function getSourceMapUrlFromBundle(bundleUrl) {
|
|
2091
|
+
try {
|
|
2092
|
+
const res = await fetch(bundleUrl, { cache: "force-cache" });
|
|
2093
|
+
if (!res.ok) return null;
|
|
2094
|
+
const text = await res.text();
|
|
2095
|
+
const match = text.match(/\/\/[#@]\s*sourceMappingURL\s*=\s*(\S+)\s*$/m);
|
|
2096
|
+
if (!match) return null;
|
|
2097
|
+
const mapRef = match[1];
|
|
2098
|
+
if (mapRef.startsWith("http")) return mapRef;
|
|
2099
|
+
const base = bundleUrl.substring(0, bundleUrl.lastIndexOf("/") + 1);
|
|
2100
|
+
return base + mapRef;
|
|
2101
|
+
} catch {
|
|
2102
|
+
return null;
|
|
2103
|
+
}
|
|
2093
2104
|
}
|
|
2094
2105
|
async function loadSourceMap(bundleUrl) {
|
|
2095
2106
|
if (cache2.has(bundleUrl)) return cache2.get(bundleUrl) ?? null;
|
|
2096
2107
|
if (failedUrls.has(bundleUrl)) return null;
|
|
2097
|
-
const
|
|
2108
|
+
const directMapUrl = bundleUrl.endsWith(".map") ? bundleUrl : `${bundleUrl}.map`;
|
|
2098
2109
|
try {
|
|
2099
|
-
const res = await fetch(
|
|
2100
|
-
if (
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2110
|
+
const res = await fetch(directMapUrl, { cache: "force-cache" });
|
|
2111
|
+
if (res.ok) {
|
|
2112
|
+
const rawMap = await res.json();
|
|
2113
|
+
const traceMap = new AnyMap(rawMap);
|
|
2114
|
+
cache2.set(bundleUrl, traceMap);
|
|
2115
|
+
return traceMap;
|
|
2104
2116
|
}
|
|
2105
|
-
const rawMap = await res.json();
|
|
2106
|
-
const traceMap = new AnyMap(rawMap);
|
|
2107
|
-
cache2.set(bundleUrl, traceMap);
|
|
2108
|
-
return traceMap;
|
|
2109
2117
|
} catch {
|
|
2110
|
-
failedUrls.add(bundleUrl);
|
|
2111
|
-
cache2.set(bundleUrl, null);
|
|
2112
|
-
return null;
|
|
2113
2118
|
}
|
|
2119
|
+
const actualMapUrl = await getSourceMapUrlFromBundle(bundleUrl);
|
|
2120
|
+
if (actualMapUrl) {
|
|
2121
|
+
try {
|
|
2122
|
+
const res = await fetch(actualMapUrl, { cache: "force-cache" });
|
|
2123
|
+
if (res.ok) {
|
|
2124
|
+
const rawMap = await res.json();
|
|
2125
|
+
const traceMap = new AnyMap(rawMap);
|
|
2126
|
+
cache2.set(bundleUrl, traceMap);
|
|
2127
|
+
return traceMap;
|
|
2128
|
+
}
|
|
2129
|
+
} catch {
|
|
2130
|
+
}
|
|
2131
|
+
}
|
|
2132
|
+
failedUrls.add(bundleUrl);
|
|
2133
|
+
cache2.set(bundleUrl, null);
|
|
2134
|
+
return null;
|
|
2114
2135
|
}
|
|
2115
2136
|
async function resolveSourcePosition(bundlePath, line, column) {
|
|
2116
2137
|
let bundleUrl;
|