@lynx-js/react 0.125.0 → 0.126.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +63 -0
- package/LICENSE +202 -0
- package/components/.gitignore +3 -0
- package/components/.npmignore +5 -0
- package/components/lib/Page.js +4 -2
- package/components/lib/Page.js.map +1 -1
- package/components/src/Page.ts +4 -2
- package/components/tsconfig.json +17 -0
- package/components/tsconfig.tsbuildinfo +1 -0
- package/package.json +6 -2
- package/refresh/.gitignore +1 -0
- package/refresh/.npmignore +3 -0
- package/refresh/.turbo/turbo-build.log +9 -0
- package/refresh/package.json +21 -0
- package/refresh/rslib.config.ts +24 -0
- package/refresh/tsconfig.json +4 -0
- package/refresh/turbo.json +16 -0
- package/runtime/.gitignore +4 -0
- package/runtime/.npmignore +15 -0
- package/runtime/.prettierrc +6 -0
- package/runtime/.turbo/turbo-build.log +1 -0
- package/runtime/CHANGELOG.md +7 -0
- package/runtime/__test__/core/background-function.test.ts +133 -0
- package/runtime/__test__/core/commit-context.test.ts +37 -0
- package/runtime/__test__/core/forceRootRender.test.ts +65 -0
- package/runtime/__test__/core/globalProps.test.ts +141 -0
- package/runtime/__test__/core/hooks/mainThread.test.tsx +279 -0
- package/runtime/__test__/core/hooks/useLynxGlobalEventListener.test.jsx +168 -0
- package/runtime/__test__/core/lynx-data-processors.test.ts +131 -0
- package/runtime/__test__/core/lynx-page-data.test.ts +62 -0
- package/runtime/__test__/core/lynx-update-data.test.ts +97 -0
- package/runtime/__test__/core/main-thread-function.test.ts +13 -0
- package/runtime/__test__/core/main-thread-ref.test.ts +102 -0
- package/runtime/__test__/core/ref.test.ts +261 -0
- package/runtime/__test__/core/reload-version.test.ts +14 -0
- package/runtime/__test__/core/thread-function-call.test.ts +182 -0
- package/runtime/__test__/element-template/debug/alog.test.ts +214 -0
- package/runtime/__test__/element-template/debug/elementPAPICall.test.ts +157 -0
- package/runtime/__test__/element-template/debug/profile-hook.test.tsx +67 -0
- package/runtime/__test__/element-template/debug/profile-installation.test.tsx +49 -0
- package/runtime/__test__/element-template/fixtures/background/event/conditional-direct-event/index.tsx +8 -0
- package/runtime/__test__/element-template/fixtures/background/event/direct-event/index.tsx +7 -0
- package/runtime/__test__/element-template/fixtures/background/event/main-thread-direct-event/index.tsx +11 -0
- package/runtime/__test__/element-template/fixtures/background/event/main-thread-run-on-background-event/index.tsx +14 -0
- package/runtime/__test__/element-template/fixtures/background/event/spread-event/index.tsx +20 -0
- package/runtime/__test__/element-template/fixtures/background/global-props/direct-read/index.tsx +7 -0
- package/runtime/__test__/element-template/fixtures/background/global-props/event-hook/index.tsx +34 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate/_shared.tsx +584 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate/attrs.adds-background-only/case.tsx +5 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate/attrs.adds-background-only/output.txt +11 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate/attrs.aligns-ids-and-patches/case.tsx +5 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate/attrs.aligns-ids-and-patches/output.txt +12 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate/attrs.array-diff/case.tsx +5 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate/attrs.array-diff/output.txt +13 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate/attrs.batch-multiple-patches/case.tsx +5 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate/attrs.batch-multiple-patches/output.txt +12 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate/attrs.nullish-values/case.tsx +5 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate/attrs.nullish-values/output.txt +10 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate/attrs.object-value-updates/case.tsx +5 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate/attrs.object-value-updates/output.txt +13 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate/attrs.patches-nested-component/case.tsx +5 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate/attrs.patches-nested-component/output.txt +13 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate/attrs.removes-missing/case.tsx +5 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate/attrs.removes-missing/output.txt +10 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate/attrs.skips-identical/case.tsx +5 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate/attrs.skips-identical/output.txt +3 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate/attrs.style-object-updates/case.tsx +5 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate/attrs.style-object-updates/output.txt +13 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate/attrs.type-diff/case.tsx +5 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate/attrs.type-diff/output.txt +10 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate/children.creates-missing-nodes-recursively/case.tsx +5 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate/children.creates-missing-nodes-recursively/output.txt +39 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate/children.iterates-existing-slots/case.tsx +5 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate/children.iterates-existing-slots/output.txt +16 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate/children.missing-attrs-element/case.tsx +5 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate/children.missing-attrs-element/output.txt +3 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate/children.missing-slot-record-on-background/case.tsx +5 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate/children.missing-slot-record-on-background/output.txt +11 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate/children.missing-slot-record-on-main/case.tsx +5 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate/children.missing-slot-record-on-main/output.txt +16 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate/children.raw-text-instance-empty-text/case.tsx +5 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate/children.raw-text-instance-empty-text/output.txt +4 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate/coverage.emit-create-raw-text/case.tsx +5 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate/coverage.emit-create-raw-text/output.txt +12 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate/coverage.emit-create-raw-text-non-text/case.tsx +5 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate/coverage.emit-create-raw-text-non-text/output.txt +10 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate/coverage.move-before-child/case.tsx +5 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate/coverage.move-before-child/output.txt +10 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate/coverage.raw-text-key-branches/case.tsx +5 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate/coverage.raw-text-key-branches/output.txt +22 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate/full-flow.dispatches-update-event/case.tsx +5 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate/full-flow.dispatches-update-event/output.txt +5 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate/root-key-mismatch-reconciles/case.tsx +5 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate/root-key-mismatch-reconciles/output.txt +24 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate/updates-raw-text-instance-id/case.tsx +5 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate/updates-raw-text-instance-id/output.txt +5 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate-compiled/children.creates-and-inserts-new/index.tsx +14 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate-compiled/children.creates-and-inserts-new/output.txt +20 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate-compiled/children.inserts-before-existing-sibling/index.tsx +39 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate-compiled/children.inserts-before-existing-sibling/output.txt +20 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate-compiled/children.mixed-operations/index.tsx +38 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate-compiled/children.mixed-operations/output.txt +29 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate-compiled/children.moves-before-existing-sibling/index.tsx +40 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate-compiled/children.moves-before-existing-sibling/output.txt +12 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate-compiled/children.non-string-raw-text-key-on-main/index.tsx +14 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate-compiled/children.non-string-raw-text-key-on-main/output.txt +22 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate-compiled/children.removes-missing/index.tsx +14 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate-compiled/children.removes-missing/output.txt +13 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate-compiled/children.reorders-when-order-differs/index.tsx +34 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate-compiled/children.reorders-when-order-differs/output.txt +12 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate-compiled/children.reuses-by-type-ignoring-keys/index.tsx +18 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate-compiled/children.reuses-by-type-ignoring-keys/output.txt +16 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate-compiled/complex-trees.deeply-nested-dynamic-content/index.tsx +33 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate-compiled/complex-trees.deeply-nested-dynamic-content/output.txt +26 -0
- package/runtime/__test__/element-template/fixtures/background/init-data/update/index.tsx +11 -0
- package/runtime/__test__/element-template/fixtures/background/instance/_shared.ts +30 -0
- package/runtime/__test__/element-template/fixtures/background/instance/ops/does-not-emit-patch-when-attrs-reference-reused/case.ts +24 -0
- package/runtime/__test__/element-template/fixtures/background/instance/ops/does-not-emit-patch-when-attrs-reference-reused/output.txt +1 -0
- package/runtime/__test__/element-template/fixtures/background/instance/ops/emits-bundle-url-in-create-template/case.ts +11 -0
- package/runtime/__test__/element-template/fixtures/background/instance/ops/emits-bundle-url-in-create-template/output.txt +8 -0
- package/runtime/__test__/element-template/fixtures/background/instance/ops/supports-silent-insert-before/case.ts +11 -0
- package/runtime/__test__/element-template/fixtures/background/instance/ops/supports-silent-insert-before/output.txt +1 -0
- package/runtime/__test__/element-template/fixtures/background/instance/ops/treats-non-object-attrs-entry-as-empty-object/case.ts +23 -0
- package/runtime/__test__/element-template/fixtures/background/instance/ops/treats-non-object-attrs-entry-as-empty-object/output.txt +6 -0
- package/runtime/__test__/element-template/fixtures/background/instance/ops/treats-nullish-attrs-as-empty-object/case.ts +23 -0
- package/runtime/__test__/element-template/fixtures/background/instance/ops/treats-nullish-attrs-as-empty-object/output.txt +6 -0
- package/runtime/__test__/element-template/fixtures/background/main-thread-function/run-on-main-thread/index.tsx +24 -0
- package/runtime/__test__/element-template/fixtures/background/ref/direct-ref/index.tsx +7 -0
- package/runtime/__test__/element-template/fixtures/background/ref/multi-ref/index.tsx +20 -0
- package/runtime/__test__/element-template/fixtures/background/ref/spread-ref/index.tsx +14 -0
- package/runtime/__test__/element-template/fixtures/background/ref/unsupported-ref/index.tsx +12 -0
- package/runtime/__test__/element-template/fixtures/background/render/_shared.tsx +85 -0
- package/runtime/__test__/element-template/fixtures/background/render/constructs-shadow-tree/case.tsx +5 -0
- package/runtime/__test__/element-template/fixtures/background/render/constructs-shadow-tree/output.txt +7 -0
- package/runtime/__test__/element-template/fixtures/background/render/supports-slot-component-materiality/case.tsx +5 -0
- package/runtime/__test__/element-template/fixtures/background/render/supports-slot-component-materiality/output.txt +13 -0
- package/runtime/__test__/element-template/fixtures/background/update/keyed/compiled-keyed-list/index.tsx +15 -0
- package/runtime/__test__/element-template/fixtures/background/update/keyed/compiled-keyed-subtree-list/index.tsx +19 -0
- package/runtime/__test__/element-template/fixtures/background/update/sparse/compiled-element-slot/index.tsx +26 -0
- package/runtime/__test__/element-template/fixtures/hydration/hydration-data/_shared.tsx +169 -0
- package/runtime/__test__/element-template/fixtures/hydration/hydration-data/multiple-root-instances/case.tsx +5 -0
- package/runtime/__test__/element-template/fixtures/hydration/hydration-data/multiple-root-instances/output.txt +14 -0
- package/runtime/__test__/element-template/fixtures/hydration/hydration-data/nested-instances/case.tsx +5 -0
- package/runtime/__test__/element-template/fixtures/hydration/hydration-data/nested-instances/output.txt +8 -0
- package/runtime/__test__/element-template/fixtures/hydration/hydration-data/simple-element/case.tsx +5 -0
- package/runtime/__test__/element-template/fixtures/hydration/hydration-data/simple-element/output.txt +10 -0
- package/runtime/__test__/element-template/fixtures/hydration/hydration-data/sub-components/case.tsx +5 -0
- package/runtime/__test__/element-template/fixtures/hydration/hydration-data/sub-components/output.txt +28 -0
- package/runtime/__test__/element-template/fixtures/hydration/hydration-data/sub-components/source.tsx +15 -0
- package/runtime/__test__/element-template/fixtures/hydration/hydration-data/text-children/case.tsx +5 -0
- package/runtime/__test__/element-template/fixtures/hydration/hydration-data/text-children/output.txt +19 -0
- package/runtime/__test__/element-template/fixtures/hydration/hydration-data/text-children/source.tsx +8 -0
- package/runtime/__test__/element-template/fixtures/page/render-page/case.tsx +41 -0
- package/runtime/__test__/element-template/fixtures/page/render-page/native-log.txt +31 -0
- package/runtime/__test__/element-template/fixtures/page/render-page/output.txt +5 -0
- package/runtime/__test__/element-template/fixtures/page-compiled/authored-page/index.tsx +67 -0
- package/runtime/__test__/element-template/fixtures/patch/_shared.tsx +270 -0
- package/runtime/__test__/element-template/fixtures/patch/detaches-node-when-moving-between-slots/after-jsx.txt +7 -0
- package/runtime/__test__/element-template/fixtures/patch/detaches-node-when-moving-between-slots/before-jsx.txt +8 -0
- package/runtime/__test__/element-template/fixtures/patch/detaches-node-when-moving-between-slots/case.tsx +100 -0
- package/runtime/__test__/element-template/fixtures/patch/props-update/after-jsx.txt +3 -0
- package/runtime/__test__/element-template/fixtures/patch/props-update/before-jsx.txt +3 -0
- package/runtime/__test__/element-template/fixtures/patch/props-update/case.tsx +42 -0
- package/runtime/__test__/element-template/fixtures/patch/props-update/ops.txt +8 -0
- package/runtime/__test__/element-template/fixtures/patch/state-update/after-jsx.txt +3 -0
- package/runtime/__test__/element-template/fixtures/patch/state-update/before-jsx.txt +3 -0
- package/runtime/__test__/element-template/fixtures/patch/state-update/case.tsx +64 -0
- package/runtime/__test__/element-template/fixtures/patch/state-update/ops.txt +8 -0
- package/runtime/__test__/element-template/fixtures/patch-compiled/applies-insert-before-with-reference/after-jsx.txt +7 -0
- package/runtime/__test__/element-template/fixtures/patch-compiled/applies-insert-before-with-reference/before-jsx.txt +6 -0
- package/runtime/__test__/element-template/fixtures/patch-compiled/applies-insert-before-with-reference/index.tsx +39 -0
- package/runtime/__test__/element-template/fixtures/patch-compiled/applies-insert-before-with-reference/ops.txt +14 -0
- package/runtime/__test__/element-template/fixtures/patch-compiled/apply-hydration-ops/after-jsx.txt +10 -0
- package/runtime/__test__/element-template/fixtures/patch-compiled/apply-hydration-ops/before-jsx.txt +9 -0
- package/runtime/__test__/element-template/fixtures/patch-compiled/apply-hydration-ops/index.tsx +47 -0
- package/runtime/__test__/element-template/fixtures/patch-compiled/apply-hydration-ops/ops.txt +34 -0
- package/runtime/__test__/element-template/fixtures/render/child-siblings/index.js.txt +21 -0
- package/runtime/__test__/element-template/fixtures/render/child-siblings/index.tsx +16 -0
- package/runtime/__test__/element-template/fixtures/render/child-siblings/output.txt +8 -0
- package/runtime/__test__/element-template/fixtures/render/child-siblings/papi.txt +128 -0
- package/runtime/__test__/element-template/fixtures/render/child-siblings/templates.json.txt +66 -0
- package/runtime/__test__/element-template/fixtures/render/component/index.js.txt +12 -0
- package/runtime/__test__/element-template/fixtures/render/component/index.tsx +17 -0
- package/runtime/__test__/element-template/fixtures/render/component/output.txt +7 -0
- package/runtime/__test__/element-template/fixtures/render/component/papi.txt +67 -0
- package/runtime/__test__/element-template/fixtures/render/component/templates.json.txt +68 -0
- package/runtime/__test__/element-template/fixtures/render/component-slot-content/index.js.txt +16 -0
- package/runtime/__test__/element-template/fixtures/render/component-slot-content/index.tsx +18 -0
- package/runtime/__test__/element-template/fixtures/render/component-slot-content/output.txt +6 -0
- package/runtime/__test__/element-template/fixtures/render/component-slot-content/papi.txt +85 -0
- package/runtime/__test__/element-template/fixtures/render/component-slot-content/templates.json.txt +78 -0
- package/runtime/__test__/element-template/fixtures/render/css-scope-dynamic-bundle-url/fixture.config.json +5 -0
- package/runtime/__test__/element-template/fixtures/render/css-scope-dynamic-bundle-url/index.js.txt +6 -0
- package/runtime/__test__/element-template/fixtures/render/css-scope-dynamic-bundle-url/index.tsx +9 -0
- package/runtime/__test__/element-template/fixtures/render/css-scope-dynamic-bundle-url/output.txt +3 -0
- package/runtime/__test__/element-template/fixtures/render/css-scope-dynamic-bundle-url/papi.txt +25 -0
- package/runtime/__test__/element-template/fixtures/render/css-scope-dynamic-bundle-url/templates.json.txt +57 -0
- package/runtime/__test__/element-template/fixtures/render/mapped-view-children/index.js.txt +18 -0
- package/runtime/__test__/element-template/fixtures/render/mapped-view-children/index.tsx +13 -0
- package/runtime/__test__/element-template/fixtures/render/mapped-view-children/output.txt +17 -0
- package/runtime/__test__/element-template/fixtures/render/mapped-view-children/papi.txt +214 -0
- package/runtime/__test__/element-template/fixtures/render/mapped-view-children/templates.json.txt +63 -0
- package/runtime/__test__/element-template/fixtures/render/mixed-children/index.js.txt +15 -0
- package/runtime/__test__/element-template/fixtures/render/mixed-children/index.tsx +15 -0
- package/runtime/__test__/element-template/fixtures/render/mixed-children/output.txt +7 -0
- package/runtime/__test__/element-template/fixtures/render/mixed-children/papi.txt +86 -0
- package/runtime/__test__/element-template/fixtures/render/mixed-children/templates.json.txt +51 -0
- package/runtime/__test__/element-template/fixtures/render/multiple-text/index.js.txt +23 -0
- package/runtime/__test__/element-template/fixtures/render/multiple-text/index.tsx +22 -0
- package/runtime/__test__/element-template/fixtures/render/multiple-text/output.txt +38 -0
- package/runtime/__test__/element-template/fixtures/render/multiple-text/papi.txt +454 -0
- package/runtime/__test__/element-template/fixtures/render/multiple-text/templates.json.txt +131 -0
- package/runtime/__test__/element-template/fixtures/render/nested-templates/index.js.txt +19 -0
- package/runtime/__test__/element-template/fixtures/render/nested-templates/index.tsx +19 -0
- package/runtime/__test__/element-template/fixtures/render/nested-templates/output.txt +5 -0
- package/runtime/__test__/element-template/fixtures/render/nested-templates/papi.txt +80 -0
- package/runtime/__test__/element-template/fixtures/render/nested-templates/templates.json.txt +34 -0
- package/runtime/__test__/element-template/fixtures/render/opcodes-into-element-template/_shared.ts +131 -0
- package/runtime/__test__/element-template/fixtures/render/opcodes-into-element-template/appends-root-text-via-append-element/case.ts +19 -0
- package/runtime/__test__/element-template/fixtures/render/opcodes-into-element-template/appends-root-text-via-append-element/native-log.txt +27 -0
- package/runtime/__test__/element-template/fixtures/render/opcodes-into-element-template/appends-root-text-via-append-element/output.txt +12 -0
- package/runtime/__test__/element-template/fixtures/render/opcodes-into-element-template/creates-template-from-attrs-and-slot-text/case.ts +39 -0
- package/runtime/__test__/element-template/fixtures/render/opcodes-into-element-template/creates-template-from-attrs-and-slot-text/native-log.txt +49 -0
- package/runtime/__test__/element-template/fixtures/render/opcodes-into-element-template/creates-template-from-attrs-and-slot-text/output.txt +34 -0
- package/runtime/__test__/element-template/fixtures/render/opcodes-into-element-template/handles-multiple-template-children-in-the-same-slot/case.ts +34 -0
- package/runtime/__test__/element-template/fixtures/render/opcodes-into-element-template/handles-multiple-template-children-in-the-same-slot/native-log.txt +56 -0
- package/runtime/__test__/element-template/fixtures/render/opcodes-into-element-template/handles-multiple-template-children-in-the-same-slot/output.txt +11 -0
- package/runtime/__test__/element-template/fixtures/render/opcodes-into-element-template/handles-multiple-text-nodes-in-the-same-slot/case.ts +29 -0
- package/runtime/__test__/element-template/fixtures/render/opcodes-into-element-template/handles-multiple-text-nodes-in-the-same-slot/native-log.txt +64 -0
- package/runtime/__test__/element-template/fixtures/render/opcodes-into-element-template/handles-multiple-text-nodes-in-the-same-slot/output.txt +20 -0
- package/runtime/__test__/element-template/fixtures/render/opcodes-into-element-template/inserts-nested-templates-into-parent-slots/case.ts +42 -0
- package/runtime/__test__/element-template/fixtures/render/opcodes-into-element-template/inserts-nested-templates-into-parent-slots/native-log.txt +84 -0
- package/runtime/__test__/element-template/fixtures/render/opcodes-into-element-template/inserts-nested-templates-into-parent-slots/output.txt +42 -0
- package/runtime/__test__/element-template/fixtures/render/opcodes-into-element-template/keeps-slot-children-separated-and-ordered/case.ts +31 -0
- package/runtime/__test__/element-template/fixtures/render/opcodes-into-element-template/keeps-slot-children-separated-and-ordered/native-log.txt +66 -0
- package/runtime/__test__/element-template/fixtures/render/opcodes-into-element-template/keeps-slot-children-separated-and-ordered/output.txt +41 -0
- package/runtime/__test__/element-template/fixtures/render/opcodes-into-element-template/passes-bundle-url-to-native-create/case.ts +20 -0
- package/runtime/__test__/element-template/fixtures/render/opcodes-into-element-template/passes-bundle-url-to-native-create/native-log.txt +25 -0
- package/runtime/__test__/element-template/fixtures/render/react-example/index.js.txt +39 -0
- package/runtime/__test__/element-template/fixtures/render/react-example/index.tsx +51 -0
- package/runtime/__test__/element-template/fixtures/render/react-example/output.txt +24 -0
- package/runtime/__test__/element-template/fixtures/render/react-example/papi.txt +70 -0
- package/runtime/__test__/element-template/fixtures/render/react-example/templates.json.txt +280 -0
- package/runtime/__test__/element-template/fixtures/render/sparse-element-slot/index.js.txt +14 -0
- package/runtime/__test__/element-template/fixtures/render/sparse-element-slot/index.tsx +17 -0
- package/runtime/__test__/element-template/fixtures/render/sparse-element-slot/output.txt +10 -0
- package/runtime/__test__/element-template/fixtures/render/sparse-element-slot/papi.txt +81 -0
- package/runtime/__test__/element-template/fixtures/render/sparse-element-slot/templates.json.txt +97 -0
- package/runtime/__test__/element-template/fixtures/render/template-dedupe/index.js.txt +28 -0
- package/runtime/__test__/element-template/fixtures/render/template-dedupe/index.tsx +28 -0
- package/runtime/__test__/element-template/fixtures/render/template-dedupe/output.txt +12 -0
- package/runtime/__test__/element-template/fixtures/render/template-dedupe/papi.txt +144 -0
- package/runtime/__test__/element-template/fixtures/render/template-dedupe/templates.json.txt +57 -0
- package/runtime/__test__/element-template/imports/global-props-api.test.ts +23 -0
- package/runtime/__test__/element-template/imports/init-data-api.test.ts +19 -0
- package/runtime/__test__/element-template/imports/jsx-runtime.test.ts +76 -0
- package/runtime/__test__/element-template/imports/legacy-react-runtime.test.ts +100 -0
- package/runtime/__test__/element-template/imports/main-thread-ref-api.test.ts +10 -0
- package/runtime/__test__/element-template/imports/no-legacy-imports.test.ts +415 -0
- package/runtime/__test__/element-template/imports/register-data-processors.test.ts +34 -0
- package/runtime/__test__/element-template/imports/suspense-lazy.test.ts +295 -0
- package/runtime/__test__/element-template/internal/legacy-internal-guardrail.test.ts +35 -0
- package/runtime/__test__/element-template/lynx/env.test.ts +242 -0
- package/runtime/__test__/element-template/lynx/lazy-bundle.test.ts +294 -0
- package/runtime/__test__/element-template/lynx/performance.test.ts +161 -0
- package/runtime/__test__/element-template/native/callDestroyLifetimeFun.test.ts +107 -0
- package/runtime/__test__/element-template/native/index.test.ts +224 -0
- package/runtime/__test__/element-template/native/init-timing-api.test.ts +29 -0
- package/runtime/__test__/element-template/native/main-thread-api.test.ts +202 -0
- package/runtime/__test__/element-template/native/mts-destroy.test.ts +226 -0
- package/runtime/__test__/element-template/native/reload.test.ts +588 -0
- package/runtime/__test__/element-template/runtime/background/adapter/background-adapter.et.test.tsx +65 -0
- package/runtime/__test__/element-template/runtime/background/commit-context.test.ts +91 -0
- package/runtime/__test__/element-template/runtime/background/commit-hook.test.ts +800 -0
- package/runtime/__test__/element-template/runtime/background/event/compiled-fixtures.test.tsx +867 -0
- package/runtime/__test__/element-template/runtime/background/global-props/compiled-fixtures.test.tsx +220 -0
- package/runtime/__test__/element-template/runtime/background/global-props.test.tsx +173 -0
- package/runtime/__test__/element-template/runtime/background/hydrate/compiled-fixtures.test.ts +43 -0
- package/runtime/__test__/element-template/runtime/background/hydrate/fixtures.test.ts +16 -0
- package/runtime/__test__/element-template/runtime/background/hydrate.test.ts +2179 -0
- package/runtime/__test__/element-template/runtime/background/init-data/compiled-fixtures.test.tsx +129 -0
- package/runtime/__test__/element-template/runtime/background/instance/fixtures.test.ts +16 -0
- package/runtime/__test__/element-template/runtime/background/instance.test.ts +2751 -0
- package/runtime/__test__/element-template/runtime/background/main-thread-function/compiled-fixtures.test.tsx +287 -0
- package/runtime/__test__/element-template/runtime/background/manager.test.ts +142 -0
- package/runtime/__test__/element-template/runtime/background/page-root-hydrate.test.ts +75 -0
- package/runtime/__test__/element-template/runtime/background/ref/compiled-fixtures.test.tsx +339 -0
- package/runtime/__test__/element-template/runtime/background/reload.test.ts +79 -0
- package/runtime/__test__/element-template/runtime/background/render/fixtures.test.ts +16 -0
- package/runtime/__test__/element-template/runtime/background/render/preact.test.tsx +268 -0
- package/runtime/__test__/element-template/runtime/background/root-render.test.tsx +265 -0
- package/runtime/__test__/element-template/runtime/background/suspense.test.tsx +940 -0
- package/runtime/__test__/element-template/runtime/background/update/compiled-fixtures.test.tsx +277 -0
- package/runtime/__test__/element-template/runtime/background/update/sparse-fixtures.test.tsx +163 -0
- package/runtime/__test__/element-template/runtime/background/update-timing.test.ts +127 -0
- package/runtime/__test__/element-template/runtime/hydration/fixtures.test.ts +16 -0
- package/runtime/__test__/element-template/runtime/hydration/hydration-listener.test.ts +1249 -0
- package/runtime/__test__/element-template/runtime/page/authored-page.test.ts +35 -0
- package/runtime/__test__/element-template/runtime/page/compiled-fixtures.test.tsx +560 -0
- package/runtime/__test__/element-template/runtime/page/fixtures.test.ts +16 -0
- package/runtime/__test__/element-template/runtime/page/page.test.ts +25 -0
- package/runtime/__test__/element-template/runtime/page/root-instance.test.ts +25 -0
- package/runtime/__test__/element-template/runtime/patch/compiled-fixtures.test.ts +40 -0
- package/runtime/__test__/element-template/runtime/patch/element-template-patch.test.tsx +3704 -0
- package/runtime/__test__/element-template/runtime/patch/fixtures.test.ts +16 -0
- package/runtime/__test__/element-template/runtime/patch/patch-listener-alog.test.ts +80 -0
- package/runtime/__test__/element-template/runtime/patch/update-fixture-helper.test.tsx +40 -0
- package/runtime/__test__/element-template/runtime/patch/update-timing.test.ts +203 -0
- package/runtime/__test__/element-template/runtime/prop-adapters/event.test.ts +183 -0
- package/runtime/__test__/element-template/runtime/prop-adapters/hydrate.test.ts +246 -0
- package/runtime/__test__/element-template/runtime/prop-adapters/ref.test.ts +155 -0
- package/runtime/__test__/element-template/runtime/prop-adapters/spread.test.ts +160 -0
- package/runtime/__test__/element-template/runtime/protocol/template-type.test.ts +40 -0
- package/runtime/__test__/element-template/runtime/render/fixtures.test.ts +18 -0
- package/runtime/__test__/element-template/runtime/render/render-main-thread.contract.test.ts +143 -0
- package/runtime/__test__/element-template/runtime/render/render-main-thread.test.ts +377 -0
- package/runtime/__test__/element-template/runtime/render/render-opcodes-into-element-template.et.test.tsx +791 -0
- package/runtime/__test__/element-template/runtime/render/render-to-opcodes.et.test.jsx +522 -0
- package/runtime/__test__/element-template/runtime/render/render-transform.contract.test.ts +564 -0
- package/runtime/__test__/element-template/runtime/template/element-template-attr-slot-plan.test.ts +373 -0
- package/runtime/__test__/element-template/runtime/template/element-template-handle.test.ts +228 -0
- package/runtime/__test__/element-template/runtime/template/element-template-registry.test.ts +65 -0
- package/runtime/__test__/element-template/runtime/template/main-thread-dynamic-attr-state.test.ts +567 -0
- package/runtime/__test__/element-template/runtime/template/main-thread-function.test.ts +280 -0
- package/runtime/__test__/element-template/test-utils/debug/compiledFixtureApp.ts +26 -0
- package/runtime/__test__/element-template/test-utils/debug/compiledFixtureCompiler.ts +76 -0
- package/runtime/__test__/element-template/test-utils/debug/compiledFixtureModule.ts +74 -0
- package/runtime/__test__/element-template/test-utils/debug/compiledFixtureRegistry.ts +22 -0
- package/runtime/__test__/element-template/test-utils/debug/compiledHydrationScenario.ts +82 -0
- package/runtime/__test__/element-template/test-utils/debug/compiledThreadRunner.ts +70 -0
- package/runtime/__test__/element-template/test-utils/debug/envManager.ts +96 -0
- package/runtime/__test__/element-template/test-utils/debug/fixtureRunner.ts +284 -0
- package/runtime/__test__/element-template/test-utils/debug/hydrate.ts +23 -0
- package/runtime/__test__/element-template/test-utils/debug/registry.ts +43 -0
- package/runtime/__test__/element-template/test-utils/debug/renderFixtureRunner.ts +337 -0
- package/runtime/__test__/element-template/test-utils/debug/serializer.ts +79 -0
- package/runtime/__test__/element-template/test-utils/debug/updateRunner.test.tsx +148 -0
- package/runtime/__test__/element-template/test-utils/debug/updateRunner.ts +303 -0
- package/runtime/__test__/element-template/test-utils/mock/globals.js +35 -0
- package/runtime/__test__/element-template/test-utils/mock/jscontext-mock.test.ts +142 -0
- package/runtime/__test__/element-template/test-utils/mock/mockNativePapi/context.ts +305 -0
- package/runtime/__test__/element-template/test-utils/mock/mockNativePapi/templateTree.test.ts +187 -0
- package/runtime/__test__/element-template/test-utils/mock/mockNativePapi/templateTree.ts +745 -0
- package/runtime/__test__/element-template/test-utils/mock/mockNativePapi.ts +432 -0
- package/runtime/__test__/element-template/test-utils/mock/performance.js +68 -0
- package/runtime/__test__/element-template/test-utils/setup.js +100 -0
- package/runtime/__test__/element-template/vitest.config.ts +128 -0
- package/runtime/__test__/guardrails/snapshot-containment.test.ts +198 -0
- package/runtime/__test__/shared/profile.test.ts +88 -0
- package/runtime/__test__/snapshot/alog/elementPAPICall.test.js +50 -0
- package/runtime/__test__/snapshot/attribute-name.test.ts +78 -0
- package/runtime/__test__/snapshot/basic.test.jsx +718 -0
- package/runtime/__test__/snapshot/children.test.jsx +476 -0
- package/runtime/__test__/snapshot/clone.test.jsx +959 -0
- package/runtime/__test__/snapshot/commit-context.test.ts +29 -0
- package/runtime/__test__/snapshot/compat/export.test.jsx +42 -0
- package/runtime/__test__/snapshot/compat/hooks.test.jsx +45 -0
- package/runtime/__test__/snapshot/compat/initData.test.jsx +195 -0
- package/runtime/__test__/snapshot/compat/use-insertion-effect.test.jsx +128 -0
- package/runtime/__test__/snapshot/compat/use.test.jsx +111 -0
- package/runtime/__test__/snapshot/compat.test.jsx +199 -0
- package/runtime/__test__/snapshot/createElement.test.jsx +1352 -0
- package/runtime/__test__/snapshot/createSuspender.jsx +26 -0
- package/runtime/__test__/snapshot/css/compat.test.jsx +164 -0
- package/runtime/__test__/snapshot/css/remove-scoped-lazy-bundle.test.jsx +40 -0
- package/runtime/__test__/snapshot/css/remove-scoped-main-bundle.test.jsx +27 -0
- package/runtime/__test__/snapshot/css/scoped-lazy-bundle.test.jsx +45 -0
- package/runtime/__test__/snapshot/css/scoped-main-bundle.test.jsx +36 -0
- package/runtime/__test__/snapshot/debug/backgroundSnapshot-profile.test.jsx +366 -0
- package/runtime/__test__/snapshot/debug/children-with-same-key.test.jsx +43 -0
- package/runtime/__test__/snapshot/debug/describeInvalidValue.test.ts +32 -0
- package/runtime/__test__/snapshot/debug/formatPatch.test.ts +89 -0
- package/runtime/__test__/snapshot/debug/hooks-in-render.test.jsx +13 -0
- package/runtime/__test__/snapshot/debug/hooks-invalid-args.test.jsx +42 -0
- package/runtime/__test__/snapshot/debug/jsx-twice.test.jsx +55 -0
- package/runtime/__test__/snapshot/debug/missing-suspense.test.jsx +35 -0
- package/runtime/__test__/snapshot/debug/object-as-child.test.jsx +35 -0
- package/runtime/__test__/snapshot/debug/printSnapshot.test.jsx +155 -0
- package/runtime/__test__/snapshot/debug/profile.test.jsx +348 -0
- package/runtime/__test__/snapshot/debug/react-hooks-profile.test.jsx +285 -0
- package/runtime/__test__/snapshot/debug/set-state-in-ctor.test.jsx +40 -0
- package/runtime/__test__/snapshot/debug/too-many-rerenders.test.jsx +33 -0
- package/runtime/__test__/snapshot/debug/undefined-component.test.jsx +40 -0
- package/runtime/__test__/snapshot/debug/vnodeSource.test.ts +120 -0
- package/runtime/__test__/snapshot/delayed-lifecycle-events.test.jsx +62 -0
- package/runtime/__test__/snapshot/dynamicPartType.test.jsx +690 -0
- package/runtime/__test__/snapshot/element.test.jsx +46 -0
- package/runtime/__test__/snapshot/event.test.jsx +1294 -0
- package/runtime/__test__/snapshot/gesture/prepareGestureForCommit.test.js +86 -0
- package/runtime/__test__/snapshot/gesture/processGesture.test.ts +326 -0
- package/runtime/__test__/snapshot/gesture.test.jsx +1446 -0
- package/runtime/__test__/snapshot/hydrate.test.jsx +372 -0
- package/runtime/__test__/snapshot/jsx-runtime-lepus.test.jsx +89 -0
- package/runtime/__test__/snapshot/lazy.test.js +203 -0
- package/runtime/__test__/snapshot/legacySlot.legacy-slot.test.jsx +437 -0
- package/runtime/__test__/snapshot/lifecycle/commitHook.test.jsx +112 -0
- package/runtime/__test__/snapshot/lifecycle/destroy.test.jsx +47 -0
- package/runtime/__test__/snapshot/lifecycle/emptyPatch.test.jsx +104 -0
- package/runtime/__test__/snapshot/lifecycle/isRendering.test.jsx +114 -0
- package/runtime/__test__/snapshot/lifecycle/reload.test.jsx +1908 -0
- package/runtime/__test__/snapshot/lifecycle/reloadBG.jsx +79 -0
- package/runtime/__test__/snapshot/lifecycle/reloadMT.jsx +76 -0
- package/runtime/__test__/snapshot/lifecycle/resetPageDataError.test.jsx +79 -0
- package/runtime/__test__/snapshot/lifecycle/updateData.test.jsx +1688 -0
- package/runtime/__test__/snapshot/lifecycle/updateGlobalProps.event.test.jsx +226 -0
- package/runtime/__test__/snapshot/lifecycle/updateGlobalProps.test.jsx +382 -0
- package/runtime/__test__/snapshot/lifecycle.test.jsx +675 -0
- package/runtime/__test__/snapshot/list.test.jsx +4956 -0
- package/runtime/__test__/snapshot/lynx/component-compat.test.ts +188 -0
- package/runtime/__test__/snapshot/lynx/dynamic-import.test.ts +111 -0
- package/runtime/__test__/snapshot/lynx/injectLepusMethods.test.jsx +81 -0
- package/runtime/__test__/snapshot/lynx/lazy-bundle-fetchbundle.test.js +659 -0
- package/runtime/__test__/snapshot/lynx/lazy-bundle.test.js +576 -0
- package/runtime/__test__/snapshot/lynx/portals.test.jsx +677 -0
- package/runtime/__test__/snapshot/lynx/prepareLazyBundleMTS.test.js +212 -0
- package/runtime/__test__/snapshot/lynx/processEvalResult.test.js +23 -0
- package/runtime/__test__/snapshot/lynx/runtime-backend.test.ts +81 -0
- package/runtime/__test__/snapshot/lynx/suspense.test.jsx +1641 -0
- package/runtime/__test__/snapshot/lynx/timing.test.jsx +1011 -0
- package/runtime/__test__/snapshot/lynx-data-processors.test.ts +3 -0
- package/runtime/__test__/snapshot/lynxQueueMicrotask.test.jsx +38 -0
- package/runtime/__test__/snapshot/mtf-execid-churn.test.jsx +216 -0
- package/runtime/__test__/snapshot/page.test.jsx +417 -0
- package/runtime/__test__/snapshot/preact.test.jsx +930 -0
- package/runtime/__test__/snapshot/ref-parity.test.jsx +78 -0
- package/runtime/__test__/snapshot/ref.test.jsx +2368 -0
- package/runtime/__test__/snapshot/render.test.jsx +148 -0
- package/runtime/__test__/snapshot/renderToOpcodes.test.jsx +1618 -0
- package/runtime/__test__/snapshot/snapshotPatch.test.jsx +1798 -0
- package/runtime/__test__/snapshot/spread.test.jsx +771 -0
- package/runtime/__test__/snapshot/ssr.test.jsx +574 -0
- package/runtime/__test__/snapshot/use-main-thread.test.jsx +141 -0
- package/runtime/__test__/snapshot/utils/debug.js +41 -0
- package/runtime/__test__/snapshot/utils/envManager.ts +109 -0
- package/runtime/__test__/snapshot/utils/globals.js +224 -0
- package/runtime/__test__/snapshot/utils/inject.ts +31 -0
- package/runtime/__test__/snapshot/utils/jsModule.ts +49 -0
- package/runtime/__test__/snapshot/utils/nativeMethod.ts +498 -0
- package/runtime/__test__/snapshot/utils/runtimeProxy.test.js +36 -0
- package/runtime/__test__/snapshot/utils/runtimeProxy.ts +73 -0
- package/runtime/__test__/snapshot/utils/setup.js +72 -0
- package/runtime/__test__/snapshot/worklet/onPost.test.js +30 -0
- package/runtime/__test__/snapshot/worklet/runOnBackground.test.js +234 -0
- package/runtime/__test__/snapshot/worklet/runOnMainThread.test.jsx +402 -0
- package/runtime/__test__/snapshot/worklet/transform.test.js +35 -0
- package/runtime/__test__/snapshot/worklet/workletRef.test.jsx +292 -0
- package/runtime/__test__/snapshot/workletEvent.test.jsx +1286 -0
- package/runtime/__test__/snapshot/workletLifecycle.test.ts +198 -0
- package/runtime/__test__/snapshot/workletRef.test.jsx +831 -0
- package/runtime/__test__/snapshot/workletRefBG.jsx +95 -0
- package/runtime/__test__/snapshot/workletRefMT.jsx +99 -0
- package/runtime/__test__/test-utils/lynx-event-emitter.ts +63 -0
- package/runtime/__test__/tsconfig.json +9 -0
- package/runtime/__test__/worklet-runtime/api/element.test.js +274 -0
- package/runtime/__test__/worklet-runtime/delayWorkletEvent.test.js +89 -0
- package/runtime/__test__/worklet-runtime/eventPropagation.test.js +89 -0
- package/runtime/__test__/worklet-runtime/jsFunctionLifecycle.test.js +89 -0
- package/runtime/__test__/worklet-runtime/mainThreadFlushLoopGuard.test.js +235 -0
- package/runtime/__test__/worklet-runtime/observers.test.js +119 -0
- package/runtime/__test__/worklet-runtime/profile.test.js +27 -0
- package/runtime/__test__/worklet-runtime/runOnBackground.test.js +186 -0
- package/runtime/__test__/worklet-runtime/runOnMainThread.test.js +66 -0
- package/runtime/__test__/worklet-runtime/workletRef.test.js +328 -0
- package/runtime/__test__/worklet-runtime/workletRuntime.test.js +534 -0
- package/runtime/compat/index.d.ts +48 -1
- package/runtime/compat/index.js +7 -3
- package/runtime/lazy/compat.js +2 -0
- package/runtime/lazy/element-template-internal.js +35 -0
- package/runtime/lazy/element-template-jsx-dev-runtime.js +19 -0
- package/runtime/lazy/element-template-jsx-runtime.js +14 -0
- package/runtime/lazy/element-template.js +53 -0
- package/runtime/lazy/internal.js +2 -1
- package/runtime/lepus/index.js +2 -2
- package/runtime/lepus/jsx-runtime/index.js +3 -8
- package/runtime/lib/core/component.js +3 -3
- package/runtime/lib/core/component.js.map +1 -1
- package/runtime/lib/core/forceRootRender.js +3 -2
- package/runtime/lib/core/forceRootRender.js.map +1 -1
- package/runtime/lib/core/globalProps.js +1 -1
- package/runtime/lib/core/globalProps.js.map +1 -1
- package/runtime/lib/core/hooks/mainThreadImpl.js +2 -0
- package/runtime/lib/core/hooks/mainThreadImpl.js.map +1 -1
- package/runtime/lib/core/hooks/useLynxGlobalEventListener.js +1 -1
- package/runtime/lib/core/hooks/useLynxGlobalEventListener.js.map +1 -1
- package/runtime/lib/core/lynx/lazy-bundle.js +1 -1
- package/runtime/lib/core/lynx/lazy-bundle.js.map +1 -1
- package/runtime/lib/core/main-thread-ref.js +1 -1
- package/runtime/lib/core/main-thread-ref.js.map +1 -1
- package/runtime/lib/core/ref.d.ts +7 -5
- package/runtime/lib/core/ref.js +22 -11
- package/runtime/lib/core/ref.js.map +1 -1
- package/runtime/lib/element-template/background/attr-slots.d.ts +5 -1
- package/runtime/lib/element-template/background/attr-slots.js +17 -6
- package/runtime/lib/element-template/background/attr-slots.js.map +1 -1
- package/runtime/lib/element-template/background/commit-context.d.ts +1 -1
- package/runtime/lib/element-template/background/commit-context.js +8 -9
- package/runtime/lib/element-template/background/commit-context.js.map +1 -1
- package/runtime/lib/element-template/background/commit-hook.js +60 -51
- package/runtime/lib/element-template/background/commit-hook.js.map +1 -1
- package/runtime/lib/element-template/background/destroy.js +4 -1
- package/runtime/lib/element-template/background/destroy.js.map +1 -1
- package/runtime/lib/element-template/background/hydrate.js +34 -38
- package/runtime/lib/element-template/background/hydrate.js.map +1 -1
- package/runtime/lib/element-template/background/hydration-listener.js +18 -10
- package/runtime/lib/element-template/background/hydration-listener.js.map +1 -1
- package/runtime/lib/element-template/background/instance.d.ts +7 -5
- package/runtime/lib/element-template/background/instance.js +79 -38
- package/runtime/lib/element-template/background/instance.js.map +1 -1
- package/runtime/lib/element-template/background/page-root-hydrate.js +1 -1
- package/runtime/lib/element-template/background/page-root-hydrate.js.map +1 -1
- package/runtime/lib/element-template/debug/alog.d.ts +10 -4
- package/runtime/lib/element-template/debug/alog.js +22 -9
- package/runtime/lib/element-template/debug/alog.js.map +1 -1
- package/runtime/lib/element-template/debug/profile.js +2 -2
- package/runtime/lib/element-template/debug/profile.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/jsx-runtime/index.d.ts +3 -1
- package/runtime/lib/element-template/jsx-runtime/index.js +2 -4
- package/runtime/lib/element-template/jsx-runtime/index.js.map +1 -1
- package/runtime/lib/element-template/lynx/env.js +1 -2
- package/runtime/lib/element-template/lynx/env.js.map +1 -1
- package/runtime/lib/element-template/native/callDestroyLifetimeFun.js +2 -0
- package/runtime/lib/element-template/native/callDestroyLifetimeFun.js.map +1 -1
- package/runtime/lib/element-template/native/index.js +9 -7
- package/runtime/lib/element-template/native/index.js.map +1 -1
- package/runtime/lib/element-template/native/main-thread-api.js +3 -3
- package/runtime/lib/element-template/native/main-thread-api.js.map +1 -1
- package/runtime/lib/element-template/native/patch-listener.js +15 -7
- package/runtime/lib/element-template/native/patch-listener.js.map +1 -1
- package/runtime/lib/element-template/native/reload-main-thread.js +21 -3
- package/runtime/lib/element-template/native/reload-main-thread.js.map +1 -1
- package/runtime/lib/element-template/prop-adapters/ref.d.ts +3 -1
- package/runtime/lib/element-template/prop-adapters/ref.js +2 -2
- package/runtime/lib/element-template/prop-adapters/ref.js.map +1 -1
- package/runtime/lib/element-template/prop-adapters/spread.js +1 -4
- package/runtime/lib/element-template/prop-adapters/spread.js.map +1 -1
- package/runtime/lib/element-template/protocol/opcodes.d.ts +2 -0
- package/runtime/lib/element-template/protocol/opcodes.js +2 -0
- package/runtime/lib/element-template/protocol/opcodes.js.map +1 -1
- package/runtime/lib/element-template/protocol/types.d.ts +45 -22
- package/runtime/lib/element-template/runtime/list/list.d.ts +5 -5
- package/runtime/lib/element-template/runtime/list/list.js +8 -7
- package/runtime/lib/element-template/runtime/list/list.js.map +1 -1
- package/runtime/lib/element-template/runtime/page/authored-page.js +17 -2
- package/runtime/lib/element-template/runtime/page/authored-page.js.map +1 -1
- package/runtime/lib/element-template/runtime/page/page.d.ts +3 -3
- package/runtime/lib/element-template/runtime/page/page.js +1 -1
- package/runtime/lib/element-template/runtime/page/page.js.map +1 -1
- package/runtime/lib/element-template/runtime/patch.js +78 -50
- package/runtime/lib/element-template/runtime/patch.js.map +1 -1
- package/runtime/lib/element-template/runtime/render/render-main-thread.js +7 -5
- package/runtime/lib/element-template/runtime/render/render-main-thread.js.map +1 -1
- package/runtime/lib/element-template/runtime/render/render-opcodes.d.ts +3 -1
- package/runtime/lib/element-template/runtime/render/render-opcodes.js +47 -38
- package/runtime/lib/element-template/runtime/render/render-opcodes.js.map +1 -1
- package/runtime/lib/element-template/runtime/render/render-to-opcodes.js +19 -17
- package/runtime/lib/element-template/runtime/render/render-to-opcodes.js.map +1 -1
- package/runtime/lib/element-template/runtime/template/attr-slot-plan.d.ts +3 -0
- package/runtime/lib/element-template/runtime/template/attr-slot-plan.js +39 -0
- package/runtime/lib/element-template/runtime/template/attr-slot-plan.js.map +1 -1
- package/runtime/lib/element-template/runtime/template/handle.d.ts +5 -3
- package/runtime/lib/element-template/runtime/template/handle.js +14 -6
- package/runtime/lib/element-template/runtime/template/handle.js.map +1 -1
- package/runtime/lib/element-template/runtime/template/main-thread-dynamic-attr-state.d.ts +16 -7
- package/runtime/lib/element-template/runtime/template/main-thread-dynamic-attr-state.js +133 -55
- package/runtime/lib/element-template/runtime/template/main-thread-dynamic-attr-state.js.map +1 -1
- package/runtime/lib/element-template/runtime/template/main-thread-ref-ctx.d.ts +4 -0
- package/runtime/lib/element-template/runtime/template/main-thread-ref-ctx.js +30 -1
- package/runtime/lib/element-template/runtime/template/main-thread-ref-ctx.js.map +1 -1
- package/runtime/lib/element-template/runtime/template/registry.d.ts +6 -6
- package/runtime/lib/element-template/runtime/template/registry.js.map +1 -1
- package/runtime/lib/internal.d.ts +1 -1
- package/runtime/lib/internal.js +1 -1
- package/runtime/lib/internal.js.map +1 -1
- package/runtime/lib/shared/attribute-name.js +1 -2
- package/runtime/lib/shared/attribute-name.js.map +1 -1
- package/runtime/lib/shared/component-stack.js +2 -1
- package/runtime/lib/shared/component-stack.js.map +1 -1
- package/runtime/lib/shared/render-constants.d.ts +4 -2
- package/runtime/lib/shared/render-constants.js +6 -2
- package/runtime/lib/shared/render-constants.js.map +1 -1
- package/runtime/lib/snapshot/alog/render.js +1 -0
- package/runtime/lib/snapshot/alog/render.js.map +1 -1
- package/runtime/lib/snapshot/debug/profileHooks.js +2 -2
- package/runtime/lib/snapshot/debug/profileHooks.js.map +1 -1
- package/runtime/lib/snapshot/debug/vnodeSource.js +1 -0
- package/runtime/lib/snapshot/debug/vnodeSource.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/destroy.js +5 -2
- package/runtime/lib/snapshot/lifecycle/destroy.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/patch/commit.js +1 -0
- package/runtime/lib/snapshot/lifecycle/patch/commit.js.map +1 -1
- package/runtime/lib/snapshot/lynx/children.js +1 -2
- package/runtime/lib/snapshot/lynx/children.js.map +1 -1
- package/runtime/lib/snapshot/lynx/env.js +1 -1
- package/runtime/lib/snapshot/lynx/env.js.map +1 -1
- package/runtime/lib/snapshot/lynx/suspense.js +1 -1
- package/runtime/lib/snapshot/lynx/suspense.js.map +1 -1
- package/runtime/lib/snapshot/lynx/tt.js +5 -5
- package/runtime/lib/snapshot/lynx/tt.js.map +1 -1
- package/runtime/lib/snapshot/renderToOpcodes/index.js +12 -13
- package/runtime/lib/snapshot/renderToOpcodes/index.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/backgroundSnapshot.d.ts +1 -0
- package/runtime/lib/snapshot/snapshot/backgroundSnapshot.js +23 -25
- package/runtime/lib/snapshot/snapshot/backgroundSnapshot.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/platformInfo.js +1 -3
- package/runtime/lib/snapshot/snapshot/platformInfo.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/ref.d.ts +3 -2
- package/runtime/lib/snapshot/snapshot/ref.js +4 -7
- package/runtime/lib/snapshot/snapshot/ref.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/snapshot.d.ts +1 -0
- package/runtime/lib/snapshot/snapshot/snapshot.js +5 -0
- package/runtime/lib/snapshot/snapshot/snapshot.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/spread.js +2 -8
- package/runtime/lib/snapshot/snapshot/spread.js.map +1 -1
- package/runtime/lib/tsconfig.tsbuildinfo +1 -1
- package/runtime/lib/utils.d.ts +9 -0
- package/runtime/lib/utils.js +27 -0
- package/runtime/lib/utils.js.map +1 -1
- package/runtime/lib/worklet-runtime/bindings/bindings.d.ts +5 -1
- package/runtime/lib/worklet-runtime/bindings/bindings.js +7 -1
- package/runtime/lib/worklet-runtime/bindings/bindings.js.map +1 -1
- package/runtime/lib/worklet-runtime/bindings/observers.js +2 -1
- package/runtime/lib/worklet-runtime/bindings/observers.js.map +1 -1
- package/runtime/package.json +37 -0
- package/runtime/src/core/background-function/exec-map.ts +44 -0
- package/runtime/src/core/background-function/handle.ts +31 -0
- package/runtime/src/core/background-function/run-on-background.ts +151 -0
- package/runtime/src/core/commit-context.ts +26 -0
- package/runtime/src/core/compat/legacy-react-runtime.ts +39 -0
- package/runtime/src/core/compat/lynxComponent.ts +91 -0
- package/runtime/src/core/component.ts +152 -0
- package/runtime/src/core/forceRootRender.ts +52 -0
- package/runtime/src/core/globalProps.ts +111 -0
- package/runtime/src/core/hooks/mainThread.ts +9 -0
- package/runtime/src/core/hooks/mainThreadImpl.ts +226 -0
- package/runtime/src/core/hooks/react.ts +172 -0
- package/runtime/src/core/hooks/useLynxGlobalEventListener.ts +59 -0
- package/runtime/src/core/initData.ts +191 -0
- package/runtime/src/core/lynx/dynamic-import.ts +37 -0
- package/runtime/src/core/lynx/lazy-bundle.ts +352 -0
- package/runtime/src/core/lynx/runtime-backend.ts +30 -0
- package/runtime/src/core/lynx-data-processors.ts +85 -0
- package/runtime/src/core/lynx-page-data.ts +22 -0
- package/runtime/src/core/lynx-update-data.ts +47 -0
- package/runtime/src/core/main-thread-function.ts +12 -0
- package/runtime/src/core/main-thread-ref-init-value.ts +29 -0
- package/runtime/src/core/main-thread-ref.ts +225 -0
- package/runtime/src/core/mts-capability.ts +21 -0
- package/runtime/src/core/performance.ts +186 -0
- package/runtime/src/core/ref.ts +181 -0
- package/runtime/src/core/reload-version.ts +13 -0
- package/runtime/src/core/runtime-destroy.ts +22 -0
- package/runtime/src/core/thread-function-call/main-thread.ts +81 -0
- package/runtime/src/core/thread-function-call/return-value.ts +77 -0
- package/runtime/src/document.ts +86 -0
- package/runtime/src/element-template/background/attr-slots.ts +132 -0
- package/runtime/src/element-template/background/commit-context.ts +47 -0
- package/runtime/src/element-template/background/commit-hook.ts +211 -0
- package/runtime/src/element-template/background/destroy.ts +34 -0
- package/runtime/src/element-template/background/document.ts +41 -0
- package/runtime/src/element-template/background/hydrate.ts +605 -0
- package/runtime/src/element-template/background/hydration-listener.ts +198 -0
- package/runtime/src/element-template/background/instance.ts +820 -0
- package/runtime/src/element-template/background/manager.ts +89 -0
- package/runtime/src/element-template/background/page-root-hydrate.ts +23 -0
- package/runtime/src/element-template/background/render-scope.ts +52 -0
- package/runtime/src/element-template/client/root.ts +71 -0
- package/runtime/src/element-template/debug/alog.ts +238 -0
- package/runtime/src/element-template/debug/elementPAPICall.ts +89 -0
- package/runtime/src/element-template/debug/profile.ts +194 -0
- package/runtime/src/element-template/hydration-map.ts +13 -0
- package/runtime/src/element-template/index.ts +138 -0
- package/runtime/src/element-template/internal.ts +69 -0
- package/runtime/src/element-template/jsx-dev-runtime/index.ts +4 -0
- package/runtime/src/element-template/jsx-runtime/index.ts +86 -0
- package/runtime/src/element-template/lynx/env.ts +59 -0
- package/runtime/src/element-template/lynx/performance.ts +20 -0
- package/runtime/src/element-template/native/callDestroyLifetimeFun.ts +10 -0
- package/runtime/src/element-template/native/index.ts +92 -0
- package/runtime/src/element-template/native/main-thread-api.ts +55 -0
- package/runtime/src/element-template/native/mts-destroy.ts +46 -0
- package/runtime/src/element-template/native/patch-listener.ts +136 -0
- package/runtime/src/element-template/native/reload-background.ts +43 -0
- package/runtime/src/element-template/native/reload-main-thread.ts +76 -0
- package/runtime/src/element-template/prop-adapters/event-value.ts +11 -0
- package/runtime/src/element-template/prop-adapters/event.ts +87 -0
- package/runtime/src/element-template/prop-adapters/ref.ts +148 -0
- package/runtime/src/element-template/prop-adapters/spread.ts +66 -0
- package/runtime/src/element-template/protocol/lifecycle-constant.ts +8 -0
- package/runtime/src/element-template/protocol/opcodes.ts +18 -0
- package/runtime/src/element-template/protocol/page.ts +7 -0
- package/runtime/src/element-template/protocol/template-type.ts +56 -0
- package/runtime/src/element-template/protocol/types.ts +229 -0
- package/runtime/src/element-template/protocol/update-event.ts +46 -0
- package/runtime/src/element-template/runtime/list/list.ts +829 -0
- package/runtime/src/element-template/runtime/page/authored-page.ts +53 -0
- package/runtime/src/element-template/runtime/page/page.ts +21 -0
- package/runtime/src/element-template/runtime/page/root-instance.ts +25 -0
- package/runtime/src/element-template/runtime/patch.ts +517 -0
- package/runtime/src/element-template/runtime/render/render-main-thread.ts +81 -0
- package/runtime/src/element-template/runtime/render/render-opcodes.ts +313 -0
- package/runtime/src/element-template/runtime/render/render-to-opcodes.ts +411 -0
- package/runtime/src/element-template/runtime/template/attr-slot-plan.ts +153 -0
- package/runtime/src/element-template/runtime/template/handle.ts +95 -0
- package/runtime/src/element-template/runtime/template/main-thread-background-function.ts +48 -0
- package/runtime/src/element-template/runtime/template/main-thread-dynamic-attr-state.ts +242 -0
- package/runtime/src/element-template/runtime/template/main-thread-event-ctx.ts +46 -0
- package/runtime/src/element-template/runtime/template/main-thread-function.ts +32 -0
- package/runtime/src/element-template/runtime/template/main-thread-ref-ctx.ts +95 -0
- package/runtime/src/element-template/runtime/template/registry.ts +72 -0
- package/runtime/src/element-template/runtime/template/typed-attributes.ts +25 -0
- package/runtime/src/element-template/runtime-backend-marker.ts +7 -0
- package/runtime/src/element-template/types.d.ts +128 -0
- package/runtime/src/index.ts +95 -0
- package/runtime/src/internal.ts +102 -0
- package/runtime/src/lynx-api.ts +563 -0
- package/runtime/src/lynx.ts +93 -0
- package/runtime/src/root.ts +38 -0
- package/runtime/src/runtime-backend-marker.ts +7 -0
- package/runtime/src/shared/attribute-name.ts +109 -0
- package/runtime/src/shared/component-stack.ts +168 -0
- package/runtime/src/shared/index-map.ts +26 -0
- package/runtime/src/shared/profile.ts +36 -0
- package/runtime/src/shared/render-constants.ts +42 -0
- package/runtime/src/snapshot/alog/elementPAPICall.ts +132 -0
- package/runtime/src/snapshot/alog/index.ts +8 -0
- package/runtime/src/snapshot/alog/render.ts +33 -0
- package/runtime/src/snapshot/compat/componentIs.ts +30 -0
- package/runtime/src/snapshot/debug/debug.ts +9 -0
- package/runtime/src/snapshot/debug/describeInvalidValue.ts +25 -0
- package/runtime/src/snapshot/debug/formatPatch.ts +28 -0
- package/runtime/src/snapshot/debug/printSnapshot.ts +63 -0
- package/runtime/src/snapshot/debug/profileHooks.ts +271 -0
- package/runtime/src/snapshot/debug/vnodeSource.ts +82 -0
- package/runtime/src/snapshot/gesture/processGesture.ts +274 -0
- package/runtime/src/snapshot/gesture/processGestureBagkround.ts +94 -0
- package/runtime/src/snapshot/gesture/types.ts +46 -0
- package/runtime/src/snapshot/index.ts +5 -0
- package/runtime/src/snapshot/lifecycle/constant.ts +29 -0
- package/runtime/src/snapshot/lifecycle/destroy.ts +38 -0
- package/runtime/src/snapshot/lifecycle/event/delayEvents.ts +11 -0
- package/runtime/src/snapshot/lifecycle/event/delayLifecycleEvents.ts +15 -0
- package/runtime/src/snapshot/lifecycle/event/firstScreenSync.ts +97 -0
- package/runtime/src/snapshot/lifecycle/isRendering.ts +27 -0
- package/runtime/src/snapshot/lifecycle/patch/commit.ts +278 -0
- package/runtime/src/snapshot/lifecycle/patch/error.ts +66 -0
- package/runtime/src/snapshot/lifecycle/patch/globalState.ts +16 -0
- package/runtime/src/snapshot/lifecycle/patch/isMainThreadHydrating.ts +13 -0
- package/runtime/src/snapshot/lifecycle/patch/nodesRefApply.ts +119 -0
- package/runtime/src/snapshot/lifecycle/patch/snapshotPatch.ts +97 -0
- package/runtime/src/snapshot/lifecycle/patch/snapshotPatchApply.ts +170 -0
- package/runtime/src/snapshot/lifecycle/patch/updateMainThread.ts +115 -0
- package/runtime/src/snapshot/lifecycle/ref/delay.ts +82 -0
- package/runtime/src/snapshot/lifecycle/reload.ts +95 -0
- package/runtime/src/snapshot/lifecycle/render.ts +36 -0
- package/runtime/src/snapshot/list/list.ts +320 -0
- package/runtime/src/snapshot/list/listUpdateInfo.ts +265 -0
- package/runtime/src/snapshot/list/pendingListUpdates.ts +44 -0
- package/runtime/src/snapshot/lynx/calledByNative.ts +180 -0
- package/runtime/src/snapshot/lynx/children.ts +40 -0
- package/runtime/src/snapshot/lynx/element.ts +217 -0
- package/runtime/src/snapshot/lynx/env.ts +58 -0
- package/runtime/src/snapshot/lynx/injectLepusMethods.ts +53 -0
- package/runtime/src/snapshot/lynx/lazyBundleConstants.ts +9 -0
- package/runtime/src/snapshot/lynx/nodesRef.ts +47 -0
- package/runtime/src/snapshot/lynx/performance.ts +20 -0
- package/runtime/src/snapshot/lynx/portals.ts +203 -0
- package/runtime/src/snapshot/lynx/portalsPending.ts +62 -0
- package/runtime/src/snapshot/lynx/prepareLazyBundleMTS.ts +68 -0
- package/runtime/src/snapshot/lynx/runWithForce.ts +18 -0
- package/runtime/src/snapshot/lynx/suspense.ts +58 -0
- package/runtime/src/snapshot/lynx/tt.ts +281 -0
- package/runtime/src/snapshot/renderToOpcodes/hydrate.ts +465 -0
- package/runtime/src/snapshot/renderToOpcodes/index.ts +445 -0
- package/runtime/src/snapshot/renderToOpcodes/opcodes.ts +155 -0
- package/runtime/src/snapshot/snapshot/backgroundSnapshot.ts +822 -0
- package/runtime/src/snapshot/snapshot/constants.ts +27 -0
- package/runtime/src/snapshot/snapshot/definition.ts +258 -0
- package/runtime/src/snapshot/snapshot/dynamicPartType.ts +40 -0
- package/runtime/src/snapshot/snapshot/event.ts +33 -0
- package/runtime/src/snapshot/snapshot/gesture.ts +31 -0
- package/runtime/src/snapshot/snapshot/index.ts +8 -0
- package/runtime/src/snapshot/snapshot/list.ts +66 -0
- package/runtime/src/snapshot/snapshot/platformInfo.ts +109 -0
- package/runtime/src/snapshot/snapshot/reconstructInstanceTree.ts +46 -0
- package/runtime/src/snapshot/snapshot/ref.ts +116 -0
- package/runtime/src/snapshot/snapshot/snapshot.ts +627 -0
- package/runtime/src/snapshot/snapshot/snapshotCreatorMap.ts +33 -0
- package/runtime/src/snapshot/snapshot/snapshotInstanceHydrationMap.ts +17 -0
- package/runtime/src/snapshot/snapshot/snapshotInstanceManager.ts +22 -0
- package/runtime/src/snapshot/snapshot/spread.ts +378 -0
- package/runtime/src/snapshot/snapshot/types.ts +29 -0
- package/runtime/src/snapshot/snapshot/utils.ts +59 -0
- package/runtime/src/snapshot/snapshot/workletEvent.ts +73 -0
- package/runtime/src/snapshot/snapshot/workletRef.ts +97 -0
- package/runtime/src/snapshot/worklet/call/runOnMainThread.ts +37 -0
- package/runtime/src/snapshot/worklet/ctx.ts +22 -0
- package/runtime/src/snapshot/worklet/destroy.ts +14 -0
- package/runtime/src/snapshot/worklet/functionality.ts +22 -0
- package/runtime/src/snapshot/worklet/hmr.ts +34 -0
- package/runtime/src/snapshot/worklet/ref/updateInitValue.ts +30 -0
- package/runtime/src/utils.ts +134 -0
- package/runtime/src/worklet-runtime/api/animation/animation.ts +48 -0
- package/runtime/src/worklet-runtime/api/animation/effect.ts +20 -0
- package/runtime/src/worklet-runtime/api/element.ts +152 -0
- package/runtime/src/worklet-runtime/api/lepusQuerySelector.ts +34 -0
- package/runtime/src/worklet-runtime/api/lynxApi.ts +42 -0
- package/runtime/src/worklet-runtime/bindings/bindings.ts +91 -0
- package/runtime/src/worklet-runtime/bindings/events.ts +29 -0
- package/runtime/src/worklet-runtime/bindings/index.ts +12 -0
- package/runtime/src/worklet-runtime/bindings/loadRuntime.ts +25 -0
- package/runtime/src/worklet-runtime/bindings/observers.ts +61 -0
- package/runtime/src/worklet-runtime/bindings/types.ts +84 -0
- package/runtime/src/worklet-runtime/delayRunOnBackground.ts +51 -0
- package/runtime/src/worklet-runtime/delayWorkletEvent.ts +70 -0
- package/runtime/src/worklet-runtime/eomImpl.ts +14 -0
- package/runtime/src/worklet-runtime/eventPropagation.ts +56 -0
- package/runtime/src/worklet-runtime/global.ts +28 -0
- package/runtime/src/worklet-runtime/hydrate.ts +113 -0
- package/runtime/src/worklet-runtime/index.ts +12 -0
- package/runtime/src/worklet-runtime/jsFunctionLifecycle.ts +69 -0
- package/runtime/src/worklet-runtime/listeners.ts +28 -0
- package/runtime/src/worklet-runtime/runOnMainThread.ts +21 -0
- package/runtime/src/worklet-runtime/types/dev.d.ts +4 -0
- package/runtime/src/worklet-runtime/types/elementApi.d.ts +97 -0
- package/runtime/src/worklet-runtime/types/runtimeProxy.d.ts +32 -0
- package/runtime/src/worklet-runtime/types/systeminfo.d.ts +19 -0
- package/runtime/src/worklet-runtime/utils/mainThreadFlushLoopGuard.ts +87 -0
- package/runtime/src/worklet-runtime/utils/profile.ts +20 -0
- package/runtime/src/worklet-runtime/utils/version.ts +11 -0
- package/runtime/src/worklet-runtime/workletRef.ts +119 -0
- package/runtime/src/worklet-runtime/workletRuntime.ts +215 -0
- package/runtime/tsconfig.json +30 -0
- package/runtime/turbo.json +21 -0
- package/runtime/types/internal-preact.d.ts +67 -0
- package/runtime/types/types.d.ts +339 -0
- package/runtime/vitest.config.ts +181 -0
- package/runtime/worklet-runtime/dev.js +1 -1
- package/testing-library/.npmignore +6 -0
- package/testing-library/.turbo/turbo-build.log +28 -0
- package/testing-library/README.md +109 -0
- package/testing-library/dist/env/index.js +1 -2
- package/testing-library/dist/index.d.ts +1 -1
- package/testing-library/dist/rstest-config.d.ts +15 -1
- package/testing-library/dist/rstest-config.js +38 -5
- package/testing-library/dist/setupFiles/common/runtime-setup.js +3 -3
- package/testing-library/etc/react-lynx-testing-library.api.md +71 -0
- package/testing-library/loaders/jsx-loader.js +49 -0
- package/testing-library/node_modules/.bin/rsbuild +55 -0
- package/testing-library/node_modules/.bin/rspeedy +55 -0
- package/testing-library/node_modules/.bin/rstest +55 -0
- package/testing-library/package.json +28 -0
- package/testing-library/rslib.config.ts +97 -0
- package/testing-library/rstest.config.ts +44 -0
- package/testing-library/src/__tests__/3.1/text.test.jsx +109 -0
- package/testing-library/src/__tests__/act.test.jsx +348 -0
- package/testing-library/src/__tests__/alog.test.jsx +813 -0
- package/testing-library/src/__tests__/auto-cleanup-skip.test.jsx +25 -0
- package/testing-library/src/__tests__/auto-cleanup.test.jsx +12 -0
- package/testing-library/src/__tests__/background-only.test.jsx +45 -0
- package/testing-library/src/__tests__/button.test.jsx +25 -0
- package/testing-library/src/__tests__/cleanup.test.jsx +29 -0
- package/testing-library/src/__tests__/css/index.test.jsx +47 -0
- package/testing-library/src/__tests__/css/style1.css +3 -0
- package/testing-library/src/__tests__/css/style2.css +3 -0
- package/testing-library/src/__tests__/css/style3.module.css +3 -0
- package/testing-library/src/__tests__/dom-reuse.test.jsx +1515 -0
- package/testing-library/src/__tests__/end-to-end.test.jsx +212 -0
- package/testing-library/src/__tests__/events.test.jsx +368 -0
- package/testing-library/src/__tests__/lazy-bundle/LazyComponent.jsx +4 -0
- package/testing-library/src/__tests__/lazy-bundle/index.test.jsx +598 -0
- package/testing-library/src/__tests__/list.test.jsx +1015 -0
- package/testing-library/src/__tests__/lynx.test.jsx +85 -0
- package/testing-library/src/__tests__/portals.test.jsx +1303 -0
- package/testing-library/src/__tests__/preact-signals.test.jsx +190 -0
- package/testing-library/src/__tests__/raw-text.test.jsx +59 -0
- package/testing-library/src/__tests__/ref.test.jsx +573 -0
- package/testing-library/src/__tests__/remove-element.test.jsx +68 -0
- package/testing-library/src/__tests__/render.test.jsx +296 -0
- package/testing-library/src/__tests__/renderComponent.test.jsx +344 -0
- package/testing-library/src/__tests__/renderHook.test.jsx +61 -0
- package/testing-library/src/__tests__/rerender.test.jsx +62 -0
- package/testing-library/src/__tests__/rstest-config.test.js +31 -0
- package/testing-library/src/__tests__/slot-jsx.test.jsx +965 -0
- package/testing-library/src/__tests__/spread.test.jsx +212 -0
- package/testing-library/src/__tests__/stopwatch.test.jsx +80 -0
- package/testing-library/src/__tests__/text.test.jsx +130 -0
- package/testing-library/src/__tests__/worklet.test.jsx +618 -0
- package/testing-library/src/entry.ts +2 -0
- package/testing-library/src/env/index.ts +2 -0
- package/testing-library/src/env/rstest.ts +7 -0
- package/testing-library/src/env/vitest.ts +27 -0
- package/testing-library/src/fire-event.ts +199 -0
- package/testing-library/src/index.jsx +25 -0
- package/testing-library/src/plugins/index.ts +2 -0
- package/testing-library/src/plugins/vitest.ts +387 -0
- package/testing-library/src/pure.jsx +159 -0
- package/testing-library/src/rstest-config.ts +173 -0
- package/testing-library/src/setupFiles/common/bootstrap.js +6 -0
- package/testing-library/src/setupFiles/common/runtime-setup.js +142 -0
- package/testing-library/src/setupFiles/inner/rstest.js +13 -0
- package/testing-library/src/setupFiles/inner/vitest.js +17 -0
- package/testing-library/src/setupFiles/rstest.js +30 -0
- package/testing-library/src/setupFiles/vitest.js +29 -0
- package/testing-library/src/vitest.config.ts +14 -0
- package/testing-library/tsconfig.json +16 -0
- package/testing-library/turbo.json +21 -0
- package/testing-library/types/entry.d.ts +1 -1
- package/testing-library/vitest-polyfill.cjs +6 -0
- package/testing-library/vitest.3.1.config.ts +17 -0
- package/testing-library/vitest.config.ts +14 -0
- package/transform/.cargo/config.toml +2 -0
- package/transform/.gitignore +6 -0
- package/transform/.npmignore +8 -0
- package/transform/.turbo/turbo-build$colon$wasm.log +252 -0
- package/transform/Cargo.toml +45 -0
- package/transform/__test__/background-only.spec.js +222 -0
- package/transform/__test__/basic.bench.js +80 -0
- package/transform/__test__/css/__snapshots__/transform-all-css-scoped-all.js +18 -0
- package/transform/__test__/css/__snapshots__/transform-all-css-scoped-modules.js +18 -0
- package/transform/__test__/css/__snapshots__/transform-all-css-scoped-none.js +18 -0
- package/transform/__test__/css/__snapshots__/transform-imports-css-scoped-all.js +24 -0
- package/transform/__test__/css/__snapshots__/transform-imports-css-scoped-modules.js +24 -0
- package/transform/__test__/css/__snapshots__/transform-imports-css-scoped-none.js +24 -0
- package/transform/__test__/css/__snapshots__/transform-imports-defaults.js +5 -0
- package/transform/__test__/css/__snapshots__/transform-imports-without-jsx-css-scoped-all.js +5 -0
- package/transform/__test__/css/__snapshots__/transform-imports-without-jsx-css-scoped-modules.js +5 -0
- package/transform/__test__/css/__snapshots__/transform-imports-without-jsx-css-scoped-none.js +5 -0
- package/transform/__test__/css/__snapshots__/transform-jsx-css-scoped-all-lazy-bundle.js +50 -0
- package/transform/__test__/css/__snapshots__/transform-jsx-css-scoped-all.js +50 -0
- package/transform/__test__/css/__snapshots__/transform-jsx-css-scoped-modules-lazy-bundle.js +50 -0
- package/transform/__test__/css/__snapshots__/transform-jsx-css-scoped-modules.js +50 -0
- package/transform/__test__/css/__snapshots__/transform-jsx-css-scoped-none-lazy-bundle.js +50 -0
- package/transform/__test__/css/__snapshots__/transform-jsx-css-scoped-none.js +50 -0
- package/transform/__test__/css/__snapshots__/transform-jsx-defaults.js +50 -0
- package/transform/__test__/css/css-scope.spec.js +209 -0
- package/transform/__test__/css/inline-style.spec.js +53 -0
- package/transform/__test__/css/object-lit-style.spec.js +293 -0
- package/transform/__test__/defines.spec.js +321 -0
- package/transform/__test__/fixture.spec.js +2496 -0
- package/transform/__test__/typescript.spec.js +97 -0
- package/transform/build.rs +11 -0
- package/transform/crates/swc_plugin_background_only/Cargo.toml +13 -0
- package/transform/crates/swc_plugin_background_only/lib.rs +326 -0
- package/transform/crates/swc_plugin_background_only/tests/__swc_snapshots__/lib.rs/defaults_to_null_without_fallback.js +5 -0
- package/transform/crates/swc_plugin_background_only/tests/__swc_snapshots__/lib.rs/desugars_nested_background_only.js +5 -0
- package/transform/crates/swc_plugin_background_only/tests/__swc_snapshots__/lib.rs/desugars_to_thread_conditional_in_child_position.js +8 -0
- package/transform/crates/swc_plugin_background_only/tests/__swc_snapshots__/lib.rs/desugars_to_thread_conditional_in_expression_position.js +3 -0
- package/transform/crates/swc_plugin_background_only/tests/__swc_snapshots__/lib.rs/keeps_the_fragment_for_a_lone_text_child.js +3 -0
- package/transform/crates/swc_plugin_background_only/tests/__swc_snapshots__/lib.rs/renders_nothing_for_empty_children.js +5 -0
- package/transform/crates/swc_plugin_background_only/tests/__swc_snapshots__/lib.rs/unwraps_a_lone_child_past_layout_and_comments.js +3 -0
- package/transform/crates/swc_plugin_compat/Cargo.toml +24 -0
- package/transform/crates/swc_plugin_compat/is_component_class.rs +51 -0
- package/transform/crates/swc_plugin_compat/lib.rs +1885 -0
- package/transform/crates/swc_plugin_compat/napi.rs +526 -0
- package/transform/crates/swc_plugin_compat/simplify_ctor_like_react_lynx_2.rs +172 -0
- package/transform/crates/swc_plugin_compat/tests/__swc_snapshots__/lib.rs/should_add_component_element.js +17 -0
- package/transform/crates/swc_plugin_compat/tests/__swc_snapshots__/lib.rs/should_add_component_element_compiler_only.js +16 -0
- package/transform/crates/swc_plugin_compat/tests/__swc_snapshots__/lib.rs/should_add_component_element_embedded.js +2 -0
- package/transform/crates/swc_plugin_compat/tests/__swc_snapshots__/lib.rs/should_add_component_element_embedded_compiler_only.js +1 -0
- package/transform/crates/swc_plugin_compat/tests/__swc_snapshots__/lib.rs/should_add_component_is_import.js +3 -0
- package/transform/crates/swc_plugin_compat/tests/__swc_snapshots__/lib.rs/should_change_runtime_pkg.js +1 -0
- package/transform/crates/swc_plugin_compat/tests/__swc_snapshots__/lib.rs/should_handle_recursive.js +4 -0
- package/transform/crates/swc_plugin_compat/tests/__swc_snapshots__/lib.rs/should_left_no_remove_component_element_attr.js +1 -0
- package/transform/crates/swc_plugin_compat/tests/__swc_snapshots__/lib.rs/should_not_handle_jsx_member_expression.js +1 -0
- package/transform/crates/swc_plugin_compat/tests/__swc_snapshots__/lib.rs/should_not_rename_view_in_scope.js +6 -0
- package/transform/crates/swc_plugin_compat/tests/__swc_snapshots__/lib.rs/should_not_rename_view_redeclaration.js +4 -0
- package/transform/crates/swc_plugin_compat/tests/__swc_snapshots__/lib.rs/should_not_transform_event_props_when_disabled.js +1 -0
- package/transform/crates/swc_plugin_compat/tests/__swc_snapshots__/lib.rs/should_remove_component_attr_regex.js +8 -0
- package/transform/crates/swc_plugin_compat/tests/__swc_snapshots__/lib.rs/should_rename_view.js +1 -0
- package/transform/crates/swc_plugin_compat/tests/__swc_snapshots__/lib.rs/should_simplify_ctor.js +9 -0
- package/transform/crates/swc_plugin_compat/tests/__swc_snapshots__/lib.rs/should_simplify_ctor_correct_order.js +10 -0
- package/transform/crates/swc_plugin_compat/tests/__swc_snapshots__/lib.rs/should_simplify_ctor_not_remain_local_decls.js +9 -0
- package/transform/crates/swc_plugin_compat/tests/__swc_snapshots__/lib.rs/should_simplify_ctor_not_remain_local_decls_with_macro.js +19 -0
- package/transform/crates/swc_plugin_compat/tests/__swc_snapshots__/lib.rs/should_simplify_ctor_not_remain_local_decls_with_spread.js +12 -0
- package/transform/crates/swc_plugin_compat/tests/__swc_snapshots__/lib.rs/should_transform_event_props_1.js +1 -0
- package/transform/crates/swc_plugin_compat/tests/__swc_snapshots__/lib.rs/should_transform_event_props_2.js +1 -0
- package/transform/crates/swc_plugin_css_scope/Cargo.toml +18 -0
- package/transform/crates/swc_plugin_css_scope/lib.rs +327 -0
- package/transform/crates/swc_plugin_css_scope/napi.rs +144 -0
- package/transform/crates/swc_plugin_css_scope/tests/__swc_snapshots__/lib.rs/scoped_all_transform_imports.js +5 -0
- package/transform/crates/swc_plugin_css_scope/tests/__swc_snapshots__/lib.rs/scoped_all_transform_imports_without_jsx.js +4 -0
- package/transform/crates/swc_plugin_css_scope/tests/__swc_snapshots__/lib.rs/scoped_modules_transform_imports.js +5 -0
- package/transform/crates/swc_plugin_css_scope/tests/__swc_snapshots__/lib.rs/scoped_modules_transform_imports_without_jsx.js +4 -0
- package/transform/crates/swc_plugin_css_scope/tests/__swc_snapshots__/lib.rs/scoped_none_transform_imports.js +5 -0
- package/transform/crates/swc_plugin_css_scope/tests/__swc_snapshots__/lib.rs/scoped_none_transform_imports_without_jsx.js +4 -0
- package/transform/crates/swc_plugin_define_dce/Cargo.toml +15 -0
- package/transform/crates/swc_plugin_define_dce/lib.rs +21 -0
- package/transform/crates/swc_plugin_define_dce/napi.rs +79 -0
- package/transform/crates/swc_plugin_directive_dce/Cargo.toml +18 -0
- package/transform/crates/swc_plugin_directive_dce/lib.rs +489 -0
- package/transform/crates/swc_plugin_directive_dce/napi.rs +65 -0
- package/transform/crates/swc_plugin_directive_dce/tests/__swc_snapshots__/lib.rs/should_do_nothing_in_mixed_target.js +6 -0
- package/transform/crates/swc_plugin_directive_dce/tests/__swc_snapshots__/lib.rs/should_do_nothing_when_arrow_function_return_directive.js +1 -0
- package/transform/crates/swc_plugin_directive_dce/tests/__swc_snapshots__/lib.rs/should_eliminate_async_arrow_with_background_only_directive.js +1 -0
- package/transform/crates/swc_plugin_directive_dce/tests/__swc_snapshots__/lib.rs/should_eliminate_background_only_generator_forms.js +7 -0
- package/transform/crates/swc_plugin_directive_dce/tests/__swc_snapshots__/lib.rs/should_eliminate_fn_body_in_component_props.js +1 -0
- package/transform/crates/swc_plugin_directive_dce/tests/__swc_snapshots__/lib.rs/should_eliminate_fn_decl.js +1 -0
- package/transform/crates/swc_plugin_directive_dce/tests/__swc_snapshots__/lib.rs/should_eliminate_js_only_but_keep_constructor.js +6 -0
- package/transform/crates/swc_plugin_directive_dce/tests/__swc_snapshots__/lib.rs/should_eliminate_js_only_class_method.js +4 -0
- package/transform/crates/swc_plugin_directive_dce/tests/__swc_snapshots__/lib.rs/should_eliminate_js_only_class_property.js +4 -0
- package/transform/crates/swc_plugin_directive_dce/tests/__swc_snapshots__/lib.rs/should_eliminate_js_only_embedded.js +5 -0
- package/transform/crates/swc_plugin_directive_dce/tests/__swc_snapshots__/lib.rs/should_eliminate_native_modules_in_default_params.js +1 -0
- package/transform/crates/swc_plugin_directive_dce/tests/__swc_snapshots__/lib.rs/should_eliminate_transpiled_async_arrow_with_background_only_generator.js +1 -0
- package/transform/crates/swc_plugin_dynamic_import/Cargo.toml +18 -0
- package/transform/crates/swc_plugin_dynamic_import/lib.rs +408 -0
- package/transform/crates/swc_plugin_dynamic_import/napi.rs +89 -0
- package/transform/crates/swc_plugin_dynamic_import/tests/__swc_snapshots__/lib.rs/should_import_lazy_bundle.js +4 -0
- package/transform/crates/swc_plugin_dynamic_import/tests/__swc_snapshots__/lib.rs/should_import_lazy_import.js +9 -0
- package/transform/crates/swc_plugin_dynamic_import/tests/__swc_snapshots__/lib.rs/should_not_import_lazy.js +3 -0
- package/transform/crates/swc_plugin_dynamic_import/tests/__swc_snapshots__/lib.rs/should_transform_import_call.js +61 -0
- package/transform/crates/swc_plugin_element_template/Cargo.toml +29 -0
- package/transform/crates/swc_plugin_element_template/asset.rs +64 -0
- package/transform/crates/swc_plugin_element_template/attr_name.rs +77 -0
- package/transform/crates/swc_plugin_element_template/extractor.rs +484 -0
- package/transform/crates/swc_plugin_element_template/lib.rs +734 -0
- package/transform/crates/swc_plugin_element_template/lowering.rs +125 -0
- package/transform/crates/swc_plugin_element_template/napi.rs +168 -0
- package/transform/crates/swc_plugin_element_template/template_attribute.rs +31 -0
- package/transform/crates/swc_plugin_element_template/template_definition.rs +375 -0
- package/transform/crates/swc_plugin_element_template/template_identity.rs +160 -0
- package/transform/crates/swc_plugin_element_template/template_slot.rs +81 -0
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_generate_attribute_slots_for_dynamic_attributes.snap +81 -0
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_handle_background_conditional_attributes.snap +44 -0
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_handle_boolean_and_number_attributes.snap +62 -0
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_handle_complex_text_structure.snap +120 -0
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_handle_dataset_attributes.snap +62 -0
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_handle_deeply_nested_user_components.snap +54 -0
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_handle_dynamic_class_attributes.snap +57 -0
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_handle_events_js.snap +57 -0
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_handle_events_lepus.snap +57 -0
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_handle_id_attributes.snap +57 -0
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_handle_inline_styles.snap +82 -0
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_handle_interpolated_text_with_siblings_js.snap +85 -0
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_handle_interpolated_text_with_siblings_lepus.snap +85 -0
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_handle_mixed_content.snap +82 -0
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_handle_nested_structure_and_dynamic_content.snap +143 -0
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_handle_refs_js.snap +52 -0
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_handle_refs_lepus.snap +52 -0
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_handle_sibling_user_components.snap +69 -0
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_handle_spread_attributes.snap +56 -0
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_handle_user_component.snap +54 -0
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_isolate_arrays_with_child_slot_placeholder.snap +56 -0
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_keep_code_and_template_attribute_slots_in_sync_for_spread.snap +66 -0
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_output_element_template_simple_lepus.snap +52 -0
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_output_template_with_static_attributes.snap +62 -0
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_verify_template_structure_complex.snap +69 -0
- package/transform/crates/swc_plugin_element_template/tests/__combined_snapshots__/should_verify_text_attribute_and_child_text_slots.snap +70 -0
- package/transform/crates/swc_plugin_element_template/tests/element_template.rs +1207 -0
- package/transform/crates/swc_plugin_element_template/tests/element_template_contract.rs +930 -0
- package/transform/crates/swc_plugin_inject/Cargo.toml +18 -0
- package/transform/crates/swc_plugin_inject/lib.rs +344 -0
- package/transform/crates/swc_plugin_inject/napi.rs +150 -0
- package/transform/crates/swc_plugin_inject/tests/__swc_snapshots__/lib.rs/should_inject.js +8 -0
- package/transform/crates/swc_plugin_inject/tests/__swc_snapshots__/lib.rs/should_inject_callee.js +1 -0
- package/transform/crates/swc_plugin_list/Cargo.toml +15 -0
- package/transform/crates/swc_plugin_list/legacy_slot.rs +410 -0
- package/transform/crates/swc_plugin_list/lib.rs +631 -0
- package/transform/crates/swc_plugin_list/tests/__swc_snapshots__/legacy_slot.rs/basic_list_legacy_slot.js +61 -0
- package/transform/crates/swc_plugin_list/tests/__swc_snapshots__/legacy_slot.rs/basic_list_toplevel_legacy_slot.js +40 -0
- package/transform/crates/swc_plugin_list/tests/__swc_snapshots__/legacy_slot.rs/basic_list_with_fragment_legacy_slot.js +65 -0
- package/transform/crates/swc_plugin_list/tests/__swc_snapshots__/legacy_slot.rs/should_transform_list_in_view_legacy_slot.js +6 -0
- package/transform/crates/swc_plugin_list/tests/__swc_snapshots__/legacy_slot.rs/should_transform_list_in_view_with_snapshot_legacy_slot.js +49 -0
- package/transform/crates/swc_plugin_list/tests/__swc_snapshots__/legacy_slot.rs/should_transform_list_item_deferred_in_list_legacy_slot.js +5 -0
- package/transform/crates/swc_plugin_list/tests/__swc_snapshots__/legacy_slot.rs/should_transform_list_item_deferred_with_children_with_snapshot_legacy_slot.js +95 -0
- package/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/basic_list.js +53 -0
- package/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/basic_list_toplevel.js +40 -0
- package/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/basic_list_with_fragment.js +57 -0
- package/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_not_transform_list_item_with_defer_false.js +1 -0
- package/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_in_view.js +6 -0
- package/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_in_view_with_snapshot.js +54 -0
- package/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_in_view_with_static_sibling.js +7 -0
- package/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_in_view_with_static_sibling_nested.js +16 -0
- package/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_in_view_with_static_sibling_with_snapshot.js +65 -0
- package/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_in_view_with_static_sibling_with_snapshot_nested.js +138 -0
- package/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_basic.js +2 -0
- package/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_in_list.js +5 -0
- package/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children.js +6 -0
- package/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js +95 -0
- package/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_not_deferred.js +1 -0
- package/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_when_defer_is_expr.js +4 -0
- package/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_with_spread_deferred.js +2 -0
- package/transform/crates/swc_plugin_shake/Cargo.toml +20 -0
- package/transform/crates/swc_plugin_shake/is_component_class.rs +66 -0
- package/transform/crates/swc_plugin_shake/lib.rs +908 -0
- package/transform/crates/swc_plugin_shake/napi.rs +220 -0
- package/transform/crates/swc_plugin_shake/tests/__swc_snapshots__/lib.rs/only_shake_class_like_react_component_class.js +10 -0
- package/transform/crates/swc_plugin_shake/tests/__swc_snapshots__/lib.rs/should_keep_access_inside_class_property_iife.js +11 -0
- package/transform/crates/swc_plugin_shake/tests/__swc_snapshots__/lib.rs/should_keep_constructor_and_used.js +12 -0
- package/transform/crates/swc_plugin_shake/tests/__swc_snapshots__/lib.rs/should_keep_indirect.js +12 -0
- package/transform/crates/swc_plugin_shake/tests/__swc_snapshots__/lib.rs/should_keep_render_and_used.js +11 -0
- package/transform/crates/swc_plugin_shake/tests/__swc_snapshots__/lib.rs/should_keep_state_and_remove_other.js +8 -0
- package/transform/crates/swc_plugin_shake/tests/__swc_snapshots__/lib.rs/should_keep_use_effect_call_from_custom_runtime.js +6 -0
- package/transform/crates/swc_plugin_shake/tests/__swc_snapshots__/lib.rs/should_keep_with_nested_class.js +11 -0
- package/transform/crates/swc_plugin_shake/tests/__swc_snapshots__/lib.rs/should_not_remove_call_in_scope_id.js +5 -0
- package/transform/crates/swc_plugin_shake/tests/__swc_snapshots__/lib.rs/should_not_remove_in_scope_id.js +5 -0
- package/transform/crates/swc_plugin_shake/tests/__swc_snapshots__/lib.rs/should_not_remove_test_with_other_runtime.js +3 -0
- package/transform/crates/swc_plugin_shake/tests/__swc_snapshots__/lib.rs/should_remove_aliased_use_effect_call.js +4 -0
- package/transform/crates/swc_plugin_shake/tests/__swc_snapshots__/lib.rs/should_remove_aliased_use_effect_call_by_local_name.js +4 -0
- package/transform/crates/swc_plugin_shake/tests/__swc_snapshots__/lib.rs/should_remove_aliased_use_effect_param.js +4 -0
- package/transform/crates/swc_plugin_shake/tests/__swc_snapshots__/lib.rs/should_remove_aliased_use_effect_param_by_local_name.js +4 -0
- package/transform/crates/swc_plugin_shake/tests/__swc_snapshots__/lib.rs/should_remove_default_and_namespace_runtime_import_calls.js +6 -0
- package/transform/crates/swc_plugin_shake/tests/__swc_snapshots__/lib.rs/should_remove_default_and_namespace_runtime_import_params.js +6 -0
- package/transform/crates/swc_plugin_shake/tests/__swc_snapshots__/lib.rs/should_remove_test.js +5 -0
- package/transform/crates/swc_plugin_shake/tests/__swc_snapshots__/lib.rs/should_remove_unused_indirect.js +5 -0
- package/transform/crates/swc_plugin_shake/tests/__swc_snapshots__/lib.rs/should_remove_use_effect_call.js +8 -0
- package/transform/crates/swc_plugin_shake/tests/__swc_snapshots__/lib.rs/should_remove_use_effect_param.js +8 -0
- package/transform/crates/swc_plugin_shake/tests/__swc_snapshots__/lib.rs/should_replace_use_effect_call_with_undefined.js +2 -0
- package/transform/crates/swc_plugin_snapshot/Cargo.toml +25 -0
- package/transform/crates/swc_plugin_snapshot/attr_name.rs +84 -0
- package/transform/crates/swc_plugin_snapshot/legacy_slot.rs +2201 -0
- package/transform/crates/swc_plugin_snapshot/lib.rs +3495 -0
- package/transform/crates/swc_plugin_snapshot/napi.rs +184 -0
- package/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/legacy_slot.rs/basic_component_legacy_slot.js +10 -0
- package/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/legacy_slot.rs/basic_component_with_static_sibling_jsx_dev_legacy_slot.js +35 -0
- package/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/legacy_slot.rs/basic_component_with_static_sibling_jsx_legacy_slot.js +27 -0
- package/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/legacy_slot.rs/basic_component_with_static_sibling_legacy_slot.js +24 -0
- package/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/legacy_slot.rs/basic_expr_container_legacy_slot.js +10 -0
- package/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/legacy_slot.rs/basic_expr_container_with_static_sibling_legacy_slot.js +24 -0
- package/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/legacy_slot.rs/basic_spread_list_item_legacy_slot.js +42 -0
- package/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/legacy_slot.rs/full_static_children_map_jsx_legacy_slot.js +44 -0
- package/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/legacy_slot.rs/page_component_legacy_slot.js +15 -0
- package/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/legacy_slot.rs/page_element_dev_legacy_slot.js +16 -0
- package/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/legacy_slot.rs/page_element_legacy_slot.js +16 -0
- package/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/legacy_slot.rs/should_create_raw_text_node_for_text_node_legacy_slot.js +55 -0
- package/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/legacy_slot.rs/should_emit_list_item_platform_info_marker_for_spread_props_legacy_slot.js +32 -0
- package/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/legacy_slot.rs/should_inject_implicit_flatten_legacy_slot.js +67 -0
- package/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/legacy_slot.rs/should_not_wrap_dynamic_part.js +29 -0
- package/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/legacy_slot.rs/should_wrap_dynamic_key_legacy_slot.js +54 -0
- package/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/legacy_slot.rs/should_wrap_dynamic_part.js +34 -0
- package/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js +10 -0
- package/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component_with_static_sibling.js +24 -0
- package/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component_with_static_sibling_jsx.js +27 -0
- package/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component_with_static_sibling_jsx_dev.js +35 -0
- package/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_event.js +26 -0
- package/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_expr_container.js +10 -0
- package/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_expr_container_with_static_sibling.js +24 -0
- package/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_full_static.js +25 -0
- package/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_full_static_snapshot_extract.js +16 -0
- package/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_full_static_snapshot_extract_it.js +21 -0
- package/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_ref.js +45 -0
- package/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_spread.js +30 -0
- package/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_spread_list_item.js +30 -0
- package/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_timing_flag.js +31 -0
- package/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/empty_module.js +1 -0
- package/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/external_bundle_uses_card_entry_name.js +16 -0
- package/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/full_static_children_comments.js +19 -0
- package/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/full_static_children_map_jsx.js +28 -0
- package/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/full_static_children_new_line.js +25 -0
- package/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/full_static_children_self_close.js +25 -0
- package/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/gesture.js +26 -0
- package/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/inline_style_literal.js +11 -0
- package/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/inline_style_literal_unknown_property.js +11 -0
- package/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/mode_development_spread.js +24 -0
- package/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/page_component.js +15 -0
- package/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/page_element.js +16 -0
- package/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/page_element_dev.js +16 -0
- package/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_create_raw_text_node_for_text_node.js +47 -0
- package/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_emit_list_item_platform_info_marker_for_non_zero_value_index.js +25 -0
- package/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_emit_list_item_platform_info_marker_for_spread_props.js +22 -0
- package/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_escape_newline_character.js +55 -0
- package/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id.js +71 -0
- package/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id_dynamic_component.js +71 -0
- package/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id_dynamic_component_without_css_id.js +69 -0
- package/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id_without_css_id.js +69 -0
- package/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_inject_implicit_flatten.js +59 -0
- package/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_set_attribute_for_text_node.js +44 -0
- package/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_static_extract_dynamic_inline_style.js +69 -0
- package/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_static_extract_inline_style.js +21 -0
- package/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_wrap_dynamic_key.js +46 -0
- package/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/worklet.js +35 -0
- package/transform/crates/swc_plugin_text/Cargo.toml +14 -0
- package/transform/crates/swc_plugin_text/lib.rs +93 -0
- package/transform/crates/swc_plugin_text/tests/__swc_snapshots__/lib.rs/should_keep_children_for_dynamic_or_multiple_text.js +9 -0
- package/transform/crates/swc_plugin_text/tests/__swc_snapshots__/lib.rs/should_transform_single_static_text_to_text_attr.js +8 -0
- package/transform/crates/swc_plugin_worklet/Cargo.toml +24 -0
- package/transform/crates/swc_plugin_worklet/decl_collect.rs +226 -0
- package/transform/crates/swc_plugin_worklet/extract_ident.rs +460 -0
- package/transform/crates/swc_plugin_worklet/gen_stmt.rs +326 -0
- package/transform/crates/swc_plugin_worklet/globals.rs +104 -0
- package/transform/crates/swc_plugin_worklet/hash.rs +29 -0
- package/transform/crates/swc_plugin_worklet/lib.rs +2869 -0
- package/transform/crates/swc_plugin_worklet/napi.rs +116 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/class_in_worklet_1.js +3 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_add_worklet_runtime_ident_with_inner_ident.js +13 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_add_worklet_runtime_ident_with_outer_ident.js +13 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_capture_env_js.js +12 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_capture_env_lepus.js +35 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_extract_ident_from_this_js.js +6 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_extract_ident_from_this_lepus.js +15 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_extract_idents_outside_of_ctx.js +9 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_extract_member_expr_2_js.js +29 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_extract_member_expr_2_lepus.js +54 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_extract_member_expr_3_js.js +12 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_extract_member_expr_3_lepus.js +89 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_extract_member_expr_4_js.js +3 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_extract_member_expr_4_lepus.js +13 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_extract_member_expr_js.js +23 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_extract_member_expr_lepus.js +46 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_handle_renamed_import_shadowing_js.js +16 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_not_capture_globals.js +15 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_not_capture_type_annotations.js +22 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_not_destructure_from_closure.js +12 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_not_extract_catch_clause_params.js +17 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_not_extract_ident_from_this.js +9 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_not_extract_idents_inside_of_ctx.js +24 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_not_transform_constructor.js +7 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_not_transform_getter_and_setter.js +13 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_not_transform_recursively.js +23 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_not_transform_when_wrong_directives.js +14 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_skip_shared_identifiers_default_import_js.js +12 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_skip_shared_identifiers_js.js +12 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_skip_shared_identifiers_lepus.js +23 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_skip_shared_identifiers_namespace_import_js.js +12 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_skip_shared_identifiers_string_key_js.js +12 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_arrow_function.js +15 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_fn_decl_js.js +6 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_fn_decl_lepus.js +16 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_function_expr.js +15 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_in_class_js.js +11 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_in_class_js_capture_values.js +11 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_in_class_lepus.js +17 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_in_class_property_js.js +14 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_in_class_property_js_capture_values.js +11 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_in_class_property_lepus.js +21 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_in_class_static_js.js +9 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_in_class_static_lepus.js +18 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_in_class_static_property_js.js +9 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_in_class_static_property_lepus.js +17 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_js.js +15 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_js_fn_in_run_on_js_js.js +10 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_js_fn_in_run_on_js_lepus.js +25 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_js_general.js +9 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_lepus.js +34 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_lepus_alias.js +20 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_lepus_general.js +20 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_lepus_general_mixed.js +20 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_multiple_worklets.js +29 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_multiple_worklets_in_func.js +31 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_ui_worklet_js.js +6 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_ui_worklet_lepus.js +15 -0
- package/transform/crates/swc_plugin_worklet/worklet_type.rs +24 -0
- package/transform/crates/swc_plugins_shared/Cargo.toml +27 -0
- package/transform/crates/swc_plugins_shared/css.rs +64 -0
- package/transform/crates/swc_plugins_shared/defines.rs +51 -0
- package/transform/crates/swc_plugins_shared/engine_version.rs +50 -0
- package/transform/crates/swc_plugins_shared/jsx_helpers.rs +451 -0
- package/transform/crates/swc_plugins_shared/lib.rs +12 -0
- package/transform/crates/swc_plugins_shared/lynx_event.rs +159 -0
- package/transform/crates/swc_plugins_shared/target.rs +66 -0
- package/transform/crates/swc_plugins_shared/target_napi.rs +69 -0
- package/transform/crates/swc_plugins_shared/transform_mode.rs +61 -0
- package/transform/crates/swc_plugins_shared/transform_mode_napi.rs +72 -0
- package/transform/crates/swc_plugins_shared/utils.rs +149 -0
- package/transform/dist/wasm.cjs +1 -1
- package/transform/node_modules/.bin/esbuild +46 -0
- package/transform/node_modules/.bin/napi +55 -0
- package/transform/package.json +42 -0
- package/transform/rspack-napi/lib/index.d.ts +32 -0
- package/transform/rspack-napi/lib/index.js +96 -0
- package/transform/rspack-napi/lib/index.js.map +1 -0
- package/transform/rspack-napi/package.json +25 -0
- package/transform/rspack-napi/src/index.ts +161 -0
- package/transform/rspack-napi/tsconfig.json +17 -0
- package/transform/rspack-napi/tsconfig.tsbuildinfo +1 -0
- package/transform/scripts/build_wasm.js +55 -0
- package/transform/src/bundle.rs +249 -0
- package/transform/src/esbuild.rs +201 -0
- package/transform/src/lib.rs +1197 -0
- package/transform/src/swc_plugin_compat_post/mod.rs +143 -0
- package/transform/src/swc_plugin_extract_str/mod.rs +382 -0
- package/transform/src/swc_plugin_refresh/mod.rs +546 -0
- package/transform/src/swc_plugin_transform_builtin_attribute_names/mod.rs +286 -0
- package/transform/src/swc_plugin_worklet_post_process/mod.rs +100 -0
- package/transform/src/wasm.js +39 -0
- package/transform/swc-plugin-reactlynx/.cargo/config.toml +9 -0
- package/transform/swc-plugin-reactlynx/.gitignore +2 -0
- package/transform/swc-plugin-reactlynx/.turbo/turbo-build.log +346 -0
- package/transform/swc-plugin-reactlynx/Cargo.toml +30 -0
- package/transform/swc-plugin-reactlynx/build.js +27 -0
- package/transform/swc-plugin-reactlynx/index.d.ts +273 -0
- package/transform/swc-plugin-reactlynx/package.json +22 -0
- package/transform/swc-plugin-reactlynx/src/lib.rs +606 -0
- package/transform/swc-plugin-reactlynx/swc_plugin_reactlynx.wasm +0 -0
- package/transform/swc-plugin-reactlynx/turbo.json +18 -0
- package/transform/swc-plugin-reactlynx-compat/.cargo/config.toml +9 -0
- package/transform/swc-plugin-reactlynx-compat/.gitignore +2 -0
- package/transform/swc-plugin-reactlynx-compat/.turbo/turbo-build.log +256 -0
- package/transform/swc-plugin-reactlynx-compat/Cargo.toml +17 -0
- package/transform/swc-plugin-reactlynx-compat/build.js +27 -0
- package/transform/swc-plugin-reactlynx-compat/index.d.ts +326 -0
- package/transform/swc-plugin-reactlynx-compat/package.json +22 -0
- package/transform/swc-plugin-reactlynx-compat/src/lib.rs +15 -0
- package/transform/swc-plugin-reactlynx-compat/swc_plugin_reactlynx_compat.wasm +0 -0
- package/transform/swc-plugin-reactlynx-compat/turbo.json +18 -0
- package/transform/tests/__swc_snapshots__/src/swc_plugin_compat_post/mod.rs/should_compat_dark_mode.js +3 -0
- package/transform/tests/__swc_snapshots__/src/swc_plugin_compat_post/mod.rs/should_compat_dark_mode_custom_theme_expr.js +3 -0
- package/transform/tests/__swc_snapshots__/src/swc_plugin_extract_str/mod.rs/should_extract_str.js +21 -0
- package/transform/tests/__swc_snapshots__/src/swc_plugin_extract_str/mod.rs/should_extract_str_with_arr.js +20 -0
- package/transform/tests/__swc_snapshots__/src/swc_plugin_extract_str/mod.rs/should_extract_tpl_str.js +9 -0
- package/transform/tests/__swc_snapshots__/src/swc_plugin_refresh/mod.rs/should_handle_basic.js +4 -0
- package/transform/tests/__swc_snapshots__/src/swc_plugin_refresh/mod.rs/should_handle_custom_library.js +4 -0
- package/transform/tests/__swc_snapshots__/src/swc_plugin_refresh/mod.rs/should_handle_function_parameter.js +4 -0
- package/transform/tests/__swc_snapshots__/src/swc_plugin_refresh/mod.rs/should_handle_import_computed.js +4 -0
- package/transform/tests/__swc_snapshots__/src/swc_plugin_refresh/mod.rs/should_handle_import_default.js +4 -0
- package/transform/tests/__swc_snapshots__/src/swc_plugin_refresh/mod.rs/should_handle_import_named_computed.js +4 -0
- package/transform/tests/__swc_snapshots__/src/swc_plugin_refresh/mod.rs/should_handle_import_namespace_computed.js +4 -0
- package/transform/tests/__swc_snapshots__/src/swc_plugin_refresh/mod.rs/should_handle_init_value.js +10 -0
- package/transform/tests/__swc_snapshots__/src/swc_plugin_refresh/mod.rs/should_handle_local_ident.js +8 -0
- package/transform/tests/__swc_snapshots__/src/swc_plugin_refresh/mod.rs/should_handle_multiple_index.js +21 -0
- package/transform/tests/__swc_snapshots__/src/swc_plugin_worklet_post_process/mod.rs/should_transform_worklet.js +12 -0
- package/transform/tests/__swc_snapshots__/src/swc_plugin_worklet_post_process/mod.rs/should_transform_worklet_2.js +14 -0
- package/transform/turbo.json +38 -0
- package/transform/vitest.config.ts +19 -0
|
@@ -0,0 +1,1249 @@
|
|
|
1
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
2
|
+
|
|
3
|
+
import { WorkletEvents } from '@lynx-js/react/worklet-runtime/bindings';
|
|
4
|
+
|
|
5
|
+
import { MainThreadRef, clearMainThreadRefLastIdForTesting } from '../../../../src/core/main-thread-ref.js';
|
|
6
|
+
import { takeMainThreadRefInitValuePatch } from '../../../../src/core/main-thread-ref-init-value.js';
|
|
7
|
+
import { clearMtsConfigCacheForTesting } from '../../../../src/core/mts-capability.js';
|
|
8
|
+
import { getReloadVersion, increaseReloadVersion } from '../../../../src/core/reload-version.js';
|
|
9
|
+
import * as elementTemplateAlog from '../../../../src/element-template/debug/alog.js';
|
|
10
|
+
import { globalCommitContext } from '../../../../src/element-template/background/commit-context.js';
|
|
11
|
+
import {
|
|
12
|
+
installElementTemplateHydrationListener,
|
|
13
|
+
resetElementTemplateHydrationListener,
|
|
14
|
+
} from '../../../../src/element-template/background/hydration-listener.js';
|
|
15
|
+
import {
|
|
16
|
+
installElementTemplatePatchListener,
|
|
17
|
+
resetElementTemplatePatchListener,
|
|
18
|
+
} from '../../../../src/element-template/native/patch-listener.js';
|
|
19
|
+
import {
|
|
20
|
+
BackgroundElementTemplateInstance,
|
|
21
|
+
BackgroundListElementTemplateInstance,
|
|
22
|
+
} from '../../../../src/element-template/background/instance.js';
|
|
23
|
+
import { backgroundElementTemplateInstanceManager } from '../../../../src/element-template/background/manager.js';
|
|
24
|
+
import { PerformanceTimingFlags, PipelineOrigins, globalPipelineOptions } from '../../../../src/core/performance.js';
|
|
25
|
+
import {
|
|
26
|
+
clearEventState,
|
|
27
|
+
flushPendingEvents,
|
|
28
|
+
publishEvent,
|
|
29
|
+
resetEventStateForRuntime,
|
|
30
|
+
} from '../../../../src/element-template/prop-adapters/event.js';
|
|
31
|
+
import {
|
|
32
|
+
ElementTemplateRefProxy,
|
|
33
|
+
clearRefState,
|
|
34
|
+
flushDelayedRefUiOps,
|
|
35
|
+
flushPendingRefs,
|
|
36
|
+
} from '../../../../src/element-template/prop-adapters/ref.js';
|
|
37
|
+
import { ElementTemplateLifecycleConstant } from '../../../../src/element-template/protocol/lifecycle-constant.js';
|
|
38
|
+
import { ElementTemplateUpdateOps } from '../../../../src/element-template/protocol/opcodes.js';
|
|
39
|
+
import { parseElementTemplateUpdateEventPayload } from '../../../../src/element-template/protocol/update-event.js';
|
|
40
|
+
import type {
|
|
41
|
+
SerializableValue,
|
|
42
|
+
SerializedCompiledNode,
|
|
43
|
+
SerializedEtNode,
|
|
44
|
+
SerializedPageRoot,
|
|
45
|
+
SerializedTypedNode,
|
|
46
|
+
SerializedTypedListNode,
|
|
47
|
+
} from '../../../../src/element-template/protocol/types.js';
|
|
48
|
+
import { __root } from '../../../../src/element-template/runtime/page/root-instance.js';
|
|
49
|
+
import {
|
|
50
|
+
__etAttrPlanMap,
|
|
51
|
+
adaptEventAttrSlot,
|
|
52
|
+
adaptRefAttrSlot,
|
|
53
|
+
adaptSpreadAttrSlot,
|
|
54
|
+
clearEtAttrPlanMap,
|
|
55
|
+
} from '../../../../src/element-template/runtime/template/attr-slot-plan.js';
|
|
56
|
+
import {
|
|
57
|
+
enqueueDelayedRunOnMainThreadData,
|
|
58
|
+
takeDelayedRunOnMainThreadData,
|
|
59
|
+
} from '../../../../src/core/thread-function-call/main-thread.js';
|
|
60
|
+
import { runOnMainThread } from '../../../../src/element-template/runtime/template/main-thread-function.js';
|
|
61
|
+
import { resetFunctionCallReturnListener } from '../../../../src/core/thread-function-call/return-value.js';
|
|
62
|
+
import { ElementTemplateEnvManager } from '../../test-utils/debug/envManager.js';
|
|
63
|
+
|
|
64
|
+
import '../../../../src/element-template/native/index.js';
|
|
65
|
+
|
|
66
|
+
function createSerializedTemplate(handleId: number, templateKey: string): SerializedCompiledNode {
|
|
67
|
+
return {
|
|
68
|
+
templateKey,
|
|
69
|
+
attributeSlots: [],
|
|
70
|
+
childSlots: [],
|
|
71
|
+
uid: handleId,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
interface LynxMock {
|
|
76
|
+
getJSContext(): { dispatchEvent(event: { type: string; data: unknown }): number };
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
interface TTMock {
|
|
80
|
+
callDestroyLifetimeFun?: () => void;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function parseUpdateEventData(data: unknown): unknown {
|
|
84
|
+
return parseElementTemplateUpdateEventPayload(data);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function dispatchHydrate(
|
|
88
|
+
instances: SerializedEtNode[],
|
|
89
|
+
reloadVersion = getReloadVersion(),
|
|
90
|
+
attributes: SerializedPageRoot['attributes'] = null,
|
|
91
|
+
): void {
|
|
92
|
+
lynx.getJSContext().dispatchEvent({
|
|
93
|
+
type: ElementTemplateLifecycleConstant.hydrate,
|
|
94
|
+
data: {
|
|
95
|
+
page: {
|
|
96
|
+
tag: 'page',
|
|
97
|
+
attributes,
|
|
98
|
+
childSlots: [instances],
|
|
99
|
+
uid: 0,
|
|
100
|
+
},
|
|
101
|
+
reloadVersion,
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
describe('ElementTemplate hydration listener', () => {
|
|
107
|
+
const envManager = new ElementTemplateEnvManager();
|
|
108
|
+
let originalLynxSdkVersion: string | undefined;
|
|
109
|
+
|
|
110
|
+
beforeEach(() => {
|
|
111
|
+
vi.clearAllMocks();
|
|
112
|
+
originalLynxSdkVersion = SystemInfo.lynxSdkVersion;
|
|
113
|
+
SystemInfo.lynxSdkVersion = '4.0';
|
|
114
|
+
clearMainThreadRefLastIdForTesting();
|
|
115
|
+
clearMtsConfigCacheForTesting();
|
|
116
|
+
takeMainThreadRefInitValuePatch();
|
|
117
|
+
clearEtAttrPlanMap();
|
|
118
|
+
clearEventState();
|
|
119
|
+
clearRefState();
|
|
120
|
+
resetElementTemplateHydrationListener();
|
|
121
|
+
envManager.resetEnv('background');
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
afterEach(() => {
|
|
125
|
+
globalThis.__ALOG__ = true;
|
|
126
|
+
resetElementTemplateHydrationListener();
|
|
127
|
+
clearRefState();
|
|
128
|
+
takeMainThreadRefInitValuePatch();
|
|
129
|
+
takeDelayedRunOnMainThreadData();
|
|
130
|
+
resetFunctionCallReturnListener();
|
|
131
|
+
SystemInfo.lynxSdkVersion = originalLynxSdkVersion;
|
|
132
|
+
clearMtsConfigCacheForTesting();
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
it('hydrates instances sent from main thread', () => {
|
|
136
|
+
envManager.switchToBackground();
|
|
137
|
+
installElementTemplateHydrationListener();
|
|
138
|
+
|
|
139
|
+
const backgroundRoot = __root as BackgroundElementTemplateInstance;
|
|
140
|
+
const after = new BackgroundElementTemplateInstance('_et_test');
|
|
141
|
+
backgroundRoot.appendChild(after);
|
|
142
|
+
const oldId = after.instanceId;
|
|
143
|
+
|
|
144
|
+
envManager.switchToMainThread();
|
|
145
|
+
const instances: SerializedCompiledNode[] = [
|
|
146
|
+
createSerializedTemplate(-1, '_et_test'),
|
|
147
|
+
createSerializedTemplate(-2, '_et_test'),
|
|
148
|
+
];
|
|
149
|
+
dispatchHydrate(instances);
|
|
150
|
+
|
|
151
|
+
const lynxObj = (globalThis as unknown as { lynx: LynxMock }).lynx;
|
|
152
|
+
lynxObj.getJSContext().dispatchEvent({
|
|
153
|
+
type: '_unknown',
|
|
154
|
+
data: { not: 'an array' },
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
envManager.switchToBackground();
|
|
158
|
+
|
|
159
|
+
expect(backgroundElementTemplateInstanceManager.get(oldId)).toBeUndefined();
|
|
160
|
+
expect(backgroundElementTemplateInstanceManager.get(-1)).toBe(after);
|
|
161
|
+
expect(backgroundElementTemplateInstanceManager.get(-2)).toBeUndefined();
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
it('dispatches hydration boundary after clean hydrate without ops', () => {
|
|
165
|
+
envManager.switchToBackground();
|
|
166
|
+
installElementTemplateHydrationListener();
|
|
167
|
+
const dispatchSpy = vi.spyOn(lynx.getCoreContext(), 'dispatchEvent');
|
|
168
|
+
|
|
169
|
+
const backgroundRoot = __root as BackgroundElementTemplateInstance;
|
|
170
|
+
const after = new BackgroundElementTemplateInstance('_et_test');
|
|
171
|
+
backgroundRoot.appendChild(after);
|
|
172
|
+
|
|
173
|
+
envManager.switchToMainThread();
|
|
174
|
+
dispatchHydrate([createSerializedTemplate(after.instanceId, '_et_test')]);
|
|
175
|
+
|
|
176
|
+
envManager.switchToBackground();
|
|
177
|
+
const updatePayload = parseUpdateEventData(dispatchSpy.mock.calls.at(-1)?.[0]?.data);
|
|
178
|
+
expect(updatePayload).toEqual({
|
|
179
|
+
ops: [],
|
|
180
|
+
flushOptions: {
|
|
181
|
+
pipelineOptions: {
|
|
182
|
+
pipelineID: 'pipelineID',
|
|
183
|
+
needTimestamps: true,
|
|
184
|
+
pipelineOrigin: PipelineOrigins.reactLynxHydrate,
|
|
185
|
+
dsl: 'reactLynx',
|
|
186
|
+
stage: 'hydrate',
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
flowIds: undefined,
|
|
190
|
+
isHydration: true,
|
|
191
|
+
reloadVersion: getReloadVersion(),
|
|
192
|
+
delayedRunOnMainThreadData: undefined,
|
|
193
|
+
});
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
it('dispatches delayed-only runOnMainThread payloads after clean hydrate', () => {
|
|
197
|
+
envManager.switchToBackground();
|
|
198
|
+
installElementTemplateHydrationListener();
|
|
199
|
+
const dispatchSpy = vi.spyOn(lynx.getCoreContext(), 'dispatchEvent');
|
|
200
|
+
|
|
201
|
+
const backgroundRoot = __root as BackgroundElementTemplateInstance;
|
|
202
|
+
const after = new BackgroundElementTemplateInstance('_et_test');
|
|
203
|
+
backgroundRoot.appendChild(after);
|
|
204
|
+
const delayedData = {
|
|
205
|
+
worklet: { _wkltId: 'clean-hydrate-main-thread-function' },
|
|
206
|
+
params: ['from-hydrate'],
|
|
207
|
+
resolveId: 1,
|
|
208
|
+
};
|
|
209
|
+
enqueueDelayedRunOnMainThreadData(delayedData);
|
|
210
|
+
|
|
211
|
+
envManager.switchToMainThread();
|
|
212
|
+
dispatchHydrate([createSerializedTemplate(after.instanceId, '_et_test')]);
|
|
213
|
+
|
|
214
|
+
envManager.switchToBackground();
|
|
215
|
+
const updatePayload = parseUpdateEventData(dispatchSpy.mock.calls.at(-1)?.[0]?.data);
|
|
216
|
+
expect(updatePayload).toEqual({
|
|
217
|
+
ops: [],
|
|
218
|
+
flushOptions: {
|
|
219
|
+
pipelineOptions: {
|
|
220
|
+
pipelineID: 'pipelineID',
|
|
221
|
+
needTimestamps: true,
|
|
222
|
+
pipelineOrigin: PipelineOrigins.reactLynxHydrate,
|
|
223
|
+
dsl: 'reactLynx',
|
|
224
|
+
stage: 'hydrate',
|
|
225
|
+
},
|
|
226
|
+
},
|
|
227
|
+
flowIds: undefined,
|
|
228
|
+
isHydration: true,
|
|
229
|
+
reloadVersion: getReloadVersion(),
|
|
230
|
+
delayedRunOnMainThreadData: [delayedData],
|
|
231
|
+
});
|
|
232
|
+
expect(takeDelayedRunOnMainThreadData()).toEqual([]);
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
it('dispatches MainThreadRef init-value patch after clean hydrate', () => {
|
|
236
|
+
envManager.switchToBackground();
|
|
237
|
+
installElementTemplateHydrationListener();
|
|
238
|
+
const dispatchSpy = vi.spyOn(lynx.getCoreContext(), 'dispatchEvent');
|
|
239
|
+
|
|
240
|
+
const backgroundRoot = __root as BackgroundElementTemplateInstance;
|
|
241
|
+
const after = new BackgroundElementTemplateInstance('_et_test');
|
|
242
|
+
backgroundRoot.appendChild(after);
|
|
243
|
+
new MainThreadRef('hydrate-init');
|
|
244
|
+
|
|
245
|
+
envManager.switchToMainThread();
|
|
246
|
+
dispatchHydrate([createSerializedTemplate(after.instanceId, '_et_test')]);
|
|
247
|
+
|
|
248
|
+
envManager.switchToBackground();
|
|
249
|
+
const updatePayload = parseUpdateEventData(dispatchSpy.mock.calls.at(-1)?.[0]?.data);
|
|
250
|
+
expect(updatePayload).toEqual({
|
|
251
|
+
ops: [],
|
|
252
|
+
flushOptions: {
|
|
253
|
+
pipelineOptions: {
|
|
254
|
+
pipelineID: 'pipelineID',
|
|
255
|
+
needTimestamps: true,
|
|
256
|
+
pipelineOrigin: PipelineOrigins.reactLynxHydrate,
|
|
257
|
+
dsl: 'reactLynx',
|
|
258
|
+
stage: 'hydrate',
|
|
259
|
+
},
|
|
260
|
+
},
|
|
261
|
+
flowIds: undefined,
|
|
262
|
+
isHydration: true,
|
|
263
|
+
reloadVersion: getReloadVersion(),
|
|
264
|
+
delayedRunOnMainThreadData: undefined,
|
|
265
|
+
mainThreadRefInitValuePatch: [[1, 'hydrate-init']],
|
|
266
|
+
});
|
|
267
|
+
expect(takeMainThreadRefInitValuePatch()).toEqual([]);
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
it('applies MainThreadRef init values when reload makes the hydration update stale', () => {
|
|
271
|
+
const updateWorkletRefInitValueChanges = vi.fn();
|
|
272
|
+
const previousWorkletImpl = globalThis.lynxWorkletImpl;
|
|
273
|
+
globalThis.lynxWorkletImpl = {
|
|
274
|
+
...previousWorkletImpl,
|
|
275
|
+
_refImpl: {
|
|
276
|
+
updateWorkletRefInitValueChanges,
|
|
277
|
+
},
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
try {
|
|
281
|
+
envManager.switchToBackground();
|
|
282
|
+
installElementTemplateHydrationListener();
|
|
283
|
+
|
|
284
|
+
const backgroundRoot = __root as BackgroundElementTemplateInstance;
|
|
285
|
+
const after = new BackgroundElementTemplateInstance('_et_test');
|
|
286
|
+
backgroundRoot.appendChild(after);
|
|
287
|
+
new MainThreadRef('reload-init');
|
|
288
|
+
|
|
289
|
+
envManager.switchToMainThread();
|
|
290
|
+
installElementTemplatePatchListener();
|
|
291
|
+
dispatchHydrate([createSerializedTemplate(after.instanceId, '_et_test')]);
|
|
292
|
+
|
|
293
|
+
envManager.switchToBackground();
|
|
294
|
+
// This harness shares module state across both simulated threads. Advance
|
|
295
|
+
// the version after BTS dispatch so the queued update is stale on MTS.
|
|
296
|
+
increaseReloadVersion();
|
|
297
|
+
vi.mocked(__FlushElementTree).mockClear();
|
|
298
|
+
envManager.switchToMainThread();
|
|
299
|
+
|
|
300
|
+
expect(updateWorkletRefInitValueChanges).toHaveBeenCalledWith([[1, 'reload-init']]);
|
|
301
|
+
expect(__FlushElementTree).not.toHaveBeenCalled();
|
|
302
|
+
} finally {
|
|
303
|
+
envManager.switchToMainThread();
|
|
304
|
+
resetElementTemplatePatchListener();
|
|
305
|
+
globalThis.lynxWorkletImpl = previousWorkletImpl;
|
|
306
|
+
envManager.switchToBackground();
|
|
307
|
+
}
|
|
308
|
+
});
|
|
309
|
+
|
|
310
|
+
it('clears delayed runOnMainThread state when hydrate matching fails', () => {
|
|
311
|
+
SystemInfo.lynxSdkVersion = '4.0';
|
|
312
|
+
envManager.switchToBackground();
|
|
313
|
+
installElementTemplateHydrationListener();
|
|
314
|
+
const removeEventListener = vi.spyOn(lynx.getCoreContext(), 'removeEventListener');
|
|
315
|
+
const oldReportError = lynx.reportError;
|
|
316
|
+
const reportError = vi.fn();
|
|
317
|
+
lynx.reportError = reportError;
|
|
318
|
+
|
|
319
|
+
try {
|
|
320
|
+
const backgroundRoot = __root as BackgroundElementTemplateInstance;
|
|
321
|
+
const after = new BackgroundElementTemplateInstance('_et_test');
|
|
322
|
+
backgroundRoot.appendChild(after);
|
|
323
|
+
const worklet = { _wkltId: 'failed-hydrate-main-thread-function' };
|
|
324
|
+
|
|
325
|
+
void runOnMainThread(worklet as unknown as () => void)();
|
|
326
|
+
expect(takeDelayedRunOnMainThreadData()).toEqual([
|
|
327
|
+
{
|
|
328
|
+
worklet,
|
|
329
|
+
params: [],
|
|
330
|
+
resolveId: 1,
|
|
331
|
+
},
|
|
332
|
+
]);
|
|
333
|
+
void runOnMainThread(worklet as unknown as () => void)();
|
|
334
|
+
|
|
335
|
+
envManager.switchToMainThread();
|
|
336
|
+
dispatchHydrate([createSerializedTemplate(0, '_et_test')]);
|
|
337
|
+
|
|
338
|
+
envManager.switchToBackground();
|
|
339
|
+
expect(reportError).toHaveBeenCalledTimes(1);
|
|
340
|
+
expect(String(reportError.mock.calls[0]?.[0]?.message ?? '')).toContain(
|
|
341
|
+
'ElementTemplate hydrate received invalid uid 0 for \'_et_test\'',
|
|
342
|
+
);
|
|
343
|
+
expect(takeDelayedRunOnMainThreadData()).toEqual([]);
|
|
344
|
+
expect(removeEventListener).toHaveBeenCalledWith(WorkletEvents.FunctionCallRet, expect.any(Function));
|
|
345
|
+
expect(globalPipelineOptions).toBeUndefined();
|
|
346
|
+
} finally {
|
|
347
|
+
lynx.reportError = oldReportError;
|
|
348
|
+
}
|
|
349
|
+
});
|
|
350
|
+
|
|
351
|
+
it('clears MainThreadRef init-value patch when hydrate matching fails', () => {
|
|
352
|
+
SystemInfo.lynxSdkVersion = '4.0';
|
|
353
|
+
const oldReportError = lynx.reportError;
|
|
354
|
+
const reportError = vi.fn();
|
|
355
|
+
lynx.reportError = reportError;
|
|
356
|
+
|
|
357
|
+
try {
|
|
358
|
+
envManager.switchToBackground();
|
|
359
|
+
installElementTemplateHydrationListener();
|
|
360
|
+
|
|
361
|
+
const backgroundRoot = __root as BackgroundElementTemplateInstance;
|
|
362
|
+
const after = new BackgroundElementTemplateInstance('_et_test');
|
|
363
|
+
backgroundRoot.appendChild(after);
|
|
364
|
+
new MainThreadRef('failed-hydrate-init');
|
|
365
|
+
|
|
366
|
+
envManager.switchToMainThread();
|
|
367
|
+
dispatchHydrate([createSerializedTemplate(0, '_et_test')]);
|
|
368
|
+
|
|
369
|
+
envManager.switchToBackground();
|
|
370
|
+
expect(takeMainThreadRefInitValuePatch()).toEqual([]);
|
|
371
|
+
expect(reportError).toHaveBeenCalledTimes(1);
|
|
372
|
+
} finally {
|
|
373
|
+
lynx.reportError = oldReportError;
|
|
374
|
+
}
|
|
375
|
+
});
|
|
376
|
+
|
|
377
|
+
it('ignores stale hydrate payloads from before reload', () => {
|
|
378
|
+
envManager.switchToBackground();
|
|
379
|
+
installElementTemplateHydrationListener();
|
|
380
|
+
|
|
381
|
+
const backgroundRoot = __root as BackgroundElementTemplateInstance;
|
|
382
|
+
const after = new BackgroundElementTemplateInstance('_et_test');
|
|
383
|
+
backgroundRoot.appendChild(after);
|
|
384
|
+
const oldId = after.instanceId;
|
|
385
|
+
const staleReloadVersion = getReloadVersion();
|
|
386
|
+
increaseReloadVersion();
|
|
387
|
+
|
|
388
|
+
envManager.switchToMainThread();
|
|
389
|
+
dispatchHydrate([createSerializedTemplate(-1, '_et_test')], staleReloadVersion);
|
|
390
|
+
|
|
391
|
+
envManager.switchToBackground();
|
|
392
|
+
expect(backgroundElementTemplateInstanceManager.get(oldId)).toBe(after);
|
|
393
|
+
expect(backgroundElementTemplateInstanceManager.get(-1)).toBeUndefined();
|
|
394
|
+
});
|
|
395
|
+
|
|
396
|
+
it('hydrates typed list roots sent from main thread', () => {
|
|
397
|
+
const oldReportError = lynx.reportError;
|
|
398
|
+
const reportError = vi.fn();
|
|
399
|
+
lynx.reportError = reportError;
|
|
400
|
+
|
|
401
|
+
try {
|
|
402
|
+
envManager.switchToBackground();
|
|
403
|
+
installElementTemplateHydrationListener();
|
|
404
|
+
|
|
405
|
+
const backgroundRoot = __root as BackgroundElementTemplateInstance;
|
|
406
|
+
const list = new BackgroundListElementTemplateInstance();
|
|
407
|
+
const item = new BackgroundElementTemplateInstance('_et_list_item');
|
|
408
|
+
list.setAttribute('attributes', { id: 'feed' });
|
|
409
|
+
list.appendChild(item);
|
|
410
|
+
backgroundRoot.appendChild(list);
|
|
411
|
+
const oldListId = list.instanceId;
|
|
412
|
+
const oldItemId = item.instanceId;
|
|
413
|
+
|
|
414
|
+
envManager.switchToMainThread();
|
|
415
|
+
dispatchHydrate([
|
|
416
|
+
{
|
|
417
|
+
tag: 'list',
|
|
418
|
+
attributes: { id: 'feed' },
|
|
419
|
+
childSlots: null,
|
|
420
|
+
uid: -1,
|
|
421
|
+
options: {
|
|
422
|
+
listChildren: [createSerializedTemplate(-2, '_et_list_item')],
|
|
423
|
+
},
|
|
424
|
+
} satisfies SerializedTypedListNode,
|
|
425
|
+
]);
|
|
426
|
+
|
|
427
|
+
envManager.switchToBackground();
|
|
428
|
+
|
|
429
|
+
expect(reportError).not.toHaveBeenCalled();
|
|
430
|
+
expect(globalCommitContext.ops).toEqual([]);
|
|
431
|
+
expect(backgroundElementTemplateInstanceManager.get(oldListId)).toBeUndefined();
|
|
432
|
+
expect(backgroundElementTemplateInstanceManager.get(oldItemId)).toBeUndefined();
|
|
433
|
+
expect(backgroundElementTemplateInstanceManager.get(-1)).toBe(list);
|
|
434
|
+
expect(backgroundElementTemplateInstanceManager.get(-2)).toBe(item);
|
|
435
|
+
} finally {
|
|
436
|
+
lynx.reportError = oldReportError;
|
|
437
|
+
}
|
|
438
|
+
});
|
|
439
|
+
|
|
440
|
+
it('reconciles root type mismatch through page slot update instead of hydrate failure', () => {
|
|
441
|
+
const oldReportError = lynx.reportError;
|
|
442
|
+
const reportError = vi.fn();
|
|
443
|
+
lynx.reportError = reportError;
|
|
444
|
+
|
|
445
|
+
try {
|
|
446
|
+
envManager.switchToBackground();
|
|
447
|
+
installElementTemplateHydrationListener();
|
|
448
|
+
const dispatchSpy = vi.spyOn(lynx.getCoreContext(), 'dispatchEvent');
|
|
449
|
+
|
|
450
|
+
const backgroundRoot = __root as BackgroundElementTemplateInstance;
|
|
451
|
+
const after = new BackgroundElementTemplateInstance('_et_after', ['after']);
|
|
452
|
+
backgroundRoot.appendChild(after);
|
|
453
|
+
const afterLocalId = after.instanceId;
|
|
454
|
+
|
|
455
|
+
envManager.switchToMainThread();
|
|
456
|
+
dispatchHydrate([createSerializedTemplate(-1, '_et_before')]);
|
|
457
|
+
|
|
458
|
+
envManager.switchToBackground();
|
|
459
|
+
|
|
460
|
+
const updateCall = dispatchSpy.mock.calls.find(([event]) =>
|
|
461
|
+
(event as { type: string }).type === ElementTemplateLifecycleConstant.update
|
|
462
|
+
);
|
|
463
|
+
const updatePayload = parseUpdateEventData(updateCall?.[0].data);
|
|
464
|
+
expect(reportError).not.toHaveBeenCalled();
|
|
465
|
+
expect(updateCall?.[0]).toMatchObject({ type: ElementTemplateLifecycleConstant.update });
|
|
466
|
+
expect(updatePayload).toMatchObject({
|
|
467
|
+
isHydration: true,
|
|
468
|
+
reloadVersion: getReloadVersion(),
|
|
469
|
+
ops: [
|
|
470
|
+
ElementTemplateUpdateOps.removeNode,
|
|
471
|
+
0,
|
|
472
|
+
0,
|
|
473
|
+
-1,
|
|
474
|
+
[-1],
|
|
475
|
+
ElementTemplateUpdateOps.createTemplate,
|
|
476
|
+
afterLocalId,
|
|
477
|
+
'_et_after',
|
|
478
|
+
null,
|
|
479
|
+
['after'],
|
|
480
|
+
[],
|
|
481
|
+
ElementTemplateUpdateOps.insertNode,
|
|
482
|
+
0,
|
|
483
|
+
0,
|
|
484
|
+
afterLocalId,
|
|
485
|
+
0,
|
|
486
|
+
null,
|
|
487
|
+
],
|
|
488
|
+
});
|
|
489
|
+
expect(backgroundElementTemplateInstanceManager.get(afterLocalId)).toBe(after);
|
|
490
|
+
expect(backgroundElementTemplateInstanceManager.get(-1)).toBeUndefined();
|
|
491
|
+
} finally {
|
|
492
|
+
lynx.reportError = oldReportError;
|
|
493
|
+
}
|
|
494
|
+
});
|
|
495
|
+
|
|
496
|
+
it('inserts background-only roots during hydrate', () => {
|
|
497
|
+
envManager.switchToBackground();
|
|
498
|
+
installElementTemplateHydrationListener();
|
|
499
|
+
const dispatchSpy = vi.spyOn(lynx.getCoreContext(), 'dispatchEvent');
|
|
500
|
+
|
|
501
|
+
const backgroundRoot = __root as BackgroundElementTemplateInstance;
|
|
502
|
+
const after = new BackgroundElementTemplateInstance('_et_after');
|
|
503
|
+
backgroundRoot.appendChild(after);
|
|
504
|
+
const afterLocalId = after.instanceId;
|
|
505
|
+
|
|
506
|
+
envManager.switchToMainThread();
|
|
507
|
+
dispatchHydrate([]);
|
|
508
|
+
|
|
509
|
+
envManager.switchToBackground();
|
|
510
|
+
|
|
511
|
+
const updateCall = dispatchSpy.mock.calls.find(([event]) =>
|
|
512
|
+
(event as { type: string }).type === ElementTemplateLifecycleConstant.update
|
|
513
|
+
);
|
|
514
|
+
const updatePayload = parseUpdateEventData(updateCall?.[0].data);
|
|
515
|
+
expect(updateCall?.[0]).toMatchObject({ type: ElementTemplateLifecycleConstant.update });
|
|
516
|
+
expect(updatePayload).toMatchObject({
|
|
517
|
+
isHydration: true,
|
|
518
|
+
reloadVersion: getReloadVersion(),
|
|
519
|
+
ops: [
|
|
520
|
+
ElementTemplateUpdateOps.createTemplate,
|
|
521
|
+
afterLocalId,
|
|
522
|
+
'_et_after',
|
|
523
|
+
null,
|
|
524
|
+
[],
|
|
525
|
+
[],
|
|
526
|
+
ElementTemplateUpdateOps.insertNode,
|
|
527
|
+
0,
|
|
528
|
+
0,
|
|
529
|
+
afterLocalId,
|
|
530
|
+
0,
|
|
531
|
+
null,
|
|
532
|
+
],
|
|
533
|
+
});
|
|
534
|
+
});
|
|
535
|
+
|
|
536
|
+
it('removes serialized-only roots during hydrate', () => {
|
|
537
|
+
envManager.switchToBackground();
|
|
538
|
+
installElementTemplateHydrationListener();
|
|
539
|
+
const dispatchSpy = vi.spyOn(lynx.getCoreContext(), 'dispatchEvent');
|
|
540
|
+
|
|
541
|
+
envManager.switchToMainThread();
|
|
542
|
+
dispatchHydrate([createSerializedTemplate(-1, '_et_stale')]);
|
|
543
|
+
|
|
544
|
+
envManager.switchToBackground();
|
|
545
|
+
|
|
546
|
+
const updateCall = dispatchSpy.mock.calls.find(([event]) =>
|
|
547
|
+
(event as { type: string }).type === ElementTemplateLifecycleConstant.update
|
|
548
|
+
);
|
|
549
|
+
const updatePayload = parseUpdateEventData(updateCall?.[0].data);
|
|
550
|
+
expect(updateCall?.[0]).toMatchObject({ type: ElementTemplateLifecycleConstant.update });
|
|
551
|
+
expect(updatePayload).toMatchObject({
|
|
552
|
+
isHydration: true,
|
|
553
|
+
reloadVersion: getReloadVersion(),
|
|
554
|
+
ops: [
|
|
555
|
+
ElementTemplateUpdateOps.removeNode,
|
|
556
|
+
0,
|
|
557
|
+
0,
|
|
558
|
+
-1,
|
|
559
|
+
[-1],
|
|
560
|
+
],
|
|
561
|
+
});
|
|
562
|
+
expect(backgroundElementTemplateInstanceManager.get(-1)).toBeUndefined();
|
|
563
|
+
});
|
|
564
|
+
|
|
565
|
+
it('schedules delayed cleanup for removed subtrees produced during hydration', () => {
|
|
566
|
+
vi.useFakeTimers();
|
|
567
|
+
try {
|
|
568
|
+
envManager.switchToBackground();
|
|
569
|
+
installElementTemplateHydrationListener();
|
|
570
|
+
const dispatchSpy = vi.spyOn(lynx.getCoreContext(), 'dispatchEvent');
|
|
571
|
+
|
|
572
|
+
const backgroundRoot = __root as BackgroundElementTemplateInstance;
|
|
573
|
+
const host = new BackgroundElementTemplateInstance('_et_test');
|
|
574
|
+
backgroundRoot.appendChild(host);
|
|
575
|
+
const stale = new BackgroundElementTemplateInstance('_et_stale');
|
|
576
|
+
|
|
577
|
+
envManager.switchToMainThread();
|
|
578
|
+
dispatchHydrate([
|
|
579
|
+
{
|
|
580
|
+
...createSerializedTemplate(host.instanceId, '_et_test'),
|
|
581
|
+
childSlots: [[createSerializedTemplate(stale.instanceId, '_et_stale')]],
|
|
582
|
+
},
|
|
583
|
+
]);
|
|
584
|
+
|
|
585
|
+
envManager.switchToBackground();
|
|
586
|
+
expect(dispatchSpy).toHaveBeenCalledWith({
|
|
587
|
+
type: ElementTemplateLifecycleConstant.update,
|
|
588
|
+
data: expect.anything(),
|
|
589
|
+
});
|
|
590
|
+
expect(parseUpdateEventData(dispatchSpy.mock.calls.at(-1)?.[0]?.data)).toEqual(
|
|
591
|
+
expect.objectContaining({
|
|
592
|
+
isHydration: true,
|
|
593
|
+
reloadVersion: getReloadVersion(),
|
|
594
|
+
}),
|
|
595
|
+
);
|
|
596
|
+
vi.advanceTimersByTime(9999);
|
|
597
|
+
expect(backgroundElementTemplateInstanceManager.get(stale.instanceId)).toBe(stale);
|
|
598
|
+
|
|
599
|
+
vi.advanceTimersByTime(1);
|
|
600
|
+
expect(backgroundElementTemplateInstanceManager.get(stale.instanceId)).toBeUndefined();
|
|
601
|
+
} finally {
|
|
602
|
+
vi.useRealTimers();
|
|
603
|
+
}
|
|
604
|
+
});
|
|
605
|
+
|
|
606
|
+
it('resets commit state when hydrate update serialization throws', () => {
|
|
607
|
+
SystemInfo.lynxSdkVersion = '4.0';
|
|
608
|
+
const serializeError = new Error('hydrate update serialization failed');
|
|
609
|
+
const oldReportError = lynx.reportError;
|
|
610
|
+
const oldCreateSelectorQuery = lynx.createSelectorQuery;
|
|
611
|
+
const reportError = vi.fn();
|
|
612
|
+
const eventHandler = vi.fn();
|
|
613
|
+
const ref = vi.fn();
|
|
614
|
+
const exec = vi.fn();
|
|
615
|
+
const select = vi.fn(() => ({ setNativeProps: vi.fn(() => ({ exec })) }));
|
|
616
|
+
const printTreeSpy = vi.spyOn(elementTemplateAlog, 'printElementTemplateTreeToString').mockReturnValue('<tree>');
|
|
617
|
+
lynx.reportError = reportError;
|
|
618
|
+
lynx.createSelectorQuery = vi.fn(() => ({ select })) as typeof lynx.createSelectorQuery;
|
|
619
|
+
|
|
620
|
+
try {
|
|
621
|
+
__etAttrPlanMap._et_serialize_failure = [1, adaptEventAttrSlot, 2, adaptRefAttrSlot];
|
|
622
|
+
resetEventStateForRuntime();
|
|
623
|
+
envManager.switchToBackground();
|
|
624
|
+
installElementTemplateHydrationListener();
|
|
625
|
+
const removeEventListener = vi.spyOn(lynx.getCoreContext(), 'removeEventListener');
|
|
626
|
+
|
|
627
|
+
const backgroundRoot = __root as BackgroundElementTemplateInstance;
|
|
628
|
+
const throwingValue = {
|
|
629
|
+
toJSON() {
|
|
630
|
+
throw serializeError;
|
|
631
|
+
},
|
|
632
|
+
} as unknown as SerializableValue;
|
|
633
|
+
const after = new BackgroundElementTemplateInstance('_et_serialize_failure', [throwingValue, eventHandler, ref]);
|
|
634
|
+
backgroundRoot.appendChild(after);
|
|
635
|
+
publishEvent('-1:1:', { type: 'tap' });
|
|
636
|
+
new ElementTemplateRefProxy(after.instanceId, 2).setNativeProps({ opacity: 1 }).exec();
|
|
637
|
+
new MainThreadRef('failed-serialize-init');
|
|
638
|
+
void runOnMainThread({ _wkltId: 'failed-serialize-main-thread-function' } as unknown as () => void)();
|
|
639
|
+
|
|
640
|
+
envManager.switchToMainThread();
|
|
641
|
+
dispatchHydrate([
|
|
642
|
+
{
|
|
643
|
+
...createSerializedTemplate(-1, '_et_serialize_failure'),
|
|
644
|
+
attributeSlots: ['before', '-1:1:', '-1-2'],
|
|
645
|
+
} satisfies SerializedCompiledNode,
|
|
646
|
+
]);
|
|
647
|
+
|
|
648
|
+
expect(() => envManager.switchToBackground()).not.toThrow();
|
|
649
|
+
expect(reportError).toHaveBeenCalledWith(serializeError);
|
|
650
|
+
expect(globalCommitContext.ops).toEqual([]);
|
|
651
|
+
expect([...globalCommitContext.nonPayload.removedSubtreesAwaitingTeardown]).toEqual([]);
|
|
652
|
+
expect(takeMainThreadRefInitValuePatch()).toEqual([]);
|
|
653
|
+
expect(takeDelayedRunOnMainThreadData()).toEqual([]);
|
|
654
|
+
expect(removeEventListener).toHaveBeenCalledWith(WorkletEvents.FunctionCallRet, expect.any(Function));
|
|
655
|
+
expect(globalPipelineOptions).toBeUndefined();
|
|
656
|
+
flushPendingEvents();
|
|
657
|
+
flushPendingRefs();
|
|
658
|
+
flushDelayedRefUiOps();
|
|
659
|
+
expect(eventHandler).not.toHaveBeenCalled();
|
|
660
|
+
expect(ref).not.toHaveBeenCalled();
|
|
661
|
+
expect(select).not.toHaveBeenCalled();
|
|
662
|
+
expect(exec).not.toHaveBeenCalled();
|
|
663
|
+
expect(lynx.performance._markTiming.mock.calls).toEqual([
|
|
664
|
+
['pipelineID', 'hydrateParseSnapshotStart'],
|
|
665
|
+
['pipelineID', 'hydrateParseSnapshotEnd'],
|
|
666
|
+
['pipelineID', 'diffVdomStart'],
|
|
667
|
+
['pipelineID', 'diffVdomEnd'],
|
|
668
|
+
['pipelineID', 'packChangesStart'],
|
|
669
|
+
['pipelineID', 'packChangesEnd'],
|
|
670
|
+
]);
|
|
671
|
+
} finally {
|
|
672
|
+
lynx.reportError = oldReportError;
|
|
673
|
+
lynx.createSelectorQuery = oldCreateSelectorQuery;
|
|
674
|
+
printTreeSpy.mockRestore();
|
|
675
|
+
}
|
|
676
|
+
});
|
|
677
|
+
|
|
678
|
+
it('processes hydrate events only when background events are flushed', () => {
|
|
679
|
+
envManager.switchToBackground();
|
|
680
|
+
installElementTemplateHydrationListener();
|
|
681
|
+
|
|
682
|
+
const backgroundRoot = __root as BackgroundElementTemplateInstance;
|
|
683
|
+
const after = new BackgroundElementTemplateInstance('_et_test');
|
|
684
|
+
backgroundRoot.appendChild(after);
|
|
685
|
+
const oldId = after.instanceId;
|
|
686
|
+
|
|
687
|
+
envManager.switchToMainThread();
|
|
688
|
+
const instances: SerializedCompiledNode[] = [createSerializedTemplate(-1, '_et_test')];
|
|
689
|
+
dispatchHydrate(instances);
|
|
690
|
+
|
|
691
|
+
expect(backgroundElementTemplateInstanceManager.get(oldId)).toBe(after);
|
|
692
|
+
expect(backgroundElementTemplateInstanceManager.get(-1)).toBeUndefined();
|
|
693
|
+
|
|
694
|
+
envManager.switchToBackground();
|
|
695
|
+
expect(backgroundElementTemplateInstanceManager.get(oldId)).toBeUndefined();
|
|
696
|
+
expect(backgroundElementTemplateInstanceManager.get(-1)).toBe(after);
|
|
697
|
+
});
|
|
698
|
+
|
|
699
|
+
it('cleans up hydrate listener via tt.callDestroyLifetimeFun', () => {
|
|
700
|
+
envManager.switchToBackground();
|
|
701
|
+
installElementTemplateHydrationListener();
|
|
702
|
+
|
|
703
|
+
const backgroundRoot = __root as BackgroundElementTemplateInstance;
|
|
704
|
+
const after = new BackgroundElementTemplateInstance('_et_test');
|
|
705
|
+
backgroundRoot.appendChild(after);
|
|
706
|
+
const oldId = after.instanceId;
|
|
707
|
+
|
|
708
|
+
const tt = lynx.getApp() as unknown as TTMock;
|
|
709
|
+
tt.callDestroyLifetimeFun?.();
|
|
710
|
+
|
|
711
|
+
envManager.switchToMainThread();
|
|
712
|
+
const instances: SerializedCompiledNode[] = [createSerializedTemplate(-1, '_et_test')];
|
|
713
|
+
dispatchHydrate(instances);
|
|
714
|
+
|
|
715
|
+
envManager.switchToBackground();
|
|
716
|
+
expect(backgroundElementTemplateInstanceManager.get(oldId)).toBeUndefined();
|
|
717
|
+
expect(backgroundElementTemplateInstanceManager.get(-1)).toBeUndefined();
|
|
718
|
+
});
|
|
719
|
+
|
|
720
|
+
it('flushes queued direct events after hydrate registers serialized handlers', () => {
|
|
721
|
+
__etAttrPlanMap._et_event = [0, adaptEventAttrSlot];
|
|
722
|
+
resetEventStateForRuntime();
|
|
723
|
+
envManager.switchToBackground();
|
|
724
|
+
installElementTemplateHydrationListener();
|
|
725
|
+
|
|
726
|
+
const eventData = { type: 'tap' };
|
|
727
|
+
const handler = vi.fn();
|
|
728
|
+
const backgroundRoot = __root as BackgroundElementTemplateInstance;
|
|
729
|
+
const after = new BackgroundElementTemplateInstance('_et_event');
|
|
730
|
+
after.setAttribute('attributeSlots', [handler]);
|
|
731
|
+
backgroundRoot.appendChild(after);
|
|
732
|
+
|
|
733
|
+
publishEvent('-1:0:', eventData);
|
|
734
|
+
|
|
735
|
+
envManager.switchToMainThread();
|
|
736
|
+
dispatchHydrate([
|
|
737
|
+
{
|
|
738
|
+
templateKey: '_et_event',
|
|
739
|
+
attributeSlots: ['-1:0:'],
|
|
740
|
+
childSlots: [],
|
|
741
|
+
uid: -1,
|
|
742
|
+
} satisfies SerializedCompiledNode,
|
|
743
|
+
]);
|
|
744
|
+
|
|
745
|
+
envManager.switchToBackground();
|
|
746
|
+
|
|
747
|
+
expect(handler).toHaveBeenCalledWith(eventData);
|
|
748
|
+
});
|
|
749
|
+
|
|
750
|
+
it('drops queued direct events when root replacement leaves the old event handle unmatched', () => {
|
|
751
|
+
__etAttrPlanMap._et_event = [0, adaptEventAttrSlot];
|
|
752
|
+
resetEventStateForRuntime();
|
|
753
|
+
const oldReportError = lynx.reportError;
|
|
754
|
+
const reportError = vi.fn();
|
|
755
|
+
lynx.reportError = reportError;
|
|
756
|
+
|
|
757
|
+
try {
|
|
758
|
+
envManager.switchToBackground();
|
|
759
|
+
installElementTemplateHydrationListener();
|
|
760
|
+
|
|
761
|
+
const eventData = { type: 'tap' };
|
|
762
|
+
const handler = vi.fn();
|
|
763
|
+
const backgroundRoot = __root as BackgroundElementTemplateInstance;
|
|
764
|
+
const after = new BackgroundElementTemplateInstance('_et_event');
|
|
765
|
+
after.setAttribute('attributeSlots', [handler]);
|
|
766
|
+
backgroundRoot.appendChild(after);
|
|
767
|
+
|
|
768
|
+
publishEvent('-1:0:', eventData);
|
|
769
|
+
|
|
770
|
+
envManager.switchToMainThread();
|
|
771
|
+
dispatchHydrate([
|
|
772
|
+
{
|
|
773
|
+
templateKey: '_et_mismatch',
|
|
774
|
+
attributeSlots: ['-1:0:'],
|
|
775
|
+
childSlots: [],
|
|
776
|
+
uid: -1,
|
|
777
|
+
} satisfies SerializedCompiledNode,
|
|
778
|
+
]);
|
|
779
|
+
|
|
780
|
+
envManager.switchToBackground();
|
|
781
|
+
|
|
782
|
+
expect(reportError).not.toHaveBeenCalled();
|
|
783
|
+
expect(handler).not.toHaveBeenCalled();
|
|
784
|
+
} finally {
|
|
785
|
+
lynx.reportError = oldReportError;
|
|
786
|
+
}
|
|
787
|
+
});
|
|
788
|
+
|
|
789
|
+
it('does not attach pending direct refs during hydrate', () => {
|
|
790
|
+
const ref = vi.fn();
|
|
791
|
+
__etAttrPlanMap._et_ref = [0, adaptRefAttrSlot];
|
|
792
|
+
envManager.switchToBackground();
|
|
793
|
+
installElementTemplateHydrationListener();
|
|
794
|
+
|
|
795
|
+
const backgroundRoot = __root as BackgroundElementTemplateInstance;
|
|
796
|
+
const after = new BackgroundElementTemplateInstance('_et_ref');
|
|
797
|
+
after.setAttribute('attributeSlots', [ref]);
|
|
798
|
+
backgroundRoot.appendChild(after);
|
|
799
|
+
|
|
800
|
+
envManager.switchToMainThread();
|
|
801
|
+
dispatchHydrate([
|
|
802
|
+
{
|
|
803
|
+
templateKey: '_et_ref',
|
|
804
|
+
attributeSlots: ['-1-0'],
|
|
805
|
+
childSlots: [],
|
|
806
|
+
uid: -1,
|
|
807
|
+
} satisfies SerializedCompiledNode,
|
|
808
|
+
]);
|
|
809
|
+
|
|
810
|
+
envManager.switchToBackground();
|
|
811
|
+
|
|
812
|
+
expect(ref).not.toHaveBeenCalled();
|
|
813
|
+
});
|
|
814
|
+
|
|
815
|
+
it('does not re-attach pre-hydration refs and replays delayed ref ops after hydrate', () => {
|
|
816
|
+
const exec = vi.fn();
|
|
817
|
+
const setNativeProps = vi.fn(() => ({ exec }));
|
|
818
|
+
const select = vi.fn(() => ({ setNativeProps }));
|
|
819
|
+
const createSelectorQuery = vi.fn(() => ({ select }));
|
|
820
|
+
const oldCreateSelectorQuery = lynx.createSelectorQuery;
|
|
821
|
+
lynx.createSelectorQuery = createSelectorQuery as typeof lynx.createSelectorQuery;
|
|
822
|
+
|
|
823
|
+
try {
|
|
824
|
+
const ref = vi.fn();
|
|
825
|
+
__etAttrPlanMap._et_ref = [0, adaptRefAttrSlot];
|
|
826
|
+
envManager.switchToBackground();
|
|
827
|
+
installElementTemplateHydrationListener();
|
|
828
|
+
|
|
829
|
+
const backgroundRoot = __root as BackgroundElementTemplateInstance;
|
|
830
|
+
const after = new BackgroundElementTemplateInstance('_et_ref');
|
|
831
|
+
after.setAttribute('attributeSlots', [ref]);
|
|
832
|
+
backgroundRoot.appendChild(after);
|
|
833
|
+
flushPendingRefs();
|
|
834
|
+
const proxy = ref.mock.calls[0]![0];
|
|
835
|
+
proxy.setNativeProps({ opacity: 1 }).exec();
|
|
836
|
+
expect(select).not.toHaveBeenCalled();
|
|
837
|
+
ref.mockClear();
|
|
838
|
+
|
|
839
|
+
envManager.switchToMainThread();
|
|
840
|
+
dispatchHydrate([
|
|
841
|
+
{
|
|
842
|
+
templateKey: '_et_ref',
|
|
843
|
+
attributeSlots: ['-1-0'],
|
|
844
|
+
childSlots: [],
|
|
845
|
+
uid: -1,
|
|
846
|
+
} satisfies SerializedCompiledNode,
|
|
847
|
+
]);
|
|
848
|
+
|
|
849
|
+
envManager.switchToBackground();
|
|
850
|
+
|
|
851
|
+
expect(ref).not.toHaveBeenCalled();
|
|
852
|
+
expect(select).toHaveBeenCalledWith('[ref=-1-0]');
|
|
853
|
+
expect(setNativeProps).toHaveBeenCalledWith({ opacity: 1 });
|
|
854
|
+
expect(exec).toHaveBeenCalledTimes(1);
|
|
855
|
+
} finally {
|
|
856
|
+
lynx.createSelectorQuery = oldCreateSelectorQuery;
|
|
857
|
+
}
|
|
858
|
+
});
|
|
859
|
+
|
|
860
|
+
it('does not re-attach pre-hydration spread refs and replays delayed ref ops after hydrate', () => {
|
|
861
|
+
const exec = vi.fn();
|
|
862
|
+
const setNativeProps = vi.fn(() => ({ exec }));
|
|
863
|
+
const select = vi.fn(() => ({ setNativeProps }));
|
|
864
|
+
const createSelectorQuery = vi.fn(() => ({ select }));
|
|
865
|
+
const oldCreateSelectorQuery = lynx.createSelectorQuery;
|
|
866
|
+
lynx.createSelectorQuery = createSelectorQuery as typeof lynx.createSelectorQuery;
|
|
867
|
+
|
|
868
|
+
try {
|
|
869
|
+
const ref = vi.fn();
|
|
870
|
+
__etAttrPlanMap._et_spread = [0, adaptSpreadAttrSlot];
|
|
871
|
+
envManager.switchToBackground();
|
|
872
|
+
installElementTemplateHydrationListener();
|
|
873
|
+
|
|
874
|
+
const backgroundRoot = __root as BackgroundElementTemplateInstance;
|
|
875
|
+
const after = new BackgroundElementTemplateInstance('_et_spread');
|
|
876
|
+
after.setAttribute('attributeSlots', [{ ref }]);
|
|
877
|
+
backgroundRoot.appendChild(after);
|
|
878
|
+
flushPendingRefs();
|
|
879
|
+
const proxy = ref.mock.calls[0]![0];
|
|
880
|
+
proxy.setNativeProps({ opacity: 1 }).exec();
|
|
881
|
+
expect(select).not.toHaveBeenCalled();
|
|
882
|
+
ref.mockClear();
|
|
883
|
+
|
|
884
|
+
envManager.switchToMainThread();
|
|
885
|
+
dispatchHydrate([
|
|
886
|
+
{
|
|
887
|
+
templateKey: '_et_spread',
|
|
888
|
+
attributeSlots: [{ ref: '-1-0' }],
|
|
889
|
+
childSlots: [],
|
|
890
|
+
uid: -1,
|
|
891
|
+
} satisfies SerializedCompiledNode,
|
|
892
|
+
]);
|
|
893
|
+
|
|
894
|
+
envManager.switchToBackground();
|
|
895
|
+
|
|
896
|
+
expect(ref).not.toHaveBeenCalled();
|
|
897
|
+
expect(select).toHaveBeenCalledWith('[ref=-1-0]');
|
|
898
|
+
expect(setNativeProps).toHaveBeenCalledWith({ opacity: 1 });
|
|
899
|
+
expect(exec).toHaveBeenCalledTimes(1);
|
|
900
|
+
} finally {
|
|
901
|
+
lynx.createSelectorQuery = oldCreateSelectorQuery;
|
|
902
|
+
}
|
|
903
|
+
});
|
|
904
|
+
|
|
905
|
+
it('detaches and attaches spread refs on real updates after hydrate', () => {
|
|
906
|
+
const oldRef = vi.fn();
|
|
907
|
+
const newRef = vi.fn();
|
|
908
|
+
__etAttrPlanMap._et_spread = [0, adaptSpreadAttrSlot];
|
|
909
|
+
envManager.switchToBackground();
|
|
910
|
+
installElementTemplateHydrationListener();
|
|
911
|
+
|
|
912
|
+
const backgroundRoot = __root as BackgroundElementTemplateInstance;
|
|
913
|
+
const after = new BackgroundElementTemplateInstance('_et_spread');
|
|
914
|
+
after.setAttribute('attributeSlots', [{ ref: oldRef }]);
|
|
915
|
+
backgroundRoot.appendChild(after);
|
|
916
|
+
flushPendingRefs();
|
|
917
|
+
oldRef.mockClear();
|
|
918
|
+
|
|
919
|
+
envManager.switchToMainThread();
|
|
920
|
+
dispatchHydrate([
|
|
921
|
+
{
|
|
922
|
+
templateKey: '_et_spread',
|
|
923
|
+
attributeSlots: [{ ref: '-1-0' }],
|
|
924
|
+
childSlots: [],
|
|
925
|
+
uid: -1,
|
|
926
|
+
} satisfies SerializedCompiledNode,
|
|
927
|
+
]);
|
|
928
|
+
|
|
929
|
+
envManager.switchToBackground();
|
|
930
|
+
expect(oldRef).not.toHaveBeenCalled();
|
|
931
|
+
|
|
932
|
+
after.setAttribute('attributeSlots', [{ ref: newRef }]);
|
|
933
|
+
flushPendingRefs();
|
|
934
|
+
|
|
935
|
+
expect(oldRef).toHaveBeenCalledWith(null);
|
|
936
|
+
expect(newRef).toHaveBeenCalledWith(expect.objectContaining({
|
|
937
|
+
selector: '[ref=-1-0]',
|
|
938
|
+
}));
|
|
939
|
+
});
|
|
940
|
+
|
|
941
|
+
it('drops delayed ref ops when hydrate fails before stable handle binding', () => {
|
|
942
|
+
const exec = vi.fn();
|
|
943
|
+
const setNativeProps = vi.fn(() => ({ exec }));
|
|
944
|
+
const select = vi.fn(() => ({ setNativeProps }));
|
|
945
|
+
const createSelectorQuery = vi.fn(() => ({ select }));
|
|
946
|
+
const oldCreateSelectorQuery = lynx.createSelectorQuery;
|
|
947
|
+
const oldReportError = lynx.reportError;
|
|
948
|
+
const reportError = vi.fn();
|
|
949
|
+
lynx.createSelectorQuery = createSelectorQuery as typeof lynx.createSelectorQuery;
|
|
950
|
+
lynx.reportError = reportError;
|
|
951
|
+
|
|
952
|
+
try {
|
|
953
|
+
const ref = vi.fn();
|
|
954
|
+
__etAttrPlanMap._et_ref = [0, adaptRefAttrSlot];
|
|
955
|
+
envManager.switchToBackground();
|
|
956
|
+
installElementTemplateHydrationListener();
|
|
957
|
+
|
|
958
|
+
const backgroundRoot = __root as BackgroundElementTemplateInstance;
|
|
959
|
+
const after = new BackgroundElementTemplateInstance('_et_ref');
|
|
960
|
+
after.setAttribute('attributeSlots', [ref]);
|
|
961
|
+
backgroundRoot.appendChild(after);
|
|
962
|
+
flushPendingRefs();
|
|
963
|
+
const proxy = ref.mock.calls[0]![0];
|
|
964
|
+
proxy.setNativeProps({ opacity: 1 }).exec();
|
|
965
|
+
expect(select).not.toHaveBeenCalled();
|
|
966
|
+
|
|
967
|
+
envManager.switchToMainThread();
|
|
968
|
+
dispatchHydrate([
|
|
969
|
+
{
|
|
970
|
+
templateKey: '_et_ref',
|
|
971
|
+
attributeSlots: ['-1-0'],
|
|
972
|
+
childSlots: [],
|
|
973
|
+
uid: 0,
|
|
974
|
+
} satisfies SerializedCompiledNode,
|
|
975
|
+
]);
|
|
976
|
+
|
|
977
|
+
envManager.switchToBackground();
|
|
978
|
+
flushDelayedRefUiOps();
|
|
979
|
+
|
|
980
|
+
expect(reportError).toHaveBeenCalledTimes(1);
|
|
981
|
+
expect(String(reportError.mock.calls[0]?.[0]?.message ?? '')).toContain(
|
|
982
|
+
'invalid uid 0',
|
|
983
|
+
);
|
|
984
|
+
expect(select).not.toHaveBeenCalled();
|
|
985
|
+
expect(setNativeProps).not.toHaveBeenCalled();
|
|
986
|
+
expect(exec).not.toHaveBeenCalled();
|
|
987
|
+
} finally {
|
|
988
|
+
lynx.createSelectorQuery = oldCreateSelectorQuery;
|
|
989
|
+
lynx.reportError = oldReportError;
|
|
990
|
+
}
|
|
991
|
+
});
|
|
992
|
+
|
|
993
|
+
it('marks hydrate performance timings on background thread', () => {
|
|
994
|
+
SystemInfo.lynxSdkVersion = '4.0';
|
|
995
|
+
envManager.switchToBackground();
|
|
996
|
+
installElementTemplateHydrationListener();
|
|
997
|
+
|
|
998
|
+
const backgroundRoot = __root as BackgroundElementTemplateInstance;
|
|
999
|
+
const after = new BackgroundElementTemplateInstance('_et_test');
|
|
1000
|
+
backgroundRoot.appendChild(after);
|
|
1001
|
+
const { performance } = lynx;
|
|
1002
|
+
const profileEndCallCount = performance.profileEnd.mock.calls.length;
|
|
1003
|
+
|
|
1004
|
+
envManager.switchToMainThread();
|
|
1005
|
+
const instances: SerializedCompiledNode[] = [createSerializedTemplate(-1, '_et_test')];
|
|
1006
|
+
dispatchHydrate(instances);
|
|
1007
|
+
|
|
1008
|
+
envManager.switchToBackground();
|
|
1009
|
+
|
|
1010
|
+
expect(performance.profileStart).toHaveBeenCalledWith('ReactLynx::hydrate');
|
|
1011
|
+
expect(performance.profileStart).toHaveBeenCalledWith('ReactLynx::commitChanges');
|
|
1012
|
+
expect(performance.profileEnd.mock.calls.length - profileEndCallCount).toBeGreaterThanOrEqual(2);
|
|
1013
|
+
|
|
1014
|
+
const onStartCalls = performance._onPipelineStart.mock.calls;
|
|
1015
|
+
expect(onStartCalls).toHaveLength(1);
|
|
1016
|
+
expect(onStartCalls[0]?.[0]).toBe('pipelineID');
|
|
1017
|
+
expect(onStartCalls[0]?.[1]).toMatchObject({
|
|
1018
|
+
pipelineID: 'pipelineID',
|
|
1019
|
+
needTimestamps: true,
|
|
1020
|
+
pipelineOrigin: PipelineOrigins.reactLynxHydrate,
|
|
1021
|
+
dsl: 'reactLynx',
|
|
1022
|
+
stage: 'hydrate',
|
|
1023
|
+
});
|
|
1024
|
+
|
|
1025
|
+
const bindCalls = performance._bindPipelineIdWithTimingFlag.mock.calls;
|
|
1026
|
+
expect(bindCalls).toHaveLength(1);
|
|
1027
|
+
expect(bindCalls[0]).toEqual(['pipelineID', PerformanceTimingFlags.reactLynxHydrate]);
|
|
1028
|
+
|
|
1029
|
+
expect(performance._markTiming.mock.calls).toEqual([
|
|
1030
|
+
['pipelineID', 'hydrateParseSnapshotStart'],
|
|
1031
|
+
['pipelineID', 'hydrateParseSnapshotEnd'],
|
|
1032
|
+
['pipelineID', 'diffVdomStart'],
|
|
1033
|
+
['pipelineID', 'diffVdomEnd'],
|
|
1034
|
+
['pipelineID', 'packChangesStart'],
|
|
1035
|
+
['pipelineID', 'packChangesEnd'],
|
|
1036
|
+
]);
|
|
1037
|
+
});
|
|
1038
|
+
|
|
1039
|
+
it('marks hydrate packChanges around update payload serialization', () => {
|
|
1040
|
+
SystemInfo.lynxSdkVersion = '4.0';
|
|
1041
|
+
globalThis.__ALOG__ = false;
|
|
1042
|
+
envManager.switchToBackground();
|
|
1043
|
+
installElementTemplateHydrationListener();
|
|
1044
|
+
|
|
1045
|
+
let didSerializePayload = false;
|
|
1046
|
+
const serializingValue = {
|
|
1047
|
+
toJSON() {
|
|
1048
|
+
didSerializePayload = true;
|
|
1049
|
+
expect(lynx.performance._markTiming.mock.calls).toEqual([
|
|
1050
|
+
['pipelineID', 'hydrateParseSnapshotStart'],
|
|
1051
|
+
['pipelineID', 'hydrateParseSnapshotEnd'],
|
|
1052
|
+
['pipelineID', 'diffVdomStart'],
|
|
1053
|
+
['pipelineID', 'diffVdomEnd'],
|
|
1054
|
+
['pipelineID', 'packChangesStart'],
|
|
1055
|
+
]);
|
|
1056
|
+
return 'after';
|
|
1057
|
+
},
|
|
1058
|
+
} as unknown as SerializableValue;
|
|
1059
|
+
|
|
1060
|
+
const backgroundRoot = __root as BackgroundElementTemplateInstance;
|
|
1061
|
+
const after = new BackgroundElementTemplateInstance('_et_test', [serializingValue]);
|
|
1062
|
+
backgroundRoot.appendChild(after);
|
|
1063
|
+
|
|
1064
|
+
envManager.switchToMainThread();
|
|
1065
|
+
dispatchHydrate([
|
|
1066
|
+
{
|
|
1067
|
+
...createSerializedTemplate(-1, '_et_test'),
|
|
1068
|
+
attributeSlots: ['before'],
|
|
1069
|
+
} satisfies SerializedCompiledNode,
|
|
1070
|
+
]);
|
|
1071
|
+
|
|
1072
|
+
envManager.switchToBackground();
|
|
1073
|
+
|
|
1074
|
+
expect(didSerializePayload).toBe(true);
|
|
1075
|
+
expect(lynx.performance._markTiming.mock.calls).toEqual([
|
|
1076
|
+
['pipelineID', 'hydrateParseSnapshotStart'],
|
|
1077
|
+
['pipelineID', 'hydrateParseSnapshotEnd'],
|
|
1078
|
+
['pipelineID', 'diffVdomStart'],
|
|
1079
|
+
['pipelineID', 'diffVdomEnd'],
|
|
1080
|
+
['pipelineID', 'packChangesStart'],
|
|
1081
|
+
['pipelineID', 'packChangesEnd'],
|
|
1082
|
+
]);
|
|
1083
|
+
});
|
|
1084
|
+
|
|
1085
|
+
it('logs hydrate payload and background tree states when alog is enabled', () => {
|
|
1086
|
+
envManager.switchToBackground();
|
|
1087
|
+
installElementTemplateHydrationListener();
|
|
1088
|
+
|
|
1089
|
+
const alog = console.alog as unknown as { mock: { calls: unknown[][] }; mockClear(): void };
|
|
1090
|
+
alog.mockClear();
|
|
1091
|
+
|
|
1092
|
+
const backgroundRoot = __root as BackgroundElementTemplateInstance;
|
|
1093
|
+
const after = new BackgroundElementTemplateInstance('_et_test', ['before']);
|
|
1094
|
+
backgroundRoot.appendChild(after);
|
|
1095
|
+
|
|
1096
|
+
envManager.switchToMainThread();
|
|
1097
|
+
dispatchHydrate([
|
|
1098
|
+
{
|
|
1099
|
+
templateKey: '_et_test',
|
|
1100
|
+
attributeSlots: ['after'],
|
|
1101
|
+
childSlots: [],
|
|
1102
|
+
uid: -1,
|
|
1103
|
+
} satisfies SerializedCompiledNode,
|
|
1104
|
+
]);
|
|
1105
|
+
|
|
1106
|
+
envManager.switchToBackground();
|
|
1107
|
+
|
|
1108
|
+
const output = alog.mock.calls.map(args => String(args[0])).join('\n');
|
|
1109
|
+
expect(output).toContain('[ReactLynxDebug] ElementTemplate MTS -> BTS hydrate');
|
|
1110
|
+
expect(output).toContain('BackgroundElementTemplate tree before hydration');
|
|
1111
|
+
expect(output).toContain('BackgroundElementTemplate tree after hydration');
|
|
1112
|
+
expect(output).toContain('setAttribute');
|
|
1113
|
+
});
|
|
1114
|
+
|
|
1115
|
+
it('does not format hydrate alog when alog is disabled', () => {
|
|
1116
|
+
globalThis.__ALOG__ = false;
|
|
1117
|
+
envManager.switchToBackground();
|
|
1118
|
+
installElementTemplateHydrationListener();
|
|
1119
|
+
|
|
1120
|
+
const alog = console.alog as unknown as { mock: { calls: unknown[][] }; mockClear(): void };
|
|
1121
|
+
alog.mockClear();
|
|
1122
|
+
const formatSpy = vi.spyOn(elementTemplateAlog, 'formatElementTemplateUpdateCommands');
|
|
1123
|
+
const printSpy = vi.spyOn(elementTemplateAlog, 'printElementTemplateTreeToString');
|
|
1124
|
+
|
|
1125
|
+
const backgroundRoot = __root as BackgroundElementTemplateInstance;
|
|
1126
|
+
const after = new BackgroundElementTemplateInstance('_et_test', ['before']);
|
|
1127
|
+
backgroundRoot.appendChild(after);
|
|
1128
|
+
|
|
1129
|
+
envManager.switchToMainThread();
|
|
1130
|
+
dispatchHydrate([
|
|
1131
|
+
{
|
|
1132
|
+
templateKey: '_et_test',
|
|
1133
|
+
attributeSlots: ['after'],
|
|
1134
|
+
childSlots: [],
|
|
1135
|
+
uid: -1,
|
|
1136
|
+
} satisfies SerializedCompiledNode,
|
|
1137
|
+
]);
|
|
1138
|
+
|
|
1139
|
+
envManager.switchToBackground();
|
|
1140
|
+
|
|
1141
|
+
expect(formatSpy).not.toHaveBeenCalled();
|
|
1142
|
+
expect(printSpy).not.toHaveBeenCalled();
|
|
1143
|
+
expect(alog.mock.calls).toHaveLength(0);
|
|
1144
|
+
});
|
|
1145
|
+
|
|
1146
|
+
it('fails serialized-only invalid root removal without dispatching updates or replaying delayed refs', () => {
|
|
1147
|
+
const exec = vi.fn();
|
|
1148
|
+
const setNativeProps = vi.fn(() => ({ exec }));
|
|
1149
|
+
const select = vi.fn(() => ({ setNativeProps }));
|
|
1150
|
+
const createSelectorQuery = vi.fn(() => ({ select }));
|
|
1151
|
+
const oldCreateSelectorQuery = lynx.createSelectorQuery;
|
|
1152
|
+
const oldReportError = lynx.reportError;
|
|
1153
|
+
const reportError = vi.fn();
|
|
1154
|
+
lynx.createSelectorQuery = createSelectorQuery as typeof lynx.createSelectorQuery;
|
|
1155
|
+
lynx.reportError = reportError;
|
|
1156
|
+
|
|
1157
|
+
try {
|
|
1158
|
+
__etAttrPlanMap._et_ref = [0, adaptRefAttrSlot];
|
|
1159
|
+
envManager.switchToBackground();
|
|
1160
|
+
installElementTemplateHydrationListener();
|
|
1161
|
+
const dispatchSpy = vi.spyOn(lynx.getCoreContext(), 'dispatchEvent');
|
|
1162
|
+
|
|
1163
|
+
const backgroundRoot = __root as BackgroundElementTemplateInstance;
|
|
1164
|
+
const ref = vi.fn();
|
|
1165
|
+
const after = new BackgroundElementTemplateInstance('_et_ref');
|
|
1166
|
+
after.setAttribute('attributeSlots', [ref]);
|
|
1167
|
+
backgroundRoot.appendChild(after);
|
|
1168
|
+
flushPendingRefs();
|
|
1169
|
+
const proxy = ref.mock.calls[0]![0];
|
|
1170
|
+
proxy.setNativeProps({ opacity: 1 }).exec();
|
|
1171
|
+
|
|
1172
|
+
envManager.switchToMainThread();
|
|
1173
|
+
dispatchHydrate([createSerializedTemplate(0, '_et_stale')]);
|
|
1174
|
+
|
|
1175
|
+
envManager.switchToBackground();
|
|
1176
|
+
flushDelayedRefUiOps();
|
|
1177
|
+
|
|
1178
|
+
const updateCall = dispatchSpy.mock.calls.find(([event]) =>
|
|
1179
|
+
(event as { type: string }).type === ElementTemplateLifecycleConstant.update
|
|
1180
|
+
);
|
|
1181
|
+
expect(updateCall).toBeUndefined();
|
|
1182
|
+
expect(reportError).toHaveBeenCalledTimes(1);
|
|
1183
|
+
expect(String(reportError.mock.calls[0]?.[0]?.message ?? '')).toContain('invalid uid 0');
|
|
1184
|
+
expect(select).not.toHaveBeenCalled();
|
|
1185
|
+
expect(setNativeProps).not.toHaveBeenCalled();
|
|
1186
|
+
expect(exec).not.toHaveBeenCalled();
|
|
1187
|
+
} finally {
|
|
1188
|
+
lynx.createSelectorQuery = oldCreateSelectorQuery;
|
|
1189
|
+
lynx.reportError = oldReportError;
|
|
1190
|
+
(globalThis as { __LYNX_REPORT_ERROR_CALLS?: Error[] }).__LYNX_REPORT_ERROR_CALLS = [];
|
|
1191
|
+
}
|
|
1192
|
+
});
|
|
1193
|
+
|
|
1194
|
+
it('reports illegal handleId 0 during hydrate', () => {
|
|
1195
|
+
envManager.switchToBackground();
|
|
1196
|
+
installElementTemplateHydrationListener();
|
|
1197
|
+
|
|
1198
|
+
const lynxObj = globalThis.lynx as typeof lynx & { reportError?: (error: Error) => void };
|
|
1199
|
+
const oldReportError = lynxObj.reportError;
|
|
1200
|
+
const reportErrorSpy = vi.fn();
|
|
1201
|
+
lynxObj.reportError = reportErrorSpy;
|
|
1202
|
+
|
|
1203
|
+
const backgroundRoot = __root as BackgroundElementTemplateInstance;
|
|
1204
|
+
const after = new BackgroundElementTemplateInstance('_et_test');
|
|
1205
|
+
backgroundRoot.appendChild(after);
|
|
1206
|
+
const oldId = after.instanceId;
|
|
1207
|
+
|
|
1208
|
+
envManager.switchToMainThread();
|
|
1209
|
+
dispatchHydrate([createSerializedTemplate(0, '_et_test')]);
|
|
1210
|
+
|
|
1211
|
+
envManager.switchToBackground();
|
|
1212
|
+
|
|
1213
|
+
expect(reportErrorSpy).toHaveBeenCalledTimes(1);
|
|
1214
|
+
expect(String(reportErrorSpy.mock.calls[0]?.[0]?.message ?? '')).toContain('invalid uid 0');
|
|
1215
|
+
expect(backgroundElementTemplateInstanceManager.get(oldId)).toBe(after);
|
|
1216
|
+
expect(backgroundElementTemplateInstanceManager.get(0)).toBe(backgroundRoot);
|
|
1217
|
+
|
|
1218
|
+
lynxObj.reportError = oldReportError;
|
|
1219
|
+
});
|
|
1220
|
+
|
|
1221
|
+
it('reports duplicate handleId during hydrate', () => {
|
|
1222
|
+
envManager.switchToBackground();
|
|
1223
|
+
installElementTemplateHydrationListener();
|
|
1224
|
+
|
|
1225
|
+
const lynxObj = globalThis.lynx as typeof lynx & { reportError?: (error: Error) => void };
|
|
1226
|
+
const oldReportError = lynxObj.reportError;
|
|
1227
|
+
const reportErrorSpy = vi.fn();
|
|
1228
|
+
lynxObj.reportError = reportErrorSpy;
|
|
1229
|
+
|
|
1230
|
+
const backgroundRoot = __root as BackgroundElementTemplateInstance;
|
|
1231
|
+
const first = new BackgroundElementTemplateInstance('_et_test');
|
|
1232
|
+
const second = new BackgroundElementTemplateInstance('_et_test');
|
|
1233
|
+
backgroundRoot.appendChild(first);
|
|
1234
|
+
backgroundRoot.appendChild(second);
|
|
1235
|
+
const oldSecondId = second.instanceId;
|
|
1236
|
+
|
|
1237
|
+
envManager.switchToMainThread();
|
|
1238
|
+
dispatchHydrate([createSerializedTemplate(-1, '_et_test'), createSerializedTemplate(-1, '_et_test')]);
|
|
1239
|
+
|
|
1240
|
+
envManager.switchToBackground();
|
|
1241
|
+
|
|
1242
|
+
expect(reportErrorSpy).toHaveBeenCalledTimes(1);
|
|
1243
|
+
expect(String(reportErrorSpy.mock.calls[0]?.[0]?.message ?? '')).toContain('already bound');
|
|
1244
|
+
expect(backgroundElementTemplateInstanceManager.get(-1)).toBe(first);
|
|
1245
|
+
expect(backgroundElementTemplateInstanceManager.get(oldSecondId)).toBe(second);
|
|
1246
|
+
|
|
1247
|
+
lynxObj.reportError = oldReportError;
|
|
1248
|
+
});
|
|
1249
|
+
});
|