@lynx-js/react 0.129.0 → 0.129.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.
Files changed (206) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/components/tsconfig.tsbuildinfo +1 -1
  3. package/package.json +3 -4
  4. package/refresh/.turbo/turbo-build.log +1 -1
  5. package/runtime/__test__/core/hooks/useLynxGlobalEventListener.test.jsx +1 -1
  6. package/runtime/__test__/element-template/imports/no-legacy-imports.test.ts +7 -6
  7. package/runtime/__test__/element-template/internal/legacy-internal-guardrail.test.ts +1 -2
  8. package/runtime/__test__/element-template/native/main-thread-api.test.ts +5 -2
  9. package/runtime/__test__/element-template/native/mts-destroy.test.ts +83 -0
  10. package/runtime/__test__/element-template/native/reload-dual-thread-communication.test.ts +3 -0
  11. package/runtime/__test__/element-template/native/reload.test.ts +31 -2
  12. package/runtime/__test__/element-template/runtime/background/update-timing.test.ts +15 -0
  13. package/runtime/__test__/element-template/runtime/patch/element-template-patch.test.tsx +197 -7
  14. package/runtime/__test__/element-template/runtime/patch/update-timing.test.ts +4 -1
  15. package/runtime/__test__/element-template/runtime/render/render-direct-suspense.test.ts +4 -1
  16. package/runtime/__test__/element-template/runtime/render/render-direct.test.ts +4 -1
  17. package/runtime/__test__/element-template/runtime/render/render-main-thread.test.ts +101 -1
  18. package/runtime/__test__/element-template/runtime/template/element-template-handle.test.ts +32 -0
  19. package/runtime/__test__/element-template/runtime/template/main-thread-dynamic-attr-state.test.ts +121 -26
  20. package/runtime/__test__/element-template/test-utils/debug/envManager.ts +8 -5
  21. package/runtime/__test__/element-template/test-utils/mock/mockNativePapi.ts +35 -2
  22. package/runtime/__test__/guardrails/snapshot-containment.test.ts +45 -11
  23. package/runtime/__test__/shared/component-stack.test.ts +211 -0
  24. package/runtime/__test__/snapshot/debug/formatPatch.test.ts +0 -8
  25. package/runtime/__test__/snapshot/gesture/prepareGestureForCommit.test.js +1 -1
  26. package/runtime/__test__/snapshot/lynx/timing.test.jsx +3 -0
  27. package/runtime/__test__/snapshot/preact.test.jsx +0 -3
  28. package/runtime/__test__/snapshot/snapshotPatch.test.jsx +0 -33
  29. package/runtime/__test__/worklet-runtime/jsFunctionLifecycle.test.js +12 -0
  30. package/runtime/__test__/worklet-runtime/loadRuntime.test.js +68 -0
  31. package/runtime/__test__/worklet-runtime/workletRuntime.test.js +30 -0
  32. package/runtime/lazy/element-template-internal.js +0 -1
  33. package/runtime/lazy/internal.js +1 -1
  34. package/runtime/lazy/jsx-dev-runtime.js +1 -1
  35. package/runtime/lazy/jsx-runtime.js +1 -1
  36. package/runtime/lazy/legacy-react-runtime.js +1 -1
  37. package/runtime/lazy/react-lepus.js +1 -1
  38. package/runtime/lazy/react.js +1 -1
  39. package/runtime/lib/core/capture-main-thread-object.js +2 -1
  40. package/runtime/lib/core/capture-main-thread-object.js.map +1 -1
  41. package/runtime/lib/core/compat/legacy-react-runtime.js +1 -1
  42. package/runtime/lib/core/compat/legacy-react-runtime.js.map +1 -1
  43. package/runtime/lib/core/lynx/lazy-bundle.js +1 -1
  44. package/runtime/lib/core/lynx/lazy-bundle.js.map +1 -1
  45. package/runtime/lib/core/lynx-data-processors.d.ts +125 -1
  46. package/runtime/lib/core/lynx-data-processors.js +3 -0
  47. package/runtime/lib/core/lynx-data-processors.js.map +1 -1
  48. package/runtime/lib/core/runtime-destroy.js +1 -1
  49. package/runtime/lib/core/runtime-destroy.js.map +1 -1
  50. package/runtime/lib/document.js +0 -5
  51. package/runtime/lib/document.js.map +1 -1
  52. package/runtime/lib/element-template/background/commit-hook.js +11 -12
  53. package/runtime/lib/element-template/background/commit-hook.js.map +1 -1
  54. package/runtime/lib/element-template/client/root.d.ts +1 -1
  55. package/runtime/lib/element-template/client/root.js.map +1 -1
  56. package/runtime/lib/element-template/index.d.ts +2 -2
  57. package/runtime/lib/element-template/index.js.map +1 -1
  58. package/runtime/lib/element-template/internal.d.ts +1 -1
  59. package/runtime/lib/element-template/internal.js +0 -13
  60. package/runtime/lib/element-template/internal.js.map +1 -1
  61. package/runtime/lib/element-template/lynx/env.js.map +1 -1
  62. package/runtime/lib/element-template/native/flush.d.ts +1 -0
  63. package/runtime/lib/element-template/native/flush.js +9 -0
  64. package/runtime/lib/element-template/native/flush.js.map +1 -0
  65. package/runtime/lib/element-template/native/main-thread-api.js +3 -7
  66. package/runtime/lib/element-template/native/main-thread-api.js.map +1 -1
  67. package/runtime/lib/element-template/native/mts-destroy.js +8 -2
  68. package/runtime/lib/element-template/native/mts-destroy.js.map +1 -1
  69. package/runtime/lib/element-template/native/patch-listener.js +57 -50
  70. package/runtime/lib/element-template/native/patch-listener.js.map +1 -1
  71. package/runtime/lib/element-template/native/reload-main-thread.js +2 -1
  72. package/runtime/lib/element-template/native/reload-main-thread.js.map +1 -1
  73. package/runtime/lib/element-template/protocol/types.js.map +1 -1
  74. package/runtime/lib/element-template/runtime/page/root-instance.d.ts +0 -1
  75. package/runtime/lib/element-template/runtime/page/root-instance.js.map +1 -1
  76. package/runtime/lib/element-template/runtime/patch.js +4 -0
  77. package/runtime/lib/element-template/runtime/patch.js.map +1 -1
  78. package/runtime/lib/element-template/runtime/render/render-components.js +4 -4
  79. package/runtime/lib/element-template/runtime/render/render-components.js.map +1 -1
  80. package/runtime/lib/element-template/runtime/render/render-main-thread.js +2 -0
  81. package/runtime/lib/element-template/runtime/render/render-main-thread.js.map +1 -1
  82. package/runtime/lib/element-template/runtime/template/main-thread-background-function.js +8 -1
  83. package/runtime/lib/element-template/runtime/template/main-thread-background-function.js.map +1 -1
  84. package/runtime/lib/element-template/runtime/template/main-thread-dynamic-attr-state.d.ts +1 -0
  85. package/runtime/lib/element-template/runtime/template/main-thread-dynamic-attr-state.js +41 -21
  86. package/runtime/lib/element-template/runtime/template/main-thread-dynamic-attr-state.js.map +1 -1
  87. package/runtime/lib/element-template/runtime/template/main-thread-ref-ctx.d.ts +1 -1
  88. package/runtime/lib/element-template/runtime/template/main-thread-ref-ctx.js.map +1 -1
  89. package/runtime/lib/internal.d.ts +1 -1
  90. package/runtime/lib/internal.js +1 -1
  91. package/runtime/lib/internal.js.map +1 -1
  92. package/runtime/lib/lynx-api.d.ts +2 -125
  93. package/runtime/lib/lynx-api.js.map +1 -1
  94. package/runtime/lib/shared/component-stack.d.ts +0 -4
  95. package/runtime/lib/shared/component-stack.js +21 -5
  96. package/runtime/lib/shared/component-stack.js.map +1 -1
  97. package/runtime/lib/snapshot/gesture/{processGestureBagkround.js → processGestureBackground.js} +1 -1
  98. package/runtime/lib/snapshot/gesture/processGestureBackground.js.map +1 -0
  99. package/runtime/lib/snapshot/lifecycle/patch/snapshotPatch.d.ts +0 -1
  100. package/runtime/lib/snapshot/lifecycle/patch/snapshotPatch.js +0 -5
  101. package/runtime/lib/snapshot/lifecycle/patch/snapshotPatch.js.map +1 -1
  102. package/runtime/lib/snapshot/lifecycle/patch/snapshotPatchApply.js +0 -10
  103. package/runtime/lib/snapshot/lifecycle/patch/snapshotPatchApply.js.map +1 -1
  104. package/runtime/lib/snapshot/lifecycle/patch/updateMainThread.js +56 -51
  105. package/runtime/lib/snapshot/lifecycle/patch/updateMainThread.js.map +1 -1
  106. package/runtime/lib/snapshot/list/listUpdateInfo.js +0 -30
  107. package/runtime/lib/snapshot/list/listUpdateInfo.js.map +1 -1
  108. package/runtime/lib/snapshot/lynx/calledByNative.js +11 -8
  109. package/runtime/lib/snapshot/lynx/calledByNative.js.map +1 -1
  110. package/runtime/lib/snapshot/renderToOpcodes/hydrate.js +0 -52
  111. package/runtime/lib/snapshot/renderToOpcodes/hydrate.js.map +1 -1
  112. package/runtime/lib/snapshot/renderToOpcodes/index.js +10 -10
  113. package/runtime/lib/snapshot/renderToOpcodes/index.js.map +1 -1
  114. package/runtime/lib/snapshot/renderToOpcodes/opcodes.js +0 -51
  115. package/runtime/lib/snapshot/renderToOpcodes/opcodes.js.map +1 -1
  116. package/runtime/lib/snapshot/snapshot/backgroundSnapshot.js +1 -1
  117. package/runtime/lib/snapshot/snapshot/backgroundSnapshot.js.map +1 -1
  118. package/runtime/lib/tsconfig.tsbuildinfo +1 -1
  119. package/runtime/lib/worklet-runtime/bindings/index.d.ts +1 -0
  120. package/runtime/lib/worklet-runtime/bindings/index.js +1 -0
  121. package/runtime/lib/worklet-runtime/bindings/index.js.map +1 -1
  122. package/runtime/lib/worklet-runtime/bindings/loadRuntime.d.ts +8 -0
  123. package/runtime/lib/worklet-runtime/bindings/loadRuntime.js +23 -0
  124. package/runtime/lib/worklet-runtime/bindings/loadRuntime.js.map +1 -0
  125. package/runtime/lib/worklet-runtime/jsFunctionLifecycle.d.ts +2 -0
  126. package/runtime/lib/worklet-runtime/jsFunctionLifecycle.js +6 -0
  127. package/runtime/lib/worklet-runtime/jsFunctionLifecycle.js.map +1 -1
  128. package/runtime/lib/worklet-runtime/workletRuntime.js +2 -0
  129. package/runtime/lib/worklet-runtime/workletRuntime.js.map +1 -1
  130. package/runtime/package.json +2 -3
  131. package/runtime/src/core/capture-main-thread-object.ts +2 -1
  132. package/runtime/src/core/compat/legacy-react-runtime.ts +1 -1
  133. package/runtime/src/core/lynx/lazy-bundle.ts +1 -1
  134. package/runtime/src/core/lynx-data-processors.ts +124 -1
  135. package/runtime/src/core/runtime-destroy.ts +1 -1
  136. package/runtime/src/document.ts +0 -6
  137. package/runtime/src/element-template/background/commit-hook.ts +18 -12
  138. package/runtime/src/element-template/client/root.ts +1 -3
  139. package/runtime/src/element-template/index.ts +2 -2
  140. package/runtime/src/element-template/internal.ts +0 -20
  141. package/runtime/src/element-template/lynx/env.ts +1 -1
  142. package/runtime/src/element-template/native/flush.ts +10 -0
  143. package/runtime/src/element-template/native/main-thread-api.ts +3 -6
  144. package/runtime/src/element-template/native/mts-destroy.ts +7 -2
  145. package/runtime/src/element-template/native/patch-listener.ts +62 -57
  146. package/runtime/src/element-template/native/reload-main-thread.ts +2 -1
  147. package/runtime/src/element-template/protocol/types.ts +0 -13
  148. package/runtime/src/element-template/runtime/page/root-instance.ts +0 -1
  149. package/runtime/src/element-template/runtime/patch.ts +5 -0
  150. package/runtime/src/element-template/runtime/render/render-components.ts +3 -3
  151. package/runtime/src/element-template/runtime/render/render-main-thread.ts +2 -0
  152. package/runtime/src/element-template/runtime/template/main-thread-background-function.ts +8 -1
  153. package/runtime/src/element-template/runtime/template/main-thread-dynamic-attr-state.ts +51 -21
  154. package/runtime/src/element-template/runtime/template/main-thread-ref-ctx.ts +2 -2
  155. package/runtime/src/element-template/types.d.ts +6 -0
  156. package/runtime/src/internal.ts +1 -1
  157. package/runtime/src/lynx-api.ts +2 -124
  158. package/runtime/src/shared/component-stack.ts +22 -5
  159. package/runtime/src/snapshot/lifecycle/patch/snapshotPatch.ts +0 -5
  160. package/runtime/src/snapshot/lifecycle/patch/snapshotPatchApply.ts +0 -10
  161. package/runtime/src/snapshot/lifecycle/patch/updateMainThread.ts +62 -58
  162. package/runtime/src/snapshot/list/listUpdateInfo.ts +0 -52
  163. package/runtime/src/snapshot/lynx/calledByNative.ts +11 -9
  164. package/runtime/src/snapshot/renderToOpcodes/hydrate.ts +0 -58
  165. package/runtime/src/snapshot/renderToOpcodes/index.ts +8 -8
  166. package/runtime/src/snapshot/renderToOpcodes/opcodes.ts +0 -57
  167. package/runtime/src/snapshot/snapshot/backgroundSnapshot.ts +1 -1
  168. package/runtime/src/worklet-runtime/README.md +30 -10
  169. package/runtime/src/worklet-runtime/bindings/index.ts +2 -0
  170. package/runtime/src/worklet-runtime/bindings/loadRuntime.ts +25 -0
  171. package/runtime/src/worklet-runtime/jsFunctionLifecycle.ts +6 -0
  172. package/runtime/src/worklet-runtime/workletRuntime.ts +2 -0
  173. package/runtime/vitest.config.ts +0 -2
  174. package/testing-library/.turbo/turbo-build.log +6 -6
  175. package/testing-library/src/__tests__/act.test.jsx +0 -7
  176. package/testing-library/src/__tests__/alog.test.jsx +12 -54
  177. package/testing-library/src/__tests__/end-to-end.test.jsx +0 -7
  178. package/testing-library/src/__tests__/renderComponent.test.jsx +0 -14
  179. package/testing-library/src/__tests__/worklet.test.jsx +49 -0
  180. package/transform/.turbo/turbo-build$colon$wasm.log +98 -376
  181. package/transform/__test__/defines.spec.js +30 -0
  182. package/transform/__test__/object-methods.spec.js +79 -0
  183. package/transform/crates/swc_plugin_worklet/extract_ident.rs +99 -49
  184. package/transform/crates/swc_plugin_worklet/gen_stmt.rs +56 -48
  185. package/transform/crates/swc_plugin_worklet/lib.rs +393 -589
  186. package/transform/crates/swc_plugin_worklet/napi.rs +4 -6
  187. package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_extract_member_expr_2_js.js +6 -1
  188. package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_extract_member_expr_2_lepus.js +7 -1
  189. package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_extract_member_expr_js.js +9 -0
  190. package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_extract_member_expr_lepus.js +12 -1
  191. package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_preserve_main_thread_objects_in_class_js.js +1 -1
  192. package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_preserve_main_thread_objects_in_class_lepus.js +1 -1
  193. package/transform/dist/wasm.cjs +1 -1
  194. package/transform/package.json +0 -1
  195. package/transform/src/lib.rs +1 -1
  196. package/transform/swc-plugin-reactlynx/.turbo/turbo-build.log +113 -42
  197. package/transform/swc-plugin-reactlynx/src/lib.rs +1 -4
  198. package/transform/swc-plugin-reactlynx/swc_plugin_reactlynx.wasm +0 -0
  199. package/transform/swc-plugin-reactlynx-compat/.turbo/turbo-build.log +273 -66
  200. package/runtime/lib/snapshot/gesture/processGestureBagkround.js.map +0 -1
  201. package/runtime/lib/snapshot/worklet/hmr.d.ts +0 -1
  202. package/runtime/lib/snapshot/worklet/hmr.js +0 -28
  203. package/runtime/lib/snapshot/worklet/hmr.js.map +0 -1
  204. package/runtime/src/snapshot/worklet/hmr.ts +0 -34
  205. /package/runtime/lib/snapshot/gesture/{processGestureBagkround.d.ts → processGestureBackground.d.ts} +0 -0
  206. /package/runtime/src/snapshot/gesture/{processGestureBagkround.ts → processGestureBackground.ts} +0 -0
