@lynx-js/react 0.126.1 → 0.126.2
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 +22 -0
- package/components/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/refresh/.turbo/turbo-build.log +3 -3
- package/refresh/dist/index.js +1 -2
- package/refresh/package.json +1 -1
- package/runtime/__test__/element-template/debug/profile-installation.test.tsx +97 -1
- package/runtime/__test__/element-template/fixtures/background/hydrate-compiled/children.non-string-raw-text-key-on-main/output.txt +1 -1
- package/runtime/__test__/element-template/fixtures/render/child-siblings/index.js.txt +15 -11
- package/runtime/__test__/element-template/fixtures/render/component/index.js.txt +8 -7
- package/runtime/__test__/element-template/fixtures/render/component-slot-content/index.js.txt +14 -10
- package/runtime/__test__/element-template/fixtures/render/css-scope-dynamic-bundle-url/index.js.txt +4 -3
- package/runtime/__test__/element-template/fixtures/render/{opcodes-into-element-template → direct-native}/_shared.ts +2 -9
- package/runtime/__test__/element-template/fixtures/render/{opcodes-into-element-template → direct-native}/appends-root-text-via-append-element/case.ts +2 -4
- package/runtime/__test__/element-template/fixtures/render/direct-native/creates-template-from-attrs-and-slot-text/case.ts +20 -0
- package/runtime/__test__/element-template/fixtures/render/{opcodes-into-element-template → direct-native}/handles-multiple-template-children-in-the-same-slot/case.ts +3 -16
- package/runtime/__test__/element-template/fixtures/render/direct-native/handles-multiple-text-nodes-in-the-same-slot/case.ts +18 -0
- package/runtime/__test__/element-template/fixtures/render/direct-native/inserts-nested-templates-into-parent-slots/case.ts +20 -0
- package/runtime/__test__/element-template/fixtures/render/direct-native/keeps-slot-children-separated-and-ordered/case.ts +18 -0
- package/runtime/__test__/element-template/fixtures/render/direct-native/passes-bundle-url-to-native-create/case.ts +15 -0
- package/runtime/__test__/element-template/fixtures/render/mapped-view-children/index.js.txt +12 -11
- package/runtime/__test__/element-template/fixtures/render/mixed-children/index.js.txt +8 -7
- package/runtime/__test__/element-template/fixtures/render/multiple-text/index.js.txt +15 -13
- package/runtime/__test__/element-template/fixtures/render/nested-templates/index.js.txt +9 -7
- package/runtime/__test__/element-template/fixtures/render/react-example/index.js.txt +17 -20
- package/runtime/__test__/element-template/fixtures/render/sparse-element-slot/index.js.txt +13 -10
- package/runtime/__test__/element-template/fixtures/render/template-dedupe/index.js.txt +14 -11
- package/runtime/__test__/element-template/imports/suspense-lazy.test.ts +52 -7
- package/runtime/__test__/element-template/native/reload.test.ts +10 -26
- package/runtime/__test__/element-template/runtime/background/component-stack.test.tsx +76 -0
- package/runtime/__test__/element-template/runtime/background/hydrate.test.ts +87 -43
- package/runtime/__test__/element-template/runtime/background/instance.test.ts +14 -0
- package/runtime/__test__/element-template/runtime/render/compact-host-debug.test.ts +57 -0
- package/runtime/__test__/element-template/runtime/render/compact-host.test.ts +199 -0
- package/runtime/__test__/element-template/runtime/render/render-components.test.jsx +292 -0
- package/runtime/__test__/element-template/runtime/render/{render-opcodes-into-element-template.et.test.tsx → render-direct-native.test.tsx} +50 -314
- package/runtime/__test__/element-template/runtime/render/render-direct-suspense.test.ts +378 -0
- package/runtime/__test__/element-template/runtime/render/render-direct.test.ts +491 -0
- package/runtime/__test__/element-template/runtime/render/render-main-thread.contract.test.ts +2 -28
- package/runtime/__test__/element-template/runtime/render/render-main-thread.test.ts +21 -35
- package/runtime/__test__/element-template/runtime/render/render-transform.contract.test.ts +6 -5
- package/runtime/__test__/element-template/test-utils/debug/renderFixtureRunner.ts +4 -4
- package/runtime/__test__/element-template/vitest.config.ts +2 -1
- package/runtime/__test__/snapshot/debug/main-thread-children-with-same-key.test.ts +28 -0
- package/runtime/__test__/snapshot/debug/profile.test.jsx +108 -3
- package/runtime/__test__/snapshot/lazy.test.js +44 -9
- package/runtime/__test__/snapshot/lifecycle/reloadGc.test.jsx +66 -0
- package/runtime/__test__/snapshot/lynx/runtime-version.test.ts +140 -0
- package/runtime/__test__/snapshot/spread.test.jsx +22 -15
- package/runtime/__test__/snapshot/ssr.legacy-slot.test.jsx +168 -0
- package/runtime/__test__/snapshot/ssr.list.test.jsx +211 -0
- package/runtime/__test__/worklet-runtime/hydrate.test.js +92 -0
- package/runtime/__test__/worklet-runtime/runOnBackground.test.js +8 -6
- package/runtime/__test__/worklet-runtime/workletRuntime.test.js +3 -2
- package/runtime/lazy/element-template-import.js +0 -4
- package/runtime/lazy/element-template-internal.js +18 -8
- package/runtime/lazy/element-template-jsx-dev-runtime.js +1 -8
- package/runtime/lazy/element-template-jsx-runtime.js +1 -3
- package/runtime/lazy/element-template.js +1 -3
- package/runtime/lazy/import.js +0 -4
- package/runtime/lazy/internal.js +15 -1
- package/runtime/lazy/target.js +0 -21
- package/runtime/lib/core/hooks/react.d.ts +2 -0
- package/runtime/lib/core/hooks/react.js +2 -0
- package/runtime/lib/core/hooks/react.js.map +1 -1
- package/runtime/lib/core/lynx/runtime-version.d.ts +16 -0
- package/runtime/lib/core/lynx/runtime-version.js +51 -0
- package/runtime/lib/core/lynx/runtime-version.js.map +1 -0
- package/runtime/lib/element-template/background/document.d.ts +1 -1
- package/runtime/lib/element-template/background/document.js +1 -1
- package/runtime/lib/element-template/background/document.js.map +1 -1
- package/runtime/lib/element-template/background/hydrate.js +51 -19
- package/runtime/lib/element-template/background/hydrate.js.map +1 -1
- package/runtime/lib/element-template/background/instance.js +5 -6
- package/runtime/lib/element-template/background/instance.js.map +1 -1
- package/runtime/lib/element-template/debug/profile.js +38 -22
- package/runtime/lib/element-template/debug/profile.js.map +1 -1
- package/runtime/lib/element-template/index.d.ts +1 -1
- package/runtime/lib/element-template/index.js +1 -1
- package/runtime/lib/element-template/index.js.map +1 -1
- package/runtime/lib/element-template/internal.d.ts +4 -1
- package/runtime/lib/element-template/internal.js +6 -1
- package/runtime/lib/element-template/internal.js.map +1 -1
- package/runtime/lib/element-template/native/index.js +4 -0
- package/runtime/lib/element-template/native/index.js.map +1 -1
- package/runtime/lib/element-template/runtime/list/list.d.ts +1 -0
- package/runtime/lib/element-template/runtime/list/list.js +3 -0
- package/runtime/lib/element-template/runtime/list/list.js.map +1 -1
- package/runtime/lib/element-template/runtime/render/create-rendered-host.d.ts +7 -0
- package/runtime/lib/element-template/runtime/render/create-rendered-host.js +65 -0
- package/runtime/lib/element-template/runtime/render/create-rendered-host.js.map +1 -0
- package/runtime/lib/element-template/runtime/render/host.d.ts +18 -0
- package/runtime/lib/element-template/runtime/render/host.js +25 -0
- package/runtime/lib/element-template/runtime/render/host.js.map +1 -0
- package/runtime/lib/element-template/runtime/render/render-components.d.ts +6 -0
- package/runtime/lib/element-template/runtime/render/render-components.js +190 -0
- package/runtime/lib/element-template/runtime/render/render-components.js.map +1 -0
- package/runtime/lib/element-template/runtime/render/{render-opcodes.d.ts → render-direct.d.ts} +3 -1
- package/runtime/lib/element-template/runtime/render/render-direct.js +194 -0
- package/runtime/lib/element-template/runtime/render/render-direct.js.map +1 -0
- package/runtime/lib/element-template/runtime/render/render-main-thread.js +10 -9
- package/runtime/lib/element-template/runtime/render/render-main-thread.js.map +1 -1
- package/runtime/lib/element-template/runtime/template/handle.d.ts +2 -1
- package/runtime/lib/element-template/runtime/template/handle.js +12 -4
- package/runtime/lib/element-template/runtime/template/handle.js.map +1 -1
- package/runtime/lib/element-template/runtime-marker.js +13 -0
- package/runtime/lib/element-template/runtime-marker.js.map +1 -0
- package/runtime/lib/index.d.ts +1 -1
- package/runtime/lib/index.js +1 -1
- package/runtime/lib/index.js.map +1 -1
- package/runtime/lib/internal.d.ts +3 -1
- package/runtime/lib/internal.js +5 -1
- package/runtime/lib/internal.js.map +1 -1
- package/runtime/lib/lynx-api.d.ts +15 -6
- package/runtime/lib/lynx-api.js +13 -4
- package/runtime/lib/lynx-api.js.map +1 -1
- package/runtime/lib/runtime-marker.js +13 -0
- package/runtime/lib/runtime-marker.js.map +1 -0
- package/runtime/lib/shared/component-stack.js +5 -1
- package/runtime/lib/shared/component-stack.js.map +1 -1
- package/runtime/lib/snapshot/debug/profileHooks.js +38 -22
- package/runtime/lib/snapshot/debug/profileHooks.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/reload.js +3 -0
- package/runtime/lib/snapshot/lifecycle/reload.js.map +1 -1
- package/runtime/lib/snapshot/lynx/calledByNative.js +3 -0
- package/runtime/lib/snapshot/lynx/calledByNative.js.map +1 -1
- package/runtime/lib/snapshot/lynx/element.d.ts +2 -0
- package/runtime/lib/snapshot/lynx/element.js +2 -0
- package/runtime/lib/snapshot/lynx/element.js.map +1 -1
- package/runtime/lib/snapshot/renderToOpcodes/opcodes.js +2 -1
- package/runtime/lib/snapshot/renderToOpcodes/opcodes.js.map +1 -1
- package/runtime/lib/tsconfig.tsbuildinfo +1 -1
- package/runtime/lib/worklet-runtime/bindings/types.d.ts +1 -1
- package/runtime/lib/worklet-runtime/hydrate.js +1 -1
- package/runtime/lib/worklet-runtime/hydrate.js.map +1 -1
- package/runtime/lib/worklet-runtime/workletRuntime.js +5 -14
- package/runtime/lib/worklet-runtime/workletRuntime.js.map +1 -1
- package/runtime/src/core/hooks/react.ts +2 -0
- package/runtime/src/core/lynx/runtime-version.ts +62 -0
- package/runtime/src/element-template/background/document.ts +3 -3
- package/runtime/src/element-template/background/hydrate.ts +61 -29
- package/runtime/src/element-template/background/instance.ts +5 -6
- package/runtime/src/element-template/debug/profile.ts +48 -36
- package/runtime/src/element-template/index.ts +1 -1
- package/runtime/src/element-template/internal.ts +12 -1
- package/runtime/src/element-template/native/index.ts +4 -0
- package/runtime/src/element-template/runtime/list/list.ts +4 -0
- package/runtime/src/element-template/runtime/render/create-rendered-host.ts +126 -0
- package/runtime/src/element-template/runtime/render/host.ts +51 -0
- package/runtime/src/element-template/runtime/render/render-components.ts +255 -0
- package/runtime/src/element-template/runtime/render/render-direct.ts +275 -0
- package/runtime/src/element-template/runtime/render/render-main-thread.ts +10 -9
- package/runtime/src/element-template/runtime/template/handle.ts +17 -7
- package/runtime/src/element-template/runtime-marker.ts +17 -0
- package/runtime/src/index.ts +1 -1
- package/runtime/src/internal.ts +10 -1
- package/runtime/src/lynx-api.ts +15 -6
- package/runtime/src/runtime-marker.ts +17 -0
- package/runtime/src/shared/component-stack.ts +5 -1
- package/runtime/src/snapshot/debug/profileHooks.ts +52 -40
- package/runtime/src/snapshot/lifecycle/reload.ts +4 -0
- package/runtime/src/snapshot/lynx/calledByNative.ts +4 -0
- package/runtime/src/snapshot/lynx/element.ts +2 -0
- package/runtime/src/snapshot/renderToOpcodes/opcodes.ts +2 -1
- package/runtime/src/worklet-runtime/bindings/types.ts +1 -1
- package/runtime/src/worklet-runtime/hydrate.ts +1 -1
- package/runtime/src/worklet-runtime/workletRuntime.ts +5 -14
- package/runtime/types/types.d.ts +2 -0
- package/runtime/worklet-runtime/dev.js +4 -16
- package/runtime/worklet-runtime/main.js +1 -1
- package/testing-library/.turbo/turbo-build.log +12 -12
- package/testing-library/dist/env/index.js +2 -2
- package/testing-library/dist/index.d.ts +2 -2
- package/testing-library/dist/plugins/index.js +1 -1
- package/testing-library/dist/pure.js +45 -44
- package/testing-library/etc/react-lynx-testing-library.api.md +1 -1
- package/testing-library/node_modules/.bin/rsbuild +19 -6
- package/testing-library/node_modules/.bin/rspeedy +17 -4
- package/testing-library/node_modules/.bin/rstest +19 -6
- package/testing-library/package.json +2 -2
- package/testing-library/src/__tests__/reload/reloadGc.test.jsx +64 -0
- package/testing-library/src/__tests__/reload/reloadTemplate.js +39 -0
- package/testing-library/types/entry.d.ts +2 -2
- package/transform/.turbo/turbo-build$colon$wasm.log +68 -56
- package/transform/__test__/fixture.spec.js +17 -20
- package/transform/__test__/text.spec.js +75 -0
- package/transform/crates/swc_plugin_compat/lib.rs +4 -3
- package/transform/crates/swc_plugin_compat/napi.rs +4 -3
- package/transform/crates/swc_plugin_define_dce/napi.rs +1 -1
- package/transform/crates/swc_plugin_dynamic_import/lib.rs +105 -3
- package/transform/crates/swc_plugin_dynamic_import/tests/__swc_snapshots__/lib.rs/should_suffix_webpack_chunk_name.js +5 -0
- package/transform/crates/swc_plugin_element_template/host_lowering.rs +111 -0
- package/transform/crates/swc_plugin_element_template/lib.rs +41 -5
- package/transform/crates/swc_plugin_element_template/lowering.rs +39 -7
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_generate_attribute_slots_for_dynamic_attributes.snap +1 -1
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_handle_background_conditional_attributes.snap +1 -1
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_handle_boolean_and_number_attributes.snap +1 -1
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_handle_complex_text_structure.snap +1 -1
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_handle_dataset_attributes.snap +1 -1
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_handle_deeply_nested_user_components.snap +1 -1
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_handle_dynamic_class_attributes.snap +1 -1
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_handle_events_lepus.snap +1 -1
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_handle_id_attributes.snap +1 -1
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_handle_inline_styles.snap +1 -1
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_handle_interpolated_text_with_siblings_lepus.snap +1 -1
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_handle_mixed_content.snap +1 -1
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_handle_nested_structure_and_dynamic_content.snap +1 -1
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_handle_refs_lepus.snap +1 -1
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_handle_sibling_user_components.snap +1 -1
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_handle_spread_attributes.snap +1 -1
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_handle_user_component.snap +1 -1
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_isolate_arrays_with_child_slot_placeholder.snap +1 -1
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_keep_code_and_template_attribute_slots_in_sync_for_spread.snap +1 -1
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_output_element_template_simple_lepus.snap +1 -1
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_output_template_with_static_attributes.snap +1 -1
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_verify_template_structure_complex.snap +1 -1
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_verify_text_attribute_and_child_text_slots.snap +1 -1
- package/transform/crates/swc_plugin_element_template/tests/element_template.rs +70 -66
- package/transform/crates/swc_plugin_element_template/tests/element_template_contract.rs +94 -8
- package/transform/crates/swc_plugin_shake/lib.rs +1 -1
- package/transform/crates/swc_plugin_shake/napi.rs +1 -1
- package/transform/crates/swc_plugin_text/lib.rs +57 -16
- package/transform/crates/swc_plugin_text/tests/__swc_snapshots__/lib.rs/should_keep_children_for_dynamic_or_multiple_text.js +13 -0
- package/transform/crates/swc_plugin_text/tests/__swc_snapshots__/lib.rs/should_transform_string_expressions_to_text_attr.js +13 -0
- package/transform/crates/swc_plugins_shared/jsx_helpers.rs +8 -4
- package/transform/dist/wasm.cjs +1 -1
- package/transform/index.d.ts +7 -6
- package/transform/node_modules/.bin/esbuild +17 -4
- package/transform/node_modules/.bin/napi +17 -4
- package/transform/rspack-napi/tsconfig.tsbuildinfo +1 -1
- package/transform/src/swc_plugin_extract_str/mod.rs +1 -1
- package/transform/swc-plugin-reactlynx/.turbo/turbo-build.log +310 -114
- package/transform/swc-plugin-reactlynx/index.d.ts +2 -2
- package/transform/swc-plugin-reactlynx/swc_plugin_reactlynx.wasm +0 -0
- package/transform/swc-plugin-reactlynx-compat/.turbo/turbo-build.log +10 -208
- package/transform/swc-plugin-reactlynx-compat/index.d.ts +3 -3
- package/transform/swc-plugin-reactlynx-compat/swc_plugin_reactlynx_compat.wasm +0 -0
- package/runtime/__test__/element-template/fixtures/render/opcodes-into-element-template/creates-template-from-attrs-and-slot-text/case.ts +0 -39
- package/runtime/__test__/element-template/fixtures/render/opcodes-into-element-template/handles-multiple-text-nodes-in-the-same-slot/case.ts +0 -29
- package/runtime/__test__/element-template/fixtures/render/opcodes-into-element-template/inserts-nested-templates-into-parent-slots/case.ts +0 -42
- package/runtime/__test__/element-template/fixtures/render/opcodes-into-element-template/keeps-slot-children-separated-and-ordered/case.ts +0 -31
- package/runtime/__test__/element-template/fixtures/render/opcodes-into-element-template/passes-bundle-url-to-native-create/case.ts +0 -20
- package/runtime/__test__/element-template/runtime/render/render-to-opcodes.et.test.jsx +0 -522
- package/runtime/lib/element-template/runtime/render/render-opcodes.js +0 -216
- package/runtime/lib/element-template/runtime/render/render-opcodes.js.map +0 -1
- package/runtime/lib/element-template/runtime/render/render-to-opcodes.d.ts +0 -16
- package/runtime/lib/element-template/runtime/render/render-to-opcodes.js +0 -324
- package/runtime/lib/element-template/runtime/render/render-to-opcodes.js.map +0 -1
- package/runtime/lib/element-template/runtime-backend-marker.js +0 -6
- package/runtime/lib/element-template/runtime-backend-marker.js.map +0 -1
- package/runtime/lib/runtime-backend-marker.js +0 -6
- package/runtime/lib/runtime-backend-marker.js.map +0 -1
- package/runtime/src/element-template/runtime/render/render-opcodes.ts +0 -313
- package/runtime/src/element-template/runtime/render/render-to-opcodes.ts +0 -411
- package/runtime/src/element-template/runtime-backend-marker.ts +0 -7
- package/runtime/src/runtime-backend-marker.ts +0 -7
- /package/runtime/__test__/element-template/fixtures/render/{opcodes-into-element-template → direct-native}/appends-root-text-via-append-element/native-log.txt +0 -0
- /package/runtime/__test__/element-template/fixtures/render/{opcodes-into-element-template → direct-native}/appends-root-text-via-append-element/output.txt +0 -0
- /package/runtime/__test__/element-template/fixtures/render/{opcodes-into-element-template → direct-native}/creates-template-from-attrs-and-slot-text/native-log.txt +0 -0
- /package/runtime/__test__/element-template/fixtures/render/{opcodes-into-element-template → direct-native}/creates-template-from-attrs-and-slot-text/output.txt +0 -0
- /package/runtime/__test__/element-template/fixtures/render/{opcodes-into-element-template → direct-native}/handles-multiple-template-children-in-the-same-slot/native-log.txt +0 -0
- /package/runtime/__test__/element-template/fixtures/render/{opcodes-into-element-template → direct-native}/handles-multiple-template-children-in-the-same-slot/output.txt +0 -0
- /package/runtime/__test__/element-template/fixtures/render/{opcodes-into-element-template → direct-native}/handles-multiple-text-nodes-in-the-same-slot/native-log.txt +0 -0
- /package/runtime/__test__/element-template/fixtures/render/{opcodes-into-element-template → direct-native}/handles-multiple-text-nodes-in-the-same-slot/output.txt +0 -0
- /package/runtime/__test__/element-template/fixtures/render/{opcodes-into-element-template → direct-native}/inserts-nested-templates-into-parent-slots/native-log.txt +0 -0
- /package/runtime/__test__/element-template/fixtures/render/{opcodes-into-element-template → direct-native}/inserts-nested-templates-into-parent-slots/output.txt +0 -0
- /package/runtime/__test__/element-template/fixtures/render/{opcodes-into-element-template → direct-native}/keeps-slot-children-separated-and-ordered/native-log.txt +0 -0
- /package/runtime/__test__/element-template/fixtures/render/{opcodes-into-element-template → direct-native}/keeps-slot-children-separated-and-ordered/output.txt +0 -0
- /package/runtime/__test__/element-template/fixtures/render/{opcodes-into-element-template → direct-native}/passes-bundle-url-to-native-create/native-log.txt +0 -0
- /package/runtime/lib/element-template/{runtime-backend-marker.d.ts → runtime-marker.d.ts} +0 -0
- /package/runtime/lib/{runtime-backend-marker.d.ts → runtime-marker.d.ts} +0 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
use std::collections::HashMap;
|
|
2
|
+
|
|
3
|
+
use swc_core::{
|
|
4
|
+
common::{comments::Comments, DUMMY_SP},
|
|
5
|
+
ecma::{
|
|
6
|
+
ast::*,
|
|
7
|
+
visit::{VisitMut, VisitMutWith},
|
|
8
|
+
},
|
|
9
|
+
quote,
|
|
10
|
+
};
|
|
11
|
+
use swc_plugins_shared::jsx_helpers::jsx_attr_value;
|
|
12
|
+
|
|
13
|
+
// Run after extraction so authored static trees and Template Definitions keep
|
|
14
|
+
// their existing boundaries. Only identifiers owned by this transform qualify.
|
|
15
|
+
pub(super) struct HostLowering<'a, C: Comments> {
|
|
16
|
+
pub identities: &'a HashMap<Id, (String, Ident, bool)>,
|
|
17
|
+
pub runtime: Expr,
|
|
18
|
+
pub comments: &'a Option<C>,
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
impl<C: Comments> HostLowering<'_, C> {
|
|
22
|
+
fn lower(&self, node: &JSXElement) -> Option<Expr> {
|
|
23
|
+
let JSXElementName::Ident(ident) = &node.opening.name else {
|
|
24
|
+
return None;
|
|
25
|
+
};
|
|
26
|
+
let (key, bundle, has_no_adapters) = self.identities.get(&ident.to_id())?;
|
|
27
|
+
let mut values = [None, None, None, None];
|
|
28
|
+
for attr in &node.opening.attrs {
|
|
29
|
+
let JSXAttrOrSpread::JSXAttr(attr) = attr else {
|
|
30
|
+
unreachable!("compiled ET host attributes are explicit");
|
|
31
|
+
};
|
|
32
|
+
let JSXAttrName::Ident(name) = &attr.name else {
|
|
33
|
+
unreachable!();
|
|
34
|
+
};
|
|
35
|
+
let index = match name.sym.as_ref() {
|
|
36
|
+
"key" => 0,
|
|
37
|
+
"attributeSlots" => 1,
|
|
38
|
+
"slotChildren" => 2,
|
|
39
|
+
"__listItemPlatformInfo" => 3,
|
|
40
|
+
_ => unreachable!("unexpected compiled ET host attribute"),
|
|
41
|
+
};
|
|
42
|
+
values[index] = Some(*jsx_attr_value(attr.value.clone()));
|
|
43
|
+
}
|
|
44
|
+
let plain = *has_no_adapters && values[3].is_none();
|
|
45
|
+
let mut args = vec![
|
|
46
|
+
Expr::Ident(ident.clone()),
|
|
47
|
+
Expr::Lit(Lit::Str(key.clone().into())),
|
|
48
|
+
Expr::Ident(bundle.clone()),
|
|
49
|
+
];
|
|
50
|
+
// Retain key evaluation before attributes and children, as in the lowered JSX.
|
|
51
|
+
args.extend(
|
|
52
|
+
values
|
|
53
|
+
.into_iter()
|
|
54
|
+
.map(|value| value.unwrap_or_else(|| quote!("void 0" as Expr))),
|
|
55
|
+
);
|
|
56
|
+
if plain {
|
|
57
|
+
args.push(quote!("true" as Expr));
|
|
58
|
+
}
|
|
59
|
+
self.comments.add_pure_comment(node.span.lo);
|
|
60
|
+
Some(Expr::Call(CallExpr {
|
|
61
|
+
span: node.span,
|
|
62
|
+
ctxt: Default::default(),
|
|
63
|
+
callee: Callee::Expr(Box::new(
|
|
64
|
+
quote!("$runtime.__etHost" as Expr, runtime: Expr = self.runtime.clone()),
|
|
65
|
+
)),
|
|
66
|
+
args: args
|
|
67
|
+
.into_iter()
|
|
68
|
+
.map(|expr| ExprOrSpread {
|
|
69
|
+
spread: None,
|
|
70
|
+
expr: Box::new(expr),
|
|
71
|
+
})
|
|
72
|
+
.collect(),
|
|
73
|
+
type_args: None,
|
|
74
|
+
}))
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
impl<C: Comments> VisitMut for HostLowering<'_, C> {
|
|
79
|
+
fn visit_mut_expr(&mut self, node: &mut Expr) {
|
|
80
|
+
node.visit_mut_children_with(self);
|
|
81
|
+
if let Expr::JSXElement(element) = node {
|
|
82
|
+
if let Some(expr) = self.lower(element) {
|
|
83
|
+
*node = expr;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
fn visit_mut_jsx_attr_value(&mut self, node: &mut JSXAttrValue) {
|
|
89
|
+
node.visit_mut_children_with(self);
|
|
90
|
+
if let JSXAttrValue::JSXElement(element) = node {
|
|
91
|
+
if let Some(expr) = self.lower(element) {
|
|
92
|
+
*node = JSXAttrValue::JSXExprContainer(JSXExprContainer {
|
|
93
|
+
span: DUMMY_SP,
|
|
94
|
+
expr: JSXExpr::Expr(Box::new(expr)),
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
fn visit_mut_jsx_element_child(&mut self, node: &mut JSXElementChild) {
|
|
101
|
+
node.visit_mut_children_with(self);
|
|
102
|
+
if let JSXElementChild::JSXElement(element) = node {
|
|
103
|
+
if let Some(expr) = self.lower(element) {
|
|
104
|
+
*node = JSXElementChild::JSXExprContainer(JSXExprContainer {
|
|
105
|
+
span: DUMMY_SP,
|
|
106
|
+
expr: JSXExpr::Expr(Box::new(expr)),
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
@@ -20,6 +20,7 @@ use swc_core::{
|
|
|
20
20
|
mod asset;
|
|
21
21
|
mod attr_name;
|
|
22
22
|
mod extractor;
|
|
23
|
+
mod host_lowering;
|
|
23
24
|
mod lowering;
|
|
24
25
|
mod template_attribute;
|
|
25
26
|
mod template_definition;
|
|
@@ -232,6 +233,7 @@ where
|
|
|
232
233
|
attr_plan_signatures_by_canonical_content: HashMap<String, String>,
|
|
233
234
|
template_identity_collision_guard: TemplateIdentityCollisionGuard,
|
|
234
235
|
current_template_defs: Vec<ModuleItem>,
|
|
236
|
+
host_identities: HashMap<Id, (String, Ident, bool)>,
|
|
235
237
|
comments: Option<C>,
|
|
236
238
|
css_id_value: Option<f64>,
|
|
237
239
|
}
|
|
@@ -273,6 +275,7 @@ where
|
|
|
273
275
|
attr_plan_signatures_by_canonical_content: HashMap::new(),
|
|
274
276
|
template_identity_collision_guard: TemplateIdentityCollisionGuard::default(),
|
|
275
277
|
current_template_defs: vec![],
|
|
278
|
+
host_identities: HashMap::new(),
|
|
276
279
|
comments,
|
|
277
280
|
css_id_value: None,
|
|
278
281
|
}
|
|
@@ -569,15 +572,41 @@ where
|
|
|
569
572
|
};
|
|
570
573
|
let template_uid = template_identity.template_id.clone();
|
|
571
574
|
|
|
572
|
-
//
|
|
573
|
-
//
|
|
574
|
-
let
|
|
575
|
+
// Capture the bundle alongside the type at the original definition point.
|
|
576
|
+
// LEPUS calls pass it separately without allocating a descriptor per template.
|
|
577
|
+
let bundle_expr = if matches!(self.cfg.is_external_bundle, Some(true))
|
|
575
578
|
&& !matches!(self.cfg.is_dynamic_component, Some(true))
|
|
576
579
|
{
|
|
577
|
-
quote!("
|
|
580
|
+
quote!("\"__Card__\"" as Expr)
|
|
578
581
|
} else {
|
|
579
|
-
quote!("
|
|
582
|
+
quote!("globDynamicComponentEntry" as Expr)
|
|
580
583
|
};
|
|
584
|
+
let bundle_expr = if target == TransformTarget::LEPUS {
|
|
585
|
+
if is_new_template {
|
|
586
|
+
let bundle_ident = private_ident!(format!("{}_bundle", template_uid));
|
|
587
|
+
self.current_template_defs.push(ModuleItem::Stmt(quote!(
|
|
588
|
+
"const $bundle_ident = $bundle_expr" as Stmt,
|
|
589
|
+
bundle_ident = bundle_ident.clone(),
|
|
590
|
+
bundle_expr: Expr = bundle_expr,
|
|
591
|
+
)));
|
|
592
|
+
self.host_identities.insert(
|
|
593
|
+
template_ident.to_id(),
|
|
594
|
+
(
|
|
595
|
+
template_uid.clone(),
|
|
596
|
+
bundle_ident,
|
|
597
|
+
attr_plan_slots.is_empty(),
|
|
598
|
+
),
|
|
599
|
+
);
|
|
600
|
+
}
|
|
601
|
+
Expr::Ident(self.host_identities[&template_ident.to_id()].1.clone())
|
|
602
|
+
} else {
|
|
603
|
+
bundle_expr
|
|
604
|
+
};
|
|
605
|
+
let entry_template_uid = quote!(
|
|
606
|
+
"`${$bundle}:${$template_uid}`" as Expr,
|
|
607
|
+
bundle: Expr = bundle_expr,
|
|
608
|
+
template_uid: Expr = Expr::Lit(Lit::Str(template_uid.clone().into())),
|
|
609
|
+
);
|
|
581
610
|
|
|
582
611
|
if is_new_template {
|
|
583
612
|
let entry_template_uid_def = ModuleItem::Stmt(quote!(
|
|
@@ -688,6 +717,13 @@ where
|
|
|
688
717
|
}
|
|
689
718
|
|
|
690
719
|
n.visit_mut_children_with(self);
|
|
720
|
+
if !self.host_identities.is_empty() {
|
|
721
|
+
n.visit_mut_with(&mut host_lowering::HostLowering {
|
|
722
|
+
identities: &self.host_identities,
|
|
723
|
+
runtime: self.internal_runtime_id.clone(),
|
|
724
|
+
comments: &self.comments,
|
|
725
|
+
});
|
|
726
|
+
}
|
|
691
727
|
self.ensure_builtin_element_templates();
|
|
692
728
|
if let Some(Expr::Ident(runtime_id)) = Lazy::get(&self.runtime_id) {
|
|
693
729
|
prepend_stmt(
|
|
@@ -101,20 +101,52 @@ where
|
|
|
101
101
|
}));
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
104
|
+
// LEPUS consumes slots in numeric order once, without background reconciliation.
|
|
105
|
+
// Keep named slot props for JS/MIXED, whose VNodes are also used by Preact.
|
|
106
|
+
if target == TransformTarget::LEPUS && !dynamic_children.is_empty() {
|
|
107
|
+
let mut slot_children: Vec<Option<ExprOrSpread>> = vec![];
|
|
108
|
+
for dynamic_child in dynamic_children {
|
|
109
|
+
let (slot_index, expr) = match dynamic_child {
|
|
110
|
+
DynamicElementPart::Slot(expr, idx) | DynamicElementPart::ListSlot(expr, idx) => {
|
|
111
|
+
(idx, expr)
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
let index = usize::try_from(slot_index).expect("ET child slot index must be non-negative");
|
|
115
|
+
if slot_children.len() <= index {
|
|
116
|
+
slot_children.resize_with(index + 1, || None);
|
|
108
117
|
}
|
|
109
|
-
|
|
118
|
+
slot_children[index] = Some(ExprOrSpread {
|
|
119
|
+
spread: None,
|
|
120
|
+
expr: Box::new(expr),
|
|
121
|
+
});
|
|
122
|
+
}
|
|
110
123
|
rendered_attrs.push(JSXAttrOrSpread::JSXAttr(JSXAttr {
|
|
111
124
|
span: DUMMY_SP,
|
|
112
|
-
name: JSXAttrName::Ident(IdentName::new(
|
|
125
|
+
name: JSXAttrName::Ident(IdentName::new("slotChildren".into(), DUMMY_SP)),
|
|
113
126
|
value: Some(JSXAttrValue::JSXExprContainer(JSXExprContainer {
|
|
114
127
|
span: DUMMY_SP,
|
|
115
|
-
expr: JSXExpr::Expr(Box::new(
|
|
128
|
+
expr: JSXExpr::Expr(Box::new(Expr::Array(ArrayLit {
|
|
129
|
+
span: DUMMY_SP,
|
|
130
|
+
elems: slot_children,
|
|
131
|
+
}))),
|
|
116
132
|
})),
|
|
117
133
|
}));
|
|
134
|
+
} else {
|
|
135
|
+
for dynamic_child in dynamic_children {
|
|
136
|
+
let (slot_index, expr) = match dynamic_child {
|
|
137
|
+
DynamicElementPart::Slot(expr, idx) | DynamicElementPart::ListSlot(expr, idx) => {
|
|
138
|
+
(idx, expr)
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
rendered_attrs.push(JSXAttrOrSpread::JSXAttr(JSXAttr {
|
|
142
|
+
span: DUMMY_SP,
|
|
143
|
+
name: JSXAttrName::Ident(IdentName::new(format!("${}", slot_index).into(), DUMMY_SP)),
|
|
144
|
+
value: Some(JSXAttrValue::JSXExprContainer(JSXExprContainer {
|
|
145
|
+
span: DUMMY_SP,
|
|
146
|
+
expr: JSXExpr::Expr(Box::new(expr)),
|
|
147
|
+
})),
|
|
148
|
+
}));
|
|
149
|
+
}
|
|
118
150
|
}
|
|
119
151
|
|
|
120
152
|
LoweredRuntimeJsx {
|
|
@@ -3,7 +3,7 @@ source: packages/react/transform/crates/swc_plugin_element_template/tests/elemen
|
|
|
3
3
|
expression: "serde_json::json!({\n \"code\": code, \"templates\": template_snapshot_json(&templates),\n})"
|
|
4
4
|
---
|
|
5
5
|
{
|
|
6
|
-
"code": "import * as ReactLynx from \"@lynx-js/react\";\nconst _et_d5a51fb4f19d = `${
|
|
6
|
+
"code": "import * as ReactLynxInternal from \"@lynx-js/react/internal\";\nimport * as ReactLynx from \"@lynx-js/react\";\nconst _et_d5a51fb4f19d_bundle = globDynamicComponentEntry;\nconst _et_d5a51fb4f19d = `${_et_d5a51fb4f19d_bundle}:${\"_et_d5a51fb4f19d\"}`;\nReactLynxInternal.__etHost(_et_d5a51fb4f19d, \"_et_d5a51fb4f19d\", _et_d5a51fb4f19d_bundle, void 0, [\n dynamicId,\n value\n], void 0, void 0, true);\n",
|
|
7
7
|
"templates": [
|
|
8
8
|
{
|
|
9
9
|
"template_id": "_et_d5a51fb4f19d",
|
|
@@ -3,7 +3,7 @@ source: packages/react/transform/crates/swc_plugin_element_template/tests/elemen
|
|
|
3
3
|
expression: "serde_json::json!({\n \"code\": code, \"templates\": template_snapshot_json(&templates),\n})"
|
|
4
4
|
---
|
|
5
5
|
{
|
|
6
|
-
"code": "import * as ReactLynx from \"@lynx-js/react\";\nconst _et_7fa05c65429d = `${
|
|
6
|
+
"code": "import * as ReactLynxInternal from \"@lynx-js/react/internal\";\nimport * as ReactLynx from \"@lynx-js/react\";\nconst _et_7fa05c65429d_bundle = globDynamicComponentEntry;\nconst _et_7fa05c65429d = `${_et_7fa05c65429d_bundle}:${\"_et_7fa05c65429d\"}`;\nfunction App() {\n const attrs = __BACKGROUND__ ? {\n 0: {\n id: 'b'\n },\n 2: {\n data: 'extra'\n }\n } : {\n 0: {\n id: 'a'\n },\n 1: {\n title: 'main'\n }\n };\n return (ReactLynxInternal.__etHost(_et_7fa05c65429d, \"_et_7fa05c65429d\", _et_7fa05c65429d_bundle, void 0, [\n attrs,\n attrs\n ], void 0, void 0, true));\n}\n",
|
|
7
7
|
"templates": [
|
|
8
8
|
{
|
|
9
9
|
"template_id": "_et_7fa05c65429d",
|
|
@@ -3,7 +3,7 @@ source: packages/react/transform/crates/swc_plugin_element_template/tests/elemen
|
|
|
3
3
|
expression: "serde_json::json!({\n \"code\": code, \"templates\": template_snapshot_json(&templates),\n})"
|
|
4
4
|
---
|
|
5
5
|
{
|
|
6
|
-
"code": "import * as ReactLynx from \"@lynx-js/react\";\nconst _et_30f1eb7cba92 = `${
|
|
6
|
+
"code": "import * as ReactLynxInternal from \"@lynx-js/react/internal\";\nimport * as ReactLynx from \"@lynx-js/react\";\nconst _et_30f1eb7cba92_bundle = globDynamicComponentEntry;\nconst _et_30f1eb7cba92 = `${_et_30f1eb7cba92_bundle}:${\"_et_30f1eb7cba92\"}`;\nReactLynxInternal.__etHost(_et_30f1eb7cba92, \"_et_30f1eb7cba92\", _et_30f1eb7cba92_bundle, void 0, void 0, void 0, void 0, true);\n",
|
|
7
7
|
"templates": [
|
|
8
8
|
{
|
|
9
9
|
"template_id": "_et_30f1eb7cba92",
|
|
@@ -3,7 +3,7 @@ source: packages/react/transform/crates/swc_plugin_element_template/tests/elemen
|
|
|
3
3
|
expression: "serde_json::json!({\n \"code\": code, \"templates\": template_snapshot_json(&templates),\n})"
|
|
4
4
|
---
|
|
5
5
|
{
|
|
6
|
-
"code": "import * as ReactLynx from \"@lynx-js/react\";\nconst _et_47f338e2f09c = `${
|
|
6
|
+
"code": "import * as ReactLynxInternal from \"@lynx-js/react/internal\";\nimport * as ReactLynx from \"@lynx-js/react\";\nconst _et_47f338e2f09c_bundle = globDynamicComponentEntry;\nconst _et_47f338e2f09c = `${_et_47f338e2f09c_bundle}:${\"_et_47f338e2f09c\"}`;\nReactLynxInternal.__etHost(_et_47f338e2f09c, \"_et_47f338e2f09c\", _et_47f338e2f09c_bundle, void 0, void 0, void 0, void 0, true);\n",
|
|
7
7
|
"templates": [
|
|
8
8
|
{
|
|
9
9
|
"template_id": "_et_47f338e2f09c",
|
|
@@ -3,7 +3,7 @@ source: packages/react/transform/crates/swc_plugin_element_template/tests/elemen
|
|
|
3
3
|
expression: "serde_json::json!({\n \"code\": code, \"templates\": template_snapshot_json(&templates),\n})"
|
|
4
4
|
---
|
|
5
5
|
{
|
|
6
|
-
"code": "import * as ReactLynx from \"@lynx-js/react\";\nconst _et_18716c005f6f = `${
|
|
6
|
+
"code": "import * as ReactLynxInternal from \"@lynx-js/react/internal\";\nimport * as ReactLynx from \"@lynx-js/react\";\nconst _et_18716c005f6f_bundle = globDynamicComponentEntry;\nconst _et_18716c005f6f = `${_et_18716c005f6f_bundle}:${\"_et_18716c005f6f\"}`;\nReactLynxInternal.__etHost(_et_18716c005f6f, \"_et_18716c005f6f\", _et_18716c005f6f_bundle, void 0, void 0, void 0, void 0, true);\n",
|
|
7
7
|
"templates": [
|
|
8
8
|
{
|
|
9
9
|
"template_id": "_et_18716c005f6f",
|
|
@@ -3,7 +3,7 @@ source: packages/react/transform/crates/swc_plugin_element_template/tests/elemen
|
|
|
3
3
|
expression: "serde_json::json!({\n \"code\": code, \"templates\": template_snapshot_json(&templates),\n})"
|
|
4
4
|
---
|
|
5
5
|
{
|
|
6
|
-
"code": "import * as ReactLynx from \"@lynx-js/react\";\nconst _et_efe140538def = `${
|
|
6
|
+
"code": "import * as ReactLynxInternal from \"@lynx-js/react/internal\";\nimport * as ReactLynx from \"@lynx-js/react\";\nconst _et_efe140538def_bundle = globDynamicComponentEntry;\nconst _et_efe140538def = `${_et_efe140538def_bundle}:${\"_et_efe140538def\"}`;\nconst _et_955a06fee137_bundle = globDynamicComponentEntry;\nconst _et_955a06fee137 = `${_et_955a06fee137_bundle}:${\"_et_955a06fee137\"}`;\nReactLynxInternal.__etHost(_et_955a06fee137, \"_et_955a06fee137\", _et_955a06fee137_bundle, void 0, void 0, [\n <Outer title={title}>\n <Middle enabled={enabled}>\n <Inner count={count}>\n {ReactLynxInternal.__etHost(_et_efe140538def, \"_et_efe140538def\", _et_efe140538def_bundle, void 0, void 0, void 0, void 0, true)}\n </Inner>\n </Middle>\n </Outer>\n], void 0, true);\n",
|
|
7
7
|
"templates": [
|
|
8
8
|
{
|
|
9
9
|
"template_id": "_et_efe140538def",
|
|
@@ -3,7 +3,7 @@ source: packages/react/transform/crates/swc_plugin_element_template/tests/elemen
|
|
|
3
3
|
expression: "serde_json::json!({\n \"code\": code, \"templates\": template_snapshot_json(&templates),\n})"
|
|
4
4
|
---
|
|
5
5
|
{
|
|
6
|
-
"code": "import * as ReactLynx from \"@lynx-js/react\";\nconst _et_512af556d201 = `${
|
|
6
|
+
"code": "import * as ReactLynxInternal from \"@lynx-js/react/internal\";\nimport * as ReactLynx from \"@lynx-js/react\";\nconst _et_512af556d201_bundle = globDynamicComponentEntry;\nconst _et_512af556d201 = `${_et_512af556d201_bundle}:${\"_et_512af556d201\"}`;\nReactLynxInternal.__etHost(_et_512af556d201, \"_et_512af556d201\", _et_512af556d201_bundle, void 0, [\n dynamicClass\n], void 0, void 0, true);\n",
|
|
7
7
|
"templates": [
|
|
8
8
|
{
|
|
9
9
|
"template_id": "_et_512af556d201",
|
|
@@ -3,7 +3,7 @@ source: packages/react/transform/crates/swc_plugin_element_template/tests/elemen
|
|
|
3
3
|
expression: "serde_json::json!({\n \"code\": code, \"templates\": template_snapshot_json(&templates),\n})"
|
|
4
4
|
---
|
|
5
5
|
{
|
|
6
|
-
"code": "import * as ReactLynxInternal from \"@lynx-js/react/internal\";\nimport * as ReactLynx from \"@lynx-js/react\";\nconst _et_22fa50e6e3b9 = `${
|
|
6
|
+
"code": "import * as ReactLynxInternal from \"@lynx-js/react/internal\";\nimport * as ReactLynx from \"@lynx-js/react\";\nconst _et_22fa50e6e3b9_bundle = globDynamicComponentEntry;\nconst _et_22fa50e6e3b9 = `${_et_22fa50e6e3b9_bundle}:${\"_et_22fa50e6e3b9\"}`;\nReactLynxInternal.__etAttrPlanMap[_et_22fa50e6e3b9] = [\n 0,\n ReactLynxInternal.adaptEventAttrSlot,\n 1,\n ReactLynxInternal.adaptEventAttrSlot\n];\nReactLynxInternal.__etHost(_et_22fa50e6e3b9, \"_et_22fa50e6e3b9\", _et_22fa50e6e3b9_bundle, void 0, [\n 1,\n 1\n], void 0, void 0);\n",
|
|
7
7
|
"templates": [
|
|
8
8
|
{
|
|
9
9
|
"template_id": "_et_22fa50e6e3b9",
|
|
@@ -3,7 +3,7 @@ source: packages/react/transform/crates/swc_plugin_element_template/tests/elemen
|
|
|
3
3
|
expression: "serde_json::json!({\n \"code\": code, \"templates\": template_snapshot_json(&templates),\n})"
|
|
4
4
|
---
|
|
5
5
|
{
|
|
6
|
-
"code": "import * as ReactLynx from \"@lynx-js/react\";\nconst _et_ea6d5e931fea = `${
|
|
6
|
+
"code": "import * as ReactLynxInternal from \"@lynx-js/react/internal\";\nimport * as ReactLynx from \"@lynx-js/react\";\nconst _et_ea6d5e931fea_bundle = globDynamicComponentEntry;\nconst _et_ea6d5e931fea = `${_et_ea6d5e931fea_bundle}:${\"_et_ea6d5e931fea\"}`;\nReactLynxInternal.__etHost(_et_ea6d5e931fea, \"_et_ea6d5e931fea\", _et_ea6d5e931fea_bundle, void 0, [\n dynamicId\n], void 0, void 0, true);\n",
|
|
7
7
|
"templates": [
|
|
8
8
|
{
|
|
9
9
|
"template_id": "_et_ea6d5e931fea",
|
|
@@ -3,7 +3,7 @@ source: packages/react/transform/crates/swc_plugin_element_template/tests/elemen
|
|
|
3
3
|
expression: "serde_json::json!({\n \"code\": code, \"templates\": template_snapshot_json(&templates),\n})"
|
|
4
4
|
---
|
|
5
5
|
{
|
|
6
|
-
"code": "import * as ReactLynx from \"@lynx-js/react\";\nconst _et_ada2059ce2a3 = `${
|
|
6
|
+
"code": "import * as ReactLynxInternal from \"@lynx-js/react/internal\";\nimport * as ReactLynx from \"@lynx-js/react\";\nconst _et_ada2059ce2a3_bundle = globDynamicComponentEntry;\nconst _et_ada2059ce2a3 = `${_et_ada2059ce2a3_bundle}:${\"_et_ada2059ce2a3\"}`;\nReactLynxInternal.__etHost(_et_ada2059ce2a3, \"_et_ada2059ce2a3\", _et_ada2059ce2a3_bundle, void 0, [\n {\n color: dynamicColor\n }\n], void 0, void 0, true);\n",
|
|
7
7
|
"templates": [
|
|
8
8
|
{
|
|
9
9
|
"template_id": "_et_ada2059ce2a3",
|
|
@@ -3,7 +3,7 @@ source: packages/react/transform/crates/swc_plugin_element_template/tests/elemen
|
|
|
3
3
|
expression: "serde_json::json!({\n \"code\": code, \"templates\": template_snapshot_json(&templates),\n})"
|
|
4
4
|
---
|
|
5
5
|
{
|
|
6
|
-
"code": "import * as ReactLynx from \"@lynx-js/react\";\nconst _et_895419ad7379 = `${
|
|
6
|
+
"code": "import * as ReactLynxInternal from \"@lynx-js/react/internal\";\nimport * as ReactLynx from \"@lynx-js/react\";\nconst _et_895419ad7379_bundle = globDynamicComponentEntry;\nconst _et_895419ad7379 = `${_et_895419ad7379_bundle}:${\"_et_895419ad7379\"}`;\nconst _et_856cbd06f956_bundle = globDynamicComponentEntry;\nconst _et_856cbd06f956 = `${_et_856cbd06f956_bundle}:${\"_et_856cbd06f956\"}`;\nReactLynxInternal.__etHost(_et_856cbd06f956, \"_et_856cbd06f956\", _et_856cbd06f956_bundle, void 0, void 0, [\n items,\n items.map((item)=>ReactLynxInternal.__etHost(_et_895419ad7379, \"_et_895419ad7379\", _et_895419ad7379_bundle, void 0, void 0, [\n item\n ], void 0, true))\n], void 0, true);\n",
|
|
7
7
|
"templates": [
|
|
8
8
|
{
|
|
9
9
|
"template_id": "_et_895419ad7379",
|
|
@@ -3,7 +3,7 @@ source: packages/react/transform/crates/swc_plugin_element_template/tests/elemen
|
|
|
3
3
|
expression: "serde_json::json!({\n \"code\": code, \"templates\": template_snapshot_json(&templates),\n})"
|
|
4
4
|
---
|
|
5
5
|
{
|
|
6
|
-
"code": "import * as ReactLynx from \"@lynx-js/react\";\nconst _et_9cf18739ee28 = `${
|
|
6
|
+
"code": "import * as ReactLynxInternal from \"@lynx-js/react/internal\";\nimport * as ReactLynx from \"@lynx-js/react\";\nconst _et_9cf18739ee28_bundle = globDynamicComponentEntry;\nconst _et_9cf18739ee28 = `${_et_9cf18739ee28_bundle}:${\"_et_9cf18739ee28\"}`;\nReactLynxInternal.__etHost(_et_9cf18739ee28, \"_et_9cf18739ee28\", _et_9cf18739ee28_bundle, void 0, void 0, [\n dynamicPart\n], void 0, true);\n",
|
|
7
7
|
"templates": [
|
|
8
8
|
{
|
|
9
9
|
"template_id": "_et_9cf18739ee28",
|
|
@@ -3,7 +3,7 @@ source: packages/react/transform/crates/swc_plugin_element_template/tests/elemen
|
|
|
3
3
|
expression: "serde_json::json!({\n \"code\": code, \"templates\": template_snapshot_json(&templates),\n})"
|
|
4
4
|
---
|
|
5
5
|
{
|
|
6
|
-
"code": "import * as ReactLynx from \"@lynx-js/react\";\nconst _et_895419ad7379 = `${
|
|
6
|
+
"code": "import * as ReactLynxInternal from \"@lynx-js/react/internal\";\nimport * as ReactLynx from \"@lynx-js/react\";\nconst _et_895419ad7379_bundle = globDynamicComponentEntry;\nconst _et_895419ad7379 = `${_et_895419ad7379_bundle}:${\"_et_895419ad7379\"}`;\nconst _et_f2aabcaaedd9_bundle = globDynamicComponentEntry;\nconst _et_f2aabcaaedd9 = `${_et_f2aabcaaedd9_bundle}:${\"_et_f2aabcaaedd9\"}`;\nconst _et_e77326ea5636_bundle = globDynamicComponentEntry;\nconst _et_e77326ea5636 = `${_et_e77326ea5636_bundle}:${\"_et_e77326ea5636\"}`;\nReactLynxInternal.__etHost(_et_e77326ea5636, \"_et_e77326ea5636\", _et_e77326ea5636_bundle, void 0, void 0, [\n items.map((item)=>ReactLynxInternal.__etHost(_et_895419ad7379, \"_et_895419ad7379\", _et_895419ad7379_bundle, void 0, void 0, [\n item\n ], void 0, true)),\n showCopyright && ReactLynxInternal.__etHost(_et_f2aabcaaedd9, \"_et_f2aabcaaedd9\", _et_f2aabcaaedd9_bundle, void 0, void 0, void 0, void 0, true)\n], void 0, true);\n",
|
|
7
7
|
"templates": [
|
|
8
8
|
{
|
|
9
9
|
"template_id": "_et_895419ad7379",
|
|
@@ -3,7 +3,7 @@ source: packages/react/transform/crates/swc_plugin_element_template/tests/elemen
|
|
|
3
3
|
expression: "serde_json::json!({\n \"code\": code, \"templates\": template_snapshot_json(&templates),\n})"
|
|
4
4
|
---
|
|
5
5
|
{
|
|
6
|
-
"code": "import * as ReactLynxInternal from \"@lynx-js/react/internal\";\nimport * as ReactLynx from \"@lynx-js/react\";\nconst _et_c5232cf7d7c7 = `${
|
|
6
|
+
"code": "import * as ReactLynxInternal from \"@lynx-js/react/internal\";\nimport * as ReactLynx from \"@lynx-js/react\";\nconst _et_c5232cf7d7c7_bundle = globDynamicComponentEntry;\nconst _et_c5232cf7d7c7 = `${_et_c5232cf7d7c7_bundle}:${\"_et_c5232cf7d7c7\"}`;\nReactLynxInternal.__etAttrPlanMap[_et_c5232cf7d7c7] = [\n 0,\n ReactLynxInternal.adaptRefAttrSlot\n];\nReactLynxInternal.__etHost(_et_c5232cf7d7c7, \"_et_c5232cf7d7c7\", _et_c5232cf7d7c7_bundle, void 0, [\n 1\n], void 0, void 0);\n",
|
|
7
7
|
"templates": [
|
|
8
8
|
{
|
|
9
9
|
"template_id": "_et_c5232cf7d7c7",
|
|
@@ -3,7 +3,7 @@ source: packages/react/transform/crates/swc_plugin_element_template/tests/elemen
|
|
|
3
3
|
expression: "serde_json::json!({\n \"code\": code, \"templates\": template_snapshot_json(&templates),\n})"
|
|
4
4
|
---
|
|
5
5
|
{
|
|
6
|
-
"code": "import * as ReactLynx from \"@lynx-js/react\";\nconst _et_1d658c77caa0 = `${
|
|
6
|
+
"code": "import * as ReactLynxInternal from \"@lynx-js/react/internal\";\nimport * as ReactLynx from \"@lynx-js/react\";\nconst _et_1d658c77caa0_bundle = globDynamicComponentEntry;\nconst _et_1d658c77caa0 = `${_et_1d658c77caa0_bundle}:${\"_et_1d658c77caa0\"}`;\nconst _et_f4df0f2dba8f_bundle = globDynamicComponentEntry;\nconst _et_f4df0f2dba8f = `${_et_f4df0f2dba8f_bundle}:${\"_et_f4df0f2dba8f\"}`;\nconst _et_955a06fee137_bundle = globDynamicComponentEntry;\nconst _et_955a06fee137 = `${_et_955a06fee137_bundle}:${\"_et_955a06fee137\"}`;\nReactLynxInternal.__etHost(_et_955a06fee137, \"_et_955a06fee137\", _et_955a06fee137_bundle, void 0, void 0, [\n [\n <Component>\n {ReactLynxInternal.__etHost(_et_1d658c77caa0, \"_et_1d658c77caa0\", _et_1d658c77caa0_bundle, void 0, void 0, void 0, void 0, true)}\n </Component>,\n <Component>\n {ReactLynxInternal.__etHost(_et_f4df0f2dba8f, \"_et_f4df0f2dba8f\", _et_f4df0f2dba8f_bundle, void 0, void 0, void 0, void 0, true)}\n </Component>\n ]\n], void 0, true);\n",
|
|
7
7
|
"templates": [
|
|
8
8
|
{
|
|
9
9
|
"template_id": "_et_1d658c77caa0",
|
|
@@ -3,7 +3,7 @@ source: packages/react/transform/crates/swc_plugin_element_template/tests/elemen
|
|
|
3
3
|
expression: "serde_json::json!({\n \"code\": code, \"templates\": template_snapshot_json(&templates),\n})"
|
|
4
4
|
---
|
|
5
5
|
{
|
|
6
|
-
"code": "import * as ReactLynxInternal from \"@lynx-js/react/internal\";\nimport * as ReactLynx from \"@lynx-js/react\";\nconst _et_9982b477067b = `${
|
|
6
|
+
"code": "import * as ReactLynxInternal from \"@lynx-js/react/internal\";\nimport * as ReactLynx from \"@lynx-js/react\";\nconst _et_9982b477067b_bundle = globDynamicComponentEntry;\nconst _et_9982b477067b = `${_et_9982b477067b_bundle}:${\"_et_9982b477067b\"}`;\nReactLynxInternal.__etAttrPlanMap[_et_9982b477067b] = [\n 0,\n ReactLynxInternal.adaptSpreadAttrSlot\n];\nReactLynxInternal.__etHost(_et_9982b477067b, \"_et_9982b477067b\", _et_9982b477067b_bundle, void 0, [\n props\n], void 0, void 0);\n",
|
|
7
7
|
"templates": [
|
|
8
8
|
{
|
|
9
9
|
"template_id": "_et_9982b477067b",
|
|
@@ -3,7 +3,7 @@ source: packages/react/transform/crates/swc_plugin_element_template/tests/elemen
|
|
|
3
3
|
expression: "serde_json::json!({\n \"code\": code, \"templates\": template_snapshot_json(&templates),\n})"
|
|
4
4
|
---
|
|
5
5
|
{
|
|
6
|
-
"code": "import * as ReactLynx from \"@lynx-js/react\";\nconst _et_b2f62f2ab913 = `${
|
|
6
|
+
"code": "import * as ReactLynxInternal from \"@lynx-js/react/internal\";\nimport * as ReactLynx from \"@lynx-js/react\";\nconst _et_b2f62f2ab913_bundle = globDynamicComponentEntry;\nconst _et_b2f62f2ab913 = `${_et_b2f62f2ab913_bundle}:${\"_et_b2f62f2ab913\"}`;\nconst _et_955a06fee137_bundle = globDynamicComponentEntry;\nconst _et_955a06fee137 = `${_et_955a06fee137_bundle}:${\"_et_955a06fee137\"}`;\nReactLynxInternal.__etHost(_et_955a06fee137, \"_et_955a06fee137\", _et_955a06fee137_bundle, void 0, void 0, [\n <Component id={1}>\n {ReactLynxInternal.__etHost(_et_b2f62f2ab913, \"_et_b2f62f2ab913\", _et_b2f62f2ab913_bundle, void 0, void 0, void 0, void 0, true)}\n </Component>\n], void 0, true);\n",
|
|
7
7
|
"templates": [
|
|
8
8
|
{
|
|
9
9
|
"template_id": "_et_b2f62f2ab913",
|
|
@@ -3,7 +3,7 @@ source: packages/react/transform/crates/swc_plugin_element_template/tests/elemen
|
|
|
3
3
|
expression: "serde_json::json!({\n \"code\": code, \"templates\": template_snapshot_json(&templates),\n})"
|
|
4
4
|
---
|
|
5
5
|
{
|
|
6
|
-
"code": "import * as ReactLynx from \"@lynx-js/react\";\nconst _et_4f3247135c8b = `${
|
|
6
|
+
"code": "import * as ReactLynxInternal from \"@lynx-js/react/internal\";\nimport * as ReactLynx from \"@lynx-js/react\";\nconst _et_4f3247135c8b_bundle = globDynamicComponentEntry;\nconst _et_4f3247135c8b = `${_et_4f3247135c8b_bundle}:${\"_et_4f3247135c8b\"}`;\nReactLynxInternal.__etHost(_et_4f3247135c8b, \"_et_4f3247135c8b\", _et_4f3247135c8b_bundle, void 0, void 0, [\n [\n \"a\",\n \"b\"\n ],\n [\n \"c\",\n \"d\"\n ]\n], void 0, true);\n",
|
|
7
7
|
"templates": [
|
|
8
8
|
{
|
|
9
9
|
"template_id": "_et_4f3247135c8b",
|
|
@@ -3,7 +3,7 @@ source: packages/react/transform/crates/swc_plugin_element_template/tests/elemen
|
|
|
3
3
|
expression: "serde_json::json!({\n \"code\": code, \"templates\": template_snapshot_json(&templates),\n})"
|
|
4
4
|
---
|
|
5
5
|
{
|
|
6
|
-
"code": "import * as ReactLynxInternal from \"@lynx-js/react/internal\";\nimport * as ReactLynx from \"@lynx-js/react\";\nconst _et_8f7efeb63f22 = `${
|
|
6
|
+
"code": "import * as ReactLynxInternal from \"@lynx-js/react/internal\";\nimport * as ReactLynx from \"@lynx-js/react\";\nconst _et_8f7efeb63f22_bundle = globDynamicComponentEntry;\nconst _et_8f7efeb63f22 = `${_et_8f7efeb63f22_bundle}:${\"_et_8f7efeb63f22\"}`;\nReactLynxInternal.__etAttrPlanMap[_et_8f7efeb63f22] = [\n 1,\n ReactLynxInternal.adaptSpreadAttrSlot,\n 2,\n ReactLynxInternal.adaptEventAttrSlot,\n 3,\n ReactLynxInternal.adaptRefAttrSlot\n];\nReactLynxInternal.__etHost(_et_8f7efeb63f22, \"_et_8f7efeb63f22\", _et_8f7efeb63f22_bundle, void 0, [\n dynamicId,\n props,\n 1,\n 1\n], void 0, void 0);\n",
|
|
7
7
|
"templates": [
|
|
8
8
|
{
|
|
9
9
|
"template_id": "_et_8f7efeb63f22",
|
|
@@ -3,7 +3,7 @@ source: packages/react/transform/crates/swc_plugin_element_template/tests/elemen
|
|
|
3
3
|
expression: "serde_json::json!({\n \"code\": code, \"templates\": template_snapshot_json(&templates),\n})"
|
|
4
4
|
---
|
|
5
5
|
{
|
|
6
|
-
"code": "import * as ReactLynx from \"@lynx-js/react\";\nconst _et_3fb8e0b93073 = `${
|
|
6
|
+
"code": "import * as ReactLynxInternal from \"@lynx-js/react/internal\";\nimport * as ReactLynx from \"@lynx-js/react\";\nconst _et_3fb8e0b93073_bundle = globDynamicComponentEntry;\nconst _et_3fb8e0b93073 = `${_et_3fb8e0b93073_bundle}:${\"_et_3fb8e0b93073\"}`;\nReactLynxInternal.__etHost(_et_3fb8e0b93073, \"_et_3fb8e0b93073\", _et_3fb8e0b93073_bundle, void 0, void 0, void 0, void 0, true);\n",
|
|
7
7
|
"templates": [
|
|
8
8
|
{
|
|
9
9
|
"template_id": "_et_3fb8e0b93073",
|
|
@@ -3,7 +3,7 @@ source: packages/react/transform/crates/swc_plugin_element_template/tests/elemen
|
|
|
3
3
|
expression: "serde_json::json!({\n \"code\": code, \"templates\": template_snapshot_json(&templates),\n})"
|
|
4
4
|
---
|
|
5
5
|
{
|
|
6
|
-
"code": "import * as ReactLynx from \"@lynx-js/react\";\nconst _et_f47c3e863a57 = `${
|
|
6
|
+
"code": "import * as ReactLynxInternal from \"@lynx-js/react/internal\";\nimport * as ReactLynx from \"@lynx-js/react\";\nconst _et_f47c3e863a57_bundle = globDynamicComponentEntry;\nconst _et_f47c3e863a57 = `${_et_f47c3e863a57_bundle}:${\"_et_f47c3e863a57\"}`;\nReactLynxInternal.__etHost(_et_f47c3e863a57, \"_et_f47c3e863a57\", _et_f47c3e863a57_bundle, void 0, void 0, void 0, void 0, true);\n",
|
|
7
7
|
"templates": [
|
|
8
8
|
{
|
|
9
9
|
"template_id": "_et_f47c3e863a57",
|
|
@@ -3,7 +3,7 @@ source: packages/react/transform/crates/swc_plugin_element_template/tests/elemen
|
|
|
3
3
|
expression: "serde_json::json!({\n \"code\": code, \"templates\": template_snapshot_json(&templates),\n})"
|
|
4
4
|
---
|
|
5
5
|
{
|
|
6
|
-
"code": "import * as ReactLynx from \"@lynx-js/react\";\nconst _et_afd0a7c03a98 = `${
|
|
6
|
+
"code": "import * as ReactLynxInternal from \"@lynx-js/react/internal\";\nimport * as ReactLynx from \"@lynx-js/react\";\nconst _et_afd0a7c03a98_bundle = globDynamicComponentEntry;\nconst _et_afd0a7c03a98 = `${_et_afd0a7c03a98_bundle}:${\"_et_afd0a7c03a98\"}`;\nReactLynxInternal.__etHost(_et_afd0a7c03a98, \"_et_afd0a7c03a98\", _et_afd0a7c03a98_bundle, void 0, [\n dynamicId,\n url\n], void 0, void 0, true);\n",
|
|
7
7
|
"templates": [
|
|
8
8
|
{
|
|
9
9
|
"template_id": "_et_afd0a7c03a98",
|
|
@@ -3,7 +3,7 @@ source: packages/react/transform/crates/swc_plugin_element_template/tests/elemen
|
|
|
3
3
|
expression: "serde_json::json!({\n \"code\": code, \"templates\": template_snapshot_json(&templates),\n})"
|
|
4
4
|
---
|
|
5
5
|
{
|
|
6
|
-
"code": "import * as ReactLynx from \"@lynx-js/react\";\nconst _et_fe1c4dce9e2b = `${
|
|
6
|
+
"code": "import * as ReactLynxInternal from \"@lynx-js/react/internal\";\nimport * as ReactLynx from \"@lynx-js/react\";\nconst _et_fe1c4dce9e2b_bundle = globDynamicComponentEntry;\nconst _et_fe1c4dce9e2b = `${_et_fe1c4dce9e2b_bundle}:${\"_et_fe1c4dce9e2b\"}`;\nReactLynxInternal.__etHost(_et_fe1c4dce9e2b, \"_et_fe1c4dce9e2b\", _et_fe1c4dce9e2b_bundle, void 0, [\n dynamicText\n], [\n dynamicText2\n], void 0, true);\n",
|
|
7
7
|
"templates": [
|
|
8
8
|
{
|
|
9
9
|
"template_id": "_et_fe1c4dce9e2b",
|