@lynx-js/react 0.126.2 → 0.127.0

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 (190) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/components/tsconfig.tsbuildinfo +1 -1
  3. package/docs/directives.md +90 -0
  4. package/docs/global-events.md +50 -0
  5. package/docs/import-attributes.md +43 -0
  6. package/docs/macros.md +285 -0
  7. package/package.json +3 -2
  8. package/refresh/.turbo/turbo-build.log +1 -1
  9. package/refresh/dist/index.js +26 -6
  10. package/refresh/package.json +1 -1
  11. package/runtime/__test__/core/main-thread-object.test.js +149 -0
  12. package/runtime/__test__/element-template/fixtures/background/main-thread-function/run-on-main-thread/index.tsx +26 -3
  13. package/runtime/__test__/element-template/imports/main-thread-object-api.test.ts +10 -0
  14. package/runtime/__test__/element-template/internal/legacy-internal-guardrail.test.ts +3 -0
  15. package/runtime/__test__/element-template/runtime/background/main-thread-function/compiled-fixtures.test.tsx +4 -0
  16. package/runtime/__test__/snapshot/ctxNotFound.test.ts +271 -0
  17. package/runtime/__test__/snapshot/event.test.jsx +7 -7
  18. package/runtime/__test__/snapshot/lazy.test.js +73 -1
  19. package/runtime/__test__/snapshot/lynx/portals.test.jsx +75 -37
  20. package/runtime/__test__/snapshot/snapshotPatch.test.jsx +59 -47
  21. package/runtime/__test__/snapshot/spread.test.jsx +10 -10
  22. package/runtime/__test__/snapshot/worklet/main-thread-object.test.jsx +306 -0
  23. package/runtime/__test__/snapshot/worklet/workletRef.test.jsx +1 -0
  24. package/runtime/__test__/worklet-runtime/mainThreadObject.test.js +182 -0
  25. package/runtime/__test__/worklet-runtime/object-methods.test.js +60 -0
  26. package/runtime/__test__/worklet-runtime/workletRef.test.js +362 -2
  27. package/runtime/__test__/worklet-runtime/workletRuntime.test.js +246 -1
  28. package/runtime/lazy/compat.js +2 -0
  29. package/runtime/lazy/element-template-internal.js +1 -0
  30. package/runtime/lazy/element-template.js +2 -0
  31. package/runtime/lazy/internal.js +2 -0
  32. package/runtime/lazy/react.js +2 -0
  33. package/runtime/lib/core/background-function/run-on-background.d.ts +16 -0
  34. package/runtime/lib/core/background-function/run-on-background.js +16 -0
  35. package/runtime/lib/core/background-function/run-on-background.js.map +1 -1
  36. package/runtime/lib/core/capture-main-thread-object.d.ts +1 -0
  37. package/runtime/lib/core/capture-main-thread-object.js +16 -0
  38. package/runtime/lib/core/capture-main-thread-object.js.map +1 -0
  39. package/runtime/lib/core/globalProps.d.ts +2 -0
  40. package/runtime/lib/core/globalProps.js.map +1 -1
  41. package/runtime/lib/core/hooks/react.d.ts +4 -0
  42. package/runtime/lib/core/hooks/react.js +4 -0
  43. package/runtime/lib/core/hooks/react.js.map +1 -1
  44. package/runtime/lib/core/hooks/useLynxGlobalEventListener.d.ts +2 -0
  45. package/runtime/lib/core/hooks/useLynxGlobalEventListener.js +2 -0
  46. package/runtime/lib/core/hooks/useLynxGlobalEventListener.js.map +1 -1
  47. package/runtime/lib/core/initData.d.ts +2 -0
  48. package/runtime/lib/core/initData.js +2 -0
  49. package/runtime/lib/core/initData.js.map +1 -1
  50. package/runtime/lib/core/main-thread-object-handle-registry.d.ts +3 -0
  51. package/runtime/lib/core/main-thread-object-handle-registry.js +17 -0
  52. package/runtime/lib/core/main-thread-object-handle-registry.js.map +1 -0
  53. package/runtime/lib/core/main-thread-object.d.ts +77 -0
  54. package/runtime/lib/core/main-thread-object.js +261 -0
  55. package/runtime/lib/core/main-thread-object.js.map +1 -0
  56. package/runtime/lib/core/main-thread-ref-id.d.ts +1 -0
  57. package/runtime/lib/core/main-thread-ref-id.js +14 -0
  58. package/runtime/lib/core/main-thread-ref-id.js.map +1 -0
  59. package/runtime/lib/core/main-thread-ref-init-value.d.ts +1 -1
  60. package/runtime/lib/core/main-thread-ref-init-value.js +4 -2
  61. package/runtime/lib/core/main-thread-ref-init-value.js.map +1 -1
  62. package/runtime/lib/core/main-thread-ref.d.ts +4 -0
  63. package/runtime/lib/core/main-thread-ref.js +5 -8
  64. package/runtime/lib/core/main-thread-ref.js.map +1 -1
  65. package/runtime/lib/element-template/background/commit-hook.js.map +1 -1
  66. package/runtime/lib/element-template/index.d.ts +2 -0
  67. package/runtime/lib/element-template/index.js +1 -0
  68. package/runtime/lib/element-template/index.js.map +1 -1
  69. package/runtime/lib/element-template/internal.d.ts +1 -0
  70. package/runtime/lib/element-template/internal.js +1 -0
  71. package/runtime/lib/element-template/internal.js.map +1 -1
  72. package/runtime/lib/element-template/protocol/types.d.ts +1 -1
  73. package/runtime/lib/internal.d.ts +1 -0
  74. package/runtime/lib/internal.js +1 -0
  75. package/runtime/lib/internal.js.map +1 -1
  76. package/runtime/lib/lynx-api.d.ts +34 -0
  77. package/runtime/lib/lynx-api.js +21 -0
  78. package/runtime/lib/lynx-api.js.map +1 -1
  79. package/runtime/lib/lynx.js +4 -1
  80. package/runtime/lib/lynx.js.map +1 -1
  81. package/runtime/lib/snapshot/lifecycle/patch/error.d.ts +11 -1
  82. package/runtime/lib/snapshot/lifecycle/patch/error.js +24 -16
  83. package/runtime/lib/snapshot/lifecycle/patch/error.js.map +1 -1
  84. package/runtime/lib/snapshot/lifecycle/patch/snapshotPatchApply.d.ts +1 -1
  85. package/runtime/lib/snapshot/lifecycle/patch/snapshotPatchApply.js +29 -7
  86. package/runtime/lib/snapshot/lifecycle/patch/snapshotPatchApply.js.map +1 -1
  87. package/runtime/lib/snapshot/lifecycle/patch/updateMainThread.js +2 -2
  88. package/runtime/lib/snapshot/lifecycle/patch/updateMainThread.js.map +1 -1
  89. package/runtime/lib/snapshot/lynx/children.d.ts +2 -0
  90. package/runtime/lib/snapshot/lynx/children.js.map +1 -1
  91. package/runtime/lib/snapshot/lynx/element.d.ts +8 -0
  92. package/runtime/lib/snapshot/lynx/element.js +4 -0
  93. package/runtime/lib/snapshot/lynx/element.js.map +1 -1
  94. package/runtime/lib/snapshot/worklet/call/runOnMainThread.d.ts +2 -0
  95. package/runtime/lib/snapshot/worklet/call/runOnMainThread.js +2 -0
  96. package/runtime/lib/snapshot/worklet/call/runOnMainThread.js.map +1 -1
  97. package/runtime/lib/snapshot/worklet/ref/updateInitValue.js.map +1 -1
  98. package/runtime/lib/tsconfig.tsbuildinfo +1 -1
  99. package/runtime/lib/worklet-runtime/bindings/bindings.d.ts +3 -3
  100. package/runtime/lib/worklet-runtime/bindings/bindings.js +9 -1
  101. package/runtime/lib/worklet-runtime/bindings/bindings.js.map +1 -1
  102. package/runtime/lib/worklet-runtime/bindings/types.d.ts +3 -6
  103. package/runtime/lib/worklet-runtime/bindings/types.js.map +1 -1
  104. package/runtime/lib/worklet-runtime/hydrate.js +26 -7
  105. package/runtime/lib/worklet-runtime/hydrate.js.map +1 -1
  106. package/runtime/lib/worklet-runtime/mainThreadObject.d.ts +8 -0
  107. package/runtime/lib/worklet-runtime/mainThreadObject.js +67 -0
  108. package/runtime/lib/worklet-runtime/mainThreadObject.js.map +1 -0
  109. package/runtime/lib/worklet-runtime/workletRef.d.ts +11 -7
  110. package/runtime/lib/worklet-runtime/workletRef.js +72 -9
  111. package/runtime/lib/worklet-runtime/workletRef.js.map +1 -1
  112. package/runtime/lib/worklet-runtime/workletRuntime.js +68 -9
  113. package/runtime/lib/worklet-runtime/workletRuntime.js.map +1 -1
  114. package/runtime/package.json +2 -3
  115. package/runtime/src/core/background-function/run-on-background.ts +16 -0
  116. package/runtime/src/core/capture-main-thread-object.ts +17 -0
  117. package/runtime/src/core/globalProps.ts +2 -0
  118. package/runtime/src/core/hooks/react.ts +4 -0
  119. package/runtime/src/core/hooks/useLynxGlobalEventListener.ts +2 -0
  120. package/runtime/src/core/initData.ts +2 -0
  121. package/runtime/src/core/main-thread-object-handle-registry.ts +25 -0
  122. package/runtime/src/core/main-thread-object.ts +387 -0
  123. package/runtime/src/core/main-thread-ref-id.ts +16 -0
  124. package/runtime/src/core/main-thread-ref-init-value.ts +12 -4
  125. package/runtime/src/core/main-thread-ref.ts +7 -8
  126. package/runtime/src/element-template/background/commit-hook.ts +1 -1
  127. package/runtime/src/element-template/index.ts +6 -0
  128. package/runtime/src/element-template/internal.ts +2 -0
  129. package/runtime/src/element-template/protocol/types.ts +1 -1
  130. package/runtime/src/internal.ts +1 -0
  131. package/runtime/src/lynx-api.ts +38 -0
  132. package/runtime/src/lynx.ts +5 -1
  133. package/runtime/src/snapshot/lifecycle/patch/error.ts +36 -19
  134. package/runtime/src/snapshot/lifecycle/patch/snapshotPatchApply.ts +29 -7
  135. package/runtime/src/snapshot/lifecycle/patch/updateMainThread.ts +2 -2
  136. package/runtime/src/snapshot/lynx/children.ts +2 -0
  137. package/runtime/src/snapshot/lynx/element.ts +8 -0
  138. package/runtime/src/snapshot/worklet/call/runOnMainThread.ts +2 -0
  139. package/runtime/src/snapshot/worklet/ref/updateInitValue.ts +1 -1
  140. package/runtime/src/worklet-runtime/bindings/bindings.ts +17 -2
  141. package/runtime/src/worklet-runtime/bindings/types.ts +7 -11
  142. package/runtime/src/worklet-runtime/hydrate.ts +43 -10
  143. package/runtime/src/worklet-runtime/mainThreadObject.ts +117 -0
  144. package/runtime/src/worklet-runtime/workletRef.ts +120 -19
  145. package/runtime/src/worklet-runtime/workletRuntime.ts +83 -11
  146. package/runtime/worklet-runtime/dev.js +154 -17
  147. package/runtime/worklet-runtime/main.js +1 -1
  148. package/testing-library/.turbo/turbo-build.log +6 -6
  149. package/testing-library/dist/index.d.ts +165 -2
  150. package/testing-library/package.json +2 -1
  151. package/testing-library/src/__tests__/lynx.test.jsx +1 -1
  152. package/testing-library/src/__tests__/worklet.test.jsx +46 -1
  153. package/testing-library/tsconfig.docs.json +9 -0
  154. package/testing-library/typedoc.json +22 -0
  155. package/transform/.turbo/turbo-build$colon$wasm.log +150 -78
  156. package/transform/__test__/fixture.spec.js +72 -30
  157. package/transform/__test__/object-methods.spec.js +84 -0
  158. package/transform/crates/swc_plugin_worklet/decl_collect.rs +10 -0
  159. package/transform/crates/swc_plugin_worklet/extract_ident.rs +14 -0
  160. package/transform/crates/swc_plugin_worklet/gen_stmt.rs +202 -3
  161. package/transform/crates/swc_plugin_worklet/lib.rs +468 -3
  162. package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_capture_env_js.js +8 -1
  163. package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_capture_env_lepus.js +10 -5
  164. package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_expose_object_method_capture_channels_js.js +27 -0
  165. package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_expose_object_method_capture_channels_lepus.js +45 -0
  166. package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_extract_member_expr_2_js.js +16 -14
  167. package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_extract_member_expr_2_lepus.js +16 -16
  168. package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_extract_member_expr_js.js +7 -5
  169. package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_extract_member_expr_lepus.js +7 -7
  170. package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_not_capture_computed_object_method_key_lepus.js +24 -0
  171. package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_not_capture_object_method_local_decls_lepus.js +16 -0
  172. package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_preserve_main_thread_objects_in_class_js.js +42 -0
  173. package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_preserve_main_thread_objects_in_class_lepus.js +58 -0
  174. package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_js.js +3 -1
  175. package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_lepus.js +3 -3
  176. package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_object_methods_js.js +9 -0
  177. package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_object_methods_lepus.js +16 -0
  178. package/transform/dist/wasm.cjs +1 -1
  179. package/transform/rspack-napi/tsconfig.tsbuildinfo +1 -1
  180. package/transform/swc-plugin-reactlynx/.turbo/turbo-build.log +66 -469
  181. package/transform/swc-plugin-reactlynx/swc_plugin_reactlynx.wasm +0 -0
  182. package/transform/swc-plugin-reactlynx-compat/.turbo/turbo-build.log +364 -30
  183. package/transform/swc-plugin-reactlynx-compat/swc_plugin_reactlynx_compat.wasm +0 -0
  184. package/transform/vitest.config.ts +5 -1
  185. package/types/react.docs.d.ts +130 -11
  186. package/testing-library/node_modules/.bin/rsbuild +0 -68
  187. package/testing-library/node_modules/.bin/rspeedy +0 -68
  188. package/testing-library/node_modules/.bin/rstest +0 -68
  189. package/transform/node_modules/.bin/esbuild +0 -59
  190. package/transform/node_modules/.bin/napi +0 -68
