@impakers/debug 1.3.11 → 1.3.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.js +45 -17
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +45 -17
- package/dist/react.mjs.map +1 -1
- package/package.json +1 -1
package/dist/react.mjs
CHANGED
|
@@ -2087,30 +2087,58 @@ 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 debugLog = typeof window !== "undefined" && window.__IMPAKERS_DEBUG_LOG;
|
|
2109
|
+
const directMapUrl = bundleUrl.endsWith(".map") ? bundleUrl : `${bundleUrl}.map`;
|
|
2098
2110
|
try {
|
|
2099
|
-
const res = await fetch(
|
|
2100
|
-
if (
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2111
|
+
const res = await fetch(directMapUrl, { cache: "force-cache" });
|
|
2112
|
+
if (debugLog) console.log("[impakers-debug] 1\uCC28 .map fetch:", res.status, directMapUrl);
|
|
2113
|
+
if (res.ok) {
|
|
2114
|
+
const rawMap = await res.json();
|
|
2115
|
+
const traceMap = new AnyMap(rawMap);
|
|
2116
|
+
cache2.set(bundleUrl, traceMap);
|
|
2117
|
+
return traceMap;
|
|
2104
2118
|
}
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
cache2.set(bundleUrl, traceMap);
|
|
2108
|
-
return traceMap;
|
|
2109
|
-
} catch {
|
|
2110
|
-
failedUrls.add(bundleUrl);
|
|
2111
|
-
cache2.set(bundleUrl, null);
|
|
2112
|
-
return null;
|
|
2119
|
+
} catch (e) {
|
|
2120
|
+
if (debugLog) console.log("[impakers-debug] 1\uCC28 .map fetch exception:", e);
|
|
2113
2121
|
}
|
|
2122
|
+
if (debugLog) console.log("[impakers-debug] 2\uCC28 \uC2DC\uB3C4: JS\uC5D0\uC11C sourceMappingURL \uCD94\uCD9C...");
|
|
2123
|
+
const actualMapUrl = await getSourceMapUrlFromBundle(bundleUrl);
|
|
2124
|
+
if (debugLog) console.log("[impakers-debug] 2\uCC28 actualMapUrl:", actualMapUrl);
|
|
2125
|
+
if (actualMapUrl) {
|
|
2126
|
+
try {
|
|
2127
|
+
const res = await fetch(actualMapUrl, { cache: "force-cache" });
|
|
2128
|
+
if (debugLog) console.log("[impakers-debug] 2\uCC28 .map fetch:", res.status, actualMapUrl);
|
|
2129
|
+
if (res.ok) {
|
|
2130
|
+
const rawMap = await res.json();
|
|
2131
|
+
const traceMap = new AnyMap(rawMap);
|
|
2132
|
+
cache2.set(bundleUrl, traceMap);
|
|
2133
|
+
return traceMap;
|
|
2134
|
+
}
|
|
2135
|
+
} catch (e) {
|
|
2136
|
+
if (debugLog) console.log("[impakers-debug] 2\uCC28 .map fetch exception:", e);
|
|
2137
|
+
}
|
|
2138
|
+
}
|
|
2139
|
+
failedUrls.add(bundleUrl);
|
|
2140
|
+
cache2.set(bundleUrl, null);
|
|
2141
|
+
return null;
|
|
2114
2142
|
}
|
|
2115
2143
|
async function resolveSourcePosition(bundlePath, line, column) {
|
|
2116
2144
|
let bundleUrl;
|