bippy 0.6.1-dev.61475ed → 0.6.1-dev.93556ef
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/LICENSE +1 -1
- package/README.md +51 -48
- package/dist/core.cjs +1 -1
- package/dist/core.d.cts +45 -60
- package/dist/core.d.ts +45 -60
- package/dist/core.js +1 -1
- package/dist/core2.cjs +9 -0
- package/dist/core2.d.cts +11 -3
- package/dist/core2.d.ts +11 -3
- package/dist/core2.js +9 -0
- package/dist/errors.d.cts +410 -0
- package/dist/errors.d.ts +410 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +11 -3
- package/dist/index.d.ts +11 -3
- package/dist/index.iife.js +1 -1
- package/dist/index.js +1 -1
- package/dist/install-hook-only.cjs +1 -1
- package/dist/install-hook-only.d.cts +9 -1
- package/dist/install-hook-only.d.ts +9 -1
- package/dist/install-hook-only.iife.js +1 -1
- package/dist/install-hook-only.js +1 -1
- package/dist/rdt-hook.cjs +1 -1
- package/dist/rdt-hook.js +1 -1
- package/dist/source.cjs +14 -5
- package/dist/source.d.cts +86 -69
- package/dist/source.d.ts +86 -69
- package/dist/source.js +14 -5
- package/package.json +22 -16
- package/src/core.ts +348 -344
- package/src/errors.ts +34 -0
- package/src/install-hook-only.ts +2 -2
- package/src/rdt-hook.ts +160 -161
- package/src/react-internals/generated/react-work-tags.ts +318 -0
- package/src/react-internals/index.ts +67 -0
- package/src/react-internals/semver.ts +80 -0
- package/src/react-internals/types.ts +186 -0
- package/src/source/constants.ts +1 -1
- package/src/source/error-stack.ts +11 -0
- package/src/source/get-display-name-from-source.ts +44 -40
- package/src/source/get-source.ts +43 -26
- package/src/source/index.ts +11 -1
- package/src/source/inspect-hooks.ts +220 -207
- package/src/source/owner-stack.ts +119 -174
- package/src/source/parse-debug-stack.ts +4 -4
- package/src/source/parse-hook-names.ts +14 -53
- package/src/source/parse-stack.ts +14 -31
- package/src/source/renderer-dispatchers.ts +30 -0
- package/src/source/symbolication.ts +709 -120
- package/dist/get-source.cjs +0 -19
- package/dist/get-source.js +0 -19
- package/dist/react-refresh.cjs +0 -9
- package/dist/react-refresh.d.cts +0 -66
- package/dist/react-refresh.d.ts +0 -66
- package/dist/react-refresh.js +0 -9
- package/dist/unsubscribe.d.cts +0 -298
- package/dist/unsubscribe.d.ts +0 -298
- package/src/react-refresh/constants.ts +0 -9
- package/src/react-refresh/detect-hmr-transport.ts +0 -33
- package/src/react-refresh/index.ts +0 -173
- package/src/react-refresh/metro-hmr-transport.ts +0 -188
- package/src/react-refresh/next-webpack-hmr-transport.ts +0 -72
- package/src/react-refresh/normalize-hmr-file-path.ts +0 -24
- package/src/react-refresh/types.ts +0 -7
- package/src/react-refresh/vite-hmr-transport.ts +0 -116
- package/src/types.ts +0 -438
- package/src/unsubscribe.ts +0 -17
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export interface StackFrame {
|
|
2
|
-
args?: unknown[];
|
|
3
2
|
columnNumber?: number;
|
|
4
3
|
lineNumber?: number;
|
|
5
4
|
// start of the enclosing function (the definition, not the call site);
|
|
@@ -16,8 +15,6 @@ export interface StackFrame {
|
|
|
16
15
|
}
|
|
17
16
|
|
|
18
17
|
export interface ParseOptions {
|
|
19
|
-
slice?: number | [number, number];
|
|
20
|
-
allowEmpty?: boolean;
|
|
21
18
|
includeInElement?: boolean;
|
|
22
19
|
}
|
|
23
20
|
|
|
@@ -31,22 +28,22 @@ export const parseStack = (stackString: string, options?: ParseOptions): StackFr
|
|
|
31
28
|
const frames: StackFrame[] = [];
|
|
32
29
|
for (const rawLine of lines) {
|
|
33
30
|
if (/^\s*at\s+/.test(rawLine)) {
|
|
34
|
-
const parsed = parseV8OrIeString(rawLine
|
|
31
|
+
const parsed = parseV8OrIeString(rawLine)[0];
|
|
35
32
|
if (parsed) frames.push(parsed);
|
|
36
33
|
} else if (/^\s*in\s+/.test(rawLine)) {
|
|
37
34
|
const elementName = rawLine.replace(/^\s*in\s+/, "").replace(/\s*\(at .*\)$/, "");
|
|
38
35
|
frames.push({ functionName: elementName, source: rawLine });
|
|
39
36
|
} else if (rawLine.match(FIREFOX_SAFARI_STACK_REGEXP)) {
|
|
40
|
-
const parsed = parseFFOrSafariString(rawLine
|
|
37
|
+
const parsed = parseFFOrSafariString(rawLine)[0];
|
|
41
38
|
if (parsed) frames.push(parsed);
|
|
42
39
|
}
|
|
43
40
|
}
|
|
44
|
-
return
|
|
41
|
+
return frames;
|
|
45
42
|
}
|
|
46
43
|
if (stackString.match(CHROME_IE_STACK_REGEXP)) {
|
|
47
|
-
return parseV8OrIeString(stackString
|
|
44
|
+
return parseV8OrIeString(stackString);
|
|
48
45
|
}
|
|
49
|
-
return parseFFOrSafariString(stackString
|
|
46
|
+
return parseFFOrSafariString(stackString);
|
|
50
47
|
};
|
|
51
48
|
|
|
52
49
|
export const extractLocation = (
|
|
@@ -66,21 +63,10 @@ export const extractLocation = (
|
|
|
66
63
|
return [parts[1], parts[2] || undefined, parts[3] || undefined] as const;
|
|
67
64
|
};
|
|
68
65
|
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
return lines;
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
export const parseV8OrIeString = (stack: string, options?: ParseOptions): StackFrame[] => {
|
|
78
|
-
const filteredLines = applySlice(
|
|
79
|
-
stack.split("\n").filter((line) => {
|
|
80
|
-
return !!line.match(CHROME_IE_STACK_REGEXP);
|
|
81
|
-
}),
|
|
82
|
-
options,
|
|
83
|
-
);
|
|
66
|
+
export const parseV8OrIeString = (stack: string): StackFrame[] => {
|
|
67
|
+
const filteredLines = stack.split("\n").filter((line) => {
|
|
68
|
+
return !!line.match(CHROME_IE_STACK_REGEXP);
|
|
69
|
+
});
|
|
84
70
|
|
|
85
71
|
return filteredLines.map((line): StackFrame => {
|
|
86
72
|
let currentLine = line;
|
|
@@ -100,7 +86,7 @@ export const parseV8OrIeString = (stack: string, options?: ParseOptions): StackF
|
|
|
100
86
|
|
|
101
87
|
const locationParts = extractLocation(locationMatch ? locationMatch[1] : sanitizedLine);
|
|
102
88
|
const functionName = (locationMatch && sanitizedLine) || undefined;
|
|
103
|
-
const fileName = ["eval", "<anonymous>"].includes(locationParts[0])
|
|
89
|
+
const fileName = ["eval", "<anonymous>", "(native)"].includes(locationParts[0])
|
|
104
90
|
? undefined
|
|
105
91
|
: locationParts[0];
|
|
106
92
|
|
|
@@ -114,13 +100,10 @@ export const parseV8OrIeString = (stack: string, options?: ParseOptions): StackF
|
|
|
114
100
|
});
|
|
115
101
|
};
|
|
116
102
|
|
|
117
|
-
export const parseFFOrSafariString = (stack: string
|
|
118
|
-
const filteredLines =
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}),
|
|
122
|
-
options,
|
|
123
|
-
);
|
|
103
|
+
export const parseFFOrSafariString = (stack: string): StackFrame[] => {
|
|
104
|
+
const filteredLines = stack.split("\n").filter((line) => {
|
|
105
|
+
return !line.match(SAFARI_NATIVE_CODE_REGEXP);
|
|
106
|
+
});
|
|
124
107
|
|
|
125
108
|
return filteredLines.map((line): StackFrame => {
|
|
126
109
|
let currentLine = line;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { RendererDispatcherRef } from "../react-internals/index.js";
|
|
2
|
+
import { _renderers, getRDTHook } from "../rdt-hook.js";
|
|
3
|
+
|
|
4
|
+
export const getRendererDispatcherRefs = (): RendererDispatcherRef[] => {
|
|
5
|
+
const rdtHook = getRDTHook();
|
|
6
|
+
const renderers = new Set([..._renderers, ...rdtHook.renderers.values()]);
|
|
7
|
+
const currentDispatcherRefs: RendererDispatcherRef[] = [];
|
|
8
|
+
const seenCurrentDispatcherRefs = new Set<object>();
|
|
9
|
+
for (const renderer of renderers) {
|
|
10
|
+
const currentDispatcherRef = renderer.currentDispatcherRef;
|
|
11
|
+
if (!currentDispatcherRef || seenCurrentDispatcherRefs.has(currentDispatcherRef)) continue;
|
|
12
|
+
seenCurrentDispatcherRefs.add(currentDispatcherRef);
|
|
13
|
+
currentDispatcherRefs.push(currentDispatcherRef);
|
|
14
|
+
}
|
|
15
|
+
return currentDispatcherRefs;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const readDispatcher = (currentDispatcherRef: RendererDispatcherRef): unknown =>
|
|
19
|
+
"H" in currentDispatcherRef ? currentDispatcherRef.H : currentDispatcherRef.current;
|
|
20
|
+
|
|
21
|
+
export const writeDispatcher = (
|
|
22
|
+
currentDispatcherRef: RendererDispatcherRef,
|
|
23
|
+
dispatcher: unknown,
|
|
24
|
+
): void => {
|
|
25
|
+
if ("H" in currentDispatcherRef) {
|
|
26
|
+
currentDispatcherRef.H = dispatcher;
|
|
27
|
+
} else {
|
|
28
|
+
currentDispatcherRef.current = dispatcher;
|
|
29
|
+
}
|
|
30
|
+
};
|