@@ -1,58 +1,392 @@
1
1
  $ node ./build.js
2
+ Updating crates.io index
2
3
  Blocking waiting for file lock on package cache
3
4
  Blocking waiting for file lock on package cache
4
- Blocking waiting for file lock on package cache
5
- Blocking waiting for file lock on build directory
6
- Compiling zerovec v0.11.6
5
+ Downloading crates ...
6
+ Downloaded phf_generator v0.11.3
7
+ Downloaded phf_shared v0.11.3
8
+ Downloaded potential_utf v0.1.5
9
+ Downloaded par-core v2.0.0
10
+ Downloaded rustc-hash v2.1.3
11
+ Downloaded scoped-tls v1.0.1
12
+ Downloaded vsimd v0.8.0
13
+ Downloaded zerofrom v0.1.8
14
+ Downloaded zerofrom-derive v0.1.7
15
+ Downloaded cpufeatures v0.2.17
16
+ Downloaded scopeguard v1.2.0
17
+ Downloaded seq-macro v0.3.6
18
+ Downloaded siphasher v0.3.11
19
+ Downloaded stable_deref_trait v1.2.1
20
+ Downloaded swc_allocator v5.0.0
21
+ Downloaded swc_ecma_codegen_macros v2.0.2
22
+ Downloaded swc_ecma_quote_macros v45.0.1
23
+ Downloaded swc_error_reporters v28.0.0
24
+ Downloaded swc_plugin v1.0.1
25
+ Downloaded swc_transform_common v20.0.0
26
+ Downloaded tap v1.0.1
27
+ Downloaded testing_macros v1.0.2
28
+ Downloaded thread_local v1.1.10
29
+ Downloaded unicode-linebreak v0.1.5
30
+ Downloaded utf8_iter v1.0.4
31
+ Downloaded version_check v0.9.5
32
+ Downloaded percent-encoding v2.3.2
33
+ Downloaded radium v0.7.0
34
+ Downloaded sha-1 v0.10.1
35
+ Downloaded siphasher v1.0.3
36
+ Downloaded string_enum v1.0.2
37
+ Downloaded swc_atoms v10.0.0
38
+ Downloaded swc_ecma_testing v27.0.0
39
+ Downloaded swc_eq_ignore_macros v1.0.1
40
+ Downloaded swc_macros_common v1.0.1
41
+ Downloaded swc_plugin_macro v2.0.0
42
+ Downloaded swc_plugin_proxy v30.0.0
43
+ Downloaded swc_visit v2.0.2
44
+ Downloaded yoke-derive v0.8.2
45
+ Downloaded zmij v1.0.23
46
+ Downloaded ast_node v7.0.0
47
+ Downloaded castaway v0.2.4
48
+ Downloaded pin-project-lite v0.2.17
49
+ Downloaded quote v1.0.47
50
+ Downloaded relative-path v1.9.3
51
+ Downloaded ansi_term v0.12.1
52
+ Downloaded base64-simd v0.8.0
53
+ Downloaded better_scoped_tls v1.0.1
54
+ Downloaded block-buffer v0.10.4
55
+ Downloaded bytes-str v0.2.8
56
+ Downloaded cargo-platform v0.1.9
57
+ Downloaded cfg-if v1.0.4
58
+ Downloaded equivalent v1.0.2
59
+ Downloaded errno v0.3.14
60
+ Downloaded form_urlencoded v1.2.2
61
+ Downloaded from_variant v3.0.0
62
+ Downloaded funty v2.0.0
63
+ Downloaded heck v0.5.0
64
+ Downloaded hex v0.4.3
65
+ Downloaded idna_adapter v1.2.2
66
+ Downloaded if_chain v1.0.3
67
+ Downloaded is-macro v0.3.7
68
+ Downloaded itoa v1.0.18
69
+ Downloaded lazy_static v1.5.0
70
+ Downloaded matchers v0.2.0
71
+ Downloaded num_cpus v1.17.0
72
+ Downloaded stacker v0.1.24
73
+ Downloaded swc_ecma_transforms_testing v53.0.0
74
+ Downloaded testing v27.0.0
75
+ Downloaded thiserror v1.0.69
76
+ Downloaded thiserror-impl v1.0.69
77
+ Downloaded tinystr v0.8.3
78
+ Downloaded tracing-log v0.2.0
79
+ Downloaded wyz v0.5.1
80
+ Downloaded yoke v0.8.3
81
+ Downloaded zerovec-derive v0.11.3
82
+ Downloaded ahash v0.8.12
83
+ Downloaded allocator-api2 v0.2.21
84
+ Downloaded autocfg v1.5.1
85
+ Downloaded camino v1.2.4
86
+ Downloaded cargo_metadata v0.18.1
87
+ Downloaded cbor4ii v1.2.2
88
+ Downloaded convert_case v0.11.0
89
+ Downloaded crypto-common v0.1.7
90
+ Downloaded data-encoding v2.11.0
91
+ Downloaded debugid v0.8.0
92
+ Downloaded digest v0.10.7
93
+ Downloaded either v1.17.0
94
+ Downloaded fastrand v2.5.0
95
+ Downloaded find-msvc-tools v0.1.9
96
+ Downloaded generic-array v0.14.7
97
+ Downloaded glob v0.3.4
98
+ Downloaded lock_api v0.4.14
99
+ Downloaded new_debug_unreachable v1.0.6
100
+ Downloaded num-integer v0.1.46
101
+ Downloaded outref v0.5.2
102
+ Downloaded phf v0.11.3
103
+ Downloaded phf_macros v0.11.3
104
+ Downloaded rand_core v0.6.4
105
+ Downloaded rustversion v1.0.23
106
+ Downloaded semver v1.0.28
107
+ Downloaded sha2 v0.10.9
108
+ Downloaded shlex v2.0.1
109
+ Downloaded smallvec v1.15.2
110
+ Downloaded static_assertions v1.1.0
111
+ Downloaded sugar_path v1.2.1
112
+ Downloaded swc_ecma_ast v29.0.0
113
+ Downloaded swc_ecma_utils v35.0.0
114
+ Downloaded synstructure v0.13.2
115
+ Downloaded tempfile v3.27.0
116
+ Downloaded termcolor v1.4.1
117
+ Downloaded tracing-attributes v0.1.31
118
+ Downloaded triomphe v0.1.16
119
+ Downloaded unicode-id-start v1.4.0
120
+ Downloaded unicode-ident v1.0.24
121
+ Downloaded uuid v1.24.0
122
+ Downloaded writeable v0.6.3
123
+ Downloaded anyhow v1.0.104
124
+ Downloaded ascii v1.1.0
125
+ Downloaded diff v0.1.13
126
+ Downloaded displaydoc v0.2.6
127
+ Downloaded litemap v0.8.2
128
+ Downloaded miette-derive v7.6.0
129
+ Downloaded nu-ansi-term v0.50.3
130
+ Downloaded owo-colors v4.3.0
131
+ Downloaded parking_lot v0.12.5
132
+ Downloaded parking_lot_core v0.9.12
133
+ Downloaded pretty_assertions v1.4.1
134
+ Downloaded psm v0.1.31
135
+ Downloaded ryu v1.0.23
136
+ Downloaded serde_core v1.0.229
137
+ Downloaded serde_derive v1.0.229
138
+ Downloaded sharded-slab v0.1.7
139
+ Downloaded swc_core v77.1.2
140
+ Downloaded textwrap v0.16.2
141
+ Downloaded tracing-core v0.1.36
142
+ Downloaded yansi v1.0.1
143
+ Downloaded base64 v0.22.1
144
+ Downloaded bitflags v2.13.1
145
+ Downloaded compact_str v0.7.1
146
+ Downloaded hstr v4.0.0
147
+ Downloaded icu_properties v2.2.0
148
+ Downloaded icu_provider v2.2.0
149
+ Downloaded proc-macro2 v1.0.107
150
+ Downloaded serde v1.0.229
151
+ Downloaded swc_ecma_codegen v32.0.0
152
+ Downloaded url v2.5.8
153
+ Downloaded bytes v1.12.1
154
+ Downloaded getrandom v0.4.3
155
+ Downloaded log v0.4.33
156
+ Downloaded num-traits v0.2.19
157
+ Downloaded once_cell v1.21.4
158
+ Downloaded rand v0.8.7
159
+ Downloaded swc_common v26.0.0
160
+ Downloaded swc_sourcemap v10.0.2
161
+ Downloaded typenum v1.20.1
162
+ Downloaded unicode-segmentation v1.13.3
163
+ Downloaded dragonbox_ecma v0.1.12
164
+ Downloaded icu_locale_core v2.2.0
165
+ Downloaded icu_normalizer v2.2.0
166
+ Downloaded swc_ecma_transforms_base v49.0.1
167
+ Downloaded zerotrie v0.2.4
168
+ Downloaded icu_normalizer_data v2.2.0
169
+ Downloaded ar_archive_writer v0.5.2
170
+ Downloaded bumpalo v3.20.3
171
+ Downloaded cc v1.4.0
172
+ Downloaded regex v1.13.1
173
+ Downloaded serde_json v1.0.151
174
+ Downloaded icu_collections v2.2.0
175
+ Downloaded indexmap v2.14.0
176
+ Downloaded miette v7.6.0
177
+ Downloaded zerovec v0.11.6
178
+ Downloaded memchr v2.8.3
179
+ Downloaded num-bigint v0.4.8
180
+ Downloaded aho-corasick v1.1.4
181
+ Downloaded hashbrown v0.14.5
182
+ Downloaded idna v1.1.0
183
+ Downloaded difference v2.0.0
184
+ Downloaded hashbrown v0.17.1
185
+ Downloaded icu_properties_data v2.2.0
186
+ Downloaded swc_ecma_parser v45.1.1
187
+ Downloaded tracing-subscriber v0.3.23
188
+ Downloaded zerocopy v0.8.55
189
+ Downloaded bitvec v1.1.1
190
+ Downloaded unicode-width v0.1.14
191
+ Downloaded unicode-width v0.2.2
192
+ Downloaded syn v2.0.119
193
+ Downloaded syn v3.0.3
194
+ Downloaded swc_ecma_visit v29.0.0
195
+ Downloaded object v0.37.3
196
+ Downloaded regex-syntax v0.8.11
197
+ Downloaded rustix v1.1.4
198
+ Downloaded tracing v0.1.44
199
+ Downloaded regex-automata v0.4.16
200
+ Downloaded libc v0.2.189
201
+ Downloaded linux-raw-sys v0.12.1
202
+ Compiling proc-macro2 v1.0.107
203
+ Compiling unicode-ident v1.0.24
204
+ Compiling quote v1.0.47
205
+ Compiling version_check v0.9.5
206
+ Compiling icu_properties_data v2.2.0
207
+ Compiling stable_deref_trait v1.2.1
208
+ Compiling icu_normalizer_data v2.2.0
209
+ Compiling zerocopy v0.8.55
7
210
  Compiling ahash v0.8.12
