@impakers/debug 1.3.11 → 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 +37 -16
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +37 -16
- package/dist/react.mjs.map +1 -1
- package/package.json +1 -1
package/dist/react.js
CHANGED
|
@@ -2121,30 +2121,51 @@ async function updateTaskStatus(endpoint, taskId, status) {
|
|
|
2121
2121
|
var import_trace_mapping = require("@jridgewell/trace-mapping");
|
|
2122
2122
|
var cache2 = /* @__PURE__ */ new Map();
|
|
2123
2123
|
var failedUrls = /* @__PURE__ */ new Set();
|
|
2124
|
-
function
|
|
2125
|
-
|
|
2126
|
-
|
|
2124
|
+
async function getSourceMapUrlFromBundle(bundleUrl) {
|
|
2125
|
+
try {
|
|
2126
|
+
const res = await fetch(bundleUrl, { cache: "force-cache" });
|
|
2127
|
+
if (!res.ok) return null;
|
|
2128
|
+
const text = await res.text();
|
|
2129
|
+
const match = text.match(/\/\/[#@]\s*sourceMappingURL\s*=\s*(\S+)\s*$/m);
|
|
2130
|
+
if (!match) return null;
|
|
2131
|
+
const mapRef = match[1];
|
|
2132
|
+
if (mapRef.startsWith("http")) return mapRef;
|
|
2133
|
+
const base = bundleUrl.substring(0, bundleUrl.lastIndexOf("/") + 1);
|
|
2134
|
+
return base + mapRef;
|
|
2135
|
+
} catch {
|
|
2136
|
+
return null;
|
|
2137
|
+
}
|
|
2127
2138
|
}
|
|
2128
2139
|
async function loadSourceMap(bundleUrl) {
|
|
2129
2140
|
if (cache2.has(bundleUrl)) return cache2.get(bundleUrl) ?? null;
|
|
2130
2141
|
if (failedUrls.has(bundleUrl)) return null;
|
|
2131
|
-
const
|
|
2142
|
+
const directMapUrl = bundleUrl.endsWith(".map") ? bundleUrl : `${bundleUrl}.map`;
|
|
2132
2143
|
try {
|
|
2133
|
-
const res = await fetch(
|
|
2134
|
-
if (
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2144
|
+
const res = await fetch(directMapUrl, { cache: "force-cache" });
|
|
2145
|
+
if (res.ok) {
|
|
2146
|
+
const rawMap = await res.json();
|
|
2147
|
+
const traceMap = new import_trace_mapping.AnyMap(rawMap);
|
|
2148
|
+
cache2.set(bundleUrl, traceMap);
|
|
2149
|
+
return traceMap;
|
|
2138
2150
|
}
|
|
2139
|
-
const rawMap = await res.json();
|
|
2140
|
-
const traceMap = new import_trace_mapping.AnyMap(rawMap);
|
|
2141
|
-
cache2.set(bundleUrl, traceMap);
|
|
2142
|
-
return traceMap;
|
|
2143
2151
|
} catch {
|
|
2144
|
-
failedUrls.add(bundleUrl);
|
|
2145
|
-
cache2.set(bundleUrl, null);
|
|
2146
|
-
return null;
|
|
2147
2152
|
}
|
|
2153
|
+
const actualMapUrl = await getSourceMapUrlFromBundle(bundleUrl);
|
|
2154
|
+
if (actualMapUrl) {
|
|
2155
|
+
try {
|
|
2156
|
+
const res = await fetch(actualMapUrl, { cache: "force-cache" });
|
|
2157
|
+
if (res.ok) {
|
|
2158
|
+
const rawMap = await res.json();
|
|
2159
|
+
const traceMap = new import_trace_mapping.AnyMap(rawMap);
|
|
2160
|
+
cache2.set(bundleUrl, traceMap);
|
|
2161
|
+
return traceMap;
|
|
2162
|
+
}
|
|
2163
|
+
} catch {
|
|
2164
|
+
}
|
|
2165
|
+
}
|
|
2166
|
+
failedUrls.add(bundleUrl);
|
|
2167
|
+
cache2.set(bundleUrl, null);
|
|
2168
|
+
return null;
|
|
2148
2169
|
}
|
|
2149
2170
|
async function resolveSourcePosition(bundlePath, line, column) {
|
|
2150
2171
|
let bundleUrl;
|