@@ -0,0 +1,211 @@
1
+ // Copyright 2026 The Lynx Authors. All rights reserved.
2
+ // Licensed under the Apache License Version 2.0 that can be found in the
3
+ // LICENSE file in the root directory of this source tree.
4
+
5
+ import type { VNode } from 'preact';
6
+ import { beforeEach, describe, expect, it, vi } from 'vitest';
7
+
8
+ import { DIFF, DIFFED, RENDER, ROOT } from '../../src/shared/render-constants.js';
9
+
10
+ describe('shared/component-stack', () => {
11
+ beforeEach(() => {
12
+ vi.resetModules();
13
+ });
14
+
15
+ it('is idempotent and clears leaked renderStack entries on next root render or re-setup', async () => {
16
+ const { options } = await import('preact');
17
+ delete options[DIFF];
18
+ delete options[DIFFED];
19
+ delete options[ROOT];
20
+ delete options.vnode;
21
+ delete options[RENDER];
22
+
23
+ const { getCurrentVNode, setupComponentStack } = await import('../../src/shared/component-stack.js');
24
+ setupComponentStack();
25
+
26
+ const installedDiff = options[DIFF];
27
+ const installedDiffed = options[DIFFED];
28
+ const installedRoot = options[ROOT];
29
+ // eslint-disable-next-line @typescript-eslint/unbound-method
30
+ const installedVNode = options.vnode;
31
+ const installedRender = options[RENDER];
32
+
33
+ function ThrowingChild() {
34
+ return null;
35
+ }
36
+
37
+ const throwingVNode = { type: ThrowingChild, props: {} } as unknown as VNode;
38
+ options[ROOT]?.(throwingVNode, {} as never);
39
+ options[DIFF]?.(throwingVNode);
40
+ options[RENDER]?.(throwingVNode);
41
+ // Simulate a component throwing during render before DIFFED runs.
42
+ expect(getCurrentVNode()).toBe(throwingVNode);
43
+
44
+ // Next root render must clear renderStack as well as ownerStack.
45
+ const nextRootVNode = { type: 'view', props: {} } as unknown as VNode;
46
+ options[ROOT]?.(nextRootVNode, {} as never);
47
+ expect(getCurrentVNode()).toBeNull();
48
+
49
+ // Repeated setupComponentStack() must not double-wrap hooks and must reset stacks.
50
+ options[DIFF]?.(throwingVNode);
51
+ expect(getCurrentVNode()).toBe(throwingVNode);
52
+ setupComponentStack();
53
+ expect(getCurrentVNode()).toBeNull();
54
+ expect(options[DIFF]).toBe(installedDiff);
55
+ expect(options[DIFFED]).toBe(installedDiffed);
56
+ expect(options[ROOT]).toBe(installedRoot);
57
+ // eslint-disable-next-line @typescript-eslint/unbound-method
58
+ expect(options.vnode).toBe(installedVNode);
59
+ expect(options[RENDER]).toBe(installedRender);
60
+ });
61
+
62
+ it('chains existing Preact option hooks and formats owner stacks across vnode types', async () => {
63
+ const { Fragment, options } = await import('preact');
64
+ const oldDiff = vi.fn();
65
+ const oldDiffed = vi.fn();
66
+ const oldRoot = vi.fn();
67
+ const oldVNode = vi.fn();
68
+ const oldRender = vi.fn();
69
+
70
+ options[DIFF] = oldDiff;
71
+ options[DIFFED] = oldDiffed;
72
+ options[ROOT] = oldRoot;
73
+ options.vnode = oldVNode;
74
+ options[RENDER] = oldRender;
75
+
76
+ const { getCurrentVNode, getOwnerStack, setupComponentStack } = await import(
77
+ '../../src/shared/component-stack.js'
78
+ );
79
+ setupComponentStack();
80
+
81
+ function Outer() {
82
+ return null;
83
+ }
84
+ function NamedInner() {
85
+ return null;
86
+ }
87
+ NamedInner.displayName = 'CustomInner';
88
+
89
+ const rootVNode = { type: Outer, props: {}, __source: { fileName: 'App.tsx', lineNumber: 10 } } as unknown as VNode;
90
+ options.vnode?.(rootVNode);
91
+ options[ROOT]?.(rootVNode, {} as never);
92
+ options[DIFF]?.(rootVNode);
93
+ options[RENDER]?.(rootVNode);
94
+ expect(getCurrentVNode()).toBe(rootVNode);
95
+
96
+ const innerVNode = { type: NamedInner, props: {} } as unknown as VNode;
97
+ options.vnode?.(innerVNode);
98
+ // Cloning a vnode with an existing _owner must preserve that _owner.
99
+ const preOwnedVNode = { type: 'view', props: {}, _owner: rootVNode } as unknown as VNode;
100
+ options.vnode?.(preOwnedVNode);
101
+ expect((preOwnedVNode as unknown as { _owner: unknown })._owner).toBe(rootVNode);
102
+
103
+ options[DIFF]?.(innerVNode);
104
+ options[RENDER]?.(innerVNode);
105
+ expect(getCurrentVNode()).toBe(innerVNode);
106
+
107
+ const fragmentVNode = { type: Fragment, props: {} } as unknown as VNode;
108
+ options.vnode?.(fragmentVNode);
109
+ options[DIFF]?.(fragmentVNode);
110
+ options[RENDER]?.(fragmentVNode);
111
+ options[DIFFED]?.(fragmentVNode);
112
+ expect(getCurrentVNode()).toBe(innerVNode);
113
+
114
+ // Nested portal root render (parent with parentNode) must preserve outer stacks,
115
+ // including when an inner portal component throws and unwinds to an outer boundary.
116
+ const portalContextVNode = { type: Outer, props: {} } as unknown as VNode;
117
+ const throwingPortalChildVNode = { type: NamedInner, props: {} } as unknown as VNode;
118
+ options.vnode?.(portalContextVNode);
119
+ options[ROOT]?.(portalContextVNode, { parentNode: {} } as never);
120
+ expect(getCurrentVNode()).toBe(innerVNode);
121
+ options[DIFF]?.(portalContextVNode);
122
+ options[RENDER]?.(portalContextVNode);
123
+ options[DIFF]?.(throwingPortalChildVNode);
124
+ options[RENDER]?.(throwingPortalChildVNode);
125
+ expect(getCurrentVNode()).toBe(throwingPortalChildVNode);
126
+ // Simulate throwingPortalChildVNode and portalContextVNode skipping DIFFED
127
+ // when an outer boundary catches the error and finishes DIFFED on innerVNode.
128
+ options[DIFFED]?.(innerVNode);
129
+ expect(getCurrentVNode()).toBe(rootVNode);
130
+
131
+ // Component bailout (DIFF + DIFFED without RENDER) must not pop parent owner.
132
+ const bailoutVNode = { type: NamedInner, props: {} } as unknown as VNode;
133
+ options[DIFF]?.(bailoutVNode);
134
+ expect(getCurrentVNode()).toBe(bailoutVNode);
135
+ options[DIFFED]?.(bailoutVNode);
136
+ expect(getCurrentVNode()).toBe(rootVNode);
137
+
138
+ // Guard against DIFFED on a component vnode that was never pushed to renderStack.
139
+ const unpushedVNode = { type: NamedInner, props: {} } as unknown as VNode;
140
+ options[DIFFED]?.(unpushedVNode);
141
+ expect(getCurrentVNode()).toBe(rootVNode);
142
+
143
+ const postPortalChildVNode = { type: 'view', props: {} } as unknown as VNode;
144
+ options.vnode?.(postPortalChildVNode);
145
+ expect((postPortalChildVNode as unknown as { _owner: unknown })._owner).toBe(rootVNode);
146
+
147
+ const hostVNode = { type: 'view', props: {}, _owner: fragmentVNode } as unknown as VNode;
148
+ const textVNode = { type: null, props: {}, _owner: hostVNode } as unknown as VNode;
149
+
150
+ expect(getOwnerStack(textVNode)).toBe(
151
+ ' in #text\n'
152
+ + ' in view\n'
153
+ + ' in Fragment\n'
154
+ + ' in CustomInner\n'
155
+ + ' in Outer (at App.tsx:10)\n',
156
+ );
157
+
158
+ options[DIFFED]?.(rootVNode);
159
+ expect(getCurrentVNode()).toBeNull();
160
+
161
+ expect(oldRoot).toHaveBeenCalledTimes(2);
162
+ expect(oldDiff).toHaveBeenCalledTimes(6);
163
+ expect(oldRender).toHaveBeenCalledTimes(5);
164
+ expect(oldDiffed).toHaveBeenCalledTimes(5);
165
+ expect(oldVNode).toHaveBeenCalledTimes(6);
166
+ });
167
+
168
+ it('unwinds renderStack and ownerStack when a Portal child throws into an outer ErrorBoundary', async () => {
169
+ const { Component, createElement, render } = await import('preact');
170
+ const { createPortal } = await import('../../src/snapshot/lynx/portals.js');
171
+ const { getCurrentVNode, setupComponentStack } = await import(
172
+ '../../src/shared/component-stack.js'
173
+ );
174
+ setupComponentStack();
175
+
176
+ class Boundary extends Component<{ children?: unknown }, { failed: boolean }> {
177
+ override state = { failed: false };
178
+ static override getDerivedStateFromError() {
179
+ return { failed: true };
180
+ }
181
+ override render() {
182
+ return this.state.failed ? null : this.props.children;
183
+ }
184
+ }
185
+
186
+ function Boom(): null {
187
+ throw new Error('portal boom');
188
+ }
189
+
190
+ const fakeTarget = {
191
+ _nodeSelectToken: { type: 0, identifier: '#host', rootUniqueId: 0 },
192
+ } as never;
193
+
194
+ function App() {
195
+ return createElement(Boundary, null, createPortal(createElement(Boom, null), fakeTarget));
196
+ }
197
+
198
+ const rootContainer = {
199
+ nodeType: 1,
200
+ childNodes: [],
201
+ insertBefore() {},
202
+ removeChild() {},
203
+ } as never;
204
+
205
+ render(createElement(App, null), rootContainer);
206
+
207
+ expect(getCurrentVNode()).toBeNull();
208
+ const afterRenderVNode = createElement('view', null) as unknown as { _owner?: unknown };
209
+ expect(afterRenderVNode._owner).toBeNull();
210
+ });
211
+ });
@@ -33,9 +33,6 @@ describe('formatPatch', () => {
33
33
  SnapshotOperation.DEV_ONLY_AddSnapshot,
34
34
  'unique-1',
35
35
  'snapshotCreator-val',
36
- SnapshotOperation.DEV_ONLY_RegisterWorklet,
37
- 'hash-1',
38
- '() => {}',
39
36
  ];
40
37
  const formatted = prettyFormatSnapshotPatch(snapshotPatch);
41
38
  expect(formatted).toEqual([
@@ -60,11 +57,6 @@ describe('formatPatch', () => {
60
57
  uniqID: 'unique-1',
61
58
  snapshotCreator: 'snapshotCreator-val',
62
59
  },
63
- {
64
- op: 'DEV_ONLY_RegisterWorklet',
65
- hash: 'hash-1',
66
- fnStr: '() => {}',
67
- },
68
60
  ]);
69
61
  });