211
+ Compiling cfg-if v1.0.4
212
+ Compiling serde_core v1.0.229
213
+ Compiling autocfg v1.5.1
214
+ Compiling once_cell v1.21.4
215
+ Compiling num-traits v0.2.19
216
+ Compiling serde v1.0.229
217
+ Compiling smallvec v1.15.2
218
+ Compiling syn v2.0.119
219
+ Compiling syn v3.0.3
220
+ Compiling anyhow v1.0.104
221
+ Compiling memchr v2.8.3
222
+ Compiling writeable v0.6.3
223
+ Compiling litemap v0.8.2
224
+ Compiling utf8_iter v1.0.4
225
+ Compiling allocator-api2 v0.2.21
226
+ Compiling synstructure v0.13.2
227
+ Compiling serde_derive v1.0.229
228
+ Compiling swc_macros_common v1.0.1
229
+ Compiling zmij v1.0.23
8
230
  Compiling hashbrown v0.17.1
9
- Compiling either v1.17.0
10
- Compiling hashbrown v0.14.5
11
- Compiling swc_visit v2.0.2
12
- Compiling aho-corasick v1.1.4
231
+ Compiling zerofrom-derive v0.1.7
232
+ Compiling yoke-derive v0.8.2
233
+ Compiling zerovec-derive v0.11.3
234
+ Compiling displaydoc v0.2.6
235
+ Compiling zerofrom v0.1.8
236
+ Compiling yoke v0.8.3
237
+ Compiling tracing-attributes v0.1.31
238
+ Compiling zerotrie v0.2.4
239
+ Compiling zerovec v0.11.6
240
+ Compiling from_variant v3.0.0
241
+ Compiling ast_node v7.0.0
242
+ Compiling swc_eq_ignore_macros v1.0.1
13
243
  Compiling tinystr v0.8.3
