test-renderer 0.12.0 → 0.13.1
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 +87 -110
- package/dist/index.cjs +26 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -10
- package/dist/index.d.ts +8 -10
- package/dist/index.js +24 -6
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -1,27 +1,22 @@
|
|
|
1
1
|
# Test Renderer for React
|
|
2
2
|
|
|
3
|
-
A lightweight,
|
|
3
|
+
A lightweight, JS-only building block for creating Testing Library-style libraries.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
This library is used by [React Native Testing Library](https://github.com/callstack/react-native-testing-library) but is written generically to support different React variants and custom renderers.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
- **Universal** - Can be used to simulate React Native or any other React renderer
|
|
9
|
-
- **React 19 Ready** - Modern alternative as React Test Renderer is now deprecated
|
|
10
|
-
- **Lightweight** - Minimal dependencies and small bundle size
|
|
11
|
-
- **Type-safe** - Written in TypeScript with full type definitions
|
|
12
|
-
- **Flexible Configuration** - Customizable reconciler options for different use cases
|
|
7
|
+
This library also serves as a replacement for the deprecated React Test Renderer. It is built using [React Reconciler](https://github.com/facebook/react/tree/main/packages/react-reconciler) to provide a custom renderer that operates on host elements by default, with proper escape hatches when needed. Most React Reconciler options are exposed for maximum flexibility.
|
|
13
8
|
|
|
14
9
|
## Installation
|
|
15
10
|
|
|
16
11
|
```bash
|
|
17
|
-
|
|
12
|
+
yarn add -D test-renderer
|
|
18
13
|
```
|
|
19
14
|
|
|
20
|
-
##
|
|
15
|
+
## Getting Started
|
|
21
16
|
|
|
22
17
|
```tsx
|
|
23
|
-
import { act } from "react";
|
|
24
18
|
import { createRoot } from "test-renderer";
|
|
19
|
+
import { act } from "react";
|
|
25
20
|
|
|
26
21
|
test("renders a component", async () => {
|
|
27
22
|
const renderer = createRoot();
|
|
@@ -45,144 +40,126 @@ test("renders a component", async () => {
|
|
|
45
40
|
|
|
46
41
|
### `createRoot(options?)`
|
|
47
42
|
|
|
48
|
-
Creates a new test renderer instance.
|
|
43
|
+
Creates a new test renderer root instance.
|
|
49
44
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
45
|
+
**Parameters:**
|
|
46
|
+
|
|
47
|
+
- `options` (optional): Configuration options for the renderer. See [`RootOptions`](#rootoptions) below.
|
|
53
48
|
|
|
54
|
-
Returns
|
|
49
|
+
**Returns:** A `Root` object with the following properties:
|
|
55
50
|
|
|
56
|
-
- `render(element)
|
|
57
|
-
- `unmount()
|
|
58
|
-
- `container
|
|
51
|
+
- `render(element: ReactElement)`: Renders a React element into the root. Must be called within `act()`.
|
|
52
|
+
- `unmount()`: Unmounts the root and cleans up. Must be called within `act()`.
|
|
53
|
+
- `container`: A `HostElement` wrapper that contains the rendered element(s). Use this to query and inspect the rendered tree.
|
|
54
|
+
|
|
55
|
+
**Example:**
|
|
56
|
+
|
|
57
|
+
```tsx
|
|
58
|
+
const renderer = createRoot();
|
|
59
|
+
await act(async () => {
|
|
60
|
+
renderer.render(<div>Hello!</div>);
|
|
61
|
+
});
|
|
62
|
+
```
|
|
59
63
|
|
|
60
64
|
### `RootOptions`
|
|
61
65
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
|
65
|
-
|
|
|
66
|
-
| `
|
|
67
|
-
| `
|
|
68
|
-
| `
|
|
69
|
-
| `
|
|
70
|
-
| `
|
|
66
|
+
Configuration options for the test renderer. Many of these options correspond to React Reconciler configuration options. For detailed information about reconciler-specific options, refer to the [React Reconciler source code](https://github.com/facebook/react/tree/main/packages/react-reconciler).
|
|
67
|
+
|
|
68
|
+
| Option | Type | Description |
|
|
69
|
+
| -------------------------- | ------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
70
|
+
| `textComponentTypes` | `string[]` | Types of host components that are allowed to contain text nodes. Trying to render text outside of these components will throw an error. Useful for simulating React Native's text rendering rules. |
|
|
71
|
+
| `publicTextComponentTypes` | `string[]` | Host component types to display to users in error messages when they try to render text outside of `textComponentTypes`. Defaults to `textComponentTypes` if not provided. |
|
|
72
|
+
| `createNodeMock` | `(element: ReactElement) => object` | Function to create mock objects for refs. Called once per element that has a ref. Defaults to returning an empty object. |
|
|
73
|
+
| `identifierPrefix` | `string` | A string prefix React uses for IDs generated by `useId()`. Useful to avoid conflicts when using multiple roots. |
|
|
74
|
+
| `isStrictMode` | `boolean` | Enable React Strict Mode. When enabled, components render twice and effects run twice in development. |
|
|
75
|
+
| `onCaughtError` | `(error: unknown, errorInfo: { componentStack?: string }) => void` | Callback called when React catches an error in an Error Boundary. Called with the error caught by the Error Boundary and an errorInfo object containing the component stack. |
|
|
76
|
+
| `onUncaughtError` | `(error: unknown, errorInfo: { componentStack?: string }) => void` | Callback called when an error is thrown and not caught by an Error Boundary. Called with the error that was thrown and an errorInfo object containing the component stack. |
|
|
77
|
+
| `onRecoverableError` | `(error: unknown, errorInfo: { componentStack?: string }) => void` | Callback called when React automatically recovers from errors. Called with an error React throws and an errorInfo object containing the component stack. Some recoverable errors may include the original error cause as `error.cause`. |
|
|
71
78
|
|
|
72
79
|
### `HostElement`
|
|
73
80
|
|
|
74
|
-
|
|
81
|
+
A wrapper around rendered host elements that provides a DOM-like API for querying and inspecting the rendered tree.
|
|
82
|
+
|
|
83
|
+
**Properties:**
|
|
75
84
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
| `
|
|
80
|
-
|
|
81
|
-
| `parent` | Parent element or `null` |
|
|
82
|
-
| `toJSON()` | Convert to JSON for snapshots |
|
|
83
|
-
| `queryAll(predicate, options?)` | Find all matching descendant elements |
|
|
85
|
+
- `type: string`: The element type (e.g., `"View"`, `"div"`). Returns an empty string for the container element.
|
|
86
|
+
- `props: HostElementProps`: The element's props object.
|
|
87
|
+
- `children: HostNode[]`: Array of child nodes (elements and text strings). Hidden children are excluded.
|
|
88
|
+
- `parent: HostElement | null`: The parent element, or `null` if this is the root container.
|
|
89
|
+
- `unstable_fiber: Fiber | null`: Access to the underlying React Fiber node. **Warning:** This is an unstable API that exposes internal React Reconciler structures which may change without warning in future React versions. Use with caution and only when absolutely necessary.
|
|
84
90
|
|
|
85
|
-
|
|
91
|
+
**Methods:**
|
|
86
92
|
|
|
87
|
-
|
|
93
|
+
- `toJSON(): JsonElement | null`: Converts this element to a JSON representation suitable for snapshots. Returns `null` if the element is hidden.
|
|
94
|
+
- `queryAll(predicate: (element: HostElement) => boolean, options?: QueryOptions): HostElement[]`: Finds all descendant elements matching the predicate. See [Query Options](#query-options) below.
|
|
95
|
+
|
|
96
|
+
**Example:**
|
|
88
97
|
|
|
89
98
|
```tsx
|
|
90
99
|
const renderer = createRoot();
|
|
91
100
|
await act(async () => {
|
|
92
|
-
renderer.render(
|
|
93
|
-
<div>
|
|
94
|
-
<button data-testid="btn-1">First</button>
|
|
95
|
-
<button data-testid="btn-2">Second</button>
|
|
96
|
-
</div>,
|
|
97
|
-
);
|
|
101
|
+
renderer.render(<div className="container">Hello</div>);
|
|
98
102
|
});
|
|
99
103
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
expect(
|
|
103
|
-
|
|
104
|
-
// Find by props
|
|
105
|
-
const btn1 = renderer.container.queryAll((el) => el.props["data-testid"] === "btn-1");
|
|
106
|
-
expect(btn1[0].children).toContain("First");
|
|
104
|
+
const root = renderer.container.children[0] as HostElement;
|
|
105
|
+
expect(root.type).toBe("div");
|
|
106
|
+
expect(root.props.className).toBe("container");
|
|
107
|
+
expect(root.children).toContain("Hello");
|
|
107
108
|
```
|
|
108
109
|
|
|
109
|
-
###
|
|
110
|
+
### `QueryOptions`
|
|
110
111
|
|
|
111
|
-
|
|
112
|
-
queryAll(predicate, {
|
|
113
|
-
includeSelf: false, // Include the element itself in results
|
|
114
|
-
matchDeepestOnly: false, // Only return deepest matches (exclude ancestors)
|
|
115
|
-
});
|
|
116
|
-
```
|
|
112
|
+
Options for configuring element queries.
|
|
117
113
|
|
|
118
|
-
|
|
114
|
+
| Option | Type | Default | Description |
|
|
115
|
+
| ------------------ | --------- | ------- | -------------------------------------------------------------------------------------------------------------------- |
|
|
116
|
+
| `includeSelf` | `boolean` | `false` | Include the element itself in the results if it matches the predicate. |
|
|
117
|
+
| `matchDeepestOnly` | `boolean` | `false` | Exclude any ancestors of deepest matched elements even if they match the predicate. Only return the deepest matches. |
|
|
119
118
|
|
|
120
|
-
|
|
119
|
+
**Example:**
|
|
121
120
|
|
|
122
121
|
```tsx
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
const renderer = createRoot({
|
|
126
|
-
textComponents: ["Text", "RCTText"],
|
|
127
|
-
});
|
|
122
|
+
// Find all divs, including nested ones
|
|
123
|
+
const allDivs = container.queryAll((el) => el.type === "div");
|
|
128
124
|
|
|
129
|
-
//
|
|
130
|
-
|
|
131
|
-
renderer.render(createElement("Text", null, "Hello!"));
|
|
132
|
-
});
|
|
125
|
+
// Find only the deepest divs (exclude parent divs if they contain matching children)
|
|
126
|
+
const deepestDivs = container.queryAll((el) => el.type === "div", { matchDeepestOnly: true });
|
|
133
127
|
|
|
134
|
-
//
|
|
135
|
-
|
|
136
|
-
renderer.render(<View>Hello!</View>); // Error!
|
|
137
|
-
});
|
|
128
|
+
// Include the container itself if it matches
|
|
129
|
+
const includingSelf = container.queryAll((el) => el.type === "div", { includeSelf: true });
|
|
138
130
|
```
|
|
139
131
|
|
|
140
|
-
##
|
|
132
|
+
## Migration from React Test Renderer
|
|
133
|
+
|
|
134
|
+
This library serves as a replacement for the deprecated React Test Renderer. The main differences are:
|
|
135
|
+
|
|
136
|
+
- **Host element focus**: This library operates on host components by default, while React Test Renderer worked with a mix of host and composite components. You can access the underlying fiber via `unstable_fiber` if needed.
|
|
137
|
+
- **Built on React Reconciler**: This library is built using React Reconciler, providing a custom renderer implementation.
|
|
138
|
+
- **Exposed reconciler options**: Most React Reconciler configuration options are exposed through `RootOptions` for maximum flexibility.
|
|
141
139
|
|
|
142
|
-
|
|
140
|
+
For most use cases, the migration is straightforward:
|
|
143
141
|
|
|
144
142
|
```tsx
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
return {
|
|
149
|
-
focus: jest.fn(),
|
|
150
|
-
value: "",
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
return {};
|
|
154
|
-
},
|
|
155
|
-
});
|
|
143
|
+
// Before (React Test Renderer)
|
|
144
|
+
import TestRenderer from "react-test-renderer";
|
|
145
|
+
const tree = TestRenderer.create(<MyComponent />);
|
|
156
146
|
|
|
147
|
+
// After (test-renderer)
|
|
148
|
+
import { createRoot } from "test-renderer";
|
|
149
|
+
const root = createRoot();
|
|
157
150
|
await act(async () => {
|
|
158
|
-
|
|
151
|
+
root.render(<MyComponent />);
|
|
159
152
|
});
|
|
160
|
-
|
|
161
|
-
// inputRef.current is now the mock object
|
|
162
|
-
inputRef.current.focus();
|
|
153
|
+
const tree = root.container;
|
|
163
154
|
```
|
|
164
155
|
|
|
165
|
-
##
|
|
166
|
-
|
|
167
|
-
Handle React errors with custom callbacks:
|
|
168
|
-
|
|
169
|
-
```tsx
|
|
170
|
-
const renderer = createRoot({
|
|
171
|
-
onCaughtError: (error, errorInfo) => {
|
|
172
|
-
// Called when an Error Boundary catches an error
|
|
173
|
-
console.log("Caught:", error.message);
|
|
174
|
-
console.log("Component stack:", errorInfo.componentStack);
|
|
175
|
-
},
|
|
176
|
-
onUncaughtError: (error, errorInfo) => {
|
|
177
|
-
// Called for uncaught render errors
|
|
178
|
-
},
|
|
179
|
-
});
|
|
180
|
-
```
|
|
156
|
+
## Supported React Features
|
|
181
157
|
|
|
182
|
-
|
|
158
|
+
This library supports all modern React features including:
|
|
183
159
|
|
|
184
|
-
-
|
|
185
|
-
-
|
|
160
|
+
- Concurrent rendering
|
|
161
|
+
- Error boundaries
|
|
162
|
+
- Suspense boundaries
|
|
186
163
|
|
|
187
164
|
## License
|
|
188
165
|
|
package/dist/index.cjs
CHANGED
|
@@ -64,7 +64,7 @@ __export(index_exports, {
|
|
|
64
64
|
module.exports = __toCommonJS(index_exports);
|
|
65
65
|
|
|
66
66
|
// src/renderer.ts
|
|
67
|
-
var
|
|
67
|
+
var import_constants6 = require("react-reconciler/constants");
|
|
68
68
|
|
|
69
69
|
// src/constants.ts
|
|
70
70
|
var Tag = {
|
|
@@ -73,6 +73,7 @@ var Tag = {
|
|
|
73
73
|
Text: "TEXT"
|
|
74
74
|
};
|
|
75
75
|
var CONTAINER_TYPE = "";
|
|
76
|
+
var REACT_CONTEXT_TYPE = /* @__PURE__ */ Symbol.for("react.context");
|
|
76
77
|
|
|
77
78
|
// src/query-all.ts
|
|
78
79
|
function queryAll(element, predicate, options) {
|
|
@@ -658,8 +659,6 @@ var hostConfig = {
|
|
|
658
659
|
* be aware that it may change significantly between versions. You're taking on additional maintenance risk by
|
|
659
660
|
* reading from it, and giving up all guarantees if you write something to it.
|
|
660
661
|
*/
|
|
661
|
-
// @ts-expect-error @types/react-reconciler types don't fully match react-reconciler's actual Flow types.
|
|
662
|
-
// Correctness is verified through tests.
|
|
663
662
|
commitUpdate(instance, type, _prevProps, nextProps, internalHandle) {
|
|
664
663
|
instance.type = type;
|
|
665
664
|
instance.props = nextProps;
|
|
@@ -767,10 +766,29 @@ var hostConfig = {
|
|
|
767
766
|
// File an issue if you need help.
|
|
768
767
|
// -------------------
|
|
769
768
|
supportsHydration: false,
|
|
769
|
+
requestPostPaintCallback(_callback) {
|
|
770
|
+
},
|
|
770
771
|
NotPendingTransition: null,
|
|
772
|
+
// Based on: https://github.com/facebook/react/blob/main/packages/react-test-renderer/src/ReactFiberConfigTestHost.js#L606
|
|
773
|
+
HostTransitionContext: {
|
|
774
|
+
$$typeof: REACT_CONTEXT_TYPE,
|
|
775
|
+
Consumer: null,
|
|
776
|
+
Provider: null,
|
|
777
|
+
_currentValue: null,
|
|
778
|
+
_currentValue2: null,
|
|
779
|
+
_threadCount: 0
|
|
780
|
+
},
|
|
771
781
|
resetFormInstance(_form) {
|
|
772
782
|
},
|
|
773
|
-
|
|
783
|
+
trackSchedulerEvent: function() {
|
|
784
|
+
},
|
|
785
|
+
// Based on: https://github.com/facebook/react/blob/main/packages/react-test-renderer/src/ReactFiberConfigTestHost.js#L256
|
|
786
|
+
resolveEventType: function() {
|
|
787
|
+
return null;
|
|
788
|
+
},
|
|
789
|
+
// Based on: https://github.com/facebook/react/blob/main/packages/react-test-renderer/src/ReactFiberConfigTestHost.js#L259
|
|
790
|
+
resolveEventTimeStamp: function() {
|
|
791
|
+
return -1.1;
|
|
774
792
|
}
|
|
775
793
|
};
|
|
776
794
|
var TestReconciler = (0, import_react_reconciler.default)(hostConfig);
|
|
@@ -823,7 +841,7 @@ function createRoot(options) {
|
|
|
823
841
|
};
|
|
824
842
|
let containerFiber = TestReconciler.createContainer(
|
|
825
843
|
container,
|
|
826
|
-
|
|
844
|
+
import_constants6.ConcurrentRoot,
|
|
827
845
|
null,
|
|
828
846
|
// hydrationCallbacks
|
|
829
847
|
(_b = options == null ? void 0 : options.isStrictMode) != null ? _b : false,
|
|
@@ -832,10 +850,10 @@ function createRoot(options) {
|
|
|
832
850
|
(_c = options == null ? void 0 : options.identifierPrefix) != null ? _c : "",
|
|
833
851
|
(_d = options == null ? void 0 : options.onUncaughtError) != null ? _d : defaultOnUncaughtError,
|
|
834
852
|
(_e = options == null ? void 0 : options.onCaughtError) != null ? _e : defaultOnCaughtError,
|
|
835
|
-
// @ts-expect-error @types/react-reconciler types don't include onRecoverableError parameter
|
|
836
|
-
// in the createContainer signature, but react-reconciler's actual Flow types do.
|
|
837
|
-
// Correctness is verified through tests.
|
|
838
853
|
(_f = options == null ? void 0 : options.onRecoverableError) != null ? _f : defaultOnRecoverableError,
|
|
854
|
+
() => {
|
|
855
|
+
},
|
|
856
|
+
// onDefaultTransitionIndicator
|
|
839
857
|
null
|
|
840
858
|
// transitionCallbacks
|
|
841
859
|
);
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/renderer.ts","../src/constants.ts","../src/query-all.ts","../src/render-to-json.ts","../src/host-element.ts","../src/reconciler.ts","../src/utils.ts"],"sourcesContent":["export { createRoot } from \"./renderer\";\n\nexport type { Root, RootOptions, ErrorHandler, ErrorInfo } from \"./renderer\";\nexport type { HostElement, HostElementProps, HostNode } from \"./host-element\";\nexport type { JsonElement, JsonNode } from \"./render-to-json\";\nexport type { QueryOptions } from \"./query-all\";\n\n/**\n * React Fiber type from react-reconciler. Exported for advanced use cases only.\n * This type represents internal React structures that may change without warning.\n * Prefer using the stable HostElement API instead.\n */\nexport type { Fiber } from \"react-reconciler\";\n","import type { ReactElement } from \"react\";\nimport { ConcurrentRoot } from \"react-reconciler/constants\";\n\nimport { Tag } from \"./constants\";\nimport { HostElement } from \"./host-element\";\nimport type { Container } from \"./reconciler\";\nimport { TestReconciler } from \"./reconciler\";\n\n// Refs:\n// https://github.com/facebook/react/blob/main/packages/react-test-renderer/src/ReactFiberConfigTestHost.js\n// https://github.com/facebook/react/blob/main/packages/react-noop-renderer/src/createReactNoop.js\n// https://github.com/facebook/react/blob/main/packages/react-native-renderer/src/ReactFiberConfigFabric.js\n\nconst defaultCreateMockNode = () => ({});\n\nconst defaultOnUncaughtError = (error: unknown, errorInfo: ErrorInfo) => {\n console.error(\"Uncaught error:\", error, errorInfo);\n};\nconst defaultOnCaughtError = (error: unknown, errorInfo: ErrorInfo) => {\n console.error(\"Caught error:\", error, errorInfo);\n};\nconst defaultOnRecoverableError = (error: unknown, errorInfo: ErrorInfo) => {\n console.error(\"Recoverable error:\", error, errorInfo);\n};\n\n/**\n * Options for configuring the test renderer root.\n */\nexport type RootOptions = {\n /** Types of host components that are allowed to contain text nodes. Trying to render text outside of these components will throw an error. */\n textComponentTypes?: string[];\n\n /**\n * Host component types to display to users in the error message when they try to render text outside of `textComponentTypes`.\n * Defaults to `textComponentTypes`, but you may want to override the components mentioned in the error message.\n */\n publicTextComponentTypes?: string[];\n\n /** Function to create mock nodes for refs. */\n createNodeMock?: (element: ReactElement) => object;\n\n /** Callback called when React catches an error in an Error Boundary. Called with the error caught by the Error Boundary, and an errorInfo object containing the componentStack. */\n onCaughtError?: ErrorHandler;\n\n /** Callback called when an error is thrown and not caught by an Error Boundary. Called with the error that was thrown, and an errorInfo object containing the componentStack. */\n onUncaughtError?: ErrorHandler;\n\n /** Callback called when React automatically recovers from errors. Called with an error React throws, and an errorInfo object containing the componentStack. Some recoverable errors may include the original error cause as error.cause. */\n onRecoverableError?: ErrorHandler;\n\n /** A string prefix React uses for IDs generated by useId. Useful to avoid conflicts when using multiple roots on the same page. */\n identifierPrefix?: string;\n\n /** Enable React Strict Mode. */\n isStrictMode?: boolean;\n};\n\n/** Callback for handling React errors. */\nexport type ErrorHandler = (error: unknown, errorInfo: ErrorInfo) => void;\n\n/** Error information provided to error handlers. */\nexport type ErrorInfo = {\n componentStack: string;\n};\n\n/**\n * Root instance returned by createRoot. Provides methods to render and unmount components.\n */\nexport type Root = {\n /** Render a React element into the root. Must be called within act(). */\n render: (element: ReactElement) => void;\n /** Unmount the root and clean up. Must be called within act(). */\n unmount: () => void;\n /** The root container element. */\n container: HostElement;\n};\n\n/**\n * Create a new test renderer root instance.\n *\n * @param options - Optional configuration for the renderer.\n * @returns A Root instance with render, unmount, and container properties.\n */\nexport function createRoot(options?: RootOptions): Root {\n let container: Container | null = {\n tag: Tag.Container,\n parent: null,\n children: [],\n isHidden: false,\n config: {\n textComponentTypes: options?.textComponentTypes,\n publicTextComponentTypes: options?.publicTextComponentTypes,\n createNodeMock: options?.createNodeMock ?? defaultCreateMockNode,\n },\n };\n\n // @types/react-reconciler types don't fully match react-reconciler's actual Flow types.\n // The return type is correct at runtime but TypeScript can't verify it statically.\n // Correctness is verified through tests.\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n let containerFiber = TestReconciler.createContainer(\n container,\n ConcurrentRoot,\n null, // hydrationCallbacks\n options?.isStrictMode ?? false,\n false, // concurrentUpdatesByDefaultOverride\n options?.identifierPrefix ?? \"\",\n options?.onUncaughtError ?? defaultOnUncaughtError,\n options?.onCaughtError ?? defaultOnCaughtError,\n // @ts-expect-error @types/react-reconciler types don't include onRecoverableError parameter\n // in the createContainer signature, but react-reconciler's actual Flow types do.\n // Correctness is verified through tests.\n options?.onRecoverableError ?? defaultOnRecoverableError,\n null, // transitionCallbacks\n );\n\n const render = (element: ReactElement) => {\n if (containerFiber == null) {\n throw new Error(\"Cannot render after unmount\");\n }\n\n TestReconciler.updateContainer(element, containerFiber, null, null);\n };\n\n const unmount = () => {\n if (container == null) {\n return;\n }\n\n TestReconciler.updateContainer(null, containerFiber, null, null);\n\n containerFiber = null;\n container = null;\n };\n\n return {\n render,\n unmount,\n get container(): HostElement {\n if (container == null) {\n throw new Error(\"Cannot access .container on unmounted test renderer\");\n }\n\n return HostElement.fromInstance(container);\n },\n };\n}\n","export const Tag = {\n Container: \"CONTAINER\",\n Instance: \"INSTANCE\",\n Text: \"TEXT\",\n} as const;\n\n// Container should render as <>{...}</>\nexport const CONTAINER_TYPE = \"\";\n","import type { HostElement } from \"./host-element\";\n\n/**\n * Options for querying elements in the rendered tree.\n */\nexport interface QueryOptions {\n /** Include the element itself in the results if it matches the predicate. Defaults to false. */\n includeSelf?: boolean;\n\n /** Exclude any ancestors of deepest matched elements even if they match the predicate. Defaults to false. */\n matchDeepestOnly?: boolean;\n}\n\n/**\n * Find all descendant elements matching the predicate.\n *\n * @param element - Root element to search from.\n * @param predicate - Function that returns true for matching elements.\n * @param options - Optional query configuration.\n * @returns Array of matching elements in tree order.\n */\nexport function queryAll(\n element: HostElement,\n predicate: (element: HostElement) => boolean,\n options?: QueryOptions,\n): HostElement[] {\n const includeSelf = options?.includeSelf ?? false;\n const matchDeepestOnly = options?.matchDeepestOnly ?? false;\n\n const results: HostElement[] = [];\n\n // Match descendants first but do not add them to results yet.\n const matchingDescendants: HostElement[] = [];\n\n element.children.forEach((child) => {\n if (typeof child === \"string\") {\n return;\n }\n\n matchingDescendants.push(...queryAll(child, predicate, { ...options, includeSelf: true }));\n });\n\n if (\n includeSelf &&\n // When matchDeepestOnly = true: add current element only if no descendants match\n (matchingDescendants.length === 0 || !matchDeepestOnly) &&\n predicate(element)\n ) {\n results.push(element);\n }\n\n // Add matching descendants after element to preserve original tree walk order.\n results.push(...matchingDescendants);\n\n return results;\n}\n","import { CONTAINER_TYPE, Tag } from \"./constants\";\nimport type { Container, Instance, TextInstance } from \"./reconciler\";\n\n/** A node in the JSON representation - either a JsonElement or a text string. */\nexport type JsonNode = JsonElement | string;\n\n/**\n * JSON representation of a rendered element, compatible with react-test-renderer format.\n */\nexport type JsonElement = {\n type: string;\n props: object;\n children: Array<JsonNode> | null;\n $$typeof: symbol;\n};\n\nexport function renderContainerToJson(instance: Container): JsonElement {\n return {\n type: CONTAINER_TYPE,\n props: {},\n children: renderChildrenToJson(instance.children),\n $$typeof: Symbol.for(\"react.test.json\"),\n };\n}\n\nexport function renderInstanceToJson(instance: Instance): JsonElement | null {\n if (instance.isHidden) {\n return null;\n }\n\n // We don't include the `children` prop in JSON.\n // Instead, we will include the actual rendered children.\n const { children: _children, ...restProps } = instance.props;\n\n return {\n type: instance.type,\n props: restProps,\n children: renderChildrenToJson(instance.children),\n $$typeof: Symbol.for(\"react.test.json\"),\n };\n}\n\nexport function renderTextInstanceToJson(instance: TextInstance): string | null {\n if (instance.isHidden) {\n return null;\n }\n\n return instance.text;\n}\n\nexport function renderChildrenToJson(children: Array<Instance | TextInstance>): JsonNode[] {\n const result = [];\n\n for (const child of children) {\n if (child.tag === Tag.Instance) {\n const renderedChild = renderInstanceToJson(child);\n if (renderedChild !== null) {\n result.push(renderedChild);\n }\n } else {\n const renderedChild = renderTextInstanceToJson(child);\n if (renderedChild !== null) {\n result.push(renderedChild);\n }\n }\n }\n\n return result;\n}\n","import type { Fiber } from \"react-reconciler\";\n\nimport { CONTAINER_TYPE, Tag } from \"./constants\";\nimport type { QueryOptions } from \"./query-all\";\nimport { queryAll } from \"./query-all\";\nimport type { Container, Instance, TextInstance } from \"./reconciler\";\nimport type { JsonElement } from \"./render-to-json\";\nimport { renderContainerToJson, renderInstanceToJson } from \"./render-to-json\";\n\n/** A node in the rendered tree - either a HostElement or a text string. */\nexport type HostNode = HostElement | string;\n\n/** Props object for a host element. */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type HostElementProps = Record<string, any>;\n\nconst instanceMap = new WeakMap<Instance | Container, HostElement>();\n\n/**\n * Represents a rendered host element in the test renderer tree.\n * Provides a DOM-like API for querying and inspecting rendered components.\n */\nexport class HostElement {\n private instance: Instance | Container;\n\n private constructor(instance: Instance | Container) {\n this.instance = instance;\n }\n\n /** The element type (e.g., \"div\", \"span\"). Empty string for container. */\n get type(): string {\n return this.instance.tag === Tag.Instance ? this.instance.type : CONTAINER_TYPE;\n }\n\n /** The element's props object. */\n get props(): HostElementProps {\n return this.instance.tag === Tag.Instance ? this.instance.props : {};\n }\n\n /** The parent element, or null if this is the root container. */\n get parent(): HostElement | null {\n const parentInstance = this.instance.parent;\n if (parentInstance == null) {\n return null;\n }\n\n return HostElement.fromInstance(parentInstance);\n }\n\n /** Array of child nodes (elements and text strings). Hidden children are excluded. */\n get children(): HostNode[] {\n const result = this.instance.children\n .filter((child) => !child.isHidden)\n .map((child) => getHostNodeForInstance(child));\n return result;\n }\n\n /**\n * Access to the underlying React Fiber node. This is an unstable API that exposes\n * internal react-reconciler structures which may change without warning in future\n * React versions. Use with caution and only when absolutely necessary.\n *\n * @returns The Fiber node for this instance, or null if this is a container.\n */\n get unstable_fiber(): Fiber | null {\n return this.instance.tag === Tag.Instance ? this.instance.unstable_fiber : null;\n }\n\n /**\n * Convert this element to a JSON representation suitable for snapshots.\n *\n * @returns JSON element or null if the element is hidden.\n */\n toJSON(): JsonElement | null {\n return this.instance.tag === Tag.Container\n ? renderContainerToJson(this.instance)\n : renderInstanceToJson(this.instance);\n }\n\n /**\n * Find all descendant elements matching the predicate.\n *\n * @param predicate - Function that returns true for matching elements.\n * @param options - Optional query configuration.\n * @returns Array of matching elements.\n */\n queryAll(\n predicate: (element: HostElement, options?: QueryOptions) => boolean,\n options?: QueryOptions,\n ): HostElement[] {\n return queryAll(this, predicate, options);\n }\n\n /** @internal */\n static fromInstance(instance: Instance | Container): HostElement {\n const hostElement = instanceMap.get(instance);\n if (hostElement) {\n return hostElement;\n }\n\n const result = new HostElement(instance);\n instanceMap.set(instance, result);\n return result;\n }\n}\n\nfunction getHostNodeForInstance(instance: Instance | TextInstance): HostNode {\n switch (instance.tag) {\n case Tag.Text:\n return instance.text;\n\n case Tag.Instance:\n return HostElement.fromInstance(instance);\n }\n}\n","import type { ReactElement } from \"react\";\nimport type { Fiber } from \"react-reconciler\";\nimport ReactReconciler from \"react-reconciler\";\nimport { DefaultEventPriority, NoEventPriority } from \"react-reconciler/constants\";\n\nimport { Tag } from \"./constants\";\nimport { formatComponentList } from \"./utils\";\n\nexport type Type = string;\nexport type Props = Record<string, unknown>;\n\ntype ReconcilerConfig = {\n textComponentTypes?: string[];\n publicTextComponentTypes?: string[];\n createNodeMock: (element: ReactElement) => object;\n};\n\nexport type Container = {\n tag: typeof Tag.Container;\n parent: null;\n children: Array<Instance | TextInstance>;\n isHidden: false;\n config: ReconcilerConfig;\n};\n\nexport type Instance = {\n tag: typeof Tag.Instance;\n type: string;\n props: Props;\n children: Array<Instance | TextInstance>;\n parent: Container | Instance | null;\n rootContainer: Container;\n isHidden: boolean;\n unstable_fiber: Fiber;\n};\n\nexport type TextInstance = {\n tag: typeof Tag.Text;\n text: string;\n parent: Container | Instance | null;\n isHidden: boolean;\n};\n\nexport type SuspenseInstance = object;\nexport type HydratableInstance = object;\nexport type PublicInstance = object | TextInstance;\nexport type UpdatePayload = unknown;\nexport type ChildSet = unknown;\nexport type TimeoutHandle = unknown;\nexport type NoTimeout = unknown;\n\ntype HostContext = {\n type: string;\n isInsideText: boolean;\n config: ReconcilerConfig;\n};\n\nconst nodeToInstanceMap = new WeakMap<object, Instance>();\n\nlet currentUpdatePriority: number = NoEventPriority;\n\nconst hostConfig: ReactReconciler.HostConfig<\n Type,\n Props,\n Container,\n Instance,\n TextInstance,\n SuspenseInstance,\n HydratableInstance,\n PublicInstance,\n HostContext,\n UpdatePayload,\n ChildSet,\n TimeoutHandle,\n NoTimeout\n> = {\n /**\n * The reconciler has two modes: mutation mode and persistent mode. You must specify one of them.\n *\n * If your target platform is similar to the DOM and has methods similar to `appendChild`, `removeChild`,\n * and so on, you'll want to use the **mutation mode**. This is the same mode used by React DOM, React ART,\n * and the classic React Native renderer.\n *\n * ```js\n * const HostConfig = {\n * // ...\n * supportsMutation: true,\n * // ...\n * }\n * ```\n *\n * Depending on the mode, the reconciler will call different methods on your host config.\n * If you're not sure which one you want, you likely need the mutation mode.\n */\n supportsMutation: true,\n\n /**\n * The reconciler has two modes: mutation mode and persistent mode. You must specify one of them.\n *\n * If your target platform has immutable trees, you'll want the **persistent mode** instead. In that mode,\n * existing nodes are never mutated, and instead every change clones the parent tree and then replaces\n * the whole parent tree at the root. This is the node used by the new React Native renderer, codenamed \"Fabric\".\n *\n * ```js\n * const HostConfig = {\n * // ...\n * supportsPersistence: true,\n * // ...\n * }\n * ```\n *\n * Depending on the mode, the reconciler will call different methods on your host config.\n * If you're not sure which one you want, you likely need the mutation mode.\n */\n supportsPersistence: false,\n\n /**\n * #### `createInstance(type, props, rootContainer, hostContext, internalHandle)`\n *\n * This method should return a newly created node. For example, the DOM renderer would call\n * `document.createElement(type)` here and then set the properties from `props`.\n *\n * You can use `rootContainer` to access the root container associated with that tree. For example,\n * in the DOM renderer, this is useful to get the correct `document` reference that the root belongs to.\n *\n * The `hostContext` parameter lets you keep track of some information about your current place in\n * the tree. To learn more about it, see `getChildHostContext` below.\n *\n * The `internalHandle` data structure is meant to be opaque. If you bend the rules and rely on its\n * internal fields, be aware that it may change significantly between versions. You're taking on additional\n * maintenance risk by reading from it, and giving up all guarantees if you write something to it.\n *\n * This method happens **in the render phase**. It can (and usually should) mutate the node it has\n * just created before returning it, but it must not modify any other nodes. It must not register\n * any event handlers on the parent tree. This is because an instance being created doesn't guarantee\n * it would be placed in the tree — it could be left unused and later collected by GC. If you need to do\n * something when an instance is definitely in the tree, look at `commitMount` instead.\n */\n createInstance(\n type: Type,\n props: Props,\n rootContainer: Container,\n _hostContext: HostContext,\n internalHandle: Fiber,\n ) {\n return {\n tag: Tag.Instance,\n type,\n props,\n isHidden: false,\n children: [],\n parent: null,\n rootContainer,\n unstable_fiber: internalHandle,\n };\n },\n\n /**\n * #### `createTextInstance(text, rootContainer, hostContext, internalHandle)`\n *\n * Same as `createInstance`, but for text nodes. If your renderer doesn't support text nodes, you can\n * throw here.\n */\n createTextInstance(\n text: string,\n rootContainer: Container,\n hostContext: HostContext,\n _internalHandle: Fiber,\n ): TextInstance {\n if (rootContainer.config.textComponentTypes && !hostContext.isInsideText) {\n const componentTypes =\n rootContainer.config.publicTextComponentTypes ?? rootContainer.config.textComponentTypes;\n\n throw new Error(\n `Invariant Violation: Text strings must be rendered within a ${formatComponentList(\n componentTypes,\n )} component. Detected attempt to render \"${text}\" string within a <${\n hostContext.type\n }> component.`,\n );\n }\n\n return {\n tag: Tag.Text,\n text,\n parent: null,\n isHidden: false,\n };\n },\n\n /**\n * #### `appendInitialChild(parentInstance, child)`\n *\n * This method should mutate the `parentInstance` and add the child to its list of children.\n * For example, in the DOM this would translate to a `parentInstance.appendChild(child)` call.\n *\n * This method happens **in the render phase**. It can mutate `parentInstance` and `child`, but it\n * must not modify any other nodes. It's called while the tree is still being built up and not connected\n * to the actual tree on the screen.\n */\n appendInitialChild: appendChild,\n\n /**\n * #### `finalizeInitialChildren(instance, type, props, rootContainer, hostContext)`\n *\n * In this method, you can perform some final mutations on the `instance`. Unlike with `createInstance`,\n * by the time `finalizeInitialChildren` is called, all the initial children have already been added to\n * the `instance`, but the instance itself has not yet been connected to the tree on the screen.\n *\n * This method happens **in the render phase**. It can mutate `instance`, but it must not modify any other\n * nodes. It's called while the tree is still being built up and not connected to the actual tree on the screen.\n *\n * There is a second purpose to this method. It lets you specify whether there is some work that needs to\n * happen when the node is connected to the tree on the screen. If you return `true`, the instance will\n * receive a `commitMount` call later. See its documentation below.\n *\n * If you don't want to do anything here, you should return `false`.\n */\n finalizeInitialChildren(\n _instance: Instance,\n _type: Type,\n _props: Props,\n _rootContainer: Container,\n _hostContext: HostContext,\n ): boolean {\n return false;\n },\n\n /**\n * #### `shouldSetTextContent(type, props)`\n *\n * Some target platforms support setting an instance's text content without manually creating a text node.\n * For example, in the DOM, you can set `node.textContent` instead of creating a text node and appending it.\n *\n * If you return `true` from this method, React will assume that this node's children are text, and will\n * not create nodes for them. It will instead rely on you to have filled that text during `createInstance`.\n * This is a performance optimization. For example, the DOM renderer returns `true` only if `type` is a\n * known text-only parent (like `'textarea'`) or if `props.children` has a `'string'` type. If you return `true`,\n * you will need to implement `resetTextContent` too.\n *\n * If you don't want to do anything here, you should return `false`.\n * This method happens **in the render phase**. Do not mutate the tree from it.\n */\n shouldSetTextContent(_type: Type, _props: Props): boolean {\n return false;\n },\n\n setCurrentUpdatePriority(newPriority: number) {\n currentUpdatePriority = newPriority;\n },\n\n getCurrentUpdatePriority() {\n return currentUpdatePriority;\n },\n\n resolveUpdatePriority(): number {\n return currentUpdatePriority || DefaultEventPriority;\n },\n\n shouldAttemptEagerTransition() {\n return false;\n },\n\n /**\n * #### `getRootHostContext(rootContainer)`\n *\n * This method lets you return the initial host context from the root of the tree. See `getChildHostContext`\n * for the explanation of host context.\n *\n * If you don't intend to use host context, you can return `null`.\n * This method happens **in the render phase**. Do not mutate the tree from it.\n */\n getRootHostContext(rootContainer: Container): HostContext | null {\n return {\n type: \"ROOT\",\n config: rootContainer.config,\n isInsideText: false,\n };\n },\n\n /**\n * #### `getChildHostContext(parentHostContext, type, rootContainer)`\n *\n * Host context lets you track some information about where you are in the tree so that it's available\n * inside `createInstance` as the `hostContext` parameter. For example, the DOM renderer uses it to track\n * whether it's inside an HTML or an SVG tree, because `createInstance` implementation needs to be\n * different for them.\n *\n * If the node of this `type` does not influence the context you want to pass down, you can return\n * `parentHostContext`. Alternatively, you can return any custom object representing the information\n * you want to pass down.\n *\n * If you don't want to do anything here, return `parentHostContext`.\n *\n * This method happens **in the render phase**. Do not mutate the tree from it.\n */\n getChildHostContext(parentHostContext: HostContext, type: Type): HostContext {\n const isInsideText = Boolean(parentHostContext.config.textComponentTypes?.includes(type));\n return { ...parentHostContext, type: type, isInsideText };\n },\n\n /**\n * #### `getPublicInstance(instance)`\n *\n * Determines what object gets exposed as a ref. You'll likely want to return the `instance` itself. But\n * in some cases it might make sense to only expose some part of it.\n *\n * If you don't want to do anything here, return `instance`.\n */\n getPublicInstance(instance: Instance | TextInstance): PublicInstance {\n switch (instance.tag) {\n case Tag.Instance: {\n const createNodeMock = instance.rootContainer.config.createNodeMock;\n const mockNode = createNodeMock({\n type: instance.type,\n props: instance.props,\n key: null,\n });\n\n nodeToInstanceMap.set(mockNode, instance);\n\n return mockNode;\n }\n\n default:\n return instance;\n }\n },\n\n /**\n * #### `prepareForCommit(containerInfo)`\n *\n * This method lets you store some information before React starts making changes to the tree on\n * the screen. For example, the DOM renderer stores the current text selection so that it can later\n * restore it. This method is mirrored by `resetAfterCommit`.\n *\n * Even if you don't want to do anything here, you need to return `null` from it.\n */\n prepareForCommit(_containerInfo: Container) {\n return null; // noop\n },\n\n /**\n * #### `resetAfterCommit(containerInfo)`\n *\n * This method is called right after React has performed the tree mutations. You can use it to restore\n * something you've stored in `prepareForCommit` — for example, text selection.\n *\n * You can leave it empty.\n */\n resetAfterCommit(_containerInfo: Container): void {\n // noop\n },\n\n /**\n * #### `preparePortalMount(containerInfo)`\n *\n * This method is called for a container that's used as a portal target. Usually you can leave it empty.\n */\n preparePortalMount(_containerInfo: Container): void {\n // noop\n },\n\n /**\n * #### `scheduleTimeout(fn, delay)`\n *\n * You can proxy this to `setTimeout` or its equivalent in your environment.\n */\n scheduleTimeout: setTimeout,\n\n /**\n * #### `cancelTimeout(id)`\n *\n * You can proxy this to `clearTimeout` or its equivalent in your environment.\n */\n cancelTimeout: clearTimeout,\n\n /**\n * #### `noTimeout`\n *\n * This is a property (not a function) that should be set to something that can never be a valid timeout ID.\n * For example, you can set it to `-1`.\n */\n noTimeout: -1,\n\n /**\n * #### `supportsMicrotasks`\n *\n * Set this to `true` to indicate that your renderer supports `scheduleMicrotask`. We use microtasks as part\n * of our discrete event implementation in React DOM. If you're not sure if your renderer should support this,\n * you probably should. The option to not implement `scheduleMicrotask` exists so that platforms with more control\n * over user events, like React Native, can choose to use a different mechanism.\n */\n supportsMicrotasks: true,\n\n /**\n * #### `scheduleMicrotask(fn)`\n *\n * Optional. You can proxy this to `queueMicrotask` or its equivalent in your environment.\n */\n scheduleMicrotask: queueMicrotask,\n\n /**\n * #### `isPrimaryRenderer`\n *\n * This is a property (not a function) that should be set to `true` if your renderer is the main one on the\n * page. For example, if you're writing a renderer for the Terminal, it makes sense to set it to `true`, but\n * if your renderer is used *on top of* React DOM or some other existing renderer, set it to `false`.\n */\n isPrimaryRenderer: true,\n\n /**\n * Whether the renderer shouldn't trigger missing `act()` warnings\n */\n warnsIfNotActing: true,\n\n getInstanceFromNode(node: object): Fiber | null | undefined {\n const instance = nodeToInstanceMap.get(node);\n if (instance !== undefined) {\n return instance.unstable_fiber;\n }\n\n return null;\n },\n\n beforeActiveInstanceBlur(): void {\n // noop\n },\n\n afterActiveInstanceBlur(): void {\n // noop\n },\n\n prepareScopeUpdate(scopeInstance: object, instance: Instance): void {\n nodeToInstanceMap.set(scopeInstance, instance);\n },\n\n getInstanceFromScope(scopeInstance: object): Instance | null {\n return nodeToInstanceMap.get(scopeInstance) ?? null;\n },\n\n detachDeletedInstance(_node: Instance): void {},\n\n /**\n * #### `appendChild(parentInstance, child)`\n *\n * This method should mutate the `parentInstance` and add the child to its list of children. For example,\n * in the DOM this would translate to a `parentInstance.appendChild(child)` call.\n *\n * Although this method currently runs in the commit phase, you still should not mutate any other nodes\n * in it. If you need to do some additional work when a node is definitely connected to the visible tree, look at `commitMount`.\n */\n appendChild: appendChild,\n\n /**\n * #### `appendChildToContainer(container, child)`\n *\n * Same as `appendChild`, but for when a node is attached to the root container. This is useful if attaching\n * to the root has a slightly different implementation, or if the root container nodes are of a different\n * type than the rest of the tree.\n */\n appendChildToContainer: appendChild,\n\n /**\n * #### `insertBefore(parentInstance, child, beforeChild)`\n *\n * This method should mutate the `parentInstance` and place the `child` before `beforeChild` in the list of\n * its children. For example, in the DOM this would translate to a `parentInstance.insertBefore(child, beforeChild)` call.\n *\n * Note that React uses this method both for insertions and for reordering nodes. Similar to DOM, it is expected\n * that you can call `insertBefore` to reposition an existing child. Do not mutate any other parts of the tree from it.\n */\n insertBefore: insertBefore,\n\n /**\n * #### `insertInContainerBefore(container, child, beforeChild)\n *\n * Same as `insertBefore`, but for when a node is attached to the root container. This is useful if attaching\n * to the root has a slightly different implementation, or if the root container nodes are of a different type\n * than the rest of the tree.\n */\n insertInContainerBefore: insertBefore,\n\n /**\n * #### `removeChild(parentInstance, child)`\n *\n * This method should mutate the `parentInstance` to remove the `child` from the list of its children.\n *\n * React will only call it for the top-level node that is being removed. It is expected that garbage collection\n * would take care of the whole subtree. You are not expected to traverse the child tree in it.\n */\n removeChild: removeChild,\n\n /**\n * #### `removeChildFromContainer(container, child)`\n *\n * Same as `removeChild`, but for when a node is detached from the root container. This is useful if attaching\n * to the root has a slightly different implementation, or if the root container nodes are of a different type\n * than the rest of the tree.\n */\n removeChildFromContainer: removeChild,\n\n /**\n * #### `resetTextContent(instance)`\n *\n * If you returned `true` from `shouldSetTextContent` for the previous props, but returned `false` from\n * `shouldSetTextContent` for the next props, React will call this method so that you can clear the text\n * content you were managing manually. For example, in the DOM you could set `node.textContent = ''`.\n *\n * If you never return `true` from `shouldSetTextContent`, you can leave it empty.\n */\n resetTextContent(_instance: Instance): void {\n // noop\n },\n\n /**\n * #### `commitTextUpdate(textInstance, prevText, nextText)`\n *\n * This method should mutate the `textInstance` and update its text content to `nextText`.\n *\n * Here, `textInstance` is a node created by `createTextInstance`.\n */\n commitTextUpdate(textInstance: TextInstance, _oldText: string, newText: string): void {\n textInstance.text = newText;\n },\n\n /**\n * #### `commitMount(instance, type, props, internalHandle)`\n *\n * This method is only called if you returned `true` from `finalizeInitialChildren` for this instance.\n *\n * It lets you do some additional work after the node is actually attached to the tree on the screen for\n * the first time. For example, the DOM renderer uses it to trigger focus on nodes with the `autoFocus` attribute.\n *\n * Note that `commitMount` does not mirror `removeChild` one to one because `removeChild` is only called for\n * the top-level removed node. This is why ideally `commitMount` should not mutate any nodes other than the\n * `instance` itself. For example, if it registers some events on some node above, it will be your responsibility\n * to traverse the tree in `removeChild` and clean them up, which is not ideal.\n *\n * The `internalHandle` data structure is meant to be opaque. If you bend the rules and rely on its internal\n * fields, be aware that it may change significantly between versions. You're taking on additional maintenance\n * risk by reading from it, and giving up all guarantees if you write something to it.\n *\n * If you never return `true` from `finalizeInitialChildren`, you can leave it empty.\n */\n commitMount(_instance: Instance, _type: Type, _props: Props, _internalHandle: Fiber): void {\n // noop\n },\n\n /**\n * #### `commitUpdate(instance, type, prevProps, nextProps, internalHandle)`\n *\n * This method should mutate the `instance` according to the set of changes in `updatePayload`. Here, `updatePayload`\n * is the object that you've returned from `prepareUpdate` and has an arbitrary structure that makes sense for your\n * renderer. For example, the DOM renderer returns an update payload like `[prop1, value1, prop2, value2, ...]` from\n * `prepareUpdate`, and that structure gets passed into `commitUpdate`. Ideally, all the diffing and calculation\n * should happen inside `prepareUpdate` so that `commitUpdate` can be fast and straightforward.\n *\n * The `internalHandle` data structure is meant to be opaque. If you bend the rules and rely on its internal fields,\n * be aware that it may change significantly between versions. You're taking on additional maintenance risk by\n * reading from it, and giving up all guarantees if you write something to it.\n */\n // @ts-expect-error @types/react-reconciler types don't fully match react-reconciler's actual Flow types.\n // Correctness is verified through tests.\n commitUpdate(\n instance: Instance,\n type: Type,\n _prevProps: Props,\n nextProps: Props,\n internalHandle: Fiber,\n ): void {\n instance.type = type;\n instance.props = nextProps;\n instance.unstable_fiber = internalHandle;\n },\n\n /**\n * #### `hideInstance(instance)`\n *\n * This method should make the `instance` invisible without removing it from the tree. For example, it can apply\n * visual styling to hide it. It is used by Suspense to hide the tree while the fallback is visible.\n */\n hideInstance(instance: Instance): void {\n instance.isHidden = true;\n },\n\n /**\n * #### `hideTextInstance(textInstance)`\n *\n * Same as `hideInstance`, but for nodes created by `createTextInstance`.\n */\n hideTextInstance(textInstance: TextInstance): void {\n textInstance.isHidden = true;\n },\n\n /**\n * #### `unhideInstance(instance, props)`\n *\n * This method should make the `instance` visible, undoing what `hideInstance` did.\n */\n unhideInstance(instance: Instance, _props: Props): void {\n instance.isHidden = false;\n },\n\n /**\n * #### `unhideTextInstance(textInstance, text)`\n *\n * Same as `unhideInstance`, but for nodes created by `createTextInstance`.\n */\n unhideTextInstance(textInstance: TextInstance, _text: string): void {\n textInstance.isHidden = false;\n },\n\n /**\n * #### `clearContainer(container)`\n *\n * This method should mutate the `container` root node and remove all children from it.\n */\n clearContainer(container: Container): void {\n container.children.forEach((child) => {\n child.parent = null;\n });\n\n container.children.splice(0);\n },\n\n /**\n * #### `maySuspendCommit(type, props)`\n *\n * This method is called during render to determine if the Host Component type and props require\n * some kind of loading process to complete before committing an update.\n */\n maySuspendCommit(_type: Type, _props: Props): boolean {\n return false;\n },\n\n /**\n * #### `preloadInstance(type, props)`\n *\n * This method may be called during render if the Host Component type and props might suspend a commit.\n * It can be used to initiate any work that might shorten the duration of a suspended commit.\n */\n preloadInstance(_type: Type, _props: Props): boolean {\n return true;\n },\n\n /**\n * #### `startSuspendingCommit()`\n *\n * This method is called just before the commit phase. Use it to set up any necessary state while any Host\n * Components that might suspend this commit are evaluated to determine if the commit must be suspended.\n */\n startSuspendingCommit() {},\n\n /**\n * #### `suspendInstance(type, props)`\n *\n * This method is called after `startSuspendingCommit` for each Host Component that indicated it might\n * suspend a commit.\n */\n suspendInstance() {},\n\n /**\n * #### `waitForCommitToBeReady()`\n *\n * This method is called after all `suspendInstance` calls are complete.\n *\n * Return `null` if the commit can happen immediately.\n * Return `(initiateCommit: Function) => Function` if the commit must be suspended. The argument to this\n * callback will initiate the commit when called. The return value is a cancellation function that the\n * Reconciler can use to abort the commit.\n */\n waitForCommitToBeReady() {\n return null;\n },\n\n // -------------------\n // Hydration Methods\n // (optional)\n // You can optionally implement hydration to \"attach\" to the existing tree during the initial render instead\n // of creating it from scratch. For example, the DOM renderer uses this to attach to an HTML markup.\n //\n // To support hydration, you need to declare `supportsHydration: true` and then implement the methods in\n // the \"Hydration\" section [listed in this file](https://github.com/facebook/react/blob/master/packages/react-reconciler/src/forks/ReactFiberHostConfig.custom.js).\n // File an issue if you need help.\n // -------------------\n supportsHydration: false,\n\n NotPendingTransition: null,\n\n resetFormInstance(_form: Instance) {},\n\n requestPostPaintCallback(_callback: (endTime: number) => void) {},\n};\n\nexport const TestReconciler = ReactReconciler(hostConfig);\n\n/**\n * This method should mutate the `parentInstance` and add the child to its list of children. For example,\n * in the DOM this would translate to a `parentInstance.appendChild(child)` call.\n *\n * Although this method currently runs in the commit phase, you still should not mutate any other nodes\n * in it. If you need to do some additional work when a node is definitely connected to the visible tree,\n * look at `commitMount`.\n */\nfunction appendChild(parentInstance: Container | Instance, child: Instance | TextInstance): void {\n const index = parentInstance.children.indexOf(child);\n if (index !== -1) {\n parentInstance.children.splice(index, 1);\n }\n\n child.parent = parentInstance;\n parentInstance.children.push(child);\n}\n\n/**\n * This method should mutate the `parentInstance` and place the `child` before `beforeChild` in the list\n * of its children. For example, in the DOM this would translate to a\n * `parentInstance.insertBefore(child, beforeChild)` call.\n *\n * Note that React uses this method both for insertions and for reordering nodes. Similar to DOM, it is\n * expected that you can call `insertBefore` to reposition an existing child. Do not mutate any other parts\n * of the tree from it.\n */\nfunction insertBefore(\n parentInstance: Container | Instance,\n child: Instance | TextInstance,\n beforeChild: Instance | TextInstance,\n): void {\n const index = parentInstance.children.indexOf(child);\n if (index !== -1) {\n parentInstance.children.splice(index, 1);\n }\n\n child.parent = parentInstance;\n const beforeIndex = parentInstance.children.indexOf(beforeChild);\n parentInstance.children.splice(beforeIndex, 0, child);\n}\n\n/**\n * This method should mutate the `parentInstance` to remove the `child` from the list of its children.\n *\n * React will only call it for the top-level node that is being removed. It is expected that garbage\n * collection would take care of the whole subtree. You are not expected to traverse the child tree in it.\n */\nfunction removeChild(parentInstance: Container | Instance, child: Instance | TextInstance): void {\n const index = parentInstance.children.indexOf(child);\n parentInstance.children.splice(index, 1);\n child.parent = null;\n}\n","export function formatComponentList(names: string[]): string {\n if (names.length === 0) {\n return \"\";\n }\n\n if (names.length === 1) {\n return `<${names[0]}>`;\n }\n\n if (names.length === 2) {\n return `<${names[0]}> or <${names[1]}>`;\n }\n\n const allButLast = names.slice(0, -1);\n const last = names[names.length - 1];\n\n return `${allButLast.map((name) => `<${name}>`).join(\", \")}, or <${last}>`;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,IAAAA,oBAA+B;;;ACDxB,IAAM,MAAM;AAAA,EACjB,WAAW;AAAA,EACX,UAAU;AAAA,EACV,MAAM;AACR;AAGO,IAAM,iBAAiB;;;ACcvB,SAAS,SACd,SACA,WACA,SACe;AAzBjB;AA0BE,QAAM,eAAc,wCAAS,gBAAT,YAAwB;AAC5C,QAAM,oBAAmB,wCAAS,qBAAT,YAA6B;AAEtD,QAAM,UAAyB,CAAC;AAGhC,QAAM,sBAAqC,CAAC;AAE5C,UAAQ,SAAS,QAAQ,CAAC,UAAU;AAClC,QAAI,OAAO,UAAU,UAAU;AAC7B;AAAA,IACF;AAEA,wBAAoB,KAAK,GAAG,SAAS,OAAO,WAAW,iCAAK,UAAL,EAAc,aAAa,KAAK,EAAC,CAAC;AAAA,EAC3F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U,CAAC;AAAA,IACX,UAAU;AAAA,IACV,QAAQ;AAAA,MACN,oBAAoB,mCAAS;AAAA,MAC7B,0BAA0B,mCAAS;AAAA,MACnC,iBAAgB,wCAAS,mBAAT,YAA2B;AAAA,IAC7C;AAAA,EACF;AAMA,MAAI,iBAAiB,eAAe;AAAA,IAClC;AAAA,IACA;AAAA,IACA;AAAA;AAAA,KACA,wCAAS,iBAAT,YAAyB;AAAA,IACzB;AAAA;AAAA,KACA,wCAAS,qBAAT,YAA6B;AAAA,KAC7B,wCAAS,oBAAT,YAA4B;AAAA,KAC5B,wCAAS,kBAAT,YAA0B;AAAA;AAAA;AAAA;AAAA,KAI1B,wCAAS,uBAAT,YAA+B;AAAA,IAC/B;AAAA;AAAA,EACF;AAEA,QAAM,SAAS,CAAC,YAA0B;AACxC,QAAI,kBAAkB,MAAM;AAC1B,YAAM,IAAI,MAAM,6BAA6B;AAAA,IAC/C;AAEA,mBAAe,gBAAgB,SAAS,gBAAgB,MAAM,IAAI;AAAA,EACpE;AAEA,QAAM,UAAU,MAAM;AACpB,QAAI,aAAa,MAAM;AACrB;AAAA,IACF;AAEA,mBAAe,gBAAgB,MAAM,gBAAgB,MAAM,IAAI;AAE/D,qBAAiB;AACjB,gBAAY;AAAA,EACd;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,IAAI,YAAyB;AAC3B,UAAI,aAAa,MAAM;AACrB,cAAM,IAAI,MAAM,qDAAqD;AAAA,MACvE;AAEA,aAAO,YAAY,aAAa,SAAS;AAAA,IAC3C;AAAA,EACF;AACF;","names":["import_constants","import_constants","ReactReconciler"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/renderer.ts","../src/constants.ts","../src/query-all.ts","../src/render-to-json.ts","../src/host-element.ts","../src/reconciler.ts","../src/utils.ts"],"sourcesContent":["export { createRoot } from \"./renderer\";\n\nexport type { Root, RootOptions } from \"./renderer\";\nexport type { HostElement, HostElementProps, HostNode } from \"./host-element\";\nexport type { JsonElement, JsonNode } from \"./render-to-json\";\nexport type { QueryOptions } from \"./query-all\";\n\n/**\n * React Fiber type from react-reconciler. Exported for advanced use cases only.\n * This type represents internal React structures that may change without warning.\n * Prefer using the stable HostElement API instead.\n */\nexport type { Fiber } from \"react-reconciler\";\n","import type { ReactElement } from \"react\";\nimport { ConcurrentRoot } from \"react-reconciler/constants\";\n\nimport { Tag } from \"./constants\";\nimport { HostElement } from \"./host-element\";\nimport type { Container } from \"./reconciler\";\nimport { TestReconciler } from \"./reconciler\";\n\n// Refs:\n// https://github.com/facebook/react/blob/main/packages/react-test-renderer/src/ReactFiberConfigTestHost.js\n// https://github.com/facebook/react/blob/main/packages/react-noop-renderer/src/createReactNoop.js\n// https://github.com/facebook/react/blob/main/packages/react-native-renderer/src/ReactFiberConfigFabric.js\n\nconst defaultCreateMockNode = () => ({});\n\nconst defaultOnUncaughtError = (error: unknown, errorInfo: BaseErrorInfo) => {\n console.error(\"Uncaught error:\", error, errorInfo);\n};\nconst defaultOnCaughtError = (error: unknown, errorInfo: BaseErrorInfo) => {\n console.error(\"Caught error:\", error, errorInfo);\n};\nconst defaultOnRecoverableError = (error: unknown, errorInfo: BaseErrorInfo) => {\n console.error(\"Recoverable error:\", error, errorInfo);\n};\n\n/**\n * Options for configuring the test renderer root.\n */\nexport type RootOptions = {\n /** Types of host components that are allowed to contain text nodes. Trying to render text outside of these components will throw an error. */\n textComponentTypes?: string[];\n\n /**\n * Host component types to display to users in the error message when they try to render text outside of `textComponentTypes`.\n * Defaults to `textComponentTypes`, but you may want to override the components mentioned in the error message.\n */\n publicTextComponentTypes?: string[];\n\n /** Function to create mock nodes for refs. */\n createNodeMock?: (element: ReactElement) => object;\n\n /** Callback called when React catches an error in an Error Boundary. Called with the error caught by the Error Boundary, and an errorInfo object containing the componentStack. */\n onCaughtError?: ErrorHandler;\n\n /** Callback called when an error is thrown and not caught by an Error Boundary. Called with the error that was thrown, and an errorInfo object containing the componentStack. */\n onUncaughtError?: ErrorHandler;\n\n /** Callback called when React automatically recovers from errors. Called with an error React throws, and an errorInfo object containing the componentStack. Some recoverable errors may include the original error cause as error.cause. */\n onRecoverableError?: ErrorHandler;\n\n /** A string prefix React uses for IDs generated by useId. Useful to avoid conflicts when using multiple roots on the same page. */\n identifierPrefix?: string;\n\n /** Enable React Strict Mode. */\n isStrictMode?: boolean;\n};\n\ntype ErrorHandler = (error: unknown, errorInfo: BaseErrorInfo) => void;\n\ninterface BaseErrorInfo {\n componentStack?: string;\n}\n\n/**\n * Root instance returned by createRoot. Provides methods to render and unmount components.\n */\nexport type Root = {\n /** Render a React element into the root. Must be called within act(). */\n render: (element: ReactElement) => void;\n /** Unmount the root and clean up. Must be called within act(). */\n unmount: () => void;\n /** The root container element. */\n container: HostElement;\n};\n\n/**\n * Create a new test renderer root instance.\n *\n * @param options - Optional configuration for the renderer.\n * @returns A Root instance with render, unmount, and container properties.\n */\nexport function createRoot(options?: RootOptions): Root {\n let container: Container | null = {\n tag: Tag.Container,\n parent: null,\n children: [],\n isHidden: false,\n config: {\n textComponentTypes: options?.textComponentTypes,\n publicTextComponentTypes: options?.publicTextComponentTypes,\n createNodeMock: options?.createNodeMock ?? defaultCreateMockNode,\n },\n };\n\n // @types/react-reconciler types don't fully match react-reconciler's actual Flow types.\n // The return type is correct at runtime but TypeScript can't verify it statically.\n // Correctness is verified through tests.\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n let containerFiber = TestReconciler.createContainer(\n container,\n ConcurrentRoot,\n null, // hydrationCallbacks\n options?.isStrictMode ?? false,\n false, // concurrentUpdatesByDefaultOverride\n options?.identifierPrefix ?? \"\",\n options?.onUncaughtError ?? defaultOnUncaughtError,\n options?.onCaughtError ?? defaultOnCaughtError,\n options?.onRecoverableError ?? defaultOnRecoverableError,\n () => {}, // onDefaultTransitionIndicator\n null, // transitionCallbacks\n );\n\n const render = (element: ReactElement) => {\n if (containerFiber == null) {\n throw new Error(\"Cannot render after unmount\");\n }\n\n TestReconciler.updateContainer(element, containerFiber, null, null);\n };\n\n const unmount = () => {\n if (container == null) {\n return;\n }\n\n TestReconciler.updateContainer(null, containerFiber, null, null);\n\n containerFiber = null;\n container = null;\n };\n\n return {\n render,\n unmount,\n get container(): HostElement {\n if (container == null) {\n throw new Error(\"Cannot access .container on unmounted test renderer\");\n }\n\n return HostElement.fromInstance(container);\n },\n };\n}\n","export const Tag = {\n Container: \"CONTAINER\",\n Instance: \"INSTANCE\",\n Text: \"TEXT\",\n} as const;\n\n// Container should render as <>{...}</>\nexport const CONTAINER_TYPE = \"\";\n\n// Source: https://github.com/facebook/react/blob/main/packages/shared/ReactSymbols.js#L16\nexport const REACT_CONTEXT_TYPE: symbol = Symbol.for(\"react.context\");\n","import type { HostElement } from \"./host-element\";\n\n/**\n * Options for querying elements in the rendered tree.\n */\nexport interface QueryOptions {\n /** Include the element itself in the results if it matches the predicate. Defaults to false. */\n includeSelf?: boolean;\n\n /** Exclude any ancestors of deepest matched elements even if they match the predicate. Defaults to false. */\n matchDeepestOnly?: boolean;\n}\n\n/**\n * Find all descendant elements matching the predicate.\n *\n * @param element - Root element to search from.\n * @param predicate - Function that returns true for matching elements.\n * @param options - Optional query configuration.\n * @returns Array of matching elements in tree order.\n */\nexport function queryAll(\n element: HostElement,\n predicate: (element: HostElement) => boolean,\n options?: QueryOptions,\n): HostElement[] {\n const includeSelf = options?.includeSelf ?? false;\n const matchDeepestOnly = options?.matchDeepestOnly ?? false;\n\n const results: HostElement[] = [];\n\n // Match descendants first but do not add them to results yet.\n const matchingDescendants: HostElement[] = [];\n\n element.children.forEach((child) => {\n if (typeof child === \"string\") {\n return;\n }\n\n matchingDescendants.push(...queryAll(child, predicate, { ...options, includeSelf: true }));\n });\n\n if (\n includeSelf &&\n // When matchDeepestOnly = true: add current element only if no descendants match\n (matchingDescendants.length === 0 || !matchDeepestOnly) &&\n predicate(element)\n ) {\n results.push(element);\n }\n\n // Add matching descendants after element to preserve original tree walk order.\n results.push(...matchingDescendants);\n\n return results;\n}\n","import { CONTAINER_TYPE, Tag } from \"./constants\";\nimport type { Container, Instance, TextInstance } from \"./reconciler\";\n\n/** A node in the JSON representation - either a JsonElement or a text string. */\nexport type JsonNode = JsonElement | string;\n\n/**\n * JSON representation of a rendered element, compatible with react-test-renderer format.\n */\nexport type JsonElement = {\n type: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n props: Record<string, any>;\n children: JsonNode[] | null;\n $$typeof: symbol;\n};\n\nexport function renderContainerToJson(instance: Container): JsonElement {\n return {\n type: CONTAINER_TYPE,\n props: {},\n children: renderChildrenToJson(instance.children),\n $$typeof: Symbol.for(\"react.test.json\"),\n };\n}\n\nexport function renderInstanceToJson(instance: Instance): JsonElement | null {\n if (instance.isHidden) {\n return null;\n }\n\n // We don't include the `children` prop in JSON.\n // Instead, we will include the actual rendered children.\n const { children: _children, ...restProps } = instance.props;\n\n return {\n type: instance.type,\n props: restProps,\n children: renderChildrenToJson(instance.children),\n $$typeof: Symbol.for(\"react.test.json\"),\n };\n}\n\nexport function renderTextInstanceToJson(instance: TextInstance): string | null {\n if (instance.isHidden) {\n return null;\n }\n\n return instance.text;\n}\n\nexport function renderChildrenToJson(children: Array<Instance | TextInstance>): JsonNode[] {\n const result = [];\n\n for (const child of children) {\n if (child.tag === Tag.Instance) {\n const renderedChild = renderInstanceToJson(child);\n if (renderedChild !== null) {\n result.push(renderedChild);\n }\n } else {\n const renderedChild = renderTextInstanceToJson(child);\n if (renderedChild !== null) {\n result.push(renderedChild);\n }\n }\n }\n\n return result;\n}\n","import type { Fiber } from \"react-reconciler\";\n\nimport { CONTAINER_TYPE, Tag } from \"./constants\";\nimport type { QueryOptions } from \"./query-all\";\nimport { queryAll } from \"./query-all\";\nimport type { Container, Instance, TextInstance } from \"./reconciler\";\nimport type { JsonElement } from \"./render-to-json\";\nimport { renderContainerToJson, renderInstanceToJson } from \"./render-to-json\";\n\n/** A node in the rendered tree - either a HostElement or a text string. */\nexport type HostNode = HostElement | string;\n\n/** Props object for a host element. */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type HostElementProps = Record<string, any>;\n\nconst instanceMap = new WeakMap<Instance | Container, HostElement>();\n\n/**\n * Represents a rendered host element in the test renderer tree.\n * Provides a DOM-like API for querying and inspecting rendered components.\n */\nexport class HostElement {\n private instance: Instance | Container;\n\n private constructor(instance: Instance | Container) {\n this.instance = instance;\n }\n\n /** The element type (e.g., \"div\", \"span\"). Empty string for container. */\n get type(): string {\n return this.instance.tag === Tag.Instance ? this.instance.type : CONTAINER_TYPE;\n }\n\n /** The element's props object. */\n get props(): HostElementProps {\n return this.instance.tag === Tag.Instance ? this.instance.props : {};\n }\n\n /** The parent element, or null if this is the root container. */\n get parent(): HostElement | null {\n const parentInstance = this.instance.parent;\n if (parentInstance == null) {\n return null;\n }\n\n return HostElement.fromInstance(parentInstance);\n }\n\n /** Array of child nodes (elements and text strings). Hidden children are excluded. */\n get children(): HostNode[] {\n const result = this.instance.children\n .filter((child) => !child.isHidden)\n .map((child) => getHostNodeForInstance(child));\n return result;\n }\n\n /**\n * Access to the underlying React Fiber node. This is an unstable API that exposes\n * internal react-reconciler structures which may change without warning in future\n * React versions. Use with caution and only when absolutely necessary.\n *\n * @returns The Fiber node for this instance, or null if this is a container.\n */\n get unstable_fiber(): Fiber | null {\n return this.instance.tag === Tag.Instance ? this.instance.unstable_fiber : null;\n }\n\n /**\n * Convert this element to a JSON representation suitable for snapshots.\n *\n * @returns JSON element or null if the element is hidden.\n */\n toJSON(): JsonElement | null {\n return this.instance.tag === Tag.Container\n ? renderContainerToJson(this.instance)\n : renderInstanceToJson(this.instance);\n }\n\n /**\n * Find all descendant elements matching the predicate.\n *\n * @param predicate - Function that returns true for matching elements.\n * @param options - Optional query configuration.\n * @returns Array of matching elements.\n */\n queryAll(predicate: (element: HostElement) => boolean, options?: QueryOptions): HostElement[] {\n return queryAll(this, predicate, options);\n }\n\n /** @internal */\n static fromInstance(instance: Instance | Container): HostElement {\n const hostElement = instanceMap.get(instance);\n if (hostElement) {\n return hostElement;\n }\n\n const result = new HostElement(instance);\n instanceMap.set(instance, result);\n return result;\n }\n}\n\nfunction getHostNodeForInstance(instance: Instance | TextInstance): HostNode {\n switch (instance.tag) {\n case Tag.Text:\n return instance.text;\n\n case Tag.Instance:\n return HostElement.fromInstance(instance);\n }\n}\n","import type { ReactElement } from \"react\";\nimport type { Fiber, ReactContext, ReactProviderType } from \"react-reconciler\";\nimport ReactReconciler from \"react-reconciler\";\nimport { DefaultEventPriority, NoEventPriority } from \"react-reconciler/constants\";\n\nimport { Tag } from \"./constants\";\nimport { REACT_CONTEXT_TYPE } from \"./constants\";\nimport { formatComponentList } from \"./utils\";\n\nexport type Type = string;\nexport type Props = Record<string, unknown>;\n\ntype ReconcilerConfig = {\n textComponentTypes?: string[];\n publicTextComponentTypes?: string[];\n createNodeMock: (element: ReactElement) => object;\n};\n\nexport type Container = {\n tag: typeof Tag.Container;\n parent: null;\n children: Array<Instance | TextInstance>;\n isHidden: false;\n config: ReconcilerConfig;\n};\n\nexport type Instance = {\n tag: typeof Tag.Instance;\n type: string;\n props: Props;\n children: Array<Instance | TextInstance>;\n parent: Container | Instance | null;\n rootContainer: Container;\n isHidden: boolean;\n unstable_fiber: Fiber;\n};\n\nexport type TextInstance = {\n tag: typeof Tag.Text;\n text: string;\n parent: Container | Instance | null;\n isHidden: boolean;\n};\n\nexport type SuspenseInstance = object;\nexport type HydratableInstance = object;\nexport type FormInstance = object;\nexport type PublicInstance = object | TextInstance;\nexport type UpdatePayload = unknown;\nexport type ChildSet = unknown;\nexport type TimeoutHandle = unknown;\nexport type NoTimeout = unknown;\nexport type TransitionStatus = unknown;\n\ntype HostContext = {\n type: string;\n isInsideText: boolean;\n config: ReconcilerConfig;\n};\n\nconst nodeToInstanceMap = new WeakMap<object, Instance>();\n\nlet currentUpdatePriority: number = NoEventPriority;\n\nconst hostConfig: ReactReconciler.HostConfig<\n Type,\n Props,\n Container,\n Instance,\n TextInstance,\n SuspenseInstance,\n HydratableInstance,\n FormInstance,\n PublicInstance,\n HostContext,\n ChildSet,\n TimeoutHandle,\n NoTimeout,\n TransitionStatus\n> = {\n /**\n * The reconciler has two modes: mutation mode and persistent mode. You must specify one of them.\n *\n * If your target platform is similar to the DOM and has methods similar to `appendChild`, `removeChild`,\n * and so on, you'll want to use the **mutation mode**. This is the same mode used by React DOM, React ART,\n * and the classic React Native renderer.\n *\n * ```js\n * const HostConfig = {\n * // ...\n * supportsMutation: true,\n * // ...\n * }\n * ```\n *\n * Depending on the mode, the reconciler will call different methods on your host config.\n * If you're not sure which one you want, you likely need the mutation mode.\n */\n supportsMutation: true,\n\n /**\n * The reconciler has two modes: mutation mode and persistent mode. You must specify one of them.\n *\n * If your target platform has immutable trees, you'll want the **persistent mode** instead. In that mode,\n * existing nodes are never mutated, and instead every change clones the parent tree and then replaces\n * the whole parent tree at the root. This is the node used by the new React Native renderer, codenamed \"Fabric\".\n *\n * ```js\n * const HostConfig = {\n * // ...\n * supportsPersistence: true,\n * // ...\n * }\n * ```\n *\n * Depending on the mode, the reconciler will call different methods on your host config.\n * If you're not sure which one you want, you likely need the mutation mode.\n */\n supportsPersistence: false,\n\n /**\n * #### `createInstance(type, props, rootContainer, hostContext, internalHandle)`\n *\n * This method should return a newly created node. For example, the DOM renderer would call\n * `document.createElement(type)` here and then set the properties from `props`.\n *\n * You can use `rootContainer` to access the root container associated with that tree. For example,\n * in the DOM renderer, this is useful to get the correct `document` reference that the root belongs to.\n *\n * The `hostContext` parameter lets you keep track of some information about your current place in\n * the tree. To learn more about it, see `getChildHostContext` below.\n *\n * The `internalHandle` data structure is meant to be opaque. If you bend the rules and rely on its\n * internal fields, be aware that it may change significantly between versions. You're taking on additional\n * maintenance risk by reading from it, and giving up all guarantees if you write something to it.\n *\n * This method happens **in the render phase**. It can (and usually should) mutate the node it has\n * just created before returning it, but it must not modify any other nodes. It must not register\n * any event handlers on the parent tree. This is because an instance being created doesn't guarantee\n * it would be placed in the tree — it could be left unused and later collected by GC. If you need to do\n * something when an instance is definitely in the tree, look at `commitMount` instead.\n */\n createInstance(\n type: Type,\n props: Props,\n rootContainer: Container,\n _hostContext: HostContext,\n internalHandle: Fiber,\n ) {\n return {\n tag: Tag.Instance,\n type,\n props,\n isHidden: false,\n children: [],\n parent: null,\n rootContainer,\n unstable_fiber: internalHandle,\n };\n },\n\n /**\n * #### `createTextInstance(text, rootContainer, hostContext, internalHandle)`\n *\n * Same as `createInstance`, but for text nodes. If your renderer doesn't support text nodes, you can\n * throw here.\n */\n createTextInstance(\n text: string,\n rootContainer: Container,\n hostContext: HostContext,\n _internalHandle: Fiber,\n ): TextInstance {\n if (rootContainer.config.textComponentTypes && !hostContext.isInsideText) {\n const componentTypes =\n rootContainer.config.publicTextComponentTypes ?? rootContainer.config.textComponentTypes;\n\n throw new Error(\n `Invariant Violation: Text strings must be rendered within a ${formatComponentList(\n componentTypes,\n )} component. Detected attempt to render \"${text}\" string within a <${\n hostContext.type\n }> component.`,\n );\n }\n\n return {\n tag: Tag.Text,\n text,\n parent: null,\n isHidden: false,\n };\n },\n\n /**\n * #### `appendInitialChild(parentInstance, child)`\n *\n * This method should mutate the `parentInstance` and add the child to its list of children.\n * For example, in the DOM this would translate to a `parentInstance.appendChild(child)` call.\n *\n * This method happens **in the render phase**. It can mutate `parentInstance` and `child`, but it\n * must not modify any other nodes. It's called while the tree is still being built up and not connected\n * to the actual tree on the screen.\n */\n appendInitialChild: appendChild,\n\n /**\n * #### `finalizeInitialChildren(instance, type, props, rootContainer, hostContext)`\n *\n * In this method, you can perform some final mutations on the `instance`. Unlike with `createInstance`,\n * by the time `finalizeInitialChildren` is called, all the initial children have already been added to\n * the `instance`, but the instance itself has not yet been connected to the tree on the screen.\n *\n * This method happens **in the render phase**. It can mutate `instance`, but it must not modify any other\n * nodes. It's called while the tree is still being built up and not connected to the actual tree on the screen.\n *\n * There is a second purpose to this method. It lets you specify whether there is some work that needs to\n * happen when the node is connected to the tree on the screen. If you return `true`, the instance will\n * receive a `commitMount` call later. See its documentation below.\n *\n * If you don't want to do anything here, you should return `false`.\n */\n finalizeInitialChildren(\n _instance: Instance,\n _type: Type,\n _props: Props,\n _rootContainer: Container,\n _hostContext: HostContext,\n ): boolean {\n return false;\n },\n\n /**\n * #### `shouldSetTextContent(type, props)`\n *\n * Some target platforms support setting an instance's text content without manually creating a text node.\n * For example, in the DOM, you can set `node.textContent` instead of creating a text node and appending it.\n *\n * If you return `true` from this method, React will assume that this node's children are text, and will\n * not create nodes for them. It will instead rely on you to have filled that text during `createInstance`.\n * This is a performance optimization. For example, the DOM renderer returns `true` only if `type` is a\n * known text-only parent (like `'textarea'`) or if `props.children` has a `'string'` type. If you return `true`,\n * you will need to implement `resetTextContent` too.\n *\n * If you don't want to do anything here, you should return `false`.\n * This method happens **in the render phase**. Do not mutate the tree from it.\n */\n shouldSetTextContent(_type: Type, _props: Props): boolean {\n return false;\n },\n\n setCurrentUpdatePriority(newPriority: number) {\n currentUpdatePriority = newPriority;\n },\n\n getCurrentUpdatePriority() {\n return currentUpdatePriority;\n },\n\n resolveUpdatePriority(): number {\n return currentUpdatePriority || DefaultEventPriority;\n },\n\n shouldAttemptEagerTransition() {\n return false;\n },\n\n /**\n * #### `getRootHostContext(rootContainer)`\n *\n * This method lets you return the initial host context from the root of the tree. See `getChildHostContext`\n * for the explanation of host context.\n *\n * If you don't intend to use host context, you can return `null`.\n * This method happens **in the render phase**. Do not mutate the tree from it.\n */\n getRootHostContext(rootContainer: Container): HostContext | null {\n return {\n type: \"ROOT\",\n config: rootContainer.config,\n isInsideText: false,\n };\n },\n\n /**\n * #### `getChildHostContext(parentHostContext, type, rootContainer)`\n *\n * Host context lets you track some information about where you are in the tree so that it's available\n * inside `createInstance` as the `hostContext` parameter. For example, the DOM renderer uses it to track\n * whether it's inside an HTML or an SVG tree, because `createInstance` implementation needs to be\n * different for them.\n *\n * If the node of this `type` does not influence the context you want to pass down, you can return\n * `parentHostContext`. Alternatively, you can return any custom object representing the information\n * you want to pass down.\n *\n * If you don't want to do anything here, return `parentHostContext`.\n *\n * This method happens **in the render phase**. Do not mutate the tree from it.\n */\n getChildHostContext(parentHostContext: HostContext, type: Type): HostContext {\n const isInsideText = Boolean(parentHostContext.config.textComponentTypes?.includes(type));\n return { ...parentHostContext, type: type, isInsideText };\n },\n\n /**\n * #### `getPublicInstance(instance)`\n *\n * Determines what object gets exposed as a ref. You'll likely want to return the `instance` itself. But\n * in some cases it might make sense to only expose some part of it.\n *\n * If you don't want to do anything here, return `instance`.\n */\n getPublicInstance(instance: Instance | TextInstance): PublicInstance {\n switch (instance.tag) {\n case Tag.Instance: {\n const createNodeMock = instance.rootContainer.config.createNodeMock;\n const mockNode = createNodeMock({\n type: instance.type,\n props: instance.props,\n key: null,\n });\n\n nodeToInstanceMap.set(mockNode, instance);\n\n return mockNode;\n }\n\n default:\n return instance;\n }\n },\n\n /**\n * #### `prepareForCommit(containerInfo)`\n *\n * This method lets you store some information before React starts making changes to the tree on\n * the screen. For example, the DOM renderer stores the current text selection so that it can later\n * restore it. This method is mirrored by `resetAfterCommit`.\n *\n * Even if you don't want to do anything here, you need to return `null` from it.\n */\n prepareForCommit(_containerInfo: Container) {\n return null; // noop\n },\n\n /**\n * #### `resetAfterCommit(containerInfo)`\n *\n * This method is called right after React has performed the tree mutations. You can use it to restore\n * something you've stored in `prepareForCommit` — for example, text selection.\n *\n * You can leave it empty.\n */\n resetAfterCommit(_containerInfo: Container): void {\n // noop\n },\n\n /**\n * #### `preparePortalMount(containerInfo)`\n *\n * This method is called for a container that's used as a portal target. Usually you can leave it empty.\n */\n preparePortalMount(_containerInfo: Container): void {\n // noop\n },\n\n /**\n * #### `scheduleTimeout(fn, delay)`\n *\n * You can proxy this to `setTimeout` or its equivalent in your environment.\n */\n scheduleTimeout: setTimeout,\n\n /**\n * #### `cancelTimeout(id)`\n *\n * You can proxy this to `clearTimeout` or its equivalent in your environment.\n */\n cancelTimeout: clearTimeout,\n\n /**\n * #### `noTimeout`\n *\n * This is a property (not a function) that should be set to something that can never be a valid timeout ID.\n * For example, you can set it to `-1`.\n */\n noTimeout: -1,\n\n /**\n * #### `supportsMicrotasks`\n *\n * Set this to `true` to indicate that your renderer supports `scheduleMicrotask`. We use microtasks as part\n * of our discrete event implementation in React DOM. If you're not sure if your renderer should support this,\n * you probably should. The option to not implement `scheduleMicrotask` exists so that platforms with more control\n * over user events, like React Native, can choose to use a different mechanism.\n */\n supportsMicrotasks: true,\n\n /**\n * #### `scheduleMicrotask(fn)`\n *\n * Optional. You can proxy this to `queueMicrotask` or its equivalent in your environment.\n */\n scheduleMicrotask: queueMicrotask,\n\n /**\n * #### `isPrimaryRenderer`\n *\n * This is a property (not a function) that should be set to `true` if your renderer is the main one on the\n * page. For example, if you're writing a renderer for the Terminal, it makes sense to set it to `true`, but\n * if your renderer is used *on top of* React DOM or some other existing renderer, set it to `false`.\n */\n isPrimaryRenderer: true,\n\n /**\n * Whether the renderer shouldn't trigger missing `act()` warnings\n */\n warnsIfNotActing: true,\n\n getInstanceFromNode(node: object): Fiber | null | undefined {\n const instance = nodeToInstanceMap.get(node);\n if (instance !== undefined) {\n return instance.unstable_fiber;\n }\n\n return null;\n },\n\n beforeActiveInstanceBlur(): void {\n // noop\n },\n\n afterActiveInstanceBlur(): void {\n // noop\n },\n\n prepareScopeUpdate(scopeInstance: object, instance: Instance): void {\n nodeToInstanceMap.set(scopeInstance, instance);\n },\n\n getInstanceFromScope(scopeInstance: object): Instance | null {\n return nodeToInstanceMap.get(scopeInstance) ?? null;\n },\n\n detachDeletedInstance(_node: Instance): void {},\n\n /**\n * #### `appendChild(parentInstance, child)`\n *\n * This method should mutate the `parentInstance` and add the child to its list of children. For example,\n * in the DOM this would translate to a `parentInstance.appendChild(child)` call.\n *\n * Although this method currently runs in the commit phase, you still should not mutate any other nodes\n * in it. If you need to do some additional work when a node is definitely connected to the visible tree, look at `commitMount`.\n */\n appendChild: appendChild,\n\n /**\n * #### `appendChildToContainer(container, child)`\n *\n * Same as `appendChild`, but for when a node is attached to the root container. This is useful if attaching\n * to the root has a slightly different implementation, or if the root container nodes are of a different\n * type than the rest of the tree.\n */\n appendChildToContainer: appendChild,\n\n /**\n * #### `insertBefore(parentInstance, child, beforeChild)`\n *\n * This method should mutate the `parentInstance` and place the `child` before `beforeChild` in the list of\n * its children. For example, in the DOM this would translate to a `parentInstance.insertBefore(child, beforeChild)` call.\n *\n * Note that React uses this method both for insertions and for reordering nodes. Similar to DOM, it is expected\n * that you can call `insertBefore` to reposition an existing child. Do not mutate any other parts of the tree from it.\n */\n insertBefore: insertBefore,\n\n /**\n * #### `insertInContainerBefore(container, child, beforeChild)\n *\n * Same as `insertBefore`, but for when a node is attached to the root container. This is useful if attaching\n * to the root has a slightly different implementation, or if the root container nodes are of a different type\n * than the rest of the tree.\n */\n insertInContainerBefore: insertBefore,\n\n /**\n * #### `removeChild(parentInstance, child)`\n *\n * This method should mutate the `parentInstance` to remove the `child` from the list of its children.\n *\n * React will only call it for the top-level node that is being removed. It is expected that garbage collection\n * would take care of the whole subtree. You are not expected to traverse the child tree in it.\n */\n removeChild: removeChild,\n\n /**\n * #### `removeChildFromContainer(container, child)`\n *\n * Same as `removeChild`, but for when a node is detached from the root container. This is useful if attaching\n * to the root has a slightly different implementation, or if the root container nodes are of a different type\n * than the rest of the tree.\n */\n removeChildFromContainer: removeChild,\n\n /**\n * #### `resetTextContent(instance)`\n *\n * If you returned `true` from `shouldSetTextContent` for the previous props, but returned `false` from\n * `shouldSetTextContent` for the next props, React will call this method so that you can clear the text\n * content you were managing manually. For example, in the DOM you could set `node.textContent = ''`.\n *\n * If you never return `true` from `shouldSetTextContent`, you can leave it empty.\n */\n resetTextContent(_instance: Instance): void {\n // noop\n },\n\n /**\n * #### `commitTextUpdate(textInstance, prevText, nextText)`\n *\n * This method should mutate the `textInstance` and update its text content to `nextText`.\n *\n * Here, `textInstance` is a node created by `createTextInstance`.\n */\n commitTextUpdate(textInstance: TextInstance, _oldText: string, newText: string): void {\n textInstance.text = newText;\n },\n\n /**\n * #### `commitMount(instance, type, props, internalHandle)`\n *\n * This method is only called if you returned `true` from `finalizeInitialChildren` for this instance.\n *\n * It lets you do some additional work after the node is actually attached to the tree on the screen for\n * the first time. For example, the DOM renderer uses it to trigger focus on nodes with the `autoFocus` attribute.\n *\n * Note that `commitMount` does not mirror `removeChild` one to one because `removeChild` is only called for\n * the top-level removed node. This is why ideally `commitMount` should not mutate any nodes other than the\n * `instance` itself. For example, if it registers some events on some node above, it will be your responsibility\n * to traverse the tree in `removeChild` and clean them up, which is not ideal.\n *\n * The `internalHandle` data structure is meant to be opaque. If you bend the rules and rely on its internal\n * fields, be aware that it may change significantly between versions. You're taking on additional maintenance\n * risk by reading from it, and giving up all guarantees if you write something to it.\n *\n * If you never return `true` from `finalizeInitialChildren`, you can leave it empty.\n */\n commitMount(_instance: Instance, _type: Type, _props: Props, _internalHandle: Fiber): void {\n // noop\n },\n\n /**\n * #### `commitUpdate(instance, type, prevProps, nextProps, internalHandle)`\n *\n * This method should mutate the `instance` according to the set of changes in `updatePayload`. Here, `updatePayload`\n * is the object that you've returned from `prepareUpdate` and has an arbitrary structure that makes sense for your\n * renderer. For example, the DOM renderer returns an update payload like `[prop1, value1, prop2, value2, ...]` from\n * `prepareUpdate`, and that structure gets passed into `commitUpdate`. Ideally, all the diffing and calculation\n * should happen inside `prepareUpdate` so that `commitUpdate` can be fast and straightforward.\n *\n * The `internalHandle` data structure is meant to be opaque. If you bend the rules and rely on its internal fields,\n * be aware that it may change significantly between versions. You're taking on additional maintenance risk by\n * reading from it, and giving up all guarantees if you write something to it.\n */\n commitUpdate(\n instance: Instance,\n type: Type,\n _prevProps: Props,\n nextProps: Props,\n internalHandle: Fiber,\n ): void {\n instance.type = type;\n instance.props = nextProps;\n instance.unstable_fiber = internalHandle;\n },\n\n /**\n * #### `hideInstance(instance)`\n *\n * This method should make the `instance` invisible without removing it from the tree. For example, it can apply\n * visual styling to hide it. It is used by Suspense to hide the tree while the fallback is visible.\n */\n hideInstance(instance: Instance): void {\n instance.isHidden = true;\n },\n\n /**\n * #### `hideTextInstance(textInstance)`\n *\n * Same as `hideInstance`, but for nodes created by `createTextInstance`.\n */\n hideTextInstance(textInstance: TextInstance): void {\n textInstance.isHidden = true;\n },\n\n /**\n * #### `unhideInstance(instance, props)`\n *\n * This method should make the `instance` visible, undoing what `hideInstance` did.\n */\n unhideInstance(instance: Instance, _props: Props): void {\n instance.isHidden = false;\n },\n\n /**\n * #### `unhideTextInstance(textInstance, text)`\n *\n * Same as `unhideInstance`, but for nodes created by `createTextInstance`.\n */\n unhideTextInstance(textInstance: TextInstance, _text: string): void {\n textInstance.isHidden = false;\n },\n\n /**\n * #### `clearContainer(container)`\n *\n * This method should mutate the `container` root node and remove all children from it.\n */\n clearContainer(container: Container): void {\n container.children.forEach((child) => {\n child.parent = null;\n });\n\n container.children.splice(0);\n },\n\n /**\n * #### `maySuspendCommit(type, props)`\n *\n * This method is called during render to determine if the Host Component type and props require\n * some kind of loading process to complete before committing an update.\n */\n maySuspendCommit(_type: Type, _props: Props): boolean {\n return false;\n },\n\n /**\n * #### `preloadInstance(type, props)`\n *\n * This method may be called during render if the Host Component type and props might suspend a commit.\n * It can be used to initiate any work that might shorten the duration of a suspended commit.\n */\n preloadInstance(_type: Type, _props: Props): boolean {\n return true;\n },\n\n /**\n * #### `startSuspendingCommit()`\n *\n * This method is called just before the commit phase. Use it to set up any necessary state while any Host\n * Components that might suspend this commit are evaluated to determine if the commit must be suspended.\n */\n startSuspendingCommit() {},\n\n /**\n * #### `suspendInstance(type, props)`\n *\n * This method is called after `startSuspendingCommit` for each Host Component that indicated it might\n * suspend a commit.\n */\n suspendInstance() {},\n\n /**\n * #### `waitForCommitToBeReady()`\n *\n * This method is called after all `suspendInstance` calls are complete.\n *\n * Return `null` if the commit can happen immediately.\n * Return `(initiateCommit: Function) => Function` if the commit must be suspended. The argument to this\n * callback will initiate the commit when called. The return value is a cancellation function that the\n * Reconciler can use to abort the commit.\n */\n waitForCommitToBeReady() {\n return null;\n },\n\n // -------------------\n // Hydration Methods\n // (optional)\n // You can optionally implement hydration to \"attach\" to the existing tree during the initial render instead\n // of creating it from scratch. For example, the DOM renderer uses this to attach to an HTML markup.\n //\n // To support hydration, you need to declare `supportsHydration: true` and then implement the methods in\n // the \"Hydration\" section [listed in this file](https://github.com/facebook/react/blob/master/packages/react-reconciler/src/forks/ReactFiberHostConfig.custom.js).\n // File an issue if you need help.\n // -------------------\n supportsHydration: false,\n\n requestPostPaintCallback(_callback: (endTime: number) => void) {},\n\n NotPendingTransition: null,\n\n // Based on: https://github.com/facebook/react/blob/main/packages/react-test-renderer/src/ReactFiberConfigTestHost.js#L606\n HostTransitionContext: {\n $$typeof: REACT_CONTEXT_TYPE,\n Consumer: null as unknown as ReactContext<TransitionStatus>,\n Provider: null as unknown as ReactProviderType<TransitionStatus>,\n _currentValue: null,\n _currentValue2: null,\n _threadCount: 0,\n },\n\n resetFormInstance(_form: Instance) {},\n\n trackSchedulerEvent: function (): void {},\n\n // Based on: https://github.com/facebook/react/blob/main/packages/react-test-renderer/src/ReactFiberConfigTestHost.js#L256\n resolveEventType: function (): null | string {\n return null;\n },\n\n // Based on: https://github.com/facebook/react/blob/main/packages/react-test-renderer/src/ReactFiberConfigTestHost.js#L259\n resolveEventTimeStamp: function (): number {\n return -1.1;\n },\n};\n\nexport const TestReconciler = ReactReconciler(hostConfig);\n\n/**\n * This method should mutate the `parentInstance` and add the child to its list of children. For example,\n * in the DOM this would translate to a `parentInstance.appendChild(child)` call.\n *\n * Although this method currently runs in the commit phase, you still should not mutate any other nodes\n * in it. If you need to do some additional work when a node is definitely connected to the visible tree,\n * look at `commitMount`.\n */\nfunction appendChild(parentInstance: Container | Instance, child: Instance | TextInstance): void {\n const index = parentInstance.children.indexOf(child);\n if (index !== -1) {\n parentInstance.children.splice(index, 1);\n }\n\n child.parent = parentInstance;\n parentInstance.children.push(child);\n}\n\n/**\n * This method should mutate the `parentInstance` and place the `child` before `beforeChild` in the list\n * of its children. For example, in the DOM this would translate to a\n * `parentInstance.insertBefore(child, beforeChild)` call.\n *\n * Note that React uses this method both for insertions and for reordering nodes. Similar to DOM, it is\n * expected that you can call `insertBefore` to reposition an existing child. Do not mutate any other parts\n * of the tree from it.\n */\nfunction insertBefore(\n parentInstance: Container | Instance,\n child: Instance | TextInstance,\n beforeChild: Instance | TextInstance,\n): void {\n const index = parentInstance.children.indexOf(child);\n if (index !== -1) {\n parentInstance.children.splice(index, 1);\n }\n\n child.parent = parentInstance;\n const beforeIndex = parentInstance.children.indexOf(beforeChild);\n parentInstance.children.splice(beforeIndex, 0, child);\n}\n\n/**\n * This method should mutate the `parentInstance` to remove the `child` from the list of its children.\n *\n * React will only call it for the top-level node that is being removed. It is expected that garbage\n * collection would take care of the whole subtree. You are not expected to traverse the child tree in it.\n */\nfunction removeChild(parentInstance: Container | Instance, child: Instance | TextInstance): void {\n const index = parentInstance.children.indexOf(child);\n parentInstance.children.splice(index, 1);\n child.parent = null;\n}\n","export function formatComponentList(names: string[]): string {\n if (names.length === 0) {\n return \"\";\n }\n\n if (names.length === 1) {\n return `<${names[0]}>`;\n }\n\n if (names.length === 2) {\n return `<${names[0]}> or <${names[1]}>`;\n }\n\n const allButLast = names.slice(0, -1);\n const last = names[names.length - 1];\n\n return `${allButLast.map((name) => `<${name}>`).join(\", \")}, or <${last}>`;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,IAAAA,oBAA+B;;;ACDxB,IAAM,MAAM;AAAA,EACjB,WAAW;AAAA,EACX,UAAU;AAAA,EACV,MAAM;AACR;AAGO,IAAM,iBAAiB;AAGvB,IAAM,qBAA6B,uBAAO,IAAI,eAAe;;;ACW7D,SAAS,SACd,SACA,WACA,SACe;AAzBjB;AA0BE,QAAM,eAAc,wCAAS,gBAAT,YAAwB;AAC5C,QAAM,oBAAmB,wCAAS,qBAAT,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,aAAa,MAAM;AACrB;AAAA,IACF;AAEA,mBAAe,gBAAgB,MAAM,gBAAgB,MAAM,IAAI;AAE/D,qBAAiB;AACjB,gBAAY;AAAA,EACd;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,IAAI,YAAyB;AAC3B,UAAI,aAAa,MAAM;AACrB,cAAM,IAAI,MAAM,qDAAqD;AAAA,MACvE;AAEA,aAAO,YAAY,aAAa,SAAS;AAAA,IAC3C;AAAA,EACF;AACF;","names":["import_constants","import_constants","ReactReconciler"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -19,8 +19,8 @@ type JsonNode = JsonElement | string;
|
|
|
19
19
|
*/
|
|
20
20
|
type JsonElement = {
|
|
21
21
|
type: string;
|
|
22
|
-
props:
|
|
23
|
-
children:
|
|
22
|
+
props: Record<string, any>;
|
|
23
|
+
children: JsonNode[] | null;
|
|
24
24
|
$$typeof: symbol;
|
|
25
25
|
};
|
|
26
26
|
|
|
@@ -64,7 +64,7 @@ declare class HostElement {
|
|
|
64
64
|
* @param options - Optional query configuration.
|
|
65
65
|
* @returns Array of matching elements.
|
|
66
66
|
*/
|
|
67
|
-
queryAll(predicate: (element: HostElement
|
|
67
|
+
queryAll(predicate: (element: HostElement) => boolean, options?: QueryOptions): HostElement[];
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
/**
|
|
@@ -91,12 +91,10 @@ type RootOptions = {
|
|
|
91
91
|
/** Enable React Strict Mode. */
|
|
92
92
|
isStrictMode?: boolean;
|
|
93
93
|
};
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
componentStack: string;
|
|
99
|
-
};
|
|
94
|
+
type ErrorHandler = (error: unknown, errorInfo: BaseErrorInfo) => void;
|
|
95
|
+
interface BaseErrorInfo {
|
|
96
|
+
componentStack?: string;
|
|
97
|
+
}
|
|
100
98
|
/**
|
|
101
99
|
* Root instance returned by createRoot. Provides methods to render and unmount components.
|
|
102
100
|
*/
|
|
@@ -116,4 +114,4 @@ type Root = {
|
|
|
116
114
|
*/
|
|
117
115
|
declare function createRoot(options?: RootOptions): Root;
|
|
118
116
|
|
|
119
|
-
export {
|
|
117
|
+
export { HostElement, type HostElementProps, type HostNode, type JsonElement, type JsonNode, type QueryOptions, type Root, type RootOptions, createRoot };
|
package/dist/index.d.ts
CHANGED
|
@@ -19,8 +19,8 @@ type JsonNode = JsonElement | string;
|
|
|
19
19
|
*/
|
|
20
20
|
type JsonElement = {
|
|
21
21
|
type: string;
|
|
22
|
-
props:
|
|
23
|
-
children:
|
|
22
|
+
props: Record<string, any>;
|
|
23
|
+
children: JsonNode[] | null;
|
|
24
24
|
$$typeof: symbol;
|
|
25
25
|
};
|
|
26
26
|
|
|
@@ -64,7 +64,7 @@ declare class HostElement {
|
|
|
64
64
|
* @param options - Optional query configuration.
|
|
65
65
|
* @returns Array of matching elements.
|
|
66
66
|
*/
|
|
67
|
-
queryAll(predicate: (element: HostElement
|
|
67
|
+
queryAll(predicate: (element: HostElement) => boolean, options?: QueryOptions): HostElement[];
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
/**
|
|
@@ -91,12 +91,10 @@ type RootOptions = {
|
|
|
91
91
|
/** Enable React Strict Mode. */
|
|
92
92
|
isStrictMode?: boolean;
|
|
93
93
|
};
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
componentStack: string;
|
|
99
|
-
};
|
|
94
|
+
type ErrorHandler = (error: unknown, errorInfo: BaseErrorInfo) => void;
|
|
95
|
+
interface BaseErrorInfo {
|
|
96
|
+
componentStack?: string;
|
|
97
|
+
}
|
|
100
98
|
/**
|
|
101
99
|
* Root instance returned by createRoot. Provides methods to render and unmount components.
|
|
102
100
|
*/
|
|
@@ -116,4 +114,4 @@ type Root = {
|
|
|
116
114
|
*/
|
|
117
115
|
declare function createRoot(options?: RootOptions): Root;
|
|
118
116
|
|
|
119
|
-
export {
|
|
117
|
+
export { HostElement, type HostElementProps, type HostNode, type JsonElement, type JsonNode, type QueryOptions, type Root, type RootOptions, createRoot };
|
package/dist/index.js
CHANGED
|
@@ -40,6 +40,7 @@ var Tag = {
|
|
|
40
40
|
Text: "TEXT"
|
|
41
41
|
};
|
|
42
42
|
var CONTAINER_TYPE = "";
|
|
43
|
+
var REACT_CONTEXT_TYPE = /* @__PURE__ */ Symbol.for("react.context");
|
|
43
44
|
|
|
44
45
|
// src/query-all.ts
|
|
45
46
|
function queryAll(element, predicate, options) {
|
|
@@ -625,8 +626,6 @@ var hostConfig = {
|
|
|
625
626
|
* be aware that it may change significantly between versions. You're taking on additional maintenance risk by
|
|
626
627
|
* reading from it, and giving up all guarantees if you write something to it.
|
|
627
628
|
*/
|
|
628
|
-
// @ts-expect-error @types/react-reconciler types don't fully match react-reconciler's actual Flow types.
|
|
629
|
-
// Correctness is verified through tests.
|
|
630
629
|
commitUpdate(instance, type, _prevProps, nextProps, internalHandle) {
|
|
631
630
|
instance.type = type;
|
|
632
631
|
instance.props = nextProps;
|
|
@@ -734,10 +733,29 @@ var hostConfig = {
|
|
|
734
733
|
// File an issue if you need help.
|
|
735
734
|
// -------------------
|
|
736
735
|
supportsHydration: false,
|
|
736
|
+
requestPostPaintCallback(_callback) {
|
|
737
|
+
},
|
|
737
738
|
NotPendingTransition: null,
|
|
739
|
+
// Based on: https://github.com/facebook/react/blob/main/packages/react-test-renderer/src/ReactFiberConfigTestHost.js#L606
|
|
740
|
+
HostTransitionContext: {
|
|
741
|
+
$$typeof: REACT_CONTEXT_TYPE,
|
|
742
|
+
Consumer: null,
|
|
743
|
+
Provider: null,
|
|
744
|
+
_currentValue: null,
|
|
745
|
+
_currentValue2: null,
|
|
746
|
+
_threadCount: 0
|
|
747
|
+
},
|
|
738
748
|
resetFormInstance(_form) {
|
|
739
749
|
},
|
|
740
|
-
|
|
750
|
+
trackSchedulerEvent: function() {
|
|
751
|
+
},
|
|
752
|
+
// Based on: https://github.com/facebook/react/blob/main/packages/react-test-renderer/src/ReactFiberConfigTestHost.js#L256
|
|
753
|
+
resolveEventType: function() {
|
|
754
|
+
return null;
|
|
755
|
+
},
|
|
756
|
+
// Based on: https://github.com/facebook/react/blob/main/packages/react-test-renderer/src/ReactFiberConfigTestHost.js#L259
|
|
757
|
+
resolveEventTimeStamp: function() {
|
|
758
|
+
return -1.1;
|
|
741
759
|
}
|
|
742
760
|
};
|
|
743
761
|
var TestReconciler = ReactReconciler(hostConfig);
|
|
@@ -799,10 +817,10 @@ function createRoot(options) {
|
|
|
799
817
|
(_c = options == null ? void 0 : options.identifierPrefix) != null ? _c : "",
|
|
800
818
|
(_d = options == null ? void 0 : options.onUncaughtError) != null ? _d : defaultOnUncaughtError,
|
|
801
819
|
(_e = options == null ? void 0 : options.onCaughtError) != null ? _e : defaultOnCaughtError,
|
|
802
|
-
// @ts-expect-error @types/react-reconciler types don't include onRecoverableError parameter
|
|
803
|
-
// in the createContainer signature, but react-reconciler's actual Flow types do.
|
|
804
|
-
// Correctness is verified through tests.
|
|
805
820
|
(_f = options == null ? void 0 : options.onRecoverableError) != null ? _f : defaultOnRecoverableError,
|
|
821
|
+
() => {
|
|
822
|
+
},
|
|
823
|
+
// onDefaultTransitionIndicator
|
|
806
824
|
null
|
|
807
825
|
// transitionCallbacks
|
|
808
826
|
);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/renderer.ts","../src/constants.ts","../src/query-all.ts","../src/render-to-json.ts","../src/host-element.ts","../src/reconciler.ts","../src/utils.ts"],"sourcesContent":["import type { ReactElement } from \"react\";\nimport { ConcurrentRoot } from \"react-reconciler/constants\";\n\nimport { Tag } from \"./constants\";\nimport { HostElement } from \"./host-element\";\nimport type { Container } from \"./reconciler\";\nimport { TestReconciler } from \"./reconciler\";\n\n// Refs:\n// https://github.com/facebook/react/blob/main/packages/react-test-renderer/src/ReactFiberConfigTestHost.js\n// https://github.com/facebook/react/blob/main/packages/react-noop-renderer/src/createReactNoop.js\n// https://github.com/facebook/react/blob/main/packages/react-native-renderer/src/ReactFiberConfigFabric.js\n\nconst defaultCreateMockNode = () => ({});\n\nconst defaultOnUncaughtError = (error: unknown, errorInfo: ErrorInfo) => {\n console.error(\"Uncaught error:\", error, errorInfo);\n};\nconst defaultOnCaughtError = (error: unknown, errorInfo: ErrorInfo) => {\n console.error(\"Caught error:\", error, errorInfo);\n};\nconst defaultOnRecoverableError = (error: unknown, errorInfo: ErrorInfo) => {\n console.error(\"Recoverable error:\", error, errorInfo);\n};\n\n/**\n * Options for configuring the test renderer root.\n */\nexport type RootOptions = {\n /** Types of host components that are allowed to contain text nodes. Trying to render text outside of these components will throw an error. */\n textComponentTypes?: string[];\n\n /**\n * Host component types to display to users in the error message when they try to render text outside of `textComponentTypes`.\n * Defaults to `textComponentTypes`, but you may want to override the components mentioned in the error message.\n */\n publicTextComponentTypes?: string[];\n\n /** Function to create mock nodes for refs. */\n createNodeMock?: (element: ReactElement) => object;\n\n /** Callback called when React catches an error in an Error Boundary. Called with the error caught by the Error Boundary, and an errorInfo object containing the componentStack. */\n onCaughtError?: ErrorHandler;\n\n /** Callback called when an error is thrown and not caught by an Error Boundary. Called with the error that was thrown, and an errorInfo object containing the componentStack. */\n onUncaughtError?: ErrorHandler;\n\n /** Callback called when React automatically recovers from errors. Called with an error React throws, and an errorInfo object containing the componentStack. Some recoverable errors may include the original error cause as error.cause. */\n onRecoverableError?: ErrorHandler;\n\n /** A string prefix React uses for IDs generated by useId. Useful to avoid conflicts when using multiple roots on the same page. */\n identifierPrefix?: string;\n\n /** Enable React Strict Mode. */\n isStrictMode?: boolean;\n};\n\n/** Callback for handling React errors. */\nexport type ErrorHandler = (error: unknown, errorInfo: ErrorInfo) => void;\n\n/** Error information provided to error handlers. */\nexport type ErrorInfo = {\n componentStack: string;\n};\n\n/**\n * Root instance returned by createRoot. Provides methods to render and unmount components.\n */\nexport type Root = {\n /** Render a React element into the root. Must be called within act(). */\n render: (element: ReactElement) => void;\n /** Unmount the root and clean up. Must be called within act(). */\n unmount: () => void;\n /** The root container element. */\n container: HostElement;\n};\n\n/**\n * Create a new test renderer root instance.\n *\n * @param options - Optional configuration for the renderer.\n * @returns A Root instance with render, unmount, and container properties.\n */\nexport function createRoot(options?: RootOptions): Root {\n let container: Container | null = {\n tag: Tag.Container,\n parent: null,\n children: [],\n isHidden: false,\n config: {\n textComponentTypes: options?.textComponentTypes,\n publicTextComponentTypes: options?.publicTextComponentTypes,\n createNodeMock: options?.createNodeMock ?? defaultCreateMockNode,\n },\n };\n\n // @types/react-reconciler types don't fully match react-reconciler's actual Flow types.\n // The return type is correct at runtime but TypeScript can't verify it statically.\n // Correctness is verified through tests.\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n let containerFiber = TestReconciler.createContainer(\n container,\n ConcurrentRoot,\n null, // hydrationCallbacks\n options?.isStrictMode ?? false,\n false, // concurrentUpdatesByDefaultOverride\n options?.identifierPrefix ?? \"\",\n options?.onUncaughtError ?? defaultOnUncaughtError,\n options?.onCaughtError ?? defaultOnCaughtError,\n // @ts-expect-error @types/react-reconciler types don't include onRecoverableError parameter\n // in the createContainer signature, but react-reconciler's actual Flow types do.\n // Correctness is verified through tests.\n options?.onRecoverableError ?? defaultOnRecoverableError,\n null, // transitionCallbacks\n );\n\n const render = (element: ReactElement) => {\n if (containerFiber == null) {\n throw new Error(\"Cannot render after unmount\");\n }\n\n TestReconciler.updateContainer(element, containerFiber, null, null);\n };\n\n const unmount = () => {\n if (container == null) {\n return;\n }\n\n TestReconciler.updateContainer(null, containerFiber, null, null);\n\n containerFiber = null;\n container = null;\n };\n\n return {\n render,\n unmount,\n get container(): HostElement {\n if (container == null) {\n throw new Error(\"Cannot access .container on unmounted test renderer\");\n }\n\n return HostElement.fromInstance(container);\n },\n };\n}\n","export const Tag = {\n Container: \"CONTAINER\",\n Instance: \"INSTANCE\",\n Text: \"TEXT\",\n} as const;\n\n// Container should render as <>{...}</>\nexport const CONTAINER_TYPE = \"\";\n","import type { HostElement } from \"./host-element\";\n\n/**\n * Options for querying elements in the rendered tree.\n */\nexport interface QueryOptions {\n /** Include the element itself in the results if it matches the predicate. Defaults to false. */\n includeSelf?: boolean;\n\n /** Exclude any ancestors of deepest matched elements even if they match the predicate. Defaults to false. */\n matchDeepestOnly?: boolean;\n}\n\n/**\n * Find all descendant elements matching the predicate.\n *\n * @param element - Root element to search from.\n * @param predicate - Function that returns true for matching elements.\n * @param options - Optional query configuration.\n * @returns Array of matching elements in tree order.\n */\nexport function queryAll(\n element: HostElement,\n predicate: (element: HostElement) => boolean,\n options?: QueryOptions,\n): HostElement[] {\n const includeSelf = options?.includeSelf ?? false;\n const matchDeepestOnly = options?.matchDeepestOnly ?? false;\n\n const results: HostElement[] = [];\n\n // Match descendants first but do not add them to results yet.\n const matchingDescendants: HostElement[] = [];\n\n element.children.forEach((child) => {\n if (typeof child === \"string\") {\n return;\n }\n\n matchingDescendants.push(...queryAll(child, predicate, { ...options, includeSelf: true }));\n });\n\n if (\n includeSelf &&\n // When matchDeepestOnly = true: add current element only if no descendants match\n (matchingDescendants.length === 0 || !matchDeepestOnly) &&\n predicate(element)\n ) {\n results.push(element);\n }\n\n // Add matching descendants after element to preserve original tree walk order.\n results.push(...matchingDescendants);\n\n return results;\n}\n","import { CONTAINER_TYPE, Tag } from \"./constants\";\nimport type { Container, Instance, TextInstance } from \"./reconciler\";\n\n/** A node in the JSON representation - either a JsonElement or a text string. */\nexport type JsonNode = JsonElement | string;\n\n/**\n * JSON representation of a rendered element, compatible with react-test-renderer format.\n */\nexport type JsonElement = {\n type: string;\n props: object;\n children: Array<JsonNode> | null;\n $$typeof: symbol;\n};\n\nexport function renderContainerToJson(instance: Container): JsonElement {\n return {\n type: CONTAINER_TYPE,\n props: {},\n children: renderChildrenToJson(instance.children),\n $$typeof: Symbol.for(\"react.test.json\"),\n };\n}\n\nexport function renderInstanceToJson(instance: Instance): JsonElement | null {\n if (instance.isHidden) {\n return null;\n }\n\n // We don't include the `children` prop in JSON.\n // Instead, we will include the actual rendered children.\n const { children: _children, ...restProps } = instance.props;\n\n return {\n type: instance.type,\n props: restProps,\n children: renderChildrenToJson(instance.children),\n $$typeof: Symbol.for(\"react.test.json\"),\n };\n}\n\nexport function renderTextInstanceToJson(instance: TextInstance): string | null {\n if (instance.isHidden) {\n return null;\n }\n\n return instance.text;\n}\n\nexport function renderChildrenToJson(children: Array<Instance | TextInstance>): JsonNode[] {\n const result = [];\n\n for (const child of children) {\n if (child.tag === Tag.Instance) {\n const renderedChild = renderInstanceToJson(child);\n if (renderedChild !== null) {\n result.push(renderedChild);\n }\n } else {\n const renderedChild = renderTextInstanceToJson(child);\n if (renderedChild !== null) {\n result.push(renderedChild);\n }\n }\n }\n\n return result;\n}\n","import type { Fiber } from \"react-reconciler\";\n\nimport { CONTAINER_TYPE, Tag } from \"./constants\";\nimport type { QueryOptions } from \"./query-all\";\nimport { queryAll } from \"./query-all\";\nimport type { Container, Instance, TextInstance } from \"./reconciler\";\nimport type { JsonElement } from \"./render-to-json\";\nimport { renderContainerToJson, renderInstanceToJson } from \"./render-to-json\";\n\n/** A node in the rendered tree - either a HostElement or a text string. */\nexport type HostNode = HostElement | string;\n\n/** Props object for a host element. */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type HostElementProps = Record<string, any>;\n\nconst instanceMap = new WeakMap<Instance | Container, HostElement>();\n\n/**\n * Represents a rendered host element in the test renderer tree.\n * Provides a DOM-like API for querying and inspecting rendered components.\n */\nexport class HostElement {\n private instance: Instance | Container;\n\n private constructor(instance: Instance | Container) {\n this.instance = instance;\n }\n\n /** The element type (e.g., \"div\", \"span\"). Empty string for container. */\n get type(): string {\n return this.instance.tag === Tag.Instance ? this.instance.type : CONTAINER_TYPE;\n }\n\n /** The element's props object. */\n get props(): HostElementProps {\n return this.instance.tag === Tag.Instance ? this.instance.props : {};\n }\n\n /** The parent element, or null if this is the root container. */\n get parent(): HostElement | null {\n const parentInstance = this.instance.parent;\n if (parentInstance == null) {\n return null;\n }\n\n return HostElement.fromInstance(parentInstance);\n }\n\n /** Array of child nodes (elements and text strings). Hidden children are excluded. */\n get children(): HostNode[] {\n const result = this.instance.children\n .filter((child) => !child.isHidden)\n .map((child) => getHostNodeForInstance(child));\n return result;\n }\n\n /**\n * Access to the underlying React Fiber node. This is an unstable API that exposes\n * internal react-reconciler structures which may change without warning in future\n * React versions. Use with caution and only when absolutely necessary.\n *\n * @returns The Fiber node for this instance, or null if this is a container.\n */\n get unstable_fiber(): Fiber | null {\n return this.instance.tag === Tag.Instance ? this.instance.unstable_fiber : null;\n }\n\n /**\n * Convert this element to a JSON representation suitable for snapshots.\n *\n * @returns JSON element or null if the element is hidden.\n */\n toJSON(): JsonElement | null {\n return this.instance.tag === Tag.Container\n ? renderContainerToJson(this.instance)\n : renderInstanceToJson(this.instance);\n }\n\n /**\n * Find all descendant elements matching the predicate.\n *\n * @param predicate - Function that returns true for matching elements.\n * @param options - Optional query configuration.\n * @returns Array of matching elements.\n */\n queryAll(\n predicate: (element: HostElement, options?: QueryOptions) => boolean,\n options?: QueryOptions,\n ): HostElement[] {\n return queryAll(this, predicate, options);\n }\n\n /** @internal */\n static fromInstance(instance: Instance | Container): HostElement {\n const hostElement = instanceMap.get(instance);\n if (hostElement) {\n return hostElement;\n }\n\n const result = new HostElement(instance);\n instanceMap.set(instance, result);\n return result;\n }\n}\n\nfunction getHostNodeForInstance(instance: Instance | TextInstance): HostNode {\n switch (instance.tag) {\n case Tag.Text:\n return instance.text;\n\n case Tag.Instance:\n return HostElement.fromInstance(instance);\n }\n}\n","import type { ReactElement } from \"react\";\nimport type { Fiber } from \"react-reconciler\";\nimport ReactReconciler from \"react-reconciler\";\nimport { DefaultEventPriority, NoEventPriority } from \"react-reconciler/constants\";\n\nimport { Tag } from \"./constants\";\nimport { formatComponentList } from \"./utils\";\n\nexport type Type = string;\nexport type Props = Record<string, unknown>;\n\ntype ReconcilerConfig = {\n textComponentTypes?: string[];\n publicTextComponentTypes?: string[];\n createNodeMock: (element: ReactElement) => object;\n};\n\nexport type Container = {\n tag: typeof Tag.Container;\n parent: null;\n children: Array<Instance | TextInstance>;\n isHidden: false;\n config: ReconcilerConfig;\n};\n\nexport type Instance = {\n tag: typeof Tag.Instance;\n type: string;\n props: Props;\n children: Array<Instance | TextInstance>;\n parent: Container | Instance | null;\n rootContainer: Container;\n isHidden: boolean;\n unstable_fiber: Fiber;\n};\n\nexport type TextInstance = {\n tag: typeof Tag.Text;\n text: string;\n parent: Container | Instance | null;\n isHidden: boolean;\n};\n\nexport type SuspenseInstance = object;\nexport type HydratableInstance = object;\nexport type PublicInstance = object | TextInstance;\nexport type UpdatePayload = unknown;\nexport type ChildSet = unknown;\nexport type TimeoutHandle = unknown;\nexport type NoTimeout = unknown;\n\ntype HostContext = {\n type: string;\n isInsideText: boolean;\n config: ReconcilerConfig;\n};\n\nconst nodeToInstanceMap = new WeakMap<object, Instance>();\n\nlet currentUpdatePriority: number = NoEventPriority;\n\nconst hostConfig: ReactReconciler.HostConfig<\n Type,\n Props,\n Container,\n Instance,\n TextInstance,\n SuspenseInstance,\n HydratableInstance,\n PublicInstance,\n HostContext,\n UpdatePayload,\n ChildSet,\n TimeoutHandle,\n NoTimeout\n> = {\n /**\n * The reconciler has two modes: mutation mode and persistent mode. You must specify one of them.\n *\n * If your target platform is similar to the DOM and has methods similar to `appendChild`, `removeChild`,\n * and so on, you'll want to use the **mutation mode**. This is the same mode used by React DOM, React ART,\n * and the classic React Native renderer.\n *\n * ```js\n * const HostConfig = {\n * // ...\n * supportsMutation: true,\n * // ...\n * }\n * ```\n *\n * Depending on the mode, the reconciler will call different methods on your host config.\n * If you're not sure which one you want, you likely need the mutation mode.\n */\n supportsMutation: true,\n\n /**\n * The reconciler has two modes: mutation mode and persistent mode. You must specify one of them.\n *\n * If your target platform has immutable trees, you'll want the **persistent mode** instead. In that mode,\n * existing nodes are never mutated, and instead every change clones the parent tree and then replaces\n * the whole parent tree at the root. This is the node used by the new React Native renderer, codenamed \"Fabric\".\n *\n * ```js\n * const HostConfig = {\n * // ...\n * supportsPersistence: true,\n * // ...\n * }\n * ```\n *\n * Depending on the mode, the reconciler will call different methods on your host config.\n * If you're not sure which one you want, you likely need the mutation mode.\n */\n supportsPersistence: false,\n\n /**\n * #### `createInstance(type, props, rootContainer, hostContext, internalHandle)`\n *\n * This method should return a newly created node. For example, the DOM renderer would call\n * `document.createElement(type)` here and then set the properties from `props`.\n *\n * You can use `rootContainer` to access the root container associated with that tree. For example,\n * in the DOM renderer, this is useful to get the correct `document` reference that the root belongs to.\n *\n * The `hostContext` parameter lets you keep track of some information about your current place in\n * the tree. To learn more about it, see `getChildHostContext` below.\n *\n * The `internalHandle` data structure is meant to be opaque. If you bend the rules and rely on its\n * internal fields, be aware that it may change significantly between versions. You're taking on additional\n * maintenance risk by reading from it, and giving up all guarantees if you write something to it.\n *\n * This method happens **in the render phase**. It can (and usually should) mutate the node it has\n * just created before returning it, but it must not modify any other nodes. It must not register\n * any event handlers on the parent tree. This is because an instance being created doesn't guarantee\n * it would be placed in the tree — it could be left unused and later collected by GC. If you need to do\n * something when an instance is definitely in the tree, look at `commitMount` instead.\n */\n createInstance(\n type: Type,\n props: Props,\n rootContainer: Container,\n _hostContext: HostContext,\n internalHandle: Fiber,\n ) {\n return {\n tag: Tag.Instance,\n type,\n props,\n isHidden: false,\n children: [],\n parent: null,\n rootContainer,\n unstable_fiber: internalHandle,\n };\n },\n\n /**\n * #### `createTextInstance(text, rootContainer, hostContext, internalHandle)`\n *\n * Same as `createInstance`, but for text nodes. If your renderer doesn't support text nodes, you can\n * throw here.\n */\n createTextInstance(\n text: string,\n rootContainer: Container,\n hostContext: HostContext,\n _internalHandle: Fiber,\n ): TextInstance {\n if (rootContainer.config.textComponentTypes && !hostContext.isInsideText) {\n const componentTypes =\n rootContainer.config.publicTextComponentTypes ?? rootContainer.config.textComponentTypes;\n\n throw new Error(\n `Invariant Violation: Text strings must be rendered within a ${formatComponentList(\n componentTypes,\n )} component. Detected attempt to render \"${text}\" string within a <${\n hostContext.type\n }> component.`,\n );\n }\n\n return {\n tag: Tag.Text,\n text,\n parent: null,\n isHidden: false,\n };\n },\n\n /**\n * #### `appendInitialChild(parentInstance, child)`\n *\n * This method should mutate the `parentInstance` and add the child to its list of children.\n * For example, in the DOM this would translate to a `parentInstance.appendChild(child)` call.\n *\n * This method happens **in the render phase**. It can mutate `parentInstance` and `child`, but it\n * must not modify any other nodes. It's called while the tree is still being built up and not connected\n * to the actual tree on the screen.\n */\n appendInitialChild: appendChild,\n\n /**\n * #### `finalizeInitialChildren(instance, type, props, rootContainer, hostContext)`\n *\n * In this method, you can perform some final mutations on the `instance`. Unlike with `createInstance`,\n * by the time `finalizeInitialChildren` is called, all the initial children have already been added to\n * the `instance`, but the instance itself has not yet been connected to the tree on the screen.\n *\n * This method happens **in the render phase**. It can mutate `instance`, but it must not modify any other\n * nodes. It's called while the tree is still being built up and not connected to the actual tree on the screen.\n *\n * There is a second purpose to this method. It lets you specify whether there is some work that needs to\n * happen when the node is connected to the tree on the screen. If you return `true`, the instance will\n * receive a `commitMount` call later. See its documentation below.\n *\n * If you don't want to do anything here, you should return `false`.\n */\n finalizeInitialChildren(\n _instance: Instance,\n _type: Type,\n _props: Props,\n _rootContainer: Container,\n _hostContext: HostContext,\n ): boolean {\n return false;\n },\n\n /**\n * #### `shouldSetTextContent(type, props)`\n *\n * Some target platforms support setting an instance's text content without manually creating a text node.\n * For example, in the DOM, you can set `node.textContent` instead of creating a text node and appending it.\n *\n * If you return `true` from this method, React will assume that this node's children are text, and will\n * not create nodes for them. It will instead rely on you to have filled that text during `createInstance`.\n * This is a performance optimization. For example, the DOM renderer returns `true` only if `type` is a\n * known text-only parent (like `'textarea'`) or if `props.children` has a `'string'` type. If you return `true`,\n * you will need to implement `resetTextContent` too.\n *\n * If you don't want to do anything here, you should return `false`.\n * This method happens **in the render phase**. Do not mutate the tree from it.\n */\n shouldSetTextContent(_type: Type, _props: Props): boolean {\n return false;\n },\n\n setCurrentUpdatePriority(newPriority: number) {\n currentUpdatePriority = newPriority;\n },\n\n getCurrentUpdatePriority() {\n return currentUpdatePriority;\n },\n\n resolveUpdatePriority(): number {\n return currentUpdatePriority || DefaultEventPriority;\n },\n\n shouldAttemptEagerTransition() {\n return false;\n },\n\n /**\n * #### `getRootHostContext(rootContainer)`\n *\n * This method lets you return the initial host context from the root of the tree. See `getChildHostContext`\n * for the explanation of host context.\n *\n * If you don't intend to use host context, you can return `null`.\n * This method happens **in the render phase**. Do not mutate the tree from it.\n */\n getRootHostContext(rootContainer: Container): HostContext | null {\n return {\n type: \"ROOT\",\n config: rootContainer.config,\n isInsideText: false,\n };\n },\n\n /**\n * #### `getChildHostContext(parentHostContext, type, rootContainer)`\n *\n * Host context lets you track some information about where you are in the tree so that it's available\n * inside `createInstance` as the `hostContext` parameter. For example, the DOM renderer uses it to track\n * whether it's inside an HTML or an SVG tree, because `createInstance` implementation needs to be\n * different for them.\n *\n * If the node of this `type` does not influence the context you want to pass down, you can return\n * `parentHostContext`. Alternatively, you can return any custom object representing the information\n * you want to pass down.\n *\n * If you don't want to do anything here, return `parentHostContext`.\n *\n * This method happens **in the render phase**. Do not mutate the tree from it.\n */\n getChildHostContext(parentHostContext: HostContext, type: Type): HostContext {\n const isInsideText = Boolean(parentHostContext.config.textComponentTypes?.includes(type));\n return { ...parentHostContext, type: type, isInsideText };\n },\n\n /**\n * #### `getPublicInstance(instance)`\n *\n * Determines what object gets exposed as a ref. You'll likely want to return the `instance` itself. But\n * in some cases it might make sense to only expose some part of it.\n *\n * If you don't want to do anything here, return `instance`.\n */\n getPublicInstance(instance: Instance | TextInstance): PublicInstance {\n switch (instance.tag) {\n case Tag.Instance: {\n const createNodeMock = instance.rootContainer.config.createNodeMock;\n const mockNode = createNodeMock({\n type: instance.type,\n props: instance.props,\n key: null,\n });\n\n nodeToInstanceMap.set(mockNode, instance);\n\n return mockNode;\n }\n\n default:\n return instance;\n }\n },\n\n /**\n * #### `prepareForCommit(containerInfo)`\n *\n * This method lets you store some information before React starts making changes to the tree on\n * the screen. For example, the DOM renderer stores the current text selection so that it can later\n * restore it. This method is mirrored by `resetAfterCommit`.\n *\n * Even if you don't want to do anything here, you need to return `null` from it.\n */\n prepareForCommit(_containerInfo: Container) {\n return null; // noop\n },\n\n /**\n * #### `resetAfterCommit(containerInfo)`\n *\n * This method is called right after React has performed the tree mutations. You can use it to restore\n * something you've stored in `prepareForCommit` — for example, text selection.\n *\n * You can leave it empty.\n */\n resetAfterCommit(_containerInfo: Container): void {\n // noop\n },\n\n /**\n * #### `preparePortalMount(containerInfo)`\n *\n * This method is called for a container that's used as a portal target. Usually you can leave it empty.\n */\n preparePortalMount(_containerInfo: Container): void {\n // noop\n },\n\n /**\n * #### `scheduleTimeout(fn, delay)`\n *\n * You can proxy this to `setTimeout` or its equivalent in your environment.\n */\n scheduleTimeout: setTimeout,\n\n /**\n * #### `cancelTimeout(id)`\n *\n * You can proxy this to `clearTimeout` or its equivalent in your environment.\n */\n cancelTimeout: clearTimeout,\n\n /**\n * #### `noTimeout`\n *\n * This is a property (not a function) that should be set to something that can never be a valid timeout ID.\n * For example, you can set it to `-1`.\n */\n noTimeout: -1,\n\n /**\n * #### `supportsMicrotasks`\n *\n * Set this to `true` to indicate that your renderer supports `scheduleMicrotask`. We use microtasks as part\n * of our discrete event implementation in React DOM. If you're not sure if your renderer should support this,\n * you probably should. The option to not implement `scheduleMicrotask` exists so that platforms with more control\n * over user events, like React Native, can choose to use a different mechanism.\n */\n supportsMicrotasks: true,\n\n /**\n * #### `scheduleMicrotask(fn)`\n *\n * Optional. You can proxy this to `queueMicrotask` or its equivalent in your environment.\n */\n scheduleMicrotask: queueMicrotask,\n\n /**\n * #### `isPrimaryRenderer`\n *\n * This is a property (not a function) that should be set to `true` if your renderer is the main one on the\n * page. For example, if you're writing a renderer for the Terminal, it makes sense to set it to `true`, but\n * if your renderer is used *on top of* React DOM or some other existing renderer, set it to `false`.\n */\n isPrimaryRenderer: true,\n\n /**\n * Whether the renderer shouldn't trigger missing `act()` warnings\n */\n warnsIfNotActing: true,\n\n getInstanceFromNode(node: object): Fiber | null | undefined {\n const instance = nodeToInstanceMap.get(node);\n if (instance !== undefined) {\n return instance.unstable_fiber;\n }\n\n return null;\n },\n\n beforeActiveInstanceBlur(): void {\n // noop\n },\n\n afterActiveInstanceBlur(): void {\n // noop\n },\n\n prepareScopeUpdate(scopeInstance: object, instance: Instance): void {\n nodeToInstanceMap.set(scopeInstance, instance);\n },\n\n getInstanceFromScope(scopeInstance: object): Instance | null {\n return nodeToInstanceMap.get(scopeInstance) ?? null;\n },\n\n detachDeletedInstance(_node: Instance): void {},\n\n /**\n * #### `appendChild(parentInstance, child)`\n *\n * This method should mutate the `parentInstance` and add the child to its list of children. For example,\n * in the DOM this would translate to a `parentInstance.appendChild(child)` call.\n *\n * Although this method currently runs in the commit phase, you still should not mutate any other nodes\n * in it. If you need to do some additional work when a node is definitely connected to the visible tree, look at `commitMount`.\n */\n appendChild: appendChild,\n\n /**\n * #### `appendChildToContainer(container, child)`\n *\n * Same as `appendChild`, but for when a node is attached to the root container. This is useful if attaching\n * to the root has a slightly different implementation, or if the root container nodes are of a different\n * type than the rest of the tree.\n */\n appendChildToContainer: appendChild,\n\n /**\n * #### `insertBefore(parentInstance, child, beforeChild)`\n *\n * This method should mutate the `parentInstance` and place the `child` before `beforeChild` in the list of\n * its children. For example, in the DOM this would translate to a `parentInstance.insertBefore(child, beforeChild)` call.\n *\n * Note that React uses this method both for insertions and for reordering nodes. Similar to DOM, it is expected\n * that you can call `insertBefore` to reposition an existing child. Do not mutate any other parts of the tree from it.\n */\n insertBefore: insertBefore,\n\n /**\n * #### `insertInContainerBefore(container, child, beforeChild)\n *\n * Same as `insertBefore`, but for when a node is attached to the root container. This is useful if attaching\n * to the root has a slightly different implementation, or if the root container nodes are of a different type\n * than the rest of the tree.\n */\n insertInContainerBefore: insertBefore,\n\n /**\n * #### `removeChild(parentInstance, child)`\n *\n * This method should mutate the `parentInstance` to remove the `child` from the list of its children.\n *\n * React will only call it for the top-level node that is being removed. It is expected that garbage collection\n * would take care of the whole subtree. You are not expected to traverse the child tree in it.\n */\n removeChild: removeChild,\n\n /**\n * #### `removeChildFromContainer(container, child)`\n *\n * Same as `removeChild`, but for when a node is detached from the root container. This is useful if attaching\n * to the root has a slightly different implementation, or if the root container nodes are of a different type\n * than the rest of the tree.\n */\n removeChildFromContainer: removeChild,\n\n /**\n * #### `resetTextContent(instance)`\n *\n * If you returned `true` from `shouldSetTextContent` for the previous props, but returned `false` from\n * `shouldSetTextContent` for the next props, React will call this method so that you can clear the text\n * content you were managing manually. For example, in the DOM you could set `node.textContent = ''`.\n *\n * If you never return `true` from `shouldSetTextContent`, you can leave it empty.\n */\n resetTextContent(_instance: Instance): void {\n // noop\n },\n\n /**\n * #### `commitTextUpdate(textInstance, prevText, nextText)`\n *\n * This method should mutate the `textInstance` and update its text content to `nextText`.\n *\n * Here, `textInstance` is a node created by `createTextInstance`.\n */\n commitTextUpdate(textInstance: TextInstance, _oldText: string, newText: string): void {\n textInstance.text = newText;\n },\n\n /**\n * #### `commitMount(instance, type, props, internalHandle)`\n *\n * This method is only called if you returned `true` from `finalizeInitialChildren` for this instance.\n *\n * It lets you do some additional work after the node is actually attached to the tree on the screen for\n * the first time. For example, the DOM renderer uses it to trigger focus on nodes with the `autoFocus` attribute.\n *\n * Note that `commitMount` does not mirror `removeChild` one to one because `removeChild` is only called for\n * the top-level removed node. This is why ideally `commitMount` should not mutate any nodes other than the\n * `instance` itself. For example, if it registers some events on some node above, it will be your responsibility\n * to traverse the tree in `removeChild` and clean them up, which is not ideal.\n *\n * The `internalHandle` data structure is meant to be opaque. If you bend the rules and rely on its internal\n * fields, be aware that it may change significantly between versions. You're taking on additional maintenance\n * risk by reading from it, and giving up all guarantees if you write something to it.\n *\n * If you never return `true` from `finalizeInitialChildren`, you can leave it empty.\n */\n commitMount(_instance: Instance, _type: Type, _props: Props, _internalHandle: Fiber): void {\n // noop\n },\n\n /**\n * #### `commitUpdate(instance, type, prevProps, nextProps, internalHandle)`\n *\n * This method should mutate the `instance` according to the set of changes in `updatePayload`. Here, `updatePayload`\n * is the object that you've returned from `prepareUpdate` and has an arbitrary structure that makes sense for your\n * renderer. For example, the DOM renderer returns an update payload like `[prop1, value1, prop2, value2, ...]` from\n * `prepareUpdate`, and that structure gets passed into `commitUpdate`. Ideally, all the diffing and calculation\n * should happen inside `prepareUpdate` so that `commitUpdate` can be fast and straightforward.\n *\n * The `internalHandle` data structure is meant to be opaque. If you bend the rules and rely on its internal fields,\n * be aware that it may change significantly between versions. You're taking on additional maintenance risk by\n * reading from it, and giving up all guarantees if you write something to it.\n */\n // @ts-expect-error @types/react-reconciler types don't fully match react-reconciler's actual Flow types.\n // Correctness is verified through tests.\n commitUpdate(\n instance: Instance,\n type: Type,\n _prevProps: Props,\n nextProps: Props,\n internalHandle: Fiber,\n ): void {\n instance.type = type;\n instance.props = nextProps;\n instance.unstable_fiber = internalHandle;\n },\n\n /**\n * #### `hideInstance(instance)`\n *\n * This method should make the `instance` invisible without removing it from the tree. For example, it can apply\n * visual styling to hide it. It is used by Suspense to hide the tree while the fallback is visible.\n */\n hideInstance(instance: Instance): void {\n instance.isHidden = true;\n },\n\n /**\n * #### `hideTextInstance(textInstance)`\n *\n * Same as `hideInstance`, but for nodes created by `createTextInstance`.\n */\n hideTextInstance(textInstance: TextInstance): void {\n textInstance.isHidden = true;\n },\n\n /**\n * #### `unhideInstance(instance, props)`\n *\n * This method should make the `instance` visible, undoing what `hideInstance` did.\n */\n unhideInstance(instance: Instance, _props: Props): void {\n instance.isHidden = false;\n },\n\n /**\n * #### `unhideTextInstance(textInstance, text)`\n *\n * Same as `unhideInstance`, but for nodes created by `createTextInstance`.\n */\n unhideTextInstance(textInstance: TextInstance, _text: string): void {\n textInstance.isHidden = false;\n },\n\n /**\n * #### `clearContainer(container)`\n *\n * This method should mutate the `container` root node and remove all children from it.\n */\n clearContainer(container: Container): void {\n container.children.forEach((child) => {\n child.parent = null;\n });\n\n container.children.splice(0);\n },\n\n /**\n * #### `maySuspendCommit(type, props)`\n *\n * This method is called during render to determine if the Host Component type and props require\n * some kind of loading process to complete before committing an update.\n */\n maySuspendCommit(_type: Type, _props: Props): boolean {\n return false;\n },\n\n /**\n * #### `preloadInstance(type, props)`\n *\n * This method may be called during render if the Host Component type and props might suspend a commit.\n * It can be used to initiate any work that might shorten the duration of a suspended commit.\n */\n preloadInstance(_type: Type, _props: Props): boolean {\n return true;\n },\n\n /**\n * #### `startSuspendingCommit()`\n *\n * This method is called just before the commit phase. Use it to set up any necessary state while any Host\n * Components that might suspend this commit are evaluated to determine if the commit must be suspended.\n */\n startSuspendingCommit() {},\n\n /**\n * #### `suspendInstance(type, props)`\n *\n * This method is called after `startSuspendingCommit` for each Host Component that indicated it might\n * suspend a commit.\n */\n suspendInstance() {},\n\n /**\n * #### `waitForCommitToBeReady()`\n *\n * This method is called after all `suspendInstance` calls are complete.\n *\n * Return `null` if the commit can happen immediately.\n * Return `(initiateCommit: Function) => Function` if the commit must be suspended. The argument to this\n * callback will initiate the commit when called. The return value is a cancellation function that the\n * Reconciler can use to abort the commit.\n */\n waitForCommitToBeReady() {\n return null;\n },\n\n // -------------------\n // Hydration Methods\n // (optional)\n // You can optionally implement hydration to \"attach\" to the existing tree during the initial render instead\n // of creating it from scratch. For example, the DOM renderer uses this to attach to an HTML markup.\n //\n // To support hydration, you need to declare `supportsHydration: true` and then implement the methods in\n // the \"Hydration\" section [listed in this file](https://github.com/facebook/react/blob/master/packages/react-reconciler/src/forks/ReactFiberHostConfig.custom.js).\n // File an issue if you need help.\n // -------------------\n supportsHydration: false,\n\n NotPendingTransition: null,\n\n resetFormInstance(_form: Instance) {},\n\n requestPostPaintCallback(_callback: (endTime: number) => void) {},\n};\n\nexport const TestReconciler = ReactReconciler(hostConfig);\n\n/**\n * This method should mutate the `parentInstance` and add the child to its list of children. For example,\n * in the DOM this would translate to a `parentInstance.appendChild(child)` call.\n *\n * Although this method currently runs in the commit phase, you still should not mutate any other nodes\n * in it. If you need to do some additional work when a node is definitely connected to the visible tree,\n * look at `commitMount`.\n */\nfunction appendChild(parentInstance: Container | Instance, child: Instance | TextInstance): void {\n const index = parentInstance.children.indexOf(child);\n if (index !== -1) {\n parentInstance.children.splice(index, 1);\n }\n\n child.parent = parentInstance;\n parentInstance.children.push(child);\n}\n\n/**\n * This method should mutate the `parentInstance` and place the `child` before `beforeChild` in the list\n * of its children. For example, in the DOM this would translate to a\n * `parentInstance.insertBefore(child, beforeChild)` call.\n *\n * Note that React uses this method both for insertions and for reordering nodes. Similar to DOM, it is\n * expected that you can call `insertBefore` to reposition an existing child. Do not mutate any other parts\n * of the tree from it.\n */\nfunction insertBefore(\n parentInstance: Container | Instance,\n child: Instance | TextInstance,\n beforeChild: Instance | TextInstance,\n): void {\n const index = parentInstance.children.indexOf(child);\n if (index !== -1) {\n parentInstance.children.splice(index, 1);\n }\n\n child.parent = parentInstance;\n const beforeIndex = parentInstance.children.indexOf(beforeChild);\n parentInstance.children.splice(beforeIndex, 0, child);\n}\n\n/**\n * This method should mutate the `parentInstance` to remove the `child` from the list of its children.\n *\n * React will only call it for the top-level node that is being removed. It is expected that garbage\n * collection would take care of the whole subtree. You are not expected to traverse the child tree in it.\n */\nfunction removeChild(parentInstance: Container | Instance, child: Instance | TextInstance): void {\n const index = parentInstance.children.indexOf(child);\n parentInstance.children.splice(index, 1);\n child.parent = null;\n}\n","export function formatComponentList(names: string[]): string {\n if (names.length === 0) {\n return \"\";\n }\n\n if (names.length === 1) {\n return `<${names[0]}>`;\n }\n\n if (names.length === 2) {\n return `<${names[0]}> or <${names[1]}>`;\n }\n\n const allButLast = names.slice(0, -1);\n const last = names[names.length - 1];\n\n return `${allButLast.map((name) => `<${name}>`).join(\", \")}, or <${last}>`;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAAS,sBAAsB;;;ACDxB,IAAM,MAAM;AAAA,EACjB,WAAW;AAAA,E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L;AAAA,IACA;AAAA,IACA,IAAI,YAAyB;AAC3B,UAAI,aAAa,MAAM;AACrB,cAAM,IAAI,MAAM,qDAAqD;AAAA,MACvE;AAEA,aAAO,YAAY,aAAa,SAAS;AAAA,IAC3C;AAAA,EACF;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/renderer.ts","../src/constants.ts","../src/query-all.ts","../src/render-to-json.ts","../src/host-element.ts","../src/reconciler.ts","../src/utils.ts"],"sourcesContent":["import type { ReactElement } from \"react\";\nimport { ConcurrentRoot } from \"react-reconciler/constants\";\n\nimport { Tag } from \"./constants\";\nimport { HostElement } from \"./host-element\";\nimport type { Container } from \"./reconciler\";\nimport { TestReconciler } from \"./reconciler\";\n\n// Refs:\n// https://github.com/facebook/react/blob/main/packages/react-test-renderer/src/ReactFiberConfigTestHost.js\n// https://github.com/facebook/react/blob/main/packages/react-noop-renderer/src/createReactNoop.js\n// https://github.com/facebook/react/blob/main/packages/react-native-renderer/src/ReactFiberConfigFabric.js\n\nconst defaultCreateMockNode = () => ({});\n\nconst defaultOnUncaughtError = (error: unknown, errorInfo: BaseErrorInfo) => {\n console.error(\"Uncaught error:\", error, errorInfo);\n};\nconst defaultOnCaughtError = (error: unknown, errorInfo: BaseErrorInfo) => {\n console.error(\"Caught error:\", error, errorInfo);\n};\nconst defaultOnRecoverableError = (error: unknown, errorInfo: BaseErrorInfo) => {\n console.error(\"Recoverable error:\", error, errorInfo);\n};\n\n/**\n * Options for configuring the test renderer root.\n */\nexport type RootOptions = {\n /** Types of host components that are allowed to contain text nodes. Trying to render text outside of these components will throw an error. */\n textComponentTypes?: string[];\n\n /**\n * Host component types to display to users in the error message when they try to render text outside of `textComponentTypes`.\n * Defaults to `textComponentTypes`, but you may want to override the components mentioned in the error message.\n */\n publicTextComponentTypes?: string[];\n\n /** Function to create mock nodes for refs. */\n createNodeMock?: (element: ReactElement) => object;\n\n /** Callback called when React catches an error in an Error Boundary. Called with the error caught by the Error Boundary, and an errorInfo object containing the componentStack. */\n onCaughtError?: ErrorHandler;\n\n /** Callback called when an error is thrown and not caught by an Error Boundary. Called with the error that was thrown, and an errorInfo object containing the componentStack. */\n onUncaughtError?: ErrorHandler;\n\n /** Callback called when React automatically recovers from errors. Called with an error React throws, and an errorInfo object containing the componentStack. Some recoverable errors may include the original error cause as error.cause. */\n onRecoverableError?: ErrorHandler;\n\n /** A string prefix React uses for IDs generated by useId. Useful to avoid conflicts when using multiple roots on the same page. */\n identifierPrefix?: string;\n\n /** Enable React Strict Mode. */\n isStrictMode?: boolean;\n};\n\ntype ErrorHandler = (error: unknown, errorInfo: BaseErrorInfo) => void;\n\ninterface BaseErrorInfo {\n componentStack?: string;\n}\n\n/**\n * Root instance returned by createRoot. Provides methods to render and unmount components.\n */\nexport type Root = {\n /** Render a React element into the root. Must be called within act(). */\n render: (element: ReactElement) => void;\n /** Unmount the root and clean up. Must be called within act(). */\n unmount: () => void;\n /** The root container element. */\n container: HostElement;\n};\n\n/**\n * Create a new test renderer root instance.\n *\n * @param options - Optional configuration for the renderer.\n * @returns A Root instance with render, unmount, and container properties.\n */\nexport function createRoot(options?: RootOptions): Root {\n let container: Container | null = {\n tag: Tag.Container,\n parent: null,\n children: [],\n isHidden: false,\n config: {\n textComponentTypes: options?.textComponentTypes,\n publicTextComponentTypes: options?.publicTextComponentTypes,\n createNodeMock: options?.createNodeMock ?? defaultCreateMockNode,\n },\n };\n\n // @types/react-reconciler types don't fully match react-reconciler's actual Flow types.\n // The return type is correct at runtime but TypeScript can't verify it statically.\n // Correctness is verified through tests.\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n let containerFiber = TestReconciler.createContainer(\n container,\n ConcurrentRoot,\n null, // hydrationCallbacks\n options?.isStrictMode ?? false,\n false, // concurrentUpdatesByDefaultOverride\n options?.identifierPrefix ?? \"\",\n options?.onUncaughtError ?? defaultOnUncaughtError,\n options?.onCaughtError ?? defaultOnCaughtError,\n options?.onRecoverableError ?? defaultOnRecoverableError,\n () => {}, // onDefaultTransitionIndicator\n null, // transitionCallbacks\n );\n\n const render = (element: ReactElement) => {\n if (containerFiber == null) {\n throw new Error(\"Cannot render after unmount\");\n }\n\n TestReconciler.updateContainer(element, containerFiber, null, null);\n };\n\n const unmount = () => {\n if (container == null) {\n return;\n }\n\n TestReconciler.updateContainer(null, containerFiber, null, null);\n\n containerFiber = null;\n container = null;\n };\n\n return {\n render,\n unmount,\n get container(): HostElement {\n if (container == null) {\n throw new Error(\"Cannot access .container on unmounted test renderer\");\n }\n\n return HostElement.fromInstance(container);\n },\n };\n}\n","export const Tag = {\n Container: \"CONTAINER\",\n Instance: \"INSTANCE\",\n Text: \"TEXT\",\n} as const;\n\n// Container should render as <>{...}</>\nexport const CONTAINER_TYPE = \"\";\n\n// Source: https://github.com/facebook/react/blob/main/packages/shared/ReactSymbols.js#L16\nexport const REACT_CONTEXT_TYPE: symbol = Symbol.for(\"react.context\");\n","import type { HostElement } from \"./host-element\";\n\n/**\n * Options for querying elements in the rendered tree.\n */\nexport interface QueryOptions {\n /** Include the element itself in the results if it matches the predicate. Defaults to false. */\n includeSelf?: boolean;\n\n /** Exclude any ancestors of deepest matched elements even if they match the predicate. Defaults to false. */\n matchDeepestOnly?: boolean;\n}\n\n/**\n * Find all descendant elements matching the predicate.\n *\n * @param element - Root element to search from.\n * @param predicate - Function that returns true for matching elements.\n * @param options - Optional query configuration.\n * @returns Array of matching elements in tree order.\n */\nexport function queryAll(\n element: HostElement,\n predicate: (element: HostElement) => boolean,\n options?: QueryOptions,\n): HostElement[] {\n const includeSelf = options?.includeSelf ?? false;\n const matchDeepestOnly = options?.matchDeepestOnly ?? false;\n\n const results: HostElement[] = [];\n\n // Match descendants first but do not add them to results yet.\n const matchingDescendants: HostElement[] = [];\n\n element.children.forEach((child) => {\n if (typeof child === \"string\") {\n return;\n }\n\n matchingDescendants.push(...queryAll(child, predicate, { ...options, includeSelf: true }));\n });\n\n if (\n includeSelf &&\n // When matchDeepestOnly = true: add current element only if no descendants match\n (matchingDescendants.length === 0 || !matchDeepestOnly) &&\n predicate(element)\n ) {\n results.push(element);\n }\n\n // Add matching descendants after element to preserve original tree walk order.\n results.push(...matchingDescendants);\n\n return results;\n}\n","import { CONTAINER_TYPE, Tag } from \"./constants\";\nimport type { Container, Instance, TextInstance } from \"./reconciler\";\n\n/** A node in the JSON representation - either a JsonElement or a text string. */\nexport type JsonNode = JsonElement | string;\n\n/**\n * JSON representation of a rendered element, compatible with react-test-renderer format.\n */\nexport type JsonElement = {\n type: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n props: Record<string, any>;\n children: JsonNode[] | null;\n $$typeof: symbol;\n};\n\nexport function renderContainerToJson(instance: Container): JsonElement {\n return {\n type: CONTAINER_TYPE,\n props: {},\n children: renderChildrenToJson(instance.children),\n $$typeof: Symbol.for(\"react.test.json\"),\n };\n}\n\nexport function renderInstanceToJson(instance: Instance): JsonElement | null {\n if (instance.isHidden) {\n return null;\n }\n\n // We don't include the `children` prop in JSON.\n // Instead, we will include the actual rendered children.\n const { children: _children, ...restProps } = instance.props;\n\n return {\n type: instance.type,\n props: restProps,\n children: renderChildrenToJson(instance.children),\n $$typeof: Symbol.for(\"react.test.json\"),\n };\n}\n\nexport function renderTextInstanceToJson(instance: TextInstance): string | null {\n if (instance.isHidden) {\n return null;\n }\n\n return instance.text;\n}\n\nexport function renderChildrenToJson(children: Array<Instance | TextInstance>): JsonNode[] {\n const result = [];\n\n for (const child of children) {\n if (child.tag === Tag.Instance) {\n const renderedChild = renderInstanceToJson(child);\n if (renderedChild !== null) {\n result.push(renderedChild);\n }\n } else {\n const renderedChild = renderTextInstanceToJson(child);\n if (renderedChild !== null) {\n result.push(renderedChild);\n }\n }\n }\n\n return result;\n}\n","import type { Fiber } from \"react-reconciler\";\n\nimport { CONTAINER_TYPE, Tag } from \"./constants\";\nimport type { QueryOptions } from \"./query-all\";\nimport { queryAll } from \"./query-all\";\nimport type { Container, Instance, TextInstance } from \"./reconciler\";\nimport type { JsonElement } from \"./render-to-json\";\nimport { renderContainerToJson, renderInstanceToJson } from \"./render-to-json\";\n\n/** A node in the rendered tree - either a HostElement or a text string. */\nexport type HostNode = HostElement | string;\n\n/** Props object for a host element. */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type HostElementProps = Record<string, any>;\n\nconst instanceMap = new WeakMap<Instance | Container, HostElement>();\n\n/**\n * Represents a rendered host element in the test renderer tree.\n * Provides a DOM-like API for querying and inspecting rendered components.\n */\nexport class HostElement {\n private instance: Instance | Container;\n\n private constructor(instance: Instance | Container) {\n this.instance = instance;\n }\n\n /** The element type (e.g., \"div\", \"span\"). Empty string for container. */\n get type(): string {\n return this.instance.tag === Tag.Instance ? this.instance.type : CONTAINER_TYPE;\n }\n\n /** The element's props object. */\n get props(): HostElementProps {\n return this.instance.tag === Tag.Instance ? this.instance.props : {};\n }\n\n /** The parent element, or null if this is the root container. */\n get parent(): HostElement | null {\n const parentInstance = this.instance.parent;\n if (parentInstance == null) {\n return null;\n }\n\n return HostElement.fromInstance(parentInstance);\n }\n\n /** Array of child nodes (elements and text strings). Hidden children are excluded. */\n get children(): HostNode[] {\n const result = this.instance.children\n .filter((child) => !child.isHidden)\n .map((child) => getHostNodeForInstance(child));\n return result;\n }\n\n /**\n * Access to the underlying React Fiber node. This is an unstable API that exposes\n * internal react-reconciler structures which may change without warning in future\n * React versions. Use with caution and only when absolutely necessary.\n *\n * @returns The Fiber node for this instance, or null if this is a container.\n */\n get unstable_fiber(): Fiber | null {\n return this.instance.tag === Tag.Instance ? this.instance.unstable_fiber : null;\n }\n\n /**\n * Convert this element to a JSON representation suitable for snapshots.\n *\n * @returns JSON element or null if the element is hidden.\n */\n toJSON(): JsonElement | null {\n return this.instance.tag === Tag.Container\n ? renderContainerToJson(this.instance)\n : renderInstanceToJson(this.instance);\n }\n\n /**\n * Find all descendant elements matching the predicate.\n *\n * @param predicate - Function that returns true for matching elements.\n * @param options - Optional query configuration.\n * @returns Array of matching elements.\n */\n queryAll(predicate: (element: HostElement) => boolean, options?: QueryOptions): HostElement[] {\n return queryAll(this, predicate, options);\n }\n\n /** @internal */\n static fromInstance(instance: Instance | Container): HostElement {\n const hostElement = instanceMap.get(instance);\n if (hostElement) {\n return hostElement;\n }\n\n const result = new HostElement(instance);\n instanceMap.set(instance, result);\n return result;\n }\n}\n\nfunction getHostNodeForInstance(instance: Instance | TextInstance): HostNode {\n switch (instance.tag) {\n case Tag.Text:\n return instance.text;\n\n case Tag.Instance:\n return HostElement.fromInstance(instance);\n }\n}\n","import type { ReactElement } from \"react\";\nimport type { Fiber, ReactContext, ReactProviderType } from \"react-reconciler\";\nimport ReactReconciler from \"react-reconciler\";\nimport { DefaultEventPriority, NoEventPriority } from \"react-reconciler/constants\";\n\nimport { Tag } from \"./constants\";\nimport { REACT_CONTEXT_TYPE } from \"./constants\";\nimport { formatComponentList } from \"./utils\";\n\nexport type Type = string;\nexport type Props = Record<string, unknown>;\n\ntype ReconcilerConfig = {\n textComponentTypes?: string[];\n publicTextComponentTypes?: string[];\n createNodeMock: (element: ReactElement) => object;\n};\n\nexport type Container = {\n tag: typeof Tag.Container;\n parent: null;\n children: Array<Instance | TextInstance>;\n isHidden: false;\n config: ReconcilerConfig;\n};\n\nexport type Instance = {\n tag: typeof Tag.Instance;\n type: string;\n props: Props;\n children: Array<Instance | TextInstance>;\n parent: Container | Instance | null;\n rootContainer: Container;\n isHidden: boolean;\n unstable_fiber: Fiber;\n};\n\nexport type TextInstance = {\n tag: typeof Tag.Text;\n text: string;\n parent: Container | Instance | null;\n isHidden: boolean;\n};\n\nexport type SuspenseInstance = object;\nexport type HydratableInstance = object;\nexport type FormInstance = object;\nexport type PublicInstance = object | TextInstance;\nexport type UpdatePayload = unknown;\nexport type ChildSet = unknown;\nexport type TimeoutHandle = unknown;\nexport type NoTimeout = unknown;\nexport type TransitionStatus = unknown;\n\ntype HostContext = {\n type: string;\n isInsideText: boolean;\n config: ReconcilerConfig;\n};\n\nconst nodeToInstanceMap = new WeakMap<object, Instance>();\n\nlet currentUpdatePriority: number = NoEventPriority;\n\nconst hostConfig: ReactReconciler.HostConfig<\n Type,\n Props,\n Container,\n Instance,\n TextInstance,\n SuspenseInstance,\n HydratableInstance,\n FormInstance,\n PublicInstance,\n HostContext,\n ChildSet,\n TimeoutHandle,\n NoTimeout,\n TransitionStatus\n> = {\n /**\n * The reconciler has two modes: mutation mode and persistent mode. You must specify one of them.\n *\n * If your target platform is similar to the DOM and has methods similar to `appendChild`, `removeChild`,\n * and so on, you'll want to use the **mutation mode**. This is the same mode used by React DOM, React ART,\n * and the classic React Native renderer.\n *\n * ```js\n * const HostConfig = {\n * // ...\n * supportsMutation: true,\n * // ...\n * }\n * ```\n *\n * Depending on the mode, the reconciler will call different methods on your host config.\n * If you're not sure which one you want, you likely need the mutation mode.\n */\n supportsMutation: true,\n\n /**\n * The reconciler has two modes: mutation mode and persistent mode. You must specify one of them.\n *\n * If your target platform has immutable trees, you'll want the **persistent mode** instead. In that mode,\n * existing nodes are never mutated, and instead every change clones the parent tree and then replaces\n * the whole parent tree at the root. This is the node used by the new React Native renderer, codenamed \"Fabric\".\n *\n * ```js\n * const HostConfig = {\n * // ...\n * supportsPersistence: true,\n * // ...\n * }\n * ```\n *\n * Depending on the mode, the reconciler will call different methods on your host config.\n * If you're not sure which one you want, you likely need the mutation mode.\n */\n supportsPersistence: false,\n\n /**\n * #### `createInstance(type, props, rootContainer, hostContext, internalHandle)`\n *\n * This method should return a newly created node. For example, the DOM renderer would call\n * `document.createElement(type)` here and then set the properties from `props`.\n *\n * You can use `rootContainer` to access the root container associated with that tree. For example,\n * in the DOM renderer, this is useful to get the correct `document` reference that the root belongs to.\n *\n * The `hostContext` parameter lets you keep track of some information about your current place in\n * the tree. To learn more about it, see `getChildHostContext` below.\n *\n * The `internalHandle` data structure is meant to be opaque. If you bend the rules and rely on its\n * internal fields, be aware that it may change significantly between versions. You're taking on additional\n * maintenance risk by reading from it, and giving up all guarantees if you write something to it.\n *\n * This method happens **in the render phase**. It can (and usually should) mutate the node it has\n * just created before returning it, but it must not modify any other nodes. It must not register\n * any event handlers on the parent tree. This is because an instance being created doesn't guarantee\n * it would be placed in the tree — it could be left unused and later collected by GC. If you need to do\n * something when an instance is definitely in the tree, look at `commitMount` instead.\n */\n createInstance(\n type: Type,\n props: Props,\n rootContainer: Container,\n _hostContext: HostContext,\n internalHandle: Fiber,\n ) {\n return {\n tag: Tag.Instance,\n type,\n props,\n isHidden: false,\n children: [],\n parent: null,\n rootContainer,\n unstable_fiber: internalHandle,\n };\n },\n\n /**\n * #### `createTextInstance(text, rootContainer, hostContext, internalHandle)`\n *\n * Same as `createInstance`, but for text nodes. If your renderer doesn't support text nodes, you can\n * throw here.\n */\n createTextInstance(\n text: string,\n rootContainer: Container,\n hostContext: HostContext,\n _internalHandle: Fiber,\n ): TextInstance {\n if (rootContainer.config.textComponentTypes && !hostContext.isInsideText) {\n const componentTypes =\n rootContainer.config.publicTextComponentTypes ?? rootContainer.config.textComponentTypes;\n\n throw new Error(\n `Invariant Violation: Text strings must be rendered within a ${formatComponentList(\n componentTypes,\n )} component. Detected attempt to render \"${text}\" string within a <${\n hostContext.type\n }> component.`,\n );\n }\n\n return {\n tag: Tag.Text,\n text,\n parent: null,\n isHidden: false,\n };\n },\n\n /**\n * #### `appendInitialChild(parentInstance, child)`\n *\n * This method should mutate the `parentInstance` and add the child to its list of children.\n * For example, in the DOM this would translate to a `parentInstance.appendChild(child)` call.\n *\n * This method happens **in the render phase**. It can mutate `parentInstance` and `child`, but it\n * must not modify any other nodes. It's called while the tree is still being built up and not connected\n * to the actual tree on the screen.\n */\n appendInitialChild: appendChild,\n\n /**\n * #### `finalizeInitialChildren(instance, type, props, rootContainer, hostContext)`\n *\n * In this method, you can perform some final mutations on the `instance`. Unlike with `createInstance`,\n * by the time `finalizeInitialChildren` is called, all the initial children have already been added to\n * the `instance`, but the instance itself has not yet been connected to the tree on the screen.\n *\n * This method happens **in the render phase**. It can mutate `instance`, but it must not modify any other\n * nodes. It's called while the tree is still being built up and not connected to the actual tree on the screen.\n *\n * There is a second purpose to this method. It lets you specify whether there is some work that needs to\n * happen when the node is connected to the tree on the screen. If you return `true`, the instance will\n * receive a `commitMount` call later. See its documentation below.\n *\n * If you don't want to do anything here, you should return `false`.\n */\n finalizeInitialChildren(\n _instance: Instance,\n _type: Type,\n _props: Props,\n _rootContainer: Container,\n _hostContext: HostContext,\n ): boolean {\n return false;\n },\n\n /**\n * #### `shouldSetTextContent(type, props)`\n *\n * Some target platforms support setting an instance's text content without manually creating a text node.\n * For example, in the DOM, you can set `node.textContent` instead of creating a text node and appending it.\n *\n * If you return `true` from this method, React will assume that this node's children are text, and will\n * not create nodes for them. It will instead rely on you to have filled that text during `createInstance`.\n * This is a performance optimization. For example, the DOM renderer returns `true` only if `type` is a\n * known text-only parent (like `'textarea'`) or if `props.children` has a `'string'` type. If you return `true`,\n * you will need to implement `resetTextContent` too.\n *\n * If you don't want to do anything here, you should return `false`.\n * This method happens **in the render phase**. Do not mutate the tree from it.\n */\n shouldSetTextContent(_type: Type, _props: Props): boolean {\n return false;\n },\n\n setCurrentUpdatePriority(newPriority: number) {\n currentUpdatePriority = newPriority;\n },\n\n getCurrentUpdatePriority() {\n return currentUpdatePriority;\n },\n\n resolveUpdatePriority(): number {\n return currentUpdatePriority || DefaultEventPriority;\n },\n\n shouldAttemptEagerTransition() {\n return false;\n },\n\n /**\n * #### `getRootHostContext(rootContainer)`\n *\n * This method lets you return the initial host context from the root of the tree. See `getChildHostContext`\n * for the explanation of host context.\n *\n * If you don't intend to use host context, you can return `null`.\n * This method happens **in the render phase**. Do not mutate the tree from it.\n */\n getRootHostContext(rootContainer: Container): HostContext | null {\n return {\n type: \"ROOT\",\n config: rootContainer.config,\n isInsideText: false,\n };\n },\n\n /**\n * #### `getChildHostContext(parentHostContext, type, rootContainer)`\n *\n * Host context lets you track some information about where you are in the tree so that it's available\n * inside `createInstance` as the `hostContext` parameter. For example, the DOM renderer uses it to track\n * whether it's inside an HTML or an SVG tree, because `createInstance` implementation needs to be\n * different for them.\n *\n * If the node of this `type` does not influence the context you want to pass down, you can return\n * `parentHostContext`. Alternatively, you can return any custom object representing the information\n * you want to pass down.\n *\n * If you don't want to do anything here, return `parentHostContext`.\n *\n * This method happens **in the render phase**. Do not mutate the tree from it.\n */\n getChildHostContext(parentHostContext: HostContext, type: Type): HostContext {\n const isInsideText = Boolean(parentHostContext.config.textComponentTypes?.includes(type));\n return { ...parentHostContext, type: type, isInsideText };\n },\n\n /**\n * #### `getPublicInstance(instance)`\n *\n * Determines what object gets exposed as a ref. You'll likely want to return the `instance` itself. But\n * in some cases it might make sense to only expose some part of it.\n *\n * If you don't want to do anything here, return `instance`.\n */\n getPublicInstance(instance: Instance | TextInstance): PublicInstance {\n switch (instance.tag) {\n case Tag.Instance: {\n const createNodeMock = instance.rootContainer.config.createNodeMock;\n const mockNode = createNodeMock({\n type: instance.type,\n props: instance.props,\n key: null,\n });\n\n nodeToInstanceMap.set(mockNode, instance);\n\n return mockNode;\n }\n\n default:\n return instance;\n }\n },\n\n /**\n * #### `prepareForCommit(containerInfo)`\n *\n * This method lets you store some information before React starts making changes to the tree on\n * the screen. For example, the DOM renderer stores the current text selection so that it can later\n * restore it. This method is mirrored by `resetAfterCommit`.\n *\n * Even if you don't want to do anything here, you need to return `null` from it.\n */\n prepareForCommit(_containerInfo: Container) {\n return null; // noop\n },\n\n /**\n * #### `resetAfterCommit(containerInfo)`\n *\n * This method is called right after React has performed the tree mutations. You can use it to restore\n * something you've stored in `prepareForCommit` — for example, text selection.\n *\n * You can leave it empty.\n */\n resetAfterCommit(_containerInfo: Container): void {\n // noop\n },\n\n /**\n * #### `preparePortalMount(containerInfo)`\n *\n * This method is called for a container that's used as a portal target. Usually you can leave it empty.\n */\n preparePortalMount(_containerInfo: Container): void {\n // noop\n },\n\n /**\n * #### `scheduleTimeout(fn, delay)`\n *\n * You can proxy this to `setTimeout` or its equivalent in your environment.\n */\n scheduleTimeout: setTimeout,\n\n /**\n * #### `cancelTimeout(id)`\n *\n * You can proxy this to `clearTimeout` or its equivalent in your environment.\n */\n cancelTimeout: clearTimeout,\n\n /**\n * #### `noTimeout`\n *\n * This is a property (not a function) that should be set to something that can never be a valid timeout ID.\n * For example, you can set it to `-1`.\n */\n noTimeout: -1,\n\n /**\n * #### `supportsMicrotasks`\n *\n * Set this to `true` to indicate that your renderer supports `scheduleMicrotask`. We use microtasks as part\n * of our discrete event implementation in React DOM. If you're not sure if your renderer should support this,\n * you probably should. The option to not implement `scheduleMicrotask` exists so that platforms with more control\n * over user events, like React Native, can choose to use a different mechanism.\n */\n supportsMicrotasks: true,\n\n /**\n * #### `scheduleMicrotask(fn)`\n *\n * Optional. You can proxy this to `queueMicrotask` or its equivalent in your environment.\n */\n scheduleMicrotask: queueMicrotask,\n\n /**\n * #### `isPrimaryRenderer`\n *\n * This is a property (not a function) that should be set to `true` if your renderer is the main one on the\n * page. For example, if you're writing a renderer for the Terminal, it makes sense to set it to `true`, but\n * if your renderer is used *on top of* React DOM or some other existing renderer, set it to `false`.\n */\n isPrimaryRenderer: true,\n\n /**\n * Whether the renderer shouldn't trigger missing `act()` warnings\n */\n warnsIfNotActing: true,\n\n getInstanceFromNode(node: object): Fiber | null | undefined {\n const instance = nodeToInstanceMap.get(node);\n if (instance !== undefined) {\n return instance.unstable_fiber;\n }\n\n return null;\n },\n\n beforeActiveInstanceBlur(): void {\n // noop\n },\n\n afterActiveInstanceBlur(): void {\n // noop\n },\n\n prepareScopeUpdate(scopeInstance: object, instance: Instance): void {\n nodeToInstanceMap.set(scopeInstance, instance);\n },\n\n getInstanceFromScope(scopeInstance: object): Instance | null {\n return nodeToInstanceMap.get(scopeInstance) ?? null;\n },\n\n detachDeletedInstance(_node: Instance): void {},\n\n /**\n * #### `appendChild(parentInstance, child)`\n *\n * This method should mutate the `parentInstance` and add the child to its list of children. For example,\n * in the DOM this would translate to a `parentInstance.appendChild(child)` call.\n *\n * Although this method currently runs in the commit phase, you still should not mutate any other nodes\n * in it. If you need to do some additional work when a node is definitely connected to the visible tree, look at `commitMount`.\n */\n appendChild: appendChild,\n\n /**\n * #### `appendChildToContainer(container, child)`\n *\n * Same as `appendChild`, but for when a node is attached to the root container. This is useful if attaching\n * to the root has a slightly different implementation, or if the root container nodes are of a different\n * type than the rest of the tree.\n */\n appendChildToContainer: appendChild,\n\n /**\n * #### `insertBefore(parentInstance, child, beforeChild)`\n *\n * This method should mutate the `parentInstance` and place the `child` before `beforeChild` in the list of\n * its children. For example, in the DOM this would translate to a `parentInstance.insertBefore(child, beforeChild)` call.\n *\n * Note that React uses this method both for insertions and for reordering nodes. Similar to DOM, it is expected\n * that you can call `insertBefore` to reposition an existing child. Do not mutate any other parts of the tree from it.\n */\n insertBefore: insertBefore,\n\n /**\n * #### `insertInContainerBefore(container, child, beforeChild)\n *\n * Same as `insertBefore`, but for when a node is attached to the root container. This is useful if attaching\n * to the root has a slightly different implementation, or if the root container nodes are of a different type\n * than the rest of the tree.\n */\n insertInContainerBefore: insertBefore,\n\n /**\n * #### `removeChild(parentInstance, child)`\n *\n * This method should mutate the `parentInstance` to remove the `child` from the list of its children.\n *\n * React will only call it for the top-level node that is being removed. It is expected that garbage collection\n * would take care of the whole subtree. You are not expected to traverse the child tree in it.\n */\n removeChild: removeChild,\n\n /**\n * #### `removeChildFromContainer(container, child)`\n *\n * Same as `removeChild`, but for when a node is detached from the root container. This is useful if attaching\n * to the root has a slightly different implementation, or if the root container nodes are of a different type\n * than the rest of the tree.\n */\n removeChildFromContainer: removeChild,\n\n /**\n * #### `resetTextContent(instance)`\n *\n * If you returned `true` from `shouldSetTextContent` for the previous props, but returned `false` from\n * `shouldSetTextContent` for the next props, React will call this method so that you can clear the text\n * content you were managing manually. For example, in the DOM you could set `node.textContent = ''`.\n *\n * If you never return `true` from `shouldSetTextContent`, you can leave it empty.\n */\n resetTextContent(_instance: Instance): void {\n // noop\n },\n\n /**\n * #### `commitTextUpdate(textInstance, prevText, nextText)`\n *\n * This method should mutate the `textInstance` and update its text content to `nextText`.\n *\n * Here, `textInstance` is a node created by `createTextInstance`.\n */\n commitTextUpdate(textInstance: TextInstance, _oldText: string, newText: string): void {\n textInstance.text = newText;\n },\n\n /**\n * #### `commitMount(instance, type, props, internalHandle)`\n *\n * This method is only called if you returned `true` from `finalizeInitialChildren` for this instance.\n *\n * It lets you do some additional work after the node is actually attached to the tree on the screen for\n * the first time. For example, the DOM renderer uses it to trigger focus on nodes with the `autoFocus` attribute.\n *\n * Note that `commitMount` does not mirror `removeChild` one to one because `removeChild` is only called for\n * the top-level removed node. This is why ideally `commitMount` should not mutate any nodes other than the\n * `instance` itself. For example, if it registers some events on some node above, it will be your responsibility\n * to traverse the tree in `removeChild` and clean them up, which is not ideal.\n *\n * The `internalHandle` data structure is meant to be opaque. If you bend the rules and rely on its internal\n * fields, be aware that it may change significantly between versions. You're taking on additional maintenance\n * risk by reading from it, and giving up all guarantees if you write something to it.\n *\n * If you never return `true` from `finalizeInitialChildren`, you can leave it empty.\n */\n commitMount(_instance: Instance, _type: Type, _props: Props, _internalHandle: Fiber): void {\n // noop\n },\n\n /**\n * #### `commitUpdate(instance, type, prevProps, nextProps, internalHandle)`\n *\n * This method should mutate the `instance` according to the set of changes in `updatePayload`. Here, `updatePayload`\n * is the object that you've returned from `prepareUpdate` and has an arbitrary structure that makes sense for your\n * renderer. For example, the DOM renderer returns an update payload like `[prop1, value1, prop2, value2, ...]` from\n * `prepareUpdate`, and that structure gets passed into `commitUpdate`. Ideally, all the diffing and calculation\n * should happen inside `prepareUpdate` so that `commitUpdate` can be fast and straightforward.\n *\n * The `internalHandle` data structure is meant to be opaque. If you bend the rules and rely on its internal fields,\n * be aware that it may change significantly between versions. You're taking on additional maintenance risk by\n * reading from it, and giving up all guarantees if you write something to it.\n */\n commitUpdate(\n instance: Instance,\n type: Type,\n _prevProps: Props,\n nextProps: Props,\n internalHandle: Fiber,\n ): void {\n instance.type = type;\n instance.props = nextProps;\n instance.unstable_fiber = internalHandle;\n },\n\n /**\n * #### `hideInstance(instance)`\n *\n * This method should make the `instance` invisible without removing it from the tree. For example, it can apply\n * visual styling to hide it. It is used by Suspense to hide the tree while the fallback is visible.\n */\n hideInstance(instance: Instance): void {\n instance.isHidden = true;\n },\n\n /**\n * #### `hideTextInstance(textInstance)`\n *\n * Same as `hideInstance`, but for nodes created by `createTextInstance`.\n */\n hideTextInstance(textInstance: TextInstance): void {\n textInstance.isHidden = true;\n },\n\n /**\n * #### `unhideInstance(instance, props)`\n *\n * This method should make the `instance` visible, undoing what `hideInstance` did.\n */\n unhideInstance(instance: Instance, _props: Props): void {\n instance.isHidden = false;\n },\n\n /**\n * #### `unhideTextInstance(textInstance, text)`\n *\n * Same as `unhideInstance`, but for nodes created by `createTextInstance`.\n */\n unhideTextInstance(textInstance: TextInstance, _text: string): void {\n textInstance.isHidden = false;\n },\n\n /**\n * #### `clearContainer(container)`\n *\n * This method should mutate the `container` root node and remove all children from it.\n */\n clearContainer(container: Container): void {\n container.children.forEach((child) => {\n child.parent = null;\n });\n\n container.children.splice(0);\n },\n\n /**\n * #### `maySuspendCommit(type, props)`\n *\n * This method is called during render to determine if the Host Component type and props require\n * some kind of loading process to complete before committing an update.\n */\n maySuspendCommit(_type: Type, _props: Props): boolean {\n return false;\n },\n\n /**\n * #### `preloadInstance(type, props)`\n *\n * This method may be called during render if the Host Component type and props might suspend a commit.\n * It can be used to initiate any work that might shorten the duration of a suspended commit.\n */\n preloadInstance(_type: Type, _props: Props): boolean {\n return true;\n },\n\n /**\n * #### `startSuspendingCommit()`\n *\n * This method is called just before the commit phase. Use it to set up any necessary state while any Host\n * Components that might suspend this commit are evaluated to determine if the commit must be suspended.\n */\n startSuspendingCommit() {},\n\n /**\n * #### `suspendInstance(type, props)`\n *\n * This method is called after `startSuspendingCommit` for each Host Component that indicated it might\n * suspend a commit.\n */\n suspendInstance() {},\n\n /**\n * #### `waitForCommitToBeReady()`\n *\n * This method is called after all `suspendInstance` calls are complete.\n *\n * Return `null` if the commit can happen immediately.\n * Return `(initiateCommit: Function) => Function` if the commit must be suspended. The argument to this\n * callback will initiate the commit when called. The return value is a cancellation function that the\n * Reconciler can use to abort the commit.\n */\n waitForCommitToBeReady() {\n return null;\n },\n\n // -------------------\n // Hydration Methods\n // (optional)\n // You can optionally implement hydration to \"attach\" to the existing tree during the initial render instead\n // of creating it from scratch. For example, the DOM renderer uses this to attach to an HTML markup.\n //\n // To support hydration, you need to declare `supportsHydration: true` and then implement the methods in\n // the \"Hydration\" section [listed in this file](https://github.com/facebook/react/blob/master/packages/react-reconciler/src/forks/ReactFiberHostConfig.custom.js).\n // File an issue if you need help.\n // -------------------\n supportsHydration: false,\n\n requestPostPaintCallback(_callback: (endTime: number) => void) {},\n\n NotPendingTransition: null,\n\n // Based on: https://github.com/facebook/react/blob/main/packages/react-test-renderer/src/ReactFiberConfigTestHost.js#L606\n HostTransitionContext: {\n $$typeof: REACT_CONTEXT_TYPE,\n Consumer: null as unknown as ReactContext<TransitionStatus>,\n Provider: null as unknown as ReactProviderType<TransitionStatus>,\n _currentValue: null,\n _currentValue2: null,\n _threadCount: 0,\n },\n\n resetFormInstance(_form: Instance) {},\n\n trackSchedulerEvent: function (): void {},\n\n // Based on: https://github.com/facebook/react/blob/main/packages/react-test-renderer/src/ReactFiberConfigTestHost.js#L256\n resolveEventType: function (): null | string {\n return null;\n },\n\n // Based on: https://github.com/facebook/react/blob/main/packages/react-test-renderer/src/ReactFiberConfigTestHost.js#L259\n resolveEventTimeStamp: function (): number {\n return -1.1;\n },\n};\n\nexport const TestReconciler = ReactReconciler(hostConfig);\n\n/**\n * This method should mutate the `parentInstance` and add the child to its list of children. For example,\n * in the DOM this would translate to a `parentInstance.appendChild(child)` call.\n *\n * Although this method currently runs in the commit phase, you still should not mutate any other nodes\n * in it. If you need to do some additional work when a node is definitely connected to the visible tree,\n * look at `commitMount`.\n */\nfunction appendChild(parentInstance: Container | Instance, child: Instance | TextInstance): void {\n const index = parentInstance.children.indexOf(child);\n if (index !== -1) {\n parentInstance.children.splice(index, 1);\n }\n\n child.parent = parentInstance;\n parentInstance.children.push(child);\n}\n\n/**\n * This method should mutate the `parentInstance` and place the `child` before `beforeChild` in the list\n * of its children. For example, in the DOM this would translate to a\n * `parentInstance.insertBefore(child, beforeChild)` call.\n *\n * Note that React uses this method both for insertions and for reordering nodes. Similar to DOM, it is\n * expected that you can call `insertBefore` to reposition an existing child. Do not mutate any other parts\n * of the tree from it.\n */\nfunction insertBefore(\n parentInstance: Container | Instance,\n child: Instance | TextInstance,\n beforeChild: Instance | TextInstance,\n): void {\n const index = parentInstance.children.indexOf(child);\n if (index !== -1) {\n parentInstance.children.splice(index, 1);\n }\n\n child.parent = parentInstance;\n const beforeIndex = parentInstance.children.indexOf(beforeChild);\n parentInstance.children.splice(beforeIndex, 0, child);\n}\n\n/**\n * This method should mutate the `parentInstance` to remove the `child` from the list of its children.\n *\n * React will only call it for the top-level node that is being removed. It is expected that garbage\n * collection would take care of the whole subtree. You are not expected to traverse the child tree in it.\n */\nfunction removeChild(parentInstance: Container | Instance, child: Instance | TextInstance): void {\n const index = parentInstance.children.indexOf(child);\n parentInstance.children.splice(index, 1);\n child.parent = null;\n}\n","export function formatComponentList(names: string[]): string {\n if (names.length === 0) {\n return \"\";\n }\n\n if (names.length === 1) {\n return `<${names[0]}>`;\n }\n\n if (names.length === 2) {\n return `<${names[0]}> or <${names[1]}>`;\n }\n\n const allButLast = names.slice(0, -1);\n const last = names[names.length - 1];\n\n return `${allButLast.map((name) => `<${name}>`).join(\", \")}, or <${last}>`;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAAS,sBAAsB;;;ACDxB,IAAM,MAAM;AAAA,EACjB,WAAW;AAAA,EACX,UAAU;AAAA,EACV,MAAM;AACR;AAGO,IAAM,iBAAiB;AAGvB,IAAM,qBAA6B,uBAAO,IAAI,eAAe;;;ACW7D,SAAS,SACd,SACA,WACA,SACe;AAzBjB;AA0BE,QAAM,eAAc,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AgB,MAAM,IAAI;AAAA,EACpE;AAEA,QAAM,UAAU,MAAM;AACpB,QAAI,aAAa,MAAM;AACrB;AAAA,IACF;AAEA,mBAAe,gBAAgB,MAAM,gBAAgB,MAAM,IAAI;AAE/D,qBAAiB;AACjB,gBAAY;AAAA,EACd;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,IAAI,YAAyB;AAC3B,UAAI,aAAa,MAAM;AACrB,cAAM,IAAI,MAAM,qDAAqD;AAAA,MACvE;AAEA,aAAO,YAAY,aAAa,SAAS;AAAA,IAC3C;AAAA,EACF;AACF;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "test-renderer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.1",
|
|
4
4
|
"description": "A lightweight, JavaScript-only replacement for the deprecated React Test Renderer.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -40,17 +40,17 @@
|
|
|
40
40
|
"typecheck": "tsc --noEmit",
|
|
41
41
|
"test:watch": "jest --watch",
|
|
42
42
|
"validate": "bun run prettier && bun run lint && bun run typecheck && bun run test",
|
|
43
|
-
"validate:
|
|
43
|
+
"validate:fix": "bun run prettier:fix && bun run lint --fix && bun run typecheck && bun run test -u",
|
|
44
44
|
"prettier": "prettier --check .",
|
|
45
|
-
"prettier:
|
|
45
|
+
"prettier:fix": "prettier --write .",
|
|
46
46
|
"release": "release-it"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"react-reconciler": "~0.
|
|
50
|
-
"@types/react-reconciler": "~0.
|
|
49
|
+
"react-reconciler": "~0.32.0",
|
|
50
|
+
"@types/react-reconciler": "~0.32.0"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
|
-
"react": "^19.
|
|
53
|
+
"react": "^19.1.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@eslint/js": "^9.21.0",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
63
63
|
"jest": "^30.2.0",
|
|
64
64
|
"prettier": "^3.5.2",
|
|
65
|
-
"react": "^19.
|
|
65
|
+
"react": "^19.1.0",
|
|
66
66
|
"release-it": "^18.1.2",
|
|
67
67
|
"ts-jest": "^29.2.6",
|
|
68
68
|
"tsup": "^8.4.0",
|