@lynx-js/react 0.126.2 → 0.128.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +36 -0
- package/components/tsconfig.tsbuildinfo +1 -1
- package/docs/directives.md +90 -0
- package/docs/global-events.md +50 -0
- package/docs/import-attributes.md +43 -0
- package/docs/macros.md +285 -0
- package/package.json +7 -14
- package/refresh/.turbo/turbo-build.log +2 -2
- package/refresh/dist/index.js +26 -6
- package/refresh/package.json +1 -1
- package/runtime/__test__/core/main-thread-object.test.js +149 -0
- package/runtime/__test__/element-template/fixtures/background/main-thread-function/run-on-main-thread/index.tsx +26 -3
- package/runtime/__test__/element-template/imports/main-thread-object-api.test.ts +10 -0
- package/runtime/__test__/element-template/internal/legacy-internal-guardrail.test.ts +4 -1
- package/runtime/__test__/element-template/runtime/background/event/compiled-fixtures.test.tsx +39 -48
- package/runtime/__test__/element-template/runtime/background/main-thread-function/compiled-fixtures.test.tsx +11 -9
- package/runtime/__test__/element-template/runtime/render/render-transform.contract.test.ts +6 -3
- package/runtime/__test__/element-template/test-utils/mock/globals.js +6 -0
- package/runtime/__test__/element-template/vitest.config.ts +4 -0
- package/runtime/__test__/snapshot/ctxNotFound.test.ts +271 -0
- package/runtime/__test__/snapshot/event.test.jsx +7 -7
- package/runtime/__test__/snapshot/lazy.test.js +73 -1
- package/runtime/__test__/snapshot/lynx/portals.test.jsx +75 -37
- package/runtime/__test__/snapshot/snapshotPatch.test.jsx +59 -47
- package/runtime/__test__/snapshot/spread.test.jsx +10 -10
- package/runtime/__test__/snapshot/worklet/main-thread-object.test.jsx +306 -0
- package/runtime/__test__/snapshot/worklet/workletRef.test.jsx +1 -0
- package/runtime/__test__/worklet-runtime/initEntry.test.js +109 -0
- package/runtime/__test__/worklet-runtime/mainThreadObject.test.js +182 -0
- package/runtime/__test__/worklet-runtime/object-methods.test.js +59 -0
- package/runtime/__test__/worklet-runtime/workletRef.test.js +362 -2
- package/runtime/__test__/worklet-runtime/workletRuntime.test.js +246 -1
- package/runtime/lazy/compat.js +2 -0
- package/runtime/lazy/element-template-internal.js +1 -1
- package/runtime/lazy/element-template.js +2 -0
- package/runtime/lazy/internal.js +2 -1
- package/runtime/lazy/react.js +2 -0
- package/runtime/lib/core/background-function/exec-map.js.map +1 -1
- package/runtime/lib/core/background-function/handle.js.map +1 -1
- package/runtime/lib/core/background-function/run-on-background.d.ts +16 -0
- package/runtime/lib/core/background-function/run-on-background.js +16 -0
- package/runtime/lib/core/background-function/run-on-background.js.map +1 -1
- package/runtime/lib/core/capture-main-thread-object.d.ts +1 -0
- package/runtime/lib/core/capture-main-thread-object.js +16 -0
- package/runtime/lib/core/capture-main-thread-object.js.map +1 -0
- package/runtime/lib/core/commit-context.js.map +1 -1
- package/runtime/lib/core/compat/legacy-react-runtime.js.map +1 -1
- package/runtime/lib/core/compat/lynxComponent.js.map +1 -1
- package/runtime/lib/core/component.js.map +1 -1
- package/runtime/lib/core/forceRootRender.js.map +1 -1
- package/runtime/lib/core/globalProps.d.ts +2 -0
- package/runtime/lib/core/globalProps.js.map +1 -1
- package/runtime/lib/core/hooks/mainThread.js.map +1 -1
- package/runtime/lib/core/hooks/mainThreadImpl.js.map +1 -1
- package/runtime/lib/core/hooks/react.d.ts +4 -0
- package/runtime/lib/core/hooks/react.js +4 -0
- package/runtime/lib/core/hooks/react.js.map +1 -1
- package/runtime/lib/core/hooks/useLynxGlobalEventListener.d.ts +2 -0
- package/runtime/lib/core/hooks/useLynxGlobalEventListener.js +2 -0
- package/runtime/lib/core/hooks/useLynxGlobalEventListener.js.map +1 -1
- package/runtime/lib/core/initData.d.ts +2 -0
- package/runtime/lib/core/initData.js +2 -0
- package/runtime/lib/core/initData.js.map +1 -1
- package/runtime/lib/core/lynx/dynamic-import.js.map +1 -1
- package/runtime/lib/core/lynx/lazy-bundle.js.map +1 -1
- package/runtime/lib/core/lynx/runtime-backend.js.map +1 -1
- package/runtime/lib/core/lynx/runtime-version.js.map +1 -1
- package/runtime/lib/core/lynx-data-processors.js.map +1 -1
- package/runtime/lib/core/lynx-page-data.js.map +1 -1
- package/runtime/lib/core/lynx-update-data.js.map +1 -1
- package/runtime/lib/core/main-thread-function.js.map +1 -1
- package/runtime/lib/core/main-thread-object-handle-registry.d.ts +3 -0
- package/runtime/lib/core/main-thread-object-handle-registry.js +17 -0
- package/runtime/lib/core/main-thread-object-handle-registry.js.map +1 -0
- package/runtime/lib/core/main-thread-object.d.ts +77 -0
- package/runtime/lib/core/main-thread-object.js +258 -0
- package/runtime/lib/core/main-thread-object.js.map +1 -0
- package/runtime/lib/core/main-thread-ref-id.d.ts +1 -0
- package/runtime/lib/core/main-thread-ref-id.js +14 -0
- package/runtime/lib/core/main-thread-ref-id.js.map +1 -0
- package/runtime/lib/core/main-thread-ref-init-value.d.ts +1 -1
- package/runtime/lib/core/main-thread-ref-init-value.js +4 -2
- package/runtime/lib/core/main-thread-ref-init-value.js.map +1 -1
- package/runtime/lib/core/main-thread-ref.d.ts +4 -0
- package/runtime/lib/core/main-thread-ref.js +5 -8
- package/runtime/lib/core/main-thread-ref.js.map +1 -1
- package/runtime/lib/core/mts-capability.js.map +1 -1
- package/runtime/lib/core/performance.js.map +1 -1
- package/runtime/lib/core/ref.js.map +1 -1
- package/runtime/lib/core/reload-version.js.map +1 -1
- package/runtime/lib/core/runtime-destroy.js.map +1 -1
- package/runtime/lib/core/thread-function-call/main-thread.js.map +1 -1
- package/runtime/lib/core/thread-function-call/return-value.js.map +1 -1
- package/runtime/lib/document.js.map +1 -1
- package/runtime/lib/element-template/background/attr-slots.js.map +1 -1
- package/runtime/lib/element-template/background/commit-context.js.map +1 -1
- package/runtime/lib/element-template/background/commit-hook.js.map +1 -1
- package/runtime/lib/element-template/background/destroy.js.map +1 -1
- package/runtime/lib/element-template/background/document.js.map +1 -1
- package/runtime/lib/element-template/background/hydrate.js.map +1 -1
- package/runtime/lib/element-template/background/hydration-listener.js.map +1 -1
- package/runtime/lib/element-template/background/instance.js.map +1 -1
- package/runtime/lib/element-template/background/manager.js.map +1 -1
- package/runtime/lib/element-template/background/page-root-hydrate.js.map +1 -1
- package/runtime/lib/element-template/background/render-scope.js.map +1 -1
- package/runtime/lib/element-template/client/root.js.map +1 -1
- package/runtime/lib/element-template/debug/alog.js.map +1 -1
- package/runtime/lib/element-template/debug/elementPAPICall.js.map +1 -1
- package/runtime/lib/element-template/debug/profile.js.map +1 -1
- package/runtime/lib/element-template/hydration-map.js.map +1 -1
- package/runtime/lib/element-template/index.d.ts +2 -0
- package/runtime/lib/element-template/index.js +1 -0
- package/runtime/lib/element-template/index.js.map +1 -1
- package/runtime/lib/element-template/internal.d.ts +1 -1
- package/runtime/lib/element-template/internal.js +1 -1
- package/runtime/lib/element-template/internal.js.map +1 -1
- package/runtime/lib/element-template/jsx-dev-runtime/index.js.map +1 -1
- package/runtime/lib/element-template/jsx-runtime/index.js.map +1 -1
- package/runtime/lib/element-template/lynx/env.js.map +1 -1
- package/runtime/lib/element-template/lynx/performance.js.map +1 -1
- package/runtime/lib/element-template/native/callDestroyLifetimeFun.js.map +1 -1
- package/runtime/lib/element-template/native/index.js.map +1 -1
- package/runtime/lib/element-template/native/main-thread-api.js.map +1 -1
- package/runtime/lib/element-template/native/mts-destroy.js.map +1 -1
- package/runtime/lib/element-template/native/patch-listener.js.map +1 -1
- package/runtime/lib/element-template/native/reload-background.js.map +1 -1
- package/runtime/lib/element-template/native/reload-main-thread.js.map +1 -1
- package/runtime/lib/element-template/prop-adapters/event-value.js.map +1 -1
- package/runtime/lib/element-template/prop-adapters/event.js.map +1 -1
- package/runtime/lib/element-template/prop-adapters/ref.js.map +1 -1
- package/runtime/lib/element-template/prop-adapters/spread.js.map +1 -1
- package/runtime/lib/element-template/protocol/lifecycle-constant.js.map +1 -1
- package/runtime/lib/element-template/protocol/opcodes.js.map +1 -1
- package/runtime/lib/element-template/protocol/page.js.map +1 -1
- package/runtime/lib/element-template/protocol/template-type.js.map +1 -1
- package/runtime/lib/element-template/protocol/types.d.ts +1 -1
- package/runtime/lib/element-template/protocol/types.js.map +1 -1
- package/runtime/lib/element-template/protocol/update-event.js.map +1 -1
- package/runtime/lib/element-template/runtime/list/list.js.map +1 -1
- package/runtime/lib/element-template/runtime/page/authored-page.js.map +1 -1
- package/runtime/lib/element-template/runtime/page/page.js.map +1 -1
- package/runtime/lib/element-template/runtime/page/root-instance.js.map +1 -1
- package/runtime/lib/element-template/runtime/patch.js.map +1 -1
- package/runtime/lib/element-template/runtime/render/create-rendered-host.js.map +1 -1
- package/runtime/lib/element-template/runtime/render/host.js.map +1 -1
- package/runtime/lib/element-template/runtime/render/render-components.js.map +1 -1
- package/runtime/lib/element-template/runtime/render/render-direct.js.map +1 -1
- package/runtime/lib/element-template/runtime/render/render-main-thread.js.map +1 -1
- package/runtime/lib/element-template/runtime/template/attr-slot-plan.js.map +1 -1
- package/runtime/lib/element-template/runtime/template/handle.js.map +1 -1
- package/runtime/lib/element-template/runtime/template/main-thread-background-function.js.map +1 -1
- 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-event-ctx.js.map +1 -1
- package/runtime/lib/element-template/runtime/template/main-thread-function.js.map +1 -1
- package/runtime/lib/element-template/runtime/template/main-thread-ref-ctx.js.map +1 -1
- package/runtime/lib/element-template/runtime/template/registry.js.map +1 -1
- package/runtime/lib/element-template/runtime/template/typed-attributes.js.map +1 -1
- package/runtime/lib/element-template/runtime-marker.js.map +1 -1
- package/runtime/lib/index.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/lynx-api.d.ts +34 -0
- package/runtime/lib/lynx-api.js +21 -0
- package/runtime/lib/lynx-api.js.map +1 -1
- package/runtime/lib/lynx.js +4 -1
- package/runtime/lib/lynx.js.map +1 -1
- package/runtime/lib/root.js.map +1 -1
- package/runtime/lib/runtime-marker.js.map +1 -1
- package/runtime/lib/shared/attribute-name.js.map +1 -1
- package/runtime/lib/shared/component-stack.js.map +1 -1
- package/runtime/lib/shared/index-map.js.map +1 -1
- package/runtime/lib/shared/profile.js.map +1 -1
- package/runtime/lib/shared/render-constants.js.map +1 -1
- package/runtime/lib/snapshot/alog/elementPAPICall.js.map +1 -1
- package/runtime/lib/snapshot/alog/index.js.map +1 -1
- package/runtime/lib/snapshot/alog/render.js.map +1 -1
- package/runtime/lib/snapshot/compat/componentIs.js.map +1 -1
- package/runtime/lib/snapshot/debug/debug.js.map +1 -1
- package/runtime/lib/snapshot/debug/describeInvalidValue.js.map +1 -1
- package/runtime/lib/snapshot/debug/formatPatch.js.map +1 -1
- package/runtime/lib/snapshot/debug/printSnapshot.js.map +1 -1
- package/runtime/lib/snapshot/debug/profileHooks.js.map +1 -1
- package/runtime/lib/snapshot/debug/vnodeSource.js.map +1 -1
- package/runtime/lib/snapshot/gesture/processGesture.js.map +1 -1
- package/runtime/lib/snapshot/gesture/processGestureBagkround.js.map +1 -1
- package/runtime/lib/snapshot/gesture/types.js.map +1 -1
- package/runtime/lib/snapshot/index.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/constant.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/destroy.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/event/delayEvents.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/event/delayLifecycleEvents.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/event/firstScreenSync.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/isRendering.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/patch/commit.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/patch/error.d.ts +11 -1
- package/runtime/lib/snapshot/lifecycle/patch/error.js +24 -16
- package/runtime/lib/snapshot/lifecycle/patch/error.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/patch/globalState.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/patch/isMainThreadHydrating.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/patch/nodesRefApply.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/patch/snapshotPatch.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/patch/snapshotPatchApply.d.ts +1 -1
- package/runtime/lib/snapshot/lifecycle/patch/snapshotPatchApply.js +29 -7
- package/runtime/lib/snapshot/lifecycle/patch/snapshotPatchApply.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/patch/updateMainThread.js +2 -2
- package/runtime/lib/snapshot/lifecycle/patch/updateMainThread.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/ref/delay.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/reload.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/render.js.map +1 -1
- package/runtime/lib/snapshot/list/list.js.map +1 -1
- package/runtime/lib/snapshot/list/listUpdateInfo.js.map +1 -1
- package/runtime/lib/snapshot/list/pendingListUpdates.js.map +1 -1
- package/runtime/lib/snapshot/lynx/calledByNative.js.map +1 -1
- package/runtime/lib/snapshot/lynx/children.d.ts +2 -0
- package/runtime/lib/snapshot/lynx/children.js.map +1 -1
- package/runtime/lib/snapshot/lynx/element.d.ts +8 -0
- package/runtime/lib/snapshot/lynx/element.js +4 -0
- package/runtime/lib/snapshot/lynx/element.js.map +1 -1
- package/runtime/lib/snapshot/lynx/env.js.map +1 -1
- package/runtime/lib/snapshot/lynx/injectLepusMethods.js.map +1 -1
- package/runtime/lib/snapshot/lynx/lazyBundleConstants.js.map +1 -1
- package/runtime/lib/snapshot/lynx/nodesRef.js.map +1 -1
- package/runtime/lib/snapshot/lynx/performance.js.map +1 -1
- package/runtime/lib/snapshot/lynx/portals.js.map +1 -1
- package/runtime/lib/snapshot/lynx/portalsPending.js.map +1 -1
- package/runtime/lib/snapshot/lynx/prepareLazyBundleMTS.js.map +1 -1
- package/runtime/lib/snapshot/lynx/runWithForce.js.map +1 -1
- package/runtime/lib/snapshot/lynx/suspense.js.map +1 -1
- package/runtime/lib/snapshot/lynx/tt.js.map +1 -1
- package/runtime/lib/snapshot/renderToOpcodes/hydrate.js.map +1 -1
- package/runtime/lib/snapshot/renderToOpcodes/index.js.map +1 -1
- package/runtime/lib/snapshot/renderToOpcodes/opcodes.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/backgroundSnapshot.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/constants.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/definition.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/dynamicPartType.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/event.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/gesture.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/index.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/list.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/platformInfo.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/reconstructInstanceTree.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/ref.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/snapshot.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/snapshotCreatorMap.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/snapshotInstanceHydrationMap.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/snapshotInstanceManager.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/spread.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/types.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/utils.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/workletEvent.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/workletRef.js.map +1 -1
- package/runtime/lib/snapshot/worklet/call/runOnMainThread.d.ts +2 -0
- package/runtime/lib/snapshot/worklet/call/runOnMainThread.js +2 -0
- package/runtime/lib/snapshot/worklet/call/runOnMainThread.js.map +1 -1
- package/runtime/lib/snapshot/worklet/ctx.js.map +1 -1
- package/runtime/lib/snapshot/worklet/destroy.js.map +1 -1
- package/runtime/lib/snapshot/worklet/functionality.js.map +1 -1
- package/runtime/lib/snapshot/worklet/hmr.js.map +1 -1
- package/runtime/lib/snapshot/worklet/ref/updateInitValue.js.map +1 -1
- package/runtime/lib/tsconfig.tsbuildinfo +1 -1
- package/runtime/lib/utils.js.map +1 -1
- package/runtime/lib/worklet-runtime/api/animation/animation.js.map +1 -1
- package/runtime/lib/worklet-runtime/api/animation/effect.js.map +1 -1
- package/runtime/lib/worklet-runtime/api/element.js.map +1 -1
- package/runtime/lib/worklet-runtime/api/lepusQuerySelector.js.map +1 -1
- package/runtime/lib/worklet-runtime/api/lynxApi.js.map +1 -1
- package/runtime/lib/worklet-runtime/bindings/bindings.d.ts +3 -3
- package/runtime/lib/worklet-runtime/bindings/bindings.js +9 -1
- package/runtime/lib/worklet-runtime/bindings/bindings.js.map +1 -1
- package/runtime/lib/worklet-runtime/bindings/events.js.map +1 -1
- package/runtime/lib/worklet-runtime/bindings/index.d.ts +0 -1
- package/runtime/lib/worklet-runtime/bindings/index.js +0 -1
- package/runtime/lib/worklet-runtime/bindings/index.js.map +1 -1
- package/runtime/lib/worklet-runtime/bindings/observers.js.map +1 -1
- package/runtime/lib/worklet-runtime/bindings/types.d.ts +3 -6
- package/runtime/lib/worklet-runtime/bindings/types.js.map +1 -1
- package/runtime/lib/worklet-runtime/delayRunOnBackground.js.map +1 -1
- package/runtime/lib/worklet-runtime/delayWorkletEvent.js.map +1 -1
- package/runtime/lib/worklet-runtime/eomImpl.js.map +1 -1
- package/runtime/lib/worklet-runtime/eventPropagation.js.map +1 -1
- package/runtime/lib/worklet-runtime/global.js.map +1 -1
- package/runtime/lib/worklet-runtime/hydrate.js +26 -7
- package/runtime/lib/worklet-runtime/hydrate.js.map +1 -1
- package/runtime/lib/worklet-runtime/index.js +6 -0
- package/runtime/lib/worklet-runtime/index.js.map +1 -1
- package/runtime/lib/worklet-runtime/jsFunctionLifecycle.js.map +1 -1
- package/runtime/lib/worklet-runtime/listeners.js.map +1 -1
- package/runtime/lib/worklet-runtime/mainThreadObject.d.ts +8 -0
- package/runtime/lib/worklet-runtime/mainThreadObject.js +67 -0
- package/runtime/lib/worklet-runtime/mainThreadObject.js.map +1 -0
- package/runtime/lib/worklet-runtime/runOnMainThread.js.map +1 -1
- package/runtime/lib/worklet-runtime/utils/mainThreadFlushLoopGuard.js.map +1 -1
- package/runtime/lib/worklet-runtime/utils/profile.js.map +1 -1
- package/runtime/lib/worklet-runtime/utils/version.js.map +1 -1
- package/runtime/lib/worklet-runtime/workletRef.d.ts +11 -7
- package/runtime/lib/worklet-runtime/workletRef.js +72 -9
- package/runtime/lib/worklet-runtime/workletRef.js.map +1 -1
- package/runtime/lib/worklet-runtime/workletRuntime.js +68 -9
- package/runtime/lib/worklet-runtime/workletRuntime.js.map +1 -1
- package/runtime/package.json +2 -3
- package/runtime/src/core/background-function/run-on-background.ts +16 -0
- package/runtime/src/core/capture-main-thread-object.ts +17 -0
- package/runtime/src/core/globalProps.ts +2 -0
- package/runtime/src/core/hooks/react.ts +4 -0
- package/runtime/src/core/hooks/useLynxGlobalEventListener.ts +2 -0
- package/runtime/src/core/initData.ts +2 -0
- package/runtime/src/core/main-thread-object-handle-registry.ts +25 -0
- package/runtime/src/core/main-thread-object.ts +380 -0
- package/runtime/src/core/main-thread-ref-id.ts +16 -0
- package/runtime/src/core/main-thread-ref-init-value.ts +12 -4
- package/runtime/src/core/main-thread-ref.ts +7 -8
- package/runtime/src/element-template/background/commit-hook.ts +1 -1
- package/runtime/src/element-template/index.ts +6 -0
- package/runtime/src/element-template/internal.ts +2 -1
- package/runtime/src/element-template/protocol/types.ts +1 -1
- package/runtime/src/internal.ts +1 -1
- package/runtime/src/lynx-api.ts +38 -0
- package/runtime/src/lynx.ts +5 -1
- package/runtime/src/snapshot/lifecycle/patch/error.ts +36 -19
- package/runtime/src/snapshot/lifecycle/patch/snapshotPatchApply.ts +29 -7
- package/runtime/src/snapshot/lifecycle/patch/updateMainThread.ts +2 -2
- package/runtime/src/snapshot/lynx/children.ts +2 -0
- package/runtime/src/snapshot/lynx/element.ts +8 -0
- package/runtime/src/snapshot/worklet/call/runOnMainThread.ts +2 -0
- package/runtime/src/snapshot/worklet/ref/updateInitValue.ts +1 -1
- package/runtime/src/worklet-runtime/bindings/bindings.ts +17 -2
- package/runtime/src/worklet-runtime/bindings/index.ts +0 -1
- package/runtime/src/worklet-runtime/bindings/types.ts +7 -11
- package/runtime/src/worklet-runtime/hydrate.ts +43 -10
- package/runtime/src/worklet-runtime/index.ts +7 -0
- package/runtime/src/worklet-runtime/mainThreadObject.ts +117 -0
- package/runtime/src/worklet-runtime/workletRef.ts +120 -19
- package/runtime/src/worklet-runtime/workletRuntime.ts +83 -11
- package/runtime/tsconfig.json +2 -0
- package/runtime/vitest.config.ts +4 -0
- package/testing-library/.turbo/turbo-build.log +11 -11
- package/testing-library/dist/env/index.js +3 -15
- package/testing-library/dist/index.d.ts +165 -2
- package/testing-library/dist/plugins/index.js +10 -0
- package/testing-library/dist/rstest-config.js +15 -0
- package/testing-library/dist/setupFiles/common/worklet-runtime-init.js +11 -0
- package/testing-library/package.json +2 -1
- package/testing-library/rstest.config.ts +3 -0
- package/testing-library/src/__tests__/lynx.test.jsx +1 -1
- package/testing-library/src/__tests__/rstest-config.test.js +34 -1
- package/testing-library/src/__tests__/worklet.test.jsx +87 -33
- package/testing-library/src/plugins/vitest.ts +5 -1
- package/testing-library/src/rstest-config.ts +17 -1
- package/testing-library/src/setupFiles/common/worklet-runtime-init.js +22 -0
- package/testing-library/tsconfig.docs.json +9 -0
- package/testing-library/typedoc.json +22 -0
- package/transform/.turbo/turbo-build$colon$wasm.log +135 -73
- package/transform/__test__/defines.spec.js +80 -12
- package/transform/__test__/fixture.spec.js +231 -71
- package/transform/__test__/object-methods.spec.js +82 -0
- package/transform/crates/swc_plugin_worklet/decl_collect.rs +10 -0
- package/transform/crates/swc_plugin_worklet/extract_ident.rs +14 -0
- package/transform/crates/swc_plugin_worklet/gen_stmt.rs +228 -13
- package/transform/crates/swc_plugin_worklet/lib.rs +599 -150
- package/transform/crates/swc_plugin_worklet/napi.rs +10 -1
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_capture_env_js.js +8 -1
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_capture_env_lepus.js +12 -7
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_expose_object_method_capture_channels_js.js +27 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_expose_object_method_capture_channels_lepus.js +43 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_extract_ident_from_this_lepus.js +2 -4
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_extract_member_expr_2_js.js +16 -14
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_extract_member_expr_2_lepus.js +18 -18
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_extract_member_expr_3_lepus.js +3 -5
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_extract_member_expr_4_lepus.js +2 -4
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_extract_member_expr_js.js +7 -5
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_extract_member_expr_lepus.js +9 -9
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_not_capture_computed_object_method_key_lepus.js +22 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_not_capture_globals.js +2 -4
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_not_capture_object_method_local_decls_lepus.js +14 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_not_capture_type_annotations.js +2 -4
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_not_destructure_from_closure.js +2 -4
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_not_extract_catch_clause_params.js +2 -4
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_not_extract_idents_inside_of_ctx.js +2 -4
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_not_transform_recursively.js +2 -4
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_preserve_main_thread_objects_in_class_js.js +42 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_preserve_main_thread_objects_in_class_lepus.js +58 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_skip_shared_identifiers_lepus.js +2 -4
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_arrow_function.js +2 -4
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_fn_decl_lepus.js +2 -4
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_function_expr.js +2 -4
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_in_class_lepus.js +2 -4
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_in_class_property_lepus.js +2 -4
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_in_class_static_lepus.js +2 -4
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_in_class_static_property_lepus.js +2 -4
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_js.js +3 -1
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_js_fn_in_run_on_js_lepus.js +2 -4
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_lepus.js +5 -5
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_lepus_alias.js +2 -4
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_lepus_general.js +2 -4
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_lepus_general_mixed.js +2 -4
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_multiple_worklets.js +3 -5
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_multiple_worklets_in_func.js +3 -5
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_object_methods_js.js +9 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_object_methods_lepus.js +14 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_ui_worklet_lepus.js +2 -4
- package/transform/dist/wasm.cjs +1 -1
- package/transform/index.d.ts +25 -1
- package/transform/rspack-napi/tsconfig.tsbuildinfo +1 -1
- package/transform/src/lib.rs +193 -23
- package/transform/swc-plugin-reactlynx/.turbo/turbo-build.log +63 -467
- package/transform/swc-plugin-reactlynx/swc_plugin_reactlynx.wasm +0 -0
- package/transform/swc-plugin-reactlynx-compat/.turbo/turbo-build.log +340 -28
- package/transform/swc-plugin-reactlynx-compat/swc_plugin_reactlynx_compat.wasm +0 -0
- package/transform/vitest.config.ts +5 -1
- package/types/react.docs.d.ts +130 -11
- package/runtime/lib/worklet-runtime/bindings/loadRuntime.d.ts +0 -8
- package/runtime/lib/worklet-runtime/bindings/loadRuntime.js +0 -23
- package/runtime/lib/worklet-runtime/bindings/loadRuntime.js.map +0 -1
- package/runtime/src/worklet-runtime/bindings/loadRuntime.ts +0 -25
- package/runtime/worklet-runtime/dev.js +0 -638
- package/runtime/worklet-runtime/main.js +0 -1
- package/testing-library/node_modules/.bin/rsbuild +0 -68
- package/testing-library/node_modules/.bin/rspeedy +0 -68
- package/testing-library/node_modules/.bin/rstest +0 -68
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_add_worklet_runtime_ident_with_inner_ident.js +0 -13
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_add_worklet_runtime_ident_with_outer_ident.js +0 -13
- package/transform/node_modules/.bin/esbuild +0 -59
- package/transform/node_modules/.bin/napi +0 -68
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Copyright 2026 The Lynx Authors. All rights reserved.
|
|
2
|
+
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
3
|
+
// LICENSE file in the root directory of this source tree.
|
|
4
|
+
// MIXED test modules can evaluate on the background thread. Initialize the
|
|
5
|
+
// emulated main-thread runtime, then restore the caller's thread.
|
|
6
|
+
const isBackground = !__MAIN_THREAD__;
|
|
7
|
+
globalThis.lynxTestingEnv.switchToMainThread();
|
|
8
|
+
try {
|
|
9
|
+
if (globalThis.lynxWorkletImpl === undefined) {
|
|
10
|
+
globalThis.onInitWorkletRuntime();
|
|
11
|
+
}
|
|
12
|
+
} finally {
|
|
13
|
+
if (isBackground) {
|
|
14
|
+
globalThis.lynxTestingEnv.switchToBackgroundThread();
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// Resolve the owner when registration runs: MIXED modules can import this entry
|
|
19
|
+
// before the main-thread globals are active.
|
|
20
|
+
export function registerWorklet(type, id, worklet) {
|
|
21
|
+
globalThis.registerWorkletInternal(type, id, worklet);
|
|
22
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://typedoc.org/schema.json",
|
|
3
|
+
"name": "@lynx-js/react/testing-library",
|
|
4
|
+
"entryPoints": [
|
|
5
|
+
"types/index.d.ts"
|
|
6
|
+
],
|
|
7
|
+
"tsconfig": "tsconfig.docs.json",
|
|
8
|
+
"intentionallyNotExported": [
|
|
9
|
+
"ElementTreeGlobals",
|
|
10
|
+
"EventType_2",
|
|
11
|
+
"FireObject_2",
|
|
12
|
+
"Indent",
|
|
13
|
+
"LynxElement",
|
|
14
|
+
"LynxEnv",
|
|
15
|
+
"LynxGlobalThis",
|
|
16
|
+
"PluginOptions",
|
|
17
|
+
"Print",
|
|
18
|
+
"Test",
|
|
19
|
+
"ThemeReceived",
|
|
20
|
+
"initElementTree"
|
|
21
|
+
]
|
|
22
|
+
}
|
|
@@ -1,26 +1,88 @@
|
|
|
1
1
|
$ node ./scripts/build_wasm.js
|
|
2
2
|
Blocking waiting for file lock on package cache
|
|
3
3
|
Blocking waiting for file lock on package cache
|
|
4
|
+
Blocking waiting for file lock on package cache
|
|
4
5
|
Downloading crates ...
|
|
5
|
-
Downloaded futures-core v0.3.33
|
|
6
|
-
Downloaded convert_case v0.6.0
|
|
7
|
-
Downloaded futures-task v0.3.33
|
|
8
6
|
Downloaded bitflags v1.3.2
|
|
7
|
+
Downloaded block-buffer v0.12.1
|
|
8
|
+
Downloaded arrayvec v0.7.8
|
|
9
|
+
Downloaded browserslist-rs v0.20.0
|
|
10
|
+
Downloaded napi-sys v2.4.0
|
|
11
|
+
Downloaded crypto-common v0.2.2
|
|
9
12
|
Downloaded ctor v0.1.26
|
|
10
13
|
Downloaded napi-build v2.3.2
|
|
11
|
-
Downloaded
|
|
12
|
-
Downloaded
|
|
14
|
+
Downloaded path-clean v1.0.1
|
|
15
|
+
Downloaded pathdiff v0.2.3
|
|
16
|
+
Downloaded radix_fmt v1.0.0
|
|
17
|
+
Downloaded convert_case v0.6.0
|
|
18
|
+
Downloaded fixedbitset v0.5.7
|
|
19
|
+
Downloaded foldhash v0.1.5
|
|
20
|
+
Downloaded foldhash v0.2.0
|
|
21
|
+
Downloaded hybrid-array v0.4.13
|
|
22
|
+
Downloaded lru v0.18.4
|
|
23
|
+
Downloaded precomputed-map v0.2.0
|
|
24
|
+
Downloaded preset_env_base v9.0.0
|
|
25
|
+
Downloaded browserslist-data v0.2.0
|
|
26
|
+
Downloaded const-oid v0.10.2
|
|
27
|
+
Downloaded cpufeatures v0.3.0
|
|
28
|
+
Downloaded crossbeam-utils v0.8.22
|
|
29
|
+
Downloaded dashmap v6.2.1
|
|
30
|
+
Downloaded digest v0.11.3
|
|
31
|
+
Downloaded getrandom v0.3.4
|
|
32
|
+
Downloaded globset v0.4.19
|
|
33
|
+
Downloaded iana-time-zone v0.1.65
|
|
34
|
+
Downloaded napi v2.10.4
|
|
13
35
|
Downloaded napi-derive v2.9.3
|
|
14
36
|
Downloaded napi-derive-backend v1.0.40
|
|
15
|
-
Downloaded
|
|
16
|
-
Downloaded
|
|
17
|
-
Downloaded
|
|
18
|
-
Downloaded
|
|
37
|
+
Downloaded sha1 v0.10.7
|
|
38
|
+
Downloaded sha2 v0.11.0
|
|
39
|
+
Downloaded st-map v0.2.4
|
|
40
|
+
Downloaded static-map-macro v0.3.4
|
|
41
|
+
Downloaded chrono v0.4.45
|
|
42
|
+
Downloaded hashbrown v0.16.1
|
|
43
|
+
Downloaded itertools v0.15.0
|
|
44
|
+
Downloaded jsonc-parser v0.26.3
|
|
45
|
+
Downloaded nom v8.0.0
|
|
46
|
+
Downloaded par-iter v2.0.0
|
|
47
|
+
Downloaded ryu-js v1.0.3
|
|
48
|
+
Downloaded bstr v1.13.0
|
|
49
|
+
Downloaded regress v0.11.1
|
|
50
|
+
Downloaded swc_compiler_base v64.0.0
|
|
51
|
+
Downloaded swc_ecma_regexp_ast v3.0.0
|
|
52
|
+
Downloaded swc_ecma_regexp_visit v0.15.0
|
|
53
|
+
Downloaded petgraph v0.7.1
|
|
54
|
+
Downloaded swc v75.0.1
|
|
55
|
+
Downloaded swc_config v6.0.0
|
|
56
|
+
Downloaded swc_config_macro v1.0.1
|
|
57
|
+
Downloaded swc_ecma_compat_common v45.0.0
|
|
58
|
+
Downloaded swc_ecma_compat_es2017 v50.0.0
|
|
59
|
+
Downloaded swc_ecma_compat_es2018 v51.0.0
|
|
60
|
+
Downloaded swc_ecma_compat_es2019 v50.0.0
|
|
61
|
+
Downloaded swc_ecma_compat_es2020 v53.0.0
|
|
62
|
+
Downloaded swc_ecma_compat_es2021 v50.0.0
|
|
63
|
+
Downloaded swc_ecma_compat_regexp v9.0.0
|
|
64
|
+
Downloaded swc_ecma_loader v27.0.0
|
|
65
|
+
Downloaded swc_ecma_preset_env v63.0.0
|
|
66
|
+
Downloaded swc_ecma_regexp_common v0.0.1
|
|
67
|
+
Downloaded swc_ecma_transformer v21.0.1
|
|
68
|
+
Downloaded swc_ecma_compat_bugfixes v56.0.0
|
|
69
|
+
Downloaded swc_ecma_compat_es2015 v55.0.0
|
|
70
|
+
Downloaded swc_ecma_compat_es2016 v50.0.0
|
|
71
|
+
Downloaded swc_ecma_hooks v1.0.0
|
|
72
|
+
Downloaded swc_ecma_regexp v0.15.0
|
|
73
|
+
Downloaded swc_ecma_minifier v61.0.4
|
|
74
|
+
Downloaded swc_ecma_transforms v62.0.0
|
|
75
|
+
Downloaded swc_ecma_transforms_macros v1.0.1
|
|
76
|
+
Downloaded swc_ecma_compat_es2022 v53.0.0
|
|
77
|
+
Downloaded swc_ecma_transforms_optimization v52.0.0
|
|
78
|
+
Downloaded swc_ecma_transforms_proposal v49.0.0
|
|
79
|
+
Downloaded swc_ecma_transforms_react v55.0.1
|
|
80
|
+
Downloaded swc_ecma_ext_transforms v35.0.0
|
|
81
|
+
Downloaded swc_ecma_transforms_classes v49.0.0
|
|
82
|
+
Downloaded swc_ecma_transforms_compat v57.0.1
|
|
83
|
+
Downloaded swc_ecma_transforms_typescript v55.0.1
|
|
84
|
+
Downloaded swc_node_comments v27.0.0
|
|
19
85
|
Downloaded version-compare v0.2.1
|
|
20
|
-
Downloaded wasm-bindgen-macro v0.2.126
|
|
21
|
-
Downloaded wasm-bindgen-macro-support v0.2.126
|
|
22
|
-
Downloaded wasm-bindgen-shared v0.2.126
|
|
23
|
-
Downloaded wasm-bindgen v0.2.126
|
|
24
86
|
Blocking waiting for file lock on package cache
|
|
25
87
|
Blocking waiting for file lock on build directory
|
|
26
88
|
Compiling cfg-if v1.0.4
|
|
@@ -31,8 +93,8 @@ $ node ./scripts/build_wasm.js
|
|
|
31
93
|
Compiling stable_deref_trait v1.2.1
|
|
32
94
|
Compiling memchr v2.8.3
|
|
33
95
|
Compiling zerofrom v0.1.8
|
|
34
|
-
Compiling foldhash v0.2.0
|
|
35
96
|
Compiling equivalent v1.0.2
|
|
97
|
+
Compiling foldhash v0.2.0
|
|
36
98
|
Compiling yoke v0.8.3
|
|
37
99
|
Compiling hashbrown v0.17.1
|
|
38
100
|
Compiling zerovec v0.11.6
|
|
@@ -43,9 +105,9 @@ $ node ./scripts/build_wasm.js
|
|
|
43
105
|
Compiling zmij v1.0.23
|
|
44
106
|
Compiling itoa v1.0.18
|
|
45
107
|
Compiling serde_json v1.0.151
|
|
46
|
-
Compiling litemap v0.8.2
|
|
47
108
|
Compiling tinystr v0.8.3
|
|
48
109
|
Compiling writeable v0.6.3
|
|
110
|
+
Compiling litemap v0.8.2
|
|
49
111
|
Compiling potential_utf v0.1.5
|
|
50
112
|
Compiling icu_locale_core v2.2.0
|
|
51
113
|
Compiling zerotrie v0.2.4
|
|
@@ -69,28 +131,28 @@ $ node ./scripts/build_wasm.js
|
|
|
69
131
|
Compiling tracing-core v0.1.36
|
|
70
132
|
Compiling percent-encoding v2.3.2
|
|
71
133
|
Compiling tap v1.0.1
|
|
72
|
-
Compiling idna v1.1.0
|
|
73
134
|
Compiling wyz v0.5.1
|
|
74
135
|
Compiling form_urlencoded v1.2.2
|
|
136
|
+
Compiling idna v1.1.0
|
|
75
137
|
Compiling anyhow v1.0.104
|
|
76
138
|
Compiling pin-project-lite v0.2.17
|
|
77
|
-
Compiling
|
|
139
|
+
Compiling bytes v1.12.1
|
|
78
140
|
Compiling funty v2.0.0
|
|
79
141
|
Compiling uuid v1.24.0
|
|
80
|
-
Compiling
|
|
142
|
+
Compiling outref v0.5.2
|
|
81
143
|
Compiling vsimd v0.8.0
|
|
82
|
-
Compiling base64-simd v0.8.0
|
|
83
144
|
Compiling bytes-str v0.2.8
|
|
84
145
|
Compiling bitvec v1.1.1
|
|
85
146
|
Compiling debugid v0.8.0
|
|
147
|
+
Compiling base64-simd v0.8.0
|
|
86
148
|
Compiling url v2.5.8
|
|
87
149
|
Compiling tracing v0.1.44
|
|
88
150
|
Compiling triomphe v0.1.16
|
|
89
|
-
Compiling unicode-id-start v1.4.0
|
|
90
|
-
Compiling if_chain v1.0.3
|
|
91
151
|
Compiling unicode-width v0.2.2
|
|
152
|
+
Compiling if_chain v1.0.3
|
|
92
153
|
Compiling data-encoding v2.11.0
|
|
93
154
|
Compiling new_debug_unreachable v1.0.6
|
|
155
|
+
Compiling unicode-id-start v1.4.0
|
|
94
156
|
Compiling hstr v4.0.0
|
|
95
157
|
Compiling num-integer v0.1.46
|
|
96
158
|
Compiling scoped-tls v1.0.1
|
|
@@ -98,127 +160,127 @@ $ node ./scripts/build_wasm.js
|
|
|
98
160
|
Compiling num-bigint v0.4.8
|
|
99
161
|
Compiling swc_atoms v10.0.0
|
|
100
162
|
Compiling parking_lot v0.12.5
|
|
101
|
-
Compiling swc_visit v2.0.2
|
|
102
163
|
Compiling swc_sourcemap v10.0.2
|
|
103
|
-
Compiling
|
|
164
|
+
Compiling swc_visit v2.0.2
|
|
104
165
|
Compiling siphasher v0.3.11
|
|
166
|
+
Compiling termcolor v1.4.1
|
|
105
167
|
Compiling bitflags v2.13.1
|
|
106
168
|
Compiling siphasher v1.0.3
|
|
107
|
-
Compiling phf_shared v0.11.3
|
|
108
|
-
Compiling phf v0.11.3
|
|
109
169
|
Compiling libc v0.2.189
|
|
110
170
|
Compiling dragonbox_ecma v0.1.12
|
|
171
|
+
Compiling phf_shared v0.11.3
|
|
111
172
|
Compiling par-core v2.0.0
|
|
112
173
|
Compiling num_cpus v1.17.0
|
|
174
|
+
Compiling phf v0.11.3
|
|
113
175
|
Compiling castaway v0.2.4
|
|
114
176
|
Compiling ryu v1.0.23
|
|
115
177
|
Compiling static_assertions v1.1.0
|
|
116
|
-
Compiling compact_str v0.7.1
|
|
117
178
|
Compiling aho-corasick v1.1.4
|
|
118
179
|
Compiling swc_common v26.0.0
|
|
180
|
+
Compiling compact_str v0.7.1
|
|
119
181
|
Compiling regex-syntax v0.8.11
|
|
120
182
|
Compiling swc_ecma_ast v29.0.0
|
|
121
183
|
Compiling regex-automata v0.4.16
|
|
122
184
|
Compiling typenum v1.20.1
|
|
123
185
|
Compiling swc_ecma_regexp_common v0.0.1
|
|
124
|
-
Compiling swc_ecma_regexp_ast v3.0.0
|
|
125
186
|
Compiling crossbeam-utils v0.8.22
|
|
187
|
+
Compiling swc_ecma_regexp_ast v3.0.0
|
|
126
188
|
Compiling swc_ecma_regexp_visit v0.15.0
|
|
127
189
|
Compiling dashmap v6.2.1
|
|
190
|
+
Compiling swc_ecma_compat_regexp v9.0.0
|
|
128
191
|
Compiling swc_ecma_regexp v0.15.0
|
|
129
192
|
Compiling swc_ecma_visit v29.0.0
|
|
130
193
|
Compiling swc_ecma_parser v45.1.1
|
|
131
194
|
Compiling regex v1.13.1
|
|
132
|
-
Compiling swc_ecma_compat_regexp v9.0.0
|
|
133
195
|
Compiling generic-array v0.14.7
|
|
134
|
-
Compiling bstr v1.13.0
|
|
135
196
|
Compiling hashbrown v0.16.1
|
|
136
|
-
Compiling
|
|
197
|
+
Compiling bstr v1.13.0
|
|
137
198
|
Compiling globset v0.4.19
|
|
199
|
+
Compiling regress v0.11.1
|
|
138
200
|
Compiling block-buffer v0.10.4
|
|
139
201
|
Compiling crypto-common v0.1.7
|
|
140
|
-
Compiling swc_config v6.0.0
|
|
141
202
|
Compiling digest v0.10.7
|
|
142
203
|
Compiling arrayvec v0.7.8
|
|
143
204
|
Compiling thiserror v1.0.69
|
|
144
205
|
Compiling owo-colors v4.3.0
|
|
145
206
|
Compiling semver v1.0.28
|
|
146
|
-
Compiling base64 v0.22.1
|
|
147
207
|
Compiling fixedbitset v0.5.7
|
|
148
|
-
Compiling swc_ecma_utils v35.0.0
|
|
149
|
-
Compiling swc_ecma_hooks v1.0.0
|
|
150
|
-
Compiling swc_ecma_transforms_base v49.0.1
|
|
151
208
|
Compiling unicode-linebreak v0.1.5
|
|
209
|
+
Compiling base64 v0.22.1
|
|
152
210
|
Compiling textwrap v0.16.2
|
|
211
|
+
Compiling swc_config v6.0.0
|
|
153
212
|
Compiling petgraph v0.7.1
|
|
154
|
-
Compiling swc_ecma_transformer v21.0.1
|
|
155
|
-
Compiling swc_ecma_transforms_classes v49.0.0
|
|
156
|
-
Compiling swc_ecma_compat_common v45.0.0
|
|
157
213
|
Compiling bumpalo v3.20.3
|
|
214
|
+
Compiling swc_ecma_utils v35.0.0
|
|
215
|
+
Compiling swc_ecma_hooks v1.0.0
|
|
158
216
|
Compiling thread_local v1.1.10
|
|
159
217
|
Compiling unicode-width v0.1.14
|
|
218
|
+
Compiling miette v7.6.0
|
|
219
|
+
Compiling swc_ecma_transforms_base v49.0.1
|
|
160
220
|
Compiling camino v1.2.4
|
|
161
221
|
Compiling swc_allocator v5.0.0
|
|
162
|
-
Compiling swc_ecma_compat_es2015 v55.0.0
|
|
163
|
-
Compiling swc_ecma_compat_es2022 v53.0.0
|
|
164
|
-
Compiling miette v7.6.0
|
|
165
|
-
Compiling swc_ecma_transforms_optimization v52.0.0
|
|
166
222
|
Compiling sha1 v0.10.7
|
|
167
223
|
Compiling chrono v0.4.45
|
|
168
|
-
Compiling syn v1.0.109
|
|
169
|
-
Compiling log v0.4.33
|
|
170
224
|
Compiling lazy_static v1.5.0
|
|
225
|
+
Compiling log v0.4.33
|
|
226
|
+
Compiling syn v1.0.109
|
|
171
227
|
Compiling ascii v1.1.0
|
|
172
228
|
Compiling swc_ecma_codegen v32.0.0
|
|
173
|
-
Compiling
|
|
174
|
-
Compiling
|
|
175
|
-
Compiling
|
|
176
|
-
Compiling
|
|
177
|
-
Compiling
|
|
178
|
-
Compiling
|
|
229
|
+
Compiling swc_ecma_transformer v21.0.1
|
|
230
|
+
Compiling swc_ecma_transforms_classes v49.0.0
|
|
231
|
+
Compiling swc_ecma_compat_common v45.0.0
|
|
232
|
+
Compiling swc_ecma_compat_es2015 v55.0.0
|
|
233
|
+
Compiling swc_ecma_compat_es2022 v53.0.0
|
|
234
|
+
Compiling swc_ecma_transforms_optimization v52.0.0
|
|
179
235
|
Compiling swc_ecma_compat_es2020 v53.0.0
|
|
180
|
-
Compiling
|
|
236
|
+
Compiling swc_ecma_compat_es2019 v50.0.0
|
|
237
|
+
Compiling swc_ecma_compat_bugfixes v56.0.0
|
|
181
238
|
Compiling swc_ecma_compat_es2021 v50.0.0
|
|
182
|
-
Compiling swc_ecma_compat_es2017 v50.0.0
|
|
183
239
|
Compiling swc_ecma_compat_es2018 v51.0.0
|
|
184
|
-
Compiling
|
|
240
|
+
Compiling swc_ecma_compat_es2016 v50.0.0
|
|
241
|
+
Compiling swc_ecma_compat_es2017 v50.0.0
|
|
242
|
+
Compiling browserslist-data v0.2.0
|
|
243
|
+
Compiling swc_ecma_transforms_react v55.0.1
|
|
244
|
+
Compiling tracing-log v0.2.0
|
|
245
|
+
Compiling sharded-slab v0.1.7
|
|
246
|
+
Compiling swc_error_reporters v28.0.0
|
|
185
247
|
Compiling matchers v0.2.0
|
|
186
248
|
Compiling itertools v0.15.0
|
|
187
249
|
Compiling cargo-platform v0.1.9
|
|
188
250
|
Compiling nom v8.0.0
|
|
189
251
|
Compiling diff v0.1.13
|
|
190
|
-
Compiling yansi v1.0.1
|
|
191
252
|
Compiling nu-ansi-term v0.50.3
|
|
192
|
-
Compiling
|
|
253
|
+
Compiling yansi v1.0.1
|
|
193
254
|
Compiling pretty_assertions v1.4.1
|
|
255
|
+
Compiling tracing-subscriber v0.3.23
|
|
194
256
|
Compiling st-map v0.2.4
|
|
195
257
|
Compiling cargo_metadata v0.18.1
|
|
196
258
|
Compiling browserslist-rs v0.20.0
|
|
197
|
-
Compiling swc_ecma_transforms_compat v57.0.1
|
|
198
259
|
Compiling swc_ecma_transforms_typescript v55.0.1
|
|
260
|
+
Compiling swc_ecma_transforms_compat v57.0.1
|
|
199
261
|
Compiling swc_ecma_transforms_proposal v49.0.0
|
|
200
262
|
Compiling par-iter v2.0.0
|
|
201
|
-
Compiling pathdiff v0.2.3
|
|
202
263
|
Compiling ryu-js v1.0.3
|
|
264
|
+
Compiling pathdiff v0.2.3
|
|
203
265
|
Compiling difference v2.0.0
|
|
204
266
|
Compiling radix_fmt v1.0.0
|
|
205
267
|
Compiling testing v27.0.0
|
|
268
|
+
Compiling swc_ecma_minifier v61.0.4
|
|
206
269
|
Compiling swc_ecma_transforms v62.0.0
|
|
207
270
|
Compiling preset_env_base v9.0.0
|
|
208
|
-
Compiling swc_ecma_minifier v61.0.4
|
|
209
271
|
Compiling swc_ecma_preset_env v63.0.0
|
|
210
272
|
Compiling sha2 v0.10.9
|
|
211
273
|
Compiling lru v0.18.4
|
|
212
|
-
Compiling
|
|
213
|
-
Compiling precomputed-map v0.2.0
|
|
214
|
-
Compiling hex v0.4.3
|
|
274
|
+
Compiling foldhash v0.1.5
|
|
215
275
|
Compiling fastrand v2.5.0
|
|
276
|
+
Compiling hex v0.4.3
|
|
216
277
|
Compiling unicode-segmentation v1.13.3
|
|
217
|
-
Compiling
|
|
278
|
+
Compiling path-clean v1.0.1
|
|
279
|
+
Compiling precomputed-map v0.2.0
|
|
280
|
+
Compiling swc_ecma_loader v27.0.0
|
|
218
281
|
Compiling convert_case v0.6.0
|
|
219
|
-
Compiling tempfile v3.27.0
|
|
220
282
|
Compiling swc_ecma_testing v27.0.0
|
|
221
|
-
Compiling
|
|
283
|
+
Compiling tempfile v3.27.0
|
|
222
284
|
Compiling swc_ecma_ext_transforms v35.0.0
|
|
223
285
|
Compiling swc_node_comments v27.0.0
|
|
224
286
|
Compiling swc_transform_common v20.0.0
|
|
@@ -234,31 +296,31 @@ $ node ./scripts/build_wasm.js
|
|
|
234
296
|
Compiling bitflags v1.3.2
|
|
235
297
|
Compiling napi v2.10.4
|
|
236
298
|
Compiling napi-derive v2.9.3
|
|
237
|
-
Compiling sha-1 v0.10.1
|
|
238
299
|
Compiling convert_case v0.11.0
|
|
300
|
+
Compiling sha-1 v0.10.1
|
|
239
301
|
Compiling sugar_path v1.2.1
|
|
240
|
-
Compiling swc_plugins_shared v0.1.0 (/home/runner/work/lynx-stack/lynx-stack/packages/react/transform/crates/swc_plugins_shared)
|
|
241
302
|
Compiling hybrid-array v0.4.13
|
|
242
|
-
Compiling
|
|
303
|
+
Compiling swc_plugins_shared v0.1.0 (/home/runner/work/lynx-stack/lynx-stack/packages/react/transform/crates/swc_plugins_shared)
|
|
243
304
|
Compiling block-buffer v0.12.1
|
|
305
|
+
Compiling crypto-common v0.2.2
|
|
244
306
|
Compiling const-oid v0.10.2
|
|
245
307
|
Compiling napi-build v2.3.2
|
|
246
308
|
Compiling digest v0.11.3
|
|
247
|
-
Compiling getrandom v0.4.3
|
|
248
309
|
Compiling sha2 v0.11.0
|
|
249
310
|
Compiling react-transform v0.0.0 (/home/runner/work/lynx-stack/lynx-stack/packages/react/transform)
|
|
311
|
+
Compiling getrandom v0.4.3
|
|
250
312
|
Compiling swc_plugin_snapshot v0.1.0 (/home/runner/work/lynx-stack/lynx-stack/packages/react/transform/crates/swc_plugin_snapshot)
|
|
251
313
|
Compiling swc_plugin_define_dce v0.1.0 (/home/runner/work/lynx-stack/lynx-stack/packages/react/transform/crates/swc_plugin_define_dce)
|
|
252
314
|
Compiling swc_plugin_directive_dce v0.1.0 (/home/runner/work/lynx-stack/lynx-stack/packages/react/transform/crates/swc_plugin_directive_dce)
|
|
253
315
|
Compiling swc_plugin_element_template v0.1.0 (/home/runner/work/lynx-stack/lynx-stack/packages/react/transform/crates/swc_plugin_element_template)
|
|
254
316
|
Compiling swc_plugin_list v0.1.0 (/home/runner/work/lynx-stack/lynx-stack/packages/react/transform/crates/swc_plugin_list)
|
|
255
|
-
Compiling
|
|
256
|
-
Compiling swc_plugin_inject v0.1.0 (/home/runner/work/lynx-stack/lynx-stack/packages/react/transform/crates/swc_plugin_inject)
|
|
317
|
+
Compiling swc_plugin_css_scope v0.1.0 (/home/runner/work/lynx-stack/lynx-stack/packages/react/transform/crates/swc_plugin_css_scope)
|
|
257
318
|
Compiling swc_plugin_dynamic_import v0.1.0 (/home/runner/work/lynx-stack/lynx-stack/packages/react/transform/crates/swc_plugin_dynamic_import)
|
|
319
|
+
Compiling swc_plugin_shake v0.1.0 (/home/runner/work/lynx-stack/lynx-stack/packages/react/transform/crates/swc_plugin_shake)
|
|
258
320
|
Compiling swc_plugin_text v0.1.0 (/home/runner/work/lynx-stack/lynx-stack/packages/react/transform/crates/swc_plugin_text)
|
|
321
|
+
Compiling swc_plugin_worklet v0.1.0 (/home/runner/work/lynx-stack/lynx-stack/packages/react/transform/crates/swc_plugin_worklet)
|
|
259
322
|
Compiling swc_plugin_compat v0.1.0 (/home/runner/work/lynx-stack/lynx-stack/packages/react/transform/crates/swc_plugin_compat)
|
|
260
|
-
Compiling
|
|
261
|
-
Compiling swc_plugin_css_scope v0.1.0 (/home/runner/work/lynx-stack/lynx-stack/packages/react/transform/crates/swc_plugin_css_scope)
|
|
323
|
+
Compiling swc_plugin_inject v0.1.0 (/home/runner/work/lynx-stack/lynx-stack/packages/react/transform/crates/swc_plugin_inject)
|
|
262
324
|
Compiling swc_plugin_background_only v0.1.0 (/home/runner/work/lynx-stack/lynx-stack/packages/react/transform/crates/swc_plugin_background_only)
|
|
263
325
|
Compiling version-compare v0.2.1
|
|
264
|
-
Finished `release` profile [optimized] target(s) in
|
|
326
|
+
Finished `release` profile [optimized] target(s) in 6m 40s
|
|
@@ -125,18 +125,29 @@ describe('collected defines', () => {
|
|
|
125
125
|
],
|
|
126
126
|
"definesForWorklet": [
|
|
127
127
|
{
|
|
128
|
-
"code": "
|
|
129
|
-
__workletRuntimeLoaded && registerWorkletInternal("main-thread", "d3dd:test:1", function(e) {
|
|
128
|
+
"code": "__registerWorklet("main-thread", "d3dd:test:1", function(e) {
|
|
130
129
|
const onScroll = lynxWorkletImpl._workletMap["d3dd:test:1"].bind(this);
|
|
131
130
|
let { label } = this["_c"];
|
|
132
|
-
'main thread';
|
|
133
131
|
console.info(label, e);
|
|
134
132
|
});
|
|
135
133
|
",
|
|
136
134
|
"id": "d3dd:test:1",
|
|
135
|
+
"imports": [
|
|
136
|
+
{
|
|
137
|
+
"imported": "registerWorklet",
|
|
138
|
+
"local": "__registerWorklet",
|
|
139
|
+
"source": "@lynx-js/react/worklet-runtime/init",
|
|
140
|
+
},
|
|
141
|
+
],
|
|
142
|
+
"runtimeRequirements": {
|
|
143
|
+
"mainThreadProgrammability": true,
|
|
144
|
+
},
|
|
137
145
|
},
|
|
138
146
|
],
|
|
139
147
|
"errors": [],
|
|
148
|
+
"runtimeRequirements": {
|
|
149
|
+
"mainThreadProgrammability": false,
|
|
150
|
+
},
|
|
140
151
|
"uiSourceMapRecords": [],
|
|
141
152
|
"warnings": [],
|
|
142
153
|
}
|
|
@@ -146,8 +157,17 @@ describe('collected defines', () => {
|
|
|
146
157
|
expect(result.definesForSnapshot).toHaveLength(1);
|
|
147
158
|
const [worklet] = result.definesForWorklet;
|
|
148
159
|
const [snapshot] = result.definesForSnapshot;
|
|
149
|
-
expect(worklet.code).toContain('
|
|
150
|
-
expect(worklet.
|
|
160
|
+
expect(worklet.code).toContain('__registerWorklet');
|
|
161
|
+
expect(worklet.imports).toEqual([{
|
|
162
|
+
source: '@lynx-js/react/worklet-runtime/init',
|
|
163
|
+
imported: 'registerWorklet',
|
|
164
|
+
local: '__registerWorklet',
|
|
165
|
+
}]);
|
|
166
|
+
expect(worklet.code).not.toContain('loadWorkletRuntime');
|
|
167
|
+
expect(worklet.runtimeRequirements).toEqual({
|
|
168
|
+
mainThreadProgrammability: true,
|
|
169
|
+
});
|
|
170
|
+
expect(result.runtimeRequirements.mainThreadProgrammability).toBe(false);
|
|
151
171
|
expect(worklet.code).toContain('this["_c"]');
|
|
152
172
|
expect(snapshot.id).toMatch(/^__snapshot_/);
|
|
153
173
|
expect(snapshot.code).toContain('ReactLynx.createSnapshot');
|
|
@@ -173,6 +193,48 @@ describe('collected defines', () => {
|
|
|
173
193
|
);
|
|
174
194
|
});
|
|
175
195
|
|
|
196
|
+
it.each(['JS', 'LEPUS'])('carries hygienic custom runtime imports with %s definitions', async target => {
|
|
197
|
+
const result = await transformReactLynx(
|
|
198
|
+
`
|
|
199
|
+
export function handler(__registerWorklet) {
|
|
200
|
+
'main thread';
|
|
201
|
+
return __registerWorklet + 1;
|
|
202
|
+
}
|
|
203
|
+
`,
|
|
204
|
+
options(target, {
|
|
205
|
+
worklet: { target, filename: 'test.jsx', runtimePkg: '@custom/react/internal' },
|
|
206
|
+
}),
|
|
207
|
+
);
|
|
208
|
+
expect(result.errors).toEqual([]);
|
|
209
|
+
const [definition] = result.definesForWorklet;
|
|
210
|
+
const [dependency] = definition.imports;
|
|
211
|
+
expect(dependency.source).toBe('@custom/react/worklet-runtime/init');
|
|
212
|
+
expect(dependency.imported).toBe('registerWorklet');
|
|
213
|
+
expect(definition.code).toContain(`${dependency.local}("main-thread"`);
|
|
214
|
+
const registrations = [];
|
|
215
|
+
new Function(dependency.local, definition.code)((...args) => registrations.push(args));
|
|
216
|
+
expect(registrations).toHaveLength(1);
|
|
217
|
+
// Execute the lowered body as well as the call site to catch capture by
|
|
218
|
+
// an authored parameter with the compiler's preferred helper name.
|
|
219
|
+
const [type, id, fn] = registrations[0];
|
|
220
|
+
expect(type).toBe('main-thread');
|
|
221
|
+
const oldImpl = globalThis.lynxWorkletImpl;
|
|
222
|
+
globalThis.lynxWorkletImpl = { _workletMap: { [id]: fn } };
|
|
223
|
+
try {
|
|
224
|
+
expect(fn.call({ _c: {} }, 41)).toBe(42);
|
|
225
|
+
} finally {
|
|
226
|
+
globalThis.lynxWorkletImpl = oldImpl;
|
|
227
|
+
}
|
|
228
|
+
if (target === 'JS') expect(result.code).not.toContain('/worklet-runtime/init');
|
|
229
|
+
const injected = await transformReactLynx(
|
|
230
|
+
`import { ${dependency.imported} as ${dependency.local} } from '${dependency.source}';\n${definition.code}`,
|
|
231
|
+
options('LEPUS'),
|
|
232
|
+
);
|
|
233
|
+
expect(injected.errors).toEqual([]);
|
|
234
|
+
expect(injected.definesForWorklet).toEqual([]);
|
|
235
|
+
expect(injected.code.match(/registerWorklet as/g)).toHaveLength(1);
|
|
236
|
+
});
|
|
237
|
+
|
|
176
238
|
it('hygienes each definition on its own', async () => {
|
|
177
239
|
const { definesForSnapshot } = await transformReactLynx(
|
|
178
240
|
source,
|
|
@@ -247,15 +309,23 @@ describe('legacy slot codegen', () => {
|
|
|
247
309
|
],
|
|
248
310
|
"definesForWorklet": [
|
|
249
311
|
{
|
|
250
|
-
"code": "
|
|
251
|
-
__workletRuntimeLoaded && registerWorkletInternal("main-thread", "d3dd:test:1", function(e) {
|
|
312
|
+
"code": "__registerWorklet("main-thread", "d3dd:test:1", function(e) {
|
|
252
313
|
const onScroll = lynxWorkletImpl._workletMap["d3dd:test:1"].bind(this);
|
|
253
314
|
let { label } = this["_c"];
|
|
254
|
-
'main thread';
|
|
255
315
|
console.info(label, e);
|
|
256
316
|
});
|
|
257
317
|
",
|
|
258
318
|
"id": "d3dd:test:1",
|
|
319
|
+
"imports": [
|
|
320
|
+
{
|
|
321
|
+
"imported": "registerWorklet",
|
|
322
|
+
"local": "__registerWorklet",
|
|
323
|
+
"source": "@lynx-js/react/worklet-runtime/init",
|
|
324
|
+
},
|
|
325
|
+
],
|
|
326
|
+
"runtimeRequirements": {
|
|
327
|
+
"mainThreadProgrammability": true,
|
|
328
|
+
},
|
|
259
329
|
},
|
|
260
330
|
],
|
|
261
331
|
}
|
|
@@ -289,13 +359,11 @@ function f() {
|
|
|
289
359
|
const result = await transformReactLynx(sharedSource, options('LEPUS'));
|
|
290
360
|
|
|
291
361
|
expect(result.code).toMatchInlineSnapshot(`
|
|
292
|
-
"import {
|
|
293
|
-
var loadWorkletRuntime = __loadWorkletRuntime;
|
|
362
|
+
"import { registerWorklet as __registerWorklet } from "@lynx-js/react/worklet-runtime/init";
|
|
294
363
|
import { Foo } from './foo.js' with {
|
|
295
364
|
runtime: 'shared'
|
|
296
365
|
};
|
|
297
|
-
|
|
298
|
-
__workletRuntimeLoaded && registerWorkletInternal("main-thread", "d3dd:test:1", function() {
|
|
366
|
+
__registerWorklet("main-thread", "d3dd:test:1", function() {
|
|
299
367
|
lynxWorkletImpl._workletMap["d3dd:test:1"].bind(this);
|
|
300
368
|
'main thread';
|
|
301
369
|
return new Foo();
|