244
+ Compiling icu_locale_core v2.2.0
14
245
  Compiling potential_utf v0.1.5
15
246
  Compiling icu_collections v2.2.0
16
- Compiling indexmap v2.14.0
17
- Compiling icu_locale_core v2.2.0
18
- Compiling hstr v4.0.0
247
+ Compiling radium v0.7.0
248
+ Compiling equivalent v1.0.2
19
249
  Compiling serde_json v1.0.151
250
+ Compiling itoa v1.0.18
251
+ Compiling rustc-hash v2.1.3
252
+ Compiling indexmap v2.14.0
253
+ Compiling hashbrown v0.14.5
20
254
  Compiling icu_provider v2.2.0
21
- Compiling icu_properties v2.2.0
22
255
  Compiling icu_normalizer v2.2.0
23
- Compiling swc_atoms v10.0.0
24
- Compiling typenum v1.20.1
256
+ Compiling icu_properties v2.2.0
257
+ Compiling tracing-core v0.1.36
258
+ Compiling parking_lot_core v0.9.12
259
+ Compiling percent-encoding v2.3.2
260
+ Compiling tap v1.0.1
261
+ Compiling rand_core v0.6.4
262
+ Compiling siphasher v1.0.3
263
+ Compiling rand v0.8.7
264
+ Compiling wyz v0.5.1
265
+ Compiling phf_shared v0.11.3
266
+ Compiling form_urlencoded v1.2.2
25
267
  Compiling idna_adapter v1.2.2
