bippy 0.6.1-dev.61475ed → 0.6.1-dev.d7876ea

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.
Files changed (62) hide show
  1. package/README.md +32 -48
  2. package/dist/core.cjs +1 -1
  3. package/dist/core.d.cts +42 -56
  4. package/dist/core.d.ts +42 -56
  5. package/dist/core.js +1 -1
  6. package/dist/core2.cjs +9 -0
  7. package/dist/core2.d.cts +3 -3
  8. package/dist/core2.d.ts +3 -3
  9. package/dist/core2.js +9 -0
  10. package/dist/errors.d.cts +436 -0
  11. package/dist/errors.d.ts +436 -0
  12. package/dist/index.cjs +1 -1
  13. package/dist/index.d.cts +3 -3
  14. package/dist/index.d.ts +3 -3
  15. package/dist/index.iife.js +1 -1
  16. package/dist/index.js +1 -1
  17. package/dist/install-hook-only.cjs +1 -1
  18. package/dist/install-hook-only.d.cts +1 -1
  19. package/dist/install-hook-only.d.ts +1 -1
  20. package/dist/install-hook-only.iife.js +1 -1
  21. package/dist/install-hook-only.js +1 -1
  22. package/dist/rdt-hook.cjs +1 -1
  23. package/dist/rdt-hook.js +1 -1
  24. package/dist/source.cjs +14 -4
  25. package/dist/source.d.cts +18 -9
  26. package/dist/source.d.ts +18 -9
  27. package/dist/source.js +14 -4
  28. package/package.json +21 -15
  29. package/src/core.ts +343 -253
  30. package/src/errors.ts +99 -0
  31. package/src/generated/react-work-tags.d.ts +261 -0
  32. package/src/generated/react-work-tags.js +240 -0
  33. package/src/rdt-hook.ts +154 -149
  34. package/src/react-internals.ts +65 -0
  35. package/src/semver.ts +78 -0
  36. package/src/source/constants.ts +1 -1
  37. package/src/source/error-stack.ts +11 -0
  38. package/src/source/get-source.ts +2 -1
  39. package/src/source/index.ts +9 -1
  40. package/src/source/inspect-hooks.ts +199 -164
  41. package/src/source/owner-stack.ts +84 -114
  42. package/src/source/parse-debug-stack.ts +4 -4
  43. package/src/source/parse-stack.ts +1 -1
  44. package/src/source/symbolication.ts +365 -89
  45. package/src/types.ts +165 -334
  46. package/src/unsubscribe.ts +2 -2
  47. package/dist/get-source.cjs +0 -19
  48. package/dist/get-source.js +0 -19
  49. package/dist/react-refresh.cjs +0 -9
  50. package/dist/react-refresh.d.cts +0 -66
  51. package/dist/react-refresh.d.ts +0 -66
  52. package/dist/react-refresh.js +0 -9
  53. package/dist/unsubscribe.d.cts +0 -298
  54. package/dist/unsubscribe.d.ts +0 -298
  55. package/src/react-refresh/constants.ts +0 -9
  56. package/src/react-refresh/detect-hmr-transport.ts +0 -33
  57. package/src/react-refresh/index.ts +0 -173
  58. package/src/react-refresh/metro-hmr-transport.ts +0 -188
  59. package/src/react-refresh/next-webpack-hmr-transport.ts +0 -72
  60. package/src/react-refresh/normalize-hmr-file-path.ts +0 -24
  61. package/src/react-refresh/types.ts +0 -7
  62. package/src/react-refresh/vite-hmr-transport.ts +0 -116