70
62
 
@@ -1,6 +1,6 @@
1
1
  import { afterEach, beforeEach, describe, expect, it } from 'vitest';
2
2
 
3
- import { prepareGestureForCommit } from '../../../src/snapshot/gesture/processGestureBagkround';
3
+ import { prepareGestureForCommit } from '../../../src/snapshot/gesture/processGestureBackground';
4
4
  import { clearConfigCacheForTesting } from '../../../src/snapshot/worklet/functionality';
5
5
 
6
6
  describe('prepareGestureForCommit', () => {
@@ -9,6 +9,7 @@ import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from 'vite
9
9
  import { replaceCommitHook } from '../../../src/snapshot/lifecycle/patch/commit';
10
10
  import { injectUpdateMainThread } from '../../../src/snapshot/lifecycle/patch/updateMainThread';
11
11
  import { installComponentCompat } from '../../../src/core/component';
12
+ import { globalPipelineOptions } from '../../../src/core/performance';
12
13
  import { initTimingAPI } from '../../../src/snapshot/lynx/performance';
13
14
  import { __root } from '../../../src/root';
14
15
  import { setupPage } from '../../../src/snapshot';
@@ -128,6 +129,7 @@ describe('setState timing api', () => {
128
129
 
129
130
  globalEnvManager.switchToMainThread();
130
131
  rLynxChange(mtCallbacks[0][1]);
132
+ expect(globalPipelineOptions).toBeUndefined();
131
133
  expect(__root.__element_root).toMatchInlineSnapshot(`
132
134
  <page
133
135
  cssId="default-entry-from-native:0"
@@ -210,6 +212,7 @@ describe('attribute timing api', () => {
210
212
 
211
213
  globalEnvManager.switchToMainThread();
212
214
  rLynxChange(mtCallbacks[0][1]);
215
+ expect(globalPipelineOptions).toBeUndefined();
213
216
  expect(__root.__element_root).toMatchInlineSnapshot(`
214
217
  <page
215
218
  cssId="default-entry-from-native:0"
@@ -93,9 +93,6 @@ function collectSnapshotPatchOps(patch) {
93
93
  case SnapshotOperation.DEV_ONLY_AddSnapshot:
94
94
  i += 2;
95
95
  break;
96
- case SnapshotOperation.DEV_ONLY_RegisterWorklet:
97
- i += 2;
98
- break;
99
96
  case SnapshotOperation.DEV_ONLY_SetSnapshotEntryName:
100
97
  i += 2;
101
98
  break;
@@ -5,7 +5,6 @@ import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from 'vite
5
5
 
6
6
  import { globalEnvManager } from './utils/envManager';
7
7
  import { elementTree } from './utils/nativeMethod';
8
- import { registerWorkletOnBackground } from '../../src/internal';
9
8
  import { addCtxNotFoundEventListener } from '../../src/snapshot/lifecycle/patch/error';
10
9
  import {
11
10
  SnapshotOperation,
@@ -1637,38 +1636,6 @@ describe('DEV_ONLY_addSnapshot', () => {
1637
1636
  });
1638
1637
  });
1639
1638
 
1640
- describe.skip('DEV_ONLY_RegisterWorklet', () => {
1641
- beforeEach(() => {
1642
- initGlobalSnapshotPatch();
1643
- });
1644
-
1645
- it('basic', () => {
1646
- registerWorkletOnBackground('main-thread', 'hash-1', () => 'fn-1');
1647
- globalThis.registerWorklet = vi.fn();
1648
-
1649
- const patch = takeGlobalSnapshotPatch();
1650
-
1651
- expect(patch).toMatchInlineSnapshot(`
1652
- [
1653
- 101,
1654
- "hash-1",
1655
- "() => "fn-1"",
1656
- ]
1657
- `);
1658
-
1659
- // Apply patches in main thread
1660
- snapshotPatchApply(patch, 42, false);
1661
-
1662
- expect(globalThis.registerWorklet).toBeCalledTimes(1);
1663
- expect(globalThis.registerWorklet.mock.calls[0][0]).toMatch('main-thread');
1664
- expect(globalThis.registerWorklet.mock.calls[0][1]).toMatch('hash-1');
1665
- expect(globalThis.registerWorklet.mock.calls[0][2]()).toMatch('fn-1');
1666
-
1667
- registerWorkletOnBackground('main-thread', 'hash-1', () => 'fn-1');
1668
- expect(globalThis.registerWorklet).toBeCalledTimes(1);
1669
- });
1670
- });
1671
-
1672
1639
  describe('list', () => {
1673
1640
  beforeEach(() => {
1674
1641
  initGlobalSnapshotPatch();
@@ -100,4 +100,16 @@ describe('jsFunctionLifecycle', () => {
100
100
  expect(register).toHaveBeenCalledTimes(2);
101
101
  expect(manager.execIdRefCount.get(3)).toBe(1);
102
102
  });
103
+
104
+ it('does not release a new runtime execution when retired finalizers run', () => {
105
+ const previous = new JsFunctionLifecycleManager();
106
+ previous.addRef(3, {});
107
+ previous.removeRef(3);
108
+ previous.dispose();
109
+ const current = new JsFunctionLifecycleManager();
110
+ current.addRef(3, {});
111
+ previous.fire();
112
+ expect(events).toEqual([]);
113
+ expect(current.execIdRefCount.get(3)).toBe(1);
114
+ });
103
115
  });
@@ -0,0 +1,68 @@
1
+ // Copyright 2026 The Lynx Authors. All rights reserved.
2
+ // Licensed under the Apache License Version 2.0 that can be found in the
3
+ // LICENSE file in the root directory of this source tree.
4
+ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
5
+
6
+ describe('worklet-runtime legacy fallback', () => {
7
+ beforeEach(() => {
8
+ vi.resetModules();
9
+ vi.stubGlobal('__LoadLepusChunk', undefined);
10
+ vi.stubGlobal('lynxWorkletImpl', undefined);
11
+ });
12
+
13
+ afterEach(() => {
14
+ vi.unstubAllGlobals();
15
+ vi.resetModules();
16
+ });
17
+
18
+ it('exports the compatibility helper without initializing the worklet runtime', async () => {
19
+ const reactInternal = await import('@lynx-js/react/internal');
20
+ const bindings = await import('@lynx-js/react/worklet-runtime/bindings');
21
+
22
+ expect(reactInternal.loadWorkletRuntime).toBeTypeOf('function');
23
+ expect(reactInternal.loadWorkletRuntime).toBe(bindings.loadWorkletRuntime);
24
+ expect(globalThis.lynxWorkletImpl).toBeUndefined();
25
+ });
26
+
27
+ it('returns false when the legacy chunk loader is unavailable', async () => {
28
+ const { loadWorkletRuntime } = await import('@lynx-js/react/internal');
29
+
30
+ expect(loadWorkletRuntime('__Card__')).toBe(false);
31
+ });
32
+
33
+ it('reuses the in-memory runtime without loading the legacy chunk', async () => {
34
+ const { loadWorkletRuntime } = await import('@lynx-js/react/internal');
35
+ const runtime = { _workletMap: {} };
36
+ const loader = vi.fn();
37
+ vi.stubGlobal('lynxWorkletImpl', runtime);
38
+ vi.stubGlobal('__LoadLepusChunk', loader);
39
+
40
+ expect(loadWorkletRuntime('__Card__')).toBe(true);
41
+ expect(globalThis.lynxWorkletImpl).toBe(runtime);
42
+ expect(loader).not.toHaveBeenCalled();
43
+ });
44
+
45
+ it.each([true, false])('returns the legacy chunk loader result (%s)', async (result) => {
46
+ const { loadWorkletRuntime } = await import('@lynx-js/react/internal');
47
+ const loader = vi.fn(() => result);
48
+ vi.stubGlobal('__LoadLepusChunk', loader);
49
+
50
+ expect(loadWorkletRuntime('__Card__')).toBe(result);
51
+ expect(loader).toHaveBeenCalledExactlyOnceWith('worklet-runtime', {
52
+ dynamicComponentEntry: '__Card__',
53
+ chunkType: 0,
54
+ });
55
+ });
56
+
57
+ it('supports callers without a dynamic component entry', async () => {
58
+ const { loadWorkletRuntime } = await import('@lynx-js/react/internal');
59
+ const loader = vi.fn(() => true);
60
+ vi.stubGlobal('__LoadLepusChunk', loader);
61
+
62
+ expect(loadWorkletRuntime()).toBe(true);
63
+ expect(loader).toHaveBeenCalledExactlyOnceWith('worklet-runtime', {
64
+ dynamicComponentEntry: undefined,
65
+ chunkType: 0,
66
+ });
67
+ });
68
+ });
@@ -61,6 +61,36 @@ describe('Worklet', () => {
61
61
  if (kind === 'metadata') expect(value.nested).toEqual({ _wvid: 999 });
62
62
  });
63
63
 
64
+ it('executes the original Native-held context without replacing its captures', () => {
65
+ initWorklet();
66
+ registerWorklet('main-thread', 'background-owner', function() {
67
+ return this._jsFn;
68
+ });
69
+ const handle = { _jsFnId: 7 };
70
+ const ctx = { _wkltId: 'background-owner', _execId: 3, _jsFn: { a: handle, b: handle } };
71
+ lynxWorkletImpl._jsFunctionLifecycleManager.addRef(3, ctx);
72
+ const nativeContext = ctx;
73
+ const first = runWorklet(nativeContext, []);
74
+ expect(first.a).toBe(first.b);
75
+ expect(first.a).toBe(ctx._jsFn.a);
76
+ expect(runWorklet(nativeContext, [])).toBe(first);
77
+ expect(lynxWorkletImpl._jsFunctionLifecycleManager.execIdRefCount.get(3)).toBe(2);
78
+ });
79
+
80
+ it.each(['2.15', '2.16'])('prepares captured execution metadata without a lifecycle manager on SDK %s', (version) => {
81
+ SystemInfo.lynxSdkVersion = version;
82
+ initWorklet();
83
+ lynxWorkletImpl._jsFunctionLifecycleManager = undefined;
84
+ registerWorklet('main-thread', 'fallback', function() {
85
+ return this._jsFn.callback;
86
+ });
87
+ const descriptor = { _jsFnId: 7 };
88
+ const ctx = { _wkltId: 'fallback', _execId: 3, _jsFn: { callback: descriptor } };
89
+ expect(runWorklet(ctx, [])).toEqual({ _jsFnId: 7, _execId: 3 });
90
+ expect(ctx._jsFn.callback).toEqual({ _jsFnId: 7, _execId: 3 });
91
+ expect(ctx._jsFn.callback).toBe(descriptor);
92
+ });
93
+
64
94
  it('worklet should be called', () => {
65
95
  initWorklet();
66
96
 
@@ -38,7 +38,6 @@ export const {
38
38
  process,
39
39
  registerRuntimeBackend,
40
40
  registerRuntimeVersion,
41
- registerWorkletOnBackground,
42
41
  transformToWorklet,
43
42
  withInitDataInState,
44
43
  wrapWithLynxComponent,
@@ -46,12 +46,12 @@ export const {
46
46
  getRuntimeVersion,
47
47
  loadDynamicJS,
48
48
  loadLazyBundle,
49
+ loadWorkletRuntime,
49
50
  options,
50
51
  preactCloneElement,
51
52
  process,
52
53
  registerRuntimeBackend,
53
54
  registerRuntimeVersion,
54
- registerWorkletOnBackground,
55
55
  snapshotCreateList,
56
56
  snapshotManager,
57
57
  snapshotCreatorMap,
@@ -2,7 +2,7 @@
2
2
  // Licensed under the Apache License Version 2.0 that can be found in the
3
3
  // LICENSE file in the root directory of this source tree.
4
4
 
5
- import { sExportsJSXDevRuntime, target } from './target';
5
+ import { sExportsJSXDevRuntime, target } from './target.js';
6
6
 
7
7
  export const {
8
8
  Fragment,
@@ -2,7 +2,7 @@
2
2
  // Licensed under the Apache License Version 2.0 that can be found in the
3
3
  // LICENSE file in the root directory of this source tree.
4
4
 
5
- import { sExportsJSXRuntime, target } from './target';
5
+ import { sExportsJSXRuntime, target } from './target.js';
6
6
 
7
7
  export const {
8
8
  Fragment,
@@ -2,7 +2,7 @@
2
2
  // Licensed under the Apache License Version 2.0 that can be found in the
3
3
  // LICENSE file in the root directory of this source tree.
4
4
 
5
- import { sExportsLegacyReactRuntime, target } from './target';
5
+ import { sExportsLegacyReactRuntime, target } from './target.js';
6
6
 
7
7
  export const {
8
8
  Component,
@@ -2,7 +2,7 @@
2
2
  // Licensed under the Apache License Version 2.0 that can be found in the
3
3
  // LICENSE file in the root directory of this source tree.
4
4
 
5
- import { sExportsReactLepus, target } from './target';
5
+ import { sExportsReactLepus, target } from './target.js';
6
6
 
7
7
  export const {
8
8
  createElement,
@@ -2,7 +2,7 @@
2
2
  // Licensed under the Apache License Version 2.0 that can be found in the
3
3
  // LICENSE file in the root directory of this source tree.
4
4
 
5
- import { sExportsReact, target } from './target';
5
+ import { sExportsReact, target } from './target.js';
6
6
 
7
7
  export const {
8
8
  Children,
@@ -6,7 +6,8 @@ import { isMainThreadObjectHandle } from './main-thread-object-handle-registry.j
6
6
  * Preserve opaque main-thread object handles when the worklet transform narrows a
7
7
  * captured member expression. Ordinary objects keep the transform's compact
8
8
  * fallback shape. The transform evaluates that shape lazily with
9
- * `captureMainThreadObject(source) ?? fallback`.
9
+ * `captureMainThreadObject(source) ?? fallback` (and guards optional-chain
10
+ * bases with `source == null ? source : ...`).
10
11
  *
11
12
  * @internal
12
13
  */
@@ -1 +1 @@
1
- {"version":3,"file":"capture-main-thread-object.js","sourceRoot":"","sources":["../../src/core/capture-main-thread-object.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D,OAAO,EAAE,wBAAwB,EAAE,MAAM,yCAAyC,CAAC;AAEnF;;;;;;;GAOG;AACH,MAAM,UAAU,uBAAuB,CAAI,MAAS;IAClD,OAAO,wBAAwB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;AAC/D,CAAC","sourcesContent":["// Copyright 2026 The Lynx Authors. All rights reserved.\n// Licensed under the Apache License Version 2.0 that can be found in the\n// LICENSE file in the root directory of this source tree.\n\nimport { isMainThreadObjectHandle } from './main-thread-object-handle-registry.js';\n\n/**\n * Preserve opaque main-thread object handles when the worklet transform narrows a\n * captured member expression. Ordinary objects keep the transform's compact\n * fallback shape. The transform evaluates that shape lazily with\n * `captureMainThreadObject(source) ?? fallback`.\n *\n * @internal\n */\nexport function captureMainThreadObject<T>(source: T): T | undefined {\n return isMainThreadObjectHandle(source) ? source : undefined;\n}\n"]}
1
+ {"version":3,"file":"capture-main-thread-object.js","sourceRoot":"","sources":["../../src/core/capture-main-thread-object.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D,OAAO,EAAE,wBAAwB,EAAE,MAAM,yCAAyC,CAAC;AAEnF;;;;;;;;GAQG;AACH,MAAM,UAAU,uBAAuB,CAAI,MAAS;IAClD,OAAO,wBAAwB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;AAC/D,CAAC","sourcesContent":["// Copyright 2026 The Lynx Authors. All rights reserved.\n// Licensed under the Apache License Version 2.0 that can be found in the\n// LICENSE file in the root directory of this source tree.\n\nimport { isMainThreadObjectHandle } from './main-thread-object-handle-registry.js';\n\n/**\n * Preserve opaque main-thread object handles when the worklet transform narrows a\n * captured member expression. Ordinary objects keep the transform's compact\n * fallback shape. The transform evaluates that shape lazily with\n * `captureMainThreadObject(source) ?? fallback` (and guards optional-chain\n * bases with `source == null ? source : ...`).\n *\n * @internal\n */\nexport function captureMainThreadObject<T>(source: T): T | undefined {\n return isMainThreadObjectHandle(source) ? source : undefined;\n}\n"]}
@@ -14,7 +14,7 @@ export { ComponentFromReactRuntime as Component } from './lynxComponent.js';
14
14
  export { ComponentFromReactRuntime as PureComponent } from './lynxComponent.js';
15
15
  export { createContext } from 'preact';
16
16
  export { lazy } from 'preact/compat';
17
- export { useState, useReducer, useEffect, useMemo, useCallback /*, useInstance */ } from '../hooks/react.js';
17
+ export { useState, useReducer, useEffect, useMemo, useCallback } from '../hooks/react.js';
18
18
  export { __runInJS, createRef, useRef };
19
19
  /**
20
20
  * @internal
@@ -1 +1 @@
1
- {"version":3,"file":"legacy-react-runtime.js","sourceRoot":"","sources":["../../../src/core/compat/legacy-react-runtime.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAC1D,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAErC,OAAO,EAAE,yBAAyB,IAAI,SAAS,EAAE,yBAAyB,IAAI,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxH,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAElG,sBAAsB;AACtB,SAAS,SAAS,CAAI,KAAQ;IAC5B,OAAO,KAAK,CAAC;AACf,CAAC;AAED,iDAAiD;AACjD,OAAO,EAAE,yBAAyB,IAAI,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAAE,yBAAyB,IAAI,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAChF,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,CAAC,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC7G,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC;AAExC;;GAEG;AACH,eAAe;IACb,SAAS;IACT,aAAa;IACb,aAAa;IACb,SAAS;IACT,IAAI;IACJ,QAAQ;IACR,UAAU;IACV,MAAM;IACN,SAAS;IACT,OAAO;IACP,WAAW;IACX,SAAS;CACV,CAAC","sourcesContent":["// Copyright 2024 The Lynx Authors. All rights reserved.\n// Licensed under the Apache License Version 2.0 that can be found in the\n// LICENSE file in the root directory of this source tree.\nimport { createContext, createRef } from 'preact';\nimport { lazy } from 'preact/compat';\n\nimport { ComponentFromReactRuntime as Component, ComponentFromReactRuntime as PureComponent } from './lynxComponent.js';\nimport { useCallback, useEffect, useMemo, useReducer, useRef, useState } from '../hooks/react.js';\n\n/* v8 ignore next 3 */\nfunction __runInJS<T>(value: T): T | undefined | null {\n return value;\n}\n\n// should mirror @lynx-js/react-runtime's exports\nexport { ComponentFromReactRuntime as Component } from './lynxComponent.js';\nexport { ComponentFromReactRuntime as PureComponent } from './lynxComponent.js';\nexport { createContext } from 'preact';\nexport { lazy } from 'preact/compat';\nexport { useState, useReducer, useEffect, useMemo, useCallback /*, useInstance */ } from '../hooks/react.js';\nexport { __runInJS, createRef, useRef };\n\n/**\n * @internal\n */\nexport default {\n Component,\n PureComponent,\n createContext,\n createRef,\n lazy,\n useState,\n useReducer,\n useRef,\n useEffect,\n useMemo,\n useCallback,\n __runInJS,\n};\n"]}
1
+ {"version":3,"file":"legacy-react-runtime.js","sourceRoot":"","sources":["../../../src/core/compat/legacy-react-runtime.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAC1D,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAErC,OAAO,EAAE,yBAAyB,IAAI,SAAS,EAAE,yBAAyB,IAAI,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxH,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAElG,sBAAsB;AACtB,SAAS,SAAS,CAAI,KAAQ;IAC5B,OAAO,KAAK,CAAC;AACf,CAAC;AAED,iDAAiD;AACjD,OAAO,EAAE,yBAAyB,IAAI,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAAE,yBAAyB,IAAI,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAChF,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC1F,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC;AAExC;;GAEG;AACH,eAAe;IACb,SAAS;IACT,aAAa;IACb,aAAa;IACb,SAAS;IACT,IAAI;IACJ,QAAQ;IACR,UAAU;IACV,MAAM;IACN,SAAS;IACT,OAAO;IACP,WAAW;IACX,SAAS;CACV,CAAC","sourcesContent":["// Copyright 2024 The Lynx Authors. All rights reserved.\n// Licensed under the Apache License Version 2.0 that can be found in the\n// LICENSE file in the root directory of this source tree.\nimport { createContext, createRef } from 'preact';\nimport { lazy } from 'preact/compat';\n\nimport { ComponentFromReactRuntime as Component, ComponentFromReactRuntime as PureComponent } from './lynxComponent.js';\nimport { useCallback, useEffect, useMemo, useReducer, useRef, useState } from '../hooks/react.js';\n\n/* v8 ignore next 3 */\nfunction __runInJS<T>(value: T): T | undefined | null {\n return value;\n}\n\n// should mirror @lynx-js/react-runtime's exports\nexport { ComponentFromReactRuntime as Component } from './lynxComponent.js';\nexport { ComponentFromReactRuntime as PureComponent } from './lynxComponent.js';\nexport { createContext } from 'preact';\nexport { lazy } from 'preact/compat';\nexport { useState, useReducer, useEffect, useMemo, useCallback } from '../hooks/react.js';\nexport { __runInJS, createRef, useRef };\n\n/**\n * @internal\n */\nexport default {\n Component,\n PureComponent,\n createContext,\n createRef,\n lazy,\n useState,\n useReducer,\n useRef,\n useEffect,\n useMemo,\n useCallback,\n __runInJS,\n};\n"]}
@@ -302,7 +302,7 @@ export const loadLazyBundle = /*#__PURE__*/ (() => {
302
302
  return impl;
303
303
  })();
304
304
  function withSyncResolvers() {
305
- 'background-only';
305
+ 'background only';
306
306
  const resolver = {
307
307
  resolve: (result) => {
308
308
  resolver.result = result;