26
268
  Compiling idna v1.1.0
27
- Compiling regex-automata v0.4.16
28
- Compiling cargo_metadata v0.18.1
269
+ Compiling triomphe v0.1.16
270
+ Compiling funty v2.0.0
271
+ Compiling uuid v1.24.0
272
+ Compiling bytes v1.12.1
273
+ Compiling outref v0.5.2
274
+ Compiling scopeguard v1.2.0
275
+ Compiling new_debug_unreachable v1.0.6
276
+ Compiling vsimd v0.8.0
277
+ Compiling unicode-width v0.2.2
278
+ Compiling pin-project-lite v0.2.17
279
+ Compiling tracing v0.1.44
280
+ Compiling bytes-str v0.2.8
281
+ Compiling base64-simd v0.8.0
282
+ Compiling hstr v4.0.0
283
+ Compiling lock_api v0.4.14
284
+ Compiling bitvec v1.1.1
285
+ Compiling debugid v0.8.0
286
+ Compiling num-integer v0.1.46
29
287
  Compiling url v2.5.8
288
+ Compiling phf_generator v0.11.3
289
+ Compiling unicode-id-start v1.4.0
290
+ Compiling if_chain v1.0.3
291
+ Compiling scoped-tls v1.0.1
292
+ Compiling data-encoding v2.11.0
293
+ Compiling either v1.17.0
294
+ Compiling cbor4ii v1.2.2
295
+ Compiling swc_visit v2.0.2
296
+ Compiling swc_atoms v10.0.0
297
+ Compiling better_scoped_tls v1.0.1
298
+ Compiling parking_lot v0.12.5
30
299
  Compiling swc_sourcemap v10.0.2
