@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.
- package/CHANGELOG.md +18 -0
- package/components/tsconfig.tsbuildinfo +1 -1
- package/docs/directives.md +90 -0
- package/docs/global-events.md +50 -0
- package/docs/import-attributes.md +43 -0
- package/docs/macros.md +285 -0
- package/package.json +3 -2
- package/refresh/.turbo/turbo-build.log +1 -1
- package/refresh/dist/index.js +26 -6
- package/refresh/package.json +1 -1
- package/runtime/__test__/core/main-thread-object.test.js +149 -0
- package/runtime/__test__/element-template/fixtures/background/main-thread-function/run-on-main-thread/index.tsx +26 -3
- package/runtime/__test__/element-template/imports/main-thread-object-api.test.ts +10 -0
- package/runtime/__test__/element-template/internal/legacy-internal-guardrail.test.ts +3 -0
- package/runtime/__test__/element-template/runtime/background/main-thread-function/compiled-fixtures.test.tsx +4 -0
- package/runtime/__test__/snapshot/ctxNotFound.test.ts +271 -0
- package/runtime/__test__/snapshot/event.test.jsx +7 -7
- package/runtime/__test__/snapshot/lazy.test.js +73 -1
- package/runtime/__test__/snapshot/lynx/portals.test.jsx +75 -37
- package/runtime/__test__/snapshot/snapshotPatch.test.jsx +59 -47
- package/runtime/__test__/snapshot/spread.test.jsx +10 -10
- package/runtime/__test__/snapshot/worklet/main-thread-object.test.jsx +306 -0
- package/runtime/__test__/snapshot/worklet/workletRef.test.jsx +1 -0
- package/runtime/__test__/worklet-runtime/mainThreadObject.test.js +182 -0
- package/runtime/__test__/worklet-runtime/object-methods.test.js +60 -0
- package/runtime/__test__/worklet-runtime/workletRef.test.js +362 -2
- package/runtime/__test__/worklet-runtime/workletRuntime.test.js +246 -1
- package/runtime/lazy/compat.js +2 -0
- package/runtime/lazy/element-template-internal.js +1 -0
- package/runtime/lazy/element-template.js +2 -0
- package/runtime/lazy/internal.js +2 -0
- package/runtime/lazy/react.js +2 -0
- package/runtime/lib/core/background-function/run-on-background.d.ts +16 -0
- package/runtime/lib/core/background-function/run-on-background.js +16 -0
- package/runtime/lib/core/background-function/run-on-background.js.map +1 -1
- package/runtime/lib/core/capture-main-thread-object.d.ts +1 -0
- package/runtime/lib/core/capture-main-thread-object.js +16 -0
- package/runtime/lib/core/capture-main-thread-object.js.map +1 -0
- package/runtime/lib/core/globalProps.d.ts +2 -0
- package/runtime/lib/core/globalProps.js.map +1 -1
- package/runtime/lib/core/hooks/react.d.ts +4 -0
- package/runtime/lib/core/hooks/react.js +4 -0
- package/runtime/lib/core/hooks/react.js.map +1 -1
- package/runtime/lib/core/hooks/useLynxGlobalEventListener.d.ts +2 -0
- package/runtime/lib/core/hooks/useLynxGlobalEventListener.js +2 -0
- package/runtime/lib/core/hooks/useLynxGlobalEventListener.js.map +1 -1
- package/runtime/lib/core/initData.d.ts +2 -0
- package/runtime/lib/core/initData.js +2 -0
- package/runtime/lib/core/initData.js.map +1 -1
- package/runtime/lib/core/main-thread-object-handle-registry.d.ts +3 -0
- package/runtime/lib/core/main-thread-object-handle-registry.js +17 -0
- package/runtime/lib/core/main-thread-object-handle-registry.js.map +1 -0
- package/runtime/lib/core/main-thread-object.d.ts +77 -0
- package/runtime/lib/core/main-thread-object.js +261 -0
- package/runtime/lib/core/main-thread-object.js.map +1 -0
- package/runtime/lib/core/main-thread-ref-id.d.ts +1 -0
- package/runtime/lib/core/main-thread-ref-id.js +14 -0
- package/runtime/lib/core/main-thread-ref-id.js.map +1 -0
- package/runtime/lib/core/main-thread-ref-init-value.d.ts +1 -1
- package/runtime/lib/core/main-thread-ref-init-value.js +4 -2
- package/runtime/lib/core/main-thread-ref-init-value.js.map +1 -1
- package/runtime/lib/core/main-thread-ref.d.ts +4 -0
- package/runtime/lib/core/main-thread-ref.js +5 -8
- package/runtime/lib/core/main-thread-ref.js.map +1 -1
- package/runtime/lib/element-template/background/commit-hook.js.map +1 -1
- package/runtime/lib/element-template/index.d.ts +2 -0
- package/runtime/lib/element-template/index.js +1 -0
- package/runtime/lib/element-template/index.js.map +1 -1
- package/runtime/lib/element-template/internal.d.ts +1 -0
- package/runtime/lib/element-template/internal.js +1 -0
- package/runtime/lib/element-template/internal.js.map +1 -1
- package/runtime/lib/element-template/protocol/types.d.ts +1 -1
- package/runtime/lib/internal.d.ts +1 -0
- package/runtime/lib/internal.js +1 -0
- package/runtime/lib/internal.js.map +1 -1
- package/runtime/lib/lynx-api.d.ts +34 -0
- package/runtime/lib/lynx-api.js +21 -0
- package/runtime/lib/lynx-api.js.map +1 -1
- package/runtime/lib/lynx.js +4 -1
- package/runtime/lib/lynx.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/patch/error.d.ts +11 -1
- package/runtime/lib/snapshot/lifecycle/patch/error.js +24 -16
- package/runtime/lib/snapshot/lifecycle/patch/error.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/patch/snapshotPatchApply.d.ts +1 -1
- package/runtime/lib/snapshot/lifecycle/patch/snapshotPatchApply.js +29 -7
- package/runtime/lib/snapshot/lifecycle/patch/snapshotPatchApply.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/patch/updateMainThread.js +2 -2
- package/runtime/lib/snapshot/lifecycle/patch/updateMainThread.js.map +1 -1
- package/runtime/lib/snapshot/lynx/children.d.ts +2 -0
- package/runtime/lib/snapshot/lynx/children.js.map +1 -1
- package/runtime/lib/snapshot/lynx/element.d.ts +8 -0
- package/runtime/lib/snapshot/lynx/element.js +4 -0
- package/runtime/lib/snapshot/lynx/element.js.map +1 -1
- package/runtime/lib/snapshot/worklet/call/runOnMainThread.d.ts +2 -0
- package/runtime/lib/snapshot/worklet/call/runOnMainThread.js +2 -0
- package/runtime/lib/snapshot/worklet/call/runOnMainThread.js.map +1 -1
- package/runtime/lib/snapshot/worklet/ref/updateInitValue.js.map +1 -1
- package/runtime/lib/tsconfig.tsbuildinfo +1 -1
- package/runtime/lib/worklet-runtime/bindings/bindings.d.ts +3 -3
- package/runtime/lib/worklet-runtime/bindings/bindings.js +9 -1
- package/runtime/lib/worklet-runtime/bindings/bindings.js.map +1 -1
- package/runtime/lib/worklet-runtime/bindings/types.d.ts +3 -6
- package/runtime/lib/worklet-runtime/bindings/types.js.map +1 -1
- package/runtime/lib/worklet-runtime/hydrate.js +26 -7
- package/runtime/lib/worklet-runtime/hydrate.js.map +1 -1
- package/runtime/lib/worklet-runtime/mainThreadObject.d.ts +8 -0
- package/runtime/lib/worklet-runtime/mainThreadObject.js +67 -0
- package/runtime/lib/worklet-runtime/mainThreadObject.js.map +1 -0
- package/runtime/lib/worklet-runtime/workletRef.d.ts +11 -7
- package/runtime/lib/worklet-runtime/workletRef.js +72 -9
- package/runtime/lib/worklet-runtime/workletRef.js.map +1 -1
- package/runtime/lib/worklet-runtime/workletRuntime.js +68 -9
- package/runtime/lib/worklet-runtime/workletRuntime.js.map +1 -1
- package/runtime/package.json +2 -3
- package/runtime/src/core/background-function/run-on-background.ts +16 -0
- package/runtime/src/core/capture-main-thread-object.ts +17 -0
- package/runtime/src/core/globalProps.ts +2 -0
- package/runtime/src/core/hooks/react.ts +4 -0
- package/runtime/src/core/hooks/useLynxGlobalEventListener.ts +2 -0
- package/runtime/src/core/initData.ts +2 -0
- package/runtime/src/core/main-thread-object-handle-registry.ts +25 -0
- package/runtime/src/core/main-thread-object.ts +387 -0
- package/runtime/src/core/main-thread-ref-id.ts +16 -0
- package/runtime/src/core/main-thread-ref-init-value.ts +12 -4
- package/runtime/src/core/main-thread-ref.ts +7 -8
- package/runtime/src/element-template/background/commit-hook.ts +1 -1
- package/runtime/src/element-template/index.ts +6 -0
- package/runtime/src/element-template/internal.ts +2 -0
- package/runtime/src/element-template/protocol/types.ts +1 -1
- package/runtime/src/internal.ts +1 -0
- package/runtime/src/lynx-api.ts +38 -0
- package/runtime/src/lynx.ts +5 -1
- package/runtime/src/snapshot/lifecycle/patch/error.ts +36 -19
- package/runtime/src/snapshot/lifecycle/patch/snapshotPatchApply.ts +29 -7
- package/runtime/src/snapshot/lifecycle/patch/updateMainThread.ts +2 -2
- package/runtime/src/snapshot/lynx/children.ts +2 -0
- package/runtime/src/snapshot/lynx/element.ts +8 -0
- package/runtime/src/snapshot/worklet/call/runOnMainThread.ts +2 -0
- package/runtime/src/snapshot/worklet/ref/updateInitValue.ts +1 -1
- package/runtime/src/worklet-runtime/bindings/bindings.ts +17 -2
- package/runtime/src/worklet-runtime/bindings/types.ts +7 -11
- package/runtime/src/worklet-runtime/hydrate.ts +43 -10
- package/runtime/src/worklet-runtime/mainThreadObject.ts +117 -0
- package/runtime/src/worklet-runtime/workletRef.ts +120 -19
- package/runtime/src/worklet-runtime/workletRuntime.ts +83 -11
- package/runtime/worklet-runtime/dev.js +154 -17
- package/runtime/worklet-runtime/main.js +1 -1
- package/testing-library/.turbo/turbo-build.log +6 -6
- package/testing-library/dist/index.d.ts +165 -2
- package/testing-library/package.json +2 -1
- package/testing-library/src/__tests__/lynx.test.jsx +1 -1
- package/testing-library/src/__tests__/worklet.test.jsx +46 -1
- package/testing-library/tsconfig.docs.json +9 -0
- package/testing-library/typedoc.json +22 -0
- package/transform/.turbo/turbo-build$colon$wasm.log +150 -78
- package/transform/__test__/fixture.spec.js +72 -30
- package/transform/__test__/object-methods.spec.js +84 -0
- package/transform/crates/swc_plugin_worklet/decl_collect.rs +10 -0
- package/transform/crates/swc_plugin_worklet/extract_ident.rs +14 -0
- package/transform/crates/swc_plugin_worklet/gen_stmt.rs +202 -3
- package/transform/crates/swc_plugin_worklet/lib.rs +468 -3
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_capture_env_js.js +8 -1
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_capture_env_lepus.js +10 -5
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_expose_object_method_capture_channels_js.js +27 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_expose_object_method_capture_channels_lepus.js +45 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_extract_member_expr_2_js.js +16 -14
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_extract_member_expr_2_lepus.js +16 -16
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_extract_member_expr_js.js +7 -5
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_extract_member_expr_lepus.js +7 -7
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_not_capture_computed_object_method_key_lepus.js +24 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_not_capture_object_method_local_decls_lepus.js +16 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_preserve_main_thread_objects_in_class_js.js +42 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_preserve_main_thread_objects_in_class_lepus.js +58 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_js.js +3 -1
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_lepus.js +3 -3
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_object_methods_js.js +9 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_object_methods_lepus.js +16 -0
- package/transform/dist/wasm.cjs +1 -1
- package/transform/rspack-napi/tsconfig.tsbuildinfo +1 -1
- package/transform/swc-plugin-reactlynx/.turbo/turbo-build.log +66 -469
- package/transform/swc-plugin-reactlynx/swc_plugin_reactlynx.wasm +0 -0
- package/transform/swc-plugin-reactlynx-compat/.turbo/turbo-build.log +364 -30
- package/transform/swc-plugin-reactlynx-compat/swc_plugin_reactlynx_compat.wasm +0 -0
- package/transform/vitest.config.ts +5 -1
- package/types/react.docs.d.ts +130 -11
- package/testing-library/node_modules/.bin/rsbuild +0 -68
- package/testing-library/node_modules/.bin/rspeedy +0 -68
- package/testing-library/node_modules/.bin/rstest +0 -68
- package/transform/node_modules/.bin/esbuild +0 -59
- package/transform/node_modules/.bin/napi +0 -68
|
@@ -1,26 +1,98 @@
|
|
|
1
1
|
$ node ./scripts/build_wasm.js
|
|
2
2
|
Blocking waiting for file lock on package cache
|
|
3
3
|
Blocking waiting for file lock on package cache
|
|
4
|
+
Blocking waiting for file lock on package cache
|
|
4
5
|
Downloading crates ...
|
|
5
|
-
Downloaded
|
|
6
|
-
Downloaded
|
|
7
|
-
Downloaded futures-task v0.3.33
|
|
6
|
+
Downloaded hybrid-array v0.4.13
|
|
7
|
+
Downloaded arrayvec v0.7.8
|
|
8
8
|
Downloaded bitflags v1.3.2
|
|
9
|
-
Downloaded
|
|
9
|
+
Downloaded iana-time-zone v0.1.65
|
|
10
|
+
Downloaded block-buffer v0.12.1
|
|
11
|
+
Downloaded cpufeatures v0.3.0
|
|
12
|
+
Downloaded futures-task v0.3.33
|
|
13
|
+
Downloaded globset v0.4.19
|
|
10
14
|
Downloaded napi-build v2.3.2
|
|
11
|
-
Downloaded napi-sys v2.4.0
|
|
12
|
-
Downloaded futures-util v0.3.33
|
|
13
15
|
Downloaded napi-derive v2.9.3
|
|
16
|
+
Downloaded napi-sys v2.4.0
|
|
17
|
+
Downloaded path-clean v1.0.1
|
|
18
|
+
Downloaded pathdiff v0.2.3
|
|
19
|
+
Downloaded sha1 v0.10.7
|
|
20
|
+
Downloaded static-map-macro v0.3.4
|
|
21
|
+
Downloaded swc_config v6.0.0
|
|
22
|
+
Downloaded swc_config_macro v1.0.1
|
|
23
|
+
Downloaded swc_ecma_compat_es2017 v50.0.0
|
|
24
|
+
Downloaded swc_ecma_compat_es2018 v51.0.0
|
|
25
|
+
Downloaded swc_ecma_compat_es2020 v53.0.0
|
|
26
|
+
Downloaded swc_ecma_regexp_ast v3.0.0
|
|
27
|
+
Downloaded wasm-bindgen-shared v0.2.126
|
|
28
|
+
Downloaded browserslist-rs v0.20.0
|
|
29
|
+
Downloaded convert_case v0.6.0
|
|
30
|
+
Downloaded crypto-common v0.2.2
|
|
31
|
+
Downloaded ctor v0.1.26
|
|
32
|
+
Downloaded fixedbitset v0.5.7
|
|
33
|
+
Downloaded foldhash v0.2.0
|
|
34
|
+
Downloaded futures-core v0.3.33
|
|
35
|
+
Downloaded lru v0.18.4
|
|
14
36
|
Downloaded napi-derive-backend v1.0.40
|
|
15
|
-
Downloaded
|
|
16
|
-
Downloaded
|
|
37
|
+
Downloaded precomputed-map v0.2.0
|
|
38
|
+
Downloaded preset_env_base v9.0.0
|
|
39
|
+
Downloaded radix_fmt v1.0.0
|
|
17
40
|
Downloaded slab v0.4.12
|
|
18
|
-
Downloaded
|
|
41
|
+
Downloaded st-map v0.2.4
|
|
42
|
+
Downloaded swc_ecma_compat_bugfixes v56.0.0
|
|
43
|
+
Downloaded swc_ecma_compat_common v45.0.0
|
|
44
|
+
Downloaded swc_ecma_compat_es2016 v50.0.0
|
|
45
|
+
Downloaded swc_ecma_compat_es2019 v50.0.0
|
|
46
|
+
Downloaded swc_ecma_compat_es2021 v50.0.0
|
|
47
|
+
Downloaded swc_ecma_compat_es2022 v53.0.0
|
|
48
|
+
Downloaded swc_ecma_compat_regexp v9.0.0
|
|
49
|
+
Downloaded swc_ecma_ext_transforms v35.0.0
|
|
50
|
+
Downloaded swc_ecma_loader v27.0.0
|
|
51
|
+
Downloaded swc_ecma_regexp_common v0.0.1
|
|
52
|
+
Downloaded swc_ecma_transforms_classes v49.0.0
|
|
53
|
+
Downloaded swc_ecma_transforms_macros v1.0.1
|
|
54
|
+
Downloaded swc_node_comments v27.0.0
|
|
19
55
|
Downloaded version-compare v0.2.1
|
|
20
56
|
Downloaded wasm-bindgen-macro v0.2.126
|
|
21
|
-
Downloaded
|
|
22
|
-
Downloaded
|
|
57
|
+
Downloaded crossbeam-utils v0.8.22
|
|
58
|
+
Downloaded dashmap v6.2.1
|
|
59
|
+
Downloaded digest v0.11.3
|
|
60
|
+
Downloaded foldhash v0.1.5
|
|
61
|
+
Downloaded getrandom v0.3.4
|
|
62
|
+
Downloaded sha2 v0.11.0
|
|
63
|
+
Downloaded swc_compiler_base v64.0.0
|
|
64
|
+
Downloaded swc_ecma_regexp v0.15.0
|
|
65
|
+
Downloaded swc_ecma_regexp_visit v0.15.0
|
|
66
|
+
Downloaded swc_ecma_transforms v62.0.0
|
|
67
|
+
Downloaded swc_ecma_transforms_compat v57.0.1
|
|
68
|
+
Downloaded swc_ecma_transforms_typescript v55.0.1
|
|
69
|
+
Downloaded const-oid v0.10.2
|
|
70
|
+
Downloaded jsonc-parser v0.26.3
|
|
71
|
+
Downloaded napi v2.10.4
|
|
72
|
+
Downloaded swc_ecma_transformer v21.0.1
|
|
73
|
+
Downloaded js-sys v0.3.103
|
|
74
|
+
Downloaded ryu-js v1.0.3
|
|
75
|
+
Downloaded swc v75.0.1
|
|
76
|
+
Downloaded swc_ecma_compat_es2015 v55.0.0
|
|
77
|
+
Downloaded swc_ecma_hooks v1.0.0
|
|
78
|
+
Downloaded swc_ecma_transforms_proposal v49.0.0
|
|
79
|
+
Downloaded swc_ecma_transforms_react v55.0.1
|
|
23
80
|
Downloaded wasm-bindgen v0.2.126
|
|
81
|
+
Downloaded swc_ecma_transforms_optimization v52.0.0
|
|
82
|
+
Downloaded wasm-bindgen-macro-support v0.2.126
|
|
83
|
+
Downloaded swc_ecma_preset_env v63.0.0
|
|
84
|
+
Downloaded hashbrown v0.16.1
|
|
85
|
+
Downloaded futures-util v0.3.33
|
|
86
|
+
Downloaded itertools v0.15.0
|
|
87
|
+
Downloaded nom v8.0.0
|
|
88
|
+
Downloaded par-iter v2.0.0
|
|
89
|
+
Downloaded browserslist-data v0.2.0
|
|
90
|
+
Downloaded chrono v0.4.45
|
|
91
|
+
Downloaded syn v1.0.109
|
|
92
|
+
Downloaded swc_ecma_minifier v61.0.4
|
|
93
|
+
Downloaded regress v0.11.1
|
|
94
|
+
Downloaded bstr v1.13.0
|
|
95
|
+
Downloaded petgraph v0.7.1
|
|
24
96
|
Blocking waiting for file lock on package cache
|
|
25
97
|
Blocking waiting for file lock on build directory
|
|
26
98
|
Compiling cfg-if v1.0.4
|
|
@@ -28,27 +100,27 @@ $ node ./scripts/build_wasm.js
|
|
|
28
100
|
Compiling allocator-api2 v0.2.21
|
|
29
101
|
Compiling serde v1.0.229
|
|
30
102
|
Compiling once_cell v1.21.4
|
|
31
|
-
Compiling stable_deref_trait v1.2.1
|
|
32
103
|
Compiling memchr v2.8.3
|
|
104
|
+
Compiling stable_deref_trait v1.2.1
|
|
33
105
|
Compiling zerofrom v0.1.8
|
|
34
|
-
Compiling foldhash v0.2.0
|
|
35
106
|
Compiling equivalent v1.0.2
|
|
107
|
+
Compiling foldhash v0.2.0
|
|
36
108
|
Compiling yoke v0.8.3
|
|
37
109
|
Compiling hashbrown v0.17.1
|
|
38
|
-
Compiling zerovec v0.11.6
|
|
39
110
|
Compiling smallvec v1.15.2
|
|
111
|
+
Compiling zerovec v0.11.6
|
|
40
112
|
Compiling getrandom v0.3.4
|
|
41
113
|
Compiling zerocopy v0.8.55
|
|
42
114
|
Compiling ahash v0.8.12
|
|
43
115
|
Compiling zmij v1.0.23
|
|
44
116
|
Compiling itoa v1.0.18
|
|
45
117
|
Compiling serde_json v1.0.151
|
|
46
|
-
Compiling litemap v0.8.2
|
|
47
118
|
Compiling tinystr v0.8.3
|
|
48
119
|
Compiling writeable v0.6.3
|
|
120
|
+
Compiling litemap v0.8.2
|
|
49
121
|
Compiling potential_utf v0.1.5
|
|
50
|
-
Compiling icu_locale_core v2.2.0
|
|
51
122
|
Compiling zerotrie v0.2.4
|
|
123
|
+
Compiling icu_locale_core v2.2.0
|
|
52
124
|
Compiling utf8_iter v1.0.4
|
|
53
125
|
Compiling icu_collections v2.2.0
|
|
54
126
|
Compiling indexmap v2.14.0
|
|
@@ -63,34 +135,34 @@ $ node ./scripts/build_wasm.js
|
|
|
63
135
|
Compiling hashbrown v0.14.5
|
|
64
136
|
Compiling either v1.17.0
|
|
65
137
|
Compiling scopeguard v1.2.0
|
|
66
|
-
Compiling radium v0.7.0
|
|
67
138
|
Compiling lock_api v0.4.14
|
|
139
|
+
Compiling radium v0.7.0
|
|
68
140
|
Compiling idna_adapter v1.2.2
|
|
69
141
|
Compiling tracing-core v0.1.36
|
|
70
142
|
Compiling percent-encoding v2.3.2
|
|
71
143
|
Compiling tap v1.0.1
|
|
72
144
|
Compiling idna v1.1.0
|
|
73
|
-
Compiling wyz v0.5.1
|
|
74
145
|
Compiling form_urlencoded v1.2.2
|
|
146
|
+
Compiling wyz v0.5.1
|
|
75
147
|
Compiling anyhow v1.0.104
|
|
76
|
-
Compiling
|
|
77
|
-
Compiling outref v0.5.2
|
|
78
|
-
Compiling funty v2.0.0
|
|
148
|
+
Compiling vsimd v0.8.0
|
|
79
149
|
Compiling uuid v1.24.0
|
|
150
|
+
Compiling outref v0.5.2
|
|
151
|
+
Compiling pin-project-lite v0.2.17
|
|
80
152
|
Compiling bytes v1.12.1
|
|
81
|
-
Compiling
|
|
153
|
+
Compiling funty v2.0.0
|
|
82
154
|
Compiling base64-simd v0.8.0
|
|
155
|
+
Compiling tracing v0.1.44
|
|
83
156
|
Compiling bytes-str v0.2.8
|
|
84
157
|
Compiling bitvec v1.1.1
|
|
85
158
|
Compiling debugid v0.8.0
|
|
86
159
|
Compiling url v2.5.8
|
|
87
|
-
Compiling tracing v0.1.44
|
|
88
160
|
Compiling triomphe v0.1.16
|
|
89
|
-
Compiling unicode-id-start v1.4.0
|
|
90
|
-
Compiling if_chain v1.0.3
|
|
91
|
-
Compiling unicode-width v0.2.2
|
|
92
161
|
Compiling data-encoding v2.11.0
|
|
162
|
+
Compiling if_chain v1.0.3
|
|
93
163
|
Compiling new_debug_unreachable v1.0.6
|
|
164
|
+
Compiling unicode-id-start v1.4.0
|
|
165
|
+
Compiling unicode-width v0.2.2
|
|
94
166
|
Compiling hstr v4.0.0
|
|
95
167
|
Compiling num-integer v0.1.46
|
|
96
168
|
Compiling scoped-tls v1.0.1
|
|
@@ -99,125 +171,125 @@ $ node ./scripts/build_wasm.js
|
|
|
99
171
|
Compiling swc_atoms v10.0.0
|
|
100
172
|
Compiling parking_lot v0.12.5
|
|
101
173
|
Compiling swc_visit v2.0.2
|
|
102
|
-
Compiling swc_sourcemap v10.0.2
|
|
103
174
|
Compiling termcolor v1.4.1
|
|
175
|
+
Compiling swc_sourcemap v10.0.2
|
|
104
176
|
Compiling siphasher v0.3.11
|
|
105
177
|
Compiling bitflags v2.13.1
|
|
106
178
|
Compiling siphasher v1.0.3
|
|
107
179
|
Compiling phf_shared v0.11.3
|
|
108
|
-
Compiling phf v0.11.3
|
|
109
180
|
Compiling libc v0.2.189
|
|
110
181
|
Compiling dragonbox_ecma v0.1.12
|
|
111
182
|
Compiling par-core v2.0.0
|
|
183
|
+
Compiling phf v0.11.3
|
|
112
184
|
Compiling num_cpus v1.17.0
|
|
113
185
|
Compiling castaway v0.2.4
|
|
114
|
-
Compiling ryu v1.0.23
|
|
115
186
|
Compiling static_assertions v1.1.0
|
|
116
|
-
Compiling
|
|
187
|
+
Compiling ryu v1.0.23
|
|
117
188
|
Compiling aho-corasick v1.1.4
|
|
189
|
+
Compiling compact_str v0.7.1
|
|
118
190
|
Compiling swc_common v26.0.0
|
|
119
191
|
Compiling regex-syntax v0.8.11
|
|
192
|
+
Compiling typenum v1.20.1
|
|
120
193
|
Compiling swc_ecma_ast v29.0.0
|
|
121
194
|
Compiling regex-automata v0.4.16
|
|
122
|
-
Compiling typenum v1.20.1
|
|
123
195
|
Compiling swc_ecma_regexp_common v0.0.1
|
|
124
196
|
Compiling swc_ecma_regexp_ast v3.0.0
|
|
125
197
|
Compiling crossbeam-utils v0.8.22
|
|
126
198
|
Compiling swc_ecma_regexp_visit v0.15.0
|
|
127
|
-
Compiling dashmap v6.2.1
|
|
128
199
|
Compiling swc_ecma_regexp v0.15.0
|
|
129
|
-
Compiling swc_ecma_visit v29.0.0
|
|
130
|
-
Compiling swc_ecma_parser v45.1.1
|
|
131
|
-
Compiling regex v1.13.1
|
|
132
200
|
Compiling swc_ecma_compat_regexp v9.0.0
|
|
201
|
+
Compiling dashmap v6.2.1
|
|
202
|
+
Compiling regex v1.13.1
|
|
133
203
|
Compiling generic-array v0.14.7
|
|
134
|
-
Compiling
|
|
204
|
+
Compiling swc_ecma_visit v29.0.0
|
|
205
|
+
Compiling swc_ecma_parser v45.1.1
|
|
135
206
|
Compiling hashbrown v0.16.1
|
|
136
|
-
Compiling
|
|
207
|
+
Compiling bstr v1.13.0
|
|
137
208
|
Compiling globset v0.4.19
|
|
138
|
-
Compiling
|
|
209
|
+
Compiling regress v0.11.1
|
|
139
210
|
Compiling crypto-common v0.1.7
|
|
140
|
-
Compiling
|
|
211
|
+
Compiling block-buffer v0.10.4
|
|
141
212
|
Compiling digest v0.10.7
|
|
142
213
|
Compiling arrayvec v0.7.8
|
|
143
214
|
Compiling thiserror v1.0.69
|
|
144
215
|
Compiling owo-colors v4.3.0
|
|
145
216
|
Compiling semver v1.0.28
|
|
146
217
|
Compiling base64 v0.22.1
|
|
218
|
+
Compiling swc_config v6.0.0
|
|
147
219
|
Compiling fixedbitset v0.5.7
|
|
148
|
-
Compiling swc_ecma_utils v35.0.0
|
|
149
|
-
Compiling swc_ecma_hooks v1.0.0
|
|
150
|
-
Compiling swc_ecma_transforms_base v49.0.1
|
|
151
220
|
Compiling unicode-linebreak v0.1.5
|
|
152
|
-
Compiling textwrap v0.16.2
|
|
153
221
|
Compiling petgraph v0.7.1
|
|
154
|
-
Compiling
|
|
155
|
-
Compiling swc_ecma_transforms_classes v49.0.0
|
|
156
|
-
Compiling swc_ecma_compat_common v45.0.0
|
|
222
|
+
Compiling textwrap v0.16.2
|
|
157
223
|
Compiling bumpalo v3.20.3
|
|
158
224
|
Compiling thread_local v1.1.10
|
|
159
225
|
Compiling unicode-width v0.1.14
|
|
160
226
|
Compiling camino v1.2.4
|
|
161
227
|
Compiling swc_allocator v5.0.0
|
|
162
|
-
Compiling swc_ecma_compat_es2015 v55.0.0
|
|
163
|
-
Compiling swc_ecma_compat_es2022 v53.0.0
|
|
164
|
-
Compiling miette v7.6.0
|
|
165
|
-
Compiling swc_ecma_transforms_optimization v52.0.0
|
|
166
228
|
Compiling sha1 v0.10.7
|
|
229
|
+
Compiling swc_ecma_utils v35.0.0
|
|
230
|
+
Compiling swc_ecma_hooks v1.0.0
|
|
231
|
+
Compiling miette v7.6.0
|
|
232
|
+
Compiling swc_ecma_transforms_base v49.0.1
|
|
167
233
|
Compiling chrono v0.4.45
|
|
168
234
|
Compiling syn v1.0.109
|
|
169
|
-
Compiling log v0.4.33
|
|
170
|
-
Compiling lazy_static v1.5.0
|
|
171
235
|
Compiling ascii v1.1.0
|
|
172
|
-
Compiling
|
|
173
|
-
Compiling
|
|
236
|
+
Compiling swc_ecma_transformer v21.0.1
|
|
237
|
+
Compiling swc_ecma_transforms_classes v49.0.0
|
|
238
|
+
Compiling swc_ecma_compat_common v45.0.0
|
|
239
|
+
Compiling swc_ecma_compat_es2015 v55.0.0
|
|
240
|
+
Compiling swc_ecma_compat_es2022 v53.0.0
|
|
241
|
+
Compiling swc_ecma_transforms_optimization v52.0.0
|
|
242
|
+
Compiling lazy_static v1.5.0
|
|
243
|
+
Compiling log v0.4.33
|
|
174
244
|
Compiling tracing-log v0.2.0
|
|
175
|
-
Compiling
|
|
245
|
+
Compiling sharded-slab v0.1.7
|
|
176
246
|
Compiling swc_ecma_compat_bugfixes v56.0.0
|
|
177
|
-
Compiling swc_ecma_transforms_react v55.0.1
|
|
178
|
-
Compiling swc_error_reporters v28.0.0
|
|
179
247
|
Compiling swc_ecma_compat_es2020 v53.0.0
|
|
248
|
+
Compiling swc_ecma_compat_es2019 v50.0.0
|
|
249
|
+
Compiling swc_ecma_compat_es2018 v51.0.0
|
|
180
250
|
Compiling swc_ecma_compat_es2016 v50.0.0
|
|
181
|
-
Compiling swc_ecma_compat_es2021 v50.0.0
|
|
182
251
|
Compiling swc_ecma_compat_es2017 v50.0.0
|
|
183
|
-
Compiling
|
|
184
|
-
Compiling
|
|
252
|
+
Compiling swc_ecma_compat_es2021 v50.0.0
|
|
253
|
+
Compiling browserslist-data v0.2.0
|
|
254
|
+
Compiling swc_ecma_codegen v32.0.0
|
|
255
|
+
Compiling swc_ecma_transforms_react v55.0.1
|
|
256
|
+
Compiling swc_error_reporters v28.0.0
|
|
185
257
|
Compiling matchers v0.2.0
|
|
186
258
|
Compiling itertools v0.15.0
|
|
187
259
|
Compiling cargo-platform v0.1.9
|
|
188
260
|
Compiling nom v8.0.0
|
|
189
|
-
Compiling diff v0.1.13
|
|
190
261
|
Compiling yansi v1.0.1
|
|
262
|
+
Compiling diff v0.1.13
|
|
191
263
|
Compiling nu-ansi-term v0.50.3
|
|
192
264
|
Compiling tracing-subscriber v0.3.23
|
|
193
265
|
Compiling pretty_assertions v1.4.1
|
|
194
266
|
Compiling st-map v0.2.4
|
|
195
267
|
Compiling cargo_metadata v0.18.1
|
|
196
268
|
Compiling browserslist-rs v0.20.0
|
|
197
|
-
Compiling swc_ecma_transforms_compat v57.0.1
|
|
198
269
|
Compiling swc_ecma_transforms_typescript v55.0.1
|
|
270
|
+
Compiling swc_ecma_transforms_compat v57.0.1
|
|
199
271
|
Compiling swc_ecma_transforms_proposal v49.0.0
|
|
200
272
|
Compiling par-iter v2.0.0
|
|
201
|
-
Compiling pathdiff v0.2.3
|
|
202
273
|
Compiling ryu-js v1.0.3
|
|
203
274
|
Compiling difference v2.0.0
|
|
204
275
|
Compiling radix_fmt v1.0.0
|
|
276
|
+
Compiling pathdiff v0.2.3
|
|
205
277
|
Compiling testing v27.0.0
|
|
206
278
|
Compiling swc_ecma_transforms v62.0.0
|
|
207
279
|
Compiling preset_env_base v9.0.0
|
|
208
|
-
Compiling swc_ecma_minifier v61.0.4
|
|
209
280
|
Compiling swc_ecma_preset_env v63.0.0
|
|
281
|
+
Compiling swc_ecma_minifier v61.0.4
|
|
210
282
|
Compiling sha2 v0.10.9
|
|
211
283
|
Compiling lru v0.18.4
|
|
284
|
+
Compiling foldhash v0.1.5
|
|
212
285
|
Compiling path-clean v1.0.1
|
|
213
|
-
Compiling precomputed-map v0.2.0
|
|
214
|
-
Compiling hex v0.4.3
|
|
215
286
|
Compiling fastrand v2.5.0
|
|
287
|
+
Compiling hex v0.4.3
|
|
288
|
+
Compiling precomputed-map v0.2.0
|
|
216
289
|
Compiling unicode-segmentation v1.13.3
|
|
217
|
-
Compiling foldhash v0.1.5
|
|
218
290
|
Compiling convert_case v0.6.0
|
|
219
|
-
Compiling tempfile v3.27.0
|
|
220
291
|
Compiling swc_ecma_testing v27.0.0
|
|
292
|
+
Compiling tempfile v3.27.0
|
|
221
293
|
Compiling swc_ecma_loader v27.0.0
|
|
222
294
|
Compiling swc_ecma_ext_transforms v35.0.0
|
|
223
295
|
Compiling swc_node_comments v27.0.0
|
|
@@ -226,39 +298,39 @@ $ node ./scripts/build_wasm.js
|
|
|
226
298
|
Compiling swc_core v77.1.2
|
|
227
299
|
Compiling ansi_term v0.12.1
|
|
228
300
|
Compiling swc_ecma_transforms_testing v53.0.0
|
|
229
|
-
Compiling napi-derive-backend v1.0.40
|
|
230
301
|
Compiling swc_compiler_base v64.0.0
|
|
302
|
+
Compiling napi-derive-backend v1.0.40
|
|
231
303
|
Compiling swc v75.0.1
|
|
232
304
|
Compiling ctor v0.1.26
|
|
233
|
-
Compiling napi-sys v2.4.0
|
|
234
305
|
Compiling bitflags v1.3.2
|
|
306
|
+
Compiling napi-sys v2.4.0
|
|
235
307
|
Compiling napi v2.10.4
|
|
236
308
|
Compiling napi-derive v2.9.3
|
|
237
|
-
Compiling sha-1 v0.10.1
|
|
238
309
|
Compiling convert_case v0.11.0
|
|
310
|
+
Compiling sha-1 v0.10.1
|
|
239
311
|
Compiling sugar_path v1.2.1
|
|
240
|
-
Compiling swc_plugins_shared v0.1.0 (/home/runner/work/lynx-stack/lynx-stack/packages/react/transform/crates/swc_plugins_shared)
|
|
241
312
|
Compiling hybrid-array v0.4.13
|
|
313
|
+
Compiling swc_plugins_shared v0.1.0 (/home/runner/work/lynx-stack/lynx-stack/packages/react/transform/crates/swc_plugins_shared)
|
|
242
314
|
Compiling crypto-common v0.2.2
|
|
243
315
|
Compiling block-buffer v0.12.1
|
|
244
316
|
Compiling const-oid v0.10.2
|
|
245
|
-
Compiling napi-build v2.3.2
|
|
246
317
|
Compiling digest v0.11.3
|
|
318
|
+
Compiling napi-build v2.3.2
|
|
319
|
+
Compiling react-transform v0.0.0 (/home/runner/work/lynx-stack/lynx-stack/packages/react/transform)
|
|
247
320
|
Compiling getrandom v0.4.3
|
|
248
321
|
Compiling sha2 v0.11.0
|
|
249
|
-
Compiling react-transform v0.0.0 (/home/runner/work/lynx-stack/lynx-stack/packages/react/transform)
|
|
250
322
|
Compiling swc_plugin_snapshot v0.1.0 (/home/runner/work/lynx-stack/lynx-stack/packages/react/transform/crates/swc_plugin_snapshot)
|
|
251
323
|
Compiling swc_plugin_define_dce v0.1.0 (/home/runner/work/lynx-stack/lynx-stack/packages/react/transform/crates/swc_plugin_define_dce)
|
|
252
324
|
Compiling swc_plugin_directive_dce v0.1.0 (/home/runner/work/lynx-stack/lynx-stack/packages/react/transform/crates/swc_plugin_directive_dce)
|
|
253
325
|
Compiling swc_plugin_element_template v0.1.0 (/home/runner/work/lynx-stack/lynx-stack/packages/react/transform/crates/swc_plugin_element_template)
|
|
254
326
|
Compiling swc_plugin_list v0.1.0 (/home/runner/work/lynx-stack/lynx-stack/packages/react/transform/crates/swc_plugin_list)
|
|
327
|
+
Compiling swc_plugin_css_scope v0.1.0 (/home/runner/work/lynx-stack/lynx-stack/packages/react/transform/crates/swc_plugin_css_scope)
|
|
255
328
|
Compiling swc_plugin_worklet v0.1.0 (/home/runner/work/lynx-stack/lynx-stack/packages/react/transform/crates/swc_plugin_worklet)
|
|
256
|
-
Compiling swc_plugin_inject v0.1.0 (/home/runner/work/lynx-stack/lynx-stack/packages/react/transform/crates/swc_plugin_inject)
|
|
257
329
|
Compiling swc_plugin_dynamic_import v0.1.0 (/home/runner/work/lynx-stack/lynx-stack/packages/react/transform/crates/swc_plugin_dynamic_import)
|
|
330
|
+
Compiling swc_plugin_inject v0.1.0 (/home/runner/work/lynx-stack/lynx-stack/packages/react/transform/crates/swc_plugin_inject)
|
|
258
331
|
Compiling swc_plugin_text v0.1.0 (/home/runner/work/lynx-stack/lynx-stack/packages/react/transform/crates/swc_plugin_text)
|
|
259
|
-
Compiling swc_plugin_compat v0.1.0 (/home/runner/work/lynx-stack/lynx-stack/packages/react/transform/crates/swc_plugin_compat)
|
|
260
332
|
Compiling swc_plugin_shake v0.1.0 (/home/runner/work/lynx-stack/lynx-stack/packages/react/transform/crates/swc_plugin_shake)
|
|
261
|
-
Compiling
|
|
333
|
+
Compiling swc_plugin_compat v0.1.0 (/home/runner/work/lynx-stack/lynx-stack/packages/react/transform/crates/swc_plugin_compat)
|
|
262
334
|
Compiling swc_plugin_background_only v0.1.0 (/home/runner/work/lynx-stack/lynx-stack/packages/react/transform/crates/swc_plugin_background_only)
|
|
263
335
|
Compiling version-compare v0.2.1
|
|
264
|
-
Finished `release` profile [optimized] target(s) in
|
|
336
|
+
Finished `release` profile [optimized] target(s) in 5m 54s
|
|
@@ -1997,6 +1997,46 @@ export function bar() {
|
|
|
1997
1997
|
);
|
|
1998
1998
|
});
|
|
1999
1999
|
|
|
2000
|
+
it('should error when an object Main Thread Function uses super', async () => {
|
|
2001
|
+
const result = await transformReactLynx(
|
|
2002
|
+
`\
|
|
2003
|
+
const valueType = defineMainThreadObjectType({
|
|
2004
|
+
type: 'example',
|
|
2005
|
+
create() {
|
|
2006
|
+
"main thread";
|
|
2007
|
+
return super.create();
|
|
2008
|
+
},
|
|
2009
|
+
});
|
|
2010
|
+
`,
|
|
2011
|
+
lepusWorkletOptions,
|
|
2012
|
+
);
|
|
2013
|
+
|
|
2014
|
+
expect(result.errors.map((error) => error.text)).toContain(
|
|
2015
|
+
'`super` is not supported in Main Thread object methods.',
|
|
2016
|
+
);
|
|
2017
|
+
});
|
|
2018
|
+
|
|
2019
|
+
it('should not reject super in a nested object method', async () => {
|
|
2020
|
+
const result = await transformReactLynx(
|
|
2021
|
+
`\
|
|
2022
|
+
const valueType = defineMainThreadObjectType({
|
|
2023
|
+
type: 'example',
|
|
2024
|
+
create() {
|
|
2025
|
+
"main thread";
|
|
2026
|
+
return {
|
|
2027
|
+
nested() {
|
|
2028
|
+
return super.create();
|
|
2029
|
+
},
|
|
2030
|
+
};
|
|
2031
|
+
},
|
|
2032
|
+
});
|
|
2033
|
+
`,
|
|
2034
|
+
lepusWorkletOptions,
|
|
2035
|
+
);
|
|
2036
|
+
|
|
2037
|
+
expect(result.errors).toEqual([]);
|
|
2038
|
+
});
|
|
2039
|
+
|
|
2000
2040
|
it('should error on non-string runtime import attribute', async () => {
|
|
2001
2041
|
const result = await transformReactLynx(
|
|
2002
2042
|
`\
|
|
@@ -2125,14 +2165,14 @@ export function getCurrentDelta(event) {
|
|
|
2125
2165
|
|
|
2126
2166
|
if (target === 'LEPUS') {
|
|
2127
2167
|
expect(code).toMatchInlineSnapshot(`
|
|
2128
|
-
"import { loadWorkletRuntime as __loadWorkletRuntime } from "@lynx-js/react";
|
|
2129
|
-
var loadWorkletRuntime = __loadWorkletRuntime;
|
|
2168
|
+
"import { captureMainThreadObject as __captureMainThreadObject, loadWorkletRuntime as __loadWorkletRuntime } from "@lynx-js/react";
|
|
2169
|
+
var captureMainThreadObject = __captureMainThreadObject, loadWorkletRuntime = __loadWorkletRuntime;
|
|
2130
2170
|
export let getCurrentDelta = {
|
|
2131
2171
|
_c: {
|
|
2132
|
-
foo: {
|
|
2133
|
-
bar: {
|
|
2134
|
-
|
|
2135
|
-
|
|
2172
|
+
foo: captureMainThreadObject(foo) ?? {
|
|
2173
|
+
bar: ((__mainThreadObjectSource)=>captureMainThreadObject(__mainThreadObjectSource) ?? {
|
|
2174
|
+
baz: __mainThreadObjectSource.baz
|
|
2175
|
+
})(foo.bar)
|
|
2136
2176
|
}
|
|
2137
2177
|
},
|
|
2138
2178
|
_wkltId: "da39:75a1b:1"
|
|
@@ -2150,12 +2190,14 @@ export function getCurrentDelta(event) {
|
|
|
2150
2190
|
expect(code).toContain('registerWorkletInternal("main-thread"');
|
|
2151
2191
|
} else if (target === 'JS') {
|
|
2152
2192
|
expect(code).toMatchInlineSnapshot(`
|
|
2153
|
-
"
|
|
2193
|
+
"import { captureMainThreadObject as __captureMainThreadObject } from "@lynx-js/react";
|
|
2194
|
+
var captureMainThreadObject = __captureMainThreadObject;
|
|
2195
|
+
export let getCurrentDelta = {
|
|
2154
2196
|
_c: {
|
|
2155
|
-
foo: {
|
|
2156
|
-
bar: {
|
|
2157
|
-
|
|
2158
|
-
|
|
2197
|
+
foo: captureMainThreadObject(foo) ?? {
|
|
2198
|
+
bar: ((__mainThreadObjectSource)=>captureMainThreadObject(__mainThreadObjectSource) ?? {
|
|
2199
|
+
baz: __mainThreadObjectSource.baz
|
|
2200
|
+
})(foo.bar)
|
|
2159
2201
|
}
|
|
2160
2202
|
},
|
|
2161
2203
|
_wkltId: "da39:75a1b:1"
|
|
@@ -2166,14 +2208,14 @@ export function getCurrentDelta(event) {
|
|
|
2166
2208
|
expect(code).not.toContain('registerWorkletInternal');
|
|
2167
2209
|
} else if (target === 'MIXED') {
|
|
2168
2210
|
expect(code).toMatchInlineSnapshot(`
|
|
2169
|
-
"import { loadWorkletRuntime as __loadWorkletRuntime } from "@lynx-js/react";
|
|
2170
|
-
var loadWorkletRuntime = __loadWorkletRuntime;
|
|
2211
|
+
"import { captureMainThreadObject as __captureMainThreadObject, loadWorkletRuntime as __loadWorkletRuntime } from "@lynx-js/react";
|
|
2212
|
+
var captureMainThreadObject = __captureMainThreadObject, loadWorkletRuntime = __loadWorkletRuntime;
|
|
2171
2213
|
export let getCurrentDelta = {
|
|
2172
2214
|
_c: {
|
|
2173
|
-
foo: {
|
|
2174
|
-
bar: {
|
|
2175
|
-
|
|
2176
|
-
|
|
2215
|
+
foo: captureMainThreadObject(foo) ?? {
|
|
2216
|
+
bar: ((__mainThreadObjectSource)=>captureMainThreadObject(__mainThreadObjectSource) ?? {
|
|
2217
|
+
baz: __mainThreadObjectSource.baz
|
|
2218
|
+
})(foo.bar)
|
|
2177
2219
|
}
|
|
2178
2220
|
},
|
|
2179
2221
|
_wkltId: "da39:75a1b:1"
|
|
@@ -2226,22 +2268,22 @@ export function foo(event) {
|
|
|
2226
2268
|
);
|
|
2227
2269
|
|
|
2228
2270
|
expect(code).toMatchInlineSnapshot(`
|
|
2229
|
-
"import { loadWorkletRuntime as __loadWorkletRuntime } from "@lynx-js/react";
|
|
2230
|
-
var loadWorkletRuntime = __loadWorkletRuntime;
|
|
2271
|
+
"import { captureMainThreadObject as __captureMainThreadObject, loadWorkletRuntime as __loadWorkletRuntime } from "@lynx-js/react";
|
|
2272
|
+
var captureMainThreadObject = __captureMainThreadObject, loadWorkletRuntime = __loadWorkletRuntime;
|
|
2231
2273
|
export let foo = {
|
|
2232
2274
|
_c: {
|
|
2233
|
-
bar: {
|
|
2234
|
-
baz: {
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
qux: {
|
|
2238
|
-
|
|
2239
|
-
|
|
2275
|
+
bar: captureMainThreadObject(bar) ?? {
|
|
2276
|
+
baz: ((__mainThreadObjectSource)=>captureMainThreadObject(__mainThreadObjectSource) ?? {
|
|
2277
|
+
'qux': __mainThreadObjectSource['qux']
|
|
2278
|
+
})(bar.baz),
|
|
2279
|
+
qux: ((__mainThreadObjectSource)=>captureMainThreadObject(__mainThreadObjectSource) ?? {
|
|
2280
|
+
'baz': __mainThreadObjectSource['baz']
|
|
2281
|
+
})(bar.qux)
|
|
2240
2282
|
},
|
|
2241
|
-
qux: {
|
|
2242
|
-
bar: {
|
|
2243
|
-
|
|
2244
|
-
|
|
2283
|
+
qux: captureMainThreadObject(qux) ?? {
|
|
2284
|
+
bar: ((__mainThreadObjectSource)=>captureMainThreadObject(__mainThreadObjectSource) ?? {
|
|
2285
|
+
baz: __mainThreadObjectSource.baz
|
|
2286
|
+
})(qux.bar)
|
|
2245
2287
|
}
|
|
2246
2288
|
},
|
|
2247
2289
|
_wkltId: "da39:64631:1"
|
|
@@ -0,0 +1,84 @@
|
|
|
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 { describe, expect, it } from 'vitest';
|
|
6
|
+
|
|
7
|
+
import { transformReactLynx } from '../main.js';
|
|
8
|
+
|
|
9
|
+
const replacementCallback = () => 2;
|
|
10
|
+
|
|
11
|
+
function options(target) {
|
|
12
|
+
return {
|
|
13
|
+
mode: 'test',
|
|
14
|
+
pluginName: '',
|
|
15
|
+
filename: 'test.jsx',
|
|
16
|
+
sourcemap: false,
|
|
17
|
+
cssScope: false,
|
|
18
|
+
shake: false,
|
|
19
|
+
compat: false,
|
|
20
|
+
refresh: false,
|
|
21
|
+
defineDCE: false,
|
|
22
|
+
directiveDCE: false,
|
|
23
|
+
worklet: {
|
|
24
|
+
target,
|
|
25
|
+
filename: 'test.jsx',
|
|
26
|
+
runtimePkg: '@lynx-js/react/internal',
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
describe('object method captures', () => {
|
|
32
|
+
it('captures nested computed keys in the enclosing worklet scope', async () => {
|
|
33
|
+
const result = await transformReactLynx(
|
|
34
|
+
`
|
|
35
|
+
const name = 'create';
|
|
36
|
+
const nestedName = 'read';
|
|
37
|
+
export const valueType = {
|
|
38
|
+
[name]() {
|
|
39
|
+
'main thread';
|
|
40
|
+
return { [nestedName](nestedName) { return nestedName; } };
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
`,
|
|
44
|
+
options('LEPUS'),
|
|
45
|
+
);
|
|
46
|
+
const functions = new Map();
|
|
47
|
+
const valueType = new Function(
|
|
48
|
+
'__loadWorkletRuntime',
|
|
49
|
+
'registerWorkletInternal',
|
|
50
|
+
`${result.code.replace(/^import .*;$/gm, '').replace(/^export /gm, '')}\nreturn valueType;`,
|
|
51
|
+
)(
|
|
52
|
+
() => true,
|
|
53
|
+
(_type, id, fn) => functions.set(id, fn),
|
|
54
|
+
);
|
|
55
|
+
expect(valueType.create._c).toEqual({ nestedName: 'read' });
|
|
56
|
+
const nested = functions.get(valueType.create._wkltId).call(valueType.create);
|
|
57
|
+
expect(nested.read(42)).toBe(42);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it('reads background callbacks from the actual object method receiver', async () => {
|
|
61
|
+
const result = await transformReactLynx(
|
|
62
|
+
`
|
|
63
|
+
export const valueType = {
|
|
64
|
+
callback: () => 1,
|
|
65
|
+
create() {
|
|
66
|
+
'main thread';
|
|
67
|
+
runOnBackground(this.callback)();
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
`,
|
|
71
|
+
options('JS'),
|
|
72
|
+
);
|
|
73
|
+
const valueType = new Function(
|
|
74
|
+
'__transformToWorklet',
|
|
75
|
+
`${result.code.replace(/^import .*;$/gm, '').replace(/^export /gm, '')}\nreturn valueType;`,
|
|
76
|
+
)(fn => fn);
|
|
77
|
+
expect(valueType.create._jsFn._jsFn1).toBe(valueType.callback);
|
|
78
|
+
valueType.callback = replacementCallback;
|
|
79
|
+
expect(valueType.create._jsFn._jsFn1).toBe(replacementCallback);
|
|
80
|
+
const other = { callback: () => 3 };
|
|
81
|
+
expect(Object.getOwnPropertyDescriptor(valueType, 'create').get.call(other)._jsFn._jsFn1)
|
|
82
|
+
.toBe(other.callback);
|
|
83
|
+
});
|
|
84
|
+
});
|
|
@@ -119,6 +119,16 @@ impl Visit for BindingCollector {
|
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
+
fn visit_method_prop(&mut self, node: &MethodProp) {
|
|
123
|
+
if self.should_enter_ctx {
|
|
124
|
+
self.should_enter_ctx = false;
|
|
125
|
+
self.enter_next_block = true;
|
|
126
|
+
// An object method's key is evaluated in the enclosing scope. Only the
|
|
127
|
+
// function parameters and body belong to the method's local scope.
|
|
128
|
+
node.function.visit_with(self);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
122
132
|
fn visit_catch_clause(&mut self, node: &CatchClause) {
|
|
123
133
|
if self.should_enter_ctx {
|
|
124
134
|
self.should_enter_ctx = false;
|
|
@@ -404,6 +404,20 @@ impl VisitMut for ExtractingIdentsCollector {
|
|
|
404
404
|
self.pop_scope();
|
|
405
405
|
}
|
|
406
406
|
|
|
407
|
+
fn visit_mut_method_prop(&mut self, n: &mut MethodProp) {
|
|
408
|
+
// Only the outer worklet's key is evaluated at its definition site.
|
|
409
|
+
// Nested method keys execute inside the worklet, in the enclosing scope
|
|
410
|
+
// rather than the nested method's parameter/body scope.
|
|
411
|
+
if !self.scope_env.last().unwrap().is_worklet_fn_scope {
|
|
412
|
+
n.key.visit_mut_with(self);
|
|
413
|
+
}
|
|
414
|
+
self.push_fn_scope(collect_inner_scope_decls(n));
|
|
415
|
+
self.next_block_decls_collected = true;
|
|
416
|
+
n.function.visit_mut_with(self);
|
|
417
|
+
self.next_block_decls_collected = false;
|
|
418
|
+
self.pop_scope();
|
|
419
|
+
}
|
|
420
|
+
|
|
407
421
|
fn visit_mut_class_method(&mut self, n: &mut ClassMethod) {
|
|
408
422
|
self.push_fn_scope(collect_inner_scope_decls(n));
|
|
409
423
|
self.next_block_decls_collected = true;
|