bippy 0.5.32 → 0.5.34
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/README.md +58 -69
- package/dist/core.cjs +1 -1
- package/dist/core.d.cts +6 -5
- package/dist/core.d.ts +6 -5
- package/dist/core.js +1 -1
- package/dist/core2.d.cts +1 -1
- package/dist/core2.d.ts +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.iife.js +1 -1
- package/dist/install-hook-only.d.cts +1 -1
- package/dist/install-hook-only.iife.js +1 -1
- package/dist/rdt-hook.cjs +1 -1
- package/dist/rdt-hook.js +1 -1
- package/dist/source.cjs +12 -12
- package/dist/source.d.cts +4 -2
- package/dist/source.d.ts +4 -2
- package/dist/source.js +13 -13
- package/package.json +34 -37
- package/src/core.ts +91 -194
- package/src/index.ts +2 -2
- package/src/install-hook-only.ts +1 -1
- package/src/rdt-hook.ts +19 -27
- package/src/source/constants.ts +13 -14
- package/src/source/get-display-name-from-source.ts +10 -20
- package/src/source/get-source.ts +26 -31
- package/src/source/index.ts +6 -6
- package/src/source/owner-stack.ts +83 -127
- package/src/source/parse-stack.ts +46 -92
- package/src/source/symbolication.ts +19 -54
- package/src/types.ts +18 -43
|
@@ -20,28 +20,23 @@ const CHROME_IE_STACK_REGEXP = /^\s*at .*(\S+:\d+|\(native\))/m;
|
|
|
20
20
|
const SAFARI_NATIVE_CODE_REGEXP = /^(eval@)?(\[native code\])?$/;
|
|
21
21
|
|
|
22
22
|
const getNonStandardStacktrace = (error: unknown): string | null => {
|
|
23
|
-
if (error && typeof error ===
|
|
24
|
-
const stacktrace = (error as Record<string, unknown>)[
|
|
25
|
-
return typeof stacktrace ===
|
|
23
|
+
if (error && typeof error === "object") {
|
|
24
|
+
const stacktrace = (error as Record<string, unknown>)["stacktrace"];
|
|
25
|
+
return typeof stacktrace === "string" ? stacktrace : null;
|
|
26
26
|
}
|
|
27
27
|
return null;
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
-
export const parseStack = (
|
|
31
|
-
stackString: string,
|
|
32
|
-
options?: ParseOptions,
|
|
33
|
-
): StackFrame[] => {
|
|
30
|
+
export const parseStack = (stackString: string, options?: ParseOptions): StackFrame[] => {
|
|
34
31
|
if (options?.includeInElement !== false) {
|
|
35
|
-
const lines = stackString.split(
|
|
32
|
+
const lines = stackString.split("\n");
|
|
36
33
|
const frames: StackFrame[] = [];
|
|
37
34
|
for (const rawLine of lines) {
|
|
38
35
|
if (/^\s*at\s+/.test(rawLine)) {
|
|
39
36
|
const parsed = parseV8OrIeString(rawLine, undefined)[0];
|
|
40
37
|
if (parsed) frames.push(parsed);
|
|
41
38
|
} else if (/^\s*in\s+/.test(rawLine)) {
|
|
42
|
-
const elementName = rawLine
|
|
43
|
-
.replace(/^\s*in\s+/, '')
|
|
44
|
-
.replace(/\s*\(at .*\)$/, '');
|
|
39
|
+
const elementName = rawLine.replace(/^\s*in\s+/, "").replace(/\s*\(at .*\)$/, "");
|
|
45
40
|
frames.push({ functionName: elementName, source: rawLine });
|
|
46
41
|
} else if (rawLine.match(FIREFOX_SAFARI_STACK_REGEXP)) {
|
|
47
42
|
const parsed = parseFFOrSafariString(rawLine, undefined)[0];
|
|
@@ -59,13 +54,12 @@ export const parseStack = (
|
|
|
59
54
|
export const extractLocation = (
|
|
60
55
|
urlLike: string,
|
|
61
56
|
): [string, string | undefined, string | undefined] => {
|
|
62
|
-
if (!urlLike.includes(
|
|
57
|
+
if (!urlLike.includes(":")) return [urlLike, undefined, undefined];
|
|
63
58
|
|
|
64
59
|
// HACK: Chrome/V8 stack traces wrap location in parens: "(file.js:10:5)"
|
|
65
60
|
// We need to strip these outer parens but preserve parens in paths (e.g., Next.js route groups like "(docs)")
|
|
66
61
|
// Chrome format always ends with `:col)` where digit comes right before the closing paren
|
|
67
|
-
const isWrappedLocation =
|
|
68
|
-
urlLike.startsWith('(') && /:\d+\)$/.test(urlLike);
|
|
62
|
+
const isWrappedLocation = urlLike.startsWith("(") && /:\d+\)$/.test(urlLike);
|
|
69
63
|
const sanitizedResult = isWrappedLocation ? urlLike.slice(1, -1) : urlLike;
|
|
70
64
|
|
|
71
65
|
const regExp = /(.+?)(?::(\d+))?(?::(\d+))?$/;
|
|
@@ -76,26 +70,19 @@ export const extractLocation = (
|
|
|
76
70
|
|
|
77
71
|
const applySlice = <T>(lines: T[], options?: ParseOptions): T[] => {
|
|
78
72
|
if (options && options.slice != null) {
|
|
79
|
-
if (Array.isArray(options.slice))
|
|
80
|
-
return lines.slice(options.slice[0], options.slice[1]);
|
|
73
|
+
if (Array.isArray(options.slice)) return lines.slice(options.slice[0], options.slice[1]);
|
|
81
74
|
return lines.slice(0, options.slice);
|
|
82
75
|
}
|
|
83
76
|
return lines;
|
|
84
77
|
};
|
|
85
78
|
|
|
86
|
-
export const parseV8OrIE = (
|
|
87
|
-
error: Error,
|
|
88
|
-
options?: ParseOptions,
|
|
89
|
-
): StackFrame[] => {
|
|
79
|
+
export const parseV8OrIE = (error: Error, options?: ParseOptions): StackFrame[] => {
|
|
90
80
|
return parseV8OrIeString(error.stack!, options);
|
|
91
81
|
};
|
|
92
82
|
|
|
93
|
-
export const parseV8OrIeString = (
|
|
94
|
-
stack: string,
|
|
95
|
-
options?: ParseOptions,
|
|
96
|
-
): StackFrame[] => {
|
|
83
|
+
export const parseV8OrIeString = (stack: string, options?: ParseOptions): StackFrame[] => {
|
|
97
84
|
const filteredLines = applySlice(
|
|
98
|
-
stack.split(
|
|
85
|
+
stack.split("\n").filter((line) => {
|
|
99
86
|
return !!line.match(CHROME_IE_STACK_REGEXP);
|
|
100
87
|
}),
|
|
101
88
|
options,
|
|
@@ -103,27 +90,23 @@ export const parseV8OrIeString = (
|
|
|
103
90
|
|
|
104
91
|
return filteredLines.map((line): StackFrame => {
|
|
105
92
|
let currentLine = line;
|
|
106
|
-
if (currentLine.includes(
|
|
93
|
+
if (currentLine.includes("(eval ")) {
|
|
107
94
|
currentLine = currentLine
|
|
108
|
-
.replace(/eval code/g,
|
|
109
|
-
.replace(/(\(eval at [^()]*)|(,.*$)/g,
|
|
95
|
+
.replace(/eval code/g, "eval")
|
|
96
|
+
.replace(/(\(eval at [^()]*)|(,.*$)/g, "");
|
|
110
97
|
}
|
|
111
98
|
let sanitizedLine = currentLine
|
|
112
|
-
.replace(/^\s+/,
|
|
113
|
-
.replace(/\(eval code/g,
|
|
114
|
-
.replace(/^.*?\s+/,
|
|
99
|
+
.replace(/^\s+/, "")
|
|
100
|
+
.replace(/\(eval code/g, "(")
|
|
101
|
+
.replace(/^.*?\s+/, "");
|
|
115
102
|
|
|
116
103
|
const locationMatch = sanitizedLine.match(/ (\(.+\)$)/);
|
|
117
104
|
|
|
118
|
-
sanitizedLine = locationMatch
|
|
119
|
-
? sanitizedLine.replace(locationMatch[0], '')
|
|
120
|
-
: sanitizedLine;
|
|
105
|
+
sanitizedLine = locationMatch ? sanitizedLine.replace(locationMatch[0], "") : sanitizedLine;
|
|
121
106
|
|
|
122
|
-
const locationParts = extractLocation(
|
|
123
|
-
locationMatch ? locationMatch[1] : sanitizedLine,
|
|
124
|
-
);
|
|
107
|
+
const locationParts = extractLocation(locationMatch ? locationMatch[1] : sanitizedLine);
|
|
125
108
|
const functionName = (locationMatch && sanitizedLine) || undefined;
|
|
126
|
-
const fileName = [
|
|
109
|
+
const fileName = ["eval", "<anonymous>"].includes(locationParts[0])
|
|
127
110
|
? undefined
|
|
128
111
|
: locationParts[0];
|
|
129
112
|
|
|
@@ -137,19 +120,13 @@ export const parseV8OrIeString = (
|
|
|
137
120
|
});
|
|
138
121
|
};
|
|
139
122
|
|
|
140
|
-
export const parseFFOrSafari = (
|
|
141
|
-
error: Error,
|
|
142
|
-
options?: ParseOptions,
|
|
143
|
-
): StackFrame[] => {
|
|
123
|
+
export const parseFFOrSafari = (error: Error, options?: ParseOptions): StackFrame[] => {
|
|
144
124
|
return parseFFOrSafariString(error.stack!, options);
|
|
145
125
|
};
|
|
146
126
|
|
|
147
|
-
export const parseFFOrSafariString = (
|
|
148
|
-
stack: string,
|
|
149
|
-
options?: ParseOptions,
|
|
150
|
-
): StackFrame[] => {
|
|
127
|
+
export const parseFFOrSafariString = (stack: string, options?: ParseOptions): StackFrame[] => {
|
|
151
128
|
const filteredLines = applySlice(
|
|
152
|
-
stack.split(
|
|
129
|
+
stack.split("\n").filter((line) => {
|
|
153
130
|
return !line.match(SAFARI_NATIVE_CODE_REGEXP);
|
|
154
131
|
}),
|
|
155
132
|
options,
|
|
@@ -157,13 +134,10 @@ export const parseFFOrSafariString = (
|
|
|
157
134
|
|
|
158
135
|
return filteredLines.map((line): StackFrame => {
|
|
159
136
|
let currentLine = line;
|
|
160
|
-
if (currentLine.includes(
|
|
161
|
-
currentLine = currentLine.replace(
|
|
162
|
-
/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,
|
|
163
|
-
':$1',
|
|
164
|
-
);
|
|
137
|
+
if (currentLine.includes(" > eval"))
|
|
138
|
+
currentLine = currentLine.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g, ":$1");
|
|
165
139
|
|
|
166
|
-
if (!currentLine.includes(
|
|
140
|
+
if (!currentLine.includes("@") && !currentLine.includes(":")) {
|
|
167
141
|
return {
|
|
168
142
|
functionName: currentLine,
|
|
169
143
|
};
|
|
@@ -172,9 +146,7 @@ export const parseFFOrSafariString = (
|
|
|
172
146
|
/(([^\n\r"\u2028\u2029]*".[^\n\r"\u2028\u2029]*"[^\n\r@\u2028\u2029]*(?:@[^\n\r"\u2028\u2029]*"[^\n\r@\u2028\u2029]*)*(?:[\n\r\u2028\u2029][^@]*)?)?[^@]*)@/;
|
|
173
147
|
const matches = currentLine.match(functionNameRegex);
|
|
174
148
|
const functionName = matches && matches[1] ? matches[1] : undefined;
|
|
175
|
-
const locationParts = extractLocation(
|
|
176
|
-
currentLine.replace(functionNameRegex, ''),
|
|
177
|
-
);
|
|
149
|
+
const locationParts = extractLocation(currentLine.replace(functionNameRegex, ""));
|
|
178
150
|
|
|
179
151
|
return {
|
|
180
152
|
functionName,
|
|
@@ -187,16 +159,12 @@ export const parseFFOrSafariString = (
|
|
|
187
159
|
});
|
|
188
160
|
};
|
|
189
161
|
|
|
190
|
-
export const parseOpera = (
|
|
191
|
-
error: Error,
|
|
192
|
-
options?: ParseOptions,
|
|
193
|
-
): StackFrame[] => {
|
|
162
|
+
export const parseOpera = (error: Error, options?: ParseOptions): StackFrame[] => {
|
|
194
163
|
const nonStandardStacktrace = getNonStandardStacktrace(error);
|
|
195
164
|
if (
|
|
196
165
|
!nonStandardStacktrace ||
|
|
197
|
-
(error.message.includes(
|
|
198
|
-
error.message.split(
|
|
199
|
-
nonStandardStacktrace.split('\n').length)
|
|
166
|
+
(error.message.includes("\n") &&
|
|
167
|
+
error.message.split("\n").length > nonStandardStacktrace.split("\n").length)
|
|
200
168
|
) {
|
|
201
169
|
return parseOpera9(error, options);
|
|
202
170
|
}
|
|
@@ -204,12 +172,9 @@ export const parseOpera = (
|
|
|
204
172
|
return parseOpera11(error, options);
|
|
205
173
|
};
|
|
206
174
|
|
|
207
|
-
export const parseOpera9 = (
|
|
208
|
-
error: Error,
|
|
209
|
-
options?: ParseOptions,
|
|
210
|
-
): StackFrame[] => {
|
|
175
|
+
export const parseOpera9 = (error: Error, options?: ParseOptions): StackFrame[] => {
|
|
211
176
|
const lineRegex = /Line (\d+).*script (?:in )?(\S+)/i;
|
|
212
|
-
const messageLines = error.message.split(
|
|
177
|
+
const messageLines = error.message.split("\n");
|
|
213
178
|
const parsedFrames: StackFrame[] = [];
|
|
214
179
|
|
|
215
180
|
for (let i = 2, len = messageLines.length; i < len; i += 2) {
|
|
@@ -226,14 +191,10 @@ export const parseOpera9 = (
|
|
|
226
191
|
return applySlice(parsedFrames, options);
|
|
227
192
|
};
|
|
228
193
|
|
|
229
|
-
export const parseOpera10 = (
|
|
230
|
-
|
|
231
|
-
options?: ParseOptions,
|
|
232
|
-
): StackFrame[] => {
|
|
233
|
-
const lineRegex =
|
|
234
|
-
/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i;
|
|
194
|
+
export const parseOpera10 = (error: Error, options?: ParseOptions): StackFrame[] => {
|
|
195
|
+
const lineRegex = /Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i;
|
|
235
196
|
const nonStandardStacktrace = getNonStandardStacktrace(error);
|
|
236
|
-
const stacktraceLines = (nonStandardStacktrace ||
|
|
197
|
+
const stacktraceLines = (nonStandardStacktrace || "").split("\n");
|
|
237
198
|
const parsedFrames: StackFrame[] = [];
|
|
238
199
|
|
|
239
200
|
for (let i = 0, len = stacktraceLines.length; i < len; i += 2) {
|
|
@@ -251,37 +212,30 @@ export const parseOpera10 = (
|
|
|
251
212
|
return applySlice(parsedFrames, options);
|
|
252
213
|
};
|
|
253
214
|
|
|
254
|
-
export const parseOpera11 = (
|
|
255
|
-
error: Error,
|
|
256
|
-
options?: ParseOptions,
|
|
257
|
-
): StackFrame[] => {
|
|
215
|
+
export const parseOpera11 = (error: Error, options?: ParseOptions): StackFrame[] => {
|
|
258
216
|
const filteredLines = applySlice(
|
|
259
217
|
// @ts-expect-error missing stack property
|
|
260
|
-
error.stack.split(
|
|
261
|
-
return (
|
|
262
|
-
!!line.match(FIREFOX_SAFARI_STACK_REGEXP) &&
|
|
263
|
-
!line.match(/^Error created at/)
|
|
264
|
-
);
|
|
218
|
+
error.stack.split("\n").filter((line) => {
|
|
219
|
+
return !!line.match(FIREFOX_SAFARI_STACK_REGEXP) && !line.match(/^Error created at/);
|
|
265
220
|
}),
|
|
266
221
|
options,
|
|
267
222
|
);
|
|
268
223
|
|
|
269
224
|
return filteredLines.map<StackFrame>((line) => {
|
|
270
|
-
const tokens = line.split(
|
|
225
|
+
const tokens = line.split("@");
|
|
271
226
|
const locationParts = extractLocation(tokens.pop()!);
|
|
272
|
-
const functionCall = tokens.shift() ||
|
|
227
|
+
const functionCall = tokens.shift() || "";
|
|
273
228
|
const functionName =
|
|
274
|
-
functionCall
|
|
275
|
-
|
|
276
|
-
.replace(/\([^)]*\)/g, '') || undefined;
|
|
229
|
+
functionCall.replace(/<anonymous function(: (\w+))?>/, "$2").replace(/\([^)]*\)/g, "") ||
|
|
230
|
+
undefined;
|
|
277
231
|
let argsRaw: string | undefined;
|
|
278
232
|
if (functionCall.match(/\(([^)]*)\)/))
|
|
279
|
-
argsRaw = functionCall.replace(/^[^(]+\(([^)]*)\)$/,
|
|
233
|
+
argsRaw = functionCall.replace(/^[^(]+\(([^)]*)\)$/, "$1");
|
|
280
234
|
|
|
281
235
|
const args =
|
|
282
|
-
argsRaw === undefined || argsRaw ===
|
|
236
|
+
argsRaw === undefined || argsRaw === "[arguments not available]"
|
|
283
237
|
? undefined
|
|
284
|
-
: argsRaw.split(
|
|
238
|
+
: argsRaw.split(",");
|
|
285
239
|
|
|
286
240
|
return {
|
|
287
241
|
functionName,
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
decode,
|
|
3
|
-
SourceMapMappings,
|
|
4
|
-
type SourceMapSegment,
|
|
5
|
-
} from '@jridgewell/sourcemap-codec';
|
|
1
|
+
import { decode, SourceMapMappings, type SourceMapSegment } from "@jridgewell/sourcemap-codec";
|
|
6
2
|
|
|
7
|
-
import { StackFrame } from
|
|
3
|
+
import { StackFrame } from "./parse-stack.js";
|
|
8
4
|
|
|
9
5
|
export interface DecodedSourceMapSection {
|
|
10
6
|
map: {
|
|
@@ -68,16 +64,10 @@ const INLINE_SOURCEMAP_REGEX = /^data:application\/json[^,]+base64,/;
|
|
|
68
64
|
const SOURCEMAP_REGEX =
|
|
69
65
|
/(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^*]+?)[ \t]*(?:\*\/)[ \t]*$)/;
|
|
70
66
|
|
|
71
|
-
const supportsWeakRef = typeof WeakRef !==
|
|
67
|
+
const supportsWeakRef = typeof WeakRef !== "undefined";
|
|
72
68
|
|
|
73
|
-
export const sourceMapCache = new Map<
|
|
74
|
-
|
|
75
|
-
null | SourceMap | WeakRef<SourceMap>
|
|
76
|
-
>();
|
|
77
|
-
const _pendingSourceMapRequests = new Map<
|
|
78
|
-
string,
|
|
79
|
-
null | Promise<null | SourceMap>
|
|
80
|
-
>();
|
|
69
|
+
export const sourceMapCache = new Map<string, null | SourceMap | WeakRef<SourceMap>>();
|
|
70
|
+
const _pendingSourceMapRequests = new Map<string, null | Promise<null | SourceMap>>();
|
|
81
71
|
|
|
82
72
|
const isWeakRefSourceMap = (
|
|
83
73
|
cachedValue: SourceMap | WeakRef<SourceMap>,
|
|
@@ -115,11 +105,7 @@ const getSourceFromMappings = (
|
|
|
115
105
|
|
|
116
106
|
const [, sourceIndex, sourceLine, sourceColumn] = closestLineSegment;
|
|
117
107
|
|
|
118
|
-
if (
|
|
119
|
-
sourceIndex === undefined ||
|
|
120
|
-
sourceLine === undefined ||
|
|
121
|
-
sourceColumn === undefined
|
|
122
|
-
) {
|
|
108
|
+
if (sourceIndex === undefined || sourceLine === undefined || sourceColumn === undefined) {
|
|
123
109
|
return null;
|
|
124
110
|
}
|
|
125
111
|
|
|
@@ -161,9 +147,7 @@ export const getSourceFromSourceMap = (
|
|
|
161
147
|
|
|
162
148
|
const relativeLine = line - targetSection.offset.line;
|
|
163
149
|
const relativeColumn =
|
|
164
|
-
line === targetSection.offset.line
|
|
165
|
-
? column - targetSection.offset.column
|
|
166
|
-
: column;
|
|
150
|
+
line === targetSection.offset.line ? column - targetSection.offset.column : column;
|
|
167
151
|
|
|
168
152
|
return getSourceFromMappings(
|
|
169
153
|
targetSection.map.mappings,
|
|
@@ -173,16 +157,11 @@ export const getSourceFromSourceMap = (
|
|
|
173
157
|
);
|
|
174
158
|
}
|
|
175
159
|
|
|
176
|
-
return getSourceFromMappings(
|
|
177
|
-
sourceMap.mappings,
|
|
178
|
-
sourceMap.sources,
|
|
179
|
-
line - 1,
|
|
180
|
-
column,
|
|
181
|
-
);
|
|
160
|
+
return getSourceFromMappings(sourceMap.mappings, sourceMap.sources, line - 1, column);
|
|
182
161
|
};
|
|
183
162
|
|
|
184
163
|
const getSourceMapUrl = (url: string, content: string): null | string => {
|
|
185
|
-
const lines = content.split(
|
|
164
|
+
const lines = content.split("\n");
|
|
186
165
|
let sourceMapUrl: string | undefined;
|
|
187
166
|
for (let i = lines.length - 1; i >= 0 && !sourceMapUrl; i--) {
|
|
188
167
|
const regexMatch = lines[i].match(SOURCEMAP_REGEX);
|
|
@@ -196,24 +175,16 @@ const getSourceMapUrl = (url: string, content: string): null | string => {
|
|
|
196
175
|
}
|
|
197
176
|
|
|
198
177
|
const hasScheme = SCHEME_REGEX.test(sourceMapUrl);
|
|
199
|
-
if (
|
|
200
|
-
|
|
201
|
-
INLINE_SOURCEMAP_REGEX.test(sourceMapUrl) ||
|
|
202
|
-
hasScheme ||
|
|
203
|
-
sourceMapUrl.startsWith('/')
|
|
204
|
-
)
|
|
205
|
-
) {
|
|
206
|
-
const urlSegments = url.split('/');
|
|
178
|
+
if (!(INLINE_SOURCEMAP_REGEX.test(sourceMapUrl) || hasScheme || sourceMapUrl.startsWith("/"))) {
|
|
179
|
+
const urlSegments = url.split("/");
|
|
207
180
|
urlSegments[urlSegments.length - 1] = sourceMapUrl;
|
|
208
|
-
sourceMapUrl = urlSegments.join(
|
|
181
|
+
sourceMapUrl = urlSegments.join("/");
|
|
209
182
|
}
|
|
210
183
|
|
|
211
184
|
return sourceMapUrl;
|
|
212
185
|
};
|
|
213
186
|
|
|
214
|
-
const decodeStandardSourceMap = (
|
|
215
|
-
rawSourceMap: StandardSourceMap,
|
|
216
|
-
): SourceMap => ({
|
|
187
|
+
const decodeStandardSourceMap = (rawSourceMap: StandardSourceMap): SourceMap => ({
|
|
217
188
|
file: rawSourceMap.file,
|
|
218
189
|
mappings: decode(rawSourceMap.mappings),
|
|
219
190
|
names: rawSourceMap.names,
|
|
@@ -272,7 +243,7 @@ const isFetchableUrl = (url: string): boolean => {
|
|
|
272
243
|
|
|
273
244
|
const scheme = schemeMatch[0].toLowerCase();
|
|
274
245
|
|
|
275
|
-
return scheme ===
|
|
246
|
+
return scheme === "http:" || scheme === "https:";
|
|
276
247
|
};
|
|
277
248
|
|
|
278
249
|
export const getSourceMapImpl = async (
|
|
@@ -312,7 +283,7 @@ export const getSourceMapImpl = async (
|
|
|
312
283
|
}
|
|
313
284
|
const rawSourceMap = (await sourceMapResponse.json()) as RawSourceMap;
|
|
314
285
|
|
|
315
|
-
return
|
|
286
|
+
return "sections" in rawSourceMap
|
|
316
287
|
? decodeIndexSourceMap(rawSourceMap)
|
|
317
288
|
: decodeStandardSourceMap(rawSourceMap);
|
|
318
289
|
} catch {
|
|
@@ -359,10 +330,7 @@ export const getSourceMap = async (
|
|
|
359
330
|
if (sourceMap === null) {
|
|
360
331
|
sourceMapCache.set(file, null);
|
|
361
332
|
} else {
|
|
362
|
-
sourceMapCache.set(
|
|
363
|
-
file,
|
|
364
|
-
supportsWeakRef ? new WeakRef(sourceMap) : sourceMap,
|
|
365
|
-
);
|
|
333
|
+
sourceMapCache.set(file, supportsWeakRef ? new WeakRef(sourceMap) : sourceMap);
|
|
366
334
|
}
|
|
367
335
|
}
|
|
368
336
|
|
|
@@ -380,8 +348,8 @@ export const symbolicateStack = async (
|
|
|
380
348
|
const sourceMap = await getSourceMap(stackFrame.fileName, cache, fetchFn);
|
|
381
349
|
if (
|
|
382
350
|
!sourceMap ||
|
|
383
|
-
typeof stackFrame.lineNumber !==
|
|
384
|
-
typeof stackFrame.columnNumber !==
|
|
351
|
+
typeof stackFrame.lineNumber !== "number" ||
|
|
352
|
+
typeof stackFrame.columnNumber !== "number"
|
|
385
353
|
) {
|
|
386
354
|
return stackFrame;
|
|
387
355
|
}
|
|
@@ -395,10 +363,7 @@ export const symbolicateStack = async (
|
|
|
395
363
|
...stackFrame,
|
|
396
364
|
source:
|
|
397
365
|
symbolicatedSource.fileName && stackFrame.source
|
|
398
|
-
? stackFrame.source.replace(
|
|
399
|
-
stackFrame.fileName,
|
|
400
|
-
symbolicatedSource.fileName,
|
|
401
|
-
)
|
|
366
|
+
? stackFrame.source.replace(stackFrame.fileName, symbolicatedSource.fileName)
|
|
402
367
|
: stackFrame.source,
|
|
403
368
|
fileName: symbolicatedSource.fileName,
|
|
404
369
|
lineNumber: symbolicatedSource.lineNumber,
|
package/src/types.ts
CHANGED
|
@@ -31,7 +31,7 @@ import type {
|
|
|
31
31
|
TransitionTracingCallbacks,
|
|
32
32
|
TypeOfMode,
|
|
33
33
|
WorkTag,
|
|
34
|
-
} from
|
|
34
|
+
} from "react-reconciler";
|
|
35
35
|
|
|
36
36
|
export type {
|
|
37
37
|
BundleType,
|
|
@@ -98,16 +98,16 @@ export interface Family {
|
|
|
98
98
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
99
99
|
export type Fiber<T = any> = Omit<
|
|
100
100
|
ReactFiber,
|
|
101
|
-
|
|
|
102
|
-
|
|
|
103
|
-
|
|
|
104
|
-
|
|
|
105
|
-
|
|
|
106
|
-
|
|
|
107
|
-
|
|
|
108
|
-
|
|
|
109
|
-
|
|
|
110
|
-
|
|
|
101
|
+
| "alternate"
|
|
102
|
+
| "child"
|
|
103
|
+
| "dependencies"
|
|
104
|
+
| "memoizedProps"
|
|
105
|
+
| "memoizedState"
|
|
106
|
+
| "pendingProps"
|
|
107
|
+
| "return"
|
|
108
|
+
| "sibling"
|
|
109
|
+
| "stateNode"
|
|
110
|
+
| "updateQueue"
|
|
111
111
|
> & {
|
|
112
112
|
_debugInfo?: Array<{
|
|
113
113
|
debugLocation?: unknown;
|
|
@@ -158,11 +158,7 @@ export interface ReactDevToolsGlobalHook {
|
|
|
158
158
|
inject: (renderer: ReactRenderer) => number;
|
|
159
159
|
// https://github.com/aidenybai/bippy/issues/43
|
|
160
160
|
on: () => void;
|
|
161
|
-
onCommitFiberRoot: (
|
|
162
|
-
rendererID: number,
|
|
163
|
-
root: FiberRoot,
|
|
164
|
-
priority: number | void,
|
|
165
|
-
) => void;
|
|
161
|
+
onCommitFiberRoot: (rendererID: number, root: FiberRoot, priority: number | void) => void;
|
|
166
162
|
onCommitFiberUnmount: (rendererID: number, fiber: Fiber) => void;
|
|
167
163
|
onPostCommitFiberRoot: (rendererID: number, root: FiberRoot) => void;
|
|
168
164
|
renderers: Map<number, ReactRenderer>;
|
|
@@ -180,24 +176,10 @@ export interface ReactRenderer {
|
|
|
180
176
|
findFiberByHostInstance?: (hostInstance: unknown) => Fiber | null;
|
|
181
177
|
// react devtools
|
|
182
178
|
getCurrentFiber?: (fiber: Fiber) => Fiber | null;
|
|
183
|
-
overrideContext?: (
|
|
184
|
-
fiber: Fiber,
|
|
185
|
-
contextType: unknown,
|
|
186
|
-
path: string[],
|
|
187
|
-
value: unknown,
|
|
188
|
-
) => void;
|
|
179
|
+
overrideContext?: (fiber: Fiber, contextType: unknown, path: string[], value: unknown) => void;
|
|
189
180
|
|
|
190
|
-
overrideHookState?: (
|
|
191
|
-
|
|
192
|
-
id: string,
|
|
193
|
-
path: string[],
|
|
194
|
-
value: unknown,
|
|
195
|
-
) => void;
|
|
196
|
-
overrideHookStateDeletePath?: (
|
|
197
|
-
fiber: Fiber,
|
|
198
|
-
id: number,
|
|
199
|
-
path: Array<number | string>,
|
|
200
|
-
) => void;
|
|
181
|
+
overrideHookState?: (fiber: Fiber, id: string, path: string[], value: unknown) => void;
|
|
182
|
+
overrideHookStateDeletePath?: (fiber: Fiber, id: number, path: Array<number | string>) => void;
|
|
201
183
|
overrideHookStateRenamePath?: (
|
|
202
184
|
fiber: Fiber,
|
|
203
185
|
id: number,
|
|
@@ -205,10 +187,7 @@ export interface ReactRenderer {
|
|
|
205
187
|
newPath: Array<number | string>,
|
|
206
188
|
) => void;
|
|
207
189
|
overrideProps?: (fiber: Fiber, path: string[], value: unknown) => void;
|
|
208
|
-
overridePropsDeletePath?: (
|
|
209
|
-
fiber: Fiber,
|
|
210
|
-
path: Array<number | string>,
|
|
211
|
-
) => void;
|
|
190
|
+
overridePropsDeletePath?: (fiber: Fiber, path: Array<number | string>) => void;
|
|
212
191
|
overridePropsRenamePath?: (
|
|
213
192
|
fiber: Fiber,
|
|
214
193
|
oldPath: Array<number | string>,
|
|
@@ -228,12 +207,8 @@ export interface ReactRenderer {
|
|
|
228
207
|
scheduleUpdate?: (fiber: Fiber) => void;
|
|
229
208
|
|
|
230
209
|
setErrorHandler?: (newShouldErrorImpl: (fiber: Fiber) => boolean) => void;
|
|
231
|
-
setRefreshHandler?: (
|
|
232
|
-
|
|
233
|
-
) => void;
|
|
234
|
-
setSuspenseHandler?: (
|
|
235
|
-
newShouldSuspendImpl: (suspenseInstance: unknown) => void,
|
|
236
|
-
) => void;
|
|
210
|
+
setRefreshHandler?: (handler: ((fiber: Fiber) => Family | null) | null) => void;
|
|
211
|
+
setSuspenseHandler?: (newShouldSuspendImpl: (suspenseInstance: unknown) => void) => void;
|
|
237
212
|
|
|
238
213
|
version: string;
|
|
239
214
|
}
|