31
- Compiling generic-array v0.14.7
32
- Compiling swc_allocator v5.0.0
300
+ Compiling phf_macros v0.11.3
301
+ Compiling num-bigint v0.4.8
302
+ Compiling siphasher v0.3.11
303
+ Compiling termcolor v1.4.1
304
+ Compiling heck v0.5.0
305
+ Compiling rustversion v1.0.23
306
+ Compiling is-macro v0.3.7
307
+ Compiling string_enum v1.0.2
33
308
  Compiling swc_common v26.0.0
309
+ Compiling bitflags v2.13.1
310
+ Compiling libc v0.2.189
311
+ Compiling generic-array v0.14.7
312
+ Compiling phf v0.11.3
313
+ Compiling aho-corasick v1.1.4
314
+ Compiling typenum v1.20.1
315
+ Compiling regex-syntax v0.8.11
316
+ Compiling swc_ecma_ast v29.0.0
317
+ Compiling regex-automata v0.4.16
318
+ Compiling owo-colors v4.3.0
319
+ Compiling dragonbox_ecma v0.1.12
320
+ Compiling unicode-linebreak v0.1.5
321
+ Compiling thiserror v1.0.69
322
+ Compiling camino v1.2.4
323
+ Compiling textwrap v0.16.2
34
324
  Compiling block-buffer v0.10.4
35
325
  Compiling crypto-common v0.1.7
326
+ Compiling castaway v0.2.4
327
+ Compiling thiserror-impl v1.0.69
328
+ Compiling miette-derive v7.6.0
329
+ Compiling lazy_static v1.5.0
330
+ Compiling unicode-width v0.1.14
331
+ Compiling seq-macro v0.3.6
332
+ Compiling static_assertions v1.1.0
333
+ Compiling ryu v1.0.23
334
+ Compiling log v0.4.33
335
+ Compiling compact_str v0.7.1
336
+ Compiling tracing-log v0.2.0
337
+ Compiling miette v7.6.0
338
+ Compiling sharded-slab v0.1.7
339
+ Compiling regex v1.13.1
36
340
  Compiling digest v0.10.7
37
- Compiling sha2 v0.10.9
341
+ Compiling swc_ecma_visit v29.0.0
38
342
  Compiling matchers v0.2.0
39
- Compiling regex v1.13.1
40
- Compiling swc_ecma_ast v29.0.0
41
- Compiling swc_error_reporters v28.0.0
343
+ Compiling num_cpus v1.17.0
344
+ Compiling cargo-platform v0.1.9
345
+ Compiling semver v1.0.28
346
+ Compiling par-core v2.0.0
347
+ Compiling thread_local v1.1.10
348
+ Compiling relative-path v1.9.3
349
+ Compiling getrandom v0.4.3
350
+ Compiling rustix v1.1.4
351
+ Compiling nu-ansi-term v0.50.3
352
+ Compiling glob v0.3.4
353
+ Compiling yansi v1.0.1
354
+ Compiling diff v0.1.13
355
+ Compiling testing_macros v1.0.2
356
+ Compiling pretty_assertions v1.4.1
42
357
  Compiling tracing-subscriber v0.3.23
43
- Compiling swc_core v77.1.2
44
- Compiling swc_transform_common v20.0.0
45
- Compiling sha-1 v0.10.1
358
+ Compiling cargo_metadata v0.18.1
359
+ Compiling swc_ecma_utils v35.0.0
360
+ Compiling swc_error_reporters v28.0.0
361
+ Compiling errno v0.3.14
362
+ Compiling bumpalo v3.20.3
363
+ Compiling difference v2.0.0
46
364
  Compiling testing v27.0.0
47
- Compiling swc_ecma_testing v27.0.0
48
- Compiling swc_ecma_visit v29.0.0
365
+ Compiling swc_allocator v5.0.0
366
+ Compiling sha2 v0.10.9
49
367
  Compiling swc_ecma_parser v45.1.1
50
- Compiling swc_plugin_proxy v30.0.0
51
- Compiling swc_ecma_utils v35.0.0
52
- Compiling swc_ecma_transforms_base v49.0.1
368
+ Compiling swc_ecma_codegen_macros v2.0.2
369
+ Compiling fastrand v2.5.0
370
+ Compiling hex v0.4.3
371
+ Compiling ascii v1.1.0
53
372
  Compiling swc_ecma_codegen v32.0.0
373
+ Compiling swc_ecma_testing v27.0.0
374
+ Compiling tempfile v3.27.0
375
+ Compiling base64 v0.22.1
376
+ Compiling ansi_term v0.12.1
377
+ Compiling swc_core v77.1.2
378
+ Compiling swc_ecma_transforms_base v49.0.1
379
+ Compiling swc_plugin_proxy v30.0.0
380
+ Compiling swc_transform_common v20.0.0
381
+ Compiling swc_plugin_macro v2.0.0
382
+ Compiling swc_plugin v1.0.1
383
+ Compiling unicode-segmentation v1.13.3
54
384
  Compiling swc_ecma_transforms_testing v53.0.0
385
+ Compiling swc_ecma_quote_macros v45.0.1
386
+ Compiling convert_case v0.11.0
387
+ Compiling sha-1 v0.10.1
388
+ Compiling sugar_path v1.2.1
55
389
  Compiling swc_plugins_shared v0.1.0 (/home/runner/work/lynx-stack/lynx-stack/packages/react/transform/crates/swc_plugins_shared)
56
390
  Compiling swc_plugin_compat v0.1.0 (/home/runner/work/lynx-stack/lynx-stack/packages/react/transform/crates/swc_plugin_compat)
