bippy 0.6.1-dev.3702582 → 0.6.1-dev.4ed5147
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 +176 -483
- package/dist/core.cjs +1 -1
- package/dist/core.d.cts +7 -52
- package/dist/core.d.ts +7 -52
- package/dist/core.js +1 -1
- package/dist/core2.cjs +1 -1
- package/dist/core2.d.cts +2 -2
- package/dist/core2.d.ts +2 -2
- package/dist/core2.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +5 -2
- package/dist/index.d.ts +5 -2
- package/dist/index.js +1 -1
- package/dist/rdt-hook.cjs +1 -1
- package/dist/rdt-hook.js +1 -1
- package/dist/source.cjs +8 -8
- package/dist/source.d.cts +3 -1
- package/dist/source.d.ts +3 -1
- package/dist/source.js +12 -12
- package/package.json +6 -3
- package/src/core.ts +37 -374
- package/src/index.ts +1 -0
- package/src/react.ts +76 -0
- package/src/source/get-display-name-from-source.ts +13 -12
- package/src/source/get-source.ts +34 -3
- package/src/source/index.ts +2 -0
- package/src/source/owner-stack.ts +6 -2
- package/src/source/parse-stack.ts +1 -1
- package/src/source/symbolication.ts +218 -54
- package/dist/index.iife.js +0 -9
- package/dist/install-hook-only.iife.js +0 -9
package/src/source/get-source.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Fiber } from "../react-internals/index.js";
|
|
2
|
+
import { getDisplayName } from "../core.js";
|
|
2
3
|
|
|
3
4
|
import type { FiberSource } from "./types.js";
|
|
4
5
|
import {
|
|
@@ -12,8 +13,13 @@ import {
|
|
|
12
13
|
} from "./constants.js";
|
|
13
14
|
import { getDefinitionFrameFromOwnedChild, getParentStack, hasDebugStack } from "./owner-stack.js";
|
|
14
15
|
import { parseDebugStack } from "./parse-debug-stack.js";
|
|
15
|
-
import { StackFrame } from "./parse-stack.js";
|
|
16
|
-
import {
|
|
16
|
+
import { parseStack, type StackFrame } from "./parse-stack.js";
|
|
17
|
+
import {
|
|
18
|
+
getSourceFromSourceMapByFunctionName,
|
|
19
|
+
getSourceMap,
|
|
20
|
+
symbolicateStack,
|
|
21
|
+
type SourceFetch,
|
|
22
|
+
} from "./symbolication.js";
|
|
17
23
|
|
|
18
24
|
export const hasDebugSource = (
|
|
19
25
|
fiber: Fiber,
|
|
@@ -27,6 +33,7 @@ export const hasDebugSource = (
|
|
|
27
33
|
return (
|
|
28
34
|
typeof debugSource === "object" &&
|
|
29
35
|
typeof debugSource.fileName === "string" &&
|
|
36
|
+
debugSource.fileName !== "(native)" &&
|
|
30
37
|
typeof debugSource.lineNumber === "number"
|
|
31
38
|
);
|
|
32
39
|
};
|
|
@@ -60,6 +67,30 @@ const getUsageFrameFromDebugStack = (fiber: Fiber): StackFrame | null => {
|
|
|
60
67
|
return null;
|
|
61
68
|
};
|
|
62
69
|
|
|
70
|
+
const getSourceByComponentName = async (
|
|
71
|
+
fiber: Fiber,
|
|
72
|
+
cache: boolean,
|
|
73
|
+
fetchFn: SourceFetch | undefined,
|
|
74
|
+
): Promise<FiberSource | null> => {
|
|
75
|
+
const functionName = getDisplayName(fiber.type);
|
|
76
|
+
if (!functionName) return null;
|
|
77
|
+
|
|
78
|
+
const runtimeStackFrames = parseStack(new Error().stack ?? "");
|
|
79
|
+
const visitedFileNames = new Set<string>();
|
|
80
|
+
for (const stackFrame of runtimeStackFrames) {
|
|
81
|
+
const fileName = stackFrame.fileName;
|
|
82
|
+
if (!fileName || visitedFileNames.has(fileName)) {
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
visitedFileNames.add(fileName);
|
|
86
|
+
const sourceMap = await getSourceMap(fileName, cache, fetchFn);
|
|
87
|
+
if (!sourceMap) continue;
|
|
88
|
+
const source = getSourceFromSourceMapByFunctionName(sourceMap, functionName);
|
|
89
|
+
if (source && !source.isIgnoreListed) return toFiberSource(source);
|
|
90
|
+
}
|
|
91
|
+
return null;
|
|
92
|
+
};
|
|
93
|
+
|
|
63
94
|
/**
|
|
64
95
|
* Returns the source of where the component is used. Available only in dev, for composite {@link Fiber}s.
|
|
65
96
|
*
|
|
@@ -111,7 +142,7 @@ export const getSource = async (
|
|
|
111
142
|
return toFiberSource(stackFrame);
|
|
112
143
|
}
|
|
113
144
|
}
|
|
114
|
-
return
|
|
145
|
+
return getSourceByComponentName(fiber, cache, fetchFn);
|
|
115
146
|
};
|
|
116
147
|
|
|
117
148
|
const getPathSegmentCount = (path: string): number => path.split("/").filter(Boolean).length;
|
package/src/source/index.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export { formatOwnerStack, getOwnerStack, getParentStack, hasDebugStack } from "./owner-stack.js";
|
|
2
2
|
export { getSource, isSourceFile, normalizeFileName } from "./get-source.js";
|
|
3
3
|
export {
|
|
4
|
+
getSourceContentFromSourceMap,
|
|
4
5
|
getSourceFromSourceMap,
|
|
6
|
+
getSourceFromSourceMapByFunctionName,
|
|
5
7
|
getSourceMap,
|
|
6
8
|
symbolicateStack,
|
|
7
9
|
type DecodedSourceMapSection,
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
} from "./constants.js";
|
|
14
14
|
import { getPrepareStackTrace, setPrepareStackTrace } from "./error-stack.js";
|
|
15
15
|
import { parseDebugStack } from "./parse-debug-stack.js";
|
|
16
|
-
import { parseStack, StackFrame } from "./parse-stack.js";
|
|
16
|
+
import { parseStack, type StackFrame } from "./parse-stack.js";
|
|
17
17
|
import {
|
|
18
18
|
getRendererDispatcherRefs,
|
|
19
19
|
readDispatcher,
|
|
@@ -272,6 +272,10 @@ const describeNativeComponentFrame = (
|
|
|
272
272
|
if (controlIndex < 0 || sampleLines[sampleIndex] !== controlLines[controlIndex]) {
|
|
273
273
|
// V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
|
|
274
274
|
let stackFrame = `\n${sampleLines[sampleIndex].replace(" at new ", " at ")}`;
|
|
275
|
+
const [parsedStackFrame] = parseStack(stackFrame);
|
|
276
|
+
if (!parsedStackFrame?.fileName) {
|
|
277
|
+
continue;
|
|
278
|
+
}
|
|
275
279
|
|
|
276
280
|
const displayName = getDisplayName(component);
|
|
277
281
|
// If our component frame is labeled "<anonymous>"
|
|
@@ -322,7 +326,7 @@ export const describeFiber = (fiber: Fiber, childFiber: Fiber | null): string =>
|
|
|
322
326
|
break;
|
|
323
327
|
case workTags.FunctionComponent:
|
|
324
328
|
case workTags.SimpleMemoComponent:
|
|
325
|
-
stackFrame = describeNativeComponentFrame(fiber.type, false);
|
|
329
|
+
stackFrame = describeNativeComponentFrame(getType(fiber.type) ?? fiber.type, false);
|
|
326
330
|
break;
|
|
327
331
|
case workTags.HostComponent:
|
|
328
332
|
case workTags.HostHoistable:
|
|
@@ -86,7 +86,7 @@ export const parseV8OrIeString = (stack: string): StackFrame[] => {
|
|
|
86
86
|
|
|
87
87
|
const locationParts = extractLocation(locationMatch ? locationMatch[1] : sanitizedLine);
|
|
88
88
|
const functionName = (locationMatch && sanitizedLine) || undefined;
|
|
89
|
-
const fileName = ["eval", "<anonymous>"].includes(locationParts[0])
|
|
89
|
+
const fileName = ["eval", "<anonymous>", "(native)"].includes(locationParts[0])
|
|
90
90
|
? undefined
|
|
91
91
|
: locationParts[0];
|
|
92
92
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { decode, SourceMapMappings, type SourceMapSegment } from "@jridgewell/sourcemap-codec";
|
|
1
|
+
import { decode, type SourceMapMappings, type SourceMapSegment } from "@jridgewell/sourcemap-codec";
|
|
2
2
|
|
|
3
3
|
import { BippySourceMapError } from "../errors.js";
|
|
4
4
|
import { SCHEME_REGEX } from "./constants.js";
|
|
5
|
-
import { StackFrame } from "./parse-stack.js";
|
|
5
|
+
import type { StackFrame } from "./parse-stack.js";
|
|
6
6
|
|
|
7
7
|
export interface DecodedSourceMapSection {
|
|
8
8
|
map: {
|
|
@@ -90,6 +90,35 @@ const pendingSourceMapRequestsByFetch = new WeakMap<
|
|
|
90
90
|
>();
|
|
91
91
|
const defaultMaxBundleSizeBytes = 25 * 1024 * 1024;
|
|
92
92
|
const defaultMaxSourceMapSizeBytes = 100 * 1024 * 1024;
|
|
93
|
+
const extensionProtocols = new Set([
|
|
94
|
+
"chrome-extension:",
|
|
95
|
+
"moz-extension:",
|
|
96
|
+
"safari-web-extension:",
|
|
97
|
+
]);
|
|
98
|
+
const defaultFetchableProtocols = new Set(["http:", "https:", ...extensionProtocols]);
|
|
99
|
+
|
|
100
|
+
const getSourceFromSegment = (
|
|
101
|
+
segment: SourceMapSegment,
|
|
102
|
+
sources: string[],
|
|
103
|
+
ignoredSourceIndices?: Set<number>,
|
|
104
|
+
names?: string[],
|
|
105
|
+
): StackFrame | null => {
|
|
106
|
+
const [, sourceIndex, sourceLine, sourceColumn, nameIndex] = segment;
|
|
107
|
+
if (sourceIndex === undefined || sourceLine === undefined || sourceColumn === undefined) {
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const fileName = sources[sourceIndex];
|
|
112
|
+
if (!fileName) return null;
|
|
113
|
+
|
|
114
|
+
return {
|
|
115
|
+
columnNumber: sourceColumn,
|
|
116
|
+
fileName,
|
|
117
|
+
functionName: nameIndex === undefined ? undefined : names?.[nameIndex] || undefined,
|
|
118
|
+
isIgnoreListed: ignoredSourceIndices?.has(sourceIndex) ?? false,
|
|
119
|
+
lineNumber: sourceLine + 1,
|
|
120
|
+
};
|
|
121
|
+
};
|
|
93
122
|
|
|
94
123
|
const getSourceFromMappings = (
|
|
95
124
|
mappings: SourceMapMappings,
|
|
@@ -97,6 +126,7 @@ const getSourceFromMappings = (
|
|
|
97
126
|
lineIndexInMappings: number,
|
|
98
127
|
column: number,
|
|
99
128
|
ignoredSourceIndices?: Set<number>,
|
|
129
|
+
names?: string[],
|
|
100
130
|
): StackFrame | null => {
|
|
101
131
|
if (lineIndexInMappings < 0 || lineIndexInMappings >= mappings.length) {
|
|
102
132
|
return null;
|
|
@@ -124,24 +154,7 @@ const getSourceFromMappings = (
|
|
|
124
154
|
return null;
|
|
125
155
|
}
|
|
126
156
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
if (sourceIndex === undefined || sourceLine === undefined || sourceColumn === undefined) {
|
|
130
|
-
return null;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
const fileName = sources[sourceIndex];
|
|
134
|
-
|
|
135
|
-
if (!fileName) {
|
|
136
|
-
return null;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
return {
|
|
140
|
-
columnNumber: sourceColumn,
|
|
141
|
-
fileName,
|
|
142
|
-
lineNumber: sourceLine + 1,
|
|
143
|
-
isIgnoreListed: ignoredSourceIndices?.has(sourceIndex) ?? false,
|
|
144
|
-
};
|
|
157
|
+
return getSourceFromSegment(closestLineSegment, sources, ignoredSourceIndices, names);
|
|
145
158
|
};
|
|
146
159
|
|
|
147
160
|
export const getSourceFromSourceMap = (
|
|
@@ -178,6 +191,7 @@ export const getSourceFromSourceMap = (
|
|
|
178
191
|
relativeLine,
|
|
179
192
|
relativeColumn,
|
|
180
193
|
targetSection.map.ignoredSourceIndices,
|
|
194
|
+
targetSection.map.names,
|
|
181
195
|
);
|
|
182
196
|
}
|
|
183
197
|
|
|
@@ -187,6 +201,61 @@ export const getSourceFromSourceMap = (
|
|
|
187
201
|
line - 1,
|
|
188
202
|
column,
|
|
189
203
|
sourceMap.ignoredSourceIndices,
|
|
204
|
+
sourceMap.names,
|
|
205
|
+
);
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
const getSourceFromMappingsByFunctionName = (
|
|
209
|
+
mappings: SourceMapMappings,
|
|
210
|
+
sources: string[],
|
|
211
|
+
names: string[] | undefined,
|
|
212
|
+
functionName: string,
|
|
213
|
+
ignoredSourceIndices?: Set<number>,
|
|
214
|
+
): StackFrame | null => {
|
|
215
|
+
if (!names) return null;
|
|
216
|
+
const functionNameIndex = names.indexOf(functionName);
|
|
217
|
+
if (functionNameIndex === -1) return null;
|
|
218
|
+
|
|
219
|
+
let ignoredSource: StackFrame | null = null;
|
|
220
|
+
for (const lineMapping of mappings) {
|
|
221
|
+
for (const segment of lineMapping) {
|
|
222
|
+
if (segment[4] !== functionNameIndex) continue;
|
|
223
|
+
const source = getSourceFromSegment(segment, sources, ignoredSourceIndices, names);
|
|
224
|
+
if (!source) continue;
|
|
225
|
+
if (!source.isIgnoreListed) return source;
|
|
226
|
+
ignoredSource ??= source;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
return ignoredSource;
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
export const getSourceFromSourceMapByFunctionName = (
|
|
233
|
+
sourceMap: SourceMap,
|
|
234
|
+
functionName: string,
|
|
235
|
+
): StackFrame | null => {
|
|
236
|
+
if (sourceMap.sections) {
|
|
237
|
+
let ignoredSource: StackFrame | null = null;
|
|
238
|
+
for (const section of sourceMap.sections) {
|
|
239
|
+
const source = getSourceFromMappingsByFunctionName(
|
|
240
|
+
section.map.mappings,
|
|
241
|
+
section.map.sources,
|
|
242
|
+
section.map.names,
|
|
243
|
+
functionName,
|
|
244
|
+
section.map.ignoredSourceIndices,
|
|
245
|
+
);
|
|
246
|
+
if (!source) continue;
|
|
247
|
+
if (!source.isIgnoreListed) return source;
|
|
248
|
+
ignoredSource ??= source;
|
|
249
|
+
}
|
|
250
|
+
return ignoredSource;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
return getSourceFromMappingsByFunctionName(
|
|
254
|
+
sourceMap.mappings,
|
|
255
|
+
sourceMap.sources,
|
|
256
|
+
sourceMap.names,
|
|
257
|
+
functionName,
|
|
258
|
+
sourceMap.ignoredSourceIndices,
|
|
190
259
|
);
|
|
191
260
|
};
|
|
192
261
|
|
|
@@ -197,29 +266,28 @@ const findSourceContentByFileName = (
|
|
|
197
266
|
): string | null => {
|
|
198
267
|
if (!sourcesContent) return null;
|
|
199
268
|
const sourceIndex = sources.indexOf(fileName);
|
|
200
|
-
return sourceIndex
|
|
269
|
+
return sourceIndex === -1 ? null : (sourcesContent[sourceIndex] ?? null);
|
|
201
270
|
};
|
|
202
271
|
|
|
203
272
|
export const getSourceContentFromSourceMap = (
|
|
204
273
|
sourceMap: SourceMap,
|
|
205
274
|
originalFileName: string,
|
|
206
275
|
): string | null => {
|
|
207
|
-
const
|
|
276
|
+
const sourceContent = findSourceContentByFileName(
|
|
208
277
|
sourceMap.sources,
|
|
209
278
|
sourceMap.sourcesContent,
|
|
210
279
|
originalFileName,
|
|
211
280
|
);
|
|
212
|
-
if (
|
|
213
|
-
|
|
214
|
-
if (sourceMap.sections)
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
}
|
|
281
|
+
if (sourceContent !== null) return sourceContent;
|
|
282
|
+
|
|
283
|
+
if (!sourceMap.sections) return null;
|
|
284
|
+
for (const section of sourceMap.sections) {
|
|
285
|
+
const sectionSourceContent = findSourceContentByFileName(
|
|
286
|
+
section.map.sources,
|
|
287
|
+
section.map.sourcesContent,
|
|
288
|
+
originalFileName,
|
|
289
|
+
);
|
|
290
|
+
if (sectionSourceContent !== null) return sectionSourceContent;
|
|
223
291
|
}
|
|
224
292
|
return null;
|
|
225
293
|
};
|
|
@@ -238,12 +306,43 @@ const resolveUrl = (reference: string, baseUrl: string): string | null => {
|
|
|
238
306
|
}
|
|
239
307
|
};
|
|
240
308
|
|
|
241
|
-
const
|
|
309
|
+
const getMetroSourceMapUrl = (bundleUrl: string): string | null => {
|
|
310
|
+
try {
|
|
311
|
+
const parsedBundleUrl = new URL(bundleUrl);
|
|
312
|
+
const bundleExtensionIndex = parsedBundleUrl.pathname.lastIndexOf(".bundle");
|
|
313
|
+
if (bundleExtensionIndex === -1) return null;
|
|
314
|
+
const embeddedSearch = parsedBundleUrl.pathname.slice(bundleExtensionIndex + ".bundle".length);
|
|
315
|
+
if (embeddedSearch && !embeddedSearch.startsWith("//&")) return null;
|
|
316
|
+
parsedBundleUrl.pathname = `${parsedBundleUrl.pathname.slice(0, bundleExtensionIndex)}.map`;
|
|
317
|
+
if (embeddedSearch) {
|
|
318
|
+
const embeddedSearchParameters = new URLSearchParams(embeddedSearch.slice("//&".length));
|
|
319
|
+
for (const [parameterName, parameterValue] of embeddedSearchParameters) {
|
|
320
|
+
parsedBundleUrl.searchParams.set(parameterName, parameterValue);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
parsedBundleUrl.hash = "";
|
|
324
|
+
return parsedBundleUrl.toString();
|
|
325
|
+
} catch {
|
|
326
|
+
return null;
|
|
327
|
+
}
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
const getSourceMapUrl = (
|
|
331
|
+
bundleUrl: string,
|
|
332
|
+
bundleContent: string,
|
|
333
|
+
bundleResponse: Response,
|
|
334
|
+
): null | string => {
|
|
335
|
+
const sourceMapHeader =
|
|
336
|
+
bundleResponse.headers.get("sourcemap") ?? bundleResponse.headers.get("x-sourcemap");
|
|
337
|
+
if (sourceMapHeader) {
|
|
338
|
+
return resolveUrl(sourceMapHeader.trim(), bundleUrl);
|
|
339
|
+
}
|
|
340
|
+
|
|
242
341
|
let sourceMapUrl: string | undefined;
|
|
243
|
-
let searchEnd =
|
|
342
|
+
let searchEnd = bundleContent.length;
|
|
244
343
|
while (searchEnd > 0 && !sourceMapUrl) {
|
|
245
|
-
const lineStart =
|
|
246
|
-
const regexMatch =
|
|
344
|
+
const lineStart = bundleContent.lastIndexOf("\n", searchEnd - 1) + 1;
|
|
345
|
+
const regexMatch = bundleContent.slice(lineStart, searchEnd).match(SOURCEMAP_REGEX);
|
|
247
346
|
if (regexMatch) {
|
|
248
347
|
sourceMapUrl = regexMatch[1] || regexMatch[2];
|
|
249
348
|
}
|
|
@@ -251,10 +350,10 @@ const getSourceMapUrl = (url: string, content: string): null | string => {
|
|
|
251
350
|
}
|
|
252
351
|
|
|
253
352
|
if (!sourceMapUrl) {
|
|
254
|
-
return
|
|
353
|
+
return getMetroSourceMapUrl(bundleUrl);
|
|
255
354
|
}
|
|
256
355
|
|
|
257
|
-
return resolveUrl(sourceMapUrl,
|
|
356
|
+
return resolveUrl(sourceMapUrl, bundleUrl);
|
|
258
357
|
};
|
|
259
358
|
|
|
260
359
|
const isStandardSourceMap = (value: unknown): value is StandardSourceMap => {
|
|
@@ -440,7 +539,7 @@ const decodeIndexSourceMap = async (
|
|
|
440
539
|
};
|
|
441
540
|
};
|
|
442
541
|
|
|
443
|
-
const isFetchableUrl = (url: string): boolean => {
|
|
542
|
+
const isFetchableUrl = (url: string, shouldAllowCustomProtocol = false): boolean => {
|
|
444
543
|
if (!url) {
|
|
445
544
|
return false;
|
|
446
545
|
}
|
|
@@ -459,7 +558,7 @@ const isFetchableUrl = (url: string): boolean => {
|
|
|
459
558
|
|
|
460
559
|
const scheme = schemeMatch[0].toLowerCase();
|
|
461
560
|
|
|
462
|
-
return
|
|
561
|
+
return shouldAllowCustomProtocol || defaultFetchableProtocols.has(scheme);
|
|
463
562
|
};
|
|
464
563
|
|
|
465
564
|
const isServerRuntime = (): boolean =>
|
|
@@ -480,14 +579,53 @@ const isAbsoluteHttpUrl = (url: string): boolean => {
|
|
|
480
579
|
}
|
|
481
580
|
};
|
|
482
581
|
|
|
582
|
+
const getUrlProtocol = (url: string): string | null => {
|
|
583
|
+
try {
|
|
584
|
+
return new URL(url).protocol;
|
|
585
|
+
} catch {
|
|
586
|
+
return null;
|
|
587
|
+
}
|
|
588
|
+
};
|
|
589
|
+
|
|
590
|
+
const isExtensionUrl = (url: string): boolean => {
|
|
591
|
+
const protocol = getUrlProtocol(url);
|
|
592
|
+
return protocol !== null && extensionProtocols.has(protocol);
|
|
593
|
+
};
|
|
594
|
+
|
|
483
595
|
const isSameOrigin = (firstUrl: string, secondUrl: string): boolean => {
|
|
484
596
|
try {
|
|
485
|
-
|
|
597
|
+
const firstParsedUrl = new URL(firstUrl);
|
|
598
|
+
const secondParsedUrl = new URL(secondUrl);
|
|
599
|
+
return (
|
|
600
|
+
firstParsedUrl.protocol === secondParsedUrl.protocol &&
|
|
601
|
+
firstParsedUrl.host === secondParsedUrl.host
|
|
602
|
+
);
|
|
486
603
|
} catch {
|
|
487
604
|
return false;
|
|
488
605
|
}
|
|
489
606
|
};
|
|
490
607
|
|
|
608
|
+
const isAllowedSourceMapUrl = (
|
|
609
|
+
bundleUrl: string,
|
|
610
|
+
sourceMapUrl: string,
|
|
611
|
+
shouldRejectCrossOrigin: boolean,
|
|
612
|
+
shouldAllowCustomProtocol: boolean,
|
|
613
|
+
): boolean => {
|
|
614
|
+
if (INLINE_SOURCEMAP_REGEX.test(sourceMapUrl)) return true;
|
|
615
|
+
if (!isFetchableUrl(sourceMapUrl, shouldAllowCustomProtocol)) return false;
|
|
616
|
+
const bundleProtocol = getUrlProtocol(bundleUrl);
|
|
617
|
+
const sourceMapProtocol = getUrlProtocol(sourceMapUrl);
|
|
618
|
+
const hasCustomProtocol =
|
|
619
|
+
(bundleProtocol !== null && !defaultFetchableProtocols.has(bundleProtocol)) ||
|
|
620
|
+
(sourceMapProtocol !== null && !defaultFetchableProtocols.has(sourceMapProtocol));
|
|
621
|
+
const shouldRequireSameOrigin =
|
|
622
|
+
shouldRejectCrossOrigin ||
|
|
623
|
+
hasCustomProtocol ||
|
|
624
|
+
isExtensionUrl(bundleUrl) ||
|
|
625
|
+
isExtensionUrl(sourceMapUrl);
|
|
626
|
+
return !shouldRequireSameOrigin || isSameOrigin(bundleUrl, sourceMapUrl);
|
|
627
|
+
};
|
|
628
|
+
|
|
491
629
|
const isTransientHttpStatus = (status: number): boolean =>
|
|
492
630
|
status === 408 || status === 425 || status === 429 || status >= 500;
|
|
493
631
|
|
|
@@ -499,6 +637,13 @@ const assertResponseIsCacheable = (response: Response): boolean => {
|
|
|
499
637
|
return false;
|
|
500
638
|
};
|
|
501
639
|
|
|
640
|
+
const isResponseUrlAllowed = (
|
|
641
|
+
requestedUrl: string,
|
|
642
|
+
response: Response,
|
|
643
|
+
shouldRejectCrossOrigin: boolean,
|
|
644
|
+
): boolean =>
|
|
645
|
+
!shouldRejectCrossOrigin || response.url.length === 0 || isSameOrigin(requestedUrl, response.url);
|
|
646
|
+
|
|
502
647
|
interface RequestSignal {
|
|
503
648
|
cleanup: () => void;
|
|
504
649
|
signal?: AbortSignal;
|
|
@@ -534,7 +679,10 @@ const readResponseText = async (
|
|
|
534
679
|
): Promise<string | null> => {
|
|
535
680
|
const contentLength = Number(response.headers.get("content-length"));
|
|
536
681
|
if (Number.isFinite(contentLength) && contentLength > maxSizeBytes) return null;
|
|
537
|
-
if (!response.body)
|
|
682
|
+
if (!response.body) {
|
|
683
|
+
const responseText = await response.text();
|
|
684
|
+
return new TextEncoder().encode(responseText).byteLength > maxSizeBytes ? null : responseText;
|
|
685
|
+
}
|
|
538
686
|
|
|
539
687
|
const reader = response.body.getReader();
|
|
540
688
|
const decoder = new TextDecoder();
|
|
@@ -622,6 +770,7 @@ const readSourceMapDocument = async (
|
|
|
622
770
|
signal,
|
|
623
771
|
});
|
|
624
772
|
if (!assertResponseIsCacheable(sourceMapResponse)) return null;
|
|
773
|
+
if (!isResponseUrlAllowed(sourceMapUrl, sourceMapResponse, shouldRejectRedirects)) return null;
|
|
625
774
|
const sourceMapContent = await readResponseText(sourceMapResponse, maxSizeBytes);
|
|
626
775
|
if (sourceMapContent === null) return null;
|
|
627
776
|
try {
|
|
@@ -636,16 +785,16 @@ const getSourceMapUncachedInternal = async (
|
|
|
636
785
|
fetchFn?: SourceFetch,
|
|
637
786
|
options: SourceMapRequestOptions = {},
|
|
638
787
|
): Promise<null | SourceMap> => {
|
|
639
|
-
|
|
788
|
+
const shouldAllowCustomProtocol = fetchFn !== undefined;
|
|
789
|
+
if (!isFetchableUrl(bundleUrl, shouldAllowCustomProtocol)) {
|
|
640
790
|
return null;
|
|
641
791
|
}
|
|
642
792
|
|
|
643
|
-
const
|
|
644
|
-
|
|
645
|
-
|
|
793
|
+
const isServer = isServerRuntime();
|
|
794
|
+
const shouldRejectRedirects = isServer || isExtensionUrl(bundleUrl);
|
|
795
|
+
if (isServer && !fetchFn) {
|
|
796
|
+
if (!options.allowUnsafeServerFetch || !isAbsoluteHttpUrl(bundleUrl)) return null;
|
|
646
797
|
}
|
|
647
|
-
const isBlockedCrossOriginUrl = (url: string): boolean =>
|
|
648
|
-
shouldRejectRedirects && !INLINE_SOURCEMAP_REGEX.test(url) && !isSameOrigin(bundleUrl, url);
|
|
649
798
|
|
|
650
799
|
const sourceFetch =
|
|
651
800
|
fetchFn ??
|
|
@@ -661,12 +810,19 @@ const getSourceMapUncachedInternal = async (
|
|
|
661
810
|
signal: requestSignal.signal,
|
|
662
811
|
});
|
|
663
812
|
if (!assertResponseIsCacheable(bundleResponse)) return null;
|
|
813
|
+
if (!isResponseUrlAllowed(bundleUrl, bundleResponse, shouldRejectRedirects)) return null;
|
|
664
814
|
const bundleContent = await readResponseText(bundleResponse, maxBundleSizeBytes);
|
|
665
|
-
if (
|
|
666
|
-
const sourceMapUrl = getSourceMapUrl(bundleUrl, bundleContent);
|
|
815
|
+
if (bundleContent === null) return null;
|
|
816
|
+
const sourceMapUrl = getSourceMapUrl(bundleUrl, bundleContent, bundleResponse);
|
|
667
817
|
if (!sourceMapUrl) return null;
|
|
668
|
-
if (
|
|
669
|
-
|
|
818
|
+
if (
|
|
819
|
+
!isAllowedSourceMapUrl(
|
|
820
|
+
bundleUrl,
|
|
821
|
+
sourceMapUrl,
|
|
822
|
+
shouldRejectRedirects,
|
|
823
|
+
shouldAllowCustomProtocol,
|
|
824
|
+
)
|
|
825
|
+
) {
|
|
670
826
|
return null;
|
|
671
827
|
}
|
|
672
828
|
|
|
@@ -682,7 +838,14 @@ const getSourceMapUncachedInternal = async (
|
|
|
682
838
|
}
|
|
683
839
|
if (!isIndexSourceMap(rawSourceMap)) return null;
|
|
684
840
|
return decodeIndexSourceMap(rawSourceMap, sourceMapUrl, async (sectionUrl) => {
|
|
685
|
-
if (
|
|
841
|
+
if (
|
|
842
|
+
!isAllowedSourceMapUrl(
|
|
843
|
+
bundleUrl,
|
|
844
|
+
sectionUrl,
|
|
845
|
+
shouldRejectRedirects,
|
|
846
|
+
shouldAllowCustomProtocol,
|
|
847
|
+
)
|
|
848
|
+
) {
|
|
686
849
|
return null;
|
|
687
850
|
}
|
|
688
851
|
const sectionSourceMap = await readSourceMapDocument(
|
|
@@ -813,6 +976,7 @@ export const symbolicateStack = async (
|
|
|
813
976
|
? stackFrame.source.replace(stackFrame.fileName, symbolicatedSource.fileName)
|
|
814
977
|
: stackFrame.source,
|
|
815
978
|
fileName: symbolicatedSource.fileName,
|
|
979
|
+
functionName: symbolicatedSource.functionName ?? stackFrame.functionName,
|
|
816
980
|
lineNumber: symbolicatedSource.lineNumber,
|
|
817
981
|
columnNumber: symbolicatedSource.columnNumber,
|
|
818
982
|
isIgnoreListed: symbolicatedSource.isIgnoreListed,
|
package/dist/index.iife.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license bippy
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) Aiden Bai
|
|
5
|
-
*
|
|
6
|
-
* This source code is licensed under the MIT license found in the
|
|
7
|
-
* LICENSE file in the root directory of this source tree.
|
|
8
|
-
*/
|
|
9
|
-
var Bippy=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});let t=`0.6.1-dev.3702582`,n=`bippy-${t}`,r=Object.defineProperty,i=()=>{},a=e=>Object.assign(e,{[Symbol.dispose]:e}),o=e=>{try{Function.prototype.toString.call(e).indexOf(`^_^`)>-1&&setTimeout(()=>{throw Error(`React is running in production mode, but dead code elimination has not been applied. Read how to correctly configure React for production: https://react.dev/link/perf-use-production-build`)})}catch{}},s=(e=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__)=>!!(e&&`getFiberRoots`in e),c=new Set,l=new Set,u=new Set,d=new Set,ee=new WeakSet,te=new WeakMap,ne=()=>{for(let e of c)e()},re=e=>{for(let t of u)t(e)},ie=e=>{for(let t of d)t(e)},ae=e=>{if(e.inject===te.get(e))return;let t=e.inject,n=n=>{let r=t.call(e,n);return ee.has(n)||(ee.add(n),re(n)),r};e.inject=n,te.set(e,n)},f=e=>(ae(_()),u.add(e),a(()=>{u.delete(e)})),oe=e=>(d.add(e),a(()=>{d.delete(e)})),p=e=>(e.renderers instanceof Map||(e.renderers=new Map),e.renderers),se=(e,t,n,r)=>{t.set(n,r),l.add(r),e._instrumentationIsActive||(e._instrumentationIsActive=!0,ne())},m=e=>{e&&c.add(e);let t=new Map,a=0,s={_instrumentationIsActive:!1,_instrumentationSource:n,checkDCE:o,hasUnsupportedRendererAttached:!1,inject:e=>{let n=++a;return se(s,t,n,e),n},on:i,onCommitFiberRoot:i,onCommitFiberUnmount:i,onPostCommitFiberRoot:i,renderers:t,supportsFiber:!0,supportsFlight:!0};try{if(r(globalThis,`__REACT_DEVTOOLS_GLOBAL_HOOK__`,{configurable:!0,enumerable:!0,get(){return s},set(t){if(t&&typeof t==`object`){let n=s.renderers;s=t;let r=p(s);n.forEach((e,t)=>{l.add(e),r.set(t,e)}),(n.size>0||d.size>0)&&h(e),ie(s)}}}),typeof window<`u`){let e=window.hasOwnProperty.bind(window),t=Object.getOwnPropertyDescriptor(window,`hasOwnProperty`),n=!1,i=()=>{t?r(window,`hasOwnProperty`,t):Reflect.deleteProperty(window,`hasOwnProperty`)};r(window,`hasOwnProperty`,{configurable:!0,value:t=>!n&&t===`__REACT_DEVTOOLS_GLOBAL_HOOK__`?(n=!0,i(),globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__=void 0,!1):e(t),writable:!0})}}catch{h(e)}return s},h=e=>{e&&c.add(e);let t=!1,r=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!r)return;let a=p(r);if(!r._instrumentationSource){r.checkDCE=o,r.supportsFiber=!0,r.supportsFlight=!0,r.hasUnsupportedRendererAttached=!1,r._instrumentationSource=n,r._instrumentationIsActive=!1,s(r)||(r.on=i),a.size&&(a.forEach(e=>l.add(e)),r._instrumentationIsActive=!0,ne(),t=!0);let e=r.inject;r.inject=t=>{let n=e.call(r,t);return se(r,a,n,t),n}}!t&&(a.size||r._instrumentationIsActive)&&e?.()},g=()=>Object.hasOwn(globalThis,`__REACT_DEVTOOLS_GLOBAL_HOOK__`),_=e=>g()?(h(e),globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__??m(e)):m(e);_();let ce=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/,v=/^\d+$/,le=e=>y(e)!==null,y=e=>{let t=ce.exec(e);if(!t)return null;let n=t[4]?.split(`.`)??[];return n.some(e=>v.test(e)&&e.length>1&&e.startsWith(`0`))?null:{major:t[1],minor:t[2],patch:t[3],prerelease:n}},b=(e,t)=>e.length===t.length?e===t?0:e<t?-1:1:e.length<t.length?-1:1,ue=(e,t)=>{let n=v.test(e),r=v.test(t);return n&&r?b(e,t):n===r?e===t?0:e<t?-1:1:n?-1:1},de=(e,t)=>{if(e.length===0||t.length===0)return e.length===t.length?0:e.length===0?1:-1;let n=Math.max(e.length,t.length);for(let r=0;r<n;r++){let n=e[r],i=t[r];if(n===void 0||i===void 0)return n===void 0?-1:1;let a=ue(n,i);if(a!==0)return a}return 0},fe=(e,t)=>{let n=y(e),r=y(t);if(!n||!r)return null;let i=b(n.major,r.major);if(i!==0)return i;let a=b(n.minor,r.minor);if(a!==0)return a;let o=b(n.patch,r.patch);return o===0?de(n.prerelease,r.prerelease):o},pe={Development:1,Production:0},x={ChildDeletion:16,Cloned:8,ContentReset:32,Hydrating:4096,PerformedWork:1,Placement:2,Snapshot:1024,Update:4,Visibility:8192},S={CONCURRENT_MODE_NUMBER:60111,CONCURRENT_MODE_SYMBOL_DESCRIPTION:`react.concurrent_mode`,CONCURRENT_MODE_SYMBOL_STRING:`Symbol(react.concurrent_mode)`,DEPRECATED_ASYNC_MODE_SYMBOL_DESCRIPTION:`react.async_mode`,DEPRECATED_ASYNC_MODE_SYMBOL_STRING:`Symbol(react.async_mode)`,ELEMENT_SYMBOL_STRING:`Symbol(react.transitional.element)`,LEGACY_ELEMENT_SYMBOL_STRING:`Symbol(react.element)`},C=(e=>e)({"16.0.0":{ActivityComponent:-1,CacheComponent:-1,ClassComponent:2,ContextConsumer:12,ContextProvider:13,CoroutineComponent:7,CoroutineHandlerPhase:8,DehydratedSuspenseComponent:-1,ForwardRef:14,Fragment:10,FunctionComponent:1,HostComponent:5,HostHoistable:-1,HostPortal:4,HostRoot:3,HostSingleton:-1,HostText:6,IncompleteClassComponent:-1,IncompleteFunctionComponent:-1,IndeterminateComponent:0,LazyComponent:-1,LegacyHiddenComponent:-1,MemoComponent:-1,Mode:11,OffscreenComponent:-1,Profiler:15,ScopeComponent:-1,SimpleMemoComponent:-1,SuspenseComponent:16,SuspenseListComponent:-1,Throw:-1,TracingMarkerComponent:-1,ViewTransitionComponent:-1,YieldComponent:9},"16.4.3-alpha":{ActivityComponent:-1,CacheComponent:-1,ClassComponent:2,ContextConsumer:11,ContextProvider:12,CoroutineComponent:-1,CoroutineHandlerPhase:-1,DehydratedSuspenseComponent:-1,ForwardRef:13,Fragment:9,FunctionComponent:0,HostComponent:7,HostHoistable:-1,HostPortal:6,HostRoot:5,HostSingleton:-1,HostText:8,IncompleteClassComponent:-1,IncompleteFunctionComponent:-1,IndeterminateComponent:4,LazyComponent:-1,LegacyHiddenComponent:-1,MemoComponent:-1,Mode:10,OffscreenComponent:-1,Profiler:15,ScopeComponent:-1,SimpleMemoComponent:-1,SuspenseComponent:16,SuspenseListComponent:-1,Throw:-1,TracingMarkerComponent:-1,ViewTransitionComponent:-1,YieldComponent:-1},"16.6.0-beta.0":{ActivityComponent:-1,CacheComponent:-1,ClassComponent:1,ContextConsumer:9,ContextProvider:10,CoroutineComponent:-1,CoroutineHandlerPhase:-1,DehydratedSuspenseComponent:18,ForwardRef:11,Fragment:7,FunctionComponent:0,HostComponent:5,HostHoistable:-1,HostPortal:4,HostRoot:3,HostSingleton:-1,HostText:6,IncompleteClassComponent:17,IncompleteFunctionComponent:-1,IndeterminateComponent:2,LazyComponent:16,LegacyHiddenComponent:-1,MemoComponent:14,Mode:8,OffscreenComponent:-1,Profiler:12,ScopeComponent:-1,SimpleMemoComponent:15,SuspenseComponent:13,SuspenseListComponent:19,Throw:-1,TracingMarkerComponent:-1,ViewTransitionComponent:-1,YieldComponent:-1},"17.0.0-alpha":{ActivityComponent:-1,CacheComponent:-1,ClassComponent:1,ContextConsumer:9,ContextProvider:10,CoroutineComponent:-1,CoroutineHandlerPhase:-1,DehydratedSuspenseComponent:18,ForwardRef:11,Fragment:7,FunctionComponent:0,HostComponent:5,HostHoistable:-1,HostPortal:4,HostRoot:3,HostSingleton:-1,HostText:6,IncompleteClassComponent:17,IncompleteFunctionComponent:-1,IndeterminateComponent:2,LazyComponent:16,LegacyHiddenComponent:24,MemoComponent:14,Mode:8,OffscreenComponent:23,Profiler:12,ScopeComponent:21,SimpleMemoComponent:15,SuspenseComponent:13,SuspenseListComponent:19,Throw:-1,TracingMarkerComponent:-1,ViewTransitionComponent:-1,YieldComponent:-1},"17.0.2":{ActivityComponent:31,CacheComponent:24,ClassComponent:1,ContextConsumer:9,ContextProvider:10,CoroutineComponent:-1,CoroutineHandlerPhase:-1,DehydratedSuspenseComponent:18,ForwardRef:11,Fragment:7,FunctionComponent:0,HostComponent:5,HostHoistable:26,HostPortal:4,HostRoot:3,HostSingleton:27,HostText:6,IncompleteClassComponent:17,IncompleteFunctionComponent:28,IndeterminateComponent:2,LazyComponent:16,LegacyHiddenComponent:23,MemoComponent:14,Mode:8,OffscreenComponent:22,Profiler:12,ScopeComponent:21,SimpleMemoComponent:15,SuspenseComponent:13,SuspenseListComponent:19,Throw:29,TracingMarkerComponent:25,ViewTransitionComponent:30,YieldComponent:-1}}),me=[{isMinimumExcluded:!0,minimumVersion:`17.0.1`,workTags:C[`17.0.2`]},{isMinimumExcluded:!1,minimumVersion:`17.0.0-alpha`,workTags:C[`17.0.0-alpha`]},{isMinimumExcluded:!1,minimumVersion:`16.6.0-beta.0`,workTags:C[`16.6.0-beta.0`]},{isMinimumExcluded:!1,minimumVersion:`16.4.3-alpha`,workTags:C[`16.4.3-alpha`]}],he=C[`17.0.2`],w=e=>{if(e===void 0)return he;for(let t of me){let n=fe(e,t.minimumVersion);if(n===null)return he;if(n===1||n===0&&!t.isMinimumExcluded)return t.workTags}return C[`16.0.0`]},ge=w(),T=new WeakMap,_e=e=>{let t=e?.reconcilerVersion;return t&&le(t)?w(t):e?.version?w(e.version):ge},ve=(e,t)=>{let n=_e(t);T.set(e,n),e.alternate&&T.set(e.alternate,n)},E=e=>{let t=T.get(e);if(t)return t;let n=[e],r=e;for(;r.return;)r=r.return,n.push(r);let i=T.get(r)??ge;for(let e of n)T.set(e,i),e.alternate&&T.set(e.alternate,i);return i},ye=x.Placement|x.Update|x.ChildDeletion|x.ContentReset|x.Hydrating|x.Visibility|x.Snapshot;var D=class extends Error{constructor(e,t){super(e,{cause:t}),this.name=`BippyError`}},O=class extends D{constructor(e,t){super(e,t),this.name=`BippyHookInspectionError`}},be=class extends O{constructor(e,t){super(e,t),this.name=`BippyUnsupportedHookError`}},xe=class extends O{constructor(e,t){super(e,t),this.name=`BippyHookRenderError`}},Se=class extends D{constructor(e,t){super(e,t),this.name=`BippySourceMapError`}};let Ce=e=>typeof e==`function`,k=e=>{let t=`displayName`in e?e.displayName:null;if(typeof t==`string`&&t)return t;let n=`name`in e?e.name:null;return typeof n==`string`&&n?n:null},we=e=>typeof e==`object`&&!!e&&`$$typeof`in e&&(String(e.$$typeof)===S.LEGACY_ELEMENT_SYMBOL_STRING||String(e.$$typeof)===S.ELEMENT_SYMBOL_STRING),A=e=>typeof e==`object`&&!!e&&`tag`in e&&`stateNode`in e&&`return`in e&&`child`in e&&`sibling`in e&&`flags`in e,Te=e=>typeof e==`object`&&!!e&&`current`in e&&A(e.current),j=e=>{let t=E(e);switch(e.tag){case t.HostComponent:case t.HostText:case t.HostHoistable:case t.HostSingleton:return!0;default:return!1}},Ee=e=>{let t=E(e);switch(e.tag){case t.ClassComponent:case t.ForwardRef:case t.FunctionComponent:case t.MemoComponent:case t.SimpleMemoComponent:return!0;default:return!1}},De=e=>!e||typeof e!=`object`?!1:`pendingProps`in e&&!(`containerInfo`in e),Oe=(e,t)=>{try{let n=e.dependencies,r=e.alternate?.dependencies;if(!n||!r||typeof n!=`object`||!(`firstContext`in n)||typeof r!=`object`||!(`firstContext`in r))return!1;let i=n.firstContext,a=r.firstContext;for(;i&&typeof i==`object`&&`memoizedValue`in i||a&&typeof a==`object`&&`memoizedValue`in a;){if(t(i,a)===!0)return!0;i=i?.next,a=a?.next}}catch{}return!1},ke=(e,t)=>{try{let n=e.memoizedState,r=e.alternate?.memoizedState;for(;n||r;){if(t(n,r)===!0)return!0;n=n?.next,r=r?.next}}catch{}return!1},Ae=(e,t)=>{try{let n=e.memoizedProps,r=e.alternate?.memoizedProps||{};for(let e of Object.keys(n))if(t(e,n[e],r[e])===!0)return!0;for(let e of Object.keys(r))if(!(e in n)&&t(e,n[e],r[e])===!0)return!0}catch{}return!1},M=e=>{let t=e.memoizedProps,n=e.alternate?.memoizedProps||{},r=e.flags??e.effectTag??0,i=E(e);switch(e.tag){case i.ClassComponent:case i.ContextConsumer:case i.ForwardRef:case i.FunctionComponent:case i.MemoComponent:case i.SimpleMemoComponent:return(r&x.PerformedWork)===x.PerformedWork;default:return!e.alternate||n!==t||e.alternate.memoizedState!==e.memoizedState||e.alternate.ref!==e.ref}},je=e=>(e.flags&(ye|x.Cloned))!==0||(e.subtreeFlags&(ye|x.Cloned))!==0,Me=e=>{let t=[],n=[e];for(;n.length;){let e=n.pop();e&&(j(e)&&je(e)&&M(e)&&t.push(e),e.child&&n.push(e.child),e.sibling&&n.push(e.sibling))}return t},Ne=e=>{let t=[],n=e;for(;n.return;)t.push(n),n=n.return;return t},N=e=>{let t=E(e);switch(e.tag){case t.DehydratedSuspenseComponent:return!0;case t.Fragment:case t.HostText:case t.LegacyHiddenComponent:case t.OffscreenComponent:return!0;case t.HostRoot:return!1;default:{let t=typeof e.type==`object`&&e.type!==null?e.type.$$typeof:e.type;if(typeof t==`symbol`)return t.description===S.CONCURRENT_MODE_SYMBOL_DESCRIPTION||t.description===S.DEPRECATED_ASYNC_MODE_SYMBOL_DESCRIPTION;switch(t){case S.CONCURRENT_MODE_NUMBER:case S.CONCURRENT_MODE_SYMBOL_STRING:case S.DEPRECATED_ASYNC_MODE_SYMBOL_STRING:return!0;default:return!1}}}},Pe=(e,t=!1)=>{let n=P(e,j,t);return n||=P(e,j,!t),n},Fe=e=>{let t=[],n=[];for(j(e)?t.push(e):e.child&&n.push(e.child);n.length;){let e=n.pop();if(!e)break;j(e)?t.push(e):e.child&&n.push(e.child),e.sibling&&n.push(e.sibling)}return t};function P(e,t,n=!1){if(!e)return null;let r=t(e);return Ie(r)?Promise.resolve(r).then(r=>r===!0?e:Le(e,t,n)):r===!0?e:Le(e,t,n)}let Ie=e=>(typeof e==`object`||typeof e==`function`)&&e!==null&&`then`in e&&typeof e.then==`function`,Le=(e,t,n)=>{let r=n?e.return:e.child;return F(r,t,n)},F=(e,t,n)=>{if(!e)return null;let r=n?null:e.sibling,i=P(e,t,n);return Ie(i)?Promise.resolve(i).then(e=>e??F(r,t,n)):i??F(r,t,n)},Re=e=>{let t=e?.actualDuration??0,n=t,r=e?.child??null;for(;t>0&&r!==null;)n-=r.actualDuration??0,r=r.sibling;return{selfTime:n,totalTime:t}},ze=e=>!!e.updateQueue?.memoCache,I=e=>Ce(e)?e:typeof e!=`object`||!e?null:I(Reflect.get(e,`type`)??Reflect.get(e,`render`)),Be=e=>{if(typeof e==`string`)return e;if(typeof e!=`function`&&typeof e!=`object`||e===null)return null;let t=k(e);if(t)return t;let n=I(e);return n?k(n):null},Ve=e=>{try{if(typeof e.version==`string`&&e.bundleType===pe.Development)return`development`}catch{}return`production`},He=()=>{let e=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__;return!!e?._instrumentationIsActive||s(e)},L=new Set,Ue=e=>{let t=e.alternate;if(!t)return e;if(t.actualStartTime&&e.actualStartTime)return t.actualStartTime>e.actualStartTime?t:e;for(let n of L){let r=P(n.current,n=>{if(n===e||n===t)return!0});if(r)return r}return e},R=0,z=new WeakMap,We=(e,t=R++)=>{z.set(e,t),Number.isSafeInteger(t)&&t>=R&&(R=t+1)},B=e=>{let t=z.get(e);return t===void 0&&e.alternate&&(t=z.get(e.alternate)),t===void 0&&(t=R++,We(e,t)),t},V=(e,t,n)=>{let r=t;for(;r!==null;){if(B(r),!N(r)&&M(r)&&e(r,`mount`),r.tag===E(r).SuspenseComponent)if(r.memoizedState!==null){let t=r.child,n=t?t.sibling:null;if(n){let t=n.child;t!==null&&V(e,t,!1)}}else{let t=r.child?.child??null;t!==null&&V(e,t,!1)}else r.child!==null&&V(e,r.child,!0);r=n?r.sibling:null}},H=(e,t,n)=>{if(B(t),!n)return;B(n);let r=t.tag===E(t).SuspenseComponent;!N(t)&&M(t)&&e(t,`update`);let i=r&&n.memoizedState!==null,a=r&&t.memoizedState!==null;if(i&&a){let r=t.child?.sibling??null,i=n.child?.sibling??null;r!==null&&i!==null&&H(e,r,i)}else if(i&&!a){let n=t.child;n!==null&&V(e,n,!0)}else if(!i&&a){Ge(e,n);let r=t.child?.sibling??null;r!==null&&V(e,r,!0)}else if(t.child!==n.child){let n=t.child;for(;n;)n.alternate?H(e,n,n.alternate):V(e,n,!1),n=n.sibling}},U=(e,t)=>{(t.tag===E(t).HostRoot||!N(t))&&e(t,`unmount`)},Ge=(e,t)=>{let n=t.tag===E(t).SuspenseComponent&&t.memoizedState!==null,r=t.child;for(n&&(r=(t.child?.sibling??null)?.child??null);r!==null;)r.return!==null&&(U(e,r),Ge(e,r)),r=r.sibling},Ke=new WeakMap,qe=(e,t)=>{let n=`current`in e?e.current:e,r=Ke.get(e);r||(r={prevFiber:null},Ke.set(e,r));let{prevFiber:i}=r;if(!n)i&&U(t,i);else if(i!==null){let e=i.memoizedState!==null&&i.memoizedState.element!==null&&i.memoizedState.element!==void 0&&i.memoizedState.isDehydrated!==!0,r=n.memoizedState!==null&&n.memoizedState.element!==null&&n.memoizedState.element!==void 0&&n.memoizedState.isDehydrated!==!0;!e&&r?V(t,n,!1):e&&r?H(t,n,n.alternate):e&&!r&&U(t,n)}else V(t,n,!0);r.prevFiber=n},W=new Set,G=!1,Je=()=>{if(!g())return;let e=_();$(e);for(let t of e.renderers.values())W.add(t);G||(G=!0,f(e=>{W.add(e)}))},Ye=e=>{if(!g())return null;let t=e;for(;t.return;)t=t.return;let n=t.stateNode;if(!Te(n))return null;let r=Q.get(n);return r===void 0?null:_().renderers.get(r)??null},K=e=>{Je();let t=Ye(e);return t?[t]:Array.from(W)},q=(e,t,n,r)=>{for(let i of e)try{i.overrideProps?.(t,n,r)}catch{}},Xe=(e,t)=>{let n=e.memoizedState;for(let e=0;e<t;e++){if(!n?.next)return null;n=n.next}let r=n?.queue;if(!J(r))return null;let i=r.dispatch;return typeof i==`function`?e=>i(e):null},Ze=(e,t)=>{let n=e;for(;n;){let e=n.type;if(e===t||e?.Provider===t)return n;n=n.return}return null},J=e=>Object.prototype.toString.call(e)===`[object Object]`&&(Object.getPrototypeOf(e)===Object.prototype||Object.getPrototypeOf(e)===null),Qe=(e,t=[],n=new WeakSet)=>{if(n.has(e))return[{path:t,value:e}];n.add(e);let r=[];for(let[i,a]of Object.entries(e)){let e=t.concat(i);J(a)?r.push(...Qe(a,e,n)):r.push({path:e,value:a})}return n.delete(e),r},Y=e=>J(e)?Qe(e):[{path:[],value:e}],$e=(e,t)=>{let n=K(e);for(let{path:r,value:i}of Y(t))q(n,e,r,i)},et=(e,t,n)=>{let r=K(e).filter(e=>!!e.overrideHookState);if(r.length>0){let i=Y(n);for(let n of r)for(let{path:r,value:a}of i)try{n.overrideHookState?.(e,t,r,a)}catch{}return}if(J(n))return;let i=Xe(e,t);if(i)try{i(n)}catch{}},tt=(e,t,n)=>{let r=Ze(e,t);if(!r)return;let i=K(r);for(let{path:e,value:t}of Y(n))q(i,r,[`value`,...e],t),r.alternate&&q(i,r.alternate,[`value`,...e],t)},X=new Set,Z=new WeakMap,nt=!1,Q=new WeakMap,$=e=>{let t=Z.get(e)??{};if(Z.set(e,t),!t.onCommitFiberRoot||e.onCommitFiberRoot!==t.onCommitFiberRoot){let n=e.onCommitFiberRoot,r=(t,i,a,o)=>{if(n&&n.call(e,t,i,a,o),Z.get(e)?.onCommitFiberRoot!==r)return;ve(i.current,e.renderers.get(t));let s=i.current.memoizedState;s===null||s.element===null||s.element===void 0?(L.delete(i),Q.delete(i)):(L.add(i),Q.set(i,t));for(let{options:e}of X)e.onCommitFiberRoot&&e.onCommitFiberRoot(t,i,a,o)};t.onCommitFiberRoot=r,e.onCommitFiberRoot=r}if(!t.onCommitFiberUnmount||e.onCommitFiberUnmount!==t.onCommitFiberUnmount){let n=e.onCommitFiberUnmount,r=(t,i)=>{if(ve(i,e.renderers.get(t)),n&&n.call(e,t,i),Z.get(e)?.onCommitFiberUnmount===r)for(let{options:e}of X)e.onCommitFiberUnmount&&e.onCommitFiberUnmount(t,i)};t.onCommitFiberUnmount=r,e.onCommitFiberUnmount=r}if(!t.onPostCommitFiberRoot||e.onPostCommitFiberRoot!==t.onPostCommitFiberRoot){let n=e.onPostCommitFiberRoot,r=(t,i)=>{if(n&&n.call(e,t,i),Z.get(e)?.onPostCommitFiberRoot===r)for(let{options:e}of X)e.onPostCommitFiberRoot&&e.onPostCommitFiberRoot(t,i)};t.onPostCommitFiberRoot=r,e.onPostCommitFiberRoot=r}if(!t.onScheduleFiberRoot||e.onScheduleFiberRoot!==t.onScheduleFiberRoot){let n=e.onScheduleFiberRoot,r=(t,i,a)=>{if(n&&n.call(e,t,i,a),Z.get(e)?.onScheduleFiberRoot===r)for(let{options:e}of X)e.onScheduleFiberRoot&&e.onScheduleFiberRoot(t,i,a)};t.onScheduleFiberRoot=r,e.onScheduleFiberRoot=r}},rt=e=>{let t=_(e.onActive);nt||=(oe($),!0),t._instrumentationSource=e.name??n,$(t);let r={options:e};return X.add(r),a(()=>{e.onActive&&c.delete(e.onActive),X.delete(r)})},it=new Set,at=e=>e.startsWith(`__reactContainer$`)||e.startsWith(`__reactInternalInstance$`)||e.startsWith(`__reactFiber`),ot=e=>{let t=Reflect.get(e,`_reactRootContainer`);if(typeof t!=`object`||!t)return null;let n=Reflect.get(t,`_internalRoot`);if(typeof n!=`object`||!n)return null;let r=Reflect.get(n,`current`);if(typeof r!=`object`||!r)return null;let i=Reflect.get(r,`child`);return A(i)?i:null},st=e=>{let t=Reflect.get(e,`__internalInstanceHandle`)??Reflect.get(e,`_internalInstanceHandle`);return A(t)?t:null},ct=e=>{if(typeof e!=`object`||!e)return e;let t=Reflect.get(e,`canonical`);if(typeof t==`object`&&t){let e=Reflect.get(t,`publicInstance`);if(typeof e==`object`&&e)return e}let n=Reflect.get(e,`_nativeTag`);return typeof n==`number`?n:e};return e.BIPPY_INSTRUMENTATION_STRING=n,e.BippyError=D,e.BippyHookInspectionError=O,e.BippyHookRenderError=xe,e.BippySourceMapError=Se,e.BippyUnsupportedHookError=be,e.ReactSymbols=S,e._fiberRoots=L,e._onActiveListeners=c,e._renderers=l,e.detectReactBuildType=Ve,e.didFiberCommit=je,e.didFiberRender=M,e.getDisplayName=Be,e.getFiberFromHostInstance=e=>{let t=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__;if(t?.renderers)for(let n of t.renderers.values())try{let t=n.findFiberByHostInstance?.(e);if(t)return t}catch{}if(typeof e==`object`&&e){let t=ot(e);if(t)return t;let n=st(e);if(n)return n;for(let t of it){let n=Reflect.get(e,t);if(A(n))return n}for(let t of Object.keys(e))if(at(t)){it.add(t);let n=Reflect.get(e,t);if(A(n))return n}}if(e!=null&&(typeof e==`object`||typeof e==`number`))for(let t of L){let n=P(t.current,t=>j(t)&&ct(t.stateNode)===e);if(n)return n}return null},e.getFiberId=B,e.getFiberStack=Ne,e.getLatestFiber=Ue,e.getMutatedHostFibers=Me,e.getNearestHostFiber=Pe,e.getNearestHostFibers=Fe,e.getRDTHook=_,e.getReactWorkTags=w,e.getTimings=Re,e.getType=I,e.hasMemoCache=ze,e.hasRDTHook=g,e.installRDTHook=m,e.instrument=rt,e.isCompositeFiber=Ee,e.isFiber=De,e.isHostFiber=j,e.isInstrumentationActive=He,e.isRealReactDevtools=s,e.isValidElement=we,e.isValidFiber=A,e.onRendererInject=f,e.overrideContext=tt,e.overrideHookState=et,e.overrideProps=$e,e.patchRDTHook=h,e.setFiberId=We,e.traverseContexts=Oe,e.traverseFiber=P,e.traverseProps=Ae,e.traverseRenderedFibers=qe,e.traverseState=ke,e.version=t,e})({});
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license bippy
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) Aiden Bai
|
|
5
|
-
*
|
|
6
|
-
* This source code is licensed under the MIT license found in the
|
|
7
|
-
* LICENSE file in the root directory of this source tree.
|
|
8
|
-
*/
|
|
9
|
-
(function(){let e=`bippy-0.6.1-dev.3702582`,t=Object.defineProperty,n=()=>{},r=e=>{try{Function.prototype.toString.call(e).indexOf(`^_^`)>-1&&setTimeout(()=>{throw Error(`React is running in production mode, but dead code elimination has not been applied. Read how to correctly configure React for production: https://react.dev/link/perf-use-production-build`)})}catch{}},i=(e=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__)=>!!(e&&`getFiberRoots`in e),a=new Set,o=new Set,s=new Set,c=()=>{for(let e of a)e()},l=e=>{for(let t of s)t(e)},u=e=>(e.renderers instanceof Map||(e.renderers=new Map),e.renderers),d=(e,t,n,r)=>{t.set(n,r),o.add(r),e._instrumentationIsActive||(e._instrumentationIsActive=!0,c())},f=i=>{i&&a.add(i);let c=new Map,f=0,m={_instrumentationIsActive:!1,_instrumentationSource:e,checkDCE:r,hasUnsupportedRendererAttached:!1,inject:e=>{let t=++f;return d(m,c,t,e),t},on:n,onCommitFiberRoot:n,onCommitFiberUnmount:n,onPostCommitFiberRoot:n,renderers:c,supportsFiber:!0,supportsFlight:!0};try{if(t(globalThis,`__REACT_DEVTOOLS_GLOBAL_HOOK__`,{configurable:!0,enumerable:!0,get(){return m},set(e){if(e&&typeof e==`object`){let t=m.renderers;m=e;let n=u(m);t.forEach((e,t)=>{o.add(e),n.set(t,e)}),(t.size>0||s.size>0)&&p(i),l(m)}}}),typeof window<`u`){let e=window.hasOwnProperty.bind(window),n=Object.getOwnPropertyDescriptor(window,`hasOwnProperty`),r=!1,i=()=>{n?t(window,`hasOwnProperty`,n):Reflect.deleteProperty(window,`hasOwnProperty`)};t(window,`hasOwnProperty`,{configurable:!0,value:t=>!r&&t===`__REACT_DEVTOOLS_GLOBAL_HOOK__`?(r=!0,i(),globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__=void 0,!1):e(t),writable:!0})}}catch{p(i)}return m},p=t=>{t&&a.add(t);let s=!1,l=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!l)return;let f=u(l);if(!l._instrumentationSource){l.checkDCE=r,l.supportsFiber=!0,l.supportsFlight=!0,l.hasUnsupportedRendererAttached=!1,l._instrumentationSource=e,l._instrumentationIsActive=!1,i(l)||(l.on=n),f.size&&(f.forEach(e=>o.add(e)),l._instrumentationIsActive=!0,c(),s=!0);let t=l.inject;l.inject=e=>{let n=t.call(l,e);return d(l,f,n,e),n}}!s&&(f.size||l._instrumentationIsActive)&&t?.()},m=()=>Object.hasOwn(globalThis,`__REACT_DEVTOOLS_GLOBAL_HOOK__`);(e=>m()?(p(e),globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__??f(e)):f(e))()})();
|