package/src/errors.ts ADDED
@@ -0,0 +1,99 @@
1
+ export class BippyError extends Error {
2
+ constructor(message: string, cause?: unknown) {
3
+ super(message, { cause });
4
+ this.name = "BippyError";
5
+ }
6
+ }
7
+
8
+ export class BippyInstrumentationError extends BippyError {
9
+ readonly callbackName: string;
10
+ readonly instrumentationName: string;
11
+
12
+ constructor(instrumentationName: string, callbackName: string, cause: unknown) {
13
+ super(
14
+ `Bippy instrumentation "${instrumentationName}" callback "${callbackName}" failed`,
15
+ cause,
16
+ );
17
+ this.name = "BippyInstrumentationError";
18
+ this.callbackName = callbackName;
19
+ this.instrumentationName = instrumentationName;
20
+ }
21
+ }
22
+
23
+ export class BippyReactDevToolsError extends BippyError {
24
+ readonly callbackName: string;
25
+
26
+ constructor(callbackName: string, cause: unknown) {
27
+ super(`React DevTools callback "${callbackName}" failed`, cause);
28
+ this.name = "BippyReactDevToolsError";
29
+ this.callbackName = callbackName;
30
+ }
31
+ }
32
+
33
+ export class BippyHookListenerError extends BippyError {
34
+ readonly listenerName: string;
35
+
36
+ constructor(listenerName: string, cause: unknown) {
37
+ super(`Bippy hook listener "${listenerName}" failed`, cause);
38
+ this.name = "BippyHookListenerError";
39
+ this.listenerName = listenerName;
40
+ }
41
+ }
42
+
43
+ export class BippyHookInstallationError extends BippyError {
44
+ constructor(cause: unknown) {
45
+ super("Bippy could not install the React DevTools hook", cause);
46
+ this.name = "BippyHookInstallationError";
47
+ }
48
+ }
49
+
50
+ export class BippyReactBuildError extends BippyError {
51
+ constructor(message: string, cause?: unknown) {
52
+ super(message, cause);
53
+ this.name = "BippyReactBuildError";
54
+ }
55
+ }
56
+
57
+ export class BippyHookInspectionError extends BippyError {
58
+ constructor(message: string, cause?: unknown) {
59
+ super(message, cause);
60
+ this.name = "BippyHookInspectionError";
61
+ }
62
+ }
63
+
64
+ export class BippyUnsupportedHookError extends BippyHookInspectionError {
65
+ constructor(message: string, cause?: unknown) {
66
+ super(message, cause);
67
+ this.name = "BippyUnsupportedHookError";
68
+ }
69
+ }
70
+
71
+ export class BippyHookRenderError extends BippyHookInspectionError {
72
+ constructor(message: string, cause?: unknown) {
73
+ super(message, cause);
74
+ this.name = "BippyHookRenderError";
75
+ }
76
+ }
77
+
78
+ export class BippySourceMapError extends BippyError {
79
+ constructor(message: string, cause?: unknown) {
80
+ super(message, cause);
81
+ this.name = "BippySourceMapError";
82
+ }
83
+ }
84
+
85
+ interface BippyErrorFactory {
86
+ (cause: unknown): BippyError;
87
+ }
88
+
89
+ export const runWithBippyError = <Result>(
90
+ callback: () => Result,
91
+ createError: BippyErrorFactory,
92
+ ): Result => {
93
+ try {
94
+ return callback();
95
+ } catch (cause) {
96
+ if (cause instanceof BippyError) throw cause;
97
+ throw createError(cause);
98
+ }
99
+ };
@@ -0,0 +1,261 @@
1
+ export declare const ReactBuildType: {
2
+ readonly Development: 1;
3
+ readonly Production: 0;
4
+ };
5
+ export declare const ReactFiberFlags: {
6
+ readonly ChildDeletion: 16;
7
+ readonly Cloned: 8;
8
+ readonly ContentReset: 32;
9
+ readonly Hydrating: 4096;
10
+ readonly PerformedWork: 1;
11
+ readonly Placement: 2;
12
+ readonly Snapshot: 1024;
13
+ readonly Update: 4;
14
+ readonly Visibility: 8192;
15
+ };
16
+ export declare const ReactSymbols: {
17
+ readonly CONCURRENT_MODE_NUMBER: 60111;
18
+ readonly CONCURRENT_MODE_SYMBOL_DESCRIPTION: "react.concurrent_mode";
19
+ readonly CONCURRENT_MODE_SYMBOL_STRING: "Symbol(react.concurrent_mode)";
20
+ readonly DEPRECATED_ASYNC_MODE_SYMBOL_DESCRIPTION: "react.async_mode";
21
+ readonly DEPRECATED_ASYNC_MODE_SYMBOL_STRING: "Symbol(react.async_mode)";
22
+ readonly ELEMENT_SYMBOL_STRING: "Symbol(react.transitional.element)";
23
+ readonly LEGACY_ELEMENT_SYMBOL_STRING: "Symbol(react.element)";
24
+ };
25
+ export interface ReactWorkTagMap {
26
+ ActivityComponent: number;
27
+ CacheComponent: number;
28
+ ClassComponent: number;
29
+ ContextConsumer: number;
30
+ ContextProvider: number;
31
+ CoroutineComponent: number;
32
+ CoroutineHandlerPhase: number;
33
+ DehydratedSuspenseComponent: number;
34
+ ForwardRef: number;
35
+ Fragment: number;
36
+ FunctionComponent: number;
37
+ HostComponent: number;
38
+ HostHoistable: number;
39
+ HostPortal: number;
40
+ HostRoot: number;
41
+ HostSingleton: number;
42
+ HostText: number;
43
+ IncompleteClassComponent: number;
44
+ IncompleteFunctionComponent: number;
45
+ IndeterminateComponent: number;
46
+ LazyComponent: number;
47
+ LegacyHiddenComponent: number;
48
+ MemoComponent: number;
49
+ Mode: number;
50
+ OffscreenComponent: number;
51
+ Profiler: number;
52
+ ScopeComponent: number;
53
+ SimpleMemoComponent: number;
54
+ SuspenseComponent: number;
55
+ SuspenseListComponent: number;
56
+ Throw: number;
57
+ TracingMarkerComponent: number;
58
+ ViewTransitionComponent: number;
59
+ YieldComponent: number;
60
+ }
61
+ declare const reactWorkTagsByVersion: {
62
+ readonly "16.0.0": {
63
+ readonly ActivityComponent: -1;
64
+ readonly CacheComponent: -1;
65
+ readonly ClassComponent: 2;
66
+ readonly ContextConsumer: 12;
67
+ readonly ContextProvider: 13;
68
+ readonly CoroutineComponent: 7;
69
+ readonly CoroutineHandlerPhase: 8;
70
+ readonly DehydratedSuspenseComponent: -1;
71
+ readonly ForwardRef: 14;
72
+ readonly Fragment: 10;
73
+ readonly FunctionComponent: 1;
74
+ readonly HostComponent: 5;
75
+ readonly HostHoistable: -1;
76
+ readonly HostPortal: 4;
77
+ readonly HostRoot: 3;
78
+ readonly HostSingleton: -1;
79
+ readonly HostText: 6;
80
+ readonly IncompleteClassComponent: -1;
81
+ readonly IncompleteFunctionComponent: -1;
82
+ readonly IndeterminateComponent: 0;
83
+ readonly LazyComponent: -1;
84
+ readonly LegacyHiddenComponent: -1;
85
+ readonly MemoComponent: -1;
86
+ readonly Mode: 11;
87
+ readonly OffscreenComponent: -1;
88
+ readonly Profiler: 15;
89
+ readonly ScopeComponent: -1;
90
+ readonly SimpleMemoComponent: -1;
91
+ readonly SuspenseComponent: 16;
92
+ readonly SuspenseListComponent: -1;
93
+ readonly Throw: -1;
94
+ readonly TracingMarkerComponent: -1;
95
+ readonly ViewTransitionComponent: -1;
96
+ readonly YieldComponent: 9;
97
+ };
98
+ readonly "16.4.3-alpha": {
99
+ readonly ActivityComponent: -1;
100
+ readonly CacheComponent: -1;
101
+ readonly ClassComponent: 2;
102
+ readonly ContextConsumer: 11;
103
+ readonly ContextProvider: 12;
104
+ readonly CoroutineComponent: -1;
105
+ readonly CoroutineHandlerPhase: -1;
106
+ readonly DehydratedSuspenseComponent: -1;
107
+ readonly ForwardRef: 13;
108
+ readonly Fragment: 9;
109
+ readonly FunctionComponent: 0;
110
+ readonly HostComponent: 7;
111
+ readonly HostHoistable: -1;
112
+ readonly HostPortal: 6;
113
+ readonly HostRoot: 5;
114
+ readonly HostSingleton: -1;
115
+ readonly HostText: 8;
116
+ readonly IncompleteClassComponent: -1;
117
+ readonly IncompleteFunctionComponent: -1;
118
+ readonly IndeterminateComponent: 4;
119
+ readonly LazyComponent: -1;
120
+ readonly LegacyHiddenComponent: -1;
121
+ readonly MemoComponent: -1;
122
+ readonly Mode: 10;
123
+ readonly OffscreenComponent: -1;
124
+ readonly Profiler: 15;
125
+ readonly ScopeComponent: -1;
126
+ readonly SimpleMemoComponent: -1;
127
+ readonly SuspenseComponent: 16;
128
+ readonly SuspenseListComponent: -1;
129
+ readonly Throw: -1;
130
+ readonly TracingMarkerComponent: -1;
131
+ readonly ViewTransitionComponent: -1;
132
+ readonly YieldComponent: -1;
133
+ };
134
+ readonly "16.6.0-beta.0": {
135
+ readonly ActivityComponent: -1;
136
+ readonly CacheComponent: -1;
137
+ readonly ClassComponent: 1;
138
+ readonly ContextConsumer: 9;
139
+ readonly ContextProvider: 10;
140
+ readonly CoroutineComponent: -1;
141
+ readonly CoroutineHandlerPhase: -1;
142
+ readonly DehydratedSuspenseComponent: 18;
143
+ readonly ForwardRef: 11;
144
+ readonly Fragment: 7;
145
+ readonly FunctionComponent: 0;
146
+ readonly HostComponent: 5;
147
+ readonly HostHoistable: -1;
148
+ readonly HostPortal: 4;
149
+ readonly HostRoot: 3;
150
+ readonly HostSingleton: -1;
151
+ readonly HostText: 6;
152
+ readonly IncompleteClassComponent: 17;
153
+ readonly IncompleteFunctionComponent: -1;
154
+ readonly IndeterminateComponent: 2;
155
+ readonly LazyComponent: 16;
156
+ readonly LegacyHiddenComponent: -1;
157
+ readonly MemoComponent: 14;
158
+ readonly Mode: 8;
159
+ readonly OffscreenComponent: -1;
160
+ readonly Profiler: 12;
161
+ readonly ScopeComponent: -1;
162
+ readonly SimpleMemoComponent: 15;
163
+ readonly SuspenseComponent: 13;
164
+ readonly SuspenseListComponent: 19;
165
+ readonly Throw: -1;
166
+ readonly TracingMarkerComponent: -1;
167
+ readonly ViewTransitionComponent: -1;
168
+ readonly YieldComponent: -1;
169
+ };
170
+ readonly "17.0.0-alpha": {
171
+ readonly ActivityComponent: -1;
172
+ readonly CacheComponent: -1;
173
+ readonly ClassComponent: 1;
174
+ readonly ContextConsumer: 9;
175
+ readonly ContextProvider: 10;
176
+ readonly CoroutineComponent: -1;
177
+ readonly CoroutineHandlerPhase: -1;
178
+ readonly DehydratedSuspenseComponent: 18;
179
+ readonly ForwardRef: 11;
180
+ readonly Fragment: 7;
181
+ readonly FunctionComponent: 0;
182
+ readonly HostComponent: 5;
183
+ readonly HostHoistable: -1;
184
+ readonly HostPortal: 4;
185
+ readonly HostRoot: 3;
186
+ readonly HostSingleton: -1;
187
+ readonly HostText: 6;
188
+ readonly IncompleteClassComponent: 17;
189
+ readonly IncompleteFunctionComponent: -1;
190
+ readonly IndeterminateComponent: 2;
191
+ readonly LazyComponent: 16;
192
+ readonly LegacyHiddenComponent: 24;
193
+ readonly MemoComponent: 14;
194
+ readonly Mode: 8;
195
+ readonly OffscreenComponent: 23;
196
+ readonly Profiler: 12;
197
+ readonly ScopeComponent: 21;
198
+ readonly SimpleMemoComponent: 15;
199
+ readonly SuspenseComponent: 13;
200
+ readonly SuspenseListComponent: 19;
201
+ readonly Throw: -1;
202
+ readonly TracingMarkerComponent: -1;
203
+ readonly ViewTransitionComponent: -1;
204
+ readonly YieldComponent: -1;
205
+ };
206
+ readonly "17.0.2": {
207
+ readonly ActivityComponent: 31;
208
+ readonly CacheComponent: 24;
209
+ readonly ClassComponent: 1;
210
+ readonly ContextConsumer: 9;
211
+ readonly ContextProvider: 10;
212
+ readonly CoroutineComponent: -1;
213
+ readonly CoroutineHandlerPhase: -1;
214
+ readonly DehydratedSuspenseComponent: 18;
215
+ readonly ForwardRef: 11;
216
+ readonly Fragment: 7;
217
+ readonly FunctionComponent: 0;
218
+ readonly HostComponent: 5;
219
+ readonly HostHoistable: 26;
220
+ readonly HostPortal: 4;
221
+ readonly HostRoot: 3;
222
+ readonly HostSingleton: 27;
223
+ readonly HostText: 6;
224
+ readonly IncompleteClassComponent: 17;
225
+ readonly IncompleteFunctionComponent: 28;
226
+ readonly IndeterminateComponent: 2;
227
+ readonly LazyComponent: 16;
228
+ readonly LegacyHiddenComponent: 23;
229
+ readonly MemoComponent: 14;
230
+ readonly Mode: 8;
231
+ readonly OffscreenComponent: 22;
232
+ readonly Profiler: 12;
233
+ readonly ScopeComponent: 21;
234
+ readonly SimpleMemoComponent: 15;
235
+ readonly SuspenseComponent: 13;
236
+ readonly SuspenseListComponent: 19;
237
+ readonly Throw: 29;
238
+ readonly TracingMarkerComponent: 25;
239
+ readonly ViewTransitionComponent: 30;
240
+ readonly YieldComponent: -1;
241
+ };
242
+ };
243
+ export type ReactWorkTagVersion = keyof typeof reactWorkTagsByVersion;
244
+ export interface GetReactWorkTags {
245
+ <Version extends ReactWorkTagVersion>(
246
+ reactVersion: Version,
247
+ ): Readonly<(typeof reactWorkTagsByVersion)[Version]>;
248
+ (reactVersion: string): Readonly<ReactWorkTagMap>;
249
+ }
250
+ export type ReactWorkTag = Exclude<
251
+ (typeof reactWorkTagsByVersion)[ReactWorkTagVersion][keyof ReactWorkTagMap],
252
+ -1
253
+ >;
254
+ export type HostWorkTag = Exclude<
255
+ | (typeof reactWorkTagsByVersion)[ReactWorkTagVersion]["HostComponent"]
256
+ | (typeof reactWorkTagsByVersion)[ReactWorkTagVersion]["HostHoistable"]
257
+ | (typeof reactWorkTagsByVersion)[ReactWorkTagVersion]["HostSingleton"]
258
+ | (typeof reactWorkTagsByVersion)[ReactWorkTagVersion]["HostText"],
259
+ -1
260
+ >;
261
+ export declare const getReactWorkTags: GetReactWorkTags;
@@ -0,0 +1,240 @@
1
+ import { compareSemver } from "../semver.js";
2
+ export const ReactBuildType = {
3
+ Development: 1,
4
+ Production: 0,
5
+ };
6
+ export const ReactFiberFlags = {
7
+ ChildDeletion: 16,
8
+ Cloned: 8,
9
+ ContentReset: 32,
10
+ Hydrating: 4096,
11
+ PerformedWork: 1,
12
+ Placement: 2,
13
+ Snapshot: 1024,
14
+ Update: 4,
15
+ Visibility: 8192,
16
+ };
17
+ export const ReactSymbols = {
18
+ CONCURRENT_MODE_NUMBER: 60111,
19
+ CONCURRENT_MODE_SYMBOL_DESCRIPTION: "react.concurrent_mode",
20
+ CONCURRENT_MODE_SYMBOL_STRING: "Symbol(react.concurrent_mode)",
21
+ DEPRECATED_ASYNC_MODE_SYMBOL_DESCRIPTION: "react.async_mode",
22
+ DEPRECATED_ASYNC_MODE_SYMBOL_STRING: "Symbol(react.async_mode)",
23
+ ELEMENT_SYMBOL_STRING: "Symbol(react.transitional.element)",
24
+ LEGACY_ELEMENT_SYMBOL_STRING: "Symbol(react.element)",
25
+ };
26
+ const defineReactWorkTags = (workTags) => workTags;
27
+ const reactWorkTagsByVersion = defineReactWorkTags({
28
+ "16.0.0": {
29
+ ActivityComponent: -1,
30
+ CacheComponent: -1,
31
+ ClassComponent: 2,
32
+ ContextConsumer: 12,
33
+ ContextProvider: 13,
34
+ CoroutineComponent: 7,
35
+ CoroutineHandlerPhase: 8,
36
+ DehydratedSuspenseComponent: -1,
37
+ ForwardRef: 14,
38
+ Fragment: 10,
39
+ FunctionComponent: 1,
40
+ HostComponent: 5,
41
+ HostHoistable: -1,
42
+ HostPortal: 4,
43
+ HostRoot: 3,
44
+ HostSingleton: -1,
45
+ HostText: 6,
46
+ IncompleteClassComponent: -1,
47
+ IncompleteFunctionComponent: -1,
48
+ IndeterminateComponent: 0,
49
+ LazyComponent: -1,
50
+ LegacyHiddenComponent: -1,
51
+ MemoComponent: -1,
52
+ Mode: 11,
53
+ OffscreenComponent: -1,
54
+ Profiler: 15,
55
+ ScopeComponent: -1,
56
+ SimpleMemoComponent: -1,
57
+ SuspenseComponent: 16,
58
+ SuspenseListComponent: -1,
59
+ Throw: -1,
60
+ TracingMarkerComponent: -1,
61
+ ViewTransitionComponent: -1,
62
+ YieldComponent: 9,
63
+ },
64
+ "16.4.3-alpha": {
65
+ ActivityComponent: -1,
66
+ CacheComponent: -1,
67
+ ClassComponent: 2,
68
+ ContextConsumer: 11,
69
+ ContextProvider: 12,
70
+ CoroutineComponent: -1,
71
+ CoroutineHandlerPhase: -1,
72
+ DehydratedSuspenseComponent: -1,
73
+ ForwardRef: 13,
74
+ Fragment: 9,
75
+ FunctionComponent: 0,
76
+ HostComponent: 7,
77
+ HostHoistable: -1,
78
+ HostPortal: 6,
79
+ HostRoot: 5,
80
+ HostSingleton: -1,
81
+ HostText: 8,
82
+ IncompleteClassComponent: -1,
83
+ IncompleteFunctionComponent: -1,
84
+ IndeterminateComponent: 4,
85
+ LazyComponent: -1,
86
+ LegacyHiddenComponent: -1,
87
+ MemoComponent: -1,
88
+ Mode: 10,
89
+ OffscreenComponent: -1,
90
+ Profiler: 15,
91
+ ScopeComponent: -1,
92
+ SimpleMemoComponent: -1,
93
+ SuspenseComponent: 16,
94
+ SuspenseListComponent: -1,
95
+ Throw: -1,
96
+ TracingMarkerComponent: -1,
97
+ ViewTransitionComponent: -1,
98
+ YieldComponent: -1,
99
+ },
100
+ "16.6.0-beta.0": {
101
+ ActivityComponent: -1,
102
+ CacheComponent: -1,
103
+ ClassComponent: 1,
104
+ ContextConsumer: 9,
105
+ ContextProvider: 10,
106
+ CoroutineComponent: -1,
107
+ CoroutineHandlerPhase: -1,
108
+ DehydratedSuspenseComponent: 18,
109
+ ForwardRef: 11,
110
+ Fragment: 7,
111
+ FunctionComponent: 0,
112
+ HostComponent: 5,
113
+ HostHoistable: -1,
114
+ HostPortal: 4,
115
+ HostRoot: 3,
116
+ HostSingleton: -1,
117
+ HostText: 6,
118
+ IncompleteClassComponent: 17,
119
+ IncompleteFunctionComponent: -1,
120
+ IndeterminateComponent: 2,
121
+ LazyComponent: 16,
122
+ LegacyHiddenComponent: -1,
123
+ MemoComponent: 14,
124
+ Mode: 8,
125
+ OffscreenComponent: -1,
126
+ Profiler: 12,
127
+ ScopeComponent: -1,
128
+ SimpleMemoComponent: 15,
129
+ SuspenseComponent: 13,
130
+ SuspenseListComponent: 19,
131
+ Throw: -1,
132
+ TracingMarkerComponent: -1,
133
+ ViewTransitionComponent: -1,
134
+ YieldComponent: -1,
135
+ },
136
+ "17.0.0-alpha": {
137
+ ActivityComponent: -1,
138
+ CacheComponent: -1,
139
+ ClassComponent: 1,
140
+ ContextConsumer: 9,
141
+ ContextProvider: 10,
142
+ CoroutineComponent: -1,
143
+ CoroutineHandlerPhase: -1,
144
+ DehydratedSuspenseComponent: 18,
145
+ ForwardRef: 11,
146
+ Fragment: 7,
147
+ FunctionComponent: 0,
148
+ HostComponent: 5,
149
+ HostHoistable: -1,
150
+ HostPortal: 4,
151
+ HostRoot: 3,
152
+ HostSingleton: -1,
153
+ HostText: 6,
154
+ IncompleteClassComponent: 17,
155
+ IncompleteFunctionComponent: -1,
156
+ IndeterminateComponent: 2,
157
+ LazyComponent: 16,
158
+ LegacyHiddenComponent: 24,
159
+ MemoComponent: 14,
160
+ Mode: 8,
161
+ OffscreenComponent: 23,
162
+ Profiler: 12,
163
+ ScopeComponent: 21,
164
+ SimpleMemoComponent: 15,
165
+ SuspenseComponent: 13,
166
+ SuspenseListComponent: 19,
167
+ Throw: -1,
168
+ TracingMarkerComponent: -1,
169
+ ViewTransitionComponent: -1,
170
+ YieldComponent: -1,
171
+ },
172
+ "17.0.2": {
173
+ ActivityComponent: 31,
174
+ CacheComponent: 24,
175
+ ClassComponent: 1,
176
+ ContextConsumer: 9,
177
+ ContextProvider: 10,
178
+ CoroutineComponent: -1,
179
+ CoroutineHandlerPhase: -1,
180
+ DehydratedSuspenseComponent: 18,
181
+ ForwardRef: 11,
182
+ Fragment: 7,
183
+ FunctionComponent: 0,
184
+ HostComponent: 5,
185
+ HostHoistable: 26,
186
+ HostPortal: 4,
187
+ HostRoot: 3,
188
+ HostSingleton: 27,
189
+ HostText: 6,
190
+ IncompleteClassComponent: 17,
191
+ IncompleteFunctionComponent: 28,
192
+ IndeterminateComponent: 2,
193
+ LazyComponent: 16,
194
+ LegacyHiddenComponent: 23,
195
+ MemoComponent: 14,
196
+ Mode: 8,
197
+ OffscreenComponent: 22,
198
+ Profiler: 12,
199
+ ScopeComponent: 21,
200
+ SimpleMemoComponent: 15,
201
+ SuspenseComponent: 13,
202
+ SuspenseListComponent: 19,
203
+ Throw: 29,
204
+ TracingMarkerComponent: 25,
205
+ ViewTransitionComponent: 30,
206
+ YieldComponent: -1,
207
+ },
208
+ });
209
+ const reactWorkTagRanges = [
210
+ {
211
+ isMinimumExcluded: true,
212
+ minimumVersion: "17.0.1",
213
+ workTags: reactWorkTagsByVersion["17.0.2"],
214
+ },
215
+ {
216
+ isMinimumExcluded: false,
217
+ minimumVersion: "17.0.0-alpha",
218
+ workTags: reactWorkTagsByVersion["17.0.0-alpha"],
219
+ },
220
+ {
221
+ isMinimumExcluded: false,
222
+ minimumVersion: "16.6.0-beta.0",
223
+ workTags: reactWorkTagsByVersion["16.6.0-beta.0"],
224
+ },
225
+ {
226
+ isMinimumExcluded: false,
227
+ minimumVersion: "16.4.3-alpha",
228
+ workTags: reactWorkTagsByVersion["16.4.3-alpha"],
229
+ },
230
+ ];
231
+ export const getReactWorkTags = (reactVersion) => {
232
+ for (const range of reactWorkTagRanges) {
233
+ const comparison = compareSemver(reactVersion, range.minimumVersion);
234
+ if (comparison === null) return reactWorkTagsByVersion["17.0.2"];
235
+ if (comparison === 1 || (comparison === 0 && !range.isMinimumExcluded)) {
236
+ return range.workTags;
237
+ }
238
+ }
239
+ return reactWorkTagsByVersion["16.0.0"];
240
+ };