57
391
  Compiling swc_plugin_reactlynx_compat v0.1.0 (/home/runner/work/lynx-stack/lynx-stack/packages/react/transform/swc-plugin-reactlynx-compat)
58
- Finished `release` profile [optimized] target(s) in 5m 29s
392
+ Finished `release` profile [optimized] target(s) in 1m 39s
@@ -10,7 +10,11 @@ export default defineConfig({
10
10
  test: {
11
11
  name: 'react/transform',
12
12
  coverage: {
13
- exclude: ['./__test__/*.bench.js'],
13
+ exclude: [
14
+ './__test__/*.bench.js',
15
+ './crates/**/tests/__swc_snapshots__/**',
16
+ './tests/__swc_snapshots__/**',
17
+ ],
14
18
  },
15
19
  },
16
20
  plugins: [
@@ -2,6 +2,56 @@
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
+ /**
6
+ * `@lynx-js/react` is React for Lynx. It keeps the React 17 API surface,
7
+ * re-exporting the standard hooks and APIs, and adds what the dual-thread
8
+ * model needs: main-thread functions, the data a page receives from native,
9
+ * and a few compile-time directives and macros.
10
+ *
11
+ * @remarks
12
+ *
13
+ * The React APIs below behave as the
14
+ * {@link https://react.dev/reference/react | official React reference}
15
+ * describes them, unless a page says otherwise. They are compatible with
16
+ * React 17 and {@link https://preactjs.com/guide/v10/switching-to-preact/ | Preact}.
17
+ *
18
+ * React entered its "concurrent" era with
19
+ * {@link https://react.dev/blog/2022/03/29/react-v18 | React 18}. Concurrent
20
+ * features such as `useTransition` and `useDeferredValue` make strict demands
21
+ * on how the host schedules work — they depend on browser Web APIs or on the
22
+ * React Native architecture. Lynx evolves its own architecture, so ReactLynx
23
+ * builds on React 17 and keeps the React programming model. The parts of
24
+ * {@link https://react.dev/blog/2024/04/25/react-19 | React 19} and the
25
+ * {@link https://react.dev/learn/react-compiler | React Compiler} that do not
26
+ * depend on the concurrent architecture are still on the table.
27
+ *
28
+ * For an introduction to ReactLynx, see the
29
+ * {@link https://lynxjs.org/react/ | ReactLynx guides}.
30
+ *
31
+ * @groupDescription Hooks
32
+ * Hooks that ReactLynx adds on top of React, plus the React hooks it
33
+ * re-exports or re-implements for the dual-thread model.
34
+ *
35
+ * @groupDescription Components
36
+ * Provider and consumer components for the data a Lynx page receives from
37
+ * the native side, and the components re-exported from React.
38
+ *
39
+ * @groupDescription Functions
40
+ * Functions for crossing the thread boundary, creating elements outside JSX
41
+ * and mounting the root.
42
+ *
43
+ * @groupDescription Types
44
+ * The types and classes exported by `@lynx-js/react`. Augment `InitData` and
45
+ * `GlobalProps` in your project to type the data your page receives.
46
+ *
47
+ * @document ../docs/directives.md
48
+ * @document ../docs/macros.md
49
+ * @document ../docs/global-events.md
50
+ * @document ../docs/import-attributes.md
51
+ *
52
+ * @packageDocumentation
53
+ */
54
+
5
55
  import type { ReactLynxChildren } from '../runtime/lib/index.js';
6
56
 
7
57
  declare global {
@@ -49,8 +99,7 @@ declare global {
49
99
  }
50
100
 
51
101
  /**
52
- * Built-in React Hooks
53
- * @see https://react.dev/reference/react/hooks
102
+ * @group Hooks
54
103
  */
55
104
  export {
56
105
  useCallback,
@@ -64,25 +113,91 @@ export {
64
113
  useSyncExternalStore,
65
114
  } from 'react';
66
115
 
67
- export { useEffect, useLayoutEffect, useErrorBoundary } from '../runtime/lib/core/hooks/react.js';
116
+ export { useEffect, useLayoutEffect } from '../runtime/lib/core/hooks/react.js';
117
+
118
+ /**
119
+ * Catches errors thrown by the components below and lets the component
120
+ * render a fallback.
121
+ * @see https://preactjs.com/guide/v10/hooks/#useerrorboundary
122
+ *
123
+ * @group Hooks
124
+ */
125
+ export { useErrorBoundary } from '../runtime/lib/core/hooks/react.js';
68
126
 
69
127
  /**
70
- * Built-in React APIs
71
- * @see https://react.dev/reference/react/apis
128
+ * @group Functions
72
129
  */
73
130
  export { createContext, forwardRef, lazy, memo } from 'react';
74
131
 
75
132
  /**
76
- * Built-in React Components
77
- * @see https://react.dev/reference/react/components
133
+ * Lets you group elements without a wrapper node.
134
+ *
135
+ * @see {@link https://react.dev/reference/react/Fragment | React Docs}
136
+ *
137
+ * @example
138
+ *
139
+ * ```tsx
140
+ * import { Fragment } from '@lynx-js/react';
141
+ *
142
+ * <Fragment>
143
+ * <text>Hello</text>
144
+ * <text>World</text>
145
+ * </Fragment>
146
+ * ```
147
+ *
148
+ * @example
149
+ *
150
+ * ```tsx
151
+ * // Using the <></> shorthand syntax:
152
+ *
153
+ * <>
154
+ * <text>Hello</text>
155
+ * <text>World</text>
156
+ * </>
157
+ * ```
158
+ *
159
+ * @public
160
+ *
161
+ * @group Components
162
+ *
163
+ * @function
164
+ */
165
+ export const Fragment: typeof import('react').Fragment;
166
+
167
+ /**
168
+ * Lets you display a fallback until its children have finished loading.
169
+ *
170
+ * @see {@link https://react.dev/reference/react/Suspense | React Docs}
171
+ *
172
+ * @example
173
+ *
174
+ * ```tsx
175
+ * import { Suspense, lazy } from '@lynx-js/react';
176
+ *
177
+ * const ProfileDetails = lazy(() => import('./ProfileDetails.jsx'));
178
+ *
179
+ * <Suspense fallback={<Loading />}>
180
+ * <ProfileDetails />
181
+ * </Suspense>
182
+ * ```
183
+ *
184
+ * @public
185
+ *
186
+ * @group Components
187
+ *
188
+ * @function
78
189
  */
79
- export { Fragment, Suspense } from 'react';
190
+ export const Suspense: typeof import('react').Suspense;
80
191
 
81
192
  /**
82
- * Legacy React APIs
83
- * @see https://react.dev/reference/react/legacy
193
+ * @group Components
84
194
  */
85
- export { Component, PureComponent, createRef, isValidElement } from 'react';
195
+ export { Component, PureComponent } from 'react';
196
+
197
+ /**
198
+ * @group Functions
199
+ */
200
+ export { createRef, isValidElement } from 'react';
86
201
 
87
202
  export type { CloneElement, CreateElement, ReactLynxChildren } from '../runtime/lib/index.js';
88
203
 
@@ -92,6 +207,8 @@ export type { CloneElement, CreateElement, ReactLynxChildren } from '../runtime/
92
207
  * Arrays returned by `map`, `forEach`, and `toArray` are frozen.
93
208
  *
94
209
  * @public
210
+ *
211
+ * @group Functions
95
212
  */
96
213
  export const Children: ReactLynxChildren;
97
214
 
@@ -100,6 +217,8 @@ export const Children: ReactLynxChildren;
100
217
  * `NodesRef` (e.g. from `ref={setX}` or `lynx.createSelectorQuery()`).
101
218
  *
102
219
  * @public
220
+ *
221
+ * @group Functions
103
222
  */
104
223
  export { createPortal } from '../runtime/lib/index.js';
105
224
 
@@ -1,68 +0,0 @@
1
- #!/bin/sh
2
- # Resolve $0 through symlinks so basedir is the shim's real directory.
3
- # Cap hops at the kernel's ELOOP limit so a cycle cannot hang the shim.
4
- #
5
- # A shim runs with node_modules/.bin at the front of PATH, so readlink, sed,
6
- # uname, and printf go through `command -p`, which searches the system default
7
- # path instead. A dependency's bin cannot stand in for one of them and take over
8
- # the shim before it reaches its target. Directories come from `${link%/*}`,
9
- # which needs no helper at all.
10
- link="$0"
11
- # `${link%/*}` needs a separator to strip. A bare name came from a PATH lookup
12
- # and stands for a file in the current directory.
13
- case "$link" in
14
- */*|*\\*) ;;
15
- *) link="./$link" ;;
16
- esac
17
- hops=0
18
- while [ -L "$link" ] && [ "$hops" -lt 40 ]; do
19
- hops=$((hops+1))
20
- target=$(command -p readlink "$link")
21
- case "$target" in
22
- /*) link="$target" ;;
23
- *) link="${link%/*}/$target" ;;
24
- esac
25
- done
26
- basedir=$(command -p printf '%s\n' "$link" | command -p sed -e 's,\\,/,g')
27
- basedir="${basedir%/*}"
28
- basedir_win="$basedir"
29
- exe=""
30
- msys=""
31
-
32
- case `command -p uname -a` in
33
- *CYGWIN*|*MINGW*|*MSYS*)
34
- if command -v cygpath > /dev/null 2>&1; then
35
- basedir_win=`cygpath -w "$basedir"`
36
- fi
37
- exe=".exe"
38
- msys="true"
39
- ;;
40
- *WSL2*)
41
- if command -v wslpath > /dev/null 2>&1; then
42
- basedir_win="$(wslpath -w "$basedir" 2> /dev/null)"
43
- if [ $? -ne 0 ] || [ -z "$basedir_win" ]; then
44
- basedir_win="$basedir"
45
- else
46
- exe=".exe"
47
- fi
48
- fi
49
- ;;
50
- esac
51
-
52
- if [ -z "$NODE_PATH" ]; then
53
- export NODE_PATH="/home/runner/work/lynx-stack/lynx-stack/node_modules/.pnpm/@rsbuild+core@2.2.9_core-js@3.50.0/node_modules/@rsbuild/core/node_modules:/home/runner/work/lynx-stack/lynx-stack/node_modules/.pnpm/@rsbuild+core@2.2.9_core-js@3.50.0/node_modules:/home/runner/work/lynx-stack/lynx-stack/node_modules/.pnpm/node_modules"
54
- else
55
- export NODE_PATH="/home/runner/work/lynx-stack/lynx-stack/node_modules/.pnpm/@rsbuild+core@2.2.9_core-js@3.50.0/node_modules/@rsbuild/core/node_modules:/home/runner/work/lynx-stack/lynx-stack/node_modules/.pnpm/@rsbuild+core@2.2.9_core-js@3.50.0/node_modules:/home/runner/work/lynx-stack/lynx-stack/node_modules/.pnpm/node_modules:$NODE_PATH"
56
- fi
57
- if [ -n "$exe" ] && [ -x "$basedir/node.exe" ]; then
58
- exec "$basedir/node.exe" "$basedir_win/../@rsbuild/core/bin/rsbuild.js" "$@"
59
- elif [ -x "$basedir/node" ]; then
60
- exec "$basedir/node" "$basedir/../@rsbuild/core/bin/rsbuild.js" "$@"
61
- elif command -v node >/dev/null 2>&1; then
62
- exec node "$basedir/../@rsbuild/core/bin/rsbuild.js" "$@"
63
- elif [ -n "$exe" ] && command -v node.exe >/dev/null 2>&1; then
64
- exec node.exe "$basedir_win/../@rsbuild/core/bin/rsbuild.js" "$@"
65
- else
66
- exec node "$basedir/../@rsbuild/core/bin/rsbuild.js" "$@"
67
- fi
68
- # cmd-shim-target=/home/runner/work/lynx-stack/lynx-stack/packages/react/testing-library/node_modules/@rsbuild/core/./bin/